diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swin.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swin.md
new file mode 100644
index 0000000000000000000000000000000000000000..e23c882a3f097aef0bcc3e04469ed0a3104be982
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swin.md
@@ -0,0 +1,107 @@
+
+
+# Swin Transformer
+
+## Overview
+
+The Swin Transformer was proposed in [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030)
+by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.
+
+The abstract from the paper is the following:
+
+*This paper presents a new vision Transformer, called Swin Transformer, that capably serves as a general-purpose backbone
+for computer vision. Challenges in adapting Transformer from language to vision arise from differences between the two domains,
+such as large variations in the scale of visual entities and the high resolution of pixels in images compared to words in text.
+To address these differences, we propose a hierarchical Transformer whose representation is computed with \bold{S}hifted
+\bold{win}dows. The shifted windowing scheme brings greater efficiency by limiting self-attention computation to non-overlapping
+local windows while also allowing for cross-window connection. This hierarchical architecture has the flexibility to model at
+various scales and has linear computational complexity with respect to image size. These qualities of Swin Transformer make it
+compatible with a broad range of vision tasks, including image classification (87.3 top-1 accuracy on ImageNet-1K) and dense
+prediction tasks such as object detection (58.7 box AP and 51.1 mask AP on COCO test-dev) and semantic segmentation
+(53.5 mIoU on ADE20K val). Its performance surpasses the previous state-of-the-art by a large margin of +2.7 box AP and
++2.6 mask AP on COCO, and +3.2 mIoU on ADE20K, demonstrating the potential of Transformer-based models as vision backbones.
+The hierarchical design and the shifted window approach also prove beneficial for all-MLP architectures.*
+
+
+
+ Swin Transformer architecture. Taken from the original paper .
+
+This model was contributed by [novice03](https://huggingface.co/novice03). The Tensorflow version of this model was contributed by [amyeroberts](https://huggingface.co/amyeroberts). The original code can be found [here](https://github.com/microsoft/Swin-Transformer).
+
+## Usage tips
+
+- Swin pads the inputs supporting any input height and width (if divisible by `32`).
+- Swin can be used as a *backbone*. When `output_hidden_states = True`, it will output both `hidden_states` and `reshaped_hidden_states`. The `reshaped_hidden_states` have a shape of `(batch, num_channels, height, width)` rather than `(batch_size, sequence_length, num_channels)`.
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with Swin Transformer.
+
+
+
+- [`SwinForImageClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
+- See also: [Image classification task guide](../tasks/image_classification)
+
+Besides that:
+
+- [`SwinForMaskedImageModeling`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining).
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## SwinConfig
+
+[[autodoc]] SwinConfig
+
+
+
+
+## SwinModel
+
+[[autodoc]] SwinModel
+ - forward
+
+## SwinForMaskedImageModeling
+
+[[autodoc]] SwinForMaskedImageModeling
+ - forward
+
+## SwinForImageClassification
+
+[[autodoc]] transformers.SwinForImageClassification
+ - forward
+
+
+
+
+## TFSwinModel
+
+[[autodoc]] TFSwinModel
+ - call
+
+## TFSwinForMaskedImageModeling
+
+[[autodoc]] TFSwinForMaskedImageModeling
+ - call
+
+## TFSwinForImageClassification
+
+[[autodoc]] transformers.TFSwinForImageClassification
+ - call
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swin2sr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swin2sr.md
new file mode 100644
index 0000000000000000000000000000000000000000..18d6635feffce2b968cbd2d2f5061801773d1bad
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swin2sr.md
@@ -0,0 +1,61 @@
+
+
+# Swin2SR
+
+## Overview
+
+The Swin2SR model was proposed in [Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration](https://arxiv.org/abs/2209.11345) by Marcos V. Conde, Ui-Jin Choi, Maxime Burchi, Radu Timofte.
+Swin2SR improves the [SwinIR](https://github.com/JingyunLiang/SwinIR/) model by incorporating [Swin Transformer v2](swinv2) layers which mitigates issues such as training instability, resolution gaps between pre-training
+and fine-tuning, and hunger on data.
+
+The abstract from the paper is the following:
+
+*Compression plays an important role on the efficient transmission and storage of images and videos through band-limited systems such as streaming services, virtual reality or videogames. However, compression unavoidably leads to artifacts and the loss of the original information, which may severely degrade the visual quality. For these reasons, quality enhancement of compressed images has become a popular research topic. While most state-of-the-art image restoration methods are based on convolutional neural networks, other transformers-based methods such as SwinIR, show impressive performance on these tasks.
+In this paper, we explore the novel Swin Transformer V2, to improve SwinIR for image super-resolution, and in particular, the compressed input scenario. Using this method we can tackle the major issues in training transformer vision models, such as training instability, resolution gaps between pre-training and fine-tuning, and hunger on data. We conduct experiments on three representative tasks: JPEG compression artifacts removal, image super-resolution (classical and lightweight), and compressed image super-resolution. Experimental results demonstrate that our method, Swin2SR, can improve the training convergence and performance of SwinIR, and is a top-5 solution at the "AIM 2022 Challenge on Super-Resolution of Compressed Image and Video".*
+
+
+
+ Swin2SR architecture. Taken from the original paper.
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr).
+The original code can be found [here](https://github.com/mv-lab/swin2sr).
+
+## Resources
+
+Demo notebooks for Swin2SR can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Swin2SR).
+
+A demo Space for image super-resolution with SwinSR can be found [here](https://huggingface.co/spaces/jjourney1125/swin2sr).
+
+## Swin2SRImageProcessor
+
+[[autodoc]] Swin2SRImageProcessor
+ - preprocess
+
+## Swin2SRConfig
+
+[[autodoc]] Swin2SRConfig
+
+## Swin2SRModel
+
+[[autodoc]] Swin2SRModel
+ - forward
+
+## Swin2SRForImageSuperResolution
+
+[[autodoc]] Swin2SRForImageSuperResolution
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swinv2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swinv2.md
new file mode 100644
index 0000000000000000000000000000000000000000..25233dca33954554c92f177fe076a779e99f0be6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/swinv2.md
@@ -0,0 +1,62 @@
+
+
+# Swin Transformer V2
+
+## Overview
+
+The Swin Transformer V2 model was proposed in [Swin Transformer V2: Scaling Up Capacity and Resolution](https://arxiv.org/abs/2111.09883) by Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo.
+
+The abstract from the paper is the following:
+
+*Large-scale NLP models have been shown to significantly improve the performance on language tasks with no signs of saturation. They also demonstrate amazing few-shot capabilities like that of human beings. This paper aims to explore large-scale models in computer vision. We tackle three major issues in training and application of large vision models, including training instability, resolution gaps between pre-training and fine-tuning, and hunger on labelled data. Three main techniques are proposed: 1) a residual-post-norm method combined with cosine attention to improve training stability; 2) A log-spaced continuous position bias method to effectively transfer models pre-trained using low-resolution images to downstream tasks with high-resolution inputs; 3) A self-supervised pre-training method, SimMIM, to reduce the needs of vast labeled images. Through these techniques, this paper successfully trained a 3 billion-parameter Swin Transformer V2 model, which is the largest dense vision model to date, and makes it capable of training with images of up to 1,536ร1,536 resolution. It set new performance records on 4 representative vision tasks, including ImageNet-V2 image classification, COCO object detection, ADE20K semantic segmentation, and Kinetics-400 video action classification. Also note our training is much more efficient than that in Google's billion-level visual models, which consumes 40 times less labelled data and 40 times less training time.*
+
+This model was contributed by [nandwalritik](https://huggingface.co/nandwalritik).
+The original code can be found [here](https://github.com/microsoft/Swin-Transformer).
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with Swin Transformer v2.
+
+
+
+- [`Swinv2ForImageClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
+- See also: [Image classification task guide](../tasks/image_classification)
+
+Besides that:
+
+- [`Swinv2ForMaskedImageModeling`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining).
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## Swinv2Config
+
+[[autodoc]] Swinv2Config
+
+## Swinv2Model
+
+[[autodoc]] Swinv2Model
+ - forward
+
+## Swinv2ForMaskedImageModeling
+
+[[autodoc]] Swinv2ForMaskedImageModeling
+ - forward
+
+## Swinv2ForImageClassification
+
+[[autodoc]] transformers.Swinv2ForImageClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/switch_transformers.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/switch_transformers.md
new file mode 100644
index 0000000000000000000000000000000000000000..ca6748167f5e014f32448b3b62e0f5050f08ce1d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/switch_transformers.md
@@ -0,0 +1,71 @@
+
+
+# SwitchTransformers
+
+## Overview
+
+The SwitchTransformers model was proposed in [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://arxiv.org/abs/2101.03961) by William Fedus, Barret Zoph, Noam Shazeer.
+
+The Switch Transformer model uses a sparse T5 encoder-decoder architecture, where the MLP are replaced by a Mixture of Experts (MoE). A routing mechanism (top 1 in this case) associates each token to one of the expert, where each expert is a dense MLP. While switch transformers have a lot more weights than their equivalent dense models, the sparsity allows better scaling and better finetuning performance at scale.
+During a forward pass, only a fraction of the weights are used. The routing mechanism allows the model to select relevant weights on the fly which increases the model capacity without increasing the number of operations.
+
+The abstract from the paper is the following:
+
+*In deep learning, models typically reuse the same parameters for all inputs. Mixture of Experts (MoE) defies this and instead selects different parameters for each incoming example. The result is a sparsely-activated model -- with outrageous numbers of parameters -- but a constant computational cost. However, despite several notable successes of MoE, widespread adoption has been hindered by complexity, communication costs and training instability -- we address these with the Switch Transformer. We simplify the MoE routing algorithm and design intuitive improved models with reduced communication and computational costs. Our proposed training techniques help wrangle the instabilities and we show large sparse models may be trained, for the first time, with lower precision (bfloat16) formats. We design models based off T5-Base and T5-Large to obtain up to 7x increases in pre-training speed with the same computational resources. These improvements extend into multilingual settings where we measure gains over the mT5-Base version across all 101 languages. Finally, we advance the current scale of language models by pre-training up to trillion parameter models on the "Colossal Clean Crawled Corpus" and achieve a 4x speedup over the T5-XXL model.*
+
+This model was contributed by [Younes Belkada](https://huggingface.co/ybelkada) and [Arthur Zucker](https://huggingface.co/ArthurZ).
+The original code can be found [here](https://github.com/google/flaxformer/tree/main/flaxformer/architectures/moe).
+
+## Usage tips
+
+- SwitchTransformers uses the [`T5Tokenizer`], which can be loaded directly from each model's repository.
+- The released weights are pretrained on English [Masked Language Modeling](https://moon-ci-docs.huggingface.co/docs/transformers/pr_19323/en/glossary#general-terms) task, and should be finetuned.
+
+## Resources
+
+- [Translation task guide](../tasks/translation)
+- [Summarization task guide](../tasks/summarization)
+
+## SwitchTransformersConfig
+
+[[autodoc]] SwitchTransformersConfig
+
+## SwitchTransformersTop1Router
+
+[[autodoc]] SwitchTransformersTop1Router
+ - _compute_router_probabilities
+ - forward
+
+## SwitchTransformersSparseMLP
+
+[[autodoc]] SwitchTransformersSparseMLP
+ - forward
+
+## SwitchTransformersModel
+
+[[autodoc]] SwitchTransformersModel
+ - forward
+
+## SwitchTransformersForConditionalGeneration
+
+[[autodoc]] SwitchTransformersForConditionalGeneration
+ - forward
+
+## SwitchTransformersEncoderModel
+
+[[autodoc]] SwitchTransformersEncoderModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/t5.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/t5.md
new file mode 100644
index 0000000000000000000000000000000000000000..86a645512c6cde8a02c6f81eb2d61a91c0d037dd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/t5.md
@@ -0,0 +1,456 @@
+
+
+# T5
+
+
+
+## Overview
+
+The T5 model was presented in [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/pdf/1910.10683.pdf) by [Colin Raffel](https://huggingface.co/craffel), Noam Shazeer, [Adam Roberts](https://huggingface.co/adarob), Katherine Lee, Sharan Narang,
+Michael Matena, Yanqi Zhou, Wei Li, [Peter J. Liu](https://huggingface.co/peterjliu).
+
+The abstract from the paper is the following:
+
+*Transfer learning, where a model is first pre-trained on a data-rich task before being fine-tuned on a downstream
+task, has emerged as a powerful technique in natural language processing (NLP). The effectiveness of transfer learning
+has given rise to a diversity of approaches, methodology, and practice. In this paper, we explore the landscape of
+transfer learning techniques for NLP by introducing a unified framework that converts every language problem into a
+text-to-text format. Our systematic study compares pretraining objectives, architectures, unlabeled datasets, transfer
+approaches, and other factors on dozens of language understanding tasks. By combining the insights from our exploration
+with scale and our new "Colossal Clean Crawled Corpus", we achieve state-of-the-art results on many benchmarks covering
+summarization, question answering, text classification, and more. To facilitate future work on transfer learning for
+NLP, we release our dataset, pre-trained models, and code.*
+
+All checkpoints can be found on the [hub](https://huggingface.co/models?search=t5).
+
+This model was contributed by [thomwolf](https://huggingface.co/thomwolf). The original code can be found [here](https://github.com/google-research/text-to-text-transfer-transformer).
+
+## Usage tips
+
+- T5 is an encoder-decoder model pre-trained on a multi-task mixture of unsupervised and supervised tasks and for which
+each task is converted into a text-to-text format. T5 works well on a variety of tasks out-of-the-box by prepending a
+different prefix to the input corresponding to each task, e.g., for translation: *translate English to German: ...*,
+for summarization: *summarize: ...*.
+- The pretraining includes both supervised and self-supervised training. Supervised training is conducted on downstream tasks provided by the GLUE and SuperGLUE benchmarks (converting them into text-to-text tasks as explained above).
+- Self-supervised training uses corrupted tokens, by randomly removing 15% of the tokens and replacing them with individual sentinel tokens (if several consecutive tokens are marked for removal, the whole group is replaced with a single sentinel token). The input of the encoder is the corrupted sentence, the input of the decoder is the original sentence and the target is then the dropped out tokens delimited by their sentinel tokens.
+
+- T5 uses relative scalar embeddings. Encoder input padding can be done on the left and on the right.
+
+- See the [training](#training), [inference](#inference) and [resources](#resources) sections below for all details regarding usage.
+
+T5 comes in different sizes:
+
+- [google-t5/t5-small](https://huggingface.co/google-t5/t5-small)
+
+- [google-t5/t5-base](https://huggingface.co/google-t5/t5-base)
+
+- [google-t5/t5-large](https://huggingface.co/google-t5/t5-large)
+
+- [google-t5/t5-3b](https://huggingface.co/google-t5/t5-3b)
+
+- [google-t5/t5-11b](https://huggingface.co/google-t5/t5-11b).
+
+Based on the original T5 model, Google has released some follow-up works:
+
+- **T5v1.1**: T5v1.1 is an improved version of T5 with some architectural tweaks, and is pre-trained on C4 only without
+ mixing in the supervised tasks. Refer to the documentation of T5v1.1 which can be found [here](t5v1.1).
+
+- **mT5**: mT5 is a multilingual T5 model. It is pre-trained on the mC4 corpus, which includes 101 languages. Refer to
+ the documentation of mT5 which can be found [here](mt5).
+
+- **byT5**: byT5 is a T5 model pre-trained on byte sequences rather than SentencePiece subword token sequences. Refer
+ to the documentation of byT5 which can be found [here](byt5).
+
+- **UL2**: UL2 is a T5 like model pretrained on various denoising objectives
+
+- **Flan-T5**: Flan is a pretraining methods that is based on prompting. The Flan-T5 are T5 models trained on the Flan collection of
+ datasets which include: `taskmaster2`, `djaym7/wiki_dialog`, `deepmind/code_contests`, `lambada`, `gsm8k`, `aqua_rat`, `esnli`, `quasc` and `qed`.
+
+- **FLan-UL2** : the UL2 model finetuned using the "Flan" prompt tuning and dataset collection.
+
+- **UMT5**: UmT5 is a multilingual T5 model trained on an improved and refreshed mC4 multilingual corpus, 29 trillion characters across 107 language, using a new sampling method, UniMax. Refer to
+ the documentation of mT5 which can be found [here](umt5).
+
+## Training
+
+T5 is an encoder-decoder model and converts all NLP problems into a text-to-text format. It is trained using teacher
+forcing. This means that for training, we always need an input sequence and a corresponding target sequence. The input
+sequence is fed to the model using `input_ids`. The target sequence is shifted to the right, i.e., prepended by a
+start-sequence token and fed to the decoder using the `decoder_input_ids`. In teacher-forcing style, the target
+sequence is then appended by the EOS token and corresponds to the `labels`. The PAD token is hereby used as the
+start-sequence token. T5 can be trained / fine-tuned both in a supervised and unsupervised fashion.
+
+One can use [`T5ForConditionalGeneration`] (or the Tensorflow/Flax variant), which includes the
+language modeling head on top of the decoder.
+
+- Unsupervised denoising training
+
+In this setup, spans of the input sequence are masked by so-called sentinel tokens (*a.k.a* unique mask tokens) and
+the output sequence is formed as a concatenation of the same sentinel tokens and the *real* masked tokens. Each
+sentinel token represents a unique mask token for this sentence and should start with ``,
+``, ... up to ``. As a default, 100 sentinel tokens are available in
+[`T5Tokenizer`].
+
+For instance, the sentence "The cute dog walks in the park" with the masks put on "cute dog" and "the" should be
+processed as follows:
+
+```python
+>>> from transformers import T5Tokenizer, T5ForConditionalGeneration
+
+>>> tokenizer = T5Tokenizer.from_pretrained("google-t5/t5-small")
+>>> model = T5ForConditionalGeneration.from_pretrained("google-t5/t5-small")
+
+>>> input_ids = tokenizer("The walks in park", return_tensors="pt").input_ids
+>>> labels = tokenizer(" cute dog the ", return_tensors="pt").input_ids
+
+>>> # the forward function automatically creates the correct decoder_input_ids
+>>> loss = model(input_ids=input_ids, labels=labels).loss
+>>> loss.item()
+3.7837
+```
+
+If you're interested in pre-training T5 on a new corpus, check out the [run_t5_mlm_flax.py](https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling) script in the Examples
+directory.
+
+- Supervised training
+
+In this setup, the input sequence and output sequence are a standard sequence-to-sequence input-output mapping.
+Suppose that we want to fine-tune the model for translation for example, and we have a training example: the input
+sequence "The house is wonderful." and output sequence "Das Haus ist wunderbar.", then they should be prepared for
+the model as follows:
+
+```python
+>>> from transformers import T5Tokenizer, T5ForConditionalGeneration
+
+>>> tokenizer = T5Tokenizer.from_pretrained("google-t5/t5-small")
+>>> model = T5ForConditionalGeneration.from_pretrained("google-t5/t5-small")
+
+>>> input_ids = tokenizer("translate English to German: The house is wonderful.", return_tensors="pt").input_ids
+>>> labels = tokenizer("Das Haus ist wunderbar.", return_tensors="pt").input_ids
+
+>>> # the forward function automatically creates the correct decoder_input_ids
+>>> loss = model(input_ids=input_ids, labels=labels).loss
+>>> loss.item()
+0.2542
+```
+
+As you can see, only 2 inputs are required for the model in order to compute a loss: `input_ids` (which are the
+`input_ids` of the encoded input sequence) and `labels` (which are the `input_ids` of the encoded
+target sequence). The model will automatically create the `decoder_input_ids` based on the `labels`, by
+shifting them one position to the right and prepending the `config.decoder_start_token_id`, which for T5 is
+equal to 0 (i.e. the id of the pad token). Also note the task prefix: we prepend the input sequence with 'translate
+English to German: ' before encoding it. This will help in improving the performance, as this task prefix was used
+during T5's pre-training.
+
+However, the example above only shows a single training example. In practice, one trains deep learning models in
+batches. This entails that we must pad/truncate examples to the same length. For encoder-decoder models, one
+typically defines a `max_source_length` and `max_target_length`, which determine the maximum length of the
+input and output sequences respectively (otherwise they are truncated). These should be carefully set depending on
+the task.
+
+In addition, we must make sure that padding token id's of the `labels` are not taken into account by the loss
+function. In PyTorch and Tensorflow, this can be done by replacing them with -100, which is the `ignore_index`
+of the `CrossEntropyLoss`. In Flax, one can use the `decoder_attention_mask` to ignore padded tokens from
+the loss (see the [Flax summarization script](https://github.com/huggingface/transformers/tree/main/examples/flax/summarization) for details). We also pass
+`attention_mask` as additional input to the model, which makes sure that padding tokens of the inputs are
+ignored. The code example below illustrates all of this.
+
+```python
+>>> from transformers import T5Tokenizer, T5ForConditionalGeneration
+>>> import torch
+
+>>> tokenizer = T5Tokenizer.from_pretrained("google-t5/t5-small")
+>>> model = T5ForConditionalGeneration.from_pretrained("google-t5/t5-small")
+
+>>> # the following 2 hyperparameters are task-specific
+>>> max_source_length = 512
+>>> max_target_length = 128
+
+>>> # Suppose we have the following 2 training examples:
+>>> input_sequence_1 = "Welcome to NYC"
+>>> output_sequence_1 = "Bienvenue ร NYC"
+
+>>> input_sequence_2 = "HuggingFace is a company"
+>>> output_sequence_2 = "HuggingFace est une entreprise"
+
+>>> # encode the inputs
+>>> task_prefix = "translate English to French: "
+>>> input_sequences = [input_sequence_1, input_sequence_2]
+
+>>> encoding = tokenizer(
+... [task_prefix + sequence for sequence in input_sequences],
+... padding="longest",
+... max_length=max_source_length,
+... truncation=True,
+... return_tensors="pt",
+... )
+
+>>> input_ids, attention_mask = encoding.input_ids, encoding.attention_mask
+
+>>> # encode the targets
+>>> target_encoding = tokenizer(
+... [output_sequence_1, output_sequence_2],
+... padding="longest",
+... max_length=max_target_length,
+... truncation=True,
+... return_tensors="pt",
+... )
+>>> labels = target_encoding.input_ids
+
+>>> # replace padding token id's of the labels by -100 so it's ignored by the loss
+>>> labels[labels == tokenizer.pad_token_id] = -100
+
+>>> # forward pass
+>>> loss = model(input_ids=input_ids, attention_mask=attention_mask, labels=labels).loss
+>>> loss.item()
+0.188
+```
+
+Additional training tips:
+
+- T5 models need a slightly higher learning rate than the default one set in the `Trainer` when using the AdamW
+optimizer. Typically, 1e-4 and 3e-4 work well for most problems (classification, summarization, translation, question
+answering, question generation). Note that T5 was pre-trained using the AdaFactor optimizer.
+
+According to [this forum post](https://discuss.huggingface.co/t/t5-finetuning-tips/684), task prefixes matter when
+(1) doing multi-task training (2) your task is similar or related to one of the supervised tasks used in T5's
+pre-training mixture (see Appendix D of the [paper](https://arxiv.org/pdf/1910.10683.pdf) for the task prefixes
+used).
+
+If training on TPU, it is recommended to pad all examples of the dataset to the same length or make use of
+*pad_to_multiple_of* to have a small number of predefined bucket sizes to fit all examples in. Dynamically padding
+batches to the longest example is not recommended on TPU as it triggers a recompilation for every batch shape that is
+encountered during training thus significantly slowing down the training. only padding up to the longest example in a
+batch) leads to very slow training on TPU.
+
+## Inference
+
+At inference time, it is recommended to use [`~generation.GenerationMixin.generate`]. This
+method takes care of encoding the input and feeding the encoded hidden states via cross-attention layers to the decoder
+and auto-regressively generates the decoder output. Check out [this blog post](https://huggingface.co/blog/how-to-generate) to know all the details about generating text with Transformers.
+There's also [this blog post](https://huggingface.co/blog/encoder-decoder#encoder-decoder) which explains how
+generation works in general in encoder-decoder models.
+
+```python
+>>> from transformers import T5Tokenizer, T5ForConditionalGeneration
+
+>>> tokenizer = T5Tokenizer.from_pretrained("google-t5/t5-small")
+>>> model = T5ForConditionalGeneration.from_pretrained("google-t5/t5-small")
+
+>>> input_ids = tokenizer("translate English to German: The house is wonderful.", return_tensors="pt").input_ids
+>>> outputs = model.generate(input_ids)
+>>> print(tokenizer.decode(outputs[0], skip_special_tokens=True))
+Das Haus ist wunderbar.
+```
+
+Note that T5 uses the `pad_token_id` as the `decoder_start_token_id`, so when doing generation without using
+[`~generation.GenerationMixin.generate`], make sure you start it with the `pad_token_id`.
+
+The example above only shows a single example. You can also do batched inference, like so:
+
+```python
+>>> from transformers import T5Tokenizer, T5ForConditionalGeneration
+
+>>> tokenizer = T5Tokenizer.from_pretrained("google-t5/t5-small")
+>>> model = T5ForConditionalGeneration.from_pretrained("google-t5/t5-small")
+
+>>> task_prefix = "translate English to German: "
+>>> # use different length sentences to test batching
+>>> sentences = ["The house is wonderful.", "I like to work in NYC."]
+
+>>> inputs = tokenizer([task_prefix + sentence for sentence in sentences], return_tensors="pt", padding=True)
+
+>>> output_sequences = model.generate(
+... input_ids=inputs["input_ids"],
+... attention_mask=inputs["attention_mask"],
+... do_sample=False, # disable sampling to test if batching affects output
+... )
+
+>>> print(tokenizer.batch_decode(output_sequences, skip_special_tokens=True))
+['Das Haus ist wunderbar.', 'Ich arbeite gerne in NYC.']
+```
+
+Because T5 has been trained with the span-mask denoising objective,
+it can be used to predict the sentinel (masked-out) tokens during inference.
+The predicted tokens will then be placed between the sentinel tokens.
+
+```python
+>>> from transformers import T5Tokenizer, T5ForConditionalGeneration
+
+>>> tokenizer = T5Tokenizer.from_pretrained("google-t5/t5-small")
+>>> model = T5ForConditionalGeneration.from_pretrained("google-t5/t5-small")
+
+>>> input_ids = tokenizer("The walks in park", return_tensors="pt").input_ids
+
+>>> sequence_ids = model.generate(input_ids)
+>>> sequences = tokenizer.batch_decode(sequence_ids)
+>>> sequences
+[' park offers the park.']
+```
+
+## Performance
+
+If you'd like a faster training and inference performance, install [NVIDIA APEX](https://github.com/NVIDIA/apex#quick-start) for NVIDIA GPUs, or [ROCm APEX](https://github.com/ROCmSoftwarePlatform/apex) for AMD GPUs and then the model will automatically use `apex.normalization.FusedRMSNorm` instead of `T5LayerNorm`. The former uses an optimized fused kernel which is several times faster than the latter.
+
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with T5. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+
+
+- A notebook for how to [finetune T5 for classification and multiple choice](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb).
+- A notebook for how to [finetune T5 for sentiment span extraction](https://colab.research.google.com/github/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb). ๐
+
+
+
+- A notebook for how to [finetune T5 for named entity recognition](https://colab.research.google.com/drive/1obr78FY_cBmWY5ODViCmzdY6O1KB65Vc?usp=sharing). ๐
+
+
+
+- A notebook for [Finetuning CodeT5 for generating docstrings from Ruby code](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/T5/Fine_tune_CodeT5_for_generating_docstrings_from_Ruby_code.ipynb).
+
+
+
+- A notebook to [Finetune T5-base-dutch to perform Dutch abstractive summarization on a TPU](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/T5/Fine_tuning_Dutch_T5_base_on_CNN_Daily_Mail_for_summarization_(on_TPU_using_HuggingFace_Accelerate).ipynb).
+- A notebook for how to [finetune T5 for summarization in PyTorch and track experiments with WandB](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb#scrollTo=OKRpFvYhBauC). ๐
+- A blog post on [Distributed Training: Train BART/T5 for Summarization using ๐ค Transformers and Amazon SageMaker](https://huggingface.co/blog/sagemaker-distributed-training-seq2seq).
+- [`T5ForConditionalGeneration`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb).
+- [`TFT5ForConditionalGeneration`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb).
+- [`FlaxT5ForConditionalGeneration`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/summarization).
+- [Summarization](https://huggingface.co/course/chapter7/5?fw=pt#summarization) chapter of the ๐ค Hugging Face course.
+- [Summarization task guide](../tasks/summarization)
+
+
+
+- [`FlaxT5ForConditionalGeneration`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#t5-like-span-masked-language-modeling) for training T5 with a span-masked language model objective. The script also shows how to train a T5 tokenizer. [`FlaxT5ForConditionalGeneration`] is also supported by this [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/masked_language_modeling_flax.ipynb).
+
+
+
+- [`T5ForConditionalGeneration`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/translation) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation.ipynb).
+- [`TFT5ForConditionalGeneration`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/translation) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb).
+- [Translation task guide](../tasks/translation)
+
+
+
+- A notebook on how to [finetune T5 for question answering with TensorFlow 2](https://colab.research.google.com/github/snapthat/TF-T5-text-to-text/blob/master/snapthatT5/notebooks/TF-T5-Datasets%20Training.ipynb). ๐
+- A notebook on how to [finetune T5 for question answering on a TPU](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb#scrollTo=QLGiFCDqvuil).
+
+๐ **Deploy**
+- A blog post on how to deploy [T5 11B for inference for less than $500](https://www.philschmid.de/deploy-t5-11b).
+
+## T5Config
+
+[[autodoc]] T5Config
+
+## T5Tokenizer
+
+[[autodoc]] T5Tokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## T5TokenizerFast
+
+[[autodoc]] T5TokenizerFast
+
+
+
+
+## T5Model
+
+[[autodoc]] T5Model
+ - forward
+
+## T5ForConditionalGeneration
+
+[[autodoc]] T5ForConditionalGeneration
+ - forward
+
+## T5EncoderModel
+
+[[autodoc]] T5EncoderModel
+ - forward
+
+## T5ForSequenceClassification
+
+[[autodoc]] T5ForSequenceClassification
+ - forward
+
+## T5ForTokenClassification
+
+[[autodoc]] T5ForTokenClassification
+ - forward
+
+## T5ForQuestionAnswering
+
+[[autodoc]] T5ForQuestionAnswering
+ - forward
+
+
+
+
+## TFT5Model
+
+[[autodoc]] TFT5Model
+ - call
+
+## TFT5ForConditionalGeneration
+
+[[autodoc]] TFT5ForConditionalGeneration
+ - call
+
+## TFT5EncoderModel
+
+[[autodoc]] TFT5EncoderModel
+ - call
+
+
+
+
+## FlaxT5Model
+
+[[autodoc]] FlaxT5Model
+ - __call__
+ - encode
+ - decode
+
+## FlaxT5ForConditionalGeneration
+
+[[autodoc]] FlaxT5ForConditionalGeneration
+ - __call__
+ - encode
+ - decode
+
+## FlaxT5EncoderModel
+
+[[autodoc]] FlaxT5EncoderModel
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/t5v1.1.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/t5v1.1.md
new file mode 100644
index 0000000000000000000000000000000000000000..e18696f629df51c93af94f16d4365305e65d9875
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/t5v1.1.md
@@ -0,0 +1,71 @@
+
+
+# T5v1.1
+
+## Overview
+
+T5v1.1 was released in the [google-research/text-to-text-transfer-transformer](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#t511)
+repository by Colin Raffel et al. It's an improved version of the original T5 model.
+This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten). The original code can be
+found [here](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#t511).
+
+## Usage tips
+
+One can directly plug in the weights of T5v1.1 into a T5 model, like so:
+
+```python
+>>> from transformers import T5ForConditionalGeneration
+
+>>> model = T5ForConditionalGeneration.from_pretrained("google/t5-v1_1-base")
+```
+
+T5 Version 1.1 includes the following improvements compared to the original T5 model:
+
+- GEGLU activation in the feed-forward hidden layer, rather than ReLU. See [this paper](https://arxiv.org/abs/2002.05202).
+
+- Dropout was turned off in pre-training (quality win). Dropout should be re-enabled during fine-tuning.
+
+- Pre-trained on C4 only without mixing in the downstream tasks.
+
+- No parameter sharing between the embedding and classifier layer.
+
+- "xl" and "xxl" replace "3B" and "11B". The model shapes are a bit different - larger `d_model` and smaller
+ `num_heads` and `d_ff`.
+
+Note: T5 Version 1.1 was only pre-trained on [C4](https://huggingface.co/datasets/c4) excluding any supervised
+training. Therefore, this model has to be fine-tuned before it is usable on a downstream task, unlike the original T5
+model. Since t5v1.1 was pre-trained unsupervisedly, there's no real advantage to using a task prefix during single-task
+fine-tuning. If you are doing multi-task fine-tuning, you should use a prefix.
+
+Google has released the following variants:
+
+- [google/t5-v1_1-small](https://huggingface.co/google/t5-v1_1-small)
+
+- [google/t5-v1_1-base](https://huggingface.co/google/t5-v1_1-base)
+
+- [google/t5-v1_1-large](https://huggingface.co/google/t5-v1_1-large)
+
+- [google/t5-v1_1-xl](https://huggingface.co/google/t5-v1_1-xl)
+
+- [google/t5-v1_1-xxl](https://huggingface.co/google/t5-v1_1-xxl).
+
+
+
+
+Refer to [T5's documentation page](t5) for all API reference, tips, code examples and notebooks.
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/table-transformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/table-transformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..850e7f50aa610f9548c395ab37eaa2d9e681dd99
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/table-transformer.md
@@ -0,0 +1,67 @@
+
+
+# Table Transformer
+
+## Overview
+
+The Table Transformer model was proposed in [PubTables-1M: Towards comprehensive table extraction from unstructured documents](https://arxiv.org/abs/2110.00061) by
+Brandon Smock, Rohith Pesala, Robin Abraham. The authors introduce a new dataset, PubTables-1M, to benchmark progress in table extraction from unstructured documents,
+as well as table structure recognition and functional analysis. The authors train 2 [DETR](detr) models, one for table detection and one for table structure recognition, dubbed Table Transformers.
+
+The abstract from the paper is the following:
+
+*Recently, significant progress has been made applying machine learning to the problem of table structure inference and extraction from unstructured documents.
+However, one of the greatest challenges remains the creation of datasets with complete, unambiguous ground truth at scale. To address this, we develop a new, more
+comprehensive dataset for table extraction, called PubTables-1M. PubTables-1M contains nearly one million tables from scientific articles, supports multiple input
+modalities, and contains detailed header and location information for table structures, making it useful for a wide variety of modeling approaches. It also addresses a significant
+source of ground truth inconsistency observed in prior datasets called oversegmentation, using a novel canonicalization procedure. We demonstrate that these improvements lead to a
+significant increase in training performance and a more reliable estimate of model performance at evaluation for table structure recognition. Further, we show that transformer-based
+object detection models trained on PubTables-1M produce excellent results for all three tasks of detection, structure recognition, and functional analysis without the need for any
+special customization for these tasks.*
+
+
+
+ Table detection and table structure recognition clarified. Taken from the original paper .
+
+The authors released 2 models, one for [table detection](https://huggingface.co/microsoft/table-transformer-detection) in
+documents, one for [table structure recognition](https://huggingface.co/microsoft/table-transformer-structure-recognition)
+(the task of recognizing the individual rows, columns etc. in a table).
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code can be
+found [here](https://github.com/microsoft/table-transformer).
+
+## Resources
+
+
+
+- A demo notebook for the Table Transformer can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Table%20Transformer).
+- It turns out padding of images is quite important for detection. An interesting Github thread with replies from the authors can be found [here](https://github.com/microsoft/table-transformer/issues/68).
+
+## TableTransformerConfig
+
+[[autodoc]] TableTransformerConfig
+
+## TableTransformerModel
+
+[[autodoc]] TableTransformerModel
+ - forward
+
+## TableTransformerForObjectDetection
+
+[[autodoc]] TableTransformerForObjectDetection
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tapas.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tapas.md
new file mode 100644
index 0000000000000000000000000000000000000000..79bbe3e819cf864728baea5a5d556a42ca740202
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tapas.md
@@ -0,0 +1,634 @@
+
+
+# TAPAS
+
+## Overview
+
+The TAPAS model was proposed in [TAPAS: Weakly Supervised Table Parsing via Pre-training](https://www.aclweb.org/anthology/2020.acl-main.398)
+by Jonathan Herzig, Paweล Krzysztof Nowak, Thomas Mรผller, Francesco Piccinno and Julian Martin Eisenschlos. It's a BERT-based model specifically
+designed (and pre-trained) for answering questions about tabular data. Compared to BERT, TAPAS uses relative position embeddings and has 7
+token types that encode tabular structure. TAPAS is pre-trained on the masked language modeling (MLM) objective on a large dataset comprising
+millions of tables from English Wikipedia and corresponding texts.
+
+For question answering, TAPAS has 2 heads on top: a cell selection head and an aggregation head, for (optionally) performing aggregations (such as counting or summing) among selected cells. TAPAS has been fine-tuned on several datasets:
+- [SQA](https://www.microsoft.com/en-us/download/details.aspx?id=54253) (Sequential Question Answering by Microsoft)
+- [WTQ](https://github.com/ppasupat/WikiTableQuestions) (Wiki Table Questions by Stanford University)
+- [WikiSQL](https://github.com/salesforce/WikiSQL) (by Salesforce).
+
+It achieves state-of-the-art on both SQA and WTQ, while having comparable performance to SOTA on WikiSQL, with a much simpler architecture.
+
+The abstract from the paper is the following:
+
+*Answering natural language questions over tables is usually seen as a semantic parsing task. To alleviate the collection cost of full logical forms, one popular approach focuses on weak supervision consisting of denotations instead of logical forms. However, training semantic parsers from weak supervision poses difficulties, and in addition, the generated logical forms are only used as an intermediate step prior to retrieving the denotation. In this paper, we present TAPAS, an approach to question answering over tables without generating logical forms. TAPAS trains from weak supervision, and predicts the denotation by selecting table cells and optionally applying a corresponding aggregation operator to such selection. TAPAS extends BERT's architecture to encode tables as input, initializes from an effective joint pre-training of text segments and tables crawled from Wikipedia, and is trained end-to-end. We experiment with three different semantic parsing datasets, and find that TAPAS outperforms or rivals semantic parsing models by improving state-of-the-art accuracy on SQA from 55.1 to 67.2 and performing on par with the state-of-the-art on WIKISQL and WIKITQ, but with a simpler model architecture. We additionally find that transfer learning, which is trivial in our setting, from WIKISQL to WIKITQ, yields 48.7 accuracy, 4.2 points above the state-of-the-art.*
+
+In addition, the authors have further pre-trained TAPAS to recognize **table entailment**, by creating a balanced dataset of millions of automatically created training examples which are learned in an intermediate step prior to fine-tuning. The authors of TAPAS call this further pre-training intermediate pre-training (since TAPAS is first pre-trained on MLM, and then on another dataset). They found that intermediate pre-training further improves performance on SQA, achieving a new state-of-the-art as well as state-of-the-art on [TabFact](https://github.com/wenhuchen/Table-Fact-Checking), a large-scale dataset with 16k Wikipedia tables for table entailment (a binary classification task). For more details, see their follow-up paper: [Understanding tables with intermediate pre-training](https://www.aclweb.org/anthology/2020.findings-emnlp.27/) by Julian Martin Eisenschlos, Syrine Krichene and Thomas Mรผller.
+
+
+
+ TAPAS architecture. Taken from the original blog post .
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The Tensorflow version of this model was contributed by [kamalkraj](https://huggingface.co/kamalkraj). The original code can be found [here](https://github.com/google-research/tapas).
+
+## Usage tips
+
+- TAPAS is a model that uses relative position embeddings by default (restarting the position embeddings at every cell of the table). Note that this is something that was added after the publication of the original TAPAS paper. According to the authors, this usually results in a slightly better performance, and allows you to encode longer sequences without running out of embeddings. This is reflected in the `reset_position_index_per_cell` parameter of [`TapasConfig`], which is set to `True` by default. The default versions of the models available on the [hub](https://huggingface.co/models?search=tapas) all use relative position embeddings. You can still use the ones with absolute position embeddings by passing in an additional argument `revision="no_reset"` when calling the `from_pretrained()` method. Note that it's usually advised to pad the inputs on the right rather than the left.
+- TAPAS is based on BERT, so `TAPAS-base` for example corresponds to a `BERT-base` architecture. Of course, `TAPAS-large` will result in the best performance (the results reported in the paper are from `TAPAS-large`). Results of the various sized models are shown on the [original GitHub repository](https://github.com/google-research/tapas).
+- TAPAS has checkpoints fine-tuned on SQA, which are capable of answering questions related to a table in a conversational set-up. This means that you can ask follow-up questions such as "what is his age?" related to the previous question. Note that the forward pass of TAPAS is a bit different in case of a conversational set-up: in that case, you have to feed every table-question pair one by one to the model, such that the `prev_labels` token type ids can be overwritten by the predicted `labels` of the model to the previous question. See "Usage" section for more info.
+- TAPAS is similar to BERT and therefore relies on the masked language modeling (MLM) objective. It is therefore efficient at predicting masked tokens and at NLU in general, but is not optimal for text generation. Models trained with a causal language modeling (CLM) objective are better in that regard. Note that TAPAS can be used as an encoder in the EncoderDecoderModel framework, to combine it with an autoregressive text decoder such as GPT-2.
+
+## Usage: fine-tuning
+
+Here we explain how you can fine-tune [`TapasForQuestionAnswering`] on your own dataset.
+
+**STEP 1: Choose one of the 3 ways in which you can use TAPAS - or experiment**
+
+Basically, there are 3 different ways in which one can fine-tune [`TapasForQuestionAnswering`], corresponding to the different datasets on which Tapas was fine-tuned:
+
+1. SQA: if you're interested in asking follow-up questions related to a table, in a conversational set-up. For example if you first ask "what's the name of the first actor?" then you can ask a follow-up question such as "how old is he?". Here, questions do not involve any aggregation (all questions are cell selection questions).
+2. WTQ: if you're not interested in asking questions in a conversational set-up, but rather just asking questions related to a table, which might involve aggregation, such as counting a number of rows, summing up cell values or averaging cell values. You can then for example ask "what's the total number of goals Cristiano Ronaldo made in his career?". This case is also called **weak supervision**, since the model itself must learn the appropriate aggregation operator (SUM/COUNT/AVERAGE/NONE) given only the answer to the question as supervision.
+3. WikiSQL-supervised: this dataset is based on WikiSQL with the model being given the ground truth aggregation operator during training. This is also called **strong supervision**. Here, learning the appropriate aggregation operator is much easier.
+
+To summarize:
+
+| **Task** | **Example dataset** | **Description** |
+|-------------------------------------|---------------------|---------------------------------------------------------------------------------------------------------|
+| Conversational | SQA | Conversational, only cell selection questions |
+| Weak supervision for aggregation | WTQ | Questions might involve aggregation, and the model must learn this given only the answer as supervision |
+| Strong supervision for aggregation | WikiSQL-supervised | Questions might involve aggregation, and the model must learn this given the gold aggregation operator |
+
+
+
+Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below.
+
+```py
+>>> from transformers import TapasConfig, TapasForQuestionAnswering
+
+>>> # for example, the base sized model with default SQA configuration
+>>> model = TapasForQuestionAnswering.from_pretrained("google/tapas-base")
+
+>>> # or, the base sized model with WTQ configuration
+>>> config = TapasConfig.from_pretrained("google/tapas-base-finetuned-wtq")
+>>> model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+
+>>> # or, the base sized model with WikiSQL configuration
+>>> config = TapasConfig("google-base-finetuned-wikisql-supervised")
+>>> model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+```
+
+Of course, you don't necessarily have to follow one of these three ways in which TAPAS was fine-tuned. You can also experiment by defining any hyperparameters you want when initializing [`TapasConfig`], and then create a [`TapasForQuestionAnswering`] based on that configuration. For example, if you have a dataset that has both conversational questions and questions that might involve aggregation, then you can do it this way. Here's an example:
+
+```py
+>>> from transformers import TapasConfig, TapasForQuestionAnswering
+
+>>> # you can initialize the classification heads any way you want (see docs of TapasConfig)
+>>> config = TapasConfig(num_aggregation_labels=3, average_logits_per_cell=True)
+>>> # initializing the pre-trained base sized model with our custom classification heads
+>>> model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+```
+
+
+Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below. Be sure to have installed the [tensorflow_probability](https://github.com/tensorflow/probability) dependency:
+
+```py
+>>> from transformers import TapasConfig, TFTapasForQuestionAnswering
+
+>>> # for example, the base sized model with default SQA configuration
+>>> model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base")
+
+>>> # or, the base sized model with WTQ configuration
+>>> config = TapasConfig.from_pretrained("google/tapas-base-finetuned-wtq")
+>>> model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+
+>>> # or, the base sized model with WikiSQL configuration
+>>> config = TapasConfig("google-base-finetuned-wikisql-supervised")
+>>> model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+```
+
+Of course, you don't necessarily have to follow one of these three ways in which TAPAS was fine-tuned. You can also experiment by defining any hyperparameters you want when initializing [`TapasConfig`], and then create a [`TFTapasForQuestionAnswering`] based on that configuration. For example, if you have a dataset that has both conversational questions and questions that might involve aggregation, then you can do it this way. Here's an example:
+
+```py
+>>> from transformers import TapasConfig, TFTapasForQuestionAnswering
+
+>>> # you can initialize the classification heads any way you want (see docs of TapasConfig)
+>>> config = TapasConfig(num_aggregation_labels=3, average_logits_per_cell=True)
+>>> # initializing the pre-trained base sized model with our custom classification heads
+>>> model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+```
+
+
+
+What you can also do is start from an already fine-tuned checkpoint. A note here is that the already fine-tuned checkpoint on WTQ has some issues due to the L2-loss which is somewhat brittle. See [here](https://github.com/google-research/tapas/issues/91#issuecomment-735719340) for more info.
+
+For a list of all pre-trained and fine-tuned TAPAS checkpoints available on HuggingFace's hub, see [here](https://huggingface.co/models?search=tapas).
+
+**STEP 2: Prepare your data in the SQA format**
+
+Second, no matter what you picked above, you should prepare your dataset in the [SQA](https://www.microsoft.com/en-us/download/details.aspx?id=54253) format. This format is a TSV/CSV file with the following columns:
+
+- `id`: optional, id of the table-question pair, for bookkeeping purposes.
+- `annotator`: optional, id of the person who annotated the table-question pair, for bookkeeping purposes.
+- `position`: integer indicating if the question is the first, second, third,... related to the table. Only required in case of conversational setup (SQA). You don't need this column in case you're going for WTQ/WikiSQL-supervised.
+- `question`: string
+- `table_file`: string, name of a csv file containing the tabular data
+- `answer_coordinates`: list of one or more tuples (each tuple being a cell coordinate, i.e. row, column pair that is part of the answer)
+- `answer_text`: list of one or more strings (each string being a cell value that is part of the answer)
+- `aggregation_label`: index of the aggregation operator. Only required in case of strong supervision for aggregation (the WikiSQL-supervised case)
+- `float_answer`: the float answer to the question, if there is one (np.nan if there isn't). Only required in case of weak supervision for aggregation (such as WTQ and WikiSQL)
+
+The tables themselves should be present in a folder, each table being a separate csv file. Note that the authors of the TAPAS algorithm used conversion scripts with some automated logic to convert the other datasets (WTQ, WikiSQL) into the SQA format. The author explains this [here](https://github.com/google-research/tapas/issues/50#issuecomment-705465960). A conversion of this script that works with HuggingFace's implementation can be found [here](https://github.com/NielsRogge/tapas_utils). Interestingly, these conversion scripts are not perfect (the `answer_coordinates` and `float_answer` fields are populated based on the `answer_text`), meaning that WTQ and WikiSQL results could actually be improved.
+
+**STEP 3: Convert your data into tensors using TapasTokenizer**
+
+
+
+Third, given that you've prepared your data in this TSV/CSV format (and corresponding CSV files containing the tabular data), you can then use [`TapasTokenizer`] to convert table-question pairs into `input_ids`, `attention_mask`, `token_type_ids` and so on. Again, based on which of the three cases you picked above, [`TapasForQuestionAnswering`] requires different
+inputs to be fine-tuned:
+
+| **Task** | **Required inputs** |
+|------------------------------------|---------------------------------------------------------------------------------------------------------------------|
+| Conversational | `input_ids`, `attention_mask`, `token_type_ids`, `labels` |
+| Weak supervision for aggregation | `input_ids`, `attention_mask`, `token_type_ids`, `labels`, `numeric_values`, `numeric_values_scale`, `float_answer` |
+| Strong supervision for aggregation | `input ids`, `attention mask`, `token type ids`, `labels`, `aggregation_labels` |
+
+[`TapasTokenizer`] creates the `labels`, `numeric_values` and `numeric_values_scale` based on the `answer_coordinates` and `answer_text` columns of the TSV file. The `float_answer` and `aggregation_labels` are already in the TSV file of step 2. Here's an example:
+
+```py
+>>> from transformers import TapasTokenizer
+>>> import pandas as pd
+
+>>> model_name = "google/tapas-base"
+>>> tokenizer = TapasTokenizer.from_pretrained(model_name)
+
+>>> data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
+>>> queries = [
+... "What is the name of the first actor?",
+... "How many movies has George Clooney played in?",
+... "What is the total number of movies?",
+... ]
+>>> answer_coordinates = [[(0, 0)], [(2, 1)], [(0, 1), (1, 1), (2, 1)]]
+>>> answer_text = [["Brad Pitt"], ["69"], ["209"]]
+>>> table = pd.DataFrame.from_dict(data)
+>>> inputs = tokenizer(
+... table=table,
+... queries=queries,
+... answer_coordinates=answer_coordinates,
+... answer_text=answer_text,
+... padding="max_length",
+... return_tensors="pt",
+... )
+>>> inputs
+{'input_ids': tensor([[ ... ]]), 'attention_mask': tensor([[...]]), 'token_type_ids': tensor([[[...]]]),
+'numeric_values': tensor([[ ... ]]), 'numeric_values_scale: tensor([[ ... ]]), labels: tensor([[ ... ]])}
+```
+
+Note that [`TapasTokenizer`] expects the data of the table to be **text-only**. You can use `.astype(str)` on a dataframe to turn it into text-only data.
+Of course, this only shows how to encode a single training example. It is advised to create a dataloader to iterate over batches:
+
+```py
+>>> import torch
+>>> import pandas as pd
+
+>>> tsv_path = "your_path_to_the_tsv_file"
+>>> table_csv_path = "your_path_to_a_directory_containing_all_csv_files"
+
+
+>>> class TableDataset(torch.utils.data.Dataset):
+... def __init__(self, data, tokenizer):
+... self.data = data
+... self.tokenizer = tokenizer
+
+... def __getitem__(self, idx):
+... item = data.iloc[idx]
+... table = pd.read_csv(table_csv_path + item.table_file).astype(
+... str
+... ) # be sure to make your table data text only
+... encoding = self.tokenizer(
+... table=table,
+... queries=item.question,
+... answer_coordinates=item.answer_coordinates,
+... answer_text=item.answer_text,
+... truncation=True,
+... padding="max_length",
+... return_tensors="pt",
+... )
+... # remove the batch dimension which the tokenizer adds by default
+... encoding = {key: val.squeeze(0) for key, val in encoding.items()}
+... # add the float_answer which is also required (weak supervision for aggregation case)
+... encoding["float_answer"] = torch.tensor(item.float_answer)
+... return encoding
+
+... def __len__(self):
+... return len(self.data)
+
+
+>>> data = pd.read_csv(tsv_path, sep="\t")
+>>> train_dataset = TableDataset(data, tokenizer)
+>>> train_dataloader = torch.utils.data.DataLoader(train_dataset, batch_size=32)
+```
+
+
+Third, given that you've prepared your data in this TSV/CSV format (and corresponding CSV files containing the tabular data), you can then use [`TapasTokenizer`] to convert table-question pairs into `input_ids`, `attention_mask`, `token_type_ids` and so on. Again, based on which of the three cases you picked above, [`TFTapasForQuestionAnswering`] requires different
+inputs to be fine-tuned:
+
+| **Task** | **Required inputs** |
+|------------------------------------|---------------------------------------------------------------------------------------------------------------------|
+| Conversational | `input_ids`, `attention_mask`, `token_type_ids`, `labels` |
+| Weak supervision for aggregation | `input_ids`, `attention_mask`, `token_type_ids`, `labels`, `numeric_values`, `numeric_values_scale`, `float_answer` |
+| Strong supervision for aggregation | `input ids`, `attention mask`, `token type ids`, `labels`, `aggregation_labels` |
+
+[`TapasTokenizer`] creates the `labels`, `numeric_values` and `numeric_values_scale` based on the `answer_coordinates` and `answer_text` columns of the TSV file. The `float_answer` and `aggregation_labels` are already in the TSV file of step 2. Here's an example:
+
+```py
+>>> from transformers import TapasTokenizer
+>>> import pandas as pd
+
+>>> model_name = "google/tapas-base"
+>>> tokenizer = TapasTokenizer.from_pretrained(model_name)
+
+>>> data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
+>>> queries = [
+... "What is the name of the first actor?",
+... "How many movies has George Clooney played in?",
+... "What is the total number of movies?",
+... ]
+>>> answer_coordinates = [[(0, 0)], [(2, 1)], [(0, 1), (1, 1), (2, 1)]]
+>>> answer_text = [["Brad Pitt"], ["69"], ["209"]]
+>>> table = pd.DataFrame.from_dict(data)
+>>> inputs = tokenizer(
+... table=table,
+... queries=queries,
+... answer_coordinates=answer_coordinates,
+... answer_text=answer_text,
+... padding="max_length",
+... return_tensors="tf",
+... )
+>>> inputs
+{'input_ids': tensor([[ ... ]]), 'attention_mask': tensor([[...]]), 'token_type_ids': tensor([[[...]]]),
+'numeric_values': tensor([[ ... ]]), 'numeric_values_scale: tensor([[ ... ]]), labels: tensor([[ ... ]])}
+```
+
+Note that [`TapasTokenizer`] expects the data of the table to be **text-only**. You can use `.astype(str)` on a dataframe to turn it into text-only data.
+Of course, this only shows how to encode a single training example. It is advised to create a dataloader to iterate over batches:
+
+```py
+>>> import tensorflow as tf
+>>> import pandas as pd
+
+>>> tsv_path = "your_path_to_the_tsv_file"
+>>> table_csv_path = "your_path_to_a_directory_containing_all_csv_files"
+
+
+>>> class TableDataset:
+... def __init__(self, data, tokenizer):
+... self.data = data
+... self.tokenizer = tokenizer
+
+... def __iter__(self):
+... for idx in range(self.__len__()):
+... item = self.data.iloc[idx]
+... table = pd.read_csv(table_csv_path + item.table_file).astype(
+... str
+... ) # be sure to make your table data text only
+... encoding = self.tokenizer(
+... table=table,
+... queries=item.question,
+... answer_coordinates=item.answer_coordinates,
+... answer_text=item.answer_text,
+... truncation=True,
+... padding="max_length",
+... return_tensors="tf",
+... )
+... # remove the batch dimension which the tokenizer adds by default
+... encoding = {key: tf.squeeze(val, 0) for key, val in encoding.items()}
+... # add the float_answer which is also required (weak supervision for aggregation case)
+... encoding["float_answer"] = tf.convert_to_tensor(item.float_answer, dtype=tf.float32)
+... yield encoding["input_ids"], encoding["attention_mask"], encoding["numeric_values"], encoding[
+... "numeric_values_scale"
+... ], encoding["token_type_ids"], encoding["labels"], encoding["float_answer"]
+
+... def __len__(self):
+... return len(self.data)
+
+
+>>> data = pd.read_csv(tsv_path, sep="\t")
+>>> train_dataset = TableDataset(data, tokenizer)
+>>> output_signature = (
+... tf.TensorSpec(shape=(512,), dtype=tf.int32),
+... tf.TensorSpec(shape=(512,), dtype=tf.int32),
+... tf.TensorSpec(shape=(512,), dtype=tf.float32),
+... tf.TensorSpec(shape=(512,), dtype=tf.float32),
+... tf.TensorSpec(shape=(512, 7), dtype=tf.int32),
+... tf.TensorSpec(shape=(512,), dtype=tf.int32),
+... tf.TensorSpec(shape=(512,), dtype=tf.float32),
+... )
+>>> train_dataloader = tf.data.Dataset.from_generator(train_dataset, output_signature=output_signature).batch(32)
+```
+
+
+
+Note that here, we encode each table-question pair independently. This is fine as long as your dataset is **not conversational**. In case your dataset involves conversational questions (such as in SQA), then you should first group together the `queries`, `answer_coordinates` and `answer_text` per table (in the order of their `position`
+index) and batch encode each table with its questions. This will make sure that the `prev_labels` token types (see docs of [`TapasTokenizer`]) are set correctly. See [this notebook](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) for more info. See [this notebook](https://github.com/kamalkraj/Tapas-Tutorial/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) for more info regarding using the TensorFlow model.
+
+**STEP 4: Train (fine-tune) the model
+
+
+
+You can then fine-tune [`TapasForQuestionAnswering`] as follows (shown here for the weak supervision for aggregation case):
+
+```py
+>>> from transformers import TapasConfig, TapasForQuestionAnswering, AdamW
+
+>>> # this is the default WTQ configuration
+>>> config = TapasConfig(
+... num_aggregation_labels=4,
+... use_answer_as_supervision=True,
+... answer_loss_cutoff=0.664694,
+... cell_selection_preference=0.207951,
+... huber_loss_delta=0.121194,
+... init_cell_selection_weights_to_zero=True,
+... select_one_column=True,
+... allow_empty_column_selection=False,
+... temperature=0.0352513,
+... )
+>>> model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+
+>>> optimizer = AdamW(model.parameters(), lr=5e-5)
+
+>>> model.train()
+>>> for epoch in range(2): # loop over the dataset multiple times
+... for batch in train_dataloader:
+... # get the inputs;
+... input_ids = batch["input_ids"]
+... attention_mask = batch["attention_mask"]
+... token_type_ids = batch["token_type_ids"]
+... labels = batch["labels"]
+... numeric_values = batch["numeric_values"]
+... numeric_values_scale = batch["numeric_values_scale"]
+... float_answer = batch["float_answer"]
+
+... # zero the parameter gradients
+... optimizer.zero_grad()
+
+... # forward + backward + optimize
+... outputs = model(
+... input_ids=input_ids,
+... attention_mask=attention_mask,
+... token_type_ids=token_type_ids,
+... labels=labels,
+... numeric_values=numeric_values,
+... numeric_values_scale=numeric_values_scale,
+... float_answer=float_answer,
+... )
+... loss = outputs.loss
+... loss.backward()
+... optimizer.step()
+```
+
+
+You can then fine-tune [`TFTapasForQuestionAnswering`] as follows (shown here for the weak supervision for aggregation case):
+
+```py
+>>> import tensorflow as tf
+>>> from transformers import TapasConfig, TFTapasForQuestionAnswering
+
+>>> # this is the default WTQ configuration
+>>> config = TapasConfig(
+... num_aggregation_labels=4,
+... use_answer_as_supervision=True,
+... answer_loss_cutoff=0.664694,
+... cell_selection_preference=0.207951,
+... huber_loss_delta=0.121194,
+... init_cell_selection_weights_to_zero=True,
+... select_one_column=True,
+... allow_empty_column_selection=False,
+... temperature=0.0352513,
+... )
+>>> model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)
+
+>>> optimizer = tf.keras.optimizers.Adam(learning_rate=5e-5)
+
+>>> for epoch in range(2): # loop over the dataset multiple times
+... for batch in train_dataloader:
+... # get the inputs;
+... input_ids = batch[0]
+... attention_mask = batch[1]
+... token_type_ids = batch[4]
+... labels = batch[-1]
+... numeric_values = batch[2]
+... numeric_values_scale = batch[3]
+... float_answer = batch[6]
+
+... # forward + backward + optimize
+... with tf.GradientTape() as tape:
+... outputs = model(
+... input_ids=input_ids,
+... attention_mask=attention_mask,
+... token_type_ids=token_type_ids,
+... labels=labels,
+... numeric_values=numeric_values,
+... numeric_values_scale=numeric_values_scale,
+... float_answer=float_answer,
+... )
+... grads = tape.gradient(outputs.loss, model.trainable_weights)
+... optimizer.apply_gradients(zip(grads, model.trainable_weights))
+```
+
+
+
+## Usage: inference
+
+
+
+Here we explain how you can use [`TapasForQuestionAnswering`] or [`TFTapasForQuestionAnswering`] for inference (i.e. making predictions on new data). For inference, only `input_ids`, `attention_mask` and `token_type_ids` (which you can obtain using [`TapasTokenizer`]) have to be provided to the model to obtain the logits. Next, you can use the handy [`~models.tapas.tokenization_tapas.convert_logits_to_predictions`] method to convert these into predicted coordinates and optional aggregation indices.
+
+However, note that inference is **different** depending on whether or not the setup is conversational. In a non-conversational set-up, inference can be done in parallel on all table-question pairs of a batch. Here's an example of that:
+
+```py
+>>> from transformers import TapasTokenizer, TapasForQuestionAnswering
+>>> import pandas as pd
+
+>>> model_name = "google/tapas-base-finetuned-wtq"
+>>> model = TapasForQuestionAnswering.from_pretrained(model_name)
+>>> tokenizer = TapasTokenizer.from_pretrained(model_name)
+
+>>> data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
+>>> queries = [
+... "What is the name of the first actor?",
+... "How many movies has George Clooney played in?",
+... "What is the total number of movies?",
+... ]
+>>> table = pd.DataFrame.from_dict(data)
+>>> inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="pt")
+>>> outputs = model(**inputs)
+>>> predicted_answer_coordinates, predicted_aggregation_indices = tokenizer.convert_logits_to_predictions(
+... inputs, outputs.logits.detach(), outputs.logits_aggregation.detach()
+... )
+
+>>> # let's print out the results:
+>>> id2aggregation = {0: "NONE", 1: "SUM", 2: "AVERAGE", 3: "COUNT"}
+>>> aggregation_predictions_string = [id2aggregation[x] for x in predicted_aggregation_indices]
+
+>>> answers = []
+>>> for coordinates in predicted_answer_coordinates:
+... if len(coordinates) == 1:
+... # only a single cell:
+... answers.append(table.iat[coordinates[0]])
+... else:
+... # multiple cells
+... cell_values = []
+... for coordinate in coordinates:
+... cell_values.append(table.iat[coordinate])
+... answers.append(", ".join(cell_values))
+
+>>> display(table)
+>>> print("")
+>>> for query, answer, predicted_agg in zip(queries, answers, aggregation_predictions_string):
+... print(query)
+... if predicted_agg == "NONE":
+... print("Predicted answer: " + answer)
+... else:
+... print("Predicted answer: " + predicted_agg + " > " + answer)
+What is the name of the first actor?
+Predicted answer: Brad Pitt
+How many movies has George Clooney played in?
+Predicted answer: COUNT > 69
+What is the total number of movies?
+Predicted answer: SUM > 87, 53, 69
+```
+
+
+Here we explain how you can use [`TFTapasForQuestionAnswering`] for inference (i.e. making predictions on new data). For inference, only `input_ids`, `attention_mask` and `token_type_ids` (which you can obtain using [`TapasTokenizer`]) have to be provided to the model to obtain the logits. Next, you can use the handy [`~models.tapas.tokenization_tapas.convert_logits_to_predictions`] method to convert these into predicted coordinates and optional aggregation indices.
+
+However, note that inference is **different** depending on whether or not the setup is conversational. In a non-conversational set-up, inference can be done in parallel on all table-question pairs of a batch. Here's an example of that:
+
+```py
+>>> from transformers import TapasTokenizer, TFTapasForQuestionAnswering
+>>> import pandas as pd
+
+>>> model_name = "google/tapas-base-finetuned-wtq"
+>>> model = TFTapasForQuestionAnswering.from_pretrained(model_name)
+>>> tokenizer = TapasTokenizer.from_pretrained(model_name)
+
+>>> data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
+>>> queries = [
+... "What is the name of the first actor?",
+... "How many movies has George Clooney played in?",
+... "What is the total number of movies?",
+... ]
+>>> table = pd.DataFrame.from_dict(data)
+>>> inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="tf")
+>>> outputs = model(**inputs)
+>>> predicted_answer_coordinates, predicted_aggregation_indices = tokenizer.convert_logits_to_predictions(
+... inputs, outputs.logits, outputs.logits_aggregation
+... )
+
+>>> # let's print out the results:
+>>> id2aggregation = {0: "NONE", 1: "SUM", 2: "AVERAGE", 3: "COUNT"}
+>>> aggregation_predictions_string = [id2aggregation[x] for x in predicted_aggregation_indices]
+
+>>> answers = []
+>>> for coordinates in predicted_answer_coordinates:
+... if len(coordinates) == 1:
+... # only a single cell:
+... answers.append(table.iat[coordinates[0]])
+... else:
+... # multiple cells
+... cell_values = []
+... for coordinate in coordinates:
+... cell_values.append(table.iat[coordinate])
+... answers.append(", ".join(cell_values))
+
+>>> display(table)
+>>> print("")
+>>> for query, answer, predicted_agg in zip(queries, answers, aggregation_predictions_string):
+... print(query)
+... if predicted_agg == "NONE":
+... print("Predicted answer: " + answer)
+... else:
+... print("Predicted answer: " + predicted_agg + " > " + answer)
+What is the name of the first actor?
+Predicted answer: Brad Pitt
+How many movies has George Clooney played in?
+Predicted answer: COUNT > 69
+What is the total number of movies?
+Predicted answer: SUM > 87, 53, 69
+```
+
+
+
+In case of a conversational set-up, then each table-question pair must be provided **sequentially** to the model, such that the `prev_labels` token types can be overwritten by the predicted `labels` of the previous table-question pair. Again, more info can be found in [this notebook](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) (for PyTorch) and [this notebook](https://github.com/kamalkraj/Tapas-Tutorial/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) (for TensorFlow).
+
+## Resources
+
+- [Text classification task guide](../tasks/sequence_classification)
+- [Masked language modeling task guide](../tasks/masked_language_modeling)
+
+## TAPAS specific outputs
+[[autodoc]] models.tapas.modeling_tapas.TableQuestionAnsweringOutput
+
+## TapasConfig
+[[autodoc]] TapasConfig
+
+## TapasTokenizer
+[[autodoc]] TapasTokenizer
+ - __call__
+ - convert_logits_to_predictions
+ - save_vocabulary
+
+
+
+
+## TapasModel
+[[autodoc]] TapasModel
+ - forward
+
+## TapasForMaskedLM
+[[autodoc]] TapasForMaskedLM
+ - forward
+
+## TapasForSequenceClassification
+[[autodoc]] TapasForSequenceClassification
+ - forward
+
+## TapasForQuestionAnswering
+[[autodoc]] TapasForQuestionAnswering
+ - forward
+
+
+
+
+## TFTapasModel
+[[autodoc]] TFTapasModel
+ - call
+
+## TFTapasForMaskedLM
+[[autodoc]] TFTapasForMaskedLM
+ - call
+
+## TFTapasForSequenceClassification
+[[autodoc]] TFTapasForSequenceClassification
+ - call
+
+## TFTapasForQuestionAnswering
+[[autodoc]] TFTapasForQuestionAnswering
+ - call
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tapex.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tapex.md
new file mode 100644
index 0000000000000000000000000000000000000000..15ac2463fd851dca72d82c43ab05a1253e202dce
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tapex.md
@@ -0,0 +1,149 @@
+
+
+# TAPEX
+
+
+
+This model is in maintenance mode only, we don't accept any new PRs changing its code.
+
+If you run into any issues running this model, please reinstall the last version that supported this model: v4.30.0.
+You can do so by running the following command: `pip install -U transformers==4.30.0`.
+
+
+
+## Overview
+
+The TAPEX model was proposed in [TAPEX: Table Pre-training via Learning a Neural SQL Executor](https://arxiv.org/abs/2107.07653) by Qian Liu,
+Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, Jian-Guang Lou. TAPEX pre-trains a BART model to solve synthetic SQL queries, after
+which it can be fine-tuned to answer natural language questions related to tabular data, as well as performing table fact checking.
+
+TAPEX has been fine-tuned on several datasets:
+- [SQA](https://www.microsoft.com/en-us/download/details.aspx?id=54253) (Sequential Question Answering by Microsoft)
+- [WTQ](https://github.com/ppasupat/WikiTableQuestions) (Wiki Table Questions by Stanford University)
+- [WikiSQL](https://github.com/salesforce/WikiSQL) (by Salesforce)
+- [TabFact](https://tabfact.github.io/) (by USCB NLP Lab).
+
+The abstract from the paper is the following:
+
+*Recent progress in language model pre-training has achieved a great success via leveraging large-scale unstructured textual data. However, it is
+still a challenge to apply pre-training on structured tabular data due to the absence of large-scale high-quality tabular data. In this paper, we
+propose TAPEX to show that table pre-training can be achieved by learning a neural SQL executor over a synthetic corpus, which is obtained by automatically
+synthesizing executable SQL queries and their execution outputs. TAPEX addresses the data scarcity challenge via guiding the language model to mimic a SQL
+executor on the diverse, large-scale and high-quality synthetic corpus. We evaluate TAPEX on four benchmark datasets. Experimental results demonstrate that
+TAPEX outperforms previous table pre-training approaches by a large margin and achieves new state-of-the-art results on all of them. This includes improvements
+on the weakly-supervised WikiSQL denotation accuracy to 89.5% (+2.3%), the WikiTableQuestions denotation accuracy to 57.5% (+4.8%), the SQA denotation accuracy
+to 74.5% (+3.5%), and the TabFact accuracy to 84.2% (+3.2%). To our knowledge, this is the first work to exploit table pre-training via synthetic executable programs
+and to achieve new state-of-the-art results on various downstream tasks.*
+
+## Usage tips
+
+- TAPEX is a generative (seq2seq) model. One can directly plug in the weights of TAPEX into a BART model.
+- TAPEX has checkpoints on the hub that are either pre-trained only, or fine-tuned on WTQ, SQA, WikiSQL and TabFact.
+- Sentences + tables are presented to the model as `sentence + " " + linearized table`. The linearized table has the following format:
+ `col: col1 | col2 | col 3 row 1 : val1 | val2 | val3 row 2 : ...`.
+- TAPEX has its own tokenizer, that allows to prepare all data for the model easily. One can pass Pandas DataFrames and strings to the tokenizer,
+ and it will automatically create the `input_ids` and `attention_mask` (as shown in the usage examples below).
+
+### Usage: inference
+
+Below, we illustrate how to use TAPEX for table question answering. As one can see, one can directly plug in the weights of TAPEX into a BART model.
+We use the [Auto API](auto), which will automatically instantiate the appropriate tokenizer ([`TapexTokenizer`]) and model ([`BartForConditionalGeneration`]) for us,
+based on the configuration file of the checkpoint on the hub.
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+>>> import pandas as pd
+
+>>> tokenizer = AutoTokenizer.from_pretrained("microsoft/tapex-large-finetuned-wtq")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("microsoft/tapex-large-finetuned-wtq")
+
+>>> # prepare table + question
+>>> data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
+>>> table = pd.DataFrame.from_dict(data)
+>>> question = "how many movies does Leonardo Di Caprio have?"
+
+>>> encoding = tokenizer(table, question, return_tensors="pt")
+
+>>> # let the model generate an answer autoregressively
+>>> outputs = model.generate(**encoding)
+
+>>> # decode back to text
+>>> predicted_answer = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
+>>> print(predicted_answer)
+53
+```
+
+Note that [`TapexTokenizer`] also supports batched inference. Hence, one can provide a batch of different tables/questions, or a batch of a single table
+and multiple questions, or a batch of a single query and multiple tables. Let's illustrate this:
+
+```python
+>>> # prepare table + question
+>>> data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
+>>> table = pd.DataFrame.from_dict(data)
+>>> questions = [
+... "how many movies does Leonardo Di Caprio have?",
+... "which actor has 69 movies?",
+... "what's the first name of the actor who has 87 movies?",
+... ]
+>>> encoding = tokenizer(table, questions, padding=True, return_tensors="pt")
+
+>>> # let the model generate an answer autoregressively
+>>> outputs = model.generate(**encoding)
+
+>>> # decode back to text
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+[' 53', ' george clooney', ' brad pitt']
+```
+
+In case one wants to do table verification (i.e. the task of determining whether a given sentence is supported or refuted by the contents
+of a table), one can instantiate a [`BartForSequenceClassification`] model. TAPEX has checkpoints on the hub fine-tuned on TabFact, an important
+benchmark for table fact checking (it achieves 84% accuracy). The code example below again leverages the [Auto API](auto).
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> tokenizer = AutoTokenizer.from_pretrained("microsoft/tapex-large-finetuned-tabfact")
+>>> model = AutoModelForSequenceClassification.from_pretrained("microsoft/tapex-large-finetuned-tabfact")
+
+>>> # prepare table + sentence
+>>> data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
+>>> table = pd.DataFrame.from_dict(data)
+>>> sentence = "George Clooney has 30 movies"
+
+>>> encoding = tokenizer(table, sentence, return_tensors="pt")
+
+>>> # forward pass
+>>> outputs = model(**encoding)
+
+>>> # print prediction
+>>> predicted_class_idx = outputs.logits[0].argmax(dim=0).item()
+>>> print(model.config.id2label[predicted_class_idx])
+Refused
+```
+
+
+
+TAPEX architecture is the same as BART, except for tokenization. Refer to [BART documentation](bart) for information on
+configuration classes and their parameters. TAPEX-specific tokenizer is documented below.
+
+
+
+## TapexTokenizer
+
+[[autodoc]] TapexTokenizer
+ - __call__
+ - save_vocabulary
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/textnet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/textnet.md
new file mode 100644
index 0000000000000000000000000000000000000000..d6b431e648f21bf985964a4bbc0d85c9db95d824
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/textnet.md
@@ -0,0 +1,55 @@
+
+
+# TextNet
+
+## Overview
+
+The TextNet model was proposed in [FAST: Faster Arbitrarily-Shaped Text Detector with Minimalist Kernel Representation](https://arxiv.org/abs/2111.02394) by Zhe Chen, Jiahao Wang, Wenhai Wang, Guo Chen, Enze Xie, Ping Luo, Tong Lu. TextNet is a vision backbone useful for text detection tasks. It is the result of neural architecture search (NAS) on backbones with reward function as text detection task (to provide powerful features for text detection).
+
+
+
+ TextNet backbone as part of FAST. Taken from the original paper.
+
+This model was contributed by [Raghavan](https://huggingface.co/Raghavan), [jadechoghari](https://huggingface.co/jadechoghari) and [nielsr](https://huggingface.co/nielsr).
+
+## Usage tips
+
+TextNet is mainly used as a backbone network for the architecture search of text detection. Each stage of the backbone network is comprised of a stride-2 convolution and searchable blocks.
+Specifically, we present a layer-level candidate set, defined as {conv3ร3, conv1ร3, conv3ร1, identity}. As the 1ร3 and 3ร1 convolutions have asymmetric kernels and oriented structure priors, they may help to capture the features of extreme aspect-ratio and rotated text lines.
+
+TextNet is the backbone for Fast, but can also be used as an efficient text/image classification, we add a `TextNetForImageClassification` as is it would allow people to train an image classifier on top of the pre-trained textnet weights
+
+## TextNetConfig
+
+[[autodoc]] TextNetConfig
+
+## TextNetImageProcessor
+
+[[autodoc]] TextNetImageProcessor
+ - preprocess
+
+## TextNetModel
+
+[[autodoc]] TextNetModel
+ - forward
+
+## TextNetForImageClassification
+
+[[autodoc]] TextNetForImageClassification
+ - forward
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/time_series_transformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/time_series_transformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..c5bfcfc15ea2a244d01bd5f94788a063200e394c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/time_series_transformer.md
@@ -0,0 +1,72 @@
+
+
+# Time Series Transformer
+
+## Overview
+
+The Time Series Transformer model is a vanilla encoder-decoder Transformer for time series forecasting.
+This model was contributed by [kashif](https://huggingface.co/kashif).
+
+## Usage tips
+
+- Similar to other models in the library, [`TimeSeriesTransformerModel`] is the raw Transformer without any head on top, and [`TimeSeriesTransformerForPrediction`]
+adds a distribution head on top of the former, which can be used for time-series forecasting. Note that this is a so-called probabilistic forecasting model, not a
+point forecasting model. This means that the model learns a distribution, from which one can sample. The model doesn't directly output values.
+- [`TimeSeriesTransformerForPrediction`] consists of 2 blocks: an encoder, which takes a `context_length` of time series values as input (called `past_values`),
+and a decoder, which predicts a `prediction_length` of time series values into the future (called `future_values`). During training, one needs to provide
+pairs of (`past_values` and `future_values`) to the model.
+- In addition to the raw (`past_values` and `future_values`), one typically provides additional features to the model. These can be the following:
+ - `past_time_features`: temporal features which the model will add to `past_values`. These serve as "positional encodings" for the Transformer encoder.
+ Examples are "day of the month", "month of the year", etc. as scalar values (and then stacked together as a vector).
+ e.g. if a given time-series value was obtained on the 11th of August, then one could have [11, 8] as time feature vector (11 being "day of the month", 8 being "month of the year").
+ - `future_time_features`: temporal features which the model will add to `future_values`. These serve as "positional encodings" for the Transformer decoder.
+ Examples are "day of the month", "month of the year", etc. as scalar values (and then stacked together as a vector).
+ e.g. if a given time-series value was obtained on the 11th of August, then one could have [11, 8] as time feature vector (11 being "day of the month", 8 being "month of the year").
+ - `static_categorical_features`: categorical features which are static over time (i.e., have the same value for all `past_values` and `future_values`).
+ An example here is the store ID or region ID that identifies a given time-series.
+ Note that these features need to be known for ALL data points (also those in the future).
+ - `static_real_features`: real-valued features which are static over time (i.e., have the same value for all `past_values` and `future_values`).
+ An example here is the image representation of the product for which you have the time-series values (like the [ResNet](resnet) embedding of a "shoe" picture,
+ if your time-series is about the sales of shoes).
+ Note that these features need to be known for ALL data points (also those in the future).
+- The model is trained using "teacher-forcing", similar to how a Transformer is trained for machine translation. This means that, during training, one shifts the
+`future_values` one position to the right as input to the decoder, prepended by the last value of `past_values`. At each time step, the model needs to predict the
+next target. So the set-up of training is similar to a GPT model for language, except that there's no notion of `decoder_start_token_id` (we just use the last value
+of the context as initial input for the decoder).
+- At inference time, we give the final value of the `past_values` as input to the decoder. Next, we can sample from the model to make a prediction at the next time step,
+which is then fed to the decoder in order to make the next prediction (also called autoregressive generation).
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+- Check out the Time Series Transformer blog-post in HuggingFace blog: [Probabilistic Time Series Forecasting with ๐ค Transformers](https://huggingface.co/blog/time-series-transformers)
+
+
+## TimeSeriesTransformerConfig
+
+[[autodoc]] TimeSeriesTransformerConfig
+
+## TimeSeriesTransformerModel
+
+[[autodoc]] TimeSeriesTransformerModel
+ - forward
+
+## TimeSeriesTransformerForPrediction
+
+[[autodoc]] TimeSeriesTransformerForPrediction
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/timesformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/timesformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..fe75bee5b2897eb1dfb4bbb28fd7d5534083db9a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/timesformer.md
@@ -0,0 +1,52 @@
+
+
+# TimeSformer
+
+## Overview
+
+The TimeSformer model was proposed in [TimeSformer: Is Space-Time Attention All You Need for Video Understanding?](https://arxiv.org/abs/2102.05095) by Facebook Research.
+This work is a milestone in action-recognition field being the first video transformer. It inspired many transformer based video understanding and classification papers.
+
+The abstract from the paper is the following:
+
+*We present a convolution-free approach to video classification built exclusively on self-attention over space and time. Our method, named "TimeSformer," adapts the standard Transformer architecture to video by enabling spatiotemporal feature learning directly from a sequence of frame-level patches. Our experimental study compares different self-attention schemes and suggests that "divided attention," where temporal attention and spatial attention are separately applied within each block, leads to the best video classification accuracy among the design choices considered. Despite the radically new design, TimeSformer achieves state-of-the-art results on several action recognition benchmarks, including the best reported accuracy on Kinetics-400 and Kinetics-600. Finally, compared to 3D convolutional networks, our model is faster to train, it can achieve dramatically higher test efficiency (at a small drop in accuracy), and it can also be applied to much longer video clips (over one minute long). Code and models are available at: [this https URL](https://github.com/facebookresearch/TimeSformer).*
+
+This model was contributed by [fcakyon](https://huggingface.co/fcakyon).
+The original code can be found [here](https://github.com/facebookresearch/TimeSformer).
+
+## Usage tips
+
+There are many pretrained variants. Select your pretrained model based on the dataset it is trained on. Moreover,
+the number of input frames per clip changes based on the model size so you should consider this parameter while selecting your pretrained model.
+
+## Resources
+
+- [Video classification task guide](../tasks/video_classification)
+
+## TimesformerConfig
+
+[[autodoc]] TimesformerConfig
+
+## TimesformerModel
+
+[[autodoc]] TimesformerModel
+ - forward
+
+## TimesformerForVideoClassification
+
+[[autodoc]] TimesformerForVideoClassification
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/timm_wrapper.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/timm_wrapper.md
new file mode 100644
index 0000000000000000000000000000000000000000..5af3d51746c325cc9085076fdfc8feaaa1ddb350
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/timm_wrapper.md
@@ -0,0 +1,67 @@
+
+
+# TimmWrapper
+
+## Overview
+
+Helper class to enable loading timm models to be used with the transformers library and its autoclasses.
+
+```python
+>>> import torch
+>>> from PIL import Image
+>>> from urllib.request import urlopen
+>>> from transformers import AutoModelForImageClassification, AutoImageProcessor
+
+>>> # Load image
+>>> image = Image.open(urlopen(
+... 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
+... ))
+
+>>> # Load model and image processor
+>>> checkpoint = "timm/resnet50.a1_in1k"
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint)
+>>> model = AutoModelForImageClassification.from_pretrained(checkpoint).eval()
+
+>>> # Preprocess image
+>>> inputs = image_processor(image)
+
+>>> # Forward pass
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+
+>>> # Get top 5 predictions
+>>> top5_probabilities, top5_class_indices = torch.topk(logits.softmax(dim=1) * 100, k=5)
+```
+
+## TimmWrapperConfig
+
+[[autodoc]] TimmWrapperConfig
+
+## TimmWrapperImageProcessor
+
+[[autodoc]] TimmWrapperImageProcessor
+ - preprocess
+
+## TimmWrapperModel
+
+[[autodoc]] TimmWrapperModel
+ - forward
+
+## TimmWrapperForImageClassification
+
+[[autodoc]] TimmWrapperForImageClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/trajectory_transformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/trajectory_transformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..45616255871a0807a023b31101af2685bd0685ae
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/trajectory_transformer.md
@@ -0,0 +1,61 @@
+
+
+# Trajectory Transformer
+
+
+
+This model is in maintenance mode only, so we won't accept any new PRs changing its code.
+
+If you run into any issues running this model, please reinstall the last version that supported this model: v4.30.0.
+You can do so by running the following command: `pip install -U transformers==4.30.0`.
+
+
+
+## Overview
+
+The Trajectory Transformer model was proposed in [Offline Reinforcement Learning as One Big Sequence Modeling Problem](https://arxiv.org/abs/2106.02039) by Michael Janner, Qiyang Li, Sergey Levine.
+
+The abstract from the paper is the following:
+
+*Reinforcement learning (RL) is typically concerned with estimating stationary policies or single-step models,
+leveraging the Markov property to factorize problems in time. However, we can also view RL as a generic sequence
+modeling problem, with the goal being to produce a sequence of actions that leads to a sequence of high rewards.
+Viewed in this way, it is tempting to consider whether high-capacity sequence prediction models that work well
+in other domains, such as natural-language processing, can also provide effective solutions to the RL problem.
+To this end, we explore how RL can be tackled with the tools of sequence modeling, using a Transformer architecture
+to model distributions over trajectories and repurposing beam search as a planning algorithm. Framing RL as sequence
+modeling problem simplifies a range of design decisions, allowing us to dispense with many of the components common
+in offline RL algorithms. We demonstrate the flexibility of this approach across long-horizon dynamics prediction,
+imitation learning, goal-conditioned RL, and offline RL. Further, we show that this approach can be combined with
+existing model-free algorithms to yield a state-of-the-art planner in sparse-reward, long-horizon tasks.*
+
+This model was contributed by [CarlCochet](https://huggingface.co/CarlCochet). The original code can be found [here](https://github.com/jannerm/trajectory-transformer).
+
+## Usage tips
+
+This Transformer is used for deep reinforcement learning. To use it, you need to create sequences from
+actions, states and rewards from all previous timesteps. This model will treat all these elements together
+as one big sequence (a trajectory).
+
+## TrajectoryTransformerConfig
+
+[[autodoc]] TrajectoryTransformerConfig
+
+## TrajectoryTransformerModel
+
+[[autodoc]] TrajectoryTransformerModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/transfo-xl.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/transfo-xl.md
new file mode 100644
index 0000000000000000000000000000000000000000..c80d9352b5aef6376aad210a39ff6f2cc056d967
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/transfo-xl.md
@@ -0,0 +1,162 @@
+
+
+# Transformer XL
+
+
+
+This model is in maintenance mode only, so we won't accept any new PRs changing its code. This model was deprecated due to security issues linked to `pickle.load`.
+
+We recommend switching to more recent models for improved security.
+
+In case you would still like to use `TransfoXL` in your experiments, we recommend using the [Hub checkpoint](https://huggingface.co/transfo-xl/transfo-xl-wt103) with a specific revision to ensure you are downloading safe files from the Hub.
+
+You will need to set the environment variable `TRUST_REMOTE_CODE` to `True` in order to allow the
+usage of `pickle.load()`:
+
+```python
+import os
+from transformers import TransfoXLTokenizer, TransfoXLLMHeadModel
+
+os.environ["TRUST_REMOTE_CODE"] = "True"
+
+checkpoint = 'transfo-xl/transfo-xl-wt103'
+revision = '40a186da79458c9f9de846edfaea79c412137f97'
+
+tokenizer = TransfoXLTokenizer.from_pretrained(checkpoint, revision=revision)
+model = TransfoXLLMHeadModel.from_pretrained(checkpoint, revision=revision)
+```
+
+If you run into any issues running this model, please reinstall the last version that supported this model: v4.35.0.
+You can do so by running the following command: `pip install -U transformers==4.35.0`.
+
+
+
+
+
+## Overview
+
+The Transformer-XL model was proposed in [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860) by Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan
+Salakhutdinov. It's a causal (uni-directional) transformer with relative positioning (sinusoรฏdal) embeddings which can
+reuse previously computed hidden-states to attend to longer context (memory). This model also uses adaptive softmax
+inputs and outputs (tied).
+
+The abstract from the paper is the following:
+
+*Transformers have a potential of learning longer-term dependency, but are limited by a fixed-length context in the
+setting of language modeling. We propose a novel neural architecture Transformer-XL that enables learning dependency
+beyond a fixed length without disrupting temporal coherence. It consists of a segment-level recurrence mechanism and a
+novel positional encoding scheme. Our method not only enables capturing longer-term dependency, but also resolves the
+context fragmentation problem. As a result, Transformer-XL learns dependency that is 80% longer than RNNs and 450%
+longer than vanilla Transformers, achieves better performance on both short and long sequences, and is up to 1,800+
+times faster than vanilla Transformers during evaluation. Notably, we improve the state-of-the-art results of
+bpc/perplexity to 0.99 on enwiki8, 1.08 on text8, 18.3 on WikiText-103, 21.8 on One Billion Word, and 54.5 on Penn
+Treebank (without finetuning). When trained only on WikiText-103, Transformer-XL manages to generate reasonably
+coherent, novel text articles with thousands of tokens.*
+
+This model was contributed by [thomwolf](https://huggingface.co/thomwolf). The original code can be found [here](https://github.com/kimiyoung/transformer-xl).
+
+## Usage tips
+
+- Transformer-XL uses relative sinusoidal positional embeddings. Padding can be done on the left or on the right. The
+ original implementation trains on SQuAD with padding on the left, therefore the padding defaults are set to left.
+- Transformer-XL is one of the few models that has no sequence length limit.
+- Same as a regular GPT model, but introduces a recurrence mechanism for two consecutive segments (similar to a regular RNNs with two consecutive inputs). In this context, a segment is a number of consecutive tokens (for instance 512) that may span across multiple documents, and segments are fed in order to the model.
+- Basically, the hidden states of the previous segment are concatenated to the current input to compute the attention scores. This allows the model to pay attention to information that was in the previous segment as well as the current one. By stacking multiple attention layers, the receptive field can be increased to multiple previous segments.
+- This changes the positional embeddings to positional relative embeddings (as the regular positional embeddings would give the same results in the current input and the current hidden state at a given position) and needs to make some adjustments in the way attention scores are computed.
+
+
+
+
+TransformerXL does **not** work with *torch.nn.DataParallel* due to a bug in PyTorch, see [issue #36035](https://github.com/pytorch/pytorch/issues/36035)
+
+
+
+## Resources
+
+- [Text classification task guide](../tasks/sequence_classification)
+- [Causal language modeling task guide](../tasks/language_modeling)
+
+## TransfoXLConfig
+
+[[autodoc]] TransfoXLConfig
+
+## TransfoXLTokenizer
+
+[[autodoc]] TransfoXLTokenizer
+ - save_vocabulary
+
+## TransfoXL specific outputs
+
+[[autodoc]] models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLModelOutput
+
+[[autodoc]] models.deprecated.transfo_xl.modeling_transfo_xl.TransfoXLLMHeadModelOutput
+
+[[autodoc]] models.deprecated.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLModelOutput
+
+[[autodoc]] models.deprecated.transfo_xl.modeling_tf_transfo_xl.TFTransfoXLLMHeadModelOutput
+
+
+
+
+## TransfoXLModel
+
+[[autodoc]] TransfoXLModel
+ - forward
+
+## TransfoXLLMHeadModel
+
+[[autodoc]] TransfoXLLMHeadModel
+ - forward
+
+## TransfoXLForSequenceClassification
+
+[[autodoc]] TransfoXLForSequenceClassification
+ - forward
+
+
+
+
+## TFTransfoXLModel
+
+[[autodoc]] TFTransfoXLModel
+ - call
+
+## TFTransfoXLLMHeadModel
+
+[[autodoc]] TFTransfoXLLMHeadModel
+ - call
+
+## TFTransfoXLForSequenceClassification
+
+[[autodoc]] TFTransfoXLForSequenceClassification
+ - call
+
+
+
+
+## Internal Layers
+
+[[autodoc]] AdaptiveEmbedding
+
+[[autodoc]] TFAdaptiveEmbedding
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/trocr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/trocr.md
new file mode 100644
index 0000000000000000000000000000000000000000..c471a13bbd23c5338abda049aa87c5922c46a5b8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/trocr.md
@@ -0,0 +1,126 @@
+
+
+# TrOCR
+
+## Overview
+
+The TrOCR model was proposed in [TrOCR: Transformer-based Optical Character Recognition with Pre-trained
+Models](https://arxiv.org/abs/2109.10282) by Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang,
+Zhoujun Li, Furu Wei. TrOCR consists of an image Transformer encoder and an autoregressive text Transformer decoder to
+perform [optical character recognition (OCR)](https://en.wikipedia.org/wiki/Optical_character_recognition).
+
+The abstract from the paper is the following:
+
+*Text recognition is a long-standing research problem for document digitalization. Existing approaches for text recognition
+are usually built based on CNN for image understanding and RNN for char-level text generation. In addition, another language
+model is usually needed to improve the overall accuracy as a post-processing step. In this paper, we propose an end-to-end
+text recognition approach with pre-trained image Transformer and text Transformer models, namely TrOCR, which leverages the
+Transformer architecture for both image understanding and wordpiece-level text generation. The TrOCR model is simple but
+effective, and can be pre-trained with large-scale synthetic data and fine-tuned with human-labeled datasets. Experiments
+show that the TrOCR model outperforms the current state-of-the-art models on both printed and handwritten text recognition
+tasks.*
+
+
+
+ TrOCR architecture. Taken from the original paper .
+
+Please refer to the [`VisionEncoderDecoder`] class on how to use this model.
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code can be found
+[here](https://github.com/microsoft/unilm/tree/6f60612e7cc86a2a1ae85c47231507a587ab4e01/trocr).
+
+## Usage tips
+
+- The quickest way to get started with TrOCR is by checking the [tutorial
+ notebooks](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/TrOCR), which show how to use the model
+ at inference time as well as fine-tuning on custom data.
+- TrOCR is pre-trained in 2 stages before being fine-tuned on downstream datasets. It achieves state-of-the-art results
+ on both printed (e.g. the [SROIE dataset](https://paperswithcode.com/dataset/sroie) and handwritten (e.g. the [IAM
+ Handwriting dataset](https://fki.tic.heia-fr.ch/databases/iam-handwriting-database>) text recognition tasks. For more
+ information, see the [official models](https://huggingface.co/models?other=trocr>).
+- TrOCR is always used within the [VisionEncoderDecoder](vision-encoder-decoder) framework.
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with TrOCR. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+
+
+- A blog post on [Accelerating Document AI](https://huggingface.co/blog/document-ai) with TrOCR.
+- A blog post on how to [Document AI](https://github.com/philschmid/document-ai-transformers) with TrOCR.
+- A notebook on how to [finetune TrOCR on IAM Handwriting Database using Seq2SeqTrainer](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TrOCR/Fine_tune_TrOCR_on_IAM_Handwriting_Database_using_Seq2SeqTrainer.ipynb).
+- A notebook on [inference with TrOCR](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TrOCR/Inference_with_TrOCR_%2B_Gradio_demo.ipynb) and Gradio demo.
+- A notebook on [finetune TrOCR on the IAM Handwriting Database](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TrOCR/Fine_tune_TrOCR_on_IAM_Handwriting_Database_using_native_PyTorch.ipynb) using native PyTorch.
+- A notebook on [evaluating TrOCR on the IAM test set](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TrOCR/Evaluating_TrOCR_base_handwritten_on_the_IAM_test_set.ipynb).
+
+
+
+- [Casual language modeling](https://huggingface.co/docs/transformers/tasks/language_modeling) task guide.
+
+โก๏ธ Inference
+
+- An interactive-demo on [TrOCR handwritten character recognition](https://huggingface.co/spaces/nielsr/TrOCR-handwritten).
+
+## Inference
+
+TrOCR's [`VisionEncoderDecoder`] model accepts images as input and makes use of
+[`~generation.GenerationMixin.generate`] to autoregressively generate text given the input image.
+
+The [`ViTImageProcessor`/`DeiTImageProcessor`] class is responsible for preprocessing the input image and
+[`RobertaTokenizer`/`XLMRobertaTokenizer`] decodes the generated target tokens to the target string. The
+[`TrOCRProcessor`] wraps [`ViTImageProcessor`/`DeiTImageProcessor`] and [`RobertaTokenizer`/`XLMRobertaTokenizer`]
+into a single instance to both extract the input features and decode the predicted token ids.
+
+- Step-by-step Optical Character Recognition (OCR)
+
+``` py
+>>> from transformers import TrOCRProcessor, VisionEncoderDecoderModel
+>>> import requests
+>>> from PIL import Image
+
+>>> processor = TrOCRProcessor.from_pretrained("microsoft/trocr-base-handwritten")
+>>> model = VisionEncoderDecoderModel.from_pretrained("microsoft/trocr-base-handwritten")
+
+>>> # load image from the IAM dataset
+>>> url = "https://fki.tic.heia-fr.ch/static/img/a01-122-02.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
+
+>>> pixel_values = processor(image, return_tensors="pt").pixel_values
+>>> generated_ids = model.generate(pixel_values)
+
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
+```
+
+See the [model hub](https://huggingface.co/models?filter=trocr) to look for TrOCR checkpoints.
+
+## TrOCRConfig
+
+[[autodoc]] TrOCRConfig
+
+## TrOCRProcessor
+
+[[autodoc]] TrOCRProcessor
+ - __call__
+ - from_pretrained
+ - save_pretrained
+ - batch_decode
+ - decode
+
+## TrOCRForCausalLM
+
+[[autodoc]] TrOCRForCausalLM
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tvlt.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tvlt.md
new file mode 100644
index 0000000000000000000000000000000000000000..0a0f50e47315693a684b369d7119315a85fb6883
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tvlt.md
@@ -0,0 +1,85 @@
+
+
+# TVLT
+
+
+
+This model is in maintenance mode only, we don't accept any new PRs changing its code.
+If you run into any issues running this model, please reinstall the last version that supported this model: v4.40.2.
+You can do so by running the following command: `pip install -U transformers==4.40.2`.
+
+
+
+## Overview
+
+The TVLT model was proposed in [TVLT: Textless Vision-Language Transformer](https://arxiv.org/abs/2209.14156)
+by Zineng Tang, Jaemin Cho, Yixin Nie, Mohit Bansal (the first three authors contributed equally). The Textless Vision-Language Transformer (TVLT) is a model that uses raw visual and audio inputs for vision-and-language representation learning, without using text-specific modules such as tokenization or automatic speech recognition (ASR). It can perform various audiovisual and vision-language tasks like retrieval, question answering, etc.
+
+The abstract from the paper is the following:
+
+*In this work, we present the Textless Vision-Language Transformer (TVLT), where homogeneous transformer blocks take raw visual and audio inputs for vision-and-language representation learning with minimal modality-specific design, and do not use text-specific modules such as tokenization or automatic speech recognition (ASR). TVLT is trained by reconstructing masked patches of continuous video frames and audio spectrograms (masked autoencoding) and contrastive modeling to align video and audio. TVLT attains performance comparable to its text-based counterpart on various multimodal tasks, such as visual question answering, image retrieval, video retrieval, and multimodal sentiment analysis, with 28x faster inference speed and only 1/3 of the parameters. Our findings suggest the possibility of learning compact and efficient visual-linguistic representations from low-level visual and audio signals without assuming the prior existence of text.*
+
+
+
+
+
+ TVLT architecture. Taken from the original paper .
+
+The original code can be found [here](https://github.com/zinengtang/TVLT). This model was contributed by [Zineng Tang](https://huggingface.co/ZinengTang).
+
+## Usage tips
+
+- TVLT is a model that takes both `pixel_values` and `audio_values` as input. One can use [`TvltProcessor`] to prepare data for the model.
+ This processor wraps an image processor (for the image/video modality) and an audio feature extractor (for the audio modality) into one.
+- TVLT is trained with images/videos and audios of various sizes: the authors resize and crop the input images/videos to 224 and limit the length of audio spectrogram to 2048. To make batching of videos and audios possible, the authors use a `pixel_mask` that indicates which pixels are real/padding and `audio_mask` that indicates which audio values are real/padding.
+- The design of TVLT is very similar to that of a standard Vision Transformer (ViT) and masked autoencoder (MAE) as in [ViTMAE](vitmae). The difference is that the model includes embedding layers for the audio modality.
+- The PyTorch version of this model is only available in torch 1.10 and higher.
+
+## TvltConfig
+
+[[autodoc]] TvltConfig
+
+## TvltProcessor
+
+[[autodoc]] TvltProcessor
+ - __call__
+
+## TvltImageProcessor
+
+[[autodoc]] TvltImageProcessor
+ - preprocess
+
+## TvltFeatureExtractor
+
+[[autodoc]] TvltFeatureExtractor
+ - __call__
+
+## TvltModel
+
+[[autodoc]] TvltModel
+ - forward
+
+## TvltForPreTraining
+
+[[autodoc]] TvltForPreTraining
+ - forward
+
+## TvltForAudioVisualClassification
+
+[[autodoc]] TvltForAudioVisualClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tvp.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tvp.md
new file mode 100644
index 0000000000000000000000000000000000000000..22b400a06c736afd890f8a1a551d83cd573ac5ab
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/tvp.md
@@ -0,0 +1,186 @@
+
+
+# TVP
+
+## Overview
+
+The text-visual prompting (TVP) framework was proposed in the paper [Text-Visual Prompting for Efficient 2D Temporal Video Grounding](https://arxiv.org/abs/2303.04995) by Yimeng Zhang, Xin Chen, Jinghan Jia, Sijia Liu, Ke Ding.
+
+The abstract from the paper is the following:
+
+*In this paper, we study the problem of temporal video grounding (TVG), which aims to predict the starting/ending time points of moments described by a text sentence within a long untrimmed video. Benefiting from fine-grained 3D visual features, the TVG techniques have achieved remarkable progress in recent years. However, the high complexity of 3D convolutional neural networks (CNNs) makes extracting dense 3D visual features time-consuming, which calls for intensive memory and computing resources. Towards efficient TVG, we propose a novel text-visual prompting (TVP) framework, which incorporates optimized perturbation patterns (that we call โpromptsโ) into both visual inputs and textual features of a TVG model. In sharp contrast to 3D CNNs, we show that TVP allows us to effectively co-train vision encoder and language encoder in a 2D TVG model and improves the performance of cross-modal feature fusion using only low-complexity sparse 2D visual features. Further, we propose a Temporal-Distance IoU (TDIoU) loss for efficient learning of TVG. Experiments on two benchmark datasets, Charades-STA and ActivityNet Captions datasets, empirically show that the proposed TVP significantly boosts the performance of 2D TVG (e.g., 9.79% improvement on Charades-STA and 30.77% improvement on ActivityNet Captions) and achieves 5ร inference acceleration over TVG using 3D visual features.*
+
+This research addresses temporal video grounding (TVG), which is the process of pinpointing the start and end times of specific events in a long video, as described by a text sentence. Text-visual prompting (TVP), is proposed to enhance TVG. TVP involves integrating specially designed patterns, known as 'prompts', into both the visual (image-based) and textual (word-based) input components of a TVG model. These prompts provide additional spatial-temporal context, improving the model's ability to accurately determine event timings in the video. The approach employs 2D visual inputs in place of 3D ones. Although 3D inputs offer more spatial-temporal detail, they are also more time-consuming to process. The use of 2D inputs with the prompting method aims to provide similar levels of context and accuracy more efficiently.
+
+
+
+ TVP architecture. Taken from the original paper.
+
+This model was contributed by [Jiqing Feng](https://huggingface.co/Jiqing). The original code can be found [here](https://github.com/intel/TVP).
+
+## Usage tips and examples
+
+Prompts are optimized perturbation patterns, which would be added to input video frames or text features. Universal set refers to using the same exact set of prompts for any input, this means that these prompts are added consistently to all video frames and text features, regardless of the input's content.
+
+TVP consists of a visual encoder and cross-modal encoder. A universal set of visual prompts and text prompts to be integrated into sampled video frames and textual features, respectively. Specially, a set of different visual prompts are applied to uniformly-sampled frames of one untrimmed video in order.
+
+The goal of this model is to incorporate trainable prompts into both visual inputs and textual features to temporal video grounding(TVG) problems.
+In principle, one can apply any visual, cross-modal encoder in the proposed architecture.
+
+The [`TvpProcessor`] wraps [`BertTokenizer`] and [`TvpImageProcessor`] into a single instance to both
+encode the text and prepare the images respectively.
+
+The following example shows how to run temporal video grounding using [`TvpProcessor`] and [`TvpForVideoGrounding`].
+```python
+import av
+import cv2
+import numpy as np
+import torch
+from huggingface_hub import hf_hub_download
+from transformers import AutoProcessor, TvpForVideoGrounding
+
+
+def pyav_decode(container, sampling_rate, num_frames, clip_idx, num_clips, target_fps):
+ '''
+ Convert the video from its original fps to the target_fps and decode the video with PyAV decoder.
+ Args:
+ container (container): pyav container.
+ sampling_rate (int): frame sampling rate (interval between two sampled frames).
+ num_frames (int): number of frames to sample.
+ clip_idx (int): if clip_idx is -1, perform random temporal sampling.
+ If clip_idx is larger than -1, uniformly split the video to num_clips
+ clips, and select the clip_idx-th video clip.
+ num_clips (int): overall number of clips to uniformly sample from the given video.
+ target_fps (int): the input video may have different fps, convert it to
+ the target video fps before frame sampling.
+ Returns:
+ frames (tensor): decoded frames from the video. Return None if the no
+ video stream was found.
+ fps (float): the number of frames per second of the video.
+ '''
+ video = container.streams.video[0]
+ fps = float(video.average_rate)
+ clip_size = sampling_rate * num_frames / target_fps * fps
+ delta = max(num_frames - clip_size, 0)
+ start_idx = delta * clip_idx / num_clips
+ end_idx = start_idx + clip_size - 1
+ timebase = video.duration / num_frames
+ video_start_pts = int(start_idx * timebase)
+ video_end_pts = int(end_idx * timebase)
+ seek_offset = max(video_start_pts - 1024, 0)
+ container.seek(seek_offset, any_frame=False, backward=True, stream=video)
+ frames = {}
+ for frame in container.decode(video=0):
+ if frame.pts < video_start_pts:
+ continue
+ frames[frame.pts] = frame
+ if frame.pts > video_end_pts:
+ break
+ frames = [frames[pts] for pts in sorted(frames)]
+ return frames, fps
+
+
+def decode(container, sampling_rate, num_frames, clip_idx, num_clips, target_fps):
+ '''
+ Decode the video and perform temporal sampling.
+ Args:
+ container (container): pyav container.
+ sampling_rate (int): frame sampling rate (interval between two sampled frames).
+ num_frames (int): number of frames to sample.
+ clip_idx (int): if clip_idx is -1, perform random temporal sampling.
+ If clip_idx is larger than -1, uniformly split the video to num_clips
+ clips, and select the clip_idx-th video clip.
+ num_clips (int): overall number of clips to uniformly sample from the given video.
+ target_fps (int): the input video may have different fps, convert it to
+ the target video fps before frame sampling.
+ Returns:
+ frames (tensor): decoded frames from the video.
+ '''
+ assert clip_idx >= -2, "Not a valied clip_idx {}".format(clip_idx)
+ frames, fps = pyav_decode(container, sampling_rate, num_frames, clip_idx, num_clips, target_fps)
+ clip_size = sampling_rate * num_frames / target_fps * fps
+ index = np.linspace(0, clip_size - 1, num_frames)
+ index = np.clip(index, 0, len(frames) - 1).astype(np.int64)
+ frames = np.array([frames[idx].to_rgb().to_ndarray() for idx in index])
+ frames = frames.transpose(0, 3, 1, 2)
+ return frames
+
+
+file = hf_hub_download(repo_id="Intel/tvp_demo", filename="AK2KG.mp4", repo_type="dataset")
+model = TvpForVideoGrounding.from_pretrained("Intel/tvp-base")
+
+decoder_kwargs = dict(
+ container=av.open(file, metadata_errors="ignore"),
+ sampling_rate=1,
+ num_frames=model.config.num_frames,
+ clip_idx=0,
+ num_clips=1,
+ target_fps=3,
+)
+raw_sampled_frms = decode(**decoder_kwargs)
+
+text = "a person is sitting on a bed."
+processor = AutoProcessor.from_pretrained("Intel/tvp-base")
+model_inputs = processor(
+ text=[text], videos=list(raw_sampled_frms), return_tensors="pt", max_text_length=100#, size=size
+)
+
+model_inputs["pixel_values"] = model_inputs["pixel_values"].to(model.dtype)
+output = model(**model_inputs)
+
+def get_video_duration(filename):
+ cap = cv2.VideoCapture(filename)
+ if cap.isOpened():
+ rate = cap.get(5)
+ frame_num = cap.get(7)
+ duration = frame_num/rate
+ return duration
+ return -1
+
+duration = get_video_duration(file)
+start, end = processor.post_process_video_grounding(output.logits, duration)
+
+print(f"The time slot of the video corresponding to the text \"{text}\" is from {start}s to {end}s")
+```
+
+Tips:
+
+- This implementation of TVP uses [`BertTokenizer`] to generate text embeddings and Resnet-50 model to compute visual embeddings.
+- Checkpoints for pre-trained [tvp-base](https://huggingface.co/Intel/tvp-base) is released.
+- Please refer to [Table 2](https://arxiv.org/pdf/2303.04995.pdf) for TVP's performance on Temporal Video Grounding task.
+
+
+## TvpConfig
+
+[[autodoc]] TvpConfig
+
+## TvpImageProcessor
+
+[[autodoc]] TvpImageProcessor
+ - preprocess
+
+## TvpProcessor
+
+[[autodoc]] TvpProcessor
+ - __call__
+
+## TvpModel
+
+[[autodoc]] TvpModel
+ - forward
+
+## TvpForVideoGrounding
+
+[[autodoc]] TvpForVideoGrounding
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/udop.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/udop.md
new file mode 100644
index 0000000000000000000000000000000000000000..614bd2ff4fd7156e094b83f20dfb4a76bf32a4cf
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/udop.md
@@ -0,0 +1,113 @@
+
+
+# UDOP
+
+## Overview
+
+The UDOP model was proposed in [Unifying Vision, Text, and Layout for Universal Document Processing](https://arxiv.org/abs/2212.02623) by Zineng Tang, Ziyi Yang, Guoxin Wang, Yuwei Fang, Yang Liu, Chenguang Zhu, Michael Zeng, Cha Zhang, Mohit Bansal.
+UDOP adopts an encoder-decoder Transformer architecture based on [T5](t5) for document AI tasks like document image classification, document parsing and document visual question answering.
+
+The abstract from the paper is the following:
+
+We propose Universal Document Processing (UDOP), a foundation Document AI model which unifies text, image, and layout modalities together with varied task formats, including document understanding and generation. UDOP leverages the spatial correlation between textual content and document image to model image, text, and layout modalities with one uniform representation. With a novel Vision-Text-Layout Transformer, UDOP unifies pretraining and multi-domain downstream tasks into a prompt-based sequence generation scheme. UDOP is pretrained on both large-scale unlabeled document corpora using innovative self-supervised objectives and diverse labeled data. UDOP also learns to generate document images from text and layout modalities via masked image reconstruction. To the best of our knowledge, this is the first time in the field of document AI that one model simultaneously achieves high-quality neural document editing and content customization. Our method sets the state-of-the-art on 9 Document AI tasks, e.g., document understanding and QA, across diverse data domains like finance reports, academic papers, and websites. UDOP ranks first on the leaderboard of the Document Understanding Benchmark (DUE).*
+
+
+
+ UDOP architecture. Taken from the original paper.
+
+## Usage tips
+
+- In addition to *input_ids*, [`UdopForConditionalGeneration`] also expects the input `bbox`, which are
+ the bounding boxes (i.e. 2D-positions) of the input tokens. These can be obtained using an external OCR engine such
+ as Google's [Tesseract](https://github.com/tesseract-ocr/tesseract) (there's a [Python wrapper](https://pypi.org/project/pytesseract/) available). Each bounding box should be in (x0, y0, x1, y1) format, where (x0, y0) corresponds to the position of the upper left corner in the bounding box, and (x1, y1) represents the
+ position of the lower right corner. Note that one first needs to normalize the bounding boxes to be on a 0-1000
+ scale. To normalize, you can use the following function:
+
+```python
+def normalize_bbox(bbox, width, height):
+ return [
+ int(1000 * (bbox[0] / width)),
+ int(1000 * (bbox[1] / height)),
+ int(1000 * (bbox[2] / width)),
+ int(1000 * (bbox[3] / height)),
+ ]
+```
+
+Here, `width` and `height` correspond to the width and height of the original document in which the token
+occurs. Those can be obtained using the Python Image Library (PIL) library for example, as follows:
+
+```python
+from PIL import Image
+
+# Document can be a png, jpg, etc. PDFs must be converted to images.
+image = Image.open(name_of_your_document).convert("RGB")
+
+width, height = image.size
+```
+
+One can use [`UdopProcessor`] to prepare images and text for the model, which takes care of all of this. By default, this class uses the Tesseract engine to extract a list of words and boxes (coordinates) from a given document. Its functionality is equivalent to that of [`LayoutLMv3Processor`], hence it supports passing either `apply_ocr=False` in case you prefer to use your own OCR engine or `apply_ocr=True` in case you want the default OCR engine to be used. Refer to the [usage guide of LayoutLMv2](layoutlmv2#usage-layoutlmv2processor) regarding all possible use cases (the functionality of `UdopProcessor` is identical).
+
+- If using an own OCR engine of choice, one recommendation is Azure's [Read API](https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/how-to/call-read-api), which supports so-called line segments. Use of segment position embeddings typically results in better performance.
+- At inference time, it's recommended to use the `generate` method to autoregressively generate text given a document image.
+- The model has been pre-trained on both self-supervised and supervised objectives. One can use the various task prefixes (prompts) used during pre-training to test out the out-of-the-box capabilities. For instance, the model can be prompted with "Question answering. What is the date?", as "Question answering." is the task prefix used during pre-training for DocVQA. Refer to the [paper](https://arxiv.org/abs/2212.02623) (table 1) for all task prefixes.
+- One can also fine-tune [`UdopEncoderModel`], which is the encoder-only part of UDOP, which can be seen as a LayoutLMv3-like Transformer encoder. For discriminative tasks, one can just add a linear classifier on top of it and fine-tune it on a labeled dataset.
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr).
+The original code can be found [here](https://github.com/microsoft/UDOP).
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with UDOP. If
+you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll
+review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+- Demo notebooks regarding UDOP can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/UDOP) that show how
+to fine-tune UDOP on a custom dataset as well as inference. ๐
+- [Document question answering task guide](../tasks/document_question_answering)
+
+## UdopConfig
+
+[[autodoc]] UdopConfig
+
+## UdopTokenizer
+
+[[autodoc]] UdopTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## UdopTokenizerFast
+
+[[autodoc]] UdopTokenizerFast
+
+## UdopProcessor
+
+[[autodoc]] UdopProcessor
+ - __call__
+
+## UdopModel
+
+[[autodoc]] UdopModel
+ - forward
+
+## UdopForConditionalGeneration
+
+[[autodoc]] UdopForConditionalGeneration
+ - forward
+
+## UdopEncoderModel
+
+[[autodoc]] UdopEncoderModel
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/ul2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/ul2.md
new file mode 100644
index 0000000000000000000000000000000000000000..f4d01c40b0c10944e5ddb3451f355e4c95bf2d9a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/ul2.md
@@ -0,0 +1,43 @@
+
+
+# UL2
+
+## Overview
+
+The T5 model was presented in [Unifying Language Learning Paradigms](https://arxiv.org/pdf/2205.05131v1.pdf) by Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, Donald Metzler.
+
+The abstract from the paper is the following:
+
+*Existing pre-trained models are generally geared towards a particular class of problems. To date, there seems to be still no consensus on what the right architecture and pre-training setup should be. This paper presents a unified framework for pre-training models that are universally effective across datasets and setups. We begin by disentangling architectural archetypes with pre-training objectives -- two concepts that are commonly conflated. Next, we present a generalized and unified perspective for self-supervision in NLP and show how different pre-training objectives can be cast as one another and how interpolating between different objectives can be effective. We then propose Mixture-of-Denoisers (MoD), a pre-training objective that combines diverse pre-training paradigms together. We furthermore introduce a notion of mode switching, wherein downstream fine-tuning is associated with specific pre-training schemes. We conduct extensive ablative experiments to compare multiple pre-training objectives and find that our method pushes the Pareto-frontier by outperforming T5 and/or GPT-like models across multiple diverse setups. Finally, by scaling our model up to 20B parameters, we achieve SOTA performance on 50 well-established supervised NLP tasks ranging from language generation (with automated and human evaluation), language understanding, text classification, question answering, commonsense reasoning, long text reasoning, structured knowledge grounding and information retrieval. Our model also achieve strong results at in-context learning, outperforming 175B GPT-3 on zero-shot SuperGLUE and tripling the performance of T5-XXL on one-shot summarization.*
+
+This model was contributed by [DanielHesslow](https://huggingface.co/Seledorn). The original code can be found [here](https://github.com/google-research/google-research/tree/master/ul2).
+
+## Usage tips
+
+- UL2 is an encoder-decoder model pre-trained on a mixture of denoising functions as well as fine-tuned on an array of downstream tasks.
+- UL2 has the same architecture as [T5v1.1](t5v1.1) but uses the Gated-SiLU activation function instead of Gated-GELU.
+- The authors release checkpoints of one architecture which can be seen [here](https://huggingface.co/google/ul2)
+
+
+
+As UL2 has the same architecture as T5v1.1, refer to [T5's documentation page](t5) for API reference, tips, code examples and notebooks.
+
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/umt5.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/umt5.md
new file mode 100644
index 0000000000000000000000000000000000000000..b9f86a0304e89234e9c6be31d854fd6851e050d7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/umt5.md
@@ -0,0 +1,112 @@
+
+
+# UMT5
+
+
+
+## Overview
+
+The UMT5 model was proposed in [UniMax: Fairer and More Effective Language Sampling for Large-Scale Multilingual Pretraining](https://openreview.net/forum?id=kXwdL1cWOAi) by Hyung Won Chung, Xavier Garcia, Adam Roberts, Yi Tay, Orhan Firat, Sharan Narang, Noah Constant.
+
+The abstract from the paper is the following:
+
+*Pretrained multilingual large language models have typically used heuristic temperature-based sampling to balance between different languages. However previous work has not systematically evaluated the efficacy of different pretraining language distributions across model scales. In this paper, we propose a new sampling method, UniMax, that delivers more uniform coverage of head languages while mitigating overfitting on tail languages by explicitly capping the number of repeats over each language's corpus. We perform an extensive series of ablations testing a range of sampling strategies on a suite of multilingual benchmarks, while varying model scale. We find that UniMax outperforms standard temperature-based sampling, and the benefits persist as scale increases. As part of our contribution, we release: (i) an improved and refreshed mC4 multilingual corpus consisting of 29 trillion characters across 107 languages, and (ii) a suite of pretrained umT5 model checkpoints trained with UniMax sampling.*
+
+Google has released the following variants:
+
+- [google/umt5-small](https://huggingface.co/google/umt5-small)
+- [google/umt5-base](https://huggingface.co/google/umt5-base)
+- [google/umt5-xl](https://huggingface.co/google/umt5-xl)
+- [google/umt5-xxl](https://huggingface.co/google/umt5-xxl).
+
+This model was contributed by [agemagician](https://huggingface.co/agemagician) and [stefan-it](https://huggingface.co/stefan-it). The original code can be
+found [here](https://github.com/google-research/t5x).
+
+## Usage tips
+
+- UMT5 was only pre-trained on [mC4](https://huggingface.co/datasets/mc4) excluding any supervised training.
+Therefore, this model has to be fine-tuned before it is usable on a downstream task, unlike the original T5 model.
+- Since umT5 was pre-trained in an unsupervised manner, there's no real advantage to using a task prefix during single-task
+fine-tuning. If you are doing multi-task fine-tuning, you should use a prefix.
+
+## Differences with mT5?
+`UmT5` is based on mT5, with a non-shared relative positional bias that is computed for each layer. This means that the model set `has_relative_bias` for each layer.
+The conversion script is also different because the model was saved in t5x's latest checkpointing format.
+
+# Sample usage
+
+```python
+>>> from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("google/umt5-small")
+>>> tokenizer = AutoTokenizer.from_pretrained("google/umt5-small")
+
+>>> inputs = tokenizer(
+... "A walks into a bar and orders a with pinch of .",
+... return_tensors="pt",
+... )
+>>> outputs = model.generate(**inputs)
+>>> print(tokenizer.batch_decode(outputs))
+['nyone who drink a alcohol A A. This I']
+```
+
+
+
+Refer to [T5's documentation page](t5) for more tips, code examples and notebooks.
+
+
+## UMT5Config
+
+[[autodoc]] UMT5Config
+
+## UMT5Model
+
+[[autodoc]] UMT5Model
+ - forward
+
+## UMT5ForConditionalGeneration
+
+[[autodoc]] UMT5ForConditionalGeneration
+ - forward
+
+## UMT5EncoderModel
+
+[[autodoc]] UMT5EncoderModel
+ - forward
+
+## UMT5ForSequenceClassification
+
+[[autodoc]] UMT5ForSequenceClassification
+ - forward
+
+## UMT5ForTokenClassification
+
+[[autodoc]] UMT5ForTokenClassification
+ - forward
+
+## UMT5ForQuestionAnswering
+
+[[autodoc]] UMT5ForQuestionAnswering
+ - forward
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/unispeech-sat.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/unispeech-sat.md
new file mode 100644
index 0000000000000000000000000000000000000000..3f0bbcc79323f23271c555fca6fe4c0864ad69ed
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/unispeech-sat.md
@@ -0,0 +1,92 @@
+
+
+# UniSpeech-SAT
+
+## Overview
+
+The UniSpeech-SAT model was proposed in [UniSpeech-SAT: Universal Speech Representation Learning with Speaker Aware
+Pre-Training](https://arxiv.org/abs/2110.05752) by Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen,
+Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu .
+
+The abstract from the paper is the following:
+
+*Self-supervised learning (SSL) is a long-standing goal for speech processing, since it utilizes large-scale unlabeled
+data and avoids extensive human labeling. Recent years witness great successes in applying self-supervised learning in
+speech recognition, while limited exploration was attempted in applying SSL for modeling speaker characteristics. In
+this paper, we aim to improve the existing SSL framework for speaker representation learning. Two methods are
+introduced for enhancing the unsupervised speaker information extraction. First, we apply the multi-task learning to
+the current SSL framework, where we integrate the utterance-wise contrastive loss with the SSL objective function.
+Second, for better speaker discrimination, we propose an utterance mixing strategy for data augmentation, where
+additional overlapped utterances are created unsupervisedly and incorporate during training. We integrate the proposed
+methods into the HuBERT framework. Experiment results on SUPERB benchmark show that the proposed system achieves
+state-of-the-art performance in universal representation learning, especially for speaker identification oriented
+tasks. An ablation study is performed verifying the efficacy of each proposed method. Finally, we scale up training
+dataset to 94 thousand hours public audio data and achieve further performance improvement in all SUPERB tasks.*
+
+This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten). The Authors' code can be
+found [here](https://github.com/microsoft/UniSpeech/tree/main/UniSpeech-SAT).
+
+## Usage tips
+
+- UniSpeechSat is a speech model that accepts a float array corresponding to the raw waveform of the speech signal.
+ Please use [`Wav2Vec2Processor`] for the feature extraction.
+- UniSpeechSat model can be fine-tuned using connectionist temporal classification (CTC) so the model output has to be
+ decoded using [`Wav2Vec2CTCTokenizer`].
+- UniSpeechSat performs especially well on speaker verification, speaker identification, and speaker diarization tasks.
+
+## Resources
+
+- [Audio classification task guide](../tasks/audio_classification)
+- [Automatic speech recognition task guide](../tasks/asr)
+
+## UniSpeechSatConfig
+
+[[autodoc]] UniSpeechSatConfig
+
+## UniSpeechSat specific outputs
+
+[[autodoc]] models.unispeech_sat.modeling_unispeech_sat.UniSpeechSatForPreTrainingOutput
+
+## UniSpeechSatModel
+
+[[autodoc]] UniSpeechSatModel
+ - forward
+
+## UniSpeechSatForCTC
+
+[[autodoc]] UniSpeechSatForCTC
+ - forward
+
+## UniSpeechSatForSequenceClassification
+
+[[autodoc]] UniSpeechSatForSequenceClassification
+ - forward
+
+## UniSpeechSatForAudioFrameClassification
+
+[[autodoc]] UniSpeechSatForAudioFrameClassification
+ - forward
+
+## UniSpeechSatForXVector
+
+[[autodoc]] UniSpeechSatForXVector
+ - forward
+
+## UniSpeechSatForPreTraining
+
+[[autodoc]] UniSpeechSatForPreTraining
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/unispeech.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/unispeech.md
new file mode 100644
index 0000000000000000000000000000000000000000..2b2b13bed52c17890f63e0e86d88a13907eb29e5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/unispeech.md
@@ -0,0 +1,77 @@
+
+
+# UniSpeech
+
+## Overview
+
+The UniSpeech model was proposed in [UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data](https://arxiv.org/abs/2101.07597) by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael
+Zeng, Xuedong Huang .
+
+The abstract from the paper is the following:
+
+*In this paper, we propose a unified pre-training approach called UniSpeech to learn speech representations with both
+unlabeled and labeled data, in which supervised phonetic CTC learning and phonetically-aware contrastive
+self-supervised learning are conducted in a multi-task learning manner. The resultant representations can capture
+information more correlated with phonetic structures and improve the generalization across languages and domains. We
+evaluate the effectiveness of UniSpeech for cross-lingual representation learning on public CommonVoice corpus. The
+results show that UniSpeech outperforms self-supervised pretraining and supervised transfer learning for speech
+recognition by a maximum of 13.4% and 17.8% relative phone error rate reductions respectively (averaged over all
+testing languages). The transferability of UniSpeech is also demonstrated on a domain-shift speech recognition task,
+i.e., a relative word error rate reduction of 6% against the previous approach.*
+
+This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten). The Authors' code can be
+found [here](https://github.com/microsoft/UniSpeech/tree/main/UniSpeech).
+
+## Usage tips
+
+- UniSpeech is a speech model that accepts a float array corresponding to the raw waveform of the speech signal. Please
+ use [`Wav2Vec2Processor`] for the feature extraction.
+- UniSpeech model can be fine-tuned using connectionist temporal classification (CTC) so the model output has to be
+ decoded using [`Wav2Vec2CTCTokenizer`].
+
+## Resources
+
+- [Audio classification task guide](../tasks/audio_classification)
+- [Automatic speech recognition task guide](../tasks/asr)
+
+## UniSpeechConfig
+
+[[autodoc]] UniSpeechConfig
+
+## UniSpeech specific outputs
+
+[[autodoc]] models.unispeech.modeling_unispeech.UniSpeechForPreTrainingOutput
+
+## UniSpeechModel
+
+[[autodoc]] UniSpeechModel
+ - forward
+
+## UniSpeechForCTC
+
+[[autodoc]] UniSpeechForCTC
+ - forward
+
+## UniSpeechForSequenceClassification
+
+[[autodoc]] UniSpeechForSequenceClassification
+ - forward
+
+## UniSpeechForPreTraining
+
+[[autodoc]] UniSpeechForPreTraining
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/univnet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/univnet.md
new file mode 100644
index 0000000000000000000000000000000000000000..45bd94732773ae48ee39dc847019a50a4a036d73
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/univnet.md
@@ -0,0 +1,80 @@
+
+
+# UnivNet
+
+## Overview
+
+The UnivNet model was proposed in [UnivNet: A Neural Vocoder with Multi-Resolution Spectrogram Discriminators for High-Fidelity Waveform Generation](https://arxiv.org/abs/2106.07889) by Won Jang, Dan Lim, Jaesam Yoon, Bongwan Kin, and Juntae Kim.
+The UnivNet model is a generative adversarial network (GAN) trained to synthesize high fidelity speech waveforms. The UnivNet model shared in `transformers` is the *generator*, which maps a conditioning log-mel spectrogram and optional noise sequence to a speech waveform (e.g. a vocoder). Only the generator is required for inference. The *discriminator* used to train the `generator` is not implemented.
+
+The abstract from the paper is the following:
+
+*Most neural vocoders employ band-limited mel-spectrograms to generate waveforms. If full-band spectral features are used as the input, the vocoder can be provided with as much acoustic information as possible. However, in some models employing full-band mel-spectrograms, an over-smoothing problem occurs as part of which non-sharp spectrograms are generated. To address this problem, we propose UnivNet, a neural vocoder that synthesizes high-fidelity waveforms in real time. Inspired by works in the field of voice activity detection, we added a multi-resolution spectrogram discriminator that employs multiple linear spectrogram magnitudes computed using various parameter sets. Using full-band mel-spectrograms as input, we expect to generate high-resolution signals by adding a discriminator that employs spectrograms of multiple resolutions as the input. In an evaluation on a dataset containing information on hundreds of speakers, UnivNet obtained the best objective and subjective results among competing models for both seen and unseen speakers. These results, including the best subjective score for text-to-speech, demonstrate the potential for fast adaptation to new speakers without a need for training from scratch.*
+
+Tips:
+
+- The `noise_sequence` argument for [`UnivNetModel.forward`] should be standard Gaussian noise (such as from `torch.randn`) of shape `([batch_size], noise_length, model.config.model_in_channels)`, where `noise_length` should match the length dimension (dimension 1) of the `input_features` argument. If not supplied, it will be randomly generated; a `torch.Generator` can be supplied to the `generator` argument so that the forward pass can be reproduced. (Note that [`UnivNetFeatureExtractor`] will return generated noise by default, so it shouldn't be necessary to generate `noise_sequence` manually.)
+- Padding added by [`UnivNetFeatureExtractor`] can be removed from the [`UnivNetModel`] output through the [`UnivNetFeatureExtractor.batch_decode`] method, as shown in the usage example below.
+- Padding the end of each waveform with silence can reduce artifacts at the end of the generated audio sample. This can be done by supplying `pad_end = True` to [`UnivNetFeatureExtractor.__call__`]. See [this issue](https://github.com/seungwonpark/melgan/issues/8) for more details.
+
+Usage Example:
+
+```python
+import torch
+from scipy.io.wavfile import write
+from datasets import Audio, load_dataset
+
+from transformers import UnivNetFeatureExtractor, UnivNetModel
+
+model_id_or_path = "dg845/univnet-dev"
+model = UnivNetModel.from_pretrained(model_id_or_path)
+feature_extractor = UnivNetFeatureExtractor.from_pretrained(model_id_or_path)
+
+ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
+# Resample the audio to the model and feature extractor's sampling rate.
+ds = ds.cast_column("audio", Audio(sampling_rate=feature_extractor.sampling_rate))
+# Pad the end of the converted waveforms to reduce artifacts at the end of the output audio samples.
+inputs = feature_extractor(
+ ds[0]["audio"]["array"], sampling_rate=ds[0]["audio"]["sampling_rate"], pad_end=True, return_tensors="pt"
+)
+
+with torch.no_grad():
+ audio = model(**inputs)
+
+# Remove the extra padding at the end of the output.
+audio = feature_extractor.batch_decode(**audio)[0]
+# Convert to wav file
+write("sample_audio.wav", feature_extractor.sampling_rate, audio)
+```
+
+This model was contributed by [dg845](https://huggingface.co/dg845).
+To the best of my knowledge, there is no official code release, but an unofficial implementation can be found at [maum-ai/univnet](https://github.com/maum-ai/univnet) with pretrained checkpoints [here](https://github.com/maum-ai/univnet#pre-trained-model).
+
+
+## UnivNetConfig
+
+[[autodoc]] UnivNetConfig
+
+## UnivNetFeatureExtractor
+
+[[autodoc]] UnivNetFeatureExtractor
+ - __call__
+
+## UnivNetModel
+
+[[autodoc]] UnivNetModel
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/upernet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/upernet.md
new file mode 100644
index 0000000000000000000000000000000000000000..418c3ef1786b52d5f265336994dabf93a12cf8af
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/upernet.md
@@ -0,0 +1,79 @@
+
+
+# UPerNet
+
+## Overview
+
+The UPerNet model was proposed in [Unified Perceptual Parsing for Scene Understanding](https://arxiv.org/abs/1807.10221)
+by Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, Jian Sun. UPerNet is a general framework to effectively segment
+a wide range of concepts from images, leveraging any vision backbone like [ConvNeXt](convnext) or [Swin](swin).
+
+The abstract from the paper is the following:
+
+*Humans recognize the visual world at multiple levels: we effortlessly categorize scenes and detect objects inside, while also identifying the textures and surfaces of the objects along with their different compositional parts. In this paper, we study a new task called Unified Perceptual Parsing, which requires the machine vision systems to recognize as many visual concepts as possible from a given image. A multi-task framework called UPerNet and a training strategy are developed to learn from heterogeneous image annotations. We benchmark our framework on Unified Perceptual Parsing and show that it is able to effectively segment a wide range of concepts from images. The trained networks are further applied to discover visual knowledge in natural scenes.*
+
+
+
+ UPerNet framework. Taken from the original paper .
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code is based on OpenMMLab's mmsegmentation [here](https://github.com/open-mmlab/mmsegmentation/blob/master/mmseg/models/decode_heads/uper_head.py).
+
+## Usage examples
+
+UPerNet is a general framework for semantic segmentation. It can be used with any vision backbone, like so:
+
+```py
+from transformers import SwinConfig, UperNetConfig, UperNetForSemanticSegmentation
+
+backbone_config = SwinConfig(out_features=["stage1", "stage2", "stage3", "stage4"])
+
+config = UperNetConfig(backbone_config=backbone_config)
+model = UperNetForSemanticSegmentation(config)
+```
+
+To use another vision backbone, like [ConvNeXt](convnext), simply instantiate the model with the appropriate backbone:
+
+```py
+from transformers import ConvNextConfig, UperNetConfig, UperNetForSemanticSegmentation
+
+backbone_config = ConvNextConfig(out_features=["stage1", "stage2", "stage3", "stage4"])
+
+config = UperNetConfig(backbone_config=backbone_config)
+model = UperNetForSemanticSegmentation(config)
+```
+
+Note that this will randomly initialize all the weights of the model.
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with UPerNet.
+
+- Demo notebooks for UPerNet can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/UPerNet).
+- [`UperNetForSemanticSegmentation`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/semantic-segmentation) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/semantic_segmentation.ipynb).
+- See also: [Semantic segmentation task guide](../tasks/semantic_segmentation)
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## UperNetConfig
+
+[[autodoc]] UperNetConfig
+
+## UperNetForSemanticSegmentation
+
+[[autodoc]] UperNetForSemanticSegmentation
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/van.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/van.md
new file mode 100644
index 0000000000000000000000000000000000000000..2fb8475ce72f3285904df831617a8450d3300776
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/van.md
@@ -0,0 +1,72 @@
+
+
+# VAN
+
+
+
+This model is in maintenance mode only, we don't accept any new PRs changing its code.
+
+If you run into any issues running this model, please reinstall the last version that supported this model: v4.30.0.
+You can do so by running the following command: `pip install -U transformers==4.30.0`.
+
+
+
+## Overview
+
+The VAN model was proposed in [Visual Attention Network](https://arxiv.org/abs/2202.09741) by Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, Shi-Min Hu.
+
+This paper introduces a new attention layer based on convolution operations able to capture both local and distant relationships. This is done by combining normal and large kernel convolution layers. The latter uses a dilated convolution to capture distant correlations.
+
+The abstract from the paper is the following:
+
+*While originally designed for natural language processing tasks, the self-attention mechanism has recently taken various computer vision areas by storm. However, the 2D nature of images brings three challenges for applying self-attention in computer vision. (1) Treating images as 1D sequences neglects their 2D structures. (2) The quadratic complexity is too expensive for high-resolution images. (3) It only captures spatial adaptability but ignores channel adaptability. In this paper, we propose a novel large kernel attention (LKA) module to enable self-adaptive and long-range correlations in self-attention while avoiding the above issues. We further introduce a novel neural network based on LKA, namely Visual Attention Network (VAN). While extremely simple, VAN outperforms the state-of-the-art vision transformers and convolutional neural networks with a large margin in extensive experiments, including image classification, object detection, semantic segmentation, instance segmentation, etc. Code is available at [this https URL](https://github.com/Visual-Attention-Network/VAN-Classification).*
+
+Tips:
+
+- VAN does not have an embedding layer, thus the `hidden_states` will have a length equal to the number of stages.
+
+The figure below illustrates the architecture of a Visual Attention Layer. Taken from the [original paper](https://arxiv.org/abs/2202.09741).
+
+
+
+This model was contributed by [Francesco](https://huggingface.co/Francesco). The original code can be found [here](https://github.com/Visual-Attention-Network/VAN-Classification).
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with VAN.
+
+
+
+- [`VanForImageClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
+- See also: [Image classification task guide](../tasks/image_classification)
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## VanConfig
+
+[[autodoc]] VanConfig
+
+## VanModel
+
+[[autodoc]] VanModel
+ - forward
+
+## VanForImageClassification
+
+[[autodoc]] VanForImageClassification
+ - forward
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/video_llava.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/video_llava.md
new file mode 100644
index 0000000000000000000000000000000000000000..a3ba1258ecfa061fc63bb7971e5dbb1e8833c16b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/video_llava.md
@@ -0,0 +1,215 @@
+
+
+# Video-LLaVA
+
+## Overview
+
+Video-LLaVa is an open-source multimodal LLM trained by fine-tuning LlamA/Vicuna on multimodal instruction-following data generated by Llava1.5 and VideChat. It is an auto-regressive language model, based on the transformer architecture. Video-LLaVa unifies visual representations to the language feature space, and enables an LLM to perform visual reasoning capabilities on both images and videos simultaneously.
+
+
+The Video-LLaVA model was proposed in [Video-LLaVA: Learning United Visual Representation by Alignment Before Projection](https://arxiv.org/abs/2311.10122) by Bin Lin, Yang Ye, Bin Zhu, Jiaxi Cui, Munang Ning, Peng Jin, Li Yuan.
+
+The abstract from the paper is the following:
+
+*The Large Vision-Language Model (LVLM) has enhanced the performance of various downstream tasks in
+visual-language understanding. Most existing approaches
+encode images and videos into separate feature spaces,
+which are then fed as inputs to large language models.
+However, due to the lack of unified tokenization for images and videos, namely misalignment before projection, it
+becomes challenging for a Large Language Model (LLM)
+to learn multi-modal interactions from several poor projection layers. In this work, we unify visual representation into the language feature space to advance the foundational LLM towards a unified LVLM. As a result, we establish a simple but robust LVLM baseline, Video-LLaVA,
+which learns from a mixed dataset of images and videos,
+mutually enhancing each other. Video-LLaVA achieves superior performances on a broad range of 9 image benchmarks across 5 image question-answering datasets and 4
+image benchmark toolkits. Additionally, our Video-LLaVA
+also outperforms Video-ChatGPT by 5.8%, 9.9%, 18.6%,
+and 10.1% on MSRVTT, MSVD, TGIF, and ActivityNet, respectively. Notably, extensive experiments demonstrate that
+Video-LLaVA mutually benefits images and videos within
+a unified visual representation, outperforming models designed specifically for images or videos. We aim for this
+work to provide modest insights into the multi-modal inputs
+for the LLM*
+
+## Usage tips:
+
+- We advise users to use padding_side="left" when computing batched generation as it leads to more accurate results. Simply make sure to call processor.tokenizer.padding_side = "left" before generating.
+
+- Note the model has not been explicitly trained to process multiple images/videos in the same prompt, although this is technically possible, you may experience inaccurate results.
+
+- Note that the video inputs should have exactly 8 frames at the input, since the models were trained in that setting.
+
+This model was contributed by [RaushanTurganbay](https://huggingface.co/RaushanTurganbay).
+The original code can be found [here](https://github.com/PKU-YuanGroup/Video-LLaVA).
+
+
+> [!NOTE]
+> LLaVA models after release v4.46 will raise warnings about adding `processor.patch_size = {{patch_size}}`, `processor.num_additional_image_tokens = {{num_additional_image_tokens}}` and processor.vision_feature_select_strategy = {{vision_feature_select_strategy}}`. It is strongly recommended to add the attributes to the processor if you own the model checkpoint, or open a PR if it is not owned by you.
+Adding these attributes means that LLaVA will try to infer the number of image tokens required per image and expand the text with as many `` placeholders as there will be tokens. Usually it is around 500 tokens per image, so make sure that the text is not truncated as otherwise there will be failure when merging the embeddings.
+The attributes can be obtained from model config, as `model.config.vision_config.patch_size` or `model.config.vision_feature_select_strategy`. The `num_additional_image_tokens` should be `1` if the vision backbone adds a CLS token or `0` if nothing extra is added to the vision patches.
+
+
+## Usage example
+
+### Single Media Mode
+
+The model can accept both images and videos as input. Here's an example code for inference in half-precision (`torch.float16`):
+
+```python
+import av
+import torch
+import numpy as np
+from transformers import VideoLlavaForConditionalGeneration, VideoLlavaProcessor
+
+def read_video_pyav(container, indices):
+ '''
+ Decode the video with PyAV decoder.
+ Args:
+ container (`av.container.input.InputContainer`): PyAV container.
+ indices (`List[int]`): List of frame indices to decode.
+ Returns:
+ result (np.ndarray): np array of decoded frames of shape (num_frames, height, width, 3).
+ '''
+ frames = []
+ container.seek(0)
+ start_index = indices[0]
+ end_index = indices[-1]
+ for i, frame in enumerate(container.decode(video=0)):
+ if i > end_index:
+ break
+ if i >= start_index and i in indices:
+ frames.append(frame)
+ return np.stack([x.to_ndarray(format="rgb24") for x in frames])
+
+# Load the model in half-precision
+model = VideoLlavaForConditionalGeneration.from_pretrained("LanguageBind/Video-LLaVA-7B-hf", torch_dtype=torch.float16, device_map="auto")
+processor = VideoLlavaProcessor.from_pretrained("LanguageBind/Video-LLaVA-7B-hf")
+
+# Load the video as an np.arrau, sampling uniformly 8 frames
+video_path = hf_hub_download(repo_id="raushan-testing-hf/videos-test", filename="sample_demo_1.mp4", repo_type="dataset")
+container = av.open(video_path)
+total_frames = container.streams.video[0].frames
+indices = np.arange(0, total_frames, total_frames / 8).astype(int)
+video = read_video_pyav(container, indices)
+
+# For better results, we recommend to prompt the model in the following format
+prompt = "USER: \nWhy is this funny? ASSISTANT:"
+inputs = processor(text=prompt, videos=video, return_tensors="pt")
+
+out = model.generate(**inputs, max_new_tokens=60)
+processor.batch_decode(out, skip_special_tokens=True, clean_up_tokenization_spaces=True)
+```
+
+For multiple turns conversation change the prompt format to:
+
+```bash
+"USER: \nWhat do you see in this video? ASSISTANT: A baby reading a book. USER: Why is the it funny? ASSISTANT:"
+```
+
+### Mixed Media Mode
+
+The model can also generate from an interleaved image-video inputs. However note, that it was not trained in interleaved image-video setting which might affect the performance. Below is an example usage for mixed media input, add the following lines to the above code snippet:
+
+```python
+from PIL import Image
+import requests
+
+# Generate from image and video mixed inputs
+# Load and image and write a new prompt
+url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+image = Image.open(requests.get(url, stream=True).raw)
+prompt = "USER: \nHow many cats are there in the image? ASSISTANT: There are two cats. USER: \nWhy is this video funny? ASSISTANT:"
+
+inputs = processor(text=prompt, images=image, videos=clip, padding=True, return_tensors="pt")
+
+# Generate
+generate_ids = model.generate(**inputs, max_length=50)
+processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=True)
+
+```
+
+## Model optimization
+
+### Quantization using Bitsandbytes for memory efficiency
+
+The model can be loaded in lower bits, significantly reducing memory burden while maintaining the performance of the original model. his allows for efficient deployment on resource-constrained cases.
+
+First make sure to install bitsandbytes by running `pip install bitsandbytes` and to have access to a GPU/accelerator that is supported by the library.
+
+
+
+bitsandbytes is being refactored to support multiple backends beyond CUDA. Currently, ROCm (AMD GPU) and Intel CPU implementations are mature, with Intel XPU in progress and Apple Silicon support expected by Q4/Q1. For installation instructions and the latest backend updates, visit [this link](https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend).
+
+We value your feedback to help identify bugs before the full release! Check out [these docs](https://huggingface.co/docs/bitsandbytes/main/en/non_cuda_backends) for more details and feedback links.
+
+
+
+Load the quantized model by simply adding [`BitsAndBytesConfig`](../main_classes/quantization#transformers.BitsAndBytesConfig) as shown below:
+
+
+```python
+from transformers import VideoLlavaForConditionalGeneration, BitsAndBytesConfig
+
+# specify how to quantize the model
+quantization_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_quant_type="nf4",
+ bnb_4bit_compute_dtype=torch.float16,
+)
+
+model = VideoLlavaForConditionalGeneration.from_pretrained("LanguageBind/Video-LLaVA-7B-hf", quantization_config=quantization_config, device_map="auto")
+```
+
+
+### Flash-Attention 2 to speed-up generation
+
+Additionally, we can greatly speed-up model inference by using [Flash Attention](../perf_train_gpu_one#flash-attention-2), which is a faster implementation of the attention mechanism used inside the model.
+
+First, make sure to install the latest version of Flash Attention 2:
+
+```bash
+pip install -U flash-attn --no-build-isolation
+```
+
+Also, you should have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of the [flash attention repository](https://github.com/Dao-AILab/flash-attention). FlashAttention-2 can only be used when a model is loaded in `torch.float16` or `torch.bfloat16`.
+
+To load and run a model using Flash Attention-2, simply add `attn_implementation="flash_attention_2"` when loading the model as follows:
+
+```python
+from transformers import VideoLlavaForConditionalGeneration
+
+model = VideoLlavaForConditionalGeneration.from_pretrained(
+ "LanguageBind/Video-LLaVA-7B-hf",
+ torch_dtype=torch.float16,
+ attn_implementation="flash_attention_2",
+).to(0)
+```
+
+
+## VideoLlavaConfig
+
+[[autodoc]] VideoLlavaConfig
+
+## VideoLlavaImageProcessor
+
+[[autodoc]] VideoLlavaImageProcessor
+
+## VideoLlavaProcessor
+
+[[autodoc]] VideoLlavaProcessor
+
+## VideoLlavaForConditionalGeneration
+
+[[autodoc]] VideoLlavaForConditionalGeneration
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/videomae.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/videomae.md
new file mode 100644
index 0000000000000000000000000000000000000000..a785611185700d0f6d731e1307162f2dedb55c2e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/videomae.md
@@ -0,0 +1,105 @@
+
+
+# VideoMAE
+
+## Overview
+
+The VideoMAE model was proposed in [VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training](https://arxiv.org/abs/2203.12602) by Zhan Tong, Yibing Song, Jue Wang, Limin Wang.
+VideoMAE extends masked auto encoders ([MAE](vit_mae)) to video, claiming state-of-the-art performance on several video classification benchmarks.
+
+The abstract from the paper is the following:
+
+*Pre-training video transformers on extra large-scale datasets is generally required to achieve premier performance on relatively small datasets. In this paper, we show that video masked autoencoders (VideoMAE) are data-efficient learners for self-supervised video pre-training (SSVP). We are inspired by the recent ImageMAE and propose customized video tube masking and reconstruction. These simple designs turn out to be effective for overcoming information leakage caused by the temporal correlation during video reconstruction. We obtain three important findings on SSVP: (1) An extremely high proportion of masking ratio (i.e., 90% to 95%) still yields favorable performance of VideoMAE. The temporally redundant video content enables higher masking ratio than that of images. (2) VideoMAE achieves impressive results on very small datasets (i.e., around 3k-4k videos) without using any extra data. This is partially ascribed to the challenging task of video reconstruction to enforce high-level structure learning. (3) VideoMAE shows that data quality is more important than data quantity for SSVP. Domain shift between pre-training and target datasets are important issues in SSVP. Notably, our VideoMAE with the vanilla ViT backbone can achieve 83.9% on Kinects-400, 75.3% on Something-Something V2, 90.8% on UCF101, and 61.1% on HMDB51 without using any extra data.*
+
+
+
+ VideoMAE pre-training. Taken from the original paper .
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr).
+The original code can be found [here](https://github.com/MCG-NJU/VideoMAE).
+
+## Using Scaled Dot Product Attention (SDPA)
+
+PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function
+encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
+[official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)
+or the [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)
+page for more information.
+
+SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set
+`attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+```
+from transformers import VideoMAEForVideoClassification
+model = VideoMAEForVideoClassification.from_pretrained("MCG-NJU/videomae-base-finetuned-kinetics", attn_implementation="sdpa", torch_dtype=torch.float16)
+...
+```
+
+For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`).
+
+On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with `float32` and `MCG-NJU/videomae-base-finetuned-kinetics` model, we saw the following speedups during inference.
+
+| Batch size | Average inference time (ms), eager mode | Average inference time (ms), sdpa model | Speed up, Sdpa / Eager (x) |
+|--------------|-------------------------------------------|-------------------------------------------|------------------------------|
+| 1 | 37 | 10 | 3.7 |
+| 2 | 24 | 18 | 1.33 |
+| 4 | 43 | 32 | 1.34 |
+| 8 | 84 | 60 | 1.4 |
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with VideoMAE. If
+you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll
+review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+**Video classification**
+- [A notebook](https://github.com/huggingface/notebooks/blob/main/examples/video_classification.ipynb) that shows how
+to fine-tune a VideoMAE model on a custom dataset.
+- [Video classification task guide](../tasks/video_classification)
+- [A ๐ค Space](https://huggingface.co/spaces/sayakpaul/video-classification-ucf101-subset) showing how to perform inference with a video classification model.
+
+## VideoMAEConfig
+
+[[autodoc]] VideoMAEConfig
+
+## VideoMAEFeatureExtractor
+
+[[autodoc]] VideoMAEFeatureExtractor
+ - __call__
+
+## VideoMAEImageProcessor
+
+[[autodoc]] VideoMAEImageProcessor
+ - preprocess
+
+## VideoMAEModel
+
+[[autodoc]] VideoMAEModel
+ - forward
+
+## VideoMAEForPreTraining
+
+`VideoMAEForPreTraining` includes the decoder on top for self-supervised pre-training.
+
+[[autodoc]] transformers.VideoMAEForPreTraining
+ - forward
+
+## VideoMAEForVideoClassification
+
+[[autodoc]] transformers.VideoMAEForVideoClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vilt.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vilt.md
new file mode 100644
index 0000000000000000000000000000000000000000..2b0ac022da4b2c1cf6e0118865f7d473786137e9
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vilt.md
@@ -0,0 +1,104 @@
+
+
+# ViLT
+
+## Overview
+
+The ViLT model was proposed in [ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision](https://arxiv.org/abs/2102.03334)
+by Wonjae Kim, Bokyung Son, Ildoo Kim. ViLT incorporates text embeddings into a Vision Transformer (ViT), allowing it to have a minimal design
+for Vision-and-Language Pre-training (VLP).
+
+The abstract from the paper is the following:
+
+*Vision-and-Language Pre-training (VLP) has improved performance on various joint vision-and-language downstream tasks.
+Current approaches to VLP heavily rely on image feature extraction processes, most of which involve region supervision
+(e.g., object detection) and the convolutional architecture (e.g., ResNet). Although disregarded in the literature, we
+find it problematic in terms of both (1) efficiency/speed, that simply extracting input features requires much more
+computation than the multimodal interaction steps; and (2) expressive power, as it is upper bounded to the expressive
+power of the visual embedder and its predefined visual vocabulary. In this paper, we present a minimal VLP model,
+Vision-and-Language Transformer (ViLT), monolithic in the sense that the processing of visual inputs is drastically
+simplified to just the same convolution-free manner that we process textual inputs. We show that ViLT is up to tens of
+times faster than previous VLP models, yet with competitive or better downstream task performance.*
+
+
+
+ ViLT architecture. Taken from the original paper .
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code can be found [here](https://github.com/dandelin/ViLT).
+
+## Usage tips
+
+- The quickest way to get started with ViLT is by checking the [example notebooks](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/ViLT)
+ (which showcase both inference and fine-tuning on custom data).
+- ViLT is a model that takes both `pixel_values` and `input_ids` as input. One can use [`ViltProcessor`] to prepare data for the model.
+ This processor wraps a image processor (for the image modality) and a tokenizer (for the language modality) into one.
+- ViLT is trained with images of various sizes: the authors resize the shorter edge of input images to 384 and limit the longer edge to
+ under 640 while preserving the aspect ratio. To make batching of images possible, the authors use a `pixel_mask` that indicates
+ which pixel values are real and which are padding. [`ViltProcessor`] automatically creates this for you.
+- The design of ViLT is very similar to that of a standard Vision Transformer (ViT). The only difference is that the model includes
+ additional embedding layers for the language modality.
+- The PyTorch version of this model is only available in torch 1.10 and higher.
+
+## ViltConfig
+
+[[autodoc]] ViltConfig
+
+## ViltFeatureExtractor
+
+[[autodoc]] ViltFeatureExtractor
+ - __call__
+
+## ViltImageProcessor
+
+[[autodoc]] ViltImageProcessor
+ - preprocess
+
+## ViltProcessor
+
+[[autodoc]] ViltProcessor
+ - __call__
+
+## ViltModel
+
+[[autodoc]] ViltModel
+ - forward
+
+## ViltForMaskedLM
+
+[[autodoc]] ViltForMaskedLM
+ - forward
+
+## ViltForQuestionAnswering
+
+[[autodoc]] ViltForQuestionAnswering
+ - forward
+
+## ViltForImagesAndTextClassification
+
+[[autodoc]] ViltForImagesAndTextClassification
+ - forward
+
+## ViltForImageAndTextRetrieval
+
+[[autodoc]] ViltForImageAndTextRetrieval
+ - forward
+
+## ViltForTokenClassification
+
+[[autodoc]] ViltForTokenClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vipllava.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vipllava.md
new file mode 100644
index 0000000000000000000000000000000000000000..cb625e3711615bdec201b682e453a3580ed9a7ff
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vipllava.md
@@ -0,0 +1,101 @@
+
+
+# VipLlava
+
+## Overview
+
+The VipLlava model was proposed in [Making Large Multimodal Models Understand Arbitrary Visual Prompts](https://arxiv.org/abs/2312.00784) by Mu Cai, Haotian Liu, Siva Karthik Mustikovela, Gregory P. Meyer, Yuning Chai, Dennis Park, Yong Jae Lee.
+
+VipLlava enhances the training protocol of Llava by marking images and interact with the model using natural cues like a "red bounding box" or "pointed arrow" during training.
+
+The abstract from the paper is the following:
+
+*While existing large vision-language multimodal models focus on whole image understanding, there is a prominent gap in achieving region-specific comprehension. Current approaches that use textual coordinates or spatial encodings often fail to provide a user-friendly interface for visual prompting. To address this challenge, we introduce a novel multimodal model capable of decoding arbitrary visual prompts. This allows users to intuitively mark images and interact with the model using natural cues like a "red bounding box" or "pointed arrow". Our simple design directly overlays visual markers onto the RGB image, eliminating the need for complex region encodings, yet achieves state-of-the-art performance on region-understanding tasks like Visual7W, PointQA, and Visual Commonsense Reasoning benchmark. Furthermore, we present ViP-Bench, a comprehensive benchmark to assess the capability of models in understanding visual prompts across multiple dimensions, enabling future research in this domain. Code, data, and model are publicly available.*
+
+The original code can be found [here](https://github.com/mu-cai/ViP-LLaVA).
+
+This model was contributed by [Younes Belkada](https://huggingface.co/ybelkada)
+
+
+## Usage tips:
+
+- The architecture is similar than llava architecture except that the multi-modal projector takes a set of concatenated vision hidden states and has an additional layernorm layer on that module.
+
+- We advise users to use `padding_side="left"` when computing batched generation as it leads to more accurate results. Simply make sure to call `processor.tokenizer.padding_side = "left"` before generating.
+
+- Note the model has not been explicitly trained to process multiple images in the same prompt, although this is technically possible, you may experience inaccurate results.
+
+> [!NOTE]
+> LLaVA models after release v4.46 will raise warnings about adding `processor.patch_size = {{patch_size}}`, `processor.num_additional_image_tokens = {{num_additional_image_tokens}}` and processor.vision_feature_select_strategy = {{vision_feature_select_strategy}}`. It is strongly recommended to add the attributes to the processor if you own the model checkpoint, or open a PR if it is not owned by you.
+Adding these attributes means that LLaVA will try to infer the number of image tokens required per image and expand the text with as many `` placeholders as there will be tokens. Usually it is around 500 tokens per image, so make sure that the text is not truncated as otherwise there will be failure when merging the embeddings.
+The attributes can be obtained from model config, as `model.config.vision_config.patch_size` or `model.config.vision_feature_select_strategy`. The `num_additional_image_tokens` should be `1` if the vision backbone adds a CLS token or `0` if nothing extra is added to the vision patches.
+
+
+- For better results, we recommend users to use the processor's `apply_chat_template()` method to format your prompt correctly. For that you need to construct a conversation history, passing in a plain string will not format your prompt. Each message in the conversation history for chat templates is a dictionary with keys "role" and "content". The "content" should be a list of dictionaries, for "text" and "image" modalities, as follows:
+
+```python
+from transformers import AutoProcessor
+
+processor = AutoProcessor.from_pretrained("llava-hf/vip-llava-7b-hf")
+
+conversation = [
+ {
+ "role": "user",
+ "content": [
+ {"type": "image"},
+ {"type": "text", "text": "Whatโs shown in this image?"},
+ ],
+ },
+ {
+ "role": "assistant",
+ "content": [{"type": "text", "text": "This image shows a red stop sign."},]
+ },
+ {
+
+ "role": "user",
+ "content": [
+ {"type": "text", "text": "Describe the image in more details."},
+ ],
+ },
+]
+
+text_prompt = processor.apply_chat_template(conversation, add_generation_prompt=True)
+
+# Note that the template simply formats your prompt, you still have to tokenize it and obtain pixel values for your images
+print(text_prompt)
+>>> "###Human: \nWhatโs shown in this image?###Assistant: This image shows a red stop sign.###Human: Describe the image in more details.###Assistant:"
+```
+
+- If you want to construct a chat prompt yourself, below is a list of prompt formats accepted by VipLLaVa checkpoints:
+```bash
+A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.###Human: \n###Assistant:
+```
+
+For multiple turns conversation:
+```bash
+A chat between a curious human and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the human's questions.###Human: \n###Assistant: ###Human: ###Assistant:
+```
+
+
+## VipLlavaConfig
+
+[[autodoc]] VipLlavaConfig
+
+## VipLlavaForConditionalGeneration
+
+[[autodoc]] VipLlavaForConditionalGeneration
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vision-encoder-decoder.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vision-encoder-decoder.md
new file mode 100644
index 0000000000000000000000000000000000000000..41159b7fc5f9a80f2d29b91e381afb9071735b97
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vision-encoder-decoder.md
@@ -0,0 +1,182 @@
+
+
+# Vision Encoder Decoder Models
+
+## Overview
+
+The [`VisionEncoderDecoderModel`] can be used to initialize an image-to-text model with any
+pretrained Transformer-based vision model as the encoder (*e.g.* [ViT](vit), [BEiT](beit), [DeiT](deit), [Swin](swin))
+and any pretrained language model as the decoder (*e.g.* [RoBERTa](roberta), [GPT2](gpt2), [BERT](bert), [DistilBERT](distilbert)).
+
+The effectiveness of initializing image-to-text-sequence models with pretrained checkpoints has been shown in (for
+example) [TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282) by Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang,
+Zhoujun Li, Furu Wei.
+
+After such a [`VisionEncoderDecoderModel`] has been trained/fine-tuned, it can be saved/loaded just like any other models (see the examples below
+for more information).
+
+An example application is image captioning, in which the encoder is used to encode the image, after which an autoregressive language model generates
+the caption. Another example is optical character recognition. Refer to [TrOCR](trocr), which is an instance of [`VisionEncoderDecoderModel`].
+
+## Randomly initializing `VisionEncoderDecoderModel` from model configurations.
+
+[`VisionEncoderDecoderModel`] can be randomly initialized from an encoder and a decoder config. In the following example, we show how to do this using the default [`ViTModel`] configuration for the encoder
+and the default [`BertForCausalLM`] configuration for the decoder.
+
+```python
+>>> from transformers import BertConfig, ViTConfig, VisionEncoderDecoderConfig, VisionEncoderDecoderModel
+
+>>> config_encoder = ViTConfig()
+>>> config_decoder = BertConfig()
+
+>>> config = VisionEncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
+>>> model = VisionEncoderDecoderModel(config=config)
+```
+
+## Initialising `VisionEncoderDecoderModel` from a pretrained encoder and a pretrained decoder.
+
+[`VisionEncoderDecoderModel`] can be initialized from a pretrained encoder checkpoint and a pretrained decoder checkpoint. Note that any pretrained Transformer-based vision model, *e.g.* [Swin](swin), can serve as the encoder and both pretrained auto-encoding models, *e.g.* BERT, pretrained causal language models, *e.g.* GPT2, as well as the pretrained decoder part of sequence-to-sequence models, *e.g.* decoder of BART, can be used as the decoder.
+Depending on which architecture you choose as the decoder, the cross-attention layers might be randomly initialized.
+Initializing [`VisionEncoderDecoderModel`] from a pretrained encoder and decoder checkpoint requires the model to be fine-tuned on a downstream task, as has been shown in [the *Warm-starting-encoder-decoder blog post*](https://huggingface.co/blog/warm-starting-encoder-decoder).
+To do so, the `VisionEncoderDecoderModel` class provides a [`VisionEncoderDecoderModel.from_encoder_decoder_pretrained`] method.
+
+```python
+>>> from transformers import VisionEncoderDecoderModel
+
+>>> model = VisionEncoderDecoderModel.from_encoder_decoder_pretrained(
+... "microsoft/swin-base-patch4-window7-224-in22k", "google-bert/bert-base-uncased"
+... )
+```
+
+## Loading an existing `VisionEncoderDecoderModel` checkpoint and perform inference.
+
+To load fine-tuned checkpoints of the `VisionEncoderDecoderModel` class, [`VisionEncoderDecoderModel`] provides the `from_pretrained(...)` method just like any other model architecture in Transformers.
+
+To perform inference, one uses the [`generate`] method, which allows to autoregressively generate text. This method supports various forms of decoding, such as greedy, beam search and multinomial sampling.
+
+```python
+>>> import requests
+>>> from PIL import Image
+
+>>> from transformers import GPT2TokenizerFast, ViTImageProcessor, VisionEncoderDecoderModel
+
+>>> # load a fine-tuned image captioning model and corresponding tokenizer and image processor
+>>> model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
+>>> tokenizer = GPT2TokenizerFast.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
+>>> image_processor = ViTImageProcessor.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
+
+>>> # let's perform inference on an image
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+>>> pixel_values = image_processor(image, return_tensors="pt").pixel_values
+
+>>> # autoregressively generate caption (uses greedy decoding by default)
+>>> generated_ids = model.generate(pixel_values)
+>>> generated_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+>>> print(generated_text)
+a cat laying on a blanket next to a cat laying on a bed
+```
+
+## Loading a PyTorch checkpoint into `TFVisionEncoderDecoderModel`.
+
+[`TFVisionEncoderDecoderModel.from_pretrained`] currently doesn't support initializing the model from a
+PyTorch checkpoint. Passing `from_pt=True` to this method will throw an exception. If there are only PyTorch
+checkpoints for a particular vision encoder-decoder model, a workaround is:
+
+```python
+>>> from transformers import VisionEncoderDecoderModel, TFVisionEncoderDecoderModel
+
+>>> _model = VisionEncoderDecoderModel.from_pretrained("nlpconnect/vit-gpt2-image-captioning")
+
+>>> _model.encoder.save_pretrained("./encoder")
+>>> _model.decoder.save_pretrained("./decoder")
+
+>>> model = TFVisionEncoderDecoderModel.from_encoder_decoder_pretrained(
+... "./encoder", "./decoder", encoder_from_pt=True, decoder_from_pt=True
+... )
+>>> # This is only for copying some specific attributes of this particular model.
+>>> model.config = _model.config
+```
+
+## Training
+
+Once the model is created, it can be fine-tuned similar to BART, T5 or any other encoder-decoder model on a dataset of (image, text) pairs.
+As you can see, only 2 inputs are required for the model in order to compute a loss: `pixel_values` (which are the
+images) and `labels` (which are the `input_ids` of the encoded target sequence).
+
+```python
+>>> from transformers import ViTImageProcessor, BertTokenizer, VisionEncoderDecoderModel
+>>> from datasets import load_dataset
+
+>>> image_processor = ViTImageProcessor.from_pretrained("google/vit-base-patch16-224-in21k")
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+>>> model = VisionEncoderDecoderModel.from_encoder_decoder_pretrained(
+... "google/vit-base-patch16-224-in21k", "google-bert/bert-base-uncased"
+... )
+
+>>> model.config.decoder_start_token_id = tokenizer.cls_token_id
+>>> model.config.pad_token_id = tokenizer.pad_token_id
+
+>>> dataset = load_dataset("huggingface/cats-image")
+>>> image = dataset["test"]["image"][0]
+>>> pixel_values = image_processor(image, return_tensors="pt").pixel_values
+
+>>> labels = tokenizer(
+... "an image of two cats chilling on a couch",
+... return_tensors="pt",
+... ).input_ids
+
+>>> # the forward function automatically creates the correct decoder_input_ids
+>>> loss = model(pixel_values=pixel_values, labels=labels).loss
+```
+
+This model was contributed by [nielsr](https://github.com/nielsrogge). This model's TensorFlow and Flax versions
+were contributed by [ydshieh](https://github.com/ydshieh).
+
+## VisionEncoderDecoderConfig
+
+[[autodoc]] VisionEncoderDecoderConfig
+
+
+
+
+## VisionEncoderDecoderModel
+
+[[autodoc]] VisionEncoderDecoderModel
+ - forward
+ - from_encoder_decoder_pretrained
+
+
+
+
+## TFVisionEncoderDecoderModel
+
+[[autodoc]] TFVisionEncoderDecoderModel
+ - call
+ - from_encoder_decoder_pretrained
+
+
+
+
+## FlaxVisionEncoderDecoderModel
+
+[[autodoc]] FlaxVisionEncoderDecoderModel
+ - __call__
+ - from_encoder_decoder_pretrained
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vision-text-dual-encoder.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vision-text-dual-encoder.md
new file mode 100644
index 0000000000000000000000000000000000000000..7cb68a261875e699a9b3bf9ea53386a2acaa00f7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vision-text-dual-encoder.md
@@ -0,0 +1,64 @@
+
+
+# VisionTextDualEncoder
+
+## Overview
+
+The [`VisionTextDualEncoderModel`] can be used to initialize a vision-text dual encoder model with
+any pretrained vision autoencoding model as the vision encoder (*e.g.* [ViT](vit), [BEiT](beit), [DeiT](deit)) and any pretrained text autoencoding model as the text encoder (*e.g.* [RoBERTa](roberta), [BERT](bert)). Two projection layers are added on top of both the vision and text encoder to project the output embeddings
+to a shared latent space. The projection layers are randomly initialized so the model should be fine-tuned on a
+downstream task. This model can be used to align the vision-text embeddings using CLIP like contrastive image-text
+training and then can be used for zero-shot vision tasks such image-classification or retrieval.
+
+In [LiT: Zero-Shot Transfer with Locked-image Text Tuning](https://arxiv.org/abs/2111.07991) it is shown how
+leveraging pre-trained (locked/frozen) image and text model for contrastive learning yields significant improvement on
+new zero-shot vision tasks such as image classification or retrieval.
+
+## VisionTextDualEncoderConfig
+
+[[autodoc]] VisionTextDualEncoderConfig
+
+## VisionTextDualEncoderProcessor
+
+[[autodoc]] VisionTextDualEncoderProcessor
+
+
+
+
+## VisionTextDualEncoderModel
+
+[[autodoc]] VisionTextDualEncoderModel
+ - forward
+
+
+
+
+## FlaxVisionTextDualEncoderModel
+
+[[autodoc]] FlaxVisionTextDualEncoderModel
+ - __call__
+
+
+
+
+## TFVisionTextDualEncoderModel
+
+[[autodoc]] TFVisionTextDualEncoderModel
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/visual_bert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/visual_bert.md
new file mode 100644
index 0000000000000000000000000000000000000000..95e5ae4e84a28da78de2a29b1456c91c27a7a1e5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/visual_bert.md
@@ -0,0 +1,127 @@
+
+
+# VisualBERT
+
+## Overview
+
+The VisualBERT model was proposed in [VisualBERT: A Simple and Performant Baseline for Vision and Language](https://arxiv.org/pdf/1908.03557) by Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang.
+VisualBERT is a neural network trained on a variety of (image, text) pairs.
+
+The abstract from the paper is the following:
+
+*We propose VisualBERT, a simple and flexible framework for modeling a broad range of vision-and-language tasks.
+VisualBERT consists of a stack of Transformer layers that implicitly align elements of an input text and regions in an
+associated input image with self-attention. We further propose two visually-grounded language model objectives for
+pre-training VisualBERT on image caption data. Experiments on four vision-and-language tasks including VQA, VCR, NLVR2,
+and Flickr30K show that VisualBERT outperforms or rivals with state-of-the-art models while being significantly
+simpler. Further analysis demonstrates that VisualBERT can ground elements of language to image regions without any
+explicit supervision and is even sensitive to syntactic relationships, tracking, for example, associations between
+verbs and image regions corresponding to their arguments.*
+
+This model was contributed by [gchhablani](https://huggingface.co/gchhablani). The original code can be found [here](https://github.com/uclanlp/visualbert).
+
+## Usage tips
+
+1. Most of the checkpoints provided work with the [`VisualBertForPreTraining`] configuration. Other
+ checkpoints provided are the fine-tuned checkpoints for down-stream tasks - VQA ('visualbert-vqa'), VCR
+ ('visualbert-vcr'), NLVR2 ('visualbert-nlvr2'). Hence, if you are not working on these downstream tasks, it is
+ recommended that you use the pretrained checkpoints.
+
+2. For the VCR task, the authors use a fine-tuned detector for generating visual embeddings, for all the checkpoints.
+ We do not provide the detector and its weights as a part of the package, but it will be available in the research
+ projects, and the states can be loaded directly into the detector provided.
+
+VisualBERT is a multi-modal vision and language model. It can be used for visual question answering, multiple choice,
+visual reasoning and region-to-phrase correspondence tasks. VisualBERT uses a BERT-like transformer to prepare
+embeddings for image-text pairs. Both the text and visual features are then projected to a latent space with identical
+dimension.
+
+To feed images to the model, each image is passed through a pre-trained object detector and the regions and the
+bounding boxes are extracted. The authors use the features generated after passing these regions through a pre-trained
+CNN like ResNet as visual embeddings. They also add absolute position embeddings, and feed the resulting sequence of
+vectors to a standard BERT model. The text input is concatenated in the front of the visual embeddings in the embedding
+layer, and is expected to be bound by [CLS] and a [SEP] tokens, as in BERT. The segment IDs must also be set
+appropriately for the textual and visual parts.
+
+The [`BertTokenizer`] is used to encode the text. A custom detector/image processor must be used
+to get the visual embeddings. The following example notebooks show how to use VisualBERT with Detectron-like models:
+
+- [VisualBERT VQA demo notebook](https://github.com/huggingface/transformers/tree/main/examples/research_projects/visual_bert) : This notebook
+ contains an example on VisualBERT VQA.
+
+- [Generate Embeddings for VisualBERT (Colab Notebook)](https://colab.research.google.com/drive/1bLGxKdldwqnMVA5x4neY7-l_8fKGWQYI?usp=sharing) : This notebook contains
+ an example on how to generate visual embeddings.
+
+The following example shows how to get the last hidden state using [`VisualBertModel`]:
+
+```python
+>>> import torch
+>>> from transformers import BertTokenizer, VisualBertModel
+
+>>> model = VisualBertModel.from_pretrained("uclanlp/visualbert-vqa-coco-pre")
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+
+>>> inputs = tokenizer("What is the man eating?", return_tensors="pt")
+>>> # this is a custom function that returns the visual embeddings given the image path
+>>> visual_embeds = get_visual_embeddings(image_path)
+
+>>> visual_token_type_ids = torch.ones(visual_embeds.shape[:-1], dtype=torch.long)
+>>> visual_attention_mask = torch.ones(visual_embeds.shape[:-1], dtype=torch.float)
+>>> inputs.update(
+... {
+... "visual_embeds": visual_embeds,
+... "visual_token_type_ids": visual_token_type_ids,
+... "visual_attention_mask": visual_attention_mask,
+... }
+... )
+>>> outputs = model(**inputs)
+>>> last_hidden_state = outputs.last_hidden_state
+```
+
+## VisualBertConfig
+
+[[autodoc]] VisualBertConfig
+
+## VisualBertModel
+
+[[autodoc]] VisualBertModel
+ - forward
+
+## VisualBertForPreTraining
+
+[[autodoc]] VisualBertForPreTraining
+ - forward
+
+## VisualBertForQuestionAnswering
+
+[[autodoc]] VisualBertForQuestionAnswering
+ - forward
+
+## VisualBertForMultipleChoice
+
+[[autodoc]] VisualBertForMultipleChoice
+ - forward
+
+## VisualBertForVisualReasoning
+
+[[autodoc]] VisualBertForVisualReasoning
+ - forward
+
+## VisualBertForRegionToPhraseAlignment
+
+[[autodoc]] VisualBertForRegionToPhraseAlignment
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit.md
new file mode 100644
index 0000000000000000000000000000000000000000..53a550895ce22ed759a8f11758f3b3332a84ebd4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit.md
@@ -0,0 +1,211 @@
+
+
+# Vision Transformer (ViT)
+
+## Overview
+
+The Vision Transformer (ViT) model was proposed in [An Image is Worth 16x16 Words: Transformers for Image Recognition
+at Scale](https://arxiv.org/abs/2010.11929) by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk
+Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob
+Uszkoreit, Neil Houlsby. It's the first paper that successfully trains a Transformer encoder on ImageNet, attaining
+very good results compared to familiar convolutional architectures.
+
+The abstract from the paper is the following:
+
+*While the Transformer architecture has become the de-facto standard for natural language processing tasks, its
+applications to computer vision remain limited. In vision, attention is either applied in conjunction with
+convolutional networks, or used to replace certain components of convolutional networks while keeping their overall
+structure in place. We show that this reliance on CNNs is not necessary and a pure transformer applied directly to
+sequences of image patches can perform very well on image classification tasks. When pre-trained on large amounts of
+data and transferred to multiple mid-sized or small image recognition benchmarks (ImageNet, CIFAR-100, VTAB, etc.),
+Vision Transformer (ViT) attains excellent results compared to state-of-the-art convolutional networks while requiring
+substantially fewer computational resources to train.*
+
+
+
+ ViT architecture. Taken from the original paper.
+
+Following the original Vision Transformer, some follow-up works have been made:
+
+- [DeiT](deit) (Data-efficient Image Transformers) by Facebook AI. DeiT models are distilled vision transformers.
+ The authors of DeiT also released more efficiently trained ViT models, which you can directly plug into [`ViTModel`] or
+ [`ViTForImageClassification`]. There are 4 variants available (in 3 different sizes): *facebook/deit-tiny-patch16-224*,
+ *facebook/deit-small-patch16-224*, *facebook/deit-base-patch16-224* and *facebook/deit-base-patch16-384*. Note that one should
+ use [`DeiTImageProcessor`] in order to prepare images for the model.
+
+- [BEiT](beit) (BERT pre-training of Image Transformers) by Microsoft Research. BEiT models outperform supervised pre-trained
+ vision transformers using a self-supervised method inspired by BERT (masked image modeling) and based on a VQ-VAE.
+
+- DINO (a method for self-supervised training of Vision Transformers) by Facebook AI. Vision Transformers trained using
+ the DINO method show very interesting properties not seen with convolutional models. They are capable of segmenting
+ objects, without having ever been trained to do so. DINO checkpoints can be found on the [hub](https://huggingface.co/models?other=dino).
+
+- [MAE](vit_mae) (Masked Autoencoders) by Facebook AI. By pre-training Vision Transformers to reconstruct pixel values for a high portion
+ (75%) of masked patches (using an asymmetric encoder-decoder architecture), the authors show that this simple method outperforms
+ supervised pre-training after fine-tuning.
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code (written in JAX) can be
+found [here](https://github.com/google-research/vision_transformer).
+
+Note that we converted the weights from Ross Wightman's [timm library](https://github.com/rwightman/pytorch-image-models),
+who already converted the weights from JAX to PyTorch. Credits go to him!
+
+## Usage tips
+
+- To feed images to the Transformer encoder, each image is split into a sequence of fixed-size non-overlapping patches,
+ which are then linearly embedded. A [CLS] token is added to serve as representation of an entire image, which can be
+ used for classification. The authors also add absolute position embeddings, and feed the resulting sequence of
+ vectors to a standard Transformer encoder.
+- As the Vision Transformer expects each image to be of the same size (resolution), one can use
+ [`ViTImageProcessor`] to resize (or rescale) and normalize images for the model.
+- Both the patch resolution and image resolution used during pre-training or fine-tuning are reflected in the name of
+ each checkpoint. For example, `google/vit-base-patch16-224` refers to a base-sized architecture with patch
+ resolution of 16x16 and fine-tuning resolution of 224x224. All checkpoints can be found on the [hub](https://huggingface.co/models?search=vit).
+- The available checkpoints are either (1) pre-trained on [ImageNet-21k](http://www.image-net.org/) (a collection of
+ 14 million images and 21k classes) only, or (2) also fine-tuned on [ImageNet](http://www.image-net.org/challenges/LSVRC/2012/) (also referred to as ILSVRC 2012, a collection of 1.3 million
+ images and 1,000 classes).
+- The Vision Transformer was pre-trained using a resolution of 224x224. During fine-tuning, it is often beneficial to
+ use a higher resolution than pre-training [(Touvron et al., 2019)](https://arxiv.org/abs/1906.06423), [(Kolesnikov
+ et al., 2020)](https://arxiv.org/abs/1912.11370). In order to fine-tune at higher resolution, the authors perform
+ 2D interpolation of the pre-trained position embeddings, according to their location in the original image.
+- The best results are obtained with supervised pre-training, which is not the case in NLP. The authors also performed
+ an experiment with a self-supervised pre-training objective, namely masked patched prediction (inspired by masked
+ language modeling). With this approach, the smaller ViT-B/16 model achieves 79.9% accuracy on ImageNet, a significant
+ improvement of 2% to training from scratch, but still 4% behind supervised pre-training.
+
+### Using Scaled Dot Product Attention (SDPA)
+
+PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function
+encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
+[official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)
+or the [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)
+page for more information.
+
+SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set
+`attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+```
+from transformers import ViTForImageClassification
+model = ViTForImageClassification.from_pretrained("google/vit-base-patch16-224", attn_implementation="sdpa", torch_dtype=torch.float16)
+...
+```
+
+For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`).
+
+On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with `float32` and `google/vit-base-patch16-224` model, we saw the following speedups during inference.
+
+| Batch size | Average inference time (ms), eager mode | Average inference time (ms), sdpa model | Speed up, Sdpa / Eager (x) |
+|--------------|-------------------------------------------|-------------------------------------------|------------------------------|
+| 1 | 7 | 6 | 1.17 |
+| 2 | 8 | 6 | 1.33 |
+| 4 | 8 | 6 | 1.33 |
+| 8 | 8 | 6 | 1.33 |
+
+## Resources
+
+Demo notebooks regarding inference as well as fine-tuning ViT on custom data can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer).
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with ViT. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+`ViTForImageClassification` is supported by:
+
+
+- A blog post on how to [Fine-Tune ViT for Image Classification with Hugging Face Transformers](https://huggingface.co/blog/fine-tune-vit)
+- A blog post on [Image Classification with Hugging Face Transformers and `Keras`](https://www.philschmid.de/image-classification-huggingface-transformers-keras)
+- A notebook on [Fine-tuning for Image Classification with Hugging Face Transformers](https://github.com/huggingface/notebooks/blob/main/examples/image_classification.ipynb)
+- A notebook on how to [Fine-tune the Vision Transformer on CIFAR-10 with the Hugging Face Trainer](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb)
+- A notebook on how to [Fine-tune the Vision Transformer on CIFAR-10 with PyTorch Lightning](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb)
+
+โ๏ธ Optimization
+
+- A blog post on how to [Accelerate Vision Transformer (ViT) with Quantization using Optimum](https://www.philschmid.de/optimizing-vision-transformer)
+
+โก๏ธ Inference
+
+- A notebook on [Quick demo: Vision Transformer (ViT) by Google Brain](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Quick_demo_of_HuggingFace_version_of_Vision_Transformer_inference.ipynb)
+
+๐ Deploy
+
+- A blog post on [Deploying Tensorflow Vision Models in Hugging Face with TF Serving](https://huggingface.co/blog/tf-serving-vision)
+- A blog post on [Deploying Hugging Face ViT on Vertex AI](https://huggingface.co/blog/deploy-vertex-ai)
+- A blog post on [Deploying Hugging Face ViT on Kubernetes with TF Serving](https://huggingface.co/blog/deploy-tfserving-kubernetes)
+
+## ViTConfig
+
+[[autodoc]] ViTConfig
+
+## ViTFeatureExtractor
+
+[[autodoc]] ViTFeatureExtractor
+ - __call__
+
+## ViTImageProcessor
+
+[[autodoc]] ViTImageProcessor
+ - preprocess
+
+## ViTImageProcessorFast
+
+[[autodoc]] ViTImageProcessorFast
+ - preprocess
+
+
+
+
+## ViTModel
+
+[[autodoc]] ViTModel
+ - forward
+
+## ViTForMaskedImageModeling
+
+[[autodoc]] ViTForMaskedImageModeling
+ - forward
+
+## ViTForImageClassification
+
+[[autodoc]] ViTForImageClassification
+ - forward
+
+
+
+
+## TFViTModel
+
+[[autodoc]] TFViTModel
+ - call
+
+## TFViTForImageClassification
+
+[[autodoc]] TFViTForImageClassification
+ - call
+
+
+
+
+## FlaxVitModel
+
+[[autodoc]] FlaxViTModel
+ - __call__
+
+## FlaxViTForImageClassification
+
+[[autodoc]] FlaxViTForImageClassification
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_hybrid.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_hybrid.md
new file mode 100644
index 0000000000000000000000000000000000000000..5cde5e529807e0f541c7ac8d71f7bcd9a3378447
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_hybrid.md
@@ -0,0 +1,106 @@
+
+
+# Hybrid Vision Transformer (ViT Hybrid)
+
+
+
+This model is in maintenance mode only, we don't accept any new PRs changing its code.
+If you run into any issues running this model, please reinstall the last version that supported this model: v4.40.2.
+You can do so by running the following command: `pip install -U transformers==4.40.2`.
+
+
+
+## Overview
+
+The hybrid Vision Transformer (ViT) model was proposed in [An Image is Worth 16x16 Words: Transformers for Image Recognition
+at Scale](https://arxiv.org/abs/2010.11929) by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk
+Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob
+Uszkoreit, Neil Houlsby. It's the first paper that successfully trains a Transformer encoder on ImageNet, attaining
+very good results compared to familiar convolutional architectures. ViT hybrid is a slight variant of the [plain Vision Transformer](vit),
+by leveraging a convolutional backbone (specifically, [BiT](bit)) whose features are used as initial "tokens" for the Transformer.
+
+The abstract from the paper is the following:
+
+*While the Transformer architecture has become the de-facto standard for natural language processing tasks, its
+applications to computer vision remain limited. In vision, attention is either applied in conjunction with
+convolutional networks, or used to replace certain components of convolutional networks while keeping their overall
+structure in place. We show that this reliance on CNNs is not necessary and a pure transformer applied directly to
+sequences of image patches can perform very well on image classification tasks. When pre-trained on large amounts of
+data and transferred to multiple mid-sized or small image recognition benchmarks (ImageNet, CIFAR-100, VTAB, etc.),
+Vision Transformer (ViT) attains excellent results compared to state-of-the-art convolutional networks while requiring
+substantially fewer computational resources to train.*
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code (written in JAX) can be
+found [here](https://github.com/google-research/vision_transformer).
+
+## Using Scaled Dot Product Attention (SDPA)
+
+PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function
+encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
+[official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)
+or the [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)
+page for more information.
+
+SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set
+`attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+```
+from transformers import ViTHybridForImageClassification
+model = ViTHybridForImageClassification.from_pretrained("google/vit-hybrid-base-bit-384", attn_implementation="sdpa", torch_dtype=torch.float16)
+...
+```
+
+For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`).
+
+On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with `float32` and `google/vit-hybrid-base-bit-384` model, we saw the following speedups during inference.
+
+| Batch size | Average inference time (ms), eager mode | Average inference time (ms), sdpa model | Speed up, Sdpa / Eager (x) |
+|--------------|-------------------------------------------|-------------------------------------------|------------------------------|
+| 1 | 29 | 18 | 1.61 |
+| 2 | 26 | 18 | 1.44 |
+| 4 | 25 | 18 | 1.39 |
+| 8 | 34 | 24 | 1.42 |
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with ViT Hybrid.
+
+
+
+- [`ViTHybridForImageClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
+- See also: [Image classification task guide](../tasks/image_classification)
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## ViTHybridConfig
+
+[[autodoc]] ViTHybridConfig
+
+## ViTHybridImageProcessor
+
+[[autodoc]] ViTHybridImageProcessor
+ - preprocess
+
+## ViTHybridModel
+
+[[autodoc]] ViTHybridModel
+ - forward
+
+## ViTHybridForImageClassification
+
+[[autodoc]] ViTHybridForImageClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_mae.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_mae.md
new file mode 100644
index 0000000000000000000000000000000000000000..8d0a40c8a3e1be25fe53169f22763957c5887d39
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_mae.md
@@ -0,0 +1,123 @@
+
+
+# ViTMAE
+
+## Overview
+
+The ViTMAE model was proposed in [Masked Autoencoders Are Scalable Vision Learners](https://arxiv.org/abs/2111.06377v2) by Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li,
+Piotr Dollรกr, Ross Girshick. The paper shows that, by pre-training a Vision Transformer (ViT) to reconstruct pixel values for masked patches, one can get results after
+fine-tuning that outperform supervised pre-training.
+
+The abstract from the paper is the following:
+
+*This paper shows that masked autoencoders (MAE) are scalable self-supervised learners for computer vision. Our MAE approach is simple: we mask random patches of the
+input image and reconstruct the missing pixels. It is based on two core designs. First, we develop an asymmetric encoder-decoder architecture, with an encoder that operates
+only on the visible subset of patches (without mask tokens), along with a lightweight decoder that reconstructs the original image from the latent representation and mask
+tokens. Second, we find that masking a high proportion of the input image, e.g., 75%, yields a nontrivial and meaningful self-supervisory task. Coupling these two designs
+enables us to train large models efficiently and effectively: we accelerate training (by 3x or more) and improve accuracy. Our scalable approach allows for learning high-capacity
+models that generalize well: e.g., a vanilla ViT-Huge model achieves the best accuracy (87.8%) among methods that use only ImageNet-1K data. Transfer performance in downstream
+tasks outperforms supervised pre-training and shows promising scaling behavior.*
+
+
+
+ MAE architecture. Taken from the original paper.
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). TensorFlow version of the model was contributed by [sayakpaul](https://github.com/sayakpaul) and
+[ariG23498](https://github.com/ariG23498) (equal contribution). The original code can be found [here](https://github.com/facebookresearch/mae).
+
+## Usage tips
+
+- MAE (masked auto encoding) is a method for self-supervised pre-training of Vision Transformers (ViTs). The pre-training objective is relatively simple:
+by masking a large portion (75%) of the image patches, the model must reconstruct raw pixel values. One can use [`ViTMAEForPreTraining`] for this purpose.
+- After pre-training, one "throws away" the decoder used to reconstruct pixels, and one uses the encoder for fine-tuning/linear probing. This means that after
+fine-tuning, one can directly plug in the weights into a [`ViTForImageClassification`].
+- One can use [`ViTImageProcessor`] to prepare images for the model. See the code examples for more info.
+- Note that the encoder of MAE is only used to encode the visual patches. The encoded patches are then concatenated with mask tokens, which the decoder (which also
+consists of Transformer blocks) takes as input. Each mask token is a shared, learned vector that indicates the presence of a missing patch to be predicted. Fixed
+sin/cos position embeddings are added both to the input of the encoder and the decoder.
+- For a visual understanding of how MAEs work you can check out this [post](https://keras.io/examples/vision/masked_image_modeling/).
+
+### Using Scaled Dot Product Attention (SDPA)
+
+PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function
+encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
+[official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)
+or the [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)
+page for more information.
+
+SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set
+`attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+```
+from transformers import ViTMAEModel
+model = ViTMAEModel.from_pretrained("facebook/vit-mae-base", attn_implementation="sdpa", torch_dtype=torch.float16)
+...
+```
+
+For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`).
+
+On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with `float32` and `facebook/vit-mae-base` model, we saw the following speedups during inference.
+
+| Batch size | Average inference time (ms), eager mode | Average inference time (ms), sdpa model | Speed up, Sdpa / Eager (x) |
+|--------------|-------------------------------------------|-------------------------------------------|------------------------------|
+| 1 | 11 | 6 | 1.83 |
+| 2 | 8 | 6 | 1.33 |
+| 4 | 8 | 6 | 1.33 |
+| 8 | 8 | 6 | 1.33 |
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with ViTMAE.
+
+- [`ViTMAEForPreTraining`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining), allowing you to pre-train the model from scratch/further pre-train the model on custom data.
+- A notebook that illustrates how to visualize reconstructed pixel values with [`ViTMAEForPreTraining`] can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/ViTMAE/ViT_MAE_visualization_demo.ipynb).
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## ViTMAEConfig
+
+[[autodoc]] ViTMAEConfig
+
+
+
+
+## ViTMAEModel
+
+[[autodoc]] ViTMAEModel
+ - forward
+
+## ViTMAEForPreTraining
+
+[[autodoc]] transformers.ViTMAEForPreTraining
+ - forward
+
+
+
+
+## TFViTMAEModel
+
+[[autodoc]] TFViTMAEModel
+ - call
+
+## TFViTMAEForPreTraining
+
+[[autodoc]] transformers.TFViTMAEForPreTraining
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_msn.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_msn.md
new file mode 100644
index 0000000000000000000000000000000000000000..e1210ce7f9dd9a72b18bb71af56d7559b265ab13
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vit_msn.md
@@ -0,0 +1,103 @@
+
+
+# ViTMSN
+
+## Overview
+
+The ViTMSN model was proposed in [Masked Siamese Networks for Label-Efficient Learning](https://arxiv.org/abs/2204.07141) by Mahmoud Assran, Mathilde Caron, Ishan Misra, Piotr Bojanowski, Florian Bordes,
+Pascal Vincent, Armand Joulin, Michael Rabbat, Nicolas Ballas. The paper presents a joint-embedding architecture to match the prototypes
+of masked patches with that of the unmasked patches. With this setup, their method yields excellent performance in the low-shot and extreme low-shot
+regimes.
+
+The abstract from the paper is the following:
+
+*We propose Masked Siamese Networks (MSN), a self-supervised learning framework for learning image representations. Our
+approach matches the representation of an image view containing randomly masked patches to the representation of the original
+unmasked image. This self-supervised pre-training strategy is particularly scalable when applied to Vision Transformers since only the
+unmasked patches are processed by the network. As a result, MSNs improve the scalability of joint-embedding architectures,
+while producing representations of a high semantic level that perform competitively on low-shot image classification. For instance,
+on ImageNet-1K, with only 5,000 annotated images, our base MSN model achieves 72.4% top-1 accuracy,
+and with 1% of ImageNet-1K labels, we achieve 75.7% top-1 accuracy, setting a new state-of-the-art for self-supervised learning on this benchmark.*
+
+
+
+ MSN architecture. Taken from the original paper.
+
+This model was contributed by [sayakpaul](https://huggingface.co/sayakpaul). The original code can be found [here](https://github.com/facebookresearch/msn).
+
+## Usage tips
+
+- MSN (masked siamese networks) is a method for self-supervised pre-training of Vision Transformers (ViTs). The pre-training
+objective is to match the prototypes assigned to the unmasked views of the images to that of the masked views of the same images.
+- The authors have only released pre-trained weights of the backbone (ImageNet-1k pre-training). So, to use that on your own image classification dataset,
+use the [`ViTMSNForImageClassification`] class which is initialized from [`ViTMSNModel`]. Follow
+[this notebook](https://github.com/huggingface/notebooks/blob/main/examples/image_classification.ipynb) for a detailed tutorial on fine-tuning.
+- MSN is particularly useful in the low-shot and extreme low-shot regimes. Notably, it achieves 75.7% top-1 accuracy with only 1% of ImageNet-1K
+labels when fine-tuned.
+
+### Using Scaled Dot Product Attention (SDPA)
+
+PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function
+encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
+[official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)
+or the [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)
+page for more information.
+
+SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set
+`attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+```
+from transformers import ViTMSNForImageClassification
+model = ViTMSNForImageClassification.from_pretrained("facebook/vit-msn-base", attn_implementation="sdpa", torch_dtype=torch.float16)
+...
+```
+
+For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`).
+
+On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with `float32` and `facebook/vit-msn-base` model, we saw the following speedups during inference.
+
+| Batch size | Average inference time (ms), eager mode | Average inference time (ms), sdpa model | Speed up, Sdpa / Eager (x) |
+|--------------|-------------------------------------------|-------------------------------------------|------------------------------|
+| 1 | 7 | 6 | 1.17 |
+| 2 | 8 | 6 | 1.33 |
+| 4 | 8 | 6 | 1.33 |
+| 8 | 8 | 6 | 1.33 |
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with ViT MSN.
+
+
+
+- [`ViTMSNForImageClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
+- See also: [Image classification task guide](../tasks/image_classification)
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## ViTMSNConfig
+
+[[autodoc]] ViTMSNConfig
+
+## ViTMSNModel
+
+[[autodoc]] ViTMSNModel
+ - forward
+
+## ViTMSNForImageClassification
+
+[[autodoc]] ViTMSNForImageClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitdet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitdet.md
new file mode 100644
index 0000000000000000000000000000000000000000..81bf787d6cda24bfdc4c398d5fde73f6c7f236a7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitdet.md
@@ -0,0 +1,38 @@
+
+
+# ViTDet
+
+## Overview
+
+The ViTDet model was proposed in [Exploring Plain Vision Transformer Backbones for Object Detection](https://arxiv.org/abs/2203.16527) by Yanghao Li, Hanzi Mao, Ross Girshick, Kaiming He.
+VitDet leverages the plain [Vision Transformer](vit) for the task of object detection.
+
+The abstract from the paper is the following:
+
+*We explore the plain, non-hierarchical Vision Transformer (ViT) as a backbone network for object detection. This design enables the original ViT architecture to be fine-tuned for object detection without needing to redesign a hierarchical backbone for pre-training. With minimal adaptations for fine-tuning, our plain-backbone detector can achieve competitive results. Surprisingly, we observe: (i) it is sufficient to build a simple feature pyramid from a single-scale feature map (without the common FPN design) and (ii) it is sufficient to use window attention (without shifting) aided with very few cross-window propagation blocks. With plain ViT backbones pre-trained as Masked Autoencoders (MAE), our detector, named ViTDet, can compete with the previous leading methods that were all based on hierarchical backbones, reaching up to 61.3 AP_box on the COCO dataset using only ImageNet-1K pre-training. We hope our study will draw attention to research on plain-backbone detectors.*
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr).
+The original code can be found [here](https://github.com/facebookresearch/detectron2/tree/main/projects/ViTDet).
+
+Tips:
+
+- At the moment, only the backbone is available.
+
+## VitDetConfig
+
+[[autodoc]] VitDetConfig
+
+## VitDetModel
+
+[[autodoc]] VitDetModel
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitmatte.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitmatte.md
new file mode 100644
index 0000000000000000000000000000000000000000..5a6d501030fcdffa8a7aba0c11d051bfb047ac15
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitmatte.md
@@ -0,0 +1,55 @@
+
+
+# ViTMatte
+
+## Overview
+
+The ViTMatte model was proposed in [Boosting Image Matting with Pretrained Plain Vision Transformers](https://arxiv.org/abs/2305.15272) by Jingfeng Yao, Xinggang Wang, Shusheng Yang, Baoyuan Wang.
+ViTMatte leverages plain [Vision Transformers](vit) for the task of image matting, which is the process of accurately estimating the foreground object in images and videos.
+
+The abstract from the paper is the following:
+
+*Recently, plain vision Transformers (ViTs) have shown impressive performance on various computer vision tasks, thanks to their strong modeling capacity and large-scale pretraining. However, they have not yet conquered the problem of image matting. We hypothesize that image matting could also be boosted by ViTs and present a new efficient and robust ViT-based matting system, named ViTMatte. Our method utilizes (i) a hybrid attention mechanism combined with a convolution neck to help ViTs achieve an excellent performance-computation trade-off in matting tasks. (ii) Additionally, we introduce the detail capture module, which just consists of simple lightweight convolutions to complement the detailed information required by matting. To the best of our knowledge, ViTMatte is the first work to unleash the potential of ViT on image matting with concise adaptation. It inherits many superior properties from ViT to matting, including various pretraining strategies, concise architecture design, and flexible inference strategies. We evaluate ViTMatte on Composition-1k and Distinctions-646, the most commonly used benchmark for image matting, our method achieves state-of-the-art performance and outperforms prior matting works by a large margin.*
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr).
+The original code can be found [here](https://github.com/hustvl/ViTMatte).
+
+
+
+ ViTMatte high-level overview. Taken from the original paper.
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with ViTMatte.
+
+- A demo notebook regarding inference with [`VitMatteForImageMatting`], including background replacement, can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/ViTMatte).
+
+
+
+The model expects both the image and trimap (concatenated) as input. Use [`ViTMatteImageProcessor`] for this purpose.
+
+
+## VitMatteConfig
+
+[[autodoc]] VitMatteConfig
+
+## VitMatteImageProcessor
+
+[[autodoc]] VitMatteImageProcessor
+ - preprocess
+
+## VitMatteForImageMatting
+
+[[autodoc]] VitMatteForImageMatting
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitpose.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitpose.md
new file mode 100644
index 0000000000000000000000000000000000000000..361f8e30c75d2b72599bfa46d48bd0b51b231f63
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vitpose.md
@@ -0,0 +1,254 @@
+
+
+# VitPose
+
+## Overview
+
+The VitPose model was proposed in [ViTPose: Simple Vision Transformer Baselines for Human Pose Estimation](https://arxiv.org/abs/2204.12484) by Yufei Xu, Jing Zhang, Qiming Zhang, Dacheng Tao. VitPose employs a standard, non-hierarchical [Vision Transformer](https://arxiv.org/pdf/2010.11929v2) as backbone for the task of keypoint estimation. A simple decoder head is added on top to predict the heatmaps from a given image. Despite its simplicity, the model gets state-of-the-art results on the challenging MS COCO Keypoint Detection benchmark.
+
+The abstract from the paper is the following:
+
+*Although no specific domain knowledge is considered in the design, plain vision transformers have shown excellent performance in visual recognition tasks. However, little effort has been made to reveal the potential of such simple structures for pose estimation tasks. In this paper, we show the surprisingly good capabilities of plain vision transformers for pose estimation from various aspects, namely simplicity in model structure, scalability in model size, flexibility in training paradigm, and transferability of knowledge between models, through a simple baseline model called ViTPose. Specifically, ViTPose employs plain and non-hierarchical vision transformers as backbones to extract features for a given person instance and a lightweight decoder for pose estimation. It can be scaled up from 100M to 1B parameters by taking the advantages of the scalable model capacity and high parallelism of transformers, setting a new Pareto front between throughput and performance. Besides, ViTPose is very flexible regarding the attention type, input resolution, pre-training and finetuning strategy, as well as dealing with multiple pose tasks. We also empirically demonstrate that the knowledge of large ViTPose models can be easily transferred to small ones via a simple knowledge token. Experimental results show that our basic ViTPose model outperforms representative methods on the challenging MS COCO Keypoint Detection benchmark, while the largest model sets a new state-of-the-art.*
+
+
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr) and [sangbumchoi](https://github.com/SangbumChoi).
+The original code can be found [here](https://github.com/ViTAE-Transformer/ViTPose).
+
+## Usage Tips
+
+ViTPose is a so-called top-down keypoint detection model. This means that one first uses an object detector, like [RT-DETR](rt_detr.md), to detect people (or other instances) in an image. Next, ViTPose takes the cropped images as input and predicts the keypoints.
+
+```py
+import torch
+import requests
+import numpy as np
+
+from PIL import Image
+
+from transformers import (
+ AutoProcessor,
+ RTDetrForObjectDetection,
+ VitPoseForPoseEstimation,
+)
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+url = "http://images.cocodataset.org/val2017/000000000139.jpg"
+image = Image.open(requests.get(url, stream=True).raw)
+
+# ------------------------------------------------------------------------
+# Stage 1. Detect humans on the image
+# ------------------------------------------------------------------------
+
+# You can choose detector by your choice
+person_image_processor = AutoProcessor.from_pretrained("PekingU/rtdetr_r50vd_coco_o365")
+person_model = RTDetrForObjectDetection.from_pretrained("PekingU/rtdetr_r50vd_coco_o365", device_map=device)
+
+inputs = person_image_processor(images=image, return_tensors="pt").to(device)
+
+with torch.no_grad():
+ outputs = person_model(**inputs)
+
+results = person_image_processor.post_process_object_detection(
+ outputs, target_sizes=torch.tensor([(image.height, image.width)]), threshold=0.3
+)
+result = results[0] # take first image results
+
+# Human label refers 0 index in COCO dataset
+person_boxes = result["boxes"][result["labels"] == 0]
+person_boxes = person_boxes.cpu().numpy()
+
+# Convert boxes from VOC (x1, y1, x2, y2) to COCO (x1, y1, w, h) format
+person_boxes[:, 2] = person_boxes[:, 2] - person_boxes[:, 0]
+person_boxes[:, 3] = person_boxes[:, 3] - person_boxes[:, 1]
+
+# ------------------------------------------------------------------------
+# Stage 2. Detect keypoints for each person found
+# ------------------------------------------------------------------------
+
+image_processor = AutoProcessor.from_pretrained("usyd-community/vitpose-base-simple")
+model = VitPoseForPoseEstimation.from_pretrained("usyd-community/vitpose-base-simple", device_map=device)
+
+inputs = image_processor(image, boxes=[person_boxes], return_tensors="pt").to(device)
+
+with torch.no_grad():
+ outputs = model(**inputs)
+
+pose_results = image_processor.post_process_pose_estimation(outputs, boxes=[person_boxes])
+image_pose_result = pose_results[0] # results for first image
+```
+
+
+### Visualization for supervision user
+```py
+import supervision as sv
+
+xy = torch.stack([pose_result['keypoints'] for pose_result in image_pose_result]).cpu().numpy()
+scores = torch.stack([pose_result['scores'] for pose_result in image_pose_result]).cpu().numpy()
+
+key_points = sv.KeyPoints(
+ xy=xy, confidence=scores
+)
+
+edge_annotator = sv.EdgeAnnotator(
+ color=sv.Color.GREEN,
+ thickness=1
+)
+vertex_annotator = sv.VertexAnnotator(
+ color=sv.Color.RED,
+ radius=2
+)
+annotated_frame = edge_annotator.annotate(
+ scene=image.copy(),
+ key_points=key_points
+)
+annotated_frame = vertex_annotator.annotate(
+ scene=annotated_frame,
+ key_points=key_points
+)
+```
+
+### Visualization for advanced user
+```py
+import math
+import cv2
+
+def draw_points(image, keypoints, scores, pose_keypoint_color, keypoint_score_threshold, radius, show_keypoint_weight):
+ if pose_keypoint_color is not None:
+ assert len(pose_keypoint_color) == len(keypoints)
+ for kid, (kpt, kpt_score) in enumerate(zip(keypoints, scores)):
+ x_coord, y_coord = int(kpt[0]), int(kpt[1])
+ if kpt_score > keypoint_score_threshold:
+ color = tuple(int(c) for c in pose_keypoint_color[kid])
+ if show_keypoint_weight:
+ cv2.circle(image, (int(x_coord), int(y_coord)), radius, color, -1)
+ transparency = max(0, min(1, kpt_score))
+ cv2.addWeighted(image, transparency, image, 1 - transparency, 0, dst=image)
+ else:
+ cv2.circle(image, (int(x_coord), int(y_coord)), radius, color, -1)
+
+def draw_links(image, keypoints, scores, keypoint_edges, link_colors, keypoint_score_threshold, thickness, show_keypoint_weight, stick_width = 2):
+ height, width, _ = image.shape
+ if keypoint_edges is not None and link_colors is not None:
+ assert len(link_colors) == len(keypoint_edges)
+ for sk_id, sk in enumerate(keypoint_edges):
+ x1, y1, score1 = (int(keypoints[sk[0], 0]), int(keypoints[sk[0], 1]), scores[sk[0]])
+ x2, y2, score2 = (int(keypoints[sk[1], 0]), int(keypoints[sk[1], 1]), scores[sk[1]])
+ if (
+ x1 > 0
+ and x1 < width
+ and y1 > 0
+ and y1 < height
+ and x2 > 0
+ and x2 < width
+ and y2 > 0
+ and y2 < height
+ and score1 > keypoint_score_threshold
+ and score2 > keypoint_score_threshold
+ ):
+ color = tuple(int(c) for c in link_colors[sk_id])
+ if show_keypoint_weight:
+ X = (x1, x2)
+ Y = (y1, y2)
+ mean_x = np.mean(X)
+ mean_y = np.mean(Y)
+ length = ((Y[0] - Y[1]) ** 2 + (X[0] - X[1]) ** 2) ** 0.5
+ angle = math.degrees(math.atan2(Y[0] - Y[1], X[0] - X[1]))
+ polygon = cv2.ellipse2Poly(
+ (int(mean_x), int(mean_y)), (int(length / 2), int(stick_width)), int(angle), 0, 360, 1
+ )
+ cv2.fillConvexPoly(image, polygon, color)
+ transparency = max(0, min(1, 0.5 * (keypoints[sk[0], 2] + keypoints[sk[1], 2])))
+ cv2.addWeighted(image, transparency, image, 1 - transparency, 0, dst=image)
+ else:
+ cv2.line(image, (x1, y1), (x2, y2), color, thickness=thickness)
+
+
+# Note: keypoint_edges and color palette are dataset-specific
+keypoint_edges = model.config.edges
+
+palette = np.array(
+ [
+ [255, 128, 0],
+ [255, 153, 51],
+ [255, 178, 102],
+ [230, 230, 0],
+ [255, 153, 255],
+ [153, 204, 255],
+ [255, 102, 255],
+ [255, 51, 255],
+ [102, 178, 255],
+ [51, 153, 255],
+ [255, 153, 153],
+ [255, 102, 102],
+ [255, 51, 51],
+ [153, 255, 153],
+ [102, 255, 102],
+ [51, 255, 51],
+ [0, 255, 0],
+ [0, 0, 255],
+ [255, 0, 0],
+ [255, 255, 255],
+ ]
+)
+
+link_colors = palette[[0, 0, 0, 0, 7, 7, 7, 9, 9, 9, 9, 9, 16, 16, 16, 16, 16, 16, 16]]
+keypoint_colors = palette[[16, 16, 16, 16, 16, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0]]
+
+numpy_image = np.array(image)
+
+for pose_result in image_pose_result:
+ scores = np.array(pose_result["scores"])
+ keypoints = np.array(pose_result["keypoints"])
+
+ # draw each point on image
+ draw_points(numpy_image, keypoints, scores, keypoint_colors, keypoint_score_threshold=0.3, radius=4, show_keypoint_weight=False)
+
+ # draw links
+ draw_links(numpy_image, keypoints, scores, keypoint_edges, link_colors, keypoint_score_threshold=0.3, thickness=1, show_keypoint_weight=False)
+
+pose_image = Image.fromarray(numpy_image)
+pose_image
+```
+
+
+### MoE backbone
+
+To enable MoE (Mixture of Experts) function in the backbone, user has to give appropriate configuration such as `num_experts` and input value `dataset_index` to the backbone model. However, it is not used in default parameters. Below is the code snippet for usage of MoE function.
+
+```py
+>>> from transformers import VitPoseBackboneConfig, VitPoseBackbone
+>>> import torch
+
+>>> config = VitPoseBackboneConfig(num_experts=3, out_indices=[-1])
+>>> model = VitPoseBackbone(config)
+
+>>> pixel_values = torch.randn(3, 3, 256, 192)
+>>> dataset_index = torch.tensor([1, 2, 3])
+>>> outputs = model(pixel_values, dataset_index)
+```
+
+## VitPoseImageProcessor
+
+[[autodoc]] VitPoseImageProcessor
+ - preprocess
+
+## VitPoseConfig
+
+[[autodoc]] VitPoseConfig
+
+## VitPoseForPoseEstimation
+
+[[autodoc]] VitPoseForPoseEstimation
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vits.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vits.md
new file mode 100644
index 0000000000000000000000000000000000000000..42997cae1e74444fa74d3c24e4869d1d117b0b0d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vits.md
@@ -0,0 +1,182 @@
+
+
+# VITS
+
+## Overview
+
+The VITS model was proposed in [Conditional Variational Autoencoder with Adversarial Learning for End-to-End Text-to-Speech](https://arxiv.org/abs/2106.06103) by Jaehyeon Kim, Jungil Kong, Juhee Son.
+
+VITS (**V**ariational **I**nference with adversarial learning for end-to-end **T**ext-to-**S**peech) is an end-to-end
+speech synthesis model that predicts a speech waveform conditional on an input text sequence. It is a conditional variational
+autoencoder (VAE) comprised of a posterior encoder, decoder, and conditional prior.
+
+A set of spectrogram-based acoustic features are predicted by the flow-based module, which is formed of a Transformer-based
+text encoder and multiple coupling layers. The spectrogram is decoded using a stack of transposed convolutional layers,
+much in the same style as the HiFi-GAN vocoder. Motivated by the one-to-many nature of the TTS problem, where the same text
+input can be spoken in multiple ways, the model also includes a stochastic duration predictor, which allows the model to
+synthesise speech with different rhythms from the same input text.
+
+The model is trained end-to-end with a combination of losses derived from variational lower bound and adversarial training.
+To improve the expressiveness of the model, normalizing flows are applied to the conditional prior distribution. During
+inference, the text encodings are up-sampled based on the duration prediction module, and then mapped into the
+waveform using a cascade of the flow module and HiFi-GAN decoder. Due to the stochastic nature of the duration predictor,
+the model is non-deterministic, and thus requires a fixed seed to generate the same speech waveform.
+
+The abstract from the paper is the following:
+
+*Several recent end-to-end text-to-speech (TTS) models enabling single-stage training and parallel sampling have been proposed, but their sample quality does not match that of two-stage TTS systems. In this work, we present a parallel end-to-end TTS method that generates more natural sounding audio than current two-stage models. Our method adopts variational inference augmented with normalizing flows and an adversarial training process, which improves the expressive power of generative modeling. We also propose a stochastic duration predictor to synthesize speech with diverse rhythms from input text. With the uncertainty modeling over latent variables and the stochastic duration predictor, our method expresses the natural one-to-many relationship in which a text input can be spoken in multiple ways with different pitches and rhythms. A subjective human evaluation (mean opinion score, or MOS) on the LJ Speech, a single speaker dataset, shows that our method outperforms the best publicly available TTS systems and achieves a MOS comparable to ground truth.*
+
+This model can also be used with TTS checkpoints from [Massively Multilingual Speech (MMS)](https://arxiv.org/abs/2305.13516)
+as these checkpoints use the same architecture and a slightly modified tokenizer.
+
+This model was contributed by [Matthijs](https://huggingface.co/Matthijs) and [sanchit-gandhi](https://huggingface.co/sanchit-gandhi). The original code can be found [here](https://github.com/jaywalnut310/vits).
+
+## Usage examples
+
+Both the VITS and MMS-TTS checkpoints can be used with the same API. Since the flow-based model is non-deterministic, it
+is good practice to set a seed to ensure reproducibility of the outputs. For languages with a Roman alphabet,
+such as English or French, the tokenizer can be used directly to pre-process the text inputs. The following code example
+runs a forward pass using the MMS-TTS English checkpoint:
+
+```python
+import torch
+from transformers import VitsTokenizer, VitsModel, set_seed
+
+tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-eng")
+model = VitsModel.from_pretrained("facebook/mms-tts-eng")
+
+inputs = tokenizer(text="Hello - my dog is cute", return_tensors="pt")
+
+set_seed(555) # make deterministic
+
+with torch.no_grad():
+ outputs = model(**inputs)
+
+waveform = outputs.waveform[0]
+```
+
+The resulting waveform can be saved as a `.wav` file:
+
+```python
+import scipy
+
+scipy.io.wavfile.write("techno.wav", rate=model.config.sampling_rate, data=waveform)
+```
+
+Or displayed in a Jupyter Notebook / Google Colab:
+
+```python
+from IPython.display import Audio
+
+Audio(waveform, rate=model.config.sampling_rate)
+```
+
+For certain languages with a non-Roman alphabet, such as Arabic, Mandarin or Hindi, the [`uroman`](https://github.com/isi-nlp/uroman)
+perl package is required to pre-process the text inputs to the Roman alphabet.
+
+You can check whether you require the `uroman` package for your language by inspecting the `is_uroman` attribute of
+the pre-trained `tokenizer`:
+
+```python
+from transformers import VitsTokenizer
+
+tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-eng")
+print(tokenizer.is_uroman)
+```
+If the is_uroman attribute is `True`, the tokenizer will automatically apply the `uroman` package to your text inputs, but you need to install uroman if not already installed using:
+```
+pip install --upgrade uroman
+```
+Note: Python version required to use `uroman` as python package should be >= `3.10`.
+You can use the tokenizer as usual without any additional preprocessing steps:
+```python
+import torch
+from transformers import VitsTokenizer, VitsModel, set_seed
+import os
+import subprocess
+
+tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-kor")
+model = VitsModel.from_pretrained("facebook/mms-tts-kor")
+text = "์ด๋ด ๋ฌด์จ ์ผ์ด์ผ"
+inputs = tokenizer(text=text, return_tensors="pt")
+
+set_seed(555) # make deterministic
+with torch.no_grad():
+ outputs = model(inputs["input_ids"])
+
+waveform = outputs.waveform[0]
+```
+If you don't want to upgrade to python >= `3.10`, then you can use the `uroman` perl package to pre-process the text inputs to the Roman alphabet.
+To do this, first clone the uroman repository to your local machine and set the bash variable `UROMAN` to the local path:
+
+
+```bash
+git clone https://github.com/isi-nlp/uroman.git
+cd uroman
+export UROMAN=$(pwd)
+```
+
+You can then pre-process the text input using the following code snippet. You can either rely on using the bash variable
+`UROMAN` to point to the uroman repository, or you can pass the uroman directory as an argument to the `uromanize` function:
+
+```python
+import torch
+from transformers import VitsTokenizer, VitsModel, set_seed
+import os
+import subprocess
+
+tokenizer = VitsTokenizer.from_pretrained("facebook/mms-tts-kor")
+model = VitsModel.from_pretrained("facebook/mms-tts-kor")
+
+def uromanize(input_string, uroman_path):
+ """Convert non-Roman strings to Roman using the `uroman` perl package."""
+ script_path = os.path.join(uroman_path, "bin", "uroman.pl")
+
+ command = ["perl", script_path]
+
+ process = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ # Execute the perl command
+ stdout, stderr = process.communicate(input=input_string.encode())
+
+ if process.returncode != 0:
+ raise ValueError(f"Error {process.returncode}: {stderr.decode()}")
+
+ # Return the output as a string and skip the new-line character at the end
+ return stdout.decode()[:-1]
+
+text = "์ด๋ด ๋ฌด์จ ์ผ์ด์ผ"
+uromanized_text = uromanize(text, uroman_path=os.environ["UROMAN"])
+
+inputs = tokenizer(text=uromanized_text, return_tensors="pt")
+
+set_seed(555) # make deterministic
+with torch.no_grad():
+ outputs = model(inputs["input_ids"])
+
+waveform = outputs.waveform[0]
+```
+
+## VitsConfig
+
+[[autodoc]] VitsConfig
+
+## VitsTokenizer
+
+[[autodoc]] VitsTokenizer
+ - __call__
+ - save_vocabulary
+
+## VitsModel
+
+[[autodoc]] VitsModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vivit.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vivit.md
new file mode 100644
index 0000000000000000000000000000000000000000..c3e3df14ab988b37746a7d95851e6e800b24f24c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/vivit.md
@@ -0,0 +1,80 @@
+
+
+# Video Vision Transformer (ViViT)
+
+## Overview
+
+The Vivit model was proposed in [ViViT: A Video Vision Transformer](https://arxiv.org/abs/2103.15691) by Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luฤiฤ, Cordelia Schmid.
+The paper proposes one of the first successful pure-transformer based set of models for video understanding.
+
+The abstract from the paper is the following:
+
+*We present pure-transformer based models for video classification, drawing upon the recent success of such models in image classification. Our model extracts spatio-temporal tokens from the input video, which are then encoded by a series of transformer layers. In order to handle the long sequences of tokens encountered in video, we propose several, efficient variants of our model which factorise the spatial- and temporal-dimensions of the input. Although transformer-based models are known to only be effective when large training datasets are available, we show how we can effectively regularise the model during training and leverage pretrained image models to be able to train on comparatively small datasets. We conduct thorough ablation studies, and achieve state-of-the-art results on multiple video classification benchmarks including Kinetics 400 and 600, Epic Kitchens, Something-Something v2 and Moments in Time, outperforming prior methods based on deep 3D convolutional networks.*
+
+This model was contributed by [jegormeister](https://huggingface.co/jegormeister). The original code (written in JAX) can be found [here](https://github.com/google-research/scenic/tree/main/scenic/projects/vivit).
+
+### Using Scaled Dot Product Attention (SDPA)
+
+PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function
+encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
+[official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)
+or the [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)
+page for more information.
+
+SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set
+`attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+```
+from transformers import VivitModel
+model = VivitModel.from_pretrained("google/vivit-b-16x2-kinetics400", attn_implementation="sdpa", torch_dtype=torch.float16)
+...
+```
+
+For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`).
+
+On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with `float32` and `google/vivit-b-16x2-kinetics400` model, we saw the following speedups during inference.
+
+### Training
+| num_training_steps | batch_size | is cuda | Speedup (%) | Eager peak mem (MB) | sdpa peak mem (MB) | Mem saving (%) |
+|---------------------:|-------------:|----------:|--------------:|----------------------:|---------------------:|-----------------:|
+| 100 | 1 | True | 7.122 | 2575.28 | 5932.54 | 130.364 |
+
+
+
+### Inference
+| num_batches | batch_size | is cuda | is half | Speedup (%) | Mem eager (MB) | Mem BT (MB) | Mem saved (%) |
+|---------------|--------------|-----------|-----------|---------------|------------------|---------------|-----------------|
+| 20 | 1 | True | False | 15.422 | 715.807 | 317.079 | 125.75 |
+| 20 | 2 | True | False | 17.146 | 1234.75 | 447.175 | 176.122 |
+| 20 | 4 | True | False | 18.093 | 2275.82 | 709.864 | 220.6 |
+| 20 | 8 | True | False | 19.284 | 4358.19 | 1233.24 | 253.393 |
+
+
+## VivitConfig
+
+[[autodoc]] VivitConfig
+
+## VivitImageProcessor
+
+[[autodoc]] VivitImageProcessor
+ - preprocess
+
+## VivitModel
+
+[[autodoc]] VivitModel
+ - forward
+
+## VivitForVideoClassification
+
+[[autodoc]] transformers.VivitForVideoClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2-bert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2-bert.md
new file mode 100644
index 0000000000000000000000000000000000000000..6514133330a9d437828eac86ac6d9e513440be71
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2-bert.md
@@ -0,0 +1,90 @@
+
+
+# Wav2Vec2-BERT
+
+## Overview
+
+The Wav2Vec2-BERT model was proposed in [Seamless: Multilingual Expressive and Streaming Speech Translation](https://ai.meta.com/research/publications/seamless-multilingual-expressive-and-streaming-speech-translation/) by the Seamless Communication team from Meta AI.
+
+This model was pre-trained on 4.5M hours of unlabeled audio data covering more than 143 languages. It requires finetuning to be used for downstream tasks such as Automatic Speech Recognition (ASR), or Audio Classification.
+
+The official results of the model can be found in Section 3.2.1 of the paper.
+
+The abstract from the paper is the following:
+
+*Recent advancements in automatic speech translation have dramatically expanded language coverage, improved multimodal capabilities, and enabled a wide range of tasks and functionalities. That said, large-scale automatic speech translation systems today lack key features that help machine-mediated communication feel seamless when compared to human-to-human dialogue. In this work, we introduce a family of models that enable end-to-end expressive and multilingual translations in a streaming fashion. First, we contribute an improved version of the massively multilingual and multimodal SeamlessM4T modelโSeamlessM4T v2. This newer model, incorporating an updated UnitY2 framework, was trained on more low-resource language data. The expanded version of SeamlessAlign adds 114,800 hours of automatically aligned data for a total of 76 languages. SeamlessM4T v2 provides the foundation on which our two newest models, SeamlessExpressive and SeamlessStreaming, are initiated. SeamlessExpressive enables translation that preserves vocal styles and prosody. Compared to previous efforts in expressive speech research, our work addresses certain underexplored aspects of prosody, such as speech rate and pauses, while also preserving the style of oneโs voice. As for SeamlessStreaming, our model leverages the Efficient Monotonic Multihead Attention (EMMA) mechanism to generate low-latency target translations without waiting for complete source utterances. As the first of its kind, SeamlessStreaming enables simultaneous speech-to-speech/text translation for multiple source and target languages. To understand the performance of these models, we combined novel and modified versions of existing automatic metrics to evaluate prosody, latency, and robustness. For human evaluations, we adapted existing protocols tailored for measuring the most relevant attributes in the preservation of meaning, naturalness, and expressivity. To ensure that our models can be used safely and responsibly, we implemented the first known red-teaming effort for multimodal machine translation, a system for the detection and mitigation of added toxicity, a systematic evaluation of gender bias, and an inaudible localized watermarking mechanism designed to dampen the impact of deepfakes. Consequently, we bring major components from SeamlessExpressive and SeamlessStreaming together to form Seamless, the first publicly available system that unlocks expressive cross-lingual communication in real-time. In sum, Seamless gives us a pivotal look at the technical foundation needed to turn the Universal Speech Translator from a science fiction concept into a real-world technology. Finally, contributions in this workโincluding models, code, and a watermark detectorโare publicly released and accessible at the link below.*
+
+This model was contributed by [ylacombe](https://huggingface.co/ylacombe). The original code can be found [here](https://github.com/facebookresearch/seamless_communication).
+
+## Usage tips
+
+- Wav2Vec2-BERT follows the same architecture as Wav2Vec2-Conformer, but employs a causal depthwise convolutional layer and uses as input a mel-spectrogram representation of the audio instead of the raw waveform.
+- Wav2Vec2-BERT can use either no relative position embeddings, Shaw-like position embeddings, Transformer-XL-like position embeddings, or
+ rotary position embeddings by setting the correct `config.position_embeddings_type`.
+- Wav2Vec2-BERT also introduces a Conformer-based adapter network instead of a simple convolutional network.
+
+## Resources
+
+
+
+- [`Wav2Vec2BertForCTC`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/speech-recognition).
+- You can also adapt these notebooks on [how to finetune a speech recognition model in English](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/speech_recognition.ipynb), and [how to finetune a speech recognition model in any language](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multi_lingual_speech_recognition.ipynb).
+
+
+
+- [`Wav2Vec2BertForSequenceClassification`] can be used by adapting this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification).
+- See also: [Audio classification task guide](../tasks/audio_classification)
+
+
+## Wav2Vec2BertConfig
+
+[[autodoc]] Wav2Vec2BertConfig
+
+## Wav2Vec2BertProcessor
+
+[[autodoc]] Wav2Vec2BertProcessor
+ - __call__
+ - pad
+ - from_pretrained
+ - save_pretrained
+ - batch_decode
+ - decode
+
+## Wav2Vec2BertModel
+
+[[autodoc]] Wav2Vec2BertModel
+ - forward
+
+## Wav2Vec2BertForCTC
+
+[[autodoc]] Wav2Vec2BertForCTC
+ - forward
+
+## Wav2Vec2BertForSequenceClassification
+
+[[autodoc]] Wav2Vec2BertForSequenceClassification
+ - forward
+
+## Wav2Vec2BertForAudioFrameClassification
+
+[[autodoc]] Wav2Vec2BertForAudioFrameClassification
+ - forward
+
+## Wav2Vec2BertForXVector
+
+[[autodoc]] Wav2Vec2BertForXVector
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2-conformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2-conformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..0b30cf5fa43145193f5c83f9d7342b8cc0c9e2cb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2-conformer.md
@@ -0,0 +1,83 @@
+
+
+# Wav2Vec2-Conformer
+
+## Overview
+
+The Wav2Vec2-Conformer was added to an updated version of [fairseq S2T: Fast Speech-to-Text Modeling with fairseq](https://arxiv.org/abs/2010.05171) by Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Sravya Popuri, Dmytro Okhonko, Juan Pino.
+
+The official results of the model can be found in Table 3 and Table 4 of the paper.
+
+The Wav2Vec2-Conformer weights were released by the Meta AI team within the [Fairseq library](https://github.com/pytorch/fairseq/blob/main/examples/wav2vec/README.md#pre-trained-models).
+
+This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten).
+The original code can be found [here](https://github.com/pytorch/fairseq/tree/main/examples/wav2vec).
+
+Note: Meta (FAIR) released a new version of [Wav2Vec2-BERT 2.0](https://huggingface.co/docs/transformers/en/model_doc/wav2vec2-bert) - it's pretrained on 4.5M hours of audio. We especially recommend using it for fine-tuning tasks, e.g. as per [this guide](https://huggingface.co/blog/fine-tune-w2v2-bert).
+
+## Usage tips
+
+- Wav2Vec2-Conformer follows the same architecture as Wav2Vec2, but replaces the *Attention*-block with a *Conformer*-block
+ as introduced in [Conformer: Convolution-augmented Transformer for Speech Recognition](https://arxiv.org/abs/2005.08100).
+- For the same number of layers, Wav2Vec2-Conformer requires more parameters than Wav2Vec2, but also yields
+an improved word error rate.
+- Wav2Vec2-Conformer uses the same tokenizer and feature extractor as Wav2Vec2.
+- Wav2Vec2-Conformer can use either no relative position embeddings, Transformer-XL-like position embeddings, or
+ rotary position embeddings by setting the correct `config.position_embeddings_type`.
+
+## Resources
+
+- [Audio classification task guide](../tasks/audio_classification)
+- [Automatic speech recognition task guide](../tasks/asr)
+
+## Wav2Vec2ConformerConfig
+
+[[autodoc]] Wav2Vec2ConformerConfig
+
+## Wav2Vec2Conformer specific outputs
+
+[[autodoc]] models.wav2vec2_conformer.modeling_wav2vec2_conformer.Wav2Vec2ConformerForPreTrainingOutput
+
+## Wav2Vec2ConformerModel
+
+[[autodoc]] Wav2Vec2ConformerModel
+ - forward
+
+## Wav2Vec2ConformerForCTC
+
+[[autodoc]] Wav2Vec2ConformerForCTC
+ - forward
+
+## Wav2Vec2ConformerForSequenceClassification
+
+[[autodoc]] Wav2Vec2ConformerForSequenceClassification
+ - forward
+
+## Wav2Vec2ConformerForAudioFrameClassification
+
+[[autodoc]] Wav2Vec2ConformerForAudioFrameClassification
+ - forward
+
+## Wav2Vec2ConformerForXVector
+
+[[autodoc]] Wav2Vec2ConformerForXVector
+ - forward
+
+## Wav2Vec2ConformerForPreTraining
+
+[[autodoc]] Wav2Vec2ConformerForPreTraining
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2.md
new file mode 100644
index 0000000000000000000000000000000000000000..5ef3fdbb1eaa6611aa5524b764bc4773a3fefec6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2.md
@@ -0,0 +1,279 @@
+
+
+# Wav2Vec2
+
+## Overview
+
+The Wav2Vec2 model was proposed in [wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations](https://arxiv.org/abs/2006.11477) by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli.
+
+The abstract from the paper is the following:
+
+*We show for the first time that learning powerful representations from speech audio alone followed by fine-tuning on
+transcribed speech can outperform the best semi-supervised methods while being conceptually simpler. wav2vec 2.0 masks
+the speech input in the latent space and solves a contrastive task defined over a quantization of the latent
+representations which are jointly learned. Experiments using all labeled data of Librispeech achieve 1.8/3.3 WER on the
+clean/other test sets. When lowering the amount of labeled data to one hour, wav2vec 2.0 outperforms the previous state
+of the art on the 100 hour subset while using 100 times less labeled data. Using just ten minutes of labeled data and
+pre-training on 53k hours of unlabeled data still achieves 4.8/8.2 WER. This demonstrates the feasibility of speech
+recognition with limited amounts of labeled data.*
+
+This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten).
+
+Note: Meta (FAIR) released a new version of [Wav2Vec2-BERT 2.0](https://huggingface.co/docs/transformers/en/model_doc/wav2vec2-bert) - it's pretrained on 4.5M hours of audio. We especially recommend using it for fine-tuning tasks, e.g. as per [this guide](https://huggingface.co/blog/fine-tune-w2v2-bert).
+
+## Usage tips
+
+- Wav2Vec2 is a speech model that accepts a float array corresponding to the raw waveform of the speech signal.
+- Wav2Vec2 model was trained using connectionist temporal classification (CTC) so the model output has to be decoded
+ using [`Wav2Vec2CTCTokenizer`].
+
+## Using Flash Attention 2
+
+Flash Attention 2 is an faster, optimized version of the model.
+
+### Installation
+
+First, check whether your hardware is compatible with Flash Attention 2. The latest list of compatible hardware can be found in the [official documentation](https://github.com/Dao-AILab/flash-attention#installation-and-features). If your hardware is not compatible with Flash Attention 2, you can still benefit from attention kernel optimisations through Better Transformer support covered [above](https://huggingface.co/docs/transformers/main/en/model_doc/bark#using-better-transformer).
+
+Next, [install](https://github.com/Dao-AILab/flash-attention#installation-and-features) the latest version of Flash Attention 2:
+
+```bash
+pip install -U flash-attn --no-build-isolation
+```
+
+### Usage
+
+To load a model using Flash Attention 2, we can pass the argument `attn_implementation="flash_attention_2"` to [`.from_pretrained`](https://huggingface.co/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained). We'll also load the model in half-precision (e.g. `torch.float16`), since it results in almost no degradation to audio quality but significantly lower memory usage and faster inference:
+
+```python
+>>> from transformers import Wav2Vec2Model
+
+model = Wav2Vec2Model.from_pretrained("facebook/wav2vec2-large-960h-lv60-self", torch_dtype=torch.float16, attn_implementation="flash_attention_2").to(device)
+...
+```
+
+### Expected speedups
+
+Below is an expected speedup diagram comparing the pure inference time between the native implementation in transformers of the `facebook/wav2vec2-large-960h-lv60-self` model and the flash-attention-2 and sdpa (scale-dot-product-attention) versions. . We show the average speedup obtained on the `librispeech_asr` `clean` validation split:
+
+
+
+
+
+
+
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with Wav2Vec2. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+
+
+- A notebook on how to [leverage a pretrained Wav2Vec2 model for emotion classification](https://colab.research.google.com/github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb). ๐
+- [`Wav2Vec2ForCTC`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb).
+- [Audio classification task guide](../tasks/audio_classification)
+
+
+
+- A blog post on [boosting Wav2Vec2 with n-grams in ๐ค Transformers](https://huggingface.co/blog/wav2vec2-with-ngram).
+- A blog post on how to [finetune Wav2Vec2 for English ASR with ๐ค Transformers](https://huggingface.co/blog/fine-tune-wav2vec2-english).
+- A blog post on [finetuning XLS-R for Multi-Lingual ASR with ๐ค Transformers](https://huggingface.co/blog/fine-tune-xlsr-wav2vec2).
+- A notebook on how to [create YouTube captions from any video by transcribing audio with Wav2Vec2](https://colab.research.google.com/github/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb). ๐
+- [`Wav2Vec2ForCTC`] is supported by a notebook on [how to finetune a speech recognition model in English](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/speech_recognition.ipynb), and [how to finetune a speech recognition model in any language](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multi_lingual_speech_recognition.ipynb).
+- [Automatic speech recognition task guide](../tasks/asr)
+
+๐ Deploy
+
+- A blog post on how to deploy Wav2Vec2 for [Automatic Speech Recognition with Hugging Face's Transformers & Amazon SageMaker](https://www.philschmid.de/automatic-speech-recognition-sagemaker).
+
+## Wav2Vec2Config
+
+[[autodoc]] Wav2Vec2Config
+
+## Wav2Vec2CTCTokenizer
+
+[[autodoc]] Wav2Vec2CTCTokenizer
+ - __call__
+ - save_vocabulary
+ - decode
+ - batch_decode
+ - set_target_lang
+
+## Wav2Vec2FeatureExtractor
+
+[[autodoc]] Wav2Vec2FeatureExtractor
+ - __call__
+
+## Wav2Vec2Processor
+
+[[autodoc]] Wav2Vec2Processor
+ - __call__
+ - pad
+ - from_pretrained
+ - save_pretrained
+ - batch_decode
+ - decode
+
+## Wav2Vec2ProcessorWithLM
+
+[[autodoc]] Wav2Vec2ProcessorWithLM
+ - __call__
+ - pad
+ - from_pretrained
+ - save_pretrained
+ - batch_decode
+ - decode
+
+### Decoding multiple audios
+
+If you are planning to decode multiple batches of audios, you should consider using [`~Wav2Vec2ProcessorWithLM.batch_decode`] and passing an instantiated `multiprocessing.Pool`.
+Otherwise, [`~Wav2Vec2ProcessorWithLM.batch_decode`] performance will be slower than calling [`~Wav2Vec2ProcessorWithLM.decode`] for each audio individually, as it internally instantiates a new `Pool` for every call. See the example below:
+
+```python
+>>> # Let's see how to use a user-managed pool for batch decoding multiple audios
+>>> from multiprocessing import get_context
+>>> from transformers import AutoTokenizer, AutoProcessor, AutoModelForCTC
+>>> from datasets import load_dataset
+>>> import datasets
+>>> import torch
+
+>>> # import model, feature extractor, tokenizer
+>>> model = AutoModelForCTC.from_pretrained("patrickvonplaten/wav2vec2-base-100h-with-lm").to("cuda")
+>>> processor = AutoProcessor.from_pretrained("patrickvonplaten/wav2vec2-base-100h-with-lm")
+
+>>> # load example dataset
+>>> dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
+>>> dataset = dataset.cast_column("audio", datasets.Audio(sampling_rate=16_000))
+
+
+>>> def map_to_array(batch):
+... batch["speech"] = batch["audio"]["array"]
+... return batch
+
+
+>>> # prepare speech data for batch inference
+>>> dataset = dataset.map(map_to_array, remove_columns=["audio"])
+
+
+>>> def map_to_pred(batch, pool):
+... inputs = processor(batch["speech"], sampling_rate=16_000, padding=True, return_tensors="pt")
+... inputs = {k: v.to("cuda") for k, v in inputs.items()}
+
+... with torch.no_grad():
+... logits = model(**inputs).logits
+
+... transcription = processor.batch_decode(logits.cpu().numpy(), pool).text
+... batch["transcription"] = transcription
+... return batch
+
+
+>>> # note: pool should be instantiated *after* `Wav2Vec2ProcessorWithLM`.
+>>> # otherwise, the LM won't be available to the pool's sub-processes
+>>> # select number of processes and batch_size based on number of CPU cores available and on dataset size
+>>> with get_context("fork").Pool(processes=2) as pool:
+... result = dataset.map(
+... map_to_pred, batched=True, batch_size=2, fn_kwargs={"pool": pool}, remove_columns=["speech"]
+... )
+
+>>> result["transcription"][:2]
+['MISTER QUILTER IS THE APOSTLE OF THE MIDDLE CLASSES AND WE ARE GLAD TO WELCOME HIS GOSPEL', "NOR IS MISTER COULTER'S MANNER LESS INTERESTING THAN HIS MATTER"]
+```
+
+## Wav2Vec2 specific outputs
+
+[[autodoc]] models.wav2vec2_with_lm.processing_wav2vec2_with_lm.Wav2Vec2DecoderWithLMOutput
+
+[[autodoc]] models.wav2vec2.modeling_wav2vec2.Wav2Vec2BaseModelOutput
+
+[[autodoc]] models.wav2vec2.modeling_wav2vec2.Wav2Vec2ForPreTrainingOutput
+
+[[autodoc]] models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2BaseModelOutput
+
+[[autodoc]] models.wav2vec2.modeling_flax_wav2vec2.FlaxWav2Vec2ForPreTrainingOutput
+
+
+
+
+## Wav2Vec2Model
+
+[[autodoc]] Wav2Vec2Model
+ - forward
+
+## Wav2Vec2ForCTC
+
+[[autodoc]] Wav2Vec2ForCTC
+ - forward
+ - load_adapter
+
+## Wav2Vec2ForSequenceClassification
+
+[[autodoc]] Wav2Vec2ForSequenceClassification
+ - forward
+
+## Wav2Vec2ForAudioFrameClassification
+
+[[autodoc]] Wav2Vec2ForAudioFrameClassification
+ - forward
+
+## Wav2Vec2ForXVector
+
+[[autodoc]] Wav2Vec2ForXVector
+ - forward
+
+## Wav2Vec2ForPreTraining
+
+[[autodoc]] Wav2Vec2ForPreTraining
+ - forward
+
+
+
+
+## TFWav2Vec2Model
+
+[[autodoc]] TFWav2Vec2Model
+ - call
+
+## TFWav2Vec2ForSequenceClassification
+
+[[autodoc]] TFWav2Vec2ForSequenceClassification
+ - call
+
+## TFWav2Vec2ForCTC
+
+[[autodoc]] TFWav2Vec2ForCTC
+ - call
+
+
+
+
+## FlaxWav2Vec2Model
+
+[[autodoc]] FlaxWav2Vec2Model
+ - __call__
+
+## FlaxWav2Vec2ForCTC
+
+[[autodoc]] FlaxWav2Vec2ForCTC
+ - __call__
+
+## FlaxWav2Vec2ForPreTraining
+
+[[autodoc]] FlaxWav2Vec2ForPreTraining
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2_phoneme.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2_phoneme.md
new file mode 100644
index 0000000000000000000000000000000000000000..93e0656f493c0fa3fcbc9b18cb1d82fced13da5d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wav2vec2_phoneme.md
@@ -0,0 +1,65 @@
+
+
+# Wav2Vec2Phoneme
+
+## Overview
+
+The Wav2Vec2Phoneme model was proposed in [Simple and Effective Zero-shot Cross-lingual Phoneme Recognition (Xu et al.,
+2021](https://arxiv.org/abs/2109.11680) by Qiantong Xu, Alexei Baevski, Michael Auli.
+
+The abstract from the paper is the following:
+
+*Recent progress in self-training, self-supervised pretraining and unsupervised learning enabled well performing speech
+recognition systems without any labeled data. However, in many cases there is labeled data available for related
+languages which is not utilized by these methods. This paper extends previous work on zero-shot cross-lingual transfer
+learning by fine-tuning a multilingually pretrained wav2vec 2.0 model to transcribe unseen languages. This is done by
+mapping phonemes of the training languages to the target language using articulatory features. Experiments show that
+this simple method significantly outperforms prior work which introduced task-specific architectures and used only part
+of a monolingually pretrained model.*
+
+Relevant checkpoints can be found under https://huggingface.co/models?other=phoneme-recognition.
+
+This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten)
+
+The original code can be found [here](https://github.com/pytorch/fairseq/tree/master/fairseq/models/wav2vec).
+
+## Usage tips
+
+- Wav2Vec2Phoneme uses the exact same architecture as Wav2Vec2
+- Wav2Vec2Phoneme is a speech model that accepts a float array corresponding to the raw waveform of the speech signal.
+- Wav2Vec2Phoneme model was trained using connectionist temporal classification (CTC) so the model output has to be
+ decoded using [`Wav2Vec2PhonemeCTCTokenizer`].
+- Wav2Vec2Phoneme can be fine-tuned on multiple language at once and decode unseen languages in a single forward pass
+ to a sequence of phonemes
+- By default, the model outputs a sequence of phonemes. In order to transform the phonemes to a sequence of words one
+ should make use of a dictionary and language model.
+
+
+
+
+Wav2Vec2Phoneme's architecture is based on the Wav2Vec2 model, for API reference, check out [`Wav2Vec2`](wav2vec2)'s documentation page
+except for the tokenizer.
+
+
+
+## Wav2Vec2PhonemeCTCTokenizer
+
+[[autodoc]] Wav2Vec2PhonemeCTCTokenizer
+ - __call__
+ - batch_decode
+ - decode
+ - phonemize
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wavlm.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wavlm.md
new file mode 100644
index 0000000000000000000000000000000000000000..a42fbff139588c47a5e612ee70edd04470e74955
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/wavlm.md
@@ -0,0 +1,83 @@
+
+
+# WavLM
+
+## Overview
+
+The WavLM model was proposed in [WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing](https://arxiv.org/abs/2110.13900) by Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen,
+Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, Jian Wu, Long Zhou, Shuo Ren, Yanmin Qian, Yao Qian, Jian Wu,
+Michael Zeng, Furu Wei.
+
+The abstract from the paper is the following:
+
+*Self-supervised learning (SSL) achieves great success in speech recognition, while limited exploration has been
+attempted for other speech processing tasks. As speech signal contains multi-faceted information including speaker
+identity, paralinguistics, spoken content, etc., learning universal representations for all speech tasks is
+challenging. In this paper, we propose a new pre-trained model, WavLM, to solve full-stack downstream speech tasks.
+WavLM is built based on the HuBERT framework, with an emphasis on both spoken content modeling and speaker identity
+preservation. We first equip the Transformer structure with gated relative position bias to improve its capability on
+recognition tasks. For better speaker discrimination, we propose an utterance mixing training strategy, where
+additional overlapped utterances are created unsupervisedly and incorporated during model training. Lastly, we scale up
+the training dataset from 60k hours to 94k hours. WavLM Large achieves state-of-the-art performance on the SUPERB
+benchmark, and brings significant improvements for various speech processing tasks on their representative benchmarks.*
+
+Relevant checkpoints can be found under https://huggingface.co/models?other=wavlm.
+
+This model was contributed by [patrickvonplaten](https://huggingface.co/patrickvonplaten). The Authors' code can be
+found [here](https://github.com/microsoft/unilm/tree/master/wavlm).
+
+## Usage tips
+
+- WavLM is a speech model that accepts a float array corresponding to the raw waveform of the speech signal. Please use
+ [`Wav2Vec2Processor`] for the feature extraction.
+- WavLM model can be fine-tuned using connectionist temporal classification (CTC) so the model output has to be decoded
+ using [`Wav2Vec2CTCTokenizer`].
+- WavLM performs especially well on speaker verification, speaker identification, and speaker diarization tasks.
+
+## Resources
+
+- [Audio classification task guide](../tasks/audio_classification)
+- [Automatic speech recognition task guide](../tasks/asr)
+
+## WavLMConfig
+
+[[autodoc]] WavLMConfig
+
+## WavLMModel
+
+[[autodoc]] WavLMModel
+ - forward
+
+## WavLMForCTC
+
+[[autodoc]] WavLMForCTC
+ - forward
+
+## WavLMForSequenceClassification
+
+[[autodoc]] WavLMForSequenceClassification
+ - forward
+
+## WavLMForAudioFrameClassification
+
+[[autodoc]] WavLMForAudioFrameClassification
+ - forward
+
+## WavLMForXVector
+
+[[autodoc]] WavLMForXVector
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/whisper.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/whisper.md
new file mode 100644
index 0000000000000000000000000000000000000000..58e641a5d0e03dea86cb0ecf68c1ed1ff946a435
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/whisper.md
@@ -0,0 +1,257 @@
+
+
+# Whisper
+
+## Overview
+
+The Whisper model was proposed in [Robust Speech Recognition via Large-Scale Weak Supervision](https://cdn.openai.com/papers/whisper.pdf) by Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, Ilya Sutskever.
+
+The abstract from the paper is the following:
+
+*We study the capabilities of speech processing systems trained simply to predict large amounts of transcripts of audio on the internet. When scaled to 680,000 hours of multilingual and multitask supervision, the resulting models generalize well to standard benchmarks and are often competitive with prior fully supervised results but in a zeroshot transfer setting without the need for any finetuning. When compared to humans, the models approach their accuracy and robustness. We are releasing models and inference code to serve as a foundation for further work on robust speech processing.*
+
+This model was contributed by [Arthur Zucker](https://huggingface.co/ArthurZ). The Tensorflow version of this model was contributed by [amyeroberts](https://huggingface.co/amyeroberts).
+The original code can be found [here](https://github.com/openai/whisper).
+
+## Quick usage
+
+You can run Whisper in less than 4 lines of code and transcribe in less than a minute!
+
+```python
+# pip install transformers torch
+
+import torch
+from transformers import pipeline
+
+whisper = pipeline("automatic-speech-recognition", "openai/whisper-large-v3", torch_dtype=torch.float16, device="cuda:0")
+
+transcription = whisper("")
+
+print(transcription["text"])
+```
+
+Voila! You can swap the model with any [Whisper checkpoints](https://huggingface.co/models?other=whisper&sort=downloads) on the Hugging Face Hub with the same pipeline based on your needs.
+
+Bonus: You can replace `"cuda"` with `"mps"` to make it seamlessly work on Macs.
+
+## Usage tips
+
+- The model usually performs well without requiring any finetuning.
+- The architecture follows a classic encoder-decoder architecture, which means that it relies on the [`~generation.GenerationMixin.generate`] function for inference.
+- One can use [`WhisperProcessor`] to prepare audio for the model, and decode the predicted ID's back into text.
+
+- To convert the model and the processor, we recommend using the following:
+
+```bash
+python src/transformers/models/whisper/convert_openai_to_hf.py --checkpoint_path "" --pytorch_dump_folder_path "Arthur/whisper-3" --convert_preprocessor True
+```
+The script will automatically determine all necessary parameters from the OpenAI checkpoint. A `tiktoken` library needs to be installed
+to perform the conversion of the OpenAI tokenizer to the `tokenizers` version.
+
+## Inference
+
+Here is a step-by-step guide to transcribing an audio sample using a pre-trained Whisper model:
+
+```python
+>>> from datasets import load_dataset
+>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration
+
+>>> # Select an audio file and read it:
+>>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
+>>> audio_sample = ds[0]["audio"]
+
+>>> # Load the Whisper model in Hugging Face format:
+>>> processor = WhisperProcessor.from_pretrained("openai/whisper-tiny.en")
+>>> model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny.en")
+
+>>> # Use the model and processor to transcribe the audio:
+>>> input_features = processor(
+... audio_sample["array"], sampling_rate=audio_sample["sampling_rate"], return_tensors="pt"
+... ).input_features
+
+>>> # Generate token ids
+>>> predicted_ids = model.generate(input_features)
+
+>>> # Decode token ids to text
+>>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
+
+>>> transcription[0]
+' Mr. Quilter is the apostle of the middle classes, and we are glad to welcome his gospel.'
+```
+
+Whisper is compatible with the following optimisations for both short and long-form generation:
+- [PyTorch Scaled Dot Product Attention (SDPA)](../perf_infer_gpu_one#pytorch-scaled-dot-product-attention): flash attention and memory-efficient attention kernels. Enabled by default for `torch>=2.1.1`.
+- [Flash Attention 2](../perf_infer_gpu_one#flashattention-2): improved implementation of flash attention through better parallelism and work partitioning.
+- [torch.compile](../llm_optims#static-kv-cache-and-torchcompile): JIT-compile the forward pass to dispatch to efficient fused kernels.
+
+As an example, the following codesnippet enables SDPA and `torch.compile` for up to 5x faster inference:
+
+```python
+>>> from datasets import load_dataset
+>>> from transformers import WhisperProcessor, WhisperForConditionalGeneration
+
+>>> # Select an audio file and read it:
+>>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
+>>> audio_sample = ds[0]["audio"]
+
+>>> # Load the Whisper model with SDPA attention
+>>> processor = WhisperProcessor.from_pretrained("openai/whisper-tiny.en")
+>>> model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-tiny.en", attn_implementation="sdpa")
+
+>>> # Enable static cache and compile the forward pass
+>>> model.generation_config.cache_implementation = "static"
+>>> model.forward = torch.compile(model.forward, mode="reduce-overhead", fullgraph=True)
+
+>>> # Use the model and processor to transcribe the audio:
+>>> input_features = processor(
+... audio_sample["array"], sampling_rate=audio_sample["sampling_rate"], return_tensors="pt"
+... ).input_features
+
+>>> # Compile the forward pass
+>>> for _ in range(2):
+>>> model.generate(input_features)
+
+>>> # Generate token ids using compiled graph (fast!)
+>>> predicted_ids = model.generate(input_features)
+
+>>> # Decode token ids to text
+>>> transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)
+
+>>> transcription[0]
+' Mr. Quilter is the apostle of the middle classes, and we are glad to welcome his gospel.'
+```
+
+For more details on each optimisation, refer to the documentation linked above.
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with Whisper. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+- [Fine-tune Whisper](https://huggingface.co/blog/fine-tune-whisper) on your own dataset for better downstream performance.
+- [Distil-Whisper](https://huggingface.co/distil-whisper): Upto 6x faster, 2x smaller distilled Whisper models for English. We release the [model checkpoints](https://huggingface.co/distil-whisper), and [distillation code](https://github.com/huggingface/distil-whisper).
+- A fork with a script to [convert a Whisper model in Hugging Face format to OpenAI format](https://github.com/zuazo-forks/transformers/blob/convert_hf_to_openai/src/transformers/models/whisper/convert_hf_to_openai.py). ๐
+Usage example:
+```bash
+pip install -U openai-whisper
+python convert_hf_to_openai.py \
+ --checkpoint openai/whisper-tiny \
+ --whisper_dump_path whisper-tiny-openai.pt
+```
+
+## WhisperConfig
+
+[[autodoc]] WhisperConfig
+
+## WhisperTokenizer
+
+[[autodoc]] WhisperTokenizer
+ - set_prefix_tokens
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+ - batch_decode
+ - decode
+ - basic_normalize
+ - normalize
+
+## WhisperTokenizerFast
+
+[[autodoc]] WhisperTokenizerFast
+ - set_prefix_tokens
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+ - batch_decode
+ - decode
+ - basic_normalize
+ - normalize
+
+## WhisperFeatureExtractor
+
+[[autodoc]] WhisperFeatureExtractor
+ - __call__
+
+## WhisperProcessor
+
+[[autodoc]] WhisperProcessor
+ - __call__
+ - from_pretrained
+ - save_pretrained
+ - batch_decode
+ - decode
+
+
+
+
+## WhisperModel
+
+[[autodoc]] WhisperModel
+ - forward
+ - _mask_input_features
+
+## WhisperForConditionalGeneration
+
+[[autodoc]] WhisperForConditionalGeneration
+ - forward
+ - generate
+
+## WhisperForCausalLM
+
+[[autodoc]] WhisperForCausalLM
+ - forward
+
+## WhisperForAudioClassification
+
+[[autodoc]] WhisperForAudioClassification
+ - forward
+
+
+
+
+## TFWhisperModel
+
+[[autodoc]] TFWhisperModel
+ - call
+
+## TFWhisperForConditionalGeneration
+
+[[autodoc]] TFWhisperForConditionalGeneration
+ - call
+
+
+
+
+## FlaxWhisperModel
+
+[[autodoc]] FlaxWhisperModel
+ - __call__
+
+## FlaxWhisperForConditionalGeneration
+
+[[autodoc]] FlaxWhisperForConditionalGeneration
+ - __call__
+
+## FlaxWhisperForAudioClassification
+
+[[autodoc]] FlaxWhisperForAudioClassification
+ - __call__
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xclip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xclip.md
new file mode 100644
index 0000000000000000000000000000000000000000..8c22747387c0844e23ce52ebb7ba8fc21aac3a4d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xclip.md
@@ -0,0 +1,80 @@
+
+
+# X-CLIP
+
+## Overview
+
+The X-CLIP model was proposed in [Expanding Language-Image Pretrained Models for General Video Recognition](https://arxiv.org/abs/2208.02816) by Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling.
+X-CLIP is a minimal extension of [CLIP](clip) for video. The model consists of a text encoder, a cross-frame vision encoder, a multi-frame integration Transformer, and a video-specific prompt generator.
+
+The abstract from the paper is the following:
+
+*Contrastive language-image pretraining has shown great success in learning visual-textual joint representation from web-scale data, demonstrating remarkable "zero-shot" generalization ability for various image tasks. However, how to effectively expand such new language-image pretraining methods to video domains is still an open problem. In this work, we present a simple yet effective approach that adapts the pretrained language-image models to video recognition directly, instead of pretraining a new model from scratch. More concretely, to capture the long-range dependencies of frames along the temporal dimension, we propose a cross-frame attention mechanism that explicitly exchanges information across frames. Such module is lightweight and can be plugged into pretrained language-image models seamlessly. Moreover, we propose a video-specific prompting scheme, which leverages video content information for generating discriminative textual prompts. Extensive experiments demonstrate that our approach is effective and can be generalized to different video recognition scenarios. In particular, under fully-supervised settings, our approach achieves a top-1 accuracy of 87.1% on Kinectics-400, while using 12 times fewer FLOPs compared with Swin-L and ViViT-H. In zero-shot experiments, our approach surpasses the current state-of-the-art methods by +7.6% and +14.9% in terms of top-1 accuracy under two popular protocols. In few-shot scenarios, our approach outperforms previous best methods by +32.1% and +23.1% when the labeled data is extremely limited.*
+
+Tips:
+
+- Usage of X-CLIP is identical to [CLIP](clip).
+
+
+
+ X-CLIP architecture. Taken from the original paper.
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr).
+The original code can be found [here](https://github.com/microsoft/VideoX/tree/master/X-CLIP).
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with X-CLIP.
+
+- Demo notebooks for X-CLIP can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/X-CLIP).
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+## XCLIPProcessor
+
+[[autodoc]] XCLIPProcessor
+
+## XCLIPConfig
+
+[[autodoc]] XCLIPConfig
+ - from_text_vision_configs
+
+## XCLIPTextConfig
+
+[[autodoc]] XCLIPTextConfig
+
+## XCLIPVisionConfig
+
+[[autodoc]] XCLIPVisionConfig
+
+## XCLIPModel
+
+[[autodoc]] XCLIPModel
+ - forward
+ - get_text_features
+ - get_video_features
+
+## XCLIPTextModel
+
+[[autodoc]] XCLIPTextModel
+ - forward
+
+## XCLIPVisionModel
+
+[[autodoc]] XCLIPVisionModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xglm.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xglm.md
new file mode 100644
index 0000000000000000000000000000000000000000..470e42c747bec6b86404a12c568c37deee68b048
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xglm.md
@@ -0,0 +1,105 @@
+
+
+# XGLM
+
+## Overview
+
+The XGLM model was proposed in [Few-shot Learning with Multilingual Language Models](https://arxiv.org/abs/2112.10668)
+by Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal,
+Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O'Horo,
+Jeff Wang, Luke Zettlemoyer, Zornitsa Kozareva, Mona Diab, Veselin Stoyanov, Xian Li.
+
+The abstract from the paper is the following:
+
+*Large-scale autoregressive language models such as GPT-3 are few-shot learners that can perform a wide range of language
+tasks without fine-tuning. While these models are known to be able to jointly represent many different languages,
+their training data is dominated by English, potentially limiting their cross-lingual generalization.
+In this work, we train multilingual autoregressive language models on a balanced corpus covering a diverse set of languages,
+and study their few- and zero-shot learning capabilities in a wide range of tasks. Our largest model with 7.5 billion parameters
+sets new state of the art in few-shot learning in more than 20 representative languages, outperforming GPT-3 of comparable size
+in multilingual commonsense reasoning (with +7.4% absolute accuracy improvement in 0-shot settings and +9.4% in 4-shot settings)
+and natural language inference (+5.4% in each of 0-shot and 4-shot settings). On the FLORES-101 machine translation benchmark,
+our model outperforms GPT-3 on 171 out of 182 translation directions with 32 training examples, while surpassing the
+official supervised baseline in 45 directions. We present a detailed analysis of where the model succeeds and fails,
+showing in particular that it enables cross-lingual in-context learning on some tasks, while there is still room for improvement
+on surface form robustness and adaptation to tasks that do not have a natural cloze form. Finally, we evaluate our models
+in social value tasks such as hate speech detection in five languages and find it has limitations similar to comparable sized GPT-3 models.*
+
+
+This model was contributed by [Suraj](https://huggingface.co/valhalla). The original code can be found [here](https://github.com/pytorch/fairseq/tree/main/examples/xglm).
+
+## Resources
+
+- [Causal language modeling task guide](../tasks/language_modeling)
+
+## XGLMConfig
+
+[[autodoc]] XGLMConfig
+
+## XGLMTokenizer
+
+[[autodoc]] XGLMTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## XGLMTokenizerFast
+
+[[autodoc]] XGLMTokenizerFast
+
+
+
+
+## XGLMModel
+
+[[autodoc]] XGLMModel
+ - forward
+
+## XGLMForCausalLM
+
+[[autodoc]] XGLMForCausalLM
+ - forward
+
+
+
+
+## TFXGLMModel
+
+[[autodoc]] TFXGLMModel
+ - call
+
+## TFXGLMForCausalLM
+
+[[autodoc]] TFXGLMForCausalLM
+ - call
+
+
+
+
+## FlaxXGLMModel
+
+[[autodoc]] FlaxXGLMModel
+ - __call__
+
+## FlaxXGLMForCausalLM
+
+[[autodoc]] FlaxXGLMForCausalLM
+ - __call__
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-prophetnet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-prophetnet.md
new file mode 100644
index 0000000000000000000000000000000000000000..b350cb554b033014ce12fc325859b453c445a3ab
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-prophetnet.md
@@ -0,0 +1,95 @@
+
+
+# XLM-ProphetNet
+
+
+
+This model is in maintenance mode only, we don't accept any new PRs changing its code.
+If you run into any issues running this model, please reinstall the last version that supported this model: v4.40.2.
+You can do so by running the following command: `pip install -U transformers==4.40.2`.
+
+
+
+
+
+**DISCLAIMER:** If you see something strange, file a [Github Issue](https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title) and assign
+@patrickvonplaten
+
+
+## Overview
+
+The XLM-ProphetNet model was proposed in [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training,](https://arxiv.org/abs/2001.04063) by Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei
+Zhang, Ming Zhou on 13 Jan, 2020.
+
+XLM-ProphetNet is an encoder-decoder model and can predict n-future tokens for "ngram" language modeling instead of
+just the next token. Its architecture is identical to ProhpetNet, but the model was trained on the multi-lingual
+"wiki100" Wikipedia dump. XLM-ProphetNet's model architecture and pretraining objective is same as ProphetNet, but XLM-ProphetNet was pre-trained on the cross-lingual dataset XGLUE.
+
+The abstract from the paper is the following:
+
+*In this paper, we present a new sequence-to-sequence pretraining model called ProphetNet, which introduces a novel
+self-supervised objective named future n-gram prediction and the proposed n-stream self-attention mechanism. Instead of
+the optimization of one-step ahead prediction in traditional sequence-to-sequence model, the ProphetNet is optimized by
+n-step ahead prediction which predicts the next n tokens simultaneously based on previous context tokens at each time
+step. The future n-gram prediction explicitly encourages the model to plan for the future tokens and prevent
+overfitting on strong local correlations. We pre-train ProphetNet using a base scale dataset (16GB) and a large scale
+dataset (160GB) respectively. Then we conduct experiments on CNN/DailyMail, Gigaword, and SQuAD 1.1 benchmarks for
+abstractive summarization and question generation tasks. Experimental results show that ProphetNet achieves new
+state-of-the-art results on all these datasets compared to the models using the same scale pretraining corpus.*
+
+The Authors' code can be found [here](https://github.com/microsoft/ProphetNet).
+
+## Resources
+
+- [Causal language modeling task guide](../tasks/language_modeling)
+- [Translation task guide](../tasks/translation)
+- [Summarization task guide](../tasks/summarization)
+
+## XLMProphetNetConfig
+
+[[autodoc]] XLMProphetNetConfig
+
+## XLMProphetNetTokenizer
+
+[[autodoc]] XLMProphetNetTokenizer
+
+## XLMProphetNetModel
+
+[[autodoc]] XLMProphetNetModel
+
+## XLMProphetNetEncoder
+
+[[autodoc]] XLMProphetNetEncoder
+
+## XLMProphetNetDecoder
+
+[[autodoc]] XLMProphetNetDecoder
+
+## XLMProphetNetForConditionalGeneration
+
+[[autodoc]] XLMProphetNetForConditionalGeneration
+
+## XLMProphetNetForCausalLM
+
+[[autodoc]] XLMProphetNetForCausalLM
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-roberta-xl.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-roberta-xl.md
new file mode 100644
index 0000000000000000000000000000000000000000..f9cb78c0bf4e654686201b8010fbff17caa7adbb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-roberta-xl.md
@@ -0,0 +1,81 @@
+
+
+# XLM-RoBERTa-XL
+
+## Overview
+
+The XLM-RoBERTa-XL model was proposed in [Larger-Scale Transformers for Multilingual Masked Language Modeling](https://arxiv.org/abs/2105.00572) by Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau.
+
+The abstract from the paper is the following:
+
+*Recent work has demonstrated the effectiveness of cross-lingual language model pretraining for cross-lingual understanding. In this study, we present the results of two larger multilingual masked language models, with 3.5B and 10.7B parameters. Our two new models dubbed XLM-R XL and XLM-R XXL outperform XLM-R by 1.8% and 2.4% average accuracy on XNLI. Our model also outperforms the RoBERTa-Large model on several English tasks of the GLUE benchmark by 0.3% on average while handling 99 more languages. This suggests pretrained models with larger capacity may obtain both strong performance on high-resource languages while greatly improving low-resource languages. We make our code and models publicly available.*
+
+This model was contributed by [Soonhwan-Kwon](https://github.com/Soonhwan-Kwon) and [stefan-it](https://huggingface.co/stefan-it). The original code can be found [here](https://github.com/pytorch/fairseq/tree/master/examples/xlmr).
+
+## Usage tips
+
+XLM-RoBERTa-XL is a multilingual model trained on 100 different languages. Unlike some XLM multilingual models, it does
+not require `lang` tensors to understand which language is used, and should be able to determine the correct
+language from the input ids.
+
+## Resources
+
+- [Text classification task guide](../tasks/sequence_classification)
+- [Token classification task guide](../tasks/token_classification)
+- [Question answering task guide](../tasks/question_answering)
+- [Causal language modeling task guide](../tasks/language_modeling)
+- [Masked language modeling task guide](../tasks/masked_language_modeling)
+- [Multiple choice task guide](../tasks/multiple_choice)
+
+## XLMRobertaXLConfig
+
+[[autodoc]] XLMRobertaXLConfig
+
+## XLMRobertaXLModel
+
+[[autodoc]] XLMRobertaXLModel
+ - forward
+
+## XLMRobertaXLForCausalLM
+
+[[autodoc]] XLMRobertaXLForCausalLM
+ - forward
+
+## XLMRobertaXLForMaskedLM
+
+[[autodoc]] XLMRobertaXLForMaskedLM
+ - forward
+
+## XLMRobertaXLForSequenceClassification
+
+[[autodoc]] XLMRobertaXLForSequenceClassification
+ - forward
+
+## XLMRobertaXLForMultipleChoice
+
+[[autodoc]] XLMRobertaXLForMultipleChoice
+ - forward
+
+## XLMRobertaXLForTokenClassification
+
+[[autodoc]] XLMRobertaXLForTokenClassification
+ - forward
+
+## XLMRobertaXLForQuestionAnswering
+
+[[autodoc]] XLMRobertaXLForQuestionAnswering
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-roberta.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-roberta.md
new file mode 100644
index 0000000000000000000000000000000000000000..414afba11681b16c4eb739999235193ad3daa969
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-roberta.md
@@ -0,0 +1,247 @@
+
+
+# XLM-RoBERTa
+
+
+
+## Overview
+
+The XLM-RoBERTa model was proposed in [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116) by Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume
+Wenzek, Francisco Guzmรกn, Edouard Grave, Myle Ott, Luke Zettlemoyer and Veselin Stoyanov. It is based on Facebook's
+RoBERTa model released in 2019. It is a large multi-lingual language model, trained on 2.5TB of filtered CommonCrawl
+data.
+
+The abstract from the paper is the following:
+
+*This paper shows that pretraining multilingual language models at scale leads to significant performance gains for a
+wide range of cross-lingual transfer tasks. We train a Transformer-based masked language model on one hundred
+languages, using more than two terabytes of filtered CommonCrawl data. Our model, dubbed XLM-R, significantly
+outperforms multilingual BERT (mBERT) on a variety of cross-lingual benchmarks, including +13.8% average accuracy on
+XNLI, +12.3% average F1 score on MLQA, and +2.1% average F1 score on NER. XLM-R performs particularly well on
+low-resource languages, improving 11.8% in XNLI accuracy for Swahili and 9.2% for Urdu over the previous XLM model. We
+also present a detailed empirical evaluation of the key factors that are required to achieve these gains, including the
+trade-offs between (1) positive transfer and capacity dilution and (2) the performance of high and low resource
+languages at scale. Finally, we show, for the first time, the possibility of multilingual modeling without sacrificing
+per-language performance; XLM-R is very competitive with strong monolingual models on the GLUE and XNLI benchmarks. We
+will make XLM-R code, data, and models publicly available.*
+
+This model was contributed by [stefan-it](https://huggingface.co/stefan-it). The original code can be found [here](https://github.com/pytorch/fairseq/tree/master/examples/xlmr).
+
+## Usage tips
+
+- XLM-RoBERTa is a multilingual model trained on 100 different languages. Unlike some XLM multilingual models, it does
+ not require `lang` tensors to understand which language is used, and should be able to determine the correct
+ language from the input ids.
+- Uses RoBERTa tricks on the XLM approach, but does not use the translation language modeling objective. It only uses masked language modeling on sentences coming from one language.
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with XLM-RoBERTa. If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+
+
+- A blog post on how to [finetune XLM RoBERTa for multiclass classification with Habana Gaudi on AWS](https://www.philschmid.de/habana-distributed-training)
+- [`XLMRobertaForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb).
+- [`TFXLMRobertaForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb).
+- [`FlaxXLMRobertaForSequenceClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/text-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_flax.ipynb).
+- [Text classification](https://huggingface.co/docs/transformers/tasks/sequence_classification) chapter of the ๐ค Hugging Face Task Guides.
+- [Text classification task guide](../tasks/sequence_classification)
+
+
+
+- [`XLMRobertaForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb).
+- [`TFXLMRobertaForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/token-classification) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb).
+- [`FlaxXLMRobertaForTokenClassification`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/token-classification).
+- [Token classification](https://huggingface.co/course/chapter7/2?fw=pt) chapter of the ๐ค Hugging Face Course.
+- [Token classification task guide](../tasks/token_classification)
+
+
+
+- [`XLMRobertaForCausalLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb).
+- [Causal language modeling](https://huggingface.co/docs/transformers/tasks/language_modeling) chapter of the ๐ค Hugging Face Task Guides.
+- [Causal language modeling task guide](../tasks/language_modeling)
+
+
+
+- [`XLMRobertaForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#robertabertdistilbert-and-masked-language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb).
+- [`TFXLMRobertaForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_mlmpy) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb).
+- [`FlaxXLMRobertaForMaskedLM`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#masked-language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/masked_language_modeling_flax.ipynb).
+- [Masked language modeling](https://huggingface.co/course/chapter7/3?fw=pt) chapter of the ๐ค Hugging Face Course.
+- [Masked language modeling](../tasks/masked_language_modeling)
+
+
+
+- [`XLMRobertaForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb).
+- [`TFXLMRobertaForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/question-answering) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb).
+- [`FlaxXLMRobertaForQuestionAnswering`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/flax/question-answering).
+- [Question answering](https://huggingface.co/course/chapter7/7?fw=pt) chapter of the ๐ค Hugging Face Course.
+- [Question answering task guide](../tasks/question_answering)
+
+**Multiple choice**
+
+- [`XLMRobertaForMultipleChoice`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/multiple-choice) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb).
+- [`TFXLMRobertaForMultipleChoice`] is supported by this [example script](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/multiple-choice) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb).
+- [Multiple choice task guide](../tasks/multiple_choice)
+
+๐ Deploy
+
+- A blog post on how to [Deploy Serverless XLM RoBERTa on AWS Lambda](https://www.philschmid.de/multilingual-serverless-xlm-roberta-with-huggingface).
+
+
+
+This implementation is the same as RoBERTa. Refer to the [documentation of RoBERTa](roberta) for usage examples as well as the information relative to the inputs and outputs.
+
+
+## XLMRobertaConfig
+
+[[autodoc]] XLMRobertaConfig
+
+## XLMRobertaTokenizer
+
+[[autodoc]] XLMRobertaTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## XLMRobertaTokenizerFast
+
+[[autodoc]] XLMRobertaTokenizerFast
+
+
+
+
+## XLMRobertaModel
+
+[[autodoc]] XLMRobertaModel
+ - forward
+
+## XLMRobertaForCausalLM
+
+[[autodoc]] XLMRobertaForCausalLM
+ - forward
+
+## XLMRobertaForMaskedLM
+
+[[autodoc]] XLMRobertaForMaskedLM
+ - forward
+
+## XLMRobertaForSequenceClassification
+
+[[autodoc]] XLMRobertaForSequenceClassification
+ - forward
+
+## XLMRobertaForMultipleChoice
+
+[[autodoc]] XLMRobertaForMultipleChoice
+ - forward
+
+## XLMRobertaForTokenClassification
+
+[[autodoc]] XLMRobertaForTokenClassification
+ - forward
+
+## XLMRobertaForQuestionAnswering
+
+[[autodoc]] XLMRobertaForQuestionAnswering
+ - forward
+
+
+
+
+## TFXLMRobertaModel
+
+[[autodoc]] TFXLMRobertaModel
+ - call
+
+## TFXLMRobertaForCausalLM
+
+[[autodoc]] TFXLMRobertaForCausalLM
+ - call
+
+## TFXLMRobertaForMaskedLM
+
+[[autodoc]] TFXLMRobertaForMaskedLM
+ - call
+
+## TFXLMRobertaForSequenceClassification
+
+[[autodoc]] TFXLMRobertaForSequenceClassification
+ - call
+
+## TFXLMRobertaForMultipleChoice
+
+[[autodoc]] TFXLMRobertaForMultipleChoice
+ - call
+
+## TFXLMRobertaForTokenClassification
+
+[[autodoc]] TFXLMRobertaForTokenClassification
+ - call
+
+## TFXLMRobertaForQuestionAnswering
+
+[[autodoc]] TFXLMRobertaForQuestionAnswering
+ - call
+
+
+
+
+## FlaxXLMRobertaModel
+
+[[autodoc]] FlaxXLMRobertaModel
+ - __call__
+
+## FlaxXLMRobertaForCausalLM
+
+[[autodoc]] FlaxXLMRobertaForCausalLM
+ - __call__
+
+## FlaxXLMRobertaForMaskedLM
+
+[[autodoc]] FlaxXLMRobertaForMaskedLM
+ - __call__
+
+## FlaxXLMRobertaForSequenceClassification
+
+[[autodoc]] FlaxXLMRobertaForSequenceClassification
+ - __call__
+
+## FlaxXLMRobertaForMultipleChoice
+
+[[autodoc]] FlaxXLMRobertaForMultipleChoice
+ - __call__
+
+## FlaxXLMRobertaForTokenClassification
+
+[[autodoc]] FlaxXLMRobertaForTokenClassification
+ - __call__
+
+## FlaxXLMRobertaForQuestionAnswering
+
+[[autodoc]] FlaxXLMRobertaForQuestionAnswering
+ - __call__
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-v.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-v.md
new file mode 100644
index 0000000000000000000000000000000000000000..049a1f35ad9ab7166163505e3e1987031bf6ab16
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm-v.md
@@ -0,0 +1,52 @@
+
+
+# XLM-V
+
+## Overview
+
+XLM-V is multilingual language model with a one million token vocabulary trained on 2.5TB of data from Common Crawl (same as XLM-R).
+It was introduced in the [XLM-V: Overcoming the Vocabulary Bottleneck in Multilingual Masked Language Models](https://arxiv.org/abs/2301.10472)
+paper by Davis Liang, Hila Gonen, Yuning Mao, Rui Hou, Naman Goyal, Marjan Ghazvininejad, Luke Zettlemoyer and Madian Khabsa.
+
+From the abstract of the XLM-V paper:
+
+*Large multilingual language models typically rely on a single vocabulary shared across 100+ languages.
+As these models have increased in parameter count and depth, vocabulary size has remained largely unchanged.
+This vocabulary bottleneck limits the representational capabilities of multilingual models like XLM-R.
+In this paper, we introduce a new approach for scaling to very large multilingual vocabularies by
+de-emphasizing token sharing between languages with little lexical overlap and assigning vocabulary capacity
+to achieve sufficient coverage for each individual language. Tokenizations using our vocabulary are typically
+more semantically meaningful and shorter compared to XLM-R. Leveraging this improved vocabulary, we train XLM-V,
+a multilingual language model with a one million token vocabulary. XLM-V outperforms XLM-R on every task we
+tested on ranging from natural language inference (XNLI), question answering (MLQA, XQuAD, TyDiQA), and
+named entity recognition (WikiAnn) to low-resource tasks (Americas NLI, MasakhaNER).*
+
+This model was contributed by [stefan-it](https://huggingface.co/stefan-it), including detailed experiments with XLM-V on downstream tasks.
+The experiments repository can be found [here](https://github.com/stefan-it/xlm-v-experiments).
+
+## Usage tips
+
+- XLM-V is compatible with the XLM-RoBERTa model architecture, only model weights from [`fairseq`](https://github.com/facebookresearch/fairseq)
+ library had to be converted.
+- The `XLMTokenizer` implementation is used to load the vocab and performs tokenization.
+
+A XLM-V (base size) model is available under the [`facebook/xlm-v-base`](https://huggingface.co/facebook/xlm-v-base) identifier.
+
+
+
+XLM-V architecture is the same as XLM-RoBERTa, refer to [XLM-RoBERTa documentation](xlm-roberta) for API reference, and examples.
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm.md
new file mode 100644
index 0000000000000000000000000000000000000000..0ee11c6addc588526b66f7842e82596aa473f166
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlm.md
@@ -0,0 +1,161 @@
+
+
+# XLM
+
+
+
+## Overview
+
+The XLM model was proposed in [Cross-lingual Language Model Pretraining](https://arxiv.org/abs/1901.07291) by
+Guillaume Lample, Alexis Conneau. It's a transformer pretrained using one of the following objectives:
+
+- a causal language modeling (CLM) objective (next token prediction),
+- a masked language modeling (MLM) objective (BERT-like), or
+- a Translation Language Modeling (TLM) object (extension of BERT's MLM to multiple language inputs)
+
+The abstract from the paper is the following:
+
+*Recent studies have demonstrated the efficiency of generative pretraining for English natural language understanding.
+In this work, we extend this approach to multiple languages and show the effectiveness of cross-lingual pretraining. We
+propose two methods to learn cross-lingual language models (XLMs): one unsupervised that only relies on monolingual
+data, and one supervised that leverages parallel data with a new cross-lingual language model objective. We obtain
+state-of-the-art results on cross-lingual classification, unsupervised and supervised machine translation. On XNLI, our
+approach pushes the state of the art by an absolute gain of 4.9% accuracy. On unsupervised machine translation, we
+obtain 34.3 BLEU on WMT'16 German-English, improving the previous state of the art by more than 9 BLEU. On supervised
+machine translation, we obtain a new state of the art of 38.5 BLEU on WMT'16 Romanian-English, outperforming the
+previous best approach by more than 4 BLEU. Our code and pretrained models will be made publicly available.*
+
+This model was contributed by [thomwolf](https://huggingface.co/thomwolf). The original code can be found [here](https://github.com/facebookresearch/XLM/).
+
+## Usage tips
+
+- XLM has many different checkpoints, which were trained using different objectives: CLM, MLM or TLM. Make sure to
+ select the correct objective for your task (e.g. MLM checkpoints are not suitable for generation).
+- XLM has multilingual checkpoints which leverage a specific `lang` parameter. Check out the [multi-lingual](../multilingual) page for more information.
+- A transformer model trained on several languages. There are three different type of training for this model and the library provides checkpoints for all of them:
+
+ * Causal language modeling (CLM) which is the traditional autoregressive training (so this model could be in the previous section as well). One of the languages is selected for each training sample, and the model input is a sentence of 256 tokens, that may span over several documents in one of those languages.
+ * Masked language modeling (MLM) which is like RoBERTa. One of the languages is selected for each training sample, and the model input is a sentence of 256 tokens, that may span over several documents in one of those languages, with dynamic masking of the tokens.
+ * A combination of MLM and translation language modeling (TLM). This consists of concatenating a sentence in two different languages, with random masking. To predict one of the masked tokens, the model can use both, the surrounding context in language 1 and the context given by language 2.
+
+## Resources
+
+- [Text classification task guide](../tasks/sequence_classification)
+- [Token classification task guide](../tasks/token_classification)
+- [Question answering task guide](../tasks/question_answering)
+- [Causal language modeling task guide](../tasks/language_modeling)
+- [Masked language modeling task guide](../tasks/masked_language_modeling)
+- [Multiple choice task guide](../tasks/multiple_choice)
+
+## XLMConfig
+
+[[autodoc]] XLMConfig
+
+## XLMTokenizer
+
+[[autodoc]] XLMTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## XLM specific outputs
+
+[[autodoc]] models.xlm.modeling_xlm.XLMForQuestionAnsweringOutput
+
+
+
+
+## XLMModel
+
+[[autodoc]] XLMModel
+ - forward
+
+## XLMWithLMHeadModel
+
+[[autodoc]] XLMWithLMHeadModel
+ - forward
+
+## XLMForSequenceClassification
+
+[[autodoc]] XLMForSequenceClassification
+ - forward
+
+## XLMForMultipleChoice
+
+[[autodoc]] XLMForMultipleChoice
+ - forward
+
+## XLMForTokenClassification
+
+[[autodoc]] XLMForTokenClassification
+ - forward
+
+## XLMForQuestionAnsweringSimple
+
+[[autodoc]] XLMForQuestionAnsweringSimple
+ - forward
+
+## XLMForQuestionAnswering
+
+[[autodoc]] XLMForQuestionAnswering
+ - forward
+
+
+
+
+## TFXLMModel
+
+[[autodoc]] TFXLMModel
+ - call
+
+## TFXLMWithLMHeadModel
+
+[[autodoc]] TFXLMWithLMHeadModel
+ - call
+
+## TFXLMForSequenceClassification
+
+[[autodoc]] TFXLMForSequenceClassification
+ - call
+
+## TFXLMForMultipleChoice
+
+[[autodoc]] TFXLMForMultipleChoice
+ - call
+
+## TFXLMForTokenClassification
+
+[[autodoc]] TFXLMForTokenClassification
+ - call
+
+## TFXLMForQuestionAnsweringSimple
+
+[[autodoc]] TFXLMForQuestionAnsweringSimple
+ - call
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlnet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlnet.md
new file mode 100644
index 0000000000000000000000000000000000000000..90b454e8af3c901d43482d78a00a34469cf2e6c3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlnet.md
@@ -0,0 +1,185 @@
+
+
+# XLNet
+
+
+
+## Overview
+
+The XLNet model was proposed in [XLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) by Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov,
+Quoc V. Le. XLnet is an extension of the Transformer-XL model pre-trained using an autoregressive method to learn
+bidirectional contexts by maximizing the expected likelihood over all permutations of the input sequence factorization
+order.
+
+The abstract from the paper is the following:
+
+*With the capability of modeling bidirectional contexts, denoising autoencoding based pretraining like BERT achieves
+better performance than pretraining approaches based on autoregressive language modeling. However, relying on
+corrupting the input with masks, BERT neglects dependency between the masked positions and suffers from a
+pretrain-finetune discrepancy. In light of these pros and cons, we propose XLNet, a generalized autoregressive
+pretraining method that (1) enables learning bidirectional contexts by maximizing the expected likelihood over all
+permutations of the factorization order and (2) overcomes the limitations of BERT thanks to its autoregressive
+formulation. Furthermore, XLNet integrates ideas from Transformer-XL, the state-of-the-art autoregressive model, into
+pretraining. Empirically, under comparable experiment settings, XLNet outperforms BERT on 20 tasks, often by a large
+margin, including question answering, natural language inference, sentiment analysis, and document ranking.*
+
+This model was contributed by [thomwolf](https://huggingface.co/thomwolf). The original code can be found [here](https://github.com/zihangdai/xlnet/).
+
+## Usage tips
+
+- The specific attention pattern can be controlled at training and test time using the `perm_mask` input.
+- Due to the difficulty of training a fully auto-regressive model over various factorization order, XLNet is pretrained
+ using only a sub-set of the output tokens as target which are selected with the `target_mapping` input.
+- To use XLNet for sequential decoding (i.e. not in fully bi-directional setting), use the `perm_mask` and
+ `target_mapping` inputs to control the attention span and outputs (see examples in
+ *examples/pytorch/text-generation/run_generation.py*)
+- XLNet is one of the few models that has no sequence length limit.
+- XLNet is not a traditional autoregressive model but uses a training strategy that builds on that. It permutes the tokens in the sentence, then allows the model to use the last n tokens to predict the token n+1. Since this is all done with a mask, the sentence is actually fed in the model in the right order, but instead of masking the first n tokens for n+1, XLNet uses a mask that hides the previous tokens in some given permutation of 1,โฆ,sequence length.
+- XLNet also uses the same recurrence mechanism as Transformer-XL to build long-term dependencies.
+
+## Resources
+
+- [Text classification task guide](../tasks/sequence_classification)
+- [Token classification task guide](../tasks/token_classification)
+- [Question answering task guide](../tasks/question_answering)
+- [Causal language modeling task guide](../tasks/language_modeling)
+- [Multiple choice task guide](../tasks/multiple_choice)
+
+## XLNetConfig
+
+[[autodoc]] XLNetConfig
+
+## XLNetTokenizer
+
+[[autodoc]] XLNetTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## XLNetTokenizerFast
+
+[[autodoc]] XLNetTokenizerFast
+
+## XLNet specific outputs
+
+[[autodoc]] models.xlnet.modeling_xlnet.XLNetModelOutput
+
+[[autodoc]] models.xlnet.modeling_xlnet.XLNetLMHeadModelOutput
+
+[[autodoc]] models.xlnet.modeling_xlnet.XLNetForSequenceClassificationOutput
+
+[[autodoc]] models.xlnet.modeling_xlnet.XLNetForMultipleChoiceOutput
+
+[[autodoc]] models.xlnet.modeling_xlnet.XLNetForTokenClassificationOutput
+
+[[autodoc]] models.xlnet.modeling_xlnet.XLNetForQuestionAnsweringSimpleOutput
+
+[[autodoc]] models.xlnet.modeling_xlnet.XLNetForQuestionAnsweringOutput
+
+[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetModelOutput
+
+[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetLMHeadModelOutput
+
+[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForSequenceClassificationOutput
+
+[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForMultipleChoiceOutput
+
+[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForTokenClassificationOutput
+
+[[autodoc]] models.xlnet.modeling_tf_xlnet.TFXLNetForQuestionAnsweringSimpleOutput
+
+
+
+
+## XLNetModel
+
+[[autodoc]] XLNetModel
+ - forward
+
+## XLNetLMHeadModel
+
+[[autodoc]] XLNetLMHeadModel
+ - forward
+
+## XLNetForSequenceClassification
+
+[[autodoc]] XLNetForSequenceClassification
+ - forward
+
+## XLNetForMultipleChoice
+
+[[autodoc]] XLNetForMultipleChoice
+ - forward
+
+## XLNetForTokenClassification
+
+[[autodoc]] XLNetForTokenClassification
+ - forward
+
+## XLNetForQuestionAnsweringSimple
+
+[[autodoc]] XLNetForQuestionAnsweringSimple
+ - forward
+
+## XLNetForQuestionAnswering
+
+[[autodoc]] XLNetForQuestionAnswering
+ - forward
+
+
+
+
+## TFXLNetModel
+
+[[autodoc]] TFXLNetModel
+ - call
+
+## TFXLNetLMHeadModel
+
+[[autodoc]] TFXLNetLMHeadModel
+ - call
+
+## TFXLNetForSequenceClassification
+
+[[autodoc]] TFXLNetForSequenceClassification
+ - call
+
+## TFXLNetForMultipleChoice
+
+[[autodoc]] TFXLNetForMultipleChoice
+ - call
+
+## TFXLNetForTokenClassification
+
+[[autodoc]] TFXLNetForTokenClassification
+ - call
+
+## TFXLNetForQuestionAnsweringSimple
+
+[[autodoc]] TFXLNetForQuestionAnsweringSimple
+ - call
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xls_r.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xls_r.md
new file mode 100644
index 0000000000000000000000000000000000000000..2226c813e72b133e2ba9ebcb8029fd036353cd9c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xls_r.md
@@ -0,0 +1,51 @@
+
+
+# XLS-R
+
+## Overview
+
+The XLS-R model was proposed in [XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale](https://arxiv.org/abs/2111.09296) by Arun Babu, Changhan Wang, Andros Tjandra, Kushal Lakhotia, Qiantong Xu, Naman
+Goyal, Kritika Singh, Patrick von Platen, Yatharth Saraf, Juan Pino, Alexei Baevski, Alexis Conneau, Michael Auli.
+
+The abstract from the paper is the following:
+
+*This paper presents XLS-R, a large-scale model for cross-lingual speech representation learning based on wav2vec 2.0.
+We train models with up to 2B parameters on nearly half a million hours of publicly available speech audio in 128
+languages, an order of magnitude more public data than the largest known prior work. Our evaluation covers a wide range
+of tasks, domains, data regimes and languages, both high and low-resource. On the CoVoST-2 speech translation
+benchmark, we improve the previous state of the art by an average of 7.4 BLEU over 21 translation directions into
+English. For speech recognition, XLS-R improves over the best known prior work on BABEL, MLS, CommonVoice as well as
+VoxPopuli, lowering error rates by 14-34% relative on average. XLS-R also sets a new state of the art on VoxLingua107
+language identification. Moreover, we show that with sufficient model size, cross-lingual pretraining can outperform
+English-only pretraining when translating English speech into other languages, a setting which favors monolingual
+pretraining. We hope XLS-R can help to improve speech processing tasks for many more languages of the world.*
+
+Relevant checkpoints can be found under https://huggingface.co/models?other=xls_r.
+
+The original code can be found [here](https://github.com/pytorch/fairseq/tree/master/fairseq/models/wav2vec).
+
+## Usage tips
+
+- XLS-R is a speech model that accepts a float array corresponding to the raw waveform of the speech signal.
+- XLS-R model was trained using connectionist temporal classification (CTC) so the model output has to be decoded using
+ [`Wav2Vec2CTCTokenizer`].
+
+
+
+XLS-R's architecture is based on the Wav2Vec2 model, refer to [Wav2Vec2's documentation page](wav2vec2) for API reference.
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlsr_wav2vec2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlsr_wav2vec2.md
new file mode 100644
index 0000000000000000000000000000000000000000..6369d068850a26d289022302d8db182dbafda2ee
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xlsr_wav2vec2.md
@@ -0,0 +1,51 @@
+
+
+# XLSR-Wav2Vec2
+
+## Overview
+
+The XLSR-Wav2Vec2 model was proposed in [Unsupervised Cross-Lingual Representation Learning For Speech Recognition](https://arxiv.org/abs/2006.13979) by Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael
+Auli.
+
+The abstract from the paper is the following:
+
+*This paper presents XLSR which learns cross-lingual speech representations by pretraining a single model from the raw
+waveform of speech in multiple languages. We build on wav2vec 2.0 which is trained by solving a contrastive task over
+masked latent speech representations and jointly learns a quantization of the latents shared across languages. The
+resulting model is fine-tuned on labeled data and experiments show that cross-lingual pretraining significantly
+outperforms monolingual pretraining. On the CommonVoice benchmark, XLSR shows a relative phoneme error rate reduction
+of 72% compared to the best known results. On BABEL, our approach improves word error rate by 16% relative compared to
+a comparable system. Our approach enables a single multilingual speech recognition model which is competitive to strong
+individual models. Analysis shows that the latent discrete speech representations are shared across languages with
+increased sharing for related languages. We hope to catalyze research in low-resource speech understanding by releasing
+XLSR-53, a large model pretrained in 53 languages.*
+
+The original code can be found [here](https://github.com/pytorch/fairseq/tree/master/fairseq/models/wav2vec).
+
+Note: Meta (FAIR) released a new version of [Wav2Vec2-BERT 2.0](https://huggingface.co/docs/transformers/en/model_doc/wav2vec2-bert) - it's pretrained on 4.5M hours of audio. We especially recommend using it for fine-tuning tasks, e.g. as per [this guide](https://huggingface.co/blog/fine-tune-w2v2-bert).
+
+## Usage tips
+
+- XLSR-Wav2Vec2 is a speech model that accepts a float array corresponding to the raw waveform of the speech signal.
+- XLSR-Wav2Vec2 model was trained using connectionist temporal classification (CTC) so the model output has to be
+ decoded using [`Wav2Vec2CTCTokenizer`].
+
+
+
+XLSR-Wav2Vec2's architecture is based on the Wav2Vec2 model, so one can refer to [Wav2Vec2's documentation page](wav2vec2).
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xmod.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xmod.md
new file mode 100644
index 0000000000000000000000000000000000000000..47797fa64902549e1950f4fda32abcfbe86674d2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/xmod.md
@@ -0,0 +1,133 @@
+
+
+# X-MOD
+
+## Overview
+
+The X-MOD model was proposed in [Lifting the Curse of Multilinguality by Pre-training Modular Transformers](http://dx.doi.org/10.18653/v1/2022.naacl-main.255) by Jonas Pfeiffer, Naman Goyal, Xi Lin, Xian Li, James Cross, Sebastian Riedel, and Mikel Artetxe.
+X-MOD extends multilingual masked language models like [XLM-R](xlm-roberta) to include language-specific modular components (_language adapters_) during pre-training. For fine-tuning, the language adapters in each transformer layer are frozen.
+
+The abstract from the paper is the following:
+
+*Multilingual pre-trained models are known to suffer from the curse of multilinguality, which causes per-language performance to drop as they cover more languages. We address this issue by introducing language-specific modules, which allows us to grow the total capacity of the model, while keeping the total number of trainable parameters per language constant. In contrast with prior work that learns language-specific components post-hoc, we pre-train the modules of our Cross-lingual Modular (X-MOD) models from the start. Our experiments on natural language inference, named entity recognition and question answering show that our approach not only mitigates the negative interference between languages, but also enables positive transfer, resulting in improved monolingual and cross-lingual performance. Furthermore, our approach enables adding languages post-hoc with no measurable drop in performance, no longer limiting the model usage to the set of pre-trained languages.*
+
+This model was contributed by [jvamvas](https://huggingface.co/jvamvas).
+The original code can be found [here](https://github.com/facebookresearch/fairseq/tree/58cc6cca18f15e6d56e3f60c959fe4f878960a60/fairseq/models/xmod) and the original documentation is found [here](https://github.com/facebookresearch/fairseq/tree/58cc6cca18f15e6d56e3f60c959fe4f878960a60/examples/xmod).
+
+## Usage tips
+
+Tips:
+- X-MOD is similar to [XLM-R](xlm-roberta), but a difference is that the input language needs to be specified so that the correct language adapter can be activated.
+- The main models โ base and large โ have adapters for 81 languages.
+
+## Adapter Usage
+
+### Input language
+
+There are two ways to specify the input language:
+1. By setting a default language before using the model:
+
+```python
+from transformers import XmodModel
+
+model = XmodModel.from_pretrained("facebook/xmod-base")
+model.set_default_language("en_XX")
+```
+
+2. By explicitly passing the index of the language adapter for each sample:
+
+```python
+import torch
+
+input_ids = torch.tensor(
+ [
+ [0, 581, 10269, 83, 99942, 136, 60742, 23, 70, 80583, 18276, 2],
+ [0, 1310, 49083, 443, 269, 71, 5486, 165, 60429, 660, 23, 2],
+ ]
+)
+lang_ids = torch.LongTensor(
+ [
+ 0, # en_XX
+ 8, # de_DE
+ ]
+)
+output = model(input_ids, lang_ids=lang_ids)
+```
+
+### Fine-tuning
+The paper recommends that the embedding layer and the language adapters are frozen during fine-tuning. A method for doing this is provided:
+
+```python
+model.freeze_embeddings_and_language_adapters()
+# Fine-tune the model ...
+```
+
+### Cross-lingual transfer
+After fine-tuning, zero-shot cross-lingual transfer can be tested by activating the language adapter of the target language:
+
+```python
+model.set_default_language("de_DE")
+# Evaluate the model on German examples ...
+```
+
+## Resources
+
+- [Text classification task guide](../tasks/sequence_classification)
+- [Token classification task guide](../tasks/token_classification)
+- [Question answering task guide](../tasks/question_answering)
+- [Causal language modeling task guide](../tasks/language_modeling)
+- [Masked language modeling task guide](../tasks/masked_language_modeling)
+- [Multiple choice task guide](../tasks/multiple_choice)
+
+## XmodConfig
+
+[[autodoc]] XmodConfig
+
+## XmodModel
+
+[[autodoc]] XmodModel
+ - forward
+
+## XmodForCausalLM
+
+[[autodoc]] XmodForCausalLM
+ - forward
+
+## XmodForMaskedLM
+
+[[autodoc]] XmodForMaskedLM
+ - forward
+
+## XmodForSequenceClassification
+
+[[autodoc]] XmodForSequenceClassification
+ - forward
+
+## XmodForMultipleChoice
+
+[[autodoc]] XmodForMultipleChoice
+ - forward
+
+## XmodForTokenClassification
+
+[[autodoc]] XmodForTokenClassification
+ - forward
+
+## XmodForQuestionAnswering
+
+[[autodoc]] XmodForQuestionAnswering
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/yolos.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/yolos.md
new file mode 100644
index 0000000000000000000000000000000000000000..ebe249517fdf3b848ad030c6879d18d4b5a5483b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/yolos.md
@@ -0,0 +1,107 @@
+
+
+# YOLOS
+
+## Overview
+
+The YOLOS model was proposed in [You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection](https://arxiv.org/abs/2106.00666) by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
+YOLOS proposes to just leverage the plain [Vision Transformer (ViT)](vit) for object detection, inspired by DETR. It turns out that a base-sized encoder-only Transformer can also achieve 42 AP on COCO, similar to DETR and much more complex frameworks such as Faster R-CNN.
+
+The abstract from the paper is the following:
+
+*Can Transformer perform 2D object- and region-level recognition from a pure sequence-to-sequence perspective with minimal knowledge about the 2D spatial structure? To answer this question, we present You Only Look at One Sequence (YOLOS), a series of object detection models based on the vanilla Vision Transformer with the fewest possible modifications, region priors, as well as inductive biases of the target task. We find that YOLOS pre-trained on the mid-sized ImageNet-1k dataset only can already achieve quite competitive performance on the challenging COCO object detection benchmark, e.g., YOLOS-Base directly adopted from BERT-Base architecture can obtain 42.0 box AP on COCO val. We also discuss the impacts as well as limitations of current pre-train schemes and model scaling strategies for Transformer in vision through YOLOS.*
+
+
+
+ YOLOS architecture. Taken from the original paper .
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr). The original code can be found [here](https://github.com/hustvl/YOLOS).
+
+## Using Scaled Dot Product Attention (SDPA)
+
+PyTorch includes a native scaled dot-product attention (SDPA) operator as part of `torch.nn.functional`. This function
+encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the
+[official documentation](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)
+or the [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)
+page for more information.
+
+SDPA is used by default for `torch>=2.1.1` when an implementation is available, but you may also set
+`attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+```
+from transformers import AutoModelForObjectDetection
+model = AutoModelForObjectDetection.from_pretrained("hustvl/yolos-base", attn_implementation="sdpa", torch_dtype=torch.float16)
+...
+```
+
+For the best speedups, we recommend loading the model in half-precision (e.g. `torch.float16` or `torch.bfloat16`).
+
+On a local benchmark (A100-40GB, PyTorch 2.3.0, OS Ubuntu 22.04) with `float32` and `hustvl/yolos-base` model, we saw the following speedups during inference.
+
+| Batch size | Average inference time (ms), eager mode | Average inference time (ms), sdpa model | Speed up, Sdpa / Eager (x) |
+|--------------|-------------------------------------------|-------------------------------------------|------------------------------|
+| 1 | 106 | 76 | 1.39 |
+| 2 | 154 | 90 | 1.71 |
+| 4 | 222 | 116 | 1.91 |
+| 8 | 368 | 168 | 2.19 |
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with YOLOS.
+
+
+
+- All example notebooks illustrating inference + fine-tuning [`YolosForObjectDetection`] on a custom dataset can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/YOLOS).
+- Scripts for finetuning [`YolosForObjectDetection`] with [`Trainer`] or [Accelerate](https://huggingface.co/docs/accelerate/index) can be found [here](https://github.com/huggingface/transformers/tree/main/examples/pytorch/object-detection).
+- See also: [Object detection task guide](../tasks/object_detection)
+
+If you're interested in submitting a resource to be included here, please feel free to open a Pull Request and we'll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.
+
+
+
+Use [`YolosImageProcessor`] for preparing images (and optional targets) for the model. Contrary to [DETR](detr), YOLOS doesn't require a `pixel_mask` to be created.
+
+
+
+## YolosConfig
+
+[[autodoc]] YolosConfig
+
+## YolosImageProcessor
+
+[[autodoc]] YolosImageProcessor
+ - preprocess
+ - pad
+ - post_process_object_detection
+
+## YolosFeatureExtractor
+
+[[autodoc]] YolosFeatureExtractor
+ - __call__
+ - pad
+ - post_process_object_detection
+
+## YolosModel
+
+[[autodoc]] YolosModel
+ - forward
+
+## YolosForObjectDetection
+
+[[autodoc]] YolosForObjectDetection
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/yoso.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/yoso.md
new file mode 100644
index 0000000000000000000000000000000000000000..a3dfa3fed855b5a05f19e9f8c00e8b85041f08cb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/yoso.md
@@ -0,0 +1,97 @@
+
+
+# YOSO
+
+## Overview
+
+The YOSO model was proposed in [You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling](https://arxiv.org/abs/2111.09714)
+by Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh. YOSO approximates standard softmax self-attention
+via a Bernoulli sampling scheme based on Locality Sensitive Hashing (LSH). In principle, all the Bernoulli random variables can be sampled with
+a single hash.
+
+The abstract from the paper is the following:
+
+*Transformer-based models are widely used in natural language processing (NLP). Central to the transformer model is
+the self-attention mechanism, which captures the interactions of token pairs in the input sequences and depends quadratically
+on the sequence length. Training such models on longer sequences is expensive. In this paper, we show that a Bernoulli sampling
+attention mechanism based on Locality Sensitive Hashing (LSH), decreases the quadratic complexity of such models to linear.
+We bypass the quadratic cost by considering self-attention as a sum of individual tokens associated with Bernoulli random
+variables that can, in principle, be sampled at once by a single hash (although in practice, this number may be a small constant).
+This leads to an efficient sampling scheme to estimate self-attention which relies on specific modifications of
+LSH (to enable deployment on GPU architectures). We evaluate our algorithm on the GLUE benchmark with standard 512 sequence
+length where we see favorable performance relative to a standard pretrained Transformer. On the Long Range Arena (LRA) benchmark,
+for evaluating performance on long sequences, our method achieves results consistent with softmax self-attention but with sizable
+speed-ups and memory savings and often outperforms other efficient self-attention methods. Our code is available at this https URL*
+
+This model was contributed by [novice03](https://huggingface.co/novice03). The original code can be found [here](https://github.com/mlpen/YOSO).
+
+## Usage tips
+
+- The YOSO attention algorithm is implemented through custom CUDA kernels, functions written in CUDA C++ that can be executed multiple times
+in parallel on a GPU.
+- The kernels provide a `fast_hash` function, which approximates the random projections of the queries and keys using the Fast Hadamard Transform. Using these
+hash codes, the `lsh_cumulation` function approximates self-attention via LSH-based Bernoulli sampling.
+- To use the custom kernels, the user should set `config.use_expectation = False`. To ensure that the kernels are compiled successfully,
+the user must install the correct version of PyTorch and cudatoolkit. By default, `config.use_expectation = True`, which uses YOSO-E and
+does not require compiling CUDA kernels.
+
+
+
+ YOSO Attention Algorithm. Taken from the original paper .
+
+## Resources
+
+- [Text classification task guide](../tasks/sequence_classification)
+- [Token classification task guide](../tasks/token_classification)
+- [Question answering task guide](../tasks/question_answering)
+- [Masked language modeling task guide](../tasks/masked_language_modeling)
+- [Multiple choice task guide](../tasks/multiple_choice)
+
+## YosoConfig
+
+[[autodoc]] YosoConfig
+
+## YosoModel
+
+[[autodoc]] YosoModel
+ - forward
+
+## YosoForMaskedLM
+
+[[autodoc]] YosoForMaskedLM
+ - forward
+
+## YosoForSequenceClassification
+
+[[autodoc]] YosoForSequenceClassification
+ - forward
+
+## YosoForMultipleChoice
+
+[[autodoc]] YosoForMultipleChoice
+ - forward
+
+## YosoForTokenClassification
+
+[[autodoc]] YosoForTokenClassification
+ - forward
+
+## YosoForQuestionAnswering
+
+[[autodoc]] YosoForQuestionAnswering
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/zamba.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/zamba.md
new file mode 100644
index 0000000000000000000000000000000000000000..450b68c77d6dacb40b24e33361a9dfcfeb3d3a86
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/zamba.md
@@ -0,0 +1,100 @@
+
+# Zamba
+
+Zamba is a large language model (LLM) trained by Zyphra, and made available under an Apache 2.0 license. Please see the [Zyphra Hugging Face](https://huggingface.co/collections/zyphra/) repository for model weights.
+
+This model was contributed by [pglo](https://huggingface.co/pglo).
+
+
+## Model details
+
+Zamba-7B-v1 is a hybrid between state-space models (Specifically [Mamba](https://github.com/state-spaces/mamba)) and transformer, and was trained using next-token prediction. Zamba uses a shared transformer layer after every 6 mamba blocks. It uses the [Mistral v0.1 tokenizer](https://huggingface.co/mistralai/Mistral-7B-v0.1). We came to this architecture after a series of ablations at small scales. Zamba-7B-v1 was pre-trained on 1T tokens of text and code data.
+
+
+
+## Quick start
+
+
+### Presequities
+
+Zamba requires you use `transformers` version 4.46.0 or higher:
+```bash
+pip install transformers>=4.45.0
+```
+
+In order to run optimized Mamba implementations, you first need to install `mamba-ssm` and `causal-conv1d`:
+```bash
+pip install mamba-ssm causal-conv1d>=1.2.0
+```
+You also have to have the model on a CUDA device.
+
+You can run the model not using the optimized Mamba kernels, but it is **not** recommended as it will result in significantly lower latencies. In order to do that, you'll need to specify `use_mamba_kernels=False` when loading the model.
+
+
+## Inference
+
+```python
+from transformers import AutoTokenizer, AutoModelForCausalLM
+import torch
+
+tokenizer = AutoTokenizer.from_pretrained("Zyphra/Zamba-7B-v1")
+model = AutoModelForCausalLM.from_pretrained("Zyphra/Zamba-7B-v1", device_map="auto", torch_dtype=torch.bfloat16)
+
+input_text = "A funny prompt would be "
+input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+outputs = model.generate(**input_ids, max_new_tokens=100)
+print(tokenizer.decode(outputs[0]))
+```
+
+
+## Model card
+
+The model cards can be found at:
+* [Zamba-7B](MODEL_CARD_ZAMBA-7B-v1.md)
+
+
+## Issues
+For issues with model output, or community discussion, please use the Hugging Face community [forum](https://huggingface.co/zyphra/zamba-7b)
+
+
+## License
+
+The model weights are open-sourced via an Apache 2.0 license.
+
+
+## ZambaConfig
+
+[[autodoc]] ZambaConfig
+
+
+## ZambaModel
+
+[[autodoc]] ZambaModel
+ - forward
+
+
+## ZambaForCausalLM
+
+[[autodoc]] ZambaForCausalLM
+ - forward
+
+
+## ZambaForSequenceClassification
+
+[[autodoc]] transformers.ZambaForSequenceClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/zoedepth.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/zoedepth.md
new file mode 100644
index 0000000000000000000000000000000000000000..74e25f3c3f6ea52fa23292b065d0f6d6cc3ab53b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_doc/zoedepth.md
@@ -0,0 +1,120 @@
+
+
+# ZoeDepth
+
+## Overview
+
+The ZoeDepth model was proposed in [ZoeDepth: Zero-shot Transfer by Combining Relative and Metric Depth](https://arxiv.org/abs/2302.12288) by Shariq Farooq Bhat, Reiner Birkl, Diana Wofk, Peter Wonka, Matthias Mรผller. ZoeDepth extends the [DPT](dpt) framework for metric (also called absolute) depth estimation. ZoeDepth is pre-trained on 12 datasets using relative depth and fine-tuned on two domains (NYU and KITTI) using metric depth. A lightweight head is used with a novel bin adjustment design called metric bins module for each domain. During inference, each input image is automatically routed to the appropriate head using a latent classifier.
+
+The abstract from the paper is the following:
+
+*This paper tackles the problem of depth estimation from a single image. Existing work either focuses on generalization performance disregarding metric scale, i.e. relative depth estimation, or state-of-the-art results on specific datasets, i.e. metric depth estimation. We propose the first approach that combines both worlds, leading to a model with excellent generalization performance while maintaining metric scale. Our flagship model, ZoeD-M12-NK, is pre-trained on 12 datasets using relative depth and fine-tuned on two datasets using metric depth. We use a lightweight head with a novel bin adjustment design called metric bins module for each domain. During inference, each input image is automatically routed to the appropriate head using a latent classifier. Our framework admits multiple configurations depending on the datasets used for relative depth pre-training and metric fine-tuning. Without pre-training, we can already significantly improve the state of the art (SOTA) on the NYU Depth v2 indoor dataset. Pre-training on twelve datasets and fine-tuning on the NYU Depth v2 indoor dataset, we can further improve SOTA for a total of 21% in terms of relative absolute error (REL). Finally, ZoeD-M12-NK is the first model that can jointly train on multiple datasets (NYU Depth v2 and KITTI) without a significant drop in performance and achieve unprecedented zero-shot generalization performance to eight unseen datasets from both indoor and outdoor domains.*
+
+
+
+ ZoeDepth architecture. Taken from the original paper.
+
+This model was contributed by [nielsr](https://huggingface.co/nielsr).
+The original code can be found [here](https://github.com/isl-org/ZoeDepth).
+
+## Usage tips
+
+- ZoeDepth is an absolute (also called metric) depth estimation model, unlike DPT which is a relative depth estimation model. This means that ZoeDepth is able to estimate depth in metric units like meters.
+
+The easiest to perform inference with ZoeDepth is by leveraging the [pipeline API](../main_classes/pipelines.md):
+
+```python
+>>> from transformers import pipeline
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> pipe = pipeline(task="depth-estimation", model="Intel/zoedepth-nyu-kitti")
+>>> result = pipe(image)
+>>> depth = result["depth"]
+```
+
+Alternatively, one can also perform inference using the classes:
+
+```python
+>>> from transformers import AutoImageProcessor, ZoeDepthForDepthEstimation
+>>> import torch
+>>> import numpy as np
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> image_processor = AutoImageProcessor.from_pretrained("Intel/zoedepth-nyu-kitti")
+>>> model = ZoeDepthForDepthEstimation.from_pretrained("Intel/zoedepth-nyu-kitti")
+
+>>> # prepare image for the model
+>>> inputs = image_processor(images=image, return_tensors="pt")
+
+>>> with torch.no_grad():
+... outputs = model(pixel_values)
+
+>>> # interpolate to original size and visualize the prediction
+>>> ## ZoeDepth dynamically pads the input image. Thus we pass the original image size as argument
+>>> ## to `post_process_depth_estimation` to remove the padding and resize to original dimensions.
+>>> post_processed_output = image_processor.post_process_depth_estimation(
+... outputs,
+... source_sizes=[(image.height, image.width)],
+... )
+
+>>> predicted_depth = post_processed_output[0]["predicted_depth"]
+>>> depth = (predicted_depth - predicted_depth.min()) / (predicted_depth.max() - predicted_depth.min())
+>>> depth = depth.detach().cpu().numpy() * 255
+>>> depth = Image.fromarray(depth.astype("uint8"))
+```
+
+
+In the original implementation ZoeDepth model performs inference on both the original and flipped images and averages out the results. The post_process_depth_estimation function can handle this for us by passing the flipped outputs to the optional outputs_flipped argument:
+>>> with torch.no_grad():
+... outputs = model(pixel_values)
+... outputs_flipped = model(pixel_values=torch.flip(inputs.pixel_values, dims=[3]))
+>>> post_processed_output = image_processor.post_process_depth_estimation(
+... outputs,
+... source_sizes=[(image.height, image.width)],
+... outputs_flipped=outputs_flipped,
+... )
+
+
+
+## Resources
+
+A list of official Hugging Face and community (indicated by ๐) resources to help you get started with ZoeDepth.
+
+- A demo notebook regarding inference with ZoeDepth models can be found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/ZoeDepth). ๐
+
+## ZoeDepthConfig
+
+[[autodoc]] ZoeDepthConfig
+
+## ZoeDepthImageProcessor
+
+[[autodoc]] ZoeDepthImageProcessor
+ - preprocess
+
+## ZoeDepthForDepthEstimation
+
+[[autodoc]] ZoeDepthForDepthEstimation
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_memory_anatomy.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_memory_anatomy.md
new file mode 100644
index 0000000000000000000000000000000000000000..44c197aae5cfe4a9fd6b7b6b56df553d2cb287b2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_memory_anatomy.md
@@ -0,0 +1,272 @@
+
+
+# Model training anatomy
+
+To understand performance optimization techniques that one can apply to improve efficiency of model training
+speed and memory utilization, it's helpful to get familiar with how GPU is utilized during training, and how compute
+intensity varies depending on an operation performed.
+
+Let's start by exploring a motivating example of GPU utilization and the training run of a model. For the demonstration,
+we'll need to install a few libraries:
+
+```bash
+pip install transformers datasets accelerate nvidia-ml-py3
+```
+
+The `nvidia-ml-py3` library allows us to monitor the memory usage of the models from within Python. You might be familiar
+with the `nvidia-smi` command in the terminal - this library allows to access the same information in Python directly.
+
+Then, we create some dummy data: random token IDs between 100 and 30000 and binary labels for a classifier.
+In total, we get 512 sequences each with length 512 and store them in a [`~datasets.Dataset`] with PyTorch format.
+
+
+```py
+>>> import numpy as np
+>>> from datasets import Dataset
+
+
+>>> seq_len, dataset_size = 512, 512
+>>> dummy_data = {
+... "input_ids": np.random.randint(100, 30000, (dataset_size, seq_len)),
+... "labels": np.random.randint(0, 2, (dataset_size)),
+... }
+>>> ds = Dataset.from_dict(dummy_data)
+>>> ds.set_format("pt")
+```
+
+To print summary statistics for the GPU utilization and the training run with the [`Trainer`] we define two helper functions:
+
+```py
+>>> from pynvml import *
+
+
+>>> def print_gpu_utilization():
+... nvmlInit()
+... handle = nvmlDeviceGetHandleByIndex(0)
+... info = nvmlDeviceGetMemoryInfo(handle)
+... print(f"GPU memory occupied: {info.used//1024**2} MB.")
+
+
+>>> def print_summary(result):
+... print(f"Time: {result.metrics['train_runtime']:.2f}")
+... print(f"Samples/second: {result.metrics['train_samples_per_second']:.2f}")
+... print_gpu_utilization()
+```
+
+Let's verify that we start with a free GPU memory:
+
+```py
+>>> print_gpu_utilization()
+GPU memory occupied: 0 MB.
+```
+
+That looks good: the GPU memory is not occupied as we would expect before we load any models. If that's not the case on
+your machine make sure to stop all processes that are using GPU memory. However, not all free GPU memory can be used by
+the user. When a model is loaded to the GPU the kernels are also loaded, which can take up 1-2GB of memory. To see how
+much it is we load a tiny tensor into the GPU which triggers the kernels to be loaded as well.
+
+```py
+>>> import torch
+
+
+>>> torch.ones((1, 1)).to("cuda")
+>>> print_gpu_utilization()
+GPU memory occupied: 1343 MB.
+```
+
+We see that the kernels alone take up 1.3GB of GPU memory. Now let's see how much space the model uses.
+
+## Load Model
+
+First, we load the `google-bert/bert-large-uncased` model. We load the model weights directly to the GPU so that we can check
+how much space just the weights use.
+
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-large-uncased").to("cuda")
+>>> print_gpu_utilization()
+GPU memory occupied: 2631 MB.
+```
+
+We can see that the model weights alone take up 1.3 GB of GPU memory. The exact number depends on the specific
+GPU you are using. Note that on newer GPUs a model can sometimes take up more space since the weights are loaded in an
+optimized fashion that speeds up the usage of the model. Now we can also quickly check if we get the same result
+as with `nvidia-smi` CLI:
+
+
+```bash
+nvidia-smi
+```
+
+```bash
+Tue Jan 11 08:58:05 2022
++-----------------------------------------------------------------------------+
+| NVIDIA-SMI 460.91.03 Driver Version: 460.91.03 CUDA Version: 11.2 |
+|-------------------------------+----------------------+----------------------+
+| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
+| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
+| | | MIG M. |
+|===============================+======================+======================|
+| 0 Tesla V100-SXM2... On | 00000000:00:04.0 Off | 0 |
+| N/A 37C P0 39W / 300W | 2631MiB / 16160MiB | 0% Default |
+| | | N/A |
++-------------------------------+----------------------+----------------------+
+
++-----------------------------------------------------------------------------+
+| Processes: |
+| GPU GI CI PID Type Process name GPU Memory |
+| ID ID Usage |
+|=============================================================================|
+| 0 N/A N/A 3721 C ...nvs/codeparrot/bin/python 2629MiB |
++-----------------------------------------------------------------------------+
+```
+
+We get the same number as before and you can also see that we are using a V100 GPU with 16GB of memory. So now we can
+start training the model and see how the GPU memory consumption changes. First, we set up a few standard training
+arguments:
+
+```py
+default_args = {
+ "output_dir": "tmp",
+ "eval_strategy": "steps",
+ "num_train_epochs": 1,
+ "log_level": "error",
+ "report_to": "none",
+}
+```
+
+
+
+ If you plan to run multiple experiments, in order to properly clear the memory between experiments, restart the Python
+ kernel between experiments.
+
+
+
+## Memory utilization at vanilla training
+
+Let's use the [`Trainer`] and train the model without using any GPU performance optimization techniques and a batch size of 4:
+
+```py
+>>> from transformers import TrainingArguments, Trainer, logging
+
+>>> logging.set_verbosity_error()
+
+
+>>> training_args = TrainingArguments(per_device_train_batch_size=4, **default_args)
+>>> trainer = Trainer(model=model, args=training_args, train_dataset=ds)
+>>> result = trainer.train()
+>>> print_summary(result)
+```
+
+```
+Time: 57.82
+Samples/second: 8.86
+GPU memory occupied: 14949 MB.
+```
+
+We see that already a relatively small batch size almost fills up our GPU's entire memory. However, a larger batch size
+can often result in faster model convergence or better end performance. So ideally we want to tune the batch size to our
+model's needs and not to the GPU limitations. What's interesting is that we use much more memory than the size of the model.
+To understand a bit better why this is the case let's have a look at a model's operations and memory needs.
+
+## Anatomy of Model's Operations
+
+Transformers architecture includes 3 main groups of operations grouped below by compute-intensity.
+
+1. **Tensor Contractions**
+
+ Linear layers and components of Multi-Head Attention all do batched **matrix-matrix multiplications**. These operations are the most compute-intensive part of training a transformer.
+
+2. **Statistical Normalizations**
+
+ Softmax and layer normalization are less compute-intensive than tensor contractions, and involve one or more **reduction operations**, the result of which is then applied via a map.
+
+3. **Element-wise Operators**
+
+ These are the remaining operators: **biases, dropout, activations, and residual connections**. These are the least compute-intensive operations.
+
+This knowledge can be helpful to know when analyzing performance bottlenecks.
+
+This summary is derived from [Data Movement Is All You Need: A Case Study on Optimizing Transformers 2020](https://arxiv.org/abs/2007.00072)
+
+
+## Anatomy of Model's Memory
+
+We've seen that training the model uses much more memory than just putting the model on the GPU. This is because there
+are many components during training that use GPU memory. The components on GPU memory are the following:
+
+1. model weights
+2. optimizer states
+3. gradients
+4. forward activations saved for gradient computation
+5. temporary buffers
+6. functionality-specific memory
+
+A typical model trained in mixed precision with AdamW requires 18 bytes per model parameter plus activation memory. For
+inference there are no optimizer states and gradients, so we can subtract those. And thus we end up with 6 bytes per
+model parameter for mixed precision inference, plus activation memory.
+
+Let's look at the details.
+
+**Model Weights:**
+
+- 4 bytes * number of parameters for fp32 training
+- 6 bytes * number of parameters for mixed precision training (maintains a model in fp32 and one in fp16 in memory)
+
+**Optimizer States:**
+
+- 8 bytes * number of parameters for normal AdamW (maintains 2 states)
+- 2 bytes * number of parameters for 8-bit AdamW optimizers like [bitsandbytes](https://github.com/bitsandbytes-foundation/bitsandbytes)
+- 4 bytes * number of parameters for optimizers like SGD with momentum (maintains only 1 state)
+
+**Gradients**
+
+- 4 bytes * number of parameters for either fp32 or mixed precision training (gradients are always kept in fp32)
+
+**Forward Activations**
+
+- size depends on many factors, the key ones being sequence length, hidden size and batch size.
+
+There are the input and output that are being passed and returned by the forward and the backward functions and the
+forward activations saved for gradient computation.
+
+**Temporary Memory**
+
+Additionally, there are all kinds of temporary variables which get released once the calculation is done, but in the
+moment these could require additional memory and could push to OOM. Therefore, when coding it's crucial to think
+strategically about such temporary variables and sometimes to explicitly free those as soon as they are no longer needed.
+
+**Functionality-specific memory**
+
+Then, your software could have special memory needs. For example, when generating text using beam search, the software
+needs to maintain multiple copies of inputs and outputs.
+
+**`forward` vs `backward` Execution Speed**
+
+For convolutions and linear layers there are 2x flops in the backward compared to the forward, which generally translates
+into ~2x slower (sometimes more, because sizes in the backward tend to be more awkward). Activations are usually
+bandwidth-limited, and itโs typical for an activation to have to read more data in the backward than in the forward
+(e.g. activation forward reads once, writes once, activation backward reads twice, gradOutput and output of the forward,
+and writes once, gradInput).
+
+As you can see, there are potentially a few places where we could save GPU memory or speed up operations.
+Now that you understand what affects GPU utilization and computation speed, refer to
+the [Methods and tools for efficient training on a single GPU](perf_train_gpu_one) documentation page to learn about
+performance optimization techniques.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_sharing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_sharing.md
new file mode 100644
index 0000000000000000000000000000000000000000..076fc2ccdd571a70dbc68eb96b5a44897a0760da
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_sharing.md
@@ -0,0 +1,232 @@
+
+
+# Share a model
+
+The last two tutorials showed how you can fine-tune a model with PyTorch, Keras, and ๐ค Accelerate for distributed setups. The next step is to share your model with the community! At Hugging Face, we believe in openly sharing knowledge and resources to democratize artificial intelligence for everyone. We encourage you to consider sharing your model with the community to help others save time and resources.
+
+In this tutorial, you will learn two methods for sharing a trained or fine-tuned model on the [Model Hub](https://huggingface.co/models):
+
+- Programmatically push your files to the Hub.
+- Drag-and-drop your files to the Hub with the web interface.
+
+VIDEO
+
+
+
+To share a model with the community, you need an account on [huggingface.co](https://huggingface.co/join). You can also join an existing organization or create a new one.
+
+
+
+## Repository features
+
+Each repository on the Model Hub behaves like a typical GitHub repository. Our repositories offer versioning, commit history, and the ability to visualize differences.
+
+The Model Hub's built-in versioning is based on git and [git-lfs](https://git-lfs.github.com/). In other words, you can treat one model as one repository, enabling greater access control and scalability. Version control allows *revisions*, a method for pinning a specific version of a model with a commit hash, tag or branch.
+
+As a result, you can load a specific model version with the `revision` parameter:
+
+```py
+>>> model = AutoModel.from_pretrained(
+... "julien-c/EsperBERTo-small", revision="4c77982" # tag name, or branch name, or commit hash
+... )
+```
+
+Files are also easily edited in a repository, and you can view the commit history as well as the differences:
+
+
+
+## Setup
+
+Before sharing a model to the Hub, you will need your Hugging Face credentials. If you have access to a terminal, run the following command in the virtual environment where ๐ค Transformers is installed. This will store your access token in your Hugging Face cache folder (`~/.cache/` by default):
+
+```bash
+huggingface-cli login
+```
+
+If you are using a notebook like Jupyter or Colaboratory, make sure you have the [`huggingface_hub`](https://huggingface.co/docs/hub/adding-a-library) library installed. This library allows you to programmatically interact with the Hub.
+
+```bash
+pip install huggingface_hub
+```
+
+Then use `notebook_login` to sign-in to the Hub, and follow the link [here](https://huggingface.co/settings/token) to generate a token to login with:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Convert a model for all frameworks
+
+To ensure your model can be used by someone working with a different framework, we recommend you convert and upload your model with both PyTorch and TensorFlow checkpoints. While users are still able to load your model from a different framework if you skip this step, it will be slower because ๐ค Transformers will need to convert the checkpoint on-the-fly.
+
+Converting a checkpoint for another framework is easy. Make sure you have PyTorch and TensorFlow installed (see [here](installation) for installation instructions), and then find the specific model for your task in the other framework.
+
+
+
+Specify `from_tf=True` to convert a checkpoint from TensorFlow to PyTorch:
+
+```py
+>>> pt_model = DistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_tf=True)
+>>> pt_model.save_pretrained("path/to/awesome-name-you-picked")
+```
+
+
+Specify `from_pt=True` to convert a checkpoint from PyTorch to TensorFlow:
+
+```py
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_pt=True)
+```
+
+Then you can save your new TensorFlow model with its new checkpoint:
+
+```py
+>>> tf_model.save_pretrained("path/to/awesome-name-you-picked")
+```
+
+
+If a model is available in Flax, you can also convert a checkpoint from PyTorch to Flax:
+
+```py
+>>> flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
+... "path/to/awesome-name-you-picked", from_pt=True
+... )
+```
+
+
+
+## Push a model during training
+
+
+
+
+
+Sharing a model to the Hub is as simple as adding an extra parameter or callback. Remember from the [fine-tuning tutorial](training), the [`TrainingArguments`] class is where you specify hyperparameters and additional training options. One of these training options includes the ability to push a model directly to the Hub. Set `push_to_hub=True` in your [`TrainingArguments`]:
+
+```py
+>>> training_args = TrainingArguments(output_dir="my-awesome-model", push_to_hub=True)
+```
+
+Pass your training arguments as usual to [`Trainer`]:
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+After you fine-tune your model, call [`~transformers.Trainer.push_to_hub`] on [`Trainer`] to push the trained model to the Hub. ๐ค Transformers will even automatically add training hyperparameters, training results and framework versions to your model card!
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+Share a model to the Hub with [`PushToHubCallback`]. In the [`PushToHubCallback`] function, add:
+
+- An output directory for your model.
+- A tokenizer.
+- The `hub_model_id`, which is your Hub username and model name.
+
+```py
+>>> from transformers import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="./your_model_save_path", tokenizer=tokenizer, hub_model_id="your-username/my-awesome-model"
+... )
+```
+
+Add the callback to [`fit`](https://keras.io/api/models/model_training_apis/), and ๐ค Transformers will push the trained model to the Hub:
+
+```py
+>>> model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3, callbacks=push_to_hub_callback)
+```
+
+
+
+## Use the `push_to_hub` function
+
+You can also call `push_to_hub` directly on your model to upload it to the Hub.
+
+Specify your model name in `push_to_hub`:
+
+```py
+>>> pt_model.push_to_hub("my-awesome-model")
+```
+
+This creates a repository under your username with the model name `my-awesome-model`. Users can now load your model with the `from_pretrained` function:
+
+```py
+>>> from transformers import AutoModel
+
+>>> model = AutoModel.from_pretrained("your_username/my-awesome-model")
+```
+
+If you belong to an organization and want to push your model under the organization name instead, just add it to the `repo_id`:
+
+```py
+>>> pt_model.push_to_hub("my-awesome-org/my-awesome-model")
+```
+
+The `push_to_hub` function can also be used to add other files to a model repository. For example, add a tokenizer to a model repository:
+
+```py
+>>> tokenizer.push_to_hub("my-awesome-model")
+```
+
+Or perhaps you'd like to add the TensorFlow version of your fine-tuned PyTorch model:
+
+```py
+>>> tf_model.push_to_hub("my-awesome-model")
+```
+
+Now when you navigate to your Hugging Face profile, you should see your newly created model repository. Clicking on the **Files** tab will display all the files you've uploaded to the repository.
+
+For more details on how to create and upload files to a repository, refer to the Hub documentation [here](https://huggingface.co/docs/hub/how-to-upstream).
+
+## Upload with the web interface
+
+Users who prefer a no-code approach are able to upload a model through the Hub's web interface. Visit [huggingface.co/new](https://huggingface.co/new) to create a new repository:
+
+
+
+From here, add some information about your model:
+
+- Select the **owner** of the repository. This can be yourself or any of the organizations you belong to.
+- Pick a name for your model, which will also be the repository name.
+- Choose whether your model is public or private.
+- Specify the license usage for your model.
+
+Now click on the **Files** tab and click on the **Add file** button to upload a new file to your repository. Then drag-and-drop a file to upload and add a commit message.
+
+
+
+## Add a model card
+
+To make sure users understand your model's capabilities, limitations, potential biases and ethical considerations, please add a model card to your repository. The model card is defined in the `README.md` file. You can add a model card by:
+
+* Manually creating and uploading a `README.md` file.
+* Clicking on the **Edit model card** button in your model repository.
+
+Take a look at the DistilBert [model card](https://huggingface.co/distilbert/distilbert-base-uncased) for a good example of the type of information a model card should include. For more details about other options you can control in the `README.md` file such as a model's carbon footprint or widget examples, refer to the documentation [here](https://huggingface.co/docs/hub/models-cards).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..c7efc4c00d9bd7d2a4c366197e3324bd7cd81a47
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/model_summary.md
@@ -0,0 +1,107 @@
+
+
+# The Transformer model family
+
+Since its introduction in 2017, the [original Transformer](https://arxiv.org/abs/1706.03762) model (see the [Annotated Transformer](http://nlp.seas.harvard.edu/2018/04/03/attention.html) blog post for a gentle technical introduction) has inspired many new and exciting models that extend beyond natural language processing (NLP) tasks. There are models for [predicting the folded structure of proteins](https://huggingface.co/blog/deep-learning-with-proteins), [training a cheetah to run](https://huggingface.co/blog/train-decision-transformers), and [time series forecasting](https://huggingface.co/blog/time-series-transformers). With so many Transformer variants available, it can be easy to miss the bigger picture. What all these models have in common is they're based on the original Transformer architecture. Some models only use the encoder or decoder, while others use both. This provides a useful taxonomy to categorize and examine the high-level differences within models in the Transformer family, and it'll help you understand Transformers you haven't encountered before.
+
+If you aren't familiar with the original Transformer model or need a refresher, check out the [How do Transformers work](https://huggingface.co/course/chapter1/4?fw=pt) chapter from the Hugging Face course.
+
+
+ VIDEO
+
+
+## Computer vision
+
+
+
+### Convolutional network
+
+For a long time, convolutional networks (CNNs) were the dominant paradigm for computer vision tasks until the [Vision Transformer](https://arxiv.org/abs/2010.11929) demonstrated its scalability and efficiency. Even then, some of a CNN's best qualities, like translation invariance, are so powerful (especially for certain tasks) that some Transformers incorporate convolutions in their architecture. [ConvNeXt](model_doc/convnext) flipped this exchange around and incorporated design choices from Transformers to modernize a CNN. For example, ConvNeXt uses non-overlapping sliding windows to patchify an image and a larger kernel to increase its global receptive field. ConvNeXt also makes several layer design choices to be more memory-efficient and improve performance, so it competes favorably with Transformers!
+
+### Encoder[[cv-encoder]]
+
+The [Vision Transformer (ViT)](model_doc/vit) opened the door to computer vision tasks without convolutions. ViT uses a standard Transformer encoder, but its main breakthrough was how it treated an image. It splits an image into fixed-size patches and uses them to create an embedding, just like how a sentence is split into tokens. ViT capitalized on the Transformers' efficient architecture to demonstrate competitive results with the CNNs at the time while requiring fewer resources to train. ViT was soon followed by other vision models that could also handle dense vision tasks like segmentation as well as detection.
+
+One of these models is the [Swin](model_doc/swin) Transformer. It builds hierarchical feature maps (like a CNN ๐ and unlike ViT) from smaller-sized patches and merges them with neighboring patches in deeper layers. Attention is only computed within a local window, and the window is shifted between attention layers to create connections to help the model learn better. Since the Swin Transformer can produce hierarchical feature maps, it is a good candidate for dense prediction tasks like segmentation and detection. The [SegFormer](model_doc/segformer) also uses a Transformer encoder to build hierarchical feature maps, but it adds a simple multilayer perceptron (MLP) decoder on top to combine all the feature maps and make a prediction.
+
+Other vision models, like BeIT and ViTMAE, drew inspiration from BERT's pretraining objective. [BeIT](model_doc/beit) is pretrained by *masked image modeling (MIM)*; the image patches are randomly masked, and the image is also tokenized into visual tokens. BeIT is trained to predict the visual tokens corresponding to the masked patches. [ViTMAE](model_doc/vitmae) has a similar pretraining objective, except it must predict the pixels instead of visual tokens. What's unusual is 75% of the image patches are masked! The decoder reconstructs the pixels from the masked tokens and encoded patches. After pretraining, the decoder is thrown away, and the encoder is ready to be used in downstream tasks.
+
+### Decoder[[cv-decoder]]
+
+Decoder-only vision models are rare because most vision models rely on an encoder to learn an image representation. But for use cases like image generation, the decoder is a natural fit, as we've seen from text generation models like GPT-2. [ImageGPT](model_doc/imagegpt) uses the same architecture as GPT-2, but instead of predicting the next token in a sequence, it predicts the next pixel in an image. In addition to image generation, ImageGPT could also be finetuned for image classification.
+
+### Encoder-decoder[[cv-encoder-decoder]]
+
+Vision models commonly use an encoder (also known as a backbone) to extract important image features before passing them to a Transformer decoder. [DETR](model_doc/detr) has a pretrained backbone, but it also uses the complete Transformer encoder-decoder architecture for object detection. The encoder learns image representations and combines them with object queries (each object query is a learned embedding that focuses on a region or object in an image) in the decoder. DETR predicts the bounding box coordinates and class label for each object query.
+
+## Natural language processing
+
+
+
+### Encoder[[nlp-encoder]]
+
+[BERT](model_doc/bert) is an encoder-only Transformer that randomly masks certain tokens in the input to avoid seeing other tokens, which would allow it to "cheat". The pretraining objective is to predict the masked token based on the context. This allows BERT to fully use the left and right contexts to help it learn a deeper and richer representation of the inputs. However, there was still room for improvement in BERT's pretraining strategy. [RoBERTa](model_doc/roberta) improved upon this by introducing a new pretraining recipe that includes training for longer and on larger batches, randomly masking tokens at each epoch instead of just once during preprocessing, and removing the next-sentence prediction objective.
+
+The dominant strategy to improve performance is to increase the model size. But training large models is computationally expensive. One way to reduce computational costs is using a smaller model like [DistilBERT](model_doc/distilbert). DistilBERT uses [knowledge distillation](https://arxiv.org/abs/1503.02531) - a compression technique - to create a smaller version of BERT while keeping nearly all of its language understanding capabilities.
+
+However, most Transformer models continued to trend towards more parameters, leading to new models focused on improving training efficiency. [ALBERT](model_doc/albert) reduces memory consumption by lowering the number of parameters in two ways: separating the larger vocabulary embedding into two smaller matrices and allowing layers to share parameters. [DeBERTa](model_doc/deberta) added a disentangled attention mechanism where the word and its position are separately encoded in two vectors. The attention is computed from these separate vectors instead of a single vector containing the word and position embeddings. [Longformer](model_doc/longformer) also focused on making attention more efficient, especially for processing documents with longer sequence lengths. It uses a combination of local windowed attention (attention only calculated from fixed window size around each token) and global attention (only for specific task tokens like `[CLS]` for classification) to create a sparse attention matrix instead of a full attention matrix.
+
+### Decoder[[nlp-decoder]]
+
+[GPT-2](model_doc/gpt2) is a decoder-only Transformer that predicts the next word in the sequence. It masks tokens to the right so the model can't "cheat" by looking ahead. By pretraining on a massive body of text, GPT-2 became really good at generating text, even if the text is only sometimes accurate or true. But GPT-2 lacked the bidirectional context from BERT's pretraining, which made it unsuitable for certain tasks. [XLNET](model_doc/xlnet) combines the best of both BERT and GPT-2's pretraining objectives by using a permutation language modeling objective (PLM) that allows it to learn bidirectionally.
+
+After GPT-2, language models grew even bigger and are now known as *large language models (LLMs)*. LLMs demonstrate few- or even zero-shot learning if pretrained on a large enough dataset. [GPT-J](model_doc/gptj) is an LLM with 6B parameters and trained on 400B tokens. GPT-J was followed by [OPT](model_doc/opt), a family of decoder-only models, the largest of which is 175B and trained on 180B tokens. [BLOOM](model_doc/bloom) was released around the same time, and the largest model in the family has 176B parameters and is trained on 366B tokens in 46 languages and 13 programming languages.
+
+### Encoder-decoder[[nlp-encoder-decoder]]
+
+[BART](model_doc/bart) keeps the original Transformer architecture, but it modifies the pretraining objective with *text infilling* corruption, where some text spans are replaced with a single `mask` token. The decoder predicts the uncorrupted tokens (future tokens are masked) and uses the encoder's hidden states to help it. [Pegasus](model_doc/pegasus) is similar to BART, but Pegasus masks entire sentences instead of text spans. In addition to masked language modeling, Pegasus is pretrained by gap sentence generation (GSG). The GSG objective masks whole sentences important to a document, replacing them with a `mask` token. The decoder must generate the output from the remaining sentences. [T5](model_doc/t5) is a more unique model that casts all NLP tasks into a text-to-text problem using specific prefixes. For example, the prefix `Summarize:` indicates a summarization task. T5 is pretrained by supervised (GLUE and SuperGLUE) training and self-supervised training (randomly sample and drop out 15% of tokens).
+
+## Audio
+
+
+
+### Encoder[[audio-encoder]]
+
+[Wav2Vec2](model_doc/wav2vec2) uses a Transformer encoder to learn speech representations directly from raw audio waveforms. It is pretrained with a contrastive task to determine the true speech representation from a set of false ones. [HuBERT](model_doc/hubert) is similar to Wav2Vec2 but has a different training process. Target labels are created by a clustering step in which segments of similar audio are assigned to a cluster which becomes a hidden unit. The hidden unit is mapped to an embedding to make a prediction.
+
+### Encoder-decoder[[audio-encoder-decoder]]
+
+[Speech2Text](model_doc/speech_to_text) is a speech model designed for automatic speech recognition (ASR) and speech translation. The model accepts log mel-filter bank features extracted from the audio waveform and pretrained autoregressively to generate a transcript or translation. [Whisper](model_doc/whisper) is also an ASR model, but unlike many other speech models, it is pretrained on a massive amount of โจ labeled โจ audio transcription data for zero-shot performance. A large chunk of the dataset also contains non-English languages, meaning Whisper can also be used for low-resource languages. Structurally, Whisper is similar to Speech2Text. The audio signal is converted to a log-mel spectrogram encoded by the encoder. The decoder generates the transcript autoregressively from the encoder's hidden states and the previous tokens.
+
+## Multimodal
+
+
+
+### Encoder[[mm-encoder]]
+
+[VisualBERT](model_doc/visual_bert) is a multimodal model for vision-language tasks released shortly after BERT. It combines BERT and a pretrained object detection system to extract image features into visual embeddings, passed alongside text embeddings to BERT. VisualBERT predicts the masked text based on the unmasked text and the visual embeddings, and it also has to predict whether the text is aligned with the image. When ViT was released, [ViLT](model_doc/vilt) adopted ViT in its architecture because it was easier to get the image embeddings this way. The image embeddings are jointly processed with the text embeddings. From there, ViLT is pretrained by image text matching, masked language modeling, and whole word masking.
+
+[CLIP](model_doc/clip) takes a different approach and makes a pair prediction of (`image`, `text`) . An image encoder (ViT) and a text encoder (Transformer) are jointly trained on a 400 million (`image`, `text`) pair dataset to maximize the similarity between the image and text embeddings of the (`image`, `text`) pairs. After pretraining, you can use natural language to instruct CLIP to predict the text given an image or vice versa. [OWL-ViT](model_doc/owlvit) builds on top of CLIP by using it as its backbone for zero-shot object detection. After pretraining, an object detection head is added to make a set prediction over the (`class`, `bounding box`) pairs.
+
+### Encoder-decoder[[mm-encoder-decoder]]
+
+Optical character recognition (OCR) is a long-standing text recognition task that typically involves several components to understand the image and generate the text. [TrOCR](model_doc/trocr) simplifies the process using an end-to-end Transformer. The encoder is a ViT-style model for image understanding and processes the image as fixed-size patches. The decoder accepts the encoder's hidden states and autoregressively generates text. [Donut](model_doc/donut) is a more general visual document understanding model that doesn't rely on OCR-based approaches. It uses a Swin Transformer as the encoder and multilingual BART as the decoder. Donut is pretrained to read text by predicting the next word based on the image and text annotations. The decoder generates a token sequence given a prompt. The prompt is represented by a special token for each downstream task. For example, document parsing has a special `parsing` token that is combined with the encoder hidden states to parse the document into a structured output format (JSON).
+
+## Reinforcement learning
+
+
+
+### Decoder[[rl-decoder]]
+
+The Decision and Trajectory Transformer casts the state, action, and reward as a sequence modeling problem. The [Decision Transformer](model_doc/decision_transformer) generates a series of actions that lead to a future desired return based on returns-to-go, past states, and actions. For the last *K* timesteps, each of the three modalities are converted into token embeddings and processed by a GPT-like model to predict a future action token. [Trajectory Transformer](model_doc/trajectory_transformer) also tokenizes the states, actions, and rewards and processes them with a GPT architecture. Unlike the Decision Transformer, which is focused on reward conditioning, the Trajectory Transformer generates future actions with beam search.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/modular_transformers.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/modular_transformers.md
new file mode 100644
index 0000000000000000000000000000000000000000..8eebbf347c11c33071b39859ea4a2c2bf39bbe19
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/modular_transformers.md
@@ -0,0 +1,210 @@
+# Modular transformers
+
+`transformers` is an opinionated framework; our philosophy is defined in the following [conceptual guide](./philosophy).
+
+The core of that philosophy is exemplified by the [single model, single file](https://huggingface.co/blog/transformers-design-philosophy)
+aspect of the library. This component's downside is that it limits the inheritance and importability of components from
+files to others in the toolkit.
+
+As a result, model components tend to be repeated across many files. There are as many attention layers defined
+in `transformers` as there are models, and a significant number of those are identical to each other.
+The unfortunate consequence is that independent implementations tend to diverge as fixes and changes get applied
+to specific parts of the code.
+
+In order to balance this issue, we introduced the concept of "copies" across the library. By adding a comment indicating
+that code is a copy of another, we can enforce through CI and local commands that copies do not diverge. However,
+while the complexity is low, this is often quite tedious to do.
+
+And, finally, this contributes to adding a significant overhead to contributing models which we would like to remove.
+This approach often requires model contributions to add modeling code (~1k lines), processor (~500 lines), tests, docs,
+etc. Model contribution PRs rarely add less than 3-5k lines of code, with much of this code being boilerplate.
+
+This raises the bar for contributions, and with Modular Transformers, we're aiming to lower the bar to a much more
+acceptable point.
+
+If you plan to add a model to `transformers` make sure you read [How to add a model to ๐ค Transformers?](https://huggingface.co/docs/transformers/add_new_model).
+For any kind of contributions, see [CONTRIBUTING.md](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md).
+
+## What is it?
+
+Modular Transformers introduces the concept of a "modular" file to a model folder. This modular file accepts code
+that isn't typically accepted in modeling/processing files, as it allows importing from neighbouring models as well
+as inheritance from classes to others.
+
+This modular file defines models, processors, and the configuration class that would otherwise be defined in their
+respective modules.
+
+Finally, this feature introduces a new `linter` which will "unravel" the modular file into the "single model, single
+file" directory structure. These files will get auto-generated every time the script is run; reducing the required
+contributions to the modular file, and therefore only to the changes between the contributed model and others.
+
+Model users will end up importing and using the single-file interface, so no change is expected here. Doing this, we
+hope to combine the best of both worlds: enabling simple contributions while sticking to our philosophy.
+
+This is therefore a replacement for the `# Copied from` markers, and previously contributed models can be expected to
+be moved to the new Modular Transformers format in the coming months.
+
+### Details
+
+To generate a single file from the modular file, run the following command.
+
+```bash
+python utils/modular_model_converter.py --files-to-parse src/transformers/models//modular_.py
+```
+
+The "linter", which unravels the inheritance and creates all single-files from the modular file, will flatten the
+inheritance while trying to be invisible to Python users. At this time, the linter flattens a **single** level of
+inheritance.
+
+For example:
+- If a configuration class inherits from another and adds/deletes an argument, the generated file will either directly
+ reference it (in case of addition) or completely remove it (in case of deletion).
+- If a class inherits from another, for example: class GemmaModel(LlamaModel):, dependencies are automatically
+ inferred. All submodules will be automatically inferred from the superclass.
+- If you define new functions in the `modular` and use them inside classes, the linter will automatically infer the
+
+You should be able to write everything (the tokenizer, the image processor, the model, the config) in this `modular`
+file, and the corresponding files will be created for you.
+
+### Enforcement
+
+Run the command below to ensure the generated content matches `modular_.py`
+
+```bash
+python utils/check_modular_conversion.py --files src/transformers/models//modular_.py
+```
+
+### Examples
+
+Here is a quick example with BERT and RoBERTa. The two models are intimately related: their modeling implementation
+differs solely by a change in the embedding layer.
+
+Instead of redefining the model entirely, here is what the `modular_roberta.py` file looks like for the modeling &
+configuration classes (for the sake of the example, the tokenizer is ignored at this time as very different).
+
+```python
+from torch import nn
+from ..bert.configuration_bert import BertConfig
+from ..bert.modeling_bert import (
+ BertModel,
+ BertEmbeddings,
+ BertForMaskedLM
+)
+
+# The RoBERTa config is identical to BERT's config
+class RobertaConfig(BertConfig):
+ model_type = 'roberta'
+
+# We redefine the embeddings here to highlight the padding ID difference, and we redefine the position embeddings
+class RobertaEmbeddings(BertEmbeddings):
+ def __init__(self, config):
+ super().__init__(config())
+
+ self.padding_idx = config.pad_token_id
+ self.position_embeddings = nn.Embedding(
+ config.max_position_embeddings, config.hidden_size, padding_idx=self.padding_idx
+ )
+
+# The RoBERTa model is identical to the BERT model, except for the embedding layer.
+# We redefine the embeddings above, so here there is no need to do additional work
+class RobertaModel(BertModel):
+ def __init__(self, config):
+ super().__init__(config)
+ self.embeddings = RobertaEmbeddings(config)
+
+
+# The heads now only need to redefine the model inside to the correct `RobertaModel`
+class RobertaForMaskedLM(BertForMaskedLM):
+ def __init__(self, config):
+ super().__init__(config)
+ self.model = RobertaModel(config)
+```
+
+Note that if you do not use the dependency that you defined, you will have the following error:
+
+```bash
+ValueError: You defined `RobertaEmbeddings` in the modular_roberta.py, it should be used
+ when you define `BertModel`, as it is one of it's direct dependencies. Make sure
+ you use it in the `__init__` function.
+```
+
+Additionally, you may find a list of examples here:
+
+## What it is not
+
+It is not a replacement for the modeling code (yet?), and if your model is not based on anything else that ever existed, then you can add a `modeling` file as usual.
+
+
+## Advanced usage
+
+### Removing attributes and functions
+To remove attributes that are not used in your modular model, and that you don't want to see in the unravelled modeling:
+
+```python
+class GemmaModel(LlamaModel): | class GemmaModel(PreTrainedModel):
+ def __init__(self, config): | def __init__(self, config):
+ super().__init__(self, eos_token) | super().__init__(config)
+ del self.embed_tokens | self.padding_idx = config.pad_token_id
+ | self.vocab_size = config.vocab_size
+ |
+ | self.layers = nn.ModuleList(
+ | [LlamaDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
+ | )
+ | self.norm = LlamaRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
+ | self.rotary_emb = LlamaRotaryEmbedding(config=config)
+ | self.gradient_checkpointing = False
+ |
+ | # Initialize weights and apply final processing
+ | self.post_init()
+```
+If you check the original `LlamaModel`, it has a `embed_tokens` which was removed here (as you would expect!)
+
+Removing a function is pretty similar, you just need to write it with a `raise ValueError("")` to mimick the behaviour you actually want when you remove a parent function in python.
+
+```python
+class GemmaTokenizer(LlamaTokenizer):
+ ...
+
+ def get_spm_processor(self):
+ raise AttributeError("Not needed for Gemma")
+
+ def unk_token_length(self):
+ raise AttributeError("Not needed for Gemma")
+```
+
+### Define new functions
+
+If you define a new function in the `modular` file to be used inside a class, say
+
+```python
+def my_new_function(*args, **kwargs):
+ # Do something here
+ pass
+
+class GemmaModel(LlamaModel):
+ def forward(*args, **kwargs):
+ # Call the function
+ example = my_new_function(*args, **kwargs)
+ # continue here
+```
+
+the `my_new_function` function (and, recursively, any other new functions called in its body) will be automatically copy-pasted
+in the file where it is used.
+
+### Calling `super()`
+We recently shipped a few features that allow you to go from:
+```python
+class GemmaTokenizer(LlamaTokenizer, PretrainedTokenizerFast): | class GemmaModel(nn.Module):
+ def __init__(self, eos_token=""): | def __init__(self):
+ eos_token = AddedToken(eos_token) | eos_token = AddedToken(eos_token)
+ PretrainedTokenizerFast.__init__(self, eos_token) | super().__init__(eos_token)
+```
+This is useful want you **don't** want to unravel the call to `super()`, and you want to differentiate which super init call you are doing!
+
+### Special naming
+We now also support special cases like
+```python
+class GemmaVisionModel(CLIPModel):
+ pass
+```
+where the name of your class `GemmaVision` is not the same as the modular `Gemma`. This is super useful for composite models.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/multilingual.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/multilingual.md
new file mode 100644
index 0000000000000000000000000000000000000000..30a63eea28c8c7fc3605f51fffe47d2f547b4bde
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/multilingual.md
@@ -0,0 +1,179 @@
+
+
+# Multilingual models for inference
+
+[[open-in-colab]]
+
+There are several multilingual models in ๐ค Transformers, and their inference usage differs from monolingual models. Not *all* multilingual model usage is different though. Some models, like [google-bert/bert-base-multilingual-uncased](https://huggingface.co/google-bert/bert-base-multilingual-uncased), can be used just like a monolingual model. This guide will show you how to use multilingual models whose usage differs for inference.
+
+## XLM
+
+XLM has ten different checkpoints, only one of which is monolingual. The nine remaining model checkpoints can be split into two categories: the checkpoints that use language embeddings and those that don't.
+
+### XLM with language embeddings
+
+The following XLM models use language embeddings to specify the language used at inference:
+
+- `FacebookAI/xlm-mlm-ende-1024` (Masked language modeling, English-German)
+- `FacebookAI/xlm-mlm-enfr-1024` (Masked language modeling, English-French)
+- `FacebookAI/xlm-mlm-enro-1024` (Masked language modeling, English-Romanian)
+- `FacebookAI/xlm-mlm-xnli15-1024` (Masked language modeling, XNLI languages)
+- `FacebookAI/xlm-mlm-tlm-xnli15-1024` (Masked language modeling + translation, XNLI languages)
+- `FacebookAI/xlm-clm-enfr-1024` (Causal language modeling, English-French)
+- `FacebookAI/xlm-clm-ende-1024` (Causal language modeling, English-German)
+
+Language embeddings are represented as a tensor of the same shape as the `input_ids` passed to the model. The values in these tensors depend on the language used and are identified by the tokenizer's `lang2id` and `id2lang` attributes.
+
+In this example, load the `FacebookAI/xlm-clm-enfr-1024` checkpoint (Causal language modeling, English-French):
+
+```py
+>>> import torch
+>>> from transformers import XLMTokenizer, XLMWithLMHeadModel
+
+>>> tokenizer = XLMTokenizer.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+>>> model = XLMWithLMHeadModel.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+```
+
+The `lang2id` attribute of the tokenizer displays this model's languages and their ids:
+
+```py
+>>> print(tokenizer.lang2id)
+{'en': 0, 'fr': 1}
+```
+
+Next, create an example input:
+
+```py
+>>> input_ids = torch.tensor([tokenizer.encode("Wikipedia was used to")]) # batch size of 1
+```
+
+Set the language id as `"en"` and use it to define the language embedding. The language embedding is a tensor filled with `0` since that is the language id for English. This tensor should be the same size as `input_ids`.
+
+```py
+>>> language_id = tokenizer.lang2id["en"] # 0
+>>> langs = torch.tensor([language_id] * input_ids.shape[1]) # torch.tensor([0, 0, 0, ..., 0])
+
+>>> # We reshape it to be of size (batch_size, sequence_length)
+>>> langs = langs.view(1, -1) # is now of shape [1, sequence_length] (we have a batch size of 1)
+```
+
+Now you can pass the `input_ids` and language embedding to the model:
+
+```py
+>>> outputs = model(input_ids, langs=langs)
+```
+
+The [run_generation.py](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation/run_generation.py) script can generate text with language embeddings using the `xlm-clm` checkpoints.
+
+### XLM without language embeddings
+
+The following XLM models do not require language embeddings during inference:
+
+- `FacebookAI/xlm-mlm-17-1280` (Masked language modeling, 17 languages)
+- `FacebookAI/xlm-mlm-100-1280` (Masked language modeling, 100 languages)
+
+These models are used for generic sentence representations, unlike the previous XLM checkpoints.
+
+## BERT
+
+The following BERT models can be used for multilingual tasks:
+
+- `google-bert/bert-base-multilingual-uncased` (Masked language modeling + Next sentence prediction, 102 languages)
+- `google-bert/bert-base-multilingual-cased` (Masked language modeling + Next sentence prediction, 104 languages)
+
+These models do not require language embeddings during inference. They should identify the language from the
+context and infer accordingly.
+
+## XLM-RoBERTa
+
+The following XLM-RoBERTa models can be used for multilingual tasks:
+
+- `FacebookAI/xlm-roberta-base` (Masked language modeling, 100 languages)
+- `FacebookAI/xlm-roberta-large` (Masked language modeling, 100 languages)
+
+XLM-RoBERTa was trained on 2.5TB of newly created and cleaned CommonCrawl data in 100 languages. It provides strong gains over previously released multilingual models like mBERT or XLM on downstream tasks like classification, sequence labeling, and question answering.
+
+## M2M100
+
+The following M2M100 models can be used for multilingual translation:
+
+- `facebook/m2m100_418M` (Translation)
+- `facebook/m2m100_1.2B` (Translation)
+
+In this example, load the `facebook/m2m100_418M` checkpoint to translate from Chinese to English. You can set the source language in the tokenizer:
+
+```py
+>>> from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> chinese_text = "ไธ่ฆๆๆๅทซๅธซ็ไบๅ, ๅ ็บไปๅๆฏๅพฎๅฆ็, ๅพๅฟซๅฐฑๆ็ผๆ."
+
+>>> tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M", src_lang="zh")
+>>> model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
+```
+
+Tokenize the text:
+
+```py
+>>> encoded_zh = tokenizer(chinese_text, return_tensors="pt")
+```
+
+M2M100 forces the target language id as the first generated token to translate to the target language. Set the `forced_bos_token_id` to `en` in the `generate` method to translate to English:
+
+```py
+>>> generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id("en"))
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+'Do not interfere with the matters of the witches, because they are delicate and will soon be angry.'
+```
+
+## MBart
+
+The following MBart models can be used for multilingual translation:
+
+- `facebook/mbart-large-50-one-to-many-mmt` (One-to-many multilingual machine translation, 50 languages)
+- `facebook/mbart-large-50-many-to-many-mmt` (Many-to-many multilingual machine translation, 50 languages)
+- `facebook/mbart-large-50-many-to-one-mmt` (Many-to-one multilingual machine translation, 50 languages)
+- `facebook/mbart-large-50` (Multilingual translation, 50 languages)
+- `facebook/mbart-large-cc25`
+
+In this example, load the `facebook/mbart-large-50-many-to-many-mmt` checkpoint to translate Finnish to English. You can set the source language in the tokenizer:
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> fi_text = "รlรค sekaannu velhojen asioihin, sillรค ne ovat hienovaraisia ja nopeasti vihaisia."
+
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/mbart-large-50-many-to-many-mmt", src_lang="fi_FI")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
+```
+
+Tokenize the text:
+
+```py
+>>> encoded_en = tokenizer(en_text, return_tensors="pt")
+```
+
+MBart forces the target language id as the first generated token to translate to the target language. Set the `forced_bos_token_id` to `en` in the `generate` method to translate to English:
+
+```py
+>>> generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id["en_XX"])
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+"Don't interfere with the wizard's affairs, because they are subtle, will soon get angry."
+```
+
+If you are using the `facebook/mbart-large-50-many-to-one-mmt` checkpoint, you don't need to force the target language id as the first generated token otherwise the usage is the same.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/notebooks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/notebooks.md
new file mode 100644
index 0000000000000000000000000000000000000000..e701ca0a8887deffd9bedcd1e7c86afd490e8120
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/notebooks.md
@@ -0,0 +1,154 @@
+
+
+# ๐ค Transformers Notebooks
+
+You can find here a list of the official notebooks provided by Hugging Face.
+
+Also, we would like to list here interesting content created by the community.
+If you wrote some notebook(s) leveraging ๐ค Transformers and would like to be listed here, please open a
+Pull Request so it can be included under the Community notebooks.
+
+
+## Hugging Face's notebooks ๐ค
+
+### Documentation notebooks
+
+You can open any page of the documentation as a notebook in Colab (there is a button directly on said pages) but they are also listed here if you need them:
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [Quicktour of the library](https://github.com/huggingface/notebooks/blob/main/transformers_doc/en/quicktour.ipynb) | A presentation of the various APIs in Transformers |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/quicktour.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/en/transformers_doc/quicktour.ipynb)|
+| [Summary of the tasks](https://github.com/huggingface/notebooks/blob/main/transformers_doc/en/task_summary.ipynb) | How to run the models of the Transformers library task by task |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/task_summary.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/task_summary.ipynb)|
+| [Preprocessing data](https://github.com/huggingface/notebooks/blob/main/transformers_doc/en/preprocessing.ipynb) | How to use a tokenizer to preprocess your data |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/preprocessing.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/preprocessing.ipynb)|
+| [Fine-tuning a pretrained model](https://github.com/huggingface/notebooks/blob/main/transformers_doc/en/training.ipynb) | How to use the Trainer to fine-tune a pretrained model |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/training.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/training.ipynb)|
+| [Summary of the tokenizers](https://github.com/huggingface/notebooks/blob/main/transformers_doc/en/tokenizer_summary.ipynb) | The differences between the tokenizers algorithm |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tokenizer_summary.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tokenizer_summary.ipynb)|
+| [Multilingual models](https://github.com/huggingface/notebooks/blob/main/transformers_doc/en/multilingual.ipynb) | How to use the multilingual models of the library |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/multilingual.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/multilingual.ipynb)|
+
+
+### PyTorch Examples
+
+#### Natural Language Processing[[pytorch-nlp]]
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [Train your tokenizer](https://github.com/huggingface/notebooks/blob/main/examples/tokenizer_training.ipynb) | How to train and use your very own tokenizer |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tokenizer_training.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/tokenizer_training.ipynb)|
+| [Train your language model](https://github.com/huggingface/notebooks/blob/main/examples/language_modeling_from_scratch.ipynb) | How to easily start using transformers |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling_from_scratch.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/language_modeling_from_scratch.ipynb)|
+| [How to fine-tune a model on text classification](https://github.com/huggingface/notebooks/blob/main/examples/text_classification.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on any GLUE task. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)|
+| [How to fine-tune a model on language modeling](https://github.com/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on a causal or masked LM task. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)|
+| [How to fine-tune a model on token classification](https://github.com/huggingface/notebooks/blob/main/examples/token_classification.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on a token classification task (NER, PoS). | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)|
+| [How to fine-tune a model on question answering](https://github.com/huggingface/notebooks/blob/main/examples/question_answering.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on SQUAD. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb)|
+| [How to fine-tune a model on multiple choice](https://github.com/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on SWAG. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb)|
+| [How to fine-tune a model on translation](https://github.com/huggingface/notebooks/blob/main/examples/translation.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on WMT. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/translation.ipynb)|
+| [How to fine-tune a model on summarization](https://github.com/huggingface/notebooks/blob/main/examples/summarization.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on XSUM. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/summarization.ipynb)|
+| [How to train a language model from scratch](https://github.com/huggingface/blog/blob/main/notebooks/01_how_to_train.ipynb)| Highlight all the steps to effectively train Transformer model on custom data | [](https://colab.research.google.com/github/huggingface/blog/blob/main/notebooks/01_how_to_train.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/blog/blob/main/notebooks/01_how_to_train.ipynb)|
+| [How to generate text](https://github.com/huggingface/blog/blob/main/notebooks/02_how_to_generate.ipynb)| How to use different decoding methods for language generation with transformers | [](https://colab.research.google.com/github/huggingface/blog/blob/main/notebooks/02_how_to_generate.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/blog/blob/main/notebooks/02_how_to_generate.ipynb)|
+| [How to generate text (with constraints)](https://github.com/huggingface/blog/blob/main/notebooks/53_constrained_beam_search.ipynb)| How to guide language generation with user-provided constraints | [](https://colab.research.google.com/github/huggingface/blog/blob/main/notebooks/53_constrained_beam_search.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/blog/blob/main/notebooks/53_constrained_beam_search.ipynb)|
+| [Reformer](https://github.com/huggingface/blog/blob/main/notebooks/03_reformer.ipynb)| How Reformer pushes the limits of language modeling | [](https://colab.research.google.com/github/patrickvonplaten/blog/blob/main/notebooks/03_reformer.ipynb)| [](https://studiolab.sagemaker.aws/import/github/patrickvonplaten/blog/blob/main/notebooks/03_reformer.ipynb)|
+
+#### Computer Vision[[pytorch-cv]]
+
+| Notebook | Description | | |
+|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------:|
+| [How to fine-tune a model on image classification (Torchvision)](https://github.com/huggingface/notebooks/blob/main/examples/image_classification.ipynb) | Show how to preprocess the data using Torchvision and fine-tune any pretrained Vision model on Image Classification | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)|
+| [How to fine-tune a model on image classification (Albumentations)](https://github.com/huggingface/notebooks/blob/main/examples/image_classification_albumentations.ipynb) | Show how to preprocess the data using Albumentations and fine-tune any pretrained Vision model on Image Classification | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification_albumentations.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/image_classification_albumentations.ipynb)|
+| [How to fine-tune a model on image classification (Kornia)](https://github.com/huggingface/notebooks/blob/main/examples/image_classification_kornia.ipynb) | Show how to preprocess the data using Kornia and fine-tune any pretrained Vision model on Image Classification | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification_kornia.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/image_classification_kornia.ipynb)|
+| [How to perform zero-shot object detection with OWL-ViT](https://github.com/huggingface/notebooks/blob/main/examples/zeroshot_object_detection_with_owlvit.ipynb) | Show how to perform zero-shot object detection on images with text queries | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/zeroshot_object_detection_with_owlvit.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/zeroshot_object_detection_with_owlvit.ipynb)|
+| [How to fine-tune an image captioning model](https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_blip.ipynb) | Show how to fine-tune BLIP for image captioning on a custom dataset | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_captioning_blip.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/image_captioning_blip.ipynb)|
+| [How to build an image similarity system with Transformers](https://github.com/huggingface/notebooks/blob/main/examples/image_similarity.ipynb) | Show how to build an image similarity system | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_similarity.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/image_similarity.ipynb)|
+| [How to fine-tune a SegFormer model on semantic segmentation](https://github.com/huggingface/notebooks/blob/main/examples/semantic_segmentation.ipynb) | Show how to preprocess the data and fine-tune a pretrained SegFormer model on Semantic Segmentation | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/semantic_segmentation.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/semantic_segmentation.ipynb)|
+| [How to fine-tune a VideoMAE model on video classification](https://github.com/huggingface/notebooks/blob/main/examples/video_classification.ipynb) | Show how to preprocess the data and fine-tune a pretrained VideoMAE model on Video Classification | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/video_classification.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/video_classification.ipynb)|
+
+#### Audio[[pytorch-audio]]
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [How to fine-tune a speech recognition model in English](https://github.com/huggingface/notebooks/blob/main/examples/speech_recognition.ipynb)| Show how to preprocess the data and fine-tune a pretrained Speech model on TIMIT | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/speech_recognition.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/speech_recognition.ipynb)|
+| [How to fine-tune a speech recognition model in any language](https://github.com/huggingface/notebooks/blob/main/examples/multi_lingual_speech_recognition.ipynb)| Show how to preprocess the data and fine-tune a multi-lingually pretrained speech model on Common Voice | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multi_lingual_speech_recognition.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/multi_lingual_speech_recognition.ipynb)|
+| [How to fine-tune a model on audio classification](https://github.com/huggingface/notebooks/blob/main/examples/audio_classification.ipynb)| Show how to preprocess the data and fine-tune a pretrained Speech model on Keyword Spotting | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb)|
+
+#### Biological Sequences[[pytorch-bio]]
+
+| Notebook | Description | | |
+|:----------|:----------------------------------------------------------------------------------------|:-------------|------:|
+| [How to fine-tune a pre-trained protein model](https://github.com/huggingface/notebooks/blob/main/examples/protein_language_modeling.ipynb) | See how to tokenize proteins and fine-tune a large pre-trained protein "language" model | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/protein_language_modeling.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/protein_language_modeling.ipynb) |
+| [How to generate protein folds](https://github.com/huggingface/notebooks/blob/main/examples/protein_folding.ipynb) | See how to go from protein sequence to a full protein model and PDB file | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/protein_folding.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/protein_folding.ipynb) |
+| [How to fine-tune a Nucleotide Transformer model](https://github.com/huggingface/notebooks/blob/main/examples/nucleotide_transformer_dna_sequence_modelling.ipynb) | See how to tokenize DNA and fine-tune a large pre-trained DNA "language" model | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/nucleotide_transformer_dna_sequence_modelling.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/nucleotide_transformer_dna_sequence_modelling.ipynb) |
+| [Fine-tune a Nucleotide Transformer model with LoRA](https://github.com/huggingface/notebooks/blob/main/examples/nucleotide_transformer_dna_sequence_modelling_with_peft.ipynb) | Train even larger DNA models in a memory-efficient way | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/nucleotide_transformer_dna_sequence_modelling_with_peft.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/nucleotide_transformer_dna_sequence_modelling_with_peft.ipynb) |
+
+
+#### Other modalities[[pytorch-other]]
+
+| Notebook | Description | | |
+|:----------|:----------------------------------------------------------------------------------------|:-------------|------:|
+| [Probabilistic Time Series Forecasting](https://github.com/huggingface/notebooks/blob/main/examples/time-series-transformers.ipynb) | See how to train Time Series Transformer on a custom dataset | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/time-series-transformers.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/time-series-transformers.ipynb) |
+
+#### Utility notebooks[[pytorch-utility]]
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [How to export model to ONNX](https://github.com/huggingface/notebooks/blob/main/examples/onnx-export.ipynb)| Highlight how to export and run inference workloads through ONNX | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/onnx-export.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/onnx-export.ipynb)|
+| [How to use Benchmarks](https://github.com/huggingface/notebooks/blob/main/examples/benchmark.ipynb)| How to benchmark models with transformers | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/benchmark.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/benchmark.ipynb)|
+
+### TensorFlow Examples
+
+#### Natural Language Processing[[tensorflow-nlp]]
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [Train your tokenizer](https://github.com/huggingface/notebooks/blob/main/examples/tokenizer_training.ipynb) | How to train and use your very own tokenizer |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tokenizer_training.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/tokenizer_training.ipynb)|
+| [Train your language model](https://github.com/huggingface/notebooks/blob/main/examples/language_modeling_from_scratch-tf.ipynb) | How to easily start using transformers |[](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling_from_scratch-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/language_modeling_from_scratch-tf.ipynb)|
+| [How to fine-tune a model on text classification](https://github.com/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on any GLUE task. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)|
+| [How to fine-tune a model on language modeling](https://github.com/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on a causal or masked LM task. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)|
+| [How to fine-tune a model on token classification](https://github.com/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on a token classification task (NER, PoS). | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb)|
+| [How to fine-tune a model on question answering](https://github.com/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on SQUAD. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb)|
+| [How to fine-tune a model on multiple choice](https://github.com/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on SWAG. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb)|
+| [How to fine-tune a model on translation](https://github.com/huggingface/notebooks/blob/main/examples/translation-tf.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on WMT. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb)|
+| [How to fine-tune a model on summarization](https://github.com/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb)| Show how to preprocess the data and fine-tune a pretrained model on XSUM. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb)|
+
+#### Computer Vision[[tensorflow-cv]]
+
+| Notebook | Description | | |
+|:---------------------------------------------------------------------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------------|:-------------|------:|
+| [How to fine-tune a model on image classification](https://github.com/huggingface/notebooks/blob/main/examples/image_classification-tf.ipynb) | Show how to preprocess the data and fine-tune any pretrained Vision model on Image Classification | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/image_classification-tf.ipynb)|
+| [How to fine-tune a SegFormer model on semantic segmentation](https://github.com/huggingface/notebooks/blob/main/examples/semantic_segmentation-tf.ipynb) | Show how to preprocess the data and fine-tune a pretrained SegFormer model on Semantic Segmentation | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/semantic_segmentation-tf.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/semantic_segmentation-tf.ipynb)|
+
+#### Biological Sequences[[tensorflow-bio]]
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [How to fine-tune a pre-trained protein model](https://github.com/huggingface/notebooks/blob/main/examples/protein_language_modeling-tf.ipynb) | See how to tokenize proteins and fine-tune a large pre-trained protein "language" model | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/protein_language_modeling-tf.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/protein_language_modeling-tf.ipynb) |
+
+#### Utility notebooks[[tensorflow-utility]]
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [How to train TF/Keras models on TPU](https://github.com/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb) | See how to train at high speed on Google's TPU hardware | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb) | [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb) |
+
+### Optimum notebooks
+
+๐ค [Optimum](https://github.com/huggingface/optimum) is an extension of ๐ค Transformers, providing a set of performance optimization tools enabling maximum efficiency to train and run models on targeted hardwares.
+
+| Notebook | Description | | |
+|:----------|:-------------|:-------------|------:|
+| [How to quantize a model with ONNX Runtime for text classification](https://github.com/huggingface/notebooks/blob/main/examples/text_classification_quantization_ort.ipynb)| Show how to apply static and dynamic quantization on a model using [ONNX Runtime](https://github.com/microsoft/onnxruntime) for any GLUE task. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_quantization_ort.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/text_classification_quantization_ort.ipynb)|
+| [How to quantize a model with Intel Neural Compressor for text classification](https://github.com/huggingface/notebooks/blob/main/examples/text_classification_quantization_inc.ipynb)| Show how to apply static, dynamic and aware training quantization on a model using [Intel Neural Compressor (INC)](https://github.com/intel/neural-compressor) for any GLUE task. | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_quantization_inc.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/text_classification_quantization_inc.ipynb)|
+| [How to fine-tune a model on text classification with ONNX Runtime](https://github.com/huggingface/notebooks/blob/main/examples/text_classification_ort.ipynb)| Show how to preprocess the data and fine-tune a model on any GLUE task using [ONNX Runtime](https://github.com/microsoft/onnxruntime). | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_ort.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/text_classification_ort.ipynb)|
+| [How to fine-tune a model on summarization with ONNX Runtime](https://github.com/huggingface/notebooks/blob/main/examples/summarization_ort.ipynb)| Show how to preprocess the data and fine-tune a model on XSUM using [ONNX Runtime](https://github.com/microsoft/onnxruntime). | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization_ort.ipynb)| [](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/examples/summarization_ort.ipynb)|
+
+## Community notebooks:
+
+More notebooks developed by the community are available [here](https://hf.co/docs/transformers/community#community-notebooks).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pad_truncation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pad_truncation.md
new file mode 100644
index 0000000000000000000000000000000000000000..345f86283d1293727ac2d421e06637e35267ac56
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pad_truncation.md
@@ -0,0 +1,71 @@
+
+
+# Padding and truncation
+
+Batched inputs are often different lengths, so they can't be converted to fixed-size tensors. Padding and truncation are strategies for dealing with this problem, to create rectangular tensors from batches of varying lengths. Padding adds a special **padding token** to ensure shorter sequences will have the same length as either the longest sequence in a batch or the maximum length accepted by the model. Truncation works in the other direction by truncating long sequences.
+
+In most cases, padding your batch to the length of the longest sequence and truncating to the maximum length a model can accept works pretty well. However, the API supports more strategies if you need them. The three arguments you need to know are: `padding`, `truncation` and `max_length`.
+
+The `padding` argument controls padding. It can be a boolean or a string:
+
+ - `True` or `'longest'`: pad to the longest sequence in the batch (no padding is applied if you only provide
+ a single sequence).
+ - `'max_length'`: pad to a length specified by the `max_length` argument or the maximum length accepted
+ by the model if no `max_length` is provided (`max_length=None`). Padding will still be applied if you only provide a single sequence.
+ - `False` or `'do_not_pad'`: no padding is applied. This is the default behavior.
+
+The `truncation` argument controls truncation. It can be a boolean or a string:
+
+ - `True` or `'longest_first'`: truncate to a maximum length specified by the `max_length` argument or
+ the maximum length accepted by the model if no `max_length` is provided (`max_length=None`). This will
+ truncate token by token, removing a token from the longest sequence in the pair until the proper length is
+ reached.
+ - `'only_second'`: truncate to a maximum length specified by the `max_length` argument or the maximum
+ length accepted by the model if no `max_length` is provided (`max_length=None`). This will only truncate
+ the second sentence of a pair if a pair of sequences (or a batch of pairs of sequences) is provided.
+ - `'only_first'`: truncate to a maximum length specified by the `max_length` argument or the maximum
+ length accepted by the model if no `max_length` is provided (`max_length=None`). This will only truncate
+ the first sentence of a pair if a pair of sequences (or a batch of pairs of sequences) is provided.
+ - `False` or `'do_not_truncate'`: no truncation is applied. This is the default behavior.
+
+The `max_length` argument controls the length of the padding and truncation. It can be an integer or `None`, in which case it will default to the maximum length the model can accept. If the model has no specific maximum input length, truncation or padding to `max_length` is deactivated.
+
+The following table summarizes the recommended way to setup padding and truncation. If you use pairs of input sequences in any of the following examples, you can replace `truncation=True` by a `STRATEGY` selected in
+`['only_first', 'only_second', 'longest_first']`, i.e. `truncation='only_second'` or `truncation='longest_first'` to control how both sequences in the pair are truncated as detailed before.
+
+| Truncation | Padding | Instruction |
+|--------------------------------------|-----------------------------------|---------------------------------------------------------------------------------------------|
+| no truncation | no padding | `tokenizer(batch_sentences)` |
+| | padding to max sequence in batch | `tokenizer(batch_sentences, padding=True)` or |
+| | | `tokenizer(batch_sentences, padding='longest')` |
+| | padding to max model input length | `tokenizer(batch_sentences, padding='max_length')` |
+| | padding to specific length | `tokenizer(batch_sentences, padding='max_length', max_length=42)` |
+| | padding to a multiple of a value | `tokenizer(batch_sentences, padding=True, pad_to_multiple_of=8)` |
+| truncation to max model input length | no padding | `tokenizer(batch_sentences, truncation=True)` or |
+| | | `tokenizer(batch_sentences, truncation=STRATEGY)` |
+| | padding to max sequence in batch | `tokenizer(batch_sentences, padding=True, truncation=True)` or |
+| | | `tokenizer(batch_sentences, padding=True, truncation=STRATEGY)` |
+| | padding to max model input length | `tokenizer(batch_sentences, padding='max_length', truncation=True)` or |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=STRATEGY)` |
+| | padding to specific length | Not possible |
+| truncation to specific length | no padding | `tokenizer(batch_sentences, truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, truncation=STRATEGY, max_length=42)` |
+| | padding to max sequence in batch | `tokenizer(batch_sentences, padding=True, truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, padding=True, truncation=STRATEGY, max_length=42)` |
+| | padding to max model input length | Not possible |
+| | padding to specific length | `tokenizer(batch_sentences, padding='max_length', truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=STRATEGY, max_length=42)` |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/peft.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/peft.md
new file mode 100644
index 0000000000000000000000000000000000000000..e1777114dbcf54da30c2a280a6e18bef793e2b57
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/peft.md
@@ -0,0 +1,251 @@
+
+
+# Load adapters with ๐ค PEFT
+
+[[open-in-colab]]
+
+[Parameter-Efficient Fine Tuning (PEFT)](https://huggingface.co/blog/peft) methods freeze the pretrained model parameters during fine-tuning and add a small number of trainable parameters (the adapters) on top of it. The adapters are trained to learn task-specific information. This approach has been shown to be very memory-efficient with lower compute usage while producing results comparable to a fully fine-tuned model.
+
+Adapters trained with PEFT are also usually an order of magnitude smaller than the full model, making it convenient to share, store, and load them.
+
+
+
+
The adapter weights for a OPTForCausalLM model stored on the Hub are only ~6MB compared to the full size of the model weights, which can be ~700MB.
+
+
+If you're interested in learning more about the ๐ค PEFT library, check out the [documentation](https://huggingface.co/docs/peft/index).
+
+## Setup
+
+Get started by installing ๐ค PEFT:
+
+```bash
+pip install peft
+```
+
+If you want to try out the brand new features, you might be interested in installing the library from source:
+
+```bash
+pip install git+https://github.com/huggingface/peft.git
+```
+
+## Supported PEFT models
+
+๐ค Transformers natively supports some PEFT methods, meaning you can load adapter weights stored locally or on the Hub and easily run or train them with a few lines of code. The following methods are supported:
+
+- [Low Rank Adapters](https://huggingface.co/docs/peft/conceptual_guides/lora)
+- [IA3](https://huggingface.co/docs/peft/conceptual_guides/ia3)
+- [AdaLoRA](https://arxiv.org/abs/2303.10512)
+
+If you want to use other PEFT methods, such as prompt learning or prompt tuning, or learn about the ๐ค PEFT library in general, please refer to the [documentation](https://huggingface.co/docs/peft/index).
+
+
+## Load a PEFT adapter
+
+To load and use a PEFT adapter model from ๐ค Transformers, make sure the Hub repository or local directory contains an `adapter_config.json` file and the adapter weights, as shown in the example image above. Then you can load the PEFT adapter model using the `AutoModelFor` class. For example, to load a PEFT adapter model for causal language modeling:
+
+1. specify the PEFT model id
+2. pass it to the [`AutoModelForCausalLM`] class
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+peft_model_id = "ybelkada/opt-350m-lora"
+model = AutoModelForCausalLM.from_pretrained(peft_model_id)
+```
+
+
+
+You can load a PEFT adapter with either an `AutoModelFor` class or the base model class like `OPTForCausalLM` or `LlamaForCausalLM`.
+
+
+
+You can also load a PEFT adapter by calling the `load_adapter` method:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model_id = "facebook/opt-350m"
+peft_model_id = "ybelkada/opt-350m-lora"
+
+model = AutoModelForCausalLM.from_pretrained(model_id)
+model.load_adapter(peft_model_id)
+```
+
+Check out the [API documentation](#transformers.integrations.PeftAdapterMixin) section below for more details.
+
+## Load in 8bit or 4bit
+
+The `bitsandbytes` integration supports 8bit and 4bit precision data types, which are useful for loading large models because it saves memory (see the `bitsandbytes` integration [guide](./quantization#bitsandbytes-integration) to learn more). Add the `load_in_8bit` or `load_in_4bit` parameters to [`~PreTrainedModel.from_pretrained`] and set `device_map="auto"` to effectively distribute the model to your hardware:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+peft_model_id = "ybelkada/opt-350m-lora"
+model = AutoModelForCausalLM.from_pretrained(peft_model_id, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+
+## Add a new adapter
+
+You can use [`~peft.PeftModel.add_adapter`] to add a new adapter to a model with an existing adapter as long as the new adapter is the same type as the current one. For example, if you have an existing LoRA adapter attached to a model:
+
+```py
+from transformers import AutoModelForCausalLM, OPTForCausalLM, AutoTokenizer
+from peft import LoraConfig
+
+model_id = "facebook/opt-350m"
+model = AutoModelForCausalLM.from_pretrained(model_id)
+
+lora_config = LoraConfig(
+ target_modules=["q_proj", "k_proj"],
+ init_lora_weights=False
+)
+
+model.add_adapter(lora_config, adapter_name="adapter_1")
+```
+
+To add a new adapter:
+
+```py
+# attach new adapter with same config
+model.add_adapter(lora_config, adapter_name="adapter_2")
+```
+
+Now you can use [`~peft.PeftModel.set_adapter`] to set which adapter to use:
+
+```py
+# use adapter_1
+model.set_adapter("adapter_1")
+output_disabled = model.generate(**inputs)
+print(tokenizer.decode(output_disabled[0], skip_special_tokens=True))
+
+# use adapter_2
+model.set_adapter("adapter_2")
+output_enabled = model.generate(**inputs)
+print(tokenizer.decode(output_enabled[0], skip_special_tokens=True))
+```
+
+## Enable and disable adapters
+
+Once you've added an adapter to a model, you can enable or disable the adapter module. To enable the adapter module:
+
+```py
+from transformers import AutoModelForCausalLM, OPTForCausalLM, AutoTokenizer
+from peft import PeftConfig
+
+model_id = "facebook/opt-350m"
+adapter_model_id = "ybelkada/opt-350m-lora"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+text = "Hello"
+inputs = tokenizer(text, return_tensors="pt")
+
+model = AutoModelForCausalLM.from_pretrained(model_id)
+peft_config = PeftConfig.from_pretrained(adapter_model_id)
+
+# to initiate with random weights
+peft_config.init_lora_weights = False
+
+model.add_adapter(peft_config)
+model.enable_adapters()
+output = model.generate(**inputs)
+```
+
+To disable the adapter module:
+
+```py
+model.disable_adapters()
+output = model.generate(**inputs)
+```
+
+## Train a PEFT adapter
+
+PEFT adapters are supported by the [`Trainer`] class so that you can train an adapter for your specific use case. It only requires adding a few more lines of code. For example, to train a LoRA adapter:
+
+
+
+If you aren't familiar with fine-tuning a model with [`Trainer`], take a look at the [Fine-tune a pretrained model](training) tutorial.
+
+
+
+1. Define your adapter configuration with the task type and hyperparameters (see [`~peft.LoraConfig`] for more details about what the hyperparameters do).
+
+```py
+from peft import LoraConfig
+
+peft_config = LoraConfig(
+ lora_alpha=16,
+ lora_dropout=0.1,
+ r=64,
+ bias="none",
+ task_type="CAUSAL_LM",
+)
+```
+
+2. Add adapter to the model.
+
+```py
+model.add_adapter(peft_config)
+```
+
+3. Now you can pass the model to [`Trainer`]!
+
+```py
+trainer = Trainer(model=model, ...)
+trainer.train()
+```
+
+To save your trained adapter and load it back:
+
+```py
+model.save_pretrained(save_dir)
+model = AutoModelForCausalLM.from_pretrained(save_dir)
+```
+
+## Add additional trainable layers to a PEFT adapter
+
+You can also fine-tune additional trainable adapters on top of a model that has adapters attached by passing `modules_to_save` in your PEFT config. For example, if you want to also fine-tune the lm_head on top of a model with a LoRA adapter:
+
+```py
+from transformers import AutoModelForCausalLM, OPTForCausalLM, AutoTokenizer
+from peft import LoraConfig
+
+model_id = "facebook/opt-350m"
+model = AutoModelForCausalLM.from_pretrained(model_id)
+
+lora_config = LoraConfig(
+ target_modules=["q_proj", "k_proj"],
+ modules_to_save=["lm_head"],
+)
+
+model.add_adapter(lora_config)
+```
+
+## API docs
+
+[[autodoc]] integrations.PeftAdapterMixin
+ - load_adapter
+ - add_adapter
+ - set_adapter
+ - disable_adapters
+ - enable_adapters
+ - active_adapters
+ - get_adapter_state_dict
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_hardware.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_hardware.md
new file mode 100644
index 0000000000000000000000000000000000000000..260fe5b71ccbd17a13acd7af507393af6c8fce7f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_hardware.md
@@ -0,0 +1,155 @@
+
+
+
+# Custom hardware for training
+
+The hardware you use to run model training and inference can have a big effect on performance. For a deep dive into GPUs make sure to check out Tim Dettmer's excellent [blog post](https://timdettmers.com/2020/09/07/which-gpu-for-deep-learning/).
+
+Let's have a look at some practical advice for GPU setups.
+
+## GPU
+When you train bigger models you have essentially three options:
+
+- bigger GPUs
+- more GPUs
+- more CPU and NVMe (offloaded to by [DeepSpeed-Infinity](main_classes/deepspeed#nvme-support))
+
+Let's start at the case where you have a single GPU.
+
+### Power and Cooling
+
+If you bought an expensive high end GPU make sure you give it the correct power and sufficient cooling.
+
+**Power**:
+
+Some high end consumer GPU cards have 2 and sometimes 3 PCI-E 8-Pin power sockets. Make sure you have as many independent 12V PCI-E 8-Pin cables plugged into the card as there are sockets. Do not use the 2 splits at one end of the same cable (also known as pigtail cable). That is if you have 2 sockets on the GPU, you want 2 PCI-E 8-Pin cables going from your PSU to the card and not one that has 2 PCI-E 8-Pin connectors at the end! You won't get the full performance out of your card otherwise.
+
+Each PCI-E 8-Pin power cable needs to be plugged into a 12V rail on the PSU side and can supply up to 150W of power.
+
+Some other cards may use a PCI-E 12-Pin connectors, and these can deliver up to 500-600W of power.
+
+Low end cards may use 6-Pin connectors, which supply up to 75W of power.
+
+Additionally you want the high-end PSU that has stable voltage. Some lower quality ones may not give the card the stable voltage it needs to function at its peak.
+
+And of course the PSU needs to have enough unused Watts to power the card.
+
+**Cooling**:
+
+When a GPU gets overheated it will start throttling down and will not deliver full performance and it can even shutdown if it gets too hot.
+
+It's hard to tell the exact best temperature to strive for when a GPU is heavily loaded, but probably anything under +80C is good, but lower is better - perhaps 70-75C is an excellent range to be in. The throttling down is likely to start at around 84-90C. But other than throttling performance a prolonged very high temperature is likely to reduce the lifespan of a GPU.
+
+Next let's have a look at one of the most important aspects when having multiple GPUs: connectivity.
+
+### Multi-GPU Connectivity
+
+If you use multiple GPUs the way cards are inter-connected can have a huge impact on the total training time. If the GPUs are on the same physical node, you can run:
+
+```bash
+nvidia-smi topo -m
+```
+
+and it will tell you how the GPUs are inter-connected. On a machine with dual-GPU and which are connected with NVLink, you will most likely see something like:
+
+```
+ GPU0 GPU1 CPU Affinity NUMA Affinity
+GPU0 X NV2 0-23 N/A
+GPU1 NV2 X 0-23 N/A
+```
+
+on a different machine w/o NVLink we may see:
+```
+ GPU0 GPU1 CPU Affinity NUMA Affinity
+GPU0 X PHB 0-11 N/A
+GPU1 PHB X 0-11 N/A
+```
+
+The report includes this legend:
+
+```
+ X = Self
+ SYS = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
+ NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
+ PHB = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
+ PXB = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
+ PIX = Connection traversing at most a single PCIe bridge
+ NV# = Connection traversing a bonded set of # NVLinks
+```
+
+So the first report `NV2` tells us the GPUs are interconnected with 2 NVLinks, and the second report `PHB` we have a typical consumer-level PCIe+Bridge setup.
+
+Check what type of connectivity you have on your setup. Some of these will make the communication between cards faster (e.g. NVLink), others slower (e.g. PHB).
+
+Depending on the type of scalability solution used, the connectivity speed could have a major or a minor impact. If the GPUs need to sync rarely, as in DDP, the impact of a slower connection will be less significant. If the GPUs need to send messages to each other often, as in ZeRO-DP, then faster connectivity becomes super important to achieve faster training.
+
+#### NVlink
+
+[NVLink](https://en.wikipedia.org/wiki/NVLink) is a wire-based serial multi-lane near-range communications link developed by Nvidia.
+
+Each new generation provides a faster bandwidth, e.g. here is a quote from [Nvidia Ampere GA102 GPU Architecture](https://www.nvidia.com/content/dam/en-zz/Solutions/geforce/ampere/pdf/NVIDIA-ampere-GA102-GPU-Architecture-Whitepaper-V1.pdf):
+
+> Third-Generation NVLinkยฎ
+> GA102 GPUs utilize NVIDIAโs third-generation NVLink interface, which includes four x4 links,
+> with each link providing 14.0625 GB/sec bandwidth in each direction between two GPUs. Four
+> links provide 56.25 GB/sec bandwidth in each direction, and 112.5 GB/sec total bandwidth
+> between two GPUs. Two RTX 3090 GPUs can be connected together for SLI using NVLink.
+> (Note that 3-Way and 4-Way SLI configurations are not supported.)
+
+So the higher `X` you get in the report of `NVX` in the output of `nvidia-smi topo -m` the better. The generation will depend on your GPU architecture.
+
+Let's compare the execution of an `openai-community/gpt2` language model training over a small sample of wikitext.
+
+The results are:
+
+
+| NVlink | Time |
+| ----- | ---: |
+| Y | 101s |
+| N | 131s |
+
+
+You can see that NVLink completes the training ~23% faster. In the second benchmark we use `NCCL_P2P_DISABLE=1` to tell the GPUs not to use NVLink.
+
+Here is the full benchmark code and outputs:
+
+```bash
+# DDP w/ NVLink
+
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 torchrun \
+--nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py --model_name_or_path openai-community/gpt2 \
+--dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 --do_train \
+--output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 101.9003, 'train_samples_per_second': 1.963, 'epoch': 0.69}
+
+# DDP w/o NVLink
+
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 NCCL_P2P_DISABLE=1 torchrun \
+--nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py --model_name_or_path openai-community/gpt2 \
+--dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 --do_train
+--output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 131.4367, 'train_samples_per_second': 1.522, 'epoch': 0.69}
+```
+
+Hardware: 2x TITAN RTX 24GB each + NVlink with 2 NVLinks (`NV2` in `nvidia-smi topo -m`)
+Software: `pytorch-1.8-to-be` + `cuda-11.0` / `transformers==4.3.0.dev0`
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_cpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_cpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..7f8b525b3df610123e97abe2bd8f8097ffe66984
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_cpu.md
@@ -0,0 +1,126 @@
+
+
+# CPU inference
+
+With some optimizations, it is possible to efficiently run large model inference on a CPU. One of these optimization techniques involves compiling the PyTorch code into an intermediate format for high-performance environments like C++. The other technique fuses multiple operations into one kernel to reduce the overhead of running each operation separately.
+
+You'll learn how to use [BetterTransformer](https://pytorch.org/blog/a-better-transformer-for-fast-transformer-encoder-inference/) for faster inference, and how to convert your PyTorch code to [TorchScript](https://pytorch.org/tutorials/beginner/Intro_to_TorchScript_tutorial.html). If you're using an Intel CPU, you can also use [graph optimizations](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features.html#graph-optimization) from [Intel Extension for PyTorch](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/index.html) to boost inference speed even more. Finally, learn how to use ๐ค Optimum to accelerate inference with ONNX Runtime or OpenVINO (if you're using an Intel CPU).
+
+## BetterTransformer
+
+BetterTransformer accelerates inference with its fastpath (native PyTorch specialized implementation of Transformer functions) execution. The two optimizations in the fastpath execution are:
+
+1. fusion, which combines multiple sequential operations into a single "kernel" to reduce the number of computation steps
+2. skipping the inherent sparsity of padding tokens to avoid unnecessary computation with nested tensors
+
+BetterTransformer also converts all attention operations to use the more memory-efficient [scaled dot product attention](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention).
+
+
+
+BetterTransformer is not supported for all models. Check this [list](https://huggingface.co/docs/optimum/bettertransformer/overview#supported-models) to see if a model supports BetterTransformer.
+
+
+
+Before you start, make sure you have ๐ค Optimum [installed](https://huggingface.co/docs/optimum/installation).
+
+Enable BetterTransformer with the [`PreTrainedModel.to_bettertransformer`] method:
+
+```py
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained("bigcode/starcoder", torch_dtype="auto")
+```
+
+## TorchScript
+
+TorchScript is an intermediate PyTorch model representation that can be run in production environments where performance is important. You can train a model in PyTorch and then export it to TorchScript to free the model from Python performance constraints. PyTorch [traces](https://pytorch.org/docs/stable/generated/torch.jit.trace.html) a model to return a [`ScriptFunction`] that is optimized with just-in-time compilation (JIT). Compared to the default eager mode, JIT mode in PyTorch typically yields better performance for inference using optimization techniques like operator fusion.
+
+For a gentle introduction to TorchScript, see the [Introduction to PyTorch TorchScript](https://pytorch.org/tutorials/beginner/Intro_to_TorchScript_tutorial.html) tutorial.
+
+With the [`Trainer`] class, you can enable JIT mode for CPU inference by setting the `--jit_mode_eval` flag:
+
+```bash
+python examples/pytorch/question-answering/run_qa.py \
+--model_name_or_path csarron/bert-base-uncased-squad-v1 \
+--dataset_name squad \
+--do_eval \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/ \
+--no_cuda \
+--jit_mode_eval
+```
+
+
+
+For PyTorch >= 1.14.0, JIT-mode could benefit any model for prediction and evaluation since the dict input is supported in `jit.trace`.
+
+For PyTorch < 1.14.0, JIT-mode could benefit a model if its forward parameter order matches the tuple input order in `jit.trace`, such as a question-answering model. If the forward parameter order does not match the tuple input order in `jit.trace`, like a text classification model, `jit.trace` will fail and we are capturing this with the exception here to make it fallback. Logging is used to notify users.
+
+
+
+## IPEX graph optimization
+
+Intelยฎ Extension for PyTorch (IPEX) provides further optimizations in JIT mode for Intel CPUs, and we recommend combining it with TorchScript for even faster performance. The IPEX [graph optimization](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/graph_optimization.html) fuses operations like Multi-head attention, Concat Linear, Linear + Add, Linear + Gelu, Add + LayerNorm, and more.
+
+To take advantage of these graph optimizations, make sure you have IPEX [installed](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/installation.html):
+
+```bash
+pip install intel_extension_for_pytorch
+```
+
+Set the `--use_ipex` and `--jit_mode_eval` flags in the [`Trainer`] class to enable JIT mode with the graph optimizations:
+
+```bash
+python examples/pytorch/question-answering/run_qa.py \
+--model_name_or_path csarron/bert-base-uncased-squad-v1 \
+--dataset_name squad \
+--do_eval \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/ \
+--no_cuda \
+--use_ipex \
+--jit_mode_eval
+```
+
+## ๐ค Optimum
+
+
+
+Learn more details about using ORT with ๐ค Optimum in the [Optimum Inference with ONNX Runtime](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/models) guide. This section only provides a brief and simple example.
+
+
+
+ONNX Runtime (ORT) is a model accelerator that runs inference on CPUs by default. ORT is supported by ๐ค Optimum which can be used in ๐ค Transformers, without making too many changes to your code. You only need to replace the ๐ค Transformers `AutoClass` with its equivalent [`~optimum.onnxruntime.ORTModel`] for the task you're solving, and load a checkpoint in the ONNX format.
+
+For example, if you're running inference on a question answering task, load the [optimum/roberta-base-squad2](https://huggingface.co/optimum/roberta-base-squad2) checkpoint which contains a `model.onnx` file:
+
+```py
+from transformers import AutoTokenizer, pipeline
+from optimum.onnxruntime import ORTModelForQuestionAnswering
+
+model = ORTModelForQuestionAnswering.from_pretrained("optimum/roberta-base-squad2")
+tokenizer = AutoTokenizer.from_pretrained("deepset/roberta-base-squad2")
+
+onnx_qa = pipeline("question-answering", model=model, tokenizer=tokenizer)
+
+question = "What's my name?"
+context = "My name is Philipp and I live in Nuremberg."
+pred = onnx_qa(question, context)
+```
+
+If you have an Intel CPU, take a look at ๐ค [Optimum Intel](https://huggingface.co/docs/optimum/intel/index) which supports a variety of compression techniques (quantization, pruning, knowledge distillation) and tools for converting models to the [OpenVINO](https://huggingface.co/docs/optimum/intel/inference) format for higher performance inference.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_gpu_multi.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_gpu_multi.md
new file mode 100644
index 0000000000000000000000000000000000000000..ea9421747c13dffd44793f66e19050321d2c3b52
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_gpu_multi.md
@@ -0,0 +1,68 @@
+
+
+# Multi-GPU inference
+
+Built-in Tensor Parallelism (TP) is now available with certain models using PyTorch. Tensor parallelism shards a model onto multiple GPUs, enabling larger model sizes, and parallelizes computations such as matrix multiplication.
+
+To enable tensor parallel, pass the argument `tp_plan="auto"` to [`~AutoModelForCausalLM.from_pretrained`]:
+
+```python
+import os
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
+
+# Initialize distributed
+rank = int(os.environ["RANK"])
+device = torch.device(f"cuda:{rank}")
+torch.distributed.init_process_group("nccl", device_id=device)
+
+# Retrieve tensor parallel model
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ tp_plan="auto",
+)
+
+# Prepare input tokens
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+prompt = "Can I help"
+inputs = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
+
+# Distributed run
+outputs = model(inputs)
+```
+
+You can use `torchrun` to launch the above script with multiple processes, each mapping to a GPU:
+
+```
+torchrun --nproc-per-node 4 demo.py
+```
+
+PyTorch tensor parallel is currently supported for the following models:
+* [Llama](https://huggingface.co/docs/transformers/model_doc/llama#transformers.LlamaModel)
+
+You can request to add tensor parallel support for another model by opening a GitHub Issue or Pull Request.
+
+### Expected speedups
+
+You can benefit from considerable speedups for inference, especially for inputs with large batch size or long sequences.
+
+For a single forward pass on [Llama](https://huggingface.co/docs/transformers/model_doc/llama#transformers.LlamaModel) with a sequence length of 512 and various batch sizes, the expected speedup is as follows:
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_gpu_one.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_gpu_one.md
new file mode 100644
index 0000000000000000000000000000000000000000..d9bdf6f6e4841d7b7b0b5c2ba880ceeb4e6c56d1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_infer_gpu_one.md
@@ -0,0 +1,553 @@
+
+
+# GPU inference
+
+GPUs are the standard choice of hardware for machine learning, unlike CPUs, because they are optimized for memory bandwidth and parallelism. To keep up with the larger sizes of modern models or to run these large models on existing and older hardware, there are several optimizations you can use to speed up GPU inference. In this guide, you'll learn how to use FlashAttention-2 (a more memory-efficient attention mechanism), BetterTransformer (a PyTorch native fastpath execution), and bitsandbytes to quantize your model to a lower precision. Finally, learn how to use ๐ค Optimum to accelerate inference with ONNX Runtime on Nvidia and AMD GPUs.
+
+
+
+The majority of the optimizations described here also apply to multi-GPU setups!
+
+
+
+## FlashAttention-2
+
+
+
+FlashAttention-2 is experimental and may change considerably in future versions.
+
+
+
+[FlashAttention-2](https://huggingface.co/papers/2205.14135) is a faster and more efficient implementation of the standard attention mechanism that can significantly speedup inference by:
+
+1. additionally parallelizing the attention computation over sequence length
+2. partitioning the work between GPU threads to reduce communication and shared memory reads/writes between them
+
+FlashAttention-2 is currently supported for the following architectures:
+* [Aria](https://huggingface.co/docs/transformers/model_doc/aria#transformers.AriaForConditionalGeneration)
+* [Bark](https://huggingface.co/docs/transformers/model_doc/bark#transformers.BarkModel)
+* [Bamba](https://huggingface.co/docs/transformers/model_doc/bamba#transformers.BambaModel)
+* [Bart](https://huggingface.co/docs/transformers/model_doc/bart#transformers.BartModel)
+* [Chameleon](https://huggingface.co/docs/transformers/model_doc/chameleon#transformers.Chameleon)
+* [CLIP](https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPModel)
+* [Cohere](https://huggingface.co/docs/transformers/model_doc/cohere#transformers.CohereModel)
+* [Cohere2](https://huggingface.co/docs/transformers/model_doc/cohere2#transformers.Cohere2Model)
+* [GLM](https://huggingface.co/docs/transformers/model_doc/glm#transformers.GLMModel)
+* [Dbrx](https://huggingface.co/docs/transformers/model_doc/dbrx#transformers.DbrxModel)
+* [DiffLlama](https://huggingface.co/docs/transformers/model_doc/diffllama#transformers.DiffLlamaModel)
+* [DistilBert](https://huggingface.co/docs/transformers/model_doc/distilbert#transformers.DistilBertModel)
+* [Emu3](https://huggingface.co/docs/transformers/model_doc/emu3)
+* [Gemma](https://huggingface.co/docs/transformers/model_doc/gemma#transformers.GemmaModel)
+* [Gemma2](https://huggingface.co/docs/transformers/model_doc/gemma2#transformers.Gemma2Model)
+* [GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2)
+* [GPTBigCode](https://huggingface.co/docs/transformers/model_doc/gpt_bigcode#transformers.GPTBigCodeModel)
+* [GPTNeo](https://huggingface.co/docs/transformers/model_doc/gpt_neo#transformers.GPTNeoModel)
+* [GPTNeoX](https://huggingface.co/docs/transformers/model_doc/gpt_neox#transformers.GPTNeoXModel)
+* [GPT-J](https://huggingface.co/docs/transformers/model_doc/gptj#transformers.GPTJModel)
+* [Granite](https://huggingface.co/docs/transformers/model_doc/granite#transformers.GraniteModel)
+* [GraniteMoe](https://huggingface.co/docs/transformers/model_doc/granitemoe#transformers.GraniteMoeModel)
+* [Idefics2](https://huggingface.co/docs/transformers/model_doc/idefics2#transformers.Idefics2Model)
+* [Idefics3](https://huggingface.co/docs/transformers/model_doc/idefics3#transformers.Idefics3Model)
+* [Falcon](https://huggingface.co/docs/transformers/model_doc/falcon#transformers.FalconModel)
+* [JetMoe](https://huggingface.co/docs/transformers/model_doc/jetmoe#transformers.JetMoeModel)
+* [Jamba](https://huggingface.co/docs/transformers/model_doc/jamba#transformers.JambaModel)
+* [Llama](https://huggingface.co/docs/transformers/model_doc/llama#transformers.LlamaModel)
+* [Llava](https://huggingface.co/docs/transformers/model_doc/llava)
+* [Llava-NeXT](https://huggingface.co/docs/transformers/model_doc/llava_next)
+* [Llava-NeXT-Video](https://huggingface.co/docs/transformers/model_doc/llava_next_video)
+* [LLaVA-Onevision](https://huggingface.co/docs/transformers/model_doc/llava_onevision)
+* [Moonshine](https://huggingface.co/docs/transformers/model_doc/moonshine#transformers.MoonshineModel)
+* [Mimi](https://huggingface.co/docs/transformers/model_doc/mimi)
+* [VipLlava](https://huggingface.co/docs/transformers/model_doc/vipllava)
+* [VideoLlava](https://huggingface.co/docs/transformers/model_doc/video_llava)
+* [M2M100](https://huggingface.co/docs/transformers/model_doc/m2m_100)
+* [MBart](https://huggingface.co/docs/transformers/model_doc/mbart#transformers.MBartModel)
+* [Mistral](https://huggingface.co/docs/transformers/model_doc/mistral#transformers.MistralModel)
+* [Mixtral](https://huggingface.co/docs/transformers/model_doc/mixtral#transformers.MixtralModel)
+* [ModernBert](https://huggingface.co/docs/transformers/model_doc/modernbert#transformers.ModernBert)
+* [Moshi](https://huggingface.co/docs/transformers/model_doc/moshi#transformers.MoshiModel)
+* [Musicgen](https://huggingface.co/docs/transformers/model_doc/musicgen#transformers.MusicgenModel)
+* [MusicGen Melody](https://huggingface.co/docs/transformers/model_doc/musicgen_melody#transformers.MusicgenMelodyModel)
+* [Nemotron](https://huggingface.co/docs/transformers/model_doc/nemotron)
+* [NLLB](https://huggingface.co/docs/transformers/model_doc/nllb)
+* [OLMo](https://huggingface.co/docs/transformers/model_doc/olmo#transformers.OlmoModel)
+* [OLMo2](https://huggingface.co/docs/transformers/model_doc/olmo2#transformers.Olmo2Model)
+* [OLMoE](https://huggingface.co/docs/transformers/model_doc/olmoe#transformers.OlmoeModel)
+* [OPT](https://huggingface.co/docs/transformers/model_doc/opt#transformers.OPTModel)
+* [PaliGemma](https://huggingface.co/docs/transformers/model_doc/paligemma#transformers.PaliGemmaForConditionalGeneration)
+* [Phi](https://huggingface.co/docs/transformers/model_doc/phi#transformers.PhiModel)
+* [Phi3](https://huggingface.co/docs/transformers/model_doc/phi3#transformers.Phi3Model)
+* [PhiMoE](https://huggingface.co/docs/transformers/model_doc/phimoe#transformers.PhimoeModel)
+* [StableLm](https://huggingface.co/docs/transformers/model_doc/stablelm#transformers.StableLmModel)
+* [Starcoder2](https://huggingface.co/docs/transformers/model_doc/starcoder2#transformers.Starcoder2Model)
+* [Qwen2](https://huggingface.co/docs/transformers/model_doc/qwen2#transformers.Qwen2Model)
+* [Qwen2Audio](https://huggingface.co/docs/transformers/model_doc/qwen2_audio#transformers.Qwen2AudioEncoder)
+* [Qwen2MoE](https://huggingface.co/docs/transformers/model_doc/qwen2_moe#transformers.Qwen2MoeModel)
+* [Qwen2VL](https://huggingface.co/docs/transformers/model_doc/qwen2_vl#transformers.Qwen2VLModel)
+* [RAG](https://huggingface.co/docs/transformers/model_doc/rag#transformers.RagModel)
+* [SpeechEncoderDecoder](https://huggingface.co/docs/transformers/model_doc/speech_encoder_decoder#transformers.SpeechEncoderDecoderModel)
+* [VisionEncoderDecoder](https://huggingface.co/docs/transformers/model_doc/vision_encoder_decoder#transformers.VisionEncoderDecoderModel)
+* [VisionTextDualEncoder](https://huggingface.co/docs/transformers/model_doc/vision_text_dual_encoder#transformers.VisionTextDualEncoderModel)
+* [Whisper](https://huggingface.co/docs/transformers/model_doc/whisper#transformers.WhisperModel)
+* [Wav2Vec2](https://huggingface.co/docs/transformers/model_doc/wav2vec2#transformers.Wav2Vec2Model)
+* [Hubert](https://huggingface.co/docs/transformers/model_doc/hubert#transformers.HubertModel)
+* [data2vec_audio](https://huggingface.co/docs/transformers/main/en/model_doc/data2vec#transformers.Data2VecAudioModel)
+* [Sew](https://huggingface.co/docs/transformers/main/en/model_doc/sew#transformers.SEWModel)
+* [SigLIP](https://huggingface.co/docs/transformers/model_doc/siglip)
+* [UniSpeech](https://huggingface.co/docs/transformers/v4.39.3/en/model_doc/unispeech#transformers.UniSpeechModel)
+* [unispeech_sat](https://huggingface.co/docs/transformers/v4.39.3/en/model_doc/unispeech-sat#transformers.UniSpeechSatModel)
+* [helium](https://huggingface.co/docs/transformers/main/en/model_doc/heliumtransformers.HeliumModel)
+
+You can request to add FlashAttention-2 support for another model by opening a GitHub Issue or Pull Request.
+
+Before you begin, make sure you have FlashAttention-2 installed.
+
+
+
+
+```bash
+pip install flash-attn --no-build-isolation
+```
+
+We strongly suggest referring to the detailed [installation instructions](https://github.com/Dao-AILab/flash-attention?tab=readme-ov-file#installation-and-features) to learn more about supported hardware and data types!
+
+
+
+
+FlashAttention-2 is also supported on AMD GPUs and current support is limited to **Instinct MI210**, **Instinct MI250** and **Instinct MI300**. We strongly suggest using this [Dockerfile](https://github.com/huggingface/optimum-amd/tree/main/docker/transformers-pytorch-amd-gpu-flash/Dockerfile) to use FlashAttention-2 on AMD GPUs.
+
+
+
+
+To enable FlashAttention-2, pass the argument `attn_implementation="flash_attention_2"` to [`~AutoModelForCausalLM.from_pretrained`]:
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM
+
+model_id = "tiiuae/falcon-7b"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ torch_dtype=torch.bfloat16,
+ attn_implementation="flash_attention_2",
+)
+```
+
+
+
+FlashAttention-2 can only be used when the model's dtype is `fp16` or `bf16`. Make sure to cast your model to the appropriate dtype and load them on a supported device before using FlashAttention-2.
+
+
+
+You can also set `use_flash_attention_2=True` to enable FlashAttention-2 but it is deprecated in favor of `attn_implementation="flash_attention_2"`.
+
+
+
+FlashAttention-2 can be combined with other optimization techniques like quantization to further speedup inference. For example, you can combine FlashAttention-2 with 8-bit or 4-bit quantization:
+
+```py
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM
+
+model_id = "tiiuae/falcon-7b"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+
+# load in 8bit
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ load_in_8bit=True,
+ attn_implementation="flash_attention_2",
+)
+
+# load in 4bit
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ load_in_4bit=True,
+ attn_implementation="flash_attention_2",
+)
+```
+
+### Expected speedups
+
+You can benefit from considerable speedups for inference, especially for inputs with long sequences. However, since FlashAttention-2 does not support computing attention scores with padding tokens, you must manually pad/unpad the attention scores for batched inference when the sequence contains padding tokens. This leads to a significant slowdown for batched generations with padding tokens.
+
+To overcome this, you should use FlashAttention-2 without padding tokens in the sequence during training (by packing a dataset or [concatenating sequences](https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_clm.py#L516) until reaching the maximum sequence length).
+
+For a single forward pass on [tiiuae/falcon-7b](https://hf.co/tiiuae/falcon-7b) with a sequence length of 4096 and various batch sizes without padding tokens, the expected speedup is:
+
+
+
+
+
+For a single forward pass on [meta-llama/Llama-7b-hf](https://hf.co/meta-llama/Llama-7b-hf) with a sequence length of 4096 and various batch sizes without padding tokens, the expected speedup is:
+
+
+
+
+
+For sequences with padding tokens (generating with padding tokens), you need to unpad/pad the input sequences to correctly compute the attention scores. With a relatively small sequence length, a single forward pass creates overhead leading to a small speedup (in the example below, 30% of the input is filled with padding tokens):
+
+
+
+
+
+But for larger sequence lengths, you can expect even more speedup benefits:
+
+
+
+FlashAttention is more memory efficient, meaning you can train on much larger sequence lengths without running into out-of-memory issues. You can potentially reduce memory usage up to 20x for larger sequence lengths. Take a look at the [flash-attention](https://github.com/Dao-AILab/flash-attention) repository for more details.
+
+
+
+
+
+
+
+## PyTorch scaled dot product attention
+
+PyTorch's [`torch.nn.functional.scaled_dot_product_attention`](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html) (SDPA) can also call FlashAttention and memory-efficient attention kernels under the hood. SDPA support is currently being added natively in Transformers and is used by default for `torch>=2.1.1` when an implementation is available. You may also set `attn_implementation="sdpa"` in `from_pretrained()` to explicitly request SDPA to be used.
+
+For now, Transformers supports SDPA inference and training for the following architectures:
+* [Albert](https://huggingface.co/docs/transformers/model_doc/albert#transformers.AlbertModel)
+* [Aria](https://huggingface.co/docs/transformers/model_doc/aria#transformers.AriaForConditionalGeneration)
+* [Audio Spectrogram Transformer](https://huggingface.co/docs/transformers/model_doc/audio-spectrogram-transformer#transformers.ASTModel)
+* [Bamba](https://huggingface.co/docs/transformers/model_doc/bamba#transformers.BambaModel)
+* [Bart](https://huggingface.co/docs/transformers/model_doc/bart#transformers.BartModel)
+* [Beit](https://huggingface.co/docs/transformers/model_doc/beit#transformers.BeitModel)
+* [Bert](https://huggingface.co/docs/transformers/model_doc/bert#transformers.BertModel)
+* [BioGpt](https://huggingface.co/docs/transformers/model_doc/biogpt#transformers.BioGptModel)
+* [CamemBERT](https://huggingface.co/docs/transformers/model_doc/camembert#transformers.CamembertModel)
+* [Chameleon](https://huggingface.co/docs/transformers/model_doc/chameleon#transformers.Chameleon)
+* [CLIP](https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPModel)
+* [GLM](https://huggingface.co/docs/transformers/model_doc/glm#transformers.GLMModel)
+* [Cohere](https://huggingface.co/docs/transformers/model_doc/cohere#transformers.CohereModel)
+* [Cohere2](https://huggingface.co/docs/transformers/model_doc/cohere2#transformers.Cohere2Model)
+* [data2vec_audio](https://huggingface.co/docs/transformers/main/en/model_doc/data2vec#transformers.Data2VecAudioModel)
+* [data2vec_vision](https://huggingface.co/docs/transformers/main/en/model_doc/data2vec#transformers.Data2VecVisionModel)
+* [Dbrx](https://huggingface.co/docs/transformers/model_doc/dbrx#transformers.DbrxModel)
+* [DeiT](https://huggingface.co/docs/transformers/model_doc/deit#transformers.DeiTModel)
+* [DiffLlama](https://huggingface.co/docs/transformers/model_doc/diffllama#transformers.DiffLlamaModel)
+* [Dinov2](https://huggingface.co/docs/transformers/en/model_doc/dinov2)
+* [Dinov2_with_registers](https://huggingface.co/docs/transformers/en/model_doc/dinov2)
+* [DistilBert](https://huggingface.co/docs/transformers/model_doc/distilbert#transformers.DistilBertModel)
+* [Dpr](https://huggingface.co/docs/transformers/model_doc/dpr#transformers.DprReader)
+* [EncoderDecoder](https://huggingface.co/docs/transformers/model_doc/encoder_decoder#transformers.EncoderDecoderModel)
+* [Emu3](https://huggingface.co/docs/transformers/model_doc/emu3)
+* [Falcon](https://huggingface.co/docs/transformers/model_doc/falcon#transformers.FalconModel)
+* [Gemma](https://huggingface.co/docs/transformers/model_doc/gemma#transformers.GemmaModel)
+* [Gemma2](https://huggingface.co/docs/transformers/model_doc/gemma2#transformers.Gemma2Model)
+* [Granite](https://huggingface.co/docs/transformers/model_doc/granite#transformers.GraniteModel)
+* [GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2)
+* [GPTBigCode](https://huggingface.co/docs/transformers/model_doc/gpt_bigcode#transformers.GPTBigCodeModel)
+* [GPTNeoX](https://huggingface.co/docs/transformers/model_doc/gpt_neox#transformers.GPTNeoXModel)
+* [Hubert](https://huggingface.co/docs/transformers/model_doc/hubert#transformers.HubertModel)
+* [Idefics](https://huggingface.co/docs/transformers/model_doc/idefics#transformers.IdeficsModel)
+* [Idefics2](https://huggingface.co/docs/transformers/model_doc/idefics2#transformers.Idefics2Model)
+* [Idefics3](https://huggingface.co/docs/transformers/model_doc/idefics3#transformers.Idefics3Model)
+* [I-JEPA](https://huggingface.co/docs/transformers/model_doc/ijepa#transformers.IJepaModel)
+* [GraniteMoe](https://huggingface.co/docs/transformers/model_doc/granitemoe#transformers.GraniteMoeModel)
+* [JetMoe](https://huggingface.co/docs/transformers/model_doc/jetmoe#transformers.JetMoeModel)
+* [Jamba](https://huggingface.co/docs/transformers/model_doc/jamba#transformers.JambaModel)
+* [Llama](https://huggingface.co/docs/transformers/model_doc/llama#transformers.LlamaModel)
+* [Llava](https://huggingface.co/docs/transformers/model_doc/llava)
+* [Llava-NeXT](https://huggingface.co/docs/transformers/model_doc/llava_next)
+* [Llava-NeXT-Video](https://huggingface.co/docs/transformers/model_doc/llava_next_video)
+* [LLaVA-Onevision](https://huggingface.co/docs/transformers/model_doc/llava_onevision)
+* [M2M100](https://huggingface.co/docs/transformers/model_doc/m2m_100#transformers.M2M100Model)
+* [Moonshine](https://huggingface.co/docs/transformers/model_doc/moonshine#transformers.MoonshineModel)
+* [Mimi](https://huggingface.co/docs/transformers/model_doc/mimi)
+* [Mistral](https://huggingface.co/docs/transformers/model_doc/mistral#transformers.MistralModel)
+* [Mllama](https://huggingface.co/docs/transformers/model_doc/mllama#transformers.MllamaForConditionalGeneration)
+* [Mixtral](https://huggingface.co/docs/transformers/model_doc/mixtral#transformers.MixtralModel)
+* [ModernBert](https://huggingface.co/docs/transformers/model_doc/modernbert#transformers.ModernBert)
+* [Moshi](https://huggingface.co/docs/transformers/model_doc/moshi#transformers.MoshiModel)
+* [Musicgen](https://huggingface.co/docs/transformers/model_doc/musicgen#transformers.MusicgenModel)
+* [MusicGen Melody](https://huggingface.co/docs/transformers/model_doc/musicgen_melody#transformers.MusicgenMelodyModel)
+* [NLLB](https://huggingface.co/docs/transformers/model_doc/nllb)
+* [OLMo](https://huggingface.co/docs/transformers/model_doc/olmo#transformers.OlmoModel)
+* [OLMo2](https://huggingface.co/docs/transformers/model_doc/olmo2#transformers.Olmo2Model)
+* [OLMoE](https://huggingface.co/docs/transformers/model_doc/olmoe#transformers.OlmoeModel)
+* [OPT](https://huggingface.co/docs/transformers/en/model_doc/opt)
+* [PaliGemma](https://huggingface.co/docs/transformers/model_doc/paligemma#transformers.PaliGemmaForConditionalGeneration)
+* [Phi](https://huggingface.co/docs/transformers/model_doc/phi#transformers.PhiModel)
+* [Phi3](https://huggingface.co/docs/transformers/model_doc/phi3#transformers.Phi3Model)
+* [PhiMoE](https://huggingface.co/docs/transformers/model_doc/phimoe#transformers.PhimoeModel)
+* [Idefics](https://huggingface.co/docs/transformers/model_doc/idefics#transformers.IdeficsModel)
+* [mBart](https://huggingface.co/docs/transformers/model_doc/mbart#transformers.MBartModel)
+* [Moonshine](https://huggingface.co/docs/transformers/model_doc/moonshine#transformers.MoonshineModel)
+* [Mistral](https://huggingface.co/docs/transformers/model_doc/mistral#transformers.MistralModel)
+* [Mixtral](https://huggingface.co/docs/transformers/model_doc/mixtral#transformers.MixtralModel)
+* [StableLm](https://huggingface.co/docs/transformers/model_doc/stablelm#transformers.StableLmModel)
+* [Starcoder2](https://huggingface.co/docs/transformers/model_doc/starcoder2#transformers.Starcoder2Model)
+* [Qwen2](https://huggingface.co/docs/transformers/model_doc/qwen2#transformers.Qwen2Model)
+* [Qwen2Audio](https://huggingface.co/docs/transformers/model_doc/qwen2_audio#transformers.Qwen2AudioEncoder)
+* [Qwen2MoE](https://huggingface.co/docs/transformers/model_doc/qwen2_moe#transformers.Qwen2MoeModel)
+* [RoBERTa](https://huggingface.co/docs/transformers/model_doc/roberta#transformers.RobertaModel)
+* [Sew](https://huggingface.co/docs/transformers/main/en/model_doc/sew#transformers.SEWModel)
+* [SigLIP](https://huggingface.co/docs/transformers/model_doc/siglip)
+* [StableLm](https://huggingface.co/docs/transformers/model_doc/stablelm#transformers.StableLmModel)
+* [Starcoder2](https://huggingface.co/docs/transformers/model_doc/starcoder2#transformers.Starcoder2Model)
+* [UniSpeech](https://huggingface.co/docs/transformers/v4.39.3/en/model_doc/unispeech#transformers.UniSpeechModel)
+* [unispeech_sat](https://huggingface.co/docs/transformers/v4.39.3/en/model_doc/unispeech-sat#transformers.UniSpeechSatModel)
+* [RoBERTa](https://huggingface.co/docs/transformers/model_doc/roberta#transformers.RobertaModel)
+* [Qwen2VL](https://huggingface.co/docs/transformers/model_doc/qwen2_vl#transformers.Qwen2VLModel)
+* [Musicgen](https://huggingface.co/docs/transformers/model_doc/musicgen#transformers.MusicgenModel)
+* [MusicGen Melody](https://huggingface.co/docs/transformers/model_doc/musicgen_melody#transformers.MusicgenMelodyModel)
+* [Nemotron](https://huggingface.co/docs/transformers/model_doc/nemotron)
+* [SpeechEncoderDecoder](https://huggingface.co/docs/transformers/model_doc/speech_encoder_decoder#transformers.SpeechEncoderDecoderModel)
+* [VideoLlava](https://huggingface.co/docs/transformers/model_doc/video_llava)
+* [VipLlava](https://huggingface.co/docs/transformers/model_doc/vipllava)
+* [VisionEncoderDecoder](https://huggingface.co/docs/transformers/model_doc/vision_encoder_decoder#transformers.VisionEncoderDecoderModel)
+* [ViT](https://huggingface.co/docs/transformers/model_doc/vit#transformers.ViTModel)
+* [ViTHybrid](https://huggingface.co/docs/transformers/model_doc/vit_hybrid#transformers.ViTHybridModel)
+* [ViTMAE](https://huggingface.co/docs/transformers/model_doc/vit_mae#transformers.ViTMAEModel)
+* [ViTMSN](https://huggingface.co/docs/transformers/model_doc/vit_msn#transformers.ViTMSNModel)
+* [VisionTextDualEncoder](https://huggingface.co/docs/transformers/model_doc/vision_text_dual_encoder#transformers.VisionTextDualEncoderModel)
+* [VideoMAE](https://huggingface.co/docs/transformers/model_doc/videomae#transformers.VideoMAEModell)
+* [ViViT](https://huggingface.co/docs/transformers/model_doc/vivit#transformers.VivitModel)
+* [wav2vec2](https://huggingface.co/docs/transformers/model_doc/wav2vec2#transformers.Wav2Vec2Model)
+* [Whisper](https://huggingface.co/docs/transformers/model_doc/whisper#transformers.WhisperModel)
+* [XLM-RoBERTa](https://huggingface.co/docs/transformers/model_doc/xlm-roberta#transformers.XLMRobertaModel)
+* [XLM-RoBERTa-XL](https://huggingface.co/docs/transformers/model_doc/xlm-roberta-xl#transformers.XLMRobertaXLModel)
+* [YOLOS](https://huggingface.co/docs/transformers/model_doc/yolos#transformers.YolosModel)
+* [helium](https://huggingface.co/docs/transformers/main/en/model_doc/heliumtransformers.HeliumModel)
+
+
+
+FlashAttention can only be used for models with the `fp16` or `bf16` torch type, so make sure to cast your model to the appropriate type first. The memory-efficient attention backend is able to handle `fp32` models.
+
+
+
+
+
+SDPA does not support certain sets of attention parameters, such as `head_mask` and `output_attentions=True`.
+In that case, you should see a warning message and we will fall back to the (slower) eager implementation.
+
+
+
+By default, SDPA selects the most performant kernel available but you can check whether a backend is available in a given setting (hardware, problem size) with [`torch.nn.attention.sdpa_kernel`](https://pytorch.org/docs/stable/generated/torch.nn.attention.sdpa_kernel.html) as a context manager:
+
+```diff
+import torch
++ from torch.nn.attention import SDPBackend, sdpa_kernel
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", torch_dtype=torch.float16).to("cuda")
+
+input_text = "Hello my dog is cute and"
+inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
+
++ with sdpa_kernel(SDPBackend.FLASH_ATTENTION):
+ outputs = model.generate(**inputs)
+
+print(tokenizer.decode(outputs[0], skip_special_tokens=True))
+```
+
+If you see a bug with the traceback below, try using the nightly version of PyTorch which may have broader coverage for FlashAttention:
+
+```bash
+RuntimeError: No available kernel. Aborting execution.
+
+# install PyTorch nightly
+pip3 install -U --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118
+```
+
+## BetterTransformer
+
+
+
+Some BetterTransformer features are being upstreamed to Transformers with default support for native `torch.nn.scaled_dot_product_attention`. BetterTransformer still has a wider coverage than the Transformers SDPA integration, but you can expect more and more architectures to natively support SDPA in Transformers.
+
+
+
+
+
+Check out our benchmarks with BetterTransformer and scaled dot product attention in the [Out of the box acceleration and memory savings of ๐ค decoder models with PyTorch 2.0](https://pytorch.org/blog/out-of-the-box-acceleration/) and learn more about the fastpath execution in the [BetterTransformer](https://medium.com/pytorch/bettertransformer-out-of-the-box-performance-for-huggingface-transformers-3fbe27d50ab2) blog post.
+
+
+
+BetterTransformer accelerates inference with its fastpath (native PyTorch specialized implementation of Transformer functions) execution. The two optimizations in the fastpath execution are:
+
+1. fusion, which combines multiple sequential operations into a single "kernel" to reduce the number of computation steps
+2. skipping the inherent sparsity of padding tokens to avoid unnecessary computation with nested tensors
+
+BetterTransformer also converts all attention operations to use the more memory-efficient [scaled dot product attention (SDPA)](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention), and it calls optimized kernels like [FlashAttention](https://huggingface.co/papers/2205.14135) under the hood.
+
+Before you start, make sure you have ๐ค Optimum [installed](https://huggingface.co/docs/optimum/installation).
+
+Then you can enable BetterTransformer with the [`PreTrainedModel.to_bettertransformer`] method:
+
+```python
+model = model.to_bettertransformer()
+```
+
+You can return the original Transformers model with the [`~PreTrainedModel.reverse_bettertransformer`] method. You should use this before saving your model to use the canonical Transformers modeling:
+
+```py
+model = model.reverse_bettertransformer()
+model.save_pretrained("saved_model")
+```
+
+## bitsandbytes
+
+bitsandbytes is a quantization library that includes support for 4-bit and 8-bit quantization. Quantization reduces your model size compared to its native full precision version, making it easier to fit large models onto GPUs with limited memory.
+
+Make sure you have bitsandbytes and ๐ค Accelerate installed:
+
+```bash
+# these versions support 8-bit and 4-bit
+pip install bitsandbytes>=0.39.0 accelerate>=0.20.0
+
+# install Transformers
+pip install transformers
+```
+
+### 4-bit
+
+To load a model in 4-bit for inference, use the `load_in_4bit` parameter. The `device_map` parameter is optional, but we recommend setting it to `"auto"` to allow ๐ค Accelerate to automatically and efficiently allocate the model given the available resources in the environment.
+
+```py
+from transformers import AutoModelForCausalLM
+
+model_name = "bigscience/bloom-2b5"
+model_4bit = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto", load_in_4bit=True)
+```
+
+To load a model in 4-bit for inference with multiple GPUs, you can control how much GPU RAM you want to allocate to each GPU. For example, to distribute 600MB of memory to the first GPU and 1GB of memory to the second GPU:
+
+```py
+max_memory_mapping = {0: "600MB", 1: "1GB"}
+model_name = "bigscience/bloom-3b"
+model_4bit = AutoModelForCausalLM.from_pretrained(
+ model_name, torch_dtype="auto", device_map="auto", load_in_4bit=True, max_memory=max_memory_mapping
+)
+```
+
+### 8-bit
+
+
+
+If you're curious and interested in learning more about the concepts underlying 8-bit quantization, read the [Gentle Introduction to 8-bit Matrix Multiplication for transformers at scale using Hugging Face Transformers, Accelerate and bitsandbytes](https://huggingface.co/blog/hf-bitsandbytes-integration) blog post.
+
+
+
+To load a model in 8-bit for inference, use the `load_in_8bit` parameter. The `device_map` parameter is optional, but we recommend setting it to `"auto"` to allow ๐ค Accelerate to automatically and efficiently allocate the model given the available resources in the environment:
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+model_name = "bigscience/bloom-2b5"
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+
+If you're loading a model in 8-bit for text generation, you should use the [`~transformers.GenerationMixin.generate`] method instead of the [`Pipeline`] function which is not optimized for 8-bit models and will be slower. Some sampling strategies, like nucleus sampling, are also not supported by the [`Pipeline`] for 8-bit models. You should also place all inputs on the same device as the model:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model_name = "bigscience/bloom-2b5"
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+
+prompt = "Hello, my llama is cute"
+inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
+generated_ids = model.generate(**inputs)
+outputs = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
+```
+
+To load a model in 8-bit for inference with multiple GPUs, you can control how much GPU RAM you want to allocate to each GPU. For example, to distribute 1GB of memory to the first GPU and 2GB of memory to the second GPU:
+
+```py
+max_memory_mapping = {0: "1GB", 1: "2GB"}
+model_name = "bigscience/bloom-3b"
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ model_name, torch_dtype="auto", device_map="auto", load_in_8bit=True, max_memory=max_memory_mapping
+)
+```
+
+
+
+Feel free to try running a 11 billion parameter [T5 model](https://colab.research.google.com/drive/1YORPWx4okIHXnjW7MSAidXN29mPVNT7F?usp=sharing) or the 3 billion parameter [BLOOM model](https://colab.research.google.com/drive/1qOjXfQIAULfKvZqwCen8-MoWKGdSatZ4?usp=sharing) for inference on Google Colab's free tier GPUs!
+
+
+
+## ๐ค Optimum
+
+
+
+Learn more details about using ORT with ๐ค Optimum in the [Accelerated inference on NVIDIA GPUs](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/gpu#accelerated-inference-on-nvidia-gpus) and [Accelerated inference on AMD GPUs](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/amdgpu#accelerated-inference-on-amd-gpus) guides. This section only provides a brief and simple example.
+
+
+
+ONNX Runtime (ORT) is a model accelerator that supports accelerated inference on Nvidia GPUs, and AMD GPUs that use [ROCm](https://www.amd.com/en/products/software/rocm.html) stack. ORT uses optimization techniques like fusing common operations into a single node and constant folding to reduce the number of computations performed and speedup inference. ORT also places the most computationally intensive operations on the GPU and the rest on the CPU to intelligently distribute the workload between the two devices.
+
+ORT is supported by ๐ค Optimum which can be used in ๐ค Transformers. You'll need to use an [`~optimum.onnxruntime.ORTModel`] for the task you're solving, and specify the `provider` parameter which can be set to either [`CUDAExecutionProvider`](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/gpu#cudaexecutionprovider), [`ROCMExecutionProvider`](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/amdgpu) or [`TensorrtExecutionProvider`](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/gpu#tensorrtexecutionprovider). If you want to load a model that was not yet exported to ONNX, you can set `export=True` to convert your model on-the-fly to the ONNX format:
+
+```py
+from optimum.onnxruntime import ORTModelForSequenceClassification
+
+ort_model = ORTModelForSequenceClassification.from_pretrained(
+ "distilbert/distilbert-base-uncased-finetuned-sst-2-english",
+ export=True,
+ provider="CUDAExecutionProvider",
+)
+```
+
+Now you're free to use the model for inference:
+
+```py
+from optimum.pipelines import pipeline
+from transformers import AutoTokenizer
+
+tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased-finetuned-sst-2-english")
+
+pipeline = pipeline(task="text-classification", model=ort_model, tokenizer=tokenizer, device="cuda:0")
+result = pipeline("Both the music and visual were astounding, not to mention the actors performance.")
+```
+
+## Combine optimizations
+
+It is often possible to combine several of the optimization techniques described above to get the best inference performance possible for your model. For example, you can load a model in 4-bit, and then enable BetterTransformer with FlashAttention:
+
+```py
+import torch
+from torch.nn.attention import SDPBackend, sdpa_kernel
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+# load model in 4-bit
+quantization_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_compute_dtype=torch.float16
+)
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", torch_dtype="auto", quantization_config=quantization_config)
+
+# enable BetterTransformer
+model = model.to_bettertransformer()
+
+input_text = "Hello my dog is cute and"
+inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+# enable FlashAttention
+with sdpa_kernel(SDPBackend.FLASH_ATTENTION):
+ outputs = model.generate(**inputs)
+
+print(tokenizer.decode(outputs[0], skip_special_tokens=True))
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_torch_compile.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_torch_compile.md
new file mode 100644
index 0000000000000000000000000000000000000000..2155a403b2b77f79cb06a3fb314b2ccd8fb0a73b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_torch_compile.md
@@ -0,0 +1,365 @@
+
+
+# Optimize inference using torch.compile()
+
+This guide aims to provide a benchmark on the inference speed-ups introduced with [`torch.compile()`](https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html)ย for [computer vision models in ๐ค Transformers](https://huggingface.co/models?pipeline_tag=image-classification&library=transformers&sort=trending).
+
+## Benefits of torch.compile
+
+Depending on the model and the GPU, `torch.compile()` yields up to 30% speed-up during inference. To use `torch.compile()`, simply install any version of `torch` above 2.0.
+
+Compiling a model takes time, so it's useful if you are compiling the model only once instead of every time you infer.
+To compile any computer vision model of your choice, call `torch.compile()` on the model as shown below:
+
+```diff
+from transformers import AutoModelForImageClassification
+
+model = AutoModelForImageClassification.from_pretrained(MODEL_ID).to(DEVICE)
++ model = torch.compile(model)
+```
+
+`compile()`ย comes with multiple modes for compiling, which essentially differ in compilation time and inference overhead. `max-autotune`ย takes longer than `reduce-overhead`ย but results in faster inference. Default mode is fastest for compilation but is not as efficient compared to `reduce-overhead` for inference time. In this guide, we used the default mode. You can learn more about it [here](https://pytorch.org/get-started/pytorch-2.0/#user-experience).
+
+We benchmarked `torch.compile` with different computer vision models, tasks, types of hardware, and batch sizes on `torch`ย version 2.0.1.
+
+## Benchmarking code
+
+Below you can find the benchmarking code for each task. We warm up the GPU before inference and take the mean time of 300 inferences, using the same image each time.
+
+### Image Classification with ViT
+
+```python
+import torch
+from PIL import Image
+import requests
+import numpy as np
+from transformers import AutoImageProcessor, AutoModelForImageClassification
+from accelerate.test_utils.testing import get_backend
+
+device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
+image = Image.open(requests.get(url, stream=True).raw)
+
+processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+model = AutoModelForImageClassification.from_pretrained("google/vit-base-patch16-224").to(device)
+model = torch.compile(model)
+
+processed_input = processor(image, return_tensors='pt').to(device)
+
+with torch.no_grad():
+ _ = model(**processed_input)
+
+```
+
+#### Object Detection with DETR
+
+```python
+from transformers import AutoImageProcessor, AutoModelForObjectDetection
+from accelerate.test_utils.testing import get_backend
+
+device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+processor = AutoImageProcessor.from_pretrained("facebook/detr-resnet-50")
+model = AutoModelForObjectDetection.from_pretrained("facebook/detr-resnet-50").to(device)
+model = torch.compile(model)
+
+texts = ["a photo of a cat", "a photo of a dog"]
+inputs = processor(text=texts, images=image, return_tensors="pt").to(device)
+
+with torch.no_grad():
+ _ = model(**inputs)
+```
+
+#### Image Segmentation with Segformer
+
+```python
+from transformers import SegformerImageProcessor, SegformerForSemanticSegmentation
+from accelerate.test_utils.testing import get_backend
+
+device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+processor = SegformerImageProcessor.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512")
+model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512").to(device)
+model = torch.compile(model)
+seg_inputs = processor(images=image, return_tensors="pt").to(device)
+
+with torch.no_grad():
+ _ = model(**seg_inputs)
+```
+
+Below you can find the list of the models we benchmarked.
+
+**Image Classification**
+- [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224)
+- [microsoft/beit-base-patch16-224-pt22k-ft22k](https://huggingface.co/microsoft/beit-base-patch16-224-pt22k-ft22k)
+- [facebook/convnext-large-224](https://huggingface.co/facebook/convnext-large-224)
+- [microsoft/resnet-50](https://huggingface.co/microsoft/resnet-50)
+
+**Image Segmentation**
+- [nvidia/segformer-b0-finetuned-ade-512-512](https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512)
+- [facebook/mask2former-swin-tiny-coco-panoptic](https://huggingface.co/facebook/mask2former-swin-tiny-coco-panoptic)
+- [facebook/maskformer-swin-base-ade](https://huggingface.co/facebook/maskformer-swin-base-ade)
+- [google/deeplabv3_mobilenet_v2_1.0_513](https://huggingface.co/google/deeplabv3_mobilenet_v2_1.0_513)
+
+**Object Detection**
+- [google/owlvit-base-patch32](https://huggingface.co/google/owlvit-base-patch32)
+- [facebook/detr-resnet-101](https://huggingface.co/facebook/detr-resnet-101)
+- [microsoft/conditional-detr-resnet-50](https://huggingface.co/microsoft/conditional-detr-resnet-50)
+
+Below you can find visualization of inference durations with and without `torch.compile()`ย and percentage improvements for each model in different hardware and batch sizes.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Below you can find inference durations in milliseconds for each model with and without `compile()`. Note that OwlViT results in OOM in larger batch sizes.
+
+### A100 (batch size: 1)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 9.325 | 7.584 |
+| Image Segmentation/Segformer | 11.759 | 10.500 |
+| Object Detection/OwlViT | 24.978 | 18.420 |
+| Image Classification/BeiT | 11.282 | 8.448 |
+| Object Detection/DETR | 34.619 | 19.040 |
+| Image Classification/ConvNeXT | 10.410 | 10.208 |
+| Image Classification/ResNet | 6.531 | 4.124 |
+| Image Segmentation/Mask2former | 60.188 | 49.117 |
+| Image Segmentation/Maskformer | 75.764 | 59.487 |
+| Image Segmentation/MobileNet | 8.583 | 3.974 |
+| Object Detection/Resnet-101 | 36.276 | 18.197 |
+| Object Detection/Conditional-DETR | 31.219 | 17.993 |
+
+
+### A100 (batch size: 4)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 14.832 | 14.499 |
+| Image Segmentation/Segformer | 18.838 | 16.476 |
+| Image Classification/BeiT | 13.205 | 13.048 |
+| Object Detection/DETR | 48.657 | 32.418|
+| Image Classification/ConvNeXT | 22.940 | 21.631 |
+| Image Classification/ResNet | 6.657 | 4.268 |
+| Image Segmentation/Mask2former | 74.277 | 61.781 |
+| Image Segmentation/Maskformer | 180.700 | 159.116 |
+| Image Segmentation/MobileNet | 14.174 | 8.515 |
+| Object Detection/Resnet-101 | 68.101 | 44.998 |
+| Object Detection/Conditional-DETR | 56.470 | 35.552 |
+
+### A100 (batch size: 16)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 40.944 | 40.010 |
+| Image Segmentation/Segformer | 37.005 | 31.144 |
+| Image Classification/BeiT | 41.854 | 41.048 |
+| Object Detection/DETR | 164.382 | 161.902 |
+| Image Classification/ConvNeXT | 82.258 | 75.561 |
+| Image Classification/ResNet | 7.018 | 5.024 |
+| Image Segmentation/Mask2former | 178.945 | 154.814 |
+| Image Segmentation/Maskformer | 638.570 | 579.826 |
+| Image Segmentation/MobileNet | 51.693 | 30.310 |
+| Object Detection/Resnet-101 | 232.887 | 155.021 |
+| Object Detection/Conditional-DETR | 180.491 | 124.032 |
+
+### V100 (batch size: 1)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 10.495 | 6.00 |
+| Image Segmentation/Segformer | 13.321 | 5.862 |
+| Object Detection/OwlViT | 25.769 | 22.395 |
+| Image Classification/BeiT | 11.347 | 7.234 |
+| Object Detection/DETR | 33.951 | 19.388 |
+| Image Classification/ConvNeXT | 11.623 | 10.412 |
+| Image Classification/ResNet | 6.484 | 3.820 |
+| Image Segmentation/Mask2former | 64.640 | 49.873 |
+| Image Segmentation/Maskformer | 95.532 | 72.207 |
+| Image Segmentation/MobileNet | 9.217 | 4.753 |
+| Object Detection/Resnet-101 | 52.818 | 28.367 |
+| Object Detection/Conditional-DETR | 39.512 | 20.816 |
+
+### V100 (batch size: 4)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 15.181 | 14.501 |
+| Image Segmentation/Segformer | 16.787 | 16.188 |
+| Image Classification/BeiT | 15.171 | 14.753 |
+| Object Detection/DETR | 88.529 | 64.195 |
+| Image Classification/ConvNeXT | 29.574 | 27.085 |
+| Image Classification/ResNet | 6.109 | 4.731 |
+| Image Segmentation/Mask2former | 90.402 | 76.926 |
+| Image Segmentation/Maskformer | 234.261 | 205.456 |
+| Image Segmentation/MobileNet | 24.623 | 14.816 |
+| Object Detection/Resnet-101 | 134.672 | 101.304 |
+| Object Detection/Conditional-DETR | 97.464 | 69.739 |
+
+### V100 (batch size: 16)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 52.209 | 51.633 |
+| Image Segmentation/Segformer | 61.013 | 55.499 |
+| Image Classification/BeiT | 53.938 | 53.581 |
+| Object Detection/DETR | OOM | OOM |
+| Image Classification/ConvNeXT | 109.682 | 100.771 |
+| Image Classification/ResNet | 14.857 | 12.089 |
+| Image Segmentation/Mask2former | 249.605 | 222.801 |
+| Image Segmentation/Maskformer | 831.142 | 743.645 |
+| Image Segmentation/MobileNet | 93.129 | 55.365 |
+| Object Detection/Resnet-101 | 482.425 | 361.843 |
+| Object Detection/Conditional-DETR | 344.661 | 255.298 |
+
+### T4 (batch size: 1)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 16.520 | 15.786 |
+| Image Segmentation/Segformer | 16.116 | 14.205 |
+| Object Detection/OwlViT | 53.634 | 51.105 |
+| Image Classification/BeiT | 16.464 | 15.710 |
+| Object Detection/DETR | 73.100 | 53.99 |
+| Image Classification/ConvNeXT | 32.932 | 30.845 |
+| Image Classification/ResNet | 6.031 | 4.321 |
+| Image Segmentation/Mask2former | 79.192 | 66.815 |
+| Image Segmentation/Maskformer | 200.026 | 188.268 |
+| Image Segmentation/MobileNet | 18.908 | 11.997 |
+| Object Detection/Resnet-101 | 106.622 | 82.566 |
+| Object Detection/Conditional-DETR | 77.594 | 56.984 |
+
+### T4 (batch size: 4)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 43.653 | 43.626 |
+| Image Segmentation/Segformer | 45.327 | 42.445 |
+| Image Classification/BeiT | 52.007 | 51.354 |
+| Object Detection/DETR | 277.850 | 268.003 |
+| Image Classification/ConvNeXT | 119.259 | 105.580 |
+| Image Classification/ResNet | 13.039 | 11.388 |
+| Image Segmentation/Mask2former | 201.540 | 184.670 |
+| Image Segmentation/Maskformer | 764.052 | 711.280 |
+| Image Segmentation/MobileNet | 74.289 | 48.677 |
+| Object Detection/Resnet-101 | 421.859 | 357.614 |
+| Object Detection/Conditional-DETR | 289.002 | 226.945 |
+
+### T4 (batch size: 16)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 163.914 | 160.907 |
+| Image Segmentation/Segformer | 192.412 | 163.620 |
+| Image Classification/BeiT | 188.978 | 187.976 |
+| Object Detection/DETR | OOM | OOM |
+| Image Classification/ConvNeXT | 422.886 | 388.078 |
+| Image Classification/ResNet | 44.114 | 37.604 |
+| Image Segmentation/Mask2former | 756.337 | 695.291 |
+| Image Segmentation/Maskformer | 2842.940 | 2656.88 |
+| Image Segmentation/MobileNet | 299.003 | 201.942 |
+| Object Detection/Resnet-101 | 1619.505 | 1262.758 |
+| Object Detection/Conditional-DETR | 1137.513 | 897.390|
+
+## PyTorch Nightly
+We also benchmarked on PyTorch nightly (2.1.0dev, find the wheel [here](https://download.pytorch.org/whl/nightly/cu118)) and observed improvement in latency both for uncompiled and compiled models.
+
+### A100
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/BeiT | Unbatched | 12.462 | 6.954 |
+| Image Classification/BeiT | 4 | 14.109 | 12.851 |
+| Image Classification/BeiT | 16 | 42.179 | 42.147 |
+| Object Detection/DETR | Unbatched | 30.484 | 15.221 |
+| Object Detection/DETR | 4 | 46.816 | 30.942 |
+| Object Detection/DETR | 16 | 163.749 | 163.706 |
+
+### T4
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/BeiT | Unbatched | 14.408 | 14.052 |
+| Image Classification/BeiT | 4 | 47.381 | 46.604 |
+| Image Classification/BeiT | 16 | 42.179 | 42.147 |
+| Object Detection/DETR | Unbatched | 68.382 | 53.481 |
+| Object Detection/DETR | 4 | 269.615 | 204.785 |
+| Object Detection/DETR | 16 | OOM | OOM |
+
+### V100
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/BeiT | Unbatched | 13.477 | 7.926 |
+| Image Classification/BeiT | 4 | 15.103 | 14.378 |
+| Image Classification/BeiT | 16 | 52.517 | 51.691 |
+| Object Detection/DETR | Unbatched | 28.706 | 19.077 |
+| Object Detection/DETR | 4 | 88.402 | 62.949|
+| Object Detection/DETR | 16 | OOM | OOM |
+
+
+## Reduce Overhead
+We benchmarked `reduce-overhead` compilation mode for A100 and T4 in Nightly.
+
+### A100
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/ConvNeXT | Unbatched | 11.758 | 7.335 |
+| Image Classification/ConvNeXT | 4 | 23.171 | 21.490 |
+| Image Classification/ResNet | Unbatched | 7.435 | 3.801 |
+| Image Classification/ResNet | 4 | 7.261 | 2.187 |
+| Object Detection/Conditional-DETR | Unbatched | 32.823 | 11.627 |
+| Object Detection/Conditional-DETR | 4 | 50.622 | 33.831 |
+| Image Segmentation/MobileNet | Unbatched | 9.869 | 4.244 |
+| Image Segmentation/MobileNet | 4 | 14.385 | 7.946 |
+
+
+### T4
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/ConvNeXT | Unbatched | 32.137 | 31.84 |
+| Image Classification/ConvNeXT | 4 | 120.944 | 110.209 |
+| Image Classification/ResNet | Unbatched | 9.761 | 7.698 |
+| Image Classification/ResNet | 4 | 15.215 | 13.871 |
+| Object Detection/Conditional-DETR | Unbatched | 72.150 | 57.660 |
+| Object Detection/Conditional-DETR | 4 | 301.494 | 247.543 |
+| Image Segmentation/MobileNet | Unbatched | 22.266 | 19.339 |
+| Image Segmentation/MobileNet | 4 | 78.311 | 50.983 |
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_cpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_cpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..ab2f735ecbdd50e01c7ff61c18a4412af4f4a670
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_cpu.md
@@ -0,0 +1,82 @@
+
+
+# Efficient Training on CPU
+
+This guide focuses on training large models efficiently on CPU.
+
+## Mixed precision with IPEX
+Mixed precision uses single (fp32) and half-precision (bf16/fp16) data types in a model to accelerate training or inference while still preserving much of the single-precision accuracy. Modern CPUs such as 3rd, 4th, and 5th Gen Intelยฎ Xeonยฎ Scalable processors natively support bf16. 6th Gen Intelยฎ Xeonยฎ Scalable processors natively support bf16 and fp16. You should get more performance out of the box by enabling mixed precision training with bf16 or fp16.
+
+To further maximize training performance, you can use Intelยฎ Extension for PyTorch (IPEX), which is a library built on PyTorch and adds additional CPU instruction level architecture (ISA) level support such as Intelยฎ Advanced Vector Extensions 512 Vector Neural Network Instructions (Intelยฎ AVX512-VNNI), and Intelยฎ Advanced Matrix Extensions (Intelยฎ AMX) for an extra performance boost on Intel CPUs. However, CPUs with only AVX2 (e.g., AMD or older Intel CPUs) are not guaranteed to have better performance under IPEX.
+
+Auto Mixed Precision (AMP) for CPU backends has been enabled since PyTorch 1.10. AMP support for bf16/fp16 on CPUs and bf16/fp16 operator optimization is also supported in IPEX and partially upstreamed to the main PyTorch branch. You can get better performance and user experience with IPEX AMP.
+
+Check more detailed information for [Auto Mixed Precision](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/amp.html).
+
+### IPEX installation:
+
+IPEX release is following PyTorch, to install via pip:
+
+| PyTorch Version | IPEX version |
+| :---------------: | :----------: |
+| 2.5.0 | 2.5.0+cpu |
+| 2.4.0 | 2.4.0+cpu |
+| 2.3.0 | 2.3.0+cpu |
+| 2.2.0 | 2.2.0+cpu |
+
+Please run `pip list | grep torch` to get your `pytorch_version`, so you can get the `IPEX version_name`.
+```bash
+pip install intel_extension_for_pytorch== -f https://developer.intel.com/ipex-whl-stable-cpu
+```
+You can check the latest versions in [ipex-whl-stable-cpu](https://developer.intel.com/ipex-whl-stable-cpu) if needed.
+
+Check more approaches for [IPEX installation](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/installation.html).
+
+### Usage in Trainer
+To enable auto mixed precision with IPEX in Trainer, users should add `use_ipex`, `bf16` or `fp16`, and `no_cuda` in training command arguments.
+
+Take an example of the use cases on [Transformers question-answering](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)
+
+- Training with IPEX using BF16 auto mixed precision on CPU:
+ python examples/pytorch/question-answering/run_qa.py \
+--model_name_or_path google-bert/bert-base-uncased \
+--dataset_name squad \
+--do_train \
+--do_eval \
+--per_device_train_batch_size 12 \
+--learning_rate 3e-5 \
+--num_train_epochs 2 \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/debug_squad/ \
+--use_ipex \
+--bf16 \
+--use_cpu
+
+If you want to enable `use_ipex` and `bf16` in your script, add these parameters to `TrainingArguments` like this:
+```diff
+training_args = TrainingArguments(
+ output_dir=args.output_path,
++ bf16=True,
++ use_ipex=True,
++ use_cpu=True,
+ **kwargs
+)
+```
+
+### Practice example
+
+Blog: [Accelerating PyTorch Transformers with Intel Sapphire Rapids](https://huggingface.co/blog/intel-sapphire-rapids)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_cpu_many.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_cpu_many.md
new file mode 100644
index 0000000000000000000000000000000000000000..d6a029c471de083b65c8d8e4c046bd18b28305bc
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_cpu_many.md
@@ -0,0 +1,308 @@
+
+
+# Efficient Training on Multiple CPUs
+
+When training on a single CPU is too slow, we can use multiple CPUs. This guide focuses on PyTorch-based DDP enabling
+distributed CPU training efficiently on [bare metal](#usage-in-trainer) and [Kubernetes](#usage-with-kubernetes).
+
+## Intelยฎ oneCCL Bindings for PyTorch
+
+[Intelยฎ oneCCL](https://github.com/oneapi-src/oneCCL) (collective communications library) is a library for efficient distributed deep learning training implementing such collectives like allreduce, allgather, alltoall. For more information on oneCCL, please refer to the [oneCCL documentation](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html) and [oneCCL specification](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html).
+
+Module `oneccl_bindings_for_pytorch` (`torch_ccl` before version 1.12) implements PyTorch C10D ProcessGroup API and can be dynamically loaded as external ProcessGroup and only works on Linux platform now
+
+Check more detailed information for [oneccl_bind_pt](https://github.com/intel/torch-ccl).
+
+### Intelยฎ oneCCL Bindings for PyTorch installation
+
+Wheel files are available for the following Python versions:
+
+| Extension Version | Python 3.7 | Python 3.8 | Python 3.9 | Python 3.10 | Python 3.11 |
+| :---------------: | :--------: | :--------: | :--------: | :---------: | :---------: |
+| 2.5.0 | | โ | โ | โ | โ |
+| 2.4.0 | | โ | โ | โ | โ |
+| 2.3.0 | | โ | โ | โ | โ |
+| 2.2.0 | | โ | โ | โ | โ |
+
+Please run `pip list | grep torch` to get your `pytorch_version`.
+```bash
+pip install oneccl_bind_pt=={pytorch_version} -f https://developer.intel.com/ipex-whl-stable-cpu
+```
+where `{pytorch_version}` should be your PyTorch version, for instance 2.4.0.
+Check more approaches for [oneccl_bind_pt installation](https://github.com/intel/torch-ccl).
+Versions of oneCCL and PyTorch must match.
+
+
+## Intelยฎ MPI library
+Use this standards-based MPI implementation to deliver flexible, efficient, scalable cluster messaging on Intelยฎ architecture. This component is part of the Intelยฎ oneAPI HPC Toolkit.
+
+oneccl_bindings_for_pytorch is installed along with the MPI tool set. Need to source the environment before using it.
+
+```bash
+oneccl_bindings_for_pytorch_path=$(python -c "from oneccl_bindings_for_pytorch import cwd; print(cwd)")
+source $oneccl_bindings_for_pytorch_path/env/setvars.sh
+```
+
+#### Intelยฎ Extension for PyTorch installation
+
+Intel Extension for PyTorch (IPEX) provides performance optimizations for CPU training with both Float32 and BFloat16 (refer to the [single CPU section](./perf_train_cpu) to learn more).
+
+
+The following "Usage in Trainer" takes mpirun in Intelยฎ MPI library as an example.
+
+
+## Usage in Trainer
+To enable multi CPU distributed training in the Trainer with the ccl backend, users should add **`--ddp_backend ccl`** in the command arguments.
+
+Let's see an example with the [question-answering example](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)
+
+
+The following command enables training with 2 processes on one Xeon node, with one process running per one socket. The variables OMP_NUM_THREADS/CCL_WORKER_COUNT can be tuned for optimal performance.
+```shell script
+ export CCL_WORKER_COUNT=1
+ export MASTER_ADDR=127.0.0.1
+ mpirun -n 2 -genv OMP_NUM_THREADS=23 \
+ python3 examples/pytorch/question-answering/run_qa.py \
+ --model_name_or_path google-bert/bert-large-uncased \
+ --dataset_name squad \
+ --do_train \
+ --do_eval \
+ --per_device_train_batch_size 12 \
+ --learning_rate 3e-5 \
+ --num_train_epochs 2 \
+ --max_seq_length 384 \
+ --doc_stride 128 \
+ --output_dir /tmp/debug_squad/ \
+ --no_cuda \
+ --ddp_backend ccl \
+ --use_ipex
+```
+The following command enables training with a total of four processes on two Xeons (node0 and node1, taking node0 as the main process), ppn (processes per node) is set to 2, with one process running per one socket. The variables OMP_NUM_THREADS/CCL_WORKER_COUNT can be tuned for optimal performance.
+
+In node0, you need to create a configuration file which contains the IP addresses of each node (for example hostfile) and pass that configuration file path as an argument.
+```shell script
+ cat hostfile
+ xxx.xxx.xxx.xxx #node0 ip
+ xxx.xxx.xxx.xxx #node1 ip
+```
+Now, run the following command in node0 and **4DDP** will be enabled in node0 and node1 with BF16 auto mixed precision:
+```shell script
+ export CCL_WORKER_COUNT=1
+ export MASTER_ADDR=xxx.xxx.xxx.xxx #node0 ip
+ mpirun -f hostfile -n 4 -ppn 2 \
+ -genv OMP_NUM_THREADS=23 \
+ python3 examples/pytorch/question-answering/run_qa.py \
+ --model_name_or_path google-bert/bert-large-uncased \
+ --dataset_name squad \
+ --do_train \
+ --do_eval \
+ --per_device_train_batch_size 12 \
+ --learning_rate 3e-5 \
+ --num_train_epochs 2 \
+ --max_seq_length 384 \
+ --doc_stride 128 \
+ --output_dir /tmp/debug_squad/ \
+ --no_cuda \
+ --ddp_backend ccl \
+ --use_ipex \
+ --bf16
+```
+
+## Usage with Kubernetes
+
+The same distributed training job from the previous section can be deployed to a Kubernetes cluster using the
+[Kubeflow PyTorchJob training operator](https://www.kubeflow.org/docs/components/training/user-guides/pytorch).
+
+### Setup
+
+This example assumes that you have:
+* Access to a Kubernetes cluster with [Kubeflow installed](https://www.kubeflow.org/docs/started/installing-kubeflow)
+* [`kubectl`](https://kubernetes.io/docs/tasks/tools) installed and configured to access the Kubernetes cluster
+* A [Persistent Volume Claim (PVC)](https://kubernetes.io/docs/concepts/storage/persistent-volumes) that can be used
+ to store datasets and model files. There are multiple options for setting up the PVC including using an NFS
+ [storage class](https://kubernetes.io/docs/concepts/storage/storage-classes) or a cloud storage bucket.
+* A Docker container that includes your model training script and all the dependencies needed to run the script. For
+ distributed CPU training jobs, this typically includes PyTorch, Transformers, Intel Extension for PyTorch, Intel
+ oneCCL Bindings for PyTorch, and OpenSSH to communicate between the containers.
+
+The snippet below is an example of a Dockerfile that uses a base image that supports distributed CPU training and then
+extracts a Transformers release to the `/workspace` directory, so that the example scripts are included in the image:
+```dockerfile
+FROM intel/intel-optimized-pytorch:2.4.0-pip-multinode
+
+RUN apt-get update -y && \
+ apt-get install -y --no-install-recommends --fix-missing \
+ google-perftools \
+ libomp-dev
+
+WORKDIR /workspace
+
+# Download and extract the transformers code
+ARG HF_TRANSFORMERS_VER="4.46.0"
+RUN pip install --no-cache-dir \
+ transformers==${HF_TRANSFORMERS_VER} && \
+ mkdir transformers && \
+ curl -sSL --retry 5 https://github.com/huggingface/transformers/archive/refs/tags/v${HF_TRANSFORMERS_VER}.tar.gz | tar -C transformers --strip-components=1 -xzf -
+```
+The image needs to be built and copied to the cluster's nodes or pushed to a container registry prior to deploying the
+PyTorchJob to the cluster.
+
+### PyTorchJob Specification File
+
+The [Kubeflow PyTorchJob](https://www.kubeflow.org/docs/components/training/user-guides/pytorch) is used to run the distributed
+training job on the cluster. The yaml file for the PyTorchJob defines parameters such as:
+ * The name of the PyTorchJob
+ * The number of replicas (workers)
+ * The python script and it's parameters that will be used to run the training job
+ * The types of resources (node selector, memory, and CPU) needed for each worker
+ * The image/tag for the Docker container to use
+ * Environment variables
+ * A volume mount for the PVC
+
+The volume mount defines a path where the PVC will be mounted in the container for each worker pod. This location can be
+used for the dataset, checkpoint files, and the saved model after training completes.
+
+The snippet below is an example of a yaml file for a PyTorchJob with 4 workers running the
+[question-answering example](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering).
+```yaml
+apiVersion: "kubeflow.org/v1"
+kind: PyTorchJob
+metadata:
+ name: transformers-pytorchjob
+spec:
+ elasticPolicy:
+ rdzvBackend: c10d
+ minReplicas: 1
+ maxReplicas: 4
+ maxRestarts: 10
+ pytorchReplicaSpecs:
+ Worker:
+ replicas: 4 # The number of worker pods
+ restartPolicy: OnFailure
+ template:
+ spec:
+ containers:
+ - name: pytorch
+ image: : # Specify the docker image to use for the worker pods
+ imagePullPolicy: IfNotPresent
+ command: ["/bin/bash", "-c"]
+ args:
+ - >-
+ cd /workspace/transformers;
+ pip install -r /workspace/transformers/examples/pytorch/question-answering/requirements.txt;
+ source /usr/local/lib/python3.10/dist-packages/oneccl_bindings_for_pytorch/env/setvars.sh;
+ torchrun /workspace/transformers/examples/pytorch/question-answering/run_qa.py \
+ --model_name_or_path distilbert/distilbert-base-uncased \
+ --dataset_name squad \
+ --do_train \
+ --do_eval \
+ --per_device_train_batch_size 12 \
+ --learning_rate 3e-5 \
+ --num_train_epochs 2 \
+ --max_seq_length 384 \
+ --doc_stride 128 \
+ --output_dir /tmp/pvc-mount/output_$(date +%Y%m%d_%H%M%S) \
+ --no_cuda \
+ --ddp_backend ccl \
+ --bf16 \
+ --use_ipex;
+ env:
+ - name: LD_PRELOAD
+ value: "/usr/lib/x86_64-linux-gnu/libtcmalloc.so.4.5.9:/usr/local/lib/libiomp5.so"
+ - name: TRANSFORMERS_CACHE
+ value: "/tmp/pvc-mount/transformers_cache"
+ - name: HF_DATASETS_CACHE
+ value: "/tmp/pvc-mount/hf_datasets_cache"
+ - name: LOGLEVEL
+ value: "INFO"
+ - name: CCL_WORKER_COUNT
+ value: "1"
+ - name: OMP_NUM_THREADS # Can be tuned for optimal performance
+ value: "240"
+ resources:
+ limits:
+ cpu: 240 # Update the CPU and memory limit values based on your nodes
+ memory: 128Gi
+ requests:
+ cpu: 240 # Update the CPU and memory request values based on your nodes
+ memory: 128Gi
+ volumeMounts:
+ - name: pvc-volume
+ mountPath: /tmp/pvc-mount
+ - mountPath: /dev/shm
+ name: dshm
+ restartPolicy: Never
+ nodeSelector: # Optionally use nodeSelector to match a certain node label for the worker pods
+ node-type: gnr
+ volumes:
+ - name: pvc-volume
+ persistentVolumeClaim:
+ claimName: transformers-pvc
+ - name: dshm
+ emptyDir:
+ medium: Memory
+```
+To run this example, update the yaml based on your training script and the nodes in your cluster.
+
+
+
+The CPU resource limits/requests in the yaml are defined in
+[cpu units](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#meaning-of-cpu)
+where 1 CPU unit is equivalent to 1 physical CPU core or 1 virtual core (depending on whether the node is a physical
+host or a VM). The amount of CPU and memory limits/requests defined in the yaml should be less than the amount of
+available CPU/memory capacity on a single machine. It is usually a good idea to not use the entire machine's capacity in
+order to leave some resources for the kubelet and OS. In order to get ["guaranteed"](https://kubernetes.io/docs/concepts/workloads/pods/pod-qos/#guaranteed)
+[quality of service](https://kubernetes.io/docs/tasks/configure-pod-container/quality-service-pod) for the worker pods,
+set the same CPU and memory amounts for both the resource limits and requests.
+
+
+
+### Deploy
+
+After the PyTorchJob spec has been updated with values appropriate for your cluster and training job, it can be deployed
+to the cluster using:
+```bash
+export NAMESPACE=
+
+kubectl create -f pytorchjob.yaml -n ${NAMESPACE}
+```
+
+The `kubectl get pods -n ${NAMESPACE}` command can then be used to list the pods in your namespace. You should see
+the worker pods for the PyTorchJob that was just deployed. At first, they will probably have a status of "Pending" as
+the containers get pulled and created, then the status should change to "Running".
+```
+NAME READY STATUS RESTARTS AGE
+...
+transformers-pytorchjob-worker-0 1/1 Running 0 7m37s
+transformers-pytorchjob-worker-1 1/1 Running 0 7m37s
+transformers-pytorchjob-worker-2 1/1 Running 0 7m37s
+transformers-pytorchjob-worker-3 1/1 Running 0 7m37s
+...
+```
+
+The logs for worker can be viewed using `kubectl logs -n ${NAMESPACE}`. Add `-f` to stream the logs, for example:
+```bash
+kubectl logs transformers-pytorchjob-worker-0 -n ${NAMESPACE} -f
+```
+
+After the training job completes, the trained model can be copied from the PVC or storage location. When you are done
+with the job, the PyTorchJob resource can be deleted from the cluster using `kubectl delete -f pytorchjob.yaml -n ${NAMESPACE}`.
+
+## Summary
+
+This guide covered running distributed PyTorch training jobs using multiple CPUs on bare metal and on a Kubernetes
+cluster. Both cases utilize Intel Extension for PyTorch and Intel oneCCL Bindings for PyTorch for optimal training
+performance, and can be used as a template to run your own workload on multiple nodes.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_gpu_many.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_gpu_many.md
new file mode 100644
index 0000000000000000000000000000000000000000..c810a18470a09e370a7d53b0250927742dc7b42d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_gpu_many.md
@@ -0,0 +1,668 @@
+
+
+# Efficient Training on Multiple GPUs
+
+If training a model on a single GPU is too slow or if the model's weights do not fit in a single GPU's memory, transitioning
+to a multi-GPU setup may be a viable option. Prior to making this transition, thoroughly explore all the strategies covered
+in the [Methods and tools for efficient training on a single GPU](perf_train_gpu_one) as they are universally applicable
+to model training on any number of GPUs. Once you have employed those strategies and found them insufficient for your
+case on a single GPU, consider moving to multiple GPUs.
+
+Transitioning from a single GPU to multiple GPUs requires the introduction of some form of parallelism, as the workload
+must be distributed across the resources. Multiple techniques can be employed to achieve parallelism, such as data
+parallelism, tensor parallelism, and pipeline parallelism. It's important to note that there isn't a one-size-fits-all
+solution, and the optimal settings depend on the specific hardware configuration you are using.
+
+This guide offers an in-depth overview of individual types of parallelism, as well as guidance on ways to combine
+techniques and choosing an appropriate approach. For step-by-step tutorials on distributed training, please refer to
+the [๐ค Accelerate documentation](https://huggingface.co/docs/accelerate/index).
+
+
+
+While the main concepts discussed in this guide are likely applicable across frameworks, here we focus on
+PyTorch-based implementations.
+
+
+
+Before diving deeper into the specifics of each technique, let's go over the rough decision process when training
+large models on a large infrastructure.
+
+## Scalability strategy
+
+Begin by estimating how much vRAM is required to train your model. For models hosted on the ๐ค Hub, use our
+[Model Memory Calculator](https://huggingface.co/spaces/hf-accelerate/model-memory-usage), which gives you
+accurate calculations within a few percent margin.
+
+**Parallelization strategy for a single Node / multi-GPU setup**
+
+When training a model on a single node with multiple GPUs, your choice of parallelization strategy can significantly
+impact performance. Here's a breakdown of your options:
+
+**Case 1: Your model fits onto a single GPU**
+
+If your model can comfortably fit onto a single GPU, you have two primary options:
+
+1. DDP - Distributed DataParallel
+2. [Zero Redundancy Optimizer (ZeRO)](https://arxiv.org/abs/1910.02054) - depending on the situation and configuration used, this method may or may not be faster, however, it's worth experimenting with it.
+
+**Case 2: Your model doesn't fit onto a single GPU:**
+
+If your model is too large for a single GPU, you have several alternatives to consider:
+
+1. PipelineParallel (PP)
+2. [ZeRO](https://arxiv.org/abs/1910.02054)
+3. [TensorParallel](#tensor-parallelism) (TP)
+
+With very fast inter-node connectivity (e.g., NVLINK or NVSwitch) all three strategies (PP, ZeRO, TP) should result in
+similar performance. However, without these, PP will be faster than TP or ZeRO. The degree of TP may also
+make a difference. It's best to experiment with your specific setup to determine the most suitable strategy.
+
+TP is almost always used within a single node. That is TP size <= GPUs per node.
+
+**Case 3: Largest layer of your model does not fit onto a single GPU**
+
+1. If you are not using ZeRO, you have to use TensorParallel (TP), because PipelineParallel (PP) alone won't be sufficient to accommodate the large layer.
+2. If you are using ZeRO, additionally adopt techniques from the [Methods and tools for efficient training on a single GPU](perf_train_gpu_one).
+
+**Parallelization strategy for a multi-Node / multi-GPU setup**
+
+* When you have fast inter-node connectivity (e.g., NVLINK or NVSwitch) consider using one of these options:
+
+ 1. ZeRO - as it requires close to no modifications to the model
+ 2. A combination of PipelineParallel(PP) with TensorParallel(TP) and DataParallel(DP) - this approach will result in fewer communications, but requires significant changes to the model
+
+* When you have slow inter-node connectivity and still low on GPU memory:
+
+ 1. Employ a combination of DataParallel(DP) with PipelineParallel(PP), TensorParallel(TP), and ZeRO.
+
+In the following sections of this guide we dig deeper into how these different parallelism methods work.
+
+## Data Parallelism
+
+Even with only 2 GPUs, you can readily leverage the accelerated training capabilities offered by PyTorch's built-in features,
+such as `DataParallel` (DP) and `DistributedDataParallel` (DDP). Note that
+[PyTorch documentation](https://pytorch.org/docs/master/generated/torch.nn.DataParallel.html) recommends to prefer
+`DistributedDataParallel` (DDP) over `DataParallel` (DP) for multi-GPU training as it works for all models.
+Let's take a look at how these two methods work and what makes them different.
+
+### DataParallel vs DistributedDataParallel
+
+To understand the key differences in inter-GPU communication overhead between the two methods, let's review the processes per batch:
+
+[DDP](https://pytorch.org/docs/master/notes/ddp.html):
+
+- At the start time the main process replicates the model once from GPU 0 to the rest of GPUs
+- Then for each batch:
+ 1. Each GPU directly consumes its mini-batch of data.
+ 2. During `backward`, once the local gradients are ready, they are averaged across all processes.
+
+[DP](https://pytorch.org/docs/master/generated/torch.nn.DataParallel.html):
+
+For each batch:
+ 1. GPU 0 reads the batch of data and then sends a mini-batch to each GPU.
+ 2. The up-to-date model is replicated from GPU 0 to each GPU.
+ 3. `forward` is executed, and output from each GPU is sent to GPU 0 to compute the loss.
+ 4. The loss is distributed from GPU 0 to all GPUs, and `backward` is run.
+ 5. Gradients from each GPU are sent to GPU 0 and averaged.
+
+Key differences include:
+1. DDP performs only a single communication per batch - sending gradients, while DP performs five different data exchanges per batch.
+DDP copies data using [torch.distributed](https://pytorch.org/docs/master/distributed.html), while DP copies data within
+the process via Python threads (which introduces limitations associated with GIL). As a result, **`DistributedDataParallel` (DDP) is generally faster than `DataParallel` (DP)** unless you have slow GPU card inter-connectivity.
+2. Under DP, GPU 0 performs significantly more work than other GPUs, resulting in GPU under-utilization.
+3. DDP supports distributed training across multiple machines, whereas DP does not.
+
+This is not an exhaustive list of differences between DP and DDP, however, other nuances are out of scope of this guide.
+You can get a deeper understanding of these methods by reading this [article](https://www.telesens.co/2019/04/04/distributed-data-parallel-training-using-pytorch-on-aws/).
+
+Let's illustrate the differences between DP and DDP with an experiment. We'll benchmark the differences between DP and
+DDP with an added context of NVLink presence:
+
+* Hardware: 2x TITAN RTX 24GB each + NVlink with 2 NVLinks (`NV2` in `nvidia-smi topo -m`).
+* Software: `pytorch-1.8-to-be` + `cuda-11.0` / `transformers==4.3.0.dev0`.
+
+To disable the NVLink feature on one of the benchmarks, we use `NCCL_P2P_DISABLE=1`.
+
+Here is the benchmarking code and outputs:
+
+**DP**
+
+```bash
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 \
+python examples/pytorch/language-modeling/run_clm.py \
+--model_name_or_path openai-community/gpt2 --dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 \
+--do_train --output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 110.5948, 'train_samples_per_second': 1.808, 'epoch': 0.69}
+```
+
+**DDP w/ NVlink**
+
+```bash
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 \
+torchrun --nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py \
+--model_name_or_path openai-community/gpt2 --dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 \
+--do_train --output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 101.9003, 'train_samples_per_second': 1.963, 'epoch': 0.69}
+```
+
+**DDP w/o NVlink**
+
+```bash
+rm -r /tmp/test-clm; NCCL_P2P_DISABLE=1 CUDA_VISIBLE_DEVICES=0,1 \
+torchrun --nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py \
+--model_name_or_path openai-community/gpt2 --dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 \
+--do_train --output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 131.4367, 'train_samples_per_second': 1.522, 'epoch': 0.69}
+```
+
+Here are the same benchmarking results gathered in a table for convenience:
+
+| Type | NVlink | Time |
+| :----- | ----- | ---: |
+| 2:DP | Y | 110s |
+| 2:DDP | Y | 101s |
+| 2:DDP | N | 131s |
+
+As you can see, in this case DP is ~10% slower than DDP with NVlink, but ~15% faster than DDP without NVlink.
+The real difference will depend on how much data each GPU needs to sync with the others - the more there is to sync,
+the more a slow link will impede the overall runtime.
+
+## ZeRO Data Parallelism
+
+ZeRO-powered data parallelism (ZeRO-DP) is illustrated in the following diagram from this [blog post](https://www.microsoft.com/en-us/research/blog/zero-deepspeed-new-system-optimizations-enable-training-models-with-over-100-billion-parameters/).
+
+
+
+
+
+While it may appear complex, it is a very similar concept to `DataParallel` (DP). The difference is that instead of
+replicating the full model parameters, gradients and optimizer states, each GPU stores only a slice of it. Then, at
+run-time when the full layer parameters are needed just for the given layer, all GPUs synchronize to give each other
+parts that they miss.
+
+To illustrate this idea, consider a simple model with 3 layers (La, Lb, and Lc), where each layer has 3 parameters.
+Layer La, for example, has weights a0, a1 and a2:
+
+```
+La | Lb | Lc
+---|----|---
+a0 | b0 | c0
+a1 | b1 | c1
+a2 | b2 | c2
+```
+
+If we have 3 GPUs, ZeRO-DP splits the model onto 3 GPUs like so:
+
+```
+GPU0:
+La | Lb | Lc
+---|----|---
+a0 | b0 | c0
+
+GPU1:
+La | Lb | Lc
+---|----|---
+a1 | b1 | c1
+
+GPU2:
+La | Lb | Lc
+---|----|---
+a2 | b2 | c2
+```
+
+In a way, this is the same horizontal slicing as tensor parallelism, as opposed to Vertical
+slicing, where one puts whole layer-groups on different GPUs. Now let's see how this works:
+
+Each of these GPUs will get the usual mini-batch as it works in DP:
+
+```
+x0 => GPU0
+x1 => GPU1
+x2 => GPU2
+```
+
+The inputs are passed without modifications as if they would be processed by the original model.
+
+First, the inputs get to the layer `La`. What happens at this point?
+
+On GPU0: the x0 mini-batch requires the a0, a1, a2 parameters to do its forward path through the layer, but the GPU0 has only a0.
+It will get a1 from GPU1 and a2 from GPU2, bringing all the pieces of the model together.
+
+In parallel, GPU1 gets another mini-batch - x1. GPU1 has the a1 parameter, but needs a0 and a2, so it gets those from GPU0 and GPU2.
+Same happens to GPU2 that gets the mini-batch x2. It gets a0 and a1 from GPU0 and GPU1.
+
+This way each of the 3 GPUs gets the full tensors reconstructed and makes a forward pass with its own mini-batch.
+As soon as the calculation is done, the data that is no longer needed gets dropped - it's only used during the calculation.
+The reconstruction is done efficiently via a pre-fetch.
+
+Then the whole process is repeated for layer Lb, then Lc forward-wise, and then backward Lc -> Lb -> La.
+
+
+
+This mechanism is similar to an efficient group backpacking strategy: person A carries the tent, person B carries the stove,
+and person C carries the axe. Each night they all share what they have with others and get from others what they don't have,
+and in the morning they pack up their allocated type of gear and continue on their way. This is what ZeRO DP/Sharded DDP is.
+Compare this strategy to the simple one where each person has to carry their own tent, stove and axe (similar to
+DataParallel (DP and DDP) in PyTorch), which would be far more inefficient.
+
+
+
+While reading the literature on this topic you may encounter the following synonyms: Sharded, Partitioned.
+If you pay close attention the way ZeRO partitions the model's weights - it looks very similar to tensor parallelism
+which will be discussed later. This is because it partitions/shards each layer's weights, unlike vertical model parallelism
+which is discussed next.
+
+Implementations:
+
+- [DeepSpeed](https://www.deepspeed.ai/tutorials/zero/) ZeRO-DP stages 1+2+3
+- [`Accelerate` integration](https://huggingface.co/docs/accelerate/en/usage_guides/deepspeed)
+- [`transformers` integration](main_classes/trainer#trainer-integrations)
+
+## From Naive Model Parallelism to Pipeline Parallelism
+
+To explain Pipeline parallelism, we'll first look into Naive Model Parallelism (MP), also known as Vertical MP. This approach
+involves distributing groups of model layers across multiple GPUs by assigning specific layers to specific GPUs with `.to()`.
+As data flows through these layers, it is moved to the same GPU as the layer, while the other layers remain untouched.
+
+We refer to this Model parallelism as "Vertical" because of how models are typically visualized. For example, the
+following diagram shows an 8-layer model split vertically into two slices, placing layers 0-3 onto
+GPU0 and 4-7 to GPU1:
+
+```
+================
+| Layer | |
+| 0 | |
+| 1 | GPU0 |
+| 2 | |
+| 3 | |
+================
+| Layer | |
+| 4 | |
+| 5 | GPU1 |
+| 6 | |
+| 7 | |
+================
+```
+
+In this example, when data moves from layer 0 to 3, it's no different from regular forward pass. However, passing data
+from layer 3 to 4 requires moving it from GPU0 to GPU1, introducing a communication overhead. If the participating
+GPUs are on the same compute node (e.g. same physical machine) this copying is fast, but if the GPUs are distributed
+across different compute nodes (e.g. multiple machines), the communication overhead could be substantially greater.
+
+Following that, layers 4 to 7 work as they would in the original model. Upon completion of the 7th layer, there is often
+a need to send the data back to layer 0 where the labels are (or alternatively send the labels to the last layer). Now the loss can be
+computed and the optimizer can do its work.
+
+Naive Model Parallelism comes several shortcomings:
+- **All but one GPU are idle at any given moment**: if 4 GPUs are used, it's nearly identical to quadrupling the amount of memory of a single GPU, and ignoring the rest of the hardware.
+- **Overhead in data transfer between devices**: E.g. 4x 6GB cards will be able to accommodate the same size as 1x 24GB card using naive MP, but a single 24GB card will complete the training faster, because it doesn't have the data copying overhead. But, say, if you have 40GB cards and need to fit a 45GB model you can with 4x 40GB cards (but barely because of the gradient and optimizer states)
+- **Copying shared embeddings**: Shared embeddings may need to get copied back and forth between GPUs.
+
+Now that you are familiar with how the naive approach to model parallelism works and its shortcomings, let's look at Pipeline Parallelism (PP).
+PP is almost identical to a naive MP, but it solves the GPU idling problem by chunking the incoming batch into micro-batches
+and artificially creating a pipeline, which allows different GPUs to concurrently participate in the computation process.
+
+The following illustration from the [GPipe paper](https://ai.googleblog.com/2019/03/introducing-gpipe-open-source-library.html)
+shows the naive MP on the top, and PP on the bottom:
+
+
+
+
+
+At the bottom of the diagram, you can observe that the Pipeline Parallelism (PP) approach minimizes the number of idle
+GPU zones, referred to as 'bubbles'. Both parts of the diagram show a parallelism level of degree 4, meaning that 4 GPUs
+are involved in the pipeline. You can see that there's a forward path of 4 pipe stages (F0, F1, F2 and F3) followed by
+a backward path in reverse order (B3, B2, B1, and B0).
+
+PP introduces a new hyperparameter to tune - `chunks`, which determines how many data chunks are sent in a sequence
+through the same pipe stage. For example, in the bottom diagram you can see `chunks=4`. GPU0 performs the same
+forward path on chunk 0, 1, 2 and 3 (F0,0, F0,1, F0,2, F0,3) and then it waits for other GPUs to do complete their work.
+Only when the other GPUs begin to complete their work, GPU0 starts to work again doing the backward path for chunks
+3, 2, 1 and 0 (B0,3, B0,2, B0,1, B0,0).
+
+Note that this is the same concept as gradient accumulation steps. PyTorch uses `chunks`, while DeepSpeed refers
+to the same hyperparameter as gradient accumulation steps.
+
+Because of the chunks, PP introduces the notion of micro-batches (MBS). DP splits the global data batch size into
+mini-batches, so if you have a DP degree of 4, a global batch size of 1024 gets split up into 4 mini-batches of
+256 each (1024/4). And if the number of `chunks` (or GAS) is 32 we end up with a micro-batch size of 8 (256/32). Each
+Pipeline stage works with a single micro-batch at a time. To calculate the global batch size of the DP + PP setup,
+use the formula: `mbs * chunks * dp_degree` (`8 * 32 * 4 = 1024`).
+With `chunks=1` you end up with the naive MP, which is inefficient. With a large `chunks` value you end up with
+tiny micro-batch sizes which is also inefficient. For this reason, we encourage to experiment with the `chunks` value to
+find the one that leads to the most efficient GPUs utilization.
+
+You may notice a bubble of "dead" time on the diagram that can't be parallelized because the last `forward` stage
+has to wait for `backward` to complete the pipeline. The purpose of finding the best value for `chunks` is to enable a high
+concurrent GPU utilization across all participating GPUs which translates to minimizing the size of the bubble.
+
+Pipeline API solutions have been implemented in:
+- PyTorch
+- DeepSpeed
+- Megatron-LM
+
+These come with some shortcomings:
+- They have to modify the model quite heavily, because Pipeline requires one to rewrite the normal flow of modules into a `nn.Sequential` sequence of the same, which may require changes to the design of the model.
+- Currently the Pipeline API is very restricted. If you had a bunch of Python variables being passed in the very first stage of the Pipeline, you will have to find a way around it. Currently, the pipeline interface requires either a single Tensor or a tuple of Tensors as the only input and output. These tensors must have a batch size as the very first dimension, since pipeline is going to chunk the mini batch into micro-batches. Possible improvements are being discussed here https://github.com/pytorch/pytorch/pull/50693
+- Conditional control flow at the level of pipe stages is not possible - e.g., Encoder-Decoder models like T5 require special workarounds to handle a conditional encoder stage.
+- They have to arrange each layer so that the output of one layer becomes an input to the other layer.
+
+More recent solutions include:
+- Varuna
+- Sagemaker
+
+We have not experimented with Varuna and SageMaker but their papers report that they have overcome the list of problems
+mentioned above and that they require smaller changes to the user's model.
+
+Implementations:
+- [PyTorch](https://pytorch.org/docs/stable/pipeline.html) (initial support in pytorch-1.8, and progressively getting improved in 1.9 and more so in 1.10). Some [examples](https://github.com/pytorch/pytorch/blob/master/benchmarks/distributed/pipeline/pipe.py)
+- [DeepSpeed](https://www.deepspeed.ai/tutorials/pipeline/)
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) has an internal implementation - no API.
+- [Varuna](https://github.com/microsoft/varuna)
+- [SageMaker](https://arxiv.org/abs/2111.05972) - this is a proprietary solution that can only be used on AWS.
+- [OSLO](https://github.com/tunib-ai/oslo) - this is implemented based on the Hugging Face Transformers.
+
+๐ค Transformers status: as of this writing none of the models supports full-PP. GPT2 and T5 models have naive MP support.
+The main obstacle is being unable to convert the models to `nn.Sequential` and have all the inputs to be Tensors. This
+is because currently the models include many features that make the conversion very complicated, and will need to be removed to accomplish that.
+
+DeepSpeed and Megatron-LM integrations are available in [๐ค Accelerate](https://huggingface.co/docs/accelerate/main/en/usage_guides/deepspeed)
+
+Other approaches:
+
+DeepSpeed, Varuna and SageMaker use the concept of an [Interleaved Pipeline](https://docs.aws.amazon.com/sagemaker/latest/dg/model-parallel-core-features.html)
+
+
+
+
+
+Here the bubble (idle time) is further minimized by prioritizing backward passes. Varuna further attempts to improve the
+schedule by using simulations to discover the most efficient scheduling.
+
+OSLO has pipeline parallelism implementation based on the Transformers without `nn.Sequential` conversion.
+
+## Tensor Parallelism
+
+In Tensor Parallelism, each GPU processes a slice of a tensor and only aggregates the full tensor for operations requiring it.
+To describe this method, this section of the guide relies on the concepts and diagrams from the [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
+paper: [Efficient Large-Scale Language Model Training on GPU Clusters](https://arxiv.org/abs/2104.04473).
+
+The main building block of any transformer is a fully connected `nn.Linear` followed by a nonlinear activation `GeLU`.
+The dot dot-product part of it, following the Megatron's paper notation, can be written as `Y = GeLU(XA)`, where `X` is
+an input vector, `Y` is the output vector, and `A` is the weight matrix.
+
+If we look at the computation in matrix form, you can see how the matrix multiplication can be split between multiple GPUs:
+
+
+
+
+
+If we split the weight matrix `A` column-wise across `N` GPUs and perform matrix multiplications `XA_1` through `XA_n` in parallel,
+then we will end up with `N` output vectors `Y_1, Y_2, ..., Y_n` which can be fed into `GeLU` independently:
+
+
+
+
+
+Using this principle, we can update a multi-layer perceptron of arbitrary depth, without the need for any synchronization
+between GPUs until the very end, where we need to reconstruct the output vector from shards. The Megatron-LM paper authors
+provide a helpful illustration for that:
+
+
+
+
+
+Parallelizing the multi-headed attention layers is even simpler, since they are already inherently parallel, due to having
+multiple independent heads!
+
+
+
+
+
+Special considerations: TP requires very fast network, and therefore it's not advisable to do TP across more than one node.
+Practically, if a node has 4 GPUs, the highest TP degree is therefore 4. If you need a TP degree of 8, you need to use
+nodes that have at least 8 GPUs.
+
+This section is based on the original much more [detailed TP overview](https://github.com/huggingface/transformers/issues/10321#issuecomment-783543530).
+by [@anton-l](https://github.com/anton-l).
+
+Alternative names:
+- DeepSpeed calls it [tensor slicing](https://www.deepspeed.ai/training/#model-parallelism)
+
+Implementations:
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) has an internal implementation, as it's very model-specific
+- [parallelformers](https://github.com/tunib-ai/parallelformers) (only inference at the moment)
+- [SageMaker](https://arxiv.org/abs/2111.05972) - this is a proprietary solution that can only be used on AWS.
+- [OSLO](https://github.com/tunib-ai/oslo) has the tensor parallelism implementation based on the Transformers.
+
+SageMaker combines TP with DP for a more efficient processing.
+
+๐ค Transformers status:
+- core: not yet implemented in the core
+- but if you want inference [parallelformers](https://github.com/tunib-ai/parallelformers) provides this support for most of our models. So until this is implemented in the core you can use theirs. And hopefully training mode will be supported too.
+- Deepspeed-Inference also supports our BERT, GPT-2, and GPT-Neo models in their super-fast CUDA-kernel-based inference mode, see more [here](https://www.deepspeed.ai/tutorials/inference-tutorial/)
+
+๐ค Accelerate integrates with [TP from Megatron-LM](https://huggingface.co/docs/accelerate/v0.23.0/en/usage_guides/megatron_lm).
+
+## Data Parallelism + Pipeline Parallelism
+
+The following diagram from the DeepSpeed [pipeline tutorial](https://www.deepspeed.ai/tutorials/pipeline/) demonstrates
+how one can combine DP with PP.
+
+
+
+
+
+Here it's important to see how DP rank 0 doesn't see GPU2 and DP rank 1 doesn't see GPU3. To DP there is just GPUs 0
+and 1 where it feeds data as if there were just 2 GPUs. GPU0 "secretly" offloads some of its load to GPU2 using PP.
+And GPU1 does the same by enlisting GPU3 to its aid.
+
+Since each dimension requires at least 2 GPUs, here you'd need at least 4 GPUs.
+
+Implementations:
+- [DeepSpeed](https://github.com/microsoft/DeepSpeed)
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
+- [Varuna](https://github.com/microsoft/varuna)
+- [SageMaker](https://arxiv.org/abs/2111.05972)
+- [OSLO](https://github.com/tunib-ai/oslo)
+
+๐ค Transformers status: not yet implemented
+
+## Data Parallelism + Pipeline Parallelism + Tensor Parallelism
+
+To get an even more efficient training a 3D parallelism is used where PP is combined with TP and DP. This can be seen in the following diagram.
+
+
+
+
+
+This diagram is from a blog post [3D parallelism: Scaling to trillion-parameter models](https://www.microsoft.com/en-us/research/blog/deepspeed-extreme-scale-model-training-for-everyone/), which is a good read as well.
+
+Since each dimension requires at least 2 GPUs, here you'd need at least 8 GPUs.
+
+Implementations:
+- [DeepSpeed](https://github.com/microsoft/DeepSpeed) - DeepSpeed also includes an even more efficient DP, which they call ZeRO-DP.
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
+- [Varuna](https://github.com/microsoft/varuna)
+- [SageMaker](https://arxiv.org/abs/2111.05972)
+- [OSLO](https://github.com/tunib-ai/oslo)
+
+๐ค Transformers status: not yet implemented, since we have no PP and TP.
+
+## ZeRO Data Parallelism + Pipeline Parallelism + Tensor Parallelism
+
+One of the main features of DeepSpeed is ZeRO, which is a super-scalable extension of DP. It has already been
+discussed in [ZeRO Data Parallelism](#zero-data-parallelism). Normally it's a standalone feature that doesn't require PP or TP.
+But it can be combined with PP and TP.
+
+When ZeRO-DP is combined with PP (and optionally TP) it typically enables only ZeRO stage 1 (optimizer sharding).
+
+While it's theoretically possible to use ZeRO stage 2 (gradient sharding) with Pipeline Parallelism, it will have negative
+performance impacts. There would need to be an additional reduce-scatter collective for every micro-batch to aggregate
+the gradients before sharding, which adds a potentially significant communication overhead. By nature of Pipeline Parallelism,
+small micro-batches are used and instead the focus is on trying to balance arithmetic intensity (micro-batch size) with
+minimizing the Pipeline bubble (number of micro-batches). Therefore those communication costs are going to impact the performance.
+
+In addition, there are already fewer layers than normal due to PP and so the memory savings won't be huge. PP already
+reduces gradient size by ``1/PP``, and so gradient sharding savings on top of that are less significant than pure DP.
+
+ZeRO stage 3 is not a good choice either for the same reason - more inter-node communications required.
+
+And since we have ZeRO, the other benefit is ZeRO-Offload. Since this is stage 1 optimizer states can be offloaded to CPU.
+
+Implementations:
+- [Megatron-DeepSpeed](https://github.com/microsoft/Megatron-DeepSpeed) and [Megatron-Deepspeed from BigScience](https://github.com/bigscience-workshop/Megatron-DeepSpeed), which is the fork of the former repo.
+- [OSLO](https://github.com/tunib-ai/oslo)
+
+Important papers:
+
+- [Using DeepSpeed and Megatron to Train Megatron-Turing NLG 530B, A Large-Scale Generative Language Model](
+https://arxiv.org/abs/2201.11990)
+
+๐ค Transformers status: not yet implemented, since we have no PP and TP.
+
+## FlexFlow
+
+[FlexFlow](https://github.com/flexflow/FlexFlow) also solves the parallelization problem in a slightly different approach.
+
+Paper: ["Beyond Data and Model Parallelism for Deep Neural Networks" by Zhihao Jia, Matei Zaharia, Alex Aiken](https://arxiv.org/abs/1807.05358)
+
+It performs a sort of 4D Parallelism over Sample-Operator-Attribute-Parameter.
+
+1. Sample = Data Parallelism (sample-wise parallel)
+2. Operator = Parallelize a single operation into several sub-operations
+3. Attribute = Data Parallelism (length-wise parallel)
+4. Parameter = Model Parallelism (regardless of dimension - horizontal or vertical)
+
+Examples:
+* Sample
+
+Let's take 10 batches of sequence length 512. If we parallelize them by sample dimension into 2 devices, we get 10 x 512 which becomes 5 x 2 x 512.
+
+* Operator
+
+If we perform layer normalization, we compute std first and mean second, and then we can normalize data.
+Operator parallelism allows computing std and mean in parallel. So if we parallelize them by operator dimension into 2
+devices (cuda:0, cuda:1), first we copy input data into both devices, and cuda:0 computes std, cuda:1 computes mean at the same time.
+
+* Attribute
+
+We have 10 batches of 512 length. If we parallelize them by attribute dimension into 2 devices, 10 x 512 will be 10 x 2 x 256.
+
+* Parameter
+
+It is similar with tensor model parallelism or naive layer-wise model parallelism.
+
+
+
+
+
+The significance of this framework is that it takes resources like (1) GPU/TPU/CPU vs. (2) RAM/DRAM vs. (3)
+fast-intra-connect/slow-inter-connect and it automatically optimizes all these algorithmically deciding which
+parallelisation to use where.
+
+One very important aspect is that FlexFlow is designed for optimizing DNN parallelizations for models with static and
+fixed workloads, since models with dynamic behavior may prefer different parallelization strategies across iterations.
+
+So the promise is very attractive - it runs a 30min simulation on the cluster of choice and it comes up with the best
+strategy to utilise this specific environment. If you add/remove/replace any parts it'll run and re-optimize the plan
+for that. And then you can train. A different setup will have its own custom optimization.
+
+๐ค Transformers status: Transformers models are FX-trace-able via [transformers.utils.fx](https://github.com/huggingface/transformers/blob/master/src/transformers/utils/fx.py),
+which is a prerequisite for FlexFlow, however, changes are required on the FlexFlow side to make it work with Transformers models.
+
+## GPU selection
+
+When training on multiple GPUs, you can specify the number of GPUs to use and in what order. This can be useful for instance when you have GPUs with different computing power and want to use the faster GPU first. The selection process works for both [DistributedDataParallel](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html) and [DataParallel](https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html) to use only a subset of the available GPUs, and you don't need Accelerate or the [DeepSpeed integration](./main_classes/deepspeed).
+
+### Number of GPUs
+
+For example, if you have 4 GPUs and you only want to use the first 2:
+
+
+
+
+Use the `--nproc_per_node` to select how many GPUs to use.
+
+```bash
+torchrun --nproc_per_node=2 trainer-program.py ...
+```
+
+
+
+
+Use `--num_processes` to select how many GPUs to use.
+
+```bash
+accelerate launch --num_processes 2 trainer-program.py ...
+```
+
+
+
+
+Use `--num_gpus` to select how many GPUs to use.
+
+```bash
+deepspeed --num_gpus 2 trainer-program.py ...
+```
+
+
+
+
+### Order of GPUs
+
+Now, to select which GPUs to use and their order, you'll use the `CUDA_VISIBLE_DEVICES` environment variable. It is easiest to set the environment variable in a `~/bashrc` or another startup config file. `CUDA_VISIBLE_DEVICES` is used to map which GPUs are used. For example, if you have 4 GPUs (0, 1, 2, 3) and you only want to run GPUs 0 and 2:
+
+```bash
+CUDA_VISIBLE_DEVICES=0,2 torchrun trainer-program.py ...
+```
+
+Only the 2 physical GPUs (0 and 2) are "visible" to PyTorch and these are mapped to `cuda:0` and `cuda:1` respectively. You can also reverse the order of the GPUs to use 2 first. Now, the mapping is `cuda:1` for GPU 0 and `cuda:0` for GPU 2.
+
+```bash
+CUDA_VISIBLE_DEVICES=2,0 torchrun trainer-program.py ...
+```
+
+You can also set the `CUDA_VISIBLE_DEVICES` environment variable to an empty value to create an environment without GPUs.
+
+```bash
+CUDA_VISIBLE_DEVICES= python trainer-program.py ...
+```
+
+
+
+As with any environment variable, they can be exported instead of being added to the command line. However, this is not recommended because it can be confusing if you forget how the environment variable was setup and you end up using the wrong GPUs. Instead, it is common practice to set the environment variable for a specific training run on the same command line.
+
+
+
+`CUDA_DEVICE_ORDER` is an alternative environment variable you can use to control how the GPUs are ordered. You can either order them by:
+
+1. PCIe bus ID's that matches the order of [`nvidia-smi`](https://developer.nvidia.com/nvidia-system-management-interface) and [`rocm-smi`](https://rocm.docs.amd.com/projects/rocm_smi_lib/en/latest/.doxygen/docBin/html/index.html) for NVIDIA and AMD GPUs respectively
+
+```bash
+export CUDA_DEVICE_ORDER=PCI_BUS_ID
+```
+
+2. GPU compute ability
+
+```bash
+export CUDA_DEVICE_ORDER=FASTEST_FIRST
+```
+
+The `CUDA_DEVICE_ORDER` is especially useful if your training setup consists of an older and newer GPU, where the older GPU appears first, but you cannot physically swap the cards to make the newer GPU appear first. In this case, set `CUDA_DEVICE_ORDER=FASTEST_FIRST` to always use the newer and faster GPU first (`nvidia-smi` or `rocm-smi` still reports the GPUs in their PCIe order). Or you could also set `export CUDA_VISIBLE_DEVICES=1,0`.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_gpu_one.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_gpu_one.md
new file mode 100644
index 0000000000000000000000000000000000000000..5d7ae312ee0ff0ad83373058e0b813267d1b8c1e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_gpu_one.md
@@ -0,0 +1,535 @@
+
+
+# Methods and tools for efficient training on a single GPU
+
+This guide demonstrates practical techniques that you can use to increase the efficiency of your model's training by
+optimizing memory utilization, speeding up the training, or both. If you'd like to understand how GPU is utilized during
+training, please refer to the [Model training anatomy](model_memory_anatomy) conceptual guide first. This guide
+focuses on practical techniques.
+
+
+
+If you have access to a machine with multiple GPUs, these approaches are still valid, plus you can leverage additional methods outlined in the [multi-GPU section](perf_train_gpu_many).
+
+
+
+When training large models, there are two aspects that should be considered at the same time:
+
+* Data throughput/training time
+* Model performance
+
+Maximizing the throughput (samples/second) leads to lower training cost. This is generally achieved by utilizing the GPU
+as much as possible and thus filling GPU memory to its limit. If the desired batch size exceeds the limits of the GPU memory,
+the memory optimization techniques, such as gradient accumulation, can help.
+
+However, if the preferred batch size fits into memory, there's no reason to apply memory-optimizing techniques because they can
+slow down the training. Just because one can use a large batch size, does not necessarily mean they should. As part of
+hyperparameter tuning, you should determine which batch size yields the best results and then optimize resources accordingly.
+
+The methods and tools covered in this guide can be classified based on the effect they have on the training process:
+
+| Method/tool | Improves training speed | Optimizes memory utilization |
+|:--------------------------------------------------------------------------------------------------------------------------------------------------------|:------------------------|:-----------------------------|
+| [Batch size choice](#batch-size-choice) | Yes | Yes |
+| [Gradient accumulation](#gradient-accumulation) | No | Yes |
+| [Gradient checkpointing](#gradient-checkpointing) | No | Yes |
+| [Mixed precision training](#mixed-precision-training) | Yes | Maybe* |
+| [torch_empty_cache_steps](https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments.torch_empty_cache_steps) | No | Yes |
+| [Optimizer choice](#optimizer-choice) | Yes | Yes |
+| [Data preloading](#data-preloading) | Yes | No |
+| [DeepSpeed Zero](#deepspeed-zero) | No | Yes |
+| [torch.compile](#using-torchcompile) | Yes | No |
+| [Parameter-Efficient Fine Tuning (PEFT)](#using--peft) | No | Yes |
+
+
+
+*Note: when using mixed precision with a small model and a large batch size, there will be some memory savings but with a
+large model and a small batch size, the memory use will be larger.
+
+
+
+You can combine the above methods to get a cumulative effect. These techniques are available to you whether you are
+training your model with [`Trainer`] or writing a pure PyTorch loop, in which case you can [configure these optimizations
+with ๐ค Accelerate](#using--accelerate).
+
+If these methods do not result in sufficient gains, you can explore the following options:
+* [Look into building your own custom Docker container with efficient software prebuilds](#efficient-software-prebuilds)
+* [Consider a model that uses Mixture of Experts (MoE)](#mixture-of-experts)
+* [Convert your model to BetterTransformer to leverage PyTorch native attention](#using-pytorch-native-attention-and-flash-attention)
+
+Finally, if all of the above is still not enough, even after switching to a server-grade GPU like A100, consider moving
+to a multi-GPU setup. All these approaches are still valid in a multi-GPU setup, plus you can leverage additional parallelism
+techniques outlined in the [multi-GPU section](perf_train_gpu_many).
+
+## Batch size choice
+
+To achieve optimal performance, start by identifying the appropriate batch size. It is recommended to use batch sizes and
+input/output neuron counts that are of size 2^N. Often it's a multiple of 8, but it can be
+higher depending on the hardware being used and the model's dtype.
+
+For reference, check out NVIDIA's recommendation for [input/output neuron counts](
+https://docs.nvidia.com/deeplearning/performance/dl-performance-fully-connected/index.html#input-features) and
+[batch size](https://docs.nvidia.com/deeplearning/performance/dl-performance-fully-connected/index.html#batch-size) for
+fully connected layers (which are involved in GEMMs (General Matrix Multiplications)).
+
+[Tensor Core Requirements](https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#requirements-tc)
+define the multiplier based on the dtype and the hardware. For instance, for fp16 data type a multiple of 8 is recommended, unless
+it's an A100 GPU, in which case use multiples of 64.
+
+For parameters that are small, consider also [Dimension Quantization Effects](https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#dim-quantization).
+This is where tiling happens and the right multiplier can have a significant speedup.
+
+## Gradient Accumulation
+
+The **gradient accumulation** method aims to calculate gradients in smaller increments instead of computing them for the
+entire batch at once. This approach involves iteratively calculating gradients in smaller batches by performing forward
+and backward passes through the model and accumulating the gradients during the process. Once a sufficient number of
+gradients have been accumulated, the model's optimization step is executed. By employing gradient accumulation, it
+becomes possible to increase the **effective batch size** beyond the limitations imposed by the GPU's memory capacity.
+However, it is important to note that the additional forward and backward passes introduced by gradient accumulation can
+slow down the training process.
+
+You can enable gradient accumulation by adding the `gradient_accumulation_steps` argument to [`TrainingArguments`]:
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=1, gradient_accumulation_steps=4, **default_args)
+```
+
+In the above example, your effective batch size becomes 4.
+
+Alternatively, use ๐ค Accelerate to gain full control over the training loop. Find the ๐ค Accelerate example
+[further down in this guide](#using--accelerate).
+
+While it is advised to max out GPU usage as much as possible, a high number of gradient accumulation steps can
+result in a more pronounced training slowdown. Consider the following example. Let's say, the `per_device_train_batch_size=4`
+without gradient accumulation hits the GPU's limit. If you would like to train with batches of size 64, do not set the
+`per_device_train_batch_size` to 1 and `gradient_accumulation_steps` to 64. Instead, keep `per_device_train_batch_size=4`
+and set `gradient_accumulation_steps=16`. This results in the same effective batch size while making better use of
+the available GPU resources.
+
+For additional information, please refer to batch size and gradient accumulation benchmarks for [RTX-3090](https://github.com/huggingface/transformers/issues/14608#issuecomment-1004392537)
+and [A100](https://github.com/huggingface/transformers/issues/15026#issuecomment-1005033957).
+
+## Gradient Checkpointing
+
+Some large models may still face memory issues even when the batch size is set to 1 and gradient accumulation is used.
+This is because there are other components that also require memory storage.
+
+Saving all activations from the forward pass in order to compute the gradients during the backward pass can result in
+significant memory overhead. The alternative approach of discarding the activations and recalculating them when needed
+during the backward pass, would introduce a considerable computational overhead and slow down the training process.
+
+**Gradient checkpointing** offers a compromise between these two approaches and saves strategically selected activations
+throughout the computational graph so only a fraction of the activations need to be re-computed for the gradients. For
+an in-depth explanation of gradient checkpointing, refer to [this great article](https://medium.com/tensorflow/fitting-larger-networks-into-memory-583e3c758ff9).
+
+To enable gradient checkpointing in the [`Trainer`], pass the corresponding a flag to [`TrainingArguments`]:
+
+```py
+training_args = TrainingArguments(
+ per_device_train_batch_size=1, gradient_accumulation_steps=4, gradient_checkpointing=True, **default_args
+)
+```
+
+Alternatively, use ๐ค Accelerate - find the ๐ค Accelerate example [further in this guide](#using--accelerate).
+
+
+
+While gradient checkpointing may improve memory efficiency, it slows training by approximately 20%.
+
+
+
+## Mixed precision training
+
+**Mixed precision training** is a technique that aims to optimize the computational efficiency of training models by
+utilizing lower-precision numerical formats for certain variables. Traditionally, most models use 32-bit floating point
+precision (fp32 or float32) to represent and process variables. However, not all variables require this high precision
+level to achieve accurate results. By reducing the precision of certain variables to lower numerical formats like 16-bit
+floating point (fp16 or float16), we can speed up the computations. Because in this approach some computations are performed
+in half-precision, while some are still in full precision, the approach is called mixed precision training.
+
+Most commonly mixed precision training is achieved by using fp16 (float16) data types, however, some GPU architectures
+(such as the Ampere architecture) offer bf16 and tf32 (CUDA internal data type) data types. Check
+out the [NVIDIA Blog](https://developer.nvidia.com/blog/accelerating-ai-training-with-tf32-tensor-cores/) to learn more about
+the differences between these data types.
+
+### fp16
+
+The main advantage of mixed precision training comes from saving the activations in half precision (fp16).
+Although the gradients are also computed in half precision they are converted back to full precision for the optimization
+step so no memory is saved here.
+While mixed precision training results in faster computations, it can also lead to more GPU memory being utilized, especially for small batch sizes.
+This is because the model is now present on the GPU in both 16-bit and 32-bit precision (1.5x the original model on the GPU).
+
+To enable mixed precision training, set the `fp16` flag to `True`:
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=4, fp16=True, **default_args)
+```
+
+If you prefer to use ๐ค Accelerate, find the ๐ค Accelerate example [further in this guide](#using--accelerate).
+
+### BF16
+
+If you have access to an Ampere or newer hardware you can use bf16 for mixed precision training and evaluation. While
+bf16 has a worse precision than fp16, it has a much bigger dynamic range. In fp16 the biggest number you can have
+is `65504` and any number above that will result in an overflow. A bf16 number can be as large as `3.39e+38` (!) which
+is about the same as fp32 - because both have 8-bits used for the numerical range.
+
+You can enable BF16 in the ๐ค Trainer with:
+
+```python
+training_args = TrainingArguments(bf16=True, **default_args)
+```
+
+### TF32
+
+The Ampere hardware uses a magical data type called tf32. It has the same numerical range as fp32 (8-bits), but instead
+of 23 bits precision it has only 10 bits (same as fp16) and uses only 19 bits in total. It's "magical" in the sense that
+you can use the normal fp32 training and/or inference code and by enabling tf32 support you can get up to 3x throughput
+improvement. All you need to do is to add the following to your code:
+
+```python
+import torch
+torch.backends.cuda.matmul.allow_tf32 = True
+torch.backends.cudnn.allow_tf32 = True
+```
+
+CUDA will automatically switch to using tf32 instead of fp32 where possible, assuming that the used GPU is from the Ampere series.
+
+According to [NVIDIA research](https://developer.nvidia.com/blog/accelerating-ai-training-with-tf32-tensor-cores/), the
+majority of machine learning training workloads show the same perplexity and convergence with tf32 training as with fp32.
+If you're already using fp16 or bf16 mixed precision it may help with the throughput as well.
+
+You can enable this mode in the ๐ค Trainer:
+
+```python
+TrainingArguments(tf32=True, **default_args)
+```
+
+
+
+tf32 can't be accessed directly via `tensor.to(dtype=torch.tf32)` because it is an internal CUDA data type. You need `torch>=1.7` to use tf32 data types.
+
+
+
+For additional information on tf32 vs other precisions, please refer to the following benchmarks:
+[RTX-3090](https://github.com/huggingface/transformers/issues/14608#issuecomment-1004390803) and
+[A100](https://github.com/huggingface/transformers/issues/15026#issuecomment-1004543189).
+
+## Flash Attention 2
+
+You can speedup the training throughput by using Flash Attention 2 integration in transformers. Check out the appropriate section in the [single GPU section](./perf_infer_gpu_one#Flash-Attention-2) to learn more about how to load a model with Flash Attention 2 modules.
+
+## Optimizer choice
+
+The most common optimizer used to train transformer models is Adam or AdamW (Adam with weight decay). Adam achieves
+good convergence by storing the rolling average of the previous gradients; however, it adds an additional memory
+footprint of the order of the number of model parameters. To remedy this, you can use an alternative optimizer.
+For example if you have [NVIDIA/apex](https://github.com/NVIDIA/apex) installed for NVIDIA GPUs, or [ROCmSoftwarePlatform/apex](https://github.com/ROCmSoftwarePlatform/apex) for AMD GPUs, `adamw_apex_fused` will give you the
+fastest training experience among all supported AdamW optimizers.
+
+[`Trainer`] integrates a variety of optimizers that can be used out of box: `adamw_hf`, `adamw_torch`, `adamw_torch_fused`,
+`adamw_apex_fused`, `adamw_anyprecision`, `adafactor`, or `adamw_bnb_8bit`. More optimizers can be plugged in via a third-party implementation.
+
+Let's take a closer look at two alternatives to AdamW optimizer:
+1. `adafactor` which is available in [`Trainer`]
+2. `adamw_bnb_8bit` is also available in Trainer, but a third-party integration is provided below for demonstration.
+
+For comparison, for a 3B-parameter model, like โgoogle-t5/t5-3bโ:
+* A standard AdamW optimizer will need 24GB of GPU memory because it uses 8 bytes for each parameter (8*3 => 24GB)
+* Adafactor optimizer will need more than 12GB. It uses slightly more than 4 bytes for each parameter, so 4*3 and then some extra.
+* 8bit BNB quantized optimizer will use only (2*3) 6GB if all optimizer states are quantized.
+
+### Adafactor
+
+Adafactor doesn't store rolling averages for each element in weight matrices. Instead, it keeps aggregated information
+(sums of rolling averages row- and column-wise), significantly reducing its footprint. However, compared to Adam,
+Adafactor may have slower convergence in certain cases.
+
+You can switch to Adafactor by setting `optim="adafactor"` in [`TrainingArguments`]:
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=4, optim="adafactor", **default_args)
+```
+
+Combined with other approaches (gradient accumulation, gradient checkpointing, and mixed precision training)
+you can notice up to 3x improvement while maintaining the throughput! However, as mentioned before, the convergence of
+Adafactor can be worse than Adam.
+
+### 8-bit Adam
+
+Instead of aggregating optimizer states like Adafactor, 8-bit Adam keeps the full state and quantizes it. Quantization
+means that it stores the state with lower precision and dequantizes it only for the optimization. This is similar to the
+idea behind mixed precision training.
+
+To use `adamw_bnb_8bit`, you simply need to set `optim="adamw_bnb_8bit"` in [`TrainingArguments`]:
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=4, optim="adamw_bnb_8bit", **default_args)
+```
+
+However, we can also use a third-party implementation of the 8-bit optimizer for demonstration purposes to see how that can be integrated.
+
+First, follow the installation guide in the GitHub [repo](https://github.com/bitsandbytes-foundation/bitsandbytes) to install the `bitsandbytes` library
+that implements the 8-bit Adam optimizer.
+
+Next you need to initialize the optimizer. This involves two steps:
+* First, group the model's parameters into two groups - one where weight decay should be applied, and the other one where it should not. Usually, biases and layer norm parameters are not weight decayed.
+* Then do some argument housekeeping to use the same parameters as the previously used AdamW optimizer.
+
+```py
+import bitsandbytes as bnb
+from torch import nn
+from transformers.trainer_pt_utils import get_parameter_names
+
+training_args = TrainingArguments(per_device_train_batch_size=4, **default_args)
+
+decay_parameters = get_parameter_names(model, [nn.LayerNorm])
+decay_parameters = [name for name in decay_parameters if "bias" not in name]
+optimizer_grouped_parameters = [
+ {
+ "params": [p for n, p in model.named_parameters() if n in decay_parameters],
+ "weight_decay": training_args.weight_decay,
+ },
+ {
+ "params": [p for n, p in model.named_parameters() if n not in decay_parameters],
+ "weight_decay": 0.0,
+ },
+]
+
+optimizer_kwargs = {
+ "betas": (training_args.adam_beta1, training_args.adam_beta2),
+ "eps": training_args.adam_epsilon,
+}
+optimizer_kwargs["lr"] = training_args.learning_rate
+adam_bnb_optim = bnb.optim.Adam8bit(
+ optimizer_grouped_parameters,
+ betas=(training_args.adam_beta1, training_args.adam_beta2),
+ eps=training_args.adam_epsilon,
+ lr=training_args.learning_rate,
+)
+```
+
+Finally, pass the custom optimizer as an argument to the `Trainer`:
+
+```py
+trainer = Trainer(model=model, args=training_args, train_dataset=ds, optimizers=(adam_bnb_optim, None))
+```
+
+Combined with other approaches (gradient accumulation, gradient checkpointing, and mixed precision training),
+you can expect to get about a 3x memory improvement and even slightly higher throughput as using Adafactor.
+
+### multi_tensor
+
+pytorch-nightly introduced `torch.optim._multi_tensor` which should significantly speed up the optimizers for situations
+with lots of small feature tensors. It should eventually become the default, but if you want to experiment with it sooner, take a look at this GitHub [issue](https://github.com/huggingface/transformers/issues/9965).
+
+## Data preloading
+
+One of the important requirements to reach great training speed is the ability to feed the GPU at the maximum speed it
+can handle. By default, everything happens in the main process, and it might not be able to read the data from disk fast
+enough, and thus create a bottleneck, leading to GPU under-utilization. Configure the following arguments to reduce the bottleneck:
+
+- `DataLoader(pin_memory=True, ...)` - ensures the data gets preloaded into the pinned memory on CPU and typically leads to much faster transfers from CPU to GPU memory.
+- `DataLoader(num_workers=4, ...)` - spawn several workers to preload data faster. During training, watch the GPU utilization stats; if it's far from 100%, experiment with increasing the number of workers. Of course, the problem could be elsewhere, so many workers won't necessarily lead to better performance.
+
+When using [`Trainer`], the corresponding [`TrainingArguments`] are: `dataloader_pin_memory` (`True` by default), and `dataloader_num_workers` (defaults to `0`).
+
+## DeepSpeed ZeRO
+
+DeepSpeed is an open-source deep learning optimization library that is integrated with ๐ค Transformers and ๐ค Accelerate.
+It provides a wide range of features and optimizations designed to improve the efficiency and scalability of large-scale
+deep learning training.
+
+If your model fits onto a single GPU and you have enough space to fit a small batch size, you don't need to use DeepSpeed
+as it'll only slow things down. However, if the model doesn't fit onto a single GPU or you can't fit a small batch, you can
+leverage DeepSpeed ZeRO + CPU Offload, or NVMe Offload for much larger models. In this case, you need to separately
+[install the library](main_classes/deepspeed#installation), then follow one of the guides to create a configuration file
+and launch DeepSpeed:
+
+* For an in-depth guide on DeepSpeed integration with [`Trainer`], review [the corresponding documentation](main_classes/deepspeed), specifically the
+[section for a single GPU](main_classes/deepspeed#deployment-with-one-gpu). Some adjustments are required to use DeepSpeed in a notebook; please take a look at the [corresponding guide](main_classes/deepspeed#deployment-in-notebooks).
+* If you prefer to use ๐ค Accelerate, refer to [๐ค Accelerate DeepSpeed guide](https://huggingface.co/docs/accelerate/en/usage_guides/deepspeed).
+
+## Using torch.compile
+
+PyTorch 2.0 introduced a new compile function that doesn't require any modification to existing PyTorch code but can
+optimize your code by adding a single line of code: `model = torch.compile(model)`.
+
+If using [`Trainer`], you only need `to` pass the `torch_compile` option in the [`TrainingArguments`]:
+
+```python
+training_args = TrainingArguments(torch_compile=True, **default_args)
+```
+
+`torch.compile` uses Python's frame evaluation API to automatically create a graph from existing PyTorch programs. After
+capturing the graph, different backends can be deployed to lower the graph to an optimized engine.
+You can find more details and benchmarks in [PyTorch documentation](https://pytorch.org/get-started/pytorch-2.0/).
+
+`torch.compile` has a growing list of backends, which can be found in by calling `torchdynamo.list_backends()`, each of which with its optional dependencies.
+
+Choose which backend to use by specifying it via `torch_compile_backend` in the [`TrainingArguments`]. Some of the most commonly used backends are:
+
+**Debugging backends**:
+* `dynamo.optimize("eager")` - Uses PyTorch to run the extracted GraphModule. This is quite useful in debugging TorchDynamo issues.
+* `dynamo.optimize("aot_eager")` - Uses AotAutograd with no compiler, i.e, just using PyTorch eager for the AotAutograd's extracted forward and backward graphs. This is useful for debugging, and unlikely to give speedups.
+
+**Training & inference backends**:
+* `dynamo.optimize("inductor")` - Uses TorchInductor backend with AotAutograd and cudagraphs by leveraging codegened Triton kernels [Read more](https://dev-discuss.pytorch.org/t/torchinductor-a-pytorch-native-compiler-with-define-by-run-ir-and-symbolic-shapes/747)
+* `dynamo.optimize("nvfuser")` - nvFuser with TorchScript. [Read more](https://dev-discuss.pytorch.org/t/tracing-with-primitives-update-1-nvfuser-and-its-primitives/593)
+* `dynamo.optimize("aot_nvfuser")` - nvFuser with AotAutograd. [Read more](https://dev-discuss.pytorch.org/t/tracing-with-primitives-update-1-nvfuser-and-its-primitives/593)
+* `dynamo.optimize("aot_cudagraphs")` - cudagraphs with AotAutograd. [Read more](https://github.com/pytorch/torchdynamo/pull/757)
+
+**Inference-only backend**s:
+* `dynamo.optimize("ofi")` - Uses TorchScript optimize_for_inference. [Read more](https://pytorch.org/docs/stable/generated/torch.jit.optimize_for_inference.html)
+* `dynamo.optimize("fx2trt")` - Uses NVIDIA TensorRT for inference optimizations. [Read more](https://pytorch.org/TensorRT/tutorials/getting_started_with_fx_path.html)
+* `dynamo.optimize("onnxrt")` - Uses ONNXRT for inference on CPU/GPU. [Read more](https://onnxruntime.ai/)
+* `dynamo.optimize("ipex")` - Uses IPEX for inference on CPU. [Read more](https://github.com/intel/intel-extension-for-pytorch)
+
+For an example of using `torch.compile` with ๐ค Transformers, check out this [blog post on fine-tuning a BERT model for Text Classification using the newest PyTorch 2.0 features](https://www.philschmid.de/getting-started-pytorch-2-0-transformers)
+
+## Using ๐ค PEFT
+
+[Parameter-Efficient Fine Tuning (PEFT)](https://huggingface.co/blog/peft) methods freeze the pretrained model parameters during fine-tuning and add a small number of trainable parameters (the adapters) on top of it.
+
+As a result the [memory associated to the optimizer states and gradients](https://huggingface.co/docs/transformers/model_memory_anatomy#anatomy-of-models-memory) are greatly reduced.
+
+For example with a vanilla AdamW, the memory requirement for the optimizer state would be:
+* fp32 copy of parameters: 4 bytes/param
+* Momentum: 4 bytes/param
+* Variance: 4 bytes/param
+
+Suppose a model with 7B parameters and 200 million parameters injected with [Low Rank Adapters](https://huggingface.co/docs/peft/conceptual_guides/lora).
+
+The memory requirement for the optimizer state of the plain model would be 12 * 7 = 84 GB (assuming 7B trainable parameters).
+
+Adding Lora increases slightly the memory associated to the model weights and substantially decreases memory requirement for the optimizer state to 12 * 0.2 = 2.4GB.
+
+Read more about PEFT and its detailed usage in [the PEFT documentation](https://huggingface.co/docs/peft/) or [PEFT repository](https://github.com/huggingface/peft).
+
+## Using ๐ค Accelerate
+
+With [๐ค Accelerate](https://huggingface.co/docs/accelerate/index) you can use the above methods while gaining full
+control over the training loop and can essentially write the loop in pure PyTorch with some minor modifications.
+
+Suppose you have combined the methods in the [`TrainingArguments`] like so:
+
+```py
+training_args = TrainingArguments(
+ per_device_train_batch_size=1,
+ gradient_accumulation_steps=4,
+ gradient_checkpointing=True,
+ fp16=True,
+ **default_args,
+)
+```
+
+The full example training loop with ๐ค Accelerate is only a handful of lines of code long:
+
+```py
+from accelerate import Accelerator
+from torch.utils.data.dataloader import DataLoader
+
+dataloader = DataLoader(ds, batch_size=training_args.per_device_train_batch_size)
+
+if training_args.gradient_checkpointing:
+ model.gradient_checkpointing_enable()
+
+accelerator = Accelerator(fp16=training_args.fp16)
+model, optimizer, dataloader = accelerator.prepare(model, adam_bnb_optim, dataloader)
+
+model.train()
+for step, batch in enumerate(dataloader, start=1):
+ loss = model(**batch).loss
+ loss = loss / training_args.gradient_accumulation_steps
+ accelerator.backward(loss)
+ if step % training_args.gradient_accumulation_steps == 0:
+ optimizer.step()
+ optimizer.zero_grad()
+```
+
+First we wrap the dataset in a [`DataLoader`](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader).
+Then we can enable gradient checkpointing by calling the model's [`~PreTrainedModel.gradient_checkpointing_enable`] method.
+When we initialize the [`Accelerator`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator)
+we can specify if we want to use mixed precision training and it will take care of it for us in the [`prepare`] call.
+During the [`prepare`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator.prepare)
+call the dataloader will also be distributed across workers should we use multiple GPUs. We use the same [8-bit optimizer](#8-bit-adam) from the earlier example.
+
+Finally, we can add the main training loop. Note that the `backward` call is handled by ๐ค Accelerate. We can also see
+how gradient accumulation works: we normalize the loss, so we get the average at the end of accumulation and once we have
+enough steps we run the optimization.
+
+Implementing these optimization techniques with ๐ค Accelerate only takes a handful of lines of code and comes with the
+benefit of more flexibility in the training loop. For a full documentation of all features have a look at the
+[Accelerate documentation](https://huggingface.co/docs/accelerate/index).
+
+
+## Efficient Software Prebuilds
+
+PyTorch's [pip and conda builds](https://pytorch.org/get-started/locally/#start-locally) come prebuilt with the cuda toolkit
+which is enough to run PyTorch, but it is insufficient if you need to build cuda extensions.
+
+At times, additional efforts may be required to pre-build some components. For instance, if you're using libraries like `apex` that
+don't come pre-compiled. In other situations figuring out how to install the right cuda toolkit system-wide can be complicated.
+To address these scenarios PyTorch and NVIDIA released a new version of NGC docker container which already comes with
+everything prebuilt. You just need to install your programs on it, and it will run out of the box.
+
+This approach is also useful if you want to tweak the pytorch source and/or make a new customized build.
+To find the docker image version you want start [with PyTorch release notes](https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/),
+choose one of the latest monthly releases. Go into the release's notes for the desired release, check that the environment's
+components are matching your needs (including NVIDIA Driver requirements!) and then at the very top of that document go
+to the corresponding NGC page. If for some reason you get lost, here is [the index of all PyTorch NGC images](https://ngc.nvidia.com/catalog/containers/nvidia:pytorch).
+
+Next follow the instructions to download and deploy the docker image.
+
+## Mixture of Experts
+
+Some recent papers reported a 4-5x training speedup and a faster inference by integrating
+Mixture of Experts (MoE) into the Transformer models.
+
+Since it has been discovered that more parameters lead to better performance, this technique allows to increase the
+number of parameters by an order of magnitude without increasing training costs.
+
+In this approach every other FFN layer is replaced with a MoE Layer which consists of many experts, with a gated function
+that trains each expert in a balanced way depending on the input token's position in a sequence.
+
+
+
+(source: [GLAM](https://ai.googleblog.com/2021/12/more-efficient-in-context-learning-with.html))
+
+You can find exhaustive details and comparison tables in the papers listed at the end of this section.
+
+The main drawback of this approach is that it requires staggering amounts of GPU memory - almost an order of magnitude
+larger than its dense equivalent. Various distillation and approaches are proposed to how to overcome the much higher memory requirements.
+
+There is direct trade-off though, you can use just a few experts with a 2-3x smaller base model instead of dozens or
+hundreds experts leading to a 5x smaller model and thus increase the training speed moderately while increasing the
+memory requirements moderately as well.
+
+Most related papers and implementations are built around Tensorflow/TPUs:
+
+- [GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding](https://arxiv.org/abs/2006.16668)
+- [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://arxiv.org/abs/2101.03961)
+- [GLaM: Generalist Language Model (GLaM)](https://ai.googleblog.com/2021/12/more-efficient-in-context-learning-with.html)
+
+And for Pytorch DeepSpeed has built one as well: [DeepSpeed-MoE: Advancing Mixture-of-Experts Inference and Training to Power Next-Generation AI Scale](https://arxiv.org/abs/2201.05596), [Mixture of Experts](https://www.deepspeed.ai/tutorials/mixture-of-experts/) - blog posts: [1](https://www.microsoft.com/en-us/research/blog/deepspeed-powers-8x-larger-moe-model-training-with-high-performance/), [2](https://www.microsoft.com/en-us/research/publication/scalable-and-efficient-moe-training-for-multitask-multilingual-models/) and specific deployment with large transformer-based natural language generation models: [blog post](https://www.deepspeed.ai/2021/12/09/deepspeed-moe-nlg.html), [Megatron-Deepspeed branch](https://github.com/microsoft/Megatron-DeepSpeed/tree/moe-training).
+
+## Using PyTorch native attention and Flash Attention
+
+PyTorch's [`torch.nn.functional.scaled_dot_product_attention`](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html) (SDPA) can also call FlashAttention and memory-efficient attention kernels under the hood. SDPA support is currently being added natively in Transformers and is used by default for `torch>=2.1.1` when an implementation is available. Please refer to [PyTorch scaled dot product attention](https://huggingface.co/docs/transformers/perf_infer_gpu_one#pytorch-scaled-dot-product-attention) for a list of supported models and more details.
+
+Check out this [blogpost](https://pytorch.org/blog/out-of-the-box-acceleration/) to learn more about acceleration and memory-savings with SDPA.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_special.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_special.md
new file mode 100644
index 0000000000000000000000000000000000000000..d98d3e0e32e5a09b8f589c7776cbab5ca140be56
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_special.md
@@ -0,0 +1,63 @@
+
+
+# PyTorch training on Apple silicon
+
+Previously, training models on a Mac was limited to the CPU only. With the release of PyTorch v1.12, you can take advantage of training models with Apple's silicon GPUs for significantly faster performance and training. This is powered in PyTorch by integrating Apple's Metal Performance Shaders (MPS) as a backend. The [MPS backend](https://pytorch.org/docs/stable/notes/mps.html) implements PyTorch operations as custom Metal shaders and places these modules on a `mps` device.
+
+
+
+Some PyTorch operations are not implemented in MPS yet and will throw an error. To avoid this, you should set the environment variable `PYTORCH_ENABLE_MPS_FALLBACK=1` to use the CPU kernels instead (you'll still see a `UserWarning`).
+
+
+
+If you run into any other errors, please open an issue in the [PyTorch](https://github.com/pytorch/pytorch/issues) repository because the [`Trainer`] only integrates the MPS backend.
+
+
+
+With the `mps` device set, you can:
+
+* train larger networks or batch sizes locally
+* reduce data retrieval latency because the GPU's unified memory architecture allows direct access to the full memory store
+* reduce costs because you don't need to train on cloud-based GPUs or add additional local GPUs
+
+Get started by making sure you have PyTorch installed. MPS acceleration is supported on macOS 12.3+.
+
+```bash
+pip install torch torchvision torchaudio
+```
+
+[`TrainingArguments`] uses the `mps` device by default if it's available which means you don't need to explicitly set the device. For example, you can run the [run_glue.py](https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-classification/run_glue.py) script with the MPS backend automatically enabled without making any changes.
+
+```diff
+export TASK_NAME=mrpc
+
+python examples/pytorch/text-classification/run_glue.py \
+ --model_name_or_path google-bert/bert-base-cased \
+ --task_name $TASK_NAME \
+- --use_mps_device \
+ --do_train \
+ --do_eval \
+ --max_seq_length 128 \
+ --per_device_train_batch_size 32 \
+ --learning_rate 2e-5 \
+ --num_train_epochs 3 \
+ --output_dir /tmp/$TASK_NAME/ \
+ --overwrite_output_dir
+```
+
+Backends for [distributed setups](https://pytorch.org/docs/stable/distributed.html#backends) like `gloo` and `nccl` are not supported by the `mps` device which means you can only train on a single GPU with the MPS backend.
+
+You can learn more about the MPS backend in the [Introducing Accelerated PyTorch Training on Mac](https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/) blog post.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_tpu_tf.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_tpu_tf.md
new file mode 100644
index 0000000000000000000000000000000000000000..1897c1ad745fa6ea730f8d481e10b7dae688d873
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perf_train_tpu_tf.md
@@ -0,0 +1,162 @@
+
+
+# Training on TPU with TensorFlow
+
+
+
+If you don't need long explanations and just want TPU code samples to get started with, check out [our TPU example notebook!](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb)
+
+
+
+### What is a TPU?
+
+A TPU is a **Tensor Processing Unit.** They are hardware designed by Google, which are used to greatly speed up the tensor computations within neural networks, much like GPUs. They can be used for both network training and inference. They are generally accessed through Googleโs cloud services, but small TPUs can also be accessed directly for free through Google Colab and Kaggle Kernels.
+
+Because [all TensorFlow models in ๐ค Transformers are Keras models](https://huggingface.co/blog/tensorflow-philosophy), most of the methods in this document are generally applicable to TPU training for any Keras model! However, there are a few points that are specific to the HuggingFace ecosystem (hug-o-system?) of Transformers and Datasets, and weโll make sure to flag them up when we get to them.
+
+### What kinds of TPU are available?
+
+New users are often very confused by the range of TPUs, and the different ways to access them. The first key distinction to understand is the difference between **TPU Nodes** and **TPU VMs.**
+
+When you use a **TPU Node**, you are effectively indirectly accessing a remote TPU. You will need a separate VM, which will initialize your network and data pipeline and then forward them to the remote node. When you use a TPU on Google Colab, you are accessing it in the **TPU Node** style.
+
+Using TPU Nodes can have some quite unexpected behaviour for people who arenโt used to them! In particular, because the TPU is located on a physically different system to the machine youโre running your Python code on, your data cannot be local to your machine - any data pipeline that loads from your machineโs internal storage will totally fail! Instead, data must be stored in Google Cloud Storage where your data pipeline can still access it, even when the pipeline is running on the remote TPU node.
+
+
+
+If you can fit all your data in memory as `np.ndarray` or `tf.Tensor`, then you can `fit()` on that data even when using Colab or a TPU Node, without needing to upload it to Google Cloud Storage.
+
+
+
+
+
+**๐คSpecific Hugging Face Tip๐ค:** The methods `Dataset.to_tf_dataset()` and its higher-level wrapper `model.prepare_tf_dataset()` , which you will see throughout our TF code examples, will both fail on a TPU Node. The reason for this is that even though they create a `tf.data.Dataset` it is not a โpureโ `tf.data` pipeline and uses `tf.numpy_function` or `Dataset.from_generator()` to stream data from the underlying HuggingFace `Dataset`. This HuggingFace `Dataset` is backed by data that is on a local disc and which the remote TPU Node will not be able to read.
+
+
+
+The second way to access a TPU is via a **TPU VM.** When using a TPU VM, you connect directly to the machine that the TPU is attached to, much like training on a GPU VM. TPU VMs are generally easier to work with, particularly when it comes to your data pipeline. All of the above warnings do not apply to TPU VMs!
+
+This is an opinionated document, so hereโs our opinion: **Avoid using TPU Node if possible.** It is more confusing and more difficult to debug than TPU VMs. It is also likely to be unsupported in future - Googleโs latest TPU, TPUv4, can only be accessed as a TPU VM, which suggests that TPU Nodes are increasingly going to become a โlegacyโ access method. However, we understand that the only free TPU access is on Colab and Kaggle Kernels, which uses TPU Node - so weโll try to explain how to handle it if you have to! Check the [TPU example notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb) for code samples that explain this in more detail.
+
+### What sizes of TPU are available?
+
+A single TPU (a v2-8/v3-8/v4-8) runs 8 replicas. TPUs exist in **pods** that can run hundreds or thousands of replicas simultaneously. When you use more than a single TPU but less than a whole pod (for example, a v3-32), your TPU fleet is referred to as a **pod slice.**
+
+When you access a free TPU via Colab, you generally get a single v2-8 TPU.
+
+### I keep hearing about this XLA thing. Whatโs XLA, and how does it relate to TPUs?
+
+XLA is an optimizing compiler, used by both TensorFlow and JAX. In JAX it is the only compiler, whereas in TensorFlow it is optional (but mandatory on TPU!). The easiest way to enable it when training a Keras model is to pass the argument `jit_compile=True` to `model.compile()`. If you donโt get any errors and performance is good, thatโs a great sign that youโre ready to move to TPU!
+
+Debugging on TPU is generally a bit harder than on CPU/GPU, so we recommend getting your code running on CPU/GPU with XLA first before trying it on TPU. You donโt have to train for long, of course - just for a few steps to make sure that your model and data pipeline are working like you expect them to.
+
+
+
+XLA compiled code is usually faster - so even if youโre not planning to run on TPU, adding `jit_compile=True` can improve your performance. Be sure to note the caveats below about XLA compatibility, though!
+
+
+
+
+
+**Tip born of painful experience:** Although using `jit_compile=True` is a good way to get a speed boost and test if your CPU/GPU code is XLA-compatible, it can actually cause a lot of problems if you leave it in when actually training on TPU. XLA compilation will happen implicitly on TPU, so remember to remove that line before actually running your code on a TPU!
+
+
+
+### How do I make my model XLA compatible?
+
+In many cases, your code is probably XLA-compatible already! However, there are a few things that work in normal TensorFlow that donโt work in XLA. Weโve distilled them into three core rules below:
+
+
+
+**๐คSpecific HuggingFace Tip๐ค:** Weโve put a lot of effort into rewriting our TensorFlow models and loss functions to be XLA-compatible. Our models and loss functions generally obey rule #1 and #2 by default, so you can skip over them if youโre using `transformers` models. Donโt forget about these rules when writing your own models and loss functions, though!
+
+
+
+#### XLA Rule #1: Your code cannot have โdata-dependent conditionalsโ
+
+What that means is that any `if` statement cannot depend on values inside a `tf.Tensor`. For example, this code block cannot be compiled with XLA!
+
+```python
+if tf.reduce_sum(tensor) > 10:
+ tensor = tensor / 2.0
+```
+
+This might seem very restrictive at first, but most neural net code doesnโt need to do this. You can often get around this restriction by using `tf.cond` (see the documentation [here](https://www.tensorflow.org/api_docs/python/tf/cond)) or by removing the conditional and finding a clever math trick with indicator variables instead, like so:
+
+```python
+sum_over_10 = tf.cast(tf.reduce_sum(tensor) > 10, tf.float32)
+tensor = tensor / (1.0 + sum_over_10)
+```
+
+This code has exactly the same effect as the code above, but by avoiding a conditional, we ensure it will compile with XLA without problems!
+
+#### XLA Rule #2: Your code cannot have โdata-dependent shapesโ
+
+What this means is that the shape of all of the `tf.Tensor` objects in your code cannot depend on their values. For example, the function `tf.unique` cannot be compiled with XLA, because it returns a `tensor` containing one instance of each unique value in the input. The shape of this output will obviously be different depending on how repetitive the input `Tensor` was, and so XLA refuses to handle it!
+
+In general, most neural network code obeys rule #2 by default. However, there are a few common cases where it becomes a problem. One very common one is when you use **label masking**, setting your labels to a negative value to indicate that those positions should be ignored when computing the loss. If you look at NumPy or PyTorch loss functions that support label masking, you will often see code like this that uses [boolean indexing](https://numpy.org/doc/stable/user/basics.indexing.html#boolean-array-indexing):
+
+```python
+label_mask = labels >= 0
+masked_outputs = outputs[label_mask]
+masked_labels = labels[label_mask]
+loss = compute_loss(masked_outputs, masked_labels)
+mean_loss = torch.mean(loss)
+```
+
+This code is totally fine in NumPy or PyTorch, but it breaks in XLA! Why? Because the shape of `masked_outputs` and `masked_labels` depends on how many positions are masked - that makes it a **data-dependent shape.** However, just like for rule #1, we can often rewrite this code to yield exactly the same output without any data-dependent shapes.
+
+```python
+label_mask = tf.cast(labels >= 0, tf.float32)
+loss = compute_loss(outputs, labels)
+loss = loss * label_mask # Set negative label positions to 0
+mean_loss = tf.reduce_sum(loss) / tf.reduce_sum(label_mask)
+```
+
+Here, we avoid data-dependent shapes by computing the loss for every position, but zeroing out the masked positions in both the numerator and denominator when we calculate the mean, which yields exactly the same result as the first block while maintaining XLA compatibility. Note that we use the same trick as in rule #1 - converting a `tf.bool` to `tf.float32` and using it as an indicator variable. This is a really useful trick, so remember it if you need to convert your own code to XLA!
+
+#### XLA Rule #3: XLA will need to recompile your model for every different input shape it sees
+
+This is the big one. What this means is that if your input shapes are very variable, XLA will have to recompile your model over and over, which will create huge performance problems. This commonly arises in NLP models, where input texts have variable lengths after tokenization. In other modalities, static shapes are more common and this rule is much less of a problem.
+
+How can you get around rule #3? The key is **padding** - if you pad all your inputs to the same length, and then use an `attention_mask`, you can get the same results as youโd get from variable shapes, but without any XLA issues. However, excessive padding can cause severe slowdown too - if you pad all your samples to the maximum length in the whole dataset, you might end up with batches consisting endless padding tokens, which will waste a lot of compute and memory!
+
+There isnโt a perfect solution to this problem. However, you can try some tricks. One very useful trick is to **pad batches of samples up to a multiple of a number like 32 or 64 tokens.** This often only increases the number of tokens by a small amount, but it hugely reduces the number of unique input shapes, because every input shape now has to be a multiple of 32 or 64. Fewer unique input shapes means fewer XLA compilations!
+
+
+
+**๐คSpecific HuggingFace Tip๐ค:** Our tokenizers and data collators have methods that can help you here. You can use `padding="max_length"` or `padding="longest"` when calling tokenizers to get them to output padded data. Our tokenizers and data collators also have a `pad_to_multiple_of` argument that you can use to reduce the number of unique input shapes you see!
+
+
+
+### How do I actually train my model on TPU?
+
+Once your training is XLA-compatible and (if youโre using TPU Node / Colab) your dataset has been prepared appropriately, running on TPU is surprisingly easy! All you really need to change in your code is to add a few lines to initialize your TPU, and to ensure that your model and dataset are created inside a `TPUStrategy` scope. Take a look at [our TPU example notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb) to see this in action!
+
+### Summary
+
+There was a lot in here, so letโs summarize with a quick checklist you can follow when you want to get your model ready for TPU training:
+
+- Make sure your code follows the three rules of XLA
+- Compile your model with `jit_compile=True` on CPU/GPU and confirm that you can train it with XLA
+- Either load your dataset into memory or use a TPU-compatible dataset loading approach (see [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb))
+- Migrate your code either to Colab (with accelerator set to โTPUโ) or a TPU VM on Google Cloud
+- Add TPU initializer code (see [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb))
+- Create your `TPUStrategy` and make sure dataset loading and model creation are inside the `strategy.scope()` (see [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb))
+- Donโt forget to take `jit_compile=True` out again when you move to TPU!
+- ๐๐๐๐ฅบ๐ฅบ๐ฅบ
+- Call `model.fit()`
+- You did it!
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/performance.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/performance.md
new file mode 100644
index 0000000000000000000000000000000000000000..b9176be04ec2063566e20827e91aba145a2b78f9
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/performance.md
@@ -0,0 +1,73 @@
+
+
+# Performance and Scalability
+
+Training large transformer models and deploying them to production present various challenges.
+During training, the model may require more GPU memory than available or exhibit slow training speed. In the deployment
+phase, the model can struggle to handle the required throughput in a production environment.
+
+This documentation aims to assist you in overcoming these challenges and finding the optimal settings for your use-case.
+The guides are divided into training and inference sections, as each comes with different challenges and solutions.
+Within each section you'll find separate guides for different hardware configurations, such as single GPU vs. multi-GPU
+for training or CPU vs. GPU for inference.
+
+Use this document as your starting point to navigate further to the methods that match your scenario.
+
+## Training
+
+Training large transformer models efficiently requires an accelerator such as a GPU or TPU. The most common case is where
+you have a single GPU. The methods that you can apply to improve training efficiency on a single GPU extend to other setups
+such as multiple GPU. However, there are also techniques that are specific to multi-GPU or CPU training. We cover them in
+separate sections.
+
+* [Methods and tools for efficient training on a single GPU](perf_train_gpu_one): start here to learn common approaches that can help optimize GPU memory utilization, speed up the training, or both.
+* [Multi-GPU training section](perf_train_gpu_many): explore this section to learn about further optimization methods that apply to a multi-GPU settings, such as data, tensor, and pipeline parallelism.
+* [CPU training section](perf_train_cpu): learn about mixed precision training on CPU.
+* [Efficient Training on Multiple CPUs](perf_train_cpu_many): learn about distributed CPU training.
+* [Training on TPU with TensorFlow](perf_train_tpu_tf): if you are new to TPUs, refer to this section for an opinionated introduction to training on TPUs and using XLA.
+* [Custom hardware for training](perf_hardware): find tips and tricks when building your own deep learning rig.
+* [Hyperparameter Search using Trainer API](hpo_train)
+
+## Inference
+
+Efficient inference with large models in a production environment can be as challenging as training them. In the following
+sections we go through the steps to run inference on CPU and single/multi-GPU setups.
+
+* [Inference on a single CPU](perf_infer_cpu)
+* [Inference on a single GPU](perf_infer_gpu_one)
+* [Multi-GPU inference](perf_infer_gpu_multi)
+* [XLA Integration for TensorFlow Models](tf_xla)
+
+
+## Training and inference
+
+Here you'll find techniques, tips and tricks that apply whether you are training a model, or running inference with it.
+
+* [Instantiating a big model](big_models)
+* [Troubleshooting performance issues](debugging)
+
+## Contribute
+
+This document is far from being complete and a lot more needs to be added, so if you have additions or corrections to
+make please don't hesitate to open a PR or if you aren't sure start an Issue and we can discuss the details there.
+
+When making contributions that A is better than B, please try to include a reproducible benchmark and/or a link to the
+source of that information (unless it comes directly from you).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perplexity.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perplexity.md
new file mode 100644
index 0000000000000000000000000000000000000000..525f0d567bcb61191701cd7e0a645aaa7f403c62
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/perplexity.md
@@ -0,0 +1,151 @@
+
+
+# Perplexity of fixed-length models
+
+[[open-in-colab]]
+
+Perplexity (PPL) is one of the most common metrics for evaluating language models. Before diving in, we should note
+that the metric applies specifically to classical language models (sometimes called autoregressive or causal language
+models) and is not well defined for masked language models like BERT (see [summary of the models](model_summary)).
+
+Perplexity is defined as the exponentiated average negative log-likelihood of a sequence. If we have a tokenized
+sequence \\(X = (x_0, x_1, \dots, x_t)\\), then the perplexity of \\(X\\) is,
+
+$$\text{PPL}(X) = \exp \left\{ {-\frac{1}{t}\sum_i^t \log p_\theta (x_i|x_{
+
+When working with approximate models, however, we typically have a constraint on the number of tokens the model can
+process. The largest version of [GPT-2](model_doc/gpt2), for example, has a fixed length of 1024 tokens, so we
+cannot calculate \\(p_\theta(x_t|x_{
+
+This is quick to compute since the perplexity of each segment can be computed in one forward pass, but serves as a poor
+approximation of the fully-factorized perplexity and will typically yield a higher (worse) PPL because the model will
+have less context at most of the prediction steps.
+
+Instead, the PPL of fixed-length models should be evaluated with a sliding-window strategy. This involves repeatedly
+sliding the context window so that the model has more context when making each prediction.
+
+
+
+This is a closer approximation to the true decomposition of the sequence probability and will typically yield a more
+favorable score. The downside is that it requires a separate forward pass for each token in the corpus. A good
+practical compromise is to employ a strided sliding window, moving the context by larger strides rather than sliding by
+1 token a time. This allows computation to proceed much faster while still giving the model a large context to make
+predictions at each step.
+
+## Example: Calculating perplexity with GPT-2 in ๐ค Transformers
+
+Let's demonstrate this process with GPT-2.
+
+```python
+from transformers import GPT2LMHeadModel, GPT2TokenizerFast
+from accelerate.test_utils.testing import get_backend
+
+device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+model_id = "openai-community/gpt2-large"
+model = GPT2LMHeadModel.from_pretrained(model_id).to(device)
+tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
+```
+
+We'll load in the WikiText-2 dataset and evaluate the perplexity using a few different sliding-window strategies. Since
+this dataset is small and we're just doing one forward pass over the set, we can just load and encode the entire
+dataset in memory.
+
+```python
+from datasets import load_dataset
+
+test = load_dataset("wikitext", "wikitext-2-raw-v1", split="test")
+encodings = tokenizer("\n\n".join(test["text"]), return_tensors="pt")
+```
+
+With ๐ค Transformers, we can simply pass the `input_ids` as the `labels` to our model, and the average negative
+log-likelihood for each token is returned as the loss. With our sliding window approach, however, there is overlap in
+the tokens we pass to the model at each iteration. We don't want the log-likelihood for the tokens we're just treating
+as context to be included in our loss, so we can set these targets to `-100` so that they are ignored. The following
+is an example of how we could do this with a stride of `512`. This means that the model will have at least 512 tokens
+for context when calculating the conditional likelihood of any one token (provided there are 512 preceding tokens
+available to condition on).
+
+```python
+import torch
+from tqdm import tqdm
+
+max_length = model.config.n_positions
+stride = 512
+seq_len = encodings.input_ids.size(1)
+
+nll_sum = 0.0
+n_tokens = 0
+prev_end_loc = 0
+for begin_loc in tqdm(range(0, seq_len, stride)):
+ end_loc = min(begin_loc + max_length, seq_len)
+ trg_len = end_loc - prev_end_loc # may be different from stride on last loop
+ input_ids = encodings.input_ids[:, begin_loc:end_loc].to(device)
+ target_ids = input_ids.clone()
+ target_ids[:, :-trg_len] = -100
+
+ with torch.no_grad():
+ outputs = model(input_ids, labels=target_ids)
+
+ # loss is calculated using CrossEntropyLoss which averages over valid labels
+ # N.B. the model only calculates loss over trg_len - 1 labels, because it internally shifts the labels
+ # to the left by 1.
+ neg_log_likelihood = outputs.loss
+
+ # Accumulate the total negative log-likelihood and the total number of tokens
+ num_valid_tokens = (target_ids != -100).sum().item() # number of valid tokens in target_ids
+ batch_size = target_ids.size(0)
+ num_loss_tokens = num_valid_tokens - batch_size # subtract batch_size due to internal label shift
+ nll_sum += neg_log_likelihood * num_loss_tokens
+ n_tokens += num_loss_tokens
+
+ prev_end_loc = end_loc
+ if end_loc == seq_len:
+ break
+
+avg_nll = nll_sum / n_tokens # average negative log-likelihood per token
+ppl = torch.exp(avg_nll)
+```
+
+Running this with the stride length equal to the max input length is equivalent to the suboptimal, non-sliding-window
+strategy we discussed above. The smaller the stride, the more context the model will have in making each prediction,
+and the better the reported perplexity will typically be.
+
+When we run the above with `stride = 1024`, i.e. no overlap, the resulting PPL is `19.44`, which is about the same
+as the `19.93` reported in the GPT-2 paper. By using `stride = 512` and thereby employing our striding window
+strategy, this jumps down to `16.44`. This is not only a more favorable score, but is calculated in a way that is
+closer to the true autoregressive decomposition of a sequence likelihood.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/philosophy.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/philosophy.md
new file mode 100644
index 0000000000000000000000000000000000000000..628cb39bbb33006180064433abf790f88194c948
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/philosophy.md
@@ -0,0 +1,79 @@
+
+
+# Philosophy
+
+๐ค Transformers is an opinionated library built for:
+
+- machine learning researchers and educators seeking to use, study or extend large-scale Transformers models.
+- hands-on practitioners who want to fine-tune those models or serve them in production, or both.
+- engineers who just want to download a pretrained model and use it to solve a given machine learning task.
+
+The library was designed with two strong goals in mind:
+
+1. Be as easy and fast to use as possible:
+
+ - We strongly limited the number of user-facing abstractions to learn, in fact, there are almost no abstractions,
+ just three standard classes required to use each model: [configuration](main_classes/configuration),
+ [models](main_classes/model), and a preprocessing class ([tokenizer](main_classes/tokenizer) for NLP, [image processor](main_classes/image_processor) for vision, [feature extractor](main_classes/feature_extractor) for audio, and [processor](main_classes/processors) for multimodal inputs).
+ - All of these classes can be initialized in a simple and unified way from pretrained instances by using a common
+ `from_pretrained()` method which downloads (if needed), caches and
+ loads the related class instance and associated data (configurations' hyperparameters, tokenizers' vocabulary,
+ and models' weights) from a pretrained checkpoint provided on [Hugging Face Hub](https://huggingface.co/models) or your own saved checkpoint.
+ - On top of those three base classes, the library provides two APIs: [`pipeline`] for quickly
+ using a model for inference on a given task and [`Trainer`] to quickly train or fine-tune a PyTorch model (all TensorFlow models are compatible with `Keras.fit`).
+ - As a consequence, this library is NOT a modular toolbox of building blocks for neural nets. If you want to
+ extend or build upon the library, just use regular Python, PyTorch, TensorFlow, Keras modules and inherit from the base
+ classes of the library to reuse functionalities like model loading and saving. If you'd like to learn more about our coding philosophy for models, check out our [Repeat Yourself](https://huggingface.co/blog/transformers-design-philosophy) blog post.
+
+2. Provide state-of-the-art models with performances as close as possible to the original models:
+
+ - We provide at least one example for each architecture which reproduces a result provided by the official authors
+ of said architecture.
+ - The code is usually as close to the original code base as possible which means some PyTorch code may be not as
+ *pytorchic* as it could be as a result of being converted TensorFlow code and vice versa.
+
+A few other goals:
+
+- Expose the models' internals as consistently as possible:
+
+ - We give access, using a single API, to the full hidden-states and attention weights.
+ - The preprocessing classes and base model APIs are standardized to easily switch between models.
+
+- Incorporate a subjective selection of promising tools for fine-tuning and investigating these models:
+
+ - A simple and consistent way to add new tokens to the vocabulary and embeddings for fine-tuning.
+ - Simple ways to mask and prune Transformer heads.
+
+- Easily switch between PyTorch, TensorFlow 2.0 and Flax, allowing training with one framework and inference with another.
+
+## Main concepts
+
+The library is built around three types of classes for each model:
+
+- **Model classes** can be PyTorch models ([torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)), Keras models ([tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model)) or JAX/Flax models ([flax.linen.Module](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html)) that work with the pretrained weights provided in the library.
+- **Configuration classes** store the hyperparameters required to build a model (such as the number of layers and hidden size). You don't always need to instantiate these yourself. In particular, if you are using a pretrained model without any modification, creating the model will automatically take care of instantiating the configuration (which is part of the model).
+- **Preprocessing classes** convert the raw data into a format accepted by the model. A [tokenizer](main_classes/tokenizer) stores the vocabulary for each model and provide methods for encoding and decoding strings in a list of token embedding indices to be fed to a model. [Image processors](main_classes/image_processor) preprocess vision inputs, [feature extractors](main_classes/feature_extractor) preprocess audio inputs, and a [processor](main_classes/processors) handles multimodal inputs.
+
+All these classes can be instantiated from pretrained instances, saved locally, and shared on the Hub with three methods:
+
+- `from_pretrained()` lets you instantiate a model, configuration, and preprocessing class from a pretrained version either
+ provided by the library itself (the supported models can be found on the [Model Hub](https://huggingface.co/models)) or
+ stored locally (or on a server) by the user.
+- `save_pretrained()` lets you save a model, configuration, and preprocessing class locally so that it can be reloaded using
+ `from_pretrained()`.
+- `push_to_hub()` lets you share a model, configuration, and a preprocessing class to the Hub, so it is easily accessible to everyone.
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pipeline_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pipeline_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..357bc7f636ec259a7687a69d07aa6af37fed5374
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pipeline_tutorial.md
@@ -0,0 +1,346 @@
+
+
+# Pipelines for inference
+
+The [`pipeline`] makes it simple to use any model from the [Hub](https://huggingface.co/models) for inference on any language, computer vision, speech, and multimodal tasks. Even if you don't have experience with a specific modality or aren't familiar with the underlying code behind the models, you can still use them for inference with the [`pipeline`]! This tutorial will teach you to:
+
+* Use a [`pipeline`] for inference.
+* Use a specific tokenizer or model.
+* Use a [`pipeline`] for audio, vision, and multimodal tasks.
+
+
+
+Take a look at the [`pipeline`] documentation for a complete list of supported tasks and available parameters.
+
+
+
+## Pipeline usage
+
+While each task has an associated [`pipeline`], it is simpler to use the general [`pipeline`] abstraction which contains
+all the task-specific pipelines. The [`pipeline`] automatically loads a default model and a preprocessing class capable
+of inference for your task. Let's take the example of using the [`pipeline`] for automatic speech recognition (ASR), or
+speech-to-text.
+
+
+1. Start by creating a [`pipeline`] and specify the inference task:
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition")
+```
+
+2. Pass your input to the [`pipeline`]. In the case of speech recognition, this is an audio input file:
+
+```py
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': 'I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES'}
+```
+
+Not the result you had in mind? Check out some of the [most downloaded automatic speech recognition models](https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=trending)
+on the Hub to see if you can get a better transcription.
+
+Let's try the [Whisper large-v2](https://huggingface.co/openai/whisper-large-v2) model from OpenAI. Whisper was released
+2 years later than Wav2Vec2, and was trained on close to 10x more data. As such, it beats Wav2Vec2 on most downstream
+benchmarks. It also has the added benefit of predicting punctuation and casing, neither of which are possible with
+Wav2Vec2.
+
+Let's give it a try here to see how it performs. Set `torch_dtype="auto"` to automatically load the most memory-efficient data type the weights are stored in.
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2", torch_dtype="auto")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+Now this result looks more accurate! For a deep-dive comparison on Wav2Vec2 vs Whisper, refer to the [Audio Transformers Course](https://huggingface.co/learn/audio-course/chapter5/asr_models).
+We really encourage you to check out the Hub for models in different languages, models specialized in your field, and more.
+You can check out and compare model results directly from your browser on the Hub to see if it fits or
+handles corner cases better than other ones.
+And if you don't find a model for your use case, you can always start [training](training) your own!
+
+If you have several inputs, you can pass your input as a list:
+
+```py
+transcriber(
+ [
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac",
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac",
+ ]
+)
+```
+
+Pipelines are great for experimentation as switching from one model to another is trivial; however, there are some ways to optimize them for larger workloads than experimentation. See the following guides that dive into iterating over whole datasets or using pipelines in a webserver:
+of the docs:
+* [Using pipelines on a dataset](#using-pipelines-on-a-dataset)
+* [Using pipelines for a webserver](./pipeline_webserver)
+
+## Parameters
+
+[`pipeline`] supports many parameters; some are task specific, and some are general to all pipelines.
+In general, you can specify parameters anywhere you want:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", my_parameter=1)
+
+out = transcriber(...) # This will use `my_parameter=1`.
+out = transcriber(..., my_parameter=2) # This will override and use `my_parameter=2`.
+out = transcriber(...) # This will go back to using `my_parameter=1`.
+```
+
+Let's check out 3 important ones:
+
+### Device
+
+If you use `device=n`, the pipeline automatically puts the model on the specified device.
+This will work regardless of whether you are using PyTorch or Tensorflow.
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0)
+```
+
+If the model is too large for a single GPU and you are using PyTorch, you can set `torch_dtype='float16'` to enable FP16 precision inference. Usually this would not cause significant performance drops but make sure you evaluate it on your models!
+
+Alternatively, you can set `device_map="auto"` to automatically
+determine how to load and store the model weights. Using the `device_map` argument requires the ๐ค [Accelerate](https://huggingface.co/docs/accelerate)
+package:
+
+```bash
+pip install --upgrade accelerate
+```
+
+The following code automatically loads and stores model weights across devices:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device_map="auto")
+```
+
+Note that if `device_map="auto"` is passed, there is no need to add the argument `device=device` when instantiating your `pipeline` as you may encounter some unexpected behavior!
+
+### Batch size
+
+By default, pipelines will not batch inference for reasons explained in detail [here](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching). The reason is that batching is not necessarily faster, and can actually be quite slower in some cases.
+
+But if it works in your use case, you can use:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0, batch_size=2)
+audio_filenames = [f"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/{i}.flac" for i in range(1, 5)]
+texts = transcriber(audio_filenames)
+```
+
+This runs the pipeline on the 4 provided audio files, but it will pass them in batches of 2
+to the model (which is on a GPU, where batching is more likely to help) without requiring any further code from you.
+The output should always match what you would have received without batching. It is only meant as a way to help you get more speed out of a pipeline.
+
+Pipelines can also alleviate some of the complexities of batching because, for some pipelines, a single item (like a long audio file) needs to be chunked into multiple parts to be processed by a model. The pipeline performs this [*chunk batching*](./main_classes/pipelines#pipeline-chunk-batching) for you.
+
+### Task specific parameters
+
+All tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done.
+For instance, the [`transformers.AutomaticSpeechRecognitionPipeline.__call__`] method has a `return_timestamps` parameter which sounds promising for subtitling videos:
+
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2", return_timestamps=True)
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.', 'chunks': [{'timestamp': (0.0, 11.88), 'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its'}, {'timestamp': (11.88, 12.38), 'text': ' creed.'}]}
+```
+
+As you can see, the model inferred the text and also outputted **when** the various sentences were pronounced.
+
+There are many parameters available for each task, so check out each task's API reference to see what you can tinker with!
+For instance, the [`~transformers.AutomaticSpeechRecognitionPipeline`] has a `chunk_length_s` parameter which is helpful
+for working on really long audio files (for example, subtitling entire movies or hour-long videos) that a model typically
+cannot handle on its own:
+
+```python
+>>> transcriber = pipeline(model="openai/whisper-large-v2", chunk_length_s=30)
+>>> transcriber("https://huggingface.co/datasets/reach-vb/random-audios/resolve/main/ted_60.wav")
+{'text': " So in college, I was a government major, which means I had to write a lot of papers. Now, when a normal student writes a paper, they might spread the work out a little like this. So, you know. You get started maybe a little slowly, but you get enough done in the first week that with some heavier days later on, everything gets done and things stay civil. And I would want to do that like that. That would be the plan. I would have it all ready to go, but then actually the paper would come along, and then I would kind of do this. And that would happen every single paper. But then came my 90-page senior thesis, a paper you're supposed to spend a year on. I knew for a paper like that, my normal workflow was not an option, it was way too big a project. So I planned things out and I decided I kind of had to go something like this. This is how the year would go. So I'd start off light and I'd bump it up"}
+```
+
+If you can't find a parameter that would really help you out, feel free to [request it](https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml)!
+
+
+## Using pipelines on a dataset
+
+The pipeline can also run inference on a large dataset. The easiest way we recommend doing this is by using an iterator:
+
+```py
+def data():
+ for i in range(1000):
+ yield f"My example {i}"
+
+
+pipe = pipeline(model="openai-community/gpt2", device=0)
+generated_characters = 0
+for out in pipe(data()):
+ generated_characters += len(out[0]["generated_text"])
+```
+
+The iterator `data()` yields each result, and the pipeline automatically
+recognizes the input is iterable and will start fetching the data while
+it continues to process it on the GPU (this uses [DataLoader](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader) under the hood).
+This is important because you don't have to allocate memory for the whole dataset
+and you can feed the GPU as fast as possible.
+
+Since batching could speed things up, it may be useful to try tuning the `batch_size` parameter here.
+
+The simplest way to iterate over a dataset is to just load one from ๐ค [Datasets](https://github.com/huggingface/datasets/):
+
+```py
+# KeyDataset is a util that will just output the item we're interested in.
+from transformers.pipelines.pt_utils import KeyDataset
+from datasets import load_dataset
+
+pipe = pipeline(model="hf-internal-testing/tiny-random-wav2vec2", device=0)
+dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:10]")
+
+for out in pipe(KeyDataset(dataset, "audio")):
+ print(out)
+```
+
+
+## Using pipelines for a webserver
+
+
+Creating an inference engine is a complex topic which deserves it's own
+page.
+
+
+[Link](./pipeline_webserver)
+
+## Vision pipeline
+
+Using a [`pipeline`] for vision tasks is practically identical.
+
+Specify your task and pass your image to the classifier. The image can be a link, a local path or a base64-encoded image. For example, what species of cat is shown below?
+
+
+
+```py
+>>> from transformers import pipeline
+
+>>> vision_classifier = pipeline(model="google/vit-base-patch16-224")
+>>> preds = vision_classifier(
+... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]
+```
+
+## Text pipeline
+
+Using a [`pipeline`] for NLP tasks is practically identical.
+
+```py
+>>> from transformers import pipeline
+
+>>> # This model is a `zero-shot-classification` model.
+>>> # It will classify text, except you are free to choose any label you might imagine
+>>> classifier = pipeline(model="facebook/bart-large-mnli")
+>>> classifier(
+... "I have a problem with my iphone that needs to be resolved asap!!",
+... candidate_labels=["urgent", "not urgent", "phone", "tablet", "computer"],
+... )
+{'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}
+```
+
+## Multimodal pipeline
+
+The [`pipeline`] supports more than one modality. For example, a visual question answering (VQA) task combines text and image. Feel free to use any image link you like and a question you want to ask about the image. The image can be a URL or a local path to the image.
+
+For example, if you use this [invoice image](https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png):
+
+```py
+>>> from transformers import pipeline
+
+>>> vqa = pipeline(model="impira/layoutlm-document-qa")
+>>> output = vqa(
+... image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png",
+... question="What is the invoice number?",
+... )
+>>> output[0]["score"] = round(output[0]["score"], 3)
+>>> output
+[{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]
+```
+
+
+
+To run the example above you need to have [`pytesseract`](https://pypi.org/project/pytesseract/) installed in addition to ๐ค Transformers:
+
+```bash
+sudo apt install -y tesseract-ocr
+pip install pytesseract
+```
+
+
+
+## Using `pipeline` on large models with ๐ค `accelerate`:
+
+You can easily run `pipeline` on large models using ๐ค `accelerate`! First make sure you have installed `accelerate` with `pip install accelerate`.
+
+First load your model using `device_map="auto"`! We will use `facebook/opt-1.3b` for our example.
+
+```py
+# pip install accelerate
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", torch_dtype=torch.bfloat16, device_map="auto")
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+You can also pass 8-bit loaded models if you install `bitsandbytes` and add the argument `load_in_8bit=True`
+
+```py
+# pip install accelerate bitsandbytes
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", device_map="auto", model_kwargs={"load_in_8bit": True})
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+Note that you can replace the checkpoint with any Hugging Face model that supports large model loading, such as BLOOM.
+
+## Creating web demos from pipelines with `gradio`
+
+Pipelines are automatically supported in [Gradio](https://github.com/gradio-app/gradio/), a library that makes creating beautiful and user-friendly machine learning apps on the web a breeze. First, make sure you have Gradio installed:
+
+```
+pip install gradio
+```
+
+Then, you can create a web demo around an image classification pipeline (or any other pipeline) in a single line of code by calling Gradio's [`Interface.from_pipeline`](https://www.gradio.app/docs/interface#interface-from-pipeline) function to launch the pipeline. This creates an intuitive drag-and-drop interface in your browser:
+
+```py
+from transformers import pipeline
+import gradio as gr
+
+pipe = pipeline("image-classification", model="google/vit-base-patch16-224")
+
+gr.Interface.from_pipeline(pipe).launch()
+```
+
+
+
+
+By default, the web demo runs on a local server. If you'd like to share it with others, you can generate a temporary public
+link by setting `share=True` in `launch()`. You can also host your demo on [Hugging Face Spaces](https://huggingface.co/spaces) for a permanent link.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pipeline_webserver.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pipeline_webserver.md
new file mode 100644
index 0000000000000000000000000000000000000000..17b5fbd958dd30a197c7ccc2bb22d9149103e6a4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pipeline_webserver.md
@@ -0,0 +1,168 @@
+
+
+# Using pipelines for a webserver
+
+
+Creating an inference engine is a complex topic, and the "best" solution
+will most likely depend on your problem space. Are you on CPU or GPU? Do
+you want the lowest latency, the highest throughput, support for
+many models, or just highly optimize 1 specific model?
+There are many ways to tackle this topic, so what we are going to present is a good default
+to get started which may not necessarily be the most optimal solution for you.
+
+
+
+The key thing to understand is that we can use an iterator, just like you would [on a
+dataset](pipeline_tutorial#using-pipelines-on-a-dataset), since a webserver is basically a system that waits for requests and
+treats them as they come in.
+
+Usually webservers are multiplexed (multithreaded, async, etc..) to handle various
+requests concurrently. Pipelines on the other hand (and mostly the underlying models)
+are not really great for parallelism; they take up a lot of RAM, so it's best to give them all the available resources when they are running or it's a compute-intensive job.
+
+We are going to solve that by having the webserver handle the light load of receiving
+and sending requests, and having a single thread handling the actual work.
+This example is going to use `starlette`. The actual framework is not really
+important, but you might have to tune or change the code if you are using another
+one to achieve the same effect.
+
+Create `server.py`:
+
+```py
+from starlette.applications import Starlette
+from starlette.responses import JSONResponse
+from starlette.routing import Route
+from transformers import pipeline
+import asyncio
+
+
+async def homepage(request):
+ payload = await request.body()
+ string = payload.decode("utf-8")
+ response_q = asyncio.Queue()
+ await request.app.model_queue.put((string, response_q))
+ output = await response_q.get()
+ return JSONResponse(output)
+
+
+async def server_loop(q):
+ pipe = pipeline(model="google-bert/bert-base-uncased")
+ while True:
+ (string, response_q) = await q.get()
+ out = pipe(string)
+ await response_q.put(out)
+
+
+app = Starlette(
+ routes=[
+ Route("/", homepage, methods=["POST"]),
+ ],
+)
+
+
+@app.on_event("startup")
+async def startup_event():
+ q = asyncio.Queue()
+ app.model_queue = q
+ asyncio.create_task(server_loop(q))
+```
+
+Now you can start it with:
+```bash
+uvicorn server:app
+```
+
+And you can query it:
+```bash
+curl -X POST -d "test [MASK]" http://localhost:8000/
+#[{"score":0.7742936015129089,"token":1012,"token_str":".","sequence":"test."},...]
+```
+
+And there you go, now you have a good idea of how to create a webserver!
+
+What is really important is that we load the model only **once**, so there are no copies
+of the model on the webserver. This way, no unnecessary RAM is being used.
+Then the queuing mechanism allows you to do fancy stuff like maybe accumulating a few
+items before inferring to use dynamic batching:
+
+
+
+The code sample below is intentionally written like pseudo-code for readability.
+Do not run this without checking if it makes sense for your system resources!
+
+
+
+```py
+(string, rq) = await q.get()
+strings = []
+queues = []
+while True:
+ try:
+ (string, rq) = await asyncio.wait_for(q.get(), timeout=0.001) # 1ms
+ except asyncio.exceptions.TimeoutError:
+ break
+ strings.append(string)
+ queues.append(rq)
+strings
+outs = pipe(strings, batch_size=len(strings))
+for rq, out in zip(queues, outs):
+ await rq.put(out)
+```
+
+Again, the proposed code is optimized for readability, not for being the best code.
+First of all, there's no batch size limit which is usually not a
+great idea. Next, the timeout is reset on every queue fetch, meaning you could
+wait much more than 1ms before running the inference (delaying the first request
+by that much).
+
+It would be better to have a single 1ms deadline.
+
+This will always wait for 1ms even if the queue is empty, which might not be the
+best since you probably want to start doing inference if there's nothing in the queue.
+But maybe it does make sense if batching is really crucial for your use case.
+Again, there's really no one best solution.
+
+
+## Few things you might want to consider
+
+### Error checking
+
+There's a lot that can go wrong in production: out of memory, out of space,
+loading the model might fail, the query might be wrong, the query might be
+correct but still fail to run because of a model misconfiguration, and so on.
+
+Generally, it's good if the server outputs the errors to the user, so
+adding a lot of `try..except` statements to show those errors is a good
+idea. But keep in mind it may also be a security risk to reveal all those errors depending
+on your security context.
+
+### Circuit breaking
+
+Webservers usually look better when they do circuit breaking. It means they
+return proper errors when they're overloaded instead of just waiting for the query indefinitely. Return a 503 error instead of waiting for a super long time or a 504 after a long time.
+
+This is relatively easy to implement in the proposed code since there is a single queue.
+Looking at the queue size is a basic way to start returning errors before your
+webserver fails under load.
+
+### Blocking the main thread
+
+Currently PyTorch is not async aware, and computation will block the main
+thread while running. That means it would be better if PyTorch was forced to run
+on its own thread/process. This wasn't done here because the code is a lot more
+complex (mostly because threads and async and queues don't play nice together).
+But ultimately it does the same thing.
+
+This would be important if the inference of single items were long (> 1s) because
+in this case, it means every query during inference would have to wait for 1s before
+even receiving an error.
+
+### Dynamic batching
+
+In general, batching is not necessarily an improvement over passing 1 item at
+a time (see [batching details](./main_classes/pipelines#pipeline-batching) for more information). But it can be very effective
+when used in the correct setting. In the API, there is no dynamic
+batching by default (too much opportunity for a slowdown). But for BLOOM inference -
+which is a very large model - dynamic batching is **essential** to provide a decent experience for everyone.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pr_checks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pr_checks.md
new file mode 100644
index 0000000000000000000000000000000000000000..efddf3a5b1690a73ab59751098f92954b53f43c3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/pr_checks.md
@@ -0,0 +1,200 @@
+
+
+# Checks on a Pull Request
+
+When you open a pull request on ๐ค Transformers, a fair number of checks will be run to make sure the patch you are adding is not breaking anything existing. Those checks are of four types:
+- regular tests
+- documentation build
+- code and documentation style
+- general repository consistency
+
+In this document, we will take a stab at explaining what those various checks are and the reason behind them, as well as how to debug them locally if one of them fails on your PR.
+
+Note that, ideally, they require you to have a dev install:
+
+```bash
+pip install transformers[dev]
+```
+
+or for an editable install:
+
+```bash
+pip install -e .[dev]
+```
+
+inside the Transformers repo. Since the number of optional dependencies of Transformers has grown a lot, it's possible you don't manage to get all of them. If the dev install fails, make sure to install the Deep Learning framework you are working with (PyTorch, TensorFlow and/or Flax) then do
+
+```bash
+pip install transformers[quality]
+```
+
+or for an editable install:
+
+```bash
+pip install -e .[quality]
+```
+
+
+## Tests
+
+All the jobs that begin with `ci/circleci: run_tests_` run parts of the Transformers testing suite. Each of those jobs focuses on a part of the library in a certain environment: for instance `ci/circleci: run_tests_pipelines_tf` runs the pipelines test in an environment where TensorFlow only is installed.
+
+Note that to avoid running tests when there is no real change in the modules they are testing, only part of the test suite is run each time: a utility is run to determine the differences in the library between before and after the PR (what GitHub shows you in the "Files changes" tab) and picks the tests impacted by that diff. That utility can be run locally with:
+
+```bash
+python utils/tests_fetcher.py
+```
+
+from the root of the Transformers repo. It will:
+
+1. Check for each file in the diff if the changes are in the code or only in comments or docstrings. Only the files with real code changes are kept.
+2. Build an internal map that gives for each file of the source code of the library all the files it recursively impacts. Module A is said to impact module B if module B imports module A. For the recursive impact, we need a chain of modules going from module A to module B in which each module imports the previous one.
+3. Apply this map on the files gathered in step 1, which gives us the list of model files impacted by the PR.
+4. Map each of those files to their corresponding test file(s) and get the list of tests to run.
+
+When executing the script locally, you should get the results of step 1, 3 and 4 printed and thus know which tests are run. The script will also create a file named `test_list.txt` which contains the list of tests to run, and you can run them locally with the following command:
+
+```bash
+python -m pytest -n 8 --dist=loadfile -rA -s $(cat test_list.txt)
+```
+
+Just in case anything slipped through the cracks, the full test suite is also run daily.
+
+## Documentation build
+
+The `build_pr_documentation` job builds and generates a preview of the documentation to make sure everything looks okay once your PR is merged. A bot will add a link to preview the documentation in your PR. Any changes you make to the PR are automatically updated in the preview. If the documentation fails to build, click on **Details** next to the failed job to see where things went wrong. Often, the error is as simple as a missing file in the `toctree`.
+
+If you're interested in building or previewing the documentation locally, take a look at the [`README.md`](https://github.com/huggingface/transformers/tree/main/docs) in the docs folder.
+
+## Code and documentation style
+
+Code formatting is applied to all the source files, the examples and the tests using `black` and `ruff`. We also have a custom tool taking care of the formatting of docstrings and `rst` files (`utils/style_doc.py`), as well as the order of the lazy imports performed in the Transformers `__init__.py` files (`utils/custom_init_isort.py`). All of this can be launched by executing
+
+```bash
+make style
+```
+
+The CI checks those have been applied inside the `ci/circleci: check_code_quality` check. It also runs `ruff`, that will have a basic look at your code and will complain if it finds an undefined variable, or one that is not used. To run that check locally, use
+
+```bash
+make quality
+```
+
+This can take a lot of time, so to run the same thing on only the files you modified in the current branch, run
+
+```bash
+make fixup
+```
+
+This last command will also run all the additional checks for the repository consistency. Let's have a look at them.
+
+## Repository consistency
+
+This regroups all the tests to make sure your PR leaves the repository in a good state, and is performed by the `ci/circleci: check_repository_consistency` check. You can locally run that check by executing the following:
+
+```bash
+make repo-consistency
+```
+
+This checks that:
+
+- All objects added to the init are documented (performed by `utils/check_repo.py`)
+- All `__init__.py` files have the same content in their two sections (performed by `utils/check_inits.py`)
+- All code identified as a copy from another module is consistent with the original (performed by `utils/check_copies.py`)
+- All configuration classes have at least one valid checkpoint mentioned in their docstrings (performed by `utils/check_config_docstrings.py`)
+- All configuration classes only contain attributes that are used in corresponding modeling files (performed by `utils/check_config_attributes.py`)
+- The translations of the READMEs and the index of the doc have the same model list as the main README (performed by `utils/check_copies.py`)
+- The auto-generated tables in the documentation are up to date (performed by `utils/check_table.py`)
+- The library has all objects available even if not all optional dependencies are installed (performed by `utils/check_dummies.py`)
+- All docstrings properly document the arguments in the signature of the object (performed by `utils/check_docstrings.py`)
+
+Should this check fail, the first two items require manual fixing, the last four can be fixed automatically for you by running the command
+
+```bash
+make fix-copies
+```
+
+Additional checks concern PRs that add new models, mainly that:
+
+- All models added are in an Auto-mapping (performed by `utils/check_repo.py`)
+
+- All models are properly tested (performed by `utils/check_repo.py`)
+
+
+
+### Check copies
+
+Since the Transformers library is very opinionated with respect to model code, and each model should fully be implemented in a single file without relying on other models, we have added a mechanism that checks whether a copy of the code of a layer of a given model stays consistent with the original. This way, when there is a bug fix, we can see all other impacted models and choose to trickle down the modification or break the copy.
+
+
+
+If a file is a full copy of another file, you should register it in the constant `FULL_COPIES` of `utils/check_copies.py`.
+
+
+
+This mechanism relies on comments of the form `# Copied from xxx`. The `xxx` should contain the whole path to the class of function which is being copied below. For instance, `RobertaSelfOutput` is a direct copy of the `BertSelfOutput` class, so you can see [here](https://github.com/huggingface/transformers/blob/2bd7a27a671fd1d98059124024f580f8f5c0f3b5/src/transformers/models/roberta/modeling_roberta.py#L289) it has a comment:
+
+```py
+# Copied from transformers.models.bert.modeling_bert.BertSelfOutput
+```
+
+Note that instead of applying this to a whole class, you can apply it to the relevant methods that are copied from. For instance [here](https://github.com/huggingface/transformers/blob/2bd7a27a671fd1d98059124024f580f8f5c0f3b5/src/transformers/models/roberta/modeling_roberta.py#L598) you can see how `RobertaPreTrainedModel._init_weights` is copied from the same method in `BertPreTrainedModel` with the comment:
+
+```py
+# Copied from transformers.models.bert.modeling_bert.BertPreTrainedModel._init_weights
+```
+
+Sometimes the copy is exactly the same except for names: for instance in `RobertaAttention`, we use `RobertaSelfAttention` instead of `BertSelfAttention` but other than that, the code is exactly the same. This is why `# Copied from` supports simple string replacements with the following syntax: `Copied from xxx with foo->bar`. This means the code is copied with all instances of `foo` being replaced by `bar`. You can see how it used [here](https://github.com/huggingface/transformers/blob/2bd7a27a671fd1d98059124024f580f8f5c0f3b5/src/transformers/models/roberta/modeling_roberta.py#L304C1-L304C86) in `RobertaAttention` with the comment:
+
+```py
+# Copied from transformers.models.bert.modeling_bert.BertAttention with Bert->Roberta
+```
+
+Note that there shouldn't be any spaces around the arrow (unless that space is part of the pattern to replace of course).
+
+You can add several patterns separated by a comma. For instance here `CamemberForMaskedLM` is a direct copy of `RobertaForMaskedLM` with two replacements: `Roberta` to `Camembert` and `ROBERTA` to `CAMEMBERT`. You can see [here](https://github.com/huggingface/transformers/blob/15082a9dc6950ecae63a0d3e5060b2fc7f15050a/src/transformers/models/camembert/modeling_camembert.py#L929) this is done with the comment:
+
+```py
+# Copied from transformers.models.roberta.modeling_roberta.RobertaForMaskedLM with Roberta->Camembert, ROBERTA->CAMEMBERT
+```
+
+If the order matters (because one of the replacements might conflict with a previous one), the replacements are executed from left to right.
+
+
+
+If the replacements change the formatting (if you replace a short name by a very long name for instance), the copy is checked after applying the auto-formatter.
+
+
+
+Another way when the patterns are just different casings of the same replacement (with an uppercased and a lowercased variants) is just to add the option `all-casing`. [Here](https://github.com/huggingface/transformers/blob/15082a9dc6950ecae63a0d3e5060b2fc7f15050a/src/transformers/models/mobilebert/modeling_mobilebert.py#L1237) is an example in `MobileBertForSequenceClassification` with the comment:
+
+```py
+# Copied from transformers.models.bert.modeling_bert.BertForSequenceClassification with Bert->MobileBert all-casing
+```
+
+In this case, the code is copied from `BertForSequenceClassification` by replacing:
+- `Bert` by `MobileBert` (for instance when using `MobileBertModel` in the init)
+- `bert` by `mobilebert` (for instance when defining `self.mobilebert`)
+- `BERT` by `MOBILEBERT` (in the constant `MOBILEBERT_INPUTS_DOCSTRING`)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/preprocessing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/preprocessing.md
new file mode 100644
index 0000000000000000000000000000000000000000..1a6f071a33538377f9aad60265cd1366a8fbf459
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/preprocessing.md
@@ -0,0 +1,534 @@
+
+
+# Preprocess
+
+[[open-in-colab]]
+
+Before you can train a model on a dataset, it needs to be preprocessed into the expected model input format. Whether your data is text, images, or audio, it needs to be converted and assembled into batches of tensors. ๐ค Transformers provides a set of preprocessing classes to help prepare your data for the model. In this tutorial, you'll learn that for:
+
+* Text, use a [Tokenizer](./main_classes/tokenizer) to convert text into a sequence of tokens, create a numerical representation of the tokens, and assemble them into tensors.
+* Speech and audio, use a [Feature extractor](./main_classes/feature_extractor) to extract sequential features from audio waveforms and convert them into tensors.
+* Image inputs use a [ImageProcessor](./main_classes/image_processor) to convert images into tensors.
+* Multimodal inputs, use a [Processor](./main_classes/processors) to combine a tokenizer and a feature extractor or image processor.
+
+
+
+`AutoProcessor` **always** works and automatically chooses the correct class for the model you're using, whether you're using a tokenizer, image processor, feature extractor or processor.
+
+
+
+Before you begin, install ๐ค Datasets so you can load some datasets to experiment with:
+
+```bash
+pip install datasets
+```
+
+## Natural Language Processing
+
+
+
+The main tool for preprocessing textual data is a [tokenizer](main_classes/tokenizer). A tokenizer splits text into *tokens* according to a set of rules. The tokens are converted into numbers and then tensors, which become the model inputs. Any additional inputs required by the model are added by the tokenizer.
+
+
+
+If you plan on using a pretrained model, it's important to use the associated pretrained tokenizer. This ensures the text is split the same way as the pretraining corpus, and uses the same corresponding tokens-to-index (usually referred to as the *vocab*) during pretraining.
+
+
+
+Get started by loading a pretrained tokenizer with the [`AutoTokenizer.from_pretrained`] method. This downloads the *vocab* a model was pretrained with:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+```
+
+Then pass your text to the tokenizer:
+
+```py
+>>> encoded_input = tokenizer("Do not meddle in the affairs of wizards, for they are subtle and quick to anger.")
+>>> print(encoded_input)
+{'input_ids': [101, 2079, 2025, 19960, 10362, 1999, 1996, 3821, 1997, 16657, 1010, 2005, 2027, 2024, 11259, 1998, 4248, 2000, 4963, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+The tokenizer returns a dictionary with three important items:
+
+* [input_ids](glossary#input-ids) are the indices corresponding to each token in the sentence.
+* [attention_mask](glossary#attention-mask) indicates whether a token should be attended to or not.
+* [token_type_ids](glossary#token-type-ids) identifies which sequence a token belongs to when there is more than one sequence.
+
+Return your input by decoding the `input_ids`:
+
+```py
+>>> tokenizer.decode(encoded_input["input_ids"])
+'[CLS] Do not meddle in the affairs of wizards, for they are subtle and quick to anger. [SEP]'
+```
+
+As you can see, the tokenizer added two special tokens - `CLS` and `SEP` (classifier and separator) - to the sentence. Not all models need
+special tokens, but if they do, the tokenizer automatically adds them for you.
+
+If there are several sentences you want to preprocess, pass them as a list to the tokenizer:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_inputs = tokenizer(batch_sentences)
+>>> print(encoded_inputs)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1]]}
+```
+
+### Pad
+
+Sentences aren't always the same length which can be an issue because tensors, the model inputs, need to have a uniform shape. Padding is a strategy for ensuring tensors are rectangular by adding a special *padding token* to shorter sentences.
+
+Set the `padding` parameter to `True` to pad the shorter sequences in the batch to match the longest sequence:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+The first and third sentences are now padded with `0`'s because they are shorter.
+
+### Truncation
+
+On the other end of the spectrum, sometimes a sequence may be too long for a model to handle. In this case, you'll need to truncate the sequence to a shorter length.
+
+Set the `truncation` parameter to `True` to truncate a sequence to the maximum length accepted by the model:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+
+
+Check out the [Padding and truncation](./pad_truncation) concept guide to learn more different padding and truncation arguments.
+
+
+
+### Build tensors
+
+Finally, you want the tokenizer to return the actual tensors that get fed to the model.
+
+Set the `return_tensors` parameter to either `pt` for PyTorch, or `tf` for TensorFlow:
+
+
+
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True, return_tensors="pt")
+>>> print(encoded_input)
+{'input_ids': tensor([[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]]),
+ 'token_type_ids': tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]),
+ 'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]])}
+```
+
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True, return_tensors="tf")
+>>> print(encoded_input)
+{'input_ids': ,
+ 'token_type_ids': ,
+ 'attention_mask': }
+```
+
+
+
+
+Different pipelines support tokenizer arguments in their `__call__()` differently. `text-2-text-generation` pipelines support (i.e. pass on)
+only `truncation`. `text-generation` pipelines support `max_length`, `truncation`, `padding` and `add_special_tokens`.
+In `fill-mask` pipelines, tokenizer arguments can be passed in the `tokenizer_kwargs` argument (dictionary).
+
+
+## Audio
+
+For audio tasks, you'll need a [feature extractor](main_classes/feature_extractor) to prepare your dataset for the model. The feature extractor is designed to extract features from raw audio data, and convert them into tensors.
+
+Load the [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) dataset (see the ๐ค [Datasets tutorial](https://huggingface.co/docs/datasets/load_hub) for more details on how to load a dataset) to see how you can use a feature extractor with audio datasets:
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
+```
+
+Access the first element of the `audio` column to take a look at the input. Calling the `audio` column automatically loads and resamples the audio file:
+
+```py
+>>> dataset[0]["audio"]
+{'array': array([ 0. , 0.00024414, -0.00024414, ..., -0.00024414,
+ 0. , 0. ], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~JOINT_ACCOUNT/602ba55abb1e6d0fbce92065.wav',
+ 'sampling_rate': 8000}
+```
+
+This returns three items:
+
+* `array` is the speech signal loaded - and potentially resampled - as a 1D array.
+* `path` points to the location of the audio file.
+* `sampling_rate` refers to how many data points in the speech signal are measured per second.
+
+For this tutorial, you'll use the [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base) model. Take a look at the model card, and you'll learn Wav2Vec2 is pretrained on 16kHz sampled speech audio. It is important your audio data's sampling rate matches the sampling rate of the dataset used to pretrain the model. If your data's sampling rate isn't the same, then you need to resample your data.
+
+1. Use ๐ค Datasets' [`~datasets.Dataset.cast_column`] method to upsample the sampling rate to 16kHz:
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+2. Call the `audio` column again to resample the audio file:
+
+```py
+>>> dataset[0]["audio"]
+{'array': array([ 2.3443763e-05, 2.1729663e-04, 2.2145823e-04, ...,
+ 3.8356509e-05, -7.3497440e-06, -2.1754686e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~JOINT_ACCOUNT/602ba55abb1e6d0fbce92065.wav',
+ 'sampling_rate': 16000}
+```
+
+Next, load a feature extractor to normalize and pad the input. When padding textual data, a `0` is added for shorter sequences. The same idea applies to audio data. The feature extractor adds a `0` - interpreted as silence - to `array`.
+
+Load the feature extractor with [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
+```
+
+Pass the audio `array` to the feature extractor. We also recommend adding the `sampling_rate` argument in the feature extractor in order to better debug any silent errors that may occur.
+
+```py
+>>> audio_input = [dataset[0]["audio"]["array"]]
+>>> feature_extractor(audio_input, sampling_rate=16000)
+{'input_values': [array([ 3.8106556e-04, 2.7506407e-03, 2.8015103e-03, ...,
+ 5.6335266e-04, 4.6588284e-06, -1.7142107e-04], dtype=float32)]}
+```
+
+Just like the tokenizer, you can apply padding or truncation to handle variable sequences in a batch. Take a look at the sequence length of these two audio samples:
+
+```py
+>>> dataset[0]["audio"]["array"].shape
+(173398,)
+
+>>> dataset[1]["audio"]["array"].shape
+(106496,)
+```
+
+Create a function to preprocess the dataset so the audio samples are the same lengths. Specify a maximum sample length, and the feature extractor will either pad or truncate the sequences to match it:
+
+```py
+>>> def preprocess_function(examples):
+... audio_arrays = [x["array"] for x in examples["audio"]]
+... inputs = feature_extractor(
+... audio_arrays,
+... sampling_rate=16000,
+... padding=True,
+... max_length=100000,
+... truncation=True,
+... )
+... return inputs
+```
+
+Apply the `preprocess_function` to the first few examples in the dataset:
+
+```py
+>>> processed_dataset = preprocess_function(dataset[:5])
+```
+
+The sample lengths are now the same and match the specified maximum length. You can pass your processed dataset to the model now!
+
+```py
+>>> processed_dataset["input_values"][0].shape
+(100000,)
+
+>>> processed_dataset["input_values"][1].shape
+(100000,)
+```
+
+## Computer vision
+
+For computer vision tasks, you'll need an [image processor](main_classes/image_processor) to prepare your dataset for the model.
+Image preprocessing consists of several steps that convert images into the input expected by the model. These steps
+include but are not limited to resizing, normalizing, color channel correction, and converting images to tensors.
+
+
+
+Image preprocessing often follows some form of image augmentation. Both image preprocessing and image augmentation
+transform image data, but they serve different purposes:
+
+* Image augmentation alters images in a way that can help prevent overfitting and increase the robustness of the model. You can get creative in how you augment your data - adjust brightness and colors, crop, rotate, resize, zoom, etc. However, be mindful not to change the meaning of the images with your augmentations.
+* Image preprocessing guarantees that the images match the modelโs expected input format. When fine-tuning a computer vision model, images must be preprocessed exactly as when the model was initially trained.
+
+You can use any library you like for image augmentation. For image preprocessing, use the `ImageProcessor` associated with the model.
+
+
+
+Load the [food101](https://huggingface.co/datasets/food101) dataset (see the ๐ค [Datasets tutorial](https://huggingface.co/docs/datasets/load_hub) for more details on how to load a dataset) to see how you can use an image processor with computer vision datasets:
+
+
+
+Use ๐ค Datasets `split` parameter to only load a small sample from the training split since the dataset is quite large!
+
+
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("food101", split="train[:100]")
+```
+
+Next, take a look at the image with ๐ค Datasets [`Image`](https://huggingface.co/docs/datasets/package_reference/main_classes?highlight=image#datasets.Image) feature:
+
+```py
+>>> dataset[0]["image"]
+```
+
+
+
+
+
+Load the image processor with [`AutoImageProcessor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+```
+
+First, let's add some image augmentation. You can use any library you prefer, but in this tutorial, we'll use torchvision's [`transforms`](https://pytorch.org/vision/stable/transforms.html) module. If you're interested in using another data augmentation library, learn how in the [Albumentations](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification_albumentations.ipynb) or [Kornia notebooks](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification_kornia.ipynb).
+
+1. Here we use [`Compose`](https://pytorch.org/vision/master/generated/torchvision.transforms.Compose.html) to chain together a couple of
+transforms - [`RandomResizedCrop`](https://pytorch.org/vision/main/generated/torchvision.transforms.RandomResizedCrop.html) and [`ColorJitter`](https://pytorch.org/vision/main/generated/torchvision.transforms.ColorJitter.html).
+Note that for resizing, we can get the image size requirements from the `image_processor`. For some models, an exact height and
+width are expected, for others only the `shortest_edge` is defined.
+
+```py
+>>> from torchvision.transforms import RandomResizedCrop, ColorJitter, Compose
+
+>>> size = (
+... image_processor.size["shortest_edge"]
+... if "shortest_edge" in image_processor.size
+... else (image_processor.size["height"], image_processor.size["width"])
+... )
+
+>>> _transforms = Compose([RandomResizedCrop(size), ColorJitter(brightness=0.5, hue=0.5)])
+```
+
+2. The model accepts [`pixel_values`](model_doc/vision-encoder-decoder#transformers.VisionEncoderDecoderModel.forward.pixel_values)
+as its input. `ImageProcessor` can take care of normalizing the images, and generating appropriate tensors.
+Create a function that combines image augmentation and image preprocessing for a batch of images and generates `pixel_values`:
+
+```py
+>>> def transforms(examples):
+... images = [_transforms(img.convert("RGB")) for img in examples["image"]]
+... examples["pixel_values"] = image_processor(images, do_resize=False, return_tensors="pt")["pixel_values"]
+... return examples
+```
+
+
+
+In the example above we set `do_resize=False` because we have already resized the images in the image augmentation transformation,
+and leveraged the `size` attribute from the appropriate `image_processor`. If you do not resize images during image augmentation,
+leave this parameter out. By default, `ImageProcessor` will handle the resizing.
+
+If you wish to normalize images as a part of the augmentation transformation, use the `image_processor.image_mean`,
+and `image_processor.image_std` values.
+
+
+3. Then use ๐ค Datasets[`~datasets.Dataset.set_transform`] to apply the transforms on the fly:
+```py
+>>> dataset.set_transform(transforms)
+```
+
+4. Now when you access the image, you'll notice the image processor has added `pixel_values`. You can pass your processed dataset to the model now!
+
+```py
+>>> dataset[0].keys()
+```
+
+Here is what the image looks like after the transforms are applied. The image has been randomly cropped and it's color properties are different.
+
+```py
+>>> import numpy as np
+>>> import matplotlib.pyplot as plt
+
+>>> img = dataset[0]["pixel_values"]
+>>> plt.imshow(img.permute(1, 2, 0))
+```
+
+
+
+
+
+
+
+For tasks like object detection, semantic segmentation, instance segmentation, and panoptic segmentation, `ImageProcessor`
+offers post processing methods. These methods convert model's raw outputs into meaningful predictions such as bounding boxes,
+or segmentation maps.
+
+
+
+### Pad
+
+In some cases, for instance, when fine-tuning [DETR](./model_doc/detr), the model applies scale augmentation at training
+time. This may cause images to be different sizes in a batch. You can use [`DetrImageProcessor.pad`]
+from [`DetrImageProcessor`] and define a custom `collate_fn` to batch images together.
+
+```py
+>>> def collate_fn(batch):
+... pixel_values = [item["pixel_values"] for item in batch]
+... encoding = image_processor.pad(pixel_values, return_tensors="pt")
+... labels = [item["labels"] for item in batch]
+... batch = {}
+... batch["pixel_values"] = encoding["pixel_values"]
+... batch["pixel_mask"] = encoding["pixel_mask"]
+... batch["labels"] = labels
+... return batch
+```
+
+## Multimodal
+
+For tasks involving multimodal inputs, you'll need a [processor](main_classes/processors) to prepare your dataset for the model. A processor couples together two processing objects such as tokenizer and feature extractor.
+
+Load the [LJ Speech](https://huggingface.co/datasets/lj_speech) dataset (see the ๐ค [Datasets tutorial](https://huggingface.co/docs/datasets/load_hub) for more details on how to load a dataset) to see how you can use a processor for automatic speech recognition (ASR):
+
+```py
+>>> from datasets import load_dataset
+
+>>> lj_speech = load_dataset("lj_speech", split="train")
+```
+
+For ASR, you're mainly focused on `audio` and `text` so you can remove the other columns:
+
+```py
+>>> lj_speech = lj_speech.map(remove_columns=["file", "id", "normalized_text"])
+```
+
+Now take a look at the `audio` and `text` columns:
+
+```py
+>>> lj_speech[0]["audio"]
+{'array': array([-7.3242188e-04, -7.6293945e-04, -6.4086914e-04, ...,
+ 7.3242188e-04, 2.1362305e-04, 6.1035156e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/917ece08c95cf0c4115e45294e3cd0dee724a1165b7fc11798369308a465bd26/LJSpeech-1.1/wavs/LJ001-0001.wav',
+ 'sampling_rate': 22050}
+
+>>> lj_speech[0]["text"]
+'Printing, in the only sense with which we are at present concerned, differs from most if not from all the arts and crafts represented in the Exhibition'
+```
+
+Remember you should always [resample](preprocessing#audio) your audio dataset's sampling rate to match the sampling rate of the dataset used to pretrain a model!
+
+```py
+>>> lj_speech = lj_speech.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+Load a processor with [`AutoProcessor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
+```
+
+1. Create a function to process the audio data contained in `array` to `input_values`, and tokenize `text` to `labels`. These are the inputs to the model:
+
+```py
+>>> def prepare_dataset(example):
+... audio = example["audio"]
+
+... example.update(processor(audio=audio["array"], text=example["text"], sampling_rate=16000))
+
+... return example
+```
+
+2. Apply the `prepare_dataset` function to a sample:
+
+```py
+>>> prepare_dataset(lj_speech[0])
+```
+
+The processor has now added `input_values` and `labels`, and the sampling rate has also been correctly downsampled to 16kHz. You can pass your processed dataset to the model now!
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/aqlm.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/aqlm.md
new file mode 100644
index 0000000000000000000000000000000000000000..2e00d94cfcfff359c7d3f5462a43f576b38de1b8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/aqlm.md
@@ -0,0 +1,57 @@
+
+
+# AQLM
+
+> [!TIP]
+> Try AQLM on [Google Colab](https://colab.research.google.com/drive/1-xZmBRXT5Fm3Ghn4Mwa2KRypORXb855X?usp=sharing)!
+
+Additive Quantization of Language Models ([AQLM](https://arxiv.org/abs/2401.06118)) is a Large Language Models compression method. It quantizes multiple weights together and takes advantage of interdependencies between them. AQLM represents groups of 8-16 weights as a sum of multiple vector codes.
+
+Inference support for AQLM is realised in the `aqlm` library. Make sure to install it to run the models (note aqlm works only with python>=3.10):
+```bash
+pip install aqlm[gpu,cpu]
+```
+
+The library provides efficient kernels for both GPU and CPU inference and training.
+
+The instructions on how to quantize models yourself, as well as all the relevant code can be found in the corresponding GitHub [repository](https://github.com/Vahe1994/AQLM). To run AQLM models simply load a model that has been quantized with AQLM:
+
+```python
+from transformers import AutoTokenizer, AutoModelForCausalLM
+
+quantized_model = AutoModelForCausalLM.from_pretrained(
+ "ISTA-DASLab/Mixtral-8x7b-AQLM-2Bit-1x16-hf",
+ torch_dtype="auto",
+ device_map="auto"
+)
+tokenizer = AutoTokenizer.from_pretrained("ISTA-DASLab/Mixtral-8x7b-AQLM-2Bit-1x16-hf")
+```
+
+## PEFT
+
+Starting with version `aqlm 1.0.2`, AQLM supports Parameter-Efficient Fine-Tuning in a form of [LoRA](https://huggingface.co/docs/peft/package_reference/lora) integrated into the [PEFT](https://huggingface.co/blog/peft) library.
+
+## AQLM configurations
+
+AQLM quantization setups vary mainly on the number of codebooks used as well as codebook sizes in bits. The most popular setups, as well as inference kernels they support are:
+
+| Kernel | Number of codebooks | Codebook size, bits | Notation | Accuracy | Speedup | Fast GPU inference | Fast CPU inference |
+|---|---------------------|---------------------|----------|-------------|-------------|--------------------|--------------------|
+| Triton | K | N | KxN | - | Up to ~0.7x | โ
| โ |
+| CUDA | 1 | 16 | 1x16 | Best | Up to ~1.3x | โ
| โ |
+| CUDA | 2 | 8 | 2x8 | OK | Up to ~3.0x | โ
| โ |
+| Numba | K | 8 | Kx8 | Good | Up to ~4.0x | โ | โ
|
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/awq.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/awq.md
new file mode 100644
index 0000000000000000000000000000000000000000..ca26844edd0294e9f5172687e622f3239b0c1ed7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/awq.md
@@ -0,0 +1,273 @@
+
+
+# AWQ
+
+
+
+Try AWQ quantization with this [notebook](https://colab.research.google.com/drive/1HzZH89yAXJaZgwJDhQj9LqSBux932BvY)!
+
+
+
+[Activation-aware Weight Quantization (AWQ)](https://hf.co/papers/2306.00978) doesn't quantize all the weights in a model, and instead, it preserves a small percentage of weights that are important for LLM performance. This significantly reduces quantization loss such that you can run models in 4-bit precision without experiencing any performance degradation.
+
+There are several libraries for quantizing models with the AWQ algorithm, such as [llm-awq](https://github.com/mit-han-lab/llm-awq), [autoawq](https://github.com/casper-hansen/AutoAWQ) or [optimum-intel](https://huggingface.co/docs/optimum/main/en/intel/optimization_inc). Transformers supports loading models quantized with the llm-awq and autoawq libraries. This guide will show you how to load models quantized with autoawq, but the process is similar for llm-awq quantized models.
+
+Make sure you have autoawq installed:
+
+```bash
+pip install autoawq
+```
+
+AWQ-quantized models can be identified by checking the `quantization_config` attribute in the model's [config.json](https://huggingface.co/TheBloke/zephyr-7B-alpha-AWQ/blob/main/config.json) file:
+
+```json
+{
+ "_name_or_path": "/workspace/process/huggingfaceh4_zephyr-7b-alpha/source",
+ "architectures": [
+ "MistralForCausalLM"
+ ],
+ ...
+ ...
+ ...
+ "quantization_config": {
+ "quant_method": "awq",
+ "zero_point": true,
+ "group_size": 128,
+ "bits": 4,
+ "version": "gemm"
+ }
+}
+```
+
+A quantized model is loaded with the [`~PreTrainedModel.from_pretrained`] method. If you loaded your model on the CPU, make sure to move it to a GPU device first. Use the `device_map` parameter to specify where to place the model:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model_id = "TheBloke/zephyr-7B-alpha-AWQ"
+model = AutoModelForCausalLM.from_pretrained(model_id, device_map="cuda:0")
+```
+
+Loading an AWQ-quantized model automatically sets other weights to fp16 by default for performance reasons. If you want to load these other weights in a different format, use the `torch_dtype` parameter:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model_id = "TheBloke/zephyr-7B-alpha-AWQ"
+model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float32)
+```
+
+AWQ quantization can also be combined with [FlashAttention-2](../perf_infer_gpu_one#flashattention-2) to further accelerate inference:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model = AutoModelForCausalLM.from_pretrained("TheBloke/zephyr-7B-alpha-AWQ", attn_implementation="flash_attention_2", device_map="cuda:0")
+```
+
+## Fused modules
+
+Fused modules offers improved accuracy and performance and it is supported out-of-the-box for AWQ modules for [Llama](https://huggingface.co/meta-llama) and [Mistral](https://huggingface.co/mistralai/Mistral-7B-v0.1) architectures, but you can also fuse AWQ modules for unsupported architectures.
+
+
+
+Fused modules cannot be combined with other optimization techniques such as FlashAttention-2.
+
+
+
+
+
+
+To enable fused modules for supported architectures, create an [`AwqConfig`] and set the parameters `fuse_max_seq_len` and `do_fuse=True`. The `fuse_max_seq_len` parameter is the total sequence length and it should include the context length and the expected generation length. You can set it to a larger value to be safe.
+
+For example, to fuse the AWQ modules of the [TheBloke/Mistral-7B-OpenOrca-AWQ](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-AWQ) model.
+
+```python
+import torch
+from transformers import AwqConfig, AutoModelForCausalLM
+
+model_id = "TheBloke/Mistral-7B-OpenOrca-AWQ"
+
+quantization_config = AwqConfig(
+ bits=4,
+ fuse_max_seq_len=512,
+ do_fuse=True,
+)
+
+model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=quantization_config).to(0)
+```
+
+The [TheBloke/Mistral-7B-OpenOrca-AWQ](https://huggingface.co/TheBloke/Mistral-7B-OpenOrca-AWQ) model was benchmarked with `batch_size=1` with and without fused modules.
+
+Unfused module
+
+| Batch Size | Prefill Length | Decode Length | Prefill tokens/s | Decode tokens/s | Memory (VRAM) |
+|-------------:|-----------------:|----------------:|-------------------:|------------------:|:----------------|
+| 1 | 32 | 32 | 60.0984 | 38.4537 | 4.50 GB (5.68%) |
+| 1 | 64 | 64 | 1333.67 | 31.6604 | 4.50 GB (5.68%) |
+| 1 | 128 | 128 | 2434.06 | 31.6272 | 4.50 GB (5.68%) |
+| 1 | 256 | 256 | 3072.26 | 38.1731 | 4.50 GB (5.68%) |
+| 1 | 512 | 512 | 3184.74 | 31.6819 | 4.59 GB (5.80%) |
+| 1 | 1024 | 1024 | 3148.18 | 36.8031 | 4.81 GB (6.07%) |
+| 1 | 2048 | 2048 | 2927.33 | 35.2676 | 5.73 GB (7.23%) |
+
+Fused module
+
+| Batch Size | Prefill Length | Decode Length | Prefill tokens/s | Decode tokens/s | Memory (VRAM) |
+|-------------:|-----------------:|----------------:|-------------------:|------------------:|:----------------|
+| 1 | 32 | 32 | 81.4899 | 80.2569 | 4.00 GB (5.05%) |
+| 1 | 64 | 64 | 1756.1 | 106.26 | 4.00 GB (5.05%) |
+| 1 | 128 | 128 | 2479.32 | 105.631 | 4.00 GB (5.06%) |
+| 1 | 256 | 256 | 1813.6 | 85.7485 | 4.01 GB (5.06%) |
+| 1 | 512 | 512 | 2848.9 | 97.701 | 4.11 GB (5.19%) |
+| 1 | 1024 | 1024 | 3044.35 | 87.7323 | 4.41 GB (5.57%) |
+| 1 | 2048 | 2048 | 2715.11 | 89.4709 | 5.57 GB (7.04%) |
+
+The speed and throughput of fused and unfused modules were also tested with the [optimum-benchmark](https://github.com/huggingface/optimum-benchmark) library.
+
+
+
+
+
forward peak memory/batch size
+
+
+
+
generate throughput/batch size
+
+
+
+
+
+
+For architectures that don't support fused modules yet, you need to create a custom fusing mapping to define which modules need to be fused with the `modules_to_fuse` parameter. For example, to fuse the AWQ modules of the [TheBloke/Yi-34B-AWQ](https://huggingface.co/TheBloke/Yi-34B-AWQ) model.
+
+```python
+import torch
+from transformers import AwqConfig, AutoModelForCausalLM
+
+model_id = "TheBloke/Yi-34B-AWQ"
+
+quantization_config = AwqConfig(
+ bits=4,
+ fuse_max_seq_len=512,
+ modules_to_fuse={
+ "attention": ["q_proj", "k_proj", "v_proj", "o_proj"],
+ "layernorm": ["ln1", "ln2", "norm"],
+ "mlp": ["gate_proj", "up_proj", "down_proj"],
+ "use_alibi": False,
+ "num_attention_heads": 56,
+ "num_key_value_heads": 8,
+ "hidden_size": 7168
+ }
+)
+
+model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=quantization_config).to(0)
+```
+
+The parameter `modules_to_fuse` should include:
+
+- `"attention"`: The names of the attention layers to fuse in the following order: query, key, value and output projection layer. If you don't want to fuse these layers, pass an empty list.
+- `"layernorm"`: The names of all the LayerNorm layers you want to replace with a custom fused LayerNorm. If you don't want to fuse these layers, pass an empty list.
+- `"mlp"`: The names of the MLP layers you want to fuse into a single MLP layer in the order: (gate (dense, layer, post-attention) / up / down layers).
+- `"use_alibi"`: If your model uses ALiBi positional embedding.
+- `"num_attention_heads"`: The number of attention heads.
+- `"num_key_value_heads"`: The number of key value heads that should be used to implement Grouped Query Attention (GQA). If `num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if `num_key_value_heads=1` the model will use Multi Query Attention (MQA), otherwise GQA is used.
+- `"hidden_size"`: The dimension of the hidden representations.
+
+
+
+
+
+
+## ExLlama-v2 support
+
+Recent versions of `autoawq` supports ExLlama-v2 kernels for faster prefill and decoding. To get started, first install the latest version of `autoawq` by running:
+
+```bash
+pip install git+https://github.com/casper-hansen/AutoAWQ.git
+```
+
+Get started by passing an `AwqConfig()` with `version="exllama"`.
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, AwqConfig
+
+quantization_config = AwqConfig(version="exllama")
+
+model = AutoModelForCausalLM.from_pretrained(
+ "TheBloke/Mistral-7B-Instruct-v0.1-AWQ",
+ quantization_config=quantization_config,
+ device_map="auto",
+)
+
+input_ids = torch.randint(0, 100, (1, 128), dtype=torch.long, device="cuda")
+output = model(input_ids)
+print(output.logits)
+
+tokenizer = AutoTokenizer.from_pretrained("TheBloke/Mistral-7B-Instruct-v0.1-AWQ")
+input_ids = tokenizer.encode("How to make a cake", return_tensors="pt").to(model.device)
+output = model.generate(input_ids, do_sample=True, max_length=50, pad_token_id=50256)
+print(tokenizer.decode(output[0], skip_special_tokens=True))
+```
+
+
+
+Note this feature is supported on AMD GPUs.
+
+
+
+
+## CPU support
+
+Recent versions of `autoawq` supports CPU with ipex op optimizations. To get started, first install the latest version of `autoawq` by running:
+
+```bash
+pip install intel-extension-for-pytorch
+pip install git+https://github.com/casper-hansen/AutoAWQ.git
+```
+
+Get started by passing an `AwqConfig()` with `version="ipex"`.
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, AwqConfig
+
+quantization_config = AwqConfig(version="ipex")
+
+model = AutoModelForCausalLM.from_pretrained(
+ "TheBloke/TinyLlama-1.1B-Chat-v0.3-AWQ",
+ quantization_config=quantization_config,
+ device_map="cpu",
+)
+
+input_ids = torch.randint(0, 100, (1, 128), dtype=torch.long, device="cpu")
+output = model(input_ids)
+print(output.logits)
+
+tokenizer = AutoTokenizer.from_pretrained("TheBloke/TinyLlama-1.1B-Chat-v0.3-AWQ")
+input_ids = tokenizer.encode("How to make a cake", return_tensors="pt")
+pad_token_id = tokenizer.eos_token_id
+output = model.generate(input_ids, do_sample=True, max_length=50, pad_token_id=pad_token_id)
+print(tokenizer.decode(output[0], skip_special_tokens=True))
+```
+
+
+
+Note this feature is supported on Intel CPUs.
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/bitnet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/bitnet.md
new file mode 100644
index 0000000000000000000000000000000000000000..6bd65e8b53a476231187a5ff55e5f517c9a01987
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/bitnet.md
@@ -0,0 +1,75 @@
+
+
+# BitNet
+
+[BitNet](https://arxiv.org/abs/2402.17764) replaces traditional Linear layers in Multi-Head Attention and Feed-Forward Networks with specialized layers called BitLinear with ternary (or binary in the older version) precision. The BitLinear layers introduced here quantize the weights using ternary precision (with values of -1, 0, and 1) and quantize the activations to 8-bit precision.
+
+
+
+
+ The architecture of BitNet with BitLinear layers
+
+
+During training, we start by quantizing the weights into ternary values, using symmetric per tensor quantization. First, we compute the average of the absolute values of the weight matrix and use this as a scale. We then divide the weights by the scale, round the values, constrain them between -1 and 1, and finally rescale them to continue in full precision.
+
+$$
+scale_w = \frac{1}{\frac{1}{nm} \sum_{ij} |W_{ij}|}
+$$
+
+$$
+W_q = \text{clamp}_{[-1,1]}(\text{round}(W*scale))
+$$
+
+$$
+W_{dequantized} = W_q*scale_w
+$$
+
+Activations are then quantized to a specified bit-width (e.g., 8-bit) using [absmax](https://arxiv.org/pdf/2208.07339) quantization (symmetric per channel quantization). This involves scaling the activations into a range [โ128,127[. The quantization formula is:
+
+$$
+scale_x = \frac{127}{|X|_{\text{max}, \, \text{dim}=-1}}
+$$
+
+$$
+X_q = \text{clamp}_{[-128,127]}(\text{round}(X*scale))
+$$
+
+$$
+X_{dequantized} = X_q * scale_x
+$$
+
+To learn more about how we trained, and fine-tuned bitnet models checkout the blogpost [here](https://huggingface.co/blog/1_58_llm_extreme_quantization)
+
+## Load a BitNet Model from the Hub
+BitNet models can't be quantized on the flyโthey need to be pre-trained or fine-tuned with the quantization applied (it's a Quantization aware training technique). Once trained, these models are already quantized and available as packed versions on the hub.
+
+A quantized model can be load :
+
+```py
+from transformers import AutoModelForCausalLM
+path = "/path/to/model"
+model = AutoModelForCausalLM.from_pretrained(path, device_map="auto")
+```
+## Pre-training / Fine-tuning a BitNet Model
+
+If you're looking to pre-train or fine-tune your own 1.58-bit model using Nanotron, check out this [PR](https://github.com/huggingface/nanotron/pull/180), all you need to get started is there !
+
+For fine-tuning, you'll need to convert the model from Hugging Face format to Nanotron format (which has some differences). You can find the conversion steps in this [PR](https://github.com/huggingface/nanotron/pull/174).
+
+## Kernels
+
+In our initial version, we chose to use `@torch.compile` to unpack the weights and perform the forward pass. Itโs very straightforward to implement and delivers significant speed improvements. We plan to integrate additional optimized kernels in future versions.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/bitsandbytes.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/bitsandbytes.md
new file mode 100644
index 0000000000000000000000000000000000000000..6c6b92d0a6e594f727c2b9e9ebc42732a9be997f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/bitsandbytes.md
@@ -0,0 +1,319 @@
+
+
+# bitsandbytes
+
+[bitsandbytes](https://github.com/TimDettmers/bitsandbytes) is the easiest option for quantizing a model to 8 and 4-bit. 8-bit quantization multiplies outliers in fp16 with non-outliers in int8, converts the non-outlier values back to fp16, and then adds them together to return the weights in fp16. This reduces the degradative effect outlier values have on a model's performance. 4-bit quantization compresses a model even further, and it is commonly used with [QLoRA](https://hf.co/papers/2305.14314) to finetune quantized LLMs.
+
+To use bitsandbytes, make sure you have the following libraries installed:
+
+
+
+
+```bash
+pip install transformers accelerate bitsandbytes>0.37.0
+```
+
+
+
+
+```bash
+pip install bitsandbytes>=0.39.0
+pip install --upgrade accelerate transformers
+```
+
+
+
+
+
+
+bitsandbytes is being refactored to support multiple backends beyond CUDA. Currently, ROCm (AMD GPU) and Intel CPU implementations are mature, with Intel XPU in progress and Apple Silicon support expected by Q4/Q1. For installation instructions and the latest backend updates, visit [this link](https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend).
+
+We value your feedback to help identify bugs before the full release! Check out [these docs](https://huggingface.co/docs/bitsandbytes/main/en/non_cuda_backends) for more details and feedback links.
+
+
+
+Now you can quantize a model by passing a `BitsAndBytesConfig` to [`~PreTrainedModel.from_pretrained`] method. This works for any model in any modality, as long as it supports loading with Accelerate and contains `torch.nn.Linear` layers.
+
+
+
+
+Quantizing a model in 8-bit halves the memory-usage, and for large models, set `device_map="auto"` to efficiently use the GPUs available:
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_8bit=True)
+
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ "bigscience/bloom-1b7",
+ quantization_config=quantization_config
+)
+```
+
+By default, all the other modules such as `torch.nn.LayerNorm` are converted to `torch.float16`. You can change the data type of these modules with the `torch_dtype` parameter if you want. Setting `torch_dtype="auto"` loads the model in the data type defined in a model's `config.json` file.
+
+```py
+import torch
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_8bit=True)
+
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ "facebook/opt-350m",
+ quantization_config=quantization_config,
+ torch_dtype="auto"
+)
+model_8bit.model.decoder.layers[-1].final_layer_norm.weight.dtype
+```
+
+Once a model is quantized to 8-bit, you can't push the quantized weights to the Hub unless you're using the latest version of Transformers and bitsandbytes. If you have the latest versions, then you can push the 8-bit model to the Hub with the [`~PreTrainedModel.push_to_hub`] method. The quantization config.json file is pushed first, followed by the quantized model weights.
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_8bit=True)
+
+model = AutoModelForCausalLM.from_pretrained(
+ "bigscience/bloom-560m",
+ quantization_config=quantization_config
+)
+tokenizer = AutoTokenizer.from_pretrained("bigscience/bloom-560m")
+
+model.push_to_hub("bloom-560m-8bit")
+```
+
+
+
+
+Quantizing a model in 4-bit reduces your memory-usage by 4x, and for large models, set `device_map="auto"` to efficiently use the GPUs available:
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_4bit=True)
+
+model_4bit = AutoModelForCausalLM.from_pretrained(
+ "bigscience/bloom-1b7",
+ quantization_config=quantization_config
+)
+```
+
+By default, all the other modules such as `torch.nn.LayerNorm` are converted to `torch.float16`. You can change the data type of these modules with the `torch_dtype` parameter if you want. Setting `torch_dtype="auto"` loads the model in the data type defined in a model's `config.json` file.
+
+```py
+import torch
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_4bit=True)
+
+model_4bit = AutoModelForCausalLM.from_pretrained(
+ "facebook/opt-350m",
+ quantization_config=quantization_config,
+ torch_dtype="auto"
+)
+model_4bit.model.decoder.layers[-1].final_layer_norm.weight.dtype
+```
+
+If you have `bitsandbytes>=0.41.3`, you can serialize 4-bit models and push them on Hugging Face Hub. Simply call `model.push_to_hub()` after loading it in 4-bit precision. You can also save the serialized 4-bit models locally with `model.save_pretrained()` command.
+
+
+
+
+
+
+Training with 8-bit and 4-bit weights are only supported for training *extra* parameters.
+
+
+
+You can check your memory footprint with the `get_memory_footprint` method:
+
+```py
+print(model.get_memory_footprint())
+```
+
+Quantized models can be loaded from the [`~PreTrainedModel.from_pretrained`] method without needing to specify the `load_in_8bit` or `load_in_4bit` parameters:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model = AutoModelForCausalLM.from_pretrained("{your_username}/bloom-560m-8bit", device_map="auto")
+```
+
+## 8-bit (LLM.int8() algorithm)
+
+
+
+Learn more about the details of 8-bit quantization in this [blog post](https://huggingface.co/blog/hf-bitsandbytes-integration)!
+
+
+
+This section explores some of the specific features of 8-bit models, such as offloading, outlier thresholds, skipping module conversion, and finetuning.
+
+### Offloading
+
+8-bit models can offload weights between the CPU and GPU to support fitting very large models into memory. The weights dispatched to the CPU are actually stored in **float32**, and aren't converted to 8-bit. For example, to enable offloading for the [bigscience/bloom-1b7](https://huggingface.co/bigscience/bloom-1b7) model, start by creating a [`BitsAndBytesConfig`]:
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(llm_int8_enable_fp32_cpu_offload=True)
+```
+
+Design a custom device map to fit everything on your GPU except for the `lm_head`, which you'll dispatch to the CPU:
+
+```py
+device_map = {
+ "transformer.word_embeddings": 0,
+ "transformer.word_embeddings_layernorm": 0,
+ "lm_head": "cpu",
+ "transformer.h": 0,
+ "transformer.ln_f": 0,
+}
+```
+
+Now load your model with the custom `device_map` and `quantization_config`:
+
+```py
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ "bigscience/bloom-1b7",
+ torch_dtype="auto",
+ device_map=device_map,
+ quantization_config=quantization_config,
+)
+```
+
+### Outlier threshold
+
+An "outlier" is a hidden state value greater than a certain threshold, and these values are computed in fp16. While the values are usually normally distributed ([-3.5, 3.5]), this distribution can be very different for large models ([-60, 6] or [6, 60]). 8-bit quantization works well for values ~5, but beyond that, there is a significant performance penalty. A good default threshold value is 6, but a lower threshold may be needed for more unstable models (small models or finetuning).
+
+To find the best threshold for your model, we recommend experimenting with the `llm_int8_threshold` parameter in [`BitsAndBytesConfig`]:
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+model_id = "bigscience/bloom-1b7"
+
+quantization_config = BitsAndBytesConfig(
+ llm_int8_threshold=10,
+)
+
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ torch_dtype="auto",
+ device_map=device_map,
+ quantization_config=quantization_config,
+)
+```
+
+### Skip module conversion
+
+For some models, like [Jukebox](model_doc/jukebox), you don't need to quantize every module to 8-bit which can actually cause instability. With Jukebox, there are several `lm_head` modules that should be skipped using the `llm_int8_skip_modules` parameter in [`BitsAndBytesConfig`]:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model_id = "bigscience/bloom-1b7"
+
+quantization_config = BitsAndBytesConfig(
+ llm_int8_skip_modules=["lm_head"],
+)
+
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ torch_dtype="auto",
+ device_map="auto",
+ quantization_config=quantization_config,
+)
+```
+
+### Finetuning
+
+With the [PEFT](https://github.com/huggingface/peft) library, you can finetune large models like [flan-t5-large](https://huggingface.co/google/flan-t5-large) and [facebook/opt-6.7b](https://huggingface.co/facebook/opt-6.7b) with 8-bit quantization. You don't need to pass the `device_map` parameter for training because it'll automatically load your model on a GPU. However, you can still customize the device map with the `device_map` parameter if you want to (`device_map="auto"` should only be used for inference).
+
+## 4-bit (QLoRA algorithm)
+
+
+
+Try 4-bit quantization in this [notebook](https://colab.research.google.com/drive/1ge2F1QSK8Q7h0hn3YKuBCOAS0bK8E0wf) and learn more about it's details in this [blog post](https://huggingface.co/blog/4bit-transformers-bitsandbytes).
+
+
+
+This section explores some of the specific features of 4-bit models, such as changing the compute data type, using the Normal Float 4 (NF4) data type, and using nested quantization.
+
+
+### Compute data type
+
+To speedup computation, you can change the data type from float32 (the default value) to bf16 using the `bnb_4bit_compute_dtype` parameter in [`BitsAndBytesConfig`]:
+
+```py
+import torch
+from transformers import BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16)
+```
+
+### Normal Float 4 (NF4)
+
+NF4 is a 4-bit data type from the [QLoRA](https://hf.co/papers/2305.14314) paper, adapted for weights initialized from a normal distribution. You should use NF4 for training 4-bit base models. This can be configured with the `bnb_4bit_quant_type` parameter in the [`BitsAndBytesConfig`]:
+
+```py
+from transformers import BitsAndBytesConfig
+
+nf4_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_quant_type="nf4",
+)
+
+model_nf4 = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", quantization_config=nf4_config)
+```
+
+For inference, the `bnb_4bit_quant_type` does not have a huge impact on performance. However, to remain consistent with the model weights, you should use the `bnb_4bit_compute_dtype` and `torch_dtype` values.
+
+### Nested quantization
+
+Nested quantization is a technique that can save additional memory at no additional performance cost. This feature performs a second quantization of the already quantized weights to save an additional 0.4 bits/parameter. For example, with nested quantization, you can finetune a [Llama-13b](https://huggingface.co/meta-llama/Llama-2-13b) model on a 16GB NVIDIA T4 GPU with a sequence length of 1024, a batch size of 1, and enabling gradient accumulation with 4 steps.
+
+```py
+from transformers import BitsAndBytesConfig
+
+double_quant_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_use_double_quant=True,
+)
+
+model_double_quant = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-2-13b", torch_dtype="auto", quantization_config=double_quant_config)
+```
+
+## Dequantizing `bitsandbytes` models
+
+Once quantized, you can dequantize the model to the original precision but this might result in a small quality loss of the model. Make sure you have enough GPU RAM to fit the dequantized model.
+
+```python
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig, AutoTokenizer
+
+model_id = "facebook/opt-125m"
+
+model = AutoModelForCausalLM.from_pretrained(model_id, BitsAndBytesConfig(load_in_4bit=True))
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+
+model.dequantize()
+
+text = tokenizer("Hello my name is", return_tensors="pt").to(0)
+
+out = model.generate(**text)
+print(tokenizer.decode(out[0]))
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/compressed_tensors.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/compressed_tensors.md
new file mode 100644
index 0000000000000000000000000000000000000000..77b8986bf8ca4cb5e3362513657b812714fad12a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/compressed_tensors.md
@@ -0,0 +1,227 @@
+
+# Compressed Tensors
+
+The [`compressed-tensors`](https://github.com/neuralmagic/compressed-tensors) library provides a versatile and efficient way to store and manage compressed model checkpoints. This library supports various quantization and sparsity schemes, making it a unified format for handling different model optimizations like GPTQ, AWQ, SmoothQuant, INT8, FP8, SparseGPT, and more.
+
+Some of the supported formats include:
+1. `dense`
+2. `int-quantized` ([sample](https://huggingface.co/nm-testing/tinyllama-w8a8-compressed-hf-quantizer)): INT8 quantized models
+3. `float-quantized` ([sample](https://huggingface.co/nm-testing/Meta-Llama-3-8B-Instruct-fp8-hf_compat)): FP8 quantized models; currently support E4M3
+4. `pack-quantized` ([sample](https://huggingface.co/nm-testing/tinyllama-w4a16-compressed-hf-quantizer)): INT4 or INT8 weight-quantized models, packed into INT32. For INT4, the weights have an INT4 range but are stored as INT8 and then packed into INT32.
+
+Compressed models can be easily created using [llm-compressor](https://github.com/vllm-project/llm-compressor).
+Alternatively models can be created independently and serialized with a compressed tensors config.
+
+To find existing models on the Hugging Face Model Hub, search for the [`compressed-tensors` tag](https://huggingface.co/models?other=compressed-tensors).
+
+#### Features:
+ - Weight and activation precisions: FP8, INT4, INT8 (for Q/DQ arbitrary precision is allowed for INT)
+ - Quantization scales and zero-points strategies: [tensor, channel, group, block, token](https://github.com/neuralmagic/compressed-tensors/blob/83b2e7a969d70606421a76b9a3d112646077c8de/src/compressed_tensors/quantization/quant_args.py#L43-L52)
+ - Dynamic per-token activation quantization (or any static strategy)
+ - Sparsity in weights (unstructured or semi-structured like 2:4) can be composed with quantization for extreme compression
+ - Supports quantization of arbitrary modules, not just Linear modules
+ - Targeted support or ignoring of modules by name or class
+
+## Installation
+
+It is recommended to install stable releases of compressed-tensors from [PyPI](https://pypi.org/project/compressed-tensors):
+```bash
+pip install compressed-tensors
+```
+
+Developers who want to experiment with the latest features can also install the package from source:
+```bash
+git clone https://github.com/neuralmagic/compressed-tensors
+cd compressed-tensors
+pip install -e .
+```
+
+## Quickstart Model Load
+Quantized models can be easily loaded for inference as shown below. Only models that have already been quantized can be loaded at the moment. To quantize a model into the compressed-tensors format see [llm-compressor](https://github.com/vllm-project/llm-compressor).
+
+```python
+from transformers import AutoModelForCausalLM
+
+# Load the model in compressed-tensors format
+ct_model = AutoModelForCausalLM.from_pretrained("nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf")
+
+# Measure memory usage
+mem_params = sum([param.nelement()*param.element_size() for param in ct_model.parameters()])
+print(f"{mem/2**30:.4f} GB")
+# 8.4575 GB
+```
+
+We can see just above that the compressed-tensors FP8 checkpoint of Llama 3.1 8B is able to be loaded for inference using half of the memory of the unquantized reference checkpoint.
+
+## Sample Use Cases - Load and run an FP8 model
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+prompt = [
+ "Hello, my name is",
+ "The capital of France is",
+ "The future of AI is"
+]
+
+model_name = "nm-testing/Meta-Llama-3-8B-Instruct-fp8-hf_compat"
+
+quantized_model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+
+inputs = tokenizer(prompt, return_tensors="pt")
+generated_ids = quantized_model.generate(**inputs, max_length=50, do_sample=False)
+outputs = tokenizer.batch_decode(generated_ids)
+
+print(outputs)
+
+"""
+['<|begin_of_text|>Hello, my name is [Name]. I am a [Your Profession/Student] and I am here to learn about the [Course/Program] at [University/Institution]. I am excited to be here and I am looking forward to', '<|begin_of_text|>The capital of France is Paris, which is located in the north-central part of the country. Paris is the most populous city in France and is known for its stunning architecture, art museums, fashion, and romantic atmosphere. The city is home to', "<|begin_of_text|>The future of AI is here, and it's already changing the way we live and work. From virtual assistants to self-driving cars, AI is transforming industries and revolutionizing the way we interact with technology. But what does the future of AI hold"]
+"""
+
+```
+
+The above shows a quick example for running generation using a `compressed-tensors`
+model. Currently, once loaded the model cannot be saved.
+
+## Deep dive into a compressed-tensors model checkpoint
+
+In this example we will examine how the compressed-tensors model nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf is defined through its configuration entry and see how this translates to the loaded model representation.
+
+First, let us look at the [`quantization_config` of the model](https://huggingface.co/nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf/blob/main/config.json). At a glance it looks overwhelming with the number of entries but this is because compressed-tensors is a format that allows for flexible expression both during and after model compression.
+
+In practice for checkpoint loading and inference the configuration can be simplified to not include all the default or empty entries, so we will do that here to focus on what compression is actually represented.
+
+```yaml
+"quantization_config": {
+ "config_groups": {
+ "group_0": {
+ "input_activations": {
+ "num_bits": 8,
+ "strategy": "tensor",
+ "type": "float"
+ },
+ "targets": ["Linear"],
+ "weights": {
+ "num_bits": 8,
+ "strategy": "tensor",
+ "type": "float"
+ }
+ }
+ },
+ "format": "naive-quantized",
+ "ignore": ["lm_head"],
+ "quant_method": "compressed-tensors",
+ "quantization_status": "frozen"
+},
+```
+
+We can see from the above configuration that it is specifying one config group that includes weight and activation quantization to FP8 with a static per-tensor strategy. It is also worth noting that in the `ignore` list there is an entry to skip quantization of the `lm_head` module, so that module should be untouched in the checkpoint.
+
+To see the result of the configuration in practice, we can simply use the [safetensors viewer](https://huggingface.co/nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf?show_file_info=model.safetensors.index.json) on the model card to see the quantized weights, input_scale, and weight_scale for all of the Linear modules in the first model layer (and so on for the rest of the layers).
+
+| Tensors | Shape | Precision |
+| ------- | ----- | --------- |
+model.layers.0.input_layernorm.weight | [4โฏ096] | BF16
+model.layers.0.mlp.down_proj.input_scale | [1] | BF16
+model.layers.0.mlp.down_proj.weight | [4โฏ096, 14โฏ336] | F8_E4M3
+model.layers.0.mlp.down_proj.weight_scale | [1] | BF16
+model.layers.0.mlp.gate_proj.input_scale | [1] | BF16
+model.layers.0.mlp.gate_proj.weight | [14โฏ336, 4โฏ096] | F8_E4M3
+model.layers.0.mlp.gate_proj.weight_scale | [1] | BF16
+model.layers.0.mlp.up_proj.input_scale| [1] |BF16
+model.layers.0.mlp.up_proj.weight | [14โฏ336, 4โฏ096] | F8_E4M3
+model.layers.0.mlp.up_proj.weight_scale | [1] | BF16
+model.layers.0.post_attention_layernorm.weight | [4โฏ096] |BF16
+model.layers.0.self_attn.k_proj.input_scale | [1] | BF16
+model.layers.0.self_attn.k_proj.weight | [1โฏ024, 4โฏ096]| F8_E4M3
+model.layers.0.self_attn.k_proj.weight_scale |[1] | BF16
+model.layers.0.self_attn.o_proj.input_scale | [1] | BF16
+model.layers.0.self_attn.o_proj.weight | [4โฏ096, 4โฏ096] | F8_E4M3
+model.layers.0.self_attn.o_proj.weight_scale | [1] | BF16
+model.layers.0.self_attn.q_proj.input_scale | [1] | BF16
+model.layers.0.self_attn.q_proj.weight | [4โฏ096, 4โฏ096] | F8_E4M3
+model.layers.0.self_attn.q_proj.weight_scale | [1] | BF16
+model.layers.0.self_attn.v_proj.input_scale | [1] | BF16
+model.layers.0.self_attn.v_proj.weight | [1โฏ024, 4โฏ096] | F8_E4M3
+model.layers.0.self_attn.v_proj.weight_scale | [1] | BF16
+
+When we load the model with the compressed-tensors HFQuantizer integration, we can see that all of the Linear modules that are specified within the quantization configuration have been replaced by `CompressedLinear` modules that manage the compressed weights and forward pass for inference. Note that the `lm_head` mentioned before in the ignore list is still kept as an unquantized Linear module.
+
+```python
+from transformers import AutoModelForCausalLM
+
+ct_model = AutoModelForCausalLM.from_pretrained("nm-testing/Meta-Llama-3.1-8B-Instruct-FP8-hf")
+print(ct_model)
+"""
+LlamaForCausalLM(
+ (model): LlamaModel(
+ (embed_tokens): Embedding(128256, 4096)
+ (layers): ModuleList(
+ (0-31): 32 x LlamaDecoderLayer(
+ (self_attn): LlamaSdpaAttention(
+ (q_proj): CompressedLinear(
+ in_features=4096, out_features=4096, bias=False
+ (input_observer): MovingAverageMinMaxObserver()
+ (weight_observer): MovingAverageMinMaxObserver()
+ )
+ (k_proj): CompressedLinear(
+ in_features=4096, out_features=1024, bias=False
+ (input_observer): MovingAverageMinMaxObserver()
+ (weight_observer): MovingAverageMinMaxObserver()
+ )
+ (v_proj): CompressedLinear(
+ in_features=4096, out_features=1024, bias=False
+ (input_observer): MovingAverageMinMaxObserver()
+ (weight_observer): MovingAverageMinMaxObserver()
+ )
+ (o_proj): CompressedLinear(
+ in_features=4096, out_features=4096, bias=False
+ (input_observer): MovingAverageMinMaxObserver()
+ (weight_observer): MovingAverageMinMaxObserver()
+ )
+ (rotary_emb): LlamaRotaryEmbedding()
+ )
+ (mlp): LlamaMLP(
+ (gate_proj): CompressedLinear(
+ in_features=4096, out_features=14336, bias=False
+ (input_observer): MovingAverageMinMaxObserver()
+ (weight_observer): MovingAverageMinMaxObserver()
+ )
+ (up_proj): CompressedLinear(
+ in_features=4096, out_features=14336, bias=False
+ (input_observer): MovingAverageMinMaxObserver()
+ (weight_observer): MovingAverageMinMaxObserver()
+ )
+ (down_proj): CompressedLinear(
+ in_features=14336, out_features=4096, bias=False
+ (input_observer): MovingAverageMinMaxObserver()
+ (weight_observer): MovingAverageMinMaxObserver()
+ )
+ (act_fn): SiLU()
+ )
+ (input_layernorm): LlamaRMSNorm((4096,), eps=1e-05)
+ (post_attention_layernorm): LlamaRMSNorm((4096,), eps=1e-05)
+ )
+ )
+ (norm): LlamaRMSNorm((4096,), eps=1e-05)
+ (rotary_emb): LlamaRotaryEmbedding()
+ )
+ (lm_head): Linear(in_features=4096, out_features=128256, bias=False)
+)
+"""
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/contribute.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/contribute.md
new file mode 100644
index 0000000000000000000000000000000000000000..fb7ef6992223fe0437f8d434395c97d016498ba5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/contribute.md
@@ -0,0 +1,69 @@
+
+
+# Contribute new quantization method
+
+Transformers supports and integrates many quantization methods such as QLoRA, GPTQ, LLM.int8, and AWQ. However, there are other quantization approaches that are not yet integrated. To make adding and using these quantization methods with Transformers models easier, you should use the [`HfQuantizer`] class. The [`HfQuantizer`] is designed as an internal helper class for adding a quantization method instead of something you apply to every PyTorch module.
+
+This guide will show you how to integrate a new quantization method with the [`HfQuantizer`] class.
+
+## Requirements
+
+Before integrating a new quantization method into Transformers, ensure the method you are trying to add meets the following prerequisites. Only quantization methods that can be run with PyTorch modules are currently supported.
+
+- The quantization method is available through a Python package that is pip-installable by anyone (it is also fine if you can only install the package from source). Ideally, pre-compiled kernels are included in the pip package.
+- The method can run on commonly-used hardware (CPU, GPU, ...).
+- The method is wrapped in a `nn.Module` (e.g., `Linear8bitLt`, `Linear4bit`), and the quantized linear layer should have the following definition:
+
+```py
+class Linear4bit(nn.Module):
+ def __init__(self, ...):
+ ...
+
+ def forward(self, x):
+ return my_4bit_kernel(x, self.weight, self.bias)
+```
+
+This way, Transformers models can be easily quantized by replacing some instances of `nn.Linear` with a target class.
+
+- The quantization method should be serializable. You can save the quantized weights locally or push them to the Hub.
+- Make sure the package that contains the quantization kernels/primitive is stable (no frequent breaking changes).
+
+For some quantization methods, they may require "pre-quantizing" the models through data calibration (e.g., AWQ). In this case, we prefer to only support inference in Transformers and let the third-party library maintained by the ML community deal with the model quantization itself.
+
+## Build a new HFQuantizer class
+
+1. Create a new quantization config class inside [src/transformers/utils/quantization_config.py](https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/utils/quantization_config.py) and make sure to expose the new quantization config inside Transformers main `init` by adding it to the [`_import_structure`](https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/__init__.py#L1088) object of [src/transformers/__init__.py](https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/__init__.py).
+
+2. Create a new file inside [src/transformers/quantizers/](https://github.com/huggingface/transformers/tree/abbffc4525566a48a9733639797c812301218b83/src/transformers/quantizers) named `quantizer_your_method.py`, and make it inherit from [src/transformers/quantizers/base.py::HfQuantizer](https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/quantizers/base.py#L28). Make sure to add the new quantizer and quantization config in the quantization auto-mapping in [src/transformers/quantizers/auto.py](https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/quantizers/auto.py).
+
+3. Define the following class attributes/property methods for your quantization method:
+
+* `requires_calibration`: Whether the quantization method requires a data calibration process. If set to `True`, you can only support inference (with quantized weights) and not inference and quantization.
+* `required_packages`: A list of strings of the required packages to use the quantized weights. You might need to define some new utility methods such as `is_auto_awq_available` in [transformers/src/utils/import_utils.py](https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/utils/import_utils.py).
+* `requires_parameters_quantization`: Only required if your quantization method requires extra attention to the underlying `nn.Parameter` object. For example, bitsandbytes uses `Params4bit` and `Int8Param`, which requires some extra attention when quantizing the model. Most of the recent quantization method packs int2/int4 weights inside `torch.uint8` weights, so this flag should not be really required (set to `False` by default).
+* `is_serializable`: A property method to determine whether the method is serializable or not.
+* `is_trainable`: A property method to determine whether you can fine-tune models on top of the quantization method (with or without PEFT approaches).
+
+4. Write the `validate_environment` and `update_torch_dtype` methods. These methods are called before creating the quantized model to ensure users use the right configuration. You can have a look at how this is done on other quantizers.
+
+5. Write the `_process_model_before_weight_loading` method. In Transformers, the quantized models are initialized first on the `"meta"` device before loading the weights. This means the `_process_model_before_weight_loading` method takes care of manipulating the model skeleton to replace some modules (e.g., `nn.Linear`) with the target modules (quantization modules). You can define a module replacement logic or any other utility method by creating a new file in [transformers/src/integrations/](https://github.com/huggingface/transformers/tree/abbffc4525566a48a9733639797c812301218b83/src/transformers/integrations) and exposing the relevant methods in that folder's `__init__.py` file. The best starting point would be to have a look at another quantization methods such as [quantizer_awq.py](https://github.com/huggingface/transformers/blob/abbffc4525566a48a9733639797c812301218b83/src/transformers/quantizers/quantizer_awq.py).
+
+6. Write the `_process_model_after_weight_loading` method. This method enables implementing additional features that require manipulating the model after loading the weights.
+
+7. Document everything! Make sure your quantization method is documented by adding a new file under `docs/source/en/quantization` and adding a new row in the table in `docs/source/en/quantization/overview.md`.
+
+8. Add tests! You should add tests by first adding the package in our nightly Dockerfile inside `docker/transformers-quantization-latest-gpu` and then adding a new test file in `tests/quantization/xxx`. Feel free to check out how it is implemented for other quantization methods.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/eetq.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/eetq.md
new file mode 100644
index 0000000000000000000000000000000000000000..bf2c4e0e6466f2f16024b5f5ac65649a8fd72ce6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/eetq.md
@@ -0,0 +1,47 @@
+
+
+# EETQ
+
+The [EETQ](https://github.com/NetEase-FuXi/EETQ) library supports int8 per-channel weight-only quantization for NVIDIA GPUS. The high-performance GEMM and GEMV kernels are from FasterTransformer and TensorRT-LLM. It requires no calibration dataset and does not need to pre-quantize your model. Moreover, the accuracy degradation is negligible owing to the per-channel quantization.
+
+Make sure you have eetq installed from the [release page](https://github.com/NetEase-FuXi/EETQ/releases)
+```
+pip install --no-cache-dir https://github.com/NetEase-FuXi/EETQ/releases/download/v1.0.0/EETQ-1.0.0+cu121+torch2.1.2-cp310-cp310-linux_x86_64.whl
+```
+or via the source code https://github.com/NetEase-FuXi/EETQ. EETQ requires CUDA capability <= 8.9 and >= 7.0
+```
+git clone https://github.com/NetEase-FuXi/EETQ.git
+cd EETQ/
+git submodule update --init --recursive
+pip install .
+```
+
+An unquantized model can be quantized via "from_pretrained".
+```py
+from transformers import AutoModelForCausalLM, EetqConfig
+path = "/path/to/model"
+quantization_config = EetqConfig("int8")
+model = AutoModelForCausalLM.from_pretrained(path, device_map="auto", quantization_config=quantization_config)
+```
+
+A quantized model can be saved via "saved_pretrained" and be reused again via the "from_pretrained".
+
+```py
+quant_path = "/path/to/save/quantized/model"
+model.save_pretrained(quant_path)
+model = AutoModelForCausalLM.from_pretrained(quant_path, device_map="auto")
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/fbgemm_fp8.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/fbgemm_fp8.md
new file mode 100644
index 0000000000000000000000000000000000000000..61cf8a059bf2776ecebc0fa4c8f2572f22439c6e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/fbgemm_fp8.md
@@ -0,0 +1,59 @@
+
+
+# FBGEMM FP8
+
+With FBGEMM FP8 quantization method, you can quantize your model in FP8 (W8A8):
+- the weights will be quantized in 8bit (FP8) per channel
+- the activation will be quantized in 8bit (FP8) per token
+
+It relies on the [FBGEMM](https://github.com/pytorch/FBGEMM) library which provides efficient low-precision general matrix multiplication for small batch sizes and support for accuracy-loss minimizing techniques such as row-wise quantization and outlier-aware quantization.
+
+> [!TIP]
+> You need a GPU with compute capability>=9 (e.g. H100)
+
+Before you begin, make sure the following libraries are installed with their latest version:
+
+```bash
+pip install --upgrade accelerate fbgemm-gpu torch
+```
+
+If you are having issues with fbgemm-gpu and torch library, you might need to install the nightly release. You can follow the instruction [here](https://pytorch.org/FBGEMM/fbgemm_gpu-development/InstallationInstructions.html#fbgemm-gpu-install-libraries:~:text=found%20here.-,Install%20the%20FBGEMM_GPU%20Package,-Install%20through%20PyTorch)
+
+By default, the weights are loaded in full precision (torch.float32) regardless of the actual data type the weights are stored in such as torch.float16. Set `torch_dtype="auto"` to load the weights in the data type defined in a model's `config.json` file to automatically load the most memory-optimal data type.
+
+```py
+from transformers import FbgemmFp8Config, AutoModelForCausalLM, AutoTokenizer
+
+model_name = "meta-llama/Meta-Llama-3-8B"
+quantization_config = FbgemmFp8Config()
+quantized_model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto", quantization_config=quantization_config)
+
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+input_text = "What are we having for dinner?"
+input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+output = quantized_model.generate(**input_ids, max_new_tokens=10)
+print(tokenizer.decode(output[0], skip_special_tokens=True))
+```
+
+A quantized model can be saved via "saved_pretrained" and be reused again via the "from_pretrained".
+
+```py
+quant_path = "/path/to/save/quantized/model"
+model.save_pretrained(quant_path)
+model = AutoModelForCausalLM.from_pretrained(quant_path, device_map="auto")
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/gptq.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/gptq.md
new file mode 100644
index 0000000000000000000000000000000000000000..5713ef4132a9a81fc16915f3a9b44dab6e81fcd6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/gptq.md
@@ -0,0 +1,120 @@
+
+
+# GPTQ
+
+
+
+Try GPTQ quantization with PEFT in this [notebook](https://colab.research.google.com/drive/1_TIrmuKOFhuRRiTWN94iLKUFu6ZX4ceb?usp=sharing) and learn more about it's details in this [blog post](https://huggingface.co/blog/gptq-integration)!
+
+
+
+The [AutoGPTQ](https://github.com/PanQiWei/AutoGPTQ) library implements the GPTQ algorithm, a post-training quantization technique where each row of the weight matrix is quantized independently to find a version of the weights that minimizes the error. These weights are quantized to int4, but they're restored to fp16 on the fly during inference. This can save your memory-usage by 4x because the int4 weights are dequantized in a fused kernel rather than a GPU's global memory, and you can also expect a speedup in inference because using a lower bitwidth takes less time to communicate.
+
+Before you begin, make sure the following libraries are installed:
+
+```bash
+pip install auto-gptq
+pip install --upgrade accelerate optimum transformers
+```
+
+To quantize a model (currently only supported for text models), you need to create a [`GPTQConfig`] class and set the number of bits to quantize to, a dataset to calibrate the weights for quantization, and a tokenizer to prepare the dataset.
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, GPTQConfig
+
+model_id = "facebook/opt-125m"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+gptq_config = GPTQConfig(bits=4, dataset="c4", tokenizer=tokenizer)
+```
+
+You could also pass your own dataset as a list of strings, but it is highly recommended to use the same dataset from the GPTQ paper.
+
+```py
+dataset = ["auto-gptq is an easy-to-use model quantization library with user-friendly apis, based on GPTQ algorithm."]
+gptq_config = GPTQConfig(bits=4, dataset=dataset, tokenizer=tokenizer)
+```
+
+Load a model to quantize and pass the `gptq_config` to the [`~AutoModelForCausalLM.from_pretrained`] method. Set `device_map="auto"` to automatically offload the model to a CPU to help fit the model in memory, and allow the model modules to be moved between the CPU and GPU for quantization.
+
+```py
+quantized_model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", quantization_config=gptq_config)
+```
+
+If you're running out of memory because a dataset is too large, disk offloading is not supported. If this is the case, try passing the `max_memory` parameter to allocate the amount of memory to use on your device (GPU and CPU):
+
+```py
+quantized_model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", max_memory={0: "30GiB", 1: "46GiB", "cpu": "30GiB"}, quantization_config=gptq_config)
+```
+
+
+
+Depending on your hardware, it can take some time to quantize a model from scratch. It can take ~5 minutes to quantize the [facebook/opt-350m](https://huggingface.co/facebook/opt-350m) model on a free-tier Google Colab GPU, but it'll take ~4 hours to quantize a 175B parameter model on a NVIDIA A100. Before you quantize a model, it is a good idea to check the Hub if a GPTQ-quantized version of the model already exists.
+
+
+
+Once your model is quantized, you can push the model and tokenizer to the Hub where it can be easily shared and accessed. Use the [`~PreTrainedModel.push_to_hub`] method to save the [`GPTQConfig`]:
+
+```py
+quantized_model.push_to_hub("opt-125m-gptq")
+tokenizer.push_to_hub("opt-125m-gptq")
+```
+
+You could also save your quantized model locally with the [`~PreTrainedModel.save_pretrained`] method. If the model was quantized with the `device_map` parameter, make sure to move the entire model to a GPU or CPU before saving it. For example, to save the model on a CPU:
+
+```py
+quantized_model.save_pretrained("opt-125m-gptq")
+tokenizer.save_pretrained("opt-125m-gptq")
+
+# if quantized with device_map set
+quantized_model.to("cpu")
+quantized_model.save_pretrained("opt-125m-gptq")
+```
+
+Reload a quantized model with the [`~PreTrainedModel.from_pretrained`] method, and set `device_map="auto"` to automatically distribute the model on all available GPUs to load the model faster without using more memory than needed.
+
+```py
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained("{your_username}/opt-125m-gptq", device_map="auto")
+```
+
+## ExLlama
+
+[ExLlama](https://github.com/turboderp/exllama) is a Python/C++/CUDA implementation of the [Llama](model_doc/llama) model that is designed for faster inference with 4-bit GPTQ weights (check out these [benchmarks](https://github.com/huggingface/optimum/tree/main/tests/benchmark#gptq-benchmark)). The ExLlama kernel is activated by default when you create a [`GPTQConfig`] object. To boost inference speed even further, use the [ExLlamaV2](https://github.com/turboderp/exllamav2) kernels by configuring the `exllama_config` parameter:
+
+```py
+import torch
+from transformers import AutoModelForCausalLM, GPTQConfig
+
+gptq_config = GPTQConfig(bits=4, exllama_config={"version":2})
+model = AutoModelForCausalLM.from_pretrained("{your_username}/opt-125m-gptq", device_map="auto", quantization_config=gptq_config)
+```
+
+
+
+Only 4-bit models are supported, and we recommend deactivating the ExLlama kernels if you're finetuning a quantized model with PEFT.
+
+
+
+The ExLlama kernels are only supported when the entire model is on the GPU. If you're doing inference on a CPU with AutoGPTQ (version > 0.4.2), then you'll need to disable the ExLlama kernel. This overwrites the attributes related to the ExLlama kernels in the quantization config of the config.json file.
+
+```py
+import torch
+from transformers import AutoModelForCausalLM, GPTQConfig
+gptq_config = GPTQConfig(bits=4, use_exllama=False)
+model = AutoModelForCausalLM.from_pretrained("{your_username}/opt-125m-gptq", device_map="cpu", quantization_config=gptq_config)
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/higgs.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/higgs.md
new file mode 100644
index 0000000000000000000000000000000000000000..d2aa9c9dc497d562fa6b74d044e34044cc5a02b1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/higgs.md
@@ -0,0 +1,66 @@
+
+
+# HIGGS
+
+HIGGS is a 0-shot quantization algorithm that combines Hadamard preprocessing with MSE-Optimal quantization grids to achieve lower quantization error and SOTA performance. You can find more information in the paper [arxiv.org/abs/2411.17525](https://arxiv.org/abs/2411.17525).
+
+Runtime support for HIGGS is implemented through [FLUTE](https://arxiv.org/abs/2407.10960), and its [library](https://github.com/HanGuo97/flute).
+
+## Quantization Example
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer, HiggsConfig
+
+model = AutoModelForCausalLM.from_pretrained(
+ "google/gemma-2-9b-it",
+ quantization_config=HiggsConfig(bits=4),
+ device_map="auto",
+)
+
+tokenizer = AutoTokenizer.from_pretrained("google/gemma-2-9b-it")
+
+tokenizer.decode(model.generate(
+ **tokenizer("Hi,", return_tensors="pt").to(model.device),
+ temperature=0.5,
+ top_p=0.80,
+)[0])
+```
+
+## Pre-quantized models
+
+Some pre-quantized models can be found in the [official collection](https://huggingface.co/collections/ISTA-DASLab/higgs-675308e432fd56b7f6dab94e) on Hugging Face Hub.
+
+## Current Limitations
+
+**Architectures**
+
+Currently, FLUTE, and HIGGS by extension, **only support Llama 3 and 3.0 of 8B, 70B and 405B parameters, as well as Gemma-2 9B and 27B**. We're working on allowing to run more diverse models as well as allow arbitrary models by modifying the FLUTE compilation procedure.
+
+**torch.compile**
+
+HIGGS is fully compatible with `torch.compile`. Compiling `model.forward`, as described [here](../perf_torch_compile.md), here're the speedups it provides on RTX 4090 for `Llama-3.1-8B-Instruct` (forward passes/sec):
+
+| Batch Size | BF16 (With `torch.compile`) | HIGGS 4bit (No `torch.compile`) | HIGGS 4bit (With `torch.compile`) |
+|------------|-----------------------------|----------------------------------|-----------------------------------|
+| 1 | 59 | 41 | 124 |
+| 4 | 57 | 42 | 123 |
+| 16 | 56 | 41 | 120 |
+
+
+**Quantized training**
+
+Currently, HIGGS doesn't support quantized training (and backward passes in general). We're working on adding support for it.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/hqq.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/hqq.md
new file mode 100644
index 0000000000000000000000000000000000000000..34608cd64fd8a34eb261dc9ed0a3ab6f6200291a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/hqq.md
@@ -0,0 +1,69 @@
+
+
+
+# HQQ
+
+Half-Quadratic Quantization (HQQ) implements on-the-fly quantization via fast robust optimization. It doesn't require calibration data and can be used to quantize any model.
+Please refer to the official package for more details.
+
+For installation, we recommend you use the following approach to get the latest version and build its corresponding CUDA kernels:
+```
+pip install hqq
+```
+
+To quantize a model, you need to create an [`HqqConfig`]. There are two ways of doing it:
+``` Python
+from transformers import AutoModelForCausalLM, AutoTokenizer, HqqConfig
+
+# Method 1: all linear layers will use the same quantization config
+quant_config = HqqConfig(nbits=8, group_size=64)
+```
+
+``` Python
+# Method 2: each linear layer with the same tag will use a dedicated quantization config
+q4_config = {'nbits':4, 'group_size':64}
+q3_config = {'nbits':3, 'group_size':32}
+quant_config = HqqConfig(dynamic_config={
+ 'self_attn.q_proj':q4_config,
+ 'self_attn.k_proj':q4_config,
+ 'self_attn.v_proj':q4_config,
+ 'self_attn.o_proj':q4_config,
+
+ 'mlp.gate_proj':q3_config,
+ 'mlp.up_proj' :q3_config,
+ 'mlp.down_proj':q3_config,
+})
+```
+
+The second approach is especially interesting for quantizing Mixture-of-Experts (MoEs) because the experts are less affected by lower quantization settings.
+
+
+Then you simply quantize the model as follows
+``` Python
+model = transformers.AutoModelForCausalLM.from_pretrained(
+ model_id,
+ torch_dtype=torch.float16,
+ device_map="cuda",
+ quantization_config=quant_config
+)
+```
+
+## Optimized Runtime
+
+HQQ supports various backends, including pure PyTorch and custom dequantization CUDA kernels. These backends are suitable for older gpus and peft/QLoRA training.
+For faster inference, HQQ supports 4-bit fused kernels (TorchAO and Marlin), reaching up to 200 tokens/sec on a single 4090.
+For more details on how to use the backends, please refer to https://github.com/mobiusml/hqq/?tab=readme-ov-file#backend
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/optimum.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/optimum.md
new file mode 100644
index 0000000000000000000000000000000000000000..d90b4c818e43592b5581a98cbe6039540e198a34
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/optimum.md
@@ -0,0 +1,19 @@
+
+
+# Optimum
+
+The [Optimum](https://huggingface.co/docs/optimum/index) library supports quantization for Intel, Furiosa, ONNX Runtime, GPTQ, and lower-level PyTorch quantization functions. Consider using Optimum for quantization if you're using specific and optimized hardware like Intel CPUs, Furiosa NPUs or a model accelerator like ONNX Runtime.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/overview.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/overview.md
new file mode 100644
index 0000000000000000000000000000000000000000..48840fad646fd0ed86cb618bc34d39ba0c120800
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/overview.md
@@ -0,0 +1,76 @@
+
+
+# Quantization
+
+Quantization techniques focus on representing data with less information while also trying to not lose too much accuracy. This often means converting a data type to represent the same information with fewer bits. For example, if your model weights are stored as 32-bit floating points and they're quantized to 16-bit floating points, this halves the model size which makes it easier to store and reduces memory-usage. Lower precision can also speedup inference because it takes less time to perform calculations with fewer bits.
+
+
+
+Interested in adding a new quantization method to Transformers? Read the [HfQuantizer](./contribute) guide to learn how!
+
+
+
+
+
+If you are new to the quantization field, we recommend you to check out these beginner-friendly courses about quantization in collaboration with DeepLearning.AI:
+
+* [Quantization Fundamentals with Hugging Face](https://www.deeplearning.ai/short-courses/quantization-fundamentals-with-hugging-face/)
+* [Quantization in Depth](https://www.deeplearning.ai/short-courses/quantization-in-depth/)
+
+
+
+## When to use what?
+
+The community has developed many quantization methods for various use cases. With Transformers, you can run any of these integrated methods depending on your use case because each method has their own pros and cons.
+
+For example, some quantization methods require calibrating the model with a dataset for more accurate and "extreme" compression (up to 1-2 bits quantization), while other methods work out of the box with on-the-fly quantization.
+
+Another parameter to consider is compatibility with your target device. Do you want to quantize on a CPU, GPU, or Apple silicon?
+
+In short, supporting a wide range of quantization methods allows you to pick the best quantization method for your specific use case.
+
+Use the table below to help you decide which quantization method to use.
+
+| Quantization method | On the fly quantization | CPU | CUDA GPU | RoCm GPU (AMD) | Metal (Apple Silicon) | Intel GPU | torch.compile() support | Number of bits | Supports fine-tuning (through PEFT) | Serializable with ๐ค transformers | ๐ค transformers support | Link to library |
+|-------------------------------------|-------------------------|-----|----------|----------------|-----------------------|-----------|-------------------------|----------------|-------------------------------------|--------------|------------------------|---------------------------------------------|
+| [AQLM](./aqlm) | ๐ด | ๐ข | ๐ข | ๐ด | ๐ด | ๐ด | ๐ข | 1 / 2 | ๐ข | ๐ข | ๐ข | https://github.com/Vahe1994/AQLM |
+| [AWQ](./awq) | ๐ด | ๐ข | ๐ข | ๐ข | ๐ด | ๐ข | ? | 4 | ๐ข | ๐ข | ๐ข | https://github.com/casper-hansen/AutoAWQ |
+| [bitsandbytes](./bitsandbytes) | ๐ข | ๐ก * | ๐ข | ๐ก * | ๐ด ** | ๐ก * | ๐ด (soon!) | 4 / 8 | ๐ข | ๐ข | ๐ข | https://github.com/bitsandbytes-foundation/bitsandbytes |
+| [compressed-tensors](./compressed_tensors) | ๐ด | ๐ข | ๐ข | ๐ข | ๐ด | ๐ด | ๐ด | 1 - 8 | ๐ข | ๐ข | ๐ข | https://github.com/neuralmagic/compressed-tensors |
+| [EETQ](./eetq) | ๐ข | ๐ด | ๐ข | ๐ด | ๐ด | ๐ด | ? | 8 | ๐ข | ๐ข | ๐ข | https://github.com/NetEase-FuXi/EETQ |
+| GGUF / GGML (llama.cpp) | ๐ข | ๐ข | ๐ข | ๐ด | ๐ข | ๐ด | ๐ด | 1 - 8 | ๐ด | [See GGUF section](../gguf) | [See GGUF section](../gguf) | https://github.com/ggerganov/llama.cpp |
+| [GPTQ](./gptq) | ๐ด | ๐ด | ๐ข | ๐ข | ๐ด | ๐ด | ๐ด | 2 - 3 - 4 - 8 | ๐ข | ๐ข | ๐ข | https://github.com/AutoGPTQ/AutoGPTQ |
+| [HIGGS](./higgs) | ๐ข | ๐ด | ๐ข | ๐ด | ๐ด | ๐ด | ๐ข | 2 - 4 | ๐ด | ๐ข | ๐ข | https://github.com/HanGuo97/flute |
+| [HQQ](./hqq) | ๐ข | ๐ข | ๐ข | ๐ด | ๐ด | ๐ด | ๐ข | 1 - 8 | ๐ข | ๐ด | ๐ข | https://github.com/mobiusml/hqq/ |
+| [optimum-quanto](./quanto) | ๐ข | ๐ข | ๐ข | ๐ด | ๐ข | ๐ด | ๐ข | 2 / 4 / 8 | ๐ด | ๐ด | ๐ข | https://github.com/huggingface/optimum-quanto |
+| [FBGEMM_FP8](./fbgemm_fp8.md) | ๐ข | ๐ด | ๐ข | ๐ด | ๐ด | ๐ด | ๐ด | 8 | ๐ด | ๐ข | ๐ข | https://github.com/pytorch/FBGEMM |
+| [torchao](./torchao.md) | ๐ข | | ๐ข | ๐ด | partial support (int4 weight only) | ๐ด | | 4 / 8 | | ๐ข๐ด | ๐ข | https://github.com/pytorch/ao |
+| [VPTQ](./vptq) | ๐ด | ๐ด | ๐ข | ๐ก | ๐ด | ๐ด | ๐ข | 1 - 8 | ๐ด | ๐ข | ๐ข | https://github.com/microsoft/VPTQ |
+
+
+
+\* bitsandbytes is being refactored to support multiple backends beyond CUDA. Currently, ROCm (AMD GPU) and Intel CPU implementations are mature, with Intel XPU in progress and Apple Silicon support expected by Q4/Q1. For installation instructions and the latest backend updates, visit [this link](https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend).
+
+We value your feedback to help identify bugs before the full release! Check out [these docs](https://huggingface.co/docs/bitsandbytes/main/en/non_cuda_backends) for more details and feedback links.
+
+
+
+
+
+\** bitsandbytes is seeking contributors to help develop and lead the Apple Silicon backend. Interested? Contact them directly via their repo. Stipends may be available through sponsorships.
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/quanto.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/quanto.md
new file mode 100644
index 0000000000000000000000000000000000000000..7feadefd83d2aa94d8b68e1bd29d2d7702386975
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/quanto.md
@@ -0,0 +1,68 @@
+
+
+# Optimum-quanto
+
+
+
+Try optimum-quanto + transformers with this [notebook](https://colab.research.google.com/drive/16CXfVmtdQvciSh9BopZUDYcmXCDpvgrT?usp=sharing)!
+
+
+
+
+[๐ค optimum-quanto](https://github.com/huggingface/optimum-quanto) library is a versatile pytorch quantization toolkit. The quantization method used is the linear quantization. Quanto provides several unique features such as:
+
+- weights quantization (`float8`,`int8`,`int4`,`int2`)
+- activation quantization (`float8`,`int8`)
+- modality agnostic (e.g CV,LLM)
+- device agnostic (e.g CUDA,XPU,MPS,CPU)
+- compatibility with `torch.compile`
+- easy to add custom kernel for specific device
+- supports quantization aware training
+
+
+Before you begin, make sure the following libraries are installed:
+
+```bash
+pip install optimum-quanto accelerate transformers
+```
+
+Now you can quantize a model by passing [`QuantoConfig`] object in the [`~PreTrainedModel.from_pretrained`] method. This works for any model in any modality, as long as it contains `torch.nn.Linear` layers.
+
+The integration with transformers only supports weights quantization. For the more complex use case such as activation quantization, calibration and quantization aware training, you should use [optimum-quanto](https://github.com/huggingface/optimum-quanto) library instead.
+
+By default, the weights are loaded in full precision (torch.float32) regardless of the actual data type the weights are stored in such as torch.float16. Set `torch_dtype="auto"` to load the weights in the data type defined in a model's `config.json` file to automatically load the most memory-optimal data type.
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, QuantoConfig
+
+model_id = "facebook/opt-125m"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+quantization_config = QuantoConfig(weights="int8")
+quantized_model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="cuda:0", quantization_config=quantization_config)
+```
+
+Note that serialization is not supported yet with transformers but it is coming soon! If you want to save the model, you can use quanto library instead.
+
+Optimum-quanto library uses linear quantization algorithm for quantization. Even though this is a basic quantization technique, we get very good results! Have a look at the following benchmark (llama-2-7b on perplexity metric). You can find more benchmarks [here](https://github.com/huggingface/optimum-quanto/tree/main/bench/generation)
+
+
+
+
+
+
+
+The library is versatile enough to be compatible with most PTQ optimization algorithms. The plan in the future is to integrate the most popular algorithms in the most seamless possible way (AWQ, Smoothquant).
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/torchao.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/torchao.md
new file mode 100644
index 0000000000000000000000000000000000000000..38f7c074c97d904146705b27b8a7a8a9ab39282a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/torchao.md
@@ -0,0 +1,92 @@
+
+
+# TorchAO
+
+[TorchAO](https://github.com/pytorch/ao) is an architecture optimization library for PyTorch, it provides high performance dtypes, optimization techniques and kernels for inference and training, featuring composability with native PyTorch features like `torch.compile`, FSDP etc.. Some benchmark numbers can be found [here](https://github.com/pytorch/ao/tree/main/torchao/quantization#benchmarks).
+
+Before you begin, make sure the following libraries are installed with their latest version:
+
+```bash
+pip install --upgrade torch torchao
+```
+
+By default, the weights are loaded in full precision (torch.float32) regardless of the actual data type the weights are stored in such as torch.float16. Set `torch_dtype="auto"` to load the weights in the data type defined in a model's `config.json` file to automatically load the most memory-optimal data type.
+
+```py
+import torch
+from transformers import TorchAoConfig, AutoModelForCausalLM, AutoTokenizer
+
+model_name = "meta-llama/Meta-Llama-3-8B"
+# We support int4_weight_only, int8_weight_only and int8_dynamic_activation_int8_weight
+# More examples and documentations for arguments can be found in https://github.com/pytorch/ao/tree/main/torchao/quantization#other-available-quantization-techniques
+quantization_config = TorchAoConfig("int4_weight_only", group_size=128)
+quantized_model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto", quantization_config=quantization_config)
+
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+input_text = "What are we having for dinner?"
+input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+# compile the quantized model to get speedup
+import torchao
+torchao.quantization.utils.recommended_inductor_config_setter()
+quantized_model = torch.compile(quantized_model, mode="max-autotune")
+
+output = quantized_model.generate(**input_ids, max_new_tokens=10)
+print(tokenizer.decode(output[0], skip_special_tokens=True))
+
+# benchmark the performance
+import torch.utils.benchmark as benchmark
+
+def benchmark_fn(f, *args, **kwargs):
+ # Manual warmup
+ for _ in range(5):
+ f(*args, **kwargs)
+
+ t0 = benchmark.Timer(
+ stmt="f(*args, **kwargs)",
+ globals={"args": args, "kwargs": kwargs, "f": f},
+ num_threads=torch.get_num_threads(),
+ )
+ return f"{(t0.blocked_autorange().mean):.3f}"
+
+MAX_NEW_TOKENS = 1000
+print("int4wo-128 model:", benchmark_fn(quantized_model.generate, **input_ids, max_new_tokens=MAX_NEW_TOKENS))
+
+bf16_model = AutoModelForCausalLM.from_pretrained(model_name, device_map="cuda", torch_dtype=torch.bfloat16)
+bf16_model = torch.compile(bf16_model, mode="max-autotune")
+print("bf16 model:", benchmark_fn(bf16_model.generate, **input_ids, max_new_tokens=MAX_NEW_TOKENS))
+
+```
+
+## Serialization and Deserialization
+torchao quantization is implemented with [tensor subclasses](https://pytorch.org/docs/stable/notes/extending.html#subclassing-torch-tensor), it only work with huggingface non-safetensor serialization and deserialization. It relies on `torch.load(..., weights_only=True)` to avoid arbitrary user code execution during load time and use [add_safe_globals](https://pytorch.org/docs/stable/notes/serialization.html#torch.serialization.add_safe_globals) to allowlist some known user functions.
+
+The reason why it does not support safe tensor serialization is that wrapper tensor subclass allows maximum flexibility so we want to make sure the effort of supporting new format of quantized Tensor is low, while safe tensor optimizes for maximum safety (no user code execution), it also means we have to make sure to manually support new quantization format.
+
+```py
+# save quantized model locally
+output_dir = "llama3-8b-int4wo-128"
+quantized_model.save_pretrained(output_dir, safe_serialization=False)
+
+# push to huggingface hub
+# save_to = "{user_id}/llama3-8b-int4wo-128"
+# quantized_model.push_to_hub(save_to, safe_serialization=False)
+
+# load quantized model
+ckpt_id = "llama3-8b-int4wo-128" # or huggingface hub model id
+loaded_quantized_model = AutoModelForCausalLM.from_pretrained(ckpt_id, device_map="cuda")
+
+
+# confirm the speedup
+loaded_quantized_model = torch.compile(loaded_quantized_model, mode="max-autotune")
+print("loaded int4wo-128 model:", benchmark_fn(loaded_quantized_model.generate, **input_ids, max_new_tokens=MAX_NEW_TOKENS))
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/vptq.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/vptq.md
new file mode 100644
index 0000000000000000000000000000000000000000..b86e82f0a3503d9186281ba92d8eb261a2636c25
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quantization/vptq.md
@@ -0,0 +1,111 @@
+
+
+# VPTQ
+
+> [!TIP]
+> Try VPTQ on [Hugging Face](https://huggingface.co/spaces/microsoft/VPTQ)!
+> Try VPTQ on [Google Colab](https://colab.research.google.com/github/microsoft/VPTQ/blob/main/notebooks/vptq_example.ipynb)!
+> Know more about VPTQ on [ArXiv](https://arxiv.org/pdf/2409.17066)!
+
+Vector Post-Training Quantization ([VPTQ](https://github.com/microsoft/VPTQ)) is a novel Post-Training Quantization method that leverages Vector Quantization to high accuracy on LLMs at an extremely low bit-width (<2-bit). VPTQ can compress 70B, even the 405B model, to 1-2 bits without retraining and maintain high accuracy.
+
+- Better Accuracy on 1-2 bits, (405B @ <2bit, 70B @ 2bit)
+- Lightweight Quantization Algorithm: only cost ~17 hours to quantize 405B Llama-3.1
+- Agile Quantization Inference: low decode overhead, best throughput, and TTFT
+
+Inference support for VPTQ is released in the `vptq` library. Make sure to install it to run the models:
+```bash
+pip install vptq
+```
+
+The library provides efficient kernels for NVIDIA/AMD GPU inference.
+
+To run VPTQ models simply load a model that has been quantized with VPTQ:
+
+## Inference example
+**Run Llama 3.1 70b on RTX4090 (24G @ ~2bits) in real time**
+
+
+
+```python
+from transformers import AutoTokenizer, AutoModelForCausalLM
+
+quantized_model = AutoModelForCausalLM.from_pretrained(
+ "VPTQ-community/Meta-Llama-3.1-70B-Instruct-v16-k65536-65536-woft",
+ torch_dtype="auto",
+ device_map="auto"
+)
+tokenizer = AutoTokenizer.from_pretrained("VPTQ-community/Meta-Llama-3.1-70B-Instruct-v16-k65536-65536-woft")
+input_ids = tokenizer("hello, it's me", return_tensors="pt").to("cuda")
+out = model.generate(**input_ids, max_new_tokens=32, do_sample=False)
+```
+
+## Quantize your own model
+VPTQ algorithm early-released at [VPTQ ](https://github.com/microsoft/VPTQ/tree/algorithm),
+and checkout the [tutorial](https://github.com/microsoft/VPTQ/blob/algorithm/algorithm.md).
+
+## Early Results from Tech Report
+VPTQ achieves better accuracy and higher throughput with lower quantization overhead across models of different sizes. The following experimental results are for reference only; VPTQ can achieve better outcomes under reasonable parameters, especially in terms of model accuracy and inference speed.
+
+
+| Model | bitwidth | W2โ | C4โ | AvgQAโ | tok/sโ | mem(GB) | cost/hโ |
+| ----------- | -------- | ---- | ---- | ------ | ------ | ------- | ------- |
+| LLaMA-2 7B | 2.02 | 6.13 | 8.07 | 58.2 | 39.9 | 2.28 | 2 |
+| | 2.26 | 5.95 | 7.87 | 59.4 | 35.7 | 2.48 | 3.1 |
+| LLaMA-2 13B | 2.02 | 5.32 | 7.15 | 62.4 | 26.9 | 4.03 | 3.2 |
+| | 2.18 | 5.28 | 7.04 | 63.1 | 18.5 | 4.31 | 3.6 |
+| LLaMA-2 70B | 2.07 | 3.93 | 5.72 | 68.6 | 9.7 | 19.54 | 19 |
+| | 2.11 | 3.92 | 5.71 | 68.7 | 9.7 | 20.01 | 19 |
+
+
+
+## More Models in [VPTQ-community](https://huggingface.co/VPTQ-community)
+
+โ ๏ธ The repository only provides a method of model quantization algorithm.
+
+โ ๏ธ The open-source community VPTQ-community provides models based on the technical report and quantization algorithm.
+
+
+
+**Quick Estimation of Model Bitwidth (Excluding Codebook Overhead)**:
+
+- **Model Naming Convention**: The model's name includes the **vector length** $v$, **codebook (lookup table) size**, and **residual codebook size**. For example, "Meta-Llama-3.1-70B-Instruct-v8-k65536-256-woft" is "Meta-Llama-3.1-70B-Instruct", where:
+ - **Vector Length**: 8
+ - **Number of Centroids**: 65536 (2^16)
+ - **Number of Residual Centroids**: 256 (2^8)
+- **Equivalent Bitwidth Calculation**:
+ - **Index**: log2(65536) = 16 / 8 = 2 bits
+ - **Residual Index**: log2(256) = 8 / 8 = 1 bit
+ - **Total Bitwidth**: 2 + 1 = 3 bits
+- **Model Size Estimation**: 70B * 3 bits / 8 bits per Byte = 26.25 GB
+
+- **Note**: This estimate does not include the size of the codebook (lookup table), other parameter overheads, and the padding overhead for storing indices. For the detailed calculation method, please refer to **Tech Report Appendix C.2**.
+
+
+| Model Series | Collections | (Estimated) Bit per weight |
+| :--------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| Llama 3.1 Nemotron 70B Instruct HF | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-llama-31-nemotron-70b-instruct-hf-without-finetune-671730b96f16208d0b3fe942) | [4 bits](https://huggingface.co/VPTQ-community/Llama-3.1-Nemotron-70B-Instruct-HF-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Llama-3.1-Nemotron-70B-Instruct-HF-v8-k65536-256-woft) [2 bits (1)](https://huggingface.co/VPTQ-community/Llama-3.1-Nemotron-70B-Instruct-HF-v16-k65536-65536-woft) [2 bits (2)](https://huggingface.co/VPTQ-community/Llama-3.1-Nemotron-70B-Instruct-HF-v8-k65536-0-woft) [1.875 bits](https://huggingface.co/VPTQ-community/Llama-3.1-Nemotron-70B-Instruct-HF-v16-k65536-16384-woft) [1.625 bits](https://huggingface.co/VPTQ-community/Llama-3.1-Nemotron-70B-Instruct-HF-v16-k65536-1024-woft) [1.5 bits](https://huggingface.co/VPTQ-community/Llama-3.1-Nemotron-70B-Instruct-HF-v16-k65536-256-woft) |
+| Llama 3.1 8B Instruct | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-llama-31-8b-instruct-without-finetune-66f2b70b1d002ceedef02d2e) | [4 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-8B-Instruct-v8-k65536-65536-woft) [3.5 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-8B-Instruct-v8-k65536-4096-woft) [3 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-8B-Instruct-v8-k65536-256-woft) [2.3 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-8B-Instruct-v12-k65536-4096-woft) |
+| Llama 3.1 70B Instruct | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-llama-31-70b-instruct-without-finetune-66f2bf454d3dd78dfee2ff11) | [4 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v8-k65536-256-woft) [2.25 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v8-k65536-4-woft) [2 bits (1)](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v16-k65536-65536-woft) [2 bits (2)](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v8-k65536-0-woft) [1.93 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v16-k65536-32768-woft) [1.875 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v8-k32768-0-woft) [1.75 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-70B-Instruct-v8-k16384-0-woft) |
+| Llama 3.1 405B Instruct | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-llama-31-405b-instruct-without-finetune-66f4413f9ba55e1a9e52cfb0) | [4 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v8-k65536-256-woft) [2 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v16-k65536-65536-woft) [1.875 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v16-k32768-32768-woft) [1.625 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v16-k65536-1024-woft) [1.5 bits (1)](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v8-k4096-0-woft) [1.5 bits (2)](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v16-k65536-256-woft) [1.43 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v16-k65536-128-woft) [1.375 bits](https://huggingface.co/VPTQ-community/Meta-Llama-3.1-405B-Instruct-v16-k65536-64-woft) |
+| Mistral Large Instruct 2407 (123B) | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-mistral-large-instruct-2407-without-finetune-6711ebfb7faf85eed9cceb16) | [4 bits](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v8-k65536-256-woft) [2 bits (1)](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v16-k65536-65536-woft) [2 bits (2)](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v8-k65536-0-woft) [1.875 bits](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v16-k65536-16384-woft) [1.75 bits](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v16-k65536-4096-woft) [1.625 bits](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v16-k65536-1024-woft) [1.5 bits](https://huggingface.co/VPTQ-community/Mistral-Large-Instruct-2407-v16-k65536-256-woft) |
+| Qwen 2.5 7B Instruct | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-qwen-25-7b-instruct-without-finetune-66f3e9866d3167cc05ce954a) | [4 bits](https://huggingface.co/VPTQ-community/Qwen2.5-7B-Instruct-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Qwen2.5-7B-Instruct-v8-k65536-256-woft) [2 bits (1)](https://huggingface.co/VPTQ-community/Qwen2.5-7B-Instruct-v8-k256-256-woft) [2 bits (2)](https://huggingface.co/VPTQ-community/Qwen2.5-7B-Instruct-v8-k65536-0-woft) [2 bits (3)](https://huggingface.co/VPTQ-community/Qwen2.5-7B-Instruct-v16-k65536-65536-woft) |
+| Qwen 2.5 14B Instruct | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-qwen-25-14b-instruct-without-finetune-66f827f83c7ffa7931b8376c) | [4 bits](https://huggingface.co/VPTQ-community/Qwen2.5-14B-Instruct-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Qwen2.5-14B-Instruct-v8-k65536-256-woft) [2 bits (1)](https://huggingface.co/VPTQ-community/Qwen2.5-14B-Instruct-v8-k256-256-woft) [2 bits (2)](https://huggingface.co/VPTQ-community/Qwen2.5-14B-Instruct-v8-k65536-0-woft) [2 bits (3)](https://huggingface.co/VPTQ-community/Qwen2.5-14B-Instruct-v16-k65536-65536-woft) |
+| Qwen 2.5 32B Instruct | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-qwen-25-32b-instruct-without-finetune-66fe77173bf7d64139f0f613) | [4 bits](https://huggingface.co/VPTQ-community/Qwen2.5-32B-Instruct-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Qwen2.5-32B-Instruct-v8-k65536-256-woft) [2 bits (1)](https://huggingface.co/VPTQ-community/Qwen2.5-32B-Instruct-v16-k65536-65536-woft) [2 bits (2)](https://huggingface.co/VPTQ-community/Qwen2.5-32B-Instruct-v8-k65536-0-woft) [2 bits (3)](https://huggingface.co/VPTQ-community/Qwen2.5-32B-Instruct-v8-k256-256-woft) |
+| Qwen 2.5 72B Instruct | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/vptq-qwen-25-72b-instruct-without-finetune-66f3bf1b3757dfa1ecb481c0) | [4 bits](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v8-k65536-65536-woft) [3 bits](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v8-k65536-256-woft) [2.38 bits](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v8-k1024-512-woft) [2.25 bits (1)](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v8-k512-512-woft) [2.25 bits (2)](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v8-k65536-4-woft) [2 bits (1)](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v8-k65536-0-woft) [2 bits (2)](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v16-k65536-65536-woft) [1.94 bits](https://huggingface.co/VPTQ-community/Qwen2.5-72B-Instruct-v16-k65536-32768-woft) |
+| Reproduced from the tech report | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/reproduced-vptq-tech-report-baseline-66fbf1dffe741cc9e93ecf04) | Results from the open source community for reference only, please use them responsibly. |
+| Hessian and Inverse Hessian Matrix | [HF ๐ค](https://huggingface.co/collections/VPTQ-community/hessian-and-invhessian-checkpoints-66fd249a104850d17b23fd8b) | Collected from RedPajama-Data-1T-Sample, following [Quip#](https://github.com/Cornell-RelaxML/quip-sharp/blob/main/quantize_llama/hessian_offline_llama.py)
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quicktour.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quicktour.md
new file mode 100644
index 0000000000000000000000000000000000000000..70afa1ea57107f2fca9021d8bf09e40978bbdda5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/quicktour.md
@@ -0,0 +1,558 @@
+
+
+# Quick tour
+
+[[open-in-colab]]
+
+Get up and running with ๐ค Transformers! Whether you're a developer or an everyday user, this quick tour will help you get started and show you how to use the [`pipeline`] for inference, load a pretrained model and preprocessor with an [AutoClass](./model_doc/auto), and quickly train a model with PyTorch or TensorFlow. If you're a beginner, we recommend checking out our tutorials or [course](https://huggingface.co/course/chapter1/1) next for more in-depth explanations of the concepts introduced here.
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+!pip install transformers datasets evaluate accelerate
+```
+
+You'll also need to install your preferred machine learning framework:
+
+
+
+
+```bash
+pip install torch
+```
+
+
+
+```bash
+pip install tensorflow
+```
+
+
+
+## Pipeline
+
+
+
+The [`pipeline`] is the easiest and fastest way to use a pretrained model for inference. You can use the [`pipeline`] out-of-the-box for many tasks across different modalities, some of which are shown in the table below:
+
+
+
+For a complete list of available tasks, check out the [pipeline API reference](./main_classes/pipelines).
+
+
+
+| **Task** | **Description** | **Modality** | **Pipeline identifier** |
+|------------------------------|--------------------------------------------------------------------------------------------------------------|-----------------|-----------------------------------------------|
+| Text classification | assign a label to a given sequence of text | NLP | pipeline(task=โsentiment-analysisโ) |
+| Text generation | generate text given a prompt | NLP | pipeline(task=โtext-generationโ) |
+| Summarization | generate a summary of a sequence of text or document | NLP | pipeline(task=โsummarizationโ) |
+| Image classification | assign a label to an image | Computer vision | pipeline(task=โimage-classificationโ) |
+| Image segmentation | assign a label to each individual pixel of an image (supports semantic, panoptic, and instance segmentation) | Computer vision | pipeline(task=โimage-segmentationโ) |
+| Object detection | predict the bounding boxes and classes of objects in an image | Computer vision | pipeline(task=โobject-detectionโ) |
+| Audio classification | assign a label to some audio data | Audio | pipeline(task=โaudio-classificationโ) |
+| Automatic speech recognition | transcribe speech into text | Audio | pipeline(task=โautomatic-speech-recognitionโ) |
+| Visual question answering | answer a question about the image, given an image and a question | Multimodal | pipeline(task=โvqaโ) |
+| Document question answering | answer a question about the document, given a document and a question | Multimodal | pipeline(task="document-question-answering") |
+| Image captioning | generate a caption for a given image | Multimodal | pipeline(task="image-to-text") |
+
+Start by creating an instance of [`pipeline`] and specifying a task you want to use it for. In this guide, you'll use the [`pipeline`] for sentiment analysis as an example:
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("sentiment-analysis")
+```
+
+The [`pipeline`] downloads and caches a default [pretrained model](https://huggingface.co/distilbert/distilbert-base-uncased-finetuned-sst-2-english) and tokenizer for sentiment analysis. Now you can use the `classifier` on your target text:
+
+```py
+>>> classifier("We are very happy to show you the ๐ค Transformers library.")
+[{'label': 'POSITIVE', 'score': 0.9998}]
+```
+
+If you have more than one input, pass your inputs as a list to the [`pipeline`] to return a list of dictionaries:
+
+```py
+>>> results = classifier(["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."])
+>>> for result in results:
+... print(f"label: {result['label']}, with score: {round(result['score'], 4)}")
+label: POSITIVE, with score: 0.9998
+label: NEGATIVE, with score: 0.5309
+```
+
+The [`pipeline`] can also iterate over an entire dataset for any task you like. For this example, let's choose automatic speech recognition as our task:
+
+```py
+>>> import torch
+>>> from transformers import pipeline
+
+>>> speech_recognizer = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")
+```
+
+Load an audio dataset (see the ๐ค Datasets [Quick Start](https://huggingface.co/docs/datasets/quickstart#audio) for more details) you'd like to iterate over. For example, load the [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) dataset:
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train") # doctest: +IGNORE_RESULT
+```
+
+You need to make sure the sampling rate of the dataset matches the sampling
+rate [`facebook/wav2vec2-base-960h`](https://huggingface.co/facebook/wav2vec2-base-960h) was trained on:
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=speech_recognizer.feature_extractor.sampling_rate))
+```
+
+The audio files are automatically loaded and resampled when calling the `"audio"` column.
+Extract the raw waveform arrays from the first 4 samples and pass it as a list to the pipeline:
+
+```py
+>>> result = speech_recognizer(dataset[:4]["audio"])
+>>> print([d["text"] for d in result])
+['I WOULD LIKE TO SET UP A JOINT ACCOUNT WITH MY PARTNER HOW DO I PROCEED WITH DOING THAT', "FONDERING HOW I'D SET UP A JOIN TO HELL T WITH MY WIFE AND WHERE THE AP MIGHT BE", "I I'D LIKE TOY SET UP A JOINT ACCOUNT WITH MY PARTNER I'M NOT SEEING THE OPTION TO DO IT ON THE APSO I CALLED IN TO GET SOME HELP CAN I JUST DO IT OVER THE PHONE WITH YOU AND GIVE YOU THE INFORMATION OR SHOULD I DO IT IN THE AP AN I'M MISSING SOMETHING UQUETTE HAD PREFERRED TO JUST DO IT OVER THE PHONE OF POSSIBLE THINGS", 'HOW DO I FURN A JOINA COUT']
+```
+
+For larger datasets where the inputs are big (like in speech or vision), you'll want to pass a generator instead of a list to load all the inputs in memory. Take a look at the [pipeline API reference](./main_classes/pipelines) for more information.
+
+### Use another model and tokenizer in the pipeline
+
+The [`pipeline`] can accommodate any model from the [Hub](https://huggingface.co/models), making it easy to adapt the [`pipeline`] for other use-cases. For example, if you'd like a model capable of handling French text, use the tags on the Hub to filter for an appropriate model. The top filtered result returns a multilingual [BERT model](https://huggingface.co/nlptown/bert-base-multilingual-uncased-sentiment) finetuned for sentiment analysis you can use for French text:
+
+```py
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+```
+
+
+
+Use [`AutoModelForSequenceClassification`] and [`AutoTokenizer`] to load the pretrained model and it's associated tokenizer (more on an `AutoClass` in the next section):
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+Use [`TFAutoModelForSequenceClassification`] and [`AutoTokenizer`] to load the pretrained model and it's associated tokenizer (more on an `TFAutoClass` in the next section):
+
+```py
+>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+
+Specify the model and tokenizer in the [`pipeline`], and now you can apply the `classifier` on French text:
+
+```py
+>>> classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
+>>> classifier("Nous sommes trรจs heureux de vous prรฉsenter la bibliothรจque ๐ค Transformers.")
+[{'label': '5 stars', 'score': 0.7273}]
+```
+
+If you can't find a model for your use-case, you'll need to finetune a pretrained model on your data. Take a look at our [finetuning tutorial](./training) to learn how. Finally, after you've finetuned your pretrained model, please consider [sharing](./model_sharing) the model with the community on the Hub to democratize machine learning for everyone! ๐ค
+
+## AutoClass
+
+
+
+Under the hood, the [`AutoModelForSequenceClassification`] and [`AutoTokenizer`] classes work together to power the [`pipeline`] you used above. An [AutoClass](./model_doc/auto) is a shortcut that automatically retrieves the architecture of a pretrained model from its name or path. You only need to select the appropriate `AutoClass` for your task and it's associated preprocessing class.
+
+Let's return to the example from the previous section and see how you can use the `AutoClass` to replicate the results of the [`pipeline`].
+
+### AutoTokenizer
+
+A tokenizer is responsible for preprocessing text into an array of numbers as inputs to a model. There are multiple rules that govern the tokenization process, including how to split a word and at what level words should be split (learn more about tokenization in the [tokenizer summary](./tokenizer_summary)). The most important thing to remember is you need to instantiate a tokenizer with the same model name to ensure you're using the same tokenization rules a model was pretrained with.
+
+Load a tokenizer with [`AutoTokenizer`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+Pass your text to the tokenizer:
+
+```py
+>>> encoding = tokenizer("We are very happy to show you the ๐ค Transformers library.")
+>>> print(encoding)
+{'input_ids': [101, 11312, 10320, 12495, 19308, 10114, 11391, 10855, 10103, 100, 58263, 13299, 119, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+The tokenizer returns a dictionary containing:
+
+* [input_ids](./glossary#input-ids): numerical representations of your tokens.
+* [attention_mask](./glossary#attention-mask): indicates which tokens should be attended to.
+
+A tokenizer can also accept a list of inputs, and pad and truncate the text to return a batch with uniform length:
+
+
+
+
+```py
+>>> pt_batch = tokenizer(
+... ["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="pt",
+... )
+```
+
+
+
+```py
+>>> tf_batch = tokenizer(
+... ["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="tf",
+... )
+```
+
+
+
+
+
+Check out the [preprocess](./preprocessing) tutorial for more details about tokenization, and how to use an [`AutoImageProcessor`], [`AutoFeatureExtractor`] and [`AutoProcessor`] to preprocess image, audio, and multimodal inputs.
+
+
+
+### AutoModel
+
+
+
+๐ค Transformers provides a simple and unified way to load pretrained instances. This means you can load an [`AutoModel`] like you would load an [`AutoTokenizer`]. The only difference is selecting the correct [`AutoModel`] for the task. For text (or sequence) classification, you should load [`AutoModelForSequenceClassification`].
+
+By default, the weights are loaded in full precision (torch.float32) regardless of the actual data type the weights are stored in such as torch.float16. Set `torch_dtype="auto"` to load the weights in the data type defined in a model's `config.json` file to automatically load the most memory-optimal data type.
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(model_name, torch_dtype="auto")
+```
+
+
+
+See the [task summary](./task_summary) for tasks supported by an [`AutoModel`] class.
+
+
+
+Now pass your preprocessed batch of inputs directly to the model. You just have to unpack the dictionary by adding `**`:
+
+```py
+>>> pt_outputs = pt_model(**pt_batch)
+```
+
+The model outputs the final activations in the `logits` attribute. Apply the softmax function to the `logits` to retrieve the probabilities:
+
+```py
+>>> from torch import nn
+
+>>> pt_predictions = nn.functional.softmax(pt_outputs.logits, dim=-1)
+>>> print(pt_predictions)
+tensor([[0.0021, 0.0018, 0.0115, 0.2121, 0.7725],
+ [0.2084, 0.1826, 0.1969, 0.1755, 0.2365]], grad_fn=)
+```
+
+
+๐ค Transformers provides a simple and unified way to load pretrained instances. This means you can load an [`TFAutoModel`] like you would load an [`AutoTokenizer`]. The only difference is selecting the correct [`TFAutoModel`] for the task. For text (or sequence) classification, you should load [`TFAutoModelForSequenceClassification`]:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+
+See the [task summary](./task_summary) for tasks supported by an [`AutoModel`] class.
+
+
+
+Now pass your preprocessed batch of inputs directly to the model. You can pass the tensors as-is:
+
+```py
+>>> tf_outputs = tf_model(tf_batch)
+```
+
+The model outputs the final activations in the `logits` attribute. Apply the softmax function to the `logits` to retrieve the probabilities:
+
+```py
+>>> import tensorflow as tf
+
+>>> tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
+>>> tf_predictions # doctest: +IGNORE_RESULT
+```
+
+
+
+
+
+All ๐ค Transformers models (PyTorch or TensorFlow) output the tensors *before* the final activation
+function (like softmax) because the final activation function is often fused with the loss. Model outputs are special dataclasses so their attributes are autocompleted in an IDE. The model outputs behave like a tuple or a dictionary (you can index with an integer, a slice or a string) in which case, attributes that are None are ignored.
+
+
+
+### Save a model
+
+
+
+Once your model is fine-tuned, you can save it with its tokenizer using [`PreTrainedModel.save_pretrained`]:
+
+```py
+>>> pt_save_directory = "./pt_save_pretrained"
+>>> tokenizer.save_pretrained(pt_save_directory) # doctest: +IGNORE_RESULT
+>>> pt_model.save_pretrained(pt_save_directory)
+```
+
+When you are ready to use the model again, reload it with [`PreTrainedModel.from_pretrained`]:
+
+```py
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained("./pt_save_pretrained")
+```
+
+
+Once your model is fine-tuned, you can save it with its tokenizer using [`TFPreTrainedModel.save_pretrained`]:
+
+```py
+>>> tf_save_directory = "./tf_save_pretrained"
+>>> tokenizer.save_pretrained(tf_save_directory) # doctest: +IGNORE_RESULT
+>>> tf_model.save_pretrained(tf_save_directory)
+```
+
+When you are ready to use the model again, reload it with [`TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained("./tf_save_pretrained")
+```
+
+
+
+One particularly cool ๐ค Transformers feature is the ability to save a model and reload it as either a PyTorch or TensorFlow model. The `from_pt` or `from_tf` parameter can convert the model from one framework to the other:
+
+
+
+
+```py
+>>> from transformers import AutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(pt_save_directory, from_pt=True)
+```
+
+
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(tf_save_directory, from_tf=True)
+```
+
+
+
+## Custom model builds
+
+You can modify the model's configuration class to change how a model is built. The configuration specifies a model's attributes, such as the number of hidden layers or attention heads. You start from scratch when you initialize a model from a custom configuration class. The model attributes are randomly initialized, and you'll need to train the model before you can use it to get meaningful results.
+
+Start by importing [`AutoConfig`], and then load the pretrained model you want to modify. Within [`AutoConfig.from_pretrained`], you can specify the attribute you want to change, such as the number of attention heads:
+
+```py
+>>> from transformers import AutoConfig
+
+>>> my_config = AutoConfig.from_pretrained("distilbert/distilbert-base-uncased", n_heads=12)
+```
+
+
+
+Create a model from your custom configuration with [`AutoModel.from_config`]:
+
+```py
+>>> from transformers import AutoModel
+
+>>> my_model = AutoModel.from_config(my_config)
+```
+
+
+Create a model from your custom configuration with [`TFAutoModel.from_config`]:
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> my_model = TFAutoModel.from_config(my_config)
+```
+
+
+
+Take a look at the [Create a custom architecture](./create_a_model) guide for more information about building custom configurations.
+
+## Trainer - a PyTorch optimized training loop
+
+All models are a standard [`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) so you can use them in any typical training loop. While you can write your own training loop, ๐ค Transformers provides a [`Trainer`] class for PyTorch, which contains the basic training loop and adds additional functionality for features like distributed training, mixed precision, and more.
+
+Depending on your task, you'll typically pass the following parameters to [`Trainer`]:
+
+1. You'll start with a [`PreTrainedModel`] or a [`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module). Set `torch_dtype="auto"` to automatically load the most memory-efficient data type the weights are stored in.
+
+ ```py
+ >>> from transformers import AutoModelForSequenceClassification
+
+ >>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased", torch_dtype="auto")
+ ```
+
+2. [`TrainingArguments`] contains the model hyperparameters you can change like learning rate, batch size, and the number of epochs to train for. The default values are used if you don't specify any training arguments:
+
+ ```py
+ >>> from transformers import TrainingArguments
+
+ >>> training_args = TrainingArguments(
+ ... output_dir="path/to/save/folder/",
+ ... learning_rate=2e-5,
+ ... per_device_train_batch_size=8,
+ ... per_device_eval_batch_size=8,
+ ... num_train_epochs=2,
+ ... )
+ ```
+
+3. Load a preprocessing class like a tokenizer, image processor, feature extractor, or processor:
+
+ ```py
+ >>> from transformers import AutoTokenizer
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+4. Load a dataset:
+
+ ```py
+ >>> from datasets import load_dataset
+
+ >>> dataset = load_dataset("rotten_tomatoes") # doctest: +IGNORE_RESULT
+ ```
+
+5. Create a function to tokenize the dataset:
+
+ ```py
+ >>> def tokenize_dataset(dataset):
+ ... return tokenizer(dataset["text"])
+ ```
+
+ Then apply it over the entire dataset with [`~datasets.Dataset.map`]:
+
+ ```py
+ >>> dataset = dataset.map(tokenize_dataset, batched=True)
+ ```
+
+6. A [`DataCollatorWithPadding`] to create a batch of examples from your dataset:
+
+ ```py
+ >>> from transformers import DataCollatorWithPadding
+
+ >>> data_collator = DataCollatorWithPadding(tokenizer=tokenizer)
+ ```
+
+Now gather all these classes in [`Trainer`]:
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=dataset["train"],
+... eval_dataset=dataset["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... ) # doctest: +SKIP
+```
+
+When you're ready, call [`~Trainer.train`] to start training:
+
+```py
+>>> trainer.train() # doctest: +SKIP
+```
+
+
+
+For tasks - like translation or summarization - that use a sequence-to-sequence model, use the [`Seq2SeqTrainer`] and [`Seq2SeqTrainingArguments`] classes instead.
+
+
+
+You can customize the training loop behavior by subclassing the methods inside [`Trainer`]. This allows you to customize features such as the loss function, optimizer, and scheduler. Take a look at the [`Trainer`] reference for which methods can be subclassed.
+
+The other way to customize the training loop is by using [Callbacks](./main_classes/callback). You can use callbacks to integrate with other libraries and inspect the training loop to report on progress or stop the training early. Callbacks do not modify anything in the training loop itself. To customize something like the loss function, you need to subclass the [`Trainer`] instead.
+
+## Train with TensorFlow
+
+All models are a standard [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) so they can be trained in TensorFlow with the [Keras](https://keras.io/) API. ๐ค Transformers provides the [`~TFPreTrainedModel.prepare_tf_dataset`] method to easily load your dataset as a `tf.data.Dataset` so you can start training right away with Keras' [`compile`](https://keras.io/api/models/model_training_apis/#compile-method) and [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) methods.
+
+1. You'll start with a [`TFPreTrainedModel`] or a [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model):
+
+ ```py
+ >>> from transformers import TFAutoModelForSequenceClassification
+
+ >>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+2. Load a preprocessing class like a tokenizer, image processor, feature extractor, or processor:
+
+ ```py
+ >>> from transformers import AutoTokenizer
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+3. Create a function to tokenize the dataset:
+
+ ```py
+ >>> def tokenize_dataset(dataset):
+ ... return tokenizer(dataset["text"]) # doctest: +SKIP
+ ```
+
+4. Apply the tokenizer over the entire dataset with [`~datasets.Dataset.map`] and then pass the dataset and tokenizer to [`~TFPreTrainedModel.prepare_tf_dataset`]. You can also change the batch size and shuffle the dataset here if you'd like:
+
+ ```py
+ >>> dataset = dataset.map(tokenize_dataset) # doctest: +SKIP
+ >>> tf_dataset = model.prepare_tf_dataset(
+ ... dataset["train"], batch_size=16, shuffle=True, tokenizer=tokenizer
+ ... ) # doctest: +SKIP
+ ```
+
+5. When you're ready, you can call `compile` and `fit` to start training. Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+ ```py
+ >>> from tensorflow.keras.optimizers import Adam
+
+ >>> model.compile(optimizer='adam') # No loss argument!
+ >>> model.fit(tf_dataset) # doctest: +SKIP
+ ```
+
+## What's next?
+
+Now that you've completed the ๐ค Transformers quick tour, check out our guides and learn how to do more specific things like writing a custom model, fine-tuning a model for a task, and how to train a model with a script. If you're interested in learning more about ๐ค Transformers core concepts, grab a cup of coffee and take a look at our Conceptual Guides!
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/run_scripts.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/run_scripts.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7a895591970c37474540548df3fb9c9c697703b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/run_scripts.md
@@ -0,0 +1,351 @@
+
+
+# Train with a script
+
+Along with the ๐ค Transformers [notebooks](./notebooks), there are also example scripts demonstrating how to train a model for a task with [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch), [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow), or [JAX/Flax](https://github.com/huggingface/transformers/tree/main/examples/flax).
+
+You will also find scripts we've used in our [research projects](https://github.com/huggingface/transformers/tree/main/examples/research_projects) and [legacy examples](https://github.com/huggingface/transformers/tree/main/examples/legacy) which are mostly community contributed. These scripts are not actively maintained and require a specific version of ๐ค Transformers that will most likely be incompatible with the latest version of the library.
+
+The example scripts are not expected to work out-of-the-box on every problem, and you may need to adapt the script to the problem you're trying to solve. To help you with this, most of the scripts fully expose how data is preprocessed, allowing you to edit it as necessary for your use case.
+
+For any feature you'd like to implement in an example script, please discuss it on the [forum](https://discuss.huggingface.co/) or in an [issue](https://github.com/huggingface/transformers/issues) before submitting a Pull Request. While we welcome bug fixes, it is unlikely we will merge a Pull Request that adds more functionality at the cost of readability.
+
+This guide will show you how to run an example summarization training script in [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization) and [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization). All examples are expected to work with both frameworks unless otherwise specified.
+
+## Setup
+
+To successfully run the latest version of the example scripts, you have to **install ๐ค Transformers from source** in a new virtual environment:
+
+```bash
+git clone https://github.com/huggingface/transformers
+cd transformers
+pip install .
+```
+
+For older versions of the example scripts, click on the toggle below:
+
+
+ Examples for older versions of ๐ค Transformers
+
+
+
+Then switch your current clone of ๐ค Transformers to a specific version, like v3.5.1 for example:
+
+```bash
+git checkout tags/v3.5.1
+```
+
+After you've setup the correct library version, navigate to the example folder of your choice and install the example specific requirements:
+
+```bash
+pip install -r requirements.txt
+```
+
+## Run a script
+
+
+
+The example script downloads and preprocesses a dataset from the ๐ค [Datasets](https://huggingface.co/docs/datasets/) library. Then the script fine-tunes a dataset with the [Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) on an architecture that supports summarization. The following example shows how to fine-tune [T5-small](https://huggingface.co/google-t5/t5-small) on the [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail) dataset. The T5 model requires an additional `source_prefix` argument due to how it was trained. This prompt lets T5 know this is a summarization task.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+The example script downloads and preprocesses a dataset from the ๐ค [Datasets](https://huggingface.co/docs/datasets/) library. Then the script fine-tunes a dataset using Keras on an architecture that supports summarization. The following example shows how to fine-tune [T5-small](https://huggingface.co/google-t5/t5-small) on the [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail) dataset. The T5 model requires an additional `source_prefix` argument due to how it was trained. This prompt lets T5 know this is a summarization task.
+
+```bash
+python examples/tensorflow/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Distributed training and mixed precision
+
+The [Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) supports distributed training and mixed precision, which means you can also use it in a script. To enable both of these features:
+
+- Add the `fp16` or `bf16` argument to enable mixed precision. XPU devices only supports `bf16` for mixed precision training.
+- Set the number of GPUs to use with the `nproc_per_node` argument.
+
+```bash
+torchrun \
+ --nproc_per_node 8 pytorch/summarization/run_summarization.py \
+ --fp16 \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+TensorFlow scripts utilize a [`MirroredStrategy`](https://www.tensorflow.org/guide/distributed_training#mirroredstrategy) for distributed training, and you don't need to add any additional arguments to the training script. The TensorFlow script will use multiple GPUs by default if they are available.
+
+## Run a script on a TPU
+
+
+
+Tensor Processing Units (TPUs) are specifically designed to accelerate performance. PyTorch supports TPUs with the [XLA](https://www.tensorflow.org/xla) deep learning compiler (see [here](https://github.com/pytorch/xla/blob/master/README.md) for more details). To use a TPU, launch the `xla_spawn.py` script and use the `num_cores` argument to set the number of TPU cores you want to use.
+
+```bash
+python xla_spawn.py --num_cores 8 \
+ summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+Tensor Processing Units (TPUs) are specifically designed to accelerate performance. TensorFlow scripts utilize a [`TPUStrategy`](https://www.tensorflow.org/guide/distributed_training#tpustrategy) for training on TPUs. To use a TPU, pass the name of the TPU resource to the `tpu` argument.
+
+```bash
+python run_summarization.py \
+ --tpu name_of_tpu_resource \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Run a script with ๐ค Accelerate
+
+๐ค [Accelerate](https://huggingface.co/docs/accelerate) is a PyTorch-only library that offers a unified method for training a model on several types of setups (CPU-only, multiple GPUs, TPUs) while maintaining complete visibility into the PyTorch training loop. Make sure you have ๐ค Accelerate installed if you don't already have it:
+
+> Note: As Accelerate is rapidly developing, the git version of accelerate must be installed to run the scripts
+```bash
+pip install git+https://github.com/huggingface/accelerate
+```
+
+Instead of the `run_summarization.py` script, you need to use the `run_summarization_no_trainer.py` script. ๐ค Accelerate supported scripts will have a `task_no_trainer.py` file in the folder. Begin by running the following command to create and save a configuration file:
+
+```bash
+accelerate config
+```
+
+Test your setup to make sure it is configured correctly:
+
+```bash
+accelerate test
+```
+
+Now you are ready to launch the training:
+
+```bash
+accelerate launch run_summarization_no_trainer.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir ~/tmp/tst-summarization
+```
+
+## Use a custom dataset
+
+The summarization script supports custom datasets as long as they are a CSV or JSON Line file. When you use your own dataset, you need to specify several additional arguments:
+
+- `train_file` and `validation_file` specify the path to your training and validation files.
+- `text_column` is the input text to summarize.
+- `summary_column` is the target text to output.
+
+A summarization script using a custom dataset would look like this:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --train_file path_to_csv_or_jsonlines_file \
+ --validation_file path_to_csv_or_jsonlines_file \
+ --text_column text_column_name \
+ --summary_column summary_column_name \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --overwrite_output_dir \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --predict_with_generate
+```
+
+## Test a script
+
+It is often a good idea to run your script on a smaller number of dataset examples to ensure everything works as expected before committing to an entire dataset which may take hours to complete. Use the following arguments to truncate the dataset to a maximum number of samples:
+
+- `max_train_samples`
+- `max_eval_samples`
+- `max_predict_samples`
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --max_train_samples 50 \
+ --max_eval_samples 50 \
+ --max_predict_samples 50 \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+Not all example scripts support the `max_predict_samples` argument. If you aren't sure whether your script supports this argument, add the `-h` argument to check:
+
+```bash
+examples/pytorch/summarization/run_summarization.py -h
+```
+
+## Resume training from checkpoint
+
+Another helpful option to enable is resuming training from a previous checkpoint. This will ensure you can pick up where you left off without starting over if your training gets interrupted. There are two methods to resume training from a checkpoint.
+
+The first method uses the `output_dir previous_output_dir` argument to resume training from the latest checkpoint stored in `output_dir`. In this case, you should remove `overwrite_output_dir`:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --output_dir previous_output_dir \
+ --predict_with_generate
+```
+
+The second method uses the `resume_from_checkpoint path_to_specific_checkpoint` argument to resume training from a specific checkpoint folder.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --resume_from_checkpoint path_to_specific_checkpoint \
+ --predict_with_generate
+```
+
+## Share your model
+
+All scripts can upload your final model to the [Model Hub](https://huggingface.co/models). Make sure you are logged into Hugging Face before you begin:
+
+```bash
+huggingface-cli login
+```
+
+Then add the `push_to_hub` argument to the script. This argument will create a repository with your Hugging Face username and the folder name specified in `output_dir`.
+
+To give your repository a specific name, use the `push_to_hub_model_id` argument to add it. The repository will be automatically listed under your namespace.
+
+The following example shows how to upload a model with a specific repository name:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --push_to_hub \
+ --push_to_hub_model_id finetuned-t5-cnn_dailymail \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/sagemaker.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/sagemaker.md
new file mode 100644
index 0000000000000000000000000000000000000000..41802d9d42b25e117bc5e8ee4c5da952e94cb14a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/sagemaker.md
@@ -0,0 +1,28 @@
+
+
+# Run training on Amazon SageMaker
+
+The documentation has been moved to [hf.co/docs/sagemaker](https://huggingface.co/docs/sagemaker). This page will be removed in `transformers` 5.0.
+
+### Table of Contents
+
+- [Train Hugging Face models on Amazon SageMaker with the SageMaker Python SDK](https://huggingface.co/docs/sagemaker/train)
+- [Deploy Hugging Face models to Amazon SageMaker with the SageMaker Python SDK](https://huggingface.co/docs/sagemaker/inference)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/serialization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/serialization.md
new file mode 100644
index 0000000000000000000000000000000000000000..eacda34f71198a41db206aa9db4bf2682f612731
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/serialization.md
@@ -0,0 +1,210 @@
+
+
+# Export to ONNX
+
+Deploying ๐ค Transformers models in production environments often requires, or can benefit from exporting the models into
+a serialized format that can be loaded and executed on specialized runtimes and hardware.
+
+๐ค Optimum is an extension of Transformers that enables exporting models from PyTorch or TensorFlow to serialized formats
+such as ONNX and TFLite through its `exporters` module. ๐ค Optimum also provides a set of performance optimization tools to train
+and run models on targeted hardware with maximum efficiency.
+
+This guide demonstrates how you can export ๐ค Transformers models to ONNX with ๐ค Optimum, for the guide on exporting models to TFLite,
+please refer to the [Export to TFLite page](tflite).
+
+## Export to ONNX
+
+[ONNX (Open Neural Network eXchange)](http://onnx.ai) is an open standard that defines a common set of operators and a
+common file format to represent deep learning models in a wide variety of frameworks, including PyTorch and
+TensorFlow. When a model is exported to the ONNX format, these operators are used to
+construct a computational graph (often called an _intermediate representation_) which
+represents the flow of data through the neural network.
+
+By exposing a graph with standardized operators and data types, ONNX makes it easy to
+switch between frameworks. For example, a model trained in PyTorch can be exported to
+ONNX format and then imported in TensorFlow (and vice versa).
+
+Once exported to ONNX format, a model can be:
+- optimized for inference via techniques such as [graph optimization](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/optimization) and [quantization](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/quantization).
+- run with ONNX Runtime via [`ORTModelForXXX` classes](https://huggingface.co/docs/optimum/onnxruntime/package_reference/modeling_ort),
+which follow the same `AutoModel` API as the one you are used to in ๐ค Transformers.
+- run with [optimized inference pipelines](https://huggingface.co/docs/optimum/main/en/onnxruntime/usage_guides/pipelines),
+which has the same API as the [`pipeline`] function in ๐ค Transformers.
+
+๐ค Optimum provides support for the ONNX export by leveraging configuration objects. These configuration objects come
+ready-made for a number of model architectures, and are designed to be easily extendable to other architectures.
+
+For the list of ready-made configurations, please refer to [๐ค Optimum documentation](https://huggingface.co/docs/optimum/exporters/onnx/overview).
+
+There are two ways to export a ๐ค Transformers model to ONNX, here we show both:
+
+- export with ๐ค Optimum via CLI.
+- export with ๐ค Optimum with `optimum.onnxruntime`.
+
+### Exporting a ๐ค Transformers model to ONNX with CLI
+
+To export a ๐ค Transformers model to ONNX, first install an extra dependency:
+
+```bash
+pip install optimum[exporters]
+```
+
+To check out all available arguments, refer to the [๐ค Optimum docs](https://huggingface.co/docs/optimum/exporters/onnx/usage_guides/export_a_model#exporting-a-model-to-onnx-using-the-cli),
+or view help in command line:
+
+```bash
+optimum-cli export onnx --help
+```
+
+To export a model's checkpoint from the ๐ค Hub, for example, `distilbert/distilbert-base-uncased-distilled-squad`, run the following command:
+
+```bash
+optimum-cli export onnx --model distilbert/distilbert-base-uncased-distilled-squad distilbert_base_uncased_squad_onnx/
+```
+
+You should see the logs indicating progress and showing where the resulting `model.onnx` is saved, like this:
+
+```bash
+Validating ONNX model distilbert_base_uncased_squad_onnx/model.onnx...
+ -[โ] ONNX model output names match reference model (start_logits, end_logits)
+ - Validating ONNX Model output "start_logits":
+ -[โ] (2, 16) matches (2, 16)
+ -[โ] all values close (atol: 0.0001)
+ - Validating ONNX Model output "end_logits":
+ -[โ] (2, 16) matches (2, 16)
+ -[โ] all values close (atol: 0.0001)
+The ONNX export succeeded and the exported model was saved at: distilbert_base_uncased_squad_onnx
+```
+
+The example above illustrates exporting a checkpoint from ๐ค Hub. When exporting a local model, first make sure that you
+saved both the model's weights and tokenizer files in the same directory (`local_path`). When using CLI, pass the
+`local_path` to the `model` argument instead of the checkpoint name on ๐ค Hub and provide the `--task` argument.
+You can review the list of supported tasks in the [๐ค Optimum documentation](https://huggingface.co/docs/optimum/exporters/task_manager).
+If `task` argument is not provided, it will default to the model architecture without any task specific head.
+
+```bash
+optimum-cli export onnx --model local_path --task question-answering distilbert_base_uncased_squad_onnx/
+```
+
+The resulting `model.onnx` file can then be run on one of the [many
+accelerators](https://onnx.ai/supported-tools.html#deployModel) that support the ONNX
+standard. For example, we can load and run the model with [ONNX
+Runtime](https://onnxruntime.ai/) as follows:
+
+```python
+>>> from transformers import AutoTokenizer
+>>> from optimum.onnxruntime import ORTModelForQuestionAnswering
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert_base_uncased_squad_onnx")
+>>> model = ORTModelForQuestionAnswering.from_pretrained("distilbert_base_uncased_squad_onnx")
+>>> inputs = tokenizer("What am I using?", "Using DistilBERT with ONNX Runtime!", return_tensors="pt")
+>>> outputs = model(**inputs)
+```
+
+The process is identical for TensorFlow checkpoints on the Hub. For instance, here's how you would
+export a pure TensorFlow checkpoint from the [Keras organization](https://huggingface.co/keras-io):
+
+```bash
+optimum-cli export onnx --model keras-io/transformers-qa distilbert_base_cased_squad_onnx/
+```
+
+### Exporting a ๐ค Transformers model to ONNX with `optimum.onnxruntime`
+
+Alternative to CLI, you can export a ๐ค Transformers model to ONNX programmatically like so:
+
+```python
+>>> from optimum.onnxruntime import ORTModelForSequenceClassification
+>>> from transformers import AutoTokenizer
+
+>>> model_checkpoint = "distilbert_base_uncased_squad"
+>>> save_directory = "onnx/"
+
+>>> # Load a model from transformers and export it to ONNX
+>>> ort_model = ORTModelForSequenceClassification.from_pretrained(model_checkpoint, export=True)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
+
+>>> # Save the onnx model and tokenizer
+>>> ort_model.save_pretrained(save_directory)
+>>> tokenizer.save_pretrained(save_directory)
+```
+
+### Exporting a model for an unsupported architecture
+
+If you wish to contribute by adding support for a model that cannot be currently exported, you should first check if it is
+supported in [`optimum.exporters.onnx`](https://huggingface.co/docs/optimum/exporters/onnx/overview),
+and if it is not, [contribute to ๐ค Optimum](https://huggingface.co/docs/optimum/exporters/onnx/usage_guides/contribute)
+directly.
+
+### Exporting a model with `transformers.onnx`
+
+
+
+`transformers.onnx` is no longer maintained, please export models with ๐ค Optimum as described above. This section will be removed in the future versions.
+
+
+
+To export a ๐ค Transformers model to ONNX with `transformers.onnx`, install extra dependencies:
+
+```bash
+pip install transformers[onnx]
+```
+
+Use `transformers.onnx` package as a Python module to export a checkpoint using a ready-made configuration:
+
+```bash
+python -m transformers.onnx --model=distilbert/distilbert-base-uncased onnx/
+```
+
+This exports an ONNX graph of the checkpoint defined by the `--model` argument. Pass any checkpoint on the ๐ค Hub or one that's stored locally.
+The resulting `model.onnx` file can then be run on one of the many accelerators that support the ONNX standard. For example,
+load and run the model with ONNX Runtime as follows:
+
+```python
+>>> from transformers import AutoTokenizer
+>>> from onnxruntime import InferenceSession
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> session = InferenceSession("onnx/model.onnx")
+>>> # ONNX Runtime expects NumPy arrays as input
+>>> inputs = tokenizer("Using DistilBERT with ONNX Runtime!", return_tensors="np")
+>>> outputs = session.run(output_names=["last_hidden_state"], input_feed=dict(inputs))
+```
+
+The required output names (like `["last_hidden_state"]`) can be obtained by taking a look at the ONNX configuration of
+each model. For example, for DistilBERT we have:
+
+```python
+>>> from transformers.models.distilbert import DistilBertConfig, DistilBertOnnxConfig
+
+>>> config = DistilBertConfig()
+>>> onnx_config = DistilBertOnnxConfig(config)
+>>> print(list(onnx_config.outputs.keys()))
+["last_hidden_state"]
+```
+
+The process is identical for TensorFlow checkpoints on the Hub. For example, export a pure TensorFlow checkpoint like so:
+
+```bash
+python -m transformers.onnx --model=keras-io/transformers-qa onnx/
+```
+
+To export a model that's stored locally, save the model's weights and tokenizer files in the same directory (e.g. `local-pt-checkpoint`),
+then export it to ONNX by pointing the `--model` argument of the `transformers.onnx` package to the desired directory:
+
+```bash
+python -m transformers.onnx --model=local-pt-checkpoint onnx/
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/task_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/task_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..a5e2192f87598edca6bcc60861128b7e9d5d62d7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/task_summary.md
@@ -0,0 +1,341 @@
+
+
+# What ๐ค Transformers can do
+
+๐ค Transformers is a library of pretrained state-of-the-art models for natural language processing (NLP), computer vision, and audio and speech processing tasks. Not only does the library contain Transformer models, but it also has non-Transformer models like modern convolutional networks for computer vision tasks. If you look at some of the most popular consumer products today, like smartphones, apps, and televisions, odds are that some kind of deep learning technology is behind it. Want to remove a background object from a picture taken by your smartphone? This is an example of a panoptic segmentation task (don't worry if you don't know what this means yet, we'll describe it in the following sections!).
+
+This page provides an overview of the different speech and audio, computer vision, and NLP tasks that can be solved with the ๐ค Transformers library in just three lines of code!
+
+## Audio
+
+Audio and speech processing tasks are a little different from the other modalities mainly because audio as an input is a continuous signal. Unlike text, a raw audio waveform can't be neatly split into discrete chunks the way a sentence can be divided into words. To get around this, the raw audio signal is typically sampled at regular intervals. If you take more samples within an interval, the sampling rate is higher, and the audio more closely resembles the original audio source.
+
+Previous approaches preprocessed the audio to extract useful features from it. It is now more common to start audio and speech processing tasks by directly feeding the raw audio waveform to a feature encoder to extract an audio representation. This simplifies the preprocessing step and allows the model to learn the most essential features.
+
+### Audio classification
+
+Audio classification is a task that labels audio data from a predefined set of classes. It is a broad category with many specific applications, some of which include:
+
+* acoustic scene classification: label audio with a scene label ("office", "beach", "stadium")
+* acoustic event detection: label audio with a sound event label ("car horn", "whale calling", "glass breaking")
+* tagging: label audio containing multiple sounds (birdsongs, speaker identification in a meeting)
+* music classification: label music with a genre label ("metal", "hip-hop", "country")
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="audio-classification", model="superb/hubert-base-superb-er")
+>>> preds = classifier("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4532, 'label': 'hap'},
+ {'score': 0.3622, 'label': 'sad'},
+ {'score': 0.0943, 'label': 'neu'},
+ {'score': 0.0903, 'label': 'ang'}]
+```
+
+### Automatic speech recognition
+
+Automatic speech recognition (ASR) transcribes speech into text. It is one of the most common audio tasks due partly to speech being such a natural form of human communication. Today, ASR systems are embedded in "smart" technology products like speakers, phones, and cars. We can ask our virtual assistants to play music, set reminders, and tell us the weather.
+
+But one of the key challenges Transformer architectures have helped with is in low-resource languages. By pretraining on large amounts of speech data, finetuning the model on only one hour of labeled speech data in a low-resource language can still produce high-quality results compared to previous ASR systems trained on 100x more labeled data.
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition", model="openai/whisper-small")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+## Computer vision
+
+One of the first and earliest successful computer vision tasks was recognizing images of zip code numbers using a [convolutional neural network (CNN)](glossary#convolution). An image is composed of pixels, and each pixel has a numerical value. This makes it easy to represent an image as a matrix of pixel values. Each particular combination of pixel values describes the colors of an image.
+
+Two general ways computer vision tasks can be solved are:
+
+1. Use convolutions to learn the hierarchical features of an image from low-level features to high-level abstract things.
+2. Split an image into patches and use a Transformer to gradually learn how each image patch is related to each other to form an image. Unlike the bottom-up approach favored by a CNN, this is kind of like starting out with a blurry image and then gradually bringing it into focus.
+
+### Image classification
+
+Image classification labels an entire image from a predefined set of classes. Like most classification tasks, there are many practical use cases for image classification, some of which include:
+
+* healthcare: label medical images to detect disease or monitor patient health
+* environment: label satellite images to monitor deforestation, inform wildland management or detect wildfires
+* agriculture: label images of crops to monitor plant health or satellite images for land use monitoring
+* ecology: label images of animal or plant species to monitor wildlife populations or track endangered species
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="image-classification")
+>>> preds = classifier(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.4335, 'label': 'lynx, catamount'}
+{'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}
+{'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}
+{'score': 0.0239, 'label': 'Egyptian cat'}
+{'score': 0.0229, 'label': 'tiger cat'}
+```
+
+### Object detection
+
+Unlike image classification, object detection identifies multiple objects within an image and the objects' positions in an image (defined by the bounding box). Some example applications of object detection include:
+
+* self-driving vehicles: detect everyday traffic objects such as other vehicles, pedestrians, and traffic lights
+* remote sensing: disaster monitoring, urban planning, and weather forecasting
+* defect detection: detect cracks or structural damage in buildings, and manufacturing defects
+
+```py
+>>> from transformers import pipeline
+
+>>> detector = pipeline(task="object-detection")
+>>> preds = detector(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"], "box": pred["box"]} for pred in preds]
+>>> preds
+[{'score': 0.9865,
+ 'label': 'cat',
+ 'box': {'xmin': 178, 'ymin': 154, 'xmax': 882, 'ymax': 598}}]
+```
+
+### Image segmentation
+
+Image segmentation is a pixel-level task that assigns every pixel in an image to a class. It differs from object detection, which uses bounding boxes to label and predict objects in an image because segmentation is more granular. Segmentation can detect objects at a pixel-level. There are several types of image segmentation:
+
+* instance segmentation: in addition to labeling the class of an object, it also labels each distinct instance of an object ("dog-1", "dog-2")
+* panoptic segmentation: a combination of semantic and instance segmentation; it labels each pixel with a semantic class **and** each distinct instance of an object
+
+Segmentation tasks are helpful in self-driving vehicles to create a pixel-level map of the world around them so they can navigate safely around pedestrians and other vehicles. It is also useful for medical imaging, where the task's finer granularity can help identify abnormal cells or organ features. Image segmentation can also be used in ecommerce to virtually try on clothes or create augmented reality experiences by overlaying objects in the real world through your camera.
+
+```py
+>>> from transformers import pipeline
+
+>>> segmenter = pipeline(task="image-segmentation")
+>>> preds = segmenter(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.9879, 'label': 'LABEL_184'}
+{'score': 0.9973, 'label': 'snow'}
+{'score': 0.9972, 'label': 'cat'}
+```
+
+### Depth estimation
+
+Depth estimation predicts the distance of each pixel in an image from the camera. This computer vision task is especially important for scene understanding and reconstruction. For example, in self-driving cars, vehicles need to understand how far objects like pedestrians, traffic signs, and other vehicles are to avoid obstacles and collisions. Depth information is also helpful for constructing 3D representations from 2D images and can be used to create high-quality 3D representations of biological structures or buildings.
+
+There are two approaches to depth estimation:
+
+* stereo: depths are estimated by comparing two images of the same image from slightly different angles
+* monocular: depths are estimated from a single image
+
+```py
+>>> from transformers import pipeline
+
+>>> depth_estimator = pipeline(task="depth-estimation")
+>>> preds = depth_estimator(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+```
+
+## Natural language processing
+
+NLP tasks are among the most common types of tasks because text is such a natural way for us to communicate. To get text into a format recognized by a model, it needs to be tokenized. This means dividing a sequence of text into separate words or subwords (tokens) and then converting these tokens into numbers. As a result, you can represent a sequence of text as a sequence of numbers, and once you have a sequence of numbers, it can be input into a model to solve all sorts of NLP tasks!
+
+### Text classification
+
+Like classification tasks in any modality, text classification labels a sequence of text (it can be sentence-level, a paragraph, or a document) from a predefined set of classes. There are many practical applications for text classification, some of which include:
+
+* sentiment analysis: label text according to some polarity like `positive` or `negative` which can inform and support decision-making in fields like politics, finance, and marketing
+* content classification: label text according to some topic to help organize and filter information in news and social media feeds (`weather`, `sports`, `finance`, etc.)
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="sentiment-analysis")
+>>> preds = classifier("Hugging Face is the best thing since sliced bread!")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.9991, 'label': 'POSITIVE'}]
+```
+
+### Token classification
+
+In any NLP task, text is preprocessed by separating the sequence of text into individual words or subwords. These are known as [tokens](glossary#token). Token classification assigns each token a label from a predefined set of classes.
+
+Two common types of token classification are:
+
+* named entity recognition (NER): label a token according to an entity category like organization, person, location or date. NER is especially popular in biomedical settings, where it can label genes, proteins, and drug names.
+* part-of-speech tagging (POS): label a token according to its part-of-speech like noun, verb, or adjective. POS is useful for helping translation systems understand how two identical words are grammatically different (bank as a noun versus bank as a verb).
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="ner")
+>>> preds = classifier("Hugging Face is a French company based in New York City.")
+>>> preds = [
+... {
+... "entity": pred["entity"],
+... "score": round(pred["score"], 4),
+... "index": pred["index"],
+... "word": pred["word"],
+... "start": pred["start"],
+... "end": pred["end"],
+... }
+... for pred in preds
+... ]
+>>> print(*preds, sep="\n")
+{'entity': 'I-ORG', 'score': 0.9968, 'index': 1, 'word': 'Hu', 'start': 0, 'end': 2}
+{'entity': 'I-ORG', 'score': 0.9293, 'index': 2, 'word': '##gging', 'start': 2, 'end': 7}
+{'entity': 'I-ORG', 'score': 0.9763, 'index': 3, 'word': 'Face', 'start': 8, 'end': 12}
+{'entity': 'I-MISC', 'score': 0.9983, 'index': 6, 'word': 'French', 'start': 18, 'end': 24}
+{'entity': 'I-LOC', 'score': 0.999, 'index': 10, 'word': 'New', 'start': 42, 'end': 45}
+{'entity': 'I-LOC', 'score': 0.9987, 'index': 11, 'word': 'York', 'start': 46, 'end': 50}
+{'entity': 'I-LOC', 'score': 0.9992, 'index': 12, 'word': 'City', 'start': 51, 'end': 55}
+```
+
+### Question answering
+
+Question answering is another token-level task that returns an answer to a question, sometimes with context (open-domain) and other times without context (closed-domain). This task happens whenever we ask a virtual assistant something like whether a restaurant is open. It can also provide customer or technical support and help search engines retrieve the relevant information you're asking for.
+
+There are two common types of question answering:
+
+* extractive: given a question and some context, the answer is a span of text from the context the model must extract
+* abstractive: given a question and some context, the answer is generated from the context; this approach is handled by the [`Text2TextGenerationPipeline`] instead of the [`QuestionAnsweringPipeline`] shown below
+
+
+```py
+>>> from transformers import pipeline
+
+>>> question_answerer = pipeline(task="question-answering")
+>>> preds = question_answerer(
+... question="What is the name of the repository?",
+... context="The name of the repository is huggingface/transformers",
+... )
+>>> print(
+... f"score: {round(preds['score'], 4)}, start: {preds['start']}, end: {preds['end']}, answer: {preds['answer']}"
+... )
+score: 0.9327, start: 30, end: 54, answer: huggingface/transformers
+```
+
+### Summarization
+
+Summarization creates a shorter version of a text from a longer one while trying to preserve most of the meaning of the original document. Summarization is a sequence-to-sequence task; it outputs a shorter text sequence than the input. There are a lot of long-form documents that can be summarized to help readers quickly understand the main points. Legislative bills, legal and financial documents, patents, and scientific papers are a few examples of documents that could be summarized to save readers time and serve as a reading aid.
+
+Like question answering, there are two types of summarization:
+
+* extractive: identify and extract the most important sentences from the original text
+* abstractive: generate the target summary (which may include new words not in the input document) from the original text; the [`SummarizationPipeline`] uses the abstractive approach
+
+```py
+>>> from transformers import pipeline
+
+>>> summarizer = pipeline(task="summarization")
+>>> summarizer(
+... "In this work, we presented the Transformer, the first sequence transduction model based entirely on attention, replacing the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention. For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers. On both WMT 2014 English-to-German and WMT 2014 English-to-French translation tasks, we achieve a new state of the art. In the former task our best model outperforms even all previously reported ensembles."
+... )
+[{'summary_text': ' The Transformer is the first sequence transduction model based entirely on attention . It replaces the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention . For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers .'}]
+```
+
+### Translation
+
+Translation converts a sequence of text in one language to another. It is important in helping people from different backgrounds communicate with each other, help translate content to reach wider audiences, and even be a learning tool to help people learn a new language. Along with summarization, translation is a sequence-to-sequence task, meaning the model receives an input sequence and returns a target output sequence.
+
+In the early days, translation models were mostly monolingual, but recently, there has been increasing interest in multilingual models that can translate between many pairs of languages.
+
+```py
+>>> from transformers import pipeline
+
+>>> text = "translate English to French: Hugging Face is a community-based open-source platform for machine learning."
+>>> translator = pipeline(task="translation", model="google-t5/t5-small")
+>>> translator(text)
+[{'translation_text': "Hugging Face est une tribune communautaire de l'apprentissage des machines."}]
+```
+
+### Language modeling
+
+Language modeling is a task that predicts a word in a sequence of text. It has become a very popular NLP task because a pretrained language model can be finetuned for many other downstream tasks. Lately, there has been a lot of interest in large language models (LLMs) which demonstrate zero- or few-shot learning. This means the model can solve tasks it wasn't explicitly trained to do! Language models can be used to generate fluent and convincing text, though you need to be careful since the text may not always be accurate.
+
+There are two types of language modeling:
+
+* causal: the model's objective is to predict the next token in a sequence, and future tokens are masked
+
+ ```py
+ >>> from transformers import pipeline
+
+ >>> prompt = "Hugging Face is a community-based open-source platform for machine learning."
+ >>> generator = pipeline(task="text-generation")
+ >>> generator(prompt) # doctest: +SKIP
+ ```
+
+* masked: the model's objective is to predict a masked token in a sequence with full access to the tokens in the sequence
+
+ ```py
+ >>> text = "Hugging Face is a community-based open-source for machine learning."
+ >>> fill_mask = pipeline(task="fill-mask")
+ >>> preds = fill_mask(text, top_k=1)
+ >>> preds = [
+ ... {
+ ... "score": round(pred["score"], 4),
+ ... "token": pred["token"],
+ ... "token_str": pred["token_str"],
+ ... "sequence": pred["sequence"],
+ ... }
+ ... for pred in preds
+ ... ]
+ >>> preds
+ [{'score': 0.2236,
+ 'token': 1761,
+ 'token_str': ' platform',
+ 'sequence': 'Hugging Face is a community-based open-source platform for machine learning.'}]
+ ```
+
+## Multimodal
+
+Multimodal tasks require a model to process multiple data modalities (text, image, audio, video) to solve a particular problem. Image captioning is an example of a multimodal task where the model takes an image as input and outputs a sequence of text describing the image or some properties of the image.
+
+Although multimodal models work with different data types or modalities, internally, the preprocessing steps help the model convert all the data types into embeddings (vectors or list of numbers that holds meaningful information about the data). For a task like image captioning, the model learns relationships between image embeddings and text embeddings.
+
+### Document question answering
+
+Document question answering is a task that answers natural language questions from a document. Unlike a token-level question answering task which takes text as input, document question answering takes an image of a document as input along with a question about the document and returns an answer. Document question answering can be used to parse structured documents and extract key information from it. In the example below, the total amount and change due can be extracted from a receipt.
+
+```py
+>>> from transformers import pipeline
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://huggingface.co/datasets/hf-internal-testing/example-documents/resolve/main/jpeg_images/2.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> doc_question_answerer = pipeline("document-question-answering", model="magorshunov/layoutlm-invoices")
+>>> preds = doc_question_answerer(
+... question="What is the total amount?",
+... image=image,
+... )
+>>> preds
+[{'score': 0.8531, 'answer': '17,000', 'start': 4, 'end': 4}]
+```
+
+Hopefully, this page has given you some more background information about all the types of tasks in each modality and the practical importance of each one. In the next [section](tasks_explained), you'll learn **how** ๐ค Transformers work to solve these tasks.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/asr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/asr.md
new file mode 100644
index 0000000000000000000000000000000000000000..e8884d327b565b1c994f7c6f8c8101f99055994f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/asr.md
@@ -0,0 +1,371 @@
+
+
+# Automatic speech recognition
+
+[[open-in-colab]]
+
+
+
+Automatic speech recognition (ASR) converts a speech signal to text, mapping a sequence of audio inputs to text outputs. Virtual assistants like Siri and Alexa use ASR models to help users every day, and there are many other useful user-facing applications like live captioning and note-taking during meetings.
+
+This guide will show you how to:
+
+1. Fine-tune [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base) on the [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) dataset to transcribe audio to text.
+2. Use your fine-tuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/automatic-speech-recognition)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate jiwer
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load MInDS-14 dataset
+
+Start by loading a smaller subset of the [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) dataset from the ๐ค Datasets library. This will give you a chance to experiment and make sure everything works before spending more time training on the full dataset.
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> minds = load_dataset("PolyAI/minds14", name="en-US", split="train[:100]")
+```
+
+Split the dataset's `train` split into a train and test set with the [`~Dataset.train_test_split`] method:
+
+```py
+>>> minds = minds.train_test_split(test_size=0.2)
+```
+
+Then take a look at the dataset:
+
+```py
+>>> minds
+DatasetDict({
+ train: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 16
+ })
+ test: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 4
+ })
+})
+```
+
+While the dataset contains a lot of useful information, like `lang_id` and `english_transcription`, this guide focuses on the `audio` and `transcription`. Remove the other columns with the [`~datasets.Dataset.remove_columns`] method:
+
+```py
+>>> minds = minds.remove_columns(["english_transcription", "intent_class", "lang_id"])
+```
+
+Review the example again:
+
+```py
+>>> minds["train"][0]
+{'audio': {'array': array([-0.00024414, 0. , 0. , ..., 0.00024414,
+ 0.00024414, 0.00024414], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'sampling_rate': 8000},
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'transcription': "hi I'm trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing"}
+```
+
+There are two fields:
+
+- `audio`: a 1-dimensional `array` of the speech signal that must be called to load and resample the audio file.
+- `transcription`: the target text.
+
+## Preprocess
+
+The next step is to load a Wav2Vec2 processor to process the audio signal:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base")
+```
+
+The MInDS-14 dataset has a sampling rate of 8000Hz (you can find this information in its [dataset card](https://huggingface.co/datasets/PolyAI/minds14)), which means you'll need to resample the dataset to 16000Hz to use the pretrained Wav2Vec2 model:
+
+```py
+>>> minds = minds.cast_column("audio", Audio(sampling_rate=16_000))
+>>> minds["train"][0]
+{'audio': {'array': array([-2.38064706e-04, -1.58618059e-04, -5.43987835e-06, ...,
+ 2.78103951e-04, 2.38446111e-04, 1.18740834e-04], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'sampling_rate': 16000},
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'transcription': "hi I'm trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing"}
+```
+
+As you can see in the `transcription` above, the text contains a mix of uppercase and lowercase characters. The Wav2Vec2 tokenizer is only trained on uppercase characters so you'll need to make sure the text matches the tokenizer's vocabulary:
+
+```py
+>>> def uppercase(example):
+... return {"transcription": example["transcription"].upper()}
+
+
+>>> minds = minds.map(uppercase)
+```
+
+Now create a preprocessing function that:
+
+1. Calls the `audio` column to load and resample the audio file.
+2. Extracts the `input_values` from the audio file and tokenize the `transcription` column with the processor.
+
+```py
+>>> def prepare_dataset(batch):
+... audio = batch["audio"]
+... batch = processor(audio["array"], sampling_rate=audio["sampling_rate"], text=batch["transcription"])
+... batch["input_length"] = len(batch["input_values"][0])
+... return batch
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] function. You can speed up `map` by increasing the number of processes with the `num_proc` parameter. Remove the columns you don't need with the [`~datasets.Dataset.remove_columns`] method:
+
+```py
+>>> encoded_minds = minds.map(prepare_dataset, remove_columns=minds.column_names["train"], num_proc=4)
+```
+
+๐ค Transformers doesn't have a data collator for ASR, so you'll need to adapt the [`DataCollatorWithPadding`] to create a batch of examples. It'll also dynamically pad your text and labels to the length of the longest element in its batch (instead of the entire dataset) so they are a uniform length. While it is possible to pad your text in the `tokenizer` function by setting `padding=True`, dynamic padding is more efficient.
+
+Unlike other data collators, this specific data collator needs to apply a different padding method to `input_values` and `labels`:
+
+```py
+>>> import torch
+
+>>> from dataclasses import dataclass, field
+>>> from typing import Any, Dict, List, Optional, Union
+
+
+>>> @dataclass
+... class DataCollatorCTCWithPadding:
+... processor: AutoProcessor
+... padding: Union[bool, str] = "longest"
+
+... def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:
+... # split inputs and labels since they have to be of different lengths and need
+... # different padding methods
+... input_features = [{"input_values": feature["input_values"][0]} for feature in features]
+... label_features = [{"input_ids": feature["labels"]} for feature in features]
+
+... batch = self.processor.pad(input_features, padding=self.padding, return_tensors="pt")
+
+... labels_batch = self.processor.pad(labels=label_features, padding=self.padding, return_tensors="pt")
+
+... # replace padding with -100 to ignore loss correctly
+... labels = labels_batch["input_ids"].masked_fill(labels_batch.attention_mask.ne(1), -100)
+
+... batch["labels"] = labels
+
+... return batch
+```
+
+Now instantiate your `DataCollatorForCTCWithPadding`:
+
+```py
+>>> data_collator = DataCollatorCTCWithPadding(processor=processor, padding="longest")
+```
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load an evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [word error rate](https://huggingface.co/spaces/evaluate-metric/wer) (WER) metric (refer to the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about loading and computing metrics):
+
+```py
+>>> import evaluate
+
+>>> wer = evaluate.load("wer")
+```
+
+Then create a function that passes your predictions and labels to [`~evaluate.EvaluationModule.compute`] to calculate the WER:
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(pred):
+... pred_logits = pred.predictions
+... pred_ids = np.argmax(pred_logits, axis=-1)
+
+... pred.label_ids[pred.label_ids == -100] = processor.tokenizer.pad_token_id
+
+... pred_str = processor.batch_decode(pred_ids)
+... label_str = processor.batch_decode(pred.label_ids, group_tokens=False)
+
+... wer = wer.compute(predictions=pred_str, references=label_str)
+
+... return {"wer": wer}
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You are now ready to start training your model! Load Wav2Vec2 with [`AutoModelForCTC`]. Specify the reduction to apply with the `ctc_loss_reduction` parameter. It is often better to use the average instead of the default summation:
+
+```py
+>>> from transformers import AutoModelForCTC, TrainingArguments, Trainer
+
+>>> model = AutoModelForCTC.from_pretrained(
+... "facebook/wav2vec2-base",
+... ctc_loss_reduction="mean",
+... pad_token_id=processor.tokenizer.pad_token_id,
+... )
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the WER and save the training checkpoint.
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to fine-tune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_asr_mind_model",
+... per_device_train_batch_size=8,
+... gradient_accumulation_steps=2,
+... learning_rate=1e-5,
+... warmup_steps=500,
+... max_steps=2000,
+... gradient_checkpointing=True,
+... fp16=True,
+... group_by_length=True,
+... eval_strategy="steps",
+... per_device_eval_batch_size=8,
+... save_steps=1000,
+... eval_steps=1000,
+... logging_steps=25,
+... load_best_model_at_end=True,
+... metric_for_best_model="wer",
+... greater_is_better=False,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=encoded_minds["train"],
+... eval_dataset=encoded_minds["test"],
+... processing_class=processor,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so it can be accessible to everyone:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+For a more in-depth example of how to fine-tune a model for automatic speech recognition, take a look at this blog [post](https://huggingface.co/blog/fine-tune-wav2vec2-english) for English ASR and this [post](https://huggingface.co/blog/fine-tune-xlsr-wav2vec2) for multilingual ASR.
+
+
+
+## Inference
+
+Great, now that you've fine-tuned a model, you can use it for inference!
+
+Load an audio file you'd like to run inference on. Remember to resample the sampling rate of the audio file to match the sampling rate of the model if you need to!
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", "en-US", split="train")
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
+>>> sampling_rate = dataset.features["audio"].sampling_rate
+>>> audio_file = dataset[0]["audio"]["path"]
+```
+
+The simplest way to try out your fine-tuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for automatic speech recognition with your model, and pass your audio file to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline("automatic-speech-recognition", model="stevhliu/my_awesome_asr_minds_model")
+>>> transcriber(audio_file)
+{'text': 'I WOUD LIKE O SET UP JOINT ACOUNT WTH Y PARTNER'}
+```
+
+
+
+The transcription is decent, but it could be better! Try finetuning your model on more examples to get even better results!
+
+
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+Load a processor to preprocess the audio file and transcription and return the `input` as PyTorch tensors:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("stevhliu/my_awesome_asr_mind_model")
+>>> inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
+```
+
+Pass your inputs to the model and return the logits:
+
+```py
+>>> from transformers import AutoModelForCTC
+
+>>> model = AutoModelForCTC.from_pretrained("stevhliu/my_awesome_asr_mind_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+Get the predicted `input_ids` with the highest probability, and use the processor to decode the predicted `input_ids` back into text:
+
+```py
+>>> import torch
+
+>>> predicted_ids = torch.argmax(logits, dim=-1)
+>>> transcription = processor.batch_decode(predicted_ids)
+>>> transcription
+['I WOUL LIKE O SET UP JOINT ACOUNT WTH Y PARTNER']
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/audio_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/audio_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..973f95e1e9555dd77e3a5a6b48a5131598dfa2df
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/audio_classification.md
@@ -0,0 +1,324 @@
+
+
+# Audio classification
+
+[[open-in-colab]]
+
+
+
+Audio classification - just like with text - assigns a class label as output from the input data. The only difference is instead of text inputs, you have raw audio waveforms. Some practical applications of audio classification include identifying speaker intent, language classification, and even animal species by their sounds.
+
+This guide will show you how to:
+
+1. Fine-tune [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base) on the [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) dataset to classify speaker intent.
+2. Use your fine-tuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/audio-classification)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load MInDS-14 dataset
+
+Start by loading the MInDS-14 dataset from the ๐ค Datasets library:
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> minds = load_dataset("PolyAI/minds14", name="en-US", split="train")
+```
+
+Split the dataset's `train` split into a smaller train and test set with the [`~datasets.Dataset.train_test_split`] method. This will give you a chance to experiment and make sure everything works before spending more time on the full dataset.
+
+```py
+>>> minds = minds.train_test_split(test_size=0.2)
+```
+
+Then take a look at the dataset:
+
+```py
+>>> minds
+DatasetDict({
+ train: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 450
+ })
+ test: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 113
+ })
+})
+```
+
+While the dataset contains a lot of useful information, like `lang_id` and `english_transcription`, you will focus on the `audio` and `intent_class` in this guide. Remove the other columns with the [`~datasets.Dataset.remove_columns`] method:
+
+```py
+>>> minds = minds.remove_columns(["path", "transcription", "english_transcription", "lang_id"])
+```
+
+Here's an example:
+
+```py
+>>> minds["train"][0]
+{'audio': {'array': array([ 0. , 0. , 0. , ..., -0.00048828,
+ -0.00024414, -0.00024414], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602b9a5fbb1e6d0fbce91f52.wav',
+ 'sampling_rate': 8000},
+ 'intent_class': 2}
+```
+
+There are two fields:
+
+- `audio`: a 1-dimensional `array` of the speech signal that must be called to load and resample the audio file.
+- `intent_class`: represents the class id of the speaker's intent.
+
+To make it easier for the model to get the label name from the label id, create a dictionary that maps the label name to an integer and vice versa:
+
+```py
+>>> labels = minds["train"].features["intent_class"].names
+>>> label2id, id2label = dict(), dict()
+>>> for i, label in enumerate(labels):
+... label2id[label] = str(i)
+... id2label[str(i)] = label
+```
+
+Now you can convert the label id to a label name:
+
+```py
+>>> id2label[str(2)]
+'app_error'
+```
+
+## Preprocess
+
+The next step is to load a Wav2Vec2 feature extractor to process the audio signal:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
+```
+
+The MInDS-14 dataset has a sampling rate of 8kHz (you can find this information in its [dataset card](https://huggingface.co/datasets/PolyAI/minds14)), which means you'll need to resample the dataset to 16kHz to use the pretrained Wav2Vec2 model:
+
+```py
+>>> minds = minds.cast_column("audio", Audio(sampling_rate=16_000))
+>>> minds["train"][0]
+{'audio': {'array': array([ 2.2098757e-05, 4.6582241e-05, -2.2803260e-05, ...,
+ -2.8419291e-04, -2.3305941e-04, -1.1425107e-04], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602b9a5fbb1e6d0fbce91f52.wav',
+ 'sampling_rate': 16000},
+ 'intent_class': 2}
+```
+
+Now create a preprocessing function that:
+
+1. Calls the `audio` column to load, and if necessary, resample the audio file.
+2. Checks if the sampling rate of the audio file matches the sampling rate of the audio data a model was pretrained with. You can find this information in the Wav2Vec2 [model card](https://huggingface.co/facebook/wav2vec2-base).
+3. Set a maximum input length to batch longer inputs without truncating them.
+
+```py
+>>> def preprocess_function(examples):
+... audio_arrays = [x["array"] for x in examples["audio"]]
+... inputs = feature_extractor(
+... audio_arrays, sampling_rate=feature_extractor.sampling_rate, max_length=16000, truncation=True
+... )
+... return inputs
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] function. You can speed up `map` by setting `batched=True` to process multiple elements of the dataset at once. Remove unnecessary columns and rename `intent_class` to `label`, as required by the model:
+
+```py
+>>> encoded_minds = minds.map(preprocess_function, remove_columns="audio", batched=True)
+>>> encoded_minds = encoded_minds.rename_column("intent_class", "label")
+```
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load an evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [accuracy](https://huggingface.co/spaces/evaluate-metric/accuracy) metric (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric):
+
+```py
+>>> import evaluate
+
+>>> accuracy = evaluate.load("accuracy")
+```
+
+Then create a function that passes your predictions and labels to [`~evaluate.EvaluationModule.compute`] to calculate the accuracy:
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions = np.argmax(eval_pred.predictions, axis=1)
+... return accuracy.compute(predictions=predictions, references=eval_pred.label_ids)
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load Wav2Vec2 with [`AutoModelForAudioClassification`] along with the number of expected labels, and the label mappings:
+
+```py
+>>> from transformers import AutoModelForAudioClassification, TrainingArguments, Trainer
+
+>>> num_labels = len(id2label)
+>>> model = AutoModelForAudioClassification.from_pretrained(
+... "facebook/wav2vec2-base", num_labels=num_labels, label2id=label2id, id2label=id2label
+... )
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir`, which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the accuracy and save the training checkpoint.
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to fine-tune your model.
+
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_mind_model",
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... learning_rate=3e-5,
+... per_device_train_batch_size=32,
+... gradient_accumulation_steps=4,
+... per_device_eval_batch_size=32,
+... num_train_epochs=10,
+... warmup_ratio=0.1,
+... logging_steps=10,
+... load_best_model_at_end=True,
+... metric_for_best_model="accuracy",
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=encoded_minds["train"],
+... eval_dataset=encoded_minds["test"],
+... processing_class=feature_extractor,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+For a more in-depth example of how to fine-tune a model for audio classification, take a look at the corresponding [PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb).
+
+
+
+## Inference
+
+Great, now that you've fine-tuned a model, you can use it for inference!
+
+Load an audio file for inference. Remember to resample the sampling rate of the audio file to match the model's sampling rate, if necessary.
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
+>>> sampling_rate = dataset.features["audio"].sampling_rate
+>>> audio_file = dataset[0]["audio"]["path"]
+```
+
+The simplest way to try out your fine-tuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for audio classification with your model, and pass your audio file to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("audio-classification", model="stevhliu/my_awesome_minds_model")
+>>> classifier(audio_file)
+[
+ {'score': 0.09766869246959686, 'label': 'cash_deposit'},
+ {'score': 0.07998877018690109, 'label': 'app_error'},
+ {'score': 0.0781070664525032, 'label': 'joint_account'},
+ {'score': 0.07667109370231628, 'label': 'pay_bill'},
+ {'score': 0.0755252093076706, 'label': 'balance'}
+]
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+Load a feature extractor to preprocess the audio file and return the `input` as PyTorch tensors:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("stevhliu/my_awesome_minds_model")
+>>> inputs = feature_extractor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
+```
+
+Pass your inputs to the model and return the logits:
+
+```py
+>>> from transformers import AutoModelForAudioClassification
+
+>>> model = AutoModelForAudioClassification.from_pretrained("stevhliu/my_awesome_minds_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+Get the class with the highest probability, and use the model's `id2label` mapping to convert it to a label:
+
+```py
+>>> import torch
+
+>>> predicted_class_ids = torch.argmax(logits).item()
+>>> predicted_label = model.config.id2label[predicted_class_ids]
+>>> predicted_label
+'cash_deposit'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/document_question_answering.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/document_question_answering.md
new file mode 100644
index 0000000000000000000000000000000000000000..d83e025c409019330f762b551f17e944a50de23b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/document_question_answering.md
@@ -0,0 +1,492 @@
+
+
+# Document Question Answering
+
+[[open-in-colab]]
+
+Document Question Answering, also referred to as Document Visual Question Answering, is a task that involves providing
+answers to questions posed about document images. The input to models supporting this task is typically a combination of an image and
+a question, and the output is an answer expressed in natural language. These models utilize multiple modalities, including
+text, the positions of words (bounding boxes), and the image itself.
+
+This guide illustrates how to:
+
+- Fine-tune [LayoutLMv2](../model_doc/layoutlmv2) on the [DocVQA dataset](https://huggingface.co/datasets/nielsr/docvqa_1200_examples_donut).
+- Use your fine-tuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/image-to-text)
+
+
+
+LayoutLMv2 solves the document question-answering task by adding a question-answering head on top of the final hidden
+states of the tokens, to predict the positions of the start and end tokens of the
+answer. In other words, the problem is treated as extractive question answering: given the context, extract which piece
+of information answers the question. The context comes from the output of an OCR engine, here it is Google's Tesseract.
+
+Before you begin, make sure you have all the necessary libraries installed. LayoutLMv2 depends on detectron2, torchvision and tesseract.
+
+```bash
+pip install -q transformers datasets
+```
+
+```bash
+pip install 'git+https://github.com/facebookresearch/detectron2.git'
+pip install torchvision
+```
+
+```bash
+sudo apt install tesseract-ocr
+pip install -q pytesseract
+```
+
+Once you have installed all of the dependencies, restart your runtime.
+
+We encourage you to share your model with the community. Log in to your Hugging Face account to upload it to the ๐ค Hub.
+When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+Let's define some global variables.
+
+```py
+>>> model_checkpoint = "microsoft/layoutlmv2-base-uncased"
+>>> batch_size = 4
+```
+
+## Load the data
+
+In this guide we use a small sample of preprocessed DocVQA that you can find on ๐ค Hub. If you'd like to use the full
+DocVQA dataset, you can register and download it on [DocVQA homepage](https://rrc.cvc.uab.es/?ch=17). If you do so, to
+proceed with this guide check out [how to load files into a ๐ค dataset](https://huggingface.co/docs/datasets/loading#local-and-remote-files).
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("nielsr/docvqa_1200_examples")
+>>> dataset
+DatasetDict({
+ train: Dataset({
+ features: ['id', 'image', 'query', 'answers', 'words', 'bounding_boxes', 'answer'],
+ num_rows: 1000
+ })
+ test: Dataset({
+ features: ['id', 'image', 'query', 'answers', 'words', 'bounding_boxes', 'answer'],
+ num_rows: 200
+ })
+})
+```
+
+As you can see, the dataset is split into train and test sets already. Take a look at a random example to familiarize
+yourself with the features.
+
+```py
+>>> dataset["train"].features
+```
+
+Here's what the individual fields represent:
+* `id`: the example's id
+* `image`: a PIL.Image.Image object containing the document image
+* `query`: the question string - natural language asked question, in several languages
+* `answers`: a list of correct answers provided by human annotators
+* `words` and `bounding_boxes`: the results of OCR, which we will not use here
+* `answer`: an answer matched by a different model which we will not use here
+
+Let's leave only English questions, and drop the `answer` feature which appears to contain predictions by another model.
+We'll also take the first of the answers from the set provided by the annotators. Alternatively, you can randomly sample it.
+
+```py
+>>> updated_dataset = dataset.map(lambda example: {"question": example["query"]["en"]}, remove_columns=["query"])
+>>> updated_dataset = updated_dataset.map(
+... lambda example: {"answer": example["answers"][0]}, remove_columns=["answer", "answers"]
+... )
+```
+
+Note that the LayoutLMv2 checkpoint that we use in this guide has been trained with `max_position_embeddings = 512` (you can
+find this information in the [checkpoint's `config.json` file](https://huggingface.co/microsoft/layoutlmv2-base-uncased/blob/main/config.json#L18)).
+We can truncate the examples but to avoid the situation where the answer might be at the end of a large document and end up truncated,
+here we'll remove the few examples where the embedding is likely to end up longer than 512.
+If most of the documents in your dataset are long, you can implement a sliding window strategy - check out [this notebook](https://github.com/huggingface/notebooks/blob/main/examples/question_answering.ipynb) for details.
+
+```py
+>>> updated_dataset = updated_dataset.filter(lambda x: len(x["words"]) + len(x["question"].split()) < 512)
+```
+
+At this point let's also remove the OCR features from this dataset. These are a result of OCR for fine-tuning a different
+model. They would still require some processing if we wanted to use them, as they do not match the input requirements
+of the model we use in this guide. Instead, we can use the [`LayoutLMv2Processor`] on the original data for both OCR and
+tokenization. This way we'll get the inputs that match model's expected input. If you want to process images manually,
+check out the [`LayoutLMv2` model documentation](../model_doc/layoutlmv2) to learn what input format the model expects.
+
+```py
+>>> updated_dataset = updated_dataset.remove_columns("words")
+>>> updated_dataset = updated_dataset.remove_columns("bounding_boxes")
+```
+
+Finally, the data exploration won't be complete if we don't peek at an image example.
+
+```py
+>>> updated_dataset["train"][11]["image"]
+```
+
+
+
+
+
+## Preprocess the data
+
+The Document Question Answering task is a multimodal task, and you need to make sure that the inputs from each modality
+are preprocessed according to the model's expectations. Let's start by loading the [`LayoutLMv2Processor`], which internally combines an image processor that can handle image data and a tokenizer that can encode text data.
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained(model_checkpoint)
+```
+
+### Preprocessing document images
+
+First, let's prepare the document images for the model with the help of the `image_processor` from the processor.
+By default, image processor resizes the images to 224x224, makes sure they have the correct order of color channels,
+applies OCR with tesseract to get words and normalized bounding boxes. In this tutorial, all of these defaults are exactly what we need.
+Write a function that applies the default image processing to a batch of images and returns the results of OCR.
+
+```py
+>>> image_processor = processor.image_processor
+
+
+>>> def get_ocr_words_and_boxes(examples):
+... images = [image.convert("RGB") for image in examples["image"]]
+... encoded_inputs = image_processor(images)
+
+... examples["image"] = encoded_inputs.pixel_values
+... examples["words"] = encoded_inputs.words
+... examples["boxes"] = encoded_inputs.boxes
+
+... return examples
+```
+
+To apply this preprocessing to the entire dataset in a fast way, use [`~datasets.Dataset.map`].
+
+```py
+>>> dataset_with_ocr = updated_dataset.map(get_ocr_words_and_boxes, batched=True, batch_size=2)
+```
+
+### Preprocessing text data
+
+Once we have applied OCR to the images, we need to encode the text part of the dataset to prepare it for the model.
+This involves converting the words and boxes that we got in the previous step to token-level `input_ids`, `attention_mask`,
+`token_type_ids` and `bbox`. For preprocessing text, we'll need the `tokenizer` from the processor.
+
+```py
+>>> tokenizer = processor.tokenizer
+```
+
+On top of the preprocessing mentioned above, we also need to add the labels for the model. For `xxxForQuestionAnswering` models
+in ๐ค Transformers, the labels consist of the `start_positions` and `end_positions`, indicating which token is at the
+start and which token is at the end of the answer.
+
+Let's start with that. Define a helper function that can find a sublist (the answer split into words) in a larger list (the words list).
+
+This function will take two lists as input, `words_list` and `answer_list`. It will then iterate over the `words_list` and check
+if the current word in the `words_list` (words_list[i]) is equal to the first word of answer_list (answer_list[0]) and if
+the sublist of `words_list` starting from the current word and of the same length as `answer_list` is equal `to answer_list`.
+If this condition is true, it means that a match has been found, and the function will record the match, its starting index (idx),
+and its ending index (idx + len(answer_list) - 1). If more than one match was found, the function will return only the first one.
+If no match is found, the function returns (`None`, 0, and 0).
+
+```py
+>>> def subfinder(words_list, answer_list):
+... matches = []
+... start_indices = []
+... end_indices = []
+... for idx, i in enumerate(range(len(words_list))):
+... if words_list[i] == answer_list[0] and words_list[i : i + len(answer_list)] == answer_list:
+... matches.append(answer_list)
+... start_indices.append(idx)
+... end_indices.append(idx + len(answer_list) - 1)
+... if matches:
+... return matches[0], start_indices[0], end_indices[0]
+... else:
+... return None, 0, 0
+```
+
+To illustrate how this function finds the position of the answer, let's use it on an example:
+
+```py
+>>> example = dataset_with_ocr["train"][1]
+>>> words = [word.lower() for word in example["words"]]
+>>> match, word_idx_start, word_idx_end = subfinder(words, example["answer"].lower().split())
+>>> print("Question: ", example["question"])
+>>> print("Words:", words)
+>>> print("Answer: ", example["answer"])
+>>> print("start_index", word_idx_start)
+>>> print("end_index", word_idx_end)
+Question: Who is in cc in this letter?
+Words: ['wie', 'baw', 'brown', '&', 'williamson', 'tobacco', 'corporation', 'research', '&', 'development', 'internal', 'correspondence', 'to:', 'r.', 'h.', 'honeycutt', 'ce:', 't.f.', 'riehl', 'from:', '.', 'c.j.', 'cook', 'date:', 'may', '8,', '1995', 'subject:', 'review', 'of', 'existing', 'brainstorming', 'ideas/483', 'the', 'major', 'function', 'of', 'the', 'product', 'innovation', 'graup', 'is', 'to', 'develop', 'marketable', 'nove!', 'products', 'that', 'would', 'be', 'profitable', 'to', 'manufacture', 'and', 'sell.', 'novel', 'is', 'defined', 'as:', 'of', 'a', 'new', 'kind,', 'or', 'different', 'from', 'anything', 'seen', 'or', 'known', 'before.', 'innovation', 'is', 'defined', 'as:', 'something', 'new', 'or', 'different', 'introduced;', 'act', 'of', 'innovating;', 'introduction', 'of', 'new', 'things', 'or', 'methods.', 'the', 'products', 'may', 'incorporate', 'the', 'latest', 'technologies,', 'materials', 'and', 'know-how', 'available', 'to', 'give', 'then', 'a', 'unique', 'taste', 'or', 'look.', 'the', 'first', 'task', 'of', 'the', 'product', 'innovation', 'group', 'was', 'to', 'assemble,', 'review', 'and', 'categorize', 'a', 'list', 'of', 'existing', 'brainstorming', 'ideas.', 'ideas', 'were', 'grouped', 'into', 'two', 'major', 'categories', 'labeled', 'appearance', 'and', 'taste/aroma.', 'these', 'categories', 'are', 'used', 'for', 'novel', 'products', 'that', 'may', 'differ', 'from', 'a', 'visual', 'and/or', 'taste/aroma', 'point', 'of', 'view', 'compared', 'to', 'canventional', 'cigarettes.', 'other', 'categories', 'include', 'a', 'combination', 'of', 'the', 'above,', 'filters,', 'packaging', 'and', 'brand', 'extensions.', 'appearance', 'this', 'category', 'is', 'used', 'for', 'novel', 'cigarette', 'constructions', 'that', 'yield', 'visually', 'different', 'products', 'with', 'minimal', 'changes', 'in', 'smoke', 'chemistry', 'two', 'cigarettes', 'in', 'cne.', 'emulti-plug', 'te', 'build', 'yaur', 'awn', 'cigarette.', 'eswitchable', 'menthol', 'or', 'non', 'menthol', 'cigarette.', '*cigarettes', 'with', 'interspaced', 'perforations', 'to', 'enable', 'smoker', 'to', 'separate', 'unburned', 'section', 'for', 'future', 'smoking.', 'ยซshort', 'cigarette,', 'tobacco', 'section', '30', 'mm.', 'ยซextremely', 'fast', 'buming', 'cigarette.', 'ยซnovel', 'cigarette', 'constructions', 'that', 'permit', 'a', 'significant', 'reduction', 'iretobacco', 'weight', 'while', 'maintaining', 'smoking', 'mechanics', 'and', 'visual', 'characteristics.', 'higher', 'basis', 'weight', 'paper:', 'potential', 'reduction', 'in', 'tobacco', 'weight.', 'ยซmore', 'rigid', 'tobacco', 'column;', 'stiffing', 'agent', 'for', 'tobacco;', 'e.g.', 'starch', '*colored', 'tow', 'and', 'cigarette', 'papers;', 'seasonal', 'promotions,', 'e.g.', 'pastel', 'colored', 'cigarettes', 'for', 'easter', 'or', 'in', 'an', 'ebony', 'and', 'ivory', 'brand', 'containing', 'a', 'mixture', 'of', 'all', 'black', '(black', 'paper', 'and', 'tow)', 'and', 'ail', 'white', 'cigarettes.', '499150498']
+Answer: T.F. Riehl
+start_index 17
+end_index 18
+```
+
+Once examples are encoded, however, they will look like this:
+
+```py
+>>> encoding = tokenizer(example["question"], example["words"], example["boxes"])
+>>> tokenizer.decode(encoding["input_ids"])
+[CLS] who is in cc in this letter? [SEP] wie baw brown & williamson tobacco corporation research & development ...
+```
+
+We'll need to find the position of the answer in the encoded input.
+* `token_type_ids` tells us which tokens are part of the question, and which ones are part of the document's words.
+* `tokenizer.cls_token_id` will help find the special token at the beginning of the input.
+* `word_ids` will help match the answer found in the original `words` to the same answer in the full encoded input and determine
+the start/end position of the answer in the encoded input.
+
+With that in mind, let's create a function to encode a batch of examples in the dataset:
+
+```py
+>>> def encode_dataset(examples, max_length=512):
+... questions = examples["question"]
+... words = examples["words"]
+... boxes = examples["boxes"]
+... answers = examples["answer"]
+
+... # encode the batch of examples and initialize the start_positions and end_positions
+... encoding = tokenizer(questions, words, boxes, max_length=max_length, padding="max_length", truncation=True)
+... start_positions = []
+... end_positions = []
+
+... # loop through the examples in the batch
+... for i in range(len(questions)):
+... cls_index = encoding["input_ids"][i].index(tokenizer.cls_token_id)
+
+... # find the position of the answer in example's words
+... words_example = [word.lower() for word in words[i]]
+... answer = answers[i]
+... match, word_idx_start, word_idx_end = subfinder(words_example, answer.lower().split())
+
+... if match:
+... # if match is found, use `token_type_ids` to find where words start in the encoding
+... token_type_ids = encoding["token_type_ids"][i]
+... token_start_index = 0
+... while token_type_ids[token_start_index] != 1:
+... token_start_index += 1
+
+... token_end_index = len(encoding["input_ids"][i]) - 1
+... while token_type_ids[token_end_index] != 1:
+... token_end_index -= 1
+
+... word_ids = encoding.word_ids(i)[token_start_index : token_end_index + 1]
+... start_position = cls_index
+... end_position = cls_index
+
+... # loop over word_ids and increase `token_start_index` until it matches the answer position in words
+... # once it matches, save the `token_start_index` as the `start_position` of the answer in the encoding
+... for id in word_ids:
+... if id == word_idx_start:
+... start_position = token_start_index
+... else:
+... token_start_index += 1
+
+... # similarly loop over `word_ids` starting from the end to find the `end_position` of the answer
+... for id in word_ids[::-1]:
+... if id == word_idx_end:
+... end_position = token_end_index
+... else:
+... token_end_index -= 1
+
+... start_positions.append(start_position)
+... end_positions.append(end_position)
+
+... else:
+... start_positions.append(cls_index)
+... end_positions.append(cls_index)
+
+... encoding["image"] = examples["image"]
+... encoding["start_positions"] = start_positions
+... encoding["end_positions"] = end_positions
+
+... return encoding
+```
+
+Now that we have this preprocessing function, we can encode the entire dataset:
+
+```py
+>>> encoded_train_dataset = dataset_with_ocr["train"].map(
+... encode_dataset, batched=True, batch_size=2, remove_columns=dataset_with_ocr["train"].column_names
+... )
+>>> encoded_test_dataset = dataset_with_ocr["test"].map(
+... encode_dataset, batched=True, batch_size=2, remove_columns=dataset_with_ocr["test"].column_names
+... )
+```
+
+Let's check what the features of the encoded dataset look like:
+
+```py
+>>> encoded_train_dataset.features
+{'image': Sequence(feature=Sequence(feature=Sequence(feature=Value(dtype='uint8', id=None), length=-1, id=None), length=-1, id=None), length=-1, id=None),
+ 'input_ids': Sequence(feature=Value(dtype='int32', id=None), length=-1, id=None),
+ 'token_type_ids': Sequence(feature=Value(dtype='int8', id=None), length=-1, id=None),
+ 'attention_mask': Sequence(feature=Value(dtype='int8', id=None), length=-1, id=None),
+ 'bbox': Sequence(feature=Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None), length=-1, id=None),
+ 'start_positions': Value(dtype='int64', id=None),
+ 'end_positions': Value(dtype='int64', id=None)}
+```
+
+## Evaluation
+
+Evaluation for document question answering requires a significant amount of postprocessing. To avoid taking up too much
+of your time, this guide skips the evaluation step. The [`Trainer`] still calculates the evaluation loss during training so
+you're not completely in the dark about your model's performance. Extractive question answering is typically evaluated using F1/exact match.
+If you'd like to implement it yourself, check out the [Question Answering chapter](https://huggingface.co/course/chapter7/7?fw=pt#postprocessing)
+of the Hugging Face course for inspiration.
+
+## Train
+
+Congratulations! You've successfully navigated the toughest part of this guide and now you are ready to train your own model.
+Training involves the following steps:
+* Load the model with [`AutoModelForDocumentQuestionAnswering`] using the same checkpoint as in the preprocessing.
+* Define your training hyperparameters in [`TrainingArguments`].
+* Define a function to batch examples together, here the [`DefaultDataCollator`] will do just fine
+* Pass the training arguments to [`Trainer`] along with the model, dataset, and data collator.
+* Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> from transformers import AutoModelForDocumentQuestionAnswering
+
+>>> model = AutoModelForDocumentQuestionAnswering.from_pretrained(model_checkpoint)
+```
+
+In the [`TrainingArguments`] use `output_dir` to specify where to save your model, and configure hyperparameters as you see fit.
+If you wish to share your model with the community, set `push_to_hub` to `True` (you must be signed in to Hugging Face to upload your model).
+In this case the `output_dir` will also be the name of the repo where your model checkpoint will be pushed.
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> # REPLACE THIS WITH YOUR REPO ID
+>>> repo_id = "MariaK/layoutlmv2-base-uncased_finetuned_docvqa"
+
+>>> training_args = TrainingArguments(
+... output_dir=repo_id,
+... per_device_train_batch_size=4,
+... num_train_epochs=20,
+... save_steps=200,
+... logging_steps=50,
+... eval_strategy="steps",
+... learning_rate=5e-5,
+... save_total_limit=2,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+```
+
+Define a simple data collator to batch examples together.
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+Finally, bring everything together, and call [`~Trainer.train`]:
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=data_collator,
+... train_dataset=encoded_train_dataset,
+... eval_dataset=encoded_test_dataset,
+... processing_class=processor,
+... )
+
+>>> trainer.train()
+```
+
+To add the final model to ๐ค Hub, create a model card and call `push_to_hub`:
+
+```py
+>>> trainer.create_model_card()
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+Now that you have finetuned a LayoutLMv2 model, and uploaded it to the ๐ค Hub, you can use it for inference. The simplest
+way to try out your finetuned model for inference is to use it in a [`Pipeline`].
+
+Let's take an example:
+```py
+>>> example = dataset["test"][2]
+>>> question = example["query"]["en"]
+>>> image = example["image"]
+>>> print(question)
+>>> print(example["answers"])
+'Who is โpresidingโ TRRF GENERAL SESSION (PART 1)?'
+['TRRF Vice President', 'lee a. waller']
+```
+
+Next, instantiate a pipeline for
+document question answering with your model, and pass the image + question combination to it.
+
+```py
+>>> from transformers import pipeline
+
+>>> qa_pipeline = pipeline("document-question-answering", model="MariaK/layoutlmv2-base-uncased_finetuned_docvqa")
+>>> qa_pipeline(image, question)
+[{'score': 0.9949808120727539,
+ 'answer': 'Lee A. Waller',
+ 'start': 55,
+ 'end': 57}]
+```
+
+You can also manually replicate the results of the pipeline if you'd like:
+1. Take an image and a question, prepare them for the model using the processor from your model.
+2. Forward the result or preprocessing through the model.
+3. The model returns `start_logits` and `end_logits`, which indicate which token is at the start of the answer and
+which token is at the end of the answer. Both have shape (batch_size, sequence_length).
+4. Take an argmax on the last dimension of both the `start_logits` and `end_logits` to get the predicted `start_idx` and `end_idx`.
+5. Decode the answer with the tokenizer.
+
+```py
+>>> import torch
+>>> from transformers import AutoProcessor
+>>> from transformers import AutoModelForDocumentQuestionAnswering
+
+>>> processor = AutoProcessor.from_pretrained("MariaK/layoutlmv2-base-uncased_finetuned_docvqa")
+>>> model = AutoModelForDocumentQuestionAnswering.from_pretrained("MariaK/layoutlmv2-base-uncased_finetuned_docvqa")
+
+>>> with torch.no_grad():
+... encoding = processor(image.convert("RGB"), question, return_tensors="pt")
+... outputs = model(**encoding)
+... start_logits = outputs.start_logits
+... end_logits = outputs.end_logits
+... predicted_start_idx = start_logits.argmax(-1).item()
+... predicted_end_idx = end_logits.argmax(-1).item()
+
+>>> processor.tokenizer.decode(encoding.input_ids.squeeze()[predicted_start_idx : predicted_end_idx + 1])
+'lee a. waller'
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/idefics.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/idefics.md
new file mode 100644
index 0000000000000000000000000000000000000000..7e3335762ea43b442668b0b1ba16261fb1beb107
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/idefics.md
@@ -0,0 +1,425 @@
+
+
+# Image tasks with IDEFICS
+
+[[open-in-colab]]
+
+While individual tasks can be tackled by fine-tuning specialized models, an alternative approach
+that has recently emerged and gained popularity is to use large models for a diverse set of tasks without fine-tuning.
+For instance, large language models can handle such NLP tasks as summarization, translation, classification, and more.
+This approach is no longer limited to a single modality, such as text, and in this guide, we will illustrate how you can
+solve image-text tasks with a large multimodal model called IDEFICS.
+
+[IDEFICS](../model_doc/idefics) is an open-access vision and language model based on [Flamingo](https://huggingface.co/papers/2204.14198),
+a state-of-the-art visual language model initially developed by DeepMind. The model accepts arbitrary sequences of image
+and text inputs and generates coherent text as output. It can answer questions about images, describe visual content,
+create stories grounded in multiple images, and so on. IDEFICS comes in two variants - [80 billion parameters](https://huggingface.co/HuggingFaceM4/idefics-80b)
+and [9 billion parameters](https://huggingface.co/HuggingFaceM4/idefics-9b), both of which are available on the ๐ค Hub. For each variant, you can also find fine-tuned instructed
+versions of the model adapted for conversational use cases.
+
+This model is exceptionally versatile and can be used for a wide range of image and multimodal tasks. However,
+being a large model means it requires significant computational resources and infrastructure. It is up to you to decide whether
+this approach suits your use case better than fine-tuning specialized models for each individual task.
+
+In this guide, you'll learn how to:
+- [Load IDEFICS](#loading-the-model) and [load the quantized version of the model](#quantized-model)
+- Use IDEFICS for:
+ - [Image captioning](#image-captioning)
+ - [Prompted image captioning](#prompted-image-captioning)
+ - [Few-shot prompting](#few-shot-prompting)
+ - [Visual question answering](#visual-question-answering)
+ - [Image classification](#image-classification)
+ - [Image-guided text generation](#image-guided-text-generation)
+- [Run inference in batch mode](#running-inference-in-batch-mode)
+- [Run IDEFICS instruct for conversational use](#idefics-instruct-for-conversational-use)
+
+Before you begin, make sure you have all the necessary libraries installed.
+
+```bash
+pip install -q bitsandbytes sentencepiece accelerate transformers
+```
+
+
+To run the following examples with a non-quantized version of the model checkpoint you will need at least 20GB of GPU memory.
+
+
+## Loading the model
+
+Let's start by loading the model's 9 billion parameters checkpoint:
+
+```py
+>>> checkpoint = "HuggingFaceM4/idefics-9b"
+```
+
+Just like for other Transformers models, you need to load a processor and the model itself from the checkpoint.
+The IDEFICS processor wraps a [`LlamaTokenizer`] and IDEFICS image processor into a single processor to take care of
+preparing text and image inputs for the model.
+
+```py
+>>> import torch
+
+>>> from transformers import IdeficsForVisionText2Text, AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+
+>>> model = IdeficsForVisionText2Text.from_pretrained(checkpoint, torch_dtype=torch.bfloat16, device_map="auto")
+```
+
+Setting `device_map` to `"auto"` will automatically determine how to load and store the model weights in the most optimized
+manner given existing devices.
+
+### Quantized model
+
+If high-memory GPU availability is an issue, you can load the quantized version of the model. To load the model and the
+processor in 4bit precision, pass a `BitsAndBytesConfig` to the `from_pretrained` method and the model will be compressed
+on the fly while loading.
+
+```py
+>>> import torch
+>>> from transformers import IdeficsForVisionText2Text, AutoProcessor, BitsAndBytesConfig
+
+>>> quantization_config = BitsAndBytesConfig(
+... load_in_4bit=True,
+... bnb_4bit_compute_dtype=torch.float16,
+... )
+
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+
+>>> model = IdeficsForVisionText2Text.from_pretrained(
+... checkpoint,
+... quantization_config=quantization_config,
+... device_map="auto"
+... )
+```
+
+Now that you have the model loaded in one of the suggested ways, let's move on to exploring tasks that you can use IDEFICS for.
+
+## Image captioning
+Image captioning is the task of predicting a caption for a given image. A common application is to aid visually impaired
+people navigate through different situations, for instance, explore image content online.
+
+To illustrate the task, get an image to be captioned, e.g.:
+
+
+
+
+
+Photo by [Hendo Wang](https://unsplash.com/@hendoo).
+
+IDEFICS accepts text and image prompts. However, to caption an image, you do not have to provide a text prompt to the
+model, only the preprocessed input image. Without a text prompt, the model will start generating text from the
+BOS (beginning-of-sequence) token thus creating a caption.
+
+As image input to the model, you can use either an image object (`PIL.Image`) or a url from which the image can be retrieved.
+
+```py
+>>> prompt = [
+... "https://images.unsplash.com/photo-1583160247711-2191776b4b91?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3542&q=80",
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+A puppy in a flower bed
+```
+
+
+
+It is a good idea to include the `bad_words_ids` in the call to `generate` to avoid errors arising when increasing
+the `max_new_tokens`: the model will want to generate a new `` or `` token when there
+is no image being generated by the model.
+You can set it on-the-fly as in this guide, or store in the `GenerationConfig` as described in the [Text generation strategies](../generation_strategies) guide.
+
+
+## Prompted image captioning
+
+You can extend image captioning by providing a text prompt, which the model will continue given the image. Let's take
+another image to illustrate:
+
+
+
+
+
+Photo by [Denys Nevozhai](https://unsplash.com/@dnevozhai).
+
+Textual and image prompts can be passed to the model's processor as a single list to create appropriate inputs.
+
+```py
+>>> prompt = [
+... "https://images.unsplash.com/photo-1543349689-9a4d426bee8e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3501&q=80",
+... "This is an image of ",
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+This is an image of the Eiffel Tower in Paris, France.
+```
+
+## Few-shot prompting
+
+While IDEFICS demonstrates great zero-shot results, your task may require a certain format of the caption, or come with
+other restrictions or requirements that increase task's complexity. Few-shot prompting can be used to enable in-context learning.
+By providing examples in the prompt, you can steer the model to generate results that mimic the format of given examples.
+
+Let's use the previous image of the Eiffel Tower as an example for the model and build a prompt that demonstrates to the model
+that in addition to learning what the object in an image is, we would also like to get some interesting information about it.
+Then, let's see, if we can get the same response format for an image of the Statue of Liberty:
+
+
+
+
+
+Photo by [Juan Mayobre](https://unsplash.com/@jmayobres).
+
+```py
+>>> prompt = ["User:",
+... "https://images.unsplash.com/photo-1543349689-9a4d426bee8e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3501&q=80",
+... "Describe this image.\nAssistant: An image of the Eiffel Tower at night. Fun fact: the Eiffel Tower is the same height as an 81-storey building.\n",
+... "User:",
+... "https://images.unsplash.com/photo-1524099163253-32b7f0256868?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3387&q=80",
+... "Describe this image.\nAssistant:"
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=30, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+User: Describe this image.
+Assistant: An image of the Eiffel Tower at night. Fun fact: the Eiffel Tower is the same height as an 81-storey building.
+User: Describe this image.
+Assistant: An image of the Statue of Liberty. Fun fact: the Statue of Liberty is 151 feet tall.
+```
+
+Notice that just from a single example (i.e., 1-shot) the model has learned how to perform the task. For more complex tasks,
+feel free to experiment with a larger number of examples (e.g., 3-shot, 5-shot, etc.).
+
+## Visual question answering
+
+Visual Question Answering (VQA) is the task of answering open-ended questions based on an image. Similar to image
+captioning it can be used in accessibility applications, but also in education (reasoning about visual materials), customer
+service (questions about products based on images), and image retrieval.
+
+Let's get a new image for this task:
+
+
+
+
+
+Photo by [Jarritos Mexican Soda](https://unsplash.com/@jarritos).
+
+You can steer the model from image captioning to visual question answering by prompting it with appropriate instructions:
+
+```py
+>>> prompt = [
+... "Instruction: Provide an answer to the question. Use the image to answer.\n",
+... "https://images.unsplash.com/photo-1623944889288-cd147dbb517c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "Question: Where are these people and what's the weather like? Answer:"
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=20, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+Instruction: Provide an answer to the question. Use the image to answer.
+ Question: Where are these people and what's the weather like? Answer: They're in a park in New York City, and it's a beautiful day.
+```
+
+## Image classification
+
+IDEFICS is capable of classifying images into different categories without being explicitly trained on data containing
+labeled examples from those specific categories. Given a list of categories and using its image and text understanding
+capabilities, the model can infer which category the image likely belongs to.
+
+Say, we have this image of a vegetable stand:
+
+
+
+
+
+Photo by [Peter Wendt](https://unsplash.com/@peterwendt).
+
+We can instruct the model to classify the image into one of the categories that we have:
+
+```py
+>>> categories = ['animals','vegetables', 'city landscape', 'cars', 'office']
+>>> prompt = [f"Instruction: Classify the following image into a single category from the following list: {categories}.\n",
+... "https://images.unsplash.com/photo-1471193945509-9ad0617afabf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "Category: "
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=6, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+Instruction: Classify the following image into a single category from the following list: ['animals', 'vegetables', 'city landscape', 'cars', 'office'].
+Category: Vegetables
+```
+
+In the example above we instruct the model to classify the image into a single category, however, you can also prompt the model to do rank classification.
+
+## Image-guided text generation
+
+For more creative applications, you can use image-guided text generation to generate text based on an image. This can be
+useful to create descriptions of products, ads, descriptions of a scene, etc.
+
+Let's prompt IDEFICS to write a story based on a simple image of a red door:
+
+
+
+
+
+Photo by [Craig Tidball](https://unsplash.com/@devonshiremedia).
+
+```py
+>>> prompt = ["Instruction: Use the image to write a story. \n",
+... "https://images.unsplash.com/photo-1517086822157-2b0358e7684a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2203&q=80",
+... "Story: \n"]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, num_beams=2, max_new_tokens=200, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+Instruction: Use the image to write a story.
+ Story:
+Once upon a time, there was a little girl who lived in a house with a red door. She loved her red door. It was the prettiest door in the whole world.
+
+One day, the little girl was playing in her yard when she noticed a man standing on her doorstep. He was wearing a long black coat and a top hat.
+
+The little girl ran inside and told her mother about the man.
+
+Her mother said, โDonโt worry, honey. Heโs just a friendly ghost.โ
+
+The little girl wasnโt sure if she believed her mother, but she went outside anyway.
+
+When she got to the door, the man was gone.
+
+The next day, the little girl was playing in her yard again when she noticed the man standing on her doorstep.
+
+He was wearing a long black coat and a top hat.
+
+The little girl ran
+```
+
+Looks like IDEFICS noticed the pumpkin on the doorstep and went with a spooky Halloween story about a ghost.
+
+
+
+For longer outputs like this, you will greatly benefit from tweaking the text generation strategy. This can help
+you significantly improve the quality of the generated output. Check out [Text generation strategies](../generation_strategies)
+to learn more.
+
+
+## Running inference in batch mode
+
+All of the earlier sections illustrated IDEFICS for a single example. In a very similar fashion, you can run inference
+for a batch of examples by passing a list of prompts:
+
+```py
+>>> prompts = [
+... [ "https://images.unsplash.com/photo-1543349689-9a4d426bee8e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3501&q=80",
+... "This is an image of ",
+... ],
+... [ "https://images.unsplash.com/photo-1623944889288-cd147dbb517c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "This is an image of ",
+... ],
+... [ "https://images.unsplash.com/photo-1471193945509-9ad0617afabf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "This is an image of ",
+... ],
+... ]
+
+>>> inputs = processor(prompts, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> for i,t in enumerate(generated_text):
+... print(f"{i}:\n{t}\n")
+0:
+This is an image of the Eiffel Tower in Paris, France.
+
+1:
+This is an image of a couple on a picnic blanket.
+
+2:
+This is an image of a vegetable stand.
+```
+
+## IDEFICS instruct for conversational use
+
+For conversational use cases, you can find fine-tuned instructed versions of the model on the ๐ค Hub:
+`HuggingFaceM4/idefics-80b-instruct` and `HuggingFaceM4/idefics-9b-instruct`.
+
+These checkpoints are the result of fine-tuning the respective base models on a mixture of supervised and instruction
+fine-tuning datasets, which boosts the downstream performance while making the models more usable in conversational settings.
+
+The use and prompting for the conversational use is very similar to using the base models:
+
+```py
+>>> import torch
+>>> from transformers import IdeficsForVisionText2Text, AutoProcessor
+>>> from accelerate.test_utils.testing import get_backend
+
+>>> device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+>>> checkpoint = "HuggingFaceM4/idefics-9b-instruct"
+>>> model = IdeficsForVisionText2Text.from_pretrained(checkpoint, torch_dtype=torch.bfloat16).to(device)
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+
+>>> prompts = [
+... [
+... "User: What is in this image?",
+... "https://upload.wikimedia.org/wikipedia/commons/8/86/Id%C3%A9fix.JPG",
+... "",
+
+... "\nAssistant: This picture depicts Idefix, the dog of Obelix in Asterix and Obelix. Idefix is running on the ground.",
+
+... "\nUser:",
+... "https://static.wikia.nocookie.net/asterix/images/2/25/R22b.gif/revision/latest?cb=20110815073052",
+... "And who is that?",
+
+... "\nAssistant:",
+... ],
+... ]
+
+>>> # --batched mode
+>>> inputs = processor(prompts, add_end_of_utterance_token=False, return_tensors="pt").to(device)
+>>> # --single sample mode
+>>> # inputs = processor(prompts[0], return_tensors="pt").to(device)
+
+>>> # Generation args
+>>> exit_condition = processor.tokenizer("", add_special_tokens=False).input_ids
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, eos_token_id=exit_condition, bad_words_ids=bad_words_ids, max_length=100)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> for i, t in enumerate(generated_text):
+... print(f"{i}:\n{t}\n")
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_captioning.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_captioning.md
new file mode 100644
index 0000000000000000000000000000000000000000..9a78967cb5198d7cb4a499dc03387bcfb2d77d30
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_captioning.md
@@ -0,0 +1,277 @@
+
+
+
+# Image captioning
+
+[[open-in-colab]]
+
+Image captioning is the task of predicting a caption for a given image. Common real world applications of it include
+aiding visually impaired people that can help them navigate through different situations. Therefore, image captioning
+helps to improve content accessibility for people by describing images to them.
+
+This guide will show you how to:
+
+* Fine-tune an image captioning model.
+* Use the fine-tuned model for inference.
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate -q
+pip install jiwer -q
+```
+
+We encourage you to log in to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to log in:
+
+
+```python
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+## Load the Pokรฉmon BLIP captions dataset
+
+Use the ๐ค Dataset library to load a dataset that consists of {image-caption} pairs. To create your own image captioning dataset
+in PyTorch, you can follow [this notebook](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/GIT/Fine_tune_GIT_on_an_image_captioning_dataset.ipynb).
+
+
+```python
+from datasets import load_dataset
+
+ds = load_dataset("lambdalabs/pokemon-blip-captions")
+ds
+```
+```bash
+DatasetDict({
+ train: Dataset({
+ features: ['image', 'text'],
+ num_rows: 833
+ })
+})
+```
+
+The dataset has two features, `image` and `text`.
+
+
+
+Many image captioning datasets contain multiple captions per image. In those cases, a common strategy is to randomly sample a caption amongst the available ones during training.
+
+
+
+Split the datasetโs train split into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+
+```python
+ds = ds["train"].train_test_split(test_size=0.1)
+train_ds = ds["train"]
+test_ds = ds["test"]
+```
+
+Let's visualize a couple of samples from the training set.
+
+
+```python
+from textwrap import wrap
+import matplotlib.pyplot as plt
+import numpy as np
+
+
+def plot_images(images, captions):
+ plt.figure(figsize=(20, 20))
+ for i in range(len(images)):
+ ax = plt.subplot(1, len(images), i + 1)
+ caption = captions[i]
+ caption = "\n".join(wrap(caption, 12))
+ plt.title(caption)
+ plt.imshow(images[i])
+ plt.axis("off")
+
+
+sample_images_to_visualize = [np.array(train_ds[i]["image"]) for i in range(5)]
+sample_captions = [train_ds[i]["text"] for i in range(5)]
+plot_images(sample_images_to_visualize, sample_captions)
+```
+
+
+
+
+
+## Preprocess the dataset
+
+Since the dataset has two modalities (image and text), the pre-processing pipeline will preprocess images and the captions.
+
+To do so, load the processor class associated with the model you are about to fine-tune.
+
+```python
+from transformers import AutoProcessor
+
+checkpoint = "microsoft/git-base"
+processor = AutoProcessor.from_pretrained(checkpoint)
+```
+
+The processor will internally pre-process the image (which includes resizing, and pixel scaling) and tokenize the caption.
+
+```python
+def transforms(example_batch):
+ images = [x for x in example_batch["image"]]
+ captions = [x for x in example_batch["text"]]
+ inputs = processor(images=images, text=captions, padding="max_length")
+ inputs.update({"labels": inputs["input_ids"]})
+ return inputs
+
+
+train_ds.set_transform(transforms)
+test_ds.set_transform(transforms)
+```
+
+With the dataset ready, you can now set up the model for fine-tuning.
+
+## Load a base model
+
+Load the ["microsoft/git-base"](https://huggingface.co/microsoft/git-base) into a [`AutoModelForCausalLM`](https://huggingface.co/docs/transformers/model_doc/auto#transformers.AutoModelForCausalLM) object.
+
+
+```python
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained(checkpoint)
+```
+
+## Evaluate
+
+Image captioning models are typically evaluated with the [Rouge Score](https://huggingface.co/spaces/evaluate-metric/rouge) or [Word Error Rate](https://huggingface.co/spaces/evaluate-metric/wer). For this guide, you will use the Word Error Rate (WER).
+
+We use the ๐ค Evaluate library to do so. For potential limitations and other gotchas of the WER, refer to [this guide](https://huggingface.co/spaces/evaluate-metric/wer).
+
+
+```python
+from evaluate import load
+import torch
+
+wer = load("wer")
+
+
+def compute_metrics(eval_pred):
+ logits, labels = eval_pred
+ predicted = logits.argmax(-1)
+ decoded_labels = processor.batch_decode(labels, skip_special_tokens=True)
+ decoded_predictions = processor.batch_decode(predicted, skip_special_tokens=True)
+ wer_score = wer.compute(predictions=decoded_predictions, references=decoded_labels)
+ return {"wer_score": wer_score}
+```
+
+## Train!
+
+Now, you are ready to start fine-tuning the model. You will use the ๐ค [`Trainer`] for this.
+
+First, define the training arguments using [`TrainingArguments`].
+
+
+```python
+from transformers import TrainingArguments, Trainer
+
+model_name = checkpoint.split("/")[1]
+
+training_args = TrainingArguments(
+ output_dir=f"{model_name}-pokemon",
+ learning_rate=5e-5,
+ num_train_epochs=50,
+ fp16=True,
+ per_device_train_batch_size=32,
+ per_device_eval_batch_size=32,
+ gradient_accumulation_steps=2,
+ save_total_limit=3,
+ eval_strategy="steps",
+ eval_steps=50,
+ save_strategy="steps",
+ save_steps=50,
+ logging_steps=50,
+ remove_unused_columns=False,
+ push_to_hub=True,
+ label_names=["labels"],
+ load_best_model_at_end=True,
+)
+```
+
+Then pass them along with the datasets and the model to ๐ค Trainer.
+
+```python
+trainer = Trainer(
+ model=model,
+ args=training_args,
+ train_dataset=train_ds,
+ eval_dataset=test_ds,
+ compute_metrics=compute_metrics,
+)
+```
+
+To start training, simply call [`~Trainer.train`] on the [`Trainer`] object.
+
+```python
+trainer.train()
+```
+
+You should see the training loss drop smoothly as training progresses.
+
+Once training is completed, share your model to the Hub with the [`~Trainer.push_to_hub`] method so everyone can use your model:
+
+
+```python
+trainer.push_to_hub()
+```
+
+## Inference
+
+Take a sample image from `test_ds` to test the model.
+
+
+```python
+from PIL import Image
+import requests
+
+url = "https://huggingface.co/datasets/sayakpaul/sample-datasets/resolve/main/pokemon.png"
+image = Image.open(requests.get(url, stream=True).raw)
+image
+```
+
+
+
+
+
+Prepare image for the model.
+
+```python
+from accelerate.test_utils.testing import get_backend
+# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+device, _, _ = get_backend()
+inputs = processor(images=image, return_tensors="pt").to(device)
+pixel_values = inputs.pixel_values
+```
+
+Call [`generate`] and decode the predictions.
+
+```python
+generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
+generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
+print(generated_caption)
+```
+```bash
+a drawing of a pink and blue pokemon
+```
+
+Looks like the fine-tuned model generated a pretty good caption!
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..49fdc9db60d4d7650a4ef85c506f7fb4a3f2f0ef
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_classification.md
@@ -0,0 +1,542 @@
+
+
+# Image classification
+
+[[open-in-colab]]
+
+
+
+Image classification assigns a label or class to an image. Unlike text or audio classification, the inputs are the
+pixel values that comprise an image. There are many applications for image classification, such as detecting damage
+after a natural disaster, monitoring crop health, or helping screen medical images for signs of disease.
+
+This guide illustrates how to:
+
+1. Fine-tune [ViT](../model_doc/vit) on the [Food-101](https://huggingface.co/datasets/food101) dataset to classify a food item in an image.
+2. Use your fine-tuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/image-classification)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate accelerate pillow torchvision scikit-learn
+```
+
+We encourage you to log in to your Hugging Face account to upload and share your model with the community. When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load Food-101 dataset
+
+Start by loading a smaller subset of the Food-101 dataset from the ๐ค Datasets library. This will give you a chance to
+experiment and make sure everything works before spending more time training on the full dataset.
+
+```py
+>>> from datasets import load_dataset
+
+>>> food = load_dataset("food101", split="train[:5000]")
+```
+
+Split the dataset's `train` split into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+```py
+>>> food = food.train_test_split(test_size=0.2)
+```
+
+Then take a look at an example:
+
+```py
+>>> food["train"][0]
+{'image': ,
+ 'label': 79}
+```
+
+Each example in the dataset has two fields:
+
+- `image`: a PIL image of the food item
+- `label`: the label class of the food item
+
+To make it easier for the model to get the label name from the label id, create a dictionary that maps the label name
+to an integer and vice versa:
+
+```py
+>>> labels = food["train"].features["label"].names
+>>> label2id, id2label = dict(), dict()
+>>> for i, label in enumerate(labels):
+... label2id[label] = str(i)
+... id2label[str(i)] = label
+```
+
+Now you can convert the label id to a label name:
+
+```py
+>>> id2label[str(79)]
+'prime_rib'
+```
+
+## Preprocess
+
+The next step is to load a ViT image processor to process the image into a tensor:
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> checkpoint = "google/vit-base-patch16-224-in21k"
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint)
+```
+
+
+
+Apply some image transformations to the images to make the model more robust against overfitting. Here you'll use torchvision's [`transforms`](https://pytorch.org/vision/stable/transforms.html) module, but you can also use any image library you like.
+
+Crop a random part of the image, resize it, and normalize it with the image mean and standard deviation:
+
+```py
+>>> from torchvision.transforms import RandomResizedCrop, Compose, Normalize, ToTensor
+
+>>> normalize = Normalize(mean=image_processor.image_mean, std=image_processor.image_std)
+>>> size = (
+... image_processor.size["shortest_edge"]
+... if "shortest_edge" in image_processor.size
+... else (image_processor.size["height"], image_processor.size["width"])
+... )
+>>> _transforms = Compose([RandomResizedCrop(size), ToTensor(), normalize])
+```
+
+Then create a preprocessing function to apply the transforms and return the `pixel_values` - the inputs to the model - of the image:
+
+```py
+>>> def transforms(examples):
+... examples["pixel_values"] = [_transforms(img.convert("RGB")) for img in examples["image"]]
+... del examples["image"]
+... return examples
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.with_transform`] method. The transforms are applied on the fly when you load an element of the dataset:
+
+```py
+>>> food = food.with_transform(transforms)
+```
+
+Now create a batch of examples using [`DefaultDataCollator`]. Unlike other data collators in ๐ค Transformers, the `DefaultDataCollator` does not apply additional preprocessing such as padding.
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+
+
+
+
+
+
+To avoid overfitting and to make the model more robust, add some data augmentation to the training part of the dataset.
+Here we use Keras preprocessing layers to define the transformations for the training data (includes data augmentation),
+and transformations for the validation data (only center cropping, resizing and normalizing). You can use `tf.image`or
+any other library you prefer.
+
+```py
+>>> from tensorflow import keras
+>>> from tensorflow.keras import layers
+
+>>> size = (image_processor.size["height"], image_processor.size["width"])
+
+>>> train_data_augmentation = keras.Sequential(
+... [
+... layers.RandomCrop(size[0], size[1]),
+... layers.Rescaling(scale=1.0 / 127.5, offset=-1),
+... layers.RandomFlip("horizontal"),
+... layers.RandomRotation(factor=0.02),
+... layers.RandomZoom(height_factor=0.2, width_factor=0.2),
+... ],
+... name="train_data_augmentation",
+... )
+
+>>> val_data_augmentation = keras.Sequential(
+... [
+... layers.CenterCrop(size[0], size[1]),
+... layers.Rescaling(scale=1.0 / 127.5, offset=-1),
+... ],
+... name="val_data_augmentation",
+... )
+```
+
+Next, create functions to apply appropriate transformations to a batch of images, instead of one image at a time.
+
+```py
+>>> import numpy as np
+>>> import tensorflow as tf
+>>> from PIL import Image
+
+
+>>> def convert_to_tf_tensor(image: Image):
+... np_image = np.array(image)
+... tf_image = tf.convert_to_tensor(np_image)
+... # `expand_dims()` is used to add a batch dimension since
+... # the TF augmentation layers operates on batched inputs.
+... return tf.expand_dims(tf_image, 0)
+
+
+>>> def preprocess_train(example_batch):
+... """Apply train_transforms across a batch."""
+... images = [
+... train_data_augmentation(convert_to_tf_tensor(image.convert("RGB"))) for image in example_batch["image"]
+... ]
+... example_batch["pixel_values"] = [tf.transpose(tf.squeeze(image)) for image in images]
+... return example_batch
+
+
+... def preprocess_val(example_batch):
+... """Apply val_transforms across a batch."""
+... images = [
+... val_data_augmentation(convert_to_tf_tensor(image.convert("RGB"))) for image in example_batch["image"]
+... ]
+... example_batch["pixel_values"] = [tf.transpose(tf.squeeze(image)) for image in images]
+... return example_batch
+```
+
+Use ๐ค Datasets [`~datasets.Dataset.set_transform`] to apply the transformations on the fly:
+
+```py
+food["train"].set_transform(preprocess_train)
+food["test"].set_transform(preprocess_val)
+```
+
+As a final preprocessing step, create a batch of examples using `DefaultDataCollator`. Unlike other data collators in ๐ค Transformers, the
+`DefaultDataCollator` does not apply additional preprocessing, such as padding.
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load an
+evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load
+the [accuracy](https://huggingface.co/spaces/evaluate-metric/accuracy) metric (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric):
+
+```py
+>>> import evaluate
+
+>>> accuracy = evaluate.load("accuracy")
+```
+
+Then create a function that passes your predictions and labels to [`~evaluate.EvaluationModule.compute`] to calculate the accuracy:
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions, labels = eval_pred
+... predictions = np.argmax(predictions, axis=1)
+... return accuracy.compute(predictions=predictions, references=labels)
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you set up your training.
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load ViT with [`AutoModelForImageClassification`]. Specify the number of labels along with the number of expected labels, and the label mappings:
+
+```py
+>>> from transformers import AutoModelForImageClassification, TrainingArguments, Trainer
+
+>>> model = AutoModelForImageClassification.from_pretrained(
+... checkpoint,
+... num_labels=len(labels),
+... id2label=id2label,
+... label2id=label2id,
+... )
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. It is important you don't remove unused columns because that'll drop the `image` column. Without the `image` column, you can't create `pixel_values`. Set `remove_unused_columns=False` to prevent this behavior! The only other required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the accuracy and save the training checkpoint.
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_food_model",
+... remove_unused_columns=False,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... learning_rate=5e-5,
+... per_device_train_batch_size=16,
+... gradient_accumulation_steps=4,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... warmup_ratio=0.1,
+... logging_steps=10,
+... load_best_model_at_end=True,
+... metric_for_best_model="accuracy",
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=data_collator,
+... train_dataset=food["train"],
+... eval_dataset=food["test"],
+... processing_class=image_processor,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+
+
+
+If you are unfamiliar with fine-tuning a model with Keras, check out the [basic tutorial](./training#train-a-tensorflow-model-with-keras) first!
+
+
+
+To fine-tune a model in TensorFlow, follow these steps:
+1. Define the training hyperparameters, and set up an optimizer and a learning rate schedule.
+2. Instantiate a pre-trained model.
+3. Convert a ๐ค Dataset to a `tf.data.Dataset`.
+4. Compile your model.
+5. Add callbacks and use the `fit()` method to run the training.
+6. Upload your model to ๐ค Hub to share with the community.
+
+Start by defining the hyperparameters, optimizer and learning rate schedule:
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_epochs = 5
+>>> num_train_steps = len(food["train"]) * num_epochs
+>>> learning_rate = 3e-5
+>>> weight_decay_rate = 0.01
+
+>>> optimizer, lr_schedule = create_optimizer(
+... init_lr=learning_rate,
+... num_train_steps=num_train_steps,
+... weight_decay_rate=weight_decay_rate,
+... num_warmup_steps=0,
+... )
+```
+
+Then, load ViT with [`TFAutoModelForImageClassification`] along with the label mappings:
+
+```py
+>>> from transformers import TFAutoModelForImageClassification
+
+>>> model = TFAutoModelForImageClassification.from_pretrained(
+... checkpoint,
+... id2label=id2label,
+... label2id=label2id,
+... )
+```
+
+Convert your datasets to the `tf.data.Dataset` format using the [`~datasets.Dataset.to_tf_dataset`] and your `data_collator`:
+
+```py
+>>> # converting our train dataset to tf.data.Dataset
+>>> tf_train_dataset = food["train"].to_tf_dataset(
+... columns="pixel_values", label_cols="label", shuffle=True, batch_size=batch_size, collate_fn=data_collator
+... )
+
+>>> # converting our test dataset to tf.data.Dataset
+>>> tf_eval_dataset = food["test"].to_tf_dataset(
+... columns="pixel_values", label_cols="label", shuffle=True, batch_size=batch_size, collate_fn=data_collator
+... )
+```
+
+Configure the model for training with `compile()`:
+
+```py
+>>> from tensorflow.keras.losses import SparseCategoricalCrossentropy
+
+>>> loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
+>>> model.compile(optimizer=optimizer, loss=loss)
+```
+
+To compute the accuracy from the predictions and push your model to the ๐ค Hub, use [Keras callbacks](../main_classes/keras_callbacks).
+Pass your `compute_metrics` function to [KerasMetricCallback](../main_classes/keras_callbacks#transformers.KerasMetricCallback),
+and use the [PushToHubCallback](../main_classes/keras_callbacks#transformers.PushToHubCallback) to upload the model:
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback, PushToHubCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_eval_dataset)
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="food_classifier",
+... tokenizer=image_processor,
+... save_strategy="no",
+... )
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+Finally, you are ready to train your model! Call `fit()` with your training and validation datasets, the number of epochs,
+and your callbacks to fine-tune the model:
+
+```py
+>>> model.fit(tf_train_dataset, validation_data=tf_eval_dataset, epochs=num_epochs, callbacks=callbacks)
+Epoch 1/5
+250/250 [==============================] - 313s 1s/step - loss: 2.5623 - val_loss: 1.4161 - accuracy: 0.9290
+Epoch 2/5
+250/250 [==============================] - 265s 1s/step - loss: 0.9181 - val_loss: 0.6808 - accuracy: 0.9690
+Epoch 3/5
+250/250 [==============================] - 252s 1s/step - loss: 0.3910 - val_loss: 0.4303 - accuracy: 0.9820
+Epoch 4/5
+250/250 [==============================] - 251s 1s/step - loss: 0.2028 - val_loss: 0.3191 - accuracy: 0.9900
+Epoch 5/5
+250/250 [==============================] - 238s 949ms/step - loss: 0.1232 - val_loss: 0.3259 - accuracy: 0.9890
+```
+
+Congratulations! You have fine-tuned your model and shared it on the ๐ค Hub. You can now use it for inference!
+
+
+
+
+
+
+For a more in-depth example of how to finetune a model for image classification, take a look at the corresponding [PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
+
+
+
+## Inference
+
+Great, now that you've fine-tuned a model, you can use it for inference!
+
+Load an image you'd like to run inference on:
+
+```py
+>>> ds = load_dataset("food101", split="validation[:10]")
+>>> image = ds["image"][0]
+```
+
+
+
+
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for image classification with your model, and pass your image to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("image-classification", model="my_awesome_food_model")
+>>> classifier(image)
+[{'score': 0.31856709718704224, 'label': 'beignets'},
+ {'score': 0.015232225880026817, 'label': 'bruschetta'},
+ {'score': 0.01519392803311348, 'label': 'chicken_wings'},
+ {'score': 0.013022331520915031, 'label': 'pork_chop'},
+ {'score': 0.012728818692266941, 'label': 'prime_rib'}]
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+Load an image processor to preprocess the image and return the `input` as PyTorch tensors:
+
+```py
+>>> from transformers import AutoImageProcessor
+>>> import torch
+
+>>> image_processor = AutoImageProcessor.from_pretrained("my_awesome_food_model")
+>>> inputs = image_processor(image, return_tensors="pt")
+```
+
+Pass your inputs to the model and return the logits:
+
+```py
+>>> from transformers import AutoModelForImageClassification
+
+>>> model = AutoModelForImageClassification.from_pretrained("my_awesome_food_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+Get the predicted label with the highest probability, and use the model's `id2label` mapping to convert it to a label:
+
+```py
+>>> predicted_label = logits.argmax(-1).item()
+>>> model.config.id2label[predicted_label]
+'beignets'
+```
+
+
+
+
+
+Load an image processor to preprocess the image and return the `input` as TensorFlow tensors:
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("MariaK/food_classifier")
+>>> inputs = image_processor(image, return_tensors="tf")
+```
+
+Pass your inputs to the model and return the logits:
+
+```py
+>>> from transformers import TFAutoModelForImageClassification
+
+>>> model = TFAutoModelForImageClassification.from_pretrained("MariaK/food_classifier")
+>>> logits = model(**inputs).logits
+```
+
+Get the predicted label with the highest probability, and use the model's `id2label` mapping to convert it to a label:
+
+```py
+>>> predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])
+>>> model.config.id2label[predicted_class_id]
+'beignets'
+```
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_feature_extraction.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_feature_extraction.md
new file mode 100644
index 0000000000000000000000000000000000000000..e55a9e2379d531115fea5b2bec0267f2809deb59
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_feature_extraction.md
@@ -0,0 +1,135 @@
+
+
+# Image Feature Extraction
+
+[[open-in-colab]]
+
+Image feature extraction is the task of extracting semantically meaningful features given an image. This has many use cases, including image similarity and image retrieval. Moreover, most computer vision models can be used for image feature extraction, where one can remove the task-specific head (image classification, object detection etc) and get the features. These features are very useful on a higher level: edge detection, corner detection and so on. They may also contain information about the real world (e.g. what a cat looks like) depending on how deep the model is. Therefore, these outputs can be used to train new classifiers on a specific dataset.
+
+In this guide, you will:
+
+- Learn to build a simple image similarity system on top of the `image-feature-extraction` pipeline.
+- Accomplish the same task with bare model inference.
+
+## Image Similarity using `image-feature-extraction` Pipeline
+
+We have two images of cats sitting on top of fish nets, one of them is generated.
+
+```python
+from PIL import Image
+import requests
+
+img_urls = ["https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png", "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.jpeg"]
+image_real = Image.open(requests.get(img_urls[0], stream=True).raw).convert("RGB")
+image_gen = Image.open(requests.get(img_urls[1], stream=True).raw).convert("RGB")
+```
+
+Let's see the pipeline in action. First, initialize the pipeline. If you don't pass any model to it, the pipeline will be automatically initialized with [google/vit-base-patch16-224](google/vit-base-patch16-224). If you'd like to calculate similarity, set `pool` to True.
+
+```python
+import torch
+from transformers import pipeline
+from accelerate.test_utils.testing import get_backend
+# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+DEVICE, _, _ = get_backend()
+pipe = pipeline(task="image-feature-extraction", model_name="google/vit-base-patch16-384", device=DEVICE, pool=True)
+```
+
+To infer with `pipe` pass both images to it.
+
+```python
+outputs = pipe([image_real, image_gen])
+```
+
+The output contains pooled embeddings of those two images.
+
+```python
+# get the length of a single output
+print(len(outputs[0][0]))
+# show outputs
+print(outputs)
+
+# 768
+# [[[-0.03909236937761307, 0.43381670117378235, -0.06913255900144577,
+```
+
+To get the similarity score, we need to pass them to a similarity function.
+
+```python
+from torch.nn.functional import cosine_similarity
+
+similarity_score = cosine_similarity(torch.Tensor(outputs[0]),
+ torch.Tensor(outputs[1]), dim=1)
+
+print(similarity_score)
+
+# tensor([0.6043])
+```
+
+If you want to get the last hidden states before pooling, avoid passing any value for the `pool` parameter, as it is set to `False`ย by default. These hidden states are useful for training new classifiers or models based on the features from the model.
+
+```python
+pipe = pipeline(task="image-feature-extraction", model_name="google/vit-base-patch16-224", device=DEVICE)
+outputs = pipe(image_real)
+```
+
+Since the outputs are unpooled, we get the last hidden states where the first dimension is the batch size, and the last two are the embedding shape.
+
+```python
+import numpy as np
+print(np.array(outputs).shape)
+# (1, 197, 768)
+```
+
+## Getting Features and Similarities using `AutoModel`
+
+We can also use `AutoModel`ย class of transformers to get the features. `AutoModel` loads any transformers model with no task-specific head, and we can use this to get the features.
+
+```python
+from transformers import AutoImageProcessor, AutoModel
+
+processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+model = AutoModel.from_pretrained("google/vit-base-patch16-224").to(DEVICE)
+```
+
+Let's write a simple function for inference. We will pass the inputs to the `processor` first and pass its outputs to the `model`.
+
+```python
+def infer(image):
+ inputs = processor(image, return_tensors="pt").to(DEVICE)
+ outputs = model(**inputs)
+ return outputs.pooler_output
+```
+
+We can pass the images directly to this function and get the embeddings.
+
+```python
+embed_real = infer(image_real)
+embed_gen = infer(image_gen)
+```
+
+We can get the similarity again over the embeddings.
+
+```python
+from torch.nn.functional import cosine_similarity
+
+similarity_score = cosine_similarity(embed_real, embed_gen, dim=1)
+print(similarity_score)
+
+# tensor([0.6061], device='cuda:0', grad_fn=)
+```
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_text_to_text.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_text_to_text.md
new file mode 100644
index 0000000000000000000000000000000000000000..28bd98457ee01658c1f237c0551dc36c0a68bff2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_text_to_text.md
@@ -0,0 +1,274 @@
+
+
+# Image-text-to-text
+
+[[open-in-colab]]
+
+Image-text-to-text models, also known as vision language models (VLMs), are language models that take an image input. These models can tackle various tasks, from visual question answering to image segmentation. This task shares many similarities with image-to-text, butย with some overlapping use cases like image captioning. Image-to-text models only take image inputs and often accomplish a specific task, whereas VLMs take open-ended text and image inputs and are more generalist models.
+
+In this guide, we provide a brief overview of VLMs and show how to use them with Transformers for inference.
+
+To begin with, there are multiple types of VLMs:
+- base models used for fine-tuning
+- chat fine-tuned models for conversation
+- instruction fine-tuned models
+
+This guide focuses on inference with an instruction-tuned model.
+
+Let's begin installing the dependencies.
+
+```bash
+pip install -q transformers accelerate flash_attn
+```
+
+Let's initialize the model and the processor.
+
+```python
+from transformers import AutoProcessor, AutoModelForImageTextToText
+import torch
+
+device = torch.device("cuda")
+model = AutoModelForImageTextToText.from_pretrained(
+ "HuggingFaceM4/idefics2-8b",
+ torch_dtype=torch.bfloat16,
+ attn_implementation="flash_attention_2",
+).to(device)
+
+processor = AutoProcessor.from_pretrained("HuggingFaceM4/idefics2-8b")
+```
+
+This model has a [chat template](./chat_templating) that helps user parse chat outputs. Moreover, the model can also accept multiple images as input in a single conversation or message. We will now prepare the inputs.
+
+The image inputs look like the following.
+
+
+
+
+
+
+
+
+
+
+```python
+from PIL import Image
+import requests
+
+img_urls =["https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png",
+ "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"]
+images = [Image.open(requests.get(img_urls[0], stream=True).raw),
+ Image.open(requests.get(img_urls[1], stream=True).raw)]
+```
+
+Below is an example of the chat template. We can feed conversation turns and the last message as an input by appending it at the end of the template.
+
+
+```python
+messages = [
+ {
+ "role": "user",
+ "content": [
+ {"type": "image"},
+ {"type": "text", "text": "What do we see in this image?"},
+ ]
+ },
+ {
+ "role": "assistant",
+ "content": [
+ {"type": "text", "text": "In this image we can see two cats on the nets."},
+ ]
+ },
+ {
+ "role": "user",
+ "content": [
+ {"type": "image"},
+ {"type": "text", "text": "And how about this image?"},
+ ]
+ },
+]
+```
+
+We will now call the processors' [`~ProcessorMixin.apply_chat_template`] method to preprocess its output along with the image inputs.
+
+```python
+prompt = processor.apply_chat_template(messages, add_generation_prompt=True)
+inputs = processor(text=prompt, images=[images[0], images[1]], return_tensors="pt").to(device)
+```
+
+We can now pass the preprocessed inputs to the model.
+
+```python
+with torch.no_grad():
+ generated_ids = model.generate(**inputs, max_new_tokens=500)
+generated_texts = processor.batch_decode(generated_ids, skip_special_tokens=True)
+
+print(generated_texts)
+## ['User: What do we see in this image? \nAssistant: In this image we can see two cats on the nets. \nUser: And how about this image? \nAssistant: In this image we can see flowers, plants and insect.']
+```
+
+## Pipeline
+
+The fastest way to get started is to use the [`Pipeline`] API. Specify the `"image-text-to-text"` task and the model you want to use.
+
+```python
+from transformers import pipeline
+pipe = pipeline("image-text-to-text", model="llava-hf/llava-interleave-qwen-0.5b-hf")
+```
+
+The example below uses chat templates to format the text inputs.
+
+```python
+messages = [
+ {
+ "role": "user",
+ "content": [
+ {
+ "type": "image",
+ "image": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg",
+ },
+ {"type": "text", "text": "Describe this image."},
+ ],
+ },
+ {
+ "role": "assistant",
+ "content": [
+ {"type": "text", "text": "There's a pink flower"},
+ ],
+ },
+ ]
+```
+
+Pass the chat template formatted text and image to [`Pipeline`] and set `return_full_text=False` to remove the input from the generated output.
+
+```python
+outputs = pipe(text=messages, max_new_tokens=20, return_full_text=False)
+outputs[0]["generated_text"]
+# with a yellow center in the foreground. The flower is surrounded by red and white flowers with green stems
+```
+
+## Streaming
+
+We can use [text streaming](./generation_strategies#streaming) for a better generation experience. Transformers supports streaming with the [`TextStreamer`] or [`TextIteratorStreamer`] classes. We will use the [`TextIteratorStreamer`] with IDEFICS-8B.
+
+Assume we have an application that keeps chat history and takes in the new user input. We will preprocess the inputs as usual and initialize [`TextIteratorStreamer`] to handle the generation in a separate thread. This allows you to stream the generated text tokens in real-time. Any generation arguments can be passed to [`TextIteratorStreamer`].
+
+
+```python
+import time
+from transformers import TextIteratorStreamer
+from threading import Thread
+
+def model_inference(
+ user_prompt,
+ chat_history,
+ max_new_tokens,
+ images
+):
+ user_prompt = {
+ "role": "user",
+ "content": [
+ {"type": "image"},
+ {"type": "text", "text": user_prompt},
+ ]
+ }
+ chat_history.append(user_prompt)
+ streamer = TextIteratorStreamer(
+ processor.tokenizer,
+ skip_prompt=True,
+ timeout=5.0,
+ )
+
+ generation_args = {
+ "max_new_tokens": max_new_tokens,
+ "streamer": streamer,
+ "do_sample": False
+ }
+
+ # add_generation_prompt=True makes model generate bot response
+ prompt = processor.apply_chat_template(chat_history, add_generation_prompt=True)
+ inputs = processor(
+ text=prompt,
+ images=images,
+ return_tensors="pt",
+ ).to(device)
+ generation_args.update(inputs)
+
+ thread = Thread(
+ target=model.generate,
+ kwargs=generation_args,
+ )
+ thread.start()
+
+ acc_text = ""
+ for text_token in streamer:
+ time.sleep(0.04)
+ acc_text += text_token
+ if acc_text.endswith(""):
+ acc_text = acc_text[:-18]
+ yield acc_text
+
+ thread.join()
+```
+
+Now let's call the `model_inference` function we created and stream the values.
+
+```python
+generator = model_inference(
+ user_prompt="And what is in this image?",
+ chat_history=messages[:2],
+ max_new_tokens=100,
+ images=images
+)
+
+for value in generator:
+ print(value)
+
+# In
+# In this
+# In this image ...
+```
+
+## Fit models in smaller hardware
+
+VLMs are often large and need to be optimized to fit on smaller hardware. Transformers supports many model quantization libraries, and here we will only show int8 quantization with [Quanto](./quantization/quanto#quanto). int8 quantization offers memory improvements up to 75 percent (if all weights are quantized). However it is no free lunch, since 8-bit is not a CUDA-native precision, the weights are quantized back and forth on the fly, which adds up to latency.
+
+First, install dependencies.
+
+```bash
+pip install -U quanto bitsandbytes
+```
+
+To quantize a model during loading, we need to first create [`QuantoConfig`]. Then load the model as usual, but pass `quantization_config`ย during model initialization.
+
+```python
+from transformers import AutoModelForImageTextToText, QuantoConfig
+
+model_id = "HuggingFaceM4/idefics2-8b"
+quantization_config = QuantoConfig(weights="int8")
+quantized_model = AutoModelForImageTextToText.from_pretrained(
+ model_id, device_map="cuda", quantization_config=quantization_config
+)
+```
+
+And that's it, we can use the model the same way with no changes.
+
+## Further Reading
+
+Here are some more resources for the image-text-to-text task.
+
+- [Image-text-to-textย task page](https://huggingface.co/tasks/image-text-to-text) covers model types, use cases, datasets, and more.
+- [Vision Language Models Explained](https://huggingface.co/blog/vlms) is a blog post that covers everything about vision language models and supervised fine-tuning using [TRL](https://huggingface.co/docs/trl/en/index).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_to_image.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_to_image.md
new file mode 100644
index 0000000000000000000000000000000000000000..f1c62e47aebf248e4e2960c94005cbe168b91e54
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/image_to_image.md
@@ -0,0 +1,134 @@
+
+
+# Image-to-Image Task Guide
+
+[[open-in-colab]]
+
+Image-to-Image task is the task where an application receives an image and outputs another image. This has various subtasks, including image enhancement (super resolution, low light enhancement, deraining and so on), image inpainting, and more.
+
+This guide will show you how to:
+- Use an image-to-image pipeline for super resolution task,
+- Run image-to-image models for same task without a pipeline.
+
+Note that as of the time this guide is released, `image-to-image` pipeline only supports super resolution task.
+
+Let's begin by installing the necessary libraries.
+
+```bash
+pip install transformers
+```
+
+We can now initialize the pipeline with a [Swin2SR model](https://huggingface.co/caidas/swin2SR-lightweight-x2-64). We can then infer with the pipeline by calling it with an image. As of now, only [Swin2SR models](https://huggingface.co/models?sort=trending&search=swin2sr) are supported in this pipeline.
+
+```python
+from transformers import pipeline
+import torch
+from accelerate.test_utils.testing import get_backend
+# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+device, _, _ = get_backend()
+pipe = pipeline(task="image-to-image", model="caidas/swin2SR-lightweight-x2-64", device=device)
+```
+
+Now, let's load an image.
+
+```python
+from PIL import Image
+import requests
+
+url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/cat.jpg"
+image = Image.open(requests.get(url, stream=True).raw)
+
+print(image.size)
+```
+```bash
+# (532, 432)
+```
+
+
+
+
+We can now do inference with the pipeline. We will get an upscaled version of the cat image.
+
+```python
+upscaled = pipe(image)
+print(upscaled.size)
+```
+```bash
+# (1072, 880)
+```
+
+If you wish to do inference yourself with no pipeline, you can use the `Swin2SRForImageSuperResolution` and `Swin2SRImageProcessor` classes of transformers. We will use the same model checkpoint for this. Let's initialize the model and the processor.
+
+```python
+from transformers import Swin2SRForImageSuperResolution, Swin2SRImageProcessor
+
+model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-lightweight-x2-64").to(device)
+processor = Swin2SRImageProcessor("caidas/swin2SR-lightweight-x2-64")
+```
+
+`pipeline` abstracts away the preprocessing and postprocessing steps that we have to do ourselves, so let's preprocess the image. We will pass the image to the processor and then move the pixel values to GPU.
+
+```python
+pixel_values = processor(image, return_tensors="pt").pixel_values
+print(pixel_values.shape)
+
+pixel_values = pixel_values.to(device)
+```
+
+We can now infer the image by passing pixel values to the model.
+
+```python
+import torch
+
+with torch.no_grad():
+ outputs = model(pixel_values)
+```
+Output is an object of type `ImageSuperResolutionOutput` that looks like below ๐
+
+```
+(loss=None, reconstruction=tensor([[[[0.8270, 0.8269, 0.8275, ..., 0.7463, 0.7446, 0.7453],
+ [0.8287, 0.8278, 0.8283, ..., 0.7451, 0.7448, 0.7457],
+ [0.8280, 0.8273, 0.8269, ..., 0.7447, 0.7446, 0.7452],
+ ...,
+ [0.5923, 0.5933, 0.5924, ..., 0.0697, 0.0695, 0.0706],
+ [0.5926, 0.5932, 0.5926, ..., 0.0673, 0.0687, 0.0705],
+ [0.5927, 0.5914, 0.5922, ..., 0.0664, 0.0694, 0.0718]]]],
+ device='cuda:0'), hidden_states=None, attentions=None)
+```
+We need to get the `reconstruction` and post-process it for visualization. Let's see how it looks like.
+
+```python
+outputs.reconstruction.data.shape
+# torch.Size([1, 3, 880, 1072])
+```
+
+We need to squeeze the output and get rid of axis 0, clip the values, then convert it to be numpy float. Then we will arrange axes to have the shape [1072, 880], and finally, bring the output back to range [0, 255].
+
+```python
+import numpy as np
+
+# squeeze, take to CPU and clip the values
+output = outputs.reconstruction.data.squeeze().cpu().clamp_(0, 1).numpy()
+# rearrange the axes
+output = np.moveaxis(output, source=0, destination=-1)
+# bring values back to pixel values range
+output = (output * 255.0).round().astype(np.uint8)
+Image.fromarray(output)
+```
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/keypoint_detection.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/keypoint_detection.md
new file mode 100644
index 0000000000000000000000000000000000000000..a0ec71a5c220003331618e503e05c8ffc8d776fd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/keypoint_detection.md
@@ -0,0 +1,154 @@
+
+
+# Keypoint Detection
+
+[[open-in-colab]]
+
+Keypoint detection identifies and locates specific points of interest within an image. These keypoints, also known as landmarks, represent meaningful features of objects, such as facial features or object parts. These models take an image input and return the following outputs:
+
+- **Keypoints and Scores**: Points of interest and their confidence scores.
+- **Descriptors**: A representation of the image region surrounding each keypoint, capturing its texture, gradient, orientation and other properties.
+
+In this guide, we will show how to extract keypoints from images.
+
+For this tutorial, we will use [SuperPoint](./model_doc/superpoint.md), a foundation model for keypoint detection.
+
+```python
+from transformers import AutoImageProcessor, SuperPointForKeypointDetection
+processor = AutoImageProcessor.from_pretrained("magic-leap-community/superpoint")
+model = SuperPointForKeypointDetection.from_pretrained("magic-leap-community/superpoint")
+```
+
+Let's test the model on the images below.
+
+
+
+
+
+
+
+```python
+import torch
+from PIL import Image
+import requests
+import cv2
+
+
+url_image_1 = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"
+image_1 = Image.open(requests.get(url_image_1, stream=True).raw)
+url_image_2 = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/cats.png"
+image_2 = Image.open(requests.get(url_image_2, stream=True).raw)
+
+images = [image_1, image_2]
+```
+
+We can now process our inputs and infer.
+
+```python
+inputs = processor(images,return_tensors="pt").to(model.device, model.dtype)
+outputs = model(**inputs)
+```
+
+The model output has relative keypoints, descriptors, masks and scores for each item in the batch. The mask highlights areas of the image where keypoints are present.
+
+```python
+SuperPointKeypointDescriptionOutput(loss=None, keypoints=tensor([[[0.0437, 0.0167],
+ [0.0688, 0.0167],
+ [0.0172, 0.0188],
+ ...,
+ [0.5984, 0.9812],
+ [0.6953, 0.9812]]]),
+ scores=tensor([[0.0056, 0.0053, 0.0079, ..., 0.0125, 0.0539, 0.0377],
+ [0.0206, 0.0058, 0.0065, ..., 0.0000, 0.0000, 0.0000]],
+ grad_fn=), descriptors=tensor([[[-0.0807, 0.0114, -0.1210, ..., -0.1122, 0.0899, 0.0357],
+ [-0.0807, 0.0114, -0.1210, ..., -0.1122, 0.0899, 0.0357],
+ [-0.0807, 0.0114, -0.1210, ..., -0.1122, 0.0899, 0.0357],
+ ...],
+ grad_fn=), mask=tensor([[1, 1, 1, ..., 1, 1, 1],
+ [1, 1, 1, ..., 0, 0, 0]], dtype=torch.int32), hidden_states=None)
+```
+
+To plot actual keypoints in the image, we need to postprocess the output. To do so, we have to pass the actual image sizes to `post_process_keypoint_detection` along with outputs.
+
+```python
+image_sizes = [(image.size[1], image.size[0]) for image in images]
+outputs = processor.post_process_keypoint_detection(outputs, image_sizes)
+```
+
+The outputs are now a list of dictionaries where each dictionary is a processed output of keypoints, scores and descriptors.
+
+```python
+[{'keypoints': tensor([[ 226, 57],
+ [ 356, 57],
+ [ 89, 64],
+ ...,
+ [3604, 3391]], dtype=torch.int32),
+ 'scores': tensor([0.0056, 0.0053, ...], grad_fn=),
+ 'descriptors': tensor([[-0.0807, 0.0114, -0.1210, ..., -0.1122, 0.0899, 0.0357],
+ [-0.0807, 0.0114, -0.1210, ..., -0.1122, 0.0899, 0.0357]],
+ grad_fn=)},
+ {'keypoints': tensor([[ 46, 6],
+ [ 78, 6],
+ [422, 6],
+ [206, 404]], dtype=torch.int32),
+ 'scores': tensor([0.0206, 0.0058, 0.0065, 0.0053, 0.0070, ...,grad_fn=),
+ 'descriptors': tensor([[-0.0525, 0.0726, 0.0270, ..., 0.0389, -0.0189, -0.0211],
+ [-0.0525, 0.0726, 0.0270, ..., 0.0389, -0.0189, -0.0211]}]
+```
+
+We can use these to plot the keypoints.
+
+```python
+import matplotlib.pyplot as plt
+import torch
+
+for i in range(len(images)):
+ keypoints = outputs[i]["keypoints"]
+ scores = outputs[i]["scores"]
+ descriptors = outputs[i]["descriptors"]
+ keypoints = outputs[i]["keypoints"].detach().numpy()
+ scores = outputs[i]["scores"].detach().numpy()
+ image = images[i]
+ image_width, image_height = image.size
+
+ plt.axis('off')
+ plt.imshow(image)
+ plt.scatter(
+ keypoints[:, 0],
+ keypoints[:, 1],
+ s=scores * 100,
+ c='cyan',
+ alpha=0.4
+ )
+ plt.show()
+```
+
+Below you can see the outputs.
+
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/knowledge_distillation_for_image_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/knowledge_distillation_for_image_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..c1ccafb6fc5d2adb66caa0f68fc7d06f6fc3a52a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/knowledge_distillation_for_image_classification.md
@@ -0,0 +1,186 @@
+
+# Knowledge Distillation for Computer Vision
+
+[[open-in-colab]]
+
+Knowledge distillation is a technique used to transfer knowledge from a larger, more complex model (teacher) to a smaller, simpler model (student). To distill knowledge from one model to another, we take a pre-trained teacher model trained on a certain task (image classification for this case) and randomly initialize a student model to be trained on image classification. Next, we train the student model to minimize the difference between its outputs and the teacher's outputs, thus making it mimic the behavior. It was first introduced in [Distilling the Knowledge in a Neural Network by Hinton et al](https://arxiv.org/abs/1503.02531). In this guide, we will do task-specific knowledge distillation. We will use the [beans dataset](https://huggingface.co/datasets/beans) for this.
+
+This guide demonstrates how you can distill a [fine-tuned ViT model](https://huggingface.co/merve/vit-mobilenet-beans-224) (teacher model) to a [MobileNet](https://huggingface.co/google/mobilenet_v2_1.4_224) (student model) using the [Trainerย API](https://huggingface.co/docs/transformers/en/main_classes/trainer#trainer) of ๐ค Transformers.
+
+Let's install the libraries needed for distillation and evaluating the process.
+
+```bash
+pip install transformers datasets accelerate tensorboard evaluate --upgrade
+```
+
+In this example, we are using the `merve/beans-vit-224` model as teacher model. It's an image classification model, based on `google/vit-base-patch16-224-in21k` fine-tuned on beans dataset. We will distill this model to a randomly initialized MobileNetV2.
+
+We will now load the dataset.
+
+```python
+from datasets import load_dataset
+
+dataset = load_dataset("beans")
+```
+
+We can use an image processor from either of the models, as in this case they return the same output with same resolution. We will use the `map()` method of `dataset` to apply the preprocessing to every split of the dataset.
+
+```python
+from transformers import AutoImageProcessor
+teacher_processor = AutoImageProcessor.from_pretrained("merve/beans-vit-224")
+
+def process(examples):
+ processed_inputs = teacher_processor(examples["image"])
+ return processed_inputs
+
+processed_datasets = dataset.map(process, batched=True)
+```
+
+Essentially, we want the student model (a randomly initialized MobileNet) to mimic the teacher model (fine-tuned vision transformer). To achieve this, we first get the logits output from the teacher and the student. Then, we divide each of them by the parameter `temperature` which controls the importance of each soft target. A parameter called `lambda` weighs the importance of the distillation loss. In this example, we will use `temperature=5` and `lambda=0.5`. We will use the Kullback-Leibler Divergence loss to compute the divergence between the student and teacher. Given two data P and Q, KL Divergence explains how much extra information we need to represent P using Q. If two are identical, their KL divergence is zero, as there's no other information needed to explain P from Q. Thus, in the context of knowledge distillation, KL divergence is useful.
+
+
+```python
+from transformers import TrainingArguments, Trainer
+import torch
+import torch.nn as nn
+import torch.nn.functional as F
+from accelerate.test_utils.testing import get_backend
+
+class ImageDistilTrainer(Trainer):
+ def __init__(self, teacher_model=None, student_model=None, temperature=None, lambda_param=None, *args, **kwargs):
+ super().__init__(model=student_model, *args, **kwargs)
+ self.teacher = teacher_model
+ self.student = student_model
+ self.loss_function = nn.KLDivLoss(reduction="batchmean")
+ device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+ self.teacher.to(device)
+ self.teacher.eval()
+ self.temperature = temperature
+ self.lambda_param = lambda_param
+
+ def compute_loss(self, student, inputs, return_outputs=False):
+ student_output = self.student(**inputs)
+
+ with torch.no_grad():
+ teacher_output = self.teacher(**inputs)
+
+ # Compute soft targets for teacher and student
+ soft_teacher = F.softmax(teacher_output.logits / self.temperature, dim=-1)
+ soft_student = F.log_softmax(student_output.logits / self.temperature, dim=-1)
+
+ # Compute the loss
+ distillation_loss = self.loss_function(soft_student, soft_teacher) * (self.temperature ** 2)
+
+ # Compute the true label loss
+ student_target_loss = student_output.loss
+
+ # Calculate final loss
+ loss = (1. - self.lambda_param) * student_target_loss + self.lambda_param * distillation_loss
+ return (loss, student_output) if return_outputs else loss
+```
+
+We will now login to Hugging Face Hub so we can push our model to the Hugging Face Hub through the `Trainer`.
+
+```python
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+Let's set the `TrainingArguments`, the teacher model and the student model.
+
+```python
+from transformers import AutoModelForImageClassification, MobileNetV2Config, MobileNetV2ForImageClassification
+
+training_args = TrainingArguments(
+ output_dir="my-awesome-model",
+ num_train_epochs=30,
+ fp16=True,
+ logging_dir=f"{repo_name}/logs",
+ logging_strategy="epoch",
+ eval_strategy="epoch",
+ save_strategy="epoch",
+ load_best_model_at_end=True,
+ metric_for_best_model="accuracy",
+ report_to="tensorboard",
+ push_to_hub=True,
+ hub_strategy="every_save",
+ hub_model_id=repo_name,
+ )
+
+num_labels = len(processed_datasets["train"].features["labels"].names)
+
+# initialize models
+teacher_model = AutoModelForImageClassification.from_pretrained(
+ "merve/beans-vit-224",
+ num_labels=num_labels,
+ ignore_mismatched_sizes=True
+)
+
+# training MobileNetV2 from scratch
+student_config = MobileNetV2Config()
+student_config.num_labels = num_labels
+student_model = MobileNetV2ForImageClassification(student_config)
+```
+
+We can use `compute_metrics` function to evaluate our model on the test set. This function will be used during the training process to compute the `accuracy` & `f1` of our model.
+
+```python
+import evaluate
+import numpy as np
+
+accuracy = evaluate.load("accuracy")
+
+def compute_metrics(eval_pred):
+ predictions, labels = eval_pred
+ acc = accuracy.compute(references=labels, predictions=np.argmax(predictions, axis=1))
+ return {"accuracy": acc["accuracy"]}
+```
+
+Let's initialize the `Trainer` with the training arguments we defined. We will also initialize our data collator.
+
+```python
+from transformers import DefaultDataCollator
+
+data_collator = DefaultDataCollator()
+trainer = ImageDistilTrainer(
+ student_model=student_model,
+ teacher_model=teacher_model,
+ training_args=training_args,
+ train_dataset=processed_datasets["train"],
+ eval_dataset=processed_datasets["validation"],
+ data_collator=data_collator,
+ processing_class=teacher_processor,
+ compute_metrics=compute_metrics,
+ temperature=5,
+ lambda_param=0.5
+)
+```
+
+We can now train our model.
+
+```python
+trainer.train()
+```
+
+We can evaluate the model on the test set.
+
+```python
+trainer.evaluate(processed_datasets["test"])
+```
+
+On test set, our model reaches 72 percent accuracy. To have a sanity check over efficiency of distillation, we also trained MobileNet on the beans dataset from scratch with the same hyperparameters and observed 63 percent accuracy on the test set. We invite the readers to try different pre-trained teacher models, student architectures, distillation parameters and report their findings. The training logs and checkpoints for distilled model can be found in [this repository](https://huggingface.co/merve/vit-mobilenet-beans-224), and MobileNetV2 trained from scratch can be found in this [repository](https://huggingface.co/merve/resnet-mobilenet-beans-5).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/language_modeling.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/language_modeling.md
new file mode 100644
index 0000000000000000000000000000000000000000..119026cd03f366ecd33253d4696ecff536cb8ebd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/language_modeling.md
@@ -0,0 +1,429 @@
+
+
+# Causal language modeling
+
+[[open-in-colab]]
+
+There are two types of language modeling, causal and masked. This guide illustrates causal language modeling.
+Causal language models are frequently used for text generation. You can use these models for creative applications like
+choosing your own text adventure or an intelligent coding assistant like Copilot or CodeParrot.
+
+
+
+Causal language modeling predicts the next token in a sequence of tokens, and the model can only attend to tokens on
+the left. This means the model cannot see future tokens. GPT-2 is an example of a causal language model.
+
+This guide will show you how to:
+
+1. Finetune [DistilGPT2](https://huggingface.co/distilbert/distilgpt2) on the [r/askscience](https://www.reddit.com/r/askscience/) subset of the [ELI5](https://huggingface.co/datasets/eli5) dataset.
+2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/text-generation)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate
+```
+
+We encourage you to log in to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load ELI5 dataset
+
+Start by loading the first 5000 examples from the [ELI5-Category](https://huggingface.co/datasets/eli5_category) dataset with the ๐ค Datasets library. This'll give you a chance to experiment and make sure everything works before spending more time training on the full dataset.
+
+```py
+>>> from datasets import load_dataset
+
+>>> eli5 = load_dataset("eli5_category", split="train[:5000]")
+```
+
+Split the dataset's `train` split into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+```py
+>>> eli5 = eli5.train_test_split(test_size=0.2)
+```
+
+Then take a look at an example:
+
+```py
+>>> eli5["train"][0]
+{'q_id': '7h191n',
+ 'title': 'What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?',
+ 'selftext': '',
+ 'category': 'Economics',
+ 'subreddit': 'explainlikeimfive',
+ 'answers': {'a_id': ['dqnds8l', 'dqnd1jl', 'dqng3i1', 'dqnku5x'],
+ 'text': ["The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It's not just an adjustment to the income tax brackets, it's a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it's the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.",
+ 'None yet. It has to be reconciled with a vastly different house bill and then passed again.',
+ 'Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?',
+ 'This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0'],
+ 'score': [21, 19, 5, 3],
+ 'text_urls': [[],
+ [],
+ [],
+ ['https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/']]},
+ 'title_urls': ['url'],
+ 'selftext_urls': ['url']}
+```
+
+While this may look like a lot, you're only really interested in the `text` field. What's cool about language modeling
+tasks is you don't need labels (also known as an unsupervised task) because the next word *is* the label.
+
+## Preprocess
+
+
+
+The next step is to load a DistilGPT2 tokenizer to process the `text` subfield:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilgpt2")
+```
+
+You'll notice from the example above, the `text` field is actually nested inside `answers`. This means you'll need to
+extract the `text` subfield from its nested structure with the [`flatten`](https://huggingface.co/docs/datasets/process#flatten) method:
+
+```py
+>>> eli5 = eli5.flatten()
+>>> eli5["train"][0]
+{'q_id': '7h191n',
+ 'title': 'What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?',
+ 'selftext': '',
+ 'category': 'Economics',
+ 'subreddit': 'explainlikeimfive',
+ 'answers.a_id': ['dqnds8l', 'dqnd1jl', 'dqng3i1', 'dqnku5x'],
+ 'answers.text': ["The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It's not just an adjustment to the income tax brackets, it's a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it's the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.",
+ 'None yet. It has to be reconciled with a vastly different house bill and then passed again.',
+ 'Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?',
+ 'This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0'],
+ 'answers.score': [21, 19, 5, 3],
+ 'answers.text_urls': [[],
+ [],
+ [],
+ ['https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/']],
+ 'title_urls': ['url'],
+ 'selftext_urls': ['url']}
+```
+
+Each subfield is now a separate column as indicated by the `answers` prefix, and the `text` field is a list now. Instead
+of tokenizing each sentence separately, convert the list to a string so you can jointly tokenize them.
+
+Here is a first preprocessing function to join the list of strings for each example and tokenize the result:
+
+```py
+>>> def preprocess_function(examples):
+... return tokenizer([" ".join(x) for x in examples["answers.text"]])
+```
+
+To apply this preprocessing function over the entire dataset, use the ๐ค Datasets [`~datasets.Dataset.map`] method. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once, and increasing the number of processes with `num_proc`. Remove any columns you don't need:
+
+```py
+>>> tokenized_eli5 = eli5.map(
+... preprocess_function,
+... batched=True,
+... num_proc=4,
+... remove_columns=eli5["train"].column_names,
+... )
+```
+
+This dataset contains the token sequences, but some of these are longer than the maximum input length for the model.
+
+You can now use a second preprocessing function to
+
+- concatenate all the sequences
+- split the concatenated sequences into shorter chunks defined by `block_size`, which should be both shorter than the maximum input length and short enough for your GPU RAM.
+
+```py
+>>> block_size = 128
+
+
+>>> def group_texts(examples):
+... # Concatenate all texts.
+... concatenated_examples = {k: sum(examples[k], []) for k in examples.keys()}
+... total_length = len(concatenated_examples[list(examples.keys())[0]])
+... # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
+... # customize this part to your needs.
+... if total_length >= block_size:
+... total_length = (total_length // block_size) * block_size
+... # Split by chunks of block_size.
+... result = {
+... k: [t[i : i + block_size] for i in range(0, total_length, block_size)]
+... for k, t in concatenated_examples.items()
+... }
+... result["labels"] = result["input_ids"].copy()
+... return result
+```
+
+Apply the `group_texts` function over the entire dataset:
+
+```py
+>>> lm_dataset = tokenized_eli5.map(group_texts, batched=True, num_proc=4)
+```
+
+Now create a batch of examples using [`DataCollatorForLanguageModeling`]. It's more efficient to *dynamically pad* the
+sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
+
+
+
+Use the end-of-sequence token as the padding token and set `mlm=False`. This will use the inputs as labels shifted to the right by one element:
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> tokenizer.pad_token = tokenizer.eos_token
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False)
+```
+
+
+
+Use the end-of-sequence token as the padding token and set `mlm=False`. This will use the inputs as labels shifted to the right by one element:
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False, return_tensors="tf")
+```
+
+
+
+
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the [basic tutorial](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load DistilGPT2 with [`AutoModelForCausalLM`]:
+
+```py
+>>> from transformers import AutoModelForCausalLM, TrainingArguments, Trainer
+
+>>> model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model).
+2. Pass the training arguments to [`Trainer`] along with the model, datasets, and data collator.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_eli5_clm-model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=lm_dataset["train"],
+... eval_dataset=lm_dataset["test"],
+... data_collator=data_collator,
+... tokenizer=tokenizer,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, use the [`~transformers.Trainer.evaluate`] method to evaluate your model and get its perplexity:
+
+```py
+>>> import math
+
+>>> eval_results = trainer.evaluate()
+>>> print(f"Perplexity: {math.exp(eval_results['eval_loss']):.2f}")
+Perplexity: 49.61
+```
+
+Then share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the [basic tutorial](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+Then you can load DistilGPT2 with [`TFAutoModelForCausalLM`]:
+
+```py
+>>> from transformers import TFAutoModelForCausalLM
+
+>>> model = TFAutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... lm_dataset["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... lm_dataset["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method). Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+This can be done by specifying where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> callback = PushToHubCallback(
+... output_dir="my_awesome_eli5_clm-model",
+... tokenizer=tokenizer,
+... )
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callback to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=[callback])
+```
+
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+For a more in-depth example of how to finetune a model for causal language modeling, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb).
+
+
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Come up with a prompt you'd like to generate text from:
+
+```py
+>>> prompt = "Somatic hypermutation allows the immune system to"
+```
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for text generation with your model, and pass your text to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> generator = pipeline("text-generation", model="username/my_awesome_eli5_clm-model")
+>>> generator(prompt)
+[{'generated_text': "Somatic hypermutation allows the immune system to be able to effectively reverse the damage caused by an infection.\n\n\nThe damage caused by an infection is caused by the immune system's ability to perform its own self-correcting tasks."}]
+```
+
+
+
+Tokenize the text and return the `input_ids` as PyTorch tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_eli5_clm-model")
+>>> inputs = tokenizer(prompt, return_tensors="pt").input_ids
+```
+
+Use the [`~generation.GenerationMixin.generate`] method to generate text.
+For more details about the different text generation strategies and parameters for controlling generation, check out the [Text generation strategies](../generation_strategies) page.
+
+```py
+>>> from transformers import AutoModelForCausalLM
+
+>>> model = AutoModelForCausalLM.from_pretrained("username/my_awesome_eli5_clm-model")
+>>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
+```
+
+Decode the generated token ids back into text:
+
+```py
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+["Somatic hypermutation allows the immune system to react to drugs with the ability to adapt to a different environmental situation. In other words, a system of 'hypermutation' can help the immune system to adapt to a different environmental situation or in some cases even a single life. In contrast, researchers at the University of Massachusetts-Boston have found that 'hypermutation' is much stronger in mice than in humans but can be found in humans, and that it's not completely unknown to the immune system. A study on how the immune system"]
+```
+
+
+Tokenize the text and return the `input_ids` as TensorFlow tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_eli5_clm-model")
+>>> inputs = tokenizer(prompt, return_tensors="tf").input_ids
+```
+
+Use the [`~transformers.generation_tf_utils.TFGenerationMixin.generate`] method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the [Text generation strategies](../generation_strategies) page.
+
+```py
+>>> from transformers import TFAutoModelForCausalLM
+
+>>> model = TFAutoModelForCausalLM.from_pretrained("username/my_awesome_eli5_clm-model")
+>>> outputs = model.generate(input_ids=inputs, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
+```
+
+Decode the generated token ids back into text:
+
+```py
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Somatic hypermutation allows the immune system to detect the presence of other viruses as they become more prevalent. Therefore, researchers have identified a high proportion of human viruses. The proportion of virus-associated viruses in our study increases with age. Therefore, we propose a simple algorithm to detect the presence of these new viruses in our samples as a sign of improved immunity. A first study based on this algorithm, which will be published in Science on Friday, aims to show that this finding could translate into the development of a better vaccine that is more effective for']
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/mask_generation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/mask_generation.md
new file mode 100644
index 0000000000000000000000000000000000000000..db16e035e303e0fe3b168bf5f1caf4e2b13759de
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/mask_generation.md
@@ -0,0 +1,238 @@
+
+
+# Mask Generation
+
+Mask generation is the task of generating semantically meaningful masks for an image.
+This task is very similar to [image segmentation](semantic_segmentation), but many differences exist. Image segmentation models are trained on labeled datasets and are limited to the classes they have seen during training; they return a set of masks and corresponding classes, given an image.
+
+Mask generation models are trained on large amounts of data and operate in two modes.
+- Prompting mode: In this mode, the model takes in an image and a prompt, where a prompt can be a 2D point location (XY coordinates) in the image within an object or a bounding box surrounding an object. In prompting mode, the model only returns the mask over the object
+that the prompt is pointing out.
+- Segment Everything mode: In segment everything, given an image, the model generates every mask in the image. To do so, a grid of points is generated and overlaid on the image for inference.
+
+Mask generation task is supported by [Segment Anything Model (SAM)](model_doc/sam). It's a powerful model that consists of a Vision Transformer-based image encoder, a prompt encoder, and a two-way transformer mask decoder. Images and prompts are encoded, and the decoder takes these embeddings and generates valid masks.
+
+
+
+
+
+SAM serves as a powerful foundation model for segmentation as it has large data coverage. It is trained on
+[SA-1B](https://ai.meta.com/datasets/segment-anything/), a dataset with 1 million images and 1.1 billion masks.
+
+In this guide, you will learn how to:
+- Infer in segment everything mode with batching,
+- Infer in point prompting mode,
+- Infer in box prompting mode.
+
+First, let's install `transformers`:
+
+```bash
+pip install -q transformers
+```
+
+## Mask Generation Pipeline
+
+The easiest way to infer mask generation models is to use the `mask-generation` pipeline.
+
+```python
+>>> from transformers import pipeline
+
+>>> checkpoint = "facebook/sam-vit-base"
+>>> mask_generator = pipeline(model=checkpoint, task="mask-generation")
+```
+
+Let's see the image.
+
+```python
+from PIL import Image
+import requests
+
+img_url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"
+image = Image.open(requests.get(img_url, stream=True).raw).convert("RGB")
+```
+
+
+
+
+
+Let's segment everything. `points-per-batch` enables parallel inference of points in segment everything mode. This enables faster inference, but consumes more memory. Moreover, SAM only enables batching over points and not the images. `pred_iou_thresh` is the IoU confidence threshold where only the masks above that certain threshold are returned.
+
+```python
+masks = mask_generator(image, points_per_batch=128, pred_iou_thresh=0.88)
+```
+
+The `masks` looks like the following:
+
+```bash
+{'masks': [array([[False, False, False, ..., True, True, True],
+ [False, False, False, ..., True, True, True],
+ [False, False, False, ..., True, True, True],
+ ...,
+ [False, False, False, ..., False, False, False],
+ [False, False, False, ..., False, False, False],
+ [False, False, False, ..., False, False, False]]),
+ array([[False, False, False, ..., False, False, False],
+ [False, False, False, ..., False, False, False],
+ [False, False, False, ..., False, False, False],
+ ...,
+'scores': tensor([0.9972, 0.9917,
+ ...,
+}
+```
+
+We can visualize them like this:
+
+```python
+import matplotlib.pyplot as plt
+
+plt.imshow(image, cmap='gray')
+
+for i, mask in enumerate(masks["masks"]):
+ plt.imshow(mask, cmap='viridis', alpha=0.1, vmin=0, vmax=1)
+
+plt.axis('off')
+plt.show()
+```
+
+Below is the original image in grayscale with colorful maps overlaid. Very impressive.
+
+
+
+
+
+
+## Model Inference
+
+### Point Prompting
+
+You can also use the model without the pipeline. To do so, initialize the model and
+the processor.
+
+```python
+from transformers import SamModel, SamProcessor
+import torch
+from accelerate.test_utils.testing import get_backend
+# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+device, _, _ = get_backend()
+model = SamModel.from_pretrained("facebook/sam-vit-base").to(device)
+processor = SamProcessor.from_pretrained("facebook/sam-vit-base")
+```
+
+To do point prompting, pass the input point to the processor, then take the processor output
+and pass it to the model for inference. To post-process the model output, pass the outputs and
+`original_sizes` and `reshaped_input_sizes` we take from the processor's initial output. We need to pass these
+since the processor resizes the image, and the output needs to be extrapolated.
+
+```python
+input_points = [[[2592, 1728]]] # point location of the bee
+
+inputs = processor(image, input_points=input_points, return_tensors="pt").to(device)
+with torch.no_grad():
+ outputs = model(**inputs)
+masks = processor.image_processor.post_process_masks(outputs.pred_masks.cpu(), inputs["original_sizes"].cpu(), inputs["reshaped_input_sizes"].cpu())
+```
+We can visualize the three masks in the `masks`ย output.
+
+```python
+import matplotlib.pyplot as plt
+import numpy as np
+
+fig, axes = plt.subplots(1, 4, figsize=(15, 5))
+
+axes[0].imshow(image)
+axes[0].set_title('Original Image')
+mask_list = [masks[0][0][0].numpy(), masks[0][0][1].numpy(), masks[0][0][2].numpy()]
+
+for i, mask in enumerate(mask_list, start=1):
+ overlayed_image = np.array(image).copy()
+
+ overlayed_image[:,:,0] = np.where(mask == 1, 255, overlayed_image[:,:,0])
+ overlayed_image[:,:,1] = np.where(mask == 1, 0, overlayed_image[:,:,1])
+ overlayed_image[:,:,2] = np.where(mask == 1, 0, overlayed_image[:,:,2])
+
+ axes[i].imshow(overlayed_image)
+ axes[i].set_title(f'Mask {i}')
+for ax in axes:
+ ax.axis('off')
+
+plt.show()
+```
+
+
+
+
+
+### Box Prompting
+
+You can also do box prompting in a similar fashion to point prompting. You can simply pass the input box in the format of a list
+`[x_min, y_min, x_max, y_max]` format along with the image to the `processor`. Take the processor output and directly pass it
+to the model, then post-process the output again.
+
+
+```python
+# bounding box around the bee
+box = [2350, 1600, 2850, 2100]
+
+inputs = processor(
+ image,
+ input_boxes=[[[box]]],
+ return_tensors="pt"
+ ).to("cuda")
+
+with torch.no_grad():
+ outputs = model(**inputs)
+
+mask = processor.image_processor.post_process_masks(
+ outputs.pred_masks.cpu(),
+ inputs["original_sizes"].cpu(),
+ inputs["reshaped_input_sizes"].cpu()
+)[0][0][0].numpy()
+```
+
+You can visualize the bounding box around the bee as shown below.
+
+```python
+import matplotlib.patches as patches
+
+fig, ax = plt.subplots()
+ax.imshow(image)
+
+rectangle = patches.Rectangle((2350, 1600), 500, 500, linewidth=2, edgecolor='r', facecolor='none')
+ax.add_patch(rectangle)
+ax.axis("off")
+plt.show()
+```
+
+
+
+
+
+You can see the inference output below.
+
+```python
+fig, ax = plt.subplots()
+ax.imshow(image)
+ax.imshow(mask, cmap='viridis', alpha=0.4)
+
+ax.axis("off")
+plt.show()
+```
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/masked_language_modeling.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/masked_language_modeling.md
new file mode 100644
index 0000000000000000000000000000000000000000..469b1d7fcb99f63b0746cbba82dd5e8657cae7a3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/masked_language_modeling.md
@@ -0,0 +1,445 @@
+
+
+# Masked language modeling
+
+[[open-in-colab]]
+
+
+
+Masked language modeling predicts a masked token in a sequence, and the model can attend to tokens bidirectionally. This
+means the model has full access to the tokens on the left and right. Masked language modeling is great for tasks that
+require a good contextual understanding of an entire sequence. BERT is an example of a masked language model.
+
+This guide will show you how to:
+
+1. Finetune [DistilRoBERTa](https://huggingface.co/distilbert/distilroberta-base) on the [r/askscience](https://www.reddit.com/r/askscience/) subset of the [ELI5](https://huggingface.co/datasets/eli5) dataset.
+2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/fill-mask)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate
+```
+
+We encourage you to log in to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load ELI5 dataset
+
+Start by loading the first 5000 examples from the [ELI5-Category](https://huggingface.co/datasets/eli5_category) dataset with the ๐ค Datasets library. This'll give you a chance to experiment and make sure everything works before spending more time training on the full dataset.
+
+```py
+>>> from datasets import load_dataset
+
+>>> eli5 = load_dataset("eli5_category", split="train[:5000]")
+```
+
+Split the dataset's `train` split into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+```py
+>>> eli5 = eli5.train_test_split(test_size=0.2)
+```
+
+Then take a look at an example:
+
+```py
+>>> eli5["train"][0]
+{'q_id': '7h191n',
+ 'title': 'What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?',
+ 'selftext': '',
+ 'category': 'Economics',
+ 'subreddit': 'explainlikeimfive',
+ 'answers': {'a_id': ['dqnds8l', 'dqnd1jl', 'dqng3i1', 'dqnku5x'],
+ 'text': ["The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It's not just an adjustment to the income tax brackets, it's a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it's the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.",
+ 'None yet. It has to be reconciled with a vastly different house bill and then passed again.',
+ 'Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?',
+ 'This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0'],
+ 'score': [21, 19, 5, 3],
+ 'text_urls': [[],
+ [],
+ [],
+ ['https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/']]},
+ 'title_urls': ['url'],
+ 'selftext_urls': ['url']}
+```
+
+While this may look like a lot, you're only really interested in the `text` field. What's cool about language modeling tasks is you don't need labels (also known as an unsupervised task) because the next word *is* the label.
+
+## Preprocess
+
+
+
+For masked language modeling, the next step is to load a DistilRoBERTa tokenizer to process the `text` subfield:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilroberta-base")
+```
+
+You'll notice from the example above, the `text` field is actually nested inside `answers`. This means you'll need to extract the `text` subfield from its nested structure with the [`flatten`](https://huggingface.co/docs/datasets/process#flatten) method:
+
+```py
+>>> eli5 = eli5.flatten()
+>>> eli5["train"][0]
+{'q_id': '7h191n',
+ 'title': 'What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?',
+ 'selftext': '',
+ 'category': 'Economics',
+ 'subreddit': 'explainlikeimfive',
+ 'answers.a_id': ['dqnds8l', 'dqnd1jl', 'dqng3i1', 'dqnku5x'],
+ 'answers.text': ["The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It's not just an adjustment to the income tax brackets, it's a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it's the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.",
+ 'None yet. It has to be reconciled with a vastly different house bill and then passed again.',
+ 'Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?',
+ 'This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0'],
+ 'answers.score': [21, 19, 5, 3],
+ 'answers.text_urls': [[],
+ [],
+ [],
+ ['https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/']],
+ 'title_urls': ['url'],
+ 'selftext_urls': ['url']}
+```
+
+Each subfield is now a separate column as indicated by the `answers` prefix, and the `text` field is a list now. Instead
+of tokenizing each sentence separately, convert the list to a string so you can jointly tokenize them.
+
+Here is a first preprocessing function to join the list of strings for each example and tokenize the result:
+
+```py
+>>> def preprocess_function(examples):
+... return tokenizer([" ".join(x) for x in examples["answers.text"]])
+```
+
+To apply this preprocessing function over the entire dataset, use the ๐ค Datasets [`~datasets.Dataset.map`] method. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once, and increasing the number of processes with `num_proc`. Remove any columns you don't need:
+
+```py
+>>> tokenized_eli5 = eli5.map(
+... preprocess_function,
+... batched=True,
+... num_proc=4,
+... remove_columns=eli5["train"].column_names,
+... )
+```
+
+This dataset contains the token sequences, but some of these are longer than the maximum input length for the model.
+
+You can now use a second preprocessing function to
+- concatenate all the sequences
+- split the concatenated sequences into shorter chunks defined by `block_size`, which should be both shorter than the maximum input length and short enough for your GPU RAM.
+
+```py
+>>> block_size = 128
+
+
+>>> def group_texts(examples):
+... # Concatenate all texts.
+... concatenated_examples = {k: sum(examples[k], []) for k in examples.keys()}
+... total_length = len(concatenated_examples[list(examples.keys())[0]])
+... # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
+... # customize this part to your needs.
+... if total_length >= block_size:
+... total_length = (total_length // block_size) * block_size
+... # Split by chunks of block_size.
+... result = {
+... k: [t[i : i + block_size] for i in range(0, total_length, block_size)]
+... for k, t in concatenated_examples.items()
+... }
+... return result
+```
+
+Apply the `group_texts` function over the entire dataset:
+
+```py
+>>> lm_dataset = tokenized_eli5.map(group_texts, batched=True, num_proc=4)
+```
+
+Now create a batch of examples using [`DataCollatorForLanguageModeling`]. It's more efficient to *dynamically pad* the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
+
+
+
+
+Use the end-of-sequence token as the padding token and specify `mlm_probability` to randomly mask tokens each time you iterate over the data:
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> tokenizer.pad_token = tokenizer.eos_token
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=0.15)
+```
+
+
+
+Use the end-of-sequence token as the padding token and specify `mlm_probability` to randomly mask tokens each time you iterate over the data:
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=0.15, return_tensors="tf")
+```
+
+
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load DistilRoBERTa with [`AutoModelForMaskedLM`]:
+
+```py
+>>> from transformers import AutoModelForMaskedLM
+
+>>> model = AutoModelForMaskedLM.from_pretrained("distilbert/distilroberta-base")
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model).
+2. Pass the training arguments to [`Trainer`] along with the model, datasets, and data collator.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_eli5_mlm_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=lm_dataset["train"],
+... eval_dataset=lm_dataset["test"],
+... data_collator=data_collator,
+... tokenizer=tokenizer,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, use the [`~transformers.Trainer.evaluate`] method to evaluate your model and get its perplexity:
+
+```py
+>>> import math
+
+>>> eval_results = trainer.evaluate()
+>>> print(f"Perplexity: {math.exp(eval_results['eval_loss']):.2f}")
+Perplexity: 8.76
+```
+
+Then share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the basic tutorial [here](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+Then you can load DistilRoBERTa with [`TFAutoModelForMaskedLM`]:
+
+```py
+>>> from transformers import TFAutoModelForMaskedLM
+
+>>> model = TFAutoModelForMaskedLM.from_pretrained("distilbert/distilroberta-base")
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... lm_dataset["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... lm_dataset["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method). Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+This can be done by specifying where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> callback = PushToHubCallback(
+... output_dir="my_awesome_eli5_mlm_model",
+... tokenizer=tokenizer,
+... )
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callback to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=[callback])
+```
+
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+For a more in-depth example of how to finetune a model for masked language modeling, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb).
+
+
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Come up with some text you'd like the model to fill in the blank with, and use the special `` token to indicate the blank:
+
+```py
+>>> text = "The Milky Way is a galaxy."
+```
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for fill-mask with your model, and pass your text to it. If you like, you can use the `top_k` parameter to specify how many predictions to return:
+
+```py
+>>> from transformers import pipeline
+
+>>> mask_filler = pipeline("fill-mask", "username/my_awesome_eli5_mlm_model")
+>>> mask_filler(text, top_k=3)
+[{'score': 0.5150994658470154,
+ 'token': 21300,
+ 'token_str': ' spiral',
+ 'sequence': 'The Milky Way is a spiral galaxy.'},
+ {'score': 0.07087188959121704,
+ 'token': 2232,
+ 'token_str': ' massive',
+ 'sequence': 'The Milky Way is a massive galaxy.'},
+ {'score': 0.06434620916843414,
+ 'token': 650,
+ 'token_str': ' small',
+ 'sequence': 'The Milky Way is a small galaxy.'}]
+```
+
+
+
+Tokenize the text and return the `input_ids` as PyTorch tensors. You'll also need to specify the position of the `` token:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_eli5_mlm_model")
+>>> inputs = tokenizer(text, return_tensors="pt")
+>>> mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1]
+```
+
+Pass your inputs to the model and return the `logits` of the masked token:
+
+```py
+>>> from transformers import AutoModelForMaskedLM
+
+>>> model = AutoModelForMaskedLM.from_pretrained("username/my_awesome_eli5_mlm_model")
+>>> logits = model(**inputs).logits
+>>> mask_token_logits = logits[0, mask_token_index, :]
+```
+
+Then return the three masked tokens with the highest probability and print them out:
+
+```py
+>>> top_3_tokens = torch.topk(mask_token_logits, 3, dim=1).indices[0].tolist()
+
+>>> for token in top_3_tokens:
+... print(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
+The Milky Way is a spiral galaxy.
+The Milky Way is a massive galaxy.
+The Milky Way is a small galaxy.
+```
+
+
+Tokenize the text and return the `input_ids` as TensorFlow tensors. You'll also need to specify the position of the `` token:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_eli5_mlm_model")
+>>> inputs = tokenizer(text, return_tensors="tf")
+>>> mask_token_index = tf.where(inputs["input_ids"] == tokenizer.mask_token_id)[0, 1]
+```
+
+Pass your inputs to the model and return the `logits` of the masked token:
+
+```py
+>>> from transformers import TFAutoModelForMaskedLM
+
+>>> model = TFAutoModelForMaskedLM.from_pretrained("username/my_awesome_eli5_mlm_model")
+>>> logits = model(**inputs).logits
+>>> mask_token_logits = logits[0, mask_token_index, :]
+```
+
+Then return the three masked tokens with the highest probability and print them out:
+
+```py
+>>> top_3_tokens = tf.math.top_k(mask_token_logits, 3).indices.numpy()
+
+>>> for token in top_3_tokens:
+... print(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
+The Milky Way is a spiral galaxy.
+The Milky Way is a massive galaxy.
+The Milky Way is a small galaxy.
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/monocular_depth_estimation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/monocular_depth_estimation.md
new file mode 100644
index 0000000000000000000000000000000000000000..edd22122f32bd6832633889ab8b1df357e85c90e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/monocular_depth_estimation.md
@@ -0,0 +1,161 @@
+
+
+# Monocular depth estimation
+
+Monocular depth estimation is a computer vision task that involves predicting the depth information of a scene from a
+single image. In other words, it is the process of estimating the distance of objects in a scene from
+a single camera viewpoint.
+
+Monocular depth estimation has various applications, including 3D reconstruction, augmented reality, autonomous driving,
+and robotics. It is a challenging task as it requires the model to understand the complex relationships between objects
+in the scene and the corresponding depth information, which can be affected by factors such as lighting conditions,
+occlusion, and texture.
+
+There are two main depth estimation categories:
+
+- **Absolute depth estimation**: This task variant aims to provide exact depth measurements from the camera. The term is used interchangeably with metric depth estimation, where depth is provided in precise measurements in meters or feet. Absolute depth estimation models output depth maps with numerical values that represent real-world distances.
+
+- **Relative depth estimation**: Relative depth estimation aims to predict the depth order of objects or points in a scene without providing the precise measurements. These models output a depth map that indicates which parts of the scene are closer or farther relative to each other without the actual distances to A and B.
+
+In this guide, we will see how to infer with [Depth Anything V2](https://huggingface.co/depth-anything/Depth-Anything-V2-Large), a state-of-the-art zero-shot relative depth estimation model, and [ZoeDepth](https://huggingface.co/docs/transformers/main/en/model_doc/zoedepth), an absolute depth estimation model.
+
+
+
+Check the [Depth Estimation](https://huggingface.co/tasks/depth-estimation) task page to view all compatible architectures and checkpoints.
+
+
+
+Before we begin, we need to install the latest version of Transformers:
+
+```bash
+pip install -q -U transformers
+```
+
+## Depth estimation pipeline
+
+The simplest way to try out inference with a model supporting depth estimation is to use the corresponding [`pipeline`].
+Instantiate a pipeline from a [checkpoint on the Hugging Face Hub](https://huggingface.co/models?pipeline_tag=depth-estimation&sort=downloads):
+
+```py
+>>> from transformers import pipeline
+>>> import torch
+>>> from accelerate.test_utils.testing import get_backend
+# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+>>> device, _, _ = get_backend()
+>>> checkpoint = "depth-anything/Depth-Anything-V2-base-hf"
+>>> pipe = pipeline("depth-estimation", model=checkpoint, device=device)
+```
+
+Next, choose an image to analyze:
+
+```py
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+>>> image
+```
+
+
+
+
+
+Pass the image to the pipeline.
+
+```py
+>>> predictions = pipe(image)
+```
+
+The pipeline returns a dictionary with two entries. The first one, called `predicted_depth`, is a tensor with the values
+being the depth expressed in meters for each pixel.
+The second one, `depth`, is a PIL image that visualizes the depth estimation result.
+
+Let's take a look at the visualized result:
+
+```py
+>>> predictions["depth"]
+```
+
+
+
+
+
+## Depth estimation inference by hand
+
+Now that you've seen how to use the depth estimation pipeline, let's see how we can replicate the same result by hand.
+
+Start by loading the model and associated processor from a [checkpoint on the Hugging Face Hub](https://huggingface.co/models?pipeline_tag=depth-estimation&sort=downloads).
+Here we'll use the same checkpoint as before:
+
+```py
+>>> from transformers import AutoImageProcessor, AutoModelForDepthEstimation
+
+>>> checkpoint = "Intel/zoedepth-nyu-kitti"
+
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint)
+>>> model = AutoModelForDepthEstimation.from_pretrained(checkpoint).to(device)
+```
+
+Prepare the image input for the model using the `image_processor` that will take care of the necessary image transformations
+such as resizing and normalization:
+
+```py
+>>> pixel_values = image_processor(image, return_tensors="pt").pixel_values.to(device)
+```
+
+Pass the prepared inputs through the model:
+
+```py
+>>> import torch
+
+>>> with torch.no_grad():
+... outputs = model(pixel_values)
+```
+
+Let's post-process the results to remove any padding and resize the depth map to match the original image size. The `post_process_depth_estimation` outputs a list of dicts containing the `"predicted_depth"`.
+
+```py
+>>> # ZoeDepth dynamically pads the input image. Thus we pass the original image size as argument
+>>> # to `post_process_depth_estimation` to remove the padding and resize to original dimensions.
+>>> post_processed_output = image_processor.post_process_depth_estimation(
+... outputs,
+... source_sizes=[(image.height, image.width)],
+... )
+
+>>> predicted_depth = post_processed_output[0]["predicted_depth"]
+>>> depth = (predicted_depth - predicted_depth.min()) / (predicted_depth.max() - predicted_depth.min())
+>>> depth = depth.detach().cpu().numpy() * 255
+>>> depth = Image.fromarray(depth.astype("uint8"))
+```
+
+
+In the original implementation ZoeDepth model performs inference on both the original and flipped images and averages out the results. The post_process_depth_estimation function can handle this for us by passing the flipped outputs to the optional outputs_flipped argument:
+>>> with torch.no_grad():
+... outputs = model(pixel_values)
+... outputs_flipped = model(pixel_values=torch.flip(inputs.pixel_values, dims=[3]))
+>>> post_processed_output = image_processor.post_process_depth_estimation(
+... outputs,
+... source_sizes=[(image.height, image.width)],
+... outputs_flipped=outputs_flipped,
+... )
+
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/multiple_choice.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/multiple_choice.md
new file mode 100644
index 0000000000000000000000000000000000000000..18b12f2166637e6ff707bbba238ca75493653837
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/multiple_choice.md
@@ -0,0 +1,454 @@
+
+
+# Multiple choice
+
+[[open-in-colab]]
+
+A multiple choice task is similar to question answering, except several candidate answers are provided along with a context and the model is trained to select the correct answer.
+
+This guide will show you how to:
+
+1. Finetune [BERT](https://huggingface.co/google-bert/bert-base-uncased) on the `regular` configuration of the [SWAG](https://huggingface.co/datasets/swag) dataset to select the best answer given multiple options and some context.
+2. Use your finetuned model for inference.
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load SWAG dataset
+
+Start by loading the `regular` configuration of the SWAG dataset from the ๐ค Datasets library:
+
+```py
+>>> from datasets import load_dataset
+
+>>> swag = load_dataset("swag", "regular")
+```
+
+Then take a look at an example:
+
+```py
+>>> swag["train"][0]
+{'ending0': 'passes by walking down the street playing their instruments.',
+ 'ending1': 'has heard approaching them.',
+ 'ending2': "arrives and they're outside dancing and asleep.",
+ 'ending3': 'turns the lead singer watches the performance.',
+ 'fold-ind': '3416',
+ 'gold-source': 'gold',
+ 'label': 0,
+ 'sent1': 'Members of the procession walk down the street holding small horn brass instruments.',
+ 'sent2': 'A drum line',
+ 'startphrase': 'Members of the procession walk down the street holding small horn brass instruments. A drum line',
+ 'video-id': 'anetv_jkn6uvmqwh4'}
+```
+
+While it looks like there are a lot of fields here, it is actually pretty straightforward:
+
+- `sent1` and `sent2`: these fields show how a sentence starts, and if you put the two together, you get the `startphrase` field.
+- `ending`: suggests a possible ending for how a sentence can end, but only one of them is correct.
+- `label`: identifies the correct sentence ending.
+
+## Preprocess
+
+The next step is to load a BERT tokenizer to process the sentence starts and the four possible endings:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
+```
+
+The preprocessing function you want to create needs to:
+
+1. Make four copies of the `sent1` field and combine each of them with `sent2` to recreate how a sentence starts.
+2. Combine `sent2` with each of the four possible sentence endings.
+3. Flatten these two lists so you can tokenize them, and then unflatten them afterward so each example has a corresponding `input_ids`, `attention_mask`, and `labels` field.
+
+```py
+>>> ending_names = ["ending0", "ending1", "ending2", "ending3"]
+
+
+>>> def preprocess_function(examples):
+... first_sentences = [[context] * 4 for context in examples["sent1"]]
+... question_headers = examples["sent2"]
+... second_sentences = [
+... [f"{header} {examples[end][i]}" for end in ending_names] for i, header in enumerate(question_headers)
+... ]
+
+... first_sentences = sum(first_sentences, [])
+... second_sentences = sum(second_sentences, [])
+
+... tokenized_examples = tokenizer(first_sentences, second_sentences, truncation=True)
+... return {k: [v[i : i + 4] for i in range(0, len(v), 4)] for k, v in tokenized_examples.items()}
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] method. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once:
+
+```py
+tokenized_swag = swag.map(preprocess_function, batched=True)
+```
+
+๐ค Transformers doesn't have a data collator for multiple choice, so you'll need to adapt the [`DataCollatorWithPadding`] to create a batch of examples. It's more efficient to *dynamically pad* the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
+
+`DataCollatorForMultipleChoice` flattens all the model inputs, applies padding, and then unflattens the results:
+
+
+
+```py
+>>> from dataclasses import dataclass
+>>> from transformers.tokenization_utils_base import PreTrainedTokenizerBase, PaddingStrategy
+>>> from typing import Optional, Union
+>>> import torch
+
+
+>>> @dataclass
+... class DataCollatorForMultipleChoice:
+... """
+... Data collator that will dynamically pad the inputs for multiple choice received.
+... """
+
+... tokenizer: PreTrainedTokenizerBase
+... padding: Union[bool, str, PaddingStrategy] = True
+... max_length: Optional[int] = None
+... pad_to_multiple_of: Optional[int] = None
+
+... def __call__(self, features):
+... label_name = "label" if "label" in features[0].keys() else "labels"
+... labels = [feature.pop(label_name) for feature in features]
+... batch_size = len(features)
+... num_choices = len(features[0]["input_ids"])
+... flattened_features = [
+... [{k: v[i] for k, v in feature.items()} for i in range(num_choices)] for feature in features
+... ]
+... flattened_features = sum(flattened_features, [])
+
+... batch = self.tokenizer.pad(
+... flattened_features,
+... padding=self.padding,
+... max_length=self.max_length,
+... pad_to_multiple_of=self.pad_to_multiple_of,
+... return_tensors="pt",
+... )
+
+... batch = {k: v.view(batch_size, num_choices, -1) for k, v in batch.items()}
+... batch["labels"] = torch.tensor(labels, dtype=torch.int64)
+... return batch
+```
+
+
+```py
+>>> from dataclasses import dataclass
+>>> from transformers.tokenization_utils_base import PreTrainedTokenizerBase, PaddingStrategy
+>>> from typing import Optional, Union
+>>> import tensorflow as tf
+
+
+>>> @dataclass
+... class DataCollatorForMultipleChoice:
+... """
+... Data collator that will dynamically pad the inputs for multiple choice received.
+... """
+
+... tokenizer: PreTrainedTokenizerBase
+... padding: Union[bool, str, PaddingStrategy] = True
+... max_length: Optional[int] = None
+... pad_to_multiple_of: Optional[int] = None
+
+... def __call__(self, features):
+... label_name = "label" if "label" in features[0].keys() else "labels"
+... labels = [feature.pop(label_name) for feature in features]
+... batch_size = len(features)
+... num_choices = len(features[0]["input_ids"])
+... flattened_features = [
+... [{k: v[i] for k, v in feature.items()} for i in range(num_choices)] for feature in features
+... ]
+... flattened_features = sum(flattened_features, [])
+
+... batch = self.tokenizer.pad(
+... flattened_features,
+... padding=self.padding,
+... max_length=self.max_length,
+... pad_to_multiple_of=self.pad_to_multiple_of,
+... return_tensors="tf",
+... )
+
+... batch = {k: tf.reshape(v, (batch_size, num_choices, -1)) for k, v in batch.items()}
+... batch["labels"] = tf.convert_to_tensor(labels, dtype=tf.int64)
+... return batch
+```
+
+
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load a evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [accuracy](https://huggingface.co/spaces/evaluate-metric/accuracy) metric (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric):
+
+```py
+>>> import evaluate
+
+>>> accuracy = evaluate.load("accuracy")
+```
+
+Then create a function that passes your predictions and labels to [`~evaluate.EvaluationModule.compute`] to calculate the accuracy:
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions, labels = eval_pred
+... predictions = np.argmax(predictions, axis=1)
+... return accuracy.compute(predictions=predictions, references=labels)
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load BERT with [`AutoModelForMultipleChoice`]:
+
+```py
+>>> from transformers import AutoModelForMultipleChoice, TrainingArguments, Trainer
+
+>>> model = AutoModelForMultipleChoice.from_pretrained("google-bert/bert-base-uncased")
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the accuracy and save the training checkpoint.
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_swag_model",
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... load_best_model_at_end=True,
+... learning_rate=5e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_swag["train"],
+... eval_dataset=tokenized_swag["validation"],
+... processing_class=tokenizer,
+... data_collator=DataCollatorForMultipleChoice(tokenizer=tokenizer),
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the basic tutorial [here](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_train_epochs = 2
+>>> total_train_steps = (len(tokenized_swag["train"]) // batch_size) * num_train_epochs
+>>> optimizer, schedule = create_optimizer(init_lr=5e-5, num_warmup_steps=0, num_train_steps=total_train_steps)
+```
+
+Then you can load BERT with [`TFAutoModelForMultipleChoice`]:
+
+```py
+>>> from transformers import TFAutoModelForMultipleChoice
+
+>>> model = TFAutoModelForMultipleChoice.from_pretrained("google-bert/bert-base-uncased")
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> data_collator = DataCollatorForMultipleChoice(tokenizer=tokenizer)
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_swag["train"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_swag["validation"],
+... shuffle=False,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method). Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+The last two things to setup before you start training is to compute the accuracy from the predictions, and provide a way to push your model to the Hub. Both are done by using [Keras callbacks](../main_classes/keras_callbacks).
+
+Pass your `compute_metrics` function to [`~transformers.KerasMetricCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)
+```
+
+Specify where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_model",
+... tokenizer=tokenizer,
+... )
+```
+
+Then bundle your callbacks together:
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=2, callbacks=callbacks)
+```
+
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+
+For a more in-depth example of how to finetune a model for multiple choice, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb).
+
+
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Come up with some text and two candidate answers:
+
+```py
+>>> prompt = "France has a bread law, Le Dรฉcret Pain, with strict rules on what is allowed in a traditional baguette."
+>>> candidate1 = "The law does not apply to croissants and brioche."
+>>> candidate2 = "The law applies to baguettes."
+```
+
+
+
+Tokenize each prompt and candidate answer pair and return PyTorch tensors. You should also create some `labels`:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_swag_model")
+>>> inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors="pt", padding=True)
+>>> labels = torch.tensor(0).unsqueeze(0)
+```
+
+Pass your inputs and labels to the model and return the `logits`:
+
+```py
+>>> from transformers import AutoModelForMultipleChoice
+
+>>> model = AutoModelForMultipleChoice.from_pretrained("username/my_awesome_swag_model")
+>>> outputs = model(**{k: v.unsqueeze(0) for k, v in inputs.items()}, labels=labels)
+>>> logits = outputs.logits
+```
+
+Get the class with the highest probability:
+
+```py
+>>> predicted_class = logits.argmax().item()
+>>> predicted_class
+0
+```
+
+
+Tokenize each prompt and candidate answer pair and return TensorFlow tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_swag_model")
+>>> inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors="tf", padding=True)
+```
+
+Pass your inputs to the model and return the `logits`:
+
+```py
+>>> from transformers import TFAutoModelForMultipleChoice
+
+>>> model = TFAutoModelForMultipleChoice.from_pretrained("username/my_awesome_swag_model")
+>>> inputs = {k: tf.expand_dims(v, 0) for k, v in inputs.items()}
+>>> outputs = model(inputs)
+>>> logits = outputs.logits
+```
+
+Get the class with the highest probability:
+
+```py
+>>> predicted_class = int(tf.math.argmax(logits, axis=-1)[0])
+>>> predicted_class
+0
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/object_detection.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/object_detection.md
new file mode 100644
index 0000000000000000000000000000000000000000..c307dd3334fe920e720248b0c486b1a3eb4974b4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/object_detection.md
@@ -0,0 +1,1540 @@
+
+
+# Object detection
+
+[[open-in-colab]]
+
+Object detection is the computer vision task of detecting instances (such as humans, buildings, or cars) in an image. Object detection models receive an image as input and output
+coordinates of the bounding boxes and associated labels of the detected objects. An image can contain multiple objects,
+each with its own bounding box and a label (e.g. it can have a car and a building), and each object can
+be present in different parts of an image (e.g. the image can have several cars).
+This task is commonly used in autonomous driving for detecting things like pedestrians, road signs, and traffic lights.
+Other applications include counting objects in images, image search, and more.
+
+In this guide, you will learn how to:
+
+ 1. Finetune [DETR](https://huggingface.co/docs/transformers/model_doc/detr), a model that combines a convolutional
+ backbone with an encoder-decoder Transformer, on the [CPPE-5](https://huggingface.co/datasets/cppe-5)
+ dataset.
+ 2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/object-detection)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install -q datasets transformers accelerate timm
+pip install -q -U albumentations>=1.4.5 torchmetrics pycocotools
+```
+
+You'll use ๐ค Datasets to load a dataset from the Hugging Face Hub, ๐ค Transformers to train your model,
+and `albumentations` to augment the data.
+
+We encourage you to share your model with the community. Log in to your Hugging Face account to upload it to the Hub.
+When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+To get started, we'll define global constants, namely the model name and image size. For this tutorial, we'll use the conditional DETR model due to its faster convergence. Feel free to select any object detection model available in the `transformers` library.
+
+```py
+>>> MODEL_NAME = "microsoft/conditional-detr-resnet-50" # or "facebook/detr-resnet-50"
+>>> IMAGE_SIZE = 480
+```
+
+## Load the CPPE-5 dataset
+
+The [CPPE-5 dataset](https://huggingface.co/datasets/cppe-5) contains images with
+annotations identifying medical personal protective equipment (PPE) in the context of the COVID-19 pandemic.
+
+Start by loading the dataset and creating a `validation` split from `train`:
+
+```py
+>>> from datasets import load_dataset
+
+>>> cppe5 = load_dataset("cppe-5")
+
+>>> if "validation" not in cppe5:
+... split = cppe5["train"].train_test_split(0.15, seed=1337)
+... cppe5["train"] = split["train"]
+... cppe5["validation"] = split["test"]
+
+>>> cppe5
+DatasetDict({
+ train: Dataset({
+ features: ['image_id', 'image', 'width', 'height', 'objects'],
+ num_rows: 850
+ })
+ test: Dataset({
+ features: ['image_id', 'image', 'width', 'height', 'objects'],
+ num_rows: 29
+ })
+ validation: Dataset({
+ features: ['image_id', 'image', 'width', 'height', 'objects'],
+ num_rows: 150
+ })
+})
+```
+
+You'll see that this dataset has 1000 images for train and validation sets and a test set with 29 images.
+
+To get familiar with the data, explore what the examples look like.
+
+```py
+>>> cppe5["train"][0]
+{
+ 'image_id': 366,
+ 'image': ,
+ 'width': 500,
+ 'height': 500,
+ 'objects': {
+ 'id': [1932, 1933, 1934],
+ 'area': [27063, 34200, 32431],
+ 'bbox': [[29.0, 11.0, 97.0, 279.0],
+ [201.0, 1.0, 120.0, 285.0],
+ [382.0, 0.0, 113.0, 287.0]],
+ 'category': [0, 0, 0]
+ }
+}
+```
+
+The examples in the dataset have the following fields:
+- `image_id`: the example image id
+- `image`: a `PIL.Image.Image` object containing the image
+- `width`: width of the image
+- `height`: height of the image
+- `objects`: a dictionary containing bounding box metadata for the objects in the image:
+ - `id`: the annotation id
+ - `area`: the area of the bounding box
+ - `bbox`: the object's bounding box (in the [COCO format](https://albumentations.ai/docs/getting_started/bounding_boxes_augmentation/#coco) )
+ - `category`: the object's category, with possible values including `Coverall (0)`, `Face_Shield (1)`, `Gloves (2)`, `Goggles (3)` and `Mask (4)`
+
+You may notice that the `bbox` field follows the COCO format, which is the format that the DETR model expects.
+However, the grouping of the fields inside `objects` differs from the annotation format DETR requires. You will
+need to apply some preprocessing transformations before using this data for training.
+
+To get an even better understanding of the data, visualize an example in the dataset.
+
+```py
+>>> import numpy as np
+>>> import os
+>>> from PIL import Image, ImageDraw
+
+>>> image = cppe5["train"][2]["image"]
+>>> annotations = cppe5["train"][2]["objects"]
+>>> draw = ImageDraw.Draw(image)
+
+>>> categories = cppe5["train"].features["objects"].feature["category"].names
+
+>>> id2label = {index: x for index, x in enumerate(categories, start=0)}
+>>> label2id = {v: k for k, v in id2label.items()}
+
+>>> for i in range(len(annotations["id"])):
+... box = annotations["bbox"][i]
+... class_idx = annotations["category"][i]
+... x, y, w, h = tuple(box)
+... # Check if coordinates are normalized or not
+... if max(box) > 1.0:
+... # Coordinates are un-normalized, no need to re-scale them
+... x1, y1 = int(x), int(y)
+... x2, y2 = int(x + w), int(y + h)
+... else:
+... # Coordinates are normalized, re-scale them
+... x1 = int(x * width)
+... y1 = int(y * height)
+... x2 = int((x + w) * width)
+... y2 = int((y + h) * height)
+... draw.rectangle((x, y, x + w, y + h), outline="red", width=1)
+... draw.text((x, y), id2label[class_idx], fill="white")
+
+>>> image
+```
+
+
+
+
+
+To visualize the bounding boxes with associated labels, you can get the labels from the dataset's metadata, specifically
+the `category` field.
+You'll also want to create dictionaries that map a label id to a label class (`id2label`) and the other way around (`label2id`).
+You can use them later when setting up the model. Including these maps will make your model reusable by others if you share
+it on the Hugging Face Hub. Please note that, the part of above code that draws the bounding boxes assume that it is in `COCO` format `(x_min, y_min, width, height)`. It has to be adjusted to work for other formats like `(x_min, y_min, x_max, y_max)`.
+
+As a final step of getting familiar with the data, explore it for potential issues. One common problem with datasets for
+object detection is bounding boxes that "stretch" beyond the edge of the image. Such "runaway" bounding boxes can raise
+errors during training and should be addressed. There are a few examples with this issue in this dataset.
+To keep things simple in this guide, we will set `clip=True` for `BboxParams` in transformations below.
+
+## Preprocess the data
+
+To finetune a model, you must preprocess the data you plan to use to match precisely the approach used for the pre-trained model.
+[`AutoImageProcessor`] takes care of processing image data to create `pixel_values`, `pixel_mask`, and
+`labels` that a DETR model can train with. The image processor has some attributes that you won't have to worry about:
+
+- `image_mean = [0.485, 0.456, 0.406 ]`
+- `image_std = [0.229, 0.224, 0.225]`
+
+These are the mean and standard deviation used to normalize images during the model pre-training. These values are crucial
+to replicate when doing inference or finetuning a pre-trained image model.
+
+Instantiate the image processor from the same checkpoint as the model you want to finetune.
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> MAX_SIZE = IMAGE_SIZE
+
+>>> image_processor = AutoImageProcessor.from_pretrained(
+... MODEL_NAME,
+... do_resize=True,
+... size={"max_height": MAX_SIZE, "max_width": MAX_SIZE},
+... do_pad=True,
+... pad_size={"height": MAX_SIZE, "width": MAX_SIZE},
+... )
+```
+
+Before passing the images to the `image_processor`, apply two preprocessing transformations to the dataset:
+- Augmenting images
+- Reformatting annotations to meet DETR expectations
+
+First, to make sure the model does not overfit on the training data, you can apply image augmentation with any data augmentation library. Here we use [Albumentations](https://albumentations.ai/docs/).
+This library ensures that transformations affect the image and update the bounding boxes accordingly.
+The ๐ค Datasets library documentation has a detailed [guide on how to augment images for object detection](https://huggingface.co/docs/datasets/object_detection),
+and it uses the exact same dataset as an example. Apply some geometric and color transformations to the image. For additional augmentation options, explore the [Albumentations Demo Space](https://huggingface.co/spaces/qubvel-hf/albumentations-demo).
+
+```py
+>>> import albumentations as A
+
+>>> train_augment_and_transform = A.Compose(
+... [
+... A.Perspective(p=0.1),
+... A.HorizontalFlip(p=0.5),
+... A.RandomBrightnessContrast(p=0.5),
+... A.HueSaturationValue(p=0.1),
+... ],
+... bbox_params=A.BboxParams(format="coco", label_fields=["category"], clip=True, min_area=25),
+... )
+
+>>> validation_transform = A.Compose(
+... [A.NoOp()],
+... bbox_params=A.BboxParams(format="coco", label_fields=["category"], clip=True),
+... )
+```
+
+The `image_processor` expects the annotations to be in the following format: `{'image_id': int, 'annotations': List[Dict]}`,
+ where each dictionary is a COCO object annotation. Let's add a function to reformat annotations for a single example:
+
+```py
+>>> def format_image_annotations_as_coco(image_id, categories, areas, bboxes):
+... """Format one set of image annotations to the COCO format
+
+... Args:
+... image_id (str): image id. e.g. "0001"
+... categories (List[int]): list of categories/class labels corresponding to provided bounding boxes
+... areas (List[float]): list of corresponding areas to provided bounding boxes
+... bboxes (List[Tuple[float]]): list of bounding boxes provided in COCO format
+... ([center_x, center_y, width, height] in absolute coordinates)
+
+... Returns:
+... dict: {
+... "image_id": image id,
+... "annotations": list of formatted annotations
+... }
+... """
+... annotations = []
+... for category, area, bbox in zip(categories, areas, bboxes):
+... formatted_annotation = {
+... "image_id": image_id,
+... "category_id": category,
+... "iscrowd": 0,
+... "area": area,
+... "bbox": list(bbox),
+... }
+... annotations.append(formatted_annotation)
+
+... return {
+... "image_id": image_id,
+... "annotations": annotations,
+... }
+
+```
+
+Now you can combine the image and annotation transformations to use on a batch of examples:
+
+```py
+>>> def augment_and_transform_batch(examples, transform, image_processor, return_pixel_mask=False):
+... """Apply augmentations and format annotations in COCO format for object detection task"""
+
+... images = []
+... annotations = []
+... for image_id, image, objects in zip(examples["image_id"], examples["image"], examples["objects"]):
+... image = np.array(image.convert("RGB"))
+
+... # apply augmentations
+... output = transform(image=image, bboxes=objects["bbox"], category=objects["category"])
+... images.append(output["image"])
+
+... # format annotations in COCO format
+... formatted_annotations = format_image_annotations_as_coco(
+... image_id, output["category"], objects["area"], output["bboxes"]
+... )
+... annotations.append(formatted_annotations)
+
+... # Apply the image processor transformations: resizing, rescaling, normalization
+... result = image_processor(images=images, annotations=annotations, return_tensors="pt")
+
+... if not return_pixel_mask:
+... result.pop("pixel_mask", None)
+
+... return result
+```
+
+Apply this preprocessing function to the entire dataset using ๐ค Datasets [`~datasets.Dataset.with_transform`] method. This method applies
+transformations on the fly when you load an element of the dataset.
+
+At this point, you can check what an example from the dataset looks like after the transformations. You should see a tensor
+with `pixel_values`, a tensor with `pixel_mask`, and `labels`.
+
+```py
+>>> from functools import partial
+
+>>> # Make transform functions for batch and apply for dataset splits
+>>> train_transform_batch = partial(
+... augment_and_transform_batch, transform=train_augment_and_transform, image_processor=image_processor
+... )
+>>> validation_transform_batch = partial(
+... augment_and_transform_batch, transform=validation_transform, image_processor=image_processor
+... )
+
+>>> cppe5["train"] = cppe5["train"].with_transform(train_transform_batch)
+>>> cppe5["validation"] = cppe5["validation"].with_transform(validation_transform_batch)
+>>> cppe5["test"] = cppe5["test"].with_transform(validation_transform_batch)
+
+>>> cppe5["train"][15]
+{'pixel_values': tensor([[[ 1.9235, 1.9407, 1.9749, ..., -0.7822, -0.7479, -0.6965],
+ [ 1.9578, 1.9749, 1.9920, ..., -0.7993, -0.7650, -0.7308],
+ [ 2.0092, 2.0092, 2.0263, ..., -0.8507, -0.8164, -0.7822],
+ ...,
+ [ 0.0741, 0.0741, 0.0741, ..., 0.0741, 0.0741, 0.0741],
+ [ 0.0741, 0.0741, 0.0741, ..., 0.0741, 0.0741, 0.0741],
+ [ 0.0741, 0.0741, 0.0741, ..., 0.0741, 0.0741, 0.0741]],
+
+ [[ 1.6232, 1.6408, 1.6583, ..., 0.8704, 1.0105, 1.1331],
+ [ 1.6408, 1.6583, 1.6758, ..., 0.8529, 0.9930, 1.0980],
+ [ 1.6933, 1.6933, 1.7108, ..., 0.8179, 0.9580, 1.0630],
+ ...,
+ [ 0.2052, 0.2052, 0.2052, ..., 0.2052, 0.2052, 0.2052],
+ [ 0.2052, 0.2052, 0.2052, ..., 0.2052, 0.2052, 0.2052],
+ [ 0.2052, 0.2052, 0.2052, ..., 0.2052, 0.2052, 0.2052]],
+
+ [[ 1.8905, 1.9080, 1.9428, ..., -0.1487, -0.0964, -0.0615],
+ [ 1.9254, 1.9428, 1.9603, ..., -0.1661, -0.1138, -0.0790],
+ [ 1.9777, 1.9777, 1.9951, ..., -0.2010, -0.1138, -0.0790],
+ ...,
+ [ 0.4265, 0.4265, 0.4265, ..., 0.4265, 0.4265, 0.4265],
+ [ 0.4265, 0.4265, 0.4265, ..., 0.4265, 0.4265, 0.4265],
+ [ 0.4265, 0.4265, 0.4265, ..., 0.4265, 0.4265, 0.4265]]]),
+ 'labels': {'image_id': tensor([688]), 'class_labels': tensor([3, 4, 2, 0, 0]), 'boxes': tensor([[0.4700, 0.1933, 0.1467, 0.0767],
+ [0.4858, 0.2600, 0.1150, 0.1000],
+ [0.4042, 0.4517, 0.1217, 0.1300],
+ [0.4242, 0.3217, 0.3617, 0.5567],
+ [0.6617, 0.4033, 0.5400, 0.4533]]), 'area': tensor([ 4048., 4140., 5694., 72478., 88128.]), 'iscrowd': tensor([0, 0, 0, 0, 0]), 'orig_size': tensor([480, 480])}}
+```
+
+You have successfully augmented the individual images and prepared their annotations. However, preprocessing isn't
+complete yet. In the final step, create a custom `collate_fn` to batch images together.
+Pad images (which are now `pixel_values`) to the largest image in a batch, and create a corresponding `pixel_mask`
+to indicate which pixels are real (1) and which are padding (0).
+
+```py
+>>> import torch
+
+>>> def collate_fn(batch):
+... data = {}
+... data["pixel_values"] = torch.stack([x["pixel_values"] for x in batch])
+... data["labels"] = [x["labels"] for x in batch]
+... if "pixel_mask" in batch[0]:
+... data["pixel_mask"] = torch.stack([x["pixel_mask"] for x in batch])
+... return data
+
+```
+
+## Preparing function to compute mAP
+
+Object detection models are commonly evaluated with a set of COCO-style metrics . We are going to use `torchmetrics` to compute `mAP` (mean average precision) and `mAR` (mean average recall) metrics and will wrap it to `compute_metrics` function in order to use in [`Trainer`] for evaluation.
+
+Intermediate format of boxes used for training is `YOLO` (normalized) but we will compute metrics for boxes in `Pascal VOC` (absolute) format in order to correctly handle box areas. Let's define a function that converts bounding boxes to `Pascal VOC` format:
+
+```py
+>>> from transformers.image_transforms import center_to_corners_format
+
+>>> def convert_bbox_yolo_to_pascal(boxes, image_size):
+... """
+... Convert bounding boxes from YOLO format (x_center, y_center, width, height) in range [0, 1]
+... to Pascal VOC format (x_min, y_min, x_max, y_max) in absolute coordinates.
+
+... Args:
+... boxes (torch.Tensor): Bounding boxes in YOLO format
+... image_size (Tuple[int, int]): Image size in format (height, width)
+
+... Returns:
+... torch.Tensor: Bounding boxes in Pascal VOC format (x_min, y_min, x_max, y_max)
+... """
+... # convert center to corners format
+... boxes = center_to_corners_format(boxes)
+
+... # convert to absolute coordinates
+... height, width = image_size
+... boxes = boxes * torch.tensor([[width, height, width, height]])
+
+... return boxes
+```
+
+Then, in `compute_metrics` function we collect `predicted` and `target` bounding boxes, scores and labels from evaluation loop results and pass it to the scoring function.
+
+```py
+>>> import numpy as np
+>>> from dataclasses import dataclass
+>>> from torchmetrics.detection.mean_ap import MeanAveragePrecision
+
+
+>>> @dataclass
+>>> class ModelOutput:
+... logits: torch.Tensor
+... pred_boxes: torch.Tensor
+
+
+>>> @torch.no_grad()
+>>> def compute_metrics(evaluation_results, image_processor, threshold=0.0, id2label=None):
+... """
+... Compute mean average mAP, mAR and their variants for the object detection task.
+
+... Args:
+... evaluation_results (EvalPrediction): Predictions and targets from evaluation.
+... threshold (float, optional): Threshold to filter predicted boxes by confidence. Defaults to 0.0.
+... id2label (Optional[dict], optional): Mapping from class id to class name. Defaults to None.
+
+... Returns:
+... Mapping[str, float]: Metrics in a form of dictionary {: }
+... """
+
+... predictions, targets = evaluation_results.predictions, evaluation_results.label_ids
+
+... # For metric computation we need to provide:
+... # - targets in a form of list of dictionaries with keys "boxes", "labels"
+... # - predictions in a form of list of dictionaries with keys "boxes", "scores", "labels"
+
+... image_sizes = []
+... post_processed_targets = []
+... post_processed_predictions = []
+
+... # Collect targets in the required format for metric computation
+... for batch in targets:
+... # collect image sizes, we will need them for predictions post processing
+... batch_image_sizes = torch.tensor(np.array([x["orig_size"] for x in batch]))
+... image_sizes.append(batch_image_sizes)
+... # collect targets in the required format for metric computation
+... # boxes were converted to YOLO format needed for model training
+... # here we will convert them to Pascal VOC format (x_min, y_min, x_max, y_max)
+... for image_target in batch:
+... boxes = torch.tensor(image_target["boxes"])
+... boxes = convert_bbox_yolo_to_pascal(boxes, image_target["orig_size"])
+... labels = torch.tensor(image_target["class_labels"])
+... post_processed_targets.append({"boxes": boxes, "labels": labels})
+
+... # Collect predictions in the required format for metric computation,
+... # model produce boxes in YOLO format, then image_processor convert them to Pascal VOC format
+... for batch, target_sizes in zip(predictions, image_sizes):
+... batch_logits, batch_boxes = batch[1], batch[2]
+... output = ModelOutput(logits=torch.tensor(batch_logits), pred_boxes=torch.tensor(batch_boxes))
+... post_processed_output = image_processor.post_process_object_detection(
+... output, threshold=threshold, target_sizes=target_sizes
+... )
+... post_processed_predictions.extend(post_processed_output)
+
+... # Compute metrics
+... metric = MeanAveragePrecision(box_format="xyxy", class_metrics=True)
+... metric.update(post_processed_predictions, post_processed_targets)
+... metrics = metric.compute()
+
+... # Replace list of per class metrics with separate metric for each class
+... classes = metrics.pop("classes")
+... map_per_class = metrics.pop("map_per_class")
+... mar_100_per_class = metrics.pop("mar_100_per_class")
+... for class_id, class_map, class_mar in zip(classes, map_per_class, mar_100_per_class):
+... class_name = id2label[class_id.item()] if id2label is not None else class_id.item()
+... metrics[f"map_{class_name}"] = class_map
+... metrics[f"mar_100_{class_name}"] = class_mar
+
+... metrics = {k: round(v.item(), 4) for k, v in metrics.items()}
+
+... return metrics
+
+
+>>> eval_compute_metrics_fn = partial(
+... compute_metrics, image_processor=image_processor, id2label=id2label, threshold=0.0
+... )
+```
+
+## Training the detection model
+
+You have done most of the heavy lifting in the previous sections, so now you are ready to train your model!
+The images in this dataset are still quite large, even after resizing. This means that finetuning this model will
+require at least one GPU.
+
+Training involves the following steps:
+1. Load the model with [`AutoModelForObjectDetection`] using the same checkpoint as in the preprocessing.
+2. Define your training hyperparameters in [`TrainingArguments`].
+3. Pass the training arguments to [`Trainer`] along with the model, dataset, image processor, and data collator.
+4. Call [`~Trainer.train`] to finetune your model.
+
+When loading the model from the same checkpoint that you used for the preprocessing, remember to pass the `label2id`
+and `id2label` maps that you created earlier from the dataset's metadata. Additionally, we specify `ignore_mismatched_sizes=True` to replace the existing classification head with a new one.
+
+```py
+>>> from transformers import AutoModelForObjectDetection
+
+>>> model = AutoModelForObjectDetection.from_pretrained(
+... MODEL_NAME,
+... id2label=id2label,
+... label2id=label2id,
+... ignore_mismatched_sizes=True,
+... )
+```
+
+In the [`TrainingArguments`] use `output_dir` to specify where to save your model, then configure hyperparameters as you see fit. For `num_train_epochs=30` training will take about 35 minutes in Google Colab T4 GPU, increase the number of epoch to get better results.
+
+Important notes:
+ - Do not remove unused columns because this will drop the image column. Without the image column, you
+can't create `pixel_values`. For this reason, set `remove_unused_columns` to `False`.
+ - Set `eval_do_concat_batches=False` to get proper evaluation results. Images have different number of target boxes, if batches are concatenated we will not be able to determine which boxes belongs to particular image.
+
+If you wish to share your model by pushing to the Hub, set `push_to_hub` to `True` (you must be signed in to Hugging
+Face to upload your model).
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> training_args = TrainingArguments(
+... output_dir="detr_finetuned_cppe5",
+... num_train_epochs=30,
+... fp16=False,
+... per_device_train_batch_size=8,
+... dataloader_num_workers=4,
+... learning_rate=5e-5,
+... lr_scheduler_type="cosine",
+... weight_decay=1e-4,
+... max_grad_norm=0.01,
+... metric_for_best_model="eval_map",
+... greater_is_better=True,
+... load_best_model_at_end=True,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... save_total_limit=2,
+... remove_unused_columns=False,
+... eval_do_concat_batches=False,
+... push_to_hub=True,
+... )
+```
+
+Finally, bring everything together, and call [`~transformers.Trainer.train`]:
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=cppe5["train"],
+... eval_dataset=cppe5["validation"],
+... processing_class=image_processor,
+... data_collator=collate_fn,
+... compute_metrics=eval_compute_metrics_fn,
+... )
+
+>>> trainer.train()
+```
+
+
+
+ [3210/3210 26:07, Epoch 30/30]
+
+
+
+
+
+ Epoch
+ Training Loss
+ Validation Loss
+ Map
+ Map 50
+ Map 75
+ Map Small
+ Map Medium
+ Map Large
+ Mar 1
+ Mar 10
+ Mar 100
+ Mar Small
+ Mar Medium
+ Mar Large
+ Map Coverall
+ Mar 100 Coverall
+ Map Face Shield
+ Mar 100 Face Shield
+ Map Gloves
+ Mar 100 Gloves
+ Map Goggles
+ Mar 100 Goggles
+ Map Mask
+ Mar 100 Mask
+
+
+
+
+ 1
+ No log
+ 2.629903
+ 0.008900
+ 0.023200
+ 0.006500
+ 0.001300
+ 0.002800
+ 0.020500
+ 0.021500
+ 0.070400
+ 0.101400
+ 0.007600
+ 0.106200
+ 0.096100
+ 0.036700
+ 0.232000
+ 0.000300
+ 0.019000
+ 0.003900
+ 0.125400
+ 0.000100
+ 0.003100
+ 0.003500
+ 0.127600
+
+
+ 2
+ No log
+ 3.479864
+ 0.014800
+ 0.034600
+ 0.010800
+ 0.008600
+ 0.011700
+ 0.012500
+ 0.041100
+ 0.098700
+ 0.130000
+ 0.056000
+ 0.062200
+ 0.111900
+ 0.053500
+ 0.447300
+ 0.010600
+ 0.100000
+ 0.000200
+ 0.022800
+ 0.000100
+ 0.015400
+ 0.009700
+ 0.064400
+
+
+ 3
+ No log
+ 2.107622
+ 0.041700
+ 0.094000
+ 0.034300
+ 0.024100
+ 0.026400
+ 0.047400
+ 0.091500
+ 0.182800
+ 0.225800
+ 0.087200
+ 0.199400
+ 0.210600
+ 0.150900
+ 0.571200
+ 0.017300
+ 0.101300
+ 0.007300
+ 0.180400
+ 0.002100
+ 0.026200
+ 0.031000
+ 0.250200
+
+
+ 4
+ No log
+ 2.031242
+ 0.055900
+ 0.120600
+ 0.046900
+ 0.013800
+ 0.038100
+ 0.090300
+ 0.105900
+ 0.225600
+ 0.266100
+ 0.130200
+ 0.228100
+ 0.330000
+ 0.191000
+ 0.572100
+ 0.010600
+ 0.157000
+ 0.014600
+ 0.235300
+ 0.001700
+ 0.052300
+ 0.061800
+ 0.313800
+
+
+ 5
+ 3.889400
+ 1.883433
+ 0.089700
+ 0.201800
+ 0.067300
+ 0.022800
+ 0.065300
+ 0.129500
+ 0.136000
+ 0.272200
+ 0.303700
+ 0.112900
+ 0.312500
+ 0.424600
+ 0.300200
+ 0.585100
+ 0.032700
+ 0.202500
+ 0.031300
+ 0.271000
+ 0.008700
+ 0.126200
+ 0.075500
+ 0.333800
+
+
+ 6
+ 3.889400
+ 1.807503
+ 0.118500
+ 0.270900
+ 0.090200
+ 0.034900
+ 0.076700
+ 0.152500
+ 0.146100
+ 0.297800
+ 0.325400
+ 0.171700
+ 0.283700
+ 0.545900
+ 0.396900
+ 0.554500
+ 0.043000
+ 0.262000
+ 0.054500
+ 0.271900
+ 0.020300
+ 0.230800
+ 0.077600
+ 0.308000
+
+
+ 7
+ 3.889400
+ 1.716169
+ 0.143500
+ 0.307700
+ 0.123200
+ 0.045800
+ 0.097800
+ 0.258300
+ 0.165300
+ 0.327700
+ 0.352600
+ 0.140900
+ 0.336700
+ 0.599400
+ 0.442900
+ 0.620700
+ 0.069400
+ 0.301300
+ 0.081600
+ 0.292000
+ 0.011000
+ 0.230800
+ 0.112700
+ 0.318200
+
+
+ 8
+ 3.889400
+ 1.679014
+ 0.153000
+ 0.355800
+ 0.127900
+ 0.038700
+ 0.115600
+ 0.291600
+ 0.176000
+ 0.322500
+ 0.349700
+ 0.135600
+ 0.326100
+ 0.643700
+ 0.431700
+ 0.582900
+ 0.069800
+ 0.265800
+ 0.088600
+ 0.274600
+ 0.028300
+ 0.280000
+ 0.146700
+ 0.345300
+
+
+ 9
+ 3.889400
+ 1.618239
+ 0.172100
+ 0.375300
+ 0.137600
+ 0.046100
+ 0.141700
+ 0.308500
+ 0.194000
+ 0.356200
+ 0.386200
+ 0.162400
+ 0.359200
+ 0.677700
+ 0.469800
+ 0.623900
+ 0.102100
+ 0.317700
+ 0.099100
+ 0.290200
+ 0.029300
+ 0.335400
+ 0.160200
+ 0.364000
+
+
+ 10
+ 1.599700
+ 1.572512
+ 0.179500
+ 0.400400
+ 0.147200
+ 0.056500
+ 0.141700
+ 0.316700
+ 0.213100
+ 0.357600
+ 0.381300
+ 0.197900
+ 0.344300
+ 0.638500
+ 0.466900
+ 0.623900
+ 0.101300
+ 0.311400
+ 0.104700
+ 0.279500
+ 0.051600
+ 0.338500
+ 0.173000
+ 0.353300
+
+
+ 11
+ 1.599700
+ 1.528889
+ 0.192200
+ 0.415000
+ 0.160800
+ 0.053700
+ 0.150500
+ 0.378000
+ 0.211500
+ 0.371700
+ 0.397800
+ 0.204900
+ 0.374600
+ 0.684800
+ 0.491900
+ 0.632400
+ 0.131200
+ 0.346800
+ 0.122000
+ 0.300900
+ 0.038400
+ 0.344600
+ 0.177500
+ 0.364400
+
+
+ 12
+ 1.599700
+ 1.517532
+ 0.198300
+ 0.429800
+ 0.159800
+ 0.066400
+ 0.162900
+ 0.383300
+ 0.220700
+ 0.382100
+ 0.405400
+ 0.214800
+ 0.383200
+ 0.672900
+ 0.469000
+ 0.610400
+ 0.167800
+ 0.379700
+ 0.119700
+ 0.307100
+ 0.038100
+ 0.335400
+ 0.196800
+ 0.394200
+
+
+ 13
+ 1.599700
+ 1.488849
+ 0.209800
+ 0.452300
+ 0.172300
+ 0.094900
+ 0.171100
+ 0.437800
+ 0.222000
+ 0.379800
+ 0.411500
+ 0.203800
+ 0.397300
+ 0.707500
+ 0.470700
+ 0.620700
+ 0.186900
+ 0.407600
+ 0.124200
+ 0.306700
+ 0.059300
+ 0.355400
+ 0.207700
+ 0.367100
+
+
+ 14
+ 1.599700
+ 1.482210
+ 0.228900
+ 0.482600
+ 0.187800
+ 0.083600
+ 0.191800
+ 0.444100
+ 0.225900
+ 0.376900
+ 0.407400
+ 0.182500
+ 0.384800
+ 0.700600
+ 0.512100
+ 0.640100
+ 0.175000
+ 0.363300
+ 0.144300
+ 0.300000
+ 0.083100
+ 0.363100
+ 0.229900
+ 0.370700
+
+
+ 15
+ 1.326800
+ 1.475198
+ 0.216300
+ 0.455600
+ 0.174900
+ 0.088500
+ 0.183500
+ 0.424400
+ 0.226900
+ 0.373400
+ 0.404300
+ 0.199200
+ 0.396400
+ 0.677800
+ 0.496300
+ 0.633800
+ 0.166300
+ 0.392400
+ 0.128900
+ 0.312900
+ 0.085200
+ 0.312300
+ 0.205000
+ 0.370200
+
+
+ 16
+ 1.326800
+ 1.459697
+ 0.233200
+ 0.504200
+ 0.192200
+ 0.096000
+ 0.202000
+ 0.430800
+ 0.239100
+ 0.382400
+ 0.412600
+ 0.219500
+ 0.403100
+ 0.670400
+ 0.485200
+ 0.625200
+ 0.196500
+ 0.410100
+ 0.135700
+ 0.299600
+ 0.123100
+ 0.356900
+ 0.225300
+ 0.371100
+
+
+ 17
+ 1.326800
+ 1.407340
+ 0.243400
+ 0.511900
+ 0.204500
+ 0.121000
+ 0.215700
+ 0.468000
+ 0.246200
+ 0.394600
+ 0.424200
+ 0.225900
+ 0.416100
+ 0.705200
+ 0.494900
+ 0.638300
+ 0.224900
+ 0.430400
+ 0.157200
+ 0.317900
+ 0.115700
+ 0.369200
+ 0.224200
+ 0.365300
+
+
+ 18
+ 1.326800
+ 1.419522
+ 0.245100
+ 0.521500
+ 0.210000
+ 0.116100
+ 0.211500
+ 0.489900
+ 0.255400
+ 0.391600
+ 0.419700
+ 0.198800
+ 0.421200
+ 0.701400
+ 0.501800
+ 0.634200
+ 0.226700
+ 0.410100
+ 0.154400
+ 0.321400
+ 0.105900
+ 0.352300
+ 0.236700
+ 0.380400
+
+
+ 19
+ 1.158600
+ 1.398764
+ 0.253600
+ 0.519200
+ 0.213600
+ 0.135200
+ 0.207700
+ 0.491900
+ 0.257300
+ 0.397300
+ 0.428000
+ 0.241400
+ 0.401800
+ 0.703500
+ 0.509700
+ 0.631100
+ 0.236700
+ 0.441800
+ 0.155900
+ 0.330800
+ 0.128100
+ 0.352300
+ 0.237500
+ 0.384000
+
+
+ 20
+ 1.158600
+ 1.390591
+ 0.248800
+ 0.520200
+ 0.216600
+ 0.127500
+ 0.211400
+ 0.471900
+ 0.258300
+ 0.407000
+ 0.429100
+ 0.240300
+ 0.407600
+ 0.708500
+ 0.505800
+ 0.623400
+ 0.235500
+ 0.431600
+ 0.150000
+ 0.325000
+ 0.125700
+ 0.375400
+ 0.227200
+ 0.390200
+
+
+ 21
+ 1.158600
+ 1.360608
+ 0.262700
+ 0.544800
+ 0.222100
+ 0.134700
+ 0.230000
+ 0.487500
+ 0.269500
+ 0.413300
+ 0.436300
+ 0.236200
+ 0.419100
+ 0.709300
+ 0.514100
+ 0.637400
+ 0.257200
+ 0.450600
+ 0.165100
+ 0.338400
+ 0.139400
+ 0.372300
+ 0.237700
+ 0.382700
+
+
+ 22
+ 1.158600
+ 1.368296
+ 0.262800
+ 0.542400
+ 0.236400
+ 0.137400
+ 0.228100
+ 0.498500
+ 0.266500
+ 0.409000
+ 0.433000
+ 0.239900
+ 0.418500
+ 0.697500
+ 0.520500
+ 0.641000
+ 0.257500
+ 0.455700
+ 0.162600
+ 0.334800
+ 0.140200
+ 0.353800
+ 0.233200
+ 0.379600
+
+
+ 23
+ 1.158600
+ 1.368176
+ 0.264800
+ 0.541100
+ 0.233100
+ 0.138200
+ 0.223900
+ 0.498700
+ 0.272300
+ 0.407400
+ 0.434400
+ 0.233100
+ 0.418300
+ 0.702000
+ 0.524400
+ 0.642300
+ 0.262300
+ 0.444300
+ 0.159700
+ 0.335300
+ 0.140500
+ 0.366200
+ 0.236900
+ 0.384000
+
+
+ 24
+ 1.049700
+ 1.355271
+ 0.269700
+ 0.549200
+ 0.239100
+ 0.134700
+ 0.229900
+ 0.519200
+ 0.274800
+ 0.412700
+ 0.437600
+ 0.245400
+ 0.417200
+ 0.711200
+ 0.523200
+ 0.644100
+ 0.272100
+ 0.440500
+ 0.166700
+ 0.341500
+ 0.137700
+ 0.373800
+ 0.249000
+ 0.388000
+
+
+ 25
+ 1.049700
+ 1.355180
+ 0.272500
+ 0.547900
+ 0.243800
+ 0.149700
+ 0.229900
+ 0.523100
+ 0.272500
+ 0.415700
+ 0.442200
+ 0.256200
+ 0.420200
+ 0.705800
+ 0.523900
+ 0.639600
+ 0.271700
+ 0.451900
+ 0.166300
+ 0.346900
+ 0.153700
+ 0.383100
+ 0.247000
+ 0.389300
+
+
+ 26
+ 1.049700
+ 1.349337
+ 0.275600
+ 0.556300
+ 0.246400
+ 0.146700
+ 0.234800
+ 0.516300
+ 0.274200
+ 0.418300
+ 0.440900
+ 0.248700
+ 0.418900
+ 0.705800
+ 0.523200
+ 0.636500
+ 0.274700
+ 0.440500
+ 0.172400
+ 0.349100
+ 0.155600
+ 0.384600
+ 0.252300
+ 0.393800
+
+
+ 27
+ 1.049700
+ 1.350782
+ 0.275200
+ 0.548700
+ 0.246800
+ 0.147300
+ 0.236400
+ 0.527200
+ 0.280100
+ 0.416200
+ 0.442600
+ 0.253400
+ 0.424000
+ 0.710300
+ 0.526600
+ 0.640100
+ 0.273200
+ 0.445600
+ 0.167000
+ 0.346900
+ 0.160100
+ 0.387700
+ 0.249200
+ 0.392900
+
+
+ 28
+ 1.049700
+ 1.346533
+ 0.277000
+ 0.552800
+ 0.252900
+ 0.147400
+ 0.240000
+ 0.527600
+ 0.280900
+ 0.420900
+ 0.444100
+ 0.255500
+ 0.424500
+ 0.711200
+ 0.530200
+ 0.646800
+ 0.277400
+ 0.441800
+ 0.170900
+ 0.346900
+ 0.156600
+ 0.389200
+ 0.249600
+ 0.396000
+
+
+ 29
+ 0.993700
+ 1.346575
+ 0.277100
+ 0.554800
+ 0.252900
+ 0.148400
+ 0.239700
+ 0.523600
+ 0.278400
+ 0.420000
+ 0.443300
+ 0.256300
+ 0.424000
+ 0.705600
+ 0.529600
+ 0.647300
+ 0.273900
+ 0.439200
+ 0.174300
+ 0.348700
+ 0.157600
+ 0.386200
+ 0.250100
+ 0.395100
+
+
+ 30
+ 0.993700
+ 1.346446
+ 0.277400
+ 0.554700
+ 0.252700
+ 0.147900
+ 0.240800
+ 0.523600
+ 0.278800
+ 0.420400
+ 0.443300
+ 0.256100
+ 0.424200
+ 0.705500
+ 0.530100
+ 0.646800
+ 0.275600
+ 0.440500
+ 0.174500
+ 0.348700
+ 0.157300
+ 0.386200
+ 0.249200
+ 0.394200
+
+
+
+
+If you have set `push_to_hub` to `True` in the `training_args`, the training checkpoints are pushed to the
+Hugging Face Hub. Upon training completion, push the final model to the Hub as well by calling the [`~transformers.Trainer.push_to_hub`] method.
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Evaluate
+
+```py
+>>> from pprint import pprint
+
+>>> metrics = trainer.evaluate(eval_dataset=cppe5["test"], metric_key_prefix="test")
+>>> pprint(metrics)
+{'epoch': 30.0,
+ 'test_loss': 1.0877351760864258,
+ 'test_map': 0.4116,
+ 'test_map_50': 0.741,
+ 'test_map_75': 0.3663,
+ 'test_map_Coverall': 0.5937,
+ 'test_map_Face_Shield': 0.5863,
+ 'test_map_Gloves': 0.3416,
+ 'test_map_Goggles': 0.1468,
+ 'test_map_Mask': 0.3894,
+ 'test_map_large': 0.5637,
+ 'test_map_medium': 0.3257,
+ 'test_map_small': 0.3589,
+ 'test_mar_1': 0.323,
+ 'test_mar_10': 0.5237,
+ 'test_mar_100': 0.5587,
+ 'test_mar_100_Coverall': 0.6756,
+ 'test_mar_100_Face_Shield': 0.7294,
+ 'test_mar_100_Gloves': 0.4721,
+ 'test_mar_100_Goggles': 0.4125,
+ 'test_mar_100_Mask': 0.5038,
+ 'test_mar_large': 0.7283,
+ 'test_mar_medium': 0.4901,
+ 'test_mar_small': 0.4469,
+ 'test_runtime': 1.6526,
+ 'test_samples_per_second': 17.548,
+ 'test_steps_per_second': 2.42}
+```
+
+These results can be further improved by adjusting the hyperparameters in [`TrainingArguments`]. Give it a go!
+
+## Inference
+
+Now that you have finetuned a model, evaluated it, and uploaded it to the Hugging Face Hub, you can use it for inference.
+
+```py
+>>> import torch
+>>> import requests
+
+>>> from PIL import Image, ImageDraw
+>>> from transformers import AutoImageProcessor, AutoModelForObjectDetection
+
+>>> url = "https://images.pexels.com/photos/8413299/pexels-photo-8413299.jpeg?auto=compress&cs=tinysrgb&w=630&h=375&dpr=2"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+```
+
+Load model and image processor from the Hugging Face Hub (skip to use already trained in this session):
+```py
+>>> from accelerate.test_utils.testing import get_backend
+# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+>>> device, _, _ = get_backend()
+>>> model_repo = "qubvel-hf/detr_finetuned_cppe5"
+
+>>> image_processor = AutoImageProcessor.from_pretrained(model_repo)
+>>> model = AutoModelForObjectDetection.from_pretrained(model_repo)
+>>> model = model.to(device)
+```
+
+And detect bounding boxes:
+
+```py
+
+>>> with torch.no_grad():
+... inputs = image_processor(images=[image], return_tensors="pt")
+... outputs = model(**inputs.to(device))
+... target_sizes = torch.tensor([[image.size[1], image.size[0]]])
+... results = image_processor.post_process_object_detection(outputs, threshold=0.3, target_sizes=target_sizes)[0]
+
+>>> for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
+... box = [round(i, 2) for i in box.tolist()]
+... print(
+... f"Detected {model.config.id2label[label.item()]} with confidence "
+... f"{round(score.item(), 3)} at location {box}"
+... )
+Detected Gloves with confidence 0.683 at location [244.58, 124.33, 300.35, 185.13]
+Detected Mask with confidence 0.517 at location [143.73, 64.58, 219.57, 125.89]
+Detected Gloves with confidence 0.425 at location [179.15, 155.57, 262.4, 226.35]
+Detected Coverall with confidence 0.407 at location [307.13, -1.18, 477.82, 318.06]
+Detected Coverall with confidence 0.391 at location [68.61, 126.66, 309.03, 318.89]
+```
+
+Let's plot the result:
+
+```py
+>>> draw = ImageDraw.Draw(image)
+
+>>> for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
+... box = [round(i, 2) for i in box.tolist()]
+... x, y, x2, y2 = tuple(box)
+... draw.rectangle((x, y, x2, y2), outline="red", width=1)
+... draw.text((x, y), model.config.id2label[label.item()], fill="white")
+
+>>> image
+```
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/prompting.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/prompting.md
new file mode 100644
index 0000000000000000000000000000000000000000..4e30fb1e0ee36288f88084dd2526bed6e337f6ba
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/prompting.md
@@ -0,0 +1,439 @@
+
+
+
+# LLM prompting guide
+
+[[open-in-colab]]
+
+Large Language Models such as Falcon, LLaMA, etc. are pretrained transformer models initially trained to predict the
+next token given some input text. They typically have billions of parameters and have been trained on trillions of
+tokens for an extended period of time. As a result, these models become quite powerful and versatile, and you can use
+them to solve multiple NLP tasks out of the box by instructing the models with natural language prompts.
+
+Designing such prompts to ensure the optimal output is often called "prompt engineering". Prompt engineering is an
+iterative process that requires a fair amount of experimentation. Natural languages are much more flexible and expressive
+than programming languages, however, they can also introduce some ambiguity. At the same time, prompts in natural language
+are quite sensitive to changes. Even minor modifications in prompts can lead to wildly different outputs.
+
+While there is no exact recipe for creating prompts to match all cases, researchers have worked out a number of best
+practices that help to achieve optimal results more consistently.
+
+This guide covers the prompt engineering best practices to help you craft better LLM prompts and solve various NLP tasks.
+You'll learn:
+
+- [Basics of prompting](#basics-of-prompting)
+- [Best practices of LLM prompting](#best-practices-of-llm-prompting)
+- [Advanced prompting techniques: few-shot prompting and chain-of-thought](#advanced-prompting-techniques)
+- [When to fine-tune instead of prompting](#prompting-vs-fine-tuning)
+
+
+
+Prompt engineering is only a part of the LLM output optimization process. Another essential component is choosing the
+optimal text generation strategy. You can customize how your LLM selects each of the subsequent tokens when generating
+the text without modifying any of the trainable parameters. By tweaking the text generation parameters, you can reduce
+repetition in the generated text and make it more coherent and human-sounding.
+Text generation strategies and parameters are out of scope for this guide, but you can learn more about these topics in
+the following guides:
+
+* [Generation with LLMs](../llm_tutorial)
+* [Text generation strategies](../generation_strategies)
+
+
+
+## Basics of prompting
+
+### Types of models
+
+The majority of modern LLMs are decoder-only transformers. Some examples include: [LLaMA](../model_doc/llama),
+[Llama2](../model_doc/llama2), [Falcon](../model_doc/falcon), [GPT2](../model_doc/gpt2). However, you may encounter
+encoder-decoder transformer LLMs as well, for instance, [Flan-T5](../model_doc/flan-t5) and [BART](../model_doc/bart).
+
+Encoder-decoder-style models are typically used in generative tasks where the output **heavily** relies on the input, for
+example, in translation and summarization. The decoder-only models are used for all other types of generative tasks.
+
+When using a pipeline to generate text with an LLM, it's important to know what type of LLM you are using, because
+they use different pipelines.
+
+Run inference with decoder-only models with the `text-generation` pipeline:
+
+```python
+>>> from transformers import pipeline
+>>> import torch
+
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+
+>>> generator = pipeline('text-generation', model = 'openai-community/gpt2')
+>>> prompt = "Hello, I'm a language model"
+
+>>> generator(prompt, max_length = 30)
+[{'generated_text': "Hello, I'm a language model programmer so you can use some of my stuff. But you also need some sort of a C program to run."}]
+```
+
+To run inference with an encoder-decoder, use the `text2text-generation` pipeline:
+
+```python
+>>> text2text_generator = pipeline("text2text-generation", model = 'google/flan-t5-base')
+>>> prompt = "Translate from English to French: I'm very happy to see you"
+
+>>> text2text_generator(prompt)
+[{'generated_text': 'Je suis trรจs heureuse de vous rencontrer.'}]
+```
+
+### Base vs instruct/chat models
+
+Most of the recent LLM checkpoints available on ๐ค Hub come in two versions: base and instruct (or chat). For example,
+[`tiiuae/falcon-7b`](https://huggingface.co/tiiuae/falcon-7b) and [`tiiuae/falcon-7b-instruct`](https://huggingface.co/tiiuae/falcon-7b-instruct).
+
+Base models are excellent at completing the text when given an initial prompt, however, they are not ideal for NLP tasks
+where they need to follow instructions, or for conversational use. This is where the instruct (chat) versions come in.
+These checkpoints are the result of further fine-tuning of the pre-trained base versions on instructions and conversational data.
+This additional fine-tuning makes them a better choice for many NLP tasks.
+
+Let's illustrate some simple prompts that you can use with [`tiiuae/falcon-7b-instruct`](https://huggingface.co/tiiuae/falcon-7b-instruct)
+to solve some common NLP tasks.
+
+### NLP tasks
+
+First, let's set up the environment:
+
+```bash
+pip install -q transformers accelerate
+```
+
+Next, let's load the model with the appropriate pipeline (`"text-generation"`):
+
+```python
+>>> from transformers import pipeline, AutoTokenizer
+>>> import torch
+
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+>>> model = "tiiuae/falcon-7b-instruct"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(model)
+>>> pipe = pipeline(
+... "text-generation",
+... model=model,
+... tokenizer=tokenizer,
+... torch_dtype=torch.bfloat16,
+... device_map="auto",
+... )
+```
+
+
+
+Note that Falcon models were trained using the `bfloat16` datatype, so we recommend you use the same. This requires a recent
+version of CUDA and works best on modern cards.
+
+
+
+Now that we have the model loaded via the pipeline, let's explore how you can use prompts to solve NLP tasks.
+
+#### Text classification
+
+One of the most common forms of text classification is sentiment analysis, which assigns a label like "positive", "negative",
+or "neutral" to a sequence of text. Let's write a prompt that instructs the model to classify a given text (a movie review).
+We'll start by giving the instruction, and then specifying the text to classify. Note that instead of leaving it at that, we're
+also adding the beginning of the response - `"Sentiment: "`:
+
+```python
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+>>> prompt = """Classify the text into neutral, negative or positive.
+... Text: This movie is definitely one of my favorite movies of its kind. The interaction between respectable and morally strong characters is an ode to chivalry and the honor code amongst thieves and policemen.
+... Sentiment:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=10,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result: Classify the text into neutral, negative or positive.
+Text: This movie is definitely one of my favorite movies of its kind. The interaction between respectable and morally strong characters is an ode to chivalry and the honor code amongst thieves and policemen.
+Sentiment:
+Positive
+```
+
+As a result, the output contains a classification label from the list we have provided in the instructions, and it is a correct one!
+
+
+
+You may notice that in addition to the prompt, we pass a `max_new_tokens` parameter. It controls the number of tokens the
+model shall generate, and it is one of the many text generation parameters that you can learn about
+in [Text generation strategies](../generation_strategies) guide.
+
+
+
+#### Named Entity Recognition
+
+Named Entity Recognition (NER) is a task of finding named entities in a piece of text, such as a person, location, or organization.
+Let's modify the instructions in the prompt to make the LLM perform this task. Here, let's also set `return_full_text = False`
+so that output doesn't contain the prompt:
+
+```python
+>>> torch.manual_seed(1) # doctest: +IGNORE_RESULT
+>>> prompt = """Return a list of named entities in the text.
+... Text: The Golden State Warriors are an American professional basketball team based in San Francisco.
+... Named entities:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=15,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"{seq['generated_text']}")
+- Golden State Warriors
+- San Francisco
+```
+
+As you can see, the model correctly identified two named entities from the given text.
+
+#### Translation
+
+Another task LLMs can perform is translation. You can choose to use encoder-decoder models for this task, however, here,
+for the simplicity of the examples, we'll keep using Falcon-7b-instruct, which does a decent job. Once again, here's how
+you can write a basic prompt to instruct a model to translate a piece of text from English to Italian:
+
+```python
+>>> torch.manual_seed(2) # doctest: +IGNORE_RESULT
+>>> prompt = """Translate the English text to Italian.
+... Text: Sometimes, I've believed as many as six impossible things before breakfast.
+... Translation:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=20,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"{seq['generated_text']}")
+A volte, ho creduto a sei impossibili cose prima di colazione.
+```
+
+Here we've added a `do_sample=True` and `top_k=10` to allow the model to be a bit more flexible when generating output.
+
+#### Text summarization
+
+Similar to the translation, text summarization is another generative task where the output **heavily** relies on the input,
+and encoder-decoder models can be a better choice. However, decoder-style models can be used for this task as well.
+Previously, we have placed the instructions at the very beginning of the prompt. However, the very end of the prompt can
+also be a suitable location for instructions. Typically, it's better to place the instruction on one of the extreme ends.
+
+```python
+>>> torch.manual_seed(3) # doctest: +IGNORE_RESULT
+>>> prompt = """Permaculture is a design process mimicking the diversity, functionality and resilience of natural ecosystems. The principles and practices are drawn from traditional ecological knowledge of indigenous cultures combined with modern scientific understanding and technological innovations. Permaculture design provides a framework helping individuals and communities develop innovative, creative and effective strategies for meeting basic needs while preparing for and mitigating the projected impacts of climate change.
+... Write a summary of the above text.
+... Summary:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=30,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"{seq['generated_text']}")
+Permaculture is an ecological design mimicking natural ecosystems to meet basic needs and prepare for climate change. It is based on traditional knowledge and scientific understanding.
+```
+
+#### Question answering
+
+For question answering task we can structure the prompt into the following logical components: instructions, context, question, and
+the leading word or phrase (`"Answer:"`) to nudge the model to start generating the answer:
+
+```python
+>>> torch.manual_seed(4) # doctest: +IGNORE_RESULT
+>>> prompt = """Answer the question using the context below.
+... Context: Gazpacho is a cold soup and drink made of raw, blended vegetables. Most gazpacho includes stale bread, tomato, cucumbers, onion, bell peppers, garlic, olive oil, wine vinegar, water, and salt. Northern recipes often include cumin and/or pimentรณn (smoked sweet paprika). Traditionally, gazpacho was made by pounding the vegetables in a mortar with a pestle; this more laborious method is still sometimes used as it helps keep the gazpacho cool and avoids the foam and silky consistency of smoothie versions made in blenders or food processors.
+... Question: What modern tool is used to make gazpacho?
+... Answer:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=10,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result: Modern tools often used to make gazpacho include
+```
+
+#### Reasoning
+
+Reasoning is one of the most difficult tasks for LLMs, and achieving good results often requires applying advanced prompting techniques, like
+[Chain-of-thought](#chain-of-thought).
+
+Let's try if we can make a model reason about a simple arithmetics task with a basic prompt:
+
+```python
+>>> torch.manual_seed(5) # doctest: +IGNORE_RESULT
+>>> prompt = """There are 5 groups of students in the class. Each group has 4 students. How many students are there in the class?"""
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=30,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result:
+There are a total of 5 groups, so there are 5 x 4=20 students in the class.
+```
+
+Correct! Let's increase the complexity a little and see if we can still get away with a basic prompt:
+
+```python
+>>> torch.manual_seed(6) # doctest: +IGNORE_RESULT
+>>> prompt = """I baked 15 muffins. I ate 2 muffins and gave 5 muffins to a neighbor. My partner then bought 6 more muffins and ate 2. How many muffins do we now have?"""
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=10,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result:
+The total number of muffins now is 21
+```
+
+This is a wrong answer, it should be 12. In this case, this can be due to the prompt being too basic, or due to the choice
+of model, after all we've picked the smallest version of Falcon. Reasoning is difficult for models of all sizes, but larger
+models are likely to perform better.
+
+## Best practices of LLM prompting
+
+In this section of the guide we have compiled a list of best practices that tend to improve the prompt results:
+
+* When choosing the model to work with, the latest and most capable models are likely to perform better.
+* Start with a simple and short prompt, and iterate from there.
+* Put the instructions at the beginning of the prompt, or at the very end. When working with large context, models apply various optimizations to prevent Attention complexity from scaling quadratically. This may make a model more attentive to the beginning or end of a prompt than the middle.
+* Clearly separate instructions from the text they apply to - more on this in the next section.
+* Be specific and descriptive about the task and the desired outcome - its format, length, style, language, etc.
+* Avoid ambiguous descriptions and instructions.
+* Favor instructions that say "what to do" instead of those that say "what not to do".
+* "Lead" the output in the right direction by writing the first word (or even begin the first sentence for the model).
+* Use advanced techniques like [Few-shot prompting](#few-shot-prompting) and [Chain-of-thought](#chain-of-thought)
+* Test your prompts with different models to assess their robustness.
+* Version and track the performance of your prompts.
+
+## Advanced prompting techniques
+
+### Few-shot prompting
+
+The basic prompts in the sections above are the examples of "zero-shot" prompts, meaning, the model has been given
+instructions and context, but no examples with solutions. LLMs that have been fine-tuned on instruction datasets, generally
+perform well on such "zero-shot" tasks. However, you may find that your task has more complexity or nuance, and, perhaps,
+you have some requirements for the output that the model doesn't catch on just from the instructions. In this case, you can
+try the technique called few-shot prompting.
+
+In few-shot prompting, we provide examples in the prompt giving the model more context to improve the performance.
+The examples condition the model to generate the output following the patterns in the examples.
+
+Here's an example:
+
+```python
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+>>> prompt = """Text: The first human went into space and orbited the Earth on April 12, 1961.
+... Date: 04/12/1961
+... Text: The first-ever televised presidential debate in the United States took place on September 28, 1960, between presidential candidates John F. Kennedy and Richard Nixon.
+... Date:"""
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=8,
+... do_sample=True,
+... top_k=10,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result: Text: The first human went into space and orbited the Earth on April 12, 1961.
+Date: 04/12/1961
+Text: The first-ever televised presidential debate in the United States took place on September 28, 1960, between presidential candidates John F. Kennedy and Richard Nixon.
+Date: 09/28/1960
+```
+
+In the above code snippet we used a single example to demonstrate the desired output to the model, so this can be called a
+"one-shot" prompting. However, depending on the task complexity you may need to use more than one example.
+
+Limitations of the few-shot prompting technique:
+- While LLMs can pick up on the patterns in the examples, these technique doesn't work well on complex reasoning tasks
+- Few-shot prompting requires creating lengthy prompts. Prompts with large number of tokens can increase computation and latency. There's also a limit to the length of the prompts.
+- Sometimes when given a number of examples, models can learn patterns that you didn't intend them to learn, e.g. that the third movie review is always negative.
+
+### Chain-of-thought
+
+Chain-of-thought (CoT) prompting is a technique that nudges a model to produce intermediate reasoning steps thus improving
+the results on complex reasoning tasks.
+
+There are two ways of steering a model to producing the reasoning steps:
+- few-shot prompting by illustrating examples with detailed answers to questions, showing the model how to work through a problem.
+- by instructing the model to reason by adding phrases like "Let's think step by step" or "Take a deep breath and work through the problem step by step."
+
+If we apply the CoT technique to the muffins example from the [reasoning section](#reasoning) and use a larger model,
+such as (`tiiuae/falcon-180B-chat`) which you can play with in the [HuggingChat](https://huggingface.co/chat/),
+we'll get a significant improvement on the reasoning result:
+
+```text
+Let's go through this step-by-step:
+1. You start with 15 muffins.
+2. You eat 2 muffins, leaving you with 13 muffins.
+3. You give 5 muffins to your neighbor, leaving you with 8 muffins.
+4. Your partner buys 6 more muffins, bringing the total number of muffins to 14.
+5. Your partner eats 2 muffins, leaving you with 12 muffins.
+Therefore, you now have 12 muffins.
+```
+
+## Prompting vs fine-tuning
+
+You can achieve great results by optimizing your prompts, however, you may still ponder whether fine-tuning a model
+would work better for your case. Here are some scenarios when fine-tuning a smaller model may be a preferred option:
+
+- Your domain is wildly different from what LLMs were pre-trained on and extensive prompt optimization did not yield sufficient results.
+- You need your model to work well in a low-resource language.
+- You need the model to be trained on sensitive data that is under strict regulations.
+- You have to use a small model due to cost, privacy, infrastructure or other limitations.
+
+In all of the above examples, you will need to make sure that you either already have or can easily obtain a large enough
+domain-specific dataset at a reasonable cost to fine-tune a model. You will also need to have enough time and resources
+to fine-tune a model.
+
+If the above examples are not the case for you, optimizing prompts can prove to be more beneficial.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/question_answering.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/question_answering.md
new file mode 100644
index 0000000000000000000000000000000000000000..41d7fd48cf816e099892c7bfa3037825721f97eb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/question_answering.md
@@ -0,0 +1,427 @@
+
+
+# Question answering
+
+[[open-in-colab]]
+
+
+
+Question answering tasks return an answer given a question. If you've ever asked a virtual assistant like Alexa, Siri or Google what the weather is, then you've used a question answering model before. There are two common types of question answering tasks:
+
+- Extractive: extract the answer from the given context.
+- Abstractive: generate an answer from the context that correctly answers the question.
+
+This guide will show you how to:
+
+1. Finetune [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) on the [SQuAD](https://huggingface.co/datasets/squad) dataset for extractive question answering.
+2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/question-answering)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load SQuAD dataset
+
+Start by loading a smaller subset of the SQuAD dataset from the ๐ค Datasets library. This'll give you a chance to experiment and make sure everything works before spending more time training on the full dataset.
+
+```py
+>>> from datasets import load_dataset
+
+>>> squad = load_dataset("squad", split="train[:5000]")
+```
+
+Split the dataset's `train` split into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+```py
+>>> squad = squad.train_test_split(test_size=0.2)
+```
+
+Then take a look at an example:
+
+```py
+>>> squad["train"][0]
+{'answers': {'answer_start': [515], 'text': ['Saint Bernadette Soubirous']},
+ 'context': 'Architecturally, the school has a Catholic character. Atop the Main Building\'s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend "Venite Ad Me Omnes". Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.',
+ 'id': '5733be284776f41900661182',
+ 'question': 'To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?',
+ 'title': 'University_of_Notre_Dame'
+}
+```
+
+There are several important fields here:
+
+- `answers`: the starting location of the answer token and the answer text.
+- `context`: background information from which the model needs to extract the answer.
+- `question`: the question a model should answer.
+
+## Preprocess
+
+
+
+The next step is to load a DistilBERT tokenizer to process the `question` and `context` fields:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+There are a few preprocessing steps particular to question answering tasks you should be aware of:
+
+1. Some examples in a dataset may have a very long `context` that exceeds the maximum input length of the model. To deal with longer sequences, truncate only the `context` by setting `truncation="only_second"`.
+2. Next, map the start and end positions of the answer to the original `context` by setting
+ `return_offset_mapping=True`.
+3. With the mapping in hand, now you can find the start and end tokens of the answer. Use the [`~tokenizers.Encoding.sequence_ids`] method to
+ find which part of the offset corresponds to the `question` and which corresponds to the `context`.
+
+Here is how you can create a function to truncate and map the start and end tokens of the `answer` to the `context`:
+
+```py
+>>> def preprocess_function(examples):
+... questions = [q.strip() for q in examples["question"]]
+... inputs = tokenizer(
+... questions,
+... examples["context"],
+... max_length=384,
+... truncation="only_second",
+... return_offsets_mapping=True,
+... padding="max_length",
+... )
+
+... offset_mapping = inputs.pop("offset_mapping")
+... answers = examples["answers"]
+... start_positions = []
+... end_positions = []
+
+... for i, offset in enumerate(offset_mapping):
+... answer = answers[i]
+... start_char = answer["answer_start"][0]
+... end_char = answer["answer_start"][0] + len(answer["text"][0])
+... sequence_ids = inputs.sequence_ids(i)
+
+... # Find the start and end of the context
+... idx = 0
+... while sequence_ids[idx] != 1:
+... idx += 1
+... context_start = idx
+... while sequence_ids[idx] == 1:
+... idx += 1
+... context_end = idx - 1
+
+... # If the answer is not fully inside the context, label it (0, 0)
+... if offset[context_start][0] > end_char or offset[context_end][1] < start_char:
+... start_positions.append(0)
+... end_positions.append(0)
+... else:
+... # Otherwise it's the start and end token positions
+... idx = context_start
+... while idx <= context_end and offset[idx][0] <= start_char:
+... idx += 1
+... start_positions.append(idx - 1)
+
+... idx = context_end
+... while idx >= context_start and offset[idx][1] >= end_char:
+... idx -= 1
+... end_positions.append(idx + 1)
+
+... inputs["start_positions"] = start_positions
+... inputs["end_positions"] = end_positions
+... return inputs
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] function. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once. Remove any columns you don't need:
+
+```py
+>>> tokenized_squad = squad.map(preprocess_function, batched=True, remove_columns=squad["train"].column_names)
+```
+
+Now create a batch of examples using [`DefaultDataCollator`]. Unlike other data collators in ๐ค Transformers, the [`DefaultDataCollator`] does not apply any additional preprocessing such as padding.
+
+
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+```
+
+
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load DistilBERT with [`AutoModelForQuestionAnswering`]:
+
+```py
+>>> from transformers import AutoModelForQuestionAnswering, TrainingArguments, Trainer
+
+>>> model = AutoModelForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model).
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, and data collator.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_qa_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_squad["train"],
+... eval_dataset=tokenized_squad["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the basic tutorial [here](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_epochs = 2
+>>> total_train_steps = (len(tokenized_squad["train"]) // batch_size) * num_epochs
+>>> optimizer, schedule = create_optimizer(
+... init_lr=2e-5,
+... num_warmup_steps=0,
+... num_train_steps=total_train_steps,
+... )
+```
+
+Then you can load DistilBERT with [`TFAutoModelForQuestionAnswering`]:
+
+```py
+>>> from transformers import TFAutoModelForQuestionAnswering
+
+>>> model = TFAutoModelForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_squad["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_squad["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method):
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer)
+```
+
+The last thing to setup before you start training is to provide a way to push your model to the Hub. This can be done by specifying where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> callback = PushToHubCallback(
+... output_dir="my_awesome_qa_model",
+... tokenizer=tokenizer,
+... )
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callback to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=3, callbacks=[callback])
+```
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+For a more in-depth example of how to finetune a model for question answering, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb).
+
+
+
+## Evaluate
+
+Evaluation for question answering requires a significant amount of postprocessing. To avoid taking up too much of your time, this guide skips the evaluation step. The [`Trainer`] still calculates the evaluation loss during training so you're not completely in the dark about your model's performance.
+
+If you have more time and you're interested in how to evaluate your model for question answering, take a look at the [Question answering](https://huggingface.co/course/chapter7/7?fw=pt#post-processing) chapter from the ๐ค Hugging Face Course!
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Come up with a question and some context you'd like the model to predict:
+
+```py
+>>> question = "How many programming languages does BLOOM support?"
+>>> context = "BLOOM has 176 billion parameters and can generate text in 46 languages natural languages and 13 programming languages."
+```
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for question answering with your model, and pass your text to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> question_answerer = pipeline("question-answering", model="my_awesome_qa_model")
+>>> question_answerer(question=question, context=context)
+{'score': 0.2058267742395401,
+ 'start': 10,
+ 'end': 95,
+ 'answer': '176 billion parameters and can generate text in 46 languages natural languages and 13'}
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+Tokenize the text and return PyTorch tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_qa_model")
+>>> inputs = tokenizer(question, context, return_tensors="pt")
+```
+
+Pass your inputs to the model and return the `logits`:
+
+```py
+>>> import torch
+>>> from transformers import AutoModelForQuestionAnswering
+
+>>> model = AutoModelForQuestionAnswering.from_pretrained("my_awesome_qa_model")
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+```
+
+Get the highest probability from the model output for the start and end positions:
+
+```py
+>>> answer_start_index = outputs.start_logits.argmax()
+>>> answer_end_index = outputs.end_logits.argmax()
+```
+
+Decode the predicted tokens to get the answer:
+
+```py
+>>> predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
+>>> tokenizer.decode(predict_answer_tokens)
+'176 billion parameters and can generate text in 46 languages natural languages and 13'
+```
+
+
+Tokenize the text and return TensorFlow tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_qa_model")
+>>> inputs = tokenizer(question, context, return_tensors="tf")
+```
+
+Pass your inputs to the model and return the `logits`:
+
+```py
+>>> from transformers import TFAutoModelForQuestionAnswering
+
+>>> model = TFAutoModelForQuestionAnswering.from_pretrained("my_awesome_qa_model")
+>>> outputs = model(**inputs)
+```
+
+Get the highest probability from the model output for the start and end positions:
+
+```py
+>>> answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
+>>> answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])
+```
+
+Decode the predicted tokens to get the answer:
+
+```py
+>>> predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
+>>> tokenizer.decode(predict_answer_tokens)
+'176 billion parameters and can generate text in 46 languages natural languages and 13'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/semantic_segmentation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/semantic_segmentation.md
new file mode 100644
index 0000000000000000000000000000000000000000..a21ff62edf1a563f5fbdeeb5c2d55ca81d8cbf72
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/semantic_segmentation.md
@@ -0,0 +1,939 @@
+
+
+# Image Segmentation
+
+[[open-in-colab]]
+
+
+
+Image segmentation models separate areas corresponding to different areas of interest in an image. These models work by assigning a label to each pixel. There are several types of segmentation: semantic segmentation, instance segmentation, and panoptic segmentation.
+
+In this guide, we will:
+1. [Take a look at different types of segmentation](#types-of-segmentation).
+2. [Have an end-to-end fine-tuning example for semantic segmentation](#fine-tuning-a-model-for-segmentation).
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```py
+# uncomment to install the necessary libraries
+!pip install -q datasets transformers evaluate accelerate
+```
+
+We encourage you to log in to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Types of Segmentation
+
+Semantic segmentation assigns a label or class to every single pixel in an image. Let's take a look at a semantic segmentation model output. It will assign the same class to every instance of an object it comes across in an image, for example, all cats will be labeled as "cat" instead of "cat-1", "cat-2".
+We can use transformers' image segmentation pipeline to quickly infer a semantic segmentation model. Let's take a look at the example image.
+
+```python
+from transformers import pipeline
+from PIL import Image
+import requests
+
+url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/segmentation_input.jpg"
+image = Image.open(requests.get(url, stream=True).raw)
+image
+```
+
+
+
+
+
+We will use [nvidia/segformer-b1-finetuned-cityscapes-1024-1024](https://huggingface.co/nvidia/segformer-b1-finetuned-cityscapes-1024-1024).
+
+```python
+semantic_segmentation = pipeline("image-segmentation", "nvidia/segformer-b1-finetuned-cityscapes-1024-1024")
+results = semantic_segmentation(image)
+results
+```
+
+The segmentation pipeline output includes a mask for every predicted class.
+```bash
+[{'score': None,
+ 'label': 'road',
+ 'mask': },
+ {'score': None,
+ 'label': 'sidewalk',
+ 'mask': },
+ {'score': None,
+ 'label': 'building',
+ 'mask': },
+ {'score': None,
+ 'label': 'wall',
+ 'mask': },
+ {'score': None,
+ 'label': 'pole',
+ 'mask': },
+ {'score': None,
+ 'label': 'traffic sign',
+ 'mask': },
+ {'score': None,
+ 'label': 'vegetation',
+ 'mask': },
+ {'score': None,
+ 'label': 'terrain',
+ 'mask': },
+ {'score': None,
+ 'label': 'sky',
+ 'mask': },
+ {'score': None,
+ 'label': 'car',
+ 'mask': }]
+```
+
+Taking a look at the mask for the car class, we can see every car is classified with the same mask.
+
+```python
+results[-1]["mask"]
+```
+
+
+
+
+In instance segmentation, the goal is not to classify every pixel, but to predict a mask for **every instance of an object** in a given image. It works very similar to object detection, where there is a bounding box for every instance, there's a segmentation mask instead. We will use [facebook/mask2former-swin-large-cityscapes-instance](https://huggingface.co/facebook/mask2former-swin-large-cityscapes-instance) for this.
+
+```python
+instance_segmentation = pipeline("image-segmentation", "facebook/mask2former-swin-large-cityscapes-instance")
+results = instance_segmentation(image)
+results
+```
+
+As you can see below, there are multiple cars classified, and there's no classification for pixels other than pixels that belong to car and person instances.
+
+```bash
+[{'score': 0.999944,
+ 'label': 'car',
+ 'mask': },
+ {'score': 0.999945,
+ 'label': 'car',
+ 'mask': },
+ {'score': 0.999652,
+ 'label': 'car',
+ 'mask': },
+ {'score': 0.903529,
+ 'label': 'person',
+ 'mask': }]
+```
+Checking out one of the car masks below.
+
+```python
+results[2]["mask"]
+```
+
+
+
+
+Panoptic segmentation combines semantic segmentation and instance segmentation, where every pixel is classified into a class and an instance of that class, and there are multiple masks for each instance of a class. We can use [facebook/mask2former-swin-large-cityscapes-panoptic](https://huggingface.co/facebook/mask2former-swin-large-cityscapes-panoptic) for this.
+
+```python
+panoptic_segmentation = pipeline("image-segmentation", "facebook/mask2former-swin-large-cityscapes-panoptic")
+results = panoptic_segmentation(image)
+results
+```
+As you can see below, we have more classes. We will later illustrate to see that every pixel is classified into one of the classes.
+
+```bash
+[{'score': 0.999981,
+ 'label': 'car',
+ 'mask': },
+ {'score': 0.999958,
+ 'label': 'car',
+ 'mask': },
+ {'score': 0.99997,
+ 'label': 'vegetation',
+ 'mask': },
+ {'score': 0.999575,
+ 'label': 'pole',
+ 'mask': },
+ {'score': 0.999958,
+ 'label': 'building',
+ 'mask': },
+ {'score': 0.999634,
+ 'label': 'road',
+ 'mask': },
+ {'score': 0.996092,
+ 'label': 'sidewalk',
+ 'mask': },
+ {'score': 0.999221,
+ 'label': 'car',
+ 'mask': },
+ {'score': 0.99987,
+ 'label': 'sky',
+ 'mask': }]
+```
+
+Let's have a side by side comparison for all types of segmentation.
+
+
+
+
+
+Seeing all types of segmentation, let's have a deep dive on fine-tuning a model for semantic segmentation.
+
+Common real-world applications of semantic segmentation include training self-driving cars to identify pedestrians and important traffic information, identifying cells and abnormalities in medical imagery, and monitoring environmental changes from satellite imagery.
+
+## Fine-tuning a Model for Segmentation
+
+We will now:
+
+1. Finetune [SegFormer](https://huggingface.co/docs/transformers/main/en/model_doc/segformer#segformer) on the [SceneParse150](https://huggingface.co/datasets/scene_parse_150) dataset.
+2. Use your fine-tuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/image-segmentation)
+
+
+
+
+### Load SceneParse150 dataset
+
+Start by loading a smaller subset of the SceneParse150 dataset from the ๐ค Datasets library. This'll give you a chance to experiment and make sure everything works before spending more time training on the full dataset.
+
+```py
+>>> from datasets import load_dataset
+
+>>> ds = load_dataset("scene_parse_150", split="train[:50]")
+```
+
+Split the dataset's `train` split into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+```py
+>>> ds = ds.train_test_split(test_size=0.2)
+>>> train_ds = ds["train"]
+>>> test_ds = ds["test"]
+```
+
+Then take a look at an example:
+
+```py
+>>> train_ds[0]
+{'image': ,
+ 'annotation': ,
+ 'scene_category': 368}
+
+# view the image
+>>> train_ds[0]["image"]
+```
+
+- `image`: a PIL image of the scene.
+- `annotation`: a PIL image of the segmentation map, which is also the model's target.
+- `scene_category`: a category id that describes the image scene like "kitchen" or "office". In this guide, you'll only need `image` and `annotation`, both of which are PIL images.
+
+You'll also want to create a dictionary that maps a label id to a label class which will be useful when you set up the model later. Download the mappings from the Hub and create the `id2label` and `label2id` dictionaries:
+
+```py
+>>> import json
+>>> from pathlib import Path
+>>> from huggingface_hub import hf_hub_download
+
+>>> repo_id = "huggingface/label-files"
+>>> filename = "ade20k-id2label.json"
+>>> id2label = json.loads(Path(hf_hub_download(repo_id, filename, repo_type="dataset")).read_text())
+>>> id2label = {int(k): v for k, v in id2label.items()}
+>>> label2id = {v: k for k, v in id2label.items()}
+>>> num_labels = len(id2label)
+```
+
+#### Custom dataset
+
+You could also create and use your own dataset if you prefer to train with the [run_semantic_segmentation.py](https://github.com/huggingface/transformers/blob/main/examples/pytorch/semantic-segmentation/run_semantic_segmentation.py) script instead of a notebook instance. The script requires:
+
+1. a [`~datasets.DatasetDict`] with two [`~datasets.Image`] columns, "image" and "label"
+
+ ```py
+ from datasets import Dataset, DatasetDict, Image
+
+ image_paths_train = ["path/to/image_1.jpg/jpg", "path/to/image_2.jpg/jpg", ..., "path/to/image_n.jpg/jpg"]
+ label_paths_train = ["path/to/annotation_1.png", "path/to/annotation_2.png", ..., "path/to/annotation_n.png"]
+
+ image_paths_validation = [...]
+ label_paths_validation = [...]
+
+ def create_dataset(image_paths, label_paths):
+ dataset = Dataset.from_dict({"image": sorted(image_paths),
+ "label": sorted(label_paths)})
+ dataset = dataset.cast_column("image", Image())
+ dataset = dataset.cast_column("label", Image())
+ return dataset
+
+ # step 1: create Dataset objects
+ train_dataset = create_dataset(image_paths_train, label_paths_train)
+ validation_dataset = create_dataset(image_paths_validation, label_paths_validation)
+
+ # step 2: create DatasetDict
+ dataset = DatasetDict({
+ "train": train_dataset,
+ "validation": validation_dataset,
+ }
+ )
+
+ # step 3: push to Hub (assumes you have ran the huggingface-cli login command in a terminal/notebook)
+ dataset.push_to_hub("your-name/dataset-repo")
+
+ # optionally, you can push to a private repo on the Hub
+ # dataset.push_to_hub("name of repo on the hub", private=True)
+ ```
+
+2. an id2label dictionary mapping the class integers to their class names
+
+ ```py
+ import json
+ # simple example
+ id2label = {0: 'cat', 1: 'dog'}
+ with open('id2label.json', 'w') as fp:
+ json.dump(id2label, fp)
+ ```
+
+As an example, take a look at this [example dataset](https://huggingface.co/datasets/nielsr/ade20k-demo) which was created with the steps shown above.
+
+### Preprocess
+
+The next step is to load a SegFormer image processor to prepare the images and annotations for the model. Some datasets, like this one, use the zero-index as the background class. However, the background class isn't actually included in the 150 classes, so you'll need to set `do_reduce_labels=True` to subtract one from all the labels. The zero-index is replaced by `255` so it's ignored by SegFormer's loss function:
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> checkpoint = "nvidia/mit-b0"
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint, do_reduce_labels=True)
+```
+
+
+
+
+It is common to apply some data augmentations to an image dataset to make a model more robust against overfitting. In this guide, you'll use the [`ColorJitter`](https://pytorch.org/vision/stable/generated/torchvision.transforms.ColorJitter.html) function from [torchvision](https://pytorch.org/vision/stable/index.html) to randomly change the color properties of an image, but you can also use any image library you like.
+
+```py
+>>> from torchvision.transforms import ColorJitter
+
+>>> jitter = ColorJitter(brightness=0.25, contrast=0.25, saturation=0.25, hue=0.1)
+```
+
+Now create two preprocessing functions to prepare the images and annotations for the model. These functions convert the images into `pixel_values` and annotations to `labels`. For the training set, `jitter` is applied before providing the images to the image processor. For the test set, the image processor crops and normalizes the `images`, and only crops the `labels` because no data augmentation is applied during testing.
+
+```py
+>>> def train_transforms(example_batch):
+... images = [jitter(x) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+
+
+>>> def val_transforms(example_batch):
+... images = [x for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+```
+
+To apply the `jitter` over the entire dataset, use the ๐ค Datasets [`~datasets.Dataset.set_transform`] function. The transform is applied on the fly which is faster and consumes less disk space:
+
+```py
+>>> train_ds.set_transform(train_transforms)
+>>> test_ds.set_transform(val_transforms)
+```
+
+
+
+
+
+
+It is common to apply some data augmentations to an image dataset to make a model more robust against overfitting.
+In this guide, you'll use [`tf.image`](https://www.tensorflow.org/api_docs/python/tf/image) to randomly change the color properties of an image, but you can also use any image
+library you like.
+Define two separate transformation functions:
+- training data transformations that include image augmentation
+- validation data transformations that only transpose the images, since computer vision models in ๐ค Transformers expect channels-first layout
+
+```py
+>>> import tensorflow as tf
+
+
+>>> def aug_transforms(image):
+... image = tf.keras.utils.img_to_array(image)
+... image = tf.image.random_brightness(image, 0.25)
+... image = tf.image.random_contrast(image, 0.5, 2.0)
+... image = tf.image.random_saturation(image, 0.75, 1.25)
+... image = tf.image.random_hue(image, 0.1)
+... image = tf.transpose(image, (2, 0, 1))
+... return image
+
+
+>>> def transforms(image):
+... image = tf.keras.utils.img_to_array(image)
+... image = tf.transpose(image, (2, 0, 1))
+... return image
+```
+
+Next, create two preprocessing functions to prepare batches of images and annotations for the model. These functions apply
+the image transformations and use the earlier loaded `image_processor` to convert the images into `pixel_values` and
+annotations to `labels`. `ImageProcessor` also takes care of resizing and normalizing the images.
+
+```py
+>>> def train_transforms(example_batch):
+... images = [aug_transforms(x.convert("RGB")) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+
+
+>>> def val_transforms(example_batch):
+... images = [transforms(x.convert("RGB")) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+```
+
+To apply the preprocessing transformations over the entire dataset, use the ๐ค Datasets [`~datasets.Dataset.set_transform`] function.
+The transform is applied on the fly which is faster and consumes less disk space:
+
+```py
+>>> train_ds.set_transform(train_transforms)
+>>> test_ds.set_transform(val_transforms)
+```
+
+
+
+### Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load an evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [mean Intersection over Union](https://huggingface.co/spaces/evaluate-metric/accuracy) (IoU) metric (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric):
+
+```py
+>>> import evaluate
+
+>>> metric = evaluate.load("mean_iou")
+```
+
+Then create a function to [`~evaluate.EvaluationModule.compute`] the metrics. Your predictions need to be converted to
+logits first, and then reshaped to match the size of the labels before you can call [`~evaluate.EvaluationModule.compute`]:
+
+
+
+
+```py
+>>> import numpy as np
+>>> import torch
+>>> from torch import nn
+
+>>> def compute_metrics(eval_pred):
+... with torch.no_grad():
+... logits, labels = eval_pred
+... logits_tensor = torch.from_numpy(logits)
+... logits_tensor = nn.functional.interpolate(
+... logits_tensor,
+... size=labels.shape[-2:],
+... mode="bilinear",
+... align_corners=False,
+... ).argmax(dim=1)
+
+... pred_labels = logits_tensor.detach().cpu().numpy()
+... metrics = metric.compute(
+... predictions=pred_labels,
+... references=labels,
+... num_labels=num_labels,
+... ignore_index=255,
+... reduce_labels=False,
+... )
+... for key, value in metrics.items():
+... if isinstance(value, np.ndarray):
+... metrics[key] = value.tolist()
+... return metrics
+```
+
+
+
+
+
+
+
+
+```py
+>>> def compute_metrics(eval_pred):
+... logits, labels = eval_pred
+... logits = tf.transpose(logits, perm=[0, 2, 3, 1])
+... logits_resized = tf.image.resize(
+... logits,
+... size=tf.shape(labels)[1:],
+... method="bilinear",
+... )
+
+... pred_labels = tf.argmax(logits_resized, axis=-1)
+... metrics = metric.compute(
+... predictions=pred_labels,
+... references=labels,
+... num_labels=num_labels,
+... ignore_index=-1,
+... reduce_labels=image_processor.do_reduce_labels,
+... )
+
+... per_category_accuracy = metrics.pop("per_category_accuracy").tolist()
+... per_category_iou = metrics.pop("per_category_iou").tolist()
+
+... metrics.update({f"accuracy_{id2label[i]}": v for i, v in enumerate(per_category_accuracy)})
+... metrics.update({f"iou_{id2label[i]}": v for i, v in enumerate(per_category_iou)})
+... return {"val_" + k: v for k, v in metrics.items()}
+```
+
+
+
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+### Train
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#finetune-with-trainer)!
+
+
+
+You're ready to start training your model now! Load SegFormer with [`AutoModelForSemanticSegmentation`], and pass the model the mapping between label ids and label classes:
+
+```py
+>>> from transformers import AutoModelForSemanticSegmentation, TrainingArguments, Trainer
+
+>>> model = AutoModelForSemanticSegmentation.from_pretrained(checkpoint, id2label=id2label, label2id=label2id)
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. It is important you don't remove unused columns because this'll drop the `image` column. Without the `image` column, you can't create `pixel_values`. Set `remove_unused_columns=False` to prevent this behavior! The only other required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the IoU metric and save the training checkpoint.
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="segformer-b0-scene-parse-150",
+... learning_rate=6e-5,
+... num_train_epochs=50,
+... per_device_train_batch_size=2,
+... per_device_eval_batch_size=2,
+... save_total_limit=3,
+... eval_strategy="steps",
+... save_strategy="steps",
+... save_steps=20,
+... eval_steps=20,
+... logging_steps=1,
+... eval_accumulation_steps=5,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=train_ds,
+... eval_dataset=test_ds,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+
+
+If you are unfamiliar with fine-tuning a model with Keras, check out the [basic tutorial](./training#train-a-tensorflow-model-with-keras) first!
+
+
+
+To fine-tune a model in TensorFlow, follow these steps:
+1. Define the training hyperparameters, and set up an optimizer and a learning rate schedule.
+2. Instantiate a pretrained model.
+3. Convert a ๐ค Dataset to a `tf.data.Dataset`.
+4. Compile your model.
+5. Add callbacks to calculate metrics and upload your model to ๐ค Hub
+6. Use the `fit()` method to run the training.
+
+Start by defining the hyperparameters, optimizer and learning rate schedule:
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 2
+>>> num_epochs = 50
+>>> num_train_steps = len(train_ds) * num_epochs
+>>> learning_rate = 6e-5
+>>> weight_decay_rate = 0.01
+
+>>> optimizer, lr_schedule = create_optimizer(
+... init_lr=learning_rate,
+... num_train_steps=num_train_steps,
+... weight_decay_rate=weight_decay_rate,
+... num_warmup_steps=0,
+... )
+```
+
+Then, load SegFormer with [`TFAutoModelForSemanticSegmentation`] along with the label mappings, and compile it with the
+optimizer. Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> from transformers import TFAutoModelForSemanticSegmentation
+
+>>> model = TFAutoModelForSemanticSegmentation.from_pretrained(
+... checkpoint,
+... id2label=id2label,
+... label2id=label2id,
+... )
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+Convert your datasets to the `tf.data.Dataset` format using the [`~datasets.Dataset.to_tf_dataset`] and the [`DefaultDataCollator`]:
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+
+>>> tf_train_dataset = train_ds.to_tf_dataset(
+... columns=["pixel_values", "label"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+
+>>> tf_eval_dataset = test_ds.to_tf_dataset(
+... columns=["pixel_values", "label"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+```
+
+To compute the accuracy from the predictions and push your model to the ๐ค Hub, use [Keras callbacks](../main_classes/keras_callbacks).
+Pass your `compute_metrics` function to [`KerasMetricCallback`],
+and use the [`PushToHubCallback`] to upload the model:
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback, PushToHubCallback
+
+>>> metric_callback = KerasMetricCallback(
+... metric_fn=compute_metrics, eval_dataset=tf_eval_dataset, batch_size=batch_size, label_cols=["labels"]
+... )
+
+>>> push_to_hub_callback = PushToHubCallback(output_dir="scene_segmentation", tokenizer=image_processor)
+
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+Finally, you are ready to train your model! Call `fit()` with your training and validation datasets, the number of epochs,
+and your callbacks to fine-tune the model:
+
+```py
+>>> model.fit(
+... tf_train_dataset,
+... validation_data=tf_eval_dataset,
+... callbacks=callbacks,
+... epochs=num_epochs,
+... )
+```
+
+Congratulations! You have fine-tuned your model and shared it on the ๐ค Hub. You can now use it for inference!
+
+
+
+### Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Reload the dataset and load an image for inference.
+
+```py
+>>> from datasets import load_dataset
+
+>>> ds = load_dataset("scene_parse_150", split="train[:50]")
+>>> ds = ds.train_test_split(test_size=0.2)
+>>> test_ds = ds["test"]
+>>> image = ds["test"][0]["image"]
+>>> image
+```
+
+
+
+
+
+
+
+
+We will now see how to infer without a pipeline. Process the image with an image processor and place the `pixel_values` on a GPU:
+
+```py
+>>> from accelerate.test_utils.testing import get_backend
+# automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+>>> device, _, _ = get_backend()
+>>> encoding = image_processor(image, return_tensors="pt")
+>>> pixel_values = encoding.pixel_values.to(device)
+```
+
+Pass your input to the model and return the `logits`:
+
+```py
+>>> outputs = model(pixel_values=pixel_values)
+>>> logits = outputs.logits.cpu()
+```
+
+Next, rescale the logits to the original image size:
+
+```py
+>>> upsampled_logits = nn.functional.interpolate(
+... logits,
+... size=image.size[::-1],
+... mode="bilinear",
+... align_corners=False,
+... )
+
+>>> pred_seg = upsampled_logits.argmax(dim=1)[0]
+```
+
+
+
+
+
+
+Load an image processor to preprocess the image and return the input as TensorFlow tensors:
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("MariaK/scene_segmentation")
+>>> inputs = image_processor(image, return_tensors="tf")
+```
+
+Pass your input to the model and return the `logits`:
+
+```py
+>>> from transformers import TFAutoModelForSemanticSegmentation
+
+>>> model = TFAutoModelForSemanticSegmentation.from_pretrained("MariaK/scene_segmentation")
+>>> logits = model(**inputs).logits
+```
+
+Next, rescale the logits to the original image size and apply argmax on the class dimension:
+```py
+>>> logits = tf.transpose(logits, [0, 2, 3, 1])
+
+>>> upsampled_logits = tf.image.resize(
+... logits,
+... # We reverse the shape of `image` because `image.size` returns width and height.
+... image.size[::-1],
+... )
+
+>>> pred_seg = tf.math.argmax(upsampled_logits, axis=-1)[0]
+```
+
+
+
+
+To visualize the results, load the [dataset color palette](https://github.com/tensorflow/models/blob/3f1ca33afe3c1631b733ea7e40c294273b9e406d/research/deeplab/utils/get_dataset_colormap.py#L51) as `ade_palette()` that maps each class to their RGB values.
+
+```py
+def ade_palette():
+ return np.asarray([
+ [0, 0, 0],
+ [120, 120, 120],
+ [180, 120, 120],
+ [6, 230, 230],
+ [80, 50, 50],
+ [4, 200, 3],
+ [120, 120, 80],
+ [140, 140, 140],
+ [204, 5, 255],
+ [230, 230, 230],
+ [4, 250, 7],
+ [224, 5, 255],
+ [235, 255, 7],
+ [150, 5, 61],
+ [120, 120, 70],
+ [8, 255, 51],
+ [255, 6, 82],
+ [143, 255, 140],
+ [204, 255, 4],
+ [255, 51, 7],
+ [204, 70, 3],
+ [0, 102, 200],
+ [61, 230, 250],
+ [255, 6, 51],
+ [11, 102, 255],
+ [255, 7, 71],
+ [255, 9, 224],
+ [9, 7, 230],
+ [220, 220, 220],
+ [255, 9, 92],
+ [112, 9, 255],
+ [8, 255, 214],
+ [7, 255, 224],
+ [255, 184, 6],
+ [10, 255, 71],
+ [255, 41, 10],
+ [7, 255, 255],
+ [224, 255, 8],
+ [102, 8, 255],
+ [255, 61, 6],
+ [255, 194, 7],
+ [255, 122, 8],
+ [0, 255, 20],
+ [255, 8, 41],
+ [255, 5, 153],
+ [6, 51, 255],
+ [235, 12, 255],
+ [160, 150, 20],
+ [0, 163, 255],
+ [140, 140, 140],
+ [250, 10, 15],
+ [20, 255, 0],
+ [31, 255, 0],
+ [255, 31, 0],
+ [255, 224, 0],
+ [153, 255, 0],
+ [0, 0, 255],
+ [255, 71, 0],
+ [0, 235, 255],
+ [0, 173, 255],
+ [31, 0, 255],
+ [11, 200, 200],
+ [255, 82, 0],
+ [0, 255, 245],
+ [0, 61, 255],
+ [0, 255, 112],
+ [0, 255, 133],
+ [255, 0, 0],
+ [255, 163, 0],
+ [255, 102, 0],
+ [194, 255, 0],
+ [0, 143, 255],
+ [51, 255, 0],
+ [0, 82, 255],
+ [0, 255, 41],
+ [0, 255, 173],
+ [10, 0, 255],
+ [173, 255, 0],
+ [0, 255, 153],
+ [255, 92, 0],
+ [255, 0, 255],
+ [255, 0, 245],
+ [255, 0, 102],
+ [255, 173, 0],
+ [255, 0, 20],
+ [255, 184, 184],
+ [0, 31, 255],
+ [0, 255, 61],
+ [0, 71, 255],
+ [255, 0, 204],
+ [0, 255, 194],
+ [0, 255, 82],
+ [0, 10, 255],
+ [0, 112, 255],
+ [51, 0, 255],
+ [0, 194, 255],
+ [0, 122, 255],
+ [0, 255, 163],
+ [255, 153, 0],
+ [0, 255, 10],
+ [255, 112, 0],
+ [143, 255, 0],
+ [82, 0, 255],
+ [163, 255, 0],
+ [255, 235, 0],
+ [8, 184, 170],
+ [133, 0, 255],
+ [0, 255, 92],
+ [184, 0, 255],
+ [255, 0, 31],
+ [0, 184, 255],
+ [0, 214, 255],
+ [255, 0, 112],
+ [92, 255, 0],
+ [0, 224, 255],
+ [112, 224, 255],
+ [70, 184, 160],
+ [163, 0, 255],
+ [153, 0, 255],
+ [71, 255, 0],
+ [255, 0, 163],
+ [255, 204, 0],
+ [255, 0, 143],
+ [0, 255, 235],
+ [133, 255, 0],
+ [255, 0, 235],
+ [245, 0, 255],
+ [255, 0, 122],
+ [255, 245, 0],
+ [10, 190, 212],
+ [214, 255, 0],
+ [0, 204, 255],
+ [20, 0, 255],
+ [255, 255, 0],
+ [0, 153, 255],
+ [0, 41, 255],
+ [0, 255, 204],
+ [41, 0, 255],
+ [41, 255, 0],
+ [173, 0, 255],
+ [0, 245, 255],
+ [71, 0, 255],
+ [122, 0, 255],
+ [0, 255, 184],
+ [0, 92, 255],
+ [184, 255, 0],
+ [0, 133, 255],
+ [255, 214, 0],
+ [25, 194, 194],
+ [102, 255, 0],
+ [92, 0, 255],
+ ])
+```
+
+Then you can combine and plot your image and the predicted segmentation map:
+
+```py
+>>> import matplotlib.pyplot as plt
+>>> import numpy as np
+
+>>> color_seg = np.zeros((pred_seg.shape[0], pred_seg.shape[1], 3), dtype=np.uint8)
+>>> palette = np.array(ade_palette())
+>>> for label, color in enumerate(palette):
+... color_seg[pred_seg == label, :] = color
+>>> color_seg = color_seg[..., ::-1] # convert to BGR
+
+>>> img = np.array(image) * 0.5 + color_seg * 0.5 # plot the image with the segmentation map
+>>> img = img.astype(np.uint8)
+
+>>> plt.figure(figsize=(15, 10))
+>>> plt.imshow(img)
+>>> plt.show()
+```
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/sequence_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/sequence_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..27516ace1cc345bd5caaf00774020749e32a2b84
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/sequence_classification.md
@@ -0,0 +1,391 @@
+
+
+# Text classification
+
+[[open-in-colab]]
+
+
+
+Text classification is a common NLP task that assigns a label or class to text. Some of the largest companies run text classification in production for a wide range of practical applications. One of the most popular forms of text classification is sentiment analysis, which assigns a label like ๐ positive, ๐ negative, or ๐ neutral to a sequence of text.
+
+This guide will show you how to:
+
+1. Finetune [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) on the [IMDb](https://huggingface.co/datasets/imdb) dataset to determine whether a movie review is positive or negative.
+2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/text-classification).
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate accelerate
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load IMDb dataset
+
+Start by loading the IMDb dataset from the ๐ค Datasets library:
+
+```py
+>>> from datasets import load_dataset
+
+>>> imdb = load_dataset("imdb")
+```
+
+Then take a look at an example:
+
+```py
+>>> imdb["test"][0]
+{
+ "label": 0,
+ "text": "I love sci-fi and am willing to put up with a lot. Sci-fi movies/TV are usually underfunded, under-appreciated and misunderstood. I tried to like this, I really did, but it is to good TV sci-fi as Babylon 5 is to Star Trek (the original). Silly prosthetics, cheap cardboard sets, stilted dialogues, CG that doesn't match the background, and painfully one-dimensional characters cannot be overcome with a 'sci-fi' setting. (I'm sure there are those of you out there who think Babylon 5 is good sci-fi TV. It's not. It's clichรฉd and uninspiring.) While US viewers might like emotion and character development, sci-fi is a genre that does not take itself seriously (cf. Star Trek). It may treat important issues, yet not as a serious philosophy. It's really difficult to care about the characters here as they are not simply foolish, just missing a spark of life. Their actions and reactions are wooden and predictable, often painful to watch. The makers of Earth KNOW it's rubbish as they have to always say \"Gene Roddenberry's Earth...\" otherwise people would not continue watching. Roddenberry's ashes must be turning in their orbit as this dull, cheap, poorly edited (watching it without advert breaks really brings this home) trudging Trabant of a show lumbers into space. Spoiler. So, kill off a main character. And then bring him back as another actor. Jeeez! Dallas all over again.",
+}
+```
+
+There are two fields in this dataset:
+
+- `text`: the movie review text.
+- `label`: a value that is either `0` for a negative review or `1` for a positive review.
+
+## Preprocess
+
+The next step is to load a DistilBERT tokenizer to preprocess the `text` field:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Create a preprocessing function to tokenize `text` and truncate sequences to be no longer than DistilBERT's maximum input length:
+
+```py
+>>> def preprocess_function(examples):
+... return tokenizer(examples["text"], truncation=True)
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] function. You can speed up `map` by setting `batched=True` to process multiple elements of the dataset at once:
+
+```py
+tokenized_imdb = imdb.map(preprocess_function, batched=True)
+```
+
+Now create a batch of examples using [`DataCollatorWithPadding`]. It's more efficient to *dynamically pad* the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
+
+
+
+```py
+>>> from transformers import DataCollatorWithPadding
+
+>>> data_collator = DataCollatorWithPadding(tokenizer=tokenizer)
+```
+
+
+```py
+>>> from transformers import DataCollatorWithPadding
+
+>>> data_collator = DataCollatorWithPadding(tokenizer=tokenizer, return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load a evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [accuracy](https://huggingface.co/spaces/evaluate-metric/accuracy) metric (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric):
+
+```py
+>>> import evaluate
+
+>>> accuracy = evaluate.load("accuracy")
+```
+
+Then create a function that passes your predictions and labels to [`~evaluate.EvaluationModule.compute`] to calculate the accuracy:
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions, labels = eval_pred
+... predictions = np.argmax(predictions, axis=1)
+... return accuracy.compute(predictions=predictions, references=labels)
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+## Train
+
+Before you start training your model, create a map of the expected ids to their labels with `id2label` and `label2id`:
+
+```py
+>>> id2label = {0: "NEGATIVE", 1: "POSITIVE"}
+>>> label2id = {"NEGATIVE": 0, "POSITIVE": 1}
+```
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load DistilBERT with [`AutoModelForSequenceClassification`] along with the number of expected labels, and the label mappings:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification, TrainingArguments, Trainer
+
+>>> model = AutoModelForSequenceClassification.from_pretrained(
+... "distilbert/distilbert-base-uncased", num_labels=2, id2label=id2label, label2id=label2id
+... )
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the accuracy and save the training checkpoint.
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_model",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=2,
+... weight_decay=0.01,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... load_best_model_at_end=True,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_imdb["train"],
+... eval_dataset=tokenized_imdb["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+
+
+[`Trainer`] applies dynamic padding by default when you pass `tokenizer` to it. In this case, you don't need to specify a data collator explicitly.
+
+
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the basic tutorial [here](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import create_optimizer
+>>> import tensorflow as tf
+
+>>> batch_size = 16
+>>> num_epochs = 5
+>>> batches_per_epoch = len(tokenized_imdb["train"]) // batch_size
+>>> total_train_steps = int(batches_per_epoch * num_epochs)
+>>> optimizer, schedule = create_optimizer(init_lr=2e-5, num_warmup_steps=0, num_train_steps=total_train_steps)
+```
+
+Then you can load DistilBERT with [`TFAutoModelForSequenceClassification`] along with the number of expected labels, and the label mappings:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained(
+... "distilbert/distilbert-base-uncased", num_labels=2, id2label=id2label, label2id=label2id
+... )
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_imdb["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_imdb["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method). Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+The last two things to setup before you start training is to compute the accuracy from the predictions, and provide a way to push your model to the Hub. Both are done by using [Keras callbacks](../main_classes/keras_callbacks).
+
+Pass your `compute_metrics` function to [`~transformers.KerasMetricCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)
+```
+
+Specify where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_model",
+... tokenizer=tokenizer,
+... )
+```
+
+Then bundle your callbacks together:
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=3, callbacks=callbacks)
+```
+
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+For a more in-depth example of how to finetune a model for text classification, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb).
+
+
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Grab some text you'd like to run inference on:
+
+```py
+>>> text = "This was a masterpiece. Not completely faithful to the books, but enthralling from beginning to end. Might be my favorite of the three."
+```
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for sentiment analysis with your model, and pass your text to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("sentiment-analysis", model="stevhliu/my_awesome_model")
+>>> classifier(text)
+[{'label': 'POSITIVE', 'score': 0.9994940757751465}]
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+Tokenize the text and return PyTorch tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_model")
+>>> inputs = tokenizer(text, return_tensors="pt")
+```
+
+Pass your inputs to the model and return the `logits`:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("stevhliu/my_awesome_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+Get the class with the highest probability, and use the model's `id2label` mapping to convert it to a text label:
+
+```py
+>>> predicted_class_id = logits.argmax().item()
+>>> model.config.id2label[predicted_class_id]
+'POSITIVE'
+```
+
+
+Tokenize the text and return TensorFlow tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_model")
+>>> inputs = tokenizer(text, return_tensors="tf")
+```
+
+Pass your inputs to the model and return the `logits`:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("stevhliu/my_awesome_model")
+>>> logits = model(**inputs).logits
+```
+
+Get the class with the highest probability, and use the model's `id2label` mapping to convert it to a text label:
+
+```py
+>>> predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])
+>>> model.config.id2label[predicted_class_id]
+'POSITIVE'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/summarization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/summarization.md
new file mode 100644
index 0000000000000000000000000000000000000000..e16dd17dfe1fc8186cd0f121f5f794d0f7f7c16e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/summarization.md
@@ -0,0 +1,400 @@
+
+
+# Summarization
+
+[[open-in-colab]]
+
+
+
+Summarization creates a shorter version of a document or an article that captures all the important information. Along with translation, it is another example of a task that can be formulated as a sequence-to-sequence task. Summarization can be:
+
+- Extractive: extract the most relevant information from a document.
+- Abstractive: generate new text that captures the most relevant information.
+
+This guide will show you how to:
+
+1. Finetune [T5](https://huggingface.co/google-t5/t5-small) on the California state bill subset of the [BillSum](https://huggingface.co/datasets/billsum) dataset for abstractive summarization.
+2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/summarization)
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate rouge_score
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load BillSum dataset
+
+Start by loading the smaller California state bill subset of the BillSum dataset from the ๐ค Datasets library:
+
+```py
+>>> from datasets import load_dataset
+
+>>> billsum = load_dataset("billsum", split="ca_test")
+```
+
+Split the dataset into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+```py
+>>> billsum = billsum.train_test_split(test_size=0.2)
+```
+
+Then take a look at an example:
+
+```py
+>>> billsum["train"][0]
+{'summary': 'Existing law authorizes state agencies to enter into contracts for the acquisition of goods or services upon approval by the Department of General Services. Existing law sets forth various requirements and prohibitions for those contracts, including, but not limited to, a prohibition on entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between spouses and domestic partners or same-sex and different-sex couples in the provision of benefits. Existing law provides that a contract entered into in violation of those requirements and prohibitions is void and authorizes the state or any person acting on behalf of the state to bring a civil action seeking a determination that a contract is in violation and therefore void. Under existing law, a willful violation of those requirements and prohibitions is a misdemeanor.\nThis bill would also prohibit a state agency from entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between employees on the basis of gender identity in the provision of benefits, as specified. By expanding the scope of a crime, this bill would impose a state-mandated local program.\nThe California Constitution requires the state to reimburse local agencies and school districts for certain costs mandated by the state. Statutory provisions establish procedures for making that reimbursement.\nThis bill would provide that no reimbursement is required by this act for a specified reason.',
+ 'text': 'The people of the State of California do enact as follows:\n\n\nSECTION 1.\nSection 10295.35 is added to the Public Contract Code, to read:\n10295.35.\n(a) (1) Notwithstanding any other law, a state agency shall not enter into any contract for the acquisition of goods or services in the amount of one hundred thousand dollars ($100,000) or more with a contractor that, in the provision of benefits, discriminates between employees on the basis of an employeeโs or dependentโs actual or perceived gender identity, including, but not limited to, the employeeโs or dependentโs identification as transgender.\n(2) For purposes of this section, โcontractโ includes contracts with a cumulative amount of one hundred thousand dollars ($100,000) or more per contractor in each fiscal year.\n(3) For purposes of this section, an employee health plan is discriminatory if the plan is not consistent with Section 1365.5 of the Health and Safety Code and Section 10140 of the Insurance Code.\n(4) The requirements of this section shall apply only to those portions of a contractorโs operations that occur under any of the following conditions:\n(A) Within the state.\n(B) On real property outside the state if the property is owned by the state or if the state has a right to occupy the property, and if the contractorโs presence at that location is connected to a contract with the state.\n(C) Elsewhere in the United States where work related to a state contract is being performed.\n(b) Contractors shall treat as confidential, to the maximum extent allowed by law or by the requirement of the contractorโs insurance provider, any request by an employee or applicant for employment benefits or any documentation of eligibility for benefits submitted by an employee or applicant for employment.\n(c) After taking all reasonable measures to find a contractor that complies with this section, as determined by the state agency, the requirements of this section may be waived under any of the following circumstances:\n(1) There is only one prospective contractor willing to enter into a specific contract with the state agency.\n(2) The contract is necessary to respond to an emergency, as determined by the state agency, that endangers the public health, welfare, or safety, or the contract is necessary for the provision of essential services, and no entity that complies with the requirements of this section capable of responding to the emergency is immediately available.\n(3) The requirements of this section violate, or are inconsistent with, the terms or conditions of a grant, subvention, or agreement, if the agency has made a good faith attempt to change the terms or conditions of any grant, subvention, or agreement to authorize application of this section.\n(4) The contractor is providing wholesale or bulk water, power, or natural gas, the conveyance or transmission of the same, or ancillary services, as required for ensuring reliable services in accordance with good utility practice, if the purchase of the same cannot practically be accomplished through the standard competitive bidding procedures and the contractor is not providing direct retail services to end users.\n(d) (1) A contractor shall not be deemed to discriminate in the provision of benefits if the contractor, in providing the benefits, pays the actual costs incurred in obtaining the benefit.\n(2) If a contractor is unable to provide a certain benefit, despite taking reasonable measures to do so, the contractor shall not be deemed to discriminate in the provision of benefits.\n(e) (1) Every contract subject to this chapter shall contain a statement by which the contractor certifies that the contractor is in compliance with this section.\n(2) The department or other contracting agency shall enforce this section pursuant to its existing enforcement powers.\n(3) (A) If a contractor falsely certifies that it is in compliance with this section, the contract with that contractor shall be subject to Article 9 (commencing with Section 10420), unless, within a time period specified by the department or other contracting agency, the contractor provides to the department or agency proof that it has complied, or is in the process of complying, with this section.\n(B) The application of the remedies or penalties contained in Article 9 (commencing with Section 10420) to a contract subject to this chapter shall not preclude the application of any existing remedies otherwise available to the department or other contracting agency under its existing enforcement powers.\n(f) Nothing in this section is intended to regulate the contracting practices of any local jurisdiction.\n(g) This section shall be construed so as not to conflict with applicable federal laws, rules, or regulations. In the event that a court or agency of competent jurisdiction holds that federal law, rule, or regulation invalidates any clause, sentence, paragraph, or section of this code or the application thereof to any person or circumstances, it is the intent of the state that the court or agency sever that clause, sentence, paragraph, or section so that the remainder of this section shall remain in effect.\nSEC. 2.\nSection 10295.35 of the Public Contract Code shall not be construed to create any new enforcement authority or responsibility in the Department of General Services or any other contracting agency.\nSEC. 3.\nNo reimbursement is required by this act pursuant to Section 6 of Article XIII\u2009B of the California Constitution because the only costs that may be incurred by a local agency or school district will be incurred because this act creates a new crime or infraction, eliminates a crime or infraction, or changes the penalty for a crime or infraction, within the meaning of Section 17556 of the Government Code, or changes the definition of a crime within the meaning of Section 6 of Article XIII\u2009B of the California Constitution.',
+ 'title': 'An act to add Section 10295.35 to the Public Contract Code, relating to public contracts.'}
+```
+
+There are two fields that you'll want to use:
+
+- `text`: the text of the bill which'll be the input to the model.
+- `summary`: a condensed version of `text` which'll be the model target.
+
+## Preprocess
+
+The next step is to load a T5 tokenizer to process `text` and `summary`:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> checkpoint = "google-t5/t5-small"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+```
+
+The preprocessing function you want to create needs to:
+
+1. Prefix the input with a prompt so T5 knows this is a summarization task. Some models capable of multiple NLP tasks require prompting for specific tasks.
+2. Use the keyword `text_target` argument when tokenizing labels.
+3. Truncate sequences to be no longer than the maximum length set by the `max_length` parameter.
+
+```py
+>>> prefix = "summarize: "
+
+
+>>> def preprocess_function(examples):
+... inputs = [prefix + doc for doc in examples["text"]]
+... model_inputs = tokenizer(inputs, max_length=1024, truncation=True)
+
+... labels = tokenizer(text_target=examples["summary"], max_length=128, truncation=True)
+
+... model_inputs["labels"] = labels["input_ids"]
+... return model_inputs
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] method. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once:
+
+```py
+>>> tokenized_billsum = billsum.map(preprocess_function, batched=True)
+```
+
+Now create a batch of examples using [`DataCollatorForSeq2Seq`]. It's more efficient to *dynamically pad* the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
+
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)
+```
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load a evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [ROUGE](https://huggingface.co/spaces/evaluate-metric/rouge) metric (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric):
+
+```py
+>>> import evaluate
+
+>>> rouge = evaluate.load("rouge")
+```
+
+Then create a function that passes your predictions and labels to [`~evaluate.EvaluationModule.compute`] to calculate the ROUGE metric:
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions, labels = eval_pred
+... decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
+... labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
+... decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
+
+... result = rouge.compute(predictions=decoded_preds, references=decoded_labels, use_stemmer=True)
+
+... prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in predictions]
+... result["gen_len"] = np.mean(prediction_lens)
+
+... return {k: round(v, 4) for k, v in result.items()}
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load T5 with [`AutoModelForSeq2SeqLM`]:
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`Seq2SeqTrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the ROUGE metric and save the training checkpoint.
+2. Pass the training arguments to [`Seq2SeqTrainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = Seq2SeqTrainingArguments(
+... output_dir="my_awesome_billsum_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... weight_decay=0.01,
+... save_total_limit=3,
+... num_train_epochs=4,
+... predict_with_generate=True,
+... fp16=True, #change to bf16=True for XPU
+... push_to_hub=True,
+... )
+
+>>> trainer = Seq2SeqTrainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_billsum["train"],
+... eval_dataset=tokenized_billsum["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the basic tutorial [here](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+Then you can load T5 with [`TFAutoModelForSeq2SeqLM`]:
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_billsum["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... tokenized_billsum["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method). Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+The last two things to setup before you start training is to compute the ROUGE score from the predictions, and provide a way to push your model to the Hub. Both are done by using [Keras callbacks](../main_classes/keras_callbacks).
+
+Pass your `compute_metrics` function to [`~transformers.KerasMetricCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_test_set)
+```
+
+Specify where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_billsum_model",
+... tokenizer=tokenizer,
+... )
+```
+
+Then bundle your callbacks together:
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=callbacks)
+```
+
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+For a more in-depth example of how to finetune a model for summarization, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb).
+
+
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Come up with some text you'd like to summarize. For T5, you need to prefix your input depending on the task you're working on. For summarization you should prefix your input as shown below:
+
+```py
+>>> text = "summarize: The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It's the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country. It'll lower the deficit and ask the ultra-wealthy and corporations to pay their fair share. And no one making under $400,000 per year will pay a penny more in taxes."
+```
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for summarization with your model, and pass your text to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> summarizer = pipeline("summarization", model="username/my_awesome_billsum_model")
+>>> summarizer(text)
+[{"summary_text": "The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It's the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country."}]
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+
+Tokenize the text and return the `input_ids` as PyTorch tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_billsum_model")
+>>> inputs = tokenizer(text, return_tensors="pt").input_ids
+```
+
+Use the [`~generation.GenerationMixin.generate`] method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the [Text Generation](../main_classes/text_generation) API.
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_billsum_model")
+>>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)
+```
+
+Decode the generated token ids back into text:
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it's the most aggressive action on tackling the climate crisis in american history. it will ask the ultra-wealthy and corporations to pay their fair share.'
+```
+
+
+Tokenize the text and return the `input_ids` as TensorFlow tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_billsum_model")
+>>> inputs = tokenizer(text, return_tensors="tf").input_ids
+```
+
+Use the [`~transformers.generation_tf_utils.TFGenerationMixin.generate`] method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the [Text Generation](../main_classes/text_generation) API.
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_billsum_model")
+>>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)
+```
+
+Decode the generated token ids back into text:
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it's the most aggressive action on tackling the climate crisis in american history. it will ask the ultra-wealthy and corporations to pay their fair share.'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/text-to-speech.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/text-to-speech.md
new file mode 100644
index 0000000000000000000000000000000000000000..e25da4e19efeaac3666194224fcc7423220ad89f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/text-to-speech.md
@@ -0,0 +1,637 @@
+
+
+# Text to speech
+
+[[open-in-colab]]
+
+Text-to-speech (TTS) is the task of creating natural-sounding speech from text, where the speech can be generated in multiple
+languages and for multiple speakers. Several text-to-speech models are currently available in ๐ค Transformers, such as
+[Bark](../model_doc/bark), [MMS](../model_doc/mms), [VITS](../model_doc/vits) and [SpeechT5](../model_doc/speecht5).
+
+You can easily generate audio using the `"text-to-audio"` pipeline (or its alias - `"text-to-speech"`). Some models, like Bark,
+can also be conditioned to generate non-verbal communications such as laughing, sighing and crying, or even add music.
+Here's an example of how you would use the `"text-to-speech"` pipeline with Bark:
+
+```py
+>>> from transformers import pipeline
+
+>>> pipe = pipeline("text-to-speech", model="suno/bark-small")
+>>> text = "[clears throat] This is a test ... and I just took a long pause."
+>>> output = pipe(text)
+```
+
+Here's a code snippet you can use to listen to the resulting audio in a notebook:
+
+```python
+>>> from IPython.display import Audio
+>>> Audio(output["audio"], rate=output["sampling_rate"])
+```
+
+For more examples on what Bark and other pretrained TTS models can do, refer to our
+[Audio course](https://huggingface.co/learn/audio-course/chapter6/pre-trained_models).
+
+If you are looking to fine-tune a TTS model, the only text-to-speech models currently available in ๐ค Transformers
+are [SpeechT5](model_doc/speecht5) and [FastSpeech2Conformer](model_doc/fastspeech2_conformer), though more will be added in the future. SpeechT5 is pre-trained on a combination of speech-to-text and text-to-speech data, allowing it to learn a unified space of hidden representations shared by both text and speech. This means that the same pre-trained model can be fine-tuned for different tasks. Furthermore, SpeechT5 supports multiple speakers through x-vector speaker embeddings.
+
+The remainder of this guide illustrates how to:
+
+1. Fine-tune [SpeechT5](../model_doc/speecht5) that was originally trained on English speech on the Dutch (`nl`) language subset of the [VoxPopuli](https://huggingface.co/datasets/facebook/voxpopuli) dataset.
+2. Use your refined model for inference in one of two ways: using a pipeline or directly.
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install datasets soundfile speechbrain accelerate
+```
+
+Install ๐คTransformers from source as not all the SpeechT5 features have been merged into an official release yet:
+
+```bash
+pip install git+https://github.com/huggingface/transformers.git
+```
+
+
+
+To follow this guide you will need a GPU. If you're working in a notebook, run the following line to check if a GPU is available:
+
+```bash
+!nvidia-smi
+```
+
+or alternatively for AMD GPUs:
+
+```bash
+!rocm-smi
+```
+
+
+
+We encourage you to log in to your Hugging Face account to upload and share your model with the community. When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load the dataset
+
+[VoxPopuli](https://huggingface.co/datasets/facebook/voxpopuli) is a large-scale multilingual speech corpus consisting of
+data sourced from 2009-2020 European Parliament event recordings. It contains labelled audio-transcription data for 15
+European languages. In this guide, we are using the Dutch language subset, feel free to pick another subset.
+
+Note that VoxPopuli or any other automated speech recognition (ASR) dataset may not be the most suitable
+option for training TTS models. The features that make it beneficial for ASR, such as excessive background noise, are
+typically undesirable in TTS. However, finding top-quality, multilingual, and multi-speaker TTS datasets can be quite
+challenging.
+
+Let's load the data:
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("facebook/voxpopuli", "nl", split="train")
+>>> len(dataset)
+20968
+```
+
+20968 examples should be sufficient for fine-tuning. SpeechT5 expects audio data to have a sampling rate of 16 kHz, so
+make sure the examples in the dataset meet this requirement:
+
+```py
+dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
+```
+
+## Preprocess the data
+
+Let's begin by defining the model checkpoint to use and loading the appropriate processor:
+
+```py
+>>> from transformers import SpeechT5Processor
+
+>>> checkpoint = "microsoft/speecht5_tts"
+>>> processor = SpeechT5Processor.from_pretrained(checkpoint)
+```
+
+### Text cleanup for SpeechT5 tokenization
+
+Start by cleaning up the text data. You'll need the tokenizer part of the processor to process the text:
+
+```py
+>>> tokenizer = processor.tokenizer
+```
+
+The dataset examples contain `raw_text` and `normalized_text` features. When deciding which feature to use as the text input,
+consider that the SpeechT5 tokenizer doesn't have any tokens for numbers. In `normalized_text` the numbers are written
+out as text. Thus, it is a better fit, and we recommend using `normalized_text` as input text.
+
+Because SpeechT5 was trained on the English language, it may not recognize certain characters in the Dutch dataset. If
+left as is, these characters will be converted to `` tokens. However, in Dutch, certain characters like `ร ` are
+used to stress syllables. In order to preserve the meaning of the text, we can replace this character with a regular `a`.
+
+To identify unsupported tokens, extract all unique characters in the dataset using the `SpeechT5Tokenizer` which
+works with characters as tokens. To do this, write the `extract_all_chars` mapping function that concatenates
+the transcriptions from all examples into one string and converts it to a set of characters.
+Make sure to set `batched=True` and `batch_size=-1` in `dataset.map()` so that all transcriptions are available at once for
+the mapping function.
+
+```py
+>>> def extract_all_chars(batch):
+... all_text = " ".join(batch["normalized_text"])
+... vocab = list(set(all_text))
+... return {"vocab": [vocab], "all_text": [all_text]}
+
+
+>>> vocabs = dataset.map(
+... extract_all_chars,
+... batched=True,
+... batch_size=-1,
+... keep_in_memory=True,
+... remove_columns=dataset.column_names,
+... )
+
+>>> dataset_vocab = set(vocabs["vocab"][0])
+>>> tokenizer_vocab = {k for k, _ in tokenizer.get_vocab().items()}
+```
+
+Now you have two sets of characters: one with the vocabulary from the dataset and one with the vocabulary from the tokenizer.
+To identify any unsupported characters in the dataset, you can take the difference between these two sets. The resulting
+set will contain the characters that are in the dataset but not in the tokenizer.
+
+```py
+>>> dataset_vocab - tokenizer_vocab
+{' ', 'ร ', 'รง', 'รจ', 'รซ', 'รญ', 'รฏ', 'รถ', 'รผ'}
+```
+
+To handle the unsupported characters identified in the previous step, define a function that maps these characters to
+valid tokens. Note that spaces are already replaced by `โ` in the tokenizer and don't need to be handled separately.
+
+```py
+>>> replacements = [
+... ("ร ", "a"),
+... ("รง", "c"),
+... ("รจ", "e"),
+... ("รซ", "e"),
+... ("รญ", "i"),
+... ("รฏ", "i"),
+... ("รถ", "o"),
+... ("รผ", "u"),
+... ]
+
+
+>>> def cleanup_text(inputs):
+... for src, dst in replacements:
+... inputs["normalized_text"] = inputs["normalized_text"].replace(src, dst)
+... return inputs
+
+
+>>> dataset = dataset.map(cleanup_text)
+```
+
+Now that you have dealt with special characters in the text, it's time to shift focus to the audio data.
+
+### Speakers
+
+The VoxPopuli dataset includes speech from multiple speakers, but how many speakers are represented in the dataset? To
+determine this, we can count the number of unique speakers and the number of examples each speaker contributes to the dataset.
+With a total of 20,968 examples in the dataset, this information will give us a better understanding of the distribution of
+speakers and examples in the data.
+
+```py
+>>> from collections import defaultdict
+
+>>> speaker_counts = defaultdict(int)
+
+>>> for speaker_id in dataset["speaker_id"]:
+... speaker_counts[speaker_id] += 1
+```
+
+By plotting a histogram you can get a sense of how much data there is for each speaker.
+
+```py
+>>> import matplotlib.pyplot as plt
+
+>>> plt.figure()
+>>> plt.hist(speaker_counts.values(), bins=20)
+>>> plt.ylabel("Speakers")
+>>> plt.xlabel("Examples")
+>>> plt.show()
+```
+
+
+
+
+
+The histogram reveals that approximately one-third of the speakers in the dataset have fewer than 100 examples, while
+around ten speakers have more than 500 examples. To improve training efficiency and balance the dataset, we can limit
+the data to speakers with between 100 and 400 examples.
+
+```py
+>>> def select_speaker(speaker_id):
+... return 100 <= speaker_counts[speaker_id] <= 400
+
+
+>>> dataset = dataset.filter(select_speaker, input_columns=["speaker_id"])
+```
+
+Let's check how many speakers remain:
+
+```py
+>>> len(set(dataset["speaker_id"]))
+42
+```
+
+Let's see how many examples are left:
+
+```py
+>>> len(dataset)
+9973
+```
+
+You are left with just under 10,000 examples from approximately 40 unique speakers, which should be sufficient.
+
+Note that some speakers with few examples may actually have more audio available if the examples are long. However,
+determining the total amount of audio for each speaker requires scanning through the entire dataset, which is a
+time-consuming process that involves loading and decoding each audio file. As such, we have chosen to skip this step here.
+
+### Speaker embeddings
+
+To enable the TTS model to differentiate between multiple speakers, you'll need to create a speaker embedding for each example.
+The speaker embedding is an additional input into the model that captures a particular speaker's voice characteristics.
+To generate these speaker embeddings, use the pre-trained [spkrec-xvect-voxceleb](https://huggingface.co/speechbrain/spkrec-xvect-voxceleb)
+model from SpeechBrain.
+
+Create a function `create_speaker_embedding()` that takes an input audio waveform and outputs a 512-element vector
+containing the corresponding speaker embedding.
+
+```py
+>>> import os
+>>> import torch
+>>> from speechbrain.inference.classifiers import EncoderClassifier
+>>> from accelerate.test_utils.testing import get_backend
+
+>>> spk_model_name = "speechbrain/spkrec-xvect-voxceleb"
+>>> device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+>>> speaker_model = EncoderClassifier.from_hparams(
+... source=spk_model_name,
+... run_opts={"device": device},
+... savedir=os.path.join("/tmp", spk_model_name),
+... )
+
+
+>>> def create_speaker_embedding(waveform):
+... with torch.no_grad():
+... speaker_embeddings = speaker_model.encode_batch(torch.tensor(waveform))
+... speaker_embeddings = torch.nn.functional.normalize(speaker_embeddings, dim=2)
+... speaker_embeddings = speaker_embeddings.squeeze().cpu().numpy()
+... return speaker_embeddings
+```
+
+It's important to note that the `speechbrain/spkrec-xvect-voxceleb` model was trained on English speech from the VoxCeleb
+dataset, whereas the training examples in this guide are in Dutch. While we believe that this model will still generate
+reasonable speaker embeddings for our Dutch dataset, this assumption may not hold true in all cases.
+
+For optimal results, we recommend training an X-vector model on the target speech first. This will ensure that the model
+is better able to capture the unique voice characteristics present in the Dutch language.
+
+### Processing the dataset
+
+Finally, let's process the data into the format the model expects. Create a `prepare_dataset` function that takes in a
+single example and uses the `SpeechT5Processor` object to tokenize the input text and load the target audio into a log-mel spectrogram.
+It should also add the speaker embeddings as an additional input.
+
+```py
+>>> def prepare_dataset(example):
+... audio = example["audio"]
+
+... example = processor(
+... text=example["normalized_text"],
+... audio_target=audio["array"],
+... sampling_rate=audio["sampling_rate"],
+... return_attention_mask=False,
+... )
+
+... # strip off the batch dimension
+... example["labels"] = example["labels"][0]
+
+... # use SpeechBrain to obtain x-vector
+... example["speaker_embeddings"] = create_speaker_embedding(audio["array"])
+
+... return example
+```
+
+Verify the processing is correct by looking at a single example:
+
+```py
+>>> processed_example = prepare_dataset(dataset[0])
+>>> list(processed_example.keys())
+['input_ids', 'labels', 'stop_labels', 'speaker_embeddings']
+```
+
+Speaker embeddings should be a 512-element vector:
+
+```py
+>>> processed_example["speaker_embeddings"].shape
+(512,)
+```
+
+The labels should be a log-mel spectrogram with 80 mel bins.
+
+```py
+>>> import matplotlib.pyplot as plt
+
+>>> plt.figure()
+>>> plt.imshow(processed_example["labels"].T)
+>>> plt.show()
+```
+
+
+
+
+
+Side note: If you find this spectrogram confusing, it may be due to your familiarity with the convention of placing low frequencies
+at the bottom and high frequencies at the top of a plot. However, when plotting spectrograms as an image using the matplotlib library,
+the y-axis is flipped and the spectrograms appear upside down.
+
+Now apply the processing function to the entire dataset. This will take between 5 and 10 minutes.
+
+```py
+>>> dataset = dataset.map(prepare_dataset, remove_columns=dataset.column_names)
+```
+
+You'll see a warning saying that some examples in the dataset are longer than the maximum input length the model can handle (600 tokens).
+Remove those examples from the dataset. Here we go even further and to allow for larger batch sizes we remove anything over 200 tokens.
+
+```py
+>>> def is_not_too_long(input_ids):
+... input_length = len(input_ids)
+... return input_length < 200
+
+
+>>> dataset = dataset.filter(is_not_too_long, input_columns=["input_ids"])
+>>> len(dataset)
+8259
+```
+
+Next, create a basic train/test split:
+
+```py
+>>> dataset = dataset.train_test_split(test_size=0.1)
+```
+
+### Data collator
+
+In order to combine multiple examples into a batch, you need to define a custom data collator. This collator will pad shorter sequences with padding
+tokens, ensuring that all examples have the same length. For the spectrogram labels, the padded portions are replaced with the special value `-100`. This special value
+instructs the model to ignore that part of the spectrogram when calculating the spectrogram loss.
+
+```py
+>>> from dataclasses import dataclass
+>>> from typing import Any, Dict, List, Union
+
+
+>>> @dataclass
+... class TTSDataCollatorWithPadding:
+... processor: Any
+
+... def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:
+... input_ids = [{"input_ids": feature["input_ids"]} for feature in features]
+... label_features = [{"input_values": feature["labels"]} for feature in features]
+... speaker_features = [feature["speaker_embeddings"] for feature in features]
+
+... # collate the inputs and targets into a batch
+... batch = processor.pad(input_ids=input_ids, labels=label_features, return_tensors="pt")
+
+... # replace padding with -100 to ignore loss correctly
+... batch["labels"] = batch["labels"].masked_fill(batch.decoder_attention_mask.unsqueeze(-1).ne(1), -100)
+
+... # not used during fine-tuning
+... del batch["decoder_attention_mask"]
+
+... # round down target lengths to multiple of reduction factor
+... if model.config.reduction_factor > 1:
+... target_lengths = torch.tensor([len(feature["input_values"]) for feature in label_features])
+... target_lengths = target_lengths.new(
+... [length - length % model.config.reduction_factor for length in target_lengths]
+... )
+... max_length = max(target_lengths)
+... batch["labels"] = batch["labels"][:, :max_length]
+
+... # also add in the speaker embeddings
+... batch["speaker_embeddings"] = torch.tensor(speaker_features)
+
+... return batch
+```
+
+In SpeechT5, the input to the decoder part of the model is reduced by a factor 2. In other words, it throws away every
+other timestep from the target sequence. The decoder then predicts a sequence that is twice as long. Since the original
+target sequence length may be odd, the data collator makes sure to round the maximum length of the batch down to be a
+multiple of 2.
+
+```py
+>>> data_collator = TTSDataCollatorWithPadding(processor=processor)
+```
+
+## Train the model
+
+Load the pre-trained model from the same checkpoint as you used for loading the processor:
+
+```py
+>>> from transformers import SpeechT5ForTextToSpeech
+
+>>> model = SpeechT5ForTextToSpeech.from_pretrained(checkpoint)
+```
+
+The `use_cache=True` option is incompatible with gradient checkpointing. Disable it for training.
+
+```py
+>>> model.config.use_cache = False
+```
+
+Define the training arguments. Here we are not computing any evaluation metrics during the training process. Instead, we'll
+only look at the loss:
+
+```python
+>>> from transformers import Seq2SeqTrainingArguments
+
+>>> training_args = Seq2SeqTrainingArguments(
+... output_dir="speecht5_finetuned_voxpopuli_nl", # change to a repo name of your choice
+... per_device_train_batch_size=4,
+... gradient_accumulation_steps=8,
+... learning_rate=1e-5,
+... warmup_steps=500,
+... max_steps=4000,
+... gradient_checkpointing=True,
+... fp16=True,
+... eval_strategy="steps",
+... per_device_eval_batch_size=2,
+... save_steps=1000,
+... eval_steps=1000,
+... logging_steps=25,
+... report_to=["tensorboard"],
+... load_best_model_at_end=True,
+... greater_is_better=False,
+... label_names=["labels"],
+... push_to_hub=True,
+... )
+```
+
+Instantiate the `Trainer` object and pass the model, dataset, and data collator to it.
+
+```py
+>>> from transformers import Seq2SeqTrainer
+
+>>> trainer = Seq2SeqTrainer(
+... args=training_args,
+... model=model,
+... train_dataset=dataset["train"],
+... eval_dataset=dataset["test"],
+... data_collator=data_collator,
+... processing_class=processor,
+... )
+```
+
+And with that, you're ready to start training! Training will take several hours. Depending on your GPU,
+it is possible that you will encounter a CUDA "out-of-memory" error when you start training. In this case, you can reduce
+the `per_device_train_batch_size` incrementally by factors of 2 and increase `gradient_accumulation_steps` by 2x to compensate.
+
+```py
+>>> trainer.train()
+```
+
+To be able to use your checkpoint with a pipeline, make sure to save the processor with the checkpoint:
+
+```py
+>>> processor.save_pretrained("YOUR_ACCOUNT_NAME/speecht5_finetuned_voxpopuli_nl")
+```
+
+Push the final model to the ๐ค Hub:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+### Inference with a pipeline
+
+Great, now that you've fine-tuned a model, you can use it for inference!
+First, let's see how you can use it with a corresponding pipeline. Let's create a `"text-to-speech"` pipeline with your
+checkpoint:
+
+```py
+>>> from transformers import pipeline
+
+>>> pipe = pipeline("text-to-speech", model="YOUR_ACCOUNT_NAME/speecht5_finetuned_voxpopuli_nl")
+```
+
+Pick a piece of text in Dutch you'd like narrated, e.g.:
+
+```py
+>>> text = "hallo allemaal, ik praat nederlands. groetjes aan iedereen!"
+```
+
+To use SpeechT5 with the pipeline, you'll need a speaker embedding. Let's get it from an example in the test dataset:
+
+```py
+>>> example = dataset["test"][304]
+>>> speaker_embeddings = torch.tensor(example["speaker_embeddings"]).unsqueeze(0)
+```
+
+Now you can pass the text and speaker embeddings to the pipeline, and it will take care of the rest:
+
+```py
+>>> forward_params = {"speaker_embeddings": speaker_embeddings}
+>>> output = pipe(text, forward_params=forward_params)
+>>> output
+{'audio': array([-6.82714235e-05, -4.26525949e-04, 1.06134125e-04, ...,
+ -1.22392643e-03, -7.76011671e-04, 3.29112721e-04], dtype=float32),
+ 'sampling_rate': 16000}
+```
+
+You can then listen to the result:
+
+```py
+>>> from IPython.display import Audio
+>>> Audio(output['audio'], rate=output['sampling_rate'])
+```
+
+### Run inference manually
+
+You can achieve the same inference results without using the pipeline, however, more steps will be required.
+
+Load the model from the ๐ค Hub:
+
+```py
+>>> model = SpeechT5ForTextToSpeech.from_pretrained("YOUR_ACCOUNT/speecht5_finetuned_voxpopuli_nl")
+```
+
+Pick an example from the test dataset obtain a speaker embedding.
+
+```py
+>>> example = dataset["test"][304]
+>>> speaker_embeddings = torch.tensor(example["speaker_embeddings"]).unsqueeze(0)
+```
+
+Define the input text and tokenize it.
+
+```py
+>>> text = "hallo allemaal, ik praat nederlands. groetjes aan iedereen!"
+>>> inputs = processor(text=text, return_tensors="pt")
+```
+
+Create a spectrogram with your model:
+
+```py
+>>> spectrogram = model.generate_speech(inputs["input_ids"], speaker_embeddings)
+```
+
+Visualize the spectrogram, if you'd like to:
+
+```py
+>>> plt.figure()
+>>> plt.imshow(spectrogram.T)
+>>> plt.show()
+```
+
+
+
+
+
+Finally, use the vocoder to turn the spectrogram into sound.
+
+```py
+>>> with torch.no_grad():
+... speech = vocoder(spectrogram)
+
+>>> from IPython.display import Audio
+
+>>> Audio(speech.numpy(), rate=16000)
+```
+
+In our experience, obtaining satisfactory results from this model can be challenging. The quality of the speaker
+embeddings appears to be a significant factor. Since SpeechT5 was pre-trained with English x-vectors, it performs best
+when using English speaker embeddings. If the synthesized speech sounds poor, try using a different speaker embedding.
+
+Increasing the training duration is also likely to enhance the quality of the results. Even so, the speech clearly is Dutch instead of English, and it does
+capture the voice characteristics of the speaker (compare to the original audio in the example).
+Another thing to experiment with is the model's configuration. For example, try using `config.reduction_factor = 1` to
+see if this improves the results.
+
+Finally, it is essential to consider ethical considerations. Although TTS technology has numerous useful applications, it
+may also be used for malicious purposes, such as impersonating someone's voice without their knowledge or consent. Please
+use TTS judiciously and responsibly.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/token_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/token_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..b93dd0cbe26d975ffe14f9f684b829163f13db65
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/token_classification.md
@@ -0,0 +1,557 @@
+
+
+# Token classification
+
+[[open-in-colab]]
+
+
+
+Token classification assigns a label to individual tokens in a sentence. One of the most common token classification tasks is Named Entity Recognition (NER). NER attempts to find a label for each entity in a sentence, such as a person, location, or organization.
+
+This guide will show you how to:
+
+1. Finetune [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) on the [WNUT 17](https://huggingface.co/datasets/wnut_17) dataset to detect new entities.
+2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/token-classification).
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate seqeval
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load WNUT 17 dataset
+
+Start by loading the WNUT 17 dataset from the ๐ค Datasets library:
+
+```py
+>>> from datasets import load_dataset
+
+>>> wnut = load_dataset("wnut_17")
+```
+
+Then take a look at an example:
+
+```py
+>>> wnut["train"][0]
+{'id': '0',
+ 'ner_tags': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'tokens': ['@paulwalk', 'It', "'s", 'the', 'view', 'from', 'where', 'I', "'m", 'living', 'for', 'two', 'weeks', '.', 'Empire', 'State', 'Building', '=', 'ESB', '.', 'Pretty', 'bad', 'storm', 'here', 'last', 'evening', '.']
+}
+```
+
+Each number in `ner_tags` represents an entity. Convert the numbers to their label names to find out what the entities are:
+
+```py
+>>> label_list = wnut["train"].features[f"ner_tags"].feature.names
+>>> label_list
+[
+ "O",
+ "B-corporation",
+ "I-corporation",
+ "B-creative-work",
+ "I-creative-work",
+ "B-group",
+ "I-group",
+ "B-location",
+ "I-location",
+ "B-person",
+ "I-person",
+ "B-product",
+ "I-product",
+]
+```
+
+The letter that prefixes each `ner_tag` indicates the token position of the entity:
+
+- `B-` indicates the beginning of an entity.
+- `I-` indicates a token is contained inside the same entity (for example, the `State` token is a part of an entity like
+ `Empire State Building`).
+- `0` indicates the token doesn't correspond to any entity.
+
+## Preprocess
+
+
+
+The next step is to load a DistilBERT tokenizer to preprocess the `tokens` field:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+As you saw in the example `tokens` field above, it looks like the input has already been tokenized. But the input actually hasn't been tokenized yet and you'll need to set `is_split_into_words=True` to tokenize the words into subwords. For example:
+
+```py
+>>> example = wnut["train"][0]
+>>> tokenized_input = tokenizer(example["tokens"], is_split_into_words=True)
+>>> tokens = tokenizer.convert_ids_to_tokens(tokenized_input["input_ids"])
+>>> tokens
+['[CLS]', '@', 'paul', '##walk', 'it', "'", 's', 'the', 'view', 'from', 'where', 'i', "'", 'm', 'living', 'for', 'two', 'weeks', '.', 'empire', 'state', 'building', '=', 'es', '##b', '.', 'pretty', 'bad', 'storm', 'here', 'last', 'evening', '.', '[SEP]']
+```
+
+However, this adds some special tokens `[CLS]` and `[SEP]` and the subword tokenization creates a mismatch between the input and labels. A single word corresponding to a single label may now be split into two subwords. You'll need to realign the tokens and labels by:
+
+1. Mapping all tokens to their corresponding word with the [`word_ids`](https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.BatchEncoding.word_ids) method.
+2. Assigning the label `-100` to the special tokens `[CLS]` and `[SEP]` so they're ignored by the PyTorch loss function (see [CrossEntropyLoss](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html)).
+3. Only labeling the first token of a given word. Assign `-100` to other subtokens from the same word.
+
+Here is how you can create a function to realign the tokens and labels, and truncate sequences to be no longer than DistilBERT's maximum input length:
+
+```py
+>>> def tokenize_and_align_labels(examples):
+... tokenized_inputs = tokenizer(examples["tokens"], truncation=True, is_split_into_words=True)
+
+... labels = []
+... for i, label in enumerate(examples[f"ner_tags"]):
+... word_ids = tokenized_inputs.word_ids(batch_index=i) # Map tokens to their respective word.
+... previous_word_idx = None
+... label_ids = []
+... for word_idx in word_ids: # Set the special tokens to -100.
+... if word_idx is None:
+... label_ids.append(-100)
+... elif word_idx != previous_word_idx: # Only label the first token of a given word.
+... label_ids.append(label[word_idx])
+... else:
+... label_ids.append(-100)
+... previous_word_idx = word_idx
+... labels.append(label_ids)
+
+... tokenized_inputs["labels"] = labels
+... return tokenized_inputs
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] function. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once:
+
+```py
+>>> tokenized_wnut = wnut.map(tokenize_and_align_labels, batched=True)
+```
+
+Now create a batch of examples using [`DataCollatorWithPadding`]. It's more efficient to *dynamically pad* the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
+
+
+
+```py
+>>> from transformers import DataCollatorForTokenClassification
+
+>>> data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer)
+```
+
+
+```py
+>>> from transformers import DataCollatorForTokenClassification
+
+>>> data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer, return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load a evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [seqeval](https://huggingface.co/spaces/evaluate-metric/seqeval) framework (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric). Seqeval actually produces several scores: precision, recall, F1, and accuracy.
+
+```py
+>>> import evaluate
+
+>>> seqeval = evaluate.load("seqeval")
+```
+
+Get the NER labels first, and then create a function that passes your true predictions and true labels to [`~evaluate.EvaluationModule.compute`] to calculate the scores:
+
+```py
+>>> import numpy as np
+
+>>> labels = [label_list[i] for i in example[f"ner_tags"]]
+
+
+>>> def compute_metrics(p):
+... predictions, labels = p
+... predictions = np.argmax(predictions, axis=2)
+
+... true_predictions = [
+... [label_list[p] for (p, l) in zip(prediction, label) if l != -100]
+... for prediction, label in zip(predictions, labels)
+... ]
+... true_labels = [
+... [label_list[l] for (p, l) in zip(prediction, label) if l != -100]
+... for prediction, label in zip(predictions, labels)
+... ]
+
+... results = seqeval.compute(predictions=true_predictions, references=true_labels)
+... return {
+... "precision": results["overall_precision"],
+... "recall": results["overall_recall"],
+... "f1": results["overall_f1"],
+... "accuracy": results["overall_accuracy"],
+... }
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+## Train
+
+Before you start training your model, create a map of the expected ids to their labels with `id2label` and `label2id`:
+
+```py
+>>> id2label = {
+... 0: "O",
+... 1: "B-corporation",
+... 2: "I-corporation",
+... 3: "B-creative-work",
+... 4: "I-creative-work",
+... 5: "B-group",
+... 6: "I-group",
+... 7: "B-location",
+... 8: "I-location",
+... 9: "B-person",
+... 10: "I-person",
+... 11: "B-product",
+... 12: "I-product",
+... }
+>>> label2id = {
+... "O": 0,
+... "B-corporation": 1,
+... "I-corporation": 2,
+... "B-creative-work": 3,
+... "I-creative-work": 4,
+... "B-group": 5,
+... "I-group": 6,
+... "B-location": 7,
+... "I-location": 8,
+... "B-person": 9,
+... "I-person": 10,
+... "B-product": 11,
+... "I-product": 12,
+... }
+```
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load DistilBERT with [`AutoModelForTokenClassification`] along with the number of expected labels, and the label mappings:
+
+```py
+>>> from transformers import AutoModelForTokenClassification, TrainingArguments, Trainer
+
+>>> model = AutoModelForTokenClassification.from_pretrained(
+... "distilbert/distilbert-base-uncased", num_labels=13, id2label=id2label, label2id=label2id
+... )
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the seqeval scores and save the training checkpoint.
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_wnut_model",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=2,
+... weight_decay=0.01,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... load_best_model_at_end=True,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_wnut["train"],
+... eval_dataset=tokenized_wnut["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the basic tutorial [here](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_train_epochs = 3
+>>> num_train_steps = (len(tokenized_wnut["train"]) // batch_size) * num_train_epochs
+>>> optimizer, lr_schedule = create_optimizer(
+... init_lr=2e-5,
+... num_train_steps=num_train_steps,
+... weight_decay_rate=0.01,
+... num_warmup_steps=0,
+... )
+```
+
+Then you can load DistilBERT with [`TFAutoModelForTokenClassification`] along with the number of expected labels, and the label mappings:
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained(
+... "distilbert/distilbert-base-uncased", num_labels=13, id2label=id2label, label2id=label2id
+... )
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_wnut["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_wnut["validation"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method). Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+The last two things to setup before you start training is to compute the seqeval scores from the predictions, and provide a way to push your model to the Hub. Both are done by using [Keras callbacks](../main_classes/keras_callbacks).
+
+Pass your `compute_metrics` function to [`~transformers.KerasMetricCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)
+```
+
+Specify where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_wnut_model",
+... tokenizer=tokenizer,
+... )
+```
+
+Then bundle your callbacks together:
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=3, callbacks=callbacks)
+```
+
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+For a more in-depth example of how to finetune a model for token classification, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb).
+
+
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Grab some text you'd like to run inference on:
+
+```py
+>>> text = "The Golden State Warriors are an American professional basketball team based in San Francisco."
+```
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for NER with your model, and pass your text to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("ner", model="stevhliu/my_awesome_wnut_model")
+>>> classifier(text)
+[{'entity': 'B-location',
+ 'score': 0.42658573,
+ 'index': 2,
+ 'word': 'golden',
+ 'start': 4,
+ 'end': 10},
+ {'entity': 'I-location',
+ 'score': 0.35856336,
+ 'index': 3,
+ 'word': 'state',
+ 'start': 11,
+ 'end': 16},
+ {'entity': 'B-group',
+ 'score': 0.3064001,
+ 'index': 4,
+ 'word': 'warriors',
+ 'start': 17,
+ 'end': 25},
+ {'entity': 'B-location',
+ 'score': 0.65523505,
+ 'index': 13,
+ 'word': 'san',
+ 'start': 80,
+ 'end': 83},
+ {'entity': 'B-location',
+ 'score': 0.4668663,
+ 'index': 14,
+ 'word': 'francisco',
+ 'start': 84,
+ 'end': 93}]
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+Tokenize the text and return PyTorch tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> inputs = tokenizer(text, return_tensors="pt")
+```
+
+Pass your inputs to the model and return the `logits`:
+
+```py
+>>> from transformers import AutoModelForTokenClassification
+
+>>> model = AutoModelForTokenClassification.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+Get the class with the highest probability, and use the model's `id2label` mapping to convert it to a text label:
+
+```py
+>>> predictions = torch.argmax(logits, dim=2)
+>>> predicted_token_class = [model.config.id2label[t.item()] for t in predictions[0]]
+>>> predicted_token_class
+['O',
+ 'O',
+ 'B-location',
+ 'I-location',
+ 'B-group',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'B-location',
+ 'B-location',
+ 'O',
+ 'O']
+```
+
+
+Tokenize the text and return TensorFlow tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> inputs = tokenizer(text, return_tensors="tf")
+```
+
+Pass your inputs to the model and return the `logits`:
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> logits = model(**inputs).logits
+```
+
+Get the class with the highest probability, and use the model's `id2label` mapping to convert it to a text label:
+
+```py
+>>> predicted_token_class_ids = tf.math.argmax(logits, axis=-1)
+>>> predicted_token_class = [model.config.id2label[t] for t in predicted_token_class_ids[0].numpy().tolist()]
+>>> predicted_token_class
+['O',
+ 'O',
+ 'B-location',
+ 'I-location',
+ 'B-group',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'B-location',
+ 'B-location',
+ 'O',
+ 'O']
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/translation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/translation.md
new file mode 100644
index 0000000000000000000000000000000000000000..922cdc7241176a22faf030e37ea21b5b7f467ba3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/translation.md
@@ -0,0 +1,409 @@
+
+
+# Translation
+
+[[open-in-colab]]
+
+
+
+Translation converts a sequence of text from one language to another. It is one of several tasks you can formulate as a sequence-to-sequence problem, a powerful framework for returning some output from an input, like translation or summarization. Translation systems are commonly used for translation between different language texts, but it can also be used for speech or some combination in between like text-to-speech or speech-to-text.
+
+This guide will show you how to:
+
+1. Finetune [T5](https://huggingface.co/google-t5/t5-small) on the English-French subset of the [OPUS Books](https://huggingface.co/datasets/opus_books) dataset to translate English text to French.
+2. Use your finetuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/translation).
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install transformers datasets evaluate sacrebleu
+```
+
+We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load OPUS Books dataset
+
+Start by loading the English-French subset of the [OPUS Books](https://huggingface.co/datasets/opus_books) dataset from the ๐ค Datasets library:
+
+```py
+>>> from datasets import load_dataset
+
+>>> books = load_dataset("opus_books", "en-fr")
+```
+
+Split the dataset into a train and test set with the [`~datasets.Dataset.train_test_split`] method:
+
+```py
+>>> books = books["train"].train_test_split(test_size=0.2)
+```
+
+Then take a look at an example:
+
+```py
+>>> books["train"][0]
+{'id': '90560',
+ 'translation': {'en': 'But this lofty plateau measured only a few fathoms, and soon we reentered Our Element.',
+ 'fr': 'Mais ce plateau รฉlevรฉ ne mesurait que quelques toises, et bientรดt nous fรปmes rentrรฉs dans notre รฉlรฉment.'}}
+```
+
+`translation`: an English and French translation of the text.
+
+## Preprocess
+
+
+
+The next step is to load a T5 tokenizer to process the English-French language pairs:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> checkpoint = "google-t5/t5-small"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+```
+
+The preprocessing function you want to create needs to:
+
+1. Prefix the input with a prompt so T5 knows this is a translation task. Some models capable of multiple NLP tasks require prompting for specific tasks.
+2. Set the target language (French) in the `text_target` parameter to ensure the tokenizer processes the target text correctly. If you don't set `text_target`, the tokenizer processes the target text as English.
+3. Truncate sequences to be no longer than the maximum length set by the `max_length` parameter.
+
+```py
+>>> source_lang = "en"
+>>> target_lang = "fr"
+>>> prefix = "translate English to French: "
+
+
+>>> def preprocess_function(examples):
+... inputs = [prefix + example[source_lang] for example in examples["translation"]]
+... targets = [example[target_lang] for example in examples["translation"]]
+... model_inputs = tokenizer(inputs, text_target=targets, max_length=128, truncation=True)
+... return model_inputs
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.Dataset.map`] method. You can speed up the `map` function by setting `batched=True` to process multiple elements of the dataset at once:
+
+```py
+>>> tokenized_books = books.map(preprocess_function, batched=True)
+```
+
+Now create a batch of examples using [`DataCollatorForSeq2Seq`]. It's more efficient to *dynamically pad* the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)
+```
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+Including a metric during training is often helpful for evaluating your model's performance. You can quickly load a evaluation method with the ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) library. For this task, load the [SacreBLEU](https://huggingface.co/spaces/evaluate-metric/sacrebleu) metric (see the ๐ค Evaluate [quick tour](https://huggingface.co/docs/evaluate/a_quick_tour) to learn more about how to load and compute a metric):
+
+```py
+>>> import evaluate
+
+>>> metric = evaluate.load("sacrebleu")
+```
+
+Then create a function that passes your predictions and labels to [`~evaluate.EvaluationModule.compute`] to calculate the SacreBLEU score:
+
+```py
+>>> import numpy as np
+
+
+>>> def postprocess_text(preds, labels):
+... preds = [pred.strip() for pred in preds]
+... labels = [[label.strip()] for label in labels]
+
+... return preds, labels
+
+
+>>> def compute_metrics(eval_preds):
+... preds, labels = eval_preds
+... if isinstance(preds, tuple):
+... preds = preds[0]
+... decoded_preds = tokenizer.batch_decode(preds, skip_special_tokens=True)
+
+... labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
+... decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
+
+... decoded_preds, decoded_labels = postprocess_text(decoded_preds, decoded_labels)
+
+... result = metric.compute(predictions=decoded_preds, references=decoded_labels)
+... result = {"bleu": result["score"]}
+
+... prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in preds]
+... result["gen_len"] = np.mean(prediction_lens)
+... result = {k: round(v, 4) for k, v in result.items()}
+... return result
+```
+
+Your `compute_metrics` function is ready to go now, and you'll return to it when you setup your training.
+
+## Train
+
+
+
+
+
+If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the basic tutorial [here](../training#train-with-pytorch-trainer)!
+
+
+
+You're ready to start training your model now! Load T5 with [`AutoModelForSeq2SeqLM`]:
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`Seq2SeqTrainingArguments`]. The only required parameter is `output_dir` which specifies where to save your model. You'll push this model to the Hub by setting `push_to_hub=True` (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the [`Trainer`] will evaluate the SacreBLEU metric and save the training checkpoint.
+2. Pass the training arguments to [`Seq2SeqTrainer`] along with the model, dataset, tokenizer, data collator, and `compute_metrics` function.
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> training_args = Seq2SeqTrainingArguments(
+... output_dir="my_awesome_opus_books_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... weight_decay=0.01,
+... save_total_limit=3,
+... num_train_epochs=2,
+... predict_with_generate=True,
+... fp16=True, #change to bf16=True for XPU
+... push_to_hub=True,
+... )
+
+>>> trainer = Seq2SeqTrainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_books["train"],
+... eval_dataset=tokenized_books["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+If you aren't familiar with finetuning a model with Keras, take a look at the basic tutorial [here](../training#train-a-tensorflow-model-with-keras)!
+
+
+To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:
+
+```py
+>>> from transformers import AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+Then you can load T5 with [`TFAutoModelForSeq2SeqLM`]:
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+Convert your datasets to the `tf.data.Dataset` format with [`~transformers.TFPreTrainedModel.prepare_tf_dataset`]:
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_books["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... tokenized_books["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+Configure the model for training with [`compile`](https://keras.io/api/models/model_training_apis/#compile-method). Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+The last two things to setup before you start training is to compute the SacreBLEU metric from the predictions, and provide a way to push your model to the Hub. Both are done by using [Keras callbacks](../main_classes/keras_callbacks).
+
+Pass your `compute_metrics` function to [`~transformers.KerasMetricCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_test_set)
+```
+
+Specify where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_opus_books_model",
+... tokenizer=tokenizer,
+... )
+```
+
+Then bundle your callbacks together:
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+Finally, you're ready to start training your model! Call [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=callbacks)
+```
+
+Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!
+
+
+
+
+
+For a more in-depth example of how to finetune a model for translation, take a look at the corresponding
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation.ipynb)
+or [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb).
+
+
+
+## Inference
+
+Great, now that you've finetuned a model, you can use it for inference!
+
+Come up with some text you'd like to translate to another language. For T5, you need to prefix your input depending on the task you're working on. For translation from English to French, you should prefix your input as shown below:
+
+```py
+>>> text = "translate English to French: Legumes share resources with nitrogen-fixing bacteria."
+```
+
+The simplest way to try out your finetuned model for inference is to use it in a [`pipeline`]. Instantiate a `pipeline` for translation with your model, and pass your text to it:
+
+```py
+>>> from transformers import pipeline
+
+# Change `xx` to the language of the input and `yy` to the language of the desired output.
+# Examples: "en" for English, "fr" for French, "de" for German, "es" for Spanish, "zh" for Chinese, etc; translation_en_to_fr translates English to French
+# You can view all the lists of languages here - https://huggingface.co/languages
+>>> translator = pipeline("translation_xx_to_yy", model="username/my_awesome_opus_books_model")
+>>> translator(text)
+[{'translation_text': 'Legumes partagent des ressources avec des bactรฉries azotantes.'}]
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like:
+
+
+
+Tokenize the text and return the `input_ids` as PyTorch tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_opus_books_model")
+>>> inputs = tokenizer(text, return_tensors="pt").input_ids
+```
+
+Use the [`~generation.GenerationMixin.generate`] method to create the translation. For more details about the different text generation strategies and parameters for controlling generation, check out the [Text Generation](../main_classes/text_generation) API.
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_opus_books_model")
+>>> outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95)
+```
+
+Decode the generated token ids back into text:
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'Les lignรฉes partagent des ressources avec des bactรฉries enfixant l'azote.'
+```
+
+
+Tokenize the text and return the `input_ids` as TensorFlow tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("username/my_awesome_opus_books_model")
+>>> inputs = tokenizer(text, return_tensors="tf").input_ids
+```
+
+Use the [`~transformers.generation_tf_utils.TFGenerationMixin.generate`] method to create the translation. For more details about the different text generation strategies and parameters for controlling generation, check out the [Text Generation](../main_classes/text_generation) API.
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("username/my_awesome_opus_books_model")
+>>> outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95)
+```
+
+Decode the generated token ids back into text:
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'Les lugumes partagent les ressources avec des bactรฉries fixatrices d'azote.'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/video_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/video_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..c268de1786bdc5453b38f899d89d39f5ddd6e453
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/video_classification.md
@@ -0,0 +1,516 @@
+
+
+# Video classification
+
+[[open-in-colab]]
+
+Video classification is the task of assigning a label or class to an entire video. Videos are expected to have only one class for each video. Video classification models take a video as input and return a prediction about which class the video belongs to. These models can be used to categorize what a video is all about. A real-world application of video classification is action / activity recognition, which is useful for fitness applications. It is also helpful for vision-impaired individuals, especially when they are commuting.
+
+This guide will show you how to:
+
+1. Fine-tune [VideoMAE](https://huggingface.co/docs/transformers/main/en/model_doc/videomae) on a subset of the [UCF101](https://www.crcv.ucf.edu/data/UCF101.php) dataset.
+2. Use your fine-tuned model for inference.
+
+
+
+To see all architectures and checkpoints compatible with this task, we recommend checking the [task-page](https://huggingface.co/tasks/video-classification).
+
+
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install -q pytorchvideo transformers evaluate
+```
+
+You will use [PyTorchVideo](https://pytorchvideo.org/) (dubbed `pytorchvideo`) to process and prepare the videos.
+
+We encourage you to log in to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load UCF101 dataset
+
+Start by loading a subset of the [UCF-101 dataset](https://www.crcv.ucf.edu/data/UCF101.php). This will give you a chance to experiment and make sure everything works before spending more time training on the full dataset.
+
+```py
+>>> from huggingface_hub import hf_hub_download
+
+>>> hf_dataset_identifier = "sayakpaul/ucf101-subset"
+>>> filename = "UCF101_subset.tar.gz"
+>>> file_path = hf_hub_download(repo_id=hf_dataset_identifier, filename=filename, repo_type="dataset")
+```
+
+After the subset has been downloaded, you need to extract the compressed archive:
+
+```py
+>>> import tarfile
+
+>>> with tarfile.open(file_path) as t:
+... t.extractall(".")
+```
+
+At a high level, the dataset is organized like so:
+
+```bash
+UCF101_subset/
+ train/
+ BandMarching/
+ video_1.mp4
+ video_2.mp4
+ ...
+ Archery
+ video_1.mp4
+ video_2.mp4
+ ...
+ ...
+ val/
+ BandMarching/
+ video_1.mp4
+ video_2.mp4
+ ...
+ Archery
+ video_1.mp4
+ video_2.mp4
+ ...
+ ...
+ test/
+ BandMarching/
+ video_1.mp4
+ video_2.mp4
+ ...
+ Archery
+ video_1.mp4
+ video_2.mp4
+ ...
+ ...
+```
+
+You can then count the number of total videos.
+
+```py
+>>> import pathlib
+>>> dataset_root_path = "UCF101_subset"
+>>> dataset_root_path = pathlib.Path(dataset_root_path)
+```
+
+```py
+>>> video_count_train = len(list(dataset_root_path.glob("train/*/*.avi")))
+>>> video_count_val = len(list(dataset_root_path.glob("val/*/*.avi")))
+>>> video_count_test = len(list(dataset_root_path.glob("test/*/*.avi")))
+>>> video_total = video_count_train + video_count_val + video_count_test
+>>> print(f"Total videos: {video_total}")
+```
+
+```py
+>>> all_video_file_paths = (
+... list(dataset_root_path.glob("train/*/*.avi"))
+... + list(dataset_root_path.glob("val/*/*.avi"))
+... + list(dataset_root_path.glob("test/*/*.avi"))
+... )
+>>> all_video_file_paths[:5]
+```
+
+The (`sorted`) video paths appear like so:
+
+```bash
+...
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g07_c04.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g07_c06.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g08_c01.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g09_c02.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g09_c06.avi'
+...
+```
+
+You will notice that there are video clips belonging to the same group / scene where group is denoted by `g` in the video file paths. `v_ApplyEyeMakeup_g07_c04.avi` and `v_ApplyEyeMakeup_g07_c06.avi`, for example.
+
+For the validation and evaluation splits, you wouldn't want to have video clips from the same group / scene to prevent [data leakage](https://www.kaggle.com/code/alexisbcook/data-leakage). The subset that you are using in this tutorial takes this information into account.
+
+Next up, you will derive the set of labels present in the dataset. Also, create two dictionaries that'll be helpful when initializing the model:
+
+* `label2id`: maps the class names to integers.
+* `id2label`: maps the integers to class names.
+
+```py
+>>> class_labels = sorted({str(path).split("/")[2] for path in all_video_file_paths})
+>>> label2id = {label: i for i, label in enumerate(class_labels)}
+>>> id2label = {i: label for label, i in label2id.items()}
+
+>>> print(f"Unique classes: {list(label2id.keys())}.")
+
+# Unique classes: ['ApplyEyeMakeup', 'ApplyLipstick', 'Archery', 'BabyCrawling', 'BalanceBeam', 'BandMarching', 'BaseballPitch', 'Basketball', 'BasketballDunk', 'BenchPress'].
+```
+
+There are 10 unique classes. For each class, there are 30 videos in the training set.
+
+## Load a model to fine-tune
+
+Instantiate a video classification model from a pretrained checkpoint and its associated image processor. The model's encoder comes with pre-trained parameters, and the classification head is randomly initialized. The image processor will come in handy when writing the preprocessing pipeline for our dataset.
+
+```py
+>>> from transformers import VideoMAEImageProcessor, VideoMAEForVideoClassification
+
+>>> model_ckpt = "MCG-NJU/videomae-base"
+>>> image_processor = VideoMAEImageProcessor.from_pretrained(model_ckpt)
+>>> model = VideoMAEForVideoClassification.from_pretrained(
+... model_ckpt,
+... label2id=label2id,
+... id2label=id2label,
+... ignore_mismatched_sizes=True, # provide this in case you're planning to fine-tune an already fine-tuned checkpoint
+... )
+```
+
+While the model is loading, you might notice the following warning:
+
+```bash
+Some weights of the model checkpoint at MCG-NJU/videomae-base were not used when initializing VideoMAEForVideoClassification: [..., 'decoder.decoder_layers.1.attention.output.dense.bias', 'decoder.decoder_layers.2.attention.attention.key.weight']
+- This IS expected if you are initializing VideoMAEForVideoClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
+- This IS NOT expected if you are initializing VideoMAEForVideoClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
+Some weights of VideoMAEForVideoClassification were not initialized from the model checkpoint at MCG-NJU/videomae-base and are newly initialized: ['classifier.bias', 'classifier.weight']
+You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
+```
+
+The warning is telling us we are throwing away some weights (e.g. the weights and bias of the `classifier` layer) and randomly initializing some others (the weights and bias of a new `classifier` layer). This is expected in this case, because we are adding a new head for which we don't have pretrained weights, so the library warns us we should fine-tune this model before using it for inference, which is exactly what we are going to do.
+
+**Note** that [this checkpoint](https://huggingface.co/MCG-NJU/videomae-base-finetuned-kinetics) leads to better performance on this task as the checkpoint was obtained fine-tuning on a similar downstream task having considerable domain overlap. You can check out [this checkpoint](https://huggingface.co/sayakpaul/videomae-base-finetuned-kinetics-finetuned-ucf101-subset) which was obtained by fine-tuning `MCG-NJU/videomae-base-finetuned-kinetics`.
+
+## Prepare the datasets for training
+
+For preprocessing the videos, you will leverage the [PyTorchVideo library](https://pytorchvideo.org/). Start by importing the dependencies we need.
+
+```py
+>>> import pytorchvideo.data
+
+>>> from pytorchvideo.transforms import (
+... ApplyTransformToKey,
+... Normalize,
+... RandomShortSideScale,
+... RemoveKey,
+... ShortSideScale,
+... UniformTemporalSubsample,
+... )
+
+>>> from torchvision.transforms import (
+... Compose,
+... Lambda,
+... RandomCrop,
+... RandomHorizontalFlip,
+... Resize,
+... )
+```
+
+For the training dataset transformations, use a combination of uniform temporal subsampling, pixel normalization, random cropping, and random horizontal flipping. For the validation and evaluation dataset transformations, keep the same transformation chain except for random cropping and horizontal flipping. To learn more about the details of these transformations check out the [official documentation of PyTorchVideo](https://pytorchvideo.org).
+
+Use the `image_processor` associated with the pre-trained model to obtain the following information:
+
+* Image mean and standard deviation with which the video frame pixels will be normalized.
+* Spatial resolution to which the video frames will be resized.
+
+Start by defining some constants.
+
+```py
+>>> mean = image_processor.image_mean
+>>> std = image_processor.image_std
+>>> if "shortest_edge" in image_processor.size:
+... height = width = image_processor.size["shortest_edge"]
+>>> else:
+... height = image_processor.size["height"]
+... width = image_processor.size["width"]
+>>> resize_to = (height, width)
+
+>>> num_frames_to_sample = model.config.num_frames
+>>> sample_rate = 4
+>>> fps = 30
+>>> clip_duration = num_frames_to_sample * sample_rate / fps
+```
+
+Now, define the dataset-specific transformations and the datasets respectively. Starting with the training set:
+
+```py
+>>> train_transform = Compose(
+... [
+... ApplyTransformToKey(
+... key="video",
+... transform=Compose(
+... [
+... UniformTemporalSubsample(num_frames_to_sample),
+... Lambda(lambda x: x / 255.0),
+... Normalize(mean, std),
+... RandomShortSideScale(min_size=256, max_size=320),
+... RandomCrop(resize_to),
+... RandomHorizontalFlip(p=0.5),
+... ]
+... ),
+... ),
+... ]
+... )
+
+>>> train_dataset = pytorchvideo.data.Ucf101(
+... data_path=os.path.join(dataset_root_path, "train"),
+... clip_sampler=pytorchvideo.data.make_clip_sampler("random", clip_duration),
+... decode_audio=False,
+... transform=train_transform,
+... )
+```
+
+The same sequence of workflow can be applied to the validation and evaluation sets:
+
+```py
+>>> val_transform = Compose(
+... [
+... ApplyTransformToKey(
+... key="video",
+... transform=Compose(
+... [
+... UniformTemporalSubsample(num_frames_to_sample),
+... Lambda(lambda x: x / 255.0),
+... Normalize(mean, std),
+... Resize(resize_to),
+... ]
+... ),
+... ),
+... ]
+... )
+
+>>> val_dataset = pytorchvideo.data.Ucf101(
+... data_path=os.path.join(dataset_root_path, "val"),
+... clip_sampler=pytorchvideo.data.make_clip_sampler("uniform", clip_duration),
+... decode_audio=False,
+... transform=val_transform,
+... )
+
+>>> test_dataset = pytorchvideo.data.Ucf101(
+... data_path=os.path.join(dataset_root_path, "test"),
+... clip_sampler=pytorchvideo.data.make_clip_sampler("uniform", clip_duration),
+... decode_audio=False,
+... transform=val_transform,
+... )
+```
+
+**Note**: The above dataset pipelines are taken from the [official PyTorchVideo example](https://pytorchvideo.org/docs/tutorial_classification#dataset). We're using the [`pytorchvideo.data.Ucf101()`](https://pytorchvideo.readthedocs.io/en/latest/api/data/data.html#pytorchvideo.data.Ucf101) function because it's tailored for the UCF-101 dataset. Under the hood, it returns a [`pytorchvideo.data.labeled_video_dataset.LabeledVideoDataset`](https://pytorchvideo.readthedocs.io/en/latest/api/data/data.html#pytorchvideo.data.LabeledVideoDataset) object. `LabeledVideoDataset` class is the base class for all things video in the PyTorchVideo dataset. So, if you want to use a custom dataset not supported off-the-shelf by PyTorchVideo, you can extend the `LabeledVideoDataset` class accordingly. Refer to the `data` API [documentation to](https://pytorchvideo.readthedocs.io/en/latest/api/data/data.html) learn more. Also, if your dataset follows a similar structure (as shown above), then using the `pytorchvideo.data.Ucf101()` should work just fine.
+
+You can access the `num_videos` argument to know the number of videos in the dataset.
+
+```py
+>>> print(train_dataset.num_videos, val_dataset.num_videos, test_dataset.num_videos)
+# (300, 30, 75)
+```
+
+## Visualize the preprocessed video for better debugging
+
+```py
+>>> import imageio
+>>> import numpy as np
+>>> from IPython.display import Image
+
+>>> def unnormalize_img(img):
+... """Un-normalizes the image pixels."""
+... img = (img * std) + mean
+... img = (img * 255).astype("uint8")
+... return img.clip(0, 255)
+
+>>> def create_gif(video_tensor, filename="sample.gif"):
+... """Prepares a GIF from a video tensor.
+...
+... The video tensor is expected to have the following shape:
+... (num_frames, num_channels, height, width).
+... """
+... frames = []
+... for video_frame in video_tensor:
+... frame_unnormalized = unnormalize_img(video_frame.permute(1, 2, 0).numpy())
+... frames.append(frame_unnormalized)
+... kargs = {"duration": 0.25}
+... imageio.mimsave(filename, frames, "GIF", **kargs)
+... return filename
+
+>>> def display_gif(video_tensor, gif_name="sample.gif"):
+... """Prepares and displays a GIF from a video tensor."""
+... video_tensor = video_tensor.permute(1, 0, 2, 3)
+... gif_filename = create_gif(video_tensor, gif_name)
+... return Image(filename=gif_filename)
+
+>>> sample_video = next(iter(train_dataset))
+>>> video_tensor = sample_video["video"]
+>>> display_gif(video_tensor)
+```
+
+
+
+
+
+## Train the model
+
+Leverage [`Trainer`](https://huggingface.co/docs/transformers/main_classes/trainer) from ๐ค Transformers for training the model. To instantiate a `Trainer`, you need to define the training configuration and an evaluation metric. The most important is the [`TrainingArguments`](https://huggingface.co/transformers/main_classes/trainer.html#transformers.TrainingArguments), which is a class that contains all the attributes to configure the training. It requires an output folder name, which will be used to save the checkpoints of the model. It also helps sync all the information in the model repository on ๐ค Hub.
+
+Most of the training arguments are self-explanatory, but one that is quite important here is `remove_unused_columns=False`. This one will drop any features not used by the model's call function. By default it's `True` because usually it's ideal to drop unused feature columns, making it easier to unpack inputs into the model's call function. But, in this case, you need the unused features ('video' in particular) in order to create `pixel_values` (which is a mandatory key our model expects in its inputs).
+
+
+```py
+>>> from transformers import TrainingArguments, Trainer
+
+>>> model_name = model_ckpt.split("/")[-1]
+>>> new_model_name = f"{model_name}-finetuned-ucf101-subset"
+>>> num_epochs = 4
+
+>>> args = TrainingArguments(
+... new_model_name,
+... remove_unused_columns=False,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... learning_rate=5e-5,
+... per_device_train_batch_size=batch_size,
+... per_device_eval_batch_size=batch_size,
+... warmup_ratio=0.1,
+... logging_steps=10,
+... load_best_model_at_end=True,
+... metric_for_best_model="accuracy",
+... push_to_hub=True,
+... max_steps=(train_dataset.num_videos // batch_size) * num_epochs,
+... )
+```
+
+The dataset returned by `pytorchvideo.data.Ucf101()` doesn't implement the `__len__` method. As such, we must define `max_steps` when instantiating `TrainingArguments`.
+
+Next, you need to define a function to compute the metrics from the predictions, which will use the `metric` you'll load now. The only preprocessing you have to do is to take the argmax of our predicted logits:
+
+```py
+import evaluate
+
+metric = evaluate.load("accuracy")
+
+
+def compute_metrics(eval_pred):
+ predictions = np.argmax(eval_pred.predictions, axis=1)
+ return metric.compute(predictions=predictions, references=eval_pred.label_ids)
+```
+
+**A note on evaluation**:
+
+In the [VideoMAE paper](https://arxiv.org/abs/2203.12602), the authors use the following evaluation strategy. They evaluate the model on several clips from test videos and apply different crops to those clips and report the aggregate score. However, in the interest of simplicity and brevity, we don't consider that in this tutorial.
+
+Also, define a `collate_fn`, which will be used to batch examples together. Each batch consists of 2 keys, namely `pixel_values` and `labels`.
+
+```py
+>>> def collate_fn(examples):
+... # permute to (num_frames, num_channels, height, width)
+... pixel_values = torch.stack(
+... [example["video"].permute(1, 0, 2, 3) for example in examples]
+... )
+... labels = torch.tensor([example["label"] for example in examples])
+... return {"pixel_values": pixel_values, "labels": labels}
+```
+
+Then you just pass all of this along with the datasets to `Trainer`:
+
+```py
+>>> trainer = Trainer(
+... model,
+... args,
+... train_dataset=train_dataset,
+... eval_dataset=val_dataset,
+... processing_class=image_processor,
+... compute_metrics=compute_metrics,
+... data_collator=collate_fn,
+... )
+```
+
+You might wonder why you passed along the `image_processor` as a tokenizer when you preprocessed the data already. This is only to make sure the image processor configuration file (stored as JSON) will also be uploaded to the repo on the Hub.
+
+Now fine-tune our model by calling the `train` method:
+
+```py
+>>> train_results = trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~transformers.Trainer.push_to_hub`] method so everyone can use your model:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+Great, now that you have fine-tuned a model, you can use it for inference!
+
+Load a video for inference:
+
+```py
+>>> sample_test_video = next(iter(test_dataset))
+```
+
+
+
+
+
+The simplest way to try out your fine-tuned model for inference is to use it in a [`pipeline`](https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.VideoClassificationPipeline). Instantiate a `pipeline` for video classification with your model, and pass your video to it:
+
+```py
+>>> from transformers import pipeline
+
+>>> video_cls = pipeline(model="my_awesome_video_cls_model")
+>>> video_cls("https://huggingface.co/datasets/sayakpaul/ucf101-subset/resolve/main/v_BasketballDunk_g14_c06.avi")
+[{'score': 0.9272987842559814, 'label': 'BasketballDunk'},
+ {'score': 0.017777055501937866, 'label': 'BabyCrawling'},
+ {'score': 0.01663011871278286, 'label': 'BalanceBeam'},
+ {'score': 0.009560945443809032, 'label': 'BandMarching'},
+ {'score': 0.0068979403004050255, 'label': 'BaseballPitch'}]
+```
+
+You can also manually replicate the results of the `pipeline` if you'd like.
+
+
+```py
+>>> def run_inference(model, video):
+... # (num_frames, num_channels, height, width)
+... perumuted_sample_test_video = video.permute(1, 0, 2, 3)
+... inputs = {
+... "pixel_values": perumuted_sample_test_video.unsqueeze(0),
+... "labels": torch.tensor(
+... [sample_test_video["label"]]
+... ), # this can be skipped if you don't have labels available.
+... }
+
+... device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+... inputs = {k: v.to(device) for k, v in inputs.items()}
+... model = model.to(device)
+
+... # forward pass
+... with torch.no_grad():
+... outputs = model(**inputs)
+... logits = outputs.logits
+
+... return logits
+```
+
+Now, pass your input to the model and return the `logits`:
+
+```py
+>>> logits = run_inference(trained_model, sample_test_video["video"])
+```
+
+Decoding the `logits`, we get:
+
+```py
+>>> predicted_class_idx = logits.argmax(-1).item()
+>>> print("Predicted class:", model.config.id2label[predicted_class_idx])
+# Predicted class: BasketballDunk
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/video_text_to_text.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/video_text_to_text.md
new file mode 100644
index 0000000000000000000000000000000000000000..4c10907e4571bf72d38743410c5956fe38355ae2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/video_text_to_text.md
@@ -0,0 +1,147 @@
+
+
+# Video-text-to-text
+
+[[open-in-colab]]
+
+Video-text-to-text models, also known as video language models or vision language models with video input, are language models that take a video input. These models can tackle various tasks, from video question answering to video captioning.
+
+These models have nearly the same architecture as [image-text-to-text](../image_text_to_text.md) models except for some changes to accept video data, since video data is essentially image frames with temporal dependencies. Some image-text-to-text models take in multiple images, but this alone is inadequate for a model to accept videos. Moreover, video-text-to-text models are often trained with all vision modalities. Each example might have videos, multiple videos, images and multiple images. Some of these models can also take interleaved inputs. For example, you can refer to a specific video inside a string of text by adding a video token in text like "What is happening in this video? ``".
+
+In this guide, we provide a brief overview of video LMs and show how to use them with Transformers for inference.
+
+To begin with, there are multiple types of video LMs:
+- base models used for fine-tuning
+- chat fine-tuned models for conversation
+- instruction fine-tuned models
+
+This guide focuses on inference with an instruction-tuned model, [llava-hf/llava-interleave-qwen-7b-hf](https://huggingface.co/llava-hf/llava-interleave-qwen-7b-hf) which can take in interleaved data. Alternatively, you can try [llava-interleave-qwen-0.5b-hf](https://huggingface.co/llava-hf/llava-interleave-qwen-0.5b-hf) if your hardware doesn't allow running a 7B model.
+
+Let's begin installing the dependencies.
+
+```bash
+pip install -q transformers accelerate flash_attn
+```
+
+Let's initialize the model and the processor.
+
+```python
+from transformers import LlavaProcessor, LlavaForConditionalGeneration
+import torch
+model_id = "llava-hf/llava-interleave-qwen-0.5b-hf"
+
+processor = LlavaProcessor.from_pretrained(model_id)
+
+model = LlavaForConditionalGeneration.from_pretrained(model_id, torch_dtype=torch.float16)
+model.to("cuda") # can also be xpu, mps, npu etc. depending on your hardware accelerator
+```
+
+Some models directly consume the `` token, and others accept `` tokens equal to the number of sampled frames. This model handles videos in the latter fashion. We will write a simple utility to handle image tokens, and another utility to get a video from a url and sample frames from it.
+
+```python
+import uuid
+import requests
+import cv2
+from PIL import Image
+
+def replace_video_with_images(text, frames):
+ return text.replace("", "" * frames)
+
+def sample_frames(url, num_frames):
+
+ response = requests.get(url)
+ path_id = str(uuid.uuid4())
+
+ path = f"./{path_id}.mp4"
+
+ with open(path, "wb") as f:
+ f.write(response.content)
+
+ video = cv2.VideoCapture(path)
+ total_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT))
+ interval = total_frames // num_frames
+ frames = []
+ for i in range(total_frames):
+ ret, frame = video.read()
+ pil_img = Image.fromarray(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
+ if not ret:
+ continue
+ if i % interval == 0:
+ frames.append(pil_img)
+ video.release()
+ return frames[:num_frames]
+```
+
+Let's get our inputs. We will sample frames and concatenate them.
+
+```python
+video_1 = "https://huggingface.co/spaces/merve/llava-interleave/resolve/main/cats_1.mp4"
+video_2 = "https://huggingface.co/spaces/merve/llava-interleave/resolve/main/cats_2.mp4"
+
+video_1 = sample_frames(video_1, 6)
+video_2 = sample_frames(video_2, 6)
+
+videos = video_1 + video_2
+
+videos
+
+# [,
+# ,
+# , ...]
+```
+
+Both videos have cats.
+
+
+
+Now we can preprocess the inputs.
+
+This model has a prompt template that looks like following. First, we'll put all the sampled frames into one list. Since we have eight frames in each video, we will insert 12 ``ย tokens to our prompt. Add `assistant` at the end of the prompt to trigger the model to give answers. Then we can preprocess.
+
+```python
+user_prompt = "Are these two cats in these two videos doing the same thing?"
+toks = "" * 12
+prompt = "<|im_start|>user"+ toks + f"\n{user_prompt}<|im_end|><|im_start|>assistant"
+inputs = processor(text=prompt, images=videos, return_tensors="pt").to(model.device, model.dtype)
+```
+
+We can now call [`~GenerationMixin.generate`] for inference. The model outputs the question in our input and answer, so we only take the text after the prompt and `assistant` part from the model output.
+
+```python
+output = model.generate(**inputs, max_new_tokens=100, do_sample=False)
+print(processor.decode(output[0][2:], skip_special_tokens=True)[len(user_prompt)+10:])
+
+# The first cat is shown in a relaxed state, with its eyes closed and a content expression, while the second cat is shown in a more active state, with its mouth open wide, possibly in a yawn or a vocalization.
+
+
+```
+
+And voila!
+
+To learn more about chat templates and token streaming for video-text-to-text models, refer to the [image-text-to-text](../tasks/image_text_to_text) task guide because these models work similarly.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/visual_question_answering.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/visual_question_answering.md
new file mode 100644
index 0000000000000000000000000000000000000000..87dbfb751bfa9872fa75bdd7834a1ae23b27a698
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/visual_question_answering.md
@@ -0,0 +1,401 @@
+
+
+# Visual Question Answering
+
+[[open-in-colab]]
+
+Visual Question Answering (VQA) is the task of answering open-ended questions based on an image.
+The input to models supporting this task is typically a combination of an image and a question, and the output is an
+answer expressed in natural language.
+
+Some noteworthy use case examples for VQA include:
+* Accessibility applications for visually impaired individuals.
+* Education: posing questions about visual materials presented in lectures or textbooks. VQA can also be utilized in interactive museum exhibits or historical sites.
+* Customer service and e-commerce: VQA can enhance user experience by letting users ask questions about products.
+* Image retrieval: VQA models can be used to retrieve images with specific characteristics. For example, the user can ask "Is there a dog?" to find all images with dogs from a set of images.
+
+In this guide you'll learn how to:
+
+- Fine-tune a classification VQA model, specifically [ViLT](../model_doc/vilt), on the [`Graphcore/vqa` dataset](https://huggingface.co/datasets/Graphcore/vqa).
+- Use your fine-tuned ViLT for inference.
+- Run zero-shot VQA inference with a generative model, like BLIP-2.
+
+## Fine-tuning ViLT
+
+ViLT model incorporates text embeddings into a Vision Transformer (ViT), allowing it to have a minimal design for
+Vision-and-Language Pre-training (VLP). This model can be used for several downstream tasks. For the VQA task, a classifier
+head is placed on top (a linear layer on top of the final hidden state of the `[CLS]` token) and randomly initialized.
+Visual Question Answering is thus treated as a **classification problem**.
+
+More recent models, such as BLIP, BLIP-2, and InstructBLIP, treat VQA as a generative task. Later in this guide we
+illustrate how to use them for zero-shot VQA inference.
+
+Before you begin, make sure you have all the necessary libraries installed.
+
+```bash
+pip install -q transformers datasets
+```
+
+We encourage you to share your model with the community. Log in to your Hugging Face account to upload it to the ๐ค Hub.
+When prompted, enter your token to log in:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+Let's define the model checkpoint as a global variable.
+
+```py
+>>> model_checkpoint = "dandelin/vilt-b32-mlm"
+```
+
+## Load the data
+
+For illustration purposes, in this guide we use a very small sample of the annotated visual question answering `Graphcore/vqa` dataset.
+You can find the full dataset on [๐ค Hub](https://huggingface.co/datasets/Graphcore/vqa).
+
+As an alternative to the [`Graphcore/vqa` dataset](https://huggingface.co/datasets/Graphcore/vqa), you can download the
+same data manually from the official [VQA dataset page](https://visualqa.org/download.html). If you prefer to follow the
+tutorial with your custom data, check out how to [Create an image dataset](https://huggingface.co/docs/datasets/image_dataset#loading-script)
+guide in the ๐ค Datasets documentation.
+
+Let's load the first 200 examples from the validation split and explore the dataset's features:
+
+```python
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("Graphcore/vqa", split="validation[:200]")
+>>> dataset
+Dataset({
+ features: ['question', 'question_type', 'question_id', 'image_id', 'answer_type', 'label'],
+ num_rows: 200
+})
+```
+
+Let's take a look at an example to understand the dataset's features:
+
+```py
+>>> dataset[0]
+{'question': 'Where is he looking?',
+ 'question_type': 'none of the above',
+ 'question_id': 262148000,
+ 'image_id': '/root/.cache/huggingface/datasets/downloads/extracted/ca733e0e000fb2d7a09fbcc94dbfe7b5a30750681d0e965f8e0a23b1c2f98c75/val2014/COCO_val2014_000000262148.jpg',
+ 'answer_type': 'other',
+ 'label': {'ids': ['at table', 'down', 'skateboard', 'table'],
+ 'weights': [0.30000001192092896,
+ 1.0,
+ 0.30000001192092896,
+ 0.30000001192092896]}}
+```
+
+The features relevant to the task include:
+* `question`: the question to be answered from the image
+* `image_id`: the path to the image the question refers to
+* `label`: the annotations
+
+We can remove the rest of the features as they won't be necessary:
+
+```py
+>>> dataset = dataset.remove_columns(['question_type', 'question_id', 'answer_type'])
+```
+
+As you can see, the `label` feature contains several answers to the same question (called `ids` here) collected by different human annotators.
+This is because the answer to a question can be subjective. In this case, the question is "where is he looking?". Some people
+annotated this with "down", others with "at table", another one with "skateboard", etc.
+
+Take a look at the image and consider which answer would you give:
+
+```python
+>>> from PIL import Image
+
+>>> image = Image.open(dataset[0]['image_id'])
+>>> image
+```
+
+
+
+
+
+Due to the questions' and answers' ambiguity, datasets like this are treated as a multi-label classification problem (as
+multiple answers are possibly valid). Moreover, rather than just creating a one-hot encoded vector, one creates a
+soft encoding, based on the number of times a certain answer appeared in the annotations.
+
+For instance, in the example above, because the answer "down" is selected way more often than other answers, it has a
+score (called `weight` in the dataset) of 1.0, and the rest of the answers have scores < 1.0.
+
+To later instantiate the model with an appropriate classification head, let's create two dictionaries: one that maps
+the label name to an integer and vice versa:
+
+```py
+>>> import itertools
+
+>>> labels = [item['ids'] for item in dataset['label']]
+>>> flattened_labels = list(itertools.chain(*labels))
+>>> unique_labels = list(set(flattened_labels))
+
+>>> label2id = {label: idx for idx, label in enumerate(unique_labels)}
+>>> id2label = {idx: label for label, idx in label2id.items()}
+```
+
+Now that we have the mappings, we can replace the string answers with their ids, and flatten the dataset for a more convenient further preprocessing.
+
+```python
+>>> def replace_ids(inputs):
+... inputs["label"]["ids"] = [label2id[x] for x in inputs["label"]["ids"]]
+... return inputs
+
+
+>>> dataset = dataset.map(replace_ids)
+>>> flat_dataset = dataset.flatten()
+>>> flat_dataset.features
+{'question': Value(dtype='string', id=None),
+ 'image_id': Value(dtype='string', id=None),
+ 'label.ids': Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None),
+ 'label.weights': Sequence(feature=Value(dtype='float64', id=None), length=-1, id=None)}
+```
+
+## Preprocessing data
+
+The next step is to load a ViLT processor to prepare the image and text data for the model.
+[`ViltProcessor`] wraps a BERT tokenizer and ViLT image processor into a convenient single processor:
+
+```py
+>>> from transformers import ViltProcessor
+
+>>> processor = ViltProcessor.from_pretrained(model_checkpoint)
+```
+
+To preprocess the data we need to encode the images and questions using the [`ViltProcessor`]. The processor will use
+the [`BertTokenizerFast`] to tokenize the text and create `input_ids`, `attention_mask` and `token_type_ids` for the text data.
+As for images, the processor will leverage [`ViltImageProcessor`] to resize and normalize the image, and create `pixel_values` and `pixel_mask`.
+
+All these preprocessing steps are done under the hood, we only need to call the `processor`. However, we still need to
+prepare the target labels. In this representation, each element corresponds to a possible answer (label). For correct answers, the element holds
+their respective score (weight), while the remaining elements are set to zero.
+
+The following function applies the `processor` to the images and questions and formats the labels as described above:
+
+```py
+>>> import torch
+
+>>> def preprocess_data(examples):
+... image_paths = examples['image_id']
+... images = [Image.open(image_path) for image_path in image_paths]
+... texts = examples['question']
+
+... encoding = processor(images, texts, padding="max_length", truncation=True, return_tensors="pt")
+
+... for k, v in encoding.items():
+... encoding[k] = v.squeeze()
+
+... targets = []
+
+... for labels, scores in zip(examples['label.ids'], examples['label.weights']):
+... target = torch.zeros(len(id2label))
+
+... for label, score in zip(labels, scores):
+... target[label] = score
+
+... targets.append(target)
+
+... encoding["labels"] = targets
+
+... return encoding
+```
+
+To apply the preprocessing function over the entire dataset, use ๐ค Datasets [`~datasets.map`] function. You can speed up `map` by
+setting `batched=True` to process multiple elements of the dataset at once. At this point, feel free to remove the columns you don't need.
+
+```py
+>>> processed_dataset = flat_dataset.map(preprocess_data, batched=True, remove_columns=['question','question_type', 'question_id', 'image_id', 'answer_type', 'label.ids', 'label.weights'])
+>>> processed_dataset
+Dataset({
+ features: ['input_ids', 'token_type_ids', 'attention_mask', 'pixel_values', 'pixel_mask', 'labels'],
+ num_rows: 200
+})
+```
+
+As a final step, create a batch of examples using [`DefaultDataCollator`]:
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+## Train the model
+
+Youโre ready to start training your model now! Load ViLT with [`ViltForQuestionAnswering`]. Specify the number of labels
+along with the label mappings:
+
+```py
+>>> from transformers import ViltForQuestionAnswering
+
+>>> model = ViltForQuestionAnswering.from_pretrained(model_checkpoint, num_labels=len(id2label), id2label=id2label, label2id=label2id)
+```
+
+At this point, only three steps remain:
+
+1. Define your training hyperparameters in [`TrainingArguments`]:
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> repo_id = "MariaK/vilt_finetuned_200"
+
+>>> training_args = TrainingArguments(
+... output_dir=repo_id,
+... per_device_train_batch_size=4,
+... num_train_epochs=20,
+... save_steps=200,
+... logging_steps=50,
+... learning_rate=5e-5,
+... save_total_limit=2,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+```
+
+2. Pass the training arguments to [`Trainer`] along with the model, dataset, processor, and data collator.
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=data_collator,
+... train_dataset=processed_dataset,
+... processing_class=processor,
+... )
+```
+
+3. Call [`~Trainer.train`] to finetune your model.
+
+```py
+>>> trainer.train()
+```
+
+Once training is completed, share your model to the Hub with the [`~Trainer.push_to_hub`] method to share your final model on the ๐ค Hub:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+Now that you have fine-tuned a ViLT model, and uploaded it to the ๐ค Hub, you can use it for inference. The simplest
+way to try out your fine-tuned model for inference is to use it in a [`Pipeline`].
+
+```py
+>>> from transformers import pipeline
+
+>>> pipe = pipeline("visual-question-answering", model="MariaK/vilt_finetuned_200")
+```
+
+The model in this guide has only been trained on 200 examples, so don't expect a lot from it. Let's see if it at least
+learned something from the data and take the first example from the dataset to illustrate inference:
+
+```py
+>>> example = dataset[0]
+>>> image = Image.open(example['image_id'])
+>>> question = example['question']
+>>> print(question)
+>>> pipe(image, question, top_k=1)
+"Where is he looking?"
+[{'score': 0.5498199462890625, 'answer': 'down'}]
+```
+
+Even though not very confident, the model indeed has learned something. With more examples and longer training, you'll get far better results!
+
+You can also manually replicate the results of the pipeline if you'd like:
+1. Take an image and a question, prepare them for the model using the processor from your model.
+2. Forward the result or preprocessing through the model.
+3. From the logits, get the most likely answer's id, and find the actual answer in the `id2label`.
+
+```py
+>>> processor = ViltProcessor.from_pretrained("MariaK/vilt_finetuned_200")
+
+>>> image = Image.open(example['image_id'])
+>>> question = example['question']
+
+>>> # prepare inputs
+>>> inputs = processor(image, question, return_tensors="pt")
+
+>>> model = ViltForQuestionAnswering.from_pretrained("MariaK/vilt_finetuned_200")
+
+>>> # forward pass
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+
+>>> logits = outputs.logits
+>>> idx = logits.argmax(-1).item()
+>>> print("Predicted answer:", model.config.id2label[idx])
+Predicted answer: down
+```
+
+## Zero-shot VQA
+
+The previous model treated VQA as a classification task. Some recent models, such as BLIP, BLIP-2, and InstructBLIP approach
+VQA as a generative task. Let's take [BLIP-2](../model_doc/blip-2) as an example. It introduced a new visual-language pre-training
+paradigm in which any combination of pre-trained vision encoder and LLM can be used (learn more in the [BLIP-2 blog post](https://huggingface.co/blog/blip-2)).
+This enables achieving state-of-the-art results on multiple visual-language tasks including visual question answering.
+
+Let's illustrate how you can use this model for VQA. First, let's load the model. Here we'll explicitly send the model to a
+GPU, if available, which we didn't need to do earlier when training, as [`Trainer`] handles this automatically:
+
+```py
+>>> from transformers import AutoProcessor, Blip2ForConditionalGeneration
+>>> import torch
+>>> from accelerate.test_utils.testing import get_backend
+
+>>> processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
+>>> model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", torch_dtype=torch.float16)
+>>> device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+>>> model.to(device)
+```
+
+The model takes image and text as input, so let's use the exact same image/question pair from the first example in the VQA dataset:
+
+```py
+>>> example = dataset[0]
+>>> image = Image.open(example['image_id'])
+>>> question = example['question']
+```
+
+To use BLIP-2 for visual question answering task, the textual prompt has to follow a specific format: `Question: {} Answer:`.
+
+```py
+>>> prompt = f"Question: {question} Answer:"
+```
+
+Now we need to preprocess the image/prompt with the model's processor, pass the processed input through the model, and decode the output:
+
+```py
+>>> inputs = processor(image, text=prompt, return_tensors="pt").to(device, torch.float16)
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0].strip()
+>>> print(generated_text)
+"He is looking at the crowd"
+```
+
+As you can see, the model recognized the crowd, and the direction of the face (looking down), however, it seems to miss
+the fact the crowd is behind the skater. Still, in cases where acquiring human-annotated datasets is not feasible, this
+approach can quickly produce useful results.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/zero_shot_image_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/zero_shot_image_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..d923ca44b401349b867f772e61f82a155bcfd8d2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/zero_shot_image_classification.md
@@ -0,0 +1,149 @@
+
+
+# Zero-shot image classification
+
+[[open-in-colab]]
+
+Zero-shot image classification is a task that involves classifying images into different categories using a model that was
+not explicitly trained on data containing labeled examples from those specific categories.
+
+Traditionally, image classification requires training a model on a specific set of labeled images, and this model learns to
+"map" certain image features to labels. When there's a need to use such model for a classification task that introduces a
+new set of labels, fine-tuning is required to "recalibrate" the model.
+
+In contrast, zero-shot or open vocabulary image classification models are typically multi-modal models that have been trained on a large
+dataset of images and associated descriptions. These models learn aligned vision-language representations that can be used for many downstream tasks including zero-shot image classification.
+
+This is a more flexible approach to image classification that allows models to generalize to new and unseen categories
+without the need for additional training data and enables users to query images with free-form text descriptions of their target objects .
+
+In this guide you'll learn how to:
+
+* create a zero-shot image classification pipeline
+* run zero-shot image classification inference by hand
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install -q "transformers[torch]" pillow
+```
+
+## Zero-shot image classification pipeline
+
+The simplest way to try out inference with a model supporting zero-shot image classification is to use the corresponding [`pipeline`].
+Instantiate a pipeline from a [checkpoint on the Hugging Face Hub](https://huggingface.co/models?pipeline_tag=zero-shot-image-classification&sort=downloads):
+
+```python
+>>> from transformers import pipeline
+
+>>> checkpoint = "openai/clip-vit-large-patch14"
+>>> detector = pipeline(model=checkpoint, task="zero-shot-image-classification")
+```
+
+Next, choose an image you'd like to classify.
+
+```py
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://unsplash.com/photos/g8oS8-82DxI/download?ixid=MnwxMjA3fDB8MXx0b3BpY3x8SnBnNktpZGwtSGt8fHx8fDJ8fDE2NzgxMDYwODc&force=true&w=640"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> image
+```
+
+
+
+
+
+Pass the image and the candidate object labels to the pipeline. Here we pass the image directly; other suitable options
+include a local path to an image or an image url.
+The candidate labels can be simple words like in this example, or more descriptive.
+
+```py
+>>> predictions = detector(image, candidate_labels=["fox", "bear", "seagull", "owl"])
+>>> predictions
+[{'score': 0.9996670484542847, 'label': 'owl'},
+ {'score': 0.000199399160919711, 'label': 'seagull'},
+ {'score': 7.392891711788252e-05, 'label': 'fox'},
+ {'score': 5.96074532950297e-05, 'label': 'bear'}]
+```
+
+## Zero-shot image classification by hand
+
+Now that you've seen how to use the zero-shot image classification pipeline, let's take a look how you can run zero-shot
+image classification manually.
+
+Start by loading the model and associated processor from a [checkpoint on the Hugging Face Hub](https://huggingface.co/models?pipeline_tag=zero-shot-image-classification&sort=downloads).
+Here we'll use the same checkpoint as before:
+
+```py
+>>> from transformers import AutoProcessor, AutoModelForZeroShotImageClassification
+
+>>> model = AutoModelForZeroShotImageClassification.from_pretrained(checkpoint)
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+```
+
+Let's take a different image to switch things up.
+
+```py
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://unsplash.com/photos/xBRQfR2bqNI/download?ixid=MnwxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNjc4Mzg4ODEx&force=true&w=640"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> image
+```
+
+
+
+
+
+Use the processor to prepare the inputs for the model. The processor combines an image processor that prepares the
+image for the model by resizing and normalizing it, and a tokenizer that takes care of the text inputs.
+
+```py
+>>> candidate_labels = ["tree", "car", "bike", "cat"]
+# follows the pipeline prompt template to get same results
+>>> candidate_labels = [f'This is a photo of {label}.' for label in candidate_labels]
+>>> inputs = processor(images=image, text=candidate_labels, return_tensors="pt", padding=True)
+```
+
+Pass the inputs through the model, and post-process the results:
+
+```py
+>>> import torch
+
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+
+>>> logits = outputs.logits_per_image[0]
+>>> probs = logits.softmax(dim=-1).numpy()
+>>> scores = probs.tolist()
+
+>>> result = [
+... {"score": score, "label": candidate_label}
+... for score, candidate_label in sorted(zip(probs, candidate_labels), key=lambda x: -x[0])
+... ]
+
+>>> result
+[{'score': 0.998572, 'label': 'car'},
+ {'score': 0.0010570387, 'label': 'bike'},
+ {'score': 0.0003393686, 'label': 'tree'},
+ {'score': 3.1572064e-05, 'label': 'cat'}]
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/zero_shot_object_detection.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/zero_shot_object_detection.md
new file mode 100644
index 0000000000000000000000000000000000000000..defe54b1c769eb8f999bdc0d59e690daa614bb5f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks/zero_shot_object_detection.md
@@ -0,0 +1,301 @@
+
+
+# Zero-shot object detection
+
+[[open-in-colab]]
+
+Traditionally, models used for [object detection](object_detection) require labeled image datasets for training,
+and are limited to detecting the set of classes from the training data.
+
+Zero-shot object detection is supported by the [OWL-ViT](../model_doc/owlvit) model which uses a different approach. OWL-ViT
+is an open-vocabulary object detector. It means that it can detect objects in images based on free-text queries without
+the need to fine-tune the model on labeled datasets.
+
+OWL-ViT leverages multi-modal representations to perform open-vocabulary detection. It combines [CLIP](../model_doc/clip) with
+lightweight object classification and localization heads. Open-vocabulary detection is achieved by embedding free-text queries with the text encoder of CLIP and using them as input to the object classification and localization heads,
+which associate images with their corresponding textual descriptions, while ViT processes image patches as inputs. The authors
+of OWL-ViT first trained CLIP from scratch and then fine-tuned OWL-ViT end to end on standard object detection datasets using
+a bipartite matching loss.
+
+With this approach, the model can detect objects based on textual descriptions without prior training on labeled datasets.
+
+In this guide, you will learn how to use OWL-ViT:
+- to detect objects based on text prompts
+- for batch object detection
+- for image-guided object detection
+
+Before you begin, make sure you have all the necessary libraries installed:
+
+```bash
+pip install -q transformers
+```
+
+## Zero-shot object detection pipeline
+
+The simplest way to try out inference with OWL-ViT is to use it in a [`pipeline`]. Instantiate a pipeline
+for zero-shot object detection from a [checkpoint on the Hugging Face Hub](https://huggingface.co/models?other=owlvit):
+
+```python
+>>> from transformers import pipeline
+
+>>> checkpoint = "google/owlv2-base-patch16-ensemble"
+>>> detector = pipeline(model=checkpoint, task="zero-shot-object-detection")
+```
+
+Next, choose an image you'd like to detect objects in. Here we'll use the image of astronaut Eileen Collins that is
+a part of the [NASA](https://www.nasa.gov/multimedia/imagegallery/index.html) Great Images dataset.
+
+```py
+>>> import skimage
+>>> import numpy as np
+>>> from PIL import Image
+
+>>> image = skimage.data.astronaut()
+>>> image = Image.fromarray(np.uint8(image)).convert("RGB")
+
+>>> image
+```
+
+
+
+
+
+Pass the image and the candidate object labels to look for to the pipeline.
+Here we pass the image directly; other suitable options include a local path to an image or an image url. We also pass text descriptions for all items we want to query the image for.
+
+```py
+>>> predictions = detector(
+... image,
+... candidate_labels=["human face", "rocket", "nasa badge", "star-spangled banner"],
+... )
+>>> predictions
+[{'score': 0.3571370542049408,
+ 'label': 'human face',
+ 'box': {'xmin': 180, 'ymin': 71, 'xmax': 271, 'ymax': 178}},
+ {'score': 0.28099656105041504,
+ 'label': 'nasa badge',
+ 'box': {'xmin': 129, 'ymin': 348, 'xmax': 206, 'ymax': 427}},
+ {'score': 0.2110239565372467,
+ 'label': 'rocket',
+ 'box': {'xmin': 350, 'ymin': -1, 'xmax': 468, 'ymax': 288}},
+ {'score': 0.13790413737297058,
+ 'label': 'star-spangled banner',
+ 'box': {'xmin': 1, 'ymin': 1, 'xmax': 105, 'ymax': 509}},
+ {'score': 0.11950037628412247,
+ 'label': 'nasa badge',
+ 'box': {'xmin': 277, 'ymin': 338, 'xmax': 327, 'ymax': 380}},
+ {'score': 0.10649408400058746,
+ 'label': 'rocket',
+ 'box': {'xmin': 358, 'ymin': 64, 'xmax': 424, 'ymax': 280}}]
+```
+
+Let's visualize the predictions:
+
+```py
+>>> from PIL import ImageDraw
+
+>>> draw = ImageDraw.Draw(image)
+
+>>> for prediction in predictions:
+... box = prediction["box"]
+... label = prediction["label"]
+... score = prediction["score"]
+
+... xmin, ymin, xmax, ymax = box.values()
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="red", width=1)
+... draw.text((xmin, ymin), f"{label}: {round(score,2)}", fill="white")
+
+>>> image
+```
+
+
+
+
+
+## Text-prompted zero-shot object detection by hand
+
+Now that you've seen how to use the zero-shot object detection pipeline, let's replicate the same
+result manually.
+
+Start by loading the model and associated processor from a [checkpoint on the Hugging Face Hub](https://huggingface.co/models?other=owlvit).
+Here we'll use the same checkpoint as before:
+
+```py
+>>> from transformers import AutoProcessor, AutoModelForZeroShotObjectDetection
+
+>>> model = AutoModelForZeroShotObjectDetection.from_pretrained(checkpoint)
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+```
+
+Let's take a different image to switch things up.
+
+```py
+>>> import requests
+
+>>> url = "https://unsplash.com/photos/oj0zeY2Ltk4/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTR8fHBpY25pY3xlbnwwfHx8fDE2Nzc0OTE1NDk&force=true&w=640"
+>>> im = Image.open(requests.get(url, stream=True).raw)
+>>> im
+```
+
+
+
+
+
+Use the processor to prepare the inputs for the model. The processor combines an image processor that prepares the
+image for the model by resizing and normalizing it, and a [`CLIPTokenizer`] that takes care of the text inputs.
+
+```py
+>>> text_queries = ["hat", "book", "sunglasses", "camera"]
+>>> inputs = processor(text=text_queries, images=im, return_tensors="pt")
+```
+
+Pass the inputs through the model, post-process, and visualize the results. Since the image processor resized images before
+feeding them to the model, you need to use the [`~OwlViTImageProcessor.post_process_object_detection`] method to make sure the predicted bounding
+boxes have the correct coordinates relative to the original image:
+
+```py
+>>> import torch
+
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+... target_sizes = torch.tensor([im.size[::-1]])
+... results = processor.post_process_object_detection(outputs, threshold=0.1, target_sizes=target_sizes)[0]
+
+>>> draw = ImageDraw.Draw(im)
+
+>>> scores = results["scores"].tolist()
+>>> labels = results["labels"].tolist()
+>>> boxes = results["boxes"].tolist()
+
+>>> for box, score, label in zip(boxes, scores, labels):
+... xmin, ymin, xmax, ymax = box
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="red", width=1)
+... draw.text((xmin, ymin), f"{text_queries[label]}: {round(score,2)}", fill="white")
+
+>>> im
+```
+
+
+
+
+
+## Batch processing
+
+You can pass multiple sets of images and text queries to search for different (or same) objects in several images.
+Let's use both an astronaut image and the beach image together.
+For batch processing, you should pass text queries as a nested list to the processor and images as lists of PIL images,
+PyTorch tensors, or NumPy arrays.
+
+```py
+>>> images = [image, im]
+>>> text_queries = [
+... ["human face", "rocket", "nasa badge", "star-spangled banner"],
+... ["hat", "book", "sunglasses", "camera"],
+... ]
+>>> inputs = processor(text=text_queries, images=images, return_tensors="pt")
+```
+
+Previously for post-processing you passed the single image's size as a tensor, but you can also pass a tuple, or, in case
+of several images, a list of tuples. Let's create predictions for the two examples, and visualize the second one (`image_idx = 1`).
+
+```py
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+... target_sizes = [x.size[::-1] for x in images]
+... results = processor.post_process_object_detection(outputs, threshold=0.1, target_sizes=target_sizes)
+
+>>> image_idx = 1
+>>> draw = ImageDraw.Draw(images[image_idx])
+
+>>> scores = results[image_idx]["scores"].tolist()
+>>> labels = results[image_idx]["labels"].tolist()
+>>> boxes = results[image_idx]["boxes"].tolist()
+
+>>> for box, score, label in zip(boxes, scores, labels):
+... xmin, ymin, xmax, ymax = box
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="red", width=1)
+... draw.text((xmin, ymin), f"{text_queries[image_idx][label]}: {round(score,2)}", fill="white")
+
+>>> images[image_idx]
+```
+
+
+
+
+
+## Image-guided object detection
+
+In addition to zero-shot object detection with text queries, OWL-ViT offers image-guided object detection. This means
+you can use an image query to find similar objects in the target image.
+Unlike text queries, only a single example image is allowed.
+
+Let's take an image with two cats on a couch as a target image, and an image of a single cat
+as a query:
+
+```py
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image_target = Image.open(requests.get(url, stream=True).raw)
+
+>>> query_url = "http://images.cocodataset.org/val2017/000000524280.jpg"
+>>> query_image = Image.open(requests.get(query_url, stream=True).raw)
+```
+
+Let's take a quick look at the images:
+
+```py
+>>> import matplotlib.pyplot as plt
+
+>>> fig, ax = plt.subplots(1, 2)
+>>> ax[0].imshow(image_target)
+>>> ax[1].imshow(query_image)
+```
+
+
+
+
+
+In the preprocessing step, instead of text queries, you now need to use `query_images`:
+
+```py
+>>> inputs = processor(images=image_target, query_images=query_image, return_tensors="pt")
+```
+
+For predictions, instead of passing the inputs to the model, pass them to [`~OwlViTForObjectDetection.image_guided_detection`]. Draw the predictions
+as before except now there are no labels.
+
+```py
+>>> with torch.no_grad():
+... outputs = model.image_guided_detection(**inputs)
+... target_sizes = torch.tensor([image_target.size[::-1]])
+... results = processor.post_process_image_guided_detection(outputs=outputs, target_sizes=target_sizes)[0]
+
+>>> draw = ImageDraw.Draw(image_target)
+
+>>> scores = results["scores"].tolist()
+>>> boxes = results["boxes"].tolist()
+
+>>> for box, score in zip(boxes, scores):
+... xmin, ymin, xmax, ymax = box
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="white", width=4)
+
+>>> image_target
+```
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks_explained.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks_explained.md
new file mode 100644
index 0000000000000000000000000000000000000000..1cc60ba096f04f56f6461db262f2721c5fbd3fd7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tasks_explained.md
@@ -0,0 +1,295 @@
+
+
+# How ๐ค Transformers solve tasks
+
+In [What ๐ค Transformers can do](task_summary), you learned about natural language processing (NLP), speech and audio, computer vision tasks, and some important applications of them. This page will look closely at how models solve these tasks and explain what's happening under the hood. There are many ways to solve a given task, some models may implement certain techniques or even approach the task from a new angle, but for Transformer models, the general idea is the same. Owing to its flexible architecture, most models are a variant of an encoder, a decoder, or an encoder-decoder structure. In addition to Transformer models, our library also has several convolutional neural networks (CNNs), which are still used today for computer vision tasks. We'll also explain how a modern CNN works.
+
+To explain how tasks are solved, we'll walk through what goes on inside the model to output useful predictions.
+
+- [Wav2Vec2](model_doc/wav2vec2) for audio classification and automatic speech recognition (ASR)
+- [Vision Transformer (ViT)](model_doc/vit) and [ConvNeXT](model_doc/convnext) for image classification
+- [DETR](model_doc/detr) for object detection
+- [Mask2Former](model_doc/mask2former) for image segmentation
+- [GLPN](model_doc/glpn) for depth estimation
+- [BERT](model_doc/bert) for NLP tasks like text classification, token classification and question answering that use an encoder
+- [GPT2](model_doc/gpt2) for NLP tasks like text generation that use a decoder
+- [BART](model_doc/bart) for NLP tasks like summarization and translation that use an encoder-decoder
+
+
+
+Before you go further, it is good to have some basic knowledge of the original Transformer architecture. Knowing how encoders, decoders, and attention work will aid you in understanding how different Transformer models work. If you're just getting started or need a refresher, check out our [course](https://huggingface.co/course/chapter1/4?fw=pt) for more information!
+
+
+
+## Speech and audio
+
+[Wav2Vec2](model_doc/wav2vec2) is a self-supervised model pretrained on unlabeled speech data and finetuned on labeled data for audio classification and automatic speech recognition.
+
+
+
+
+
+This model has four main components:
+
+1. A *feature encoder* takes the raw audio waveform, normalizes it to zero mean and unit variance, and converts it into a sequence of feature vectors that are each 20ms long.
+
+2. Waveforms are continuous by nature, so they can't be divided into separate units like a sequence of text can be split into words. That's why the feature vectors are passed to a *quantization module*, which aims to learn discrete speech units. The speech unit is chosen from a collection of codewords, known as a *codebook* (you can think of this as the vocabulary). From the codebook, the vector or speech unit, that best represents the continuous audio input is chosen and forwarded through the model.
+
+3. About half of the feature vectors are randomly masked, and the masked feature vector is fed to a *context network*, which is a Transformer encoder that also adds relative positional embeddings.
+
+4. The pretraining objective of the context network is a *contrastive task*. The model has to predict the true quantized speech representation of the masked prediction from a set of false ones, encouraging the model to find the most similar context vector and quantized speech unit (the target label).
+
+Now that wav2vec2 is pretrained, you can finetune it on your data for audio classification or automatic speech recognition!
+
+### Audio classification
+
+To use the pretrained model for audio classification, add a sequence classification head on top of the base Wav2Vec2 model. The classification head is a linear layer that accepts the encoder's hidden states. The hidden states represent the learned features from each audio frame which can have varying lengths. To create one vector of fixed-length, the hidden states are pooled first and then transformed into logits over the class labels. The cross-entropy loss is calculated between the logits and target to find the most likely class.
+
+Ready to try your hand at audio classification? Check out our complete [audio classification guide](tasks/audio_classification) to learn how to finetune Wav2Vec2 and use it for inference!
+
+### Automatic speech recognition
+
+To use the pretrained model for automatic speech recognition, add a language modeling head on top of the base Wav2Vec2 model for [connectionist temporal classification (CTC)](glossary#connectionist-temporal-classification-ctc). The language modeling head is a linear layer that accepts the encoder's hidden states and transforms them into logits. Each logit represents a token class (the number of tokens comes from the task vocabulary). The CTC loss is calculated between the logits and targets to find the most likely sequence of tokens, which are then decoded into a transcription.
+
+Ready to try your hand at automatic speech recognition? Check out our complete [automatic speech recognition guide](tasks/asr) to learn how to finetune Wav2Vec2 and use it for inference!
+
+## Computer vision
+
+There are two ways to approach computer vision tasks:
+
+1. Split an image into a sequence of patches and process them in parallel with a Transformer.
+2. Use a modern CNN, like [ConvNeXT](model_doc/convnext), which relies on convolutional layers but adopts modern network designs.
+
+
+
+A third approach mixes Transformers with convolutions (for example, [Convolutional Vision Transformer](model_doc/cvt) or [LeViT](model_doc/levit)). We won't discuss those because they just combine the two approaches we examine here.
+
+
+
+ViT and ConvNeXT are commonly used for image classification, but for other vision tasks like object detection, segmentation, and depth estimation, we'll look at DETR, Mask2Former and GLPN, respectively; these models are better suited for those tasks.
+
+### Image classification
+
+ViT and ConvNeXT can both be used for image classification; the main difference is that ViT uses an attention mechanism while ConvNeXT uses convolutions.
+
+#### Transformer
+
+[ViT](model_doc/vit) replaces convolutions entirely with a pure Transformer architecture. If you're familiar with the original Transformer, then you're already most of the way toward understanding ViT.
+
+
+
+
+
+The main change ViT introduced was in how images are fed to a Transformer:
+
+1. An image is split into square non-overlapping patches, each of which gets turned into a vector or *patch embedding*. The patch embeddings are generated from a convolutional 2D layer which creates the proper input dimensions (which for a base Transformer is 768 values for each patch embedding). If you had a 224x224 pixel image, you could split it into 196 16x16 image patches. Just like how text is tokenized into words, an image is "tokenized" into a sequence of patches.
+
+2. A *learnable embedding* - a special `[CLS]` token - is added to the beginning of the patch embeddings just like BERT. The final hidden state of the `[CLS]` token is used as the input to the attached classification head; other outputs are ignored. This token helps the model learn how to encode a representation of the image.
+
+3. The last thing to add to the patch and learnable embeddings are the *position embeddings* because the model doesn't know how the image patches are ordered. The position embeddings are also learnable and have the same size as the patch embeddings. Finally, all of the embeddings are passed to the Transformer encoder.
+
+4. The output, specifically only the output with the `[CLS]` token, is passed to a multilayer perceptron head (MLP). ViT's pretraining objective is simply classification. Like other classification heads, the MLP head converts the output into logits over the class labels and calculates the cross-entropy loss to find the most likely class.
+
+Ready to try your hand at image classification? Check out our complete [image classification guide](tasks/image_classification) to learn how to finetune ViT and use it for inference!
+
+#### CNN
+
+
+
+This section briefly explains convolutions, but it'd be helpful to have a prior understanding of how they change an image's shape and size. If you're unfamiliar with convolutions, check out the [Convolution Neural Networks chapter](https://github.com/fastai/fastbook/blob/master/13_convolutions.ipynb) from the fastai book!
+
+
+
+[ConvNeXT](model_doc/convnext) is a CNN architecture that adopts new and modern network designs to improve performance. However, convolutions are still at the core of the model. From a high-level perspective, a [convolution](glossary#convolution) is an operation where a smaller matrix (*kernel*) is multiplied by a small window of the image pixels. It computes some features from it, such as a particular texture or curvature of a line. Then it slides over to the next window of pixels; the distance the convolution travels is known as the *stride*.
+
+
+
+
+
+A basic convolution without padding or stride, taken from A guide to convolution arithmetic for deep learning.
+
+You can feed this output to another convolutional layer, and with each successive layer, the network learns more complex and abstract things like hotdogs or rockets. Between convolutional layers, it is common to add a pooling layer to reduce dimensionality and make the model more robust to variations of a feature's position.
+
+
+
+
+
+ConvNeXT modernizes a CNN in five ways:
+
+1. Change the number of blocks in each stage and "patchify" an image with a larger stride and corresponding kernel size. The non-overlapping sliding window makes this patchifying strategy similar to how ViT splits an image into patches.
+
+2. A *bottleneck* layer shrinks the number of channels and then restores it because it is faster to do a 1x1 convolution, and you can increase the depth. An inverted bottleneck does the opposite by expanding the number of channels and shrinking them, which is more memory efficient.
+
+3. Replace the typical 3x3 convolutional layer in the bottleneck layer with *depthwise convolution*, which applies a convolution to each input channel separately and then stacks them back together at the end. This widens the network width for improved performance.
+
+4. ViT has a global receptive field which means it can see more of an image at once thanks to its attention mechanism. ConvNeXT attempts to replicate this effect by increasing the kernel size to 7x7.
+
+5. ConvNeXT also makes several layer design changes that imitate Transformer models. There are fewer activation and normalization layers, the activation function is switched to GELU instead of ReLU, and it uses LayerNorm instead of BatchNorm.
+
+The output from the convolution blocks is passed to a classification head which converts the outputs into logits and calculates the cross-entropy loss to find the most likely label.
+
+### Object detection
+
+[DETR](model_doc/detr), *DEtection TRansformer*, is an end-to-end object detection model that combines a CNN with a Transformer encoder-decoder.
+
+
+
+
+
+1. A pretrained CNN *backbone* takes an image, represented by its pixel values, and creates a low-resolution feature map of it. A 1x1 convolution is applied to the feature map to reduce dimensionality and it creates a new feature map with a high-level image representation. Since the Transformer is a sequential model, the feature map is flattened into a sequence of feature vectors that are combined with positional embeddings.
+
+2. The feature vectors are passed to the encoder, which learns the image representations using its attention layers. Next, the encoder hidden states are combined with *object queries* in the decoder. Object queries are learned embeddings that focus on the different regions of an image, and they're updated as they progress through each attention layer. The decoder hidden states are passed to a feedforward network that predicts the bounding box coordinates and class label for each object query, or `no object` if there isn't one.
+
+ DETR decodes each object query in parallel to output *N* final predictions, where *N* is the number of queries. Unlike a typical autoregressive model that predicts one element at a time, object detection is a set prediction task (`bounding box`, `class label`) that makes *N* predictions in a single pass.
+
+3. DETR uses a *bipartite matching loss* during training to compare a fixed number of predictions with a fixed set of ground truth labels. If there are fewer ground truth labels in the set of *N* labels, then they're padded with a `no object` class. This loss function encourages DETR to find a one-to-one assignment between the predictions and ground truth labels. If either the bounding boxes or class labels aren't correct, a loss is incurred. Likewise, if DETR predicts an object that doesn't exist, it is penalized. This encourages DETR to find other objects in an image instead of focusing on one really prominent object.
+
+An object detection head is added on top of DETR to find the class label and the coordinates of the bounding box. There are two components to the object detection head: a linear layer to transform the decoder hidden states into logits over the class labels, and a MLP to predict the bounding box.
+
+Ready to try your hand at object detection? Check out our complete [object detection guide](tasks/object_detection) to learn how to finetune DETR and use it for inference!
+
+### Image segmentation
+
+[Mask2Former](model_doc/mask2former) is a universal architecture for solving all types of image segmentation tasks. Traditional segmentation models are typically tailored towards a particular subtask of image segmentation, like instance, semantic or panoptic segmentation. Mask2Former frames each of those tasks as a *mask classification* problem. Mask classification groups pixels into *N* segments, and predicts *N* masks and their corresponding class label for a given image. We'll explain how Mask2Former works in this section, and then you can try finetuning SegFormer at the end.
+
+
+
+
+
+There are three main components to Mask2Former:
+
+1. A [Swin](model_doc/swin) backbone accepts an image and creates a low-resolution image feature map from 3 consecutive 3x3 convolutions.
+
+2. The feature map is passed to a *pixel decoder* which gradually upsamples the low-resolution features into high-resolution per-pixel embeddings. The pixel decoder actually generates multi-scale features (contains both low- and high-resolution features) with resolutions 1/32, 1/16, and 1/8th of the original image.
+
+3. Each of these feature maps of differing scales is fed successively to one Transformer decoder layer at a time in order to capture small objects from the high-resolution features. The key to Mask2Former is the *masked attention* mechanism in the decoder. Unlike cross-attention which can attend to the entire image, masked attention only focuses on a certain area of the image. This is faster and leads to better performance because the local features of an image are enough for the model to learn from.
+
+4. Like [DETR](tasks_explained#object-detection), Mask2Former also uses learned object queries and combines them with the image features from the pixel decoder to make a set prediction (`class label`, `mask prediction`). The decoder hidden states are passed into a linear layer and transformed into logits over the class labels. The cross-entropy loss is calculated between the logits and class label to find the most likely one.
+
+ The mask predictions are generated by combining the pixel-embeddings with the final decoder hidden states. The sigmoid cross-entropy and dice loss is calculated between the logits and the ground truth mask to find the most likely mask.
+
+Ready to try your hand at image segmentation? Check out our complete [image segmentation guide](tasks/semantic_segmentation) to learn how to finetune SegFormer and use it for inference!
+
+### Depth estimation
+
+[GLPN](model_doc/glpn), *Global-Local Path Network*, is a Transformer for depth estimation that combines a [SegFormer](model_doc/segformer) encoder with a lightweight decoder.
+
+
+
+
+
+1. Like ViT, an image is split into a sequence of patches, except these image patches are smaller. This is better for dense prediction tasks like segmentation or depth estimation. The image patches are transformed into patch embeddings (see the [image classification](#image-classification) section for more details about how patch embeddings are created), which are fed to the encoder.
+
+2. The encoder accepts the patch embeddings, and passes them through several encoder blocks. Each block consists of attention and Mix-FFN layers. The purpose of the latter is to provide positional information. At the end of each encoder block is a *patch merging* layer for creating hierarchical representations. The features of each group of neighboring patches are concatenated, and a linear layer is applied to the concatenated features to reduce the number of patches to a resolution of 1/4. This becomes the input to the next encoder block, where this whole process is repeated until you have image features with resolutions of 1/8, 1/16, and 1/32.
+
+3. A lightweight decoder takes the last feature map (1/32 scale) from the encoder and upsamples it to 1/16 scale. From here, the feature is passed into a *Selective Feature Fusion (SFF)* module, which selects and combines local and global features from an attention map for each feature and then upsamples it to 1/8th. This process is repeated until the decoded features are the same size as the original image. The output is passed through two convolution layers and then a sigmoid activation is applied to predict the depth of each pixel.
+
+## Natural language processing
+
+The Transformer was initially designed for machine translation, and since then, it has practically become the default architecture for solving all NLP tasks. Some tasks lend themselves to the Transformer's encoder structure, while others are better suited for the decoder. Still, other tasks make use of both the Transformer's encoder-decoder structure.
+
+### Text classification
+
+[BERT](model_doc/bert) is an encoder-only model and is the first model to effectively implement deep bidirectionality to learn richer representations of the text by attending to words on both sides.
+
+1. BERT uses [WordPiece](tokenizer_summary#wordpiece) tokenization to generate a token embedding of the text. To tell the difference between a single sentence and a pair of sentences, a special `[SEP]` token is added to differentiate them. A special `[CLS]` token is added to the beginning of every sequence of text. The final output with the `[CLS]` token is used as the input to the classification head for classification tasks. BERT also adds a segment embedding to denote whether a token belongs to the first or second sentence in a pair of sentences.
+
+2. BERT is pretrained with two objectives: masked language modeling and next-sentence prediction. In masked language modeling, some percentage of the input tokens are randomly masked, and the model needs to predict these. This solves the issue of bidirectionality, where the model could cheat and see all the words and "predict" the next word. The final hidden states of the predicted mask tokens are passed to a feedforward network with a softmax over the vocabulary to predict the masked word.
+
+ The second pretraining object is next-sentence prediction. The model must predict whether sentence B follows sentence A. Half of the time sentence B is the next sentence, and the other half of the time, sentence B is a random sentence. The prediction, whether it is the next sentence or not, is passed to a feedforward network with a softmax over the two classes (`IsNext` and `NotNext`).
+
+3. The input embeddings are passed through multiple encoder layers to output some final hidden states.
+
+To use the pretrained model for text classification, add a sequence classification head on top of the base BERT model. The sequence classification head is a linear layer that accepts the final hidden states and performs a linear transformation to convert them into logits. The cross-entropy loss is calculated between the logits and target to find the most likely label.
+
+Ready to try your hand at text classification? Check out our complete [text classification guide](tasks/sequence_classification) to learn how to finetune DistilBERT and use it for inference!
+
+### Token classification
+
+To use BERT for token classification tasks like named entity recognition (NER), add a token classification head on top of the base BERT model. The token classification head is a linear layer that accepts the final hidden states and performs a linear transformation to convert them into logits. The cross-entropy loss is calculated between the logits and each token to find the most likely label.
+
+Ready to try your hand at token classification? Check out our complete [token classification guide](tasks/token_classification) to learn how to finetune DistilBERT and use it for inference!
+
+### Question answering
+
+To use BERT for question answering, add a span classification head on top of the base BERT model. This linear layer accepts the final hidden states and performs a linear transformation to compute the `span` start and end logits corresponding to the answer. The cross-entropy loss is calculated between the logits and the label position to find the most likely span of text corresponding to the answer.
+
+Ready to try your hand at question answering? Check out our complete [question answering guide](tasks/question_answering) to learn how to finetune DistilBERT and use it for inference!
+
+
+
+๐ก Notice how easy it is to use BERT for different tasks once it's been pretrained. You only need to add a specific head to the pretrained model to manipulate the hidden states into your desired output!
+
+
+
+### Text generation
+
+[GPT-2](model_doc/gpt2) is a decoder-only model pretrained on a large amount of text. It can generate convincing (though not always true!) text given a prompt and complete other NLP tasks like question answering despite not being explicitly trained to.
+
+
+
+
+
+1. GPT-2 uses [byte pair encoding (BPE)](tokenizer_summary#bytepair-encoding-bpe) to tokenize words and generate a token embedding. Positional encodings are added to the token embeddings to indicate the position of each token in the sequence. The input embeddings are passed through multiple decoder blocks to output some final hidden state. Within each decoder block, GPT-2 uses a *masked self-attention* layer which means GPT-2 can't attend to future tokens. It is only allowed to attend to tokens on the left. This is different from BERT's [`mask`] token because, in masked self-attention, an attention mask is used to set the score to `0` for future tokens.
+
+2. The output from the decoder is passed to a language modeling head, which performs a linear transformation to convert the hidden states into logits. The label is the next token in the sequence, which are created by shifting the logits to the right by one. The cross-entropy loss is calculated between the shifted logits and the labels to output the next most likely token.
+
+GPT-2's pretraining objective is based entirely on [causal language modeling](glossary#causal-language-modeling), predicting the next word in a sequence. This makes GPT-2 especially good at tasks that involve generating text.
+
+Ready to try your hand at text generation? Check out our complete [causal language modeling guide](tasks/language_modeling#causal-language-modeling) to learn how to finetune DistilGPT-2 and use it for inference!
+
+
+
+For more information about text generation, check out the [text generation strategies](generation_strategies) guide!
+
+
+
+### Summarization
+
+Encoder-decoder models like [BART](model_doc/bart) and [T5](model_doc/t5) are designed for the sequence-to-sequence pattern of a summarization task. We'll explain how BART works in this section, and then you can try finetuning T5 at the end.
+
+
+
+
+
+1. BART's encoder architecture is very similar to BERT and accepts a token and positional embedding of the text. BART is pretrained by corrupting the input and then reconstructing it with the decoder. Unlike other encoders with specific corruption strategies, BART can apply any type of corruption. The *text infilling* corruption strategy works the best though. In text infilling, a number of text spans are replaced with a **single** [`mask`] token. This is important because the model has to predict the masked tokens, and it teaches the model to predict the number of missing tokens. The input embeddings and masked spans are passed through the encoder to output some final hidden states, but unlike BERT, BART doesn't add a final feedforward network at the end to predict a word.
+
+2. The encoder's output is passed to the decoder, which must predict the masked tokens and any uncorrupted tokens from the encoder's output. This gives additional context to help the decoder restore the original text. The output from the decoder is passed to a language modeling head, which performs a linear transformation to convert the hidden states into logits. The cross-entropy loss is calculated between the logits and the label, which is just the token shifted to the right.
+
+Ready to try your hand at summarization? Check out our complete [summarization guide](tasks/summarization) to learn how to finetune T5 and use it for inference!
+
+
+
+For more information about text generation, check out the [text generation strategies](generation_strategies) guide!
+
+
+
+### Translation
+
+Translation is another example of a sequence-to-sequence task, which means you can use an encoder-decoder model like [BART](model_doc/bart) or [T5](model_doc/t5) to do it. We'll explain how BART works in this section, and then you can try finetuning T5 at the end.
+
+BART adapts to translation by adding a separate randomly initialized encoder to map a source language to an input that can be decoded into the target language. This new encoder's embeddings are passed to the pretrained encoder instead of the original word embeddings. The source encoder is trained by updating the source encoder, positional embeddings, and input embeddings with the cross-entropy loss from the model output. The model parameters are frozen in this first step, and all the model parameters are trained together in the second step.
+
+BART has since been followed up by a multilingual version, mBART, intended for translation and pretrained on many different languages.
+
+Ready to try your hand at translation? Check out our complete [translation guide](tasks/translation) to learn how to finetune T5 and use it for inference!
+
+
+
+For more information about text generation, check out the [text generation strategies](generation_strategies) guide!
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/testing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/testing.md
new file mode 100644
index 0000000000000000000000000000000000000000..9e85f2248e16fc9b7498c47ce62c2586ca8d0d23
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/testing.md
@@ -0,0 +1,1333 @@
+
+
+# Testing
+
+
+Let's take a look at how ๐ค Transformers models are tested and how you can write new tests and improve the existing ones.
+
+There are 2 test suites in the repository:
+
+1. `tests` -- tests for the general API
+2. `examples` -- tests primarily for various applications that aren't part of the API
+
+## How transformers are tested
+
+1. Once a PR is submitted it gets tested with 9 CircleCi jobs. Every new commit to that PR gets retested. These jobs
+ are defined in this [config file](https://github.com/huggingface/transformers/tree/main/.circleci/config.yml), so that if needed you can reproduce the same
+ environment on your machine.
+
+ These CI jobs don't run `@slow` tests.
+
+2. There are 3 jobs run by [github actions](https://github.com/huggingface/transformers/actions):
+
+ - [torch hub integration](https://github.com/huggingface/transformers/tree/main/.github/workflows/github-torch-hub.yml): checks whether torch hub
+ integration works.
+
+ - [self-hosted (push)](https://github.com/huggingface/transformers/tree/main/.github/workflows/self-push.yml): runs fast tests on GPU only on commits on
+ `main`. It only runs if a commit on `main` has updated the code in one of the following folders: `src`,
+ `tests`, `.github` (to prevent running on added model cards, notebooks, etc.)
+
+ - [self-hosted runner](https://github.com/huggingface/transformers/tree/main/.github/workflows/self-scheduled.yml): runs normal and slow tests on GPU in
+ `tests` and `examples`:
+
+```bash
+RUN_SLOW=1 pytest tests/
+RUN_SLOW=1 pytest examples/
+```
+
+ The results can be observed [here](https://github.com/huggingface/transformers/actions).
+
+
+
+## Running tests
+
+
+
+### Choosing which tests to run
+
+This document goes into many details of how tests can be run. If after reading everything, you need even more details
+you will find them [here](https://docs.pytest.org/en/latest/usage.html).
+
+Here are some most useful ways of running tests.
+
+Run all:
+
+```console
+pytest
+```
+
+or:
+
+```bash
+make test
+```
+
+Note that the latter is defined as:
+
+```bash
+python -m pytest -n auto --dist=loadfile -s -v ./tests/
+```
+
+which tells pytest to:
+
+- run as many test processes as they are CPU cores (which could be too many if you don't have a ton of RAM!)
+- ensure that all tests from the same file will be run by the same test process
+- do not capture output
+- run in verbose mode
+
+
+
+### Getting the list of all tests
+
+All tests of the test suite:
+
+```bash
+pytest --collect-only -q
+```
+
+All tests of a given test file:
+
+```bash
+pytest tests/test_optimization.py --collect-only -q
+```
+
+### Run a specific test module
+
+To run an individual test module:
+
+```bash
+pytest tests/utils/test_logging.py
+```
+
+### Run specific tests
+
+Since unittest is used inside most of the tests, to run specific subtests you need to know the name of the unittest
+class containing those tests. For example, it could be:
+
+```bash
+pytest tests/test_optimization.py::OptimizationTest::test_adam_w
+```
+
+Here:
+
+- `tests/test_optimization.py` - the file with tests
+- `OptimizationTest` - the name of the class
+- `test_adam_w` - the name of the specific test function
+
+If the file contains multiple classes, you can choose to run only tests of a given class. For example:
+
+```bash
+pytest tests/test_optimization.py::OptimizationTest
+```
+
+will run all the tests inside that class.
+
+As mentioned earlier you can see what tests are contained inside the `OptimizationTest` class by running:
+
+```bash
+pytest tests/test_optimization.py::OptimizationTest --collect-only -q
+```
+
+You can run tests by keyword expressions.
+
+To run only tests whose name contains `adam`:
+
+```bash
+pytest -k adam tests/test_optimization.py
+```
+
+Logical `and` and `or` can be used to indicate whether all keywords should match or either. `not` can be used to
+negate.
+
+To run all tests except those whose name contains `adam`:
+
+```bash
+pytest -k "not adam" tests/test_optimization.py
+```
+
+And you can combine the two patterns in one:
+
+```bash
+pytest -k "ada and not adam" tests/test_optimization.py
+```
+
+For example to run both `test_adafactor` and `test_adam_w` you can use:
+
+```bash
+pytest -k "test_adafactor or test_adam_w" tests/test_optimization.py
+```
+
+Note that we use `or` here, since we want either of the keywords to match to include both.
+
+If you want to include only tests that include both patterns, `and` is to be used:
+
+```bash
+pytest -k "test and ada" tests/test_optimization.py
+```
+
+### Run `accelerate` tests
+
+Sometimes you need to run `accelerate` tests on your models. For that you can just add `-m accelerate_tests` to your command, if let's say you want to run these tests on `OPT` run:
+
+```bash
+RUN_SLOW=1 pytest -m accelerate_tests tests/models/opt/test_modeling_opt.py
+```
+
+
+### Run documentation tests
+
+In order to test whether the documentation examples are correct, you should check that the `doctests` are passing.
+As an example, let's use [`WhisperModel.forward`'s docstring](https://github.com/huggingface/transformers/blob/1124d95dbb1a3512d3e80791d73d0f541d1d7e9f/src/transformers/models/whisper/modeling_whisper.py#L1591-L1609)
+
+```python
+r"""
+Returns:
+
+Example:
+ ```python
+ >>> import torch
+ >>> from transformers import WhisperModel, WhisperFeatureExtractor
+ >>> from datasets import load_dataset
+
+ >>> model = WhisperModel.from_pretrained("openai/whisper-base")
+ >>> feature_extractor = WhisperFeatureExtractor.from_pretrained("openai/whisper-base")
+ >>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
+ >>> inputs = feature_extractor(ds[0]["audio"]["array"], return_tensors="pt")
+ >>> input_features = inputs.input_features
+ >>> decoder_input_ids = torch.tensor([[1, 1]]) * model.config.decoder_start_token_id
+ >>> last_hidden_state = model(input_features, decoder_input_ids=decoder_input_ids).last_hidden_state
+ >>> list(last_hidden_state.shape)
+ [1, 2, 512]
+ ```"""
+
+```
+
+Just run the following line to automatically test every docstring example in the desired file:
+```bash
+pytest --doctest-modules
+```
+If the file has a markdown extention, you should add the `--doctest-glob="*.md"` argument.
+
+### Run only modified tests
+
+You can run the tests related to the unstaged files or the current branch (according to Git) by using [pytest-picked](https://github.com/anapaulagomes/pytest-picked). This is a great way of quickly testing your changes didn't break
+anything, since it won't run the tests related to files you didn't touch.
+
+```bash
+pip install pytest-picked
+```
+
+```bash
+pytest --picked
+```
+
+All tests will be run from files and folders which are modified, but not yet committed.
+
+### Automatically rerun failed tests on source modification
+
+[pytest-xdist](https://github.com/pytest-dev/pytest-xdist) provides a very useful feature of detecting all failed
+tests, and then waiting for you to modify files and continuously re-rerun those failing tests until they pass while you
+fix them. So that you don't need to re start pytest after you made the fix. This is repeated until all tests pass after
+which again a full run is performed.
+
+```bash
+pip install pytest-xdist
+```
+
+To enter the mode: `pytest -f` or `pytest --looponfail`
+
+File changes are detected by looking at `looponfailroots` root directories and all of their contents (recursively).
+If the default for this value does not work for you, you can change it in your project by setting a configuration
+option in `setup.cfg`:
+
+```ini
+[tool:pytest]
+looponfailroots = transformers tests
+```
+
+or `pytest.ini`/``tox.ini`` files:
+
+```ini
+[pytest]
+looponfailroots = transformers tests
+```
+
+This would lead to only looking for file changes in the respective directories, specified relatively to the ini-fileโs
+directory.
+
+[pytest-watch](https://github.com/joeyespo/pytest-watch) is an alternative implementation of this functionality.
+
+
+### Skip a test module
+
+If you want to run all test modules, except a few you can exclude them by giving an explicit list of tests to run. For
+example, to run all except `test_modeling_*.py` tests:
+
+```bash
+pytest *ls -1 tests/*py | grep -v test_modeling*
+```
+
+### Clearing state
+
+CI builds and when isolation is important (against speed), cache should be cleared:
+
+```bash
+pytest --cache-clear tests
+```
+
+### Running tests in parallel
+
+As mentioned earlier `make test` runs tests in parallel via `pytest-xdist` plugin (`-n X` argument, e.g. `-n 2`
+to run 2 parallel jobs).
+
+`pytest-xdist`'s `--dist=` option allows one to control how the tests are grouped. `--dist=loadfile` puts the
+tests located in one file onto the same process.
+
+Since the order of executed tests is different and unpredictable, if running the test suite with `pytest-xdist`
+produces failures (meaning we have some undetected coupled tests), use [pytest-replay](https://github.com/ESSS/pytest-replay) to replay the tests in the same order, which should help with then somehow
+reducing that failing sequence to a minimum.
+
+### Test order and repetition
+
+It's good to repeat the tests several times, in sequence, randomly, or in sets, to detect any potential
+inter-dependency and state-related bugs (tear down). And the straightforward multiple repetition is just good to detect
+some problems that get uncovered by randomness of DL.
+
+
+#### Repeat tests
+
+- [pytest-flakefinder](https://github.com/dropbox/pytest-flakefinder):
+
+```bash
+pip install pytest-flakefinder
+```
+
+And then run every test multiple times (50 by default):
+
+```bash
+pytest --flake-finder --flake-runs=5 tests/test_failing_test.py
+```
+
+
+
+This plugin doesn't work with `-n` flag from `pytest-xdist`.
+
+
+
+
+
+There is another plugin `pytest-repeat`, but it doesn't work with `unittest`.
+
+
+
+#### Run tests in a random order
+
+```bash
+pip install pytest-random-order
+```
+
+Important: the presence of `pytest-random-order` will automatically randomize tests, no configuration change or
+command line options is required.
+
+As explained earlier this allows detection of coupled tests - where one test's state affects the state of another. When
+`pytest-random-order` is installed it will print the random seed it used for that session, e.g:
+
+```bash
+pytest tests
+[...]
+Using --random-order-bucket=module
+Using --random-order-seed=573663
+```
+
+So that if the given particular sequence fails, you can reproduce it by adding that exact seed, e.g.:
+
+```bash
+pytest --random-order-seed=573663
+[...]
+Using --random-order-bucket=module
+Using --random-order-seed=573663
+```
+
+It will only reproduce the exact order if you use the exact same list of tests (or no list at all). Once you start to
+manually narrowing down the list you can no longer rely on the seed, but have to list them manually in the exact order
+they failed and tell pytest to not randomize them instead using `--random-order-bucket=none`, e.g.:
+
+```bash
+pytest --random-order-bucket=none tests/test_a.py tests/test_c.py tests/test_b.py
+```
+
+To disable the shuffling for all tests:
+
+```bash
+pytest --random-order-bucket=none
+```
+
+By default `--random-order-bucket=module` is implied, which will shuffle the files on the module levels. It can also
+shuffle on `class`, `package`, `global` and `none` levels. For the complete details please see its
+[documentation](https://github.com/jbasko/pytest-random-order).
+
+Another randomization alternative is: [`pytest-randomly`](https://github.com/pytest-dev/pytest-randomly). This
+module has a very similar functionality/interface, but it doesn't have the bucket modes available in
+`pytest-random-order`. It has the same problem of imposing itself once installed.
+
+### Look and feel variations
+
+#### pytest-sugar
+
+[pytest-sugar](https://github.com/Frozenball/pytest-sugar) is a plugin that improves the look-n-feel, adds a
+progressbar, and show tests that fail and the assert instantly. It gets activated automatically upon installation.
+
+```bash
+pip install pytest-sugar
+```
+
+To run tests without it, run:
+
+```bash
+pytest -p no:sugar
+```
+
+or uninstall it.
+
+
+
+#### Report each sub-test name and its progress
+
+For a single or a group of tests via `pytest` (after `pip install pytest-pspec`):
+
+```bash
+pytest --pspec tests/test_optimization.py
+```
+
+#### Instantly shows failed tests
+
+[pytest-instafail](https://github.com/pytest-dev/pytest-instafail) shows failures and errors instantly instead of
+waiting until the end of test session.
+
+```bash
+pip install pytest-instafail
+```
+
+```bash
+pytest --instafail
+```
+
+### To GPU or not to GPU
+
+On a GPU-enabled setup, to test in CPU-only mode add `CUDA_VISIBLE_DEVICES=""` for CUDA GPUs:
+
+```bash
+CUDA_VISIBLE_DEVICES="" pytest tests/utils/test_logging.py
+```
+
+or if you have multiple gpus, you can specify which one is to be used by `pytest`. For example, to use only the
+second gpu if you have gpus `0` and `1`, you can run:
+
+```bash
+CUDA_VISIBLE_DEVICES="1" pytest tests/utils/test_logging.py
+```
+
+For Intel GPUs, use `ZE_AFFINITY_MASK` instead of `CUDA_VISIBLE_DEVICES` in the above example.
+
+This is handy when you want to run different tasks on different GPUs.
+
+Some tests must be run on CPU-only, others on either CPU or GPU or TPU, yet others on multiple-GPUs. The following skip
+decorators are used to set the requirements of tests CPU/GPU/XPU/TPU-wise:
+
+- `require_torch` - this test will run only under torch
+- `require_torch_gpu` - as `require_torch` plus requires at least 1 GPU
+- `require_torch_multi_gpu` - as `require_torch` plus requires at least 2 GPUs
+- `require_torch_non_multi_gpu` - as `require_torch` plus requires 0 or 1 GPUs
+- `require_torch_up_to_2_gpus` - as `require_torch` plus requires 0 or 1 or 2 GPUs
+- `require_torch_xla` - as `require_torch` plus requires at least 1 TPU
+
+Let's depict the GPU requirements in the following table:
+
+
+| n gpus | decorator |
+|--------|--------------------------------|
+| `>= 0` | `@require_torch` |
+| `>= 1` | `@require_torch_gpu` |
+| `>= 2` | `@require_torch_multi_gpu` |
+| `< 2` | `@require_torch_non_multi_gpu` |
+| `< 3` | `@require_torch_up_to_2_gpus` |
+
+
+For example, here is a test that must be run only when there are 2 or more GPUs available and pytorch is installed:
+
+```python no-style
+@require_torch_multi_gpu
+def test_example_with_multi_gpu():
+```
+
+If a test requires `tensorflow` use the `require_tf` decorator. For example:
+
+```python no-style
+@require_tf
+def test_tf_thing_with_tensorflow():
+```
+
+These decorators can be stacked. For example, if a test is slow and requires at least one GPU under pytorch, here is
+how to set it up:
+
+```python no-style
+@require_torch_gpu
+@slow
+def test_example_slow_on_gpu():
+```
+
+Some decorators like `@parametrized` rewrite test names, therefore `@require_*` skip decorators have to be listed
+last for them to work correctly. Here is an example of the correct usage:
+
+```python no-style
+@parameterized.expand(...)
+@require_torch_multi_gpu
+def test_integration_foo():
+```
+
+This order problem doesn't exist with `@pytest.mark.parametrize`, you can put it first or last and it will still
+work. But it only works with non-unittests.
+
+Inside tests:
+
+- How many GPUs are available:
+
+```python
+from transformers.testing_utils import get_gpu_count
+
+n_gpu = get_gpu_count() # works with torch and tf
+```
+
+### Testing with a specific PyTorch backend or device
+
+To run the test suite on a specific torch device add `TRANSFORMERS_TEST_DEVICE="$device"` where `$device` is the target backend. For example, to test on CPU only:
+
+```bash
+TRANSFORMERS_TEST_DEVICE="cpu" pytest tests/utils/test_logging.py
+```
+
+This variable is useful for testing custom or less common PyTorch backends such as `mps`, `xpu` or `npu`. It can also be used to achieve the same effect as `CUDA_VISIBLE_DEVICES` by targeting specific GPUs or testing in CPU-only mode.
+
+Certain devices will require an additional import after importing `torch` for the first time. This can be specified using the environment variable `TRANSFORMERS_TEST_BACKEND`:
+
+```bash
+TRANSFORMERS_TEST_BACKEND="torch_npu" pytest tests/utils/test_logging.py
+```
+Alternative backends may also require the replacement of device-specific functions. For example `torch.cuda.manual_seed` may need to be replaced with a device-specific seed setter like `torch.npu.manual_seed` or `torch.xpu.manual_seed` to correctly set a random seed on the device. To specify a new backend with backend-specific device functions when running the test suite, create a Python device specification file `spec.py` in the format:
+
+```python
+import torch
+import torch_npu # for xpu, replace it with `import intel_extension_for_pytorch`
+# !! Further additional imports can be added here !!
+
+# Specify the device name (eg. 'cuda', 'cpu', 'npu', 'xpu', 'mps')
+DEVICE_NAME = 'npu'
+
+# Specify device-specific backends to dispatch to.
+# If not specified, will fallback to 'default' in 'testing_utils.py`
+MANUAL_SEED_FN = torch.npu.manual_seed
+EMPTY_CACHE_FN = torch.npu.empty_cache
+DEVICE_COUNT_FN = torch.npu.device_count
+```
+This format also allows for specification of any additional imports required. To use this file to replace equivalent methods in the test suite, set the environment variable `TRANSFORMERS_TEST_DEVICE_SPEC` to the path of the spec file, e.g. `TRANSFORMERS_TEST_DEVICE_SPEC=spec.py`.
+
+Currently, only `MANUAL_SEED_FN`, `EMPTY_CACHE_FN` and `DEVICE_COUNT_FN` are supported for device-specific dispatch.
+
+### Distributed training
+
+`pytest` can't deal with distributed training directly. If this is attempted - the sub-processes don't do the right
+thing and end up thinking they are `pytest` and start running the test suite in loops. It works, however, if one
+spawns a normal process that then spawns off multiple workers and manages the IO pipes.
+
+Here are some tests that use it:
+
+- [test_trainer_distributed.py](https://github.com/huggingface/transformers/tree/main/tests/trainer/test_trainer_distributed.py)
+- [test_deepspeed.py](https://github.com/huggingface/transformers/tree/main/tests/deepspeed/test_deepspeed.py)
+
+To jump right into the execution point, search for the `execute_subprocess_async` call in those tests.
+
+You will need at least 2 GPUs to see these tests in action:
+
+```bash
+CUDA_VISIBLE_DEVICES=0,1 RUN_SLOW=1 pytest -sv tests/test_trainer_distributed.py
+```
+
+### Output capture
+
+During test execution any output sent to `stdout` and `stderr` is captured. If a test or a setup method fails, its
+according captured output will usually be shown along with the failure traceback.
+
+To disable output capturing and to get the `stdout` and `stderr` normally, use `-s` or `--capture=no`:
+
+```bash
+pytest -s tests/utils/test_logging.py
+```
+
+To send test results to JUnit format output:
+
+```bash
+pytest tests --junitxml=result.xml
+```
+
+### Color control
+
+To have no color (e.g., yellow on white background is not readable):
+
+```bash
+pytest --color=no tests/utils/test_logging.py
+```
+
+### Sending test report to online pastebin service
+
+Creating a URL for each test failure:
+
+```bash
+pytest --pastebin=failed tests/utils/test_logging.py
+```
+
+This will submit test run information to a remote Paste service and provide a URL for each failure. You may select
+tests as usual or add for example -x if you only want to send one particular failure.
+
+Creating a URL for a whole test session log:
+
+```bash
+pytest --pastebin=all tests/utils/test_logging.py
+```
+
+## Writing tests
+
+๐ค transformers tests are based on `unittest`, but run by `pytest`, so most of the time features from both systems
+can be used.
+
+You can read [here](https://docs.pytest.org/en/stable/unittest.html) which features are supported, but the important
+thing to remember is that most `pytest` fixtures don't work. Neither parametrization, but we use the module
+`parameterized` that works in a similar way.
+
+
+### Parametrization
+
+Often, there is a need to run the same test multiple times, but with different arguments. It could be done from within
+the test, but then there is no way of running that test for just one set of arguments.
+
+```python
+# test_this1.py
+import unittest
+from parameterized import parameterized
+
+
+class TestMathUnitTest(unittest.TestCase):
+ @parameterized.expand(
+ [
+ ("negative", -1.5, -2.0),
+ ("integer", 1, 1.0),
+ ("large fraction", 1.6, 1),
+ ]
+ )
+ def test_floor(self, name, input, expected):
+ assert_equal(math.floor(input), expected)
+```
+
+Now, by default this test will be run 3 times, each time with the last 3 arguments of `test_floor` being assigned the
+corresponding arguments in the parameter list.
+
+and you could run just the `negative` and `integer` sets of params with:
+
+```bash
+pytest -k "negative and integer" tests/test_mytest.py
+```
+
+or all but `negative` sub-tests, with:
+
+```bash
+pytest -k "not negative" tests/test_mytest.py
+```
+
+Besides using the `-k` filter that was just mentioned, you can find out the exact name of each sub-test and run any
+or all of them using their exact names.
+
+```bash
+pytest test_this1.py --collect-only -q
+```
+
+and it will list:
+
+```bash
+test_this1.py::TestMathUnitTest::test_floor_0_negative
+test_this1.py::TestMathUnitTest::test_floor_1_integer
+test_this1.py::TestMathUnitTest::test_floor_2_large_fraction
+```
+
+So now you can run just 2 specific sub-tests:
+
+```bash
+pytest test_this1.py::TestMathUnitTest::test_floor_0_negative test_this1.py::TestMathUnitTest::test_floor_1_integer
+```
+
+The module [parameterized](https://pypi.org/project/parameterized/) which is already in the developer dependencies
+of `transformers` works for both: `unittests` and `pytest` tests.
+
+If, however, the test is not a `unittest`, you may use `pytest.mark.parametrize` (or you may see it being used in
+some existing tests, mostly under `examples`).
+
+Here is the same example, this time using `pytest`'s `parametrize` marker:
+
+```python
+# test_this2.py
+import pytest
+
+
+@pytest.mark.parametrize(
+ "name, input, expected",
+ [
+ ("negative", -1.5, -2.0),
+ ("integer", 1, 1.0),
+ ("large fraction", 1.6, 1),
+ ],
+)
+def test_floor(name, input, expected):
+ assert_equal(math.floor(input), expected)
+```
+
+Same as with `parameterized`, with `pytest.mark.parametrize` you can have a fine control over which sub-tests are
+run, if the `-k` filter doesn't do the job. Except, this parametrization function creates a slightly different set of
+names for the sub-tests. Here is what they look like:
+
+```bash
+pytest test_this2.py --collect-only -q
+```
+
+and it will list:
+
+```bash
+test_this2.py::test_floor[integer-1-1.0]
+test_this2.py::test_floor[negative--1.5--2.0]
+test_this2.py::test_floor[large fraction-1.6-1]
+```
+
+So now you can run just the specific test:
+
+```bash
+pytest test_this2.py::test_floor[negative--1.5--2.0] test_this2.py::test_floor[integer-1-1.0]
+```
+
+as in the previous example.
+
+
+
+### Files and directories
+
+In tests often we need to know where things are relative to the current test file, and it's not trivial since the test
+could be invoked from more than one directory or could reside in sub-directories with different depths. A helper class
+`transformers.test_utils.TestCasePlus` solves this problem by sorting out all the basic paths and provides easy
+accessors to them:
+
+- `pathlib` objects (all fully resolved):
+
+ - `test_file_path` - the current test file path, i.e. `__file__`
+ - `test_file_dir` - the directory containing the current test file
+ - `tests_dir` - the directory of the `tests` test suite
+ - `examples_dir` - the directory of the `examples` test suite
+ - `repo_root_dir` - the directory of the repository
+ - `src_dir` - the directory of `src` (i.e. where the `transformers` sub-dir resides)
+
+- stringified paths---same as above but these return paths as strings, rather than `pathlib` objects:
+
+ - `test_file_path_str`
+ - `test_file_dir_str`
+ - `tests_dir_str`
+ - `examples_dir_str`
+ - `repo_root_dir_str`
+ - `src_dir_str`
+
+To start using those all you need is to make sure that the test resides in a subclass of
+`transformers.test_utils.TestCasePlus`. For example:
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class PathExampleTest(TestCasePlus):
+ def test_something_involving_local_locations(self):
+ data_dir = self.tests_dir / "fixtures/tests_samples/wmt_en_ro"
+```
+
+If you don't need to manipulate paths via `pathlib` or you just need a path as a string, you can always invoked
+`str()` on the `pathlib` object or use the accessors ending with `_str`. For example:
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class PathExampleTest(TestCasePlus):
+ def test_something_involving_stringified_locations(self):
+ examples_dir = self.examples_dir_str
+```
+
+### Temporary files and directories
+
+Using unique temporary files and directories are essential for parallel test running, so that the tests won't overwrite
+each other's data. Also we want to get the temporary files and directories removed at the end of each test that created
+them. Therefore, using packages like `tempfile`, which address these needs is essential.
+
+However, when debugging tests, you need to be able to see what goes into the temporary file or directory and you want
+to know it's exact path and not having it randomized on every test re-run.
+
+A helper class `transformers.test_utils.TestCasePlus` is best used for such purposes. It's a sub-class of
+`unittest.TestCase`, so we can easily inherit from it in the test modules.
+
+Here is an example of its usage:
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class ExamplesTests(TestCasePlus):
+ def test_whatever(self):
+ tmp_dir = self.get_auto_remove_tmp_dir()
+```
+
+This code creates a unique temporary directory, and sets `tmp_dir` to its location.
+
+- Create a unique temporary dir:
+
+```python
+def test_whatever(self):
+ tmp_dir = self.get_auto_remove_tmp_dir()
+```
+
+`tmp_dir` will contain the path to the created temporary dir. It will be automatically removed at the end of the
+test.
+
+- Create a temporary dir of my choice, ensure it's empty before the test starts and don't empty it after the test.
+
+```python
+def test_whatever(self):
+ tmp_dir = self.get_auto_remove_tmp_dir("./xxx")
+```
+
+This is useful for debug when you want to monitor a specific directory and want to make sure the previous tests didn't
+leave any data in there.
+
+- You can override the default behavior by directly overriding the `before` and `after` args, leading to one of the
+ following behaviors:
+
+ - `before=True`: the temporary dir will always be cleared at the beginning of the test.
+ - `before=False`: if the temporary dir already existed, any existing files will remain there.
+ - `after=True`: the temporary dir will always be deleted at the end of the test.
+ - `after=False`: the temporary dir will always be left intact at the end of the test.
+
+
+
+In order to run the equivalent of `rm -r` safely, only subdirs of the project repository checkout are allowed if
+an explicit `tmp_dir` is used, so that by mistake no `/tmp` or similar important part of the filesystem will
+get nuked. i.e. please always pass paths that start with `./`.
+
+
+
+
+
+Each test can register multiple temporary directories and they all will get auto-removed, unless requested
+otherwise.
+
+
+
+### Temporary sys.path override
+
+If you need to temporary override `sys.path` to import from another test for example, you can use the
+`ExtendSysPath` context manager. Example:
+
+
+```python
+import os
+from transformers.testing_utils import ExtendSysPath
+
+bindir = os.path.abspath(os.path.dirname(__file__))
+with ExtendSysPath(f"{bindir}/.."):
+ from test_trainer import TrainerIntegrationCommon # noqa
+```
+
+### Skipping tests
+
+This is useful when a bug is found and a new test is written, yet the bug is not fixed yet. In order to be able to
+commit it to the main repository we need make sure it's skipped during `make test`.
+
+Methods:
+
+- A **skip** means that you expect your test to pass only if some conditions are met, otherwise pytest should skip
+ running the test altogether. Common examples are skipping windows-only tests on non-windows platforms, or skipping
+ tests that depend on an external resource which is not available at the moment (for example a database).
+
+- A **xfail** means that you expect a test to fail for some reason. A common example is a test for a feature not yet
+ implemented, or a bug not yet fixed. When a test passes despite being expected to fail (marked with
+ pytest.mark.xfail), itโs an xpass and will be reported in the test summary.
+
+One of the important differences between the two is that `skip` doesn't run the test, and `xfail` does. So if the
+code that's buggy causes some bad state that will affect other tests, do not use `xfail`.
+
+#### Implementation
+
+- Here is how to skip whole test unconditionally:
+
+```python no-style
+@unittest.skip(reason="this bug needs to be fixed")
+def test_feature_x():
+```
+
+or via pytest:
+
+```python no-style
+@pytest.mark.skip(reason="this bug needs to be fixed")
+```
+
+or the `xfail` way:
+
+```python no-style
+@pytest.mark.xfail
+def test_feature_x():
+```
+
+
+Here's how to skip a test based on internal checks within the test:
+
+```python
+def test_feature_x():
+ if not has_something():
+ pytest.skip("unsupported configuration")
+```
+
+or the whole module:
+
+```python
+import pytest
+
+if not pytest.config.getoption("--custom-flag"):
+ pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True)
+```
+
+or the `xfail` way:
+
+```python
+def test_feature_x():
+ pytest.xfail("expected to fail until bug XYZ is fixed")
+```
+
+- Here is how to skip all tests in a module if some import is missing:
+
+```python
+docutils = pytest.importorskip("docutils", minversion="0.3")
+```
+
+- Skip a test based on a condition:
+
+```python no-style
+@pytest.mark.skipif(sys.version_info < (3,6), reason="requires python3.6 or higher")
+def test_feature_x():
+```
+
+or:
+
+```python no-style
+@unittest.skipIf(torch_device == "cpu", "Can't do half precision")
+def test_feature_x():
+```
+
+or skip the whole module:
+
+```python no-style
+@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
+class TestClass():
+ def test_feature_x(self):
+```
+
+More details, example and ways are [here](https://docs.pytest.org/en/latest/skipping.html).
+
+### Slow tests
+
+The library of tests is ever-growing, and some of the tests take minutes to run, therefore we can't afford waiting for
+an hour for the test suite to complete on CI. Therefore, with some exceptions for essential tests, slow tests should be
+marked as in the example below:
+
+```python no-style
+from transformers.testing_utils import slow
+@slow
+def test_integration_foo():
+```
+
+Once a test is marked as `@slow`, to run such tests set `RUN_SLOW=1` env var, e.g.:
+
+```bash
+RUN_SLOW=1 pytest tests
+```
+
+Some decorators like `@parameterized` rewrite test names, therefore `@slow` and the rest of the skip decorators
+`@require_*` have to be listed last for them to work correctly. Here is an example of the correct usage:
+
+```python no-style
+@parameterized.expand(...)
+@slow
+def test_integration_foo():
+```
+
+As explained at the beginning of this document, slow tests get to run on a scheduled basis, rather than in PRs CI
+checks. So it's possible that some problems will be missed during a PR submission and get merged. Such problems will
+get caught during the next scheduled CI job. But it also means that it's important to run the slow tests on your
+machine before submitting the PR.
+
+Here is a rough decision making mechanism for choosing which tests should be marked as slow:
+
+If the test is focused on one of the library's internal components (e.g., modeling files, tokenization files,
+pipelines), then we should run that test in the non-slow test suite. If it's focused on an other aspect of the library,
+such as the documentation or the examples, then we should run these tests in the slow test suite. And then, to refine
+this approach we should have exceptions:
+
+- All tests that need to download a heavy set of weights or a dataset that is larger than ~50MB (e.g., model or
+ tokenizer integration tests, pipeline integration tests) should be set to slow. If you're adding a new model, you
+ should create and upload to the hub a tiny version of it (with random weights) for integration tests. This is
+ discussed in the following paragraphs.
+- All tests that need to do a training not specifically optimized to be fast should be set to slow.
+- We can introduce exceptions if some of these should-be-non-slow tests are excruciatingly slow, and set them to
+ `@slow`. Auto-modeling tests, which save and load large files to disk, are a good example of tests that are marked
+ as `@slow`.
+- If a test completes under 1 second on CI (including downloads if any) then it should be a normal test regardless.
+
+Collectively, all the non-slow tests need to cover entirely the different internals, while remaining fast. For example,
+a significant coverage can be achieved by testing with specially created tiny models with random weights. Such models
+have the very minimal number of layers (e.g., 2), vocab size (e.g., 1000), etc. Then the `@slow` tests can use large
+slow models to do qualitative testing. To see the use of these simply look for *tiny* models with:
+
+```bash
+grep tiny tests examples
+```
+
+Here is an example of a [script](https://github.com/huggingface/transformers/tree/main/scripts/fsmt/fsmt-make-tiny-model.py) that created the tiny model
+[stas/tiny-wmt19-en-de](https://huggingface.co/stas/tiny-wmt19-en-de). You can easily adjust it to your specific
+model's architecture.
+
+It's easy to measure the run-time incorrectly if for example there is an overheard of downloading a huge model, but if
+you test it locally the downloaded files would be cached and thus the download time not measured. Hence check the
+execution speed report in CI logs instead (the output of `pytest --durations=0 tests`).
+
+That report is also useful to find slow outliers that aren't marked as such, or which need to be re-written to be fast.
+If you notice that the test suite starts getting slow on CI, the top listing of this report will show the slowest
+tests.
+
+
+### Testing the stdout/stderr output
+
+In order to test functions that write to `stdout` and/or `stderr`, the test can access those streams using the
+`pytest`'s [capsys system](https://docs.pytest.org/en/latest/capture.html). Here is how this is accomplished:
+
+```python
+import sys
+
+
+def print_to_stdout(s):
+ print(s)
+
+
+def print_to_stderr(s):
+ sys.stderr.write(s)
+
+
+def test_result_and_stdout(capsys):
+ msg = "Hello"
+ print_to_stdout(msg)
+ print_to_stderr(msg)
+ out, err = capsys.readouterr() # consume the captured output streams
+ # optional: if you want to replay the consumed streams:
+ sys.stdout.write(out)
+ sys.stderr.write(err)
+ # test:
+ assert msg in out
+ assert msg in err
+```
+
+And, of course, most of the time, `stderr` will come as a part of an exception, so try/except has to be used in such
+a case:
+
+```python
+def raise_exception(msg):
+ raise ValueError(msg)
+
+
+def test_something_exception():
+ msg = "Not a good value"
+ error = ""
+ try:
+ raise_exception(msg)
+ except Exception as e:
+ error = str(e)
+ assert msg in error, f"{msg} is in the exception:\n{error}"
+```
+
+Another approach to capturing stdout is via `contextlib.redirect_stdout`:
+
+```python
+from io import StringIO
+from contextlib import redirect_stdout
+
+
+def print_to_stdout(s):
+ print(s)
+
+
+def test_result_and_stdout():
+ msg = "Hello"
+ buffer = StringIO()
+ with redirect_stdout(buffer):
+ print_to_stdout(msg)
+ out = buffer.getvalue()
+ # optional: if you want to replay the consumed streams:
+ sys.stdout.write(out)
+ # test:
+ assert msg in out
+```
+
+An important potential issue with capturing stdout is that it may contain `\r` characters that in normal `print`
+reset everything that has been printed so far. There is no problem with `pytest`, but with `pytest -s` these
+characters get included in the buffer, so to be able to have the test run with and without `-s`, you have to make an
+extra cleanup to the captured output, using `re.sub(r'~.*\r', '', buf, 0, re.M)`.
+
+But, then we have a helper context manager wrapper to automatically take care of it all, regardless of whether it has
+some `\r`'s in it or not, so it's a simple:
+
+```python
+from transformers.testing_utils import CaptureStdout
+
+with CaptureStdout() as cs:
+ function_that_writes_to_stdout()
+print(cs.out)
+```
+
+Here is a full test example:
+
+```python
+from transformers.testing_utils import CaptureStdout
+
+msg = "Secret message\r"
+final = "Hello World"
+with CaptureStdout() as cs:
+ print(msg + final)
+assert cs.out == final + "\n", f"captured: {cs.out}, expecting {final}"
+```
+
+If you'd like to capture `stderr` use the `CaptureStderr` class instead:
+
+```python
+from transformers.testing_utils import CaptureStderr
+
+with CaptureStderr() as cs:
+ function_that_writes_to_stderr()
+print(cs.err)
+```
+
+If you need to capture both streams at once, use the parent `CaptureStd` class:
+
+```python
+from transformers.testing_utils import CaptureStd
+
+with CaptureStd() as cs:
+ function_that_writes_to_stdout_and_stderr()
+print(cs.err, cs.out)
+```
+
+Also, to aid debugging test issues, by default these context managers automatically replay the captured streams on exit
+from the context.
+
+
+### Capturing logger stream
+
+If you need to validate the output of a logger, you can use `CaptureLogger`:
+
+```python
+from transformers import logging
+from transformers.testing_utils import CaptureLogger
+
+msg = "Testing 1, 2, 3"
+logging.set_verbosity_info()
+logger = logging.get_logger("transformers.models.bart.tokenization_bart")
+with CaptureLogger(logger) as cl:
+ logger.info(msg)
+assert cl.out, msg + "\n"
+```
+
+### Testing with environment variables
+
+If you want to test the impact of environment variables for a specific test you can use a helper decorator
+`transformers.testing_utils.mockenv`
+
+```python
+from transformers.testing_utils import mockenv
+
+
+class HfArgumentParserTest(unittest.TestCase):
+ @mockenv(TRANSFORMERS_VERBOSITY="error")
+ def test_env_override(self):
+ env_level_str = os.getenv("TRANSFORMERS_VERBOSITY", None)
+```
+
+At times an external program needs to be called, which requires setting `PYTHONPATH` in `os.environ` to include
+multiple local paths. A helper class `transformers.test_utils.TestCasePlus` comes to help:
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class EnvExampleTest(TestCasePlus):
+ def test_external_prog(self):
+ env = self.get_env()
+ # now call the external program, passing `env` to it
+```
+
+Depending on whether the test file was under the `tests` test suite or `examples` it'll correctly set up
+`env[PYTHONPATH]` to include one of these two directories, and also the `src` directory to ensure the testing is
+done against the current repo, and finally with whatever `env[PYTHONPATH]` was already set to before the test was
+called if anything.
+
+This helper method creates a copy of the `os.environ` object, so the original remains intact.
+
+
+### Getting reproducible results
+
+In some situations you may want to remove randomness for your tests. To get identical reproducible results set, you
+will need to fix the seed:
+
+```python
+seed = 42
+
+# python RNG
+import random
+
+random.seed(seed)
+
+# pytorch RNGs
+import torch
+
+torch.manual_seed(seed)
+torch.backends.cudnn.deterministic = True
+if torch.cuda.is_available():
+ torch.cuda.manual_seed_all(seed)
+
+# numpy RNG
+import numpy as np
+
+np.random.seed(seed)
+
+# tf RNG
+import tensorflow as tf
+
+tf.random.set_seed(seed)
+```
+
+### Debugging tests
+
+To start a debugger at the point of the warning, do this:
+
+```bash
+pytest tests/utils/test_logging.py -W error::UserWarning --pdb
+```
+
+## Working with github actions workflows
+
+To trigger a self-push workflow CI job, you must:
+
+1. Create a new branch on `transformers` origin (not a fork!).
+2. The branch name has to start with either `ci_` or `ci-` (`main` triggers it too, but we can't do PRs on
+ `main`). It also gets triggered only for specific paths - you can find the up-to-date definition in case it
+ changed since this document has been written [here](https://github.com/huggingface/transformers/blob/main/.github/workflows/self-push.yml) under *push:*
+3. Create a PR from this branch.
+4. Then you can see the job appear [here](https://github.com/huggingface/transformers/actions/workflows/self-push.yml). It may not run right away if there
+ is a backlog.
+
+
+
+
+## Testing Experimental CI Features
+
+Testing CI features can be potentially problematic as it can interfere with the normal CI functioning. Therefore if a
+new CI feature is to be added, it should be done as following.
+
+1. Create a new dedicated job that tests what needs to be tested
+2. The new job must always succeed so that it gives us a green โ (details below).
+3. Let it run for some days to see that a variety of different PR types get to run on it (user fork branches,
+ non-forked branches, branches originating from github.com UI direct file edit, various forced pushes, etc. - there
+ are so many) while monitoring the experimental job's logs (not the overall job green as it's purposefully always
+ green)
+4. When it's clear that everything is solid, then merge the new changes into existing jobs.
+
+That way experiments on CI functionality itself won't interfere with the normal workflow.
+
+Now how can we make the job always succeed while the new CI feature is being developed?
+
+Some CIs, like TravisCI support ignore-step-failure and will report the overall job as successful, but CircleCI and
+Github Actions as of this writing don't support that.
+
+So the following workaround can be used:
+
+1. `set +euo pipefail` at the beginning of the run command to suppress most potential failures in the bash script.
+2. the last command must be a success: `echo "done"` or just `true` will do
+
+Here is an example:
+
+```yaml
+- run:
+ name: run CI experiment
+ command: |
+ set +euo pipefail
+ echo "setting run-all-despite-any-errors-mode"
+ this_command_will_fail
+ echo "but bash continues to run"
+ # emulate another failure
+ false
+ # but the last command must be a success
+ echo "during experiment do not remove: reporting success to CI, even if there were failures"
+```
+
+For simple commands you could also do:
+
+```bash
+cmd_that_may_fail || true
+```
+
+Of course, once satisfied with the results, integrate the experimental step or job with the rest of the normal jobs,
+while removing `set +euo pipefail` or any other things you may have added to ensure that the experimental job doesn't
+interfere with the normal CI functioning.
+
+This whole process would have been much easier if we only could set something like `allow-failure` for the
+experimental step, and let it fail without impacting the overall status of PRs. But as mentioned earlier CircleCI and
+Github Actions don't support it at the moment.
+
+You can vote for this feature and see where it is at these CI-specific threads:
+
+- [Github Actions:](https://github.com/actions/toolkit/issues/399)
+- [CircleCI:](https://ideas.circleci.com/ideas/CCI-I-344)
+
+## DeepSpeed integration
+
+For a PR that involves the DeepSpeed integration, keep in mind our CircleCI PR CI setup doesn't have GPUs. Tests requiring GPUs are run on a different CI nightly. This means if you get a passing CI report in your PR, it doesnโt mean the DeepSpeed tests pass.
+
+To run DeepSpeed tests:
+
+```bash
+RUN_SLOW=1 pytest tests/deepspeed/test_deepspeed.py
+```
+
+Any changes to the modeling or PyTorch examples code requires running the model zoo tests as well.
+
+```bash
+RUN_SLOW=1 pytest tests/deepspeed
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tf_xla.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tf_xla.md
new file mode 100644
index 0000000000000000000000000000000000000000..a585aec068b1f380f23428d401ceeb958970e2a6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tf_xla.md
@@ -0,0 +1,174 @@
+
+
+# XLA Integration for TensorFlow Models
+
+[[open-in-colab]]
+
+Accelerated Linear Algebra, dubbed XLA, is a compiler for accelerating the runtime of TensorFlow Models. From the [official documentation](https://www.tensorflow.org/xla):
+
+XLA (Accelerated Linear Algebra) is a domain-specific compiler for linear algebra that can accelerate TensorFlow models with potentially no source code changes.
+
+Using XLA in TensorFlow is simple โ it comes packaged inside the `tensorflow` library, and it can be triggered with the `jit_compile` argument in any graph-creating function such as [`tf.function`](https://www.tensorflow.org/guide/intro_to_graphs). When using Keras methods like `fit()` and `predict()`, you can enable XLA simply by passing the `jit_compile` argument to `model.compile()`. However, XLA is not limited to these methods - it can also be used to accelerate any arbitrary `tf.function`.
+
+Several TensorFlow methods in ๐ค Transformers have been rewritten to be XLA-compatible, including text generation for models such as [GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2), [T5](https://huggingface.co/docs/transformers/model_doc/t5) and [OPT](https://huggingface.co/docs/transformers/model_doc/opt), as well as speech processing for models such as [Whisper](https://huggingface.co/docs/transformers/model_doc/whisper).
+
+While the exact amount of speed-up is very much model-dependent, for TensorFlow text generation models inside ๐ค Transformers, we noticed a speed-up of ~100x. This document will explain how you can use XLA for these models to get the maximum amount of performance. Weโll also provide links to additional resources if youโre interested to learn more about the benchmarks and our design philosophy behind the XLA integration.
+
+## Running TF functions with XLA
+
+Let us consider the following model in TensorFlow:
+
+```py
+import tensorflow as tf
+
+model = tf.keras.Sequential(
+ [tf.keras.layers.Dense(10, input_shape=(10,), activation="relu"), tf.keras.layers.Dense(5, activation="softmax")]
+)
+```
+
+The above model accepts inputs having a dimension of `(10, )`. We can use the model for running a forward pass like so:
+
+```py
+# Generate random inputs for the model.
+batch_size = 16
+input_vector_dim = 10
+random_inputs = tf.random.normal((batch_size, input_vector_dim))
+
+# Run a forward pass.
+_ = model(random_inputs)
+```
+
+In order to run the forward pass with an XLA-compiled function, weโd need to do:
+
+```py
+xla_fn = tf.function(model, jit_compile=True)
+_ = xla_fn(random_inputs)
+```
+
+The default `call()` function of the `model` is used for compiling the XLA graph. But if thereโs any other model function you want to compile into XLA thatโs also possible with:
+
+```py
+my_xla_fn = tf.function(model.my_xla_fn, jit_compile=True)
+```
+
+## Running a TF text generation model with XLA from ๐ค Transformers
+
+To enable XLA-accelerated generation within ๐ค Transformers, you need to have a recent version of `transformers` installed. You can install it by running:
+
+```bash
+pip install transformers --upgrade
+```
+
+And then you can run the following code:
+
+```py
+import tensorflow as tf
+from transformers import AutoTokenizer, TFAutoModelForCausalLM
+
+# Will error if the minimal version of Transformers is not installed.
+from transformers.utils import check_min_version
+
+check_min_version("4.21.0")
+
+
+tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2", padding_side="left", pad_token="")
+model = TFAutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+input_string = ["TensorFlow is"]
+
+# One line to create an XLA generation function
+xla_generate = tf.function(model.generate, jit_compile=True)
+
+tokenized_input = tokenizer(input_string, return_tensors="tf")
+generated_tokens = xla_generate(**tokenized_input, num_beams=2)
+
+decoded_text = tokenizer.decode(generated_tokens[0], skip_special_tokens=True)
+print(f"Generated -- {decoded_text}")
+# Generated -- TensorFlow is an open-source, open-source, distributed-source application # framework for the
+```
+
+As you can notice, enabling XLA on `generate()` is just a single line of code. The rest of the code remains unchanged. However, there are a couple of gotchas in the above code snippet that are specific to XLA. You need to be aware of those to realize the speed-ups that XLA can bring in. We discuss these in the following section.
+
+## Gotchas to be aware of
+
+When you are executing an XLA-enabled function (like `xla_generate()` above) for the first time, it will internally try to infer the computation graph, which is time-consuming. This process is known as [โtracingโ](https://www.tensorflow.org/guide/intro_to_graphs#when_is_a_function_tracing).
+
+You might notice that the generation time is not fast. Successive calls of `xla_generate()` (or any other XLA-enabled function) wonโt have to infer the computation graph, given the inputs to the function follow the same shape with which the computation graph was initially built. While this is not a problem for modalities with fixed input shapes (e.g., images), you must pay attention if you are working with variable input shape modalities (e.g., text).
+
+To ensure `xla_generate()` always operates with the same input shapes, you can specify the `padding` arguments when calling the tokenizer.
+
+```py
+import tensorflow as tf
+from transformers import AutoTokenizer, TFAutoModelForCausalLM
+
+tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2", padding_side="left", pad_token="")
+model = TFAutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+input_string = ["TensorFlow is"]
+
+xla_generate = tf.function(model.generate, jit_compile=True)
+
+# Here, we call the tokenizer with padding options.
+tokenized_input = tokenizer(input_string, pad_to_multiple_of=8, padding=True, return_tensors="tf")
+
+generated_tokens = xla_generate(**tokenized_input, num_beams=2)
+decoded_text = tokenizer.decode(generated_tokens[0], skip_special_tokens=True)
+print(f"Generated -- {decoded_text}")
+```
+
+This way, you can ensure that the inputs to `xla_generate()` will always receive inputs with the shape it was traced with and thus leading to speed-ups in the generation time. You can verify this with the code below:
+
+```py
+import time
+import tensorflow as tf
+from transformers import AutoTokenizer, TFAutoModelForCausalLM
+
+tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2", padding_side="left", pad_token="")
+model = TFAutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+
+xla_generate = tf.function(model.generate, jit_compile=True)
+
+for input_string in ["TensorFlow is", "TensorFlow is a", "TFLite is a"]:
+ tokenized_input = tokenizer(input_string, pad_to_multiple_of=8, padding=True, return_tensors="tf")
+ start = time.time_ns()
+ generated_tokens = xla_generate(**tokenized_input, num_beams=2)
+ end = time.time_ns()
+ print(f"Execution time -- {(end - start) / 1e6:.1f} ms\n")
+```
+
+On a Tesla T4 GPU, you can expect the outputs like so:
+
+```bash
+Execution time -- 30819.6 ms
+
+Execution time -- 79.0 ms
+
+Execution time -- 78.9 ms
+```
+The first call to `xla_generate()` is time-consuming because of tracing, but the successive calls are orders of magnitude faster. Keep in mind that any change in the generation options at any point will trigger re-tracing and thus leading to slow-downs in the generation time.
+
+We didnโt cover all the text generation options ๐ค Transformers provides in this document. We encourage you to read the documentation for advanced use cases.
+
+## Additional Resources
+
+Here, we leave you with some additional resources if you want to delve deeper into XLA in ๐ค Transformers and in general.
+
+* [This Colab Notebook](https://colab.research.google.com/github/huggingface/blog/blob/main/notebooks/91_tf_xla_generate.ipynb) provides an interactive demonstration if you want to fiddle with the XLA-compatible encoder-decoder (like [T5](https://huggingface.co/docs/transformers/model_doc/t5)) and decoder-only (like [GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2)) text generation models.
+* [This blog post](https://huggingface.co/blog/tf-xla-generate) provides an overview of the comparison benchmarks for XLA-compatible models along with a friendly introduction to XLA in TensorFlow.
+* [This blog post](https://blog.tensorflow.org/2022/11/how-hugging-face-improved-text-generation-performance-with-xla.html) discusses our design philosophy behind adding XLA support to the TensorFlow models in ๐ค Transformers.
+* Recommended posts for learning more about XLA and TensorFlow graphs in general:
+ * [XLA: Optimizing Compiler for Machine Learning](https://www.tensorflow.org/xla)
+ * [Introduction to graphs and tf.function](https://www.tensorflow.org/guide/intro_to_graphs)
+ * [Better performance with tf.function](https://www.tensorflow.org/guide/function)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tflite.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tflite.md
new file mode 100644
index 0000000000000000000000000000000000000000..09434a81508d35e795b95b8704110df2039aac97
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tflite.md
@@ -0,0 +1,62 @@
+
+
+# Export to TFLite
+
+[TensorFlow Lite](https://www.tensorflow.org/lite/guide) is a lightweight framework for deploying machine learning models
+on resource-constrained devices, such as mobile phones, embedded systems, and Internet of Things (IoT) devices.
+TFLite is designed to optimize and run models efficiently on these devices with limited computational power, memory, and
+power consumption.
+A TensorFlow Lite model is represented in a special efficient portable format identified by the `.tflite` file extension.
+
+๐ค Optimum offers functionality to export ๐ค Transformers models to TFLite through the `exporters.tflite` module.
+For the list of supported model architectures, please refer to [๐ค Optimum documentation](https://huggingface.co/docs/optimum/exporters/tflite/overview).
+
+To export a model to TFLite, install the required dependencies:
+
+```bash
+pip install optimum[exporters-tf]
+```
+
+To check out all available arguments, refer to the [๐ค Optimum docs](https://huggingface.co/docs/optimum/main/en/exporters/tflite/usage_guides/export_a_model),
+or view help in command line:
+
+```bash
+optimum-cli export tflite --help
+```
+
+To export a model's checkpoint from the ๐ค Hub, for example, `google-bert/bert-base-uncased`, run the following command:
+
+```bash
+optimum-cli export tflite --model google-bert/bert-base-uncased --sequence_length 128 bert_tflite/
+```
+
+You should see the logs indicating progress and showing where the resulting `model.tflite` is saved, like this:
+
+```bash
+Validating TFLite model...
+ -[โ] TFLite model output names match reference model (logits)
+ - Validating TFLite Model output "logits":
+ -[โ] (1, 128, 30522) matches (1, 128, 30522)
+ -[x] values not close enough, max diff: 5.817413330078125e-05 (atol: 1e-05)
+The TensorFlow Lite export succeeded with the warning: The maximum absolute difference between the output of the reference model and the TFLite exported model is not within the set tolerance 1e-05:
+- logits: max diff = 5.817413330078125e-05.
+ The exported model was saved at: bert_tflite
+ ```
+
+The example above illustrates exporting a checkpoint from ๐ค Hub. When exporting a local model, first make sure that you
+saved both the model's weights and tokenizer files in the same directory (`local_path`). When using CLI, pass the
+`local_path` to the `model` argument instead of the checkpoint name on ๐ค Hub.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tiktoken.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tiktoken.md
new file mode 100644
index 0000000000000000000000000000000000000000..aac81e24fdd7387695c3add6d02ac6da840d4d13
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tiktoken.md
@@ -0,0 +1,60 @@
+
+
+# Tiktoken and interaction with Transformers
+
+Support for tiktoken model files is seamlessly integrated in ๐ค transformers when loading models
+`from_pretrained` with a `tokenizer.model` tiktoken file on the Hub, which is automatically converted into our
+[fast tokenizer](https://huggingface.co/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast).
+
+### Known models that were released with a `tiktoken.model`:
+ - gpt2
+ - llama3
+
+## Example usage
+
+In order to load `tiktoken` files in `transformers`, ensure that the `tokenizer.model` file is a tiktoken file and it
+will automatically be loaded when loading `from_pretrained`. Here is how one would load a tokenizer and a model, which
+ can be loaded from the exact same file:
+
+```py
+from transformers import AutoTokenizer
+
+model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
+tokenizer = AutoTokenizer.from_pretrained(model_id, subfolder="original")
+```
+## Create tiktoken tokenizer
+
+The `tokenizer.model` file contains no information about additional tokens or pattern strings. If these are important, convert the tokenizer to `tokenizer.json`, the appropriate format for [`PreTrainedTokenizerFast`].
+
+Generate the `tokenizer.model` file with [tiktoken.get_encoding](https://github.com/openai/tiktoken/blob/63527649963def8c759b0f91f2eb69a40934e468/tiktoken/registry.py#L63) and then convert it to `tokenizer.json` with [`convert_tiktoken_to_fast`].
+
+```py
+
+from transformers.integrations.tiktoken import convert_tiktoken_to_fast
+from tiktoken import get_encoding
+
+# You can load your custom encoding or the one provided by OpenAI
+encoding = get_encoding("gpt2")
+convert_tiktoken_to_fast(encoding, "config/save/dir")
+```
+
+The resulting `tokenizer.json` file is saved to the specified directory and can be loaded with [`PreTrainedTokenizerFast`].
+
+```py
+tokenizer = PreTrainedTokenizerFast.from_pretrained("config/save/dir")
+```
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tokenizer_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tokenizer_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..c5f12dd20d20ed6750aa070d95e519690bf686a7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/tokenizer_summary.md
@@ -0,0 +1,282 @@
+
+
+# Summary of the tokenizers
+
+[[open-in-colab]]
+
+On this page, we will have a closer look at tokenization.
+
+
+
+As we saw in [the preprocessing tutorial](preprocessing), tokenizing a text is splitting it into words or
+subwords, which then are converted to ids through a look-up table. Converting words or subwords to ids is
+straightforward, so in this summary, we will focus on splitting a text into words or subwords (i.e. tokenizing a text).
+More specifically, we will look at the three main types of tokenizers used in ๐ค Transformers: [Byte-Pair Encoding
+(BPE)](#byte-pair-encoding), [WordPiece](#wordpiece), and [SentencePiece](#sentencepiece), and show examples
+of which tokenizer type is used by which model.
+
+Note that on each model page, you can look at the documentation of the associated tokenizer to know which tokenizer
+type was used by the pretrained model. For instance, if we look at [`BertTokenizer`], we can see
+that the model uses [WordPiece](#wordpiece).
+
+## Introduction
+
+Splitting a text into smaller chunks is a task that is harder than it looks, and there are multiple ways of doing so.
+For instance, let's look at the sentence `"Don't you love ๐ค Transformers? We sure do."`
+
+
+
+A simple way of tokenizing this text is to split it by spaces, which would give:
+
+```
+["Don't", "you", "love", "๐ค", "Transformers?", "We", "sure", "do."]
+```
+
+This is a sensible first step, but if we look at the tokens `"Transformers?"` and `"do."`, we notice that the
+punctuation is attached to the words `"Transformer"` and `"do"`, which is suboptimal. We should take the
+punctuation into account so that a model does not have to learn a different representation of a word and every possible
+punctuation symbol that could follow it, which would explode the number of representations the model has to learn.
+Taking punctuation into account, tokenizing our exemplary text would give:
+
+```
+["Don", "'", "t", "you", "love", "๐ค", "Transformers", "?", "We", "sure", "do", "."]
+```
+
+Better. However, it is disadvantageous, how the tokenization dealt with the word `"Don't"`. `"Don't"` stands for
+`"do not"`, so it would be better tokenized as `["Do", "n't"]`. This is where things start getting complicated, and
+part of the reason each model has its own tokenizer type. Depending on the rules we apply for tokenizing a text, a
+different tokenized output is generated for the same text. A pretrained model only performs properly if you feed it an
+input that was tokenized with the same rules that were used to tokenize its training data.
+
+[spaCy](https://spacy.io/) and [Moses](http://www.statmt.org/moses/?n=Development.GetStarted) are two popular
+rule-based tokenizers. Applying them on our example, *spaCy* and *Moses* would output something like:
+
+```
+["Do", "n't", "you", "love", "๐ค", "Transformers", "?", "We", "sure", "do", "."]
+```
+
+As can be seen space and punctuation tokenization, as well as rule-based tokenization, is used here. Space and
+punctuation tokenization and rule-based tokenization are both examples of word tokenization, which is loosely defined
+as splitting sentences into words. While it's the most intuitive way to split texts into smaller chunks, this
+tokenization method can lead to problems for massive text corpora. In this case, space and punctuation tokenization
+usually generates a very big vocabulary (the set of all unique words and tokens used). *E.g.*, [Transformer XL](model_doc/transfo-xl) uses space and punctuation tokenization, resulting in a vocabulary size of 267,735!
+
+Such a big vocabulary size forces the model to have an enormous embedding matrix as the input and output layer, which
+causes both an increased memory and time complexity. In general, transformers models rarely have a vocabulary size
+greater than 50,000, especially if they are pretrained only on a single language.
+
+So if simple space and punctuation tokenization is unsatisfactory, why not simply tokenize on characters?
+
+
+
+While character tokenization is very simple and would greatly reduce memory and time complexity it makes it much harder
+for the model to learn meaningful input representations. *E.g.* learning a meaningful context-independent
+representation for the letter `"t"` is much harder than learning a context-independent representation for the word
+`"today"`. Therefore, character tokenization is often accompanied by a loss of performance. So to get the best of
+both worlds, transformers models use a hybrid between word-level and character-level tokenization called **subword**
+tokenization.
+
+## Subword tokenization
+
+
+
+Subword tokenization algorithms rely on the principle that frequently used words should not be split into smaller
+subwords, but rare words should be decomposed into meaningful subwords. For instance `"annoyingly"` might be
+considered a rare word and could be decomposed into `"annoying"` and `"ly"`. Both `"annoying"` and `"ly"` as
+stand-alone subwords would appear more frequently while at the same time the meaning of `"annoyingly"` is kept by the
+composite meaning of `"annoying"` and `"ly"`. This is especially useful in agglutinative languages such as Turkish,
+where you can form (almost) arbitrarily long complex words by stringing together subwords.
+
+Subword tokenization allows the model to have a reasonable vocabulary size while being able to learn meaningful
+context-independent representations. In addition, subword tokenization enables the model to process words it has never
+seen before, by decomposing them into known subwords. For instance, the [`~transformers.BertTokenizer`] tokenizes
+`"I have a new GPU!"` as follows:
+
+```py
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+>>> tokenizer.tokenize("I have a new GPU!")
+["i", "have", "a", "new", "gp", "##u", "!"]
+```
+
+Because we are considering the uncased model, the sentence was lowercased first. We can see that the words `["i", "have", "a", "new"]` are present in the tokenizer's vocabulary, but the word `"gpu"` is not. Consequently, the
+tokenizer splits `"gpu"` into known subwords: `["gp" and "##u"]`. `"##"` means that the rest of the token should
+be attached to the previous one, without space (for decoding or reversal of the tokenization).
+
+As another example, [`~transformers.XLNetTokenizer`] tokenizes our previously exemplary text as follows:
+
+```py
+>>> from transformers import XLNetTokenizer
+
+>>> tokenizer = XLNetTokenizer.from_pretrained("xlnet/xlnet-base-cased")
+>>> tokenizer.tokenize("Don't you love ๐ค Transformers? We sure do.")
+["โDon", "'", "t", "โyou", "โlove", "โ", "๐ค", "โ", "Transform", "ers", "?", "โWe", "โsure", "โdo", "."]
+```
+
+We'll get back to the meaning of those `"โ"` when we look at [SentencePiece](#sentencepiece). As one can see,
+the rare word `"Transformers"` has been split into the more frequent subwords `"Transform"` and `"ers"`.
+
+Let's now look at how the different subword tokenization algorithms work. Note that all of those tokenization
+algorithms rely on some form of training which is usually done on the corpus the corresponding model will be trained
+on.
+
+
+
+### Byte-Pair Encoding (BPE)
+
+Byte-Pair Encoding (BPE) was introduced in [Neural Machine Translation of Rare Words with Subword Units (Sennrich et
+al., 2015)](https://arxiv.org/abs/1508.07909). BPE relies on a pre-tokenizer that splits the training data into
+words. Pretokenization can be as simple as space tokenization, e.g. [GPT-2](model_doc/gpt2), [RoBERTa](model_doc/roberta). More advanced pre-tokenization include rule-based tokenization, e.g. [XLM](model_doc/xlm),
+[FlauBERT](model_doc/flaubert) which uses Moses for most languages, or [GPT](model_doc/openai-gpt) which uses
+spaCy and ftfy, to count the frequency of each word in the training corpus.
+
+After pre-tokenization, a set of unique words has been created and the frequency with which each word occurred in the
+training data has been determined. Next, BPE creates a base vocabulary consisting of all symbols that occur in the set
+of unique words and learns merge rules to form a new symbol from two symbols of the base vocabulary. It does so until
+the vocabulary has attained the desired vocabulary size. Note that the desired vocabulary size is a hyperparameter to
+define before training the tokenizer.
+
+As an example, let's assume that after pre-tokenization, the following set of words including their frequency has been
+determined:
+
+```
+("hug", 10), ("pug", 5), ("pun", 12), ("bun", 4), ("hugs", 5)
+```
+
+Consequently, the base vocabulary is `["b", "g", "h", "n", "p", "s", "u"]`. Splitting all words into symbols of the
+base vocabulary, we obtain:
+
+```
+("h" "u" "g", 10), ("p" "u" "g", 5), ("p" "u" "n", 12), ("b" "u" "n", 4), ("h" "u" "g" "s", 5)
+```
+
+BPE then counts the frequency of each possible symbol pair and picks the symbol pair that occurs most frequently. In
+the example above `"h"` followed by `"u"` is present _10 + 5 = 15_ times (10 times in the 10 occurrences of
+`"hug"`, 5 times in the 5 occurrences of `"hugs"`). However, the most frequent symbol pair is `"u"` followed by
+`"g"`, occurring _10 + 5 + 5 = 20_ times in total. Thus, the first merge rule the tokenizer learns is to group all
+`"u"` symbols followed by a `"g"` symbol together. Next, `"ug"` is added to the vocabulary. The set of words then
+becomes
+
+```
+("h" "ug", 10), ("p" "ug", 5), ("p" "u" "n", 12), ("b" "u" "n", 4), ("h" "ug" "s", 5)
+```
+
+BPE then identifies the next most common symbol pair. It's `"u"` followed by `"n"`, which occurs 16 times. `"u"`,
+`"n"` is merged to `"un"` and added to the vocabulary. The next most frequent symbol pair is `"h"` followed by
+`"ug"`, occurring 15 times. Again the pair is merged and `"hug"` can be added to the vocabulary.
+
+At this stage, the vocabulary is `["b", "g", "h", "n", "p", "s", "u", "ug", "un", "hug"]` and our set of unique words
+is represented as
+
+```
+("hug", 10), ("p" "ug", 5), ("p" "un", 12), ("b" "un", 4), ("hug" "s", 5)
+```
+
+Assuming, that the Byte-Pair Encoding training would stop at this point, the learned merge rules would then be applied
+to new words (as long as those new words do not include symbols that were not in the base vocabulary). For instance,
+the word `"bug"` would be tokenized to `["b", "ug"]` but `"mug"` would be tokenized as `["", "ug"]` since
+the symbol `"m"` is not in the base vocabulary. In general, single letters such as `"m"` are not replaced by the
+`""` symbol because the training data usually includes at least one occurrence of each letter, but it is likely
+to happen for very special characters like emojis.
+
+As mentioned earlier, the vocabulary size, *i.e.* the base vocabulary size + the number of merges, is a hyperparameter
+to choose. For instance [GPT](model_doc/openai-gpt) has a vocabulary size of 40,478 since they have 478 base characters
+and chose to stop training after 40,000 merges.
+
+#### Byte-level BPE
+
+A base vocabulary that includes all possible base characters can be quite large if *e.g.* all unicode characters are
+considered as base characters. To have a better base vocabulary, [GPT-2](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) uses bytes
+as the base vocabulary, which is a clever trick to force the base vocabulary to be of size 256 while ensuring that
+every base character is included in the vocabulary. With some additional rules to deal with punctuation, the GPT2's
+tokenizer can tokenize every text without the need for the symbol. [GPT-2](model_doc/gpt) has a vocabulary
+size of 50,257, which corresponds to the 256 bytes base tokens, a special end-of-text token and the symbols learned
+with 50,000 merges.
+
+
+
+### WordPiece
+
+WordPiece is the subword tokenization algorithm used for [BERT](model_doc/bert), [DistilBERT](model_doc/distilbert), and [Electra](model_doc/electra). The algorithm was outlined in [Japanese and Korean
+Voice Search (Schuster et al., 2012)](https://static.googleusercontent.com/media/research.google.com/ja//pubs/archive/37842.pdf) and is very similar to
+BPE. WordPiece first initializes the vocabulary to include every character present in the training data and
+progressively learns a given number of merge rules. In contrast to BPE, WordPiece does not choose the most frequent
+symbol pair, but the one that maximizes the likelihood of the training data once added to the vocabulary.
+
+So what does this mean exactly? Referring to the previous example, maximizing the likelihood of the training data is
+equivalent to finding the symbol pair, whose probability divided by the probabilities of its first symbol followed by
+its second symbol is the greatest among all symbol pairs. *E.g.* `"u"`, followed by `"g"` would have only been
+merged if the probability of `"ug"` divided by `"u"`, `"g"` would have been greater than for any other symbol
+pair. Intuitively, WordPiece is slightly different to BPE in that it evaluates what it _loses_ by merging two symbols
+to ensure it's _worth it_.
+
+
+
+### Unigram
+
+Unigram is a subword tokenization algorithm introduced in [Subword Regularization: Improving Neural Network Translation
+Models with Multiple Subword Candidates (Kudo, 2018)](https://arxiv.org/pdf/1804.10959.pdf). In contrast to BPE or
+WordPiece, Unigram initializes its base vocabulary to a large number of symbols and progressively trims down each
+symbol to obtain a smaller vocabulary. The base vocabulary could for instance correspond to all pre-tokenized words and
+the most common substrings. Unigram is not used directly for any of the models in the transformers, but it's used in
+conjunction with [SentencePiece](#sentencepiece).
+
+At each training step, the Unigram algorithm defines a loss (often defined as the log-likelihood) over the training
+data given the current vocabulary and a unigram language model. Then, for each symbol in the vocabulary, the algorithm
+computes how much the overall loss would increase if the symbol was to be removed from the vocabulary. Unigram then
+removes p (with p usually being 10% or 20%) percent of the symbols whose loss increase is the lowest, *i.e.* those
+symbols that least affect the overall loss over the training data. This process is repeated until the vocabulary has
+reached the desired size. The Unigram algorithm always keeps the base characters so that any word can be tokenized.
+
+Because Unigram is not based on merge rules (in contrast to BPE and WordPiece), the algorithm has several ways of
+tokenizing new text after training. As an example, if a trained Unigram tokenizer exhibits the vocabulary:
+
+```
+["b", "g", "h", "n", "p", "s", "u", "ug", "un", "hug"],
+```
+
+`"hugs"` could be tokenized both as `["hug", "s"]`, `["h", "ug", "s"]` or `["h", "u", "g", "s"]`. So which one
+to choose? Unigram saves the probability of each token in the training corpus on top of saving the vocabulary so that
+the probability of each possible tokenization can be computed after training. The algorithm simply picks the most
+likely tokenization in practice, but also offers the possibility to sample a possible tokenization according to their
+probabilities.
+
+Those probabilities are defined by the loss the tokenizer is trained on. Assuming that the training data consists of
+the words \\(x_{1}, \dots, x_{N}\\) and that the set of all possible tokenizations for a word \\(x_{i}\\) is
+defined as \\(S(x_{i})\\), then the overall loss is defined as
+
+$$\mathcal{L} = -\sum_{i=1}^{N} \log \left ( \sum_{x \in S(x_{i})} p(x) \right )$$
+
+
+
+### SentencePiece
+
+All tokenization algorithms described so far have the same problem: It is assumed that the input text uses spaces to
+separate words. However, not all languages use spaces to separate words. One possible solution is to use language
+specific pre-tokenizers, *e.g.* [XLM](model_doc/xlm) uses a specific Chinese, Japanese, and Thai pre-tokenizer.
+To solve this problem more generally, [SentencePiece: A simple and language independent subword tokenizer and
+detokenizer for Neural Text Processing (Kudo et al., 2018)](https://arxiv.org/pdf/1808.06226.pdf) treats the input
+as a raw input stream, thus including the space in the set of characters to use. It then uses the BPE or unigram
+algorithm to construct the appropriate vocabulary.
+
+The [`XLNetTokenizer`] uses SentencePiece for example, which is also why in the example earlier the
+`"โ"` character was included in the vocabulary. Decoding with SentencePiece is very easy since all tokens can just be
+concatenated and `"โ"` is replaced by a space.
+
+All transformers models in the library that use SentencePiece use it in combination with unigram. Examples of models
+using SentencePiece are [ALBERT](model_doc/albert), [XLNet](model_doc/xlnet), [Marian](model_doc/marian), and [T5](model_doc/t5).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/torchscript.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/torchscript.md
new file mode 100644
index 0000000000000000000000000000000000000000..b62e23468f8f2da8493d2443641690632f669de8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/torchscript.md
@@ -0,0 +1,229 @@
+
+
+# Export to TorchScript
+
+
+
+This is the very beginning of our experiments with TorchScript and we are still
+exploring its capabilities with variable-input-size models. It is a focus of interest to
+us and we will deepen our analysis in upcoming releases, with more code examples, a more
+flexible implementation, and benchmarks comparing Python-based codes with compiled
+TorchScript.
+
+
+
+According to the [TorchScript documentation](https://pytorch.org/docs/stable/jit.html):
+
+> TorchScript is a way to create serializable and optimizable models from PyTorch code.
+
+There are two PyTorch modules, [JIT and
+TRACE](https://pytorch.org/docs/stable/jit.html), that allow developers to export their
+models to be reused in other programs like efficiency-oriented C++ programs.
+
+We provide an interface that allows you to export ๐ค Transformers models to TorchScript
+so they can be reused in a different environment than PyTorch-based Python programs.
+Here, we explain how to export and use our models using TorchScript.
+
+Exporting a model requires two things:
+
+- model instantiation with the `torchscript` flag
+- a forward pass with dummy inputs
+
+These necessities imply several things developers should be careful about as detailed
+below.
+
+## TorchScript flag and tied weights
+
+The `torchscript` flag is necessary because most of the ๐ค Transformers language models
+have tied weights between their `Embedding` layer and their `Decoding` layer.
+TorchScript does not allow you to export models that have tied weights, so it is
+necessary to untie and clone the weights beforehand.
+
+Models instantiated with the `torchscript` flag have their `Embedding` layer and
+`Decoding` layer separated, which means that they should not be trained down the line.
+Training would desynchronize the two layers, leading to unexpected results.
+
+This is not the case for models that do not have a language model head, as those do not
+have tied weights. These models can be safely exported without the `torchscript` flag.
+
+## Dummy inputs and standard lengths
+
+The dummy inputs are used for a models forward pass. While the inputs' values are
+propagated through the layers, PyTorch keeps track of the different operations executed
+on each tensor. These recorded operations are then used to create the *trace* of the
+model.
+
+The trace is created relative to the inputs' dimensions. It is therefore constrained by
+the dimensions of the dummy input, and will not work for any other sequence length or
+batch size. When trying with a different size, the following error is raised:
+
+```
+`The expanded size of the tensor (3) must match the existing size (7) at non-singleton dimension 2`
+```
+
+We recommended you trace the model with a dummy input size at least as large as the
+largest input that will be fed to the model during inference. Padding can help fill the
+missing values. However, since the model is traced with a larger input size, the
+dimensions of the matrix will also be large, resulting in more calculations.
+
+Be careful of the total number of operations done on each input and follow the
+performance closely when exporting varying sequence-length models.
+
+## Using TorchScript in Python
+
+This section demonstrates how to save and load models as well as how to use the trace
+for inference.
+
+### Saving a model
+
+To export a `BertModel` with TorchScript, instantiate `BertModel` from the `BertConfig`
+class and then save it to disk under the filename `traced_bert.pt`:
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+
+enc = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+
+# Tokenizing input text
+text = "[CLS] Who was Jim Henson ? [SEP] Jim Henson was a puppeteer [SEP]"
+tokenized_text = enc.tokenize(text)
+
+# Masking one of the input tokens
+masked_index = 8
+tokenized_text[masked_index] = "[MASK]"
+indexed_tokens = enc.convert_tokens_to_ids(tokenized_text)
+segments_ids = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
+
+# Creating a dummy input
+tokens_tensor = torch.tensor([indexed_tokens])
+segments_tensors = torch.tensor([segments_ids])
+dummy_input = [tokens_tensor, segments_tensors]
+
+# Initializing the model with the torchscript flag
+# Flag set to True even though it is not necessary as this model does not have an LM Head.
+config = BertConfig(
+ vocab_size_or_config_json_file=32000,
+ hidden_size=768,
+ num_hidden_layers=12,
+ num_attention_heads=12,
+ intermediate_size=3072,
+ torchscript=True,
+)
+
+# Instantiating the model
+model = BertModel(config)
+
+# The model needs to be in evaluation mode
+model.eval()
+
+# If you are instantiating the model with *from_pretrained* you can also easily set the TorchScript flag
+model = BertModel.from_pretrained("google-bert/bert-base-uncased", torchscript=True)
+
+# Creating the trace
+traced_model = torch.jit.trace(model, [tokens_tensor, segments_tensors])
+torch.jit.save(traced_model, "traced_bert.pt")
+```
+
+### Loading a model
+
+Now you can load the previously saved `BertModel`, `traced_bert.pt`, from disk and use
+it on the previously initialised `dummy_input`:
+
+```python
+loaded_model = torch.jit.load("traced_bert.pt")
+loaded_model.eval()
+
+all_encoder_layers, pooled_output = loaded_model(*dummy_input)
+```
+
+### Using a traced model for inference
+
+Use the traced model for inference by using its `__call__` dunder method:
+
+```python
+traced_model(tokens_tensor, segments_tensors)
+```
+
+## Deploy Hugging Face TorchScript models to AWS with the Neuron SDK
+
+AWS introduced the [Amazon EC2 Inf1](https://aws.amazon.com/ec2/instance-types/inf1/)
+instance family for low cost, high performance machine learning inference in the cloud.
+The Inf1 instances are powered by the AWS Inferentia chip, a custom-built hardware
+accelerator, specializing in deep learning inferencing workloads. [AWS
+Neuron](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/#) is the SDK for
+Inferentia that supports tracing and optimizing transformers models for deployment on
+Inf1. The Neuron SDK provides:
+
+
+1. Easy-to-use API with one line of code change to trace and optimize a TorchScript
+ model for inference in the cloud.
+2. Out of the box performance optimizations for [improved
+ cost-performance](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/benchmark/>).
+3. Support for Hugging Face transformers models built with either
+ [PyTorch](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/bert_tutorial/tutorial_pretrained_bert.html)
+ or
+ [TensorFlow](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/tensorflow/huggingface_bert/huggingface_bert.html).
+
+### Implications
+
+Transformers models based on the [BERT (Bidirectional Encoder Representations from
+Transformers)](https://huggingface.co/docs/transformers/main/model_doc/bert)
+architecture, or its variants such as
+[distilBERT](https://huggingface.co/docs/transformers/main/model_doc/distilbert) and
+[roBERTa](https://huggingface.co/docs/transformers/main/model_doc/roberta) run best on
+Inf1 for non-generative tasks such as extractive question answering, sequence
+classification, and token classification. However, text generation tasks can still be
+adapted to run on Inf1 according to this [AWS Neuron MarianMT
+tutorial](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/transformers-marianmt.html).
+More information about models that can be converted out of the box on Inferentia can be
+found in the [Model Architecture
+Fit](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/models/models-inferentia.html#models-inferentia)
+section of the Neuron documentation.
+
+### Dependencies
+
+Using AWS Neuron to convert models requires a [Neuron SDK
+environment](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/neuron-frameworks/pytorch-neuron/index.html#installation-guide)
+which comes preconfigured on [AWS Deep Learning
+AMI](https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-inferentia-launching.html).
+
+### Converting a model for AWS Neuron
+
+Convert a model for AWS NEURON using the same code from [Using TorchScript in
+Python](torchscript#using-torchscript-in-python) to trace a `BertModel`. Import the
+`torch.neuron` framework extension to access the components of the Neuron SDK through a
+Python API:
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+import torch.neuron
+```
+
+You only need to modify the following line:
+
+```diff
+- torch.jit.trace(model, [tokens_tensor, segments_tensors])
++ torch.neuron.trace(model, [tokens_tensor, segments_tensors])
+```
+
+This enables the Neuron SDK to trace the model and optimize it for Inf1 instances.
+
+To learn more about AWS Neuron SDK features, tools, example tutorials and latest
+updates, please see the [AWS NeuronSDK
+documentation](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/index.html).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/trainer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/trainer.md
new file mode 100644
index 0000000000000000000000000000000000000000..e3a66f420424858b10f660bb3077d690e62a1984
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/trainer.md
@@ -0,0 +1,753 @@
+
+
+# Trainer
+
+The [`Trainer`] is a complete training and evaluation loop for PyTorch models implemented in the Transformers library. You only need to pass it the necessary pieces for training (model, tokenizer, dataset, evaluation function, training hyperparameters, etc.), and the [`Trainer`] class takes care of the rest. This makes it easier to start training faster without manually writing your own training loop. But at the same time, [`Trainer`] is very customizable and offers a ton of training options so you can tailor it to your exact training needs.
+
+
+
+In addition to the [`Trainer`] class, Transformers also provides a [`Seq2SeqTrainer`] class for sequence-to-sequence tasks like translation or summarization. There is also the [`~trl.SFTTrainer`] class from the [TRL](https://hf.co/docs/trl) library which wraps the [`Trainer`] class and is optimized for training language models like Llama-2 and Mistral with autoregressive techniques. [`~trl.SFTTrainer`] also supports features like sequence packing, LoRA, quantization, and DeepSpeed for efficiently scaling to any model size.
+
+
+
+Feel free to check out the [API reference](./main_classes/trainer) for these other [`Trainer`]-type classes to learn more about when to use which one. In general, [`Trainer`] is the most versatile option and is appropriate for a broad spectrum of tasks. [`Seq2SeqTrainer`] is designed for sequence-to-sequence tasks and [`~trl.SFTTrainer`] is designed for training language models.
+
+
+
+Before you start, make sure [Accelerate](https://hf.co/docs/accelerate) - a library for enabling and running PyTorch training across distributed environments - is installed.
+
+```bash
+pip install accelerate
+
+# upgrade
+pip install accelerate --upgrade
+```
+
+This guide provides an overview of the [`Trainer`] class.
+
+## Basic usage
+
+[`Trainer`] includes all the code you'll find in a basic training loop:
+
+1. perform a training step to calculate the loss
+2. calculate the gradients with the [`~accelerate.Accelerator.backward`] method
+3. update the weights based on the gradients
+4. repeat this process until you've reached a predetermined number of epochs
+
+The [`Trainer`] class abstracts all of this code away so you don't have to worry about manually writing a training loop every time or if you're just getting started with PyTorch and training. You only need to provide the essential components required for training, such as a model and a dataset, and the [`Trainer`] class handles everything else.
+
+If you want to specify any training options or hyperparameters, you can find them in the [`TrainingArguments`] class. For example, let's define where to save the model in `output_dir` and push the model to the Hub after training with `push_to_hub=True`.
+
+```py
+from transformers import TrainingArguments
+
+training_args = TrainingArguments(
+ output_dir="your-model",
+ learning_rate=2e-5,
+ per_device_train_batch_size=16,
+ per_device_eval_batch_size=16,
+ num_train_epochs=2,
+ weight_decay=0.01,
+ eval_strategy="epoch",
+ save_strategy="epoch",
+ load_best_model_at_end=True,
+ push_to_hub=True,
+)
+```
+
+Pass `training_args` to the [`Trainer`] along with a model, dataset, something to preprocess the dataset with (depending on your data type it could be a tokenizer, feature extractor or image processor), a data collator, and a function to compute the metrics you want to track during training.
+
+Finally, call [`~Trainer.train`] to start training!
+
+```py
+from transformers import Trainer
+
+trainer = Trainer(
+ model=model,
+ args=training_args,
+ train_dataset=dataset["train"],
+ eval_dataset=dataset["test"],
+ processing_class=tokenizer,
+ data_collator=data_collator,
+ compute_metrics=compute_metrics,
+)
+
+trainer.train()
+```
+
+### Checkpoints
+
+The [`Trainer`] class saves your model checkpoints to the directory specified in the `output_dir` parameter of [`TrainingArguments`]. You'll find the checkpoints saved in a `checkpoint-000` subfolder where the numbers at the end correspond to the training step. Saving checkpoints are useful for resuming training later.
+
+```py
+# resume from latest checkpoint
+trainer.train(resume_from_checkpoint=True)
+
+# resume from specific checkpoint saved in output directory
+trainer.train(resume_from_checkpoint="your-model/checkpoint-1000")
+```
+
+You can save your checkpoints (the optimizer state is not saved by default) to the Hub by setting `push_to_hub=True` in [`TrainingArguments`] to commit and push them. Other options for deciding how your checkpoints are saved are set up in the [`hub_strategy`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.hub_strategy) parameter:
+
+* `hub_strategy="checkpoint"` pushes the latest checkpoint to a subfolder named "last-checkpoint" from which you can resume training
+* `hub_strategy="all_checkpoints"` pushes all checkpoints to the directory defined in `output_dir` (you'll see one checkpoint per folder in your model repository)
+
+When you resume training from a checkpoint, the [`Trainer`] tries to keep the Python, NumPy, and PyTorch RNG states the same as they were when the checkpoint was saved. But because PyTorch has various non-deterministic default settings, the RNG states aren't guaranteed to be the same. If you want to enable full determinism, take a look at the [Controlling sources of randomness](https://pytorch.org/docs/stable/notes/randomness#controlling-sources-of-randomness) guide to learn what you can enable to make your training fully deterministic. Keep in mind though that by making certain settings deterministic, training may be slower.
+
+## Customize the Trainer
+
+While the [`Trainer`] class is designed to be accessible and easy-to-use, it also offers a lot of customizability for more adventurous users. Many of the [`Trainer`]'s method can be subclassed and overridden to support the functionality you want, without having to rewrite the entire training loop from scratch to accommodate it. These methods include:
+
+* [`~Trainer.get_train_dataloader`] creates a training DataLoader
+* [`~Trainer.get_eval_dataloader`] creates an evaluation DataLoader
+* [`~Trainer.get_test_dataloader`] creates a test DataLoader
+* [`~Trainer.log`] logs information on the various objects that watch training
+* [`~Trainer.create_optimizer_and_scheduler`] creates an optimizer and learning rate scheduler if they weren't passed in the `__init__`; these can also be separately customized with [`~Trainer.create_optimizer`] and [`~Trainer.create_scheduler`] respectively
+* [`~Trainer.compute_loss`] computes the loss on a batch of training inputs
+* [`~Trainer.training_step`] performs the training step
+* [`~Trainer.prediction_step`] performs the prediction and test step
+* [`~Trainer.evaluate`] evaluates the model and returns the evaluation metrics
+* [`~Trainer.predict`] makes predictions (with metrics if labels are available) on the test set
+
+For example, if you want to customize the [`~Trainer.compute_loss`] method to use a weighted loss instead.
+
+```py
+from torch import nn
+from transformers import Trainer
+
+class CustomTrainer(Trainer):
+ def compute_loss(self, model, inputs, return_outputs=False):
+ labels = inputs.pop("labels")
+ # forward pass
+ outputs = model(**inputs)
+ logits = outputs.get("logits")
+ # compute custom loss for 3 labels with different weights
+ loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([1.0, 2.0, 3.0], device=model.device))
+ loss = loss_fct(logits.view(-1, self.model.config.num_labels), labels.view(-1))
+ return (loss, outputs) if return_outputs else loss
+```
+
+### Callbacks
+
+Another option for customizing the [`Trainer`] is to use [callbacks](callbacks). Callbacks *don't change* anything in the training loop. They inspect the training loop state and then execute some action (early stopping, logging results, etc.) depending on the state. In other words, a callback can't be used to implement something like a custom loss function and you'll need to subclass and override the [`~Trainer.compute_loss`] method for that.
+
+For example, if you want to add an early stopping callback to the training loop after 10 steps.
+
+```py
+from transformers import TrainerCallback
+
+class EarlyStoppingCallback(TrainerCallback):
+ def __init__(self, num_steps=10):
+ self.num_steps = num_steps
+
+ def on_step_end(self, args, state, control, **kwargs):
+ if state.global_step >= self.num_steps:
+ return {"should_training_stop": True}
+ else:
+ return {}
+```
+
+Then pass it to the [`Trainer`]'s `callback` parameter.
+
+```py
+from transformers import Trainer
+
+trainer = Trainer(
+ model=model,
+ args=training_args,
+ train_dataset=dataset["train"],
+ eval_dataset=dataset["test"],
+ processing_class=tokenizer,
+ data_collator=data_collator,
+ compute_metrics=compute_metrics,
+ callbacks=[EarlyStoppingCallback()],
+)
+```
+
+## Logging
+
+
+
+Check out the [logging](./main_classes/logging) API reference for more information about the different logging levels.
+
+
+
+The [`Trainer`] is set to `logging.INFO` by default which reports errors, warnings, and other basic information. A [`Trainer`] replica - in distributed environments - is set to `logging.WARNING` which only reports errors and warnings. You can change the logging level with the [`log_level`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.log_level) and [`log_level_replica`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.log_level_replica) parameters in [`TrainingArguments`].
+
+To configure the log level setting for each node, use the [`log_on_each_node`](https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments.log_on_each_node) parameter to determine whether to use the log level on each node or only on the main node.
+
+
+
+[`Trainer`] sets the log level separately for each node in the [`Trainer.__init__`] method, so you may want to consider setting this sooner if you're using other Transformers functionalities before creating the [`Trainer`] object.
+
+
+
+For example, to set your main code and modules to use the same log level according to each node:
+
+```py
+logger = logging.getLogger(__name__)
+
+logging.basicConfig(
+ format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
+ datefmt="%m/%d/%Y %H:%M:%S",
+ handlers=[logging.StreamHandler(sys.stdout)],
+)
+
+log_level = training_args.get_process_log_level()
+logger.setLevel(log_level)
+datasets.utils.logging.set_verbosity(log_level)
+transformers.utils.logging.set_verbosity(log_level)
+
+trainer = Trainer(...)
+```
+
+Use different combinations of `log_level` and `log_level_replica` to configure what gets logged on each of the nodes.
+
+
+
+
+```bash
+my_app.py ... --log_level warning --log_level_replica error
+```
+
+
+
+
+Add the `log_on_each_node 0` parameter for multi-node environments.
+
+```bash
+my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0
+
+# set to only report errors
+my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0
+```
+
+
+
+
+## NEFTune
+
+[NEFTune](https://hf.co/papers/2310.05914) is a technique that can improve performance by adding noise to the embedding vectors during training. To enable it in [`Trainer`], set the `neftune_noise_alpha` parameter in [`TrainingArguments`] to control how much noise is added.
+
+```py
+from transformers import TrainingArguments, Trainer
+
+training_args = TrainingArguments(..., neftune_noise_alpha=0.1)
+trainer = Trainer(..., args=training_args)
+```
+
+NEFTune is disabled after training to restore the original embedding layer to avoid any unexpected behavior.
+
+## Liger Kernel
+
+[Liger-Kernel](https://github.com/linkedin/Liger-Kernel) Kernel is a collection of Triton kernels developed by Linkedin designed specifically for LLM training. We have implemented Hugging Face Compatible RMSNorm, RoPE, SwiGLU, CrossEntropy, FusedLinearCrossEntropy, and more to come. It can effectively increase multi-GPU training throughput by 20% and reduces memory usage by 60%. The kernel works out of the box with flash attention, PyTorch FSDP, and Microsoft DeepSpeed.
+
+
+Gain +20% throughput and reduce memory usage by 60% on LLaMA 3-8B model training. Achieve longer context lengths and larger batch sizes. Itโs also useful if you want to scale up your model to multi-head training or large vocabulary sizes. Unleash multi-head training (medusa) and more. See details and examples in [Liger](https://github.com/linkedin/Liger-Kernel/tree/main/examples)
+
+
+First make sure to install Liger official repository:
+```bash
+pip install liger-kernel
+```
+
+You should pass `use_liger_kernel=True` to apply liger kernel on your model, for example:
+
+```py
+from transformers import TrainingArguments
+
+training_args = TrainingArguments(
+ output_dir="your-model",
+ learning_rate=2e-5,
+ per_device_train_batch_size=16,
+ per_device_eval_batch_size=16,
+ num_train_epochs=2,
+ weight_decay=0.01,
+ eval_strategy="epoch",
+ save_strategy="epoch",
+ load_best_model_at_end=True,
+ push_to_hub=True,
+ use_liger_kernel=True
+)
+```
+
+The kernel supports the Llama, Gemma, Mistral, and Mixtral model architectures. The most up-to-date list of supported models can be found [here](https://github.com/linkedin/Liger-Kernel). When `use_liger_kernel` is set to `True`, the corresponding layers in the original model will be patched with Liger's efficient implementation, so you don't need to do anything extra other than setting the argument value.
+
+
+## Optimizers
+
+You can choose a built-in optimizer for training using:
+
+```python
+from transformers import TrainingArguments
+training_args = TrainingArguments(..., optim="adamw_torch")
+```
+
+See [`OptimizerNames`](https://github.com/huggingface/transformers/blob/main/src/transformers/training_args.py) for a full list of choices. We include advanced examples in the sections below.
+
+You can also use an arbitrary PyTorch optimizer via:
+
+```python
+import torch
+
+optimizer_cls = torch.optim.AdamW
+optimizer_kwargs = {
+ "lr": 4e-3,
+ "betas": (0.9, 0.999),
+ "weight_decay": 0.05,
+}
+
+from transformers import Trainer
+trainer = Trainer(..., optimizer_cls_and_kwargs=(optimizer_cls, optimizer_kwargs))
+```
+
+### GaLore
+
+Gradient Low-Rank Projection (GaLore) is a memory-efficient low-rank training strategy that allows full-parameter learning but is more memory-efficient than common low-rank adaptation methods, such as LoRA.
+
+First make sure to install GaLore official repository:
+
+```bash
+pip install galore-torch
+```
+
+Then simply add one of `["galore_adamw", "galore_adafactor", "galore_adamw_8bit"]` in `optim` together with `optim_target_modules`, which can be a list of strings, regex or full path corresponding to the target module names you want to adapt. Below is an end-to-end example script (make sure to `pip install trl datasets`):
+
+```python
+import torch
+import datasets
+import trl
+
+from transformers import TrainingArguments, AutoConfig, AutoTokenizer, AutoModelForCausalLM
+
+train_dataset = datasets.load_dataset('imdb', split='train')
+
+args = TrainingArguments(
+ output_dir="./test-galore",
+ max_steps=100,
+ per_device_train_batch_size=2,
+ optim="galore_adamw",
+ optim_target_modules=[r".*.attn.*", r".*.mlp.*"]
+)
+
+model_id = "google/gemma-2b"
+
+config = AutoConfig.from_pretrained(model_id)
+
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_config(config).to(0)
+
+trainer = trl.SFTTrainer(
+ model=model,
+ args=args,
+ train_dataset=train_dataset,
+ dataset_text_field='text',
+ max_seq_length=512,
+)
+
+trainer.train()
+```
+
+To pass extra arguments supported by GaLore, you should pass correctly `optim_args`, for example:
+
+```python
+import torch
+import datasets
+import trl
+
+from transformers import TrainingArguments, AutoConfig, AutoTokenizer, AutoModelForCausalLM
+
+train_dataset = datasets.load_dataset('imdb', split='train')
+
+args = TrainingArguments(
+ output_dir="./test-galore",
+ max_steps=100,
+ per_device_train_batch_size=2,
+ optim="galore_adamw",
+ optim_target_modules=[r".*.attn.*", r".*.mlp.*"],
+ optim_args="rank=64, update_proj_gap=100, scale=0.10",
+)
+
+model_id = "google/gemma-2b"
+
+config = AutoConfig.from_pretrained(model_id)
+
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_config(config).to(0)
+
+trainer = trl.SFTTrainer(
+ model=model,
+ args=args,
+ train_dataset=train_dataset,
+ dataset_text_field='text',
+ max_seq_length=512,
+)
+
+trainer.train()
+```
+
+You can read more about the method in the [original repository](https://github.com/jiaweizzhao/GaLore) or the [paper](https://arxiv.org/abs/2403.03507).
+
+Currently you can only train Linear layers that are considered as GaLore layers and will use low-rank decomposition to be trained while remaining layers will be optimized in the conventional manner.
+
+Note it will take a bit of time before starting the training (~3 minutes for a 2B model on a NVIDIA A100), but training should go smoothly afterwards.
+
+You can also perform layer-wise optimization by post-pending the optimizer name with `layerwise` like below:
+
+```python
+import torch
+import datasets
+import trl
+
+from transformers import TrainingArguments, AutoConfig, AutoTokenizer, AutoModelForCausalLM
+
+train_dataset = datasets.load_dataset('imdb', split='train')
+
+args = TrainingArguments(
+ output_dir="./test-galore",
+ max_steps=100,
+ per_device_train_batch_size=2,
+ optim="galore_adamw_layerwise",
+ optim_target_modules=[r".*.attn.*", r".*.mlp.*"]
+)
+
+model_id = "google/gemma-2b"
+
+config = AutoConfig.from_pretrained(model_id)
+
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_config(config).to(0)
+
+trainer = trl.SFTTrainer(
+ model=model,
+ args=args,
+ train_dataset=train_dataset,
+ dataset_text_field='text',
+ max_seq_length=512,
+)
+
+trainer.train()
+```
+
+Note layerwise optimization is a bit experimental and does not support DDP (Distributed Data Parallel), thus you can run the training script only on a single GPU. Please see [this appropriate section](https://github.com/jiaweizzhao/GaLore?tab=readme-ov-file#train-7b-model-with-a-single-gpu-with-24gb-memory) for more details. Other features such as gradient clipping, DeepSpeed, etc might not be supported out of the box. Please [raise an issue on GitHub](https://github.com/huggingface/transformers/issues) if you encounter such issue.
+
+### LOMO optimizer
+
+The LOMO optimizers have been introduced in [Full Parameter Fine-Tuning for Large Language Models with Limited Resources](https://hf.co/papers/2306.09782) and [AdaLomo: Low-memory Optimization with Adaptive Learning Rate](https://hf.co/papers/2310.10195).
+They both consist of an efficient full-parameter fine-tuning method. These optimizers fuse the gradient computation and the parameter update in one step to reduce memory usage. Supported optimizers for LOMO are `"lomo"` and `"adalomo"`. First either install LOMO from pypi `pip install lomo-optim` or install it from source with `pip install git+https://github.com/OpenLMLab/LOMO.git`.
+
+
+
+According to the authors, it is recommended to use `AdaLomo` without `grad_norm` to get better performance and higher throughput.
+
+
+
+Below is a simple script to demonstrate how to fine-tune [google/gemma-2b](https://huggingface.co/google/gemma-2b) on IMDB dataset in full precision:
+
+```python
+import torch
+import datasets
+from transformers import TrainingArguments, AutoTokenizer, AutoModelForCausalLM
+import trl
+
+train_dataset = datasets.load_dataset('imdb', split='train')
+
+args = TrainingArguments(
+ output_dir="./test-lomo",
+ max_steps=1000,
+ per_device_train_batch_size=4,
+ optim="adalomo",
+ gradient_checkpointing=True,
+ logging_strategy="steps",
+ logging_steps=1,
+ learning_rate=2e-6,
+ save_strategy="no",
+ run_name="lomo-imdb",
+)
+
+model_id = "google/gemma-2b"
+
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True).to(0)
+
+trainer = trl.SFTTrainer(
+ model=model,
+ args=args,
+ train_dataset=train_dataset,
+ dataset_text_field='text',
+ max_seq_length=1024,
+)
+
+trainer.train()
+```
+
+### GrokAdamW optimizer
+
+The GrokAdamW optimizer is designed to enhance training performance and stability, particularly for models that benefit from grokking signal functions. To use GrokAdamW, first install the optimizer package with `pip install grokadamw`.
+
+
+
+GrokAdamW is particularly useful for models that require advanced optimization techniques to achieve better performance and stability.
+
+
+
+Below is a simple script to demonstrate how to fine-tune [google/gemma-2b](https://huggingface.co/google/gemma-2b) on the IMDB dataset using the GrokAdamW optimizer:
+
+```python
+import torch
+import datasets
+from transformers import TrainingArguments, AutoTokenizer, AutoModelForCausalLM, Trainer
+
+# Load the IMDB dataset
+train_dataset = datasets.load_dataset('imdb', split='train')
+
+# Define the training arguments
+args = TrainingArguments(
+ output_dir="./test-grokadamw",
+ max_steps=1000,
+ per_device_train_batch_size=4,
+ optim="grokadamw",
+ logging_strategy="steps",
+ logging_steps=1,
+ learning_rate=2e-5,
+ save_strategy="no",
+ run_name="grokadamw-imdb",
+)
+
+# Load the model and tokenizer
+model_id = "google/gemma-2b"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True).to(0)
+
+# Initialize the Trainer
+trainer = Trainer(
+ model=model,
+ args=args,
+ train_dataset=train_dataset,
+)
+
+# Train the model
+trainer.train()
+```
+
+This script demonstrates how to fine-tune the `google/gemma-2b` model on the IMDB dataset using the GrokAdamW optimizer. The `TrainingArguments` are configured to use GrokAdamW, and the dataset is passed to the `Trainer` for training.
+
+### Schedule Free Optimizer
+
+The Schedule Free optimizers have been introduced in [The Road Less Scheduled](https://hf.co/papers/2405.15682).
+Schedule-Free learning replaces the momentum of the base optimizer with a combination of averaging and interpolation, to completely remove the need to anneal the learning rate with a traditional schedule.
+Supported optimizers for SFO are `"schedule_free_adamw"` and `"schedule_free_sgd"`. First install schedulefree from pypi `pip install schedulefree`.
+
+Below is a simple script to demonstrate how to fine-tune [google/gemma-2b](https://huggingface.co/google/gemma-2b) on IMDB dataset in full precision:
+
+```python
+import torch
+import datasets
+from transformers import TrainingArguments, AutoTokenizer, AutoModelForCausalLM
+import trl
+
+train_dataset = datasets.load_dataset('imdb', split='train')
+
+args = TrainingArguments(
+ output_dir="./test-schedulefree",
+ max_steps=1000,
+ per_device_train_batch_size=4,
+ optim="schedule_free_adamw",
+ gradient_checkpointing=True,
+ logging_strategy="steps",
+ logging_steps=1,
+ learning_rate=2e-6,
+ save_strategy="no",
+ run_name="sfo-imdb",
+)
+
+model_id = "google/gemma-2b"
+
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True).to(0)
+
+trainer = trl.SFTTrainer(
+ model=model,
+ args=args,
+ train_dataset=train_dataset,
+ dataset_text_field='text',
+ max_seq_length=1024,
+)
+
+trainer.train()
+```
+
+## Accelerate and Trainer
+
+The [`Trainer`] class is powered by [Accelerate](https://hf.co/docs/accelerate), a library for easily training PyTorch models in distributed environments with support for integrations such as [FullyShardedDataParallel (FSDP)](https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/) and [DeepSpeed](https://www.deepspeed.ai/).
+
+
+
+Learn more about FSDP sharding strategies, CPU offloading, and more with the [`Trainer`] in the [Fully Sharded Data Parallel](fsdp) guide.
+
+
+
+To use Accelerate with [`Trainer`], run the [`accelerate.config`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-config) command to set up training for your training environment. This command creates a `config_file.yaml` that'll be used when you launch your training script. For example, some example configurations you can setup are:
+
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+distributed_type: MULTI_GPU
+downcast_bf16: 'no'
+gpu_ids: all
+machine_rank: 0 #change rank as per the node
+main_process_ip: 192.168.20.1
+main_process_port: 9898
+main_training_function: main
+mixed_precision: fp16
+num_machines: 2
+num_processes: 8
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+distributed_type: FSDP
+downcast_bf16: 'no'
+fsdp_config:
+ fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
+ fsdp_backward_prefetch_policy: BACKWARD_PRE
+ fsdp_forward_prefetch: true
+ fsdp_offload_params: false
+ fsdp_sharding_strategy: 1
+ fsdp_state_dict_type: FULL_STATE_DICT
+ fsdp_sync_module_states: true
+ fsdp_transformer_layer_cls_to_wrap: BertLayer
+ fsdp_use_orig_params: true
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 2
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+deepspeed_config:
+ deepspeed_config_file: /home/user/configs/ds_zero3_config.json
+ zero3_init_flag: true
+distributed_type: DEEPSPEED
+downcast_bf16: 'no'
+machine_rank: 0
+main_training_function: main
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+deepspeed_config:
+ gradient_accumulation_steps: 1
+ gradient_clipping: 0.7
+ offload_optimizer_device: cpu
+ offload_param_device: cpu
+ zero3_init_flag: true
+ zero_stage: 2
+distributed_type: DEEPSPEED
+downcast_bf16: 'no'
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+
+
+
+The [`accelerate_launch`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch) command is the recommended way to launch your training script on a distributed system with Accelerate and [`Trainer`] with the parameters specified in `config_file.yaml`. This file is saved to the Accelerate cache folder and automatically loaded when you run `accelerate_launch`.
+
+For example, to run the [run_glue.py](https://github.com/huggingface/transformers/blob/f4db565b695582891e43a5e042e5d318e28f20b8/examples/pytorch/text-classification/run_glue.py#L4) training script with the FSDP configuration:
+
+```bash
+accelerate launch \
+ ./examples/pytorch/text-classification/run_glue.py \
+ --model_name_or_path google-bert/bert-base-cased \
+ --task_name $TASK_NAME \
+ --do_train \
+ --do_eval \
+ --max_seq_length 128 \
+ --per_device_train_batch_size 16 \
+ --learning_rate 5e-5 \
+ --num_train_epochs 3 \
+ --output_dir /tmp/$TASK_NAME/ \
+ --overwrite_output_dir
+```
+
+You could also specify the parameters from the `config_file.yaml` file directly in the command line:
+
+```bash
+accelerate launch --num_processes=2 \
+ --use_fsdp \
+ --mixed_precision=bf16 \
+ --fsdp_auto_wrap_policy=TRANSFORMER_BASED_WRAP \
+ --fsdp_transformer_layer_cls_to_wrap="BertLayer" \
+ --fsdp_sharding_strategy=1 \
+ --fsdp_state_dict_type=FULL_STATE_DICT \
+ ./examples/pytorch/text-classification/run_glue.py
+ --model_name_or_path google-bert/bert-base-cased \
+ --task_name $TASK_NAME \
+ --do_train \
+ --do_eval \
+ --max_seq_length 128 \
+ --per_device_train_batch_size 16 \
+ --learning_rate 5e-5 \
+ --num_train_epochs 3 \
+ --output_dir /tmp/$TASK_NAME/ \
+ --overwrite_output_dir
+```
+
+Check out the [Launching your Accelerate scripts](https://huggingface.co/docs/accelerate/basic_tutorials/launch) tutorial to learn more about `accelerate_launch` and custom configurations.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/training.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/training.md
new file mode 100644
index 0000000000000000000000000000000000000000..fa6ef0c0da6e4b3e8198846cb87bac45dabc857a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/training.md
@@ -0,0 +1,439 @@
+
+
+# Fine-tune a pretrained model
+
+[[open-in-colab]]
+
+There are significant benefits to using a pretrained model. It reduces computation costs, your carbon footprint, and allows you to use state-of-the-art models without having to train one from scratch. ๐ค Transformers provides access to thousands of pretrained models for a wide range of tasks. When you use a pretrained model, you train it on a dataset specific to your task. This is known as fine-tuning, an incredibly powerful training technique. In this tutorial, you will fine-tune a pretrained model with a deep learning framework of your choice:
+
+* Fine-tune a pretrained model with ๐ค Transformers [`Trainer`].
+* Fine-tune a pretrained model in TensorFlow with Keras.
+* Fine-tune a pretrained model in native PyTorch.
+
+
+
+## Prepare a dataset
+
+
+
+Before you can fine-tune a pretrained model, download a dataset and prepare it for training. The previous tutorial showed you how to process data for training, and now you get an opportunity to put those skills to the test!
+
+Begin by loading the [Yelp Reviews](https://huggingface.co/datasets/yelp_review_full) dataset:
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("yelp_review_full")
+>>> dataset["train"][100]
+{'label': 0,
+ 'text': 'My expectations for McDonalds are t rarely high. But for one to still fail so spectacularly...that takes something special!\\nThe cashier took my friends\'s order, then promptly ignored me. I had to force myself in front of a cashier who opened his register to wait on the person BEHIND me. I waited over five minutes for a gigantic order that included precisely one kid\'s meal. After watching two people who ordered after me be handed their food, I asked where mine was. The manager started yelling at the cashiers for \\"serving off their orders\\" when they didn\'t have their food. But neither cashier was anywhere near those controls, and the manager was the one serving food to customers and clearing the boards.\\nThe manager was rude when giving me my order. She didn\'t make sure that I had everything ON MY RECEIPT, and never even had the decency to apologize that I felt I was getting poor service.\\nI\'ve eaten at various McDonalds restaurants for over 30 years. I\'ve worked at more than one location. I expect bad days, bad moods, and the occasional mistake. But I have yet to have a decent experience at this store. It will remain a place I avoid unless someone in my party needs to avoid illness from low blood sugar. Perhaps I should go back to the racially biased service of Steak n Shake instead!'}
+```
+
+As you now know, you need a tokenizer to process the text and include a padding and truncation strategy to handle any variable sequence lengths. To process your dataset in one step, use ๐ค Datasets [`map`](https://huggingface.co/docs/datasets/process#map) method to apply a preprocessing function over the entire dataset:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+
+>>> def tokenize_function(examples):
+... return tokenizer(examples["text"], padding="max_length", truncation=True)
+
+
+>>> tokenized_datasets = dataset.map(tokenize_function, batched=True)
+```
+
+If you like, you can create a smaller subset of the full dataset to fine-tune on to reduce the time it takes:
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+
+
+## Train
+
+At this point, you should follow the section corresponding to the framework you want to use. You can use the links
+in the right sidebar to jump to the one you want - and if you want to hide all of the content for a given framework,
+just use the button at the top-right of that framework's block!
+
+
+
+
+
+## Train with PyTorch Trainer
+
+๐ค Transformers provides a [`Trainer`] class optimized for training ๐ค Transformers models, making it easier to start training without manually writing your own training loop. The [`Trainer`] API supports a wide range of training options and features such as logging, gradient accumulation, and mixed precision.
+
+Start by loading your model and specify the number of expected labels. From the Yelp Review [dataset card](https://huggingface.co/datasets/yelp_review_full#data-fields), you know there are five labels.
+
+By default, the weights are loaded in full precision (torch.float32) regardless of the actual data type the weights are stored in such as torch.float16. Set `torch_dtype="auto"` to load the weights in the data type defined in a model's `config.json` file to automatically load the most memory-optimal data type.
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5, torch_dtype="auto")
+```
+
+
+
+You will see a warning about some of the pretrained weights not being used and some weights being randomly
+initialized. Don't worry, this is completely normal! The pretrained head of the BERT model is discarded, and replaced with a randomly initialized classification head. You will fine-tune this new model head on your sequence classification task, transferring the knowledge of the pretrained model to it.
+
+
+
+### Training hyperparameters
+
+Next, create a [`TrainingArguments`] class which contains all the hyperparameters you can tune as well as flags for activating different training options. For this tutorial you can start with the default training [hyperparameters](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments), but feel free to experiment with these to find your optimal settings.
+
+Specify where to save the checkpoints from your training:
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> training_args = TrainingArguments(output_dir="test_trainer")
+```
+
+### Evaluate
+
+[`Trainer`] does not automatically evaluate model performance during training. You'll need to pass [`Trainer`] a function to compute and report metrics. The [๐ค Evaluate](https://huggingface.co/docs/evaluate/index) library provides a simple [`accuracy`](https://huggingface.co/spaces/evaluate-metric/accuracy) function you can load with the [`evaluate.load`] (see this [quicktour](https://huggingface.co/docs/evaluate/a_quick_tour) for more information) function:
+
+```py
+>>> import numpy as np
+>>> import evaluate
+
+>>> metric = evaluate.load("accuracy")
+```
+
+Call [`~evaluate.compute`] on `metric` to calculate the accuracy of your predictions. Before passing your predictions to `compute`, you need to convert the logits to predictions (remember all ๐ค Transformers models return logits):
+
+```py
+>>> def compute_metrics(eval_pred):
+... logits, labels = eval_pred
+... predictions = np.argmax(logits, axis=-1)
+... return metric.compute(predictions=predictions, references=labels)
+```
+
+If you'd like to monitor your evaluation metrics during fine-tuning, specify the `eval_strategy` parameter in your training arguments to report the evaluation metric at the end of each epoch:
+
+```py
+>>> from transformers import TrainingArguments, Trainer
+
+>>> training_args = TrainingArguments(output_dir="test_trainer", eval_strategy="epoch")
+```
+
+### Trainer
+
+Create a [`Trainer`] object with your model, training arguments, training and test datasets, and evaluation function:
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+Then fine-tune your model by calling [`~transformers.Trainer.train`]:
+
+```py
+>>> trainer.train()
+```
+
+
+
+
+
+
+## Train a TensorFlow model with Keras
+
+You can also train ๐ค Transformers models in TensorFlow with the Keras API!
+
+### Loading data for Keras
+
+When you want to train a ๐ค Transformers model with the Keras API, you need to convert your dataset to a format that
+Keras understands. If your dataset is small, you can just convert the whole thing to NumPy arrays and pass it to Keras.
+Let's try that first before we do anything more complicated.
+
+First, load a dataset. We'll use the CoLA dataset from the [GLUE benchmark](https://huggingface.co/datasets/glue),
+since it's a simple binary text classification task, and just take the training split for now.
+
+```py
+from datasets import load_dataset
+
+dataset = load_dataset("glue", "cola")
+dataset = dataset["train"] # Just take the training split for now
+```
+
+Next, load a tokenizer and tokenize the data as NumPy arrays. Note that the labels are already a list of 0 and 1s,
+so we can just convert that directly to a NumPy array without tokenization!
+
+```py
+from transformers import AutoTokenizer
+import numpy as np
+
+tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+tokenized_data = tokenizer(dataset["sentence"], return_tensors="np", padding=True)
+# Tokenizer returns a BatchEncoding, but we convert that to a dict for Keras
+tokenized_data = dict(tokenized_data)
+
+labels = np.array(dataset["label"]) # Label is already an array of 0 and 1
+```
+
+Finally, load, [`compile`](https://keras.io/api/models/model_training_apis/#compile-method), and [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) the model. Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:
+
+```py
+from transformers import TFAutoModelForSequenceClassification
+from tensorflow.keras.optimizers import Adam
+
+# Load and compile our model
+model = TFAutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased")
+# Lower learning rates are often better for fine-tuning transformers
+model.compile(optimizer=Adam(3e-5)) # No loss argument!
+
+model.fit(tokenized_data, labels)
+```
+
+
+
+You don't have to pass a loss argument to your models when you `compile()` them! Hugging Face models automatically
+choose a loss that is appropriate for their task and model architecture if this argument is left blank. You can always
+override this by specifying a loss yourself if you want to!
+
+
+
+This approach works great for smaller datasets, but for larger datasets, you might find it starts to become a problem. Why?
+Because the tokenized array and labels would have to be fully loaded into memory, and because NumPy doesnโt handle
+โjaggedโ arrays, so every tokenized sample would have to be padded to the length of the longest sample in the whole
+dataset. Thatโs going to make your array even bigger, and all those padding tokens will slow down training too!
+
+### Loading data as a tf.data.Dataset
+
+If you want to avoid slowing down training, you can load your data as a `tf.data.Dataset` instead. Although you can write your own
+`tf.data` pipeline if you want, we have two convenience methods for doing this:
+
+- [`~TFPreTrainedModel.prepare_tf_dataset`]: This is the method we recommend in most cases. Because it is a method
+on your model, it can inspect the model to automatically figure out which columns are usable as model inputs, and
+discard the others to make a simpler, more performant dataset.
+- [`~datasets.Dataset.to_tf_dataset`]: This method is more low-level, and is useful when you want to exactly control how
+your dataset is created, by specifying exactly which `columns` and `label_cols` to include.
+
+Before you can use [`~TFPreTrainedModel.prepare_tf_dataset`], you will need to add the tokenizer outputs to your dataset as columns, as shown in
+the following code sample:
+
+```py
+def tokenize_dataset(data):
+ # Keys of the returned dictionary will be added to the dataset as columns
+ return tokenizer(data["text"])
+
+
+dataset = dataset.map(tokenize_dataset)
+```
+
+Remember that Hugging Face datasets are stored on disk by default, so this will not inflate your memory usage! Once the
+columns have been added, you can stream batches from the dataset and add padding to each batch, which greatly
+reduces the number of padding tokens compared to padding the entire dataset.
+
+
+```py
+>>> tf_dataset = model.prepare_tf_dataset(dataset["train"], batch_size=16, shuffle=True, tokenizer=tokenizer)
+```
+
+Note that in the code sample above, you need to pass the tokenizer to `prepare_tf_dataset` so it can correctly pad batches as they're loaded.
+If all the samples in your dataset are the same length and no padding is necessary, you can skip this argument.
+If you need to do something more complex than just padding samples (e.g. corrupting tokens for masked language
+modelling), you can use the `collate_fn` argument instead to pass a function that will be called to transform the
+list of samples into a batch and apply any preprocessing you want. See our
+[examples](https://github.com/huggingface/transformers/tree/main/examples) or
+[notebooks](https://huggingface.co/docs/transformers/notebooks) to see this approach in action.
+
+Once you've created a `tf.data.Dataset`, you can compile and fit the model as before:
+
+```py
+model.compile(optimizer=Adam(3e-5)) # No loss argument!
+
+model.fit(tf_dataset)
+```
+
+
+
+
+
+
+## Train in native PyTorch
+
+
+
+
+
+[`Trainer`] takes care of the training loop and allows you to fine-tune a model in a single line of code. For users who prefer to write their own training loop, you can also fine-tune a ๐ค Transformers model in native PyTorch.
+
+At this point, you may need to restart your notebook or execute the following code to free some memory:
+
+```py
+from accelerate.utils.memory import clear_device_cache
+del model
+del trainer
+clear_device_cache()
+```
+
+Next, manually postprocess `tokenized_dataset` to prepare it for training.
+
+1. Remove the `text` column because the model does not accept raw text as an input:
+
+ ```py
+ >>> tokenized_datasets = tokenized_datasets.remove_columns(["text"])
+ ```
+
+2. Rename the `label` column to `labels` because the model expects the argument to be named `labels`:
+
+ ```py
+ >>> tokenized_datasets = tokenized_datasets.rename_column("label", "labels")
+ ```
+
+3. Set the format of the dataset to return PyTorch tensors instead of lists:
+
+ ```py
+ >>> tokenized_datasets.set_format("torch")
+ ```
+
+Then create a smaller subset of the dataset as previously shown to speed up the fine-tuning:
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+### DataLoader
+
+Create a `DataLoader` for your training and test datasets so you can iterate over batches of data:
+
+```py
+>>> from torch.utils.data import DataLoader
+
+>>> train_dataloader = DataLoader(small_train_dataset, shuffle=True, batch_size=8)
+>>> eval_dataloader = DataLoader(small_eval_dataset, batch_size=8)
+```
+
+Load your model with the number of expected labels:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+### Optimizer and learning rate scheduler
+
+Create an optimizer and learning rate scheduler to fine-tune the model. Let's use the [`AdamW`](https://pytorch.org/docs/stable/generated/torch.optim.AdamW.html) optimizer from PyTorch:
+
+```py
+>>> from torch.optim import AdamW
+
+>>> optimizer = AdamW(model.parameters(), lr=5e-5)
+```
+
+Create the default learning rate scheduler from [`Trainer`]:
+
+```py
+>>> from transformers import get_scheduler
+
+>>> num_epochs = 3
+>>> num_training_steps = num_epochs * len(train_dataloader)
+>>> lr_scheduler = get_scheduler(
+... name="linear", optimizer=optimizer, num_warmup_steps=0, num_training_steps=num_training_steps
+... )
+```
+
+Lastly, specify `device` to use a GPU if you have access to one. Otherwise, training on a CPU may take several hours instead of a couple of minutes.
+
+```py
+>>> import torch
+>>> from accelerate.test_utils.testing import get_backend
+
+>>> device, _, _ = get_backend() # automatically detects the underlying device type (CUDA, CPU, XPU, MPS, etc.)
+>>> model.to(device)
+```
+
+
+
+Get free access to a cloud GPU if you don't have one with a hosted notebook like [Colaboratory](https://colab.research.google.com/) or [SageMaker StudioLab](https://studiolab.sagemaker.aws/).
+
+
+
+Great, now you are ready to train! ๐ฅณ
+
+### Training loop
+
+To keep track of your training progress, use the [tqdm](https://tqdm.github.io/) library to add a progress bar over the number of training steps:
+
+```py
+>>> from tqdm.auto import tqdm
+
+>>> progress_bar = tqdm(range(num_training_steps))
+
+>>> model.train()
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... outputs = model(**batch)
+... loss = outputs.loss
+... loss.backward()
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+### Evaluate
+
+Just like how you added an evaluation function to [`Trainer`], you need to do the same when you write your own training loop. But instead of calculating and reporting the metric at the end of each epoch, this time you'll accumulate all the batches with [`~evaluate.add_batch`] and calculate the metric at the very end.
+
+```py
+>>> import evaluate
+
+>>> metric = evaluate.load("accuracy")
+>>> model.eval()
+>>> for batch in eval_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... with torch.no_grad():
+... outputs = model(**batch)
+
+... logits = outputs.logits
+... predictions = torch.argmax(logits, dim=-1)
+... metric.add_batch(predictions=predictions, references=batch["labels"])
+
+>>> metric.compute()
+```
+
+
+
+
+
+## Additional resources
+
+For more fine-tuning examples, refer to:
+
+- [๐ค Transformers Examples](https://github.com/huggingface/transformers/tree/main/examples) includes scripts
+ to train common NLP tasks in PyTorch and TensorFlow.
+
+- [๐ค Transformers Notebooks](notebooks) contains various notebooks on how to fine-tune a model for specific tasks in PyTorch and TensorFlow.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/troubleshooting.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/troubleshooting.md
new file mode 100644
index 0000000000000000000000000000000000000000..c1bf338c13bebb9714604047f2ec43814c97a09b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/en/troubleshooting.md
@@ -0,0 +1,198 @@
+
+
+# Troubleshoot
+
+Sometimes errors occur, but we are here to help! This guide covers some of the most common issues we've seen and how you can resolve them. However, this guide isn't meant to be a comprehensive collection of every ๐ค Transformers issue. For more help with troubleshooting your issue, try:
+
+
+
+1. Asking for help on the [forums](https://discuss.huggingface.co/). There are specific categories you can post your question to, like [Beginners](https://discuss.huggingface.co/c/beginners/5) or [๐ค Transformers](https://discuss.huggingface.co/c/transformers/9). Make sure you write a good descriptive forum post with some reproducible code to maximize the likelihood that your problem is solved!
+
+
+
+2. Create an [Issue](https://github.com/huggingface/transformers/issues/new/choose) on the ๐ค Transformers repository if it is a bug related to the library. Try to include as much information describing the bug as possible to help us better figure out what's wrong and how we can fix it.
+
+3. Check the [Migration](migration) guide if you use an older version of ๐ค Transformers since some important changes have been introduced between versions.
+
+For more details about troubleshooting and getting help, take a look at [Chapter 8](https://huggingface.co/course/chapter8/1?fw=pt) of the Hugging Face course.
+
+
+## Firewalled environments
+
+Some GPU instances on cloud and intranet setups are firewalled to external connections, resulting in a connection error. When your script attempts to download model weights or datasets, the download will hang and then timeout with the following message:
+
+```
+ValueError: Connection error, and we cannot find the requested files in the cached path.
+Please try again or make sure your Internet connection is on.
+```
+
+In this case, you should try to run ๐ค Transformers on [offline mode](installation#offline-mode) to avoid the connection error.
+
+## CUDA out of memory
+
+Training large models with millions of parameters can be challenging without the appropriate hardware. A common error you may encounter when the GPU runs out of memory is:
+
+```
+CUDA out of memory. Tried to allocate 256.00 MiB (GPU 0; 11.17 GiB total capacity; 9.70 GiB already allocated; 179.81 MiB free; 9.85 GiB reserved in total by PyTorch)
+```
+
+Here are some potential solutions you can try to lessen memory use:
+
+- Reduce the [`per_device_train_batch_size`](main_classes/trainer#transformers.TrainingArguments.per_device_train_batch_size) value in [`TrainingArguments`].
+- Try using [`gradient_accumulation_steps`](main_classes/trainer#transformers.TrainingArguments.gradient_accumulation_steps) in [`TrainingArguments`] to effectively increase overall batch size.
+
+
+
+Refer to the Performance [guide](performance) for more details about memory-saving techniques.
+
+
+
+## Unable to load a saved TensorFlow model
+
+TensorFlow's [model.save](https://www.tensorflow.org/tutorials/keras/save_and_load#save_the_entire_model) method will save the entire model - architecture, weights, training configuration - in a single file. However, when you load the model file again, you may run into an error because ๐ค Transformers may not load all the TensorFlow-related objects in the model file. To avoid issues with saving and loading TensorFlow models, we recommend you:
+
+- Save the model weights as a `h5` file extension with [`model.save_weights`](https://www.tensorflow.org/tutorials/keras/save_and_load#save_the_entire_model) and then reload the model with [`~TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> from transformers import TFPreTrainedModel
+>>> from tensorflow import keras
+
+>>> model.save_weights("some_folder/tf_model.h5")
+>>> model = TFPreTrainedModel.from_pretrained("some_folder")
+```
+
+- Save the model with [`~TFPretrainedModel.save_pretrained`] and load it again with [`~TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> from transformers import TFPreTrainedModel
+
+>>> model.save_pretrained("path_to/model")
+>>> model = TFPreTrainedModel.from_pretrained("path_to/model")
+```
+
+## ImportError
+
+Another common error you may encounter, especially if it is a newly released model, is `ImportError`:
+
+```
+ImportError: cannot import name 'ImageGPTImageProcessor' from 'transformers' (unknown location)
+```
+
+For these error types, check to make sure you have the latest version of ๐ค Transformers installed to access the most recent models:
+
+```bash
+pip install transformers --upgrade
+```
+
+## CUDA error: device-side assert triggered
+
+Sometimes you may run into a generic CUDA error about an error in the device code.
+
+```
+RuntimeError: CUDA error: device-side assert triggered
+```
+
+You should try to run the code on a CPU first to get a more descriptive error message. Add the following environment variable to the beginning of your code to switch to a CPU:
+
+```py
+>>> import os
+
+>>> os.environ["CUDA_VISIBLE_DEVICES"] = ""
+```
+
+Another option is to get a better traceback from the GPU. Add the following environment variable to the beginning of your code to get the traceback to point to the source of the error:
+
+```py
+>>> import os
+
+>>> os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
+```
+
+## Incorrect output when padding tokens aren't masked
+
+In some cases, the output `hidden_state` may be incorrect if the `input_ids` include padding tokens. To demonstrate, load a model and tokenizer. You can access a model's `pad_token_id` to see its value. The `pad_token_id` may be `None` for some models, but you can always manually set it.
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+>>> import torch
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-uncased")
+>>> model.config.pad_token_id
+0
+```
+
+The following example shows the output without masking the padding tokens:
+
+```py
+>>> input_ids = torch.tensor([[7592, 2057, 2097, 2393, 9611, 2115], [7592, 0, 0, 0, 0, 0]])
+>>> output = model(input_ids)
+>>> print(output.logits)
+tensor([[ 0.0082, -0.2307],
+ [ 0.1317, -0.1683]], grad_fn=)
+```
+
+Here is the actual output of the second sequence:
+
+```py
+>>> input_ids = torch.tensor([[7592]])
+>>> output = model(input_ids)
+>>> print(output.logits)
+tensor([[-0.1008, -0.4061]], grad_fn=)
+```
+
+Most of the time, you should provide an `attention_mask` to your model to ignore the padding tokens to avoid this silent error. Now the output of the second sequence matches its actual output:
+
+
+
+By default, the tokenizer creates an `attention_mask` for you based on your specific tokenizer's defaults.
+
+
+
+```py
+>>> attention_mask = torch.tensor([[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0]])
+>>> output = model(input_ids, attention_mask=attention_mask)
+>>> print(output.logits)
+tensor([[ 0.0082, -0.2307],
+ [-0.1008, -0.4061]], grad_fn=)
+```
+
+๐ค Transformers doesn't automatically create an `attention_mask` to mask a padding token if it is provided because:
+
+- Some models don't have a padding token.
+- For some use-cases, users want a model to attend to a padding token.
+
+## ValueError: Unrecognized configuration class XYZ for this kind of AutoModel
+
+Generally, we recommend using the [`AutoModel`] class to load pretrained instances of models. This class
+can automatically infer and load the correct architecture from a given checkpoint based on the configuration. If you see
+this `ValueError` when loading a model from a checkpoint, this means the Auto class couldn't find a mapping from
+the configuration in the given checkpoint to the kind of model you are trying to load. Most commonly, this happens when a
+checkpoint doesn't support a given task.
+For instance, you'll see this error in the following example because there is no GPT2 for question answering:
+
+```py
+>>> from transformers import AutoProcessor, AutoModelForQuestionAnswering
+
+>>> processor = AutoProcessor.from_pretrained("openai-community/gpt2-medium")
+>>> model = AutoModelForQuestionAnswering.from_pretrained("openai-community/gpt2-medium")
+ValueError: Unrecognized configuration class for this kind of AutoModel: AutoModelForQuestionAnswering.
+Model type should be one of AlbertConfig, BartConfig, BertConfig, BigBirdConfig, BigBirdPegasusConfig, BloomConfig, ...
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/_config.py b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/_config.py
new file mode 100644
index 0000000000000000000000000000000000000000..f49e4e4731965a504b8da443c2cd979638cd22bb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/_config.py
@@ -0,0 +1,14 @@
+# docstyle-ignore
+INSTALL_CONTENT = """
+# Transformers installation
+! pip install transformers datasets evaluate accelerate
+# To install from source instead of the last release, comment the command above and uncomment the following one.
+# ! pip install git+https://github.com/huggingface/transformers.git
+"""
+
+notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
+black_avoid_patterns = {
+ "{processor_class}": "FakeProcessorClass",
+ "{model_class}": "FakeModelClass",
+ "{object_class}": "FakeObjectClass",
+}
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/_toctree.yml b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/_toctree.yml
new file mode 100644
index 0000000000000000000000000000000000000000..45dd27abaf100af249b6893ddb855505e464adc2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/_toctree.yml
@@ -0,0 +1,109 @@
+- sections:
+ - local: index
+ title: ๐ค Transformers
+ - local: quicktour
+ title: Tour rรกpido
+ - local: installation
+ title: Instalaciรณn
+ title: Empezar
+- sections:
+ - local: pipeline_tutorial
+ title: Pipelines para inferencia
+ - local: autoclass_tutorial
+ title: Carga instancias preentrenadas con un AutoClass
+ - local: preprocessing
+ title: Preprocesamiento
+ - local: training
+ title: Fine-tuning a un modelo pre-entrenado
+ - local: accelerate
+ title: Entrenamiento distribuido con ๐ค Accelerate
+ - local: model_sharing
+ title: Compartir un modelo
+ title: Tutoriales
+- sections:
+ - isExpanded: false
+ sections:
+ - local: tasks/question_answering
+ title: Respuesta a preguntas
+ - local: tasks/language_modeling
+ title: Modelado de lenguaje
+ - local: tasks/summarization
+ title: Generaciรณn de resรบmenes
+ - local: tasks/multiple_choice
+ title: Selecciรณn mรบltiple
+ - local: tasks/image_captioning
+ title: Subtรญtulos de imรกgenes
+ title: Procesamiento del Lenguaje Natural
+ - isExpanded: false
+ sections:
+ - local: tasks/asr
+ title: Reconocimiento automรกtico del habla
+ title: Audio
+ - isExpanded: false
+ sections:
+ - local: tasks/image_classification
+ title: Clasificaciรณn de imรกgenes
+ title: Visiรณn Artificial
+ title: Guรญas prรกcticas
+- sections:
+ - local: fast_tokenizers
+ title: Usa tokenizadores de ๐ค Tokenizers
+ - local: multilingual
+ title: Modelos multilingรผes para inferencia
+ - local: create_a_model
+ title: Crea una arquitectura personalizada
+ - local: custom_models
+ title: Compartir modelos personalizados
+ - local: run_scripts
+ title: Entrenamiento con scripts
+ - local: chat_templating
+ title: Plantillas para Modelos de Chat
+ - local: trainer
+ title: Entrenador
+ - local: sagemaker
+ title: Ejecutar el entrenamiento en Amazon SageMaker
+ - local: converting_tensorflow_models
+ title: Convertir checkpoints de TensorFlow
+ - local: serialization
+ title: Exportar a ONNX
+ - local: torchscript
+ title: Exportar a TorchScript
+ - local: community
+ title: Los recursos de la comunidad
+ title: Guรญas para desarrolladores
+- sections:
+ - local: performance
+ title: Descripciรณn general
+ - local: debugging
+ title: Debugging
+ title: Rendimiento y escalabilidad
+- sections:
+ - local: add_new_pipeline
+ title: ยฟCรณmo puedo aรฑadir un pipeline a ๐ค Transformers?
+ - local: pr_checks
+ title: Verificaciones en un Pull Request
+ title: Contribuir
+- sections:
+ - local: philosophy
+ title: Filosofรญa
+ - local: glossary
+ title: Glosario
+ - local: task_summary
+ title: Lo que ๐ค Transformers puede hacer
+ - local: tasks_explained
+ title: Como los ๐ค Transformers resuelven tareas
+ - local: tokenizer_summary
+ title: Descripciรณn general de los tokenizadores
+ - local: attention
+ title: Mecanismos de atenciรณn
+ - local: pad_truncation
+ title: Relleno y truncamiento
+ - local: bertology
+ title: BERTologรญa
+ - local: perplexity
+ title: Perplejidad de los modelos de longitud fija
+ - local: pipeline_webserver
+ title: Flujo de trabajo para la inferencia de los servidores web
+ - local: model_memory_anatomy
+ title: Anatomรญa del entrenamiento de los modelos
+ title: Guรญas conceptuales
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/accelerate.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/accelerate.md
new file mode 100644
index 0000000000000000000000000000000000000000..2c4063b7ca3bca9a992ca4e407f96e51bb767a75
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/accelerate.md
@@ -0,0 +1,136 @@
+
+
+# Entrenamiento distribuido con ๐ค Accelerate
+
+El paralelismo ha emergido como una estrategia para entrenar modelos grandes en hardware limitado e incrementar la velocidad de entrenamiento en varios รณrdenes de magnitud. En Hugging Face creamos la biblioteca [๐ค Accelerate](https://huggingface.co/docs/accelerate) para ayudar a los usuarios a entrenar modelos ๐ค Transformers en cualquier tipo de configuraciรณn distribuida, ya sea en una mรกquina con mรบltiples GPUs o en mรบltiples GPUs distribuidas entre muchas mรกquinas. En este tutorial aprenderรกs cรณmo personalizar tu bucle de entrenamiento de PyTorch nativo para poder entrenar en entornos distribuidos.
+
+## Configuraciรณn
+
+Empecemos por instalar ๐ค Accelerate:
+
+```bash
+pip install accelerate
+```
+
+Luego, importamos y creamos un objeto [`Accelerator`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator). `Accelerator` detectarรก automรกticamente el tipo de configuraciรณn distribuida que tengas disponible e inicializarรก todos los componentes necesarios para el entrenamiento. No necesitas especificar el dispositivo en donde se debe colocar tu modelo.
+
+```py
+>>> from accelerate import Accelerator
+
+>>> accelerator = Accelerator()
+```
+
+## Prepรกrate para acelerar
+
+Pasa todos los objetos relevantes para el entrenamiento al mรฉtodo [`prepare`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator.prepare). Esto incluye los DataLoaders de entrenamiento y evaluaciรณn, un modelo y un optimizador:
+
+```py
+>>> train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
+... train_dataloader, eval_dataloader, model, optimizer
+... )
+```
+
+## Backward
+
+Por รบltimo, reemplaza el tรญpico `loss.backward()` en tu bucle de entrenamiento con el mรฉtodo [`backward`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator.backward) de ๐ค Accelerate:
+
+```py
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... outputs = model(**batch)
+... loss = outputs.loss
+... accelerator.backward(loss)
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+Como se puede ver en el siguiente cรณdigo, ยกsolo necesitas adicionar cuatro lรญneas de cรณdigo a tu bucle de entrenamiento para habilitar el entrenamiento distribuido!
+
+```diff
++ from accelerate import Accelerator
+ from transformers import AdamW, AutoModelForSequenceClassification, get_scheduler
+
++ accelerator = Accelerator()
+
+ model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
+ optimizer = AdamW(model.parameters(), lr=3e-5)
+
+- device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+- model.to(device)
+
++ train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
++ train_dataloader, eval_dataloader, model, optimizer
++ )
+
+ num_epochs = 3
+ num_training_steps = num_epochs * len(train_dataloader)
+ lr_scheduler = get_scheduler(
+ "linear",
+ optimizer=optimizer,
+ num_warmup_steps=0,
+ num_training_steps=num_training_steps
+ )
+
+ progress_bar = tqdm(range(num_training_steps))
+
+ model.train()
+ for epoch in range(num_epochs):
+ for batch in train_dataloader:
+- batch = {k: v.to(device) for k, v in batch.items()}
+ outputs = model(**batch)
+ loss = outputs.loss
+- loss.backward()
++ accelerator.backward(loss)
+
+ optimizer.step()
+ lr_scheduler.step()
+ optimizer.zero_grad()
+ progress_bar.update(1)
+```
+
+## Entrenamiento
+
+Una vez que hayas aรฑadido las lรญneas de cรณdigo relevantes, inicia el entrenamiento desde un script o notebook como Colaboratory.
+
+### Entrenar con un script
+
+Si estรกs corriendo tu entrenamiento desde un script ejecuta el siguiente comando para crear y guardar un archivo de configuraciรณn:
+
+```bash
+accelerate config
+```
+
+Comienza el entrenamiento con:
+
+```bash
+accelerate launch train.py
+```
+
+### Entrenar con un notebook
+
+๐ค Accelerate puede correr en un notebook si, por ejemplo, estรกs planeando utilizar las TPUs de Colaboratory. Encierra el cรณdigo responsable del entrenamiento en una funciรณn y pรกsalo a `notebook_launcher`:
+
+```py
+>>> from accelerate import notebook_launcher
+
+>>> notebook_launcher(training_function)
+```
+
+Para obtener mรกs informaciรณn sobre ๐ค Accelerate y sus numerosas funciones, consulta la [documentaciรณn](https://huggingface.co/docs/accelerate).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/add_new_pipeline.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/add_new_pipeline.md
new file mode 100644
index 0000000000000000000000000000000000000000..4ccacbd18a1853e55de5cbc41849284c3bdfd492
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/add_new_pipeline.md
@@ -0,0 +1,260 @@
+
+
+# ยฟCรณmo puedo crear un pipeline personalizado?
+
+En esta guรญa, veremos cรณmo crear un pipeline personalizado y cรณmo compartirlo en el [Hub](https://hf.co/models) o aรฑadirlo
+a la biblioteca ๐ค Transformers.
+
+En primer lugar, debes decidir las entradas que tu pipeline podrรก recibir. Pueden ser strings, bytes,
+diccionarios o lo que te parezca que vaya a ser la entrada mรกs apropiada. Intenta mantener estas entradas en un
+formato que sea tan Python puro como sea posible, puesto que esto facilita la compatibilidad (incluso con otros
+lenguajes de programaciรณn por medio de JSON). Estos serรกn los `inputs` (entradas) del pipeline (`preprocess`).
+
+Ahora debes definir los `outputs` (salidas). Al igual que con los `inputs`, entre mรกs simple el formato, mejor.
+Estas serรกn las salidas del mรฉtodo `postprocess` (posprocesamiento).
+
+Empieza heredando la clase base `Pipeline` con los 4 mรฉtodos que debemos implementar: `preprocess` (preprocesamiento),
+`_forward` (ejecuciรณn), `postprocess` (posprocesamiento) y `_sanitize_parameters` (verificar parรกmetros).
+
+```python
+from transformers import Pipeline
+
+
+class MyPipeline(Pipeline):
+ def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "maybe_arg" in kwargs:
+ preprocess_kwargs["maybe_arg"] = kwargs["maybe_arg"]
+ return preprocess_kwargs, {}, {}
+
+ def preprocess(self, inputs, maybe_arg=2):
+ model_input = Tensor(inputs["input_ids"])
+ return {"model_input": model_input}
+
+ def _forward(self, model_inputs):
+ # model_inputs == {"model_input": model_input}
+ outputs = self.model(**model_inputs)
+ # Quizรก {"logits": Tensor(...)}
+ return outputs
+
+ def postprocess(self, model_outputs):
+ best_class = model_outputs["logits"].softmax(-1)
+ return best_class
+```
+
+La estructura de este desglose es asรญ para garantizar una compatibilidad mรกs o menos transparente con el uso de
+CPU/GPU y el pre/posprocesamiento en CPU en varios hilos.
+
+`preprocess` tomarรก las entradas definidas originalmente y las convertirรก en algo que se le pueda pasar al modelo.
+Podrรญa contener mรกs informaciรณn y a menudo es un objeto `Dict` (diccionario).
+
+`_forward` contiene los detalles de la implementaciรณn y no deberรญa ser invocado de forma directa. `forward` es el
+mรฉtodo preferido a utilizar pues contiene verificaciones para asegurar que todo funcione en el dispositivo correcto.
+Cualquier cosa que estรฉ relacionada con un modelo real deberรญa ir en el mรฉtodo `_forward`, todo lo demรกs va en
+los mรฉtodos de preprocesamiento y posprocesamiento.
+
+Los mรฉtodos `postprocess` reciben la salida `_forward` y la convierten en la salida final que decidimos
+anteriormente.
+
+`_sanitize_parameters` existe para permitir a los usuarios pasar cualesquiera parรกmetros cuando lo deseen, ya
+sea al momento de inicializar el pipeline `pipeline(...., maybe_arg=4)` o al momento de invocarlo
+`pipe = pipeline(...); output = pipe(...., maybe_arg=4)`.
+
+
+El mรฉtodo `_sanitize_parameters` devuelve 3 diccionarios de kwargs que serรกn pasados directamente a `preprocess`,
+`_forward` y `postprocess`. No ingreses nada si el caller no se va a invocar con parรกmetros adicionales.
+Esto permite mantener los parรกmetros por defecto de la definiciรณn de la funciรณn, lo que es mรกs "natural".
+
+Un ejemplo clรกsico serรญa un argumento `top_k` en el posprocesamiento de una tarea de clasificaciรณn.
+
+```python
+>>> pipe = pipeline("my-new-task")
+>>> pipe("This is a test")
+[{"label": "1-star", "score": 0.8}, {"label": "2-star", "score": 0.1}, {"label": "3-star", "score": 0.05}
+{"label": "4-star", "score": 0.025}, {"label": "5-star", "score": 0.025}]
+
+>>> pipe("This is a test", top_k=2)
+[{"label": "1-star", "score": 0.8}, {"label": "2-star", "score": 0.1}]
+```
+
+Para lograrlo, actualizaremos nuestro mรฉtodo `postprocess` con un valor por defecto de `5` y modificaremos
+`_sanitize_parameters` para permitir este nuevo parรกmetro.
+
+
+```python
+def postprocess(self, model_outputs, top_k=5):
+ best_class = model_outputs["logits"].softmax(-1)
+ # Aรฑade la lรณgica para manejar el top_k
+ return best_class
+
+
+def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "maybe_arg" in kwargs:
+ preprocess_kwargs["maybe_arg"] = kwargs["maybe_arg"]
+
+ postprocess_kwargs = {}
+ if "top_k" in kwargs:
+ postprocess_kwargs["top_k"] = kwargs["top_k"]
+ return preprocess_kwargs, {}, postprocess_kwargs
+```
+
+Intenta que las entradas y salidas sean muy simples e, idealmente, que puedan serializarse como JSON, pues esto
+hace el uso del pipeline muy sencillo sin que el usuario tenga que preocuparse por conocer nuevos tipos de objetos.
+Tambiรฉn es relativamente comรบn tener compatibilidad con muchos tipos diferentes de argumentos por facilidad de uso
+(por ejemplo, los archivos de audio pueden ser nombres de archivo, URLs o bytes).
+
+
+## Aรฑadirlo a la lista de tareas
+
+Para registrar tu `new-task` (nueva tarea) en la lista de tareas, debes aรฑadirla al
+`PIPELINE_REGISTRY` (registro de pipelines):
+
+```python
+from transformers.pipelines import PIPELINE_REGISTRY
+
+PIPELINE_REGISTRY.register_pipeline(
+ "new-task",
+ pipeline_class=MyPipeline,
+ pt_model=AutoModelForSequenceClassification,
+)
+```
+
+Puedes especificar un modelo por defecto si lo deseas, en cuyo caso debe venir con una versiรณn especรญfica (que puede ser el nombre de un branch o hash de commit, en este caso usamos `"abcdef"`), asรญ como el tipo:
+
+```python
+PIPELINE_REGISTRY.register_pipeline(
+ "new-task",
+ pipeline_class=MyPipeline,
+ pt_model=AutoModelForSequenceClassification,
+ default={"pt": ("user/awesome_model", "abcdef")},
+ type="text", # tipo de datos que maneja: texto, audio, imagen, multi-modalidad
+)
+```
+
+## Comparte tu pipeline en el Hub
+
+Para compartir tu pipeline personalizado en el Hub, solo tienes que guardar el cรณdigo personalizado de tu sub-clase
+`Pipeline` en un archivo de Python. Por ejemplo, digamos que queremos usar un pipeline personalizado para la
+clasificaciรณn de duplas de oraciones de esta forma:
+
+```py
+import numpy as np
+
+from transformers import Pipeline
+
+
+def softmax(outputs):
+ maxes = np.max(outputs, axis=-1, keepdims=True)
+ shifted_exp = np.exp(outputs - maxes)
+ return shifted_exp / shifted_exp.sum(axis=-1, keepdims=True)
+
+
+class PairClassificationPipeline(Pipeline):
+ def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "second_text" in kwargs:
+ preprocess_kwargs["second_text"] = kwargs["second_text"]
+ return preprocess_kwargs, {}, {}
+
+ def preprocess(self, text, second_text=None):
+ return self.tokenizer(text, text_pair=second_text, return_tensors=self.framework)
+
+ def _forward(self, model_inputs):
+ return self.model(**model_inputs)
+
+ def postprocess(self, model_outputs):
+ logits = model_outputs.logits[0].numpy()
+ probabilities = softmax(logits)
+
+ best_class = np.argmax(probabilities)
+ label = self.model.config.id2label[best_class]
+ score = probabilities[best_class].item()
+ logits = logits.tolist()
+ return {"label": label, "score": score, "logits": logits}
+```
+
+La implementaciรณn es independiente del framework y funcionarรก con modelos de PyTorch y TensorFlow. Si guardamos
+esto en un archivo llamado `pair_classification.py`, podemos importarlo y registrarlo de la siguiente manera:
+
+```py
+from pair_classification import PairClassificationPipeline
+from transformers.pipelines import PIPELINE_REGISTRY
+from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification
+
+PIPELINE_REGISTRY.register_pipeline(
+ "pair-classification",
+ pipeline_class=PairClassificationPipeline,
+ pt_model=AutoModelForSequenceClassification,
+ tf_model=TFAutoModelForSequenceClassification,
+)
+```
+
+Una vez hecho esto, podemos usarlo con un modelo pre-entrenado. Por ejemplo, al modelo `sgugger/finetuned-bert-mrpc`
+se le hizo fine-tuning con el dataset MRPC, en el cual se clasifican duplas de oraciones como parรกfrasis o no.
+
+```py
+from transformers import pipeline
+
+classifier = pipeline("pair-classification", model="sgugger/finetuned-bert-mrpc")
+```
+
+Ahora podemos compartirlo en el Hub usando el mรฉtodo `save_pretrained`:
+
+```py
+classifier.push_to_hub("test-dynamic-pipeline")
+```
+
+Esto copiarรก el archivo donde definiste `PairClassificationPipeline` dentro de la carpeta `"test-dynamic-pipeline"`,
+y ademรกs guardarรก el modelo y el tokenizer del pipeline, antes de enviar todo al repositorio
+`{your_username}/test-dynamic-pipeline`. Despuรฉs de esto, cualquier persona puede usarlo siempre que usen la opciรณn
+`trust_remote_code=True` (confiar en cรณdigo remoto):
+
+```py
+from transformers import pipeline
+
+classifier = pipeline(model="{your_username}/test-dynamic-pipeline", trust_remote_code=True)
+```
+
+## Aรฑadir el pipeline a ๐ค Transformers
+
+Si quieres contribuir tu pipeline a la biblioteca ๐ค Transformers, tendrรกs que aรฑadirlo a un nuevo mรณdulo en el
+sub-mรณdulo `pipelines` con el cรณdigo de tu pipeline. Luego, debes aรฑadirlo a la lista de tareas definidas en
+`pipelines/__init__.py`.
+
+A continuaciรณn tienes que aรฑadir las pruebas. Crea un nuevo archivo llamado `tests/test_pipelines_MY_PIPELINE.py`
+basรกndote en las pruebas existentes.
+
+La funciรณn `run_pipeline_test` serรก muy genรฉrica y se correrรก sobre modelos pequeรฑos escogidos al azar sobre todas las
+arquitecturas posibles definidas en `model_mapping` y `tf_model_mapping`.
+
+Esto es muy importante para probar compatibilidades a futuro, lo que significa que si alguien aรฑade un nuevo modelo
+para `XXXForQuestionAnswering` entonces el pipeline intentarรก ejecutarse con ese modelo. Ya que los modelos son aleatorios,
+es imposible verificar los valores como tales, y es por eso que hay un helper `ANY` que simplemente intentarรก que la
+salida tenga el mismo tipo que la salida esperada del pipeline.
+
+Tambiรฉn *debes* implementar 2 (preferiblemente 4) pruebas:
+
+- `test_small_model_pt` : Define un (1) modelo pequeรฑo para este pipeline (no importa si los resultados no tienen sentido)
+y prueba las salidas del pipeline. Los resultados deberรญan ser los mismos que en `test_small_model_tf`.
+- `test_small_model_tf` : Define un (1) modelo pequeรฑo para este pipeline (no importa si los resultados no tienen sentido)
+y prueba las salidas del pipeline. Los resultados deberรญan ser los mismos que en `test_small_model_pt`.
+- `test_large_model_pt` (`optional`): Prueba el pipeline en una tarea real en la que los resultados deben tener sentido.
+Estas pruebas son lentas y deben marcarse como tales. El objetivo de esto es ejemplificar el pipeline y asegurarse de que
+no haya divergencias en versiones futuras.
+- `test_large_model_tf` (`optional`): Prueba el pipeline en una tarea real en la que los resultados deben tener sentido.
+Estas pruebas son lentas y deben marcarse como tales. El objetivo de esto es ejemplificar el pipeline y asegurarse de que
+no haya divergencias en versiones futuras.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/attention.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/attention.md
new file mode 100644
index 0000000000000000000000000000000000000000..12b774ed88622da9ec721dd3dbdd08381d589c16
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/attention.md
@@ -0,0 +1,41 @@
+
+
+# Mecanismos de atenciรณn
+
+La mayorรญa de los modelos transformers utilizan atenciรณn completa, en el sentido de que la matriz de atenciรณn es cuadrada. Esto puede ser un gran cuello de botella computacional cuando tienes textos largos. `Longformer` y `reformer` son modelos que intentan ser mรกs eficientes y utilizan una versiรณn dispersa de la matriz de atenciรณn para acelerar el entrenamiento.
+
+## Atenciรณn LSH
+
+[Reformer](https://huggingface.co/docs/transformers/model_doc/reformer) utiliza atenciรณn LSH. En el softmax(QK^t), solo los elementos mรกs grandes (en la dimensiรณn softmax) de la matriz QK^t van a dar contribuciones รบtiles. Entonces, para cada consulta q en Q, podemos considerar solo las claves k en K que estรฉn cerca de q. Se utiliza una funciรณn hash para determinar si q y k estรกn cerca. La mรกscara de atenciรณn se modifica para enmascarar el token actual (excepto en la primera posiciรณn), porque darรก una consulta y una clave iguales (entonces muy similares entre sรญ). Dado que el hash puede ser un poco aleatorio, en la prรกctica se utilizan varias funciones hash (determinadas por un parรกmetro n_rounds) y luego se promedian juntas.
+
+## Atenciรณn local
+
+[Longformer](https://huggingface.co/docs/transformers/model_doc/longformer) utiliza atenciรณn local: a menudo, el contexto local (por ejemplo, ยฟcuรกles son los dos tokens a la izquierda y a la derecha?) es suficiente para tomar acciรณn para un token dado. Ademรกs, apilando capas de atenciรณn que tienen una ventana pequeรฑa, la รบltima capa tendrรก un campo receptivo mayor que solamente los tokens en la ventana, lo que les permite construir una representaciรณn de toda la oraciรณn.
+
+Algunos tokens de entrada preseleccionados tambiรฉn reciben atenciรณn global: para esos pocos tokens, la matriz de atenciรณn puede acceder a todos los tokens y este proceso es simรฉtrico: todos los demรกs tokens tienen acceso a esos tokens especรญficos (ademรกs de los que estรกn en su ventana local). Esto se muestra en la Figura 2d del artรญculo, el cual se puede apreciar un ejemplo de una mรกscara de atenciรณn:
+
+
+
+
+
+El uso de dichas matrices de atenciรณn con menos parรกmetros permite que el modelo tenga entradas con una longitud de secuencia mayor.
+
+## Otros trucos
+
+### Codificaciรณn posicional axial
+
+[Reformer](https://huggingface.co/docs/transformers/model_doc/reformer) utiliza codificaciรณn posicional axial: en los modelos transformers tradicionales, la codificaciรณn posicional E es una matriz de tamaรฑo \\(l\\) por \\(d\\), donde \\(l\\) es la longitud de la secuencia y \\(d\\) es la dimensiรณn del estado oculto. Si tienes textos muy extensos, esta matriz puede ser enorme y ocupar demasiado espacio en la GPU. Para aliviar eso, las codificaciones posicionales axiales consisten en factorizar esa gran matriz E en dos matrices mรกs pequeรฑas E1 y E2, con dimensiones \\(l_{1} \times d_{1}\\) y \\(l_{2} \times d_{2}\\), tal que \\(l_{1} \times l_{2} = l\\) y \\(d_{1} + d_{2} = d\\) (con el producto de las longitudes, esto termina siendo mucho mรกs pequeรฑo). La incrustaciรณn (embedding) para el paso de tiempo \\(j\\) en E se obtiene concatenando las incrustaciones para el paso de tiempo \\(j \% l1\\) en E1 y \\(j // l1\\) en E2.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/autoclass_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/autoclass_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..cea44c3c1ea6cf1ef4cce7d02c419a47f512e474
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/autoclass_tutorial.md
@@ -0,0 +1,123 @@
+
+
+# Carga instancias preentrenadas con un AutoClass
+
+Con tantas arquitecturas diferentes de Transformer puede ser retador crear una para tu checkpoint. Como parte de la filosofรญa central de ๐ค Transformers para hacer que la biblioteca sea fรกcil, simple y flexible de usar; una `AutoClass` automรกticamente infiere y carga la arquitectura correcta desde un checkpoint dado. El mรฉtodo `from_pretrained` te permite cargar rรกpidamente un modelo preentrenado para cualquier arquitectura, por lo que no tendrรกs que dedicar tiempo y recursos para entrenar uno desde cero. Producir este tipo de cรณdigo con checkpoint implica que si funciona con uno, funcionarรก tambiรฉn con otro (siempre que haya sido entrenado para una tarea similar) incluso si la arquitectura es distinta.
+
+
+
+Recuerda, la arquitectura se refiere al esqueleto del modelo y los checkpoints son los pesos para una arquitectura dada. Por ejemplo, [BERT](https://huggingface.co/google-bert/bert-base-uncased) es una arquitectura, mientras que `google-bert/bert-base-uncased` es un checkpoint. Modelo es un tรฉrmino general que puede significar una arquitectura o un checkpoint.
+
+
+
+En este tutorial, aprenderรกs a:
+
+* Cargar un tokenizador pre-entrenado.
+* Cargar un extractor de caracterรญsticas (feature extractor en inglรฉs) pre-entrenado.
+* Cargar un procesador pre-entrenado.
+* Cargar un modelo pre-entrenado.
+
+## AutoTokenizer
+
+Casi cualquier tarea de Procesamiento de Lenguaje Natural comienza con un tokenizador. Un tokenizador convierte tu input a un formato que puede ser procesado por el modelo.
+
+Carga un tokenizador con [`AutoTokenizer.from_pretrained`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
+```
+
+Luego tokeniza tu input como lo mostrado a continuaciรณn:
+
+```py
+>>> sequence = "In a hole in the ground there lived a hobbit."
+>>> print(tokenizer(sequence))
+{'input_ids': [101, 1999, 1037, 4920, 1999, 1996, 2598, 2045, 2973, 1037, 7570, 10322, 4183, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+## AutoFeatureExtractor
+
+Para tareas de audio y visiรณn, un extractor de caracterรญsticas procesa la seรฑal de audio o imagen al formato de input correcto.
+
+Carga un extractor de caracterรญsticas con [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained(
+... "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
+... )
+```
+
+## AutoProcessor
+
+Las tareas multimodales requieren un procesador que combine dos tipos de herramientas de preprocesamiento. Por ejemplo, el modelo [LayoutLMV2](model_doc/layoutlmv2) requiere que un extractor de caracterรญsticas maneje las imรกgenes y que un tokenizador maneje el texto; un procesador combina ambas.
+
+Carga un procesador con [`AutoProcessor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("microsoft/layoutlmv2-base-uncased")
+```
+
+## AutoModel
+
+
+
+Finalmente, las clases `AutoModelFor` te permiten cargar un modelo preentrenado para una tarea dada (revisa [aquรญ](model_doc/auto) para conocer la lista completa de tareas disponibles). Por ejemplo, cargue un modelo para clasificaciรณn de secuencias con [`AutoModelForSequenceClassification.from_pretrained`]:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Reutiliza fรกcilmente el mismo checkpoint para cargar una aquitectura para alguna tarea diferente:
+
+```py
+>>> from transformers import AutoModelForTokenClassification
+
+>>> model = AutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Generalmente recomendamos utilizar las clases `AutoTokenizer` y `AutoModelFor` para cargar instancias pre-entrenadas de modelos. รsto asegurarรก que cargues la arquitectura correcta en cada ocasiรณn. En el siguiente [tutorial](preprocessing), aprende a usar tu tokenizador reciรฉn cargado, el extractor de caracterรญsticas y el procesador para preprocesar un dataset para fine-tuning.
+
+
+Finalmente, la clase `TFAutoModelFor` te permite cargar tu modelo pre-entrenado para una tarea dada (revisa [aquรญ](model_doc/auto) para conocer la lista completa de tareas disponibles). Por ejemplo, carga un modelo para clasificaciรณn de secuencias con [`TFAutoModelForSequenceClassification.from_pretrained`]:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Reutiliza fรกcilmente el mismo checkpoint para cargar una aquitectura para alguna tarea diferente:
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Generalmente recomendamos utilizar las clases `AutoTokenizer` y `TFAutoModelFor` para cargar instancias de modelos pre-entrenados. รsto asegurarรก que cargues la arquitectura correcta cada vez. En el siguiente [tutorial](preprocessing), aprende a usar tu tokenizador reciรฉn cargado, el extractor de caracterรญsticas y el procesador para preprocesar un dataset para fine-tuning.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/bertology.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/bertology.md
new file mode 100644
index 0000000000000000000000000000000000000000..ed4e12a8d59ceb47521ab55bb40d7878a0298b46
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/bertology.md
@@ -0,0 +1,41 @@
+
+
+# BERTologรญa
+
+Hay un creciente campo de estudio empeรฑado en la investigaciรณn del funcionamiento interno de los transformers de gran escala como BERT
+(que algunos llaman "BERTologรญa"). Algunos buenos ejemplos de este campo son:
+
+
+- BERT Rediscovers the Classical NLP Pipeline por Ian Tenney, Dipanjan Das, Ellie Pavlick:
+ https://arxiv.org/abs/1905.05950
+- Are Sixteen Heads Really Better than One? por Paul Michel, Omer Levy, Graham Neubig: https://arxiv.org/abs/1905.10650
+- What Does BERT Look At? An Analysis of BERT's Attention por Kevin Clark, Urvashi Khandelwal, Omer Levy, Christopher D.
+ Manning: https://arxiv.org/abs/1906.04341
+- CAT-probing: A Metric-based Approach to Interpret How Pre-trained Models for Programming Language Attend Code Structure: https://arxiv.org/abs/2210.04633
+
+Para asistir al desarrollo de este nuevo campo, hemos incluido algunas features adicionales en los modelos BERT/GPT/GPT-2 para
+ayudar a acceder a las representaciones internas, principalmente adaptado de la gran obra de Paul Michel
+(https://arxiv.org/abs/1905.10650):
+
+
+- accediendo a todos los hidden-states de BERT/GPT/GPT-2,
+- accediendo a todos los pesos de atenciรณn para cada head de BERT/GPT/GPT-2,
+- adquiriendo los valores de salida y gradientes de las heads para poder computar la mรฉtrica de importancia de las heads y realizar la poda de heads como se explica
+ en https://arxiv.org/abs/1905.10650.
+
+Para ayudarte a entender y usar estas features, hemos aรฑadido un script especรญfico de ejemplo: [bertology.py](https://github.com/huggingface/transformers/tree/main/examples/research_projects/bertology/run_bertology.py) mientras extraes informaciรณn y cortas un modelo pre-entrenado en
+GLUE.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/chat_templating.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/chat_templating.md
new file mode 100644
index 0000000000000000000000000000000000000000..e287c213743542779e5bfd5ac58ba38c5e1b557e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/chat_templating.md
@@ -0,0 +1,393 @@
+
+
+
+# Plantillas para Modelos de Chat
+
+## Introducciรณn
+
+Un caso de uso cada vez mรกs comรบn para LLMs es **el chat**. En un contexto de chat, en lugar de continuar una รบnica cadena de texto (como es el caso con un modelo de lenguaje estรกndar), el modelo continรบa una conversaciรณn que consta de uno o mรกs **mensajes**, cada uno de los cuales incluye un **rol**, como "usuario" o "asistente", asรญ como el texto del mensaje.
+Al igual que con la tokenizaciรณn, diferentes modelos esperan formatos de entrada muy diferentes para el chat. Esta es la razรณn por la que agregamos las plantillas de chat como una caracterรญstica. Las plantillas de chat son parte del tokenizador. Especifican cรณmo convertir conversaciones, representadas como listas de mensajes, en una รบnica cadena tokenizable en el formato que el modelo espera.
+Vamos a hacer esto con un ejemplo concreto utilizando el modelo `BlenderBot`. BlenderBot tiene una plantilla predeterminada extremadamente simple, que principalmente solo agrega espacios en blanco entre rondas de diรกlogo:
+
+```python
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
+
+>>> chat = [
+... {"role": "user", "content": "Hello, how are you?"},
+... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
+... {"role": "user", "content": "I'd like to show off how chat templating works!"},
+... ]
+
+>>> tokenizer.apply_chat_template(chat, tokenize=False)
+" Hello, how are you? I'm doing great. How can I help you today? I'd like to show off how chat templating works!"
+
+```
+Observa cรณmo todo el chat se condensa en una sola cadena. Si usamos `tokenize=True`, que es la configuraciรณn predeterminada, esa cadena tambiรฉn serรก tokenizada para nosotros. Sin embargo, para ver una plantilla mรกs compleja en acciรณn, usemos el modelo `mistralai/Mistral-7B-Instruct-v0.1`
+
+```python
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
+
+>>> chat = [
+... {"role": "user", "content": "Hello, how are you?"},
+... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
+... {"role": "user", "content": "I'd like to show off how chat templating works!"},
+... ]
+
+>>> tokenizer.apply_chat_template(chat, tokenize=False)
+"[INST] Hello, how are you? [/INST]I'm doing great. How can I help you today? [INST] I'd like to show off how chat templating works! [/INST]"
+```
+
+Ten en cuenta que esta vez, el tokenizador ha aรฑadido los tokens de control [INST] y [/INST] para indicar el inicio y el final de los mensajes de usuario (ยกpero no de los mensajes del asistente!). Mistral-instruct fue entrenado con estos tokens, pero BlenderBot no lo fue.
+
+## ยฟCรณmo uso las plantillas de chat?
+
+Como puedes ver en el ejemplo anterior, las plantillas de chat son fรกciles de usar. Simplemente construye una lista de mensajes, con claves de `rol` y `contenido`, y luego pรกsala al mรฉtodo [`~PreTrainedTokenizer.apply_chat_template`]. Una vez que hagas eso, ยกobtendrรกs una salida lista para usar! Al utilizar plantillas de chat como entrada para la generaciรณn de modelos, tambiรฉn es una buena idea usar `add_generation_prompt=True` para agregar una [indicaciรณn de generaciรณn](#ยฟQuรฉ-son-los-"generation-prompts"?).
+
+Aquรญ tienes un ejemplo de cรณmo preparar la entrada para `model.generate()` utilizando el modelo de asistente `Zephyr`:
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+checkpoint = "HuggingFaceH4/zephyr-7b-beta"
+tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+model = AutoModelForCausalLM.from_pretrained(checkpoint) # You may want to use bfloat16 and/or move to GPU here
+
+messages = [
+ {
+ "role": "system",
+ "content": "You are a friendly chatbot who always responds in the style of a pirate",
+ },
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
+ ]
+tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
+print(tokenizer.decode(tokenized_chat[0]))
+```
+
+Esto generarรก una cadena en el formato de entrada que Zephyr espera.
+
+```text
+<|system|>
+You are a friendly chatbot who always responds in the style of a pirate
+<|user|>
+How many helicopters can a human eat in one sitting?
+<|assistant|>
+```
+
+Ahora que nuestra entrada estรก formateada correctamente para Zephyr, podemos usar el modelo para generar una respuesta a la pregunta del usuario:
+
+```python
+outputs = model.generate(tokenized_chat, max_new_tokens=128)
+print(tokenizer.decode(outputs[0]))
+
+```
+Esto producirรก:
+
+```text
+<|system|>
+You are a friendly chatbot who always responds in the style of a pirate
+<|user|>
+How many helicopters can a human eat in one sitting?
+<|assistant|>
+Matey, I'm afraid I must inform ye that humans cannot eat helicopters. Helicopters are not food, they are flying machines. Food is meant to be eaten, like a hearty plate o' grog, a savory bowl o' stew, or a delicious loaf o' bread. But helicopters, they be for transportin' and movin' around, not for eatin'. So, I'd say none, me hearties. None at all.
+```
+
+ยกArr, al final resultรณ ser fรกcil!
+
+## ยฟExiste un pipeline automatizado para chats?
+
+Sรญ, lo hay! Nuestros canales de generaciรณn de texto admiten entradas de chat, cual facilita mรกs facรญl utilizar los modelos de chat. En el pasado, solรญamos utilizar una clase dedicada "ConversationalPipeline", pero ahora ha quedado obsoleta y su funcionalidad se ha fusionado en [`TextGenerationPipeline`]. Este pipeline estรก diseรฑado para facilitar el uso de modelos de chat. Intentemos el ejemplo de `Zephyr` de nuevo, pero esta vez utilizando el pipeline:
+
+```python
+from transformers import pipeline
+
+pipe = pipeline("conversational", "HuggingFaceH4/zephyr-7b-beta")
+messages = [
+ {
+ "role": "system",
+ "content": "You are a friendly chatbot who always responds in the style of a pirate",
+ },
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
+]
+print(pipe(messages, max_new_tokens=128)[0]['generated_text'][-1]) # Print the assistant's response
+```
+
+```text
+{'role': 'assistant', 'content': "Matey, I'm afraid I must inform ye that humans cannot eat helicopters. Helicopters are not food, they are flying machines. Food is meant to be eaten, like a hearty plate o' grog, a savory bowl o' stew, or a delicious loaf o' bread. But helicopters, they be for transportin' and movin' around, not for eatin'. So, I'd say none, me hearties. None at all."}
+```
+
+
+La canalizaciรณn se encargarรก de todos los detalles de la tokenizaciรณn y de llamar a `apply_chat_template` por ti. Una vez que el modelo tenga una plantilla de chat, ยกtodo lo que necesitas hacer es inicializar el pipeline y pasarle la lista de mensajes!
+
+# ยฟQuรฉ son los "generation prompts"?
+
+Puede que hayas notado que el mรฉtodo `apply_chat_template` tiene un argumento `add_generation_prompt`. Este argumento indica a la plantilla que agregue tokens que indiquen el inicio de una respuesta del bot. Por ejemplo, considera el siguiente chat:
+
+```python
+messages = [
+ {"role": "user", "content": "Hi there!"},
+ {"role": "assistant", "content": "Nice to meet you!"},
+ {"role": "user", "content": "Can I ask a question?"}
+]
+```
+
+Asรญ es cรณmo se verรก esto sin un "generation prompt", usando la plantilla ChatML que vimos en el ejemplo de Zephyr:
+
+```python
+tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=False)
+"""<|im_start|>user
+Hi there!<|im_end|>
+<|im_start|>assistant
+Nice to meet you!<|im_end|>
+<|im_start|>user
+Can I ask a question?<|im_end|>
+"""
+```
+
+Y asรญ es como se ve **con** un "generation prompt":
+
+```python
+tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
+"""<|im_start|>user
+Hi there!<|im_end|>
+<|im_start|>assistant
+Nice to meet you!<|im_end|>
+<|im_start|>user
+Can I ask a question?<|im_end|>
+<|im_start|>assistant
+"""
+```
+
+Ten en cuenta que esta vez, hemos agregado los tokens que indican el inicio de una respuesta del bot. Esto asegura que cuando el modelo genere texto, escribirรก una respuesta del bot en lugar de hacer algo inesperado, como continuar el mensaje del usuario. Recuerda, los modelos de chat siguen siendo solo modelos de lenguaje: estรกn entrenados para continuar texto, ยกy el chat es solo un tipo especial de texto para ellos! Necesitas guiarlos con los tokens de control apropiados para que sepan lo que se supone que deben estar haciendo.
+
+No todos los modelos requieren "generation prompts". Algunos modelos, como BlenderBot y LLaMA, no tienen ningรบn token especial antes de las respuestas del bot. En estos casos, el argumento `add_generation_prompt` no tendrรก ningรบn efecto. El efecto exacto que tiene `add_generation_prompt` dependerรก de la plantilla que se estรฉ utilizando.
+
+## ยฟPuedo usar plantillas de chat en el entrenamiento?
+
+ยกSรญ! Recomendamos que apliques la plantilla de chat como un paso de preprocesamiento para tu conjunto de datos. Despuรฉs de esto, simplemente puedes continuar como cualquier otra tarea de entrenamiento de modelos de lenguaje. Durante el entrenamiento, generalmente deberรญas establecer `add_generation_prompt=False`, porque los tokens aรฑadidos para solicitar una respuesta del asistente no serรกn รบtiles durante el entrenamiento. Veamos un ejemplo:
+
+```python
+from transformers import AutoTokenizer
+from datasets import Dataset
+
+tokenizer = AutoTokenizer.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
+
+chat1 = [
+ {"role": "user", "content": "Which is bigger, the moon or the sun?"},
+ {"role": "assistant", "content": "The sun."}
+]
+chat2 = [
+ {"role": "user", "content": "Which is bigger, a virus or a bacterium?"},
+ {"role": "assistant", "content": "A bacterium."}
+]
+
+dataset = Dataset.from_dict({"chat": [chat1, chat2]})
+dataset = dataset.map(lambda x: {"formatted_chat": tokenizer.apply_chat_template(x["chat"], tokenize=False, add_generation_prompt=False)})
+print(dataset['formatted_chat'][0])
+```
+
+Y obtenemos:
+
+```text
+<|user|>
+Which is bigger, the moon or the sun?
+<|assistant|>
+The sun.
+```
+
+Desde aquรญ, simplemente continรบa el entrenamiento como lo harรญas con una tarea estรกndar de modelado de lenguaje, utilizando la columna `formatted_chat`.
+
+## Avanzado: ยฟCรณmo funcionan las plantillas de chat?
+
+La plantilla de chat para un modelo se almacena en el atributo `tokenizer.chat_template`. Si no se establece ninguna plantilla de chat, se utiliza en su lugar la plantilla predeterminada para esa clase de modelo. Echemos un vistazo a la plantilla para `BlenderBot`:
+
+```python
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
+
+>>> tokenizer.chat_template
+"{% for message in messages %}{% if message['role'] == 'user' %}{{ ' ' }}{% endif %}{{ message['content'] }}{% if not loop.last %}{{ ' ' }}{% endif %}{% endfor %}{{ eos_token }}"
+```
+
+ยกEs un poco intimidante! Vamos a agregar algunas lรญneas nuevas y sangria para que sea mรกs legible. Ten en cuenta que la primera lรญnea nueva despuรฉs de cada bloque, asรญ como cualquier espacio en blanco anterior a un bloque, se ignoran de forma predeterminada, utilizando las banderas `trim_blocks` y `lstrip_blocks` de Jinja. Sin embargo, ยกten cuidado! Aunque el espacio en blanco inicial en cada lรญnea se elimina, los espacios entre bloques en la misma lรญnea no. ยกTe recomendamos encarecidamente que verifiques que tu plantilla no estรฉ imprimiendo espacios adicionales donde no deberรญa estarlo!
+
+```
+{% for message in messages %}
+ {% if message['role'] == 'user' %}
+ {{ ' ' }}
+ {% endif %}
+ {{ message['content'] }}
+ {% if not loop.last %}
+ {{ ' ' }}
+ {% endif %}
+{% endfor %}
+{{ eos_token }}
+```
+
+Si nunca has visto uno de estos antes, esto es una [plantilla de Jinja](https://jinja.palletsprojects.com/en/3.1.x/templates/). Jinja es un lenguaje de plantillas que te permite escribir cรณdigo simple que genera texto. En muchos aspectos, el cรณdigo y la sintaxis se asemejan a Python. En Python puro, esta plantilla se verรญa algo asรญ:
+
+```python
+for idx, message in enumerate(messages):
+ if message['role'] == 'user':
+ print(' ')
+ print(message['content'])
+ if not idx == len(messages) - 1: # Check for the last message in the conversation
+ print(' ')
+print(eos_token)
+```
+
+Efectivamente, la plantilla hace tres cosas:
+1. Para cada mensaje, si el mensaje es un mensaje de usuario, aรฑade un espacio en blanco antes de รฉl, de lo contrario no imprime nada.
+2. Aรฑade el contenido del mensaje.
+3. Si el mensaje no es el รบltimo mensaje, aรฑade dos espacios despuรฉs de รฉl. Despuรฉs del รบltimo mensaje, imprime el token EOS.
+
+Esta es una plantilla bastante simple: no aรฑade ningรบn token de control y no admite mensajes "del sistema", que son una forma comรบn de dar al modelo directivas sobre cรณmo debe comportarse en la conversaciรณn posterior. ยกPero Jinja te brinda mucha flexibilidad para hacer esas cosas! Veamos una plantilla de Jinja que pueda formatear las entradas de manera similar a la forma en que LLaMA las formatea (nota que la plantilla real de LLaMA incluye el manejo de mensajes del sistema predeterminados y el manejo de mensajes del sistema ligeramente diferentes en general; ยกno uses esta en tu cรณdigo real!)
+
+```
+{% for message in messages %}
+ {% if message['role'] == 'user' %}
+ {{ bos_token + '[INST] ' + message['content'] + ' [/INST]' }}
+ {% elif message['role'] == 'system' %}
+ {{ '<>\\n' + message['content'] + '\\n< >\\n\\n' }}
+ {% elif message['role'] == 'assistant' %}
+ {{ ' ' + message['content'] + ' ' + eos_token }}
+ {% endif %}
+{% endfor %}
+```
+
+Si observas esto por un momento, puedas ver lo que esta plantilla estรก haciendo: aรฑade tokens especรญficos basados en el "rol" de cada mensaje, que representa quiรฉn lo enviรณ. Los mensajes de usuario, asistente y sistema son claramente distinguibles para el modelo debido a los tokens en los que estรกn envueltos.
+
+## Avanzado: Aรฑadiendo y editando plantillas de chat
+
+### ยฟCรณmo creo una plantilla de chat?
+
+Simple, solo escribe una plantilla de Jinja y establece `tokenizer.chat_template`. ยกPuede resultarte mรกs fรกcil comenzar con una plantilla existente de otro modelo y simplemente editarla segรบn tus necesidades! Por ejemplo, podrรญamos tomar la plantilla de LLaMA de arriba y aรฑadir "[ASST]" y "[/ASST]" a los mensajes del asistente:
+
+```
+{% for message in messages %}
+ {% if message['role'] == 'user' %}
+ {{ bos_token + '[INST] ' + message['content'].strip() + ' [/INST]' }}
+ {% elif message['role'] == 'system' %}
+ {{ '<>\\n' + message['content'].strip() + '\\n< >\\n\\n' }}
+ {% elif message['role'] == 'assistant' %}
+ {{ '[ASST] ' + message['content'] + ' [/ASST]' + eos_token }}
+ {% endif %}
+{% endfor %}
+```
+
+Ahora, simplemente establece el atributo `tokenizer.chat_template`. ยกLa prรณxima vez que uses [`~PreTrainedTokenizer.apply_chat_template`], se utilizarรก tu nueva plantilla! Este atributo se guardarรก en el archivo tokenizer_config.json, por lo que puedes usar [`~utils.PushToHubMixin.push_to_hub`] para cargar tu nueva plantilla en el Hub y asegurarte de que todos estรฉn utilizando la plantilla correcta para tu modelo.
+
+```python
+template = tokenizer.chat_template
+template = template.replace("SYS", "SYSTEM") # Change the system token
+tokenizer.chat_template = template # Set the new template
+tokenizer.push_to_hub("model_name") # Upload your new template to the Hub!
+```
+
+El mรฉtodo [`~PreTrainedTokenizer.apply_chat_template`], que utiliza tu plantilla de chat, es llamado por la clase [`TextGenerationPipeline`], asรญ que una vez que configures la plantilla de chat correcta, tu modelo se volverรก automรกticamente compatible con [`TextGenerationPipeline`].
+
+
+
+Si estรกs ajustando finamente un modelo para chat, ademรกs de establecer una plantilla de chat, probablemente deberรญas agregar cualquier nuevo token de control de chat como los tokens especiales en el tokenizador. Los tokens especiales nunca se dividen, asegurando que tus tokens de control siempre se manejen como tokens รบnicos en lugar de ser tokenizados en piezas. Tambiรฉn deberรญas establecer el atributo `eos_token` del tokenizador con el token que marca el final de las generaciones del asistente en tu plantilla. Esto asegurarรก que las herramientas de generaciรณn de texto puedan determinar correctamente cuรกndo detener la generaciรณn de texto.
+
+
+
+### ยฟQuรฉ plantilla deberรญa usar?
+
+Cuando establezcas la plantilla para un modelo que ya ha sido entrenado para chat, debes asegurarte de que la plantilla coincida exactamente con el formato de mensajes que el modelo vio durante el entrenamiento, o de lo contrario es probable que experimentes degradaciรณn del rendimiento. Esto es cierto incluso si estรกs entrenando aรบn mรกs el modelo; probablemente obtendrรกs el mejor rendimiento si mantienes constantes los tokens de chat. Esto es muy anรกlogo a la tokenizaciรณn: generalmente obtienes el mejor rendimiento para la inferencia o el ajuste fino cuando coincides precisamente con la tokenizaciรณn utilizada durante el entrenamiento.
+
+Si estรกs entrenando un modelo desde cero o ajustando finamente un modelo de lenguaje base para chat, por otro lado, ยกtienes mucha libertad para elegir una plantilla apropiada! Los LLM son lo suficientemente inteligentes como para aprender a manejar muchos formatos de entrada diferentes. Nuestra plantilla predeterminada para modelos que no tienen una plantilla especรญfica de clase sigue el formato ChatML, y esta es una buena elecciรณn flexible para muchos casos de uso. Se ve asรญ:
+
+```
+{% for message in messages %}
+ {{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}
+{% endfor %}
+```
+
+Si te gusta esta plantilla, aquรญ estรก en forma de una sola lรญnea, lista para copiar en tu cรณdigo. La versiรณn de una sola lรญnea tambiรฉn incluye un prรกctico soporte para [prompts de generaciรณn](#ยฟQuรฉ-son-los-"generation-prompts"?), ยกpero ten en cuenta que no aรฑade tokens de BOS o EOS! Si tu modelo espera esos tokens, no se agregarรกn automรกticamente por `apply_chat_template`, en otras palabras, el texto serรก tokenizado con `add_special_tokens=False`. Esto es para evitar posibles conflictos entre la plantilla y la lรณgica de `add_special_tokens`. ยกSi tu modelo espera tokens especiales, asegรบrate de aรฑadirlos a la plantilla!
+
+```python
+tokenizer.chat_template = "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
+```
+
+Esta plantilla envuelve cada mensaje en tokens `<|im_start|>` y `<|im_end|>`, y simplemente escribe el rol como una cadena, lo que permite flexibilidad en los roles con los que entrenas. La salida se ve asรญ:
+
+```text
+<|im_start|>system
+You are a helpful chatbot that will do its best not to say anything so stupid that people tweet about it.<|im_end|>
+<|im_start|>user
+How are you?<|im_end|>
+<|im_start|>assistant
+I'm doing great!<|im_end|>
+```
+
+Los roles "usuario", "sistema" y "asistente" son los estรกndar para chat, y recomendamos usarlos cuando tenga sentido, particularmente si deseas que tu modelo funcione bien con [`TextGenerationPipeline`]. Sin embargo, no estรกs limitado a estos roles: la plantilla es extremadamente flexible y cualquier cadena puede ser un rol.
+
+### ยกQuiero aรฑadir algunas plantillas de chat! ยฟCรณmo debo empezar?
+
+Si tienes algรบn modelo de chat, debes establecer su atributo `tokenizer.chat_template` y probarlo usando [`~PreTrainedTokenizer.apply_chat_template`], luego subir el tokenizador actualizado al Hub. Esto se aplica incluso si no eres el propietario del modelo: si estรกs usando un modelo con una plantilla de chat vacรญa o que todavรญa estรก utilizando la plantilla predeterminada de clase, por favor abre una solicitud de extracciรณn [pull request](https://huggingface.co/docs/hub/repositories-pull-requests-discussions) al repositorio del modelo para que este atributo se pueda establecer correctamente.
+
+Una vez que se establece el atributo, ยกeso es todo, has terminado! `tokenizer.apply_chat_template` ahora funcionarรก correctamente para ese modelo, ยกlo que significa que tambiรฉn es compatible automรกticamente en lugares como `TextGenerationPipeline`!
+
+Al asegurarnos de que los modelos tengan este atributo, podemos garantizar que toda la comunidad pueda utilizar todo el poder de los modelos de cรณdigo abierto. Los desajustes de formato han estado acechando el campo y daรฑando silenciosamente el rendimiento durante demasiado tiempo: ยกes hora de ponerles fin!
+
+## Avanzado: Consejos para escribir plantillas
+
+Si no estรกs familiarizado con Jinja, generalmente encontramos que la forma mรกs fรกcil de escribir una plantilla de chat es primero escribir un script de Python corto que formatee los mensajes como desees, y luego convertir ese script en una plantilla.
+
+Recuerda que el manejador de plantillas recibirรก el historial de conversaciรณn como una variable llamada mensajes. Cada mensaje es un diccionario con dos claves, `role` y `content`. Podrรกs acceder a los `mensajes` en tu plantilla tal como lo harรญas en Python, lo que significa que puedes recorrerlo con `{% for message in messages %}` o acceder a mensajes individuales con, por ejemplo, `{{ messages[0] }}`.
+
+Tambiรฉn puedes usar los siguientes consejos para convertir tu cรณdigo a Jinja:
+
+### Bucles For
+
+Los bucles For en Jinja se ven asรญ:
+
+```
+{% for message in messages %}
+{{ message['content'] }}
+{% endfor %}
+```
+
+Ten en cuenta que todo lo que estรฉ dentro del {{bloque de expresiรณn}} se imprimirรก en la salida. Puedes usar operadores como `+` para combinar cadenas dentro de bloques de expresiรณn.
+
+### Declaraciones if
+
+Las declaraciones if en Jinja se ven asรญ:
+
+```
+{% if message['role'] == 'user' %}
+{{ message['content'] }}
+{% endif %}
+```
+
+Observa cรณmo donde Python utiliza espacios en blanco para marcar el inicio y el final de los bloques `for` e `if`, Jinja requiere que los termines explรญcitamente con `{% endfor %}` y `{% endif %}`.
+
+### Variables especiales
+
+Dentro de tu plantilla, tendrรกs acceso a la lista de `mensajes`, pero tambiรฉn puedes acceder a varias otras variables especiales. Estas incluyen tokens especiales como `bos_token` y `eos_token`, asรญ como la variable `add_generation_prompt` que discutimos anteriormente. Tambiรฉn puedes usar la variable `loop` para acceder a informaciรณn sobre la iteraciรณn actual del bucle, por ejemplo, usando `{% if loop.last %}` para verificar si el mensaje actual es el รบltimo mensaje en la conversaciรณn. Aquรญ tienes un ejemplo que combina estas ideas para agregar un prompt de generaciรณn al final de la conversaciรณn si add_generation_prompt es `True`:
+
+```
+{% if loop.last and add_generation_prompt %}
+{{ bos_token + 'Assistant:\n' }}
+{% endif %}
+```
+
+### Notas sobre los espacios en blanco
+
+Hemos intentado que Jinja ignore los espacios en blanco fuera de las {{expresiones}} tanto como sea posible. Sin embargo, ten en cuenta que Jinja es un motor de plantillas de propรณsito general y puede tratar el espacio en blanco entre bloques en la misma lรญnea como significativo e imprimirlo en la salida. ยกTe recomendamos **encarecidamente** que verifiques que tu plantilla no estรฉ imprimiendo espacios adicionales donde no deberรญa antes de subirla!
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/community.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/community.md
new file mode 100644
index 0000000000000000000000000000000000000000..71153fbc8336f629f7db3cb32277c07a099b650f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/community.md
@@ -0,0 +1,69 @@
+
+
+# Comunidad
+
+Esta pรกgina agrupa los recursos de ๐ค Transformers desarrollados por la comunidad.
+
+## Los recursos de la comunidad:
+
+| Recurso | Descripciรณn | Autor |
+|:----------|:-------------|------:|
+| [Hugging Face Transformers Glossary Flashcards](https://www.darigovresearch.com/huggingface-transformers-glossary-flashcards) | Un conjunto de flashcards basadas en el [Glosario de documentos de Transformers] (glosario) que se ha puesto en un formato que se puede aprender/revisar fรกcilmente usando [Anki](https://apps.ankiweb.net/) una fuente abierta, aplicaciรณn de multiplataforma diseรฑada especรญficamente para la retenciรณn de conocimientos a largo plazo. Ve este [Introductory video on how to use the flashcards](https://www.youtube.com/watch?v=Dji_h7PILrw). | [Darigov Research](https://www.darigovresearch.com/) |
+
+## Los cuadernos de la comunidad:
+
+| Cuaderno | Descripciรณn | Autor | |
+|:----------|:-------------|:-------------|------:|
+| [Ajustar un transformador preentrenado para generar letras](https://github.com/AlekseyKorshuk/huggingartists) | Cรณmo generar letras al estilo de tu artista favorito ajustando un modelo GPT-2 | [Aleksey Korshuk](https://github.com/AlekseyKorshuk) | [](https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb) |
+| [Entrenar T5 en Tensorflow 2](https://github.com/snapthat/TF-T5-text-to-text) | Cรณmo entrenar a T5 para cualquier tarea usando Tensorflow 2. Este cuaderno demuestra una tarea de preguntas y respuestas implementada en Tensorflow 2 usando SQUAD | [Muhammad Harris](https://github.com/HarrisDePerceptron) |[](https://colab.research.google.com/github/snapthat/TF-T5-text-to-text/blob/master/snapthatT5/notebooks/TF-T5-Datasets%20Training.ipynb) |
+| [Entrenar T5 en TPU](https://github.com/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb) | Cรณmo entrenar a T5 en SQUAD con Transformers y Nlp | [Suraj Patil](https://github.com/patil-suraj) |[](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb#scrollTo=QLGiFCDqvuil) |
+| [Ajustar T5 para Clasificaciรณn y Opciรณn Mรบltiple](https://github.com/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) | Cรณmo ajustar T5 para clasificaciรณn y tareas de opciรณn mรบltiple usando un formato de texto a texto con PyTorch Lightning | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) |
+| [Ajustar DialoGPT en nuevos conjuntos de datos e idiomas](https://github.com/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) | Cรณmo ajustar el modelo DialoGPT en un nuevo conjunto de datos para chatbots conversacionales de diรกlogo abierto | [Nathan Cooper](https://github.com/ncoop57) | [](https://colab.research.google.com/github/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) |
+| [Modelado de secuencias largas con Reformer](https://github.com/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) | Cรณmo entrenar en secuencias de hasta 500,000 tokens con Reformer | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) |
+| [Ajustar BART para resumir](https://github.com/ohmeow/ohmeow_website/blob/master/_notebooks/2020-05-23-text-generation-with-blurr.ipynb) | Cรณmo ajustar BART para resumir con fastai usando blurr | [Wayde Gilliam](https://ohmeow.com/) | [](https://colab.research.google.com/github/ohmeow/ohmeow_website/blob/master/_notebooks/2020-05-23-text-generation-with-blurr.ipynb) |
+| [Ajustar un Transformador previamente entrenado en los tweets de cualquier persona](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) | Cรณmo generar tweets al estilo de tu cuenta de Twitter favorita ajustando un modelo GPT-2 | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) |
+| [Optimizar ๐ค modelos de Hugging Face con pesos y sesgos](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) | Un tutorial completo que muestra la integraciรณn de W&B con Hugging Face | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) |
+| [Preentrenar Longformer](https://github.com/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) | Cรณmo construir una versiรณn "larga" de modelos preentrenados existentes | [Iz Beltagy](https://beltagy.net) | [](https://colab.research.google.com/github/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) |
+| [Ajustar Longformer para control de calidad](https://github.com/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) | Cรณmo ajustar el modelo antiguo para la tarea de control de calidad | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) |
+| [Evaluar modelo con ๐คnlp](https://github.com/patrickvonplaten/notebooks/blob/master/How_to_evaluate_Longformer_on_TriviaQA_using_NLP.ipynb) | Cรณmo evaluar longformer en TriviaQA con `nlp` | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/drive/1m7eTGlPmLRgoPkkA7rkhQdZ9ydpmsdLE?usp=sharing) |
+| [Ajustar fino de T5 para la extracciรณn de amplitud de opiniรณn](https://github.com/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) | Cรณmo ajustar T5 para la extracciรณn de intervalos de opiniones mediante un formato de texto a texto con PyTorch Lightning | [Lorenzo Ampil](https://github.com/enzoampil) | [](https://colab.research.google.com/github/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) |
+| [Ajustar fino de DistilBert para la clasificaciรณn multiclase](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb) | Cรณmo ajustar DistilBert para la clasificaciรณn multiclase con PyTorch | [Abhishek Kumar Mishra](https://github.com/abhimishra91) | [](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb)|
+|[Ajustar BERT para la clasificaciรณn de etiquetas mรบltiples](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)| Cรณmo ajustar BERT para la clasificaciรณn de mรบltiples etiquetas usando PyTorch |[Abhishek Kumar Mishra](https://github.com/abhimishra91) |[](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)|
+|[Ajustar T5 para resumir](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb)| Cรณmo ajustar T5 para resumir en PyTorch y realizar un seguimiento de los experimentos con WandB |[Abhishek Kumar Mishra](https://github.com/abhimishra91) |[](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb)|
+|[Acelerar el ajuste fino en transformadores con Dynamic Padding/Bucketing](https://github.com/ELS-RD/transformers-notebook/blob/master/Divide_Hugging_Face_Transformers_training_time_by_2_or_more.ipynb)| Cรณmo acelerar el ajuste fino en un factor de 2 usando relleno dinรกmico/cubetas |[Michael Benesty](https://github.com/pommedeterresautee) |[](https://colab.research.google.com/drive/1CBfRU1zbfu7-ijiOqAAQUA-RJaxfcJoO?usp=sharing)|
+|[Preentrenar Reformer para modelado de lenguaje enmascarado](https://github.com/patrickvonplaten/notebooks/blob/master/Reformer_For_Masked_LM.ipynb)| Cรณmo entrenar un modelo Reformer con capas de autoatenciรณn bidireccionales | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/drive/1tzzh0i8PgDQGV3SMFUGxM7_gGae3K-uW?usp=sharing)|
+|[Ampliar y ajustar Sci-BERT](https://github.com/lordtt13/word-embeddings/blob/master/COVID-19%20Research%20Data/COVID-SciBERT.ipynb)| Cรณmo aumentar el vocabulario de un modelo SciBERT preentrenado de AllenAI en el conjunto de datos CORD y canalizarlo. | [Tanmay Thakur](https://github.com/lordtt13) | [](https://colab.research.google.com/drive/1rqAR40goxbAfez1xvF3hBJphSCsvXmh8)|
+|[Ajustar fino de BlenderBotSmall para resรบmenes usando la API de Entrenador](https://github.com/lordtt13/transformers-experiments/blob/master/Custom%20Tasks/fine-tune-blenderbot_small-for-summarization.ipynb)| Cรณmo ajustar BlenderBotSmall para resumir en un conjunto de datos personalizado, utilizando la API de Entrenador. | [Tanmay Thakur](https://github.com/lordtt13) | [](https://colab.research.google.com/drive/19Wmupuls7mykSGyRN_Qo6lPQhgp56ymq?usp=sharing)|
+|[Ajustar Electra e interpreta con gradientes integrados](https://github.com/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb) | Cรณmo ajustar Electra para el anรกlisis de sentimientos e interpretar predicciones con Captum Integrated Gradients | [Eliza Szczechla](https://elsanns.github.io) | [](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb)|
+|[ajustar un modelo GPT-2 que no estรก en inglรฉs con la clase Trainer](https://github.com/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb) | Cรณmo ajustar un modelo GPT-2 que no estรก en inglรฉs con la clase Trainer | [Philipp Schmid](https://www.philschmid.de) | [](https://colab.research.google.com/github/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb)|
+|[Ajustar un modelo DistilBERT para la tarea de clasificaciรณn de mรบltiples etiquetas](https://github.com/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb) | Cรณmo ajustar un modelo DistilBERT para la tarea de clasificaciรณn de mรบltiples etiquetas | [Dhaval Taunk](https://github.com/DhavalTaunk08) | [](https://colab.research.google.com/github/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb)|
+|[Ajustar ALBERT para la clasificaciรณn de pares de oraciones](https://github.com/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb) | Cรณmo ajustar un modelo ALBERT u otro modelo basado en BERT para la tarea de clasificaciรณn de pares de oraciones | [Nadir El Manouzi](https://github.com/NadirEM) | [](https://colab.research.google.com/github/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb)|
+|[Ajustar a Roberta para el anรกlisis de sentimientos](https://github.com/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb) | Cรณmo ajustar un modelo de Roberta para el anรกlisis de sentimientos | [Dhaval Taunk](https://github.com/DhavalTaunk08) | [](https://colab.research.google.com/github/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb)|
+|[Evaluaciรณn de modelos de generaciรณn de preguntas](https://github.com/flexudy-pipe/qugeev) | ยฟQuรฉ tan precisas son las respuestas a las preguntas generadas por tu modelo de transformador seq2seq? | [Pascal Zoleko](https://github.com/zolekode) | [](https://colab.research.google.com/drive/1bpsSqCQU-iw_5nNoRm_crPq6FRuJthq_?usp=sharing)|
+|[Clasificar texto con DistilBERT y Tensorflow](https://github.com/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb) | Cรณmo ajustar DistilBERT para la clasificaciรณn de texto en TensorFlow | [Peter Bayerle](https://github.com/peterbayerle) | [](https://colab.research.google.com/github/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb)|
+|[Aprovechar BERT para el resumen de codificador y decodificador en CNN/Dailymail](https://github.com/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb) | Cรณmo iniciar en caliente un *EncoderDecoderModel* con un punto de control *google-bert/bert-base-uncased* para resumir en CNN/Dailymail | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb)|
+|[Aprovechar RoBERTa para el resumen de codificador-decodificador en BBC XSum](https://github.com/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb) | Cรณmo iniciar en caliente un *EncoderDecoderModel* compartido con un punto de control *FacebookAI/roberta-base* para resumir en BBC/XSum | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb)|
+|[Ajustar TAPAS en Sequential Question Answering (SQA)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) | Cรณmo ajustar *TapasForQuestionAnswering* con un punto de control *tapas-base* en el conjunto de datos del Sequential Question Answering (SQA) | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb)|
+|[Evaluar TAPAS en Table Fact Checking (TabFact)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb) | Cรณmo evaluar un *TapasForSequenceClassification* ajustado con un punto de control *tapas-base-finetuned-tabfact* usando una combinaciรณn de ๐ค conjuntos de datos y ๐ค bibliotecas de transformadores | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb)|
+|[Ajustar de mBART para traducciรณn](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb) | Cรณmo ajustar mBART utilizando Seq2SeqTrainer para la traducciรณn del hindi al inglรฉs | [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb)|
+|[Ajustar LayoutLM en FUNSD (a form understanding dataset)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb) | Cรณmo ajustar *LayoutLMForTokenClassification* en el conjunto de datos de FUNSD para la extracciรณn de informaciรณn de documentos escaneados | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb)|
+|[Ajustar DistilGPT2 y genere texto](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb) | Cรณmo ajustar DistilGPT2 y generar texto | [Aakash Tripathi](https://github.com/tripathiaakash) | [](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb)|
+|[Ajustar LED en tokens de hasta 8K](https://github.com/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb) | Cรณmo ajustar LED en pubmed para resรบmenes de largo alcance | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb)|
+|[Evaluar LED en Arxiv](https://github.com/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb) | Cรณmo evaluar efectivamente LED en resรบmenes de largo alcance | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb)|
+|[Ajustar fino de LayoutLM en RVL-CDIP (un conjunto de datos de clasificaciรณn de imรกgenes de documentos)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb) | Cรณmo ajustar *LayoutLMForSequenceClassification* en el conjunto de datos RVL-CDIP para la clasificaciรณn de documentos escaneados | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb)|
+|[Decodificaciรณn Wav2Vec2 CTC con ajuste GPT2](https://github.com/voidful/huggingface_notebook/blob/main/xlsr_gpt.ipynb) | Cรณmo decodificar la secuencia CTC con el ajuste del modelo de lenguaje | [Eric Lam](https://github.com/voidful) | [](https://colab.research.google.com/drive/1e_z5jQHYbO2YKEaUgzb1ww1WwiAyydAj?usp=sharing)|
+|[Ajustar BART para resรบmenes en dos idiomas con la clase Trainer](https://github.com/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb) | Cรณmo ajustar BART para resรบmenes en dos idiomas con la clase Trainer | [Eliza Szczechla](https://github.com/elsanns) | [](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb)|
+|[Evaluar Big Bird en Trivia QA](https://github.com/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb) | Cรณmo evaluar BigBird en respuesta a preguntas de documentos largos en Trivia QA | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb)|
+| [Crear subtรญtulos de video usando Wav2Vec2](https://github.com/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) | Cรณmo crear subtรญtulos de YouTube a partir de cualquier vรญdeo transcribiendo el audio con Wav2Vec | [Niklas Muennighoff](https://github.com/Muennighoff) |[](https://colab.research.google.com/github/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) |
+| [Ajustar el transformador de visiรณn en CIFAR-10 usando PyTorch Lightning](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) | Cรณmo ajustar el transformador de visiรณn (ViT) en CIFAR-10 usando transformadores HuggingFace, conjuntos de datos y PyTorch Lightning | [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) |
+| [Ajustar el Transformador de visiรณn en CIFAR-10 usando el ๐ค Entrenador](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) | Cรณmo ajustar el Vision Transformer (ViT) en CIFAR-10 usando HuggingFace Transformers, Datasets y el ๐ค Trainer | [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) |
+| [Evaluar LUKE en Open Entity, un conjunto de datos de tipificaciรณn de entidades](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) | Cรณmo evaluar *LukeForEntityClassification* en el conjunto de datos de entidad abierta | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) |
+| [Evaluar LUKE en TACRED, un conjunto de datos de extracciรณn de relaciones](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) | Cรณmo evaluar *LukeForEntityPairClassification* en el conjunto de datos TACRED | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) |
+| [Evaluar LUKE en CoNLL-2003, un punto de referencia importante de NER](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) | Cรณmo evaluar *LukeForEntitySpanClassification* en el conjunto de datos CoNLL-2003 | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) |
+| [Evaluar BigBird-Pegasus en el conjunto de datos de PubMed](https://github.com/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) | Cรณmo evaluar *BigBirdPegasusForConditionalGeneration* en el conjunto de datos de PubMed | [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) |
+| [Clasificaciรณn de emociones del habla con Wav2Vec2](https://github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) | Cรณmo aprovechar un modelo Wav2Vec2 preentrenado para la clasificaciรณn de emociones en el conjunto de datos MEGA | [Mehrdad Farahani](https://github.com/m3hrdadfi) | [](https://colab.research.google.com/github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) |
+| [Detectar objetos en una imagen con DETR](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) | Cรณmo usar un modelo entrenado *DetrForObjectDetection* para detectar objetos en una imagen y visualizar la atenciรณn | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) |
+| [Ajustar el DETR en un conjunto de datos de detecciรณn de objetos personalizados](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) | Cรณmo ajustar *DetrForObjectDetection* en un conjunto de datos de detecciรณn de objetos personalizados | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) |
+| [Ajustar T5 para el reconocimiento de entidades nombradas](https://github.com/ToluClassics/Notebooks/blob/main/T5_Ner_Finetuning.ipynb) | Cรณmo ajustar *T5* en una tarea de reconocimiento de entidad nombrada | [Ogundepo Odunayo](https://github.com/ToluClassics) | [](https://colab.research.google.com/drive/1obr78FY_cBmWY5ODViCmzdY6O1KB65Vc?usp=sharing) |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/converting_tensorflow_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/converting_tensorflow_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..efd47e29dc29c6afdde3c27d66f8c4f09d51c0f1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/converting_tensorflow_models.md
@@ -0,0 +1,139 @@
+
+
+# Convertir checkpoints de Tensorflow
+
+Te proporcionamos una interfaz de lรญnea de comando (`CLI`, por sus siglas en inglรฉs) para convertir puntos de control (_checkpoints_) originales de Bert/GPT/GPT-2/Transformer-XL/XLNet/XLM en modelos que se puedan cargar utilizando los mรฉtodos `from_pretrained` de la biblioteca.
+
+
+
+Desde 2.3.0, el script para convertir es parte de la CLI de transformers (**transformers-cli**) disponible en cualquier instalaciรณn de transformers >= 2.3.0.
+
+La siguiente documentaciรณn refleja el formato para el comando **transformers-cli convert**.
+
+
+
+## BERT
+
+Puedes convertir cualquier checkpoint de TensorFlow para BERT (en particular, [los modelos pre-entrenados y publicados por Google](https://github.com/google-research/bert#pre-trained-models)) en un archivo de PyTorch mediante el script [convert_bert_original_tf_checkpoint_to_pytorch.py](https://github.com/huggingface/transformers/tree/main/src/transformers/models/bert/convert_bert_original_tf_checkpoint_to_pytorch.py).
+
+Esta CLI toma como entrada un checkpoint de TensorFlow (tres archivos que comienzan con `bert_model.ckpt`) y el archivo de configuraciรณn asociado (`bert_config.json`), y crea un modelo PyTorch para esta configuraciรณn, carga los pesos del checkpoint de TensorFlow en el modelo de PyTorch y guarda el modelo resultante en un archivo estรกndar de PyTorch que se puede importar usando `from_pretrained()` (ve el ejemplo en [Tour rรกpido](quicktour), [run_glue.py](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification/run_glue.py)).
+
+Solo necesitas ejecutar este script **una vez** para convertir un modelo a PyTorch. Despuรฉs, puedes ignorar el checkpoint de TensorFlow (los tres archivos que comienzan con `bert_model.ckpt`), pero asegรบrate de conservar el archivo de configuraciรณn (`bert_config.json`) y el archivo de vocabulario (`vocab.txt`) ya que estos tambiรฉn son necesarios para el modelo en PyTorch.
+
+Para ejecutar este script deberรกs tener instalado TensorFlow y PyTorch (`pip install tensorflow`). El resto del repositorio solo requiere PyTorch.
+
+Aquรญ hay un ejemplo del proceso para convertir un modelo `BERT-Base Uncased` pre-entrenado:
+
+```bash
+export BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12
+
+transformers-cli convert --model_type bert \
+ --tf_checkpoint $BERT_BASE_DIR/bert_model.ckpt \
+ --config $BERT_BASE_DIR/bert_config.json \
+ --pytorch_dump_output $BERT_BASE_DIR/pytorch_model.bin
+```
+
+Puedes descargar los modelos pre-entrenados de Google para la conversiรณn [aquรญ](https://github.com/google-research/bert#pre-trained-models).
+
+## ALBERT
+
+Convierte los checkpoints del modelo ALBERT de TensorFlow a PyTorch usando el script [convert_albert_original_tf_checkpoint_to_pytorch.py](https://github.com/huggingface/transformers/tree/main/src/transformers/models/albert/convert_albert_original_tf_checkpoint_to_pytorch.py).
+
+La CLI toma como entrada un checkpoint de TensorFlow (tres archivos que comienzan con `model.ckpt-best`) y el archivo de configuraciรณn adjunto (`albert_config.json`), luego crea y guarda un modelo de PyTorch. Para ejecutar esta conversiรณn deberรกs tener instalados TensorFlow y PyTorch.
+
+Aquรญ hay un ejemplo del proceso para convertir un modelo `ALBERT Base` pre-entrenado:
+
+```bash
+export ALBERT_BASE_DIR=/path/to/albert/albert_base
+
+transformers-cli convert --model_type albert \
+ --tf_checkpoint $ALBERT_BASE_DIR/model.ckpt-best \
+ --config $ALBERT_BASE_DIR/albert_config.json \
+ --pytorch_dump_output $ALBERT_BASE_DIR/pytorch_model.bin
+```
+
+Puedes descargar los modelos pre-entrenados de Google para la conversiรณn [aquรญ](https://github.com/google-research/albert#pre-trained-models).
+
+## OpenAI GPT
+
+Este es un ejemplo del proceso para convertir un modelo OpenAI GPT pre-entrenado, asumiendo que tu checkpoint de NumPy se guarda con el mismo formato que el modelo pre-entrenado de OpenAI (mรกs informaciรณn [aquรญ](https://github.com/openai/finetune-transformer-lm)):
+
+```bash
+export OPENAI_GPT_CHECKPOINT_FOLDER_PATH=/path/to/openai/pretrained/numpy/weights
+
+transformers-cli convert --model_type gpt \
+ --tf_checkpoint $OPENAI_GPT_CHECKPOINT_FOLDER_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \
+ [--config OPENAI_GPT_CONFIG] \
+ [--finetuning_task_name OPENAI_GPT_FINETUNED_TASK] \
+```
+
+## OpenAI GPT-2
+
+Aquรญ hay un ejemplo del proceso para convertir un modelo OpenAI GPT-2 pre-entrenado (mรกs informaciรณn [aquรญ](https://github.com/openai/gpt-2)):
+
+```bash
+export OPENAI_GPT2_CHECKPOINT_PATH=/path/to/openai-community/gpt2/pretrained/weights
+
+transformers-cli convert --model_type gpt2 \
+ --tf_checkpoint $OPENAI_GPT2_CHECKPOINT_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \
+ [--config OPENAI_GPT2_CONFIG] \
+ [--finetuning_task_name OPENAI_GPT2_FINETUNED_TASK]
+```
+
+## XLNet
+
+Aquรญ hay un ejemplo del proceso para convertir un modelo XLNet pre-entrenado:
+
+```bash
+export TRANSFO_XL_CHECKPOINT_PATH=/path/to/xlnet/checkpoint
+export TRANSFO_XL_CONFIG_PATH=/path/to/xlnet/config
+
+transformers-cli convert --model_type xlnet \
+ --tf_checkpoint $TRANSFO_XL_CHECKPOINT_PATH \
+ --config $TRANSFO_XL_CONFIG_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \
+ [--finetuning_task_name XLNET_FINETUNED_TASK] \
+```
+
+## XLM
+
+Aquรญ hay un ejemplo del proceso para convertir un modelo XLM pre-entrenado:
+
+```bash
+export XLM_CHECKPOINT_PATH=/path/to/xlm/checkpoint
+
+transformers-cli convert --model_type xlm \
+ --tf_checkpoint $XLM_CHECKPOINT_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT
+ [--config XML_CONFIG] \
+ [--finetuning_task_name XML_FINETUNED_TASK]
+```
+
+## T5
+
+Aquรญ hay un ejemplo del proceso para convertir un modelo T5 pre-entrenado:
+
+```bash
+export T5=/path/to/t5/uncased_L-12_H-768_A-12
+
+transformers-cli convert --model_type t5 \
+ --tf_checkpoint $T5/t5_model.ckpt \
+ --config $T5/t5_config.json \
+ --pytorch_dump_output $T5/pytorch_model.bin
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/create_a_model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/create_a_model.md
new file mode 100644
index 0000000000000000000000000000000000000000..560fbd74e3851c73afb4ddd999528267f321795c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/create_a_model.md
@@ -0,0 +1,371 @@
+
+
+# Crea una arquitectura personalizada
+
+Una [`AutoClass`](model_doc/auto) infiere, automรกticamente, la arquitectura del modelo y descarga la configuraciรณn y los pesos del modelo preentrenado. Normalmente, recomendamos usar una `AutoClass` para producir un cรณdigo agnรณstico a puntos de guardado o checkpoints. Sin embargo, los usuarios que quieran mรกs control sobre los parรกmetros especรญficos de los modelos pueden crear su propio modelo ๐ค Transformers personalizado a partir de varias clases base. Esto puede ser particularmente รบtil para alguien que estรฉ interesado en estudiar, entrenar o experimentar con modelos ๐ค Transformers. En esta guรญa vamos a profundizar en la creaciรณn de modelos personalizados sin usar `AutoClass`. Aprenderemos a:
+
+- Cargar y personalizar una configuraciรณn para un modelo.
+- Crear una arquitectura para un modelo.
+- Crear tokenizadores rรกpidos y lentos para textos.
+- Crear un extractor de propiedades para tareas de audio o imรกgenes.
+- Crear un procesador para tareas multimodales.
+
+## Configuraciรณn
+
+Una [configuraciรณn](main_classes/configuration) es un conjunto de atributos especรญficos de un modelo. Cada configuraciรณn de modelo tiene atributos diferentes. Por ejemplo, todos los modelos de PLN tienen los atributos `hidden_size`, `num_attention_heads`, `num_hidden_layers` y `vocab_size` en comรบn. Estos atributos especifican el nรบmero de cabezas de atenciรณn o de capas ocultas con las que se construyen los modelos.
+
+Puedes echarle un vistazo a [DistilBERT](model_doc/distilbert) y sus atributos accediendo a [`DistilBertConfig`]:
+
+```py
+>>> from transformers import DistilBertConfig
+
+>>> config = DistilBertConfig()
+>>> print(config)
+DistilBertConfig {
+ "activation": "gelu",
+ "attention_dropout": 0.1,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+[`DistilBertConfig`] muestra todos los atributos por defecto que se han usado para construir un modelo [`DistilBertModel`] base. Todos ellos son personalizables, lo que deja espacio para poder experimentar. Por ejemplo, puedes personalizar un modelo predeterminado para:
+
+- Probar una funciรณn de activaciรณn diferente, usando el parรกmetro `activation`.
+- Usar un valor de abandono (tambiรฉn conocido como _dropout_) mรกs alto para las probabilidades de las capas de atenciรณn, usando el parรกmetro `attention_dropout`.
+
+```py
+>>> my_config = DistilBertConfig(activation="relu", attention_dropout=0.4)
+>>> print(my_config)
+DistilBertConfig {
+ "activation": "relu",
+ "attention_dropout": 0.4,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+Los atributos de los modelos preentrenados pueden ser modificados con la funciรณn [`~PretrainedConfig.from_pretrained`]:
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("distilbert/distilbert-base-uncased", activation="relu", attention_dropout=0.4)
+```
+
+Cuando estรฉs satisfecho con la configuraciรณn de tu modelo, puedes guardarlo con la funciรณn [`~PretrainedConfig.save_pretrained`]. Tu configuraciรณn se guardarรก en un archivo JSON dentro del directorio que le especifiques como parรกmetro.
+
+```py
+>>> my_config.save_pretrained(save_directory="./your_model_save_path")
+```
+
+Para volver a usar el archivo de configuraciรณn, puedes cargarlo usando [`~PretrainedConfig.from_pretrained`]:
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+```
+
+
+
+Tambiรฉn puedes guardar los archivos de configuraciรณn como un diccionario; o incluso guardar solo la diferencia entre tu archivo personalizado y la configuraciรณn por defecto. Consulta la [documentaciรณn sobre configuraciรณn](main_classes/configuration) para ver mรกs detalles.
+
+
+
+## Modelo
+
+El siguiente paso serรก crear un [modelo](main_classes/models). El modelo, al que a veces tambiรฉn nos referimos como arquitectura, es el encargado de definir cada capa y quรฉ operaciones se realizan. Los atributos como `num_hidden_layers` de la configuraciรณn se usan para definir la arquitectura. Todos los modelos comparten una clase base, [`PreTrainedModel`], y algunos mรฉtodos comunes que se pueden usar para redimensionar los _embeddings_ o para recortar cabezas de auto-atenciรณn (tambiรฉn llamadas _self-attention heads_). Ademรกs, todos los modelos son subclases de [`torch.nn.Module`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html), [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) o [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html), lo que significa que son compatibles con su respectivo framework.
+
+
+
+
+Carga los atributos de tu configuraciรณn personalizada en el modelo de la siguiente forma:
+
+```py
+>>> from transformers import DistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+>>> model = DistilBertModel(my_config)
+```
+
+Esto crea un modelo con valores aleatorios, en lugar de crearlo con los pesos del preentrenamiento, por lo que no serรกs capaz de usar este modelo para nada รบtil hasta que no lo entrenes. El entrenamiento es un proceso costoso, tanto en cuestiรณn de recursos como de tiempo, por lo que generalmente es mejor usar un modelo preentrenado para obtener mejores resultados mรกs rรกpido, consumiendo una fracciรณn de los recursos que un entrenamiento completo hubiera requerido.
+
+Puedes crear un modelo preentrenado con [`~PreTrainedModel.from_pretrained`]:
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Cuando cargues tus pesos del preentrenamiento, el modelo por defecto se carga automรกticamente si nos lo proporciona ๐ค Transformers. Sin embargo, siempre puedes reemplazar (todos o algunos de) los atributos del modelo por defecto por los tuyos:
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+
+Carga los atributos de tu configuraciรณn personalizada en el modelo de la siguiente forma:
+
+```py
+>>> from transformers import TFDistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+>>> tf_model = TFDistilBertModel(my_config)
+```
+
+Esto crea un modelo con valores aleatorios, en lugar de crearlo con los pesos del preentrenamiento, por lo que no serรกs capaz de usar este modelo para nada รบtil hasta que no lo entrenes. El entrenamiento es un proceso costoso, tanto en cuestiรณn de recursos como de tiempo, por lo que generalmente es mejor usar un modelo preentrenado para obtener mejores resultados mรกs rรกpido, consumiendo solo una fracciรณn de los recursos que un entrenamiento completo hubiera requerido.
+
+Puedes crear un modelo preentrenado con [`~TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Cuando cargues tus pesos del preentrenamiento, el modelo por defecto se carga automรกticamente si este nos lo proporciona ๐ค Transformers. Sin embargo, siempre puedes reemplazar (todos o algunos de) los atributos del modelo por defecto por los tuyos:
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+
+### Cabezas de modelo
+
+En este punto del tutorial, tenemos un modelo DistilBERT base que devuelve los *hidden states* o estados ocultos. Los *hidden states* se pasan como parรกmetros de entrada a la cabeza del modelo para producir la salida. ๐ค Transformers ofrece una cabeza de modelo diferente para cada tarea, siempre y cuando el modelo sea compatible para la tarea (por ejemplo, no puedes usar DistilBERT para una tarea secuencia a secuencia como la traducciรณn).
+
+
+
+
+
+Por ejemplo, [`DistilBertForSequenceClassification`] es un modelo DistilBERT base con una cabeza de clasificaciรณn de secuencias. La cabeza de clasificaciรณn de secuencias es una capa superior que precede a la recolecciรณn de las salidas.
+
+```py
+>>> from transformers import DistilBertForSequenceClassification
+
+>>> model = DistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Puedes reutilizar este punto de guardado o *checkpoint* para otra tarea fรกcilmente cambiando a una cabeza de un modelo diferente. Para una tarea de respuesta a preguntas, puedes usar la cabeza del modelo [`DistilBertForQuestionAnswering`]. La cabeza de respuesta a preguntas es similar a la de clasificaciรณn de secuencias, excepto porque consta de una capa lineal delante de la salida de los *hidden states*.
+
+
+```py
+>>> from transformers import DistilBertForQuestionAnswering
+
+>>> model = DistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+Por ejemplo, [`TFDistilBertForSequenceClassification`] es un modelo DistilBERT base con una cabeza de clasificaciรณn de secuencias. La cabeza de clasificaciรณn de secuencias es una capa superior que precede a la recolecciรณn de las salidas.
+
+```py
+>>> from transformers import TFDistilBertForSequenceClassification
+
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Puedes reutilizar este punto de guardado o *checkpoint* para otra tarea fรกcilmente cambiando a una cabeza de un modelo diferente. Para una tarea de respuesta a preguntas, puedes usar la cabeza del modelo [`TFDistilBertForQuestionAnswering`]. La cabeza de respuesta a preguntas es similar a la de clasificaciรณn de secuencias, excepto porque consta de una capa lineal delante de la salida de los *hidden states*.
+
+
+```py
+>>> from transformers import TFDistilBertForQuestionAnswering
+
+>>> tf_model = TFDistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+## Tokenizer
+
+La ultima clase base que debes conocer antes de usar un modelo con datos textuales es la clase [tokenizer](main_classes/tokenizer), que convierte el texto bruto en tensores. Hay dos tipos de *tokenizers* que puedes usar con ๐ค Transformers:
+
+- [`PreTrainedTokenizer`]: una implementaciรณn de un *tokenizer* hecha en Python.
+- [`PreTrainedTokenizerFast`]: un *tokenizer* de nuestra librerรญa [๐ค Tokenizer](https://huggingface.co/docs/tokenizers/python/latest/), basada en Rust. Este tipo de *tokenizer* es bastante mรกs rรกpido, especialmente durante la tokenizaciรณn por lotes, gracias a estar implementado en Rust. Esta rรกpida tokenizaciรณn tambiรฉn ofrece mรฉtodos adicionales como el *offset mapping*, que relaciona los tokens con sus palabras o caracteres originales.
+
+Ambos *tokenizers* son compatibles con los mรฉtodos comunes, como los de encodificaciรณn y decodificaciรณn, los mรฉtodos para aรฑadir tokens y aquellos que manejan tokens especiales.
+
+
+
+No todos los modelos son compatibles con un *tokenizer* rรกpido. รchale un vistazo a esta [tabla](index#supported-frameworks) para comprobar si un modelo especรญfico es compatible con un *tokenizer* rรกpido.
+
+
+
+Si has entrenado tu propio *tokenizer*, puedes crear uno desde tu archivo de โvocabularioโ:
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> my_tokenizer = DistilBertTokenizer(vocab_file="my_vocab_file.txt", do_lower_case=False, padding_side="left")
+```
+
+Es importante recordar que los vocabularios que provienen de un *tokenizer* personalizado serรกn diferentes a los vocabularios generados por el *tokenizer* de un modelo preentrenado. Debes usar el vocabulario de un *tokenizer* preentrenado si vas a usar un modelo preentrenado, de lo contrario las entradas no tendrรกn sentido. Crea un *tokenizer* con el vocabulario de un modelo preentrenado usando la clase [`DistilBertTokenizer`]:
+
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> slow_tokenizer = DistilBertTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Crea un *tokenizer* rรกpido con la clase [`DistilBertTokenizerFast`]:
+
+
+```py
+>>> from transformers import DistilBertTokenizerFast
+
+>>> fast_tokenizer = DistilBertTokenizerFast.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+Por defecto, el [`AutoTokenizer`] intentarรก cargar un *tokenizer* rรกpido. Puedes desactivar este comportamiento cambiando el parรกmetro `use_fast=False` de `from_pretrained`.
+
+
+
+
+## Extractor de Caracterรญsticas
+
+Un extractor de caracterรญsticas procesa entradas de audio e imagen. Hereda de la clase base [`~feature_extraction_utils.FeatureExtractionMixin`] y tambiรฉn puede heredar de la clase [`ImageFeatureExtractionMixin`] para el procesamiento de caracterรญsticas de las imรกgenes o de la clase [`SequenceFeatureExtractor`] para el procesamiento de entradas de audio.
+
+Dependiendo de si trabajas en una tarea de audio o de video, puedes crear un extractor de caracterรญsticas asociado al modelo que estรฉs usando. Por ejemplo, podrรญas crear un [`ViTFeatureExtractor`] por defecto si estรกs usando [ViT](model_doc/vit) para clasificaciรณn de imรกgenes:
+
+```py
+>>> from transformers import ViTFeatureExtractor
+
+>>> vit_extractor = ViTFeatureExtractor()
+>>> print(vit_extractor)
+ViTFeatureExtractor {
+ "do_normalize": true,
+ "do_resize": true,
+ "feature_extractor_type": "ViTFeatureExtractor",
+ "image_mean": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": 2,
+ "size": 224
+}
+```
+
+
+
+Si no estรกs buscando ninguna personalizaciรณn en especรญfico, usa el mรฉtodo `from_pretrained` para cargar los parรกmetros del extractor de caracterรญsticas por defecto del modelo.
+
+
+
+Puedes modificar cualquier parรกmetro de [`ViTFeatureExtractor`] para crear tu extractor de caracterรญsticas personalizado:
+
+```py
+>>> from transformers import ViTFeatureExtractor
+
+>>> my_vit_extractor = ViTFeatureExtractor(resample="PIL.Image.BOX", do_normalize=False, image_mean=[0.3, 0.3, 0.3])
+>>> print(my_vit_extractor)
+ViTFeatureExtractor {
+ "do_normalize": false,
+ "do_resize": true,
+ "feature_extractor_type": "ViTFeatureExtractor",
+ "image_mean": [
+ 0.3,
+ 0.3,
+ 0.3
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": "PIL.Image.BOX",
+ "size": 224
+}
+```
+
+Para las entradas de audio, puedes crear un [`Wav2Vec2FeatureExtractor`] y personalizar los parรกmetros de una forma similar:
+
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> w2v2_extractor = Wav2Vec2FeatureExtractor()
+>>> print(w2v2_extractor)
+Wav2Vec2FeatureExtractor {
+ "do_normalize": true,
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
+ "feature_size": 1,
+ "padding_side": "right",
+ "padding_value": 0.0,
+ "return_attention_mask": false,
+ "sampling_rate": 16000
+}
+```
+
+## Procesador
+
+Para modelos que son compatibles con tareas multimodales, ๐ค Transformers ofrece una clase *procesador* que agrupa un extractor de caracterรญsticas y un *tokenizer* en el mismo objeto. Por ejemplo, probemos a usar el procesador [`Wav2Vec2Processor`] para una tarea de reconocimiento de voz (ASR). Un ASR transcribe el audio a texto, por lo que necesitaremos un extractor de caracterรญsticas y un *tokenizer*.
+
+Crea un extractor de caracterรญsticas para manejar la entrada de audio:
+
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> feature_extractor = Wav2Vec2FeatureExtractor(padding_value=1.0, do_normalize=True)
+```
+
+Crea un *tokenizer* para manejar la entrada de texto:
+
+```py
+>>> from transformers import Wav2Vec2CTCTokenizer
+
+>>> tokenizer = Wav2Vec2CTCTokenizer(vocab_file="my_vocab_file.txt")
+```
+
+Puedes combinar el extractor de caracterรญsticas y el *tokenizer* en el [`Wav2Vec2Processor`]:
+
+
+```py
+>>> from transformers import Wav2Vec2Processor
+
+>>> processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)
+```
+Con dos clases base (la configuraciรณn y el modelo) y una clase de preprocesamiento adicional (*tokenizer*, extractor de caracterรญsticas o procesador), puedes crear cualquiera de los modelos compatibles con ๐ค Transformers. Cada una de estas clases son configurables, permitiรฉndote usar sus atributos especรญficos. Puedes crear un modelo para entrenarlo de una forma fรกcil, o modificar un modelo preentrenado disponible para especializarlo.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/custom_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/custom_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..022b50d9ba52fb97c13d72d75ec97195d803424d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/custom_models.md
@@ -0,0 +1,358 @@
+
+
+# Compartir modelos personalizados
+
+La biblioteca ๐ค Transformers estรก diseรฑada para ser fรกcilmente ampliable. Cada modelo estรก completamente codificado
+sin abstracciรณn en una subcarpeta determinada del repositorio, por lo que puedes copiar fรกcilmente un archivo del modelo
+y ajustarlo segรบn tus necesidades.
+
+Si estรกs escribiendo un modelo completamente nuevo, podrรญa ser mรกs fรกcil comenzar desde cero. En este tutorial, te mostraremos
+cรณmo escribir un modelo personalizado y su configuraciรณn para que pueda usarse dentro de Transformers, y cรณmo puedes compartirlo
+con la comunidad (con el cรณdigo en el que se basa) para que cualquiera pueda usarlo, incluso si no estรก presente en la biblioteca
+๐ค Transformers.
+
+Ilustraremos todo esto con un modelo ResNet, envolviendo la clase ResNet de la [biblioteca timm](https://github.com/rwightman/pytorch-image-models) en un [`PreTrainedModel`].
+
+## Escribir una configuraciรณn personalizada
+
+Antes de adentrarnos en el modelo, primero escribamos su configuraciรณn. La configuraciรณn de un modelo es un objeto que
+contendrรก toda la informaciรณn necesaria para construir el modelo. Como veremos en la siguiente secciรณn, el modelo solo puede
+tomar un `config` para ser inicializado, por lo que realmente necesitamos que ese objeto estรฉ lo mรกs completo posible.
+
+En nuestro ejemplo, tomaremos un par de argumentos de la clase ResNet que tal vez queramos modificar. Las diferentes
+configuraciones nos darรกn los diferentes tipos de ResNet que son posibles. Luego simplemente almacenamos esos argumentos
+despuรฉs de verificar la validez de algunos de ellos.
+
+```python
+from transformers import PretrainedConfig
+from typing import List
+
+
+class ResnetConfig(PretrainedConfig):
+ model_type = "resnet"
+
+ def __init__(
+ self,
+ block_type="bottleneck",
+ layers: List[int] = [3, 4, 6, 3],
+ num_classes: int = 1000,
+ input_channels: int = 3,
+ cardinality: int = 1,
+ base_width: int = 64,
+ stem_width: int = 64,
+ stem_type: str = "",
+ avg_down: bool = False,
+ **kwargs,
+ ):
+ if block_type not in ["basic", "bottleneck"]:
+ raise ValueError(f"`block_type` must be 'basic' or bottleneck', got {block_type}.")
+ if stem_type not in ["", "deep", "deep-tiered"]:
+ raise ValueError(f"`stem_type` must be '', 'deep' or 'deep-tiered', got {stem_type}.")
+
+ self.block_type = block_type
+ self.layers = layers
+ self.num_classes = num_classes
+ self.input_channels = input_channels
+ self.cardinality = cardinality
+ self.base_width = base_width
+ self.stem_width = stem_width
+ self.stem_type = stem_type
+ self.avg_down = avg_down
+ super().__init__(**kwargs)
+```
+
+Las tres cosas importantes que debes recordar al escribir tu propia configuraciรณn son las siguientes:
+- tienes que heredar de `PretrainedConfig`,
+- el `__init__` de tu `PretrainedConfig` debe aceptar cualquier `kwargs`,
+- esos `kwargs` deben pasarse a la superclase `__init__`.
+
+La herencia es para asegurarte de obtener toda la funcionalidad de la biblioteca ๐ค Transformers, mientras que las otras dos
+restricciones provienen del hecho de que una `PretrainedConfig` tiene mรกs campos que los que estรกs configurando. Al recargar una
+`config` con el mรฉtodo `from_pretrained`, esos campos deben ser aceptados por tu `config` y luego enviados a la superclase.
+
+Definir un `model_type` para tu configuraciรณn (en este caso `model_type="resnet"`) no es obligatorio, a menos que quieras
+registrar tu modelo con las clases automรกticas (ver la รบltima secciรณn).
+
+Una vez hecho esto, puedes crear y guardar fรกcilmente tu configuraciรณn como lo harรญas con cualquier otra configuraciรณn de un
+modelo de la biblioteca. Asรญ es como podemos crear una configuraciรณn resnet50d y guardarla:
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d_config.save_pretrained("custom-resnet")
+```
+
+Esto guardarรก un archivo llamado `config.json` dentro de la carpeta `custom-resnet`. Luego puedes volver a cargar tu configuraciรณn
+con el mรฉtodo `from_pretrained`:
+
+```py
+resnet50d_config = ResnetConfig.from_pretrained("custom-resnet")
+```
+
+Tambiรฉn puedes usar cualquier otro mรฉtodo de la clase [`PretrainedConfig`], como [`~PretrainedConfig.push_to_hub`], para cargar
+directamente tu configuraciรณn en el Hub.
+
+## Escribir un modelo personalizado
+
+Ahora que tenemos nuestra configuraciรณn de ResNet, podemos seguir escribiendo el modelo. En realidad escribiremos dos: una que
+extrae las caracterรญsticas ocultas de un grupo de imรกgenes (como [`BertModel`]) y una que es adecuada para clasificaciรณn de
+imagenes (como [`BertForSequenceClassification`]).
+
+Como mencionamos antes, solo escribiremos un envoltura (_wrapper_) libre del modelo para simplificar este ejemplo. Lo รบnico que debemos
+hacer antes de escribir esta clase es un mapeo entre los tipos de bloques y las clases de bloques reales. Luego se define el
+modelo desde la configuraciรณn pasando todo a la clase `ResNet`:
+
+```py
+from transformers import PreTrainedModel
+from timm.models.resnet import BasicBlock, Bottleneck, ResNet
+from .configuration_resnet import ResnetConfig
+
+
+BLOCK_MAPPING = {"basic": BasicBlock, "bottleneck": Bottleneck}
+
+
+class ResnetModel(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor):
+ return self.model.forward_features(tensor)
+```
+
+Para el modelo que clasificarรก las imรกgenes, solo cambiamos el mรฉtodo de avance (es decir, el mรฉtodo `forward`):
+
+```py
+import torch
+
+
+class ResnetModelForImageClassification(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor, labels=None):
+ logits = self.model(tensor)
+ if labels is not None:
+ loss = torch.nn.functional.cross_entropy(logits, labels)
+ return {"loss": loss, "logits": logits}
+ return {"logits": logits}
+```
+
+En ambos casos, observa cรณmo heredamos de `PreTrainedModel` y llamamos a la inicializaciรณn de la superclase con `config`
+(un poco como cuando escribes `torch.nn.Module`). La lรญnea que establece `config_class` no es obligatoria, a menos
+que quieras registrar tu modelo con las clases automรกticas (consulta la รบltima secciรณn).
+
+
+
+Si tu modelo es muy similar a un modelo dentro de la biblioteca, puedes reutilizar la misma configuraciรณn de ese modelo.
+
+
+
+Puedes hacer que tu modelo devuelva lo que quieras, pero devolver un diccionario como lo hicimos para
+`ResnetModelForImageClassification`, con el `loss` incluido cuando se pasan las etiquetas, harรก que tu modelo se pueda
+usar directamente dentro de la clase [`Trainer`]. Usar otro formato de salida estรก bien, siempre y cuando estรฉs planeando usar
+tu propio bucle de entrenamiento u otra biblioteca para el entrenamiento.
+
+Ahora que tenemos nuestra clase, vamos a crear un modelo:
+
+```py
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+```
+
+Nuevamente, puedes usar cualquiera de los mรฉtodos de [`PreTrainedModel`], como [`~PreTrainedModel.save_pretrained`] o
+[`~PreTrainedModel.push_to_hub`]. Usaremos el segundo en la siguiente secciรณn y veremos cรณmo pasar los pesos del modelo
+con el cรณdigo de nuestro modelo. Pero primero, carguemos algunos pesos previamente entrenados dentro de nuestro modelo.
+
+En tu caso de uso, probablemente estarรกs entrenando tu modelo personalizado con tus propios datos. Para ir rรกpido en este
+tutorial, usaremos la versiรณn preentrenada de resnet50d. Dado que nuestro modelo es solo un envoltorio alrededor del resnet50d
+original, serรก fรกcil transferir esos pesos:
+
+```py
+import timm
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+Ahora veamos cรณmo asegurarnos de que cuando hacemos [`~PreTrainedModel.save_pretrained`] o [`~PreTrainedModel.push_to_hub`],
+se guarda el cรณdigo del modelo.
+
+## Enviar el cรณdigo al _Hub_
+
+
+
+Esta _API_ es experimental y puede tener algunos cambios leves en las prรณximas versiones.
+
+
+
+Primero, asegรบrate de que tu modelo estรฉ completamente definido en un archivo `.py`. Puedes basarte en importaciones
+relativas a otros archivos, siempre que todos los archivos estรฉn en el mismo directorio (aรบn no admitimos submรณdulos
+para esta caracterรญstica). Para nuestro ejemplo, definiremos un archivo `modeling_resnet.py` y un archivo
+`configuration_resnet.py` en una carpeta del directorio de trabajo actual llamado `resnet_model`. El archivo de configuraciรณn
+contiene el cรณdigo de `ResnetConfig` y el archivo del modelo contiene el cรณdigo de `ResnetModel` y
+`ResnetModelForImageClassification`.
+
+```
+.
+โโโ resnet_model
+ โโโ __init__.py
+ โโโ configuration_resnet.py
+ โโโ modeling_resnet.py
+```
+
+El `__init__.py` puede estar vacรญo, solo estรก ahรญ para que Python detecte que `resnet_model` se puede usar como un mรณdulo.
+
+
+
+Si copias archivos del modelo desde la biblioteca, deberรกs reemplazar todas las importaciones relativas en la parte superior
+del archivo para importarlos desde el paquete `transformers`.
+
+
+
+Ten en cuenta que puedes reutilizar (o subclasificar) una configuraciรณn o modelo existente.
+
+Para compartir tu modelo con la comunidad, sigue estos pasos: primero importa el modelo y la configuraciรณn de ResNet desde
+los archivos reciรฉn creados:
+
+```py
+from resnet_model.configuration_resnet import ResnetConfig
+from resnet_model.modeling_resnet import ResnetModel, ResnetModelForImageClassification
+```
+
+Luego, debes decirle a la biblioteca que deseas copiar el cรณdigo de esos objetos cuando usas el mรฉtodo `save_pretrained`
+y registrarlos correctamente con una determinada clase automรกtica (especialmente para modelos), simplemente ejecuta:
+
+```py
+ResnetConfig.register_for_auto_class()
+ResnetModel.register_for_auto_class("AutoModel")
+ResnetModelForImageClassification.register_for_auto_class("AutoModelForImageClassification")
+```
+
+Ten en cuenta que no es necesario especificar una clase automรกtica para la configuraciรณn (solo hay una clase automรกtica
+para ellos, [`AutoConfig`]), pero es diferente para los modelos. Tu modelo personalizado podrรญa ser adecuado para muchas
+tareas diferentes, por lo que debes especificar cuรกl de las clases automรกticas es la correcta para tu modelo.
+
+A continuaciรณn, vamos a crear la configuraciรณn y los modelos como lo hicimos antes:
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+Ahora, para enviar el modelo al Hub, asegรบrate de haber iniciado sesiรณn. Ejecuta en tu terminal:
+
+```bash
+huggingface-cli login
+```
+
+o desde un _notebook_:
+
+```py
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+Luego puedes ingresar a tu propio espacio (o una organizaciรณn de la que seas miembro) de esta manera:
+
+```py
+resnet50d.push_to_hub("custom-resnet50d")
+```
+
+Ademรกs de los pesos del modelo y la configuraciรณn en formato json, esto tambiรฉn copiรณ los archivos `.py` del modelo y la
+configuraciรณn en la carpeta `custom-resnet50d` y subiรณ el resultado al Hub. Puedes verificar el resultado en este
+[repositorio de modelos](https://huggingface.co/sgugger/custom-resnet50d).
+
+Consulta el tutorial sobre cรณmo [compartir modelos](model_sharing) para obtener mรกs informaciรณn sobre el mรฉtodo para subir modelos al Hub.
+
+## Usar un modelo con cรณdigo personalizado
+
+Puedes usar cualquier configuraciรณn, modelo o _tokenizador_ con archivos de cรณdigo personalizado en tu repositorio con las
+clases automรกticas y el mรฉtodo `from_pretrained`. Todos los archivos y cรณdigos cargados en el Hub se analizan en busca de
+malware (consulta la documentaciรณn de [seguridad del Hub](https://huggingface.co/docs/hub/security#malware-scanning) para
+obtener mรกs informaciรณn), pero aรบn debes revisar el cรณdigo del modelo y el autor para evitar la ejecuciรณn de cรณdigo malicioso
+en tu computadora. Configura `trust_remote_code=True` para usar un modelo con cรณdigo personalizado:
+
+```py
+from transformers import AutoModelForImageClassification
+
+model = AutoModelForImageClassification.from_pretrained("sgugger/custom-resnet50d", trust_remote_code=True)
+```
+
+Tambiรฉn se recomienda encarecidamente pasar un _hash_ de confirmaciรณn como una "revisiรณn" para asegurarte de que el autor
+de los modelos no actualizรณ el cรณdigo con algunas lรญneas nuevas maliciosas (a menos que confรญes plenamente en los autores
+de los modelos).
+
+```py
+commit_hash = "ed94a7c6247d8aedce4647f00f20de6875b5b292"
+model = AutoModelForImageClassification.from_pretrained(
+ "sgugger/custom-resnet50d", trust_remote_code=True, revision=commit_hash
+)
+```
+
+Ten en cuenta que al navegar por el historial de confirmaciones del repositorio del modelo en Hub, hay un botรณn para copiar
+fรกcilmente el hash de confirmaciรณn de cualquier _commit_.
+
+## Registrar un model con cรณdigo personalizado a las clases automรกticas
+
+Si estรกs escribiendo una biblioteca que amplรญa ๐ค Transformers, es posible que quieras ampliar las clases automรกticas para
+incluir tu propio modelo. Esto es diferente de enviar el cรณdigo al Hub en el sentido de que los usuarios necesitarรกn importar
+tu biblioteca para obtener los modelos personalizados (al contrario de descargar automรกticamente el cรณdigo del modelo desde Hub).
+
+Siempre que tu configuraciรณn tenga un atributo `model_type` que sea diferente de los tipos de modelos existentes, y que tus
+clases modelo tengan los atributos `config_class` correctos, puedes agregarlos a las clases automรกticas de la siguiente manera:
+
+```py
+from transformers import AutoConfig, AutoModel, AutoModelForImageClassification
+
+AutoConfig.register("resnet", ResnetConfig)
+AutoModel.register(ResnetConfig, ResnetModel)
+AutoModelForImageClassification.register(ResnetConfig, ResnetModelForImageClassification)
+```
+
+Ten en cuenta que el primer argumento utilizado al registrar tu configuraciรณn personalizada en [`AutoConfig`] debe coincidir
+con el `model_type` de tu configuraciรณn personalizada, y el primer argumento utilizado al registrar tus modelos personalizados
+en cualquier clase del modelo automรกtico debe coincidir con el `config_class ` de esos modelos.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/debugging.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/debugging.md
new file mode 100644
index 0000000000000000000000000000000000000000..313566753052cbf147c4d28eaaa48d0f3f9bf5df
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/debugging.md
@@ -0,0 +1,335 @@
+
+
+# Debugging
+
+## Debug de problemas de Network multi-GPU
+
+Cuando entrenas o infieres con `DistributedDataParallel` y varias GPUs, si encuentras problemas de intercomunicaciรณn entre procesos y/o nodos, puedes usar el siguiente script para diagnosticar problemas de red.
+
+```bash
+wget https://raw.githubusercontent.com/huggingface/transformers/main/scripts/distributed/torch-distributed-gpu-test.py
+```
+
+Por ejemplo, para probar cรณmo interactรบan 2 GPUs, haz lo siguiente:
+
+```bash
+python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-gpu-test.py
+```
+Si ambos procesos pueden hablar entre sรญ y asignar la memoria de la GPU, cada uno imprimirรก un status OK.
+
+Para mรกs GPUs o nodos, ajusta los argumentos en el script.
+
+Encontrarรกs muchos mรกs detalles dentro del script de diagnรณstico e incluso una receta de cรณmo ejecutarlo en un entorno SLURM.
+
+Un nivel adicional de debug es agregar la variable de entorno `NCCL_DEBUG=INFO` de la siguiente manera:
+
+```bash
+NCCL_DEBUG=INFO python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-gpu-test.py
+```
+
+Esto mostrarรก mucha informaciรณn de debug relacionada con NCCL, que luego puedes buscar online si encuentras que reporta algรบn problema. O si no estรกs seguro de cรณmo interpretar el output, puedes compartir el archivo de log en un Issue.
+
+
+## Detecciรณn de Underflow y Overflow
+
+
+
+Esta funciรณn estรก disponible actualmente sรณlo para PyTorch.
+
+
+
+
+
+Para el entrenamiento multi-GPU, requiere DDP (`torch.distributed.launch`).
+
+
+
+
+
+Esta funciรณn puede utilizarse con cualquier modelo basado en `nn.Module`.
+
+
+
+Si empiezas a obtener `loss=NaN` o el modelo muestra algรบn otro comportamiento anormal debido a `inf` o `nan` en
+activations o weights hay que descubrir dรณnde se produce el primer underflow o overflow y quรฉ lo ha provocado. Por suerte
+puedes lograrlo fรกcilmente activando un mรณdulo especial que harรก la detecciรณn automรกticamente.
+
+Si estรกs usando [`Trainer`], solo necesitas aรฑadir:
+
+```bash
+--debug underflow_overflow
+```
+
+a los argumentos normales de la lรญnea de comandos, o pasar `debug="underflow_overflow"` al crear el objeto [`TrainingArguments`].
+
+Si estรกs usando tu propio bucle de entrenamiento u otro Trainer puedes lograr lo mismo con:
+
+```python
+from .debug_utils import DebugUnderflowOverflow
+
+debug_overflow = DebugUnderflowOverflow(model)
+```
+
+[`~debug_utils.DebugUnderflowOverflow`] inserta hooks en el modelo que inmediatamente despuรฉs de cada forward
+testearรก las variables de input y output y tambiรฉn los weights del mรณdulo correspondiente. Tan pronto como se detecte `inf` o
+`nan` se detecta en al menos un elemento de las activations o weights, el programa afirmarรก e imprimirรก un informe
+como este (esto fue capturado con `google/mt5-small` bajo fp16 mixed precision):
+
+```
+Detected inf/nan during batch_number=0
+Last 21 forward frames:
+abs min abs max metadata
+ encoder.block.1.layer.1.DenseReluDense.dropout Dropout
+0.00e+00 2.57e+02 input[0]
+0.00e+00 2.85e+02 output
+[...]
+ encoder.block.2.layer.0 T5LayerSelfAttention
+6.78e-04 3.15e+03 input[0]
+2.65e-04 3.42e+03 output[0]
+ None output[1]
+2.25e-01 1.00e+04 output[2]
+ encoder.block.2.layer.1.layer_norm T5LayerNorm
+8.69e-02 4.18e-01 weight
+2.65e-04 3.42e+03 input[0]
+1.79e-06 4.65e+00 output
+ encoder.block.2.layer.1.DenseReluDense.wi_0 Linear
+2.17e-07 4.50e+00 weight
+1.79e-06 4.65e+00 input[0]
+2.68e-06 3.70e+01 output
+ encoder.block.2.layer.1.DenseReluDense.wi_1 Linear
+8.08e-07 2.66e+01 weight
+1.79e-06 4.65e+00 input[0]
+1.27e-04 2.37e+02 output
+ encoder.block.2.layer.1.DenseReluDense.dropout Dropout
+0.00e+00 8.76e+03 input[0]
+0.00e+00 9.74e+03 output
+ encoder.block.2.layer.1.DenseReluDense.wo Linear
+1.01e-06 6.44e+00 weight
+0.00e+00 9.74e+03 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.DenseReluDense T5DenseGatedGeluDense
+1.79e-06 4.65e+00 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.dropout Dropout
+3.18e-04 6.27e+04 input[0]
+0.00e+00 inf output
+```
+
+El output del ejemplo se ha recortado en el centro por razones de brevedad.
+
+La segunda columna muestra el valor del elemento mรกs grande en tรฉrminos absolutos, por lo que si observas con detenimiento los รบltimos fotogramas,
+los inputs y outputs estaban en el rango de `1e4`. Asรญ que cuando este entrenamiento se hizo con fp16 mixed precision,
+el รบltimo paso sufriรณ overflow (ya que bajo `fp16` el mayor nรบmero antes de `inf` es `64e3`). Para evitar overflows en
+`fp16` las activations deben permanecer muy por debajo de `1e4`, porque `1e4 * 1e4 = 1e8` por lo que cualquier matrix multiplication con
+grandes activations va a llevar a una condiciรณn de overflow numรฉrico.
+
+Al principio del output puedes descubrir en quรฉ nรบmero de batch se produjo el problema (aquรญ `Detected inf/nan during batch_number=0` significa que el problema se produjo en el primer batch).
+
+Cada frame del informe comienza declarando la entrada completamente calificada para el mรณdulo correspondiente que este frame estรก reportando.
+Si nos fijamos sรณlo en este frame:
+
+```
+ encoder.block.2.layer.1.layer_norm T5LayerNorm
+8.69e-02 4.18e-01 weight
+2.65e-04 3.42e+03 input[0]
+1.79e-06 4.65e+00 output
+```
+
+Aquรญ, `encoder.block.2.layer.1.layer_norm` indica que era una layer norm para la primera capa, del segundo
+block del encoder. Y la call especรญfica del `forward` es `T5LayerNorm`.
+
+Veamos los รบltimos frames de ese informe:
+
+```
+Detected inf/nan during batch_number=0
+Last 21 forward frames:
+abs min abs max metadata
+[...]
+ encoder.block.2.layer.1.DenseReluDense.wi_0 Linear
+2.17e-07 4.50e+00 weight
+1.79e-06 4.65e+00 input[0]
+2.68e-06 3.70e+01 output
+ encoder.block.2.layer.1.DenseReluDense.wi_1 Linear
+8.08e-07 2.66e+01 weight
+1.79e-06 4.65e+00 input[0]
+1.27e-04 2.37e+02 output
+ encoder.block.2.layer.1.DenseReluDense.wo Linear
+1.01e-06 6.44e+00 weight
+0.00e+00 9.74e+03 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.DenseReluDense T5DenseGatedGeluDense
+1.79e-06 4.65e+00 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.dropout Dropout
+3.18e-04 6.27e+04 input[0]
+0.00e+00 inf output
+```
+
+El รบltimo frame informa para la funciรณn `Dropout.forward` con la primera entrada para el รบnico input y la segunda para el
+รบnico output. Puedes ver que fue llamada desde un atributo `dropout` dentro de la clase `DenseReluDense`. Podemos ver
+que ocurriรณ durante la primera capa, del segundo block, durante el primer batch. Por รบltimo, el mayor absoluto
+elementos de input fue `6.27e+04` y el mismo para el output fue `inf`.
+
+Puedes ver aquรญ, que `T5DenseGatedGeluDense.forward` resultรณ en output activations, cuyo valor mรกximo absoluto fue
+alrededor de 62.7K, que estรก muy cerca del lรญmite mรกximo de fp16 de 64K. En el siguiente frame tenemos `Dropout`, el cual renormaliza
+los weights, despuรฉs de poner a cero algunos de los elementos, lo que empuja el valor mรกximo absoluto a mรกs de 64K, y obtenemos un
+overflow (`inf`).
+
+Como puedes ver son los frames anteriores los que tenemos que mirar cuando los nรบmeros empiezan a ser muy grandes para nรบmeros fp16.
+
+Combinemos el informe con el cรณdigo de `models/t5/modeling_t5.py`:
+
+```python
+class T5DenseGatedGeluDense(nn.Module):
+ def __init__(self, config):
+ super().__init__()
+ self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False)
+ self.wi_1 = nn.Linear(config.d_model, config.d_ff, bias=False)
+ self.wo = nn.Linear(config.d_ff, config.d_model, bias=False)
+ self.dropout = nn.Dropout(config.dropout_rate)
+ self.gelu_act = ACT2FN["gelu_new"]
+
+ def forward(self, hidden_states):
+ hidden_gelu = self.gelu_act(self.wi_0(hidden_states))
+ hidden_linear = self.wi_1(hidden_states)
+ hidden_states = hidden_gelu * hidden_linear
+ hidden_states = self.dropout(hidden_states)
+ hidden_states = self.wo(hidden_states)
+ return hidden_states
+```
+
+Ahora es fรกcil ver la call `dropout`, y tambiรฉn todas las calls anteriores.
+
+Dado que la detecciรณn se produce en un forward hook, estos informes se imprimen inmediatamente despuรฉs de que cada `forward`
+responda.
+
+Volviendo al informe completo, para actuar sobre รฉl y arreglar el problema, tenemos que subir unos cuantos frames donde los nรบmeros
+empezaron a subir y probablemente cambiar al modo `fp32` aquรญ, para que los nรบmeros no sufran overflow cuando se multipliquen
+o al sumarlos. Por supuesto, puede haber otras soluciones. Por ejemplo, podrรญamos desactivar `amp` temporalmente si estรก
+activado, despuรฉs de mover el original `forward` dentro de un helper wrapper, asรญ:
+
+```python
+def _forward(self, hidden_states):
+ hidden_gelu = self.gelu_act(self.wi_0(hidden_states))
+ hidden_linear = self.wi_1(hidden_states)
+ hidden_states = hidden_gelu * hidden_linear
+ hidden_states = self.dropout(hidden_states)
+ hidden_states = self.wo(hidden_states)
+ return hidden_states
+
+
+import torch
+
+
+def forward(self, hidden_states):
+ if torch.is_autocast_enabled():
+ with torch.cuda.amp.autocast(enabled=False):
+ return self._forward(hidden_states)
+ else:
+ return self._forward(hidden_states)
+```
+
+Como el detector automรกtico sรณlo informa de los inputs y outputs de los frames completos, una vez que sepas dรณnde buscar, puedes
+analizar tambiรฉn las etapas intermedias de una funciรณn especรญfica de `forward`. En este caso, puede utilizar la funciรณn
+funciรณn de ayuda `detect_overflow` para inyectar el detector donde quieras, por ejemplo:
+
+```python
+from debug_utils import detect_overflow
+
+
+class T5LayerFF(nn.Module):
+ [...]
+
+ def forward(self, hidden_states):
+ forwarded_states = self.layer_norm(hidden_states)
+ detect_overflow(forwarded_states, "after layer_norm")
+ forwarded_states = self.DenseReluDense(forwarded_states)
+ detect_overflow(forwarded_states, "after DenseReluDense")
+ return hidden_states + self.dropout(forwarded_states)
+```
+
+Puedes ver que hemos aรฑadido 2 de estos y ahora se trackea si `inf` o `nan` para `forwarded_states` fue detectado
+en algรบn punto intermedio.
+
+De hecho, el detector ya informa de esto porque cada una de las llamadas en el ejemplo anterior es un `nn.Module`, pero
+digamos que si tuvieras algunos cรกlculos directos locales, asรญ es como lo harรญas.
+
+Ademรกs, si estรกs instanciando el debugger en tu propio cรณdigo, puedes ajustar el nรบmero de frames impresos de
+su valor por defecto, por ejemplo:
+
+```python
+from .debug_utils import DebugUnderflowOverflow
+
+debug_overflow = DebugUnderflowOverflow(model, max_frames_to_save=100)
+```
+
+### Rastreo de valores mรญnimos y mรกximos absolutos de batches especรญficos
+
+La misma clase de debugging se puede utilizar para el rastreo por batches con la funciรณn de detecciรณn de underflow/overflow desactivada.
+
+Digamos que quieres ver los valores mรญnimos y mรกximos absolutos de todos los ingredientes de cada call `forward` de un determinado
+batch, y sรณlo hacerlo para los batches 1 y 3. Entonces instancias esta clase como:
+
+```python
+debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3])
+```
+
+Y ahora los batches 1 y 3 completos serรกn rastreados usando el mismo formato que el detector de underflow/overflow.
+
+Los batches son 0-index.
+
+Esto es muy รบtil si sabes que el programa empieza a comportarse mal despuรฉs de un determinado nรบmero de batch, para que puedas avanzar rรกpidamente
+hasta esa รกrea. Aquรญ hay un ejemplo de output recortado para tal configuraciรณn:
+
+```
+ *** Starting batch number=1 ***
+abs min abs max metadata
+ shared Embedding
+1.01e-06 7.92e+02 weight
+0.00e+00 2.47e+04 input[0]
+5.36e-05 7.92e+02 output
+[...]
+ decoder.dropout Dropout
+1.60e-07 2.27e+01 input[0]
+0.00e+00 2.52e+01 output
+ decoder T5Stack
+ not a tensor output
+ lm_head Linear
+1.01e-06 7.92e+02 weight
+0.00e+00 1.11e+00 input[0]
+6.06e-02 8.39e+01 output
+ T5ForConditionalGeneration
+ not a tensor output
+
+ *** Starting batch number=3 ***
+abs min abs max metadata
+ shared Embedding
+1.01e-06 7.92e+02 weight
+0.00e+00 2.78e+04 input[0]
+5.36e-05 7.92e+02 output
+[...]
+```
+
+Aquรญ obtendrรกs un gran nรบmero de frames mostrados - tantos como forward calls haya en tu modelo, por lo que puede o no ser lo que quieras, pero a veces puede ser mรกs fรกcil de usar para debug que un debugger normal.
+Por ejemplo, si un problema comienza a ocurrir en el batch 150. Entonces puedes mostrar las trazas de los batches 149 y 150 y comparar dรณnde
+los nรบmeros empezaron a divergir.
+
+Tambiรฉn puedes especificar el nรบmero de batch despuรฉs del cual se debe detener el entrenamiento, con:
+
+```python
+debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3], abort_after_batch_num=3)
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/fast_tokenizers.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/fast_tokenizers.md
new file mode 100644
index 0000000000000000000000000000000000000000..92b925f67f7e47b604ba1e0efd7bae23324a4313
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/fast_tokenizers.md
@@ -0,0 +1,74 @@
+
+
+# Usa los tokenizadores de ๐ค Tokenizers
+
+[`PreTrainedTokenizerFast`] depende de la biblioteca [๐ค Tokenizers](https://huggingface.co/docs/tokenizers). Los tokenizadores obtenidos desde la biblioteca ๐ค Tokenizers pueden ser
+cargados de forma muy sencilla en los ๐ค Transformers.
+
+Antes de entrar en detalles, comencemos creando un tokenizador dummy en unas cuantas lรญneas:
+
+```python
+>>> from tokenizers import Tokenizer
+>>> from tokenizers.models import BPE
+>>> from tokenizers.trainers import BpeTrainer
+>>> from tokenizers.pre_tokenizers import Whitespace
+
+>>> tokenizer = Tokenizer(BPE(unk_token="[UNK]"))
+>>> trainer = BpeTrainer(special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"])
+
+>>> tokenizer.pre_tokenizer = Whitespace()
+>>> files = [...]
+>>> tokenizer.train(files, trainer)
+```
+
+Ahora tenemos un tokenizador entrenado en los archivos que definimos. Lo podemos seguir utilizando en ese entorno de ejecuciรณn (runtime en inglรฉs), o puedes guardarlo
+en un archivo JSON para reutilizarlo en un futuro.
+
+## Cargando directamente desde el objeto tokenizador
+
+Veamos cรณmo utilizar este objeto tokenizador en la biblioteca ๐ค Transformers. La clase
+[`PreTrainedTokenizerFast`] permite una instanciaciรณn fรกcil, al aceptar el objeto
+*tokenizer* instanciado como argumento:
+
+```python
+>>> from transformers import PreTrainedTokenizerFast
+
+>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_object=tokenizer)
+```
+
+Este objeto ya puede ser utilizado con todos los mรฉtodos compartidos por los tokenizadores de ๐ค Transformers! Visita la [pรกgina sobre tokenizadores
+](main_classes/tokenizer) para mรกs informaciรณn.
+
+## Cargando desde un archivo JSON
+
+Para cargar un tokenizador desde un archivo JSON, comencemos por guardar nuestro tokenizador:
+
+```python
+>>> tokenizer.save("tokenizer.json")
+```
+
+La localizaciรณn (path en inglรฉs) donde este archivo es guardado puede ser incluida en el mรฉtodo de inicializaciรณn de [`PreTrainedTokenizerFast`]
+utilizando el parรกmetro `tokenizer_file`:
+
+```python
+>>> from transformers import PreTrainedTokenizerFast
+
+>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json")
+```
+
+Este objeto ya puede ser utilizado con todos los mรฉtodos compartidos por los tokenizadores de ๐ค Transformers! Visita la [pรกgina sobre tokenizadores
+](main_classes/tokenizer) para mรกs informaciรณn.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/glossary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/glossary.md
new file mode 100644
index 0000000000000000000000000000000000000000..790fa1fecbe69a0fcd989d431462d539c4883383
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/glossary.md
@@ -0,0 +1,464 @@
+
+
+# Glosario
+
+Este glosario define tรฉrminos generales de aprendizaje automรกtico y tรฉrminos relacionados con ๐ค Transformers para ayudarte a comprender mejor la documentaciรณn.
+
+## A
+
+### attention mask
+
+La mรกscara de atenciรณn es un argumento opcional utilizado al agrupar secuencias.
+
+
+
+Este argumento indica al modelo quรฉ tokens deben recibir atenciรณn y cuรกles no.
+
+Por ejemplo, considera estas dos secuencias:
+
+```python
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+>>> sequence_a = "This is a short sequence."
+>>> sequence_b = "This is a rather long sequence. It is at least longer than the sequence A."
+
+>>> encoded_sequence_a = tokenizer(sequence_a)["input_ids"]
+>>> encoded_sequence_b = tokenizer(sequence_b)["input_ids"]
+```
+
+Las versiones codificadas tienen longitudes diferentes:
+
+```python
+>>> len(encoded_sequence_a), len(encoded_sequence_b)
+(8, 19)
+```
+
+Por lo tanto, no podemos colocarlas juntas en el mismo tensor tal cual. La primera secuencia necesita ser rellenada hasta la longitud de la segunda, o la segunda necesita ser truncada hasta la longitud de la primera.
+
+En el primer caso, la lista de IDs se extenderรก con los รญndices de relleno. Podemos pasar una lista al tokenizador y pedirle que realice el relleno de esta manera:
+
+```python
+>>> padded_sequences = tokenizer([sequence_a, sequence_b], padding=True)
+```
+
+Podemos ver que se han agregado ceros a la derecha de la primera oraciรณn para que tenga la misma longitud que la segunda:
+
+```python
+>>> padded_sequences["input_ids"]
+[[101, 1188, 1110, 170, 1603, 4954, 119, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [101, 1188, 1110, 170, 1897, 1263, 4954, 119, 1135, 1110, 1120, 1655, 2039, 1190, 1103, 4954, 138, 119, 102]]
+```
+
+Esto luego se puede convertir en un tensor en PyTorch o TensorFlow. La mรกscara de atenciรณn es un tensor binario que indica la posiciรณn de los รญndices de relleno para que el modelo no los tenga en cuenta. Para el [`BertTokenizer`], `1` indica un valor al que se debe prestar atenciรณn, mientras que `0` indica un valor de relleno. Esta mรกscara de atenciรณn estรก en el diccionario devuelto por el tokenizador bajo la clave "attention_mask":
+
+```python
+>>> padded_sequences["attention_mask"]
+[[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
+```
+
+### autoencoding models
+
+Consulta [modelos de codificaciรณn](#encoder-models) y [modelado de lenguaje enmascarado](#masked-language-modeling-mlm)
+
+### autoregressive models
+
+Consulta [modelado de lenguaje causal](#causal-language-modeling) y [modelos de decodificaciรณn](#decoder-models)
+
+## B
+
+### backbone
+
+La columna vertebral, backbone en inglรฉs, es la red (embeddings y layers) que produce los estados ocultos o caracterรญsticas crudas. Normalmente, estรก conectado a una [cabecera](#head), que acepta las caracterรญsticas como entrada para hacer una predicciรณn. Por ejemplo, [`ViTModel`] es una columna vertebral sin una cabecera especรญfica encima. Otros modelos tambiรฉn pueden usar [`VitModel`] como columna vertebral, como por ejemplo [DPT](model_doc/dpt).
+
+## C
+
+### causal language modeling
+
+Una tarea de preentrenamiento donde el modelo lee los textos en orden y tiene que predecir la siguiente palabra. Generalmente, se realiza leyendo toda la oraciรณn, pero utilizando una mรกscara dentro del modelo para ocultar los tokens futuros en un cierto paso de tiempo.
+
+### channel
+
+Las imรกgenes a color estรกn compuestas por alguna combinaciรณn de valores en tres canales: rojo, verde y azul (RGB), y las imรกgenes en escala de grises solo tienen un canal. En ๐ค Transformers, el canal puede ser la primera o รบltima dimensiรณn del tensor de una imagen: [`n_channels`, `height`, `width`] o [`height`, `width`, `n_channels`].
+
+### connectionist temporal classification (CTC)
+
+Un algoritmo que permite que un modelo aprenda sin saber exactamente cรณmo estรกn alineadas la entrada y la salida; CTC calcula la distribuciรณn de todas las salidas posibles para una entrada dada y elige la salida mรกs probable de ella. CTC se utiliza comรบnmente en tareas de reconocimiento de voz porque el habla no siempre se alinea perfectamente con la transcripciรณn debido a diversas razones, como las diferentes velocidades de habla de los oradores.
+
+### convolution
+
+Un tipo de capa en una red neuronal donde la matriz de entrada se multiplica elemento por elemento por una matriz mรกs pequeรฑa (nรบcleo o filtro) y los valores se suman en una nueva matriz. Esto se conoce como una operaciรณn de convoluciรณn que se repite sobre toda la matriz de entrada. Cada operaciรณn se aplica a un segmento diferente de la matriz de entrada. Las redes neuronales convolucionales (CNN) se utilizan comรบnmente en visiรณn por computadora.
+
+## D
+
+### DataParallel (DP)
+
+Tรฉcnica de paralelismo para entrenamiento en mรบltiples GPUs donde se replica la misma configuraciรณn varias veces, con cada instancia recibiendo una porciรณn de datos รบnica. El procesamiento se realiza en paralelo y todas las configuraciones se sincronizan al final de cada paso de entrenamiento.
+
+Obtรฉn mรกs informaciรณn sobre cรณmo funciona el DataParallel [aquรญ](perf_train_gpu_many#dataparallel-vs-distributeddataparallel).
+
+### decoder input IDs
+
+Esta entrada es especรญfica para modelos codificador-decodificador y contiene los IDs de entrada que se enviarรกn al decodificador. Estas entradas deben usarse para tareas de secuencia a secuencia, como traducciรณn o resumen, y generalmente se construyen de una manera especรญfica para cada modelo.
+
+La mayorรญa de los modelos codificador-decodificador (BART, T5) crean sus `decoder_input_ids` por sรญ mismos a partir de las `labels`. En tales modelos, pasar las `labels` es la forma preferida de manejar el entrenamiento.
+
+Consulta la documentaciรณn de cada modelo para ver cรณmo manejan estos IDs de entrada para el entrenamiento de secuencia a secuencia.
+
+### decoder models
+
+Tambiรฉn conocidos como modelos autorregresivos, los modelos decodificadores involucran una tarea de preentrenamiento (llamada modelado de lenguaje causal) donde el modelo lee los textos en orden y tiene que predecir la siguiente palabra. Generalmente, se realiza leyendo la oraciรณn completa con una mรกscara para ocultar los tokens futuros en un cierto paso de tiempo.
+
+
+
+### deep learning (DL)
+
+Algoritmos de aprendizaje automรกtico que utilizan redes neuronales con varias capas.
+
+## E
+
+### encoder models
+
+Tambiรฉn conocidos como modelos de codificaciรณn automรกtica (autoencoding models), los modelos codificadores toman una entrada (como texto o imรกgenes) y las transforman en una representaciรณn numรฉrica condensada llamada embedding. A menudo, los modelos codificadores se entrenan previamente utilizando tรฉcnicas como el [modelado de lenguaje enmascarado](#masked-language-modeling-mlm), que enmascara partes de la secuencia de entrada y obliga al modelo a crear representaciones mรกs significativas.
+
+
+
+## F
+
+### feature extraction
+
+El proceso de seleccionar y transformar datos crudos en un conjunto de caracterรญsticas mรกs informativas y รบtiles para algoritmos de aprendizaje automรกtico. Algunos ejemplos de extracciรณn de caracterรญsticas incluyen transformar texto crudo en embeddings de palabras y extraer caracterรญsticas importantes como bordes o formas de datos de imรกgenes/videos.
+
+### feed forward chunking
+
+En cada bloque de atenciรณn residual en los transformadores, la capa de autoatenciรณn suele ir seguida de 2 capas de avance. El tamaรฑo de embedding intermedio de las capas de avance suele ser mayor que el tamaรฑo oculto del modelo (por ejemplo, para `google-bert/bert-base-uncased`).
+
+Para una entrada de tamaรฑo `[batch_size, sequence_length]`, la memoria requerida para almacenar los embeddings intermedios de avance `[batch_size, sequence_length, config.intermediate_size]` puede representar una gran fracciรณn del uso de memoria. Los autores de [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451) observaron que, dado que el cรกlculo es independiente de la dimensiรณn `sequence_length`, es matemรกticamente equivalente calcular los embeddings de salida de ambas capas de avance `[batch_size, config.hidden_size]_0, ..., [batch_size, config.hidden_size]_n` individualmente y concatenarlos despuรฉs a `[batch_size, sequence_length, config.hidden_size]` con `n = sequence_length`, lo que intercambia el aumento del tiempo de cรกlculo por una reducciรณn en el uso de memoria, pero produce un resultado matemรกticamente **equivalente**.
+
+Para modelos que utilizan la funciรณn [`apply_chunking_to_forward`], el `chunk_size` define el nรบmero de embeddings de salida que se calculan en paralelo y, por lo tanto, define el equilibrio entre la complejidad de memoria y tiempo. Si `chunk_size` se establece en 0, no se realiza ninguna fragmentaciรณn de avance.
+
+### finetuned models
+
+El ajuste fino es una forma de transferencia de aprendizaje que implica tomar un modelo entrenado previamente, congelar sus pesos y reemplazar la capa de salida con una nueva [cabecera de modelo](#head) reciรฉn aรฑadida. La cabecera del modelo se entrena en tu conjunto de datos objetivo.
+
+Consulta el tutorial [Ajustar finamente un modelo pre-entrenado](https://huggingface.co/docs/transformers/training) para obtener mรกs detalles y aprende cรณmo ajustar finamente modelos con ๐ค Transformers.
+
+## H
+
+### head
+
+La cabecera del modelo se refiere a la รบltima capa de una red neuronal que acepta los estados ocultos crudos y los proyecta en una dimensiรณn diferente. Hay una cabecera de modelo diferente para cada tarea. Por ejemplo:
+
+ * [`GPT2ForSequenceClassification`] es una cabecera de clasificaciรณn de secuencias, es decir, una capa lineal, encima del modelo base [`GPT2Model`].
+ * [`ViTForImageClassification`] es una cabecera de clasificaciรณn de imรกgenes, es decir, una capa lineal encima del estado oculto final del token `CLS`, encima del modelo base [`ViTModel`].
+ * [`Wav2Vec2ForCTC`] es una cabecera de modelado de lenguaje con [CTC](#connectionist-temporal-classification-ctc) encima del modelo base [`Wav2Vec2Model`].
+
+## I
+
+### image patch
+
+Los modelos de Transformers basados en visiรณn dividen una imagen en parches mรกs pequeรฑos que se incorporan linealmente y luego se pasan como una secuencia al modelo. Puedes encontrar el `patch_size` (o resoluciรณn del modelo) en su configuraciรณn.
+
+### inference
+
+La inferencia es el proceso de evaluar un modelo en nuevos datos despuรฉs de completar el entrenamiento. Consulta el tutorial [Pipeline for inference](https://huggingface.co/docs/transformers/pipeline_tutorial) para aprender cรณmo realizar inferencias con ๐ค Transformers.
+
+### input IDs
+
+Los IDs de entrada a menudo son los รบnicos parรกmetros necesarios que se deben pasar al modelo como entrada. Son รญndices de tokens, representaciones numรฉricas de tokens que construyen las secuencias que se utilizarรกn como entrada por el modelo.
+
+
+
+Cada tokenizador funciona de manera diferente, pero el mecanismo subyacente sigue siendo el mismo. Aquรญ tienes un ejemplo utilizando el tokenizador BERT, que es un tokenizador [WordPiece](https://arxiv.org/pdf/1609.08144.pdf):
+
+```python
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+>>> sequence = "A Titan RTX has 24GB of VRAM"
+```
+
+El tokenizador se encarga de dividir la secuencia en tokens disponibles en el vocabulario del tokenizador.
+
+```python
+>>> tokenized_sequence = tokenizer.tokenize(sequence)
+```
+
+Los tokens son palabras o sub palabras. Por ejemplo, "VRAM" no estaba en el vocabulario del modelo, asรญ que se dividiรณ
+en "V", "RA" y "M". Para indicar que estos tokens no son palabras separadas sino partes de la misma palabra, se aรฑade un prefijo de doble almohadilla para "RA" y "M":
+
+```python
+>>> print(tokenized_sequence)
+['A', 'Titan', 'R', '##T', '##X', 'has', '24', '##GB', 'of', 'V', '##RA', '##M']
+```
+
+Estos tokens luego se pueden convertir en IDs que son comprensibles por el modelo. Esto se puede hacer alimentando directamente la oraciรณn al tokenizador, que aprovecha la implementaciรณn en Rust de [๐ค Tokenizers](https://github.com/huggingface/tokenizers) para obtener un rendimiento รณptimo.
+
+```python
+>>> inputs = tokenizer(sequence)
+```
+
+El tokenizador devuelve un diccionario con todos los argumentos necesarios para que su modelo correspondiente funcione correctamente. Los รญndices de los tokens estรกn bajo la clave `input_ids`:
+
+```python
+>>> encoded_sequence = inputs["input_ids"]
+>>> print(encoded_sequence)
+[101, 138, 18696, 155, 1942, 3190, 1144, 1572, 13745, 1104, 159, 9664, 2107, 102]
+```
+
+Ten en cuenta que el tokenizador aรฑade automรกticamente "tokens especiales" (si el modelo asociado depende de ellos), que son IDs especiales que el modelo utiliza en ocasiones.
+
+Si descodificamos la secuencia anterior de IDs,
+
+```python
+>>> decoded_sequence = tokenizer.decode(encoded_sequence)
+```
+
+Veremos
+
+```python
+>>> print(decoded_sequence)
+[CLS] A Titan RTX has 24GB of VRAM [SEP]
+```
+
+Porque esta es la forma en que un [`BertModel`] espera sus entradas.
+
+## L
+
+### labels
+
+Las etiquetas son un argumento opcional que se puede pasar para que el modelo calcule la pรฉrdida por sรญ mismo. Estas etiquetas deberรญan ser la predicciรณn esperada del modelo: usarรก la pรฉrdida estรกndar para calcular la pรฉrdida entre sus
+predicciones y el valor esperado (la etiqueta).
+
+Estas etiquetas son diferentes segรบn la cabecera del modelo, por ejemplo:
+
+- Para modelos de clasificaciรณn de secuencias ([`BertForSequenceClassification`]), el modelo espera un tensor de dimensiรณn
+ `(batch_size)` con cada valor del lote correspondiente a la etiqueta esperada de toda la secuencia.
+- Para modelos de clasificaciรณn de tokens ([`BertForTokenClassification`]), el modelo espera un tensor de dimensiรณn
+ `(batch_size, seq_length)` con cada valor correspondiente a la etiqueta esperada de cada token individual.
+- Para el modelado de lenguaje enmascarado ([`BertForMaskedLM`]), el modelo espera un tensor de dimensiรณn `(batch_size, seq_length)` con cada valor correspondiente a la etiqueta esperada de cada token individual: las etiquetas son el ID del token enmascarado y los valores deben ignorarse para el resto (generalmente -100).
+- Para tareas de secuencia a secuencia ([`BartForConditionalGeneration`], [`MBartForConditionalGeneration`]), el modelo
+ espera un tensor de dimensiรณn `(batch_size, tgt_seq_length)` con cada valor correspondiente a las secuencias objetivo asociadas con cada secuencia de entrada. Durante el entrenamiento, tanto BART como T5 generarรกn internamente los `decoder_input_ids` y las mรกscaras de atenciรณn del decodificador. Por lo general, no es necesario suministrarlos. Esto no se aplica a los modelos que aprovechan el marco codificador-decodificador.
+- Para modelos de clasificaciรณn de imรกgenes ([`ViTForImageClassification`]), el modelo espera un tensor de dimensiรณn
+ `(batch_size)` con cada valor del lote correspondiente a la etiqueta esperada de cada imagen individual.
+- Para modelos de segmentaciรณn semรกntica ([`SegformerForSemanticSegmentation`]), el modelo espera un tensor de dimensiรณn
+ `(batch_size, height, width)` con cada valor del lote correspondiente a la etiqueta esperada de cada pรญxel individual.
+- Para modelos de detecciรณn de objetos ([`DetrForObjectDetection`]), el modelo espera una lista de diccionarios con claves `class_labels` y `boxes` donde cada valor del lote corresponde a la etiqueta esperada y el nรบmero de cajas delimitadoras de cada imagen individual.
+- Para modelos de reconocimiento automรกtico de voz ([`Wav2Vec2ForCTC`]), el modelo espera un tensor de dimensiรณn `(batch_size, target_length)` con cada valor correspondiente a la etiqueta esperada de cada token individual.
+
+
+
+Las etiquetas de cada modelo pueden ser diferentes, asรญ que asegรบrate siempre de revisar la documentaciรณn de cada modelo para obtener mรกs informaciรณn sobre sus etiquetas especรญficas.
+
+
+
+Los modelos base ([`BertModel`]) no aceptan etiquetas, ya que estos son los modelos base de transformadores, que simplemente generan caracterรญsticas.
+
+### large language models (LLM)
+
+Un tรฉrmino genรฉrico que se refiere a modelos de lenguaje de transformadores (GPT-3, BLOOM, OPT) que fueron entrenados con una gran cantidad de datos. Estos modelos tambiรฉn tienden a tener un gran nรบmero de parรกmetros que se pueden aprender (por ejemplo, 175 mil millones para GPT-3).
+
+## M
+
+### masked language modeling (MLM)
+
+Una tarea de preentrenamiento en la que el modelo ve una versiรณn corrupta de los textos, generalmente hecha
+al enmascarar algunos tokens al azar, y tiene que predecir el texto original.
+
+### multimodal
+
+Una tarea que combina textos con otro tipo de entradas (por ejemplo: imรกgenes).
+
+## N
+
+### Natural language generation (NLG)
+
+Todas las tareas relacionadas con la generaciรณn de texto (por ejemplo: [Escribe con Transformers](https://transformer.huggingface.co/) o traducciรณn).
+
+### Natural language processing (NLP)
+
+Una forma genรฉrica de decir "trabajar con textos".
+
+### Natural language understanding (NLU)
+
+Todas las tareas relacionadas con entender lo que hay en un texto (por ejemplo: clasificar el
+texto completo o palabras individuales).
+
+## P
+
+### Pipeline
+
+Un pipeline en ๐ค Transformers es una abstracciรณn que se refiere a una serie de pasos que se ejecutan en un orden especรญfico para preprocesar y transformar datos y devolver una predicciรณn de un modelo. Algunas etapas de ejemplo que se encuentran en un pipeline pueden ser el preprocesamiento de datos, la extracciรณn de caracterรญsticas y la normalizaciรณn.
+
+Para obtener mรกs detalles, consulta [Pipelines para inferencia](https://huggingface.co/docs/transformers/pipeline_tutorial).
+
+### PipelineParallel (PP)
+
+Tรฉcnica de paralelismo en la que el modelo se divide verticalmente (a nivel de capa) en varios GPU, de modo que solo una o varias capas del modelo se colocan en un solo GPU. Cada GPU procesa en paralelo diferentes etapas del pipeline y trabaja en un pequeรฑo fragmento del lote. Obtรฉn mรกs informaciรณn sobre cรณmo funciona PipelineParallel [aquรญ](perf_train_gpu_many#from-naive-model-parallelism-to-pipeline-parallelism).
+
+### pixel values
+
+Un tensor de las representaciones numรฉricas de una imagen que se pasa a un modelo. Los valores de pรญxeles tienen una forma de [`batch_size`, `num_channels`, `height`, `width`], y se generan a partir de un procesador de imรกgenes.
+
+### pooling
+
+Una operaciรณn que reduce una matriz a una matriz mรกs pequeรฑa, ya sea tomando el mรกximo o el promedio de la dimensiรณn (o dimensiones) agrupada(s). Las capas de agrupaciรณn se encuentran comรบnmente entre capas convolucionales para reducir la representaciรณn de caracterรญsticas.
+
+### position IDs
+
+A diferencia de las RNN que tienen la posiciรณn de cada token incrustada en ellas, los transformers no son conscientes de la posiciรณn de cada token. Por lo tanto, se utilizan los IDs de posiciรณn (`position_ids`) para que el modelo identifique la posiciรณn de cada token en la lista de tokens.
+
+Son un parรกmetro opcional. Si no se pasan `position_ids` al modelo, los IDs se crean automรกticamente como embeddings de posiciรณn absolutas.
+
+Los embeddings de posiciรณn absolutas se seleccionan en el rango `[0, config.max_position_embeddings - 1]`. Algunos modelos utilizan otros tipos de embeddings de posiciรณn, como embeddings de posiciรณn sinusoidales o embeddings de posiciรณn relativas.
+
+### preprocessing
+
+La tarea de preparar datos crudos en un formato que pueda ser fรกcilmente consumido por modelos de aprendizaje automรกtico. Por ejemplo, el texto se preprocesa tรญpicamente mediante la tokenizaciรณn. Para tener una mejor idea de cรณmo es el preprocesamiento para otros tipos de entrada, consulta el tutorial [Pre-procesar](https://huggingface.co/docs/transformers/preprocessing).
+
+### pretrained model
+
+Un modelo que ha sido pre-entrenado en algunos datos (por ejemplo, toda Wikipedia). Los mรฉtodos de preentrenamiento involucran un objetivo auto-supervisado, que puede ser leer el texto e intentar predecir la siguiente palabra (ver [modelado de lenguaje causal](#causal-language-modeling)) o enmascarar algunas palabras e intentar predecirlas (ver [modelado de lenguaje enmascarado](#masked-language-modeling-mlm)).
+
+Los modelos de habla y visiรณn tienen sus propios objetivos de pre-entrenamiento. Por ejemplo, Wav2Vec2 es un modelo de habla pre-entrenado en una tarea contrastiva que requiere que el modelo identifique la representaciรณn de habla "verdadera" de un conjunto de representaciones de habla "falsas". Por otro lado, BEiT es un modelo de visiรณn pre-entrenado en una tarea de modelado de imรกgenes enmascaradas que enmascara algunos de los parches de la imagen y requiere que el modelo prediga los parches enmascarados (similar al objetivo de modelado de lenguaje enmascarado).
+
+## R
+
+### recurrent neural network (RNN)
+
+Un tipo de modelo que utiliza un bucle sobre una capa para procesar textos.
+
+### representation learning
+
+Un subcampo del aprendizaje automรกtico que se centra en aprender representaciones significativas de datos en bruto. Algunos ejemplos de tรฉcnicas de aprendizaje de representaciones incluyen embeddings de palabras, auto-encoders y Redes Generativas Adversarias (Generative Adversarial Networks, GANs).
+
+## S
+
+### sampling rate
+
+Una medida en hercios del nรบmero de muestras (la seรฑal de audio) tomadas por segundo. La tasa de muestreo es el resultado de aproximar una seรฑal continua como el habla.
+
+### self-attention
+
+Cada elemento de la entrada averigua a cuรกles otros elementos de la entrada debe prestar atenciรณn.
+
+### self-supervised learning
+
+Una categorรญa de tรฉcnicas de aprendizaje automรกtico en la que un modelo crea su propio objetivo de aprendizaje a partir de datos no etiquetados. Difiere del [aprendizaje no supervisado](#unsupervised-learning) y del [aprendizaje supervisado](#supervised-learning) en que el proceso de aprendizaje estรก supervisado, pero no explรญcitamente por el usuario.
+
+Un ejemplo de aprendizaje auto-supervisado es el [modelado de lenguaje enmascarado](#masked-language-modeling-mlm), donde un modelo recibe oraciones con una proporciรณn de sus tokens eliminados y aprende a predecir los tokens faltantes.
+
+### semi-supervised learning
+
+Una amplia categorรญa de tรฉcnicas de entrenamiento de aprendizaje automรกtico que aprovecha una pequeรฑa cantidad de datos etiquetados con una mayor cantidad de datos no etiquetados para mejorar la precisiรณn de un modelo, a diferencia del [aprendizaje supervisado](#supervised-learning) y del [aprendizaje no supervisado](#unsupervised-learning).
+
+Un ejemplo de un enfoque de aprendizaje semi-supervisado es "auto-entrenamiento", en el que un modelo se entrena con datos etiquetados y luego se utiliza para hacer predicciones sobre los datos no etiquetados. La porciรณn de datos no etiquetados que el modelo predice con mayor confianza se agrega al conjunto de datos etiquetados y se utiliza para volver a entrenar el modelo.
+
+### sequence-to-sequence (seq2seq)
+
+Modelos que generan una nueva secuencia a partir de una entrada, como modelos de traducciรณn o modelos de resumen (como
+[Bart](model_doc/bart) o [T5](model_doc/t5)).
+
+### Sharded DDP
+
+Otro nombre para el concepto fundamental de [ZeRO](#zero-redundancy-optimizer-zero) utilizado por varias otras implementaciones de ZeRO.
+
+### stride
+
+En [convoluciรณn](#convolution) o [agrupaciรณn](#pooling), el paso (stride) se refiere a la distancia que recorre el nรบcleo sobre una matriz. Un paso de 1 significa que el nรบcleo se mueve un pรญxel a la vez, y un paso de 2 significa que el nรบcleo se mueve dos pรญxeles a la vez.
+
+### supervised learning
+
+Una forma de entrenamiento de modelos que utiliza directamente datos etiquetados para corregir y dirigir el rendimiento del modelo. Los datos se introducen en el modelo en entrenamiento, y sus predicciones se comparan con las etiquetas conocidas. El modelo actualiza sus pesos en funciรณn de cuรกn incorrectas fueron sus predicciones, y el proceso se repite para optimizar el rendimiento del modelo.
+
+## T
+
+### Tensor Parallelism (TP)
+
+Tรฉcnica de paralelismo para entrenamiento en mรบltiples GPU en la que cada tensor se divide en mรบltiples fragmentos, de modo que en lugar de tener todo el tensor en una sola GPU, cada fragmento del tensor reside en su GPU designada. Los fragmentos se procesan por separado y en paralelo en diferentes GPU y los resultados se sincronizan al final del paso de procesamiento.Esto es lo que a veces se llama paralelismo horizontal, ya que la divisiรณn ocurre a nivel horizontal.
+Obtรฉn mรกs informaciรณn sobre el Paralelismo de Tensores [aquรญ](perf_train_gpu_many#tensor-parallelism).
+
+### token
+
+Parte de una oraciรณn, generalmente una palabra, pero tambiรฉn puede ser una sub-palabra (las palabras no comunes a menudo se dividen en sub-palabras) o un sรญmbolo de puntuaciรณn.
+
+### token Type IDs
+
+Algunos modelos tienen como objetivo realizar clasificaciรณn en pares de oraciones o responder preguntas.
+
+
+
+Estos requieren que dos secuencias diferentes se unan en una รบnica entrada "input_ids", lo cual generalmente se realiza con
+la ayuda de tokens especiales, como el token de clasificaciรณn (`[CLS]`) y el token separador (`[SEP]`). Por ejemplo, el modelo BERT construye sus dos secuencias de entrada de la siguiente manera:
+
+```python
+>>> # [CLS] SEQUENCE_A [SEP] SEQUENCE_B [SEP]
+```
+
+Podemos utilizar nuestro tokenizador para generar automรกticamente una oraciรณn de este tipo al pasar las dos secuencias a `tokenizer` como dos argumentos (y no como una lista, como antes) de la siguiente manera:
+
+```python
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-cased")
+>>> sequence_a = "HuggingFace is based in NYC"
+>>> sequence_b = "Where is HuggingFace based?"
+
+>>> encoded_dict = tokenizer(sequence_a, sequence_b)
+>>> decoded = tokenizer.decode(encoded_dict["input_ids"])
+```
+
+Que devolverรก:
+
+```python
+>>> print(decoded)
+[CLS] HuggingFace is based in NYC [SEP] Where is HuggingFace based? [SEP]
+```
+
+Esto es suficiente para que algunos modelos comprendan dรณnde termina una secuencia y comienza otra. Sin embargo, otros modelos, como BERT, tambiรฉn utilizan identificadores de tipo de token (tambiรฉn llamados identificadores de segmento). Se representan como una mรกscara binaria que identifica los dos tipos de secuencia en el modelo.
+
+El tokenizador devuelve esta mรกscara como la entrada "token_type_ids":
+
+```python
+>>> encoded_dict["token_type_ids"]
+[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
+```
+
+La primera secuencia, el "contexto" utilizado para la pregunta, tiene todos sus tokens representados por un `0`, mientras que la segunda secuencia, correspondiente a la "pregunta", tiene todos sus tokens representados por un `1`.
+
+Algunos modelos, como [`XLNetModel`], utilizan un token adicional representado por un `2`.
+
+### transfer learning
+
+Una tรฉcnica que implica tomar un modelo pre-entrenado y adaptarlo a un conjunto de datos especรญfico para tu tarea. En lugar de entrenar un modelo desde cero, puedes aprovechar el conocimiento obtenido de un modelo existente como punto de partida. Esto acelera el proceso de aprendizaje y reduce la cantidad de datos de entrenamiento necesarios.
+
+### transformer
+
+Arquitectura de modelo de aprendizaje profundo basada en auto-atenciรณn (Self-attention).
+
+## U
+
+### unsupervised learning
+
+Una forma de entrenamiento de modelos en la que los datos proporcionados al modelo no estรกn etiquetados. Las tรฉcnicas de aprendizaje no supervisado aprovechan la informaciรณn estadรญstica de la distribuciรณn de datos para encontrar patrones รบtiles para la tarea en cuestiรณn.
+
+## Z
+
+### Zero Redundancy Optimizer (ZeRO)
+
+Tรฉcnica de paralelismo que realiza la fragmentaciรณn de los tensores de manera algo similar a [TensorParallel](#tensor-parallelism-tp), excepto que todo el tensor se reconstruye a tiempo para una computaciรณn hacia adelante o hacia atrรกs, por lo tanto, el modelo no necesita ser modificado. Este mรฉtodo tambiรฉn admite diversas tรฉcnicas de descarga para compensar la memoria limitada de la GPU. Obtรฉn mรกs informaciรณn sobre ZeRO [aquรญ](perf_train_gpu_many#zero-data-parallelism).
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/index.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/index.md
new file mode 100644
index 0000000000000000000000000000000000000000..fe7d65d94e356cfc4765b6d6a112f7b7c99d9738
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/index.md
@@ -0,0 +1,281 @@
+
+
+# ๐ค Transformers
+
+Machine Learning de รบltima generaciรณn para PyTorch, TensorFlow y JAX.
+
+๐ค Transformers proporciona APIs para descargar y entrenar fรกcilmente modelos preentrenados de รบltima generaciรณn. El uso de modelos preentrenados puede reducir tus costos de cรณmputo, tu huella de carbono y ahorrarte tiempo al entrenar un modelo desde cero. Los modelos se pueden utilizar en diferentes modalidades, tales como:
+
+* ๐ Texto: clasificaciรณn de texto, extracciรณn de informaciรณn, respuesta a preguntas, resumir, traducciรณn y generaciรณn de texto en mรกs de 100 idiomas.
+* ๐ผ๏ธ Imรกgenes: clasificaciรณn de imรกgenes, detecciรณn de objetos y segmentaciรณn.
+* ๐ฃ๏ธ Audio: reconocimiento de voz y clasificaciรณn de audio.
+* ๐ Multimodal: respuesta a preguntas en tablas, reconocimiento รณptico de caracteres, extracciรณn de informaciรณn de documentos escaneados, clasificaciรณn de videos y respuesta visual a preguntas.
+
+Nuestra biblioteca admite una integraciรณn perfecta entre tres de las bibliotecas de deep learning mรกs populares: [PyTorch](https://pytorch.org/), [TensorFlow](https://www.tensorflow.org/) y [JAX](https://jax.readthedocs.io/en/latest/). Entrena tu modelo con tres lรญneas de cรณdigo en un framework y cรกrgalo para inferencia con otro.
+Cada arquitectura de ๐ค Transformers se define en un mรณdulo de Python independiente para que se puedan personalizar fรกcilmente para investigaciรณn y experimentos.
+
+## Si estรกs buscando soporte personalizado del equipo de Hugging Face
+
+
+
+
+
+## Contenidos
+
+La documentaciรณn estรก organizada en cuatro partes:
+
+- **EMPEZAR** contiene un recorrido rรกpido e instrucciones de instalaciรณn para comenzar a usar ๐ค Transformers.
+- **TUTORIALES** es un excelente lugar para comenzar. Esta secciรณn te ayudarรก a obtener las habilidades bรกsicas que necesitas para comenzar a usar ๐ค Transformers.
+- **GUรAS PRรCTICAS** te mostrarรก cรณmo lograr un objetivo especรญfico, cรณmo hacer fine-tuning a un modelo preentrenado para el modelado de lenguaje o cรณmo crear un cabezal para un modelo personalizado.
+- **GUรAS CONCEPTUALES** proporciona mรกs discusiรณn y explicaciรณn de los conceptos e ideas subyacentes detrรกs de los modelos, las tareas y la filosofรญa de diseรฑo de ๐ค Transformers.
+
+La biblioteca actualmente contiene implementaciones de JAX, PyTorch y TensorFlow, pesos de modelos preentrenados, scripts de uso y utilidades de conversiรณn para los siguientes modelos.
+
+### Modelos compatibles
+
+
+
+1. **[ALBERT](model_doc/albert)** (de Google Research y el Instituto Tecnolรณgico de Toyota en Chicago) publicado con el paper [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), por Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.
+1. **[ALIGN](model_doc/align)** (de Google Research) publicado con el paper [Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision](https://arxiv.org/abs/2102.05918) por Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yunhsuan Sung, Zhen Li, Tom Duerig.
+1. **[BART](model_doc/bart)** (de Facebook) publicado con el paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/abs/1910.13461) por Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov y Luke Zettlemoyer.
+1. **[BARThez](model_doc/barthez)** (de รcole polytechnique) publicado con el paper [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321) por Moussa Kamal Eddine, Antoine J.-P. Tixier, Michalis Vazirgiannis.
+1. **[BARTpho](model_doc/bartpho)** (de VinAI Research) publicado con el paper [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese](https://arxiv.org/abs/2109.09701) por Nguyen Luong Tran, Duong Minh Le y Dat Quoc Nguyen.
+1. **[BEiT](model_doc/beit)** (de Microsoft) publicado con el paper [BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) por Hangbo Bao, Li Dong, Furu Wei.
+1. **[BERT](model_doc/bert)** (de Google) publicado con el paper [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) por Jacob Devlin, Ming-Wei Chang, Kenton Lee y Kristina Toutanova.
+1. **[BERTweet](model_doc/bertweet)** (de VinAI Research) publicado con el paper [BERTweet: A pre-trained language model for English Tweets](https://aclanthology.org/2020.emnlp-demos.2/) por Dat Quoc Nguyen, Thanh Vu y Anh Tuan Nguyen.
+1. **[BERT For Sequence Generation](model_doc/bert-generation)** (de Google) publicado con el paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) por Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[BigBird-RoBERTa](model_doc/big_bird)** (de Google Research) publicado con el paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) por Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[BigBird-Pegasus](model_doc/bigbird_pegasus)** (de Google Research) publicado con el paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) por Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[Blenderbot](model_doc/blenderbot)** (de Facebook) publicado con el paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) por Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BlenderbotSmall](model_doc/blenderbot-small)** (de Facebook) publicado con el paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) por Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BORT](model_doc/bort)** (de Alexa) publicado con el paper [Optimal Subarchitecture Extraction For BERT](https://arxiv.org/abs/2010.10499) por Adrian de Wynter y Daniel J. Perry.
+1. **[ByT5](model_doc/byt5)** (de Google Research) publicado con el paper [ByT5: Towards a token-free future with pre-trained byte-to-byte models](https://arxiv.org/abs/2105.13626) por Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, Colin Raffel.
+1. **[CamemBERT](model_doc/camembert)** (de Inria/Facebook/Sorbonne) publicado con el paper [CamemBERT: a Tasty French Language Model](https://arxiv.org/abs/1911.03894) por Louis Martin*, Benjamin Muller*, Pedro Javier Ortiz Suรกrez*, Yoann Dupont, Laurent Romary, รric Villemonte de la Clergerie, Djamรฉ Seddah y Benoรฎt Sagot.
+1. **[CANINE](model_doc/canine)** (de Google Research) publicado con el paper [CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representation](https://arxiv.org/abs/2103.06874) por Jonathan H. Clark, Dan Garrette, Iulia Turc, John Wieting.
+1. **[ConvNeXT](model_doc/convnext)** (de Facebook AI) publicado con el paper [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545) por Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, Saining Xie.
+1. **[ConvNeXTV2](model_doc/convnextv2)** (de Facebook AI) publicado con el paper [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://arxiv.org/abs/2301.00808) por Sanghyun Woo, Shoubhik Debnath, Ronghang Hu, Xinlei Chen, Zhuang Liu, In So Kweon, Saining Xie.
+1. **[CLIP](model_doc/clip)** (de OpenAI) publicado con el paper [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020) por Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever.
+1. **[ConvBERT](model_doc/convbert)** (de YituTech) publicado con el paper [ConvBERT: Improving BERT with Span-based Dynamic Convolution](https://arxiv.org/abs/2008.02496) por Zihang Jiang, Weihao Yu, Daquan Zhou, Yunpeng Chen, Jiashi Feng, Shuicheng Yan.
+1. **[CPM](model_doc/cpm)** (de Universidad de Tsinghua) publicado con el paper [CPM: A Large-scale Generative Chinese Pre-trained Language Model](https://arxiv.org/abs/2012.00413) por Zhengyan Zhang, Xu Han, Hao Zhou, Pei Ke, Yuxian Gu, Deming Ye, Yujia Qin, Yusheng Su, Haozhe Ji, Jian Guan, Fanchao Qi, Xiaozhi Wang, Yanan Zheng, Guoyang Zeng, Huanqi Cao, Shengqi Chen, Daixuan Li, Zhenbo Sun, Zhiyuan Liu, Minlie Huang, Wentao Han, Jie Tang, Juanzi Li, Xiaoyan Zhu, Maosong Sun.
+1. **[CTRL](model_doc/ctrl)** (de Salesforce) publicado con el paper [CTRL: A Conditional Transformer Language Model for Controllable Generation](https://arxiv.org/abs/1909.05858) por Nitish Shirish Keskar*, Bryan McCann*, Lav R. Varshney, Caiming Xiong y Richard Socher.
+1. **[Data2Vec](model_doc/data2vec)** (de Facebook) publicado con el paper [Data2Vec: A General Framework for Self-supervised Learning in Speech, Vision and Language](https://arxiv.org/abs/2202.03555) por Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, Michael Auli.
+1. **[DeBERTa](model_doc/deberta)** (de Microsoft) publicado con el paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) por Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[DeBERTa-v2](model_doc/deberta-v2)** (de Microsoft) publicado con el paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) por Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[Decision Transformer](model_doc/decision_transformer)** (de Berkeley/Facebook/Google) publicado con el paper [Decision Transformer: Reinforcement Learning via Sequence Modeling](https://arxiv.org/abs/2106.01345) por Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, Igor Mordatch.
+1. **[DiT](model_doc/dit)** (de Microsoft Research) publicado con el paper [DiT: Self-supervised Pre-training for Document Image Transformer](https://arxiv.org/abs/2203.02378) por Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei.
+1. **[DeiT](model_doc/deit)** (de Facebook) publicado con el paper [Training data-efficient image transformers & distillation through attention](https://arxiv.org/abs/2012.12877) por Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, Hervรฉ Jรฉgou.
+1. **[DETR](model_doc/detr)** (de Facebook) publicado con el paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) por Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko.
+1. **[DialoGPT](model_doc/dialogpt)** (de Microsoft Research) publicado con el paper [DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation](https://arxiv.org/abs/1911.00536) por Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, Bill Dolan.
+1. **[DistilBERT](model_doc/distilbert)** (de HuggingFace), publicado junto con el paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter](https://arxiv.org/abs/1910.01108) por Victor Sanh, Lysandre Debut y Thomas Wolf. Se ha aplicado el mismo mรฉtodo para comprimir GPT2 en [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), RoBERTa en [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), BERT multilingรผe en [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation) y una versiรณn alemana de DistilBERT.
+1. **[DPR](model_doc/dpr)** (de Facebook) publicado con el paper [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906) por Vladimir Karpukhin, Barlas Oฤuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, y Wen-tau Yih.
+1. **[DPT](master/model_doc/dpt)** (de Intel Labs) publicado con el paper [Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413) por Renรฉ Ranftl, Alexey Bochkovskiy, Vladlen Koltun.
+1. **[EfficientNet](model_doc/efficientnet)** (from Google Research) released with the paper [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks](https://arxiv.org/abs/1905.11946) by Mingxing Tan and Quoc V. Le.
+1. **[EncoderDecoder](model_doc/encoder-decoder)** (de Google Research) publicado con el paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) por Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[ELECTRA](model_doc/electra)** (de Google Research/Universidad de Stanford) publicado con el paper [ELECTRA: Pre-training text encoders as discriminators rather than generators](https://arxiv.org/abs/2003.10555) por Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning.
+1. **[FlauBERT](model_doc/flaubert)** (de CNRS) publicado con el paper [FlauBERT: Unsupervised Language Model Pre-training for French](https://arxiv.org/abs/1912.05372) por Hang Le, Loรฏc Vial, Jibril Frej, Vincent Segonne, Maximin Coavoux, Benjamin Lecouteux, Alexandre Allauzen, Benoรฎt Crabbรฉ, Laurent Besacier, Didier Schwab.
+1. **[FNet](model_doc/fnet)** (de Google Research) publicado con el paper [FNet: Mixing Tokens with Fourier Transforms](https://arxiv.org/abs/2105.03824) por James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, Santiago Ontanon.
+1. **[Funnel Transformer](model_doc/funnel)** (de CMU/Google Brain) publicado con el paper [Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing](https://arxiv.org/abs/2006.03236) por Zihang Dai, Guokun Lai, Yiming Yang, Quoc V. Le.
+1. **[GLPN](model_doc/glpn)** (de KAIST) publicado con el paper [Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth](https://arxiv.org/abs/2201.07436) por Doyeon Kim, Woonghyun Ga, Pyungwhan Ahn, Donggyu Joo, Sehwan Chun, Junmo Kim.
+1. **[GPT](model_doc/openai-gpt)** (de OpenAI) publicado con el paper [Improving Language Understanding by Generative Pre-Training](https://openai.com/research/language-unsupervised/) por Alec Radford, Karthik Narasimhan, Tim Salimans y Ilya Sutskever.
+1. **[GPT-2](model_doc/gpt2)** (de OpenAI) publicado con el paper [Language Models are Unsupervised Multitask Learners](https://openai.com/research/better-language-models/) por Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei y Ilya Sutskever.
+1. **[GPT-J](model_doc/gptj)** (de EleutherAI) publicado con el repositorio [kingoflolz/mesh-transformer-jax](https://github.com/kingoflolz/mesh-transformer-jax/) por Ben Wang y Aran Komatsuzaki.
+1. **[GPT Neo](model_doc/gpt_neo)** (de EleutherAI) publicado en el paper [EleutherAI/gpt-neo](https://github.com/EleutherAI/gpt-neo) por Sid Black, Stella Biderman, Leo Gao, Phil Wang y Connor Leahy.
+1. **[GPTSAN-japanese](model_doc/gptsan-japanese)** released with [GPTSAN](https://github.com/tanreinama/GPTSAN) by Toshiyuki Sakamoto (tanreinama).
+1. **[Hubert](model_doc/hubert)** (de Facebook) publicado con el paper [HuBERT: Self-Supervised Speech Representation Learning por Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447) por Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, Abdelrahman Mohamed.
+1. **[I-BERT](model_doc/ibert)** (de Berkeley) publicado con el paper [I-BERT: Integer-only BERT Quantization](https://arxiv.org/abs/2101.01321) por Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer.
+1. **[ImageGPT](model_doc/imagegpt)** (de OpenAI) publicado con el paper [Generative Pretraining from Pixels](https://openai.com/blog/image-gpt/) por Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, Ilya Sutskever.
+1. **[LayoutLM](model_doc/layoutlm)** (de Microsoft Research Asia) publicado con el paper [LayoutLM: Pre-training of Text and Layout for Document Image Understanding](https://arxiv.org/abs/1912.13318) por Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou.
+1. **[LayoutLMv2](model_doc/layoutlmv2)** (de Microsoft Research Asia) publicado con el paper [LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding](https://arxiv.org/abs/2012.14740) por Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, Lidong Zhou.
+1. **[LayoutXLM](model_doc/layoutxlm)** (de Microsoft Research Asia) publicado con el paper [LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding](https://arxiv.org/abs/2104.08836) por Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Furu Wei.
+1. **[LED](model_doc/led)** (de AllenAI) publicado con el paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) por Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[Longformer](model_doc/longformer)** (de AllenAI) publicado con el paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) por Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[LUKE](model_doc/luke)** (de Studio Ousia) publicado con el paper [LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention](https://arxiv.org/abs/2010.01057) por Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, Yuji Matsumoto.
+1. **[mLUKE](model_doc/mluke)** (de Studio Ousia) publicado con el paper [mLUKE: The Power of Entity Representations in Multilingual Pretrained Language Models](https://arxiv.org/abs/2110.08151) por Ryokan Ri, Ikuya Yamada, y Yoshimasa Tsuruoka.
+1. **[LXMERT](model_doc/lxmert)** (de UNC Chapel Hill) publicado con el paper [LXMERT: Learning Cross-Modality Encoder Representations from Transformers for Open-Domain Question Answering](https://arxiv.org/abs/1908.07490) por Hao Tan y Mohit Bansal.
+1. **[M2M100](model_doc/m2m_100)** (de Facebook) publicado con el paper [Beyond English-Centric Multilingual Machine Translation](https://arxiv.org/abs/2010.11125) por Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky, Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, Armand Joulin.
+1. **[MarianMT](model_doc/marian)** Modelos de traducciรณn automรกtica entrenados usando [OPUS](http://opus.nlpl.eu/) data por Jรถrg Tiedemann. El [Marian Framework](https://marian-nmt.github.io/) estรก siendo desarrollado por el equipo de traductores de Microsoft.
+1. **[Mask2Former](model_doc/mask2former)** (de FAIR y UIUC) publicado con el paper [Masked-attention Mask Transformer for Universal Image Segmentation](https://arxiv.org/abs/2112.01527) por Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar.
+1. **[MaskFormer](model_doc/maskformer)** (de Meta y UIUC) publicado con el paper [Per-Pixel Classification is Not All You Need for Semantic Segmentation](https://arxiv.org/abs/2107.06278) por Bowen Cheng, Alexander G. Schwing, Alexander Kirillov.
+1. **[MBart](model_doc/mbart)** (de Facebook) publicado con el paper [Multilingual Denoising Pre-training for Neural Machine Translation](https://arxiv.org/abs/2001.08210) por Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, Luke Zettlemoyer.
+1. **[MBart-50](model_doc/mbart)** (de Facebook) publicado con el paper [Multilingual Translation with Extensible Multilingual Pretraining and Finetuning](https://arxiv.org/abs/2008.00401) por Yuqing Tang, Chau Tran, Xian Li, Peng-Jen Chen, Naman Goyal, Vishrav Chaudhary, Jiatao Gu, Angela Fan.
+1. **[Megatron-BERT](model_doc/megatron-bert)** (de NVIDIA) publicado con el paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) por Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper y Bryan Catanzaro.
+1. **[Megatron-GPT2](model_doc/megatron_gpt2)** (de NVIDIA) publicado con el paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) por Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper y Bryan Catanzaro.
+1. **[MPNet](model_doc/mpnet)** (de Microsoft Research) publicado con el paper [MPNet: Masked and Permuted Pre-training for Language Understanding](https://arxiv.org/abs/2004.09297) por Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu.
+1. **[MT5](model_doc/mt5)** (de Google AI) publicado con el paper [mT5: A massively multilingual pre-trained text-to-text transformer](https://arxiv.org/abs/2010.11934) por Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, Colin Raffel.
+1. **[Nystrรถmformer](model_doc/nystromformer)** (de la Universidad de Wisconsin - Madison) publicado con el paper [Nystrรถmformer: A Nystrรถm-Based Algorithm for Approximating Self-Attention](https://arxiv.org/abs/2102.03902) por Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, Vikas Singh.
+1. **[OneFormer](model_doc/oneformer)** (de la SHI Labs) publicado con el paper [OneFormer: One Transformer to Rule Universal Image Segmentation](https://arxiv.org/abs/2211.06220) por Jitesh Jain, Jiachen Li, MangTik Chiu, Ali Hassani, Nikita Orlov, Humphrey Shi.
+1. **[Pegasus](model_doc/pegasus)** (de Google) publicado con el paper [PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization](https://arxiv.org/abs/1912.08777) por Jingqing Zhang, Yao Zhao, Mohammad Saleh y Peter J. Liu.
+1. **[Perceiver IO](model_doc/perceiver)** (de Deepmind) publicado con el paper [Perceiver IO: A General Architecture for Structured Inputs & Outputs](https://arxiv.org/abs/2107.14795) por Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, Olivier Hรฉnaff, Matthew M. Botvinick, Andrew Zisserman, Oriol Vinyals, Joรฃo Carreira.
+1. **[PhoBERT](model_doc/phobert)** (de VinAI Research) publicado con el paper [PhoBERT: Pre-trained language models for Vietnamese](https://www.aclweb.org/anthology/2020.findings-emnlp.92/) por Dat Quoc Nguyen y Anh Tuan Nguyen.
+1. **[PLBart](model_doc/plbart)** (de UCLA NLP) publicado con el paper [Unified Pre-training for Program Understanding and Generation](https://arxiv.org/abs/2103.06333) por Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang.
+1. **[PoolFormer](model_doc/poolformer)** (de Sea AI Labs) publicado con el paper [MetaFormer is Actually What You Need for Vision](https://arxiv.org/abs/2111.11418) por Yu, Weihao y Luo, Mi y Zhou, Pan y Si, Chenyang y Zhou, Yichen y Wang, Xinchao y Feng, Jiashi y Yan, Shuicheng.
+1. **[ProphetNet](model_doc/prophetnet)** (de Microsoft Research) publicado con el paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) por Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang y Ming Zhou.
+1. **[QDQBert](model_doc/qdqbert)** (de NVIDIA) publicado con el paper [Integer Quantization for Deep Learning Inference: Principles and Empirical Evaluation](https://arxiv.org/abs/2004.09602) por Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev y Paulius Micikevicius.
+1. **[REALM](model_doc/realm.html)** (de Google Research) publicado con el paper [REALM: Retrieval-Augmented Language Model Pre-Training](https://arxiv.org/abs/2002.08909) por Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat y Ming-Wei Chang.
+1. **[Reformer](model_doc/reformer)** (de Google Research) publicado con el paper [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451) por Nikita Kitaev, ลukasz Kaiser, Anselm Levskaya.
+1. **[RemBERT](model_doc/rembert)** (de Google Research) publicado con el paper [Rethinking embedding coupling in pre-trained language models](https://arxiv.org/abs/2010.12821) por Hyung Won Chung, Thibault Fรฉvry, Henry Tsai, M. Johnson, Sebastian Ruder.
+1. **[RegNet](model_doc/regnet)** (de META Platforms) publicado con el paper [Designing Network Design Space](https://arxiv.org/abs/2003.13678) por Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollรกr.
+1. **[ResNet](model_doc/resnet)** (de Microsoft Research) publicado con el paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) por Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun.
+1. **[RoBERTa](model_doc/roberta)** (de Facebook), publicado junto con el paper [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) por Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov.
+1. **[RoFormer](model_doc/roformer)** (de ZhuiyiTechnology), publicado junto con el paper [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/abs/2104.09864) por Jianlin Su y Yu Lu y Shengfeng Pan y Bo Wen y Yunfeng Liu.
+1. **[SegFormer](model_doc/segformer)** (de NVIDIA) publicado con el paper [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) por Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping Luo.
+1. **[SEW](model_doc/sew)** (de ASAPP) publicado con el paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) por Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SEW-D](model_doc/sew_d)** (de ASAPP) publicado con el paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) por Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SpeechToTextTransformer](model_doc/speech_to_text)** (de Facebook), publicado junto con el paper [fairseq S2T: Fast Speech-to-Text Modeling with fairseq](https://arxiv.org/abs/2010.05171) por Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Dmytro Okhonko, Juan Pino.
+1. **[SpeechToTextTransformer2](model_doc/speech_to_text_2)** (de Facebook), publicado junto con el paper [Large-Scale Self- and Semi-Supervised Learning for Speech Translation](https://arxiv.org/abs/2104.06678) por Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.
+1. **[Splinter](model_doc/splinter)** (de Universidad de Tel Aviv), publicado junto con el paper [Few-Shot Question Answering by Pretraining Span Selection](https://arxiv.org/abs/2101.00438) pory Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, Omer Levy.
+1. **[SqueezeBert](model_doc/squeezebert)** (de Berkeley) publicado con el paper [SqueezeBERT: What can computer vision teach NLP about efficient neural networks?](https://arxiv.org/abs/2006.11316) por Forrest N. Iandola, Albert E. Shaw, Ravi Krishna, y Kurt W. Keutzer.
+1. **[Swin Transformer](model_doc/swin)** (de Microsoft) publicado con el paper [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030) por Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.
+1. **[T5](model_doc/t5)** (de Google AI) publicado con el paper [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) por Colin Raffel y Noam Shazeer y Adam Roberts y Katherine Lee y Sharan Narang y Michael Matena y Yanqi Zhou y Wei Li y Peter J. Liu.
+1. **[T5v1.1](model_doc/t5v1.1)** (de Google AI) publicado en el repositorio [google-research/text-to-text-transfer-transformer](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#t511) por Colin Raffel y Noam Shazeer y Adam Roberts y Katherine Lee y Sharan Narang y Michael Matena y Yanqi Zhou y Wei Li y Peter J. Liu.
+1. **[TAPAS](model_doc/tapas)** (de Google AI) publicado con el paper [TAPAS: Weakly Supervised Table Parsing via Pre-training](https://arxiv.org/abs/2004.02349) por Jonathan Herzig, Paweล Krzysztof Nowak, Thomas Mรผller, Francesco Piccinno y Julian Martin Eisenschlos.
+1. **[TAPEX](model_doc/tapex)** (de Microsoft Research) publicado con el paper [TAPEX: Table Pre-training via Learning a Neural SQL Executor](https://arxiv.org/abs/2107.07653) por Qian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, Jian-Guang Lou.
+1. **[Transformer-XL](model_doc/transfo-xl)** (de Google/CMU) publicado con el paper [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860) por Zihang Dai*, Zhilin Yang*, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov.
+1. **[TrOCR](model_doc/trocr)** (de Microsoft), publicado junto con el paper [TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282) por Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, Furu Wei.
+1. **[UniSpeech](model_doc/unispeech)** (de Microsoft Research) publicado con el paper [UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data](https://arxiv.org/abs/2101.07597) por Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael Zeng, Xuedong Huang.
+1. **[UniSpeechSat](model_doc/unispeech-sat)** (de Microsoft Research) publicado con el paper [UNISPEECH-SAT: UNIVERSAL SPEECH REPRESENTATION LEARNING WITH SPEAKER AWARE PRE-TRAINING](https://arxiv.org/abs/2110.05752) por Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu.
+1. **[VAN](model_doc/van)** (de la Universidad de Tsinghua y la Universidad de Nankai) publicado con el paper [Visual Attention Network](https://arxiv.org/abs/2202.09741) por Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, Shi-Min Hu.
+1. **[ViLT](model_doc/vilt)** (de NAVER AI Lab/Kakao Enterprise/Kakao Brain) publicado con el paper [ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision](https://arxiv.org/abs/2102.03334) por Wonjae Kim, Bokyung Son, Ildoo Kim.
+1. **[Vision Transformer (ViT)](model_doc/vit)** (de Google AI) publicado con el paper [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) por Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, Neil Houlsby.
+1. **[ViTMAE](model_doc/vit_mae)** (de Meta AI) publicado con el paper [Masked Autoencoders Are Scalable Vision Learners](https://arxiv.org/abs/2111.06377) por Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollรกr, Ross Girshick.
+1. **[VisualBERT](model_doc/visual_bert)** (de UCLA NLP) publicado con el paper [VisualBERT: A Simple and Performant Baseline for Vision and Language](https://arxiv.org/pdf/1908.03557) por Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang.
+1. **[WavLM](model_doc/wavlm)** (de Microsoft Research) publicado con el paper [WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing](https://arxiv.org/abs/2110.13900) por Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, Jian Wu, Long Zhou, Shuo Ren, Yanmin Qian, Yao Qian, Jian Wu, Michael Zeng, Furu Wei.
+1. **[Wav2Vec2](model_doc/wav2vec2)** (de Facebook AI) publicado con el paper [wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations](https://arxiv.org/abs/2006.11477) por Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli.
+1. **[Wav2Vec2Phoneme](model_doc/wav2vec2_phoneme)** (de Facebook AI) publicado con el paper [Simple and Effective Zero-shot Cross-lingual Phoneme Recognition](https://arxiv.org/abs/2109.11680) por Qiantong Xu, Alexei Baevski, Michael Auli.
+1. **[XGLM](model_doc/xglm)** (de Facebook AI) publicado con el paper [Few-shot Learning with Multilingual Language Models](https://arxiv.org/abs/2112.10668) por Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O'Horo, Jeff Wang, Luke Zettlemoyer, Zornitsa Kozareva, Mona Diab, Veselin Stoyanov, Xian Li.
+1. **[XLM](model_doc/xlm)** (de Facebook) publicado junto con el paper [Cross-lingual Language Model Pretraining](https://arxiv.org/abs/1901.07291) por Guillaume Lample y Alexis Conneau.
+1. **[XLM-ProphetNet](model_doc/xlm-prophetnet)** (de Microsoft Research) publicado con el paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) por Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang y Ming Zhou.
+1. **[XLM-RoBERTa](model_doc/xlm-roberta)** (de Facebook AI), publicado junto con el paper [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116) por Alexis Conneau*, Kartikay Khandelwal*, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmรกn, Edouard Grave, Myle Ott, Luke Zettlemoyer y Veselin Stoyanov.
+1. **[XLM-RoBERTa-XL](model_doc/xlm-roberta-xl)** (de Facebook AI), publicado junto con el paper [Larger-Scale Transformers for Multilingual Masked Language Modeling](https://arxiv.org/abs/2105.00572) por Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau.
+1. **[XLNet](model_doc/xlnet)** (de Google/CMU) publicado con el paper [XLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) por Zhilin Yang*, Zihang Dai*, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, Quoc V. Le.
+1. **[XLSR-Wav2Vec2](model_doc/xlsr_wav2vec2)** (de Facebook AI) publicado con el paper [Unsupervised Cross-Lingual Representation Learning For Speech Recognition](https://arxiv.org/abs/2006.13979) por Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael Auli.
+1. **[XLS-R](model_doc/xls_r)** (de Facebook AI) publicado con el paper [XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale](https://arxiv.org/abs/2111.09296) por Arun Babu, Changhan Wang, Andros Tjandra, Kushal Lakhotia, Qiantong Xu, Naman Goyal, Kritika Singh, Patrick von Platen, Yatharth Saraf, Juan Pino, Alexei Baevski, Alexis Conneau, Michael Auli.
+1. **[YOSO](model_doc/yoso)** (de la Universidad de Wisconsin-Madison) publicado con el paper [You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling](https://arxiv.org/abs/2111.09714) por Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh.
+
+
+### Frameworks compatibles
+
+La siguiente tabla representa el soporte actual en la biblioteca para cada uno de esos modelos, ya sea que tengan un tokenizador de Python (llamado "slow"). Un tokenizador "fast" respaldado por la biblioteca ๐ค Tokenizers, ya sea que tengan soporte en Jax (a travรฉs de
+Flax), PyTorch y/o TensorFlow.
+
+
+
+| Modelo | Tokenizer slow | Tokenizer fast | PyTorch support | TensorFlow support | Flax Support |
+|:---------------------------:|:--------------:|:--------------:|:---------------:|:------------------:|:------------:|
+| ALBERT | โ
| โ
| โ
| โ
| โ
|
+| BART | โ
| โ
| โ
| โ
| โ
|
+| BEiT | โ | โ | โ
| โ | โ
|
+| BERT | โ
| โ
| โ
| โ
| โ
|
+| Bert Generation | โ
| โ | โ
| โ | โ |
+| BigBird | โ
| โ
| โ
| โ | โ
|
+| BigBirdPegasus | โ | โ | โ
| โ | โ |
+| Blenderbot | โ
| โ
| โ
| โ
| โ
|
+| BlenderbotSmall | โ
| โ
| โ
| โ
| โ
|
+| CamemBERT | โ
| โ
| โ
| โ
| โ |
+| Canine | โ
| โ | โ
| โ | โ |
+| CLIP | โ
| โ
| โ
| โ
| โ
|
+| ConvBERT | โ
| โ
| โ
| โ
| โ |
+| ConvNext | โ | โ | โ
| โ
| โ |
+| CTRL | โ
| โ | โ
| โ
| โ |
+| Data2VecAudio | โ | โ | โ
| โ | โ |
+| Data2VecText | โ | โ | โ
| โ | โ |
+| DeBERTa | โ
| โ
| โ
| โ
| โ |
+| DeBERTa-v2 | โ
| โ | โ
| โ
| โ |
+| Decision Transformer | โ | โ | โ
| โ | โ |
+| DeiT | โ | โ | โ
| โ | โ |
+| DETR | โ | โ | โ
| โ | โ |
+| DistilBERT | โ
| โ
| โ
| โ
| โ
|
+| DPR | โ
| โ
| โ
| โ
| โ |
+| DPT | โ | โ | โ
| โ | โ |
+| ELECTRA | โ
| โ
| โ
| โ
| โ
|
+| Encoder decoder | โ | โ | โ
| โ
| โ
|
+| FairSeq Machine-Translation | โ
| โ | โ
| โ | โ |
+| FlauBERT | โ
| โ | โ
| โ
| โ |
+| FNet | โ
| โ
| โ
| โ | โ |
+| Funnel Transformer | โ
| โ
| โ
| โ
| โ |
+| GLPN | โ | โ | โ
| โ | โ |
+| GPT Neo | โ | โ | โ
| โ | โ
|
+| GPT-J | โ | โ | โ
| โ
| โ
|
+| Hubert | โ | โ | โ
| โ
| โ |
+| I-BERT | โ | โ | โ
| โ | โ |
+| ImageGPT | โ | โ | โ
| โ | โ |
+| LayoutLM | โ
| โ
| โ
| โ
| โ |
+| LayoutLMv2 | โ
| โ
| โ
| โ | โ |
+| LED | โ
| โ
| โ
| โ
| โ |
+| Longformer | โ
| โ
| โ
| โ
| โ |
+| LUKE | โ
| โ | โ
| โ | โ |
+| LXMERT | โ
| โ
| โ
| โ
| โ |
+| M2M100 | โ
| โ | โ
| โ | โ |
+| Marian | โ
| โ | โ
| โ
| โ
|
+| MaskFormer | โ | โ | โ
| โ | โ |
+| mBART | โ
| โ
| โ
| โ
| โ
|
+| MegatronBert | โ | โ | โ
| โ | โ |
+| MobileBERT | โ
| โ
| โ
| โ
| โ |
+| MPNet | โ
| โ
| โ
| โ
| โ |
+| mT5 | โ
| โ
| โ
| โ
| โ
|
+| Nystromformer | โ | โ | โ
| โ | โ |
+| OpenAI GPT | โ
| โ
| โ
| โ
| โ |
+| OpenAI GPT-2 | โ
| โ
| โ
| โ
| โ
|
+| Pegasus | โ
| โ
| โ
| โ
| โ
|
+| Perceiver | โ
| โ | โ
| โ | โ |
+| PLBart | โ
| โ | โ
| โ | โ |
+| PoolFormer | โ | โ | โ
| โ | โ |
+| ProphetNet | โ
| โ | โ
| โ | โ |
+| QDQBert | โ | โ | โ
| โ | โ |
+| RAG | โ
| โ | โ
| โ
| โ |
+| Realm | โ
| โ
| โ
| โ | โ |
+| Reformer | โ
| โ
| โ
| โ | โ |
+| RegNet | โ | โ | โ
| โ
| โ
|
+| RemBERT | โ
| โ
| โ
| โ
| โ |
+| ResNet | โ | โ | โ
| โ | โ
|
+| RetriBERT | โ
| โ
| โ
| โ | โ |
+| RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| RoFormer | โ
| โ
| โ
| โ
| โ
|
+| SegFormer | โ | โ | โ
| โ | โ |
+| SEW | โ | โ | โ
| โ | โ |
+| SEW-D | โ | โ | โ
| โ | โ |
+| Speech Encoder decoder | โ | โ | โ
| โ | โ
|
+| Speech2Text | โ
| โ | โ
| โ
| โ |
+| Speech2Text2 | โ
| โ | โ | โ | โ |
+| Splinter | โ
| โ
| โ
| โ | โ |
+| SqueezeBERT | โ
| โ
| โ
| โ | โ |
+| Swin | โ | โ | โ
| โ | โ |
+| T5 | โ
| โ
| โ
| โ
| โ
|
+| TAPAS | โ
| โ | โ
| โ
| โ |
+| TAPEX | โ
| โ
| โ
| โ
| โ
|
+| Transformer-XL | โ
| โ | โ
| โ
| โ |
+| TrOCR | โ | โ | โ
| โ | โ |
+| UniSpeech | โ | โ | โ
| โ | โ |
+| UniSpeechSat | โ | โ | โ
| โ | โ |
+| VAN | โ | โ | โ
| โ | โ |
+| ViLT | โ | โ | โ
| โ | โ |
+| Vision Encoder decoder | โ | โ | โ
| โ
| โ
|
+| VisionTextDualEncoder | โ | โ | โ
| โ | โ
|
+| VisualBert | โ | โ | โ
| โ | โ |
+| ViT | โ | โ | โ
| โ
| โ
|
+| ViTMAE | โ | โ | โ
| โ
| โ |
+| Wav2Vec2 | โ
| โ | โ
| โ
| โ
|
+| WavLM | โ | โ | โ
| โ | โ |
+| XGLM | โ
| โ
| โ
| โ | โ
|
+| XLM | โ
| โ | โ
| โ
| โ |
+| XLM-RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| XLM-RoBERTa-XL | โ | โ | โ
| โ | โ |
+| XLMProphetNet | โ
| โ | โ
| โ | โ |
+| XLNet | โ
| โ
| โ
| โ
| โ |
+| YOSO | โ | โ | โ
| โ | โ |
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/installation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/installation.md
new file mode 100644
index 0000000000000000000000000000000000000000..714c3b195ebcc09d052f11ce9c34d4f301c54f02
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/installation.md
@@ -0,0 +1,242 @@
+
+
+# Instalaciรณn
+
+En esta guรญa puedes encontrar informaciรณn para instalar ๐ค Transformers para cualquier biblioteca de Machine Learning con la que estรฉs trabajando. Ademรกs, encontrarรกs informaciรณn sobre cรณmo establecer el cachรฉ y cรณmo configurar ๐ค Transformers para correrlo de manera offline (opcional).
+
+๐ค Transformers ha sido probada en Python 3.6+, PyTorch 1.1.0+, TensorFlow 2.0+, y Flax. Para instalar la biblioteca de deep learning con la que desees trabajar, sigue las instrucciones correspondientes listadas a continuaciรณn:
+
+* [PyTorch](https://pytorch.org/get-started/locally/)
+* [TensorFlow 2.0](https://www.tensorflow.org/install/pip)
+* [Flax](https://flax.readthedocs.io/en/latest/)
+
+## Instalaciรณn con pip
+
+Es necesario instalar ๐ค Transformers en un [entorno virtual](https://docs.python.org/3/library/venv.html). Si necesitas mรกs informaciรณn sobre entornos virtuales de Python, consulta esta [guรญa](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
+). Un entorno virtual facilita el manejo de proyectos y evita problemas de compatibilidad entre dependencias.
+
+Comienza por crear un entorno virtual en el directorio de tu proyecto:
+
+```bash
+python -m venv .env
+```
+
+Activa el entorno virtual:
+
+```bash
+source .env/bin/activate
+```
+
+Ahora puedes instalar ๐ค Transformers con el siguiente comando:
+
+```bash
+pip install transformers
+```
+
+Solo para CPU, puedes instalar ๐ค Transformers y una biblioteca de deep learning con un comando de una sola lรญnea.
+
+Por ejemplo, instala ๐ค Transformers y Pytorch:
+
+```bash
+pip install transformers[torch]
+```
+
+๐ค Transformers y TensorFlow 2.0:
+
+```bash
+pip install transformers[tf-cpu]
+```
+
+๐ค Transformers y Flax:
+
+```bash
+pip install transformers[flax]
+```
+
+Por รบltimo, revisa si ๐ค Transformers ha sido instalada exitosamente con el siguiente comando que descarga un modelo pre-entrenado:
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
+```
+Despuรฉs imprime la etiqueta y el puntaje:
+
+```bash
+[{'label': 'POSITIVE', 'score': 0.9998704791069031}]
+```
+
+## Instalaciรณn desde la fuente
+
+Instala ๐ค Transformers desde la fuente con el siguiente comando:
+
+```bash
+pip install git+https://github.com/huggingface/transformers
+```
+
+El comando de arriba instala la versiรณn `master` mรกs actual en vez de la รบltima versiรณn estable. La versiรณn `master` es รบtil para obtener los รบltimos avances de ๐ค Transformers. Por ejemplo, se puede dar el caso de que un error fue corregido despuรฉs de la รบltima versiรณn estable pero aรบn no se ha liberado un nuevo lanzamiento. Sin embargo, existe la posibilidad de que la versiรณn `master` no sea estable. El equipo trata de mantener la versiรณn `master` operacional y la mayorรญa de los errores son resueltos en unas cuantas horas o un dรญa. Si encuentras algรบn problema, por favor abre un [Issue](https://github.com/huggingface/transformers/issues) para que pueda ser corregido mรกs rรกpido.
+
+Verifica si ๐ค Transformers estรก instalada apropiadamente con el siguiente comando:
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))"
+```
+
+## Instalaciรณn editable
+
+Necesitarรกs una instalaciรณn editable si deseas:
+* Usar la versiรณn `master` del cรณdigo fuente.
+* Contribuir a ๐ค Transformers y necesitas probar cambios en el cรณdigo.
+
+Clona el repositorio e instala ๐ค Transformers con los siguientes comandos:
+
+```bash
+git clone https://github.com/huggingface/transformers.git
+cd transformers
+pip install -e .
+```
+
+รstos comandos van a ligar el directorio desde donde clonamos el repositorio al path de las bibliotecas de Python. Python ahora buscarรก dentro de la carpeta que clonaste ademรกs de los paths normales de la biblioteca. Por ejemplo, si los paquetes de Python se encuentran instalados en `~/anaconda3/envs/main/lib/python3.7/site-packages/`, Python tambiรฉn buscarรก en el directorio desde donde clonamos el repositorio `~/transformers/`.
+
+
+
+Debes mantener el directorio `transformers` si deseas seguir usando la biblioteca.
+
+
+
+Puedes actualizar tu copia local a la รบltima versiรณn de ๐ค Transformers con el siguiente comando:
+
+```bash
+cd ~/transformers/
+git pull
+```
+
+El entorno de Python que creaste para la instalaciรณn de ๐ค Transformers encontrarรก la versiรณn `master` en la siguiente ejecuciรณn.
+
+## Instalaciรณn con conda
+
+Puedes instalar ๐ค Transformers desde el canal de conda `conda-forge` con el siguiente comando:
+
+```bash
+conda install conda-forge::transformers
+```
+
+## Configuraciรณn de Cachรฉ
+
+Los modelos preentrenados se descargan y almacenan en cachรฉ localmente en: `~/.cache/huggingface/transformers/`. Este es el directorio predeterminado proporcionado por la variable de entorno de shell `TRANSFORMERS_CACHE`. En Windows, el directorio predeterminado es dado por `C:\Users\username\.cache\huggingface\transformers`. Puedes cambiar las variables de entorno de shell que se muestran a continuaciรณn, en orden de prioridad, para especificar un directorio de cachรฉ diferente:
+
+1. Variable de entorno del shell (por defecto): `TRANSFORMERS_CACHE`.
+2. Variable de entorno del shell:`HF_HOME` + `transformers/`.
+3. Variable de entorno del shell: `XDG_CACHE_HOME` + `/huggingface/transformers`.
+
+
+
+๐ค Transformers usarรก las variables de entorno de shell `PYTORCH_TRANSFORMERS_CACHE` o `PYTORCH_PRETRAINED_BERT_CACHE` si viene de una iteraciรณn anterior de la biblioteca y ha configurado esas variables de entorno, a menos que especifiques la variable de entorno de shell `TRANSFORMERS_CACHE`.
+
+
+
+
+## Modo Offline
+
+๐ค Transformers puede ejecutarse en un entorno con firewall o fuera de lรญnea (offline) usando solo archivos locales. Configura la variable de entorno `HF_HUB_OFFLINE=1` para habilitar este comportamiento.
+
+
+
+Puedes aรฑadir [๐ค Datasets](https://huggingface.co/docs/datasets/) al flujo de entrenamiento offline declarando la variable de entorno `HF_DATASETS_OFFLINE=1`.
+
+
+
+Por ejemplo, normalmente ejecutarรญas un programa en una red normal con firewall para instancias externas con el siguiente comando:
+
+```bash
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+Ejecuta este mismo programa en una instancia offline con el siguiente comando:
+
+```bash
+HF_DATASETS_OFFLINE=1 HF_HUB_OFFLINE=1 \
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+El script ahora deberรญa ejecutarse sin bloquearse ni esperar a que se agote el tiempo de espera porque sabe que solo debe buscar archivos locales.
+
+### Obtener modelos y tokenizers para uso offline
+
+Otra opciรณn para usar ๐ค Transformers offline es descargando previamente los archivos y despuรฉs apuntar al path local donde se encuentren. Hay tres maneras de hacer esto:
+
+* Descarga un archivo mediante la interfaz de usuario del [Model Hub](https://huggingface.co/models) haciendo click en el รญcono โ.
+
+ 
+
+
+* Utiliza el flujo de [`PreTrainedModel.from_pretrained`] y [`PreTrainedModel.save_pretrained`]:
+ 1. Descarga previamente los archivos con [`PreTrainedModel.from_pretrained`]:
+
+ ```py
+ >>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("bigscience/T0_3B")
+ >>> model = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0_3B")
+ ```
+
+
+ 2. Guarda los archivos en un directorio especรญfico con [`PreTrainedModel.save_pretrained`]:
+
+ ```py
+ >>> tokenizer.save_pretrained("./your/path/bigscience_t0")
+ >>> model.save_pretrained("./your/path/bigscience_t0")
+ ```
+
+ 3. Cuando te encuentres offline, recarga los archivos con [`PreTrainedModel.from_pretrained`] desde el directorio especificado:
+
+ ```py
+ >>> tokenizer = AutoTokenizer.from_pretrained("./your/path/bigscience_t0")
+ >>> model = AutoModel.from_pretrained("./your/path/bigscience_t0")
+ ```
+
+* Descarga de manera programรกtica los archivos con la biblioteca [huggingface_hub](https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub):
+
+ 1. Instala la biblioteca [huggingface_hub](https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub) en tu entorno virtual:
+
+ ```bash
+ python -m pip install huggingface_hub
+ ```
+
+ 2. Utiliza la funciรณn [`hf_hub_download`](https://huggingface.co/docs/hub/adding-a-library#download-files-from-the-hub) para descargar un archivo a un path especรญfico. Por ejemplo, el siguiente comando descarga el archivo `config.json` del modelo [T0](https://huggingface.co/bigscience/T0_3B) al path deseado:
+
+ ```py
+ >>> from huggingface_hub import hf_hub_download
+
+ >>> hf_hub_download(repo_id="bigscience/T0_3B", filename="config.json", cache_dir="./your/path/bigscience_t0")
+ ```
+
+Una vez que el archivo se descargue y se almacene en cachรฉ localmente, especifica tu ruta local para cargarlo y usarlo:
+
+```py
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("./your/path/bigscience_t0/config.json")
+```
+
+
+
+Para mรกs detalles sobre cรณmo descargar archivos almacenados en el Hub consulta la secciรณn [How to download files from the Hub](https://huggingface.co/docs/hub/how-to-downstream).
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/model_memory_anatomy.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/model_memory_anatomy.md
new file mode 100644
index 0000000000000000000000000000000000000000..6a220da993dba39d98493c60f123830436fc332b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/model_memory_anatomy.md
@@ -0,0 +1,239 @@
+
+
+# Anatomรญa del entrenamiento de los modelos
+
+Para entender las tรฉcnicas de optimizaciรณn del rendimiento que se pueden aplicar para mejorar la eficiencia en la velocidad del entrenamiento de los modelos y la utilizaciรณn de la memoria, es รบtil familiarizarse con cรณmo se utiliza la GPU durante el entrenamiento y cรณmo varรญa la intensidad de cรกlculo segรบn la operaciรณn realizada.
+
+Empecemos explorando un ejemplo enfocado en la utilizaciรณn de la GPU y la ejecuciรณn del entrenamiento de un modelo. Para la demostraciรณn, necesitaremos instalar algunas bibliotecas:
+
+```bash
+pip install transformers datasets accelerate nvidia-ml-py3
+```
+
+La biblioteca `nvidia-ml-py3` nos permite monitorear la utilizaciรณn de memoria de los modelos desde Python. Es posible que estรฉs familiarizado con el comando `nvidia-smi` en la terminal, esta biblioteca nos permite acceder a la misma informaciรณn en Python directamente.
+
+Luego, creamos algunos datos ficticios: IDs de tokens aleatorios entre 100 y 30000 y etiquetas binarias para un clasificador. En total, obtenemos 512 secuencias cada una con longitud 512 y las almacenamos en un [`~datasets.Dataset`] con formato PyTorch.
+
+
+```py
+>>> import numpy as np
+>>> from datasets import Dataset
+
+
+>>> seq_len, dataset_size = 512, 512
+>>> dummy_data = {
+... "input_ids": np.random.randint(100, 30000, (dataset_size, seq_len)),
+... "labels": np.random.randint(0, 1, (dataset_size)),
+... }
+>>> ds = Dataset.from_dict(dummy_data)
+>>> ds.set_format("pt")
+```
+
+Para imprimir estadรญsticas resumidas para la utilizaciรณn de la GPU y la ejecuciรณn del entrenamiento con [`Trainer`](https://huggingface.co/docs/transformers/en/main_classes/trainer#transformers.Trainer), definimos dos funciones auxiliares:
+
+```py
+>>> from pynvml import *
+
+
+>>> def print_gpu_utilization():
+... nvmlInit()
+... handle = nvmlDeviceGetHandleByIndex(0)
+... info = nvmlDeviceGetMemoryInfo(handle)
+... print(f"GPU memory occupied: {info.used//1024**2} MB.")
+
+
+>>> def print_summary(result):
+... print(f"Time: {result.metrics['train_runtime']:.2f}")
+... print(f"Samples/second: {result.metrics['train_samples_per_second']:.2f}")
+... print_gpu_utilization()
+```
+
+Comencemos comprobando que la memoria GPU este libre:
+
+```py
+>>> print_gpu_utilization()
+GPU memory occupied: 0 MB.
+```
+
+Parece estar bien: la memoria de la GPU no estรก ocupada como esperarรญamos antes de cargar cualquier modelo. Si no es el caso en tu mรกquina, asegรบrate de detener todos los procesos que estรฉn utilizando la memoria de la GPU. Sin embargo, no toda la memoria libre de la GPU puede ser utilizada por el usuario. Cuando se carga un modelo en la GPU, tambiรฉn se cargan los kernels, lo que puede ocupar 1-2GB de memoria. Para ver cuรกnta memoria serรก ocupada por defecto, cargemos un tensor diminuto en la GPU, lo que tambiรฉn desencadena la carga de los kernels.
+
+```py
+>>> import torch
+
+
+>>> torch.ones((1, 1)).to("cuda")
+>>> print_gpu_utilization()
+GPU memory occupied: 1343 MB.
+```
+
+Vemos que los kernels solos ocupan 1,3GB de memoria de la GPU. Ahora, veamos cuรกnto espacio ocupa el modelo.
+
+## Cargar el Modelo
+
+Primero, cargamos el modelo `google-bert/bert-large-uncased`. Los pesos del modelo son cargados directamente en la GPU para que podamos verificar cuรกnto espacio ocupan solo los pesos.
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-large-uncased").to("cuda")
+>>> print_gpu_utilization()
+GPU memory occupied: 2631 MB.
+```
+
+Podemos ver que los pesos del modelo solos ocupan 1,3 GB de memoria de la GPU. El nรบmero exacto depende de la GPU especรญfica que estรฉs utilizando. Ten en cuenta que en GPUs mรกs modernas, un modelo puede ocupar mรกs espacio ya que los pesos se cargan de manera optimizada lo cual acelera el uso del modelo. Ahora tambiรฉn podemos verificar rรกpidamente si obtenemos el mismo resultado que con la CLI de `nvidia-smi`:
+
+```bash
+nvidia-smi
+```
+
+```bash
+Tue Jan 11 08:58:05 2022
++-----------------------------------------------------------------------------+
+| NVIDIA-SMI 460.91.03 Driver Version: 460.91.03 CUDA Version: 11.2 |
+|-------------------------------+----------------------+----------------------+
+| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
+| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
+| | | MIG M. |
+|===============================+======================+======================|
+| 0 Tesla V100-SXM2... On | 00000000:00:04.0 Off | 0 |
+| N/A 37C P0 39W / 300W | 2631MiB / 16160MiB | 0% Default |
+| | | N/A |
++-------------------------------+----------------------+----------------------+
+
++-----------------------------------------------------------------------------+
+| Processes: |
+| GPU GI CI PID Type Process name GPU Memory |
+| ID ID Usage |
+|=============================================================================|
+| 0 N/A N/A 3721 C ...nvs/codeparrot/bin/python 2629MiB |
++-----------------------------------------------------------------------------+
+```
+
+Obtenemos el mismo nรบmero que antes y tambiรฉn puedes ver que estamos utilizando una GPU V100 con 16GB de memoria. Ahora podemos empezar a entrenar el modelo y ver cรณmo cambia el consumo de memoria de la GPU. Primero, configuramos algunos argumentos de entrenamiento estรกndar:
+
+```py
+default_args = {
+ "output_dir": "tmp",
+ "eval_strategy": "steps",
+ "num_train_epochs": 1,
+ "log_level": "error",
+ "report_to": "none",
+}
+```
+
+
+
+Si planeas ejecutar varias pruebas, reinicie el kernel de Python entre cada prueba para borrar correctamente la memoria.
+
+
+
+## Utilizaciรณn de la memoria en el entrenamiento
+
+Vamos a utilizar el [`Trainer`](https://huggingface.co/docs/transformers/en/main_classes/trainer#transformers.Trainer) y entrenar el modelo sin utilizar ninguna tรฉcnica de optimizaciรณn del rendimiento de la GPU y un tamaรฑo de lote de 4:
+
+```py
+>>> from transformers import TrainingArguments, Trainer, logging
+
+>>> logging.set_verbosity_error()
+
+
+>>> training_args = TrainingArguments(per_device_train_batch_size=4, **default_args)
+>>> trainer = Trainer(model=model, args=training_args, train_dataset=ds)
+>>> result = trainer.train()
+>>> print_summary(result)
+```
+
+```
+Time: 57.82
+Samples/second: 8.86
+GPU memory occupied: 14949 MB.
+```
+
+Vemos que incluso un tamaรฑo de lote relativamente pequeรฑo casi llena toda la memoria de nuestra GPU. Sin embargo, un tamaรฑo de lote mรกs grande a menudo puede resultar en una convergencia del modelo mรกs rรกpida o un mejor rendimiento final. Asรญ que idealmente queremos ajustar el tamaรฑo del lote a las necesidades del modelo y no a las limitaciones de la GPU. Lo interesante es que utilizamos mucha mรกs memoria que el tamaรฑo del modelo.
+Para entender un poco mejor por quรฉ es el caso, echemos un vistazo a las operaciones y necesidades de memoria de un modelo.
+
+## Anatomรญa de las Operaciones del Modelo
+
+La arquitectura de los transformers incluye 3 grupos principales de operaciones agrupadas a continuaciรณn por intensidad de cรกlculo.
+
+1. **Contracciones de Tensores**
+
+ Las capas lineales y componentes de la Atenciรณn Multi-Head realizan **multiplicaciones matriciales por lotes**. Estas operaciones son la parte mรกs intensiva en cรกlculo del entrenamiento de los transformers.
+
+2. **Normalizaciones Estadรญsticas**
+
+ Softmax y normalizaciรณn de capas son menos intensivas en cรกlculo que las contracciones de tensores, e implican una o mรกs **operaciones de reducciรณn**, cuyo resultado se aplica luego mediante un mapa.
+
+3. **Operadores por Elemento**
+
+ Estos son los operadores restantes: **sesgos, dropout, activaciones y conexiones residuales**. Estas son las operaciones menos intensivas en cรกlculo.
+
+Este conocimiento puede ser รบtil al analizar cuellos de botella de rendimiento.
+
+Este resumen se deriva de [Data Movement Is All You Need: A Case Study on Optimizing Transformers 2020](https://arxiv.org/abs/2007.00072)
+
+
+## Anatomรญa de la Memoria del Modelo
+
+Hemos visto que al entrenar un modelo se utiliza mucha mรกs memoria que solo poner el modelo en la GPU. Esto se debe a que hay muchos componentes durante el entrenamiento que utilizan memoria de la GPU. Los componentes en memoria de la GPU son los siguientes:
+
+1. pesos del modelo
+2. estados del optimizador
+3. gradientes
+4. activaciones hacia adelante guardadas para el cรกlculo del gradiente
+5. buffers temporales
+6. memoria especรญfica de funcionalidad
+
+Un modelo tรญpico entrenado en precisiรณn mixta con AdamW requiere 18 bytes por parรกmetro del modelo mรกs memoria de activaciรณn. Para la inferencia no hay estados del optimizador ni gradientes, por lo que podemos restarlos. Y asรญ terminamos con 6 bytes por parรกmetro del modelo para la inferencia en precisiรณn mixta, mรกs la memoria de activaciรณn.
+
+Veรกmoslo a detalle:
+
+**Pesos del Modelo:**
+
+- 4 bytes por nรบmero de parรกmetros para entrenamiento en fp32
+- 6 bytes por nรบmero de parรกmetros para entrenamiento en precisiรณn mixta (mantiene un modelo en fp32 y uno en fp16 en memoria)
+
+**Estados del Optimizador:**
+
+- 8 bytes por nรบmero de parรกmetros para un AdamW normal (mantiene 2 estados)
+- 2 bytes por nรบmero de parรกmetros para optimizadores de 8 bits como [bitsandbytes](https://github.com/TimDettmers/bitsandbytes)
+- 4 bytes por nรบmero de parรกmetros para optimizadores como SGD con momentum (mantiene solo 1 estado)
+
+**Gradientes**
+
+- 4 bytes por nรบmero de parรกmetros para entrenamiento en fp32 o precisiรณn mixta (los gradientes siempre se mantienen en fp32)
+
+**Activaciones hacia Adelante**
+
+- El tamaรฑo depende de muchos factores, los principales siendo la longitud de la secuencia, el tamaรฑo oculto y el tamaรฑo de lote.
+
+Hay entradas y salidas que se pasan y se devuelven por las funciones hacia adelante y hacia atrรกs, y las activaciones hacia adelante (*forward activations*) guardadas para el cรกlculo del gradiente.
+
+**Memoria Temporal**
+
+Ademรกs, hay todas clases de variables temporales que se liberan una vez que se completa el cรกlculo, pero en el momento podrรญan requerir memoria adicional y podrรญan provocar un error de memoria insuficiente. Por lo tanto, al codificar es crucial pensar estratรฉgicamente sobre tales variables temporales y a veces liberarlas explรญcitamente tan pronto como ya no se necesitan.
+
+**Memoria Especรญfica de Funcionalidad**
+
+Entonces, su software podrรญa tener necesidades especiales de memoria. Por ejemplo, al generar texto mediante la bรบsqueda por haz, el software necesita mantener mรบltiples copias de las entradas y salidas.
+
+**Velocidad de Ejecuciรณn `forward` vs `backward`**
+
+Para convoluciones y capas lineales, hay 2x flops en la ejecuciรณn hacia atrรกs (`backward`) en comparaciรณn con la ejecuciรณn hacia adelante (`forward`), lo que generalmente se traduce en ~2x mรกs lento (a veces mรกs, porque los tamaรฑos en la ejecuciรณn hacia atrรกs tienden a ser mรกs complejos). Las activaciones suelen ser limitadas por ancho de banda, y es tรญpico que una activaciรณn tenga que leer mรกs datos en la ejecuciรณn hacia atrรกs que en la ejecuciรณn hacia adelante (por ejemplo, la activaciรณn hacia adelante lee una vez, escribe una vez, la activaciรณn hacia atrรกs lee dos veces, gradOutput y salida de la ejecuciรณn hacia adelante, y escribe una vez, gradInput).
+
+Como puedes ver, hay potencialmente unos pocos lugares donde podrรญamos ahorrar memoria de la GPU o acelerar operaciones. Ahora que entiendes quรฉ afecta la utilizaciรณn de la GPU y la velocidad de cรกlculo, consulta la pรกgina de documentaciรณn [Mรฉtodos y herramientas para entrenamiento eficiente en una sola GPU](https://huggingface.co/docs/transformers/perf_train_gpu_one) para aprender sobre tรฉcnicas de optimizaciรณn del rendimiento.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/model_sharing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/model_sharing.md
new file mode 100644
index 0000000000000000000000000000000000000000..77ee523094f4527549b2e19627a0e46fe230ff1a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/model_sharing.md
@@ -0,0 +1,223 @@
+
+
+# Compartir un modelo
+
+Los รบltimos dos tutoriales mostraron cรณmo puedes realizar fine-tunning a un modelo con PyTorch, Keras y ๐ค Accelerate para configuraciones distribuidas. ยกEl siguiente paso es compartir tu modelo con la comunidad! En Hugging Face creemos en compartir abiertamente a todos el conocimiento y los recursos para democratizar la inteligencia artificial. En este sentido, te animamos a considerar compartir tu modelo con la comunidad, de esta forma ayudas a otros ahorrando tiempo y recursos.
+
+En este tutorial aprenderรกs dos mรฉtodos para compartir un modelo trained o fine-tuned en el [Model Hub](https://huggingface.co/models):
+
+- Mediante Cรณdigo, enviando (push) tus archivos al Hub.
+- Con la interfaz Web, con Drag-and-drop de tus archivos al Hub.
+
+VIDEO
+
+
+
+Para compartir un modelo con la comunidad necesitas una cuenta en [huggingface.co](https://huggingface.co/join). Tambiรฉn puedes unirte a una organizaciรณn existente o crear una nueva.
+
+
+
+## Caracterรญsticas de los repositorios
+
+Cada repositorio en el Model Hub se comporta como cualquier otro repositorio en GitHub. Nuestros repositorios ofrecen versioning, commit history, y la habilidad para visualizar diferencias.
+
+El versioning desarrollado dentro del Model Hub es basado en git y [git-lfs](https://git-lfs.github.com/). En otras palabras, puedes tratar un modelo como un repositorio, brindando un mejor control de acceso y escalabilidad. Version control permite *revisions*, un mรฉtodo para apuntar a una versiรณn especรญfica de un modelo utilizando un commit hash, tag o branch.
+
+Como resultado, puedes cargar una versiรณn especรญfica del modelo con el parรกmetro `revision`:
+
+```py
+>>> model = AutoModel.from_pretrained(
+... "julien-c/EsperBERTo-small", revision="4c77982" # tag name, or branch name, or commit hash
+... )
+```
+
+Los archivos son editados fรกcilmente dentro de un repositorio. Incluso puedes observar el commit history y las diferencias:
+
+
+
+## Configuraciรณn inicial
+
+Antes de compartir un modelo al Hub necesitarรกs tus credenciales de Hugging Face. Si tienes acceso a una terminal ejecuta el siguiente comando en el entorno virtual donde ๐ค Transformers estรฉ instalado. Esto guardarรก tu token de acceso dentro de tu carpeta cache de Hugging Face (~/.cache/ by default):
+
+```bash
+huggingface-cli login
+```
+
+Si usas un notebook como Jupyter o Colaboratory, asegรบrate de tener instalada la biblioteca [`huggingface_hub`](https://huggingface.co/docs/hub/adding-a-library). Esta biblioteca te permitirรก interactuar por cรณdigo con el Hub.
+
+```bash
+pip install huggingface_hub
+```
+
+Luego usa `notebook_login` para iniciar sesiรณn al Hub, y sigue el link [aquรญ](https://huggingface.co/settings/token) para generar un token con el que iniciaremos sesiรณn:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Convertir un modelo para todos los Frameworks
+
+Para asegurarnos que tu modelo pueda ser usado por alguien que estรฉ trabajando con un framework diferente, te recomendamos convertir y subir tu modelo con checkpoints de pytorch y tensorflow. Aunque los usuarios aรบn son capaces de cargar su modelo desde un framework diferente, si se omite este paso serรก mรกs lento debido a que ๐ค Transformers necesitarรก convertir el checkpoint sobre-la-marcha.
+
+Convertir un checkpoint para otro framework es fรกcil. Asegรบrate tener Pytorch y TensorFlow instalado (Vรฉase [aquรญ](installation) para instrucciones de instalaciรณn), y luego encuentra el modelo especรญfico para tu tarea en el otro Framework.
+
+Por ejemplo, supongamos que has entrenado DistilBert para clasificaciรณn de secuencias en PyTorch y quieres convertirlo a su equivalente en TensorFlow. Cargas el equivalente en TensorFlow de tu modelo para tu tarea y especificas `from_pt=True` asรญ ๐ค Transformers convertirรก el Pytorch checkpoint a un TensorFlow Checkpoint:
+
+```py
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_pt=True)
+```
+
+Luego guardas tu nuevo modelo TensorFlow con su nuevo checkpoint:
+
+```py
+>>> tf_model.save_pretrained("path/to/awesome-name-you-picked")
+```
+
+De manera similar, especificas `from_tf=True` para convertir un checkpoint de TensorFlow a Pytorch:
+
+```py
+>>> pt_model = DistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_tf=True)
+>>> pt_model.save_pretrained("path/to/awesome-name-you-picked")
+```
+
+Si algรบn modelo estรก disponible en Flax, tambiรฉn puedes convertir un checkpoint de Pytorch a Flax:
+
+```py
+>>> flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
+... "path/to/awesome-name-you-picked", from_pt=True
+... )
+```
+
+## Compartir un modelo con `Trainer`
+
+
+
+Compartir un modelo al Hub es tan simple como aรฑadir un parรกmetro extra o un callback. Si recuerdas del tutorial de [fine-tuning tutorial](training), la clase [`TrainingArguments`] es donde especificas los Hiperparรกmetros y opciones de entrenamiento adicionales. Una de estas opciones incluye la habilidad de compartir un modelo directamente al Hub. Para ello configuras `push_to_hub=True` dentro de [`TrainingArguments`]:
+
+```py
+>>> training_args = TrainingArguments(output_dir="my-awesome-model", push_to_hub=True)
+```
+
+A continuaciรณn, como usualmente, pasa tus argumentos de entrenamiento a [`Trainer`]:
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+Luego que realizas fine-tune a tu modelo, llamas [`~transformers.Trainer.push_to_hub`] en [`Trainer`] para enviar el modelo al Hub!๐ค Transformers incluso aรฑadirรก automรกticamente los Hiperparรกmetros de entrenamiento, resultados de entrenamiento y versiones del Framework a tu model card!
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Compartir un modelo con `PushToHubCallback`
+
+Los usuarios de TensorFlow pueden activar la misma funcionalidad con [`PushToHubCallback`]. En la funcion [`PushToHubCallback`], agrega:
+
+- Un directorio de salida para tu modelo.
+- Un tokenizador.
+- El `hub_model_id`, el cual es tu usuario Hub y el nombre del modelo.
+
+```py
+>>> from transformers import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="./your_model_save_path", tokenizer=tokenizer, hub_model_id="your-username/my-awesome-model"
+... )
+```
+
+Agregamos el callback a [`fit`](https://keras.io/api/models/model_training_apis/), y ๐ค Transformers enviarรก el modelo entrenado al Hub:
+
+```py
+>>> model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3, callbacks=push_to_hub_callback)
+```
+
+## Usando la funciรณn `push_to_hub`
+
+Puedes llamar la funciรณn `push_to_hub` directamente en tu modelo para subirlo al Hub.
+
+Especifica el nombre del modelo en `push_to_hub`:
+
+```py
+>>> pt_model.push_to_hub("my-awesome-model")
+```
+
+Esto crearรก un repositorio bajo tu usuario con el nombre del modelo `my-awesome-model`. Ahora los usuarios pueden cargar tu modelo con la funciรณn `from_pretrained`:
+
+```py
+>>> from transformers import AutoModel
+
+>>> model = AutoModel.from_pretrained("your_username/my-awesome-model")
+```
+
+Si perteneces a una organizaciรณn y quieres compartir tu modelo bajo el nombre de la organizaciรณn, aรฑade el parรกmetro `organization`:
+
+```py
+>>> pt_model.push_to_hub("my-awesome-model", organization="my-awesome-org")
+```
+
+La funciรณn `push_to_hub` tambiรฉn puede ser usada para aรฑadir archivos al repositorio del modelo. Por ejemplo, aรฑade un tokenizador al repositorio:
+
+```py
+>>> tokenizer.push_to_hub("my-awesome-model")
+```
+
+O quizรกs te gustarรญa aรฑadir la versiรณn de TensorFlow de tu modelo fine-tuned en Pytorch:
+
+```py
+>>> tf_model.push_to_hub("my-awesome-model")
+```
+
+Ahora, cuando navegues a tu perfil en Hugging Face, deberรญas observar el repositorio de tu modelo creado recientemente. Si das click en el tab **Files** observarรกs todos los archivos que has subido al repositorio.
+
+Para mรกs detalles sobre cรณmo crear y subir archivos al repositorio, consulta la [documentaciรณn del Hub](https://huggingface.co/docs/hub/how-to-upstream).
+
+## Compartir con la interfaz web
+
+Los usuarios que prefieran un enfoque no-code tienen la opciรณn de cargar su modelo a travรฉs de la interfaz grรกfica del Hub. Visita la pรกgina [huggingface.co/new](https://huggingface.co/new) para crear un nuevo repositorio:
+
+
+
+Desde aquรญ, aรฑade informaciรณn acerca del modelo:
+
+- Selecciona el **owner** (la persona propietaria) del repositorio. Puedes ser tรบ o cualquier organizaciรณn a la que pertenezcas.
+- Escoge un nombre para tu modelo. Tambiรฉn serรก el nombre del repositorio.
+- Elige si tu modelo es pรบblico o privado.
+- Especifica la licencia que usarรก tu modelo.
+
+Ahora puedes hacer click en el tab **Files** y luego en el botรณn **Add file** para subir un nuevo archivo a tu repositorio. Luego arrastra y suelta un archivo a subir y le aรฑades un mensaje al commit.
+
+
+
+## Aรฑadiendo una tarjeta de modelo
+
+Para asegurarnos que los usuarios entiendan las capacidades de tu modelo, sus limitaciones, posibles sesgos y consideraciones รฉticas, por favor aรฑade una tarjeta (como una tarjeta de presentaciรณn) al repositorio del modelo. La tarjeta de modelo es definida en el archivo `README.md`. Puedes agregar una de la siguiente manera:
+
+* Elaborando y subiendo manualmente el archivo`README.md`.
+* Dando click en el botรณn **Edit model card** dentro del repositorio.
+
+Toma un momento para ver la [tarjeta de modelo](https://huggingface.co/distilbert/distilbert-base-uncased) de DistilBert para que tengas un buen ejemplo del tipo de informaciรณn que deberรญa incluir. Consulta [la documentaciรณn](https://huggingface.co/docs/hub/models-cards) para mรกs detalles acerca de otras opciones que puedes controlar dentro del archivo `README.md` como la huella de carbono del modelo o ejemplos de widgets. Consulta la documentaciรณn [aquรญ](https://huggingface.co/docs/hub/models-cards).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/multilingual.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/multilingual.md
new file mode 100644
index 0000000000000000000000000000000000000000..d49d54f196d54e160e02c93b9322255e3e0509bc
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/multilingual.md
@@ -0,0 +1,179 @@
+
+
+# Modelos multilingรผes para inferencia
+
+[[open-in-colab]]
+
+Existen varios modelos multilingรผes en ๐ค Transformers y su uso para inferencia difiere de los modelos monolingรผes. Sin embargo, no *todos* los usos de los modelos multilingรผes son diferentes. Algunos modelos, como [google-bert/bert-base-multilingual-uncased](https://huggingface.co/google-bert/bert-base-multilingual-uncased), pueden utilizarse igual que un modelo monolingรผe. Esta guรญa te enseรฑarรก cรณmo utilizar modelos multilingรผes cuyo uso difiere en la inferencia.
+
+## XLM
+
+XLM tiene diez checkpoints diferentes de los cuales solo uno es monolingรผe. Los nueve checkpoints restantes del modelo pueden dividirse en dos categorรญas: los checkpoints que utilizan language embeddings y los que no.
+
+### XLM con language embeddings
+
+Los siguientes modelos XLM usan language embeddings para especificar el lenguaje utilizado en la inferencia:
+
+- `FacebookAI/xlm-mlm-ende-1024` (Masked language modeling, English-German)
+- `FacebookAI/xlm-mlm-enfr-1024` (Masked language modeling, English-French)
+- `FacebookAI/xlm-mlm-enro-1024` (Masked language modeling, English-Romanian)
+- `FacebookAI/xlm-mlm-xnli15-1024` (Masked language modeling, XNLI languages)
+- `FacebookAI/xlm-mlm-tlm-xnli15-1024` (Masked language modeling + translation, XNLI languages)
+- `FacebookAI/xlm-clm-enfr-1024` (Causal language modeling, English-French)
+- `FacebookAI/xlm-clm-ende-1024` (Causal language modeling, English-German)
+
+Los language embeddings son representados como un tensor de la mismas dimensiones que los `input_ids` pasados al modelo. Los valores de estos tensores dependen del idioma utilizado y se identifican mediante los atributos `lang2id` y `id2lang` del tokenizador.
+
+En este ejemplo, carga el checkpoint `FacebookAI/xlm-clm-enfr-1024` (Causal language modeling, English-French):
+
+```py
+>>> import torch
+>>> from transformers import XLMTokenizer, XLMWithLMHeadModel
+
+>>> tokenizer = XLMTokenizer.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+>>> model = XLMWithLMHeadModel.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+```
+
+El atributo `lang2id` del tokenizador muestra los idiomas de este modelo y sus ids:
+
+```py
+>>> print(tokenizer.lang2id)
+{'en': 0, 'fr': 1}
+```
+
+A continuaciรณn, crea un input de ejemplo:
+
+```py
+>>> input_ids = torch.tensor([tokenizer.encode("Wikipedia was used to")]) # batch size of 1
+```
+
+Establece el id del idioma, por ejemplo `"en"`, y utilรญzalo para definir el language embedding. El language embedding es un tensor lleno de `0` ya que es el id del idioma para inglรฉs. Este tensor debe ser del mismo tamaรฑo que `input_ids`.
+
+```py
+>>> language_id = tokenizer.lang2id["en"] # 0
+>>> langs = torch.tensor([language_id] * input_ids.shape[1]) # torch.tensor([0, 0, 0, ..., 0])
+
+>>> # We reshape it to be of size (batch_size, sequence_length)
+>>> langs = langs.view(1, -1) # is now of shape [1, sequence_length] (we have a batch size of 1)
+```
+
+Ahora puedes pasar los `input_ids` y el language embedding al modelo:
+
+```py
+>>> outputs = model(input_ids, langs=langs)
+```
+
+El script [run_generation.py](https://github.com/huggingface/transformers/tree/master/examples/pytorch/text-generation/run_generation.py) puede generar texto con language embeddings utilizando los checkpoints `xlm-clm`.
+
+### XLM sin language embeddings
+
+Los siguientes modelos XLM no requieren language embeddings durante la inferencia:
+
+- `FacebookAI/xlm-mlm-17-1280` (modelado de lenguaje enmascarado, 17 idiomas)
+- `FacebookAI/xlm-mlm-100-1280` (modelado de lenguaje enmascarado, 100 idiomas)
+
+Estos modelos se utilizan para representaciones genรฉricas de frases a diferencia de los anteriores checkpoints XLM.
+
+## BERT
+
+Los siguientes modelos de BERT pueden utilizarse para tareas multilingรผes:
+
+- `google-bert/bert-base-multilingual-uncased` (modelado de lenguaje enmascarado + predicciรณn de la siguiente oraciรณn, 102 idiomas)
+- `google-bert/bert-base-multilingual-cased` (modelado de lenguaje enmascarado + predicciรณn de la siguiente oraciรณn, 104 idiomas)
+
+Estos modelos no requieren language embeddings durante la inferencia. Deben identificar la lengua a partir del
+contexto e inferir en consecuencia.
+
+## XLM-RoBERTa
+
+Los siguientes modelos de XLM-RoBERTa pueden utilizarse para tareas multilingรผes:
+
+- `FacebookAI/xlm-roberta-base` (modelado de lenguaje enmascarado, 100 idiomas)
+- `FacebookAI/xlm-roberta-large` (Modelado de lenguaje enmascarado, 100 idiomas)
+
+XLM-RoBERTa se entrenรณ con 2,5 TB de datos CommonCrawl reciรฉn creados y depurados en 100 idiomas. Proporciona fuertes ventajas sobre los modelos multilingรผes publicados anteriormente como mBERT o XLM en tareas posteriores como la clasificaciรณn, el etiquetado de secuencias y la respuesta a preguntas.
+
+## M2M100
+
+Los siguientes modelos de M2M100 pueden utilizarse para traducciรณn multilingรผe:
+
+- `facebook/m2m100_418M` (traducciรณn)
+- `facebook/m2m100_1.2B` (traducciรณn)
+
+En este ejemplo, carga el checkpoint `facebook/m2m100_418M` para traducir del chino al inglรฉs. Puedes establecer el idioma de origen en el tokenizador:
+
+```py
+>>> from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> chinese_text = "ไธ่ฆๆๆๅทซๅธซ็ไบๅ, ๅ ็บไปๅๆฏๅพฎๅฆ็, ๅพๅฟซๅฐฑๆ็ผๆ."
+
+>>> tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M", src_lang="zh")
+>>> model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
+```
+
+Tokeniza el texto:
+
+```py
+>>> encoded_zh = tokenizer(chinese_text, return_tensors="pt")
+```
+
+M2M100 fuerza el id del idioma de destino como el primer token generado para traducir al idioma de destino.. Establece el `forced_bos_token_id` a `en` en el mรฉtodo `generate` para traducir al inglรฉs:
+
+```py
+>>> generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id("en"))
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+'Do not interfere with the matters of the witches, because they are delicate and will soon be angry.'
+```
+
+## MBart
+
+Los siguientes modelos de MBart pueden utilizarse para traducciรณn multilingรผe:
+
+- `facebook/mbart-large-50-one-to-many-mmt` (traducciรณn automรกtica multilingรผe de uno a muchos, 50 idiomas)
+- `facebook/mbart-large-50-many-to-many-mmt` (traducciรณn automรกtica multilingรผe de muchos a muchos, 50 idiomas)
+- `facebook/mbart-large-50-many-to-one-mmt` (traducciรณn automรกtica multilingรผe muchos a uno, 50 idiomas)
+- `facebook/mbart-large-50` (traducciรณn multilingรผe, 50 idiomas)
+- `facebook/mbart-large-cc25`
+
+En este ejemplo, carga el checkpoint `facebook/mbart-large-50-many-to-many-mmt` para traducir del finlandรฉs al inglรฉs. Puedes establecer el idioma de origen en el tokenizador:
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> fi_text = "รlรค sekaannu velhojen asioihin, sillรค ne ovat hienovaraisia ja nopeasti vihaisia."
+
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/mbart-large-50-many-to-many-mmt", src_lang="fi_FI")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
+```
+
+Tokeniza el texto:
+
+```py
+>>> encoded_en = tokenizer(en_text, return_tensors="pt")
+```
+
+MBart fuerza el id del idioma de destino como el primer token generado para traducirlo. Establece el `forced_bos_token_id` a `en` en el mรฉtodo `generate` para traducir al inglรฉs:
+
+```py
+>>> generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id("en_XX"))
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+"Don't interfere with the wizard's affairs, because they are subtle, will soon get angry."
+```
+
+Si estรกs usando el checkpoint `facebook/mbart-large-50-many-to-one-mmt` no necesitas forzar el id del idioma de destino como el primer token generado, de lo contrario el uso es el mismo.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pad_truncation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pad_truncation.md
new file mode 100644
index 0000000000000000000000000000000000000000..6a31a69103502fa2736b870b1fa5bc61e8556657
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pad_truncation.md
@@ -0,0 +1,69 @@
+
+
+# Relleno y truncamiento
+
+Las entradas agrupadas por lotes (batched) suelen tener longitudes diferentes, por lo que no se pueden convertir en tensores de tamaรฑo fijo. El relleno (tambiรฉn conocido como "Padding") y el truncamiento (conocido como "Truncation") son estrategias para abordar este problema y crear tensores rectangulares a partir de lotes de longitudes variables. El relleno agrega un **padding token** especial para garantizar que las secuencias mรกs cortas tengan la misma longitud que la secuencia mรกs larga en un lote o la longitud mรกxima aceptada por el modelo. El truncamiento funciona en la otra direcciรณn al truncar secuencias largas.
+
+En la mayorรญa de los casos, es bastante eficaz rellenar el lote hasta la longitud de la secuencia mรกs larga y truncar hasta la longitud mรกxima que un modelo puede aceptar. Sin embargo, la API admite mรกs estrategias si las necesitas. Los tres argumentos que necesitas son: `padding`, `truncation` y `max_length`.
+
+El argumento `padding` controla el relleno. Puede ser un booleano o una cadena:
+
+ - `True` o `'longest'`: rellena hasta la longitud de la secuencia mรกs larga en el lote (no se aplica relleno si solo proporcionas una รบnica secuencia).
+ - `'max_length'`: rellena hasta una longitud especificada por el argumento `max_length` o la longitud mรกxima aceptada
+ por el modelo si no se proporciona `max_length` (`max_length=None`). El relleno se aplicarรก incluso si solo proporcionas una รบnica secuencia.
+ - `False` o `'do_not_pad'`: no se aplica relleno. Este es el comportamiento predeterminado.
+
+El argumento `truncation` controla el truncamiento. Puede ser un booleano o una cadena:
+
+ - `True` o `'longest_first'`: trunca hasta una longitud mรกxima especificada por el argumento `max_length` o
+ la longitud mรกxima aceptada por el modelo si no se proporciona `max_length` (`max_length=None`). Esto
+ truncarรก token por token, eliminando un token de la secuencia mรกs larga en el par hasta alcanzar la longitud adecuada.
+ - `'only_second'`: trunca hasta una longitud mรกxima especificada por el argumento `max_length` o la longitud mรกxima
+ aceptada por el modelo si no se proporciona `max_length` (`max_length=None`). Esto solo truncarรก
+ la segunda oraciรณn de un par si se proporciona un par de secuencias (o un lote de pares de secuencias).
+ - `'only_first'`: trunca hasta una longitud mรกxima especificada por el argumento `max_length` o la longitud mรกxima
+ aceptada por el modelo si no se proporciona `max_length` (`max_length=None`). Esto solo truncarรก
+ la primera oraciรณn de un par si se proporciona un par de secuencias (o un lote de pares de secuencias).
+ - `False` o `'do_not_truncate'`: no se aplica truncamiento. Este es el comportamiento predeterminado.
+
+El argumento `max_length` controla la longitud del relleno y del truncamiento. Puede ser un nรบmero entero o `None`, en cuyo caso se establecerรก automรกticamente en la longitud mรกxima que el modelo puede aceptar. Si el modelo no tiene una longitud mรกxima de entrada especรญfica, se desactiva el truncamiento o el relleno hasta `max_length`.
+
+La siguiente tabla resume la forma recomendada de configurar el relleno y el truncamiento. Si usas pares de secuencias de entrada en alguno de los siguientes ejemplos, puedes reemplazar `truncation=True` por una `ESTRATEGIA` seleccionada en
+`['only_first', 'only_second', 'longest_first']`, es decir, `truncation='only_second'` o `truncation='longest_first'` para controlar cรณmo se truncan ambas secuencias en el par, como se detallรณ anteriormente.
+
+| Truncation | Padding | Instrucciรณn |
+|-----------------------------------------|--------------------------------------|---------------------------------------------------------------------------------------------|
+| sin truncamiento | sin relleno | `tokenizer(batch_sentences)` |
+| | relleno hasta la longitud mรกxima del lote | `tokenizer(batch_sentences, padding=True)` o |
+| | | `tokenizer(batch_sentences, padding='longest')` |
+| | relleno hasta la longitud mรกxima del modelo | `tokenizer(batch_sentences, padding='max_length')` |
+| | relleno hasta una longitud especรญfica | `tokenizer(batch_sentences, padding='max_length', max_length=42)` |
+| | relleno hasta un mรบltiplo de un valor | `tokenizer(batch_sentences, padding=True, pad_to_multiple_of=8)` |
+| truncamiento hasta la longitud mรกxima del modelo | sin relleno | `tokenizer(batch_sentences, truncation=True)` o |
+| | | `tokenizer(batch_sentences, truncation=ESTRATEGIA)` |
+| | relleno hasta la longitud mรกxima del lote | `tokenizer(batch_sentences, padding=True, truncation=True)` o |
+| | | `tokenizer(batch_sentences, padding=True, truncation=ESTRATEGIA)` |
+| | relleno hasta la longitud mรกxima del modelo | `tokenizer(batch_sentences, padding='max_length', truncation=True)` o |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=ESTRATEGIA)` |
+| | relleno hasta una longitud especรญfica | No es posible |
+| truncamiento hasta una longitud especรญfica | sin relleno | `tokenizer(batch_sentences, truncation=True, max_length=42)` o |
+| | | `tokenizer(batch_sentences, truncation=ESTRATEGIA, max_length=42)` |
+| | relleno hasta la longitud mรกxima del lote | `tokenizer(batch_sentences, padding=True, truncation=True, max_length=42)` o |
+| | | `tokenizer(batch_sentences, padding=True, truncation=ESTRATEGIA, max_length=42)` |
+| | relleno hasta la longitud mรกxima del modelo | No es posible |
+| | relleno hasta una longitud especรญfica | `tokenizer(batch_sentences, padding='max_length', truncation=True, max_length=42)` o |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=ESTRATEGIA, max_length=42)` |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/performance.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/performance.md
new file mode 100644
index 0000000000000000000000000000000000000000..4665c2961b3f23ddd22d129776c5f6bd91e80e5d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/performance.md
@@ -0,0 +1,61 @@
+
+
+# Rendimiento y Escalabilidad
+
+Entrenar modelos grandes de transformadores y desplegarlos en producciรณn presenta varios desafรญos. Durante el entrenamiento, el modelo puede requerir mรกs memoria de GPU de la disponible o mostrar una velocidad de entrenamiento lenta. En la fase de implementaciรณn, el modelo puede tener dificultades para manejar el rendimiento necesario en un entorno de producciรณn.
+
+Esta documentaciรณn tiene como objetivo ayudarte a superar estos desafรญos y encontrar la configuraciรณn รณptima para tu caso de uso. Las guรญas estรกn divididas en secciones de entrenamiento e inferencia, ya que cada una presenta diferentes desafรญos y soluciones. Dentro de cada secciรณn, encontrarรกs guรญas separadas para diferentes configuraciones de hardware, como GPU รบnica vs. multi-GPU para el entrenamiento o CPU vs. GPU para la inferencia.
+
+Utiliza este documento como punto de partida para navegar hacia los mรฉtodos que se ajusten a tu escenario.
+
+## Entrenamiento
+
+Entrenar modelos grandes de transformadores de manera eficiente requiere un acelerador como una GPU o TPU. El caso mรกs comรบn es cuando tienes una GPU รบnica. Los mรฉtodos que puedes aplicar para mejorar la eficiencia de entrenamiento en una GPU รบnica tambiรฉn se aplican a otras configuraciones, como mรบltiples GPU. Sin embargo, tambiรฉn existen tรฉcnicas especรญficas para entrenamiento con mรบltiples GPU o CPU, las cuales cubrimos en secciones separadas.
+
+* [Mรฉtodos y herramientas para un entrenamiento eficiente en una sola GPU](https://huggingface.co/docs/transformers/perf_train_gpu_one): comienza aquรญ para aprender enfoques comunes que pueden ayudar a optimizar la utilizaciรณn de memoria de la GPU, acelerar el entrenamiento o ambas cosas.
+* [Secciรณn de entrenamiento con varias GPU](https://huggingface.co/docs/transformers/perf_train_gpu_many): explora esta secciรณn para conocer mรฉtodos de optimizaciรณn adicionales que se aplican a configuraciones con varias GPU, como paralelismo de datos, tensores y canalizaciones.
+* [Secciรณn de entrenamiento en CPU](https://huggingface.co/docs/transformers/perf_train_cpu): aprende sobre entrenamiento de precisiรณn mixta en CPU.
+* [Entrenamiento eficiente en mรบltiples CPUs](https://huggingface.co/docs/transformers/perf_train_cpu_many): aprende sobre el entrenamiento distribuido en CPU.
+* [Entrenamiento en TPU con TensorFlow](https://huggingface.co/docs/transformers/perf_train_tpu_tf): si eres nuevo en TPUs, consulta esta secciรณn para obtener una introducciรณn basada en opiniones sobre el entrenamiento en TPUs y el uso de XLA.
+* [Hardware personalizado para el entrenamiento](https://huggingface.co/docs/transformers/perf_hardware): encuentra consejos y trucos al construir tu propia plataforma de aprendizaje profundo.
+* [Bรบsqueda de hiperparรกmetros utilizando la API del Entrenador](https://huggingface.co/docs/transformers/hpo_train)
+
+## Inferencia
+
+Realizar inferencias eficientes con modelos grandes en un entorno de producciรณn puede ser tan desafiante como entrenarlos. En las siguientes secciones, describimos los pasos para ejecutar inferencias en CPU y configuraciones con GPU รบnica/mรบltiple.
+
+* [Inferencia en una sola CPU](https://huggingface.co/docs/transformers/perf_infer_cpu)
+* [Inferencia en una sola GPU](https://huggingface.co/docs/transformers/perf_infer_gpu_one)
+* [Inferencia con mรบltiples GPU](https://huggingface.co/docs/transformers/perf_infer_gpu_one)
+* [Integraciรณn de XLA para modelos de TensorFlow](https://huggingface.co/docs/transformers/tf_xla)
+
+## Entrenamiento e Inferencia
+
+Aquรญ encontrarรกs tรฉcnicas, consejos y trucos que aplican tanto si estรกs entrenando un modelo como si estรกs ejecutando inferencias con รฉl.
+
+* [Instanciar un modelo grande](https://huggingface.co/docs/transformers/big_models)
+* [Soluciรณn de problemas de rendimiento](https://huggingface.co/docs/transformers/debugging)
+
+## Contribuir
+
+Este documento estรก lejos de estar completo y aรบn se deben agregar muchas cosas, asรญ que si tienes adiciones o correcciones que hacer, no dudes en abrir un PR. Si no estรกs seguro, inicia un Issue y podemos discutir los detalles allรญ.
+
+Cuando hagas contribuciones que indiquen que A es mejor que B, intenta incluir un benchmark reproducible y/o un enlace a la fuente de esa informaciรณn (a menos que provenga directamente de ti).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/perplexity.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/perplexity.md
new file mode 100644
index 0000000000000000000000000000000000000000..f07dc663f5524e7af98728ea3edde12466731a2d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/perplexity.md
@@ -0,0 +1,116 @@
+
+
+# Perplejidad de los modelos de longitud fija
+
+[[open-in-colab]]
+
+La perplejidad, perplexity en inglรฉs (PPL), es una de las mรฉtricas mรกs comunes para evaluar modelos de lenguaje. Antes de sumergirnos, debemos tener en cuenta que esta mรฉtrica se aplica especรญficamente a modelos de lenguaje clรกsicos (a veces llamados modelos autorregresivos o causales) y no estรก bien definida para modelos de lenguaje enmascarados como BERT (ver [resumen del modelo](model_summary)).
+
+La perplejidad se define como la media negativa exponenciada del log-likelihood de una secuencia. Si tenemos una secuencia tokenizada \\(X = (x_0, x_1, \dots, x_t)\\), entonces la perplejidad de \\(X\\) es,
+
+$$\text{PPL}(X) = \exp \left\{ {-\frac{1}{t}\sum_i^t \log p_\theta (x_i|x_{
+
+Sin embargo, al trabajar con modelos aproximados, generalmente tenemos una restricciรณn en la cantidad de tokens que el modelo puede procesar. La versiรณn mรกs grande de [GPT-2](model_doc/gpt2), por ejemplo, tiene una longitud fija de 1024 tokens, por lo que no podemos calcular \\(p_\theta(x_t|x_{
+
+Esto es rรกpido de calcular, ya que la perplejidad de cada segmento se puede calcular en un solo pase hacia adelante, pero sirve como una aproximaciรณn pobre de la perplejidad completamente factorizada y generalmente darรก como resultado una PPL mรกs alta (peor) porque el modelo tendrรก menos contexto en la mayorรญa de los pasos de predicciรณn.
+
+En cambio, la PPL de modelos de longitud fija deberรญa evaluarse con una estrategia de ventana deslizante. Esto implica deslizar repetidamente la ventana de contexto para que el modelo tenga mรกs contexto al hacer cada predicciรณn.
+
+
+
+Esta es una aproximaciรณn mรกs cercana a la verdadera descomposiciรณn de la probabilidad de la secuencia y generalmente darรก como resultado una puntuaciรณn mรกs favorable. La desventaja es que requiere un pase hacia adelante separado para cada token en el corpus. Un buen compromiso prรกctico es emplear una ventana deslizante estratificada, moviendo el contexto con pasos mรกs grandes en lugar de deslizarse de 1 token a la vez. Esto permite que la computaciรณn avance mucho mรกs rรกpido, mientras le da al modelo un contexto amplio para hacer
+predicciones en cada paso.
+
+## Ejemplo: Cรกlculo de la perplejidad con GPT-2 en ๐ค Transformers
+
+Demostremos este proceso con GPT-2.
+
+```python
+from transformers import GPT2LMHeadModel, GPT2TokenizerFast
+
+device = "cuda"
+model_id = "openai-community/gpt2-large"
+model = GPT2LMHeadModel.from_pretrained(model_id).to(device)
+tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
+```
+
+Carguemos el conjunto de datos WikiText-2 y evaluemos la perplejidad utilizando algunas estrategias de ventana deslizante diferentes. Dado que este conjunto de datos es pequeรฑo y solo estamos realizando un pase hacia adelante sobre el conjunto, podemos cargar y codificar todo el conjunto de datos en la memoria.
+
+```python
+from datasets import load_dataset
+
+test = load_dataset("wikitext", "wikitext-2-raw-v1", split="test")
+encodings = tokenizer("\n\n".join(test["text"]), return_tensors="pt")
+```
+
+Con ๐ค Transformers, simplemente podemos pasar los `input_ids` como las `labels` a nuestro modelo, y la media negativa del log-likelihood para cada token se devuelve como la pรฉrdida. Sin embargo, con nuestro enfoque de ventana deslizante, hay superposiciรณn en los tokens que pasamos al modelo en cada iteraciรณn. No queremos que el log-likelihood de los tokens que estamos tratando solo como contexto se incluya en nuestra pรฉrdida, por lo que podemos establecer estos objetivos en `-100` para que se ignoren. El siguiente es un ejemplo de cรณmo podrรญamos hacer esto con un paso de `512`. Esto significa que el modelo tendrรก al menos `512` tokens como contexto al calcular el log-likelihood condicional de cualquier token (siempre que haya `512` tokens precedentes disponibles para condicionar).
+
+```python
+import torch
+from tqdm import tqdm
+
+max_length = model.config.n_positions
+stride = 512
+seq_len = encodings.input_ids.size(1)
+
+nlls = []
+prev_end_loc = 0
+for begin_loc in tqdm(range(0, seq_len, stride)):
+ end_loc = min(begin_loc + max_length, seq_len)
+ trg_len = end_loc - prev_end_loc # puede ser diferente del paso en el รบltimo bucle
+ input_ids = encodings.input_ids[:, begin_loc:end_loc].to(device)
+ target_ids = input_ids.clone()
+ target_ids[:, :-trg_len] = -100
+
+ with torch.no_grad():
+ outputs = model(input_ids, labels=target_ids)
+
+ # la pรฉrdida se calcula utilizando CrossEntropyLoss, que promedia las etiquetas vรกlidas
+ # N.B. el modelo solo calcula la pรฉrdida sobre trg_len - 1 etiquetas, porque desplaza las etiqueta internamente
+ # a la izquierda por 1.
+ neg_log_likelihood = outputs.loss
+
+ nlls.append(neg_log_likelihood)
+
+ prev_end_loc = end_loc
+ if end_loc == seq_len:
+ break
+
+ppl = torch.exp(torch.stack(nlls).mean())
+```
+
+Ejecuta esto con la longitud de paso igual a la longitud mรกxima de entrada es equivalente a la estrategia sub รณptima,
+sin ventana deslizante, que discutimos anteriormente. Cuanto menor sea el paso, mรกs contexto tendrรก el modelo para
+realizar cada predicciรณn y, por lo general, mejor serรก la perplejidad informada.
+
+Cuando ejecutamos lo anterior con `stride = 1024`, es decir, sin superposiciรณn, la PPL resultante es `19.44`, que es
+aproximadamente la misma que la `19.93` informada en el artรญculo de GPT-2. Al utilizar `stride = 512` y, por lo tanto,
+emplear nuestra estrategia de ventana deslizante, esto disminuye a `16.45`. Esto no solo es una puntuaciรณn mรกs favorable, sino que se calcula de una manera mรกs cercana a la verdadera descomposiciรณn autorregresiva de la probabilidad de una secuencia.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/philosophy.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/philosophy.md
new file mode 100644
index 0000000000000000000000000000000000000000..4054ac0ae507160dbe7b42023ab58910f875e847
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/philosophy.md
@@ -0,0 +1,79 @@
+
+
+# Filosofรญa
+
+๐ค Transformers es una biblioteca construida para:
+
+- Los investigadores y educadores de NLP que busquen usar/estudiar/extender modelos transformers a gran escala
+- Profesionales que quieren optimizar esos modelos y/o ponerlos en producciรณn
+- Ingenieros que solo quieren descargar un modelo preentrenado y usarlo para resolver una tarea NLP dada.
+
+La biblioteca fue diseรฑada con dos fuertes objetivos en mente:
+
+- Que sea tan fรกcil y rรกpida de utilizar como sea posible:
+
+ - Hemos limitado enormemente el nรบmero de abstracciones que el usuario tiene que aprender. De hecho, no hay casi abstracciones,
+ solo tres clases estรกndar necesarias para usar cada modelo: [configuration](main_classes/configuration),
+ [models](main_classes/model) y [tokenizer](main_classes/tokenizer).
+ - Todas estas clases pueden ser inicializadas de forma simple y unificada a partir de ejemplos pre-entrenados mediante el uso de un mรฉtodo
+ `from_pretrained()` comรบn de solicitud que se encargarรก de descargar (si es necesario), almacenar y cargar la solicitud de clase relacionada y datos asociados
+ (configurations' hyper-parameters, tokenizers' vocabulary, and models' weights) a partir de un control pre-entrenado proporcionado en
+ [Hugging Face Hub](https://huggingface.co/models) o de tu propio control guardado.
+ - Por encima de esas tres clases estรกndar, la biblioteca proporciona dos APIs: [`pipeline`] para usar rรกpidamente un modelo (junto a su configuracion y tokenizer asociados)
+ sobre una tarea dada, y [`Trainer`]/`Keras.fit` para entrenar u optimizar de forma rรกpida un modelo dado.
+ - Como consecuencia, esta biblioteca NO es una caja de herramientas modular de bloques individuales para redes neuronales. Si quieres extender/construir sobre la biblioteca,
+ usa simplemente los mรณdulos regulares de Python/PyTorch/TensorFlow/Keras y emplea las clases estรกndar de la biblioteca como punto de partida para reutilizar funcionalidades
+ tales como abrir/guardar modelo.
+
+- Proporciona modelos modernos con rendimientos lo mรกs parecido posible a los modelos originales:
+
+ - Proporcionamos al menos un ejemplo para cada arquitectura que reproduce un resultado proporcionado por los autores de dicha arquitectura.
+ - El cรณdigo normalmente es parecido al cรณdigo base original, lo cual significa que algรบn cรณdigo Pytorch puede no ser tan
+ *pytorchic* como podrรญa ser por haber sido convertido a cรณdigo TensorFlow, y viceversa.
+
+Unos cuantos objetivos adicionales:
+
+- Exponer las caracterรญsticas internas de los modelos de la forma mรกs coherente posible:
+
+ - Damos acceso, mediante una sola API, a todos los estados ocultos y pesos de atenciรณn.
+ - Tokenizer y el modelo de API base estรกn estandarizados para cambiar fรกcilmente entre modelos.
+
+- Incorporar una selecciรณn subjetiva de herramientas de gran potencial para la optimizaciรณn/investigaciรณn de estos modelos:
+
+ - Una forma sencilla/coherente de aรฑadir nuevos tokens al vocabulario e incrustraciones (embeddings, en inglรฉs) para optimizaciรณn.
+ - Formas sencillas de camuflar y reducir "transformer heads".
+
+- Cambiar fรกcilmente entre PyTorch y TensorFlow 2.0, permitiendo el entrenamiento usando un marco y la inferencia usando otro.
+
+## Conceptos principales
+
+La biblioteca estรก construida alrededor de tres tipos de clases para cada modelo:
+
+- **Model classes** como [`BertModel`], que consisten en mรกs de 30 modelos PyTorch ([torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)) o modelos Keras ([tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model)) que funcionan con pesos pre-entrenados proporcionados en la
+ biblioteca.
+- **Configuration classes** como [`BertConfig`], que almacena todos los parรกmetros necesarios para construir un modelo.
+ No siempre tienes que generarla tu. En particular, si estas usando un modelo pre-entrenado sin ninguna modificaciรณn,
+ la creaciรณn del modelo se encargarรก automรกticamente de generar la configuraciรณn (que es parte del modelo).
+- **Tokenizer classes** como [`BertTokenizer`], que almacena el vocabulario para cada modelo y proporciona mรฉtodos para
+ codificar/decodificar strings en una lista de รญndices de "token embeddings" para ser empleados en un modelo.
+
+Todas estas clases pueden ser generadas a partir de ejemplos pre-entrenados, y guardados localmente usando dos mรฉtodos:
+
+- `from_pretrained()` permite generar un modelo/configuraciรณn/tokenizer a partir de una versiรณn pre-entrenada proporcionada ya sea por
+ la propia biblioteca (los modelos compatibles se pueden encontrar en [Model Hub](https://huggingface.co/models)) o
+ guardados localmente (o en un servidor) por el usuario.
+- `save_pretrained()` permite guardar un modelo/configuraciรณn/tokenizer localmente, de forma que puede ser empleado de nuevo usando
+ `from_pretrained()`.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pipeline_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pipeline_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..3fbcce1447612cd5e07dbdfe6065da88f08f522d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pipeline_tutorial.md
@@ -0,0 +1,324 @@
+
+
+# Pipelines para inferencia
+
+Un [`pipeline`] simplifica el uso de cualquier modelo del [Hub](https://huggingface.co/models) para la inferencia en una variedad de tareas como la generaciรณn de texto, la segmentaciรณn de imรกgenes y la clasificaciรณn de audio. Incluso si no tienes experiencia con una modalidad especรญfica o no comprendes el cรณdigo que alimenta los modelos, ยกaรบn puedes usarlos con el [`pipeline`]! Este tutorial te enseรฑarรก a:
+
+* Utilizar un [`pipeline`] para inferencia.
+* Utilizar un tokenizador o modelo especรญfico.
+* Utilizar un [`pipeline`] para tareas de audio y visiรณn.
+
+
+
+Echa un vistazo a la documentaciรณn de [`pipeline`] para obtener una lista completa de tareas admitidas.
+
+
+
+## Uso del pipeline
+
+Si bien cada tarea tiene un [`pipeline`] asociado, es mรกs sencillo usar la abstracciรณn general [`pipeline`] que contiene todos los pipelines de tareas especรญficas. El [`pipeline`] carga automรกticamente un modelo predeterminado y un tokenizador con capacidad de inferencia para tu tarea. Veamos el ejemplo de usar un [`pipeline`] para reconocimiento automรกtico del habla (ASR), o texto a voz.
+
+1. Comienza creando un [`pipeline`] y especรญfica una tarea de inferencia:
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition")
+```
+
+2. Pasa tu entrada a la [`pipeline`]. En el caso del reconocimiento del habla, esto es un archivo de entrada de audio:
+
+```py
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': 'I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES'}
+```
+
+ยฟNo es el resultado que tenรญas en mente? Echa un vistazo a algunos de los [modelos de reconocimiento automรกtico del habla mรกs descargados](https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=trending)
+en el Hub para ver si puedes obtener una mejor transcripciรณn.
+
+Intentemos con el modelo [Whisper large-v2](https://huggingface.co/openai/whisper-large) de OpenAI. Whisper se lanzรณ
+2 aรฑos despuรฉs que Wav2Vec2, y se entrenรณ con cerca de 10 veces mรกs datos. Como tal, supera a Wav2Vec2 en la mayorรญa de las pruebas
+downstream. Tambiรฉn tiene el beneficio adicional de predecir puntuaciรณn y mayรบsculas, ninguno de los cuales es posible con
+Wav2Vec2.
+
+Vamos a probarlo aquรญ para ver cรณmo se desempeรฑa:
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+ยกAhora este resultado parece mรกs preciso! Para una comparaciรณn detallada de Wav2Vec2 vs Whisper, consulta el [Curso de Transformers de Audio](https://huggingface.co/learn/audio-course/chapter5/asr_models).
+Realmente te animamos a que eches un vistazo al Hub para modelos en diferentes idiomas, modelos especializados en tu campo, y mรกs.
+Puedes comparar directamente los resultados de los modelos desde tu navegador en el Hub para ver si se adapta o
+maneja casos de borde mejor que otros.
+Y si no encuentras un modelo para tu caso de uso, siempre puedes empezar a [entrenar](training) el tuyo propio.
+
+Si tienes varias entradas, puedes pasar tu entrada como una lista:
+
+```py
+transcriber(
+ [
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac",
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac",
+ ]
+)
+```
+
+Los pipelines son ideales para la experimentaciรณn, ya que cambiar de un modelo a otro es trivial; sin embargo, hay algunas formas de optimizarlas para cargas de trabajo mรกs grandes que la experimentaciรณn. Consulta las siguientes guรญas que profundizan en iterar sobre conjuntos de datos completos o utilizar pipelines en un servidor web:
+de la documentaciรณn:
+
+* [Uso de pipelines en un conjunto de datos](#uso-de-pipelines-en-un-conjunto-de-datos)
+* [Uso de pipelines para un servidor web](./pipeline_webserver)
+
+## Parรกmetros
+
+[`pipeline`] admite muchos parรกmetros; algunos son especรญficos de la tarea y algunos son generales para todas las pipelines. En general, puedes especificar parรกmetros en cualquier lugar que desees:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", my_parameter=1)
+
+out = transcriber(...) # This will use `my_parameter=1`.
+out = transcriber(..., my_parameter=2) # This will override and use `my_parameter=2`.
+out = transcriber(...) # This will go back to using `my_parameter=1`.
+```
+
+Vamos a echar un vistazo a tres importantes:
+
+### Device
+
+Si usas `device=n`, el pipeline automรกticamente coloca el modelo en el dispositivo especificado. Esto funcionarรก independientemente de si estรกs utilizando PyTorch o Tensorflow.
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0)
+```
+
+Si el modelo es demasiado grande para una sola GPU y estรกs utilizando PyTorch, puedes establecer `device_map="auto"` para determinar automรกticamente cรณmo cargar y almacenar los pesos del modelo. Utilizar el argumento `device_map` requiere el paquete ๐ค [Accelerate](https://huggingface.co/docs/accelerate):
+
+```bash
+pip install --upgrade accelerate
+```
+
+El siguiente cรณdigo carga y almacena automรกticamente los pesos del modelo en varios dispositivos:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device_map="auto")
+```
+
+Tenga en cuenta que si se pasa `device_map="auto"`, no es necesario agregar el argumento `device=device` al instanciar tu `pipeline`, ยกya que podrรญas encontrar algรบn comportamiento inesperado!
+
+### Batch size
+
+Por defecto, los pipelines no realizarรกn inferencia por lotes por razones explicadas en detalle [aquรญ](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching). La razรณn es que la agrupaciรณn en lotes no es necesariamente mรกs rรกpida y, de hecho, puede ser bastante mรกs lenta en algunos casos.
+
+Pero si funciona en tu caso de uso, puedes utilizar:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0, batch_size=2)
+audio_filenames = [f"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/{i}.flac" for i in range(1, 5)]
+texts = transcriber(audio_filenames)
+```
+
+Esto ejecuta el pipeline en los 4 archivos de audio proporcionados, pero los pasarรก en lotes de a 2 al modelo (que estรก en una GPU, donde la agrupaciรณn en lotes es mรกs probable que ayude) sin requerir ningรบn cรณdigo adicional de tu parte. La salida siempre deberรญa coincidir con lo que habrรญas recibido sin agrupaciรณn en lotes. Solo se pretende como una forma de ayudarte a obtener mรกs velocidad de una pipeline.
+
+Los pipelines tambiรฉn pueden aliviar algunas de las complejidades de la agrupaciรณn en lotes porque, para algunos pipelines, un solo elemento (como un archivo de audio largo) necesita ser dividido en varias partes para ser procesado por un modelo. El pipeline realiza esta [*agrupaciรณn en lotes de fragmentos*](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-chunk-batching) por ti.
+
+### Task specific parameters
+
+Todas las tareas proporcionan parรกmetros especรญficos de la tarea que permiten flexibilidad adicional y opciones para ayudarte a completar tu trabajo. Por ejemplo, el mรฉtodo [`transformers.AutomaticSpeechRecognitionPipeline.__call__`] tiene un parรกmetro `return_timestamps` que suena prometedor para subtรญtulos de videos:
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2", return_timestamps=True)
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.', 'chunks': [{'timestamp': (0.0, 11.88), 'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its'}, {'timestamp': (11.88, 12.38), 'text': ' creed.'}]}
+```
+
+Como puedes ver, el modelo infiriรณ el texto y tambiรฉn saliรณ **cuรกndo** se pronunciaron las distintas oraciones.
+
+Hay muchos parรกmetros disponibles para cada tarea, asรญ que echa un vistazo a la referencia de la API de cada tarea para ver quรฉ puedes ajustar. Por ejemplo, el [`~transformers.AutomaticSpeechRecognitionPipeline`] tiene un parรกmetro `chunk_length_s` que es รบtil para trabajar con archivos de audio realmente largos (por ejemplo, subtรญtulos de pelรญculas completas o videos de una hora de duraciรณn) que un modelo tรญpicamente no puede manejar solo:
+
+```python
+>>> transcriber = pipeline(model="openai/whisper-large-v2", chunk_length_s=30)
+>>> transcriber("https://huggingface.co/datasets/reach-vb/random-audios/resolve/main/ted_60.wav")
+{'text': " So in college, I was a government major, which means I had to write a lot of papers. Now, when a normal student writes a paper, they might spread the work out a little like this. So, you know. You get started maybe a little slowly, but you get enough done in the first week that with some heavier days later on, everything gets done and things stay civil. And I would want to do that like that. That would be the plan. I would have it all ready to go, but then actually the paper would come along, and then I would kind of do this. And that would happen every single paper. But then came my 90-page senior thesis, a paper you're supposed to spend a year on. I knew for a paper like that, my normal workflow was not an option, it was way too big a project. So I planned things out and I decided I kind of had to go something like this. This is how the year would go. So I'd start off light and I'd bump it up"}
+```
+
+ยกSi no puedes encontrar un parรกmetro que te ayude, no dudes en [solicitarlo](https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml)!
+
+## Uso de pipelines en un conjunto de datos
+
+Los pipeline tambiรฉn puede ejecutar inferencia en un conjunto de datos grande. La forma mรกs fรกcil que recomendamos para hacer esto es utilizando un iterador:
+
+```py
+def data():
+ for i in range(1000):
+ yield f"My example {i}"
+
+
+pipe = pipeline(model="openai-community/gpt2", device=0)
+generated_characters = 0
+for out in pipe(data()):
+ generated_characters += len(out[0]["generated_text"])
+```
+
+El iterador `data()` produce cada resultado, y el pipeline automรกticamente
+reconoce que la entrada es iterable y comenzarรก a buscar los datos mientras
+continรบa procesรกndolos en la GPU (dicho proceso utiliza [DataLoader](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader)). Esto es importante porque no tienes que asignar memoria para todo el conjunto de datos y puedes alimentar la GPU lo mรกs rรกpido posible.
+
+Dado que la agrupaciรณn en lotes podrรญa acelerar las cosas, puede ser รบtil intentar ajustar el parรกmetro `batch_size` aquรญ.
+
+La forma mรกs sencilla de iterar sobre un conjunto de datos es cargandolo desde ๐ค [Datasets](https://github.com/huggingface/datasets/):
+
+```py
+# KeyDataset is a util that will just output the item we're interested in.
+from transformers.pipelines.pt_utils import KeyDataset
+from datasets import load_dataset
+
+pipe = pipeline(model="hf-internal-testing/tiny-random-wav2vec2", device=0)
+dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:10]")
+
+for out in pipe(KeyDataset(dataset, "audio")):
+ print(out)
+```
+
+## Uso de pipelines para un servidor web
+
+
+Crear un motor de inferencia es un tema complejo que merece su propia pรกgina.
+
+
+[Link](./pipeline_webserver)
+
+## Pipeline de visiรณn
+
+Usar un [`pipeline`] para tareas de visiรณn es prรกcticamente idรฉntico.
+
+Especifica tu tarea y pasa tu imagen al clasificador. La imagen puede ser un enlace, una ruta local o una imagen codificada en base64. Por ejemplo, ยฟquรฉ especie de gato se muestra a continuaciรณn?
+
+
+
+```py
+>>> from transformers import pipeline
+
+>>> vision_classifier = pipeline(model="google/vit-base-patch16-224")
+>>> preds = vision_classifier(
+... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]
+```
+
+## Pipeline de texto
+
+Usar un [`pipeline`] para tareas de PLN es prรกcticamente idรฉntico.
+
+```py
+>>> from transformers import pipeline
+
+>>> # This model is a `zero-shot-classification` model.
+>>> # It will classify text, except you are free to choose any label you might imagine
+>>> classifier = pipeline(model="facebook/bart-large-mnli")
+>>> classifier(
+... "I have a problem with my iphone that needs to be resolved asap!!",
+... candidate_labels=["urgent", "not urgent", "phone", "tablet", "computer"],
+... )
+{'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}
+```
+
+## Pipeline multimodal
+
+[`pipeline`] admite mรกs de una modalidad. Por ejemplo, una tarea de respuesta a preguntas visuales (VQA) combina texto e imagen. No dudes en usar cualquier enlace de imagen que desees y una pregunta que quieras hacer sobre la imagen. La imagen puede ser una URL o una ruta local a la imagen.
+
+Por ejemplo, si usas esta [imagen de factura](https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png):
+
+```py
+>>> from transformers import pipeline
+
+>>> vqa = pipeline(model="impira/layoutlm-document-qa")
+>>> output = vqa(
+... image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png",
+... question="What is the invoice number?",
+... )
+>>> output[0]["score"] = round(output[0]["score"], 3)
+>>> output
+[{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]
+```
+
+
+
+Para ejecutar el ejemplo anterior, debe tener instalado [`pytesseract`](https://pypi.org/project/pytesseract/) ademรกs de ๐ค Transformers:
+
+```bash
+sudo apt install -y tesseract-ocr
+pip install pytesseract
+```
+
+
+
+## Uso de `pipeline` en modelos grandes con ๐ค `accelerate`:
+
+ยกPuedes ejecutar fรกcilmente `pipeline` en modelos grandes utilizando ๐ค `accelerate`! Primero asegรบrate de haber instalado `accelerate` con `pip install accelerate`.
+
+ยกLuego carga tu modelo utilizando `device_map="auto"`! Utilizaremos `facebook/opt-1.3b` para nuestro ejemplo.
+
+```py
+# pip install accelerate
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", torch_dtype=torch.bfloat16, device_map="auto")
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+Tambiรฉn puedes pasar modelos cargados de 8 bits sรญ instalas `bitsandbytes` y agregas el argumento `load_in_8bit=True`
+
+```py
+# pip install accelerate bitsandbytes
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", device_map="auto", model_kwargs={"load_in_8bit": True})
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+Nota que puedes reemplazar el punto de control con cualquier modelo de Hugging Face que admita la carga de modelos grandes, como BLOOM.
+
+## Crear demos web desde pipelines con `gradio`
+
+Los pipelines estรกn automรกticamente soportadas en [Gradio](https://github.com/gradio-app/gradio/), una biblioteca que hace que crear aplicaciones de aprendizaje automรกtico hermosas y fรกciles de usar en la web sea un proceso sencillo. Primero, asegรบrate de tener Gradio instalado:
+
+```
+pip install gradio
+```
+
+Luego, puedes crear una demo web alrededor de una pipeline de clasificaciรณn de imรกgenes (o cualquier otra pipeline) en una sola lรญnea de cรณdigo llamando a la funciรณn `Interface.from_pipeline` de Gradio para lanzar la pipeline. Esto crea una interfaz intuitiva *drag-and-drop* en tu navegador:
+
+```py
+from transformers import pipeline
+import gradio as gr
+
+pipe = pipeline("image-classification", model="google/vit-base-patch16-224")
+
+gr.Interface.from_pipeline(pipe).launch()
+```
+
+
+
+
+De forma predeterminada, la demo web se ejecuta en un servidor local. Si deseas compartirlo con otros, puedes generar un enlace pรบblico temporal estableciendo `share=True` en `launch()`. Tambiรฉn puedes hospedar tu demo en [Hugging Face Spaces](https://huggingface.co/spaces) para un enlace permanente.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pipeline_webserver.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pipeline_webserver.md
new file mode 100644
index 0000000000000000000000000000000000000000..e268daabcbe881a617fad0cfd41c24d32bb78992
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pipeline_webserver.md
@@ -0,0 +1,128 @@
+
+
+# Uso de un flujo de trabajo para un servidor web
+
+
+Crear un motor de inferencia es un tema complejo, y la "mejor" soluciรณn probablemente dependerรก de tu caso de uso. ยฟEstรกs en CPU o en GPU? ยฟQuieres la latencia mรกs baja, el rendimiento mรกs alto, soporte para muchos modelos o simplemente optimizar altamente un modelo especรญfico? Hay muchas formas de abordar este tema, asรญ que lo que vamos a presentar es un buen valor predeterminado para comenzar, que no necesariamente serรก la soluciรณn mรกs รณptima para ti.
+
+
+
+Lo fundamental para entender es que podemos usar un iterador, tal como [en un conjunto de datos](pipeline_tutorial#uso-de-pipelines-en-un-conjunto-de-datos), ya que un servidor web es bรกsicamente un sistema que espera solicitudes y las trata a medida que llegan.
+
+Por lo general, los servidores web estรกn multiplexados (multihilo, asรญncrono, etc.) para manejar varias solicitudes simultรกneamente. Por otro lado, los flujos de trabajo (y principalmente los modelos subyacentes) no son realmente ideales para el paralelismo; consumen mucha RAM, por lo que es mejor darles todos los recursos disponibles cuando se estรกn ejecutando o es un trabajo intensivo en cรณmputo.
+
+Vamos a resolver esto haciendo que el servidor web maneje la carga ligera de recibir y enviar solicitudes, y que un รบnico hilo maneje el trabajo real. Este ejemplo va a utilizar `starlette`. El marco de trabajo no es realmente importante, pero es posible que debas ajustar o cambiar el cรณdigo si estรกs utilizando otro para lograr el mismo efecto.
+
+Crear `server.py`:
+
+```py
+from starlette.applications import Starlette
+from starlette.responses import JSONResponse
+from starlette.routing import Route
+from transformers import pipeline
+import asyncio
+
+
+async def homepage(request):
+ payload = await request.body()
+ string = payload.decode("utf-8")
+ response_q = asyncio.Queue()
+ await request.app.model_queue.put((string, response_q))
+ output = await response_q.get()
+ return JSONResponse(output)
+
+
+async def server_loop(q):
+ pipe = pipeline(model="google-bert/bert-base-uncased")
+ while True:
+ (string, response_q) = await q.get()
+ out = pipe(string)
+ await response_q.put(out)
+
+
+app = Starlette(
+ routes=[
+ Route("/", homepage, methods=["POST"]),
+ ],
+)
+
+
+@app.on_event("startup")
+async def startup_event():
+ q = asyncio.Queue()
+ app.model_queue = q
+ asyncio.create_task(server_loop(q))
+```
+
+Ahora puedes empezar con:
+```bash
+uvicorn server:app
+```
+
+Y puedes consultarlo con:
+```bash
+curl -X POST -d "test [MASK]" http://localhost:8000/
+#[{"score":0.7742936015129089,"token":1012,"token_str":".","sequence":"test."},...]
+```
+
+ยกY listo, ahora tienes una buena idea de cรณmo crear un servidor web!
+
+Lo realmente importante es cargar el modelo solo **una vez**, de modo que no haya copias del modelo en el servidor web. De esta manera, no se utiliza RAM innecesariamente. Luego, el mecanismo de queuing (colas) te permite hacer cosas sofisticadas como acumular algunos elementos antes de inferir para usar el agrupamiento dinรกmico:
+
+
+
+El ejemplo de cรณdigo a continuaciรณn estรก escrito intencionalmente como pseudocรณdigo para facilitar la lectura.
+ยกNo lo ejecutes sin verificar si tiene sentido para los recursos de tu sistema!
+
+
+
+```py
+(string, rq) = await q.get()
+strings = []
+queues = []
+while True:
+ try:
+ (string, rq) = await asyncio.wait_for(q.get(), timeout=0.001) # 1ms
+ except asyncio.exceptions.TimeoutError:
+ break
+ strings.append(string)
+ queues.append(rq)
+strings
+outs = pipe(strings, batch_size=len(strings))
+for rq, out in zip(queues, outs):
+ await rq.put(out)
+```
+
+Nuevamente, el cรณdigo propuesto estรก optimizado para la legibilidad, no para ser el mejor cรณdigo.
+En primer lugar, no hay lรญmite de tamaรฑo de lote, lo cual generalmente no es una buena idea. Luego, el tiempo de espera se restablece en cada obtenciรณn de la cola, lo que significa que podrรญas esperar mucho mรกs de 1ms antes de ejecutar la inferencia (retrasando la primera solicitud en esa cantidad).
+
+Serรญa mejor tener un รบnico plazo de 1ms.
+
+Esto siempre esperarรก 1ms incluso si la cola estรก vacรญa, lo que podrรญa no ser lo mejor ya que probablemente quieras comenzar a hacer inferencias si no hay nada en la cola. Pero tal vez tenga sentido si el agrupamiento es realmente crucial para tu caso de uso. Nuevamente, no hay una soluciรณn รบnica y mejor.
+
+
+## Algunas cosas que podrรญas considerar
+
+### Comprobaciรณn de errores
+
+Hay muchas cosas que pueden salir mal en producciรณn: falta de memoria, falta de espacio, cargar el modelo podrรญa fallar, la consulta podrรญa ser incorrecta, la consulta podrรญa ser correcta pero aรบn asรญ fallar debido a una mala configuraciรณn del modelo, y asรญ sucesivamente.
+
+Generalmente, es bueno que el servidor muestre los errores al usuario, por lo que agregar muchos bloques `try..except` para mostrar esos errores es una buena idea. Pero ten en cuenta que tambiรฉn puede ser un riesgo de seguridad revelar todos esos errores dependiendo de tu contexto de seguridad.
+
+### Interrupciรณn de circuito
+
+Los servidores web suelen verse mejor cuando hacen interrupciones de circuitos. Significa que devuelven errores adecuados cuando estรกn sobrecargados en lugar de simplemente esperar la consulta indefinidamente. Devolver un error 503 en lugar de esperar un tiempo muy largo o un error 504 despuรฉs de mucho tiempo.
+
+Esto es relativamente fรกcil de implementar en el cรณdigo propuesto ya que hay una sola cola. Mirar el tamaรฑo de la cola es una forma bรกsica de empezar a devolver errores antes de que tu servidor web falle bajo carga.
+
+### Bloqueo del hilo principal
+
+Actualmente, PyTorch no es consciente de la asincronรญa, y el cรกlculo bloquearรก el hilo principal mientras se ejecuta. Esto significa que serรญa mejor si PyTorch se viera obligado a ejecutarse en su propio hilo/proceso. Esto no se hizo aquรญ porque el cรณdigo es mucho mรกs complejo (principalmente porque los hilos, la asincronรญa y las colas no se llevan bien juntos). Pero en รบltima instancia, hace lo mismo.
+
+Esto serรญa importante si la inferencia de elementos individuales fuera larga (> 1s) porque en este caso, significa que cada consulta durante la inferencia tendrรญa que esperar 1s antes de recibir incluso un error.
+
+### Procesamiento por lotes dinรกmico
+
+En general, el procesamiento por lotes no es necesariamente una mejora respecto a pasar 1 elemento a la vez (ver [procesamiento por lotes](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching) para mรกs informaciรณn). Pero puede ser muy efectivo cuando se usa en el entorno correcto. En la API, no hay procesamiento por lotes dinรกmico por defecto (demasiada oportunidad para una desaceleraciรณn). Pero para la inferencia de BLOOM - que es un modelo muy grande - el procesamiento por lotes dinรกmico es **esencial** para proporcionar una experiencia decente para todos.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pr_checks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pr_checks.md
new file mode 100644
index 0000000000000000000000000000000000000000..ba67e85306d3a9d9944f263ad79a70182b170d31
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/pr_checks.md
@@ -0,0 +1,132 @@
+
+
+# Verificaciones en un Pull Request
+
+Cuando abres un _pull request_ en ๐ค Transformers, se ejecutarรกn una serie de verificaciones para asegurarte de que el _patch_ que estรกs agregando no rompa nada existente. Estas verificaciones son de cuatro tipos:
+- pruebas regulares
+- creaciรณn de la documentaciรณn
+- estilo del cรณdigo y documentaciรณn
+- consistencia del repositorio
+
+En este documento, intentaremos explicar cuรกles son esas diferentes verificaciones y el motivo detrรกs de ellas, asรญ como tambiรฉn cรณmo depurarlas localmente si una falla en tu PR.
+
+Recuerda que todas las verificaciones requieren que tengas una instalaciรณn de desarrollo:
+
+```bash
+pip install transformers[dev]
+```
+
+o una instalaciรณn editable:
+
+```bash
+pip install -e .[dev]
+```
+
+del repositorio de Transformers.
+
+## Pruebas
+
+Todos los procesos que comienzan con `ci/circleci: run_tests_` ejecutan partes del conjunto de pruebas de Transformers. Cada uno de esos procesos se enfoca en una parte de la biblioteca en un entorno determinado: por ejemplo, `ci/circleci: run_tests_pipelines_tf` ejecuta la prueba de _pipelines_ en un entorno donde solo estรก instalado TensorFlow.
+
+Ten en cuenta que para evitar ejecutar pruebas cuando no hay un cambio real en los mรณdulos que estรกs probando, solo se ejecuta una parte del conjunto de pruebas: se ejecuta una tarea auxiliar para determinar las diferencias en la biblioteca antes y despuรฉs del PR (lo que GitHub te muestra en la pestaรฑa "Files changes") y selecciona las pruebas afectadas por esa diferencia. Este auxiliar se puede ejecutar localmente usando:
+
+```bash
+python utils/tests_fetcher.py
+```
+
+desde el directorio raiz del repositorio de Transformers. Se ejecutarรก lo siguiente:
+
+1. Verificaciรณn para cada archivo en el _diff_ si los cambios estรกn en el cรณdigo, solo en comentarios o _docstrings_. Solo los archivos con cambios reales de cรณdigo se conservan.
+2. Creaciรณn de un mapa interno que proporciona para cada archivo del cรณdigo fuente de la biblioteca todos los archivos a los que impacta recursivamente. Se dice que el mรณdulo A impacta al mรณdulo B si el mรณdulo B importa el mรณdulo A. Para el impacto recursivo, necesitamos una cadena de mรณdulos que va del mรณdulo A al mรณdulo B en la que cada mรณdulo importa el anterior.
+3. Aplicaciรณn de este mapa en los archivos recopilados en el paso 1, lo que nos da una lista de archivos modelo afectados por el PR.
+4. Asignaciรณn de cada uno de esos archivos a sus archivos de prueba correspondientes y para obtener una la lista de pruebas a ejecutar.
+
+Al ejecutar el _script_ localmente, debes obtener los resultados de los pasos 1, 3 y 4 impresos y asรญ saber quรฉ pruebas se ejecutarรกn. El _script_ tambiรฉn crearรก un archivo llamado `test_list.txt` que contiene la lista de pruebas para ejecutar, y puede ejecutarlas localmente con el siguiente comando:
+
+```bash
+python -m pytest -n 8 --dist=loadfile -rA -s $(cat test_list.txt)
+```
+
+En caso de que se te escape algo, el conjunto completo de pruebas tambiรฉn se ejecuta a diario.
+
+## Creaciรณn de la documentaciรณn
+
+El proceso `build_pr_documentation` compila y genera una vista previa de la documentaciรณn para asegurarse de que todo se vea bien una vez que se fusione tu PR. Un bot agregarรก un enlace para obtener una vista previa de la documentaciรณn en tu PR. Cualquier cambio que realices en el PR se actualiza automรกticamente en la vista previa. Si la documentaciรณn no se genera, haz clic en **Detalles** junto al proceso fallido para ver dรณnde saliรณ mal. A menudo, el error es tan simple como que falta un archivo en `toctree`.
+
+Si estรกs interesado en compilar u obtener una vista previa de la documentaciรณn localmente, echa un vistazo al [`README.md`](https://github.com/huggingface/transformers/tree/main/docs) en la carpeta `docs`.
+
+## Estilo de cรณdigo y documentaciรณn.
+
+El formato de cรณdigo se aplica a todos los archivos fuente, los ejemplos y las pruebas utilizando `black` e `ruff`. Tambiรฉn tenemos una herramienta personalizada que se ocupa del formato de los _docstrings_ y archivos `rst` (`utils/style_doc.py`), asรญ como del orden de las importaciones _lazy_ realizadas en los archivos `__init__.py` de Transformers (`utils /custom_init_isort.py`). Todo esto se puede probar ejecutando
+
+```bash
+make style
+```
+
+CI verifica que se hayan aplicado dentro de la verificaciรณn `ci/circleci: check_code_quality`. Tambiรฉn se ejecuta `ruff`, que harรก una verificaciรณn bรกsica a tu cรณdigo y te harรก saber si encuentra una variable no definida, o una que no se usa. Para ejecutar esa verificaciรณn localmente, usa
+
+```bash
+make quality
+```
+
+Esto puede llevar mucho tiempo, asรญ que para ejecutar lo mismo solo en los archivos que modificaste en la rama actual, ejecuta
+
+```bash
+make fixup
+```
+
+Este รบltimo comando tambiรฉn ejecutarรก todas las verificaciones adicionales para la consistencia del repositorio. Echemos un vistazo a estas pruebas.
+
+## Consistencia del repositorio
+
+Esta verificaciรณn reagrupa todas las pruebas para asegurarse de que tu PR deja el repositorio en buen estado, y se realiza mediante `ci/circleci: check_repository_consistency`. Puedes ejecutar localmente esta verificaciรณn ejecutando lo siguiente:
+
+```bash
+make repo-consistency
+```
+
+Esta instrucciรณn verifica que:
+
+- Todos los objetos agregados al _init_ estรกn documentados (realizados por `utils/check_repo.py`)
+- Todos los archivos `__init__.py` tienen el mismo contenido en sus dos secciones (realizado por `utils/check_inits.py`)
+- Todo el cรณdigo identificado como una copia de otro mรณdulo es consistente con el original (realizado por `utils/check_copies.py`)
+- Todas las clases de configuraciรณn tienen al menos _checkpoint_ vรกlido mencionado en sus _docstrings_ (realizado por `utils/check_config_docstrings.py`)
+- Las traducciones de los README y el รญndice del documento tienen la misma lista de modelos que el README principal (realizado por `utils/check_copies.py`)
+- Las tablas generadas automaticamente en la documentaciรณn estรกn actualizadas (realizadas por `utils/check_table.py`)
+- La biblioteca tiene todos los objetos disponibles incluso si no estรกn instaladas todas las dependencias opcionales (realizadas por `utils/check_dummies.py`)
+
+Si esta verificaciรณn falla, los primeros dos elementos requieren una reparaciรณn manual, los รบltimos cuatro pueden repararse automรกticamente ejecutando el comando
+
+```bash
+make fix-copies
+```
+
+Las verificaciones adicionales se refieren a los PRs que agregan nuevos modelos, principalmente que:
+
+- Todos los modelos agregados estรกn en un Auto-mapping (realizado por `utils/check_repo.py`)
+
+- Todos los modelos se verifican correctamente (realizados por `utils/check_repo.py`)
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/preprocessing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/preprocessing.md
new file mode 100644
index 0000000000000000000000000000000000000000..8486d6a0687abc296559a099884df6d6ae48cae2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/preprocessing.md
@@ -0,0 +1,560 @@
+
+
+# Preprocesamiento
+
+[[open-in-colab]]
+
+Antes de que puedas utilizar los datos en un modelo, debes procesarlos en un formato aceptable para el modelo. Un modelo no entiende el texto en bruto, las imรกgenes o el audio. Estas entradas necesitan ser convertidas en nรบmeros y ensambladas en tensores. En este tutorial, podrรกs:
+
+* Preprocesar los datos textuales con un tokenizador.
+* Preprocesar datos de imagen o audio con un extractor de caracterรญsticas.
+* Preprocesar datos para una tarea multimodal con un procesador.
+
+## NLP
+
+
+
+La principal herramienta para procesar datos textuales es un [tokenizador](main_classes/tokenizer). Un tokenizador comienza dividiendo el texto en *tokens* segรบn un conjunto de reglas. Los tokens se convierten en nรบmeros, que se utilizan para construir tensores como entrada a un modelo. El tokenizador tambiรฉn aรฑade cualquier entrada adicional que requiera el modelo.
+
+
+
+Si tienes previsto utilizar un modelo pre-entrenado, es importante que utilices el tokenizador pre-entrenado asociado. Esto te asegura que el texto se divide de la misma manera que el corpus de pre-entrenamiento y utiliza el mismo รญndice de tokens correspondiente (usualmente referido como el *vocab*) durante el pre-entrenamiento.
+
+
+
+Comienza rรกpidamente cargando un tokenizador pre-entrenado con la clase [`AutoTokenizer`]. Esto descarga el *vocab* utilizado cuando un modelo es pre-entrenado.
+
+### Tokenizar
+
+Carga un tokenizador pre-entrenado con [`AutoTokenizer.from_pretrained`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+```
+
+A continuaciรณn, pasa tu frase al tokenizador:
+
+```py
+>>> encoded_input = tokenizer("Do not meddle in the affairs of wizards, for they are subtle and quick to anger.")
+>>> print(encoded_input)
+{'input_ids': [101, 2079, 2025, 19960, 10362, 1999, 1996, 3821, 1997, 16657, 1010, 2005, 2027, 2024, 11259, 1998, 4248, 2000, 4963, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+El tokenizador devuelve un diccionario con tres รญtems importantes:
+
+* [input_ids](glossary#input-ids) son los รญndices correspondientes a cada token de la frase.
+* [attention_mask](glossary#attention-mask) indica si un token debe ser atendido o no.
+* [token_type_ids](glossary#token-type-ids) identifica a quรฉ secuencia pertenece un token cuando hay mรกs de una secuencia.
+
+Tu puedes decodificar el `input_ids` para devolver la entrada original:
+
+```py
+>>> tokenizer.decode(encoded_input["input_ids"])
+'[CLS] Do not meddle in the affairs of wizards, for they are subtle and quick to anger. [SEP]'
+```
+
+Como puedes ver, el tokenizador ha aรฑadido dos tokens especiales - `CLS` y `SEP` (clasificador y separador) - a la frase. No todos los modelos necesitan
+tokens especiales, pero si lo llegas a necesitar, el tokenizador los aรฑadirรก automรกticamente.
+
+Si hay varias frases que quieres preprocesar, pasa las frases como una lista al tokenizador:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_inputs = tokenizer(batch_sentences)
+>>> print(encoded_inputs)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1]]}
+```
+
+### Pad
+
+Esto nos lleva a un tema importante. Cuando se procesa un batch de frases, no siempre tienen la misma longitud. Esto es un problema porque los tensores que se introducen en el modelo deben tener una forma uniforme. El pad es una estrategia para asegurar que los tensores sean rectangulares aรฑadiendo un "padding token" especial a las oraciones con menos tokens.
+
+Establece el parรกmetro `padding` en `True` aplicando el pad a las secuencias mรกs cortas del batch para que coincidan con la secuencia mรกs larga:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+Observa que el tokenizador ha aplicado el pad a la primera y la tercera frase con un "0" porque son mรกs cortas.
+
+### Truncamiento
+
+En el otro extremo del espectro, a veces una secuencia puede ser demasiado larga para un modelo. En este caso, tendrรกs que truncar la secuencia a una longitud mรกs corta.
+
+Establece el parรกmetro `truncation` a `True` para truncar una secuencia a la longitud mรกxima aceptada por el modelo:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+### Construye tensores
+
+Finalmente, si quieres que el tokenizador devuelva los tensores reales que se introducen en el modelo.
+
+Establece el parรกmetro `return_tensors` como `pt` para PyTorch, o `tf` para TensorFlow:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch, padding=True, truncation=True, return_tensors="pt")
+>>> print(encoded_input)
+{'input_ids': tensor([[ 101, 153, 7719, 21490, 1122, 1114, 9582, 1623, 102],
+ [ 101, 5226, 1122, 9649, 1199, 2610, 1236, 102, 0]]),
+ 'token_type_ids': tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0]]),
+ 'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 1, 0]])}
+===PT-TF-SPLIT===
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch, padding=True, truncation=True, return_tensors="tf")
+>>> print(encoded_input)
+{'input_ids': ,
+ 'token_type_ids': ,
+ 'attention_mask': }
+```
+
+## Audio
+
+Las entradas de audio se preprocesan de forma diferente a las entradas textuales, pero el objetivo final es el mismo: crear secuencias numรฉricas que el modelo pueda entender. Un [extractor de caracterรญsticas](main_classes/feature_extractor) (o feature extractor en inglรฉs) estรก diseรฑado para extraer caracterรญsticas de datos provenientes de imรกgenes o audio sin procesar y convertirlos en tensores. Antes de empezar, instala ๐ค Datasets para cargar un dataset de audio para experimentar:
+
+```bash
+pip install datasets
+```
+
+Carga la tarea de detecciรณn de palabras clave del benchmark [SUPERB](https://huggingface.co/datasets/superb) (consulta el [tutorial ๐ค Dataset](https://huggingface.co/docs/datasets/load_hub) para que obtengas mรกs detalles sobre cรณmo cargar un dataset):
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("superb", "ks")
+```
+
+Accede al primer elemento de la columna `audio` para echar un vistazo a la entrada. Al llamar a la columna `audio` se cargarรก y volverรก a muestrear automรกticamente el archivo de audio:
+
+```py
+>>> dataset["train"][0]["audio"]
+{'array': array([ 0. , 0. , 0. , ..., -0.00592041,
+ -0.00405884, -0.00253296], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/05734a36d88019a09725c20cc024e1c4e7982e37d7d55c0c1ca1742ea1cdd47f/_background_noise_/doing_the_dishes.wav',
+ 'sampling_rate': 16000}
+```
+
+Esto devuelve tres elementos:
+
+* `array` es la seรฑal de voz cargada - y potencialmente remuestreada - como un array 1D.
+* `path` apunta a la ubicaciรณn del archivo de audio.
+* `sampling_rate` se refiere a cuรกntos puntos de datos de la seรฑal de voz se miden por segundo.
+
+### Resample
+
+Para este tutorial, se utilizarรก el modelo [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base). Como puedes ver en la model card, el modelo Wav2Vec2 estรก pre-entrenado en audio de voz muestreado a 16kHz. Es importante que la tasa de muestreo de tus datos de audio coincida con la tasa de muestreo del dataset utilizado para pre-entrenar el modelo. Si la tasa de muestreo de tus datos no es la misma, deberรกs volver a muestrear tus datos de audio.
+
+Por ejemplo, carga el dataset [LJ Speech](https://huggingface.co/datasets/lj_speech) que tiene una tasa de muestreo de 22050kHz. Para utilizar el modelo Wav2Vec2 con este dataset, reduce la tasa de muestreo a 16kHz:
+
+```py
+>>> lj_speech = load_dataset("lj_speech", split="train")
+>>> lj_speech[0]["audio"]
+{'array': array([-7.3242188e-04, -7.6293945e-04, -6.4086914e-04, ...,
+ 7.3242188e-04, 2.1362305e-04, 6.1035156e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/917ece08c95cf0c4115e45294e3cd0dee724a1165b7fc11798369308a465bd26/LJSpeech-1.1/wavs/LJ001-0001.wav',
+ 'sampling_rate': 22050}
+```
+
+1. Usa el mรฉtodo ๐ค Datasets' [`cast_column`](https://huggingface.co/docs/datasets/package_reference/main_classes#datasets.Dataset.cast_column) para reducir la tasa de muestreo a 16kHz:
+
+```py
+>>> lj_speech = lj_speech.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+2. Carga el archivo de audio:
+
+```py
+>>> lj_speech[0]["audio"]
+{'array': array([-0.00064146, -0.00074657, -0.00068768, ..., 0.00068341,
+ 0.00014045, 0. ], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/917ece08c95cf0c4115e45294e3cd0dee724a1165b7fc11798369308a465bd26/LJSpeech-1.1/wavs/LJ001-0001.wav',
+ 'sampling_rate': 16000}
+```
+
+Como puedes ver, el `sampling_rate` se ha reducido a 16kHz. Ahora que sabes cรณmo funciona el resampling, volvamos a nuestro ejemplo anterior con el dataset SUPERB.
+
+### Extractor de caracterรญsticas
+
+El siguiente paso es cargar un extractor de caracterรญsticas para normalizar y aplicar el pad a la entrada. Cuando se aplica padding a los datos textuales, se aรฑade un "0" para las secuencias mรกs cortas. La misma idea se aplica a los datos de audio y el extractor de caracterรญsticas de audio aรฑadirรก un "0" - interpretado como silencio - al "array".
+
+Carga el extractor de caracterรญsticas con [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
+```
+
+Pasa el `array` de audio al extractor de caracterรญsticas. Tambiรฉn te recomendamos aรฑadir el argumento `sampling_rate` en el extractor de caracterรญsticas para poder depurar mejor los errores silenciosos que puedan producirse.
+
+```py
+>>> audio_input = [dataset["train"][0]["audio"]["array"]]
+>>> feature_extractor(audio_input, sampling_rate=16000)
+{'input_values': [array([ 0.00045439, 0.00045439, 0.00045439, ..., -0.1578519 , -0.10807519, -0.06727459], dtype=float32)]}
+```
+
+### Pad y truncamiento
+
+Al igual que el tokenizador, puedes aplicar padding o truncamiento para manejar secuencias variables en un batch. Fรญjate en la longitud de la secuencia de estas dos muestras de audio:
+
+```py
+>>> dataset["train"][0]["audio"]["array"].shape
+(1522930,)
+
+>>> dataset["train"][1]["audio"]["array"].shape
+(988891,)
+```
+
+Como puedes ver, el `sampling_rate` se ha reducido a 16kHz.
+
+```py
+>>> def preprocess_function(examples):
+... audio_arrays = [x["array"] for x in examples["audio"]]
+... inputs = feature_extractor(
+... audio_arrays,
+... sampling_rate=16000,
+... padding=True,
+... max_length=1000000,
+... truncation=True,
+... )
+... return inputs
+```
+
+Aplica la funciรณn a los primeros ejemplos del dataset:
+
+```py
+>>> processed_dataset = preprocess_function(dataset["train"][:5])
+```
+
+Ahora echa un vistazo a las longitudes de las muestras procesadas:
+
+```py
+>>> processed_dataset["input_values"][0].shape
+(1000000,)
+
+>>> processed_dataset["input_values"][1].shape
+(1000000,)
+```
+
+Las longitudes de las dos primeras muestras coinciden ahora con la longitud mรกxima especificada.
+
+## Visiรณn
+
+Tambiรฉn se utiliza un extractor de caracterรญsticas para procesar imรกgenes para tareas de visiรณn por computadora. Una vez mรกs, el objetivo es convertir la imagen en bruto en un batch de tensores como entrada.
+
+Vamos a cargar el dataset [food101](https://huggingface.co/datasets/food101) para este tutorial. Usa el parรกmetro ๐ค Datasets `split` para cargar solo una pequeรฑa muestra de la divisiรณn de entrenamiento ya que el dataset es bastante grande:
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("food101", split="train[:100]")
+```
+
+A continuaciรณn, observa la imagen con la funciรณn ๐ค Datasets [`Image`](https://huggingface.co/docs/datasets/package_reference/main_classes?highlight=image#datasets.Image):
+
+```py
+>>> dataset[0]["image"]
+```
+
+
+
+### Extractor de caracterรญsticas
+
+Carga el extractor de caracterรญsticas con [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("google/vit-base-patch16-224")
+```
+
+### Aumento de Datos
+
+Para las tareas de visiรณn por computadora es comรบn aรฑadir algรบn tipo de aumento de datos (o data augmentation) a las imรกgenes como parte del preprocesamiento. Puedes aรฑadir el mรฉtodo de aumento de datos con cualquier librerรญa que quieras, pero en este tutorial utilizarรกs el mรณdulo [`transforms`](https://pytorch.org/vision/stable/transforms.html) de torchvision.
+
+1. Normaliza la imagen y utiliza [`Compose`](https://pytorch.org/vision/master/generated/torchvision.transforms.Compose.html) para encadenar algunas transformaciones - [`RandomResizedCrop`](https://pytorch.org/vision/main/generated/torchvision.transforms.RandomResizedCrop.html) y [`ColorJitter`](https://pytorch.org/vision/main/generated/torchvision.transforms.ColorJitter.html) - juntas:
+
+```py
+>>> from torchvision.transforms import Compose, Normalize, RandomResizedCrop, ColorJitter, ToTensor
+
+>>> normalize = Normalize(mean=feature_extractor.image_mean, std=feature_extractor.image_std)
+>>> _transforms = Compose(
+... [RandomResizedCrop(feature_extractor.size), ColorJitter(brightness=0.5, hue=0.5), ToTensor(), normalize]
+... )
+```
+
+2. El modelo acepta [`pixel_values`](model_doc/visionencoderdecoder#transformers.VisionEncoderDecoderModel.forward.pixel_values) como entrada. Este valor es generado por el extractor de caracterรญsticas. Crea una funciรณn que genere `pixel_values` a partir de las transformaciones:
+
+```py
+>>> def transforms(examples):
+... examples["pixel_values"] = [_transforms(image.convert("RGB")) for image in examples["image"]]
+... return examples
+```
+
+3. A continuaciรณn, utiliza ๐ค Datasets [`set_transform`](https://huggingface.co/docs/datasets/process#format-transform) para aplicar las transformaciones sobre la marcha:
+
+```py
+>>> dataset.set_transform(transforms)
+```
+
+4. Ahora, cuando accedes a la imagen, observarรกs que el extractor de caracterรญsticas ha aรฑadido a la entrada del modelo `pixel_values`:
+
+```py
+>>> dataset[0]["image"]
+{'image': ,
+ 'label': 6,
+ 'pixel_values': tensor([[[ 0.0353, 0.0745, 0.1216, ..., -0.9922, -0.9922, -0.9922],
+ [-0.0196, 0.0667, 0.1294, ..., -0.9765, -0.9843, -0.9922],
+ [ 0.0196, 0.0824, 0.1137, ..., -0.9765, -0.9686, -0.8667],
+ ...,
+ [ 0.0275, 0.0745, 0.0510, ..., -0.1137, -0.1216, -0.0824],
+ [ 0.0667, 0.0824, 0.0667, ..., -0.0588, -0.0745, -0.0980],
+ [ 0.0353, 0.0353, 0.0431, ..., -0.0039, -0.0039, -0.0588]],
+
+ [[ 0.2078, 0.2471, 0.2863, ..., -0.9451, -0.9373, -0.9451],
+ [ 0.1608, 0.2471, 0.3098, ..., -0.9373, -0.9451, -0.9373],
+ [ 0.2078, 0.2706, 0.3020, ..., -0.9608, -0.9373, -0.8275],
+ ...,
+ [-0.0353, 0.0118, -0.0039, ..., -0.2392, -0.2471, -0.2078],
+ [ 0.0196, 0.0353, 0.0196, ..., -0.1843, -0.2000, -0.2235],
+ [-0.0118, -0.0039, -0.0039, ..., -0.0980, -0.0980, -0.1529]],
+
+ [[ 0.3961, 0.4431, 0.4980, ..., -0.9216, -0.9137, -0.9216],
+ [ 0.3569, 0.4510, 0.5216, ..., -0.9059, -0.9137, -0.9137],
+ [ 0.4118, 0.4745, 0.5216, ..., -0.9137, -0.8902, -0.7804],
+ ...,
+ [-0.2314, -0.1922, -0.2078, ..., -0.4196, -0.4275, -0.3882],
+ [-0.1843, -0.1686, -0.2000, ..., -0.3647, -0.3804, -0.4039],
+ [-0.1922, -0.1922, -0.1922, ..., -0.2941, -0.2863, -0.3412]]])}
+```
+
+Este es el aspecto de la imagen despuรฉs de preprocesarla. Como era de esperar por las transformaciones aplicadas, la imagen ha sido recortada aleatoriamente y sus propiedades de color son diferentes.
+
+```py
+>>> import numpy as np
+>>> import matplotlib.pyplot as plt
+
+>>> img = dataset[0]["pixel_values"]
+>>> plt.imshow(img.permute(1, 2, 0))
+```
+
+
+
+## Multimodal
+
+Para las tareas multimodales utilizarรกs una combinaciรณn de todo lo que has aprendido hasta ahora y aplicarรกs tus habilidades a una tarea de reconocimiento automรกtico de voz (ASR). Esto significa que necesitarรกs un:
+
+* Extractor de caracterรญsticas para preprocesar los datos de audio.
+* Un tokenizador para procesar el texto.
+
+Volvamos al dataset [LJ Speech](https://huggingface.co/datasets/lj_speech):
+
+```py
+>>> from datasets import load_dataset
+
+>>> lj_speech = load_dataset("lj_speech", split="train")
+```
+
+Suponiendo que te interesan principalmente las columnas `audio` y `texto`, elimina las demรกs columnas:
+
+```py
+>>> lj_speech = lj_speech.map(remove_columns=["file", "id", "normalized_text"])
+```
+
+Ahora echa un vistazo a las columnas `audio` y `texto`:
+
+```py
+>>> lj_speech[0]["audio"]
+{'array': array([-7.3242188e-04, -7.6293945e-04, -6.4086914e-04, ...,
+ 7.3242188e-04, 2.1362305e-04, 6.1035156e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/917ece08c95cf0c4115e45294e3cd0dee724a1165b7fc11798369308a465bd26/LJSpeech-1.1/wavs/LJ001-0001.wav',
+ 'sampling_rate': 22050}
+
+>>> lj_speech[0]["text"]
+'Printing, in the only sense with which we are at present concerned, differs from most if not from all the arts and crafts represented in the Exhibition'
+```
+
+Recuerda la secciรณn anterior sobre el procesamiento de datos de audio, siempre debes [volver a muestrear](preprocessing#audio) la tasa de muestreo de tus datos de audio para que coincida con la tasa de muestreo del dataset utilizado para preentrenar un modelo:
+
+```py
+>>> lj_speech = lj_speech.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+### Processor
+
+Un processor combina un extractor de caracterรญsticas y un tokenizador. Cargue un procesador con [`AutoProcessor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
+```
+
+1. Crea una funciรณn para procesar los datos de audio en `input_values`, y tokeniza el texto en `labels`. Estas son las entradas del modelo:
+
+```py
+>>> def prepare_dataset(example):
+... audio = example["audio"]
+
+... example.update(processor(audio=audio["array"], text=example["text"], sampling_rate=16000))
+
+... return example
+```
+
+2. Aplica la funciรณn `prepare_dataset` a una muestra:
+
+```py
+>>> prepare_dataset(lj_speech[0])
+```
+
+Observa que el mรฉtodo processor ha aรฑadido `input_values` y `labels`. La tasa de muestreo tambiรฉn se ha reducido correctamente a 16kHz.
+
+Genial, ahora deberรญas ser capaz de preprocesar datos para cualquier modalidad e incluso combinar diferentes modalidades. En el siguiente tutorial, aprenderรกs aplicar fine tuning a un modelo en tus datos reciรฉn preprocesados.
+
+## Todo lo que siempre quisiste saber sobre el padding y el truncamiento
+
+Hemos visto los comandos que funcionarรกn para la mayorรญa de los casos (hacer pad a tu batch teniendo en cuenta la longitud de la frase mรกxima y
+truncar a la longitud mรกxima que el modelo puede aceptar). Sin embargo, la API admite mรกs estrategias si las necesitas. Los
+tres argumentos que necesitas conocer para ello son `padding`, `truncation` y `max_length`.
+
+- `padding` controla el aplicarme padding al texto. Puede ser un booleano o una cadena que debe ser:
+
+ - `True` o `'longest'` para aplicar el pad hasta la secuencia mรกs larga del batch (no apliques el padding si sรณlo le proporcionas
+ una sola secuencia).
+ - `'max_length'` para aplicar el pad hasta la longitud especificada por el argumento `max_length` o la longitud mรกxima aceptada
+ por el modelo si no le proporcionas `longitud_mรกxima` (`longitud_mรกxima=None`). Si sรณlo le proporcionas una รบnica secuencia
+ se le aplicarรก el padding.
+ `False` o `'do_not_pad'` para no aplicar pad a las secuencias. Como hemos visto antes, este es el comportamiento por
+ defecto.
+
+- `truncation` controla el truncamiento. Puede ser un booleano o una string que debe ser:
+
+ - `True` o `'longest_first'` truncan hasta la longitud mรกxima especificada por el argumento `max_length` o
+ la longitud mรกxima aceptada por el modelo si no le proporcionas `max_length` (`max_length=None`). Esto
+ truncarรก token por token, eliminando un token de la secuencia mรกs larga del par hasta alcanzar la longitud
+ adecuada.
+ - `'only_second'` trunca hasta la longitud mรกxima especificada por el argumento `max_length` o la
+ longitud mรกxima aceptada por el modelo si no le proporcionas `max_length` (`max_length=None`). Esto sรณlo truncarรก
+ la segunda frase de un par si le proporcionas un par de secuencias (o un batch de pares de secuencias).
+ - `'only_first'` trunca hasta la longitud mรกxima especificada por el argumento `max_length` o la longitud mรกxima
+ aceptada por el modelo si no se proporciona `max_length` (`max_length=None`). Esto sรณlo truncarรก
+ la primera frase de un par si se proporciona un par de secuencias (o un lote de pares de secuencias).
+ - `False` o `'do_not_truncate'` para no truncar las secuencias. Como hemos visto antes, este es el comportamiento
+ por defecto.
+
+- `max_length` para controlar la longitud del padding/truncamiento. Puede ser un nรบmero entero o `None`, en cuyo caso
+serรก por defecto la longitud mรกxima que el modelo puede aceptar. Si el modelo no tiene una longitud mรกxima de entrada especรญfica, el
+padding/truncamiento a `longitud_mรกxima` se desactiva.
+
+A continuaciรณn te mostramos en una tabla que resume la forma recomendada de configurar el padding y el truncamiento. Si utilizas un par de secuencias de entrada en
+algunos de los siguientes ejemplos, puedes sustituir `truncation=True` por una `STRATEGY` seleccionada en
+`['only_first', 'only_second', 'longest_first']`, es decir, `truncation='only_second'` o `truncation= 'longest_first'` para controlar cรณmo se truncan ambas secuencias del par como se ha detallado anteriormente.
+
+| Truncation | Padding | Instrucciones |
+|--------------------------------------|-----------------------------------|---------------------------------------------------------------------------------------------|
+| no truncation | no padding | `tokenizer(batch_sentences)` |
+| | padding secuencia max del batch | `tokenizer(batch_sentences, padding=True)` or |
+| | | `tokenizer(batch_sentences, padding='longest')` |
+| | padding long max de input model | `tokenizer(batch_sentences, padding='max_length')` |
+| | padding a una long especifica | `tokenizer(batch_sentences, padding='max_length', max_length=42)` |
+| truncation long max del input model | no padding | `tokenizer(batch_sentences, truncation=True)` or |
+| | | `tokenizer(batch_sentences, truncation=STRATEGY)` |
+| | padding secuencia max del batch | `tokenizer(batch_sentences, padding=True, truncation=True)` or |
+| | | `tokenizer(batch_sentences, padding=True, truncation=STRATEGY)` |
+| | padding long max de input model | `tokenizer(batch_sentences, padding='max_length', truncation=True)` or |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=STRATEGY)` |
+| | padding a una long especifica | Not possible |
+| truncation a una long especifica | no padding | `tokenizer(batch_sentences, truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, truncation=STRATEGY, max_length=42)` |
+| | padding secuencia max del batch | `tokenizer(batch_sentences, padding=True, truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, padding=True, truncation=STRATEGY, max_length=42)` |
+| | padding long max de input model | Not possible |
+| | padding a una long especifica | `tokenizer(batch_sentences, padding='max_length', truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=STRATEGY, max_length=42)` |
+
+
+
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/quicktour.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/quicktour.md
new file mode 100644
index 0000000000000000000000000000000000000000..c4babab09f023df427320dbd9c6ce26ff0eb24da
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/quicktour.md
@@ -0,0 +1,401 @@
+
+
+# Tour rรกpido
+
+[[open-in-colab]]
+
+ยกEntra en marcha con los ๐ค Transformers! Comienza usando [`pipeline`] para una inferencia veloz, carga un modelo preentrenado y un tokenizador con una [AutoClass](./model_doc/auto) para resolver tu tarea de texto, visiรณn o audio.
+
+
+
+Todos los ejemplos de cรณdigo presentados en la documentaciรณn tienen un botรณn arriba a la derecha para elegir si quieres ocultar o mostrar el cรณdigo en Pytorch o TensorFlow.
+Si no fuese asรญ, se espera que el cรณdigo funcione para ambos backends sin ningรบn cambio.
+
+
+
+## Pipeline
+
+[`pipeline`] es la forma mรกs fรกcil de usar un modelo preentrenado para una tarea dada.
+
+
+
+El [`pipeline`] soporta muchas tareas comunes listas para usar:
+
+**Texto**:
+* Anรกlisis de Sentimiento (Sentiment Analysis, en inglรฉs): clasifica la polaridad de un texto dado.
+* Generaciรณn de Texto (Text Generation, en inglรฉs): genera texto a partir de un input dado.
+* Reconocimiento de Entidades (Name Entity Recognition o NER, en inglรฉs): etiqueta cada palabra con la entidad que representa (persona, fecha, ubicaciรณn, etc.).
+* Responder Preguntas (Question answering, en inglรฉs): extrae la respuesta del contexto dado un contexto y una pregunta.
+* Rellenar Mรกscara (Fill-mask, en inglรฉs): rellena el espacio faltante dado un texto con palabras enmascaradas.
+* Resumir (Summarization, en inglรฉs): genera un resumen de una secuencia larga de texto o un documento.
+* Traducciรณn (Translation, en inglรฉs): traduce un texto a otro idioma.
+* Extracciรณn de Caracterรญsticas (Feature Extraction, en inglรฉs): crea una representaciรณn tensorial del texto.
+
+**Imagen**:
+* Clasificaciรณn de Imรกgenes (Image Classification, en inglรฉs): clasifica una imagen.
+* Segmentaciรณn de Imรกgenes (Image Segmentation, en inglรฉs): clasifica cada pixel de una imagen.
+* Detecciรณn de Objetos (Object Detection, en inglรฉs): detecta objetos dentro de una imagen.
+
+**Audio**:
+* Clasificaciรณn de Audios (Audio Classification, en inglรฉs): asigna una etiqueta a un segmento de audio.
+* Reconocimiento de Voz Automรกtico (Automatic Speech Recognition o ASR, en inglรฉs): transcribe datos de audio a un texto.
+
+
+
+Para mรกs detalles acerca del [`pipeline`] y tareas asociadas, consulta la documentaciรณn [aquรญ](./main_classes/pipelines).
+
+
+
+### Uso del Pipeline
+
+En el siguiente ejemplo, usarรกs el [`pipeline`] para anรกlisis de sentimiento.
+
+Instala las siguientes dependencias si aรบn no lo has hecho:
+
+
+
+
+```bash
+pip install torch
+```
+
+
+
+```bash
+pip install tensorflow
+```
+
+
+
+Importa [`pipeline`] y especifica la tarea que deseas completar:
+
+```py
+>>> from transformers import pipeline
+
+>>> clasificador = pipeline("sentiment-analysis", model="pysentimiento/robertuito-sentiment-analysis")
+```
+
+El pipeline descarga y almacena en cachรฉ el [modelo preentrenado](https://huggingface.co/pysentimiento/robertuito-sentiment-analysis) y tokeniza para anรกlisis de sentimiento. Si no hubieramos elegido un modelo el pipeline habrรญa elegido uno por defecto. Ahora puedes usar `clasificador` en tu texto objetivo:
+
+```py
+>>> clasificador("Estamos muy felices de mostrarte la biblioteca de ๐ค Transformers.")
+[{'label': 'POS', 'score': 0.9320}]
+```
+
+Para mรกs de un enunciado, entrega una lista al [`pipeline`] que devolverรก una lista de diccionarios:
+
+El [`pipeline`] tambiรฉn puede iterar sobre un dataset entero. Comienza instalando la biblioteca [๐ค Datasets](https://huggingface.co/docs/datasets/):
+
+```bash
+pip install datasets
+```
+
+Crea un [`pipeline`] con la tarea que deseas resolver y el modelo que quieres usar. Coloca el parรกmetro `device` a `0` para poner los tensores en un dispositivo CUDA:
+
+```py
+>>> import torch
+>>> from transformers import pipeline
+
+>>> reconocedor_de_voz = pipeline(
+... "automatic-speech-recognition", model="jonatasgrosman/wav2vec2-large-xlsr-53-spanish", device=0
+... )
+```
+
+A continuaciรณn, carga el dataset (ve ๐ค Datasets [Quick Start](https://huggingface.co/docs/datasets/quickstart.html) para mรกs detalles) sobre el que quisieras iterar. Por ejemplo, vamos a cargar el dataset [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14):
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="es-ES", split="train") # doctest: +IGNORE_RESULT
+```
+
+Debemos asegurarnos de que la frecuencia de muestreo del conjunto de datos coincide con la frecuencia de muestreo con la que se entrenรณ `jonatasgrosman/wav2vec2-large-xlsr-53-spanish`.
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=reconocedor_de_voz.feature_extractor.sampling_rate))
+```
+
+Los archivos de audio se cargan y remuestrean automรกticamente cuando llamamos a la columna `"audio"`.
+Extraigamos las matrices de onda cruda (raw waveform, en inglรฉs) de las primeras 4 muestras y pasรฉmosla como una lista al pipeline:
+
+```py
+>>> resultado = reconocedor_de_voz(dataset[:4]["audio"])
+>>> print([d["text"] for d in resultado])
+['ahora buenas eh a ver tengo un problema con vuestra aplicaciรณn resulta que que quiero hacer una transferencia bancaria a una cuenta conocida pero me da error la aplicaciรณn a ver que a ver que puede ser', 'la aplicaciรณn no cargue saldo de mi nueva cuenta', 'hola tengo un problema con la aplicaciรณn no carga y y tampoco veo que carga el saldo de mi cuenta nueva dice que la aplicaciรณn estรก siendo reparada y ahora no puedo acceder a mi cuenta no necesito inmediatamente', 'hora buena la aplicaciรณn no se carga la vida no carga el saldo de mi cuenta nueva dice que la villadenta siendo reparada y oro no puedo hacer a mi cuenta']
+```
+
+Para un dataset mรกs grande, donde los inputs son de mayor tamaรฑo (como en habla/audio o visiรณn), querrรกs pasar un generador en lugar de una lista que carga todos los inputs en memoria. Ve la [documentaciรณn del pipeline](./main_classes/pipelines) para mรกs informaciรณn.
+
+### Usa otro modelo y otro tokenizador en el pipeline
+
+El [`pipeline`] puede acomodarse a cualquier modelo del [Model Hub](https://huggingface.co/models) haciendo mรกs fรกcil adaptar el [`pipeline`] para otros casos de uso. Por ejemplo, si quisieras un modelo capaz de manejar texto en francรฉs, usa los tags en el Model Hub para filtrar entre los modelos apropiados. El resultado mejor filtrado devuelve un [modelo BERT](https://huggingface.co/nlptown/bert-base-multilingual-uncased-sentiment) multilingual fine-tuned para el anรกlisis de sentimiento. Genial, ยกvamos a usar este modelo!
+
+```py
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+```
+
+
+
+Usa [`AutoModelForSequenceClassification`] y ['AutoTokenizer'] para cargar un modelo preentrenado y un tokenizador asociado (mรกs en un `AutoClass` debajo):
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+
+
+Usa [`TFAutoModelForSequenceClassification`] y ['AutoTokenizer'] para cargar un modelo preentrenado y un tokenizador asociado (mรกs en un `TFAutoClass` debajo):
+
+```py
+>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+
+
+Despuรฉs puedes especificar el modelo y el tokenizador en el [`pipeline`], y aplicar el `classifier` en tu texto objetivo:
+
+```py
+>>> classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
+>>> classifier("Nous sommes trรจs heureux de vous prรฉsenter la bibliothรจque ๐ค Transformers.")
+[{'label': '5 stars', 'score': 0.7273}]
+```
+
+Si no pudieras encontrar el modelo para tu caso respectivo de uso necesitarรกs ajustar un modelo preentrenado a tus datos. Mira nuestro [tutorial de fine-tuning](./training) para aprender cรณmo. Finalmente, despuรฉs de que has ajustado tu modelo preentrenado, ยกpor favor considera compartirlo (ve el tutorial [aquรญ](./model_sharing)) con la comunidad en el Model Hub para democratizar el NLP! ๐ค
+
+## AutoClass
+
+
+
+Por debajo, las clases [`AutoModelForSequenceClassification`] y [`AutoTokenizer`] trabajan juntas para dar poder al [`pipeline`]. Una [AutoClass](./model_doc/auto) es un atajo que automรกticamente recupera la arquitectura de un modelo preentrenado con su nombre o el path. Sรณlo necesitarรกs seleccionar el `AutoClass` apropiado para tu tarea y tu tokenizador asociado con [`AutoTokenizer`].
+
+Regresemos a nuestro ejemplo y veamos cรณmo puedes usar el `AutoClass` para reproducir los resultados del [`pipeline`].
+
+### AutoTokenizer
+
+Un tokenizador es responsable de procesar el texto a un formato que sea entendible para el modelo. Primero, el tokenizador separarรก el texto en palabras llamadas *tokens*. Hay mรบltiples reglas que gobiernan el proceso de tokenizaciรณn incluyendo el cรณmo separar una palabra y en quรฉ nivel (aprende mรกs sobre tokenizaciรณn [aquรญ](./tokenizer_summary)). Lo mรกs importante es recordar que necesitarรกs instanciar el tokenizador con el mismo nombre del modelo para asegurar que estรกs usando las mismas reglas de tokenizaciรณn con las que el modelo fue preentrenado.
+
+Carga un tokenizador con [`AutoTokenizer`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> nombre_del_modelo = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tokenizer = AutoTokenizer.from_pretrained(nombre_del_modelo)
+```
+
+Despuรฉs, el tokenizador convierte los tokens a nรบmeros para construir un tensor que servirรก como input para el modelo. Esto es conocido como el *vocabulario* del modelo.
+
+Pasa tu texto al tokenizador:
+
+```py
+>>> encoding = tokenizer("Estamos muy felices de mostrarte la biblioteca de ๐ค Transformers.")
+>>> print(encoding)
+{'input_ids': [101, 10602, 14000, 13653, 43353, 10107, 10102, 47201, 10218, 10106, 18283, 10102, 100, 58263, 119, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+El tokenizador devolverรก un diccionario conteniendo:
+
+* [input_ids](./glossary#input-ids): representaciones numรฉricas de los tokens.
+* [atttention_mask](.glossary#attention-mask): indica cuรกles tokens deben ser atendidos.
+
+Como con el [`pipeline`], el tokenizador aceptarรก una lista de inputs. Ademรกs, el tokenizador tambiรฉn puede rellenar (pad, en inglรฉs) y truncar el texto para devolver un lote (batch, en inglรฉs) de longitud uniforme:
+
+
+
+
+```py
+>>> pt_batch = tokenizer(
+... ["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="pt",
+... )
+```
+
+
+
+```py
+>>> tf_batch = tokenizer(
+... ["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="tf",
+... )
+```
+
+
+
+Lee el tutorial de [preprocessing](./preprocessing) para mรกs detalles acerca de la tokenizaciรณn.
+
+### AutoModel
+
+
+
+๐ค Transformers provee una forma simple y unificada de cargar tus instancias preentrenadas. Esto significa que puedes cargar un [`AutoModel`] como cargarรญas un [`AutoTokenizer`]. La รบnica diferencia es seleccionar el [`AutoModel`] correcto para la tarea. Ya que estรกs clasificando texto, o secuencias, carga [`AutoModelForSequenceClassification`]:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+
+Ve el [task summary](./task_summary) para revisar quรฉ clase del [`AutoModel`] deberรญas usar para cada tarea.
+
+
+
+Ahora puedes pasar tu lote (batch) preprocesado de inputs directamente al modelo. Solo tienes que desempacar el diccionario aรฑadiendo `**`:
+
+```py
+>>> pt_outputs = pt_model(**pt_batch)
+```
+
+El modelo producirรก las activaciones finales en el atributo `logits`. Aplica la funciรณn softmax a `logits` para obtener las probabilidades:
+
+```py
+>>> from torch import nn
+
+>>> pt_predictions = nn.functional.softmax(pt_outputs.logits, dim=-1)
+>>> print(pt_predictions)
+tensor([[0.0021, 0.0018, 0.0115, 0.2121, 0.7725],
+ [0.2084, 0.1826, 0.1969, 0.1755, 0.2365]], grad_fn=)
+```
+
+
+๐ค Transformers provee una forma simple y unificada de cargar tus instancias preentrenadas. Esto significa que puedes cargar un [`TFAutoModel`] como cargarรญas un [`AutoTokenizer`]. La รบnica diferencia es seleccionar el [`TFAutoModel`] correcto para la tarea. Ya que estรกs clasificando texto, o secuencias, carga [`TFAutoModelForSequenceClassification`]:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+ Ve el [task summary](./task_summary) para revisar quรฉ clase del [`AutoModel`]
+ deberรญas usar para cada tarea.
+
+
+Ahora puedes pasar tu lote preprocesado de inputs directamente al modelo pasando las llaves del diccionario directamente a los tensores:
+
+```py
+>>> tf_outputs = tf_model(tf_batch)
+```
+
+El modelo producirรก las activaciones finales en el atributo `logits`. Aplica la funciรณn softmax a `logits` para obtener las probabilidades:
+
+```py
+>>> import tensorflow as tf
+
+>>> tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
+>>> print(tf.math.round(tf_predictions * 10**4) / 10**4)
+tf.Tensor(
+[[0.0021 0.0018 0.0116 0.2121 0.7725]
+ [0.2084 0.1826 0.1969 0.1755 0.2365]], shape=(2, 5), dtype=float32)
+```
+
+
+
+
+
+Todos los modelos de ๐ค Transformers (PyTorch o TensorFlow) producirรกn los tensores *antes* de la funciรณn de activaciรณn
+final (como softmax) porque la funciรณn de activaciรณn final es comรบnmente fusionada con la pรฉrdida.
+
+
+
+Los modelos son [`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) o [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) estรกndares asรญ que podrรกs usarlos en tu training loop usual. Sin embargo, para facilitar las cosas, ๐ค Transformers provee una clase [`Trainer`] para PyTorch que aรฑade funcionalidades para entrenamiento distribuido, preciciรณn mixta, y mรกs. Para TensorFlow, puedes usar el mรฉtodo `fit` desde [Keras](https://keras.io/). Consulta el [tutorial de entrenamiento](./training) para mรกs detalles.
+
+
+
+Los outputs del modelo de ๐ค Transformers son dataclasses especiales por lo que sus atributos pueden ser completados en un IDE.
+Los outputs del modelo tambiรฉn se comportan como tuplas o diccionarios (e.g., puedes indexar con un entero, un slice o una cadena) en cuyo caso los atributos que son `None` son ignorados.
+
+
+
+### Guarda un modelo
+
+
+
+Una vez que se haya hecho fine-tuning a tu modelo puedes guardarlo con tu tokenizador usando [`PreTrainedModel.save_pretrained`]:
+
+```py
+>>> pt_save_directory = "./pt_save_pretrained"
+>>> tokenizer.save_pretrained(pt_save_directory) # doctest: +IGNORE_RESULT
+>>> pt_model.save_pretrained(pt_save_directory)
+```
+
+Cuando quieras usar el modelo otra vez cรกrgalo con [`PreTrainedModel.from_pretrained`]:
+
+```py
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained("./pt_save_pretrained")
+```
+
+
+
+
+Una vez que se haya hecho fine-tuning a tu modelo puedes guardarlo con tu tokenizador usando [`TFPreTrainedModel.save_pretrained`]:
+
+```py
+>>> tf_save_directory = "./tf_save_pretrained"
+>>> tokenizer.save_pretrained(tf_save_directory) # doctest: +IGNORE_RESULT
+>>> tf_model.save_pretrained(tf_save_directory)
+```
+
+Cuando quieras usar el modelo otra vez cรกrgalo con [`TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained("./tf_save_pretrained")
+```
+
+
+
+Una caracterรญstica particularmente interesante de ๐ค Transformers es la habilidad de guardar el modelo y cargarlo como un modelo de PyTorch o TensorFlow. El parรกmetro `from_pt` o `from_tf` puede convertir el modelo de un framework al otro:
+
+
+
+
+```py
+>>> from transformers import AutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(pt_save_directory, from_pt=True)
+```
+
+
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(tf_save_directory, from_tf=True)
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/run_scripts.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/run_scripts.md
new file mode 100644
index 0000000000000000000000000000000000000000..d9a2b142a8ab6c9c2c9b287e479015afbd4eb279
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/run_scripts.md
@@ -0,0 +1,351 @@
+
+
+# Entrenamiento con scripts
+
+Junto con los [notebooks](./notebooks) de ๐ค Transformers, tambiรฉn hay scripts con ejemplos que muestran cรณmo entrenar un modelo para una tarea en [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch), [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow), o [JAX/Flax](https://github.com/huggingface/transformers/tree/main/examples/flax).
+
+Tambiรฉn encontrarรกs scripts que hemos usado en nuestros [proyectos de investigaciรณn](https://github.com/huggingface/transformers/tree/main/examples/research_projects) y [ejemplos pasados](https://github.com/huggingface/transformers/tree/main/examples/legacy) que en su mayorรญa son aportados por la comunidad. Estos scripts no se mantienen activamente y requieren una versiรณn especรญfica de ๐ค Transformers que probablemente sea incompatible con la รบltima versiรณn de la biblioteca.
+
+No se espera que los scripts de ejemplo funcionen de inmediato en todos los problemas, y es posible que debas adaptar el script al problema que estรกs tratando de resolver. Para ayudarte con esto, la mayorรญa de los scripts exponen completamente cรณmo se preprocesan los datos, lo que te permite editarlos segรบn sea necesario para tu caso de uso.
+
+Para cualquier caracterรญstica que te gustarรญa implementar en un script de ejemplo, por favor discรบtelo en el [foro](https://discuss.huggingface.co/) o con un [issue](https://github.com/huggingface/transformers/issues) antes de enviar un Pull Request. Si bien agradecemos las correcciones de errores, es poco probable que fusionemos un Pull Request que agregue mรกs funcionalidad a costa de la legibilidad.
+
+Esta guรญa te mostrarรก cรณmo ejecutar un ejemplo de un script de entrenamiento para resumir texto en [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization) y [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization). Se espera que todos los ejemplos funcionen con ambos frameworks a menos que se especifique lo contrario.
+
+## Configuraciรณn
+
+Para ejecutar con รฉxito la รบltima versiรณn de los scripts de ejemplo debes **instalar ๐ค Transformers desde su fuente** en un nuevo entorno virtual:
+
+```bash
+git clone https://github.com/huggingface/transformers
+cd transformers
+pip install .
+```
+
+Para versiones anteriores de los scripts de ejemplo, haz clic en alguno de los siguientes links:
+
+
+ Ejemplos de versiones anteriores de ๐ค Transformers
+
+
+
+Luego cambia tu clon actual de ๐ค Transformers a una versiรณn especรญfica, por ejemplo v3.5.1:
+
+```bash
+git checkout tags/v3.5.1
+```
+
+Una vez que hayas configurado la versiรณn correcta de la biblioteca, ve a la carpeta de ejemplo de tu elecciรณn e instala los requisitos especรญficos del ejemplo:
+
+```bash
+pip install -r requirements.txt
+```
+
+## Ejecutar un script
+
+
+
+El script de ejemplo descarga y preprocesa un conjunto de datos de la biblioteca ๐ค [Datasets](https://huggingface.co/docs/datasets/). Luego, el script ajusta un conjunto de datos con [Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) en una arquitectura que soporta la tarea de resumen. El siguiente ejemplo muestra cรณmo ajustar un [T5-small](https://huggingface.co/google-t5/t5-small) en el conjunto de datos [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail). El modelo T5 requiere un argumento adicional `source_prefix` debido a cรณmo fue entrenado. Este aviso le permite a T5 saber que se trata de una tarea de resumir.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+El script de ejemplo descarga y preprocesa un conjunto de datos de la biblioteca ๐ค [Datasets](https://huggingface.co/docs/datasets/). Luego, el script ajusta un conjunto de datos utilizando Keras en una arquitectura que soporta la tarea de resumir. El siguiente ejemplo muestra cรณmo ajustar un [T5-small](https://huggingface.co/google-t5/t5-small) en el conjunto de datos [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail). El modelo T5 requiere un argumento adicional `source_prefix` debido a cรณmo fue entrenado. Este aviso le permite a T5 saber que se trata de una tarea de resumir.
+
+```bash
+python examples/tensorflow/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Entrenamiento distribuido y de precisiรณn mixta
+
+[Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) admite un entrenamiento distribuido y de precisiรณn mixta, lo que significa que tambiรฉn puedes usarlo en un script. Para habilitar ambas caracterรญsticas:
+
+- Agrega el argumento `fp16` para habilitar la precisiรณn mixta.
+- Establece la cantidad de GPU que se usarรก con el argumento `nproc_per_node`.
+
+```bash
+torchrun \
+ --nproc_per_node 8 pytorch/summarization/run_summarization.py \
+ --fp16 \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+Los scripts de TensorFlow utilizan [`MirroredStrategy`](https://www.tensorflow.org/guide/distributed_training#mirroredstrategy) para el entrenamiento distribuido, y no es necesario agregar argumentos adicionales al script de entrenamiento. El script de TensorFlow utilizarรก mรบltiples GPUs de forma predeterminada si estรกn disponibles.
+
+## Ejecutar un script en una TPU
+
+
+
+Las Unidades de Procesamiento de Tensor (TPUs) estรกn diseรฑadas especรญficamente para acelerar el rendimiento. PyTorch admite TPU con el compilador de aprendizaje profundo [XLA](https://www.tensorflow.org/xla) (consulta [aquรญ](https://github.com/pytorch/xla/blob/master/README.md) para obtener mรกs detalles). Para usar una TPU, inicia el script `xla_spawn.py` y usa el argumento `num_cores` para establecer la cantidad de nรบcleos de TPU que deseas usar.
+
+```bash
+python xla_spawn.py --num_cores 8 \
+ summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+Las Unidades de Procesamiento de Tensor (TPUs) estรกn diseรฑadas especรญficamente para acelerar el rendimiento. TensorFlow utiliza [`TPUStrategy`](https://www.tensorflow.org/guide/distributed_training#tpustrategy) para entrenar en TPUs. Para usar una TPU, pasa el nombre del recurso de la TPU al argumento `tpu`
+
+```bash
+python run_summarization.py \
+ --tpu name_of_tpu_resource \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Ejecutar un script con ๐ค Accelerate
+
+๐ค [Accelerate](https://huggingface.co/docs/accelerate) es una biblioteca exclusiva de PyTorch que ofrece un mรฉtodo unificado para entrenar un modelo en varios tipos de configuraciones (solo CPU, GPU mรบltiples, TPU) mientras mantiene una visibilidad completa en el ciclo de entrenamiento de PyTorch. Asegรบrate de tener ๐ค Accelerate instalado si aรบn no lo tienes:
+
+> Nota: Como Accelerate se estรก desarrollando rรกpidamente, debes instalar la versiรณn git de Accelerate para ejecutar los scripts
+```bash
+pip install git+https://github.com/huggingface/accelerate
+```
+
+En lugar del script `run_summarization.py`, debes usar el script `run_summarization_no_trainer.py`. Los scripts compatibles con ๐ค Accelerate tendrรกn un archivo `task_no_trainer.py` en la carpeta. Comienza ejecutando el siguiente comando para crear y guardar un archivo de configuraciรณn:
+
+```bash
+accelerate config
+```
+
+Prueba tu configuraciรณn para asegurarte que estรก configurada correctamente:
+
+```bash
+accelerate test
+```
+
+Todo listo para iniciar el entrenamiento:
+
+```bash
+accelerate launch run_summarization_no_trainer.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir ~/tmp/tst-summarization
+```
+
+## Usar un conjunto de datos personalizado
+
+El script de la tarea resumir admite conjuntos de datos personalizados siempre que sean un archivo CSV o JSON Line. Cuando uses tu propio conjunto de datos, necesitas especificar varios argumentos adicionales:
+
+- `train_file` y `validation_file` especifican la ruta a tus archivos de entrenamiento y validaciรณn.
+- `text_column` es el texto de entrada para resumir.
+- `summary_column` es el texto de destino para la salida.
+
+Un script para resumir que utiliza un conjunto de datos personalizado se vera asรญ:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --train_file path_to_csv_or_jsonlines_file \
+ --validation_file path_to_csv_or_jsonlines_file \
+ --text_column text_column_name \
+ --summary_column summary_column_name \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --overwrite_output_dir \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --predict_with_generate
+```
+
+## Prueba un script
+
+A veces, es una buena idea ejecutar tu secuencia de comandos en una cantidad menor de ejemplos para asegurarte de que todo funciona como se espera antes de comprometerte con un conjunto de datos completo, lo que puede demorar horas en completarse. Utiliza los siguientes argumentos para truncar el conjunto de datos a un nรบmero mรกximo de muestras:
+
+- `max_train_samples`
+- `max_eval_samples`
+- `max_predict_samples`
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --max_train_samples 50 \
+ --max_eval_samples 50 \
+ --max_predict_samples 50 \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+No todos los scripts de ejemplo admiten el argumento `max_predict_samples`. Puede que desconozcas si la secuencia de comandos admite este argumento, agrega `-h` para verificar:
+
+```bash
+examples/pytorch/summarization/run_summarization.py -h
+```
+
+## Reanudar el entrenamiento desde el punto de control
+
+Otra opciรณn รบtil para habilitar es reanudar el entrenamiento desde un punto de control anterior. Esto asegurarรก que puedas continuar donde lo dejaste sin comenzar de nuevo si tu entrenamiento se interrumpe. Hay dos mรฉtodos para reanudar el entrenamiento desde un punto de control.
+
+El primer mรฉtodo utiliza el argumento `output_dir previous_output_dir` para reanudar el entrenamiento desde el รบltimo punto de control almacenado en `output_dir`. En este caso, debes eliminar `overwrite_output_dir`:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --output_dir previous_output_dir \
+ --predict_with_generate
+```
+
+El segundo mรฉtodo utiliza el argumento `resume_from_checkpoint path_to_specific_checkpoint` para reanudar el entrenamiento desde una carpeta de punto de control especรญfica.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --resume_from_checkpoint path_to_specific_checkpoint \
+ --predict_with_generate
+```
+
+## Comparte tu modelo
+
+Todos los scripts pueden cargar tu modelo final en el [Model Hub](https://huggingface.co/models). Asegรบrate de haber iniciado sesiรณn en Hugging Face antes de comenzar:
+
+```bash
+huggingface-cli login
+```
+
+Luego agrega el argumento `push_to_hub` al script. Este argumento crearรก un repositorio con tu nombre de usuario Hugging Face y el nombre de la carpeta especificado en `output_dir`.
+
+Para darle a tu repositorio un nombre especรญfico, usa el argumento `push_to_hub_model_id` para aรฑadirlo. El repositorio se incluirรก automรกticamente en tu namespace.
+
+El siguiente ejemplo muestra cรณmo cargar un modelo con un nombre de repositorio especรญfico:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --push_to_hub \
+ --push_to_hub_model_id finetuned-t5-cnn_dailymail \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/sagemaker.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/sagemaker.md
new file mode 100644
index 0000000000000000000000000000000000000000..9bc5b74108419865a04b64388bbf49d6d5878aab
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/sagemaker.md
@@ -0,0 +1,28 @@
+
+
+# Ejecutar el entrenamiento en Amazon SageMaker
+
+La documentaciรณn ha sido trasladada a [hf.co/docs/sagemaker](https://huggingface.co/docs/sagemaker). Esta pรกgina serรก eliminada en `transformers` 5.0.
+
+### Tabla de contenido
+
+- [Entrenar modelos de Hugging Face en Amazon SageMaker con SageMaker Python SDK](https://huggingface.co/docs/sagemaker/train)
+- [Desplegar modelos de Hugging Face en Amazon SageMaker con SageMaker Python SDK](https://huggingface.co/docs/sagemaker/inference)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/serialization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/serialization.md
new file mode 100644
index 0000000000000000000000000000000000000000..3ad7d08985305327301b9d385d20949de5260962
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/serialization.md
@@ -0,0 +1,674 @@
+
+
+# Exportar modelos ๐ค Transformers
+
+Si necesitas implementar modelos ๐ค Transformers en entornos de producciรณn, te
+recomendamos exportarlos a un formato serializado que se pueda cargar y ejecutar
+en tiempos de ejecuciรณn y hardware especializados. En esta guรญa, te mostraremos cรณmo
+exportar modelos ๐ค Transformers en dos formatos ampliamente utilizados: ONNX y TorchScript.
+
+Una vez exportado, un modelo puede optimizarse para la inferencia a travรฉs de tรฉcnicas
+como la cuantizaciรณn y _pruning_. Si estรกs interesado en optimizar tus modelos para
+que funcionen con la mรกxima eficiencia, consulta la
+[biblioteca de ๐ค Optimum](https://github.com/huggingface/optimum).
+
+## ONNX
+
+El proyecto [ONNX (Open Neural Network eXchange)](http://onnx.ai) es un
+estรกndar abierto que define un conjunto comรบn de operadores y un formato
+de archivo comรบn para representar modelos de aprendizaje profundo en una
+amplia variedad de _frameworks_, incluidos PyTorch y TensorFlow. Cuando un modelo
+se exporta al formato ONNX, estos operadores se usan para construir un
+grafo computacional (a menudo llamado _representaciรณn intermedia_) que
+representa el flujo de datos a travรฉs de la red neuronal.
+
+Al exponer un grafo con operadores y tipos de datos estandarizados, ONNX facilita
+el cambio entre frameworks. Por ejemplo, un modelo entrenado en PyTorch se puede
+exportar a formato ONNX y luego importar en TensorFlow (y viceversa).
+
+๐ค Transformers proporciona un paquete llamado `transformers.onnx`, el cual permite convertir
+los checkpoints de un modelo en un grafo ONNX aprovechando los objetos de configuraciรณn.
+Estos objetos de configuraciรณn estรกn hechos a la medida de diferentes arquitecturas de modelos
+y estรกn diseรฑados para ser fรกcilmente extensibles a otras arquitecturas.
+
+Las configuraciones a la medida incluyen las siguientes arquitecturas:
+
+
+
+- ALBERT
+- BART
+- BEiT
+- BERT
+- BigBird
+- BigBird-Pegasus
+- Blenderbot
+- BlenderbotSmall
+- BLOOM
+- CamemBERT
+- CLIP
+- CodeGen
+- ConvBERT
+- ConvNeXT
+- ConvNeXTV2
+- Data2VecText
+- Data2VecVision
+- DeBERTa
+- DeBERTa-v2
+- DeiT
+- DETR
+- DistilBERT
+- ELECTRA
+- FlauBERT
+- GPT Neo
+- GPT-J
+- I-BERT
+- LayoutLM
+- LayoutLMv3
+- LeViT
+- LongT5
+- M2M100
+- Marian
+- mBART
+- MobileBERT
+- MobileViT
+- MT5
+- OpenAI GPT-2
+- Perceiver
+- PLBart
+- ResNet
+- RoBERTa
+- RoFormer
+- SqueezeBERT
+- T5
+- ViT
+- XLM
+- XLM-RoBERTa
+- XLM-RoBERTa-XL
+- YOLOS
+
+En las prรณximas dos secciones, te mostraremos cรณmo:
+
+* Exportar un modelo compatible utilizando el paquete `transformers.onnx`.
+* Exportar un modelo personalizado para una arquitectura no compatible.
+
+### Exportar un model a ONNX
+
+Para exportar un modelo ๐ค Transformers a ONNX, tienes que instalar primero algunas
+dependencias extra:
+
+```bash
+pip install transformers[onnx]
+```
+
+El paquete `transformers.onnx` puede ser usado luego como un mรณdulo de Python:
+
+```bash
+python -m transformers.onnx --help
+
+usage: Hugging Face Transformers ONNX exporter [-h] -m MODEL [--feature {causal-lm, ...}] [--opset OPSET] [--atol ATOL] output
+
+positional arguments:
+ output Path indicating where to store generated ONNX model.
+
+optional arguments:
+ -h, --help show this help message and exit
+ -m MODEL, --model MODEL
+ Model ID on huggingface.co or path on disk to load model from.
+ --feature {causal-lm, ...}
+ The type of features to export the model with.
+ --opset OPSET ONNX opset version to export the model with.
+ --atol ATOL Absolute difference tolerence when validating the model.
+```
+
+Exportar un checkpoint usando una configuraciรณn a la medida se puede hacer de la siguiente manera:
+
+```bash
+python -m transformers.onnx --model=distilbert/distilbert-base-uncased onnx/
+```
+
+que deberรญa mostrar los siguientes registros:
+
+```bash
+Validating ONNX model...
+ -[โ] ONNX model output names match reference model ({'last_hidden_state'})
+ - Validating ONNX Model output "last_hidden_state":
+ -[โ] (2, 8, 768) matches (2, 8, 768)
+ -[โ] all values close (atol: 1e-05)
+All good, model saved at: onnx/model.onnx
+```
+
+Esto exporta un grafo ONNX del checkpoint definido por el argumento `--model`.
+En este ejemplo, es un modelo `distilbert/distilbert-base-uncased`, pero puede ser cualquier
+checkpoint en Hugging Face Hub o que estรฉ almacenado localmente.
+
+El archivo `model.onnx` resultante se puede ejecutar en uno de los
+[muchos aceleradores](https://onnx.ai/supported-tools.html#deployModel)
+que admiten el estรกndar ONNX. Por ejemplo, podemos cargar y ejecutar el
+modelo con [ONNX Runtime](https://onnxruntime.ai/) de la siguiente manera:
+
+```python
+>>> from transformers import AutoTokenizer
+>>> from onnxruntime import InferenceSession
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> session = InferenceSession("onnx/model.onnx")
+>>> # ONNX Runtime expects NumPy arrays as input
+>>> inputs = tokenizer("Using DistilBERT with ONNX Runtime!", return_tensors="np")
+>>> outputs = session.run(output_names=["last_hidden_state"], input_feed=dict(inputs))
+```
+
+Los nombres necesarios de salida (es decir, `["last_hidden_state"]`) se pueden obtener
+echando un vistazo a la configuraciรณn ONNX de cada modelo. Por ejemplo, para DistilBERT tenemos:
+
+```python
+>>> from transformers.models.distilbert import DistilBertConfig, DistilBertOnnxConfig
+
+>>> config = DistilBertConfig()
+>>> onnx_config = DistilBertOnnxConfig(config)
+>>> print(list(onnx_config.outputs.keys()))
+["last_hidden_state"]s
+```
+
+El proceso es idรฉntico para los checkpoints de TensorFlow en Hub.
+Por ejemplo, podemos exportar un checkpoint puro de TensorFlow desde
+[Keras](https://huggingface.co/keras-io) de la siguiente manera:
+
+```bash
+python -m transformers.onnx --model=keras-io/transformers-qa onnx/
+```
+
+Para exportar un modelo que estรก almacenado localmente, deberรกs tener los pesos
+y tokenizadores del modelo almacenados en un directorio. Por ejemplo, podemos cargar
+y guardar un checkpoint de la siguiente manera:
+
+
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> # Load tokenizer and PyTorch weights form the Hub
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+>>> # Save to disk
+>>> tokenizer.save_pretrained("local-pt-checkpoint")
+>>> pt_model.save_pretrained("local-pt-checkpoint")
+```
+
+Una vez que se guarda el checkpoint, podemos exportarlo a ONNX usando el argumento `--model`
+del paquete `transformers.onnx` al directorio deseado:
+
+```bash
+python -m transformers.onnx --model=local-pt-checkpoint onnx/
+```
+
+
+```python
+>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
+
+>>> # Load tokenizer and TensorFlow weights from the Hub
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+>>> # Save to disk
+>>> tokenizer.save_pretrained("local-tf-checkpoint")
+>>> tf_model.save_pretrained("local-tf-checkpoint")
+```
+
+Una vez que se guarda el checkpoint, podemos exportarlo a ONNX usando el argumento `--model`
+del paquete `transformers.onnx` al directorio deseado:
+
+```bash
+python -m transformers.onnx --model=local-tf-checkpoint onnx/
+```
+
+
+
+### Seleccionar caracterรญsticas para diferentes topologรญas de un modelo
+
+Cada configuraciรณn a la medida viene con un conjunto de _caracterรญsticas_ que te permiten exportar
+modelos para diferentes tipos de topologรญas o tareas. Como se muestra en la siguiente tabla, cada
+funciรณn estรก asociada con una auto-clase de automรณvil diferente:
+
+| Feature | Auto Class |
+| ------------------------------------ | ------------------------------------ |
+| `causal-lm`, `causal-lm-with-past` | `AutoModelForCausalLM` |
+| `default`, `default-with-past` | `AutoModel` |
+| `masked-lm` | `AutoModelForMaskedLM` |
+| `question-answering` | `AutoModelForQuestionAnswering` |
+| `seq2seq-lm`, `seq2seq-lm-with-past` | `AutoModelForSeq2SeqLM` |
+| `sequence-classification` | `AutoModelForSequenceClassification` |
+| `token-classification` | `AutoModelForTokenClassification` |
+
+Para cada configuraciรณn, puedes encontrar la lista de funciones admitidas a travรฉs de `FeaturesManager`.
+Por ejemplo, para DistilBERT tenemos:
+
+```python
+>>> from transformers.onnx.features import FeaturesManager
+
+>>> distilbert_features = list(FeaturesManager.get_supported_features_for_model_type("distilbert").keys())
+>>> print(distilbert_features)
+["default", "masked-lm", "causal-lm", "sequence-classification", "token-classification", "question-answering"]
+```
+
+Le puedes pasar una de estas caracterรญsticas al argumento `--feature` en el paquete `transformers.onnx`.
+Por ejemplo, para exportar un modelo de clasificaciรณn de texto, podemos elegir un modelo ya ajustado del Hub y ejecutar:
+
+```bash
+python -m transformers.onnx --model=distilbert/distilbert-base-uncased-finetuned-sst-2-english \
+ --feature=sequence-classification onnx/
+```
+
+que mostrarรก los siguientes registros:
+
+```bash
+Validating ONNX model...
+ -[โ] ONNX model output names match reference model ({'logits'})
+ - Validating ONNX Model output "logits":
+ -[โ] (2, 2) matches (2, 2)
+ -[โ] all values close (atol: 1e-05)
+All good, model saved at: onnx/model.onnx
+```
+
+Ten en cuenta que, en este caso, los nombres de salida del modelo ajustado son `logits` en lugar de `last_hidden_state`
+que vimos anteriormente con el checkpoint `distilbert/distilbert-base-uncased`. Esto es de esperarse ya que el modelo ajustado
+tiene un cabezal de clasificaciรณn secuencial.
+
+
+
+Las caracterรญsticas que tienen un sufijo 'with-past' (por ejemplo, 'causal-lm-with-past') corresponden a topologรญas
+de modelo con estados ocultos precalculados (clave y valores en los bloques de atenciรณn) que se pueden usar para una
+decodificaciรณn autorregresiva mรกs rรกpida.
+
+
+
+
+### Exportar un modelo para una arquitectura no compatible
+
+Si deseas exportar un modelo cuya arquitectura no es compatible de forma nativa
+con la biblioteca, debes seguir tres pasos principales:
+
+1. Implementa una configuraciรณn personalizada en ONNX.
+2. Exporta el modelo a ONNX.
+3. Valide los resultados de PyTorch y los modelos exportados.
+
+En esta secciรณn, veremos cรณmo se implementรณ la serializaciรณn de DistilBERT
+para mostrar lo que implica cada paso.
+
+#### Implementar una configuraciรณn personalizada en ONNX
+
+Comencemos con el objeto de configuraciรณn de ONNX. Proporcionamos tres clases abstractas
+de las que debe heredar, segรบn el tipo de arquitectura del modelo que quieras exportar:
+
+* Modelos basados en el _Encoder_ inherente de [`~onnx.config.OnnxConfig`]
+* Modelos basados en el _Decoder_ inherente de [`~onnx.config.OnnxConfigWithPast`]
+* Modelos _Encoder-decoder_ inherente de [`~onnx.config.OnnxSeq2SeqConfigWithPast`]
+
+
+
+Una buena manera de implementar una configuraciรณn personalizada en ONNX es observar la implementaciรณn
+existente en el archivo `configuration_.py` de una arquitectura similar.
+
+
+
+Dado que DistilBERT es un modelo de tipo _encoder_, su configuraciรณn se hereda de `OnnxConfig`:
+
+```python
+>>> from typing import Mapping, OrderedDict
+>>> from transformers.onnx import OnnxConfig
+
+
+>>> class DistilBertOnnxConfig(OnnxConfig):
+... @property
+... def inputs(self) -> Mapping[str, Mapping[int, str]]:
+... return OrderedDict(
+... [
+... ("input_ids", {0: "batch", 1: "sequence"}),
+... ("attention_mask", {0: "batch", 1: "sequence"}),
+... ]
+... )
+```
+
+Cada objeto de configuraciรณn debe implementar la propiedad `inputs` y devolver un mapeo,
+donde cada llave corresponde a una entrada esperada y cada valor indica el eje de esa entrada.
+Para DistilBERT, podemos ver que se requieren dos entradas: `input_ids` y `attention_mask`.
+Estas entradas tienen la misma forma de `(batch_size, sequence_length)`, es por lo que vemos
+los mismos ejes utilizados en la configuraciรณn.
+
+
+
+Observa que la propiedad `inputs` para `DistilBertOnnxConfig` devuelve un `OrderedDict`.
+Esto nos asegura que las entradas coincidan con su posiciรณn relativa dentro del mรฉtodo
+`PreTrainedModel.forward()` al rastrear el grafo. Recomendamos usar un `OrderedDict`
+para las propiedades `inputs` y `outputs` al implementar configuraciones ONNX personalizadas.
+
+
+
+Una vez que hayas implementado una configuraciรณn ONNX, puedes crear una
+instancia proporcionando la configuraciรณn del modelo base de la siguiente manera:
+
+```python
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("distilbert/distilbert-base-uncased")
+>>> onnx_config = DistilBertOnnxConfig(config)
+```
+
+El objeto resultante tiene varias propiedades รบtiles. Por ejemplo, puedes ver el conjunto de operadores ONNX que se
+utilizarรก durante la exportaciรณn:
+
+```python
+>>> print(onnx_config.default_onnx_opset)
+11
+```
+
+Tambiรฉn puedes ver los resultados asociados con el modelo de la siguiente manera:
+
+```python
+>>> print(onnx_config.outputs)
+OrderedDict([("last_hidden_state", {0: "batch", 1: "sequence"})])
+```
+
+Observa que la propiedad de salidas sigue la misma estructura que las entradas;
+devuelve un objecto `OrderedDict` de salidas nombradas y sus formas. La estructura
+de salida estรก vinculada a la elecciรณn de la funciรณn con la que se inicializa la configuraciรณn.
+Por defecto, la configuraciรณn de ONNX se inicializa con la funciรณn `default` que
+corresponde a exportar un modelo cargado con la clase `AutoModel`. Si quieres exportar
+una topologรญa de modelo diferente, simplemente proporciona una caracterรญstica diferente
+al argumento `task` cuando inicialices la configuraciรณn de ONNX. Por ejemplo, si quisiรฉramos
+exportar DistilBERT con un cabezal de clasificaciรณn de secuencias, podrรญamos usar:
+
+```python
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("distilbert/distilbert-base-uncased")
+>>> onnx_config_for_seq_clf = DistilBertOnnxConfig(config, task="sequence-classification")
+>>> print(onnx_config_for_seq_clf.outputs)
+OrderedDict([('logits', {0: 'batch'})])
+```
+
+
+
+Todas las propiedades base y mรฉtodos asociados con [`~onnx.config.OnnxConfig`] y las
+otras clases de configuraciรณn se pueden sobreescribir si es necesario.
+Consulte [`BartOnnxConfig`] para ver un ejemplo avanzado.
+
+
+
+#### Exportar el modelo
+
+Una vez que hayas implementado la configuraciรณn de ONNX, el siguiente paso es exportar el modelo.
+Aquรญ podemos usar la funciรณn `export()` proporcionada por el paquete `transformers.onnx`.
+Esta funciรณn espera la configuraciรณn de ONNX, junto con el modelo base y el tokenizador,
+y la ruta para guardar el archivo exportado:
+
+```python
+>>> from pathlib import Path
+>>> from transformers.onnx import export
+>>> from transformers import AutoTokenizer, AutoModel
+
+>>> onnx_path = Path("model.onnx")
+>>> model_ckpt = "distilbert/distilbert-base-uncased"
+>>> base_model = AutoModel.from_pretrained(model_ckpt)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
+
+>>> onnx_inputs, onnx_outputs = export(tokenizer, base_model, onnx_config, onnx_config.default_onnx_opset, onnx_path)
+```
+
+Los objetos `onnx_inputs` y `onnx_outputs` devueltos por la funciรณn `export()`
+son listas de llaves definidas en las propiedades `inputs` y `outputs` de la configuraciรณn.
+Una vez exportado el modelo, puedes probar que el modelo estรก bien formado de la siguiente manera:
+
+```python
+>>> import onnx
+
+>>> onnx_model = onnx.load("model.onnx")
+>>> onnx.checker.check_model(onnx_model)
+```
+
+
+
+Si tu modelo tiene mรกs de 2GB, verรกs que se crean muchos archivos adicionales durante la exportaciรณn.
+Esto es _esperado_ porque ONNX usa [Bรบferes de protocolo](https://developers.google.com/protocol-buffers/)
+para almacenar el modelo y รฉstos tienen un lรญmite de tamaรฑo de 2 GB. Consulta la
+[documentaciรณn de ONNX](https://github.com/onnx/onnx/blob/master/docs/ExternalData.md) para obtener
+instrucciones sobre cรณmo cargar modelos con datos externos.
+
+
+
+#### Validar los resultados del modelo
+
+El paso final es validar que los resultados del modelo base y exportado coincidan dentro
+de cierta tolerancia absoluta. Aquรญ podemos usar la funciรณn `validate_model_outputs()`
+proporcionada por el paquete `transformers.onnx` de la siguiente manera:
+
+```python
+>>> from transformers.onnx import validate_model_outputs
+
+>>> validate_model_outputs(
+... onnx_config, tokenizer, base_model, onnx_path, onnx_outputs, onnx_config.atol_for_validation
+... )
+```
+
+Esta funciรณn usa el mรฉtodo `OnnxConfig.generate_dummy_inputs()` para generar entradas para el modelo base
+y exportado, y la tolerancia absoluta se puede definir en la configuraciรณn. En general, encontramos una
+concordancia numรฉrica en el rango de 1e-6 a 1e-4, aunque es probable que cualquier valor menor que 1e-3 estรฉ bien.
+
+### Contribuir con una nueva configuraciรณn a ๐ค Transformers
+
+ยกEstamos buscando expandir el conjunto de configuraciones a la medida para usar y agradecemos las contribuciones de la comunidad!
+Si deseas contribuir con su colaboraciรณn a la biblioteca, deberรกs:
+
+* Implementa la configuraciรณn de ONNX en el archivo `configuration_.py` correspondiente
+* Incluye la arquitectura del modelo y las caracterรญsticas correspondientes en [`~onnx.features.FeatureManager`]
+* Agrega tu arquitectura de modelo a las pruebas en `test_onnx_v2.py`
+
+Revisa cรณmo fue la contribuciรณn para la [configuraciรณn de IBERT](https://github.com/huggingface/transformers/pull/14868/files)
+y asรญ tener una idea de lo que necesito.
+
+## TorchScript
+
+
+
+Este es el comienzo de nuestros experimentos con TorchScript y todavรญa estamos explorando sus capacidades con modelos de
+tamaรฑo de entrada variable. Es un tema de interรฉs y profundizaremos nuestro anรกlisis en las prรณximas
+versiones, con mรกs ejemplos de cรณdigo, una implementaciรณn mรกs flexible y puntos de referencia que comparen cรณdigos
+basados en Python con TorchScript compilado.
+
+
+
+Segรบn la documentaciรณn de PyTorch: "TorchScript es una forma de crear modelos serializables y optimizables a partir del
+cรณdigo de PyTorch". Los dos mรณdulos de Pytorch [JIT y TRACE](https://pytorch.org/docs/stable/jit.html) permiten al
+desarrollador exportar su modelo para reutilizarlo en otros programas, como los programas C++ orientados a la eficiencia.
+
+Hemos proporcionado una interfaz que permite exportar modelos de ๐ค Transformers a TorchScript para que puedan reutilizarse
+en un entorno diferente al de un programa Python basado en PyTorch. Aquรญ explicamos cรณmo exportar y usar nuestros modelos
+usando TorchScript.
+
+Exportar un modelo requiere de dos cosas:
+
+- un pase hacia adelante con entradas ficticias.
+- instanciaciรณn del modelo con la indicador `torchscript`.
+
+Estas necesidades implican varias cosas con las que los desarrolladores deben tener cuidado. รstas se detallan a continuaciรณn.
+
+### Indicador de TorchScript y pesos atados
+
+Este indicador es necesario porque la mayorรญa de los modelos de lenguaje en este repositorio tienen pesos vinculados entre su capa
+de `Embedding` y su capa de `Decoding`. TorchScript no permite la exportaciรณn de modelos que tengan pesos atados, por lo que es
+necesario desvincular y clonar los pesos previamente.
+
+Esto implica que los modelos instanciados con el indicador `torchscript` tienen su capa `Embedding` y `Decoding` separadas,
+lo que significa que no deben entrenarse mรกs adelante. El entrenamiento desincronizarรญa las dos capas, lo que generarรญa
+resultados inesperados.
+
+Este no es el caso de los modelos que no tienen un cabezal de modelo de lenguaje, ya que no tienen pesos atados.
+Estos modelos se pueden exportar de forma segura sin el indicador `torchscript`.
+
+### Entradas ficticias y longitudes estรกndar
+
+Las entradas ficticias se utilizan para crear un modelo de pase hacia adelante. Mientras los valores de las entradas se
+propagan a travรฉs de las capas, PyTorch realiza un seguimiento de las diferentes operaciones ejecutadas en cada tensor.
+Estas operaciones registradas se utilizan luego para crear el "rastro" del modelo.
+
+El rastro se crea en relaciรณn con las dimensiones de las entradas. Por lo tanto, estรก limitado por las dimensiones de la
+entrada ficticia y no funcionarรก para ninguna otra longitud de secuencia o tamaรฑo de lote. Al intentar con un tamaรฑo diferente,
+un error como:
+
+`The expanded size of the tensor (3) must match the existing size (7) at non-singleton dimension 2`
+
+aparecerรก. Por lo tanto, se recomienda rastrear el modelo con un tamaรฑo de entrada ficticia al menos tan grande como la
+entrada mรกs grande que se alimentarรก al modelo durante la inferencia. El _padding_ se puede realizar para completar los
+valores que faltan. Sin embargo, como el modelo se habrรก rastreado con un tamaรฑo de entrada grande, las dimensiones de
+las diferentes matrices tambiรฉn serรกn grandes, lo que darรก como resultado mรกs cรกlculos.
+
+Se recomienda tener cuidado con el nรบmero total de operaciones realizadas en cada entrada y seguir de cerca el rendimiento
+al exportar modelos de longitud de secuencia variable.
+
+### Usar TorchScript en Python
+
+A continuaciรณn se muestra un ejemplo que muestra cรณmo guardar, cargar modelos y cรณmo usar el rastreo para la inferencia.
+
+#### Guardando un modelo
+
+Este fragmento muestra cรณmo usar TorchScript para exportar un `BertModel`. Aquรญ, el `BertModel` se instancia de acuerdo
+con la clase `BertConfig` y luego se guarda en el disco con el nombre de archivo `traced_bert.pt`
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+
+enc = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+
+# Tokenizing input text
+text = "[CLS] Who was Jim Henson ? [SEP] Jim Henson was a puppeteer [SEP]"
+tokenized_text = enc.tokenize(text)
+
+# Masking one of the input tokens
+masked_index = 8
+tokenized_text[masked_index] = "[MASK]"
+indexed_tokens = enc.convert_tokens_to_ids(tokenized_text)
+segments_ids = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
+
+# Creating a dummy input
+tokens_tensor = torch.tensor([indexed_tokens])
+segments_tensors = torch.tensor([segments_ids])
+dummy_input = [tokens_tensor, segments_tensors]
+
+# Initializing the model with the torchscript flag
+# Flag set to True even though it is not necessary as this model does not have an LM Head.
+config = BertConfig(
+ vocab_size_or_config_json_file=32000,
+ hidden_size=768,
+ num_hidden_layers=12,
+ num_attention_heads=12,
+ intermediate_size=3072,
+ torchscript=True,
+)
+
+# Instantiating the model
+model = BertModel(config)
+
+# The model needs to be in evaluation mode
+model.eval()
+
+# If you are instantiating the model with *from_pretrained* you can also easily set the TorchScript flag
+model = BertModel.from_pretrained("google-bert/bert-base-uncased", torchscript=True)
+
+# Creating the trace
+traced_model = torch.jit.trace(model, [tokens_tensor, segments_tensors])
+torch.jit.save(traced_model, "traced_bert.pt")
+```
+
+#### Cargar un modelo
+
+Este fragmento muestra cรณmo cargar el `BertModel` que se guardรณ previamente en el disco con el nombre `traced_bert.pt`.
+Estamos reutilizando el `dummy_input` previamente inicializado.
+
+```python
+loaded_model = torch.jit.load("traced_bert.pt")
+loaded_model.eval()
+
+all_encoder_layers, pooled_output = loaded_model(*dummy_input)
+```
+
+#### Usar un modelo rastreado para la inferencia
+
+Usar el modelo rastreado para la inferencia es tan simple como usar su mรฉtodo `__call__`:
+
+```python
+traced_model(tokens_tensor, segments_tensors)
+```
+
+### Implementar los modelos HuggingFace TorchScript en AWS mediante Neuron SDK
+
+AWS presentรณ la familia de instancias [Amazon EC2 Inf1](https://aws.amazon.com/ec2/instance-types/inf1/) para la inferencia
+de aprendizaje automรกtico de bajo costo y alto rendimiento en la nube. Las instancias Inf1 funcionan con el chip AWS
+Inferentia, un acelerador de hardware personalizado, que se especializa en cargas de trabajo de inferencia de aprendizaje
+profundo. [AWS Neuron](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/#) es el kit de desarrollo para Inferentia
+que admite el rastreo y la optimizaciรณn de modelos de transformers para su implementaciรณn en Inf1. El SDK de Neuron proporciona:
+
+
+1. API fรกcil de usar con una lรญnea de cambio de cรณdigo para rastrear y optimizar un modelo de TorchScript para la inferencia en la nube.
+2. Optimizaciones de rendimiento listas para usar con un [costo-rendimiento mejorado](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/benchmark/>)
+3. Soporte para modelos HuggingFace Transformers construidos con [PyTorch](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/bert_tutorial/tutorial_pretrained_bert.html)
+o [TensorFlow](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/tensorflow/huggingface_bert/huggingface_bert.html).
+
+#### Implicaciones
+
+Los modelos Transformers basados en la arquitectura
+[BERT (Representaciones de _Enconder_ bidireccional de Transformers)](https://huggingface.co/docs/transformers/main/model_doc/bert),
+o sus variantes, como [distilBERT](https://huggingface.co/docs/transformers/main/model_doc/distilbert) y
+[roBERTa](https://huggingface.co/docs/transformers/main/model_doc/roberta), se ejecutarรกn mejor en Inf1 para tareas no
+generativas, como la respuesta extractiva de preguntas, la clasificaciรณn de secuencias y la clasificaciรณn de tokens.
+Como alternativa, las tareas de generaciรณn de texto se pueden adaptar para ejecutarse en Inf1, segรบn este
+[tutorial de AWS Neuron MarianMT](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/transformers-marianmt.html).
+Puedes encontrar mรกs informaciรณn sobre los modelos que estรกn listos para usarse en Inferentia en la
+[secciรณn _Model Architecture Fit_ de la documentaciรณn de Neuron](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/models/models-inferentia.html#models-inferentia).
+
+#### Dependencias
+
+Usar AWS Neuron para convertir modelos requiere las siguientes dependencias y entornos:
+
+* Un [entorno Neuron SDK](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/neuron-frameworks/pytorch-neuron/index.html#installation-guide),
+que viene preconfigurado en [AWS Deep Learning AMI](https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-inferentia-launching.html).
+
+#### Convertir un modelo a AWS Neuron
+
+Con el mismo script usado en [Uso de TorchScript en Python](https://huggingface.co/docs/transformers/main/es/serialization#using-torchscript-in-python)
+para rastrear un "BertModel", puedes importar la extensiรณn del _framework_ `torch.neuron` para acceder a los componentes
+del SDK de Neuron a travรฉs de una API de Python.
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+import torch.neuron
+```
+Y modificando la lรญnea de cรณdigo de rastreo de:
+
+```python
+torch.jit.trace(model, [tokens_tensor, segments_tensors])
+```
+
+con lo siguiente:
+
+```python
+torch.neuron.trace(model, [token_tensor, segments_tensors])
+```
+
+Este cambio permite a Neuron SDK rastrear el modelo y optimizarlo para ejecutarse en instancias Inf1.
+
+Para obtener mรกs informaciรณn sobre las funciones, las herramientas, los tutoriales de ejemplo y las รบltimas actualizaciones
+de AWS Neuron SDK, consulte la [documentaciรณn de AWS NeuronSDK](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/index.html).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/task_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/task_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..639654c3697a2b85eabd5b3153efd841f5d69a61
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/task_summary.md
@@ -0,0 +1,340 @@
+
+
+# Lo que ๐ค Transformers puede hacer
+
+๐ค Transformers es una biblioteca de modelos preentrenados de รบltima generaciรณn para procesamiento del lenguaje natural (NLP, por sus siglas en inglรฉs), visiรณn por computadora y tareas de procesamiento de audio y voz. No solo contiene modelos Transformer, sino tambiรฉn modelos no Transformer como redes convolucionales modernas para tareas de visiรณn por computadora. Si observas algunos de los productos de consumo mรกs populares hoy en dรญa, como telรฉfonos inteligentes, aplicaciones y televisores, es probable que haya alguna tecnologรญa de aprendizaje profundo detrรกs. ยฟQuieres quitar un objeto de fondo de una foto tomada por tu telรฉfono inteligente? Este es un ejemplo de una tarea de segmentaciรณn panรณptica (no te preocupes si aรบn no sabes quรฉ significa, ยกlo describiremos en las siguientes secciones!).
+
+Esta pรกgina proporciona una descripciรณn general de las diferentes tareas de procesamiento de audio y voz, visiรณn por computadora y NLP que se pueden resolver con la biblioteca ๐ค Transformers en solo tres lรญneas de cรณdigo.
+
+## Audio
+
+Las tareas de procesamiento de audio y voz son un poco diferentes de las otras modalidades principalmente porque el audio como entrada es una seรฑal continua. A diferencia del texto, una forma de onda de audio cruda no se puede dividir ordenadamente en fragmentos discretos de la misma manera en que una oraciรณn puede dividirse en palabras. Para superar esto, la seรฑal de audio cruda generalmente se muestrea a intervalos regulares. Si tomas mรกs muestras dentro de un intervalo, la tasa de muestreo es mayor y el audio se asemeja mรกs a la fuente de audio original.
+
+Enfoques anteriores preprocesaban el audio para extraer caracterรญsticas รบtiles. Ahora es mรกs comรบn comenzar las tareas de procesamiento de audio y voz alimentando directamente la forma de onda de audio cruda a un codificador de caracterรญsticas para extraer una representaciรณn de audio. Esto simplifica el paso de preprocesamiento y permite que el modelo aprenda las caracterรญsticas mรกs esenciales.
+
+### Clasificaciรณn de audio
+
+La clasificaciรณn de audio es una tarea que etiqueta datos de audio con un conjunto predefinido de clases. Es una categorรญa amplia con muchas aplicaciones especรญficas, algunas de las cuales incluyen:
+
+* clasificaciรณn de escena acรบstica: etiquetar audio con una etiqueta de escena ("oficina", "playa", "estadio")
+* detecciรณn de eventos acรบsticos: etiquetar audio con una etiqueta de evento de sonido ("bocina de automรณvil", "llamada de ballena", "cristal rompiรฉndose")
+* etiquetado: etiquetar audio que contiene varios sonidos (canto de pรกjaros, identificaciรณn de altavoces en una reuniรณn)
+* clasificaciรณn de mรบsica: etiquetar mรบsica con una etiqueta de gรฉnero ("metal", "hip-hop", "country")
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="audio-classification", model="superb/hubert-base-superb-er")
+>>> preds = classifier("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4532, 'label': 'hap'},
+ {'score': 0.3622, 'label': 'sad'},
+ {'score': 0.0943, 'label': 'neu'},
+ {'score': 0.0903, 'label': 'ang'}]
+```
+
+### Reconocimiento automรกtico del habla
+
+El reconocimiento automรกtico del habla (ASR, por sus siglas en inglรฉs) transcribe el habla a texto. Es una de las tareas de audio mรกs comunes, en parte debido a que el habla es una forma natural de comunicaciรณn humana. Hoy en dรญa, los sistemas ASR estรกn integrados en productos de tecnologรญa "inteligente" como altavoces, telรฉfonos y automรณviles. Podemos pedirle a nuestros asistentes virtuales que reproduzcan mรบsica, establezcan recordatorios y nos informen sobre el clima.
+
+Pero uno de los desafรญos clave que las arquitecturas Transformer han ayudado a superar es en los idiomas con recursos limitados. Al preentrenar con grandes cantidades de datos de habla, afinar el modelo solo con una hora de datos de habla etiquetados en un idioma con recursos limitados aรบn puede producir resultados de alta calidad en comparaciรณn con los sistemas ASR anteriores entrenados con 100 veces mรกs datos etiquetados.
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition", model="openai/whisper-small")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+## Visiรณn por computadora
+
+Una de las primeras y exitosas tareas de visiรณn por computadora fue reconocer imรกgenes de nรบmeros de cรณdigo postal utilizando una [red neuronal convolucional](glossary#convolution) (CNN, por sus siglas en inglรฉs). Una imagen estรก compuesta por pรญxeles, y cada pรญxel tiene un valor numรฉrico. Esto facilita representar una imagen como una matriz de valores de pรญxeles. Cada combinaciรณn particular de valores de pรญxeles describe los colores de una imagen.
+
+Dos formas generales en las que se pueden resolver las tareas de visiรณn por computadora son:
+
+1. Utilizar convoluciones para aprender las caracterรญsticas jerรกrquicas de una imagen, desde caracterรญsticas de bajo nivel hasta cosas abstractas de alto nivel.
+2. Dividir una imagen en parches y utilizar un Transformer para aprender gradualmente cรณmo cada parche de imagen se relaciona entre sรญ para formar una imagen. A diferencia del enfoque ascendente preferido por una CNN, esto es como comenzar con una imagen borrosa y luego enfocarla gradualmente.
+
+### Clasificaciรณn de imรกgenes
+
+La clasificaciรณn de imรกgenes etiqueta una imagen completa con un conjunto predefinido de clases. Como la mayorรญa de las tareas de clasificaciรณn, hay muchos casos prรกcticos para la clasificaciรณn de imรกgenes, algunos de los cuales incluyen:
+
+* salud: etiquetar imรกgenes mรฉdicas para detectar enfermedades o monitorear la salud del paciente
+* medio ambiente: etiquetar imรกgenes de satรฉlite para monitorear la deforestaciรณn, informar la gestiรณn de รกreas silvestres o detectar incendios forestales
+* agricultura: etiquetar imรกgenes de cultivos para monitorear la salud de las plantas o imรกgenes de satรฉlite para el monitoreo del uso del suelo
+* ecologรญa: etiquetar imรกgenes de especies animales o vegetales para monitorear poblaciones de vida silvestre o rastrear especies en peligro de extinciรณn
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="image-classification")
+>>> preds = classifier(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.4335, 'label': 'lynx, catamount'}
+{'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}
+{'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}
+{'score': 0.0239, 'label': 'Egyptian cat'}
+{'score': 0.0229, 'label': 'tiger cat'}
+```
+
+### Detecciรณn de objetos
+
+A diferencia de la clasificaciรณn de imรกgenes, la detecciรณn de objetos identifica mรบltiples objetos dentro de una imagen y las posiciones de los objetos en la imagen (definidas por el cuadro delimitador). Algunas aplicaciones ejemplares de la detecciรณn de objetos incluyen:
+
+* vehรญculos autรณnomos: detectar objetos de trรกfico cotidianos como otros vehรญculos, peatones y semรกforos
+* teledetecciรณn: monitoreo de desastres, planificaciรณn urbana y pronรณstico del tiempo
+* detecciรณn de defectos: detectar grietas o daรฑos estructurales en edificios y defectos de fabricaciรณn
+
+```py
+>>> from transformers import pipeline
+
+>>> detector = pipeline(task="object-detection")
+>>> preds = detector(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"], "box": pred["box"]} for pred in preds]
+>>> preds
+[{'score': 0.9865,
+ 'label': 'cat',
+ 'box': {'xmin': 178, 'ymin': 154, 'xmax': 882, 'ymax': 598}}]
+```
+
+### Segmentaciรณn de imรกgenes
+
+La segmentaciรณn de imรกgenes es una tarea a nivel de pรญxeles que asigna cada pรญxel en una imagen a una clase. A diferencia de la detecciรณn de objetos, que utiliza cuadros delimitadores para etiquetar y predecir objetos en una imagen, la segmentaciรณn es mรกs granular. La segmentaciรณn puede detectar objetos a nivel de pรญxeles. Hay varios tipos de segmentaciรณn de imรกgenes:
+
+* segmentaciรณn de instancias: ademรกs de etiquetar la clase de un objeto, tambiรฉn etiqueta cada instancia distinta de un objeto ("perro-1", "perro-2")
+* segmentaciรณn panรณptica: una combinaciรณn de segmentaciรณn semรกntica y de instancias; etiqueta cada pรญxel con una clase semรกntica **y** cada instancia distinta de un objeto
+
+Las tareas de segmentaciรณn son รบtiles en vehรญculos autรณnomos para crear un mapa a nivel de pรญxeles del mundo que los rodea para que puedan navegar de manera segura alrededor de peatones y otros vehรญculos. Tambiรฉn es รบtil en imรกgenes mรฉdicas, donde la mayor granularidad de la tarea puede ayudar a identificar cรฉlulas anormales o caracterรญsticas de รณrganos. La segmentaciรณn de imรกgenes tambiรฉn se puede utilizar en comercio electrรณnico para probar virtualmente la ropa o crear experiencias de realidad aumentada superponiendo objetos en el mundo real a travรฉs de tu cรกmara.
+
+```py
+>>> from transformers import pipeline
+
+>>> segmenter = pipeline(task="image-segmentation")
+>>> preds = segmenter(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.9879, 'label': 'LABEL_184'}
+{'score': 0.9973, 'label': 'snow'}
+{'score': 0.9972, 'label': 'cat'}
+```
+
+### Estimaciรณn de profundidad
+
+La estimaciรณn de profundidad predice la distancia de cada pรญxel en una imagen desde la cรกmara. Esta tarea de visiรณn por computadora es especialmente importante para la comprensiรณn y reconstrucciรณn de escenas. Por ejemplo, en los vehรญculos autรณnomos, es necesario entender quรฉ tan lejos estรกn los objetos como peatones, seรฑales de trรกfico y otros vehรญculos para evitar obstรกculos y colisiones. La informaciรณn de profundidad tambiรฉn es รบtil para construir representaciones 3D a partir de imรกgenes 2D y se puede utilizar para crear representaciones 3D de alta calidad de estructuras biolรณgicas o edificios.
+
+Hay dos enfoques para la estimaciรณn de profundidad:
+
+* estรฉreo: las profundidades se estiman comparando dos imรกgenes de la misma escena desde รกngulos ligeramente diferentes
+* monocular: las profundidades se estiman a partir de una sola imagen
+
+```py
+>>> from transformers import pipeline
+
+>>> depth_estimator = pipeline(task="depth-estimation")
+>>> preds = depth_estimator(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+```
+
+## Procesamiento del lenguaje natural
+
+Las tareas de procesamiento del lenguaje natural (NLP, por sus siglas en inglรฉs) estรกn entre los tipos de tareas mรกs comunes porque el texto es una forma natural de comunicaciรณn para nosotros. Para convertir el texto en un formato reconocido por un modelo, es necesario tokenizarlo. Esto significa dividir una secuencia de texto en palabras o subpalabras separadas (tokens) y luego convertir estos tokens en nรบmeros. Como resultado, puedes representar una secuencia de texto como una secuencia de nรบmeros, y una vez que tienes una secuencia de nรบmeros, se puede ingresar a un modelo para resolver todo tipo de tareas de NLP.
+
+### Clasificaciรณn de texto
+
+Al igual que las tareas de clasificaciรณn en cualquier modalidad, la clasificaciรณn de texto etiqueta una secuencia de texto (puede ser a nivel de oraciรณn, pรกrrafo o documento) de un conjunto predefinido de clases. Hay muchas aplicaciones prรกcticas para la clasificaciรณn de texto, algunas de las cuales incluyen:
+
+* anรกlisis de sentimientos: etiquetar texto segรบn alguna polaridad como `positivo` o `negativo`, lo que puede informar y respaldar la toma de decisiones en campos como polรญtica, finanzas y marketing
+* clasificaciรณn de contenido: etiquetar texto segรบn algรบn tema para ayudar a organizar y filtrar informaciรณn en noticias y feeds de redes sociales (`clima`, `deportes`, `finanzas`, etc.)
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="sentiment-analysis")
+>>> preds = classifier("Hugging Face is the best thing since sliced bread!")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.9991, 'label': 'POSITIVE'}]
+```
+
+### Clasificaciรณn de tokens
+
+En cualquier tarea de NLP, el texto se procesa separando la secuencia de texto en palabras o subpalabras individuales. Estas se conocen como [tokens](glossary#token). La clasificaciรณn de tokens asigna a cada token una etiqueta de un conjunto predefinido de clases.
+
+Dos tipos comunes de clasificaciรณn de tokens son:
+
+* reconocimiento de entidades nombradas (NER, por sus siglas en inglรฉs): etiquetar un token segรบn una categorรญa de entidad como organizaciรณn, persona, ubicaciรณn o fecha. NER es especialmente popular en entornos biomรฉdicos, donde puede etiquetar genes, proteรญnas y nombres de medicamentos
+* etiquetado de partes del discurso (POS, por sus siglas en inglรฉs): etiquetar un token segรบn su parte del discurso, como sustantivo, verbo o adjetivo. POS es รบtil para ayudar a los sistemas de traducciรณn a comprender cรณmo dos palabras idรฉnticas son gramaticalmente diferentes (por ejemplo, "corte" como sustantivo versus "corte" como verbo)
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="ner")
+>>> preds = classifier("Hugging Face is a French company based in New York City.")
+>>> preds = [
+... {
+... "entity": pred["entity"],
+... "score": round(pred["score"], 4),
+... "index": pred["index"],
+... "word": pred["word"],
+... "start": pred["start"],
+... "end": pred["end"],
+... }
+... for pred in preds
+... ]
+>>> print(*preds, sep="\n")
+{'entity': 'I-ORG', 'score': 0.9968, 'index': 1, 'word': 'Hu', 'start': 0, 'end': 2}
+{'entity': 'I-ORG', 'score': 0.9293, 'index': 2, 'word': '##gging', 'start': 2, 'end': 7}
+{'entity': 'I-ORG', 'score': 0.9763, 'index': 3, 'word': 'Face', 'start': 8, 'end': 12}
+{'entity': 'I-MISC', 'score': 0.9983, 'index': 6, 'word': 'French', 'start': 18, 'end': 24}
+{'entity': 'I-LOC', 'score': 0.999, 'index': 10, 'word': 'New', 'start': 42, 'end': 45}
+{'entity': 'I-LOC', 'score': 0.9987, 'index': 11, 'word': 'York', 'start': 46, 'end': 50}
+{'entity': 'I-LOC', 'score': 0.9992, 'index': 12, 'word': 'City', 'start': 51, 'end': 55}
+```
+
+### Respuestas a preguntas
+
+Responder preguntas es otra tarea a nivel de tokens que devuelve una respuesta a una pregunta, a veces con contexto (dominio abierto) y otras veces sin contexto (dominio cerrado). Esta tarea ocurre cuando le preguntamos algo a un asistente virtual, como si un restaurante estรก abierto. Tambiรฉn puede proporcionar soporte al cliente o tรฉcnico y ayudar a los motores de bรบsqueda a recuperar la informaciรณn relevante que estรกs buscando.
+
+Hay dos tipos comunes de respuestas a preguntas:
+
+* extractivas: dada una pregunta y algรบn contexto, la respuesta es un fragmento de texto del contexto que el modelo debe extraer
+* abstractivas: dada una pregunta y algรบn contexto, la respuesta se genera a partir del contexto; este enfoque lo maneja la [`Text2TextGenerationPipeline`] en lugar del [`QuestionAnsweringPipeline`] que se muestra a continuaciรณn
+
+```py
+>>> from transformers import pipeline
+
+>>> question_answerer = pipeline(task="question-answering")
+>>> preds = question_answerer(
+... question="What is the name of the repository?",
+... context="The name of the repository is huggingface/transformers",
+... )
+>>> print(
+... f"score: {round(preds['score'], 4)}, start: {preds['start']}, end: {preds['end']}, answer: {preds['answer']}"
+... )
+score: 0.9327, start: 30, end: 54, answer: huggingface/transformers
+```
+
+### Resumir
+
+Al resumir se crea una versiรณn mรกs corta de un texto mรกs largo mientras intenta preservar la mayor parte del significado del documento original. Resumir es una tarea de secuencia a secuencia; produce una secuencia de texto mรกs corta que la entrada. Hay muchos documentos de formato largo que se pueden resumir para ayudar a los lectores a comprender rรกpidamente los puntos principales. Proyectos de ley legislativos, documentos legales y financieros, patentes y artรญculos cientรญficos son algunos ejemplos de documentos que podrรญan resumirse para ahorrar tiempo a los lectores y servir como ayuda para la lectura.
+
+Al igual que en las respuestas a preguntas, hay dos tipos de resumen:
+
+* extractiva: identifica y extrae las oraciones mรกs importantes del texto original
+* abstractiva: genera el resumen objetivo (que puede incluir nuevas palabras no presentes en el documento de entrada) a partir del texto original; el [`SummarizationPipeline`] utiliza el enfoque abstractivo
+
+```py
+>>> from transformers import pipeline
+
+>>> summarizer = pipeline(task="summarization")
+>>> summarizer(
+... "In this work, we presented the Transformer, the first sequence transduction model based entirely on attention, replacing the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention. For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers. On both WMT 2014 English-to-German and WMT 2014 English-to-French translation tasks, we achieve a new state of the art. In the former task our best model outperforms even all previously reported ensembles."
+... )
+[{'summary_text': ' The Transformer is the first sequence transduction model based entirely on attention . It replaces the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention . For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers .'}]
+```
+
+### Traducciรณn
+
+La traducciรณn convierte una secuencia de texto en un idioma a otro. Es importante para ayudar a personas de diferentes orรญgenes a comunicarse entre sรญ, traducir contenido para llegar a audiencias mรกs amplias e incluso ser una herramienta de aprendizaje para ayudar a las personas a aprender un nuevo idioma. Al igual que resumir, la traducciรณn es una tarea de secuencia a secuencia, lo que significa que el modelo recibe una secuencia de entrada y devuelve una secuencia de salida objetivo.
+
+En sus primeros dรญas, los modelos de traducciรณn eran principalmente monolingรผes, pero recientemente ha habido un creciente interรฉs en modelos multilingรผes que pueden traducir entre muchas combinaciones de idiomas.
+
+```py
+>>> from transformers import pipeline
+
+>>> text = "translate English to French: Hugging Face is a community-based open-source platform for machine learning."
+>>> translator = pipeline(task="translation", model="t5-small")
+>>> translator(text)
+[{'translation_text': "Hugging Face est une tribune communautaire de l'apprentissage des machines."}]
+```
+
+### Modelado de lenguaje
+
+El modelado de lenguaje es una tarea que predice una palabra en una secuencia de texto. Se ha vuelto una tarea de NLP muy popular porque un modelo de lenguaje preentrenado puede ser afinado para muchas otras tareas secundarias. รltimamente, ha habido mucho interรฉs en modelos de lenguaje grandes (LLM, por sus siglas en inglรฉs) que demuestran aprendizaje de cero o con pocas muestras (zero- or few-shot learning). ยกEsto significa que el modelo puede resolver tareas para las cuales no fue entrenado explรญcitamente! Los modelos de lenguaje se pueden utilizar para generar texto fluido y convincente, aunque debes tener cuidado, ya que el texto no siempre puede ser preciso.
+
+Hay dos tipos de modelado de lenguaje:
+
+* causal: el objetivo del modelo es predecir el prรณximo token en una secuencia, y los tokens futuros estรกn enmascarados
+
+ ```py
+ >>> from transformers import pipeline
+
+ >>> prompt = "Hugging Face is a community-based open-source platform for machine learning."
+ >>> generator = pipeline(task="text-generation")
+ >>> generator(prompt) # doctest: +SKIP
+ ```
+
+* enmascarado: el objetivo del modelo es predecir un token enmascarado en una secuencia con acceso completo a los tokens en la secuencia
+
+ ```py
+ >>> text = "Hugging Face is a community-based open-source for machine learning."
+ >>> fill_mask = pipeline(task="fill-mask")
+ >>> preds = fill_mask(text, top_k=1)
+ >>> preds = [
+ ... {
+ ... "score": round(pred["score"], 4),
+ ... "token": pred["token"],
+ ... "token_str": pred["token_str"],
+ ... "sequence": pred["sequence"],
+ ... }
+ ... for pred in preds
+ ... ]
+ >>> preds
+ [{'score': 0.2236,
+ 'token': 1761,
+ 'token_str': ' platform',
+ 'sequence': 'Hugging Face is a community-based open-source platform for machine learning.'}]
+ ```
+
+## Multimodal
+
+Las tareas multimodales requieren que un modelo procese mรบltiples modalidades de datos (texto, imagen, audio, video) para resolver un problema particular. La descripciรณn de imรกgenes es un ejemplo de una tarea multimodal en la que el modelo toma una imagen como entrada y produce una secuencia de texto que describe la imagen o algunas propiedades de la imagen.
+
+Aunque los modelos multimodales trabajan con diferentes tipos de datos o modalidades, internamente, los pasos de preprocesamiento ayudan al modelo a convertir todos los tipos de datos en embeddings (vectores o listas de nรบmeros que contienen informaciรณn significativa sobre los datos). Para una tarea como la descripciรณn de imรกgenes, el modelo aprende las relaciones entre los embeddings de imรกgenes y los embeddings de texto.
+
+### Respuestas a preguntas de documentos
+
+Las respuestas a preguntas de documentos es una tarea que responde preguntas en lenguaje natural a partir de un documento. A diferencia de una tarea de respuestas a preguntas a nivel de token que toma texto como entrada, las respuestas a preguntas de documentos toman una imagen de un documento como entrada junto con una pregunta sobre el documento y devuelven una respuesta. Las respuestas a preguntas de documentos pueden usarse para analizar documentos estructurados y extraer informaciรณn clave de ellos. En el ejemplo a continuaciรณn, el monto total y el cambio debido se pueden extraer de un recibo.
+
+```py
+>>> from transformers import pipeline
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://huggingface.co/datasets/hf-internal-testing/example-documents/resolve/main/jpeg_images/2.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> doc_question_answerer = pipeline("document-question-answering", model="magorshunov/layoutlm-invoices")
+>>> preds = doc_question_answerer(
+... question="What is the total amount?",
+... image=image,
+... )
+>>> preds
+[{'score': 0.8531, 'answer': '17,000', 'start': 4, 'end': 4}]
+```
+
+Con suerte, esta pรกgina te ha proporcionado mรกs informaciรณn de fondo sobre todos los tipos de tareas en cada modalidad y la importancia prรกctica de cada una. En la prรณxima [secciรณn](tasks_explained), aprenderรกs **cรณmo** ๐ค Transformers trabaja para resolver estas tareas.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/asr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/asr.md
new file mode 100644
index 0000000000000000000000000000000000000000..41e9f82e35f7f1932e729b8224f1d89fbb5f4d72
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/asr.md
@@ -0,0 +1,366 @@
+
+
+# Reconocimiento automรกtico del habla
+
+
+
+El reconocimiento automรกtico del habla (ASR, por sus siglas en inglรฉs) convierte una seรฑal de habla en texto y mapea una secuencia de entradas de audio en salidas en forma de texto. Los asistentes virtuales como Siri y Alexa usan modelos de ASR para ayudar a sus usuarios todos los dรญas. De igual forma, hay muchas otras aplicaciones, como la transcripciรณn de contenidos en vivo y la toma automรกtica de notas durante reuniones.
+
+En esta guรญa te mostraremos como:
+
+1. Hacer fine-tuning al modelo [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base) con el dataset [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) para transcribir audio a texto.
+2. Usar tu modelo ajustado para tareas de inferencia.
+
+
+
+Revisa la [pรกgina de la tarea](https://huggingface.co/tasks/automatic-speech-recognition) de reconocimiento automรกtico del habla para acceder a mรกs informaciรณn sobre los modelos, datasets y mรฉtricas asociados.
+
+
+
+Antes de comenzar, asegรบrate de haber instalado todas las librerรญas necesarias:
+
+```bash
+pip install transformers datasets evaluate jiwer
+```
+
+Te aconsejamos iniciar sesiรณn con tu cuenta de Hugging Face para que puedas subir tu modelo y comartirlo con la comunidad. Cuando te sea solicitado, ingresa tu token para iniciar sesiรณn:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Cargar el dataset MInDS-14
+
+Comencemos cargando un subconjunto mรกs pequeรฑo del dataset [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) desde la biblioteca ๐ค Datasets. De esta forma, tendrรกs la oportunidad de experimentar y asegurarte de que todo funcione antes de invertir mรกs tiempo entrenando con el dataset entero.
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> minds = load_dataset("PolyAI/minds14", name="en-US", split="train[:100]")
+```
+Divide la particiรณn `train` (entrenamiento) en una particiรณn de entrenamiento y una de prueba usando el mรฉtodo [`~Dataset.train_test_split`]:
+
+```py
+>>> minds = minds.train_test_split(test_size=0.2)
+```
+
+Ahora รฉchale un vistazo al dataset:
+
+```py
+>>> minds
+DatasetDict({
+ train: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 16
+ })
+ test: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 4
+ })
+})
+```
+
+Aunque el dataset contiene mucha informaciรณn รบtil, como los campos `lang_id` (identificador del lenguaje) y `english_transcription` (transcripciรณn al inglรฉs), en esta guรญa nos enfocaremos en los campos `audio` y `transcription`. Puedes quitar las otras columnas con el mรฉtodo [`~datasets.Dataset.remove_columns`]:
+
+```py
+>>> minds = minds.remove_columns(["english_transcription", "intent_class", "lang_id"])
+```
+
+Vuelve a echarle un vistazo al ejemplo:
+
+```py
+>>> minds["train"][0]
+{'audio': {'array': array([-0.00024414, 0. , 0. , ..., 0.00024414,
+ 0.00024414, 0.00024414], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'sampling_rate': 8000},
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'transcription': "hi I'm trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing"}
+```
+
+Hay dos campos:
+
+- `audio`: un `array` (arreglo) unidimensional de la seรฑal de habla que debe ser invocado para cargar y re-muestrear el archivo de audio.
+- `transcription`: el texto objetivo.
+
+## Preprocesamiento
+
+El siguiente paso es cargar un procesador Wav2Vec2 para procesar la seรฑal de audio:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base")
+```
+El dataset MInDS-14 tiene una tasa de muestreo de 8000kHz (puedes encontrar esta informaciรณn en su [tarjeta de dataset](https://huggingface.co/datasets/PolyAI/minds14)), lo que significa que tendrรกs que re-muestrear el dataset a 16000kHz para poder usar el modelo Wav2Vec2 pre-entrenado:
+
+```py
+>>> minds = minds.cast_column("audio", Audio(sampling_rate=16_000))
+>>> minds["train"][0]
+{'audio': {'array': array([-2.38064706e-04, -1.58618059e-04, -5.43987835e-06, ...,
+ 2.78103951e-04, 2.38446111e-04, 1.18740834e-04], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'sampling_rate': 16000},
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'transcription': "hi I'm trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing"}
+```
+
+Como puedes ver en el campo `transcription`, el texto contiene una mezcla de carรกcteres en mayรบsculas y en minรบsculas. El tokenizer Wav2Vec2 fue entrenado รบnicamente con carรกcteres en mayรบsculas, asรญ que tendrรกs que asegurarte de que el texto se ajuste al vocabulario del tokenizer:
+
+```py
+>>> def uppercase(example):
+... return {"transcription": example["transcription"].upper()}
+
+
+>>> minds = minds.map(uppercase)
+```
+
+Ahora vamos a crear una funciรณn de preprocesamiento que:
+
+1. Invoque la columna `audio` para cargar y re-muestrear el archivo de audio.
+2. Extraiga el campo `input_values` (valores de entrada) del archivo de audio y haga la tokenizaciรณn de la columna `transcription` con el procesador.
+
+```py
+>>> def prepare_dataset(batch):
+... audio = batch["audio"]
+... batch = processor(audio["array"], sampling_rate=audio["sampling_rate"], text=batch["transcription"])
+... batch["input_length"] = len(batch["input_values"][0])
+... return batch
+```
+
+Para aplicar la funciรณn de preprocesamiento a todo el dataset, puedes usar la funciรณn [`~datasets.Dataset.map`] de ๐ค Datasets. Para acelerar la funciรณn `map` puedes incrementar el nรบmero de procesos con el parรกmetro `num_proc`. Quita las columnas que no necesites con el mรฉtodo [`~datasets.Dataset.remove_columns`]:
+
+```py
+>>> encoded_minds = minds.map(prepare_dataset, remove_columns=minds.column_names["train"], num_proc=4)
+```
+
+๐ค Transformers no tiene un collator de datos para la tarea de ASR, asรญ que tendrรกs que adaptar el [`DataCollatorWithPadding`] para crear un lote de ejemplos. El collator tambiรฉn le aplicarรก padding dinรกmico a tu texto y etiquetas para que tengan la longitud del elemento mรกs largo en su lote (en vez de la mayor longitud en el dataset entero), de forma que todas las muestras tengan una longitud uniforme. Aunque es posible hacerle padding a tu texto con el `tokenizer` haciendo `padding=True`, el padding dinรกmico es mรกs eficiente.
+
+A diferencia de otros collators de datos, este tiene que aplicarle un mรฉtodo de padding distinto a los campos `input_values` (valores de entrada) y `labels` (etiquetas):
+
+```py
+>>> import torch
+
+>>> from dataclasses import dataclass, field
+>>> from typing import Any, Dict, List, Optional, Union
+
+
+>>> @dataclass
+... class DataCollatorCTCWithPadding:
+... processor: AutoProcessor
+... padding: Union[bool, str] = "longest"
+
+... def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:
+... # particiona las entradas y las etiquetas ya que tienen que tener longitudes distintas y
+... # requieren mรฉtodos de padding diferentes
+... input_features = [{"input_values": feature["input_values"][0]} for feature in features]
+... label_features = [{"input_ids": feature["labels"]} for feature in features]
+
+... batch = self.processor.pad(input_features, padding=self.padding, return_tensors="pt")
+
+... labels_batch = self.processor.pad(labels=label_features, padding=self.padding, return_tensors="pt")
+
+... # remplaza el padding con -100 para ignorar la pรฉrdida de forma correcta
+... labels = labels_batch["input_ids"].masked_fill(labels_batch.attention_mask.ne(1), -100)
+
+... batch["labels"] = labels
+
+... return batch
+```
+
+Ahora puedes instanciar tu `DataCollatorForCTCWithPadding`:
+
+```py
+>>> data_collator = DataCollatorCTCWithPadding(processor=processor, padding="longest")
+```
+
+## Evaluaciรณn
+
+A menudo es รบtil incluir una mรฉtrica durante el entrenamiento para evaluar el rendimiento de tu modelo. Puedes cargar un mรฉtodo de evaluaciรณn rรกpidamente con la biblioteca ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index). Para esta tarea, puedes usar la mรฉtrica de [tasa de error por palabra](https://huggingface.co/spaces/evaluate-metric/wer) (WER, por sus siglas en inglรฉs). Puedes ver la [guรญa rรกpida](https://huggingface.co/docs/evaluate/a_quick_tour) de ๐ค Evaluate para aprender mรกs acerca de cรณmo cargar y computar una mรฉtrica.
+
+```py
+>>> import evaluate
+
+>>> wer = evaluate.load("wer")
+```
+
+Ahora crea una funciรณn que le pase tus predicciones y etiquetas a [`~evaluate.EvaluationModule.compute`] para calcular la WER:
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(pred):
+... pred_logits = pred.predictions
+... pred_ids = np.argmax(pred_logits, axis=-1)
+
+... pred.label_ids[pred.label_ids == -100] = processor.tokenizer.pad_token_id
+
+... pred_str = processor.batch_decode(pred_ids)
+... label_str = processor.batch_decode(pred.label_ids, group_tokens=False)
+
+... wer = wer.compute(predictions=pred_str, references=label_str)
+
+... return {"wer": wer}
+```
+
+Ahora tu funciรณn `compute_metrics` (computar mรฉtricas) estรก lista y podrรกs usarla cuando estรฉs preparando tu entrenamiento.
+
+## Entrenamiento
+
+
+
+
+
+Si no tienes experiencia haciรฉndole fine-tuning a un modelo con el [`Trainer`], ยกรฉchale un vistazo al tutorial bรกsico [aquรญ](../training#train-with-pytorch-trainer)!
+
+
+
+ยกYa puedes empezar a entrenar tu modelo! Para ello, carga Wav2Vec2 con [`AutoModelForCTC`]. Especifica la reducciรณn que quieres aplicar con el parรกmetro `ctc_loss_reduction`. A menudo, es mejor usar el promedio en lugar de la sumatoria que se hace por defecto.
+
+```py
+>>> from transformers import AutoModelForCTC, TrainingArguments, Trainer
+
+>>> model = AutoModelForCTC.from_pretrained(
+... "facebook/wav2vec2-base",
+... ctc_loss_reduction="mean",
+... pad_token_id=processor.tokenizer.pad_token_id,
+... )
+```
+En este punto, solo quedan tres pasos:
+
+1. Define tus hiperparรกmetros de entrenamiento en [`TrainingArguments`]. El รบnico parรกmetro obligatorio es `output_dir` (carpeta de salida), el cual especifica dรณnde guardar tu modelo. Puedes subir este modelo al Hub haciendo `push_to_hub=True` (debes haber iniciado sesiรณn en Hugging Face para subir tu modelo). Al final de cada รฉpoca, el [`Trainer`] evaluarรก la WER y guardarรก el punto de control del entrenamiento.
+2. Pรกsale los argumentos del entrenamiento al [`Trainer`] junto con el modelo, el dataset, el tokenizer, el collator de datos y la funciรณn `compute_metrics`.
+3. Llama el mรฉtodo [`~Trainer.train`] para hacerle fine-tuning a tu modelo.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_asr_mind_model",
+... per_device_train_batch_size=8,
+... gradient_accumulation_steps=2,
+... learning_rate=1e-5,
+... warmup_steps=500,
+... max_steps=2000,
+... gradient_checkpointing=True,
+... fp16=True,
+... group_by_length=True,
+... eval_strategy="steps",
+... per_device_eval_batch_size=8,
+... save_steps=1000,
+... eval_steps=1000,
+... logging_steps=25,
+... load_best_model_at_end=True,
+... metric_for_best_model="wer",
+... greater_is_better=False,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=encoded_minds["train"],
+... eval_dataset=encoded_minds["test"],
+... processing_class=processor.feature_extractor,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+Una vez que el entrenamiento haya sido completado, comparte tu modelo en el Hub con el mรฉtodo [`~transformers.Trainer.push_to_hub`] para que todo el mundo pueda usar tu modelo:
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+Para ver un ejemplo mรกs detallado de cรณmo hacerle fine-tuning a un modelo para reconocimiento automรกtico del habla, รฉchale un vistazo a esta [entrada de blog](https://huggingface.co/blog/fine-tune-wav2vec2-english) para ASR en inglรฉs y a esta [entrada](https://huggingface.co/blog/fine-tune-xlsr-wav2vec2) para ASR multilingรผe.
+
+
+
+## Inferencia
+
+ยกGenial, ahora que le has hecho fine-tuning a un modelo, puedes usarlo para inferencia!
+
+Carga el archivo de audio sobre el cual quieras correr la inferencia. ยกRecuerda re-muestrar la tasa de muestreo del archivo de audio para que sea la misma del modelo si es necesario!
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", "en-US", split="train")
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
+>>> sampling_rate = dataset.features["audio"].sampling_rate
+>>> audio_file = dataset[0]["audio"]["path"]
+```
+
+La manera mรกs simple de probar tu modelo para hacer inferencia es usarlo en un [`pipeline`]. Puedes instanciar un `pipeline` para reconocimiento automรกtico del habla con tu modelo y pasarle tu archivo de audio:
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline("automatic-speech-recognition", model="stevhliu/my_awesome_asr_minds_model")
+>>> transcriber(audio_file)
+{'text': 'I WOUD LIKE O SET UP JOINT ACOUNT WTH Y PARTNER'}
+```
+
+
+
+La transcripciรณn es decente, pero podrรญa ser mejor. ยกIntenta hacerle fine-tuning a tu modelo con mรกs ejemplos para obtener resultados aรบn mejores!
+
+
+
+Tambiรฉn puedes replicar de forma manual los resultados del `pipeline` si lo deseas:
+
+
+
+Carga un procesador para preprocesar el archivo de audio y la transcripciรณn y devuelve el `input` como un tensor de PyTorch:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("stevhliu/my_awesome_asr_mind_model")
+>>> inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
+```
+
+Pรกsale tus entradas al modelo y devuelve los logits:
+
+```py
+>>> from transformers import AutoModelForCTC
+
+>>> model = AutoModelForCTC.from_pretrained("stevhliu/my_awesome_asr_mind_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+Obtรฉn los identificadores de los tokens con mayor probabilidad en las predicciones y usa el procesador para decodificarlos y transformarlos en texto:
+
+```py
+>>> import torch
+
+>>> predicted_ids = torch.argmax(logits, dim=-1)
+>>> transcription = processor.batch_decode(predicted_ids)
+>>> transcription
+['I WOUL LIKE O SET UP JOINT ACOUNT WTH Y PARTNER']
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/image_captioning.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/image_captioning.md
new file mode 100644
index 0000000000000000000000000000000000000000..620dcec1bfbd1c719f6e3f0929015a60aa240fa4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/image_captioning.md
@@ -0,0 +1,266 @@
+
+
+# Subtรญtulos de Imรกgenes
+
+[[open-in-colab]]
+
+Los subtรญtulos de imรกgenes es la tarea de predecir un subtรญtulo para una imagen dada. Las aplicaciones comunes en el mundo real incluyen
+ayudar a personas con discapacidad visual que les puede ayudar a navegar a travรฉs de diferentes situaciones. Por lo tanto, los subtรญtulos de imรกgenes
+ayuda a mejorar la accesibilidad del contenido para las personas describiรฉndoles imรกgenes.
+
+Esta guรญa te mostrarรก cรณmo:
+
+* Ajustar un modelo de subtรญtulos de imรกgenes.
+* Usar el modelo ajustado para inferencia.
+
+Antes de comenzar, asegรบrate de tener todas las bibliotecas necesarias instaladas:
+
+```bash
+pip install transformers datasets evaluate -q
+pip install jiwer -q
+```
+
+Te animamos a que inicies sesiรณn en tu cuenta de Hugging Face para que puedas subir y compartir tu modelo con la comunidad. Cuando se te solicite, ingresa tu token para iniciar sesiรณn:
+
+```python
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+## Cargar el conjunto de datos de subtรญtulos BLIP de Pokรฉmon
+
+Utiliza la biblioteca ๐ค Dataset para cargar un conjunto de datos que consiste en pares {image-caption}. Para crear tu propio conjunto de datos de subtรญtulos de imรกgenes
+en PyTorch, puedes seguir [este cuaderno](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/GIT/Fine_tune_GIT_on_an_image_captioning_dataset.ipynb).
+
+```python
+from datasets import load_dataset
+
+ds = load_dataset("lambdalabs/pokemon-blip-captions")
+ds
+```
+```bash
+DatasetDict({
+ train: Dataset({
+ features: ['image', 'text'],
+ num_rows: 833
+ })
+})
+```
+
+El conjunto de datos tiene dos caracterรญsticas, `image` y `text`.
+
+
+
+Muchos conjuntos de datos de subtรญtulos de imรกgenes contienen mรบltiples subtรญtulos por imagen. En esos casos, una estrategia comรบn es muestrear aleatoriamente un subtรญtulo entre los disponibles durante el entrenamiento.
+
+
+
+Divide el conjunto de entrenamiento del conjunto de datos en un conjunto de entrenamiento y de prueba con el mรฉtodo [`~datasets.Dataset.train_test_split`]:
+
+```python
+ds = ds["train"].train_test_split(test_size=0.1)
+train_ds = ds["train"]
+test_ds = ds["test"]
+```
+
+Vamos a visualizar un par de muestras del conjunto de entrenamiento.
+
+```python
+from textwrap import wrap
+import matplotlib.pyplot as plt
+import numpy as np
+
+
+def plot_images(images, captions):
+ plt.figure(figsize=(20, 20))
+ for i in range(len(images)):
+ ax = plt.subplot(1, len(images), i + 1)
+ caption = captions[i]
+ caption = "\n".join(wrap(caption, 12))
+ plt.title(caption)
+ plt.imshow(images[i])
+ plt.axis("off")
+
+
+sample_images_to_visualize = [np.array(train_ds[i]["image"]) for i in range(5)]
+sample_captions = [train_ds[i]["text"] for i in range(5)]
+plot_images(sample_images_to_visualize, sample_captions)
+```
+
+
+
+
+
+## Preprocesar el conjunto de datos
+
+Dado que el conjunto de datos tiene dos modalidades (imagen y texto), el proceso de preprocesamiento preprocesarรก las imรกgenes y los subtรญtulos.
+
+Para hacerlo, carga la clase de procesador asociada con el modelo que estรกs a punto de ajustar.
+
+```python
+from transformers import AutoProcessor
+
+checkpoint = "microsoft/git-base"
+processor = AutoProcessor.from_pretrained(checkpoint)
+```
+
+El procesador preprocesarรก internamente la imagen (lo que incluye el cambio de tamaรฑo y la escala de pรญxeles) y tokenizarรก el subtรญtulo.
+
+```python
+def transforms(example_batch):
+ images = [x for x in example_batch["image"]]
+ captions = [x for x in example_batch["text"]]
+ inputs = processor(images=images, text=captions, padding="max_length")
+ inputs.update({"labels": inputs["input_ids"]})
+ return inputs
+
+
+train_ds.set_transform(transforms)
+test_ds.set_transform(transforms)
+```
+
+Con el conjunto de datos listo, ahora puedes configurar el modelo para el ajuste fino.
+
+## Cargar un modelo base
+
+Carga ["microsoft/git-base"](https://huggingface.co/microsoft/git-base) en un objeto [`AutoModelForCausalLM`](https://huggingface.co/docs/transformers/model_doc/auto#transformers.AutoModelForCausalLM).
+
+```python
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained(checkpoint)
+```
+
+## Evaluar
+
+Los modelos de subtรญtulos de imรกgenes se evalรบan tรญpicamente con el [Rouge Score](https://huggingface.co/spaces/evaluate-metric/rouge) o Tasa de Error de Palabra ([Word Error Rate](https://huggingface.co/spaces/evaluate-metric/wer), por sus siglas en inglรฉs). Para esta guรญa, utilizarรกs la Tasa de Error de Palabra (WER).
+
+Usamos la biblioteca ๐ค Evaluate para hacerlo. Para conocer las limitaciones potenciales y otros problemas del WER, consulta [esta guรญa](https://huggingface.co/spaces/evaluate-metric/wer).
+
+```python
+from evaluate import load
+import torch
+
+wer = load("wer")
+
+
+def compute_metrics(eval_pred):
+ logits, labels = eval_pred
+ predicted = logits.argmax(-1)
+ decoded_labels = processor.batch_decode(labels, skip_special_tokens=True)
+ decoded_predictions = processor.batch_decode(predicted, skip_special_tokens=True)
+ wer_score = wer.compute(predictions=decoded_predictions, references=decoded_labels)
+ return {"wer_score": wer_score}
+```
+
+## ยกEntrenar!
+
+Ahora, estรกs listo para comenzar a ajustar el modelo. Utilizarรกs el ๐ค [`Trainer`] para esto.
+
+Primero, define los argumentos de entrenamiento usando [`TrainingArguments`].
+
+```python
+from transformers import TrainingArguments, Trainer
+
+model_name = checkpoint.split("/")[1]
+
+training_args = TrainingArguments(
+ output_dir=f"{model_name}-pokemon",
+ learning_rate=5e-5,
+ num_train_epochs=50,
+ fp16=True,
+ per_device_train_batch_size=32,
+ per_device_eval_batch_size=32,
+ gradient_accumulation_steps=2,
+ save_total_limit=3,
+ eval_strategy="steps",
+ eval_steps=50,
+ save_strategy="steps",
+ save_steps=50,
+ logging_steps=50,
+ remove_unused_columns=False,
+ push_to_hub=True,
+ label_names=["labels"],
+ load_best_model_at_end=True,
+)
+```
+
+Luego pรกsalos junto con los conjuntos de datos y el modelo al ๐ค Trainer.
+
+```python
+trainer = Trainer(
+ model=model,
+ args=training_args,
+ train_dataset=train_ds,
+ eval_dataset=test_ds,
+ compute_metrics=compute_metrics,
+)
+```
+
+Para comenzar el entrenamiento, simplemente llama a [`~Trainer.train`] en el objeto [`Trainer`].
+
+```python
+trainer.train()
+```
+
+Deberรญas ver cรณmo disminuye suavemente la pรฉrdida de entrenamiento a medida que avanza el entrenamiento.
+
+Una vez completado el entrenamiento, comparte tu modelo en el Hub con el mรฉtodo [`~Trainer.push_to_hub`] para que todos puedan usar tu modelo:
+
+```python
+trainer.push_to_hub()
+```
+
+## Inferencia
+
+Toma una imagen de muestra de test_ds para probar el modelo.
+
+```python
+from PIL import Image
+import requests
+
+url = "https://huggingface.co/datasets/sayakpaul/sample-datasets/resolve/main/pokemon.png"
+image = Image.open(requests.get(url, stream=True).raw)
+image
+```
+
+
+
+
+
+Prepara la imagen para el modelo.
+
+```python
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+inputs = processor(images=image, return_tensors="pt").to(device)
+pixel_values = inputs.pixel_values
+```
+
+Llama a [`generate`] y decodifica las predicciones.
+
+```python
+generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
+generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
+print(generated_caption)
+```
+```bash
+a drawing of a pink and blue pokemon
+```
+
+ยกParece que el modelo ajustado generรณ un subtรญtulo bastante bueno!
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/image_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/image_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..1bea46884202fe4ac5e49f50a2ffa4d56bdffc5c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/image_classification.md
@@ -0,0 +1,173 @@
+
+
+# Clasificaciรณn de imรกgenes
+
+
+
+La clasificaciรณn de imรกgenes asigna una etiqueta o clase a una imagen. A diferencia de la clasificaciรณn de texto o audio, las entradas son los valores de los pรญxeles que representan una imagen. La clasificaciรณn de imรกgenes tiene muchos usos, como la detecciรณn de daรฑos tras una catรกstrofe, el control de la salud de los cultivos o la bรบsqueda de signos de enfermedad en imรกgenes mรฉdicas.
+
+Esta guรญa te mostrarรก como hacer fine-tune al [ViT](https://huggingface.co/docs/transformers/v4.16.2/en/model_doc/vit) en el dataset [Food-101](https://huggingface.co/datasets/food101) para clasificar un alimento en una imagen.
+
+
+
+Consulta la [pรกgina de la tarea](https://huggingface.co/tasks/audio-classification) de clasificaciรณn de imรกgenes para obtener mรกs informaciรณn sobre sus modelos, datasets y mรฉtricas asociadas.
+
+
+
+## Carga el dataset Food-101
+
+Carga solo las primeras 5000 imรกgenes del dataset Food-101 de la biblioteca ๐ค de Datasets ya que es bastante grande:
+
+```py
+>>> from datasets import load_dataset
+
+>>> food = load_dataset("food101", split="train[:5000]")
+```
+
+Divide el dataset en un train y un test set:
+
+```py
+>>> food = food.train_test_split(test_size=0.2)
+```
+
+A continuaciรณn, observa un ejemplo:
+
+```py
+>>> food["train"][0]
+{'image': ,
+ 'label': 79}
+```
+
+El campo `image` contiene una imagen PIL, y cada `label` es un nรบmero entero que representa una clase. Crea un diccionario que asigne un nombre de label a un entero y viceversa. El mapeo ayudarรก al modelo a recuperar el nombre de label a partir del nรบmero de la misma:
+
+```py
+>>> labels = food["train"].features["label"].names
+>>> label2id, id2label = dict(), dict()
+>>> for i, label in enumerate(labels):
+... label2id[label] = str(i)
+... id2label[str(i)] = label
+```
+
+Ahora puedes convertir el nรบmero de label en un nombre de label para obtener mรกs informaciรณn:
+
+```py
+>>> id2label[str(79)]
+'prime_rib'
+```
+
+Cada clase de alimento - o label - corresponde a un nรบmero; `79` indica una costilla de primera en el ejemplo anterior.
+
+## Preprocesa
+
+Carga el image processor de ViT para procesar la imagen en un tensor:
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224-in21k")
+```
+
+Aplica varias transformaciones de imagen al dataset para hacer el modelo mรกs robusto contra el overfitting. En este caso se utilizarรก el mรณdulo [`transforms`](https://pytorch.org/vision/stable/transforms.html) de torchvision. Recorta una parte aleatoria de la imagen, cambia su tamaรฑo y normalรญzala con la media y la desviaciรณn estรกndar de la imagen:
+
+```py
+>>> from torchvision.transforms import RandomResizedCrop, Compose, Normalize, ToTensor
+
+>>> normalize = Normalize(mean=image_processor.image_mean, std=image_processor.image_std)
+>>> _transforms = Compose([RandomResizedCrop(image_processor.size["height"]), ToTensor(), normalize])
+```
+
+Crea una funciรณn de preprocesamiento que aplique las transformaciones y devuelva los `pixel_values` - los inputs al modelo - de la imagen:
+
+```py
+>>> def transforms(examples):
+... examples["pixel_values"] = [_transforms(img.convert("RGB")) for img in examples["image"]]
+... del examples["image"]
+... return examples
+```
+
+Utiliza el mรฉtodo [`with_transform`](https://huggingface.co/docs/datasets/package_reference/main_classes?#datasets.Dataset.with_transform) de ๐ค Dataset para aplicar las transformaciones sobre todo el dataset. Las transformaciones se aplican sobre la marcha cuando se carga un elemento del dataset:
+
+```py
+>>> food = food.with_transform(transforms)
+```
+
+Utiliza [`DefaultDataCollator`] para crear un batch de ejemplos. A diferencia de otros data collators en ๐ค Transformers, el DefaultDataCollator no aplica un preprocesamiento adicional como el padding.
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+## Entrena
+Carga ViT con [`AutoModelForImageClassification`]. Especifica el nรบmero de labels, y pasa al modelo el mapping entre el nรบmero de label y la clase de label:
+
+```py
+>>> from transformers import AutoModelForImageClassification, TrainingArguments, Trainer
+
+>>> model = AutoModelForImageClassification.from_pretrained(
+... "google/vit-base-patch16-224-in21k",
+... num_labels=len(labels),
+... id2label=id2label,
+... label2id=label2id,
+... )
+```
+
+
+
+Si no estรกs familiarizado con el fine-tuning de un modelo con el [`Trainer`], echa un vistazo al tutorial bรกsico [aquรญ](../training#finetune-with-trainer)!
+
+
+
+Al llegar a este punto, solo quedan tres pasos:
+
+1. Define tus hiperparรกmetros de entrenamiento en [`TrainingArguments`]. Es importante que no elimines las columnas que no se utilicen, ya que esto harรก que desaparezca la columna `image`. Sin la columna `image` no puedes crear `pixel_values`. Establece `remove_unused_columns=False` para evitar este comportamiento.
+2. Pasa los training arguments al [`Trainer`] junto con el modelo, los datasets, tokenizer y data collator.
+3. Llama [`~Trainer.train`] para hacer fine-tune de tu modelo.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="./results",
+... per_device_train_batch_size=16,
+... eval_strategy="steps",
+... num_train_epochs=4,
+... fp16=True,
+... save_steps=100,
+... eval_steps=100,
+... logging_steps=10,
+... learning_rate=2e-4,
+... save_total_limit=2,
+... remove_unused_columns=False,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=data_collator,
+... train_dataset=food["train"],
+... eval_dataset=food["test"],
+... processing_class=image_processor,
+... )
+
+>>> trainer.train()
+```
+
+
+
+Para ver un ejemplo mรกs a profundidad de cรณmo hacer fine-tune a un modelo para clasificaciรณn de imรกgenes, echa un vistazo al correspondiente [PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb).
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/language_modeling.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/language_modeling.md
new file mode 100644
index 0000000000000000000000000000000000000000..9516876a00633e238f91507413acd0b4e6b5387a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/language_modeling.md
@@ -0,0 +1,421 @@
+
+
+# Modelado de lenguaje
+
+El modelado de lenguaje predice palabras en un enunciado. Hay dos formas de modelado de lenguaje.
+
+
+
+El modelado de lenguaje causal predice el siguiente token en una secuencia de tokens, y el modelo solo puede considerar los tokens a la izquierda.
+
+
+
+El modelado de lenguaje por enmascaramiento predice un token enmascarado en una secuencia, y el modelo puede considerar los tokens bidireccionalmente.
+
+Esta guรญa te mostrarรก cรณmo realizar fine-tuning [DistilGPT2](https://huggingface.co/distilbert/distilgpt2) para modelos de lenguaje causales y [DistilRoBERTa](https://huggingface.co/distilbert/distilroberta-base) para modelos de lenguaje por enmascaramiento en el [r/askscience](https://www.reddit.com/r/askscience/) subdataset [ELI5](https://huggingface.co/datasets/eli5).
+
+
+
+Mira la [pรกgina de tarea](https://huggingface.co/tasks/text-generation) para generaciรณn de texto y la [pรกgina de tarea](https://huggingface.co/tasks/fill-mask) para modelos de lenguajes por enmascaramiento para obtener mรกs informaciรณn sobre los modelos, datasets, y mรฉtricas asociadas.
+
+
+
+## Carga el dataset ELI5
+
+Carga solo los primeros 5000 registros desde la biblioteca ๐ค Datasets, dado que es bastante grande:
+
+```py
+>>> from datasets import load_dataset
+
+>>> eli5 = load_dataset("eli5", split="train_asks[:5000]")
+```
+
+Divide este dataset en subdatasets para el entrenamiento y el test:
+
+```py
+eli5 = eli5.train_test_split(test_size=0.2)
+```
+
+Luego observa un ejemplo:
+
+```py
+>>> eli5["train"][0]
+{'answers': {'a_id': ['c3d1aib', 'c3d4lya'],
+ 'score': [6, 3],
+ 'text': ["The velocity needed to remain in orbit is equal to the square root of Newton's constant times the mass of earth divided by the distance from the center of the earth. I don't know the altitude of that specific mission, but they're usually around 300 km. That means he's going 7-8 km/s.\n\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.",
+ "Hope you don't mind me asking another question, but why aren't there any stars visible in this photo?"]},
+ 'answers_urls': {'url': []},
+ 'document': '',
+ 'q_id': 'nyxfp',
+ 'selftext': '_URL_0_\n\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?',
+ 'selftext_urls': {'url': ['http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg']},
+ 'subreddit': 'askscience',
+ 'title': 'Few questions about this space walk photograph.',
+ 'title_urls': {'url': []}}
+```
+
+Observa que `text` es un subcampo anidado dentro del diccionario `answers`. Cuando preproceses el dataset, deberรกs extraer el subcampo `text` en una columna aparte.
+
+## Preprocesamiento
+
+
+
+Para modelados de lenguaje causales carga el tokenizador DistilGPT2 para procesar el subcampo `text`:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilgpt2")
+```
+
+
+
+Para modelados de lenguaje por enmascaramiento carga el tokenizador DistilRoBERTa, en lugar de DistilGPT2:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilroberta-base")
+```
+
+Extrae el subcampo `text` desde su estructura anidado con el mรฉtodo [`flatten`](https://huggingface.co/docs/datasets/process#flatten):
+
+```py
+>>> eli5 = eli5.flatten()
+>>> eli5["train"][0]
+{'answers.a_id': ['c3d1aib', 'c3d4lya'],
+ 'answers.score': [6, 3],
+ 'answers.text': ["The velocity needed to remain in orbit is equal to the square root of Newton's constant times the mass of earth divided by the distance from the center of the earth. I don't know the altitude of that specific mission, but they're usually around 300 km. That means he's going 7-8 km/s.\n\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.",
+ "Hope you don't mind me asking another question, but why aren't there any stars visible in this photo?"],
+ 'answers_urls.url': [],
+ 'document': '',
+ 'q_id': 'nyxfp',
+ 'selftext': '_URL_0_\n\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?',
+ 'selftext_urls.url': ['http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg'],
+ 'subreddit': 'askscience',
+ 'title': 'Few questions about this space walk photograph.',
+ 'title_urls.url': []}
+```
+
+Cada subcampo es ahora una columna separada, como lo indica el prefijo `answers`. Observa que `answers.text` es una lista. En lugar de tokenizar cada enunciado por separado, convierte la lista en un string para tokenizarlos conjuntamente.
+
+Asรญ es como puedes crear una funciรณn de preprocesamiento para convertir la lista en una cadena y truncar las secuencias para que no superen la longitud mรกxima de input de DistilGPT2:
+
+```py
+>>> def preprocess_function(examples):
+... return tokenizer([" ".join(x) for x in examples["answers.text"]], truncation=True)
+```
+
+Usa de ๐ค Datasets la funciรณn [`map`](https://huggingface.co/docs/datasets/process#map) para aplicar la funciรณn de preprocesamiento sobre el dataset en su totalidad. Puedes acelerar la funciรณn `map` configurando el argumento `batched=True` para procesar mรบltiples elementos del dataset a la vez y aumentar la cantidad de procesos con `num_proc`. Elimina las columnas que no necesitas:
+
+```py
+>>> tokenized_eli5 = eli5.map(
+... preprocess_function,
+... batched=True,
+... num_proc=4,
+... remove_columns=eli5["train"].column_names,
+... )
+```
+
+Ahora necesitas una segunda funciรณn de preprocesamiento para capturar el texto truncado de cualquier ejemplo demasiado largo para evitar cualquier pรฉrdida de informaciรณn. Esta funciรณn de preprocesamiento deberรญa:
+
+- Concatenar todo el texto.
+- Dividir el texto concatenado en trozos mรกs pequeรฑos definidos por un `block_size`.
+
+```py
+>>> block_size = 128
+
+
+>>> def group_texts(examples):
+... concatenated_examples = {k: sum(examples[k], []) for k in examples.keys()}
+... total_length = len(concatenated_examples[list(examples.keys())[0]])
+... total_length = (total_length // block_size) * block_size
+... result = {
+... k: [t[i : i + block_size] for i in range(0, total_length, block_size)]
+... for k, t in concatenated_examples.items()
+... }
+... result["labels"] = result["input_ids"].copy()
+... return result
+```
+
+Aplica la funciรณn `group_texts` sobre todo el dataset:
+
+```py
+>>> lm_dataset = tokenized_eli5.map(group_texts, batched=True, num_proc=4)
+```
+
+Para modelados de lenguaje causales, usa [`DataCollatorForLanguageModeling`] para crear un lote de ejemplos. Esto tambiรฉn *rellenarรก dinรกmicamente* tu texto a la dimensiรณn del elemento mรกs largo del lote para que de esta manera tengan largo uniforme. Si bien es posible rellenar tu texto en la funciรณn `tokenizer` mediante el argumento `padding=True`, el rellenado dinรกmico es mรกs eficiente.
+
+
+
+Puedes usar el token de final de secuencia como el token de relleno y asignar `mlm=False`. Esto usarรก los inputs como etiquetas movidas un elemento hacia la derecha:
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> tokenizer.pad_token = tokenizer.eos_token
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False)
+```
+
+Para modelados de lenguaje por enmascaramiento usa el mismo [`DataCollatorForLanguageModeling`] excepto que deberรกs especificar `mlm_probability` para enmascarar tokens aleatoriamente cada vez que iteras sobre los datos.
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> tokenizer.pad_token = tokenizer.eos_token
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=0.15)
+```
+
+
+Puedes usar el token de final de secuencia como el token de relleno y asignar `mlm=False`. Esto usarรก los inputs como etiquetas movidas un elemento hacia la derecha:
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False, return_tensors="tf")
+```
+
+Para modelados de lenguajes por enmascaramiento usa el mismo [`DataCollatorForLanguageModeling`] excepto que deberรกs especificar `mlm_probability` para enmascarar tokens aleatoriamente cada vez que iteras sobre los datos.
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False, return_tensors="tf")
+```
+
+
+
+## Modelado de lenguaje causal
+
+El modelado de lenguaje causal es frecuentemente utilizado para generaciรณn de texto. Esta secciรณn te muestra cรณmo realizar fine-tuning a [DistilGPT2](https://huggingface.co/distilbert/distilgpt2) para generar nuevo texto.
+
+### Entrenamiento
+
+
+
+Carga DistilGPT2 con [`AutoModelForCausalLM`]:
+
+```py
+>>> from transformers import AutoModelForCausalLM, TrainingArguments, Trainer
+
+>>> model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+```
+
+
+
+Si no estรกs familiarizado con el proceso de realizar fine-tuning sobre un modelo con [`Trainer`], considera el tutorial bรกsico [aquรญ](../training#finetune-with-trainer)!
+
+
+
+A este punto, solo faltan tres pasos:
+
+1. Definir tus hiperparรกmetros de entrenamiento en [`TrainingArguments`].
+2. Pasarle los argumentos de entrenamiento a [`Trainer`] junto con el modelo, dataset, y el data collator.
+3. Realiza la llamada [`~Trainer.train`] para realizar el fine-tuning sobre tu modelo.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="./results",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... weight_decay=0.01,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=lm_dataset["train"],
+... eval_dataset=lm_dataset["test"],
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+
+Para realizar el fine-tuning de un modelo en TensorFlow, comienza por convertir tus datasets al formato `tf.data.Dataset` con [`to_tf_dataset`](https://huggingface.co/docs/datasets/package_reference/main_classes#datasets.Dataset.to_tf_dataset). Especifica los inputs y etiquetas en `columns`, ya sea para mezclar el dataset, tamaรฑo de lote, y el data collator:
+
+```py
+>>> tf_train_set = lm_dataset["train"].to_tf_dataset(
+... columns=["attention_mask", "input_ids", "labels"],
+... dummy_labels=True,
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = lm_dataset["test"].to_tf_dataset(
+... columns=["attention_mask", "input_ids", "labels"],
+... dummy_labels=True,
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+
+
+Si no estรกs familiarizado con realizar fine-tuning de tus modelos con Keras, considera el tutorial bรกsico [aquรญ](training#finetune-with-keras)!
+
+
+
+Crea la funciรณn optimizadora, la tasa de aprendizaje, y algunos hiperparรกmetros de entrenamiento:
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+Carga DistilGPT2 con [`TFAutoModelForCausalLM`]:
+
+```py
+>>> from transformers import TFAutoModelForCausalLM
+
+>>> model = TFAutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+```
+
+Configura el modelo para entrenamiento con [`compile`](https://keras.io/api/models/model_training_apis/#compile-method):
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer)
+```
+
+Llama a [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) para realizar el fine-tuning del modelo:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3)
+```
+
+
+
+## Modelado de lenguaje por enmascaramiento
+
+El modelado de lenguaje por enmascaramiento es tambiรฉn conocido como una tarea de rellenar la mรกscara, pues predice un token enmascarado dada una secuencia. Los modelos de lenguaje por enmascaramiento requieren una buena comprensiรณn del contexto de una secuencia entera, en lugar de solo el contexto a la izquierda. Esta secciรณn te enseรฑa como realizar el fine-tuning de [DistilRoBERTa](https://huggingface.co/distilbert/distilroberta-base) para predecir una palabra enmascarada.
+
+### Entrenamiento
+
+
+
+Carga DistilRoBERTa con [`AutoModelForMaskedlM`]:
+
+```py
+>>> from transformers import AutoModelForMaskedLM
+
+>>> model = AutoModelForMaskedLM.from_pretrained("distilbert/distilroberta-base")
+```
+
+
+
+Si no estรกs familiarizado con el proceso de realizar fine-tuning sobre un modelo con [`Trainer`], considera el tutorial bรกsico [aquรญ](../training#finetune-with-trainer)!
+
+
+
+A este punto, solo faltan tres pasos:
+
+1. Definir tus hiperparรกmetros de entrenamiento en [`TrainingArguments`].
+2. Pasarle los argumentos de entrenamiento a [`Trainer`] junto con el modelo, dataset, y el data collator.
+3. Realiza la llamada [`~Trainer.train`] para realizar el fine-tuning de tu modelo.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="./results",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=lm_dataset["train"],
+... eval_dataset=lm_dataset["test"],
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+
+Para realizar el fine-tuning de un modelo en TensorFlow, comienza por convertir tus datasets al formato `tf.data.Dataset` con [`to_tf_dataset`](https://huggingface.co/docs/datasets/package_reference/main_classes#datasets.Dataset.to_tf_dataset). Especifica los inputs y etiquetas en `columns`, ya sea para mezclar el dataset, tamaรฑo de lote, y el data collator:
+
+```py
+>>> tf_train_set = lm_dataset["train"].to_tf_dataset(
+... columns=["attention_mask", "input_ids", "labels"],
+... dummy_labels=True,
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = lm_dataset["test"].to_tf_dataset(
+... columns=["attention_mask", "input_ids", "labels"],
+... dummy_labels=True,
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+
+
+Si no estรกs familiarizado con realizar fine-tuning de tus modelos con Keras, considera el tutorial bรกsico [aquรญ](training#finetune-with-keras)!
+
+
+
+Crea la funciรณn optimizadora, la tasa de aprendizaje, y algunos hiperparรกmetros de entrenamiento:
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+Carga DistilRoBERTa con [`TFAutoModelForMaskedLM`]:
+
+```py
+>>> from transformers import TFAutoModelForMaskedLM
+
+>>> model = TFAutoModelForCausalLM.from_pretrained("distilbert/distilroberta-base")
+```
+
+Configura el modelo para entrenamiento con [`compile`](https://keras.io/api/models/model_training_apis/#compile-method):
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer)
+```
+
+Llama a [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) para realizar el fine-tuning del modelo:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3)
+```
+
+
+
+
+
+Para un ejemplo mรกs profundo sobre cรณmo realizar el fine-tuning sobre un modelo de lenguaje causal, considera
+[PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)
+o [TensorFlow notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb).
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/multiple_choice.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/multiple_choice.md
new file mode 100644
index 0000000000000000000000000000000000000000..32df3401d737dea3a95026df707b55984a566bc6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/multiple_choice.md
@@ -0,0 +1,292 @@
+
+
+# Selecciรณn mรบltiple
+
+La tarea de selecciรณn mรบltiple es parecida a la de responder preguntas, con la excepciรณn de que se dan varias opciones de respuesta junto con el contexto. El modelo se entrena para escoger la respuesta correcta
+entre varias opciones a partir del contexto dado.
+
+Esta guรญa te mostrarรก como hacerle fine-tuning a [BERT](https://huggingface.co/google-bert/bert-base-uncased) en la configuraciรณn `regular` del dataset [SWAG](https://huggingface.co/datasets/swag), de forma
+que seleccione la mejor respuesta a partir de varias opciones y algรบn contexto.
+
+## Cargar el dataset SWAG
+
+Carga el dataset SWAG con la biblioteca ๐ค Datasets:
+
+```py
+>>> from datasets import load_dataset
+
+>>> swag = load_dataset("swag", "regular")
+```
+
+Ahora, รฉchale un vistazo a un ejemplo del dataset:
+
+```py
+>>> swag["train"][0]
+{'ending0': 'passes by walking down the street playing their instruments.',
+ 'ending1': 'has heard approaching them.',
+ 'ending2': "arrives and they're outside dancing and asleep.",
+ 'ending3': 'turns the lead singer watches the performance.',
+ 'fold-ind': '3416',
+ 'gold-source': 'gold',
+ 'label': 0,
+ 'sent1': 'Members of the procession walk down the street holding small horn brass instruments.',
+ 'sent2': 'A drum line',
+ 'startphrase': 'Members of the procession walk down the street holding small horn brass instruments. A drum line',
+ 'video-id': 'anetv_jkn6uvmqwh4'}
+```
+
+Los campos `sent1` y `sent2` muestran cรณmo comienza una oraciรณn, y cada campo `ending` indica cรณmo podrรญa terminar. Dado el comienzo de la oraciรณn, el modelo debe escoger el final de oraciรณn correcto indicado por el campo `label`.
+
+## Preprocesmaiento
+
+Carga el tokenizer de BERT para procesar el comienzo de cada oraciรณn y los cuatro finales posibles:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
+```
+
+La funciรณn de preprocesmaiento debe hacer lo siguiente:
+
+1. Hacer cuatro copias del campo `sent1` de forma que se pueda combinar cada una con el campo `sent2` para recrear la forma en que empieza la oraciรณn.
+2. Combinar `sent2` con cada uno de los cuatro finales de oraciรณn posibles.
+3. Aplanar las dos listas para que puedas tokenizarlas, y luego des-aplanarlas para que cada ejemplo tenga los campos `input_ids`, `attention_mask` y `labels` correspondientes.
+
+```py
+>>> ending_names = ["ending0", "ending1", "ending2", "ending3"]
+
+
+>>> def preprocess_function(examples):
+... first_sentences = [[context] * 4 for context in examples["sent1"]]
+... question_headers = examples["sent2"]
+... second_sentences = [
+... [f"{header} {examples[end][i]}" for end in ending_names] for i, header in enumerate(question_headers)
+... ]
+
+... first_sentences = sum(first_sentences, [])
+... second_sentences = sum(second_sentences, [])
+
+... tokenized_examples = tokenizer(first_sentences, second_sentences, truncation=True)
+... return {k: [v[i : i + 4] for i in range(0, len(v), 4)] for k, v in tokenized_examples.items()}
+```
+
+Usa la funciรณn [`~datasets.Dataset.map`] de ๐ค Datasets para aplicarle la funciรณn de preprocesamiento al dataset entero. Puedes acelerar la funciรณn `map` haciendo `batched=True` para procesar varios elementos del dataset a la vez.
+
+```py
+tokenized_swag = swag.map(preprocess_function, batched=True)
+```
+
+๐ค Transformers no tiene un collator de datos para la tarea de selecciรณn mรบltiple, asรญ que tendrรญas que crear uno. Puedes adaptar el [`DataCollatorWithPadding`] para crear un lote de ejemplos para selecciรณn mรบltiple. Este tambiรฉn
+le *aรฑadirรก relleno de manera dinรกmica* a tu texto y a las etiquetas para que tengan la longitud del elemento mรกs largo en su lote, de forma que tengan una longitud uniforme. Aunque es posible rellenar el texto en la funciรณn `tokenizer` haciendo
+`padding=True`, el rellenado dinรกmico es mรกs eficiente.
+
+El `DataCollatorForMultipleChoice` aplanarรก todas las entradas del modelo, les aplicarรก relleno y luego des-aplanarรก los resultados:
+
+
+
+```py
+>>> from dataclasses import dataclass
+>>> from transformers.tokenization_utils_base import PreTrainedTokenizerBase, PaddingStrategy
+>>> from typing import Optional, Union
+>>> import torch
+
+
+>>> @dataclass
+... class DataCollatorForMultipleChoice:
+... """
+... Collator de datos que le aรฑadirรก relleno de forma automรกtica a las entradas recibidas para
+... una tarea de selecciรณn mรบltiple.
+... """
+
+... tokenizer: PreTrainedTokenizerBase
+... padding: Union[bool, str, PaddingStrategy] = True
+... max_length: Optional[int] = None
+... pad_to_multiple_of: Optional[int] = None
+
+... def __call__(self, features):
+... label_name = "label" if "label" in features[0].keys() else "labels"
+... labels = [feature.pop(label_name) for feature in features]
+... batch_size = len(features)
+... num_choices = len(features[0]["input_ids"])
+... flattened_features = [
+... [{k: v[i] for k, v in feature.items()} for i in range(num_choices)] for feature in features
+... ]
+... flattened_features = sum(flattened_features, [])
+
+... batch = self.tokenizer.pad(
+... flattened_features,
+... padding=self.padding,
+... max_length=self.max_length,
+... pad_to_multiple_of=self.pad_to_multiple_of,
+... return_tensors="pt",
+... )
+
+... batch = {k: v.view(batch_size, num_choices, -1) for k, v in batch.items()}
+... batch["labels"] = torch.tensor(labels, dtype=torch.int64)
+... return batch
+```
+
+
+```py
+>>> from dataclasses import dataclass
+>>> from transformers.tokenization_utils_base import PreTrainedTokenizerBase, PaddingStrategy
+>>> from typing import Optional, Union
+>>> import tensorflow as tf
+
+
+>>> @dataclass
+... class DataCollatorForMultipleChoice:
+... """
+... Data collator that will dynamically pad the inputs for multiple choice received.
+... """
+
+... tokenizer: PreTrainedTokenizerBase
+... padding: Union[bool, str, PaddingStrategy] = True
+... max_length: Optional[int] = None
+... pad_to_multiple_of: Optional[int] = None
+
+... def __call__(self, features):
+... label_name = "label" if "label" in features[0].keys() else "labels"
+... labels = [feature.pop(label_name) for feature in features]
+... batch_size = len(features)
+... num_choices = len(features[0]["input_ids"])
+... flattened_features = [
+... [{k: v[i] for k, v in feature.items()} for i in range(num_choices)] for feature in features
+... ]
+... flattened_features = sum(flattened_features, [])
+
+... batch = self.tokenizer.pad(
+... flattened_features,
+... padding=self.padding,
+... max_length=self.max_length,
+... pad_to_multiple_of=self.pad_to_multiple_of,
+... return_tensors="tf",
+... )
+
+... batch = {k: tf.reshape(v, (batch_size, num_choices, -1)) for k, v in batch.items()}
+... batch["labels"] = tf.convert_to_tensor(labels, dtype=tf.int64)
+... return batch
+```
+
+
+
+## Entrenamiento
+
+
+
+Carga el modelo BERT con [`AutoModelForMultipleChoice`]:
+
+```py
+>>> from transformers import AutoModelForMultipleChoice, TrainingArguments, Trainer
+
+>>> model = AutoModelForMultipleChoice.from_pretrained("google-bert/bert-base-uncased")
+```
+
+
+
+Para familiarizarte con el fine-tuning con [`Trainer`], ยกmira el tutorial bรกsico [aquรญ](../training#finetune-with-trainer)!
+
+
+
+En este punto, solo quedan tres pasos:
+
+1. Definir tus hiperparรกmetros de entrenamiento en [`TrainingArguments`].
+2. Pasarle los argumentos del entrenamiento al [`Trainer`] jnto con el modelo, el dataset, el tokenizer y el collator de datos.
+3. Invocar el mรฉtodo [`~Trainer.train`] para realizar el fine-tuning del modelo.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="./results",
+... eval_strategy="epoch",
+... learning_rate=5e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_swag["train"],
+... eval_dataset=tokenized_swag["validation"],
+... processing_class=tokenizer,
+... data_collator=DataCollatorForMultipleChoice(tokenizer=tokenizer),
+... )
+
+>>> trainer.train()
+```
+
+
+Para realizar el fine-tuning de un modelo en TensorFlow, primero convierte tus datasets al formato `tf.data.Dataset` con el mรฉtodo [`~TFPreTrainedModel.prepare_tf_dataset`].
+
+```py
+>>> data_collator = DataCollatorForMultipleChoice(tokenizer=tokenizer)
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_swag["train"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_swag["validation"],
+... shuffle=False,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+```
+
+
+
+Para familiarizarte con el fine-tuning con Keras, ยกmira el tutorial bรกsico [aquรญ](training#finetune-with-keras)!
+
+
+
+Prepara una funciรณn de optimizaciรณn, un programa para la tasa de aprendizaje y algunos hiperparรกmetros de entrenamiento:
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_train_epochs = 2
+>>> total_train_steps = (len(tokenized_swag["train"]) // batch_size) * num_train_epochs
+>>> optimizer, schedule = create_optimizer(init_lr=5e-5, num_warmup_steps=0, num_train_steps=total_train_steps)
+```
+
+Carga el modelo BERT con [`TFAutoModelForMultipleChoice`]:
+
+```py
+>>> from transformers import TFAutoModelForMultipleChoice
+
+>>> model = TFAutoModelForMultipleChoice.from_pretrained("google-bert/bert-base-uncased")
+```
+
+Configura el modelo para entrenarlo con [`compile`](https://keras.io/api/models/model_training_apis/#compile-method):
+
+```py
+>>> model.compile(optimizer=optimizer)
+```
+
+Invoca el mรฉtodo [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) para realizar el fine-tuning del modelo:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=2)
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/question_answering.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/question_answering.md
new file mode 100644
index 0000000000000000000000000000000000000000..42a6e4b6e1bc4ee3af2d6e760054b398db9b5d48
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/question_answering.md
@@ -0,0 +1,275 @@
+
+
+# Respuesta a preguntas
+
+
+
+La respuesta a preguntas devuelve una respuesta a partir de una pregunta dada. Existen dos formas comunes de responder preguntas:
+
+- Extractiva: extraer la respuesta a partir del contexto dado.
+- Abstractiva: generar una respuesta que responda correctamente la pregunta a partir del contexto dado.
+
+Esta guรญa te mostrarรก como hacer fine-tuning de [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) en el dataset [SQuAD](https://huggingface.co/datasets/squad) para responder preguntas de forma extractiva.
+
+
+
+Revisa la [pรกgina de la tarea](https://huggingface.co/tasks/question-answering) de responder preguntas para tener mรกs informaciรณn sobre otras formas de responder preguntas y los modelos, datasets y mรฉtricas asociadas.
+
+
+
+## Carga el dataset SQuAD
+
+Carga el dataset SQuAD con la biblioteca ๐ค Datasets:
+
+```py
+>>> from datasets import load_dataset
+
+>>> squad = load_dataset("squad")
+```
+
+Ahora, รฉchale un vistazo a una muestra:
+
+```py
+>>> squad["train"][0]
+{'answers': {'answer_start': [515], 'text': ['Saint Bernadette Soubirous']},
+ 'context': 'Architecturally, the school has a Catholic character. Atop the Main Building\'s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend "Venite Ad Me Omnes". Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.',
+ 'id': '5733be284776f41900661182',
+ 'question': 'To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?',
+ 'title': 'University_of_Notre_Dame'
+}
+```
+
+El campo `answers` es un diccionario que contiene la posiciรณn inicial de la respuesta y el `texto` de la respuesta.
+
+## Preprocesamiento
+
+
+
+Carga el tokenizer de DistilBERT para procesar los campos `question` (pregunta) y `context` (contexto):
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Hay algunos pasos de preprocesamiento especรญficos para la tarea de respuesta a preguntas que debes tener en cuenta:
+
+1. Algunos ejemplos en un dataset pueden tener un contexto que supera la longitud mรกxima de entrada de un modelo. Trunca solamente el contexto asignรกndole el valor `"only_second"` al parรกmetro `truncation`.
+2. A continuaciรณn, mapea las posiciones de inicio y fin de la respuesta al contexto original asignรกndole el valor `True` al parรกmetro `return_offsets_mapping`.
+3. Una vez tengas el mapeo, puedes encontrar los tokens de inicio y fin de la respuesta. Usa el mรฉtodo [`sequence_ids`](https://huggingface.co/docs/tokenizers/python/latest/api/reference.html#tokenizers.Encoding.sequence_ids)
+para encontrar quรฉ parte de la lista de tokens desplazados corresponde a la pregunta y cuรกl corresponde al contexto.
+
+A continuaciรณn puedes ver como se crea una funciรณn para truncar y mapear los tokens de inicio y fin de la respuesta al `context`:
+
+```py
+>>> def preprocess_function(examples):
+... questions = [q.strip() for q in examples["question"]]
+... inputs = tokenizer(
+... questions,
+... examples["context"],
+... max_length=384,
+... truncation="only_second",
+... return_offsets_mapping=True,
+... padding="max_length",
+... )
+
+... offset_mapping = inputs.pop("offset_mapping")
+... answers = examples["answers"]
+... start_positions = []
+... end_positions = []
+
+... for i, offset in enumerate(offset_mapping):
+... answer = answers[i]
+... start_char = answer["answer_start"][0]
+... end_char = answer["answer_start"][0] + len(answer["text"][0])
+... sequence_ids = inputs.sequence_ids(i)
+
+... # Encuentra el inicio y el fin del contexto
+... idx = 0
+... while sequence_ids[idx] != 1:
+... idx += 1
+... context_start = idx
+... while sequence_ids[idx] == 1:
+... idx += 1
+... context_end = idx - 1
+
+... # Si la respuesta entera no estรก dentro del contexto, etiquรฉtala como (0, 0)
+... if offset[context_start][0] > end_char or offset[context_end][1] < start_char:
+... start_positions.append(0)
+... end_positions.append(0)
+... else:
+... # De lo contrario, esta es la posiciรณn de los tokens de inicio y fin
+... idx = context_start
+... while idx <= context_end and offset[idx][0] <= start_char:
+... idx += 1
+... start_positions.append(idx - 1)
+
+... idx = context_end
+... while idx >= context_start and offset[idx][1] >= end_char:
+... idx -= 1
+... end_positions.append(idx + 1)
+
+... inputs["start_positions"] = start_positions
+... inputs["end_positions"] = end_positions
+... return inputs
+```
+
+Usa la funciรณn [`~datasets.Dataset.map`] de ๐ค Datasets para aplicarle la funciรณn de preprocesamiento al dataset entero. Puedes acelerar la funciรณn `map` haciendo `batched=True` para procesar varios elementos del dataset a la vez.
+Quita las columnas que no necesites:
+
+```py
+>>> tokenized_squad = squad.map(preprocess_function, batched=True, remove_columns=squad["train"].column_names)
+```
+
+Usa el [`DefaultDataCollator`] para crear un lote de ejemplos. A diferencia de los otros collators de datos en ๐ค Transformers, el `DefaultDataCollator` no aplica ningรบn procesamiento adicional (como el rellenado).
+
+
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+```
+
+
+
+## Entrenamiento
+
+
+
+Carga el modelo DistilBERT con [`AutoModelForQuestionAnswering`]:
+
+```py
+>>> from transformers import AutoModelForQuestionAnswering, TrainingArguments, Trainer
+
+>>> model = AutoModelForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+Para familiarizarte con el fine-tuning con [`Trainer`], ยกmira el tutorial bรกsico [aquรญ](../training#finetune-with-trainer)!
+
+
+
+En este punto, solo quedan tres pasos:
+
+1. Definir tus hiperparรกmetros de entrenamiento en [`TrainingArguments`].
+2. Pasarle los argumentos del entrenamiento al [`Trainer`] junto con el modelo, el dataset, el tokenizer y el collator de datos.
+3. Invocar el mรฉtodo [`~Trainer.train`] para realizar el fine-tuning del modelo.
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="./results",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_squad["train"],
+... eval_dataset=tokenized_squad["validation"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+
+Para realizar el fine-tuning de un modelo en TensorFlow, primero convierte tus datasets al formato `tf.data.Dataset` con el mรฉtodo [`~TFPreTrainedModel.prepare_tf_dataset`].
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_squad["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_squad["validation"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+
+
+Para familiarizarte con el fine-tuning con Keras, ยกmira el tutorial bรกsico [aquรญ](training#finetune-with-keras)!
+
+
+
+Prepara una funciรณn de optimizaciรณn, un programa para la tasa de aprendizaje y algunos hiperparรกmetros de entrenamiento:
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_epochs = 2
+>>> total_train_steps = (len(tokenized_squad["train"]) // batch_size) * num_epochs
+>>> optimizer, schedule = create_optimizer(
+... init_lr=2e-5,
+... num_warmup_steps=0,
+... num_train_steps=total_train_steps,
+... )
+```
+
+Carga el modelo DistilBERT con [`TFAutoModelForQuestionAnswering`]:
+
+```py
+>>> from transformers import TFAutoModelForQuestionAnswering
+
+>>> model = TFAutoModelForQuestionAnswering("distilbert/distilbert-base-uncased")
+```
+
+Configura el modelo para entrenarlo con [`compile`](https://keras.io/api/models/model_training_apis/#compile-method):
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer)
+```
+
+Invoca el mรฉtodo [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) para realizar el fine-tuning del modelo:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=3)
+```
+
+
+
+
+
+Para un ejemplo con mayor profundidad de cรณmo hacer fine-tuning a un modelo para responder preguntas, รฉchale un vistazo al
+[cuaderno de PyTorch](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb) o al
+[cuaderno de TensorFlow](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb) correspondiente.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/summarization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/summarization.md
new file mode 100644
index 0000000000000000000000000000000000000000..c9060cba6b771db41ee71be6e29af77345f14fc9
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks/summarization.md
@@ -0,0 +1,226 @@
+
+
+# Generaciรณn de resรบmenes
+
+
+
+La generaciรณn de resรบmenes (summarization, en inglรฉs) crea una versiรณn mรกs corta de un documento o un artรญculo que resume toda su informaciรณn importante. Junto con la traducciรณn, es un ejemplo de una tarea que puede ser formulada como una tarea secuencia a secuencia. La generaciรณn de resรบmenes puede ser:
+
+- Extractiva: Extrae la informaciรณn mรกs relevante de un documento.
+- Abstractiva: Genera un texto nuevo que captura la informaciรณn mรกs importante.
+
+Esta guรญa te mostrarรก cรณmo puedes hacer fine-tuning del modelo [T5](https://huggingface.co/google-t5/t5-small) sobre el subset de proyectos de ley del estado de California, dentro del dataset [BillSum](https://huggingface.co/datasets/billsum) para hacer generaciรณn de resรบmenes abstractiva.
+
+
+
+Consulta la [pรกgina de la tarea](https://huggingface.co/tasks/summarization) de generaciรณn de resรบmenes para obtener mรกs informaciรณn sobre sus modelos, datasets y mรฉtricas asociadas.
+
+
+
+## Carga el dataset BillSum
+
+Carga el dataset BillSum de la biblioteca ๐ค Datasets:
+
+```py
+>>> from datasets import load_dataset
+
+>>> billsum = load_dataset("billsum", split="ca_test")
+```
+
+Divide el dataset en un set de train y un set de test:
+
+```py
+>>> billsum = billsum.train_test_split(test_size=0.2)
+```
+
+A continuaciรณn, observa un ejemplo:
+
+```py
+>>> billsum["train"][0]
+{'summary': 'Existing law authorizes state agencies to enter into contracts for the acquisition of goods or services upon approval by the Department of General Services. Existing law sets forth various requirements and prohibitions for those contracts, including, but not limited to, a prohibition on entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between spouses and domestic partners or same-sex and different-sex couples in the provision of benefits. Existing law provides that a contract entered into in violation of those requirements and prohibitions is void and authorizes the state or any person acting on behalf of the state to bring a civil action seeking a determination that a contract is in violation and therefore void. Under existing law, a willful violation of those requirements and prohibitions is a misdemeanor.\nThis bill would also prohibit a state agency from entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between employees on the basis of gender identity in the provision of benefits, as specified. By expanding the scope of a crime, this bill would impose a state-mandated local program.\nThe California Constitution requires the state to reimburse local agencies and school districts for certain costs mandated by the state. Statutory provisions establish procedures for making that reimbursement.\nThis bill would provide that no reimbursement is required by this act for a specified reason.',
+ 'text': 'The people of the State of California do enact as follows:\n\n\nSECTION 1.\nSection 10295.35 is added to the Public Contract Code, to read:\n10295.35.\n(a) (1) Notwithstanding any other law, a state agency shall not enter into any contract for the acquisition of goods or services in the amount of one hundred thousand dollars ($100,000) or more with a contractor that, in the provision of benefits, discriminates between employees on the basis of an employeeโs or dependentโs actual or perceived gender identity, including, but not limited to, the employeeโs or dependentโs identification as transgender.\n(2) For purposes of this section, โcontractโ includes contracts with a cumulative amount of one hundred thousand dollars ($100,000) or more per contractor in each fiscal year.\n(3) For purposes of this section, an employee health plan is discriminatory if the plan is not consistent with Section 1365.5 of the Health and Safety Code and Section 10140 of the Insurance Code.\n(4) The requirements of this section shall apply only to those portions of a contractorโs operations that occur under any of the following conditions:\n(A) Within the state.\n(B) On real property outside the state if the property is owned by the state or if the state has a right to occupy the property, and if the contractorโs presence at that location is connected to a contract with the state.\n(C) Elsewhere in the United States where work related to a state contract is being performed.\n(b) Contractors shall treat as confidential, to the maximum extent allowed by law or by the requirement of the contractorโs insurance provider, any request by an employee or applicant for employment benefits or any documentation of eligibility for benefits submitted by an employee or applicant for employment.\n(c) After taking all reasonable measures to find a contractor that complies with this section, as determined by the state agency, the requirements of this section may be waived under any of the following circumstances:\n(1) There is only one prospective contractor willing to enter into a specific contract with the state agency.\n(2) The contract is necessary to respond to an emergency, as determined by the state agency, that endangers the public health, welfare, or safety, or the contract is necessary for the provision of essential services, and no entity that complies with the requirements of this section capable of responding to the emergency is immediately available.\n(3) The requirements of this section violate, or are inconsistent with, the terms or conditions of a grant, subvention, or agreement, if the agency has made a good faith attempt to change the terms or conditions of any grant, subvention, or agreement to authorize application of this section.\n(4) The contractor is providing wholesale or bulk water, power, or natural gas, the conveyance or transmission of the same, or ancillary services, as required for ensuring reliable services in accordance with good utility practice, if the purchase of the same cannot practically be accomplished through the standard competitive bidding procedures and the contractor is not providing direct retail services to end users.\n(d) (1) A contractor shall not be deemed to discriminate in the provision of benefits if the contractor, in providing the benefits, pays the actual costs incurred in obtaining the benefit.\n(2) If a contractor is unable to provide a certain benefit, despite taking reasonable measures to do so, the contractor shall not be deemed to discriminate in the provision of benefits.\n(e) (1) Every contract subject to this chapter shall contain a statement by which the contractor certifies that the contractor is in compliance with this section.\n(2) The department or other contracting agency shall enforce this section pursuant to its existing enforcement powers.\n(3) (A) If a contractor falsely certifies that it is in compliance with this section, the contract with that contractor shall be subject to Article 9 (commencing with Section 10420), unless, within a time period specified by the department or other contracting agency, the contractor provides to the department or agency proof that it has complied, or is in the process of complying, with this section.\n(B) The application of the remedies or penalties contained in Article 9 (commencing with Section 10420) to a contract subject to this chapter shall not preclude the application of any existing remedies otherwise available to the department or other contracting agency under its existing enforcement powers.\n(f) Nothing in this section is intended to regulate the contracting practices of any local jurisdiction.\n(g) This section shall be construed so as not to conflict with applicable federal laws, rules, or regulations. In the event that a court or agency of competent jurisdiction holds that federal law, rule, or regulation invalidates any clause, sentence, paragraph, or section of this code or the application thereof to any person or circumstances, it is the intent of the state that the court or agency sever that clause, sentence, paragraph, or section so that the remainder of this section shall remain in effect.\nSEC. 2.\nSection 10295.35 of the Public Contract Code shall not be construed to create any new enforcement authority or responsibility in the Department of General Services or any other contracting agency.\nSEC. 3.\nNo reimbursement is required by this act pursuant to Section 6 of Article XIII\u2009B of the California Constitution because the only costs that may be incurred by a local agency or school district will be incurred because this act creates a new crime or infraction, eliminates a crime or infraction, or changes the penalty for a crime or infraction, within the meaning of Section 17556 of the Government Code, or changes the definition of a crime within the meaning of Section 6 of Article XIII\u2009B of the California Constitution.',
+ 'title': 'An act to add Section 10295.35 to the Public Contract Code, relating to public contracts.'}
+```
+
+El campo `text` es el input y el campo `summary` es el objetivo.
+
+## Preprocesa
+
+Carga el tokenizador T5 para procesar `text` y `summary`:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-t5/t5-small")
+```
+
+La funciรณn de preprocesamiento necesita:
+
+1. Agregar un prefijo al input; una clave para que T5 sepa que se trata de una tarea de generaciรณn de resรบmenes. Algunos modelos capaces de realizar mรบltiples tareas de NLP requieren una clave que indique la tarea especรญfica.
+2. Usar el argumento `text_target` para tokenizar etiquetas.
+3. Truncar secuencias para que no sean mรกs largas que la longitud mรกxima fijada por el parรกmetro `max_length`.
+
+```py
+>>> prefix = "summarize: "
+
+
+>>> def preprocess_function(examples):
+... inputs = [prefix + doc for doc in examples["text"]]
+... model_inputs = tokenizer(inputs, max_length=1024, truncation=True)
+
+... labels = tokenizer(text_target=examples["summary"], max_length=128, truncation=True)
+
+... model_inputs["labels"] = labels["input_ids"]
+... return model_inputs
+```
+
+Usa la funciรณn [`~datasets.Dataset.map`] de ๐ค Datasets para aplicar la funciรณn de preprocesamiento sobre el dataset en su totalidad. Puedes acelerar la funciรณn `map` configurando el argumento `batched=True` para procesar mรบltiples elementos del dataset a la vez:
+
+```py
+>>> tokenized_billsum = billsum.map(preprocess_function, batched=True)
+```
+
+Usa [`DataCollatorForSeq2Seq`] para crear un lote de ejemplos. Esto tambiรฉn *rellenarรก dinรกmicamente* tu texto y etiquetas a la dimensiรณn del elemento mรกs largo del lote para que tengan un largo uniforme. Si bien es posible rellenar tu texto en la funciรณn `tokenizer` mediante el argumento `padding=True`, el rellenado dinรกmico es mรกs eficiente.
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=model)
+```
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=model, return_tensors="tf")
+```
+
+
+
+## Entrenamiento
+
+
+
+Carga T5 con [`AutoModelForSeq2SeqLM`]:
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("google-t5/t5-small")
+```
+
+
+
+Para familiarizarte con el proceso para realizar fine-tuning sobre un modelo con [`Trainer`], ยกmira el tutorial bรกsico [aquรญ](../training#finetune-with-trainer)!
+
+
+
+En este punto, solo faltan tres pasos:
+
+1. Definir tus hiperparรกmetros de entrenamiento en [`Seq2SeqTrainingArguments`].
+2. Pasarle los argumentos de entrenamiento a [`Seq2SeqTrainer`] junto con el modelo, dataset y data collator.
+3. Llamar [`~Trainer.train`] para realizar el fine-tuning sobre tu modelo.
+
+```py
+>>> training_args = Seq2SeqTrainingArguments(
+... output_dir="./results",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... weight_decay=0.01,
+... save_total_limit=3,
+... num_train_epochs=1,
+... fp16=True,
+... )
+
+>>> trainer = Seq2SeqTrainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_billsum["train"],
+... eval_dataset=tokenized_billsum["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+
+Para hacer fine-tuning de un modelo en TensorFlow, comienza por convertir tus datasets al formato `tf.data.Dataset` con [`~datasets.Dataset.to_tf_dataset`]. Especifica los inputs y etiquetas en `columns`, el tamaรฑo de lote, el data collator, y si es necesario mezclar el dataset:
+
+```py
+>>> tf_train_set = tokenized_billsum["train"].to_tf_dataset(
+... columns=["attention_mask", "input_ids", "labels"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = tokenized_billsum["test"].to_tf_dataset(
+... columns=["attention_mask", "input_ids", "labels"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+
+
+Para familiarizarte con el fine-tuning con Keras, ยกmira el tutorial bรกsico [aquรญ](training#finetune-with-keras)!
+
+
+
+Crea la funciรณn optimizadora, establece la tasa de aprendizaje y algunos hiperparรกmetros de entrenamiento:
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+Carga T5 con [`TFAutoModelForSeq2SeqLM`]:
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("google-t5/t5-small")
+```
+
+Configura el modelo para entrenamiento con [`compile`](https://keras.io/api/models/model_training_apis/#compile-method):
+
+```py
+>>> model.compile(optimizer=optimizer)
+```
+
+Llama a [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) para realizar el fine-tuning del modelo:
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3)
+```
+
+
+
+
+
+Para un ejemplo con mayor profundidad de cรณmo hacer fine-tuning a un modelo para generaciรณn de resรบmenes, revisa la
+[notebook en PyTorch](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb)
+o a la [notebook en TensorFlow](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb).
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks_explained.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks_explained.md
new file mode 100644
index 0000000000000000000000000000000000000000..9b13f521417890a329a758e1b8fb68b9b1727507
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tasks_explained.md
@@ -0,0 +1,295 @@
+
+
+# ยฟCรณmo los ๐ค Transformers resuelven tareas?
+
+En [Lo que ๐ค Transformers puede hacer](task_summary), aprendiste sobre el procesamiento de lenguaje natural (NLP), tareas de voz y audio, visiรณn por computadora y algunas aplicaciones importantes de ellas. Esta pรกgina se centrarรก en cรณmo los modelos resuelven estas tareas y explicarรก lo que estรก sucediendo debajo de la superficie. Hay muchas maneras de resolver una tarea dada, y diferentes modelos pueden implementar ciertas tรฉcnicas o incluso abordar la tarea desde un รกngulo nuevo, pero para los modelos Transformer, la idea general es la misma. Debido a su arquitectura flexible, la mayorรญa de los modelos son una variante de una estructura de codificador, descodificador o codificador-descodificador. Ademรกs de los modelos Transformer, nuestra biblioteca tambiรฉn tiene varias redes neuronales convolucionales (CNNs) modernas, que todavรญa se utilizan hoy en dรญa para tareas de visiรณn por computadora. Tambiรฉn explicaremos cรณmo funciona una CNN moderna.
+
+Para explicar cรณmo se resuelven las tareas, caminaremos a travรฉs de lo que sucede dentro del modelo para generar predicciones รบtiles.
+
+- [Wav2Vec2](https://huggingface.co/docs/transformers/model_doc/wav2vec2) para clasificaciรณn de audio y reconocimiento automรกtico de habla (ASR)
+- [Transformador de Visiรณn (ViT)](https://huggingface.co/docs/transformers/model_doc/vit) y [ConvNeXT](https://huggingface.co/docs/transformers/model_doc/convnext) para clasificaciรณn de imรกgenes
+- [DETR](https://huggingface.co/docs/transformers/model_doc/detr) para detecciรณn de objetos
+- [Mask2Former](https://huggingface.co/docs/transformers/model_doc/mask2former) para segmentaciรณn de imagen
+- [GLPN](https://huggingface.co/docs/transformers/model_doc/glpn) para estimaciรณn de profundidad
+- [BERT](https://huggingface.co/docs/transformers/model_doc/bert) para tareas de NLP como clasificaciรณn de texto, clasificaciรณn de tokens y preguntas y respuestas que utilizan un codificador
+- [GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2) para tareas de NLP como generaciรณn de texto que utilizan un descodificador
+- [BART](https://huggingface.co/docs/transformers/model_doc/bart) para tareas de NLP como resumen y traducciรณn que utilizan un codificador-descodificador
+
+
+
+Antes de continuar, es bueno tener un conocimiento bรกsico de la arquitectura original del Transformer. Saber cรณmo funcionan los codificadores, decodificadores y la atenciรณn te ayudarรก a entender cรณmo funcionan los diferentes modelos de Transformer. Si estรกs empezando o necesitas repasar, ยกecha un vistazo a nuestro [curso](https://huggingface.co/course/chapter1/4?fw=pt) para obtener mรกs informaciรณn!
+
+
+
+## Habla y audio
+
+[Wav2Vec2](https://huggingface.co/docs/transformers/model_doc/wav2vec2) es un modelo auto-supervisado preentrenado en datos de habla no etiquetados y ajustado en datos etiquetados para clasificaciรณn de audio y reconocimiento automรกtico de voz.
+
+
+
+
+
+Este modelo tiene cuatro componentes principales:
+
+1. Un *codificador de caracterรญsticas* toma la forma de onda de audio cruda, la normaliza a media cero y varianza unitaria, y la convierte en una secuencia de vectores de caracterรญsticas, cada uno de 20 ms de duraciรณn.
+
+2. Las formas de onda son continuas por naturaleza, por lo que no se pueden dividir en unidades separadas como una secuencia de texto se puede dividir en palabras. Por eso, los vectores de caracterรญsticas se pasan a un *mรณdulo de cuantificaciรณn*, que tiene como objetivo aprender unidades de habla discretas. La unidad de habla se elige de una colecciรณn de palabras de cรณdigo, conocidas como *codebook* (puedes pensar en esto como el vocabulario). Del codebook, se elige el vector o unidad de habla que mejor representa la entrada de audio continua y se envรญa a travรฉs del modelo.
+
+3. Alrededor de la mitad de los vectores de caracterรญsticas se enmascaran aleatoriamente, y el vector de caracterรญsticas enmascarado se alimenta a una *red de contexto*, que es un codificador Transformer que tambiรฉn agrega incrustaciones posicionales relativas.
+
+4. El objetivo del preentrenamiento de la red de contexto es una *tarea contrastiva*. El modelo tiene que predecir la verdadera representaciรณn de habla cuantizada de la predicciรณn enmascarada a partir de un conjunto de falsas, lo que anima al modelo a encontrar el vector de contexto y la unidad de habla cuantizada mรกs similares (la etiqueta objetivo).
+
+ยกAhora que wav2vec2 estรก preentrenado, puedes ajustarlo con tus datos para clasificaciรณn de audio o reconocimiento automรกtico de voz!
+
+### Clasificaciรณn de audio
+
+Para usar el modelo preentrenado para la clasificaciรณn de audio, aรฑade una capa de clasificaciรณn de secuencia encima del modelo base de Wav2Vec2. La capa de clasificaciรณn es una capa lineal que acepta los estados ocultos del codificador. Los estados ocultos representan las caracterรญsticas aprendidas de cada fotograma de audio, que pueden tener longitudes variables. Para crear un vector de longitud fija, primero se agrupan los estados ocultos y luego se transforman en logits sobre las etiquetas de clase. La pรฉrdida de entropรญa cruzada se calcula entre los logits y el objetivo para encontrar la clase mรกs probable.
+
+ยฟListo para probar la clasificaciรณn de audio? ยกConsulta nuestra guรญa completa de [clasificaciรณn de audio](https://huggingface.co/docs/transformers/tasks/audio_classification) para aprender cรณmo ajustar Wav2Vec2 y usarlo para inferencia!
+
+### Reconocimiento automรกtico de voz
+
+Para usar el modelo preentrenado para el reconocimiento automรกtico de voz, aรฑade una capa de modelado del lenguaje encima del modelo base de Wav2Vec2 para [CTC (clasificaciรณn temporal conexista)](glossary#connectionist-temporal-classification-ctc). La capa de modelado del lenguaje es una capa lineal que acepta los estados ocultos del codificador y los transforma en logits. Cada logit representa una clase de token (el nรบmero de tokens proviene del vocabulario de la tarea). La pรฉrdida de CTC se calcula entre los logits y los objetivos para encontrar la secuencia de tokens mรกs probable, que luego se decodifican en una transcripciรณn.
+
+ยฟListo para probar el reconocimiento automรกtico de voz? ยกConsulta nuestra guรญa completa de [reconocimiento automรกtico de voz](tasks/asr) para aprender cรณmo ajustar Wav2Vec2 y usarlo para inferencia!
+
+## Visiรณn por computadora
+
+Hay dos formas de abordar las tareas de visiรณn por computadora:
+
+1. Dividir una imagen en una secuencia de parches y procesarlos en paralelo con un Transformer.
+2. Utilizar una CNN moderna, como [ConvNeXT](https://huggingface.co/docs/transformers/model_doc/convnext), que se basa en capas convolucionales pero adopta diseรฑos de redes modernas.
+
+
+
+Un tercer enfoque combina Transformers con convoluciones (por ejemplo, [Convolutional Vision Transformer](https://huggingface.co/docs/transformers/model_doc/cvt) o [LeViT](https://huggingface.co/docs/transformers/model_doc/levit)). No discutiremos estos porque simplemente combinan los dos enfoques que examinamos aquรญ.
+
+
+
+ViT y ConvNeXT se utilizan comรบnmente para la clasificaciรณn de imรกgenes, pero para otras tareas de visiรณn como la detecciรณn de objetos, la segmentaciรณn y la estimaciรณn de profundidad, veremos DETR, Mask2Former y GLPN, respectivamente; estos modelos son mรกs adecuados para esas tareas.
+
+### Clasificaciรณn de imรกgenes
+
+ViT y ConvNeXT pueden usarse ambos para la clasificaciรณn de imรกgenes; la diferencia principal es que ViT utiliza un mecanismo de atenciรณn mientras que ConvNeXT utiliza convoluciones.
+
+#### Transformer
+
+[ViT](https://huggingface.co/docs/transformers/model_doc/vit) reemplaza completamente las convoluciones con una arquitectura de Transformer pura. Si estรกs familiarizado con el Transformer original, entonces ya estรกs en el camino para entender ViT.
+
+
+
+
+
+El cambio principal que introdujo ViT fue en cรณmo se alimentan las imรกgenes a un Transformer:
+
+1. Una imagen se divide en parches cuadrados no superpuestos, cada uno de los cuales se convierte en un vector o *incrustaciรณn de parche*(patch embedding). Las incrustaciones de parche se generan a partir de una capa convolucional 2D que crea las dimensiones de entrada adecuadas (que para un Transformer base son 768 valores para cada incrustaciรณn de parche). Si tuvieras una imagen de 224x224 pรญxeles, podrรญas dividirla en 196 parches de imagen de 16x16. Al igual que el texto se tokeniza en palabras, una imagen se "tokeniza" en una secuencia de parches.
+
+2. Se agrega una *incrustaciรณn aprendida* - un token especial `[CLS]` - al principio de las incrustaciones del parche, al igual que en BERT. El estado oculto final del token `[CLS]` se utiliza como la entrada para la cabecera de clasificaciรณn adjunta; otras salidas se ignoran. Este token ayuda al modelo a aprender cรณmo codificar una representaciรณn de la imagen.
+
+3. Lo รบltimo que se agrega a las incrustaciones de parche e incrustaciones aprendidas son las *incrustaciones de posiciรณn* porque el modelo no sabe cรณmo estรกn ordenados los parches de imagen. Las incrustaciones de posiciรณn tambiรฉn son aprendibles y tienen el mismo tamaรฑo que las incrustaciones de parche. Finalmente, todas las incrustaciones se pasan al codificador Transformer.
+
+4. La salida, especรญficamente solo la salida con el token `[CLS]`, se pasa a una cabecera de perceptrรณn multicapa (MLP). El objetivo del preentrenamiento de ViT es simplemente la clasificaciรณn. Al igual que otras cabeceras de clasificaciรณn, la cabecera de MLP convierte la salida en logits sobre las etiquetas de clase y calcula la pรฉrdida de entropรญa cruzada para encontrar la clase mรกs probable.
+
+ยฟListo para probar la clasificaciรณn de imรกgenes? ยกConsulta nuestra guรญa completa de [clasificaciรณn de imรกgenes](tasks/image_classification) para aprender cรณmo ajustar ViT y usarlo para inferencia!
+
+#### CNN
+
+
+
+Esta secciรณn explica brevemente las convoluciones, pero serรญa รบtil tener un entendimiento previo de cรณmo cambian la forma y el tamaรฑo de una imagen. Si no estรกs familiarizado con las convoluciones, ยกecha un vistazo al [capรญtulo de Redes Neuronales Convolucionales](https://github.com/fastai/fastbook/blob/master/13_convolutions.ipynb) del libro fastai!
+
+
+
+[ConvNeXT](https://huggingface.co/docs/transformers/model_doc/convnext) es una arquitectura de CNN que adopta diseรฑos de redes nuevas y modernas para mejorar el rendimiento. Sin embargo, las convoluciones siguen siendo el nรบcleo del modelo. Desde una perspectiva de alto nivel, una [convoluciรณn](glossary#convolution) es una operaciรณn donde una matriz mรกs pequeรฑa (*kernel*) se multiplica por una pequeรฑa ventana de pรญxeles de la imagen. Esta calcula algunas caracterรญsticas de ella, como una textura particular o la curvatura de una lรญnea. Luego, se desliza hacia la siguiente ventana de pรญxeles; la distancia que recorre la convoluciรณn se conoce como el *stride*.
+
+
+
+
+
+Una convoluciรณn bรกsica sin relleno ni paso, tomada de Una guรญa para la aritmรฉtica de convoluciones para el aprendizaje profundo.
+
+Puedes alimentar esta salida a otra capa convolucional, y con cada capa sucesiva, la red aprende cosas mรกs complejas y abstractas como perros calientes o cohetes. Entre capas convolucionales, es comรบn aรฑadir una capa de agrupaciรณn para reducir la dimensionalidad y hacer que el modelo sea mรกs robusto a las variaciones de la posiciรณn de una caracterรญstica.
+
+
+
+
+
+ConvNeXT moderniza una CNN de cinco maneras:
+
+1. Cambia el nรบmero de bloques en cada etapa y "fragmenta" una imagen con un paso y tamaรฑo de kernel mรกs grandes. La ventana deslizante no superpuesta hace que esta estrategia de fragmentaciรณn sea similar a cรณmo ViT divide una imagen en parches.
+
+2. Una capa de *cuello de botella* reduce el nรบmero de canales y luego lo restaura porque es mรกs rรกpido hacer una convoluciรณn de 1x1, y se puede aumentar la profundidad. Un cuello de botella invertido hace lo contrario al expandir el nรบmero de canales y luego reducirlos, lo cual es mรกs eficiente en memoria.
+
+3. Reemplaza la tรญpica capa convolucional de 3x3 en la capa de cuello de botella con una convoluciรณn *depthwise*, que aplica una convoluciรณn a cada canal de entrada por separado y luego los apila de nuevo al final. Esto ensancha el ancho de la red para mejorar el rendimiento.
+
+4. ViT tiene un campo receptivo global, lo que significa que puede ver mรกs de una imagen a la vez gracias a su mecanismo de atenciรณn. ConvNeXT intenta replicar este efecto aumentando el tamaรฑo del kernel a 7x7.
+
+5. ConvNeXT tambiรฉn hace varios cambios en el diseรฑo de capas que imitan a los modelos Transformer. Hay menos capas de activaciรณn y normalizaciรณn, la funciรณn de activaciรณn se cambia a GELU en lugar de ReLU, y utiliza LayerNorm en lugar de BatchNorm.
+
+La salida de los bloques convolucionales se pasa a una cabecera de clasificaciรณn que convierte las salidas en logits y calcula la pรฉrdida de entropรญa cruzada para encontrar la etiqueta mรกs probable.
+
+### Object detection
+
+[DETR](https://huggingface.co/docs/transformers/model_doc/detr), *DEtection TRansformer*, es un modelo de detecciรณn de objetos de un extremo a otro que combina una CNN con un codificador-decodificador Transformer.
+
+
+
+
+
+1. Una CNN preentrenada *backbone* toma una imagen, representada por sus valores de pรญxeles, y crea un mapa de caracterรญsticas de baja resoluciรณn de la misma. A continuaciรณn, se aplica una convoluciรณn 1x1 al mapa de caracterรญsticas para reducir la dimensionalidad y se crea un nuevo mapa de caracterรญsticas con una representaciรณn de imagen de alto nivel. Dado que el Transformer es un modelo secuencial, el mapa de caracterรญsticas se aplana en una secuencia de vectores de caracterรญsticas que se combinan con incrustaciones posicionales.
+
+2. Los vectores de caracterรญsticas se pasan al codificador, que aprende las representaciones de imagen usando sus capas de atenciรณn. A continuaciรณn, los estados ocultos del codificador se combinan con *consultas de objeto* en el decodificador. Las consultas de objeto son incrustaciones aprendidas que se enfocan en las diferentes regiones de una imagen, y se actualizan a medida que avanzan a travรฉs de cada capa de atenciรณn. Los estados ocultos del decodificador se pasan a una red feedforward que predice las coordenadas del cuadro delimitador y la etiqueta de clase para cada consulta de objeto, o `no objeto` si no hay ninguno.
+
+ DETR descodifica cada consulta de objeto en paralelo para producir *N* predicciones finales, donde *N* es el nรบmero de consultas. A diferencia de un modelo autoregresivo tรญpico que predice un elemento a la vez, la detecciรณn de objetos es una tarea de predicciรณn de conjuntos (`cuadro delimitador`, `etiqueta de clase`) que hace *N* predicciones en un solo paso.
+
+3. DETR utiliza una **pรฉrdida de coincidencia bipartita** durante el entrenamiento para comparar un nรบmero fijo de predicciones con un conjunto fijo de etiquetas de verdad bรกsica. Si hay menos etiquetas de verdad bรกsica en el conjunto de *N* etiquetas, entonces se rellenan con una clase `no objeto`. Esta funciรณn de pรฉrdida fomenta que DETR encuentre una asignaciรณn uno a uno entre las predicciones y las etiquetas de verdad bรกsica. Si los cuadros delimitadores o las etiquetas de clase no son correctos, se incurre en una pรฉrdida. Del mismo modo, si DETR predice un objeto que no existe, se penaliza. Esto fomenta que DETR encuentre otros objetos en una imagen en lugar de centrarse en un objeto realmente prominente.
+
+Se aรฑade una cabecera de detecciรณn de objetos encima de DETR para encontrar la etiqueta de clase y las coordenadas del cuadro delimitador. Hay dos componentes en la cabecera de detecciรณn de objetos: una capa lineal para transformar los estados ocultos del decodificador en logits sobre las etiquetas de clase, y una MLP para predecir el cuadro delimitador.
+
+ยฟListo para probar la detecciรณn de objetos? ยกConsulta nuestra guรญa completa de [detecciรณn de objetos](https://huggingface.co/docs/transformers/tasks/object_detection) para aprender cรณmo ajustar DETR y usarlo para inferencia!
+
+### Segmentaciรณn de imรกgenes
+
+[Mask2Former](https://huggingface.co/docs/transformers/model_doc/mask2former) es una arquitectura universal para resolver todos los tipos de tareas de segmentaciรณn de imรกgenes. Los modelos de segmentaciรณn tradicionales suelen estar adaptados a una tarea particular de segmentaciรณn de imรกgenes, como la segmentaciรณn de instancias, semรกntica o panรณptica. Mask2Former enmarca cada una de esas tareas como un problema de *clasificaciรณn de mรกscaras*. La clasificaciรณn de mรกscaras agrupa pรญxeles en *N* segmentos, y predice *N* mรกscaras y su etiqueta de clase correspondiente para una imagen dada. Explicaremos cรณmo funciona Mask2Former en esta secciรณn, y luego podrรกs probar el ajuste fino de SegFormer al final.
+
+
+
+
+
+Hay tres componentes principales en Mask2Former:
+
+1. Un [backbone Swin](https://huggingface.co/docs/transformers/model_doc/swin) acepta una imagen y crea un mapa de caracterรญsticas de imagen de baja resoluciรณn a partir de 3 convoluciones consecutivas de 3x3.
+
+2. El mapa de caracterรญsticas se pasa a un *decodificador de pรญxeles* que aumenta gradualmente las caracterรญsticas de baja resoluciรณn en incrustaciones de alta resoluciรณn por pรญxel. De hecho, el decodificador de pรญxeles genera caracterรญsticas multiescala (contiene caracterรญsticas de baja y alta resoluciรณn) con resoluciones de 1/32, 1/16 y 1/8 de la imagen original.
+
+3. Cada uno de estos mapas de caracterรญsticas de diferentes escalas se alimenta sucesivamente a una capa decodificadora Transformer a la vez para capturar objetos pequeรฑos de las caracterรญsticas de alta resoluciรณn. La clave de Mask2Former es el mecanismo de *atenciรณn enmascarada* en el decodificador. A diferencia de la atenciรณn cruzada que puede atender a toda la imagen, la atenciรณn enmascarada solo se centra en cierta รกrea de la imagen. Esto es mรกs rรกpido y conduce a un mejor rendimiento porque las caracterรญsticas locales de una imagen son suficientes para que el modelo aprenda.
+
+4. Al igual que [DETR](tasks_explained#object-detection), Mask2Former tambiรฉn utiliza consultas de objetos aprendidas y las combina con las caracterรญsticas de la imagen del decodificador de pรญxeles para hacer una predicciรณn de conjunto (`etiqueta de clase`, `predicciรณn de mรกscara`). Los estados ocultos del decodificador se pasan a una capa lineal y se transforman en logits sobre las etiquetas de clase. Se calcula la pรฉrdida de entropรญa cruzada entre los logits y la etiqueta de clase para encontrar la mรกs probable.
+
+ Las predicciones de mรกscara se generan combinando las incrustaciones de pรญxeles con los estados ocultos finales del decodificador. La pรฉrdida de entropรญa cruzada sigmoidea y de la pรฉrdida DICE se calcula entre los logits y la mรกscara de verdad bรกsica para encontrar la mรกscara mรกs probable.
+
+ยฟListo para probar la detecciรณn de objetos? ยกConsulta nuestra guรญa completa de [segmentaciรณn de imรกgenes](https://huggingface.co/docs/transformers/tasks/semantic_segmentation) para aprender cรณmo ajustar SegFormer y usarlo para inferencia!
+
+### Estimaciรณn de profundidad
+
+[GLPN](https://huggingface.co/docs/transformers/model_doc/glpn), *Global-Local Path Network*, es un Transformer para la estimaciรณn de profundidad que combina un codificador [SegFormer](https://huggingface.co/docs/transformers/model_doc/segformer) con un decodificador ligero.
+
+
+
+
+
+1. Al igual que ViT, una imagen se divide en una secuencia de parches, excepto que estos parches de imagen son mรกs pequeรฑos. Esto es mejor para tareas de predicciรณn densa como la segmentaciรณn o la estimaciรณn de profundidad. Los parches de imagen se transforman en incrustaciones de parches (ver la secciรณn de [clasificaciรณn de imรกgenes](#clasificaciรณn-de-imรกgenes) para mรกs detalles sobre cรณmo se crean las incrustaciones de parches), que se alimentan al codificador.
+
+2. El codificador acepta las incrustaciones de parches y las pasa a travรฉs de varios bloques codificadores. Cada bloque consiste en capas de atenciรณn y Mix-FFN. El propรณsito de este รบltimo es proporcionar informaciรณn posicional. Al final de cada bloque codificador hay una capa de *fusiรณn de parches* para crear representaciones jerรกrquicas. Las caracterรญsticas de cada grupo de parches vecinos se concatenan, y se aplica una capa lineal a las caracterรญsticas concatenadas para reducir el nรบmero de parches a una resoluciรณn de 1/4. Esto se convierte en la entrada al siguiente bloque codificador, donde se repite todo este proceso hasta que tengas caracterรญsticas de imagen con resoluciones de 1/8, 1/16 y 1/32.
+
+3. Un decodificador ligero toma el รบltimo mapa de caracterรญsticas (escala 1/32) del codificador y lo aumenta a una escala de 1/16. A partir de aquรญ, la caracterรญstica se pasa a un mรณdulo de *Fusiรณn Selectiva de Caracterรญsticas (SFF)*, que selecciona y combina caracterรญsticas locales y globales de un mapa de atenciรณn para cada caracterรญstica y luego la aumenta a 1/8. Este proceso se repite hasta que las caracterรญsticas decodificadas sean del mismo tamaรฑo que la imagen original. La salida se pasa a travรฉs de dos capas de convoluciรณn y luego se aplica una activaciรณn sigmoide para predecir la profundidad de cada pรญxel.
+
+## Procesamiento del lenguaje natural
+
+El Transformer fue diseรฑado inicialmente para la traducciรณn automรกtica, y desde entonces, prรกcticamente se ha convertido en la arquitectura predeterminada para resolver todas las tareas de procesamiento del lenguaje natural (NLP, por sus siglas en inglรฉs). Algunas tareas se prestan a la estructura del codificador del Transformer, mientras que otras son mรกs adecuadas para el decodificador. Todavรญa hay otras tareas que hacen uso de la estructura codificador-decodificador del Transformer.
+
+### Clasificaciรณn de texto
+
+[BERT](https://huggingface.co/docs/transformers/model_doc/bert) es un modelo que solo tiene codificador y es el primer modelo en implementar efectivamente la bidireccionalidad profunda para aprender representaciones mรกs ricas del texto al atender a las palabras en ambos lados.
+
+1. BERT utiliza la tokenizaciรณn [WordPiece](https://huggingface.co/docs/transformers/tokenizer_summary#wordpiece) para generar una incrustaciรณn de tokens del texto. Para diferenciar entre una sola oraciรณn y un par de oraciones, se agrega un token especial `[SEP]` para diferenciarlos. Tambiรฉn se agrega un token especial `[CLS]` al principio de cada secuencia de texto. La salida final con el token `[CLS]` se utiliza como la entrada a la cabeza de clasificaciรณn para tareas de clasificaciรณn. BERT tambiรฉn agrega una incrustaciรณn de segmento para indicar si un token pertenece a la primera o segunda oraciรณn en un par de oraciones.
+
+2. BERT se preentrena con dos objetivos: modelar el lenguaje enmascarado y predecir de prรณxima oraciรณn. En el modelado de lenguaje enmascarado, un cierto porcentaje de los tokens de entrada se enmascaran aleatoriamente, y el modelo necesita predecir estos. Esto resuelve el problema de la bidireccionalidad, donde el modelo podrรญa hacer trampa y ver todas las palabras y "predecir" la siguiente palabra. Los estados ocultos finales de los tokens de mรกscara predichos se pasan a una red feedforward con una softmax sobre el vocabulario para predecir la palabra enmascarada.
+
+ El segundo objetivo de preentrenamiento es la predicciรณn de prรณxima oraciรณn. El modelo debe predecir si la oraciรณn B sigue a la oraciรณn A. La mitad del tiempo, la oraciรณn B es la siguiente oraciรณn, y la otra mitad del tiempo, la oraciรณn B es una oraciรณn aleatoria. La predicciรณn, ya sea que sea la prรณxima oraciรณn o no, se pasa a una red feedforward con una softmax sobre las dos clases (`EsSiguiente` y `NoSiguiente`).
+
+3. Las incrustaciones de entrada se pasan a travรฉs de mรบltiples capas codificadoras para producir algunos estados ocultos finales.
+
+Para usar el modelo preentrenado para clasificaciรณn de texto, se aรฑade una cabecera de clasificaciรณn de secuencia encima del modelo base de BERT. La cabecera de clasificaciรณn de secuencia es una capa lineal que acepta los estados ocultos finales y realiza una transformaciรณn lineal para convertirlos en logits. Se calcula la pรฉrdida de entropรญa cruzada entre los logits y el objetivo para encontrar la etiqueta mรกs probable.
+
+ยฟListo para probar la clasificaciรณn de texto? ยกConsulta nuestra guรญa completa de [clasificaciรณn de texto](https://huggingface.co/docs/transformers/tasks/sequence_classification) para aprender cรณmo ajustar DistilBERT y usarlo para inferencia!
+
+### Clasificaciรณn de tokens
+
+Para usar BERT en tareas de clasificaciรณn de tokens como el reconocimiento de entidades nombradas (NER), aรฑade una cabecera de clasificaciรณn de tokens encima del modelo base de BERT. La cabecera de clasificaciรณn de tokens es una capa lineal que acepta los estados ocultos finales y realiza una transformaciรณn lineal para convertirlos en logits. Se calcula la pรฉrdida de entropรญa cruzada entre los logits y cada token para encontrar la etiqueta mรกs probable.
+
+ยฟListo para probar la clasificaciรณn de tokens? ยกConsulta nuestra guรญa completa de [clasificaciรณn de tokens](https://huggingface.co/docs/transformers/tasks/token_classification) para aprender cรณmo ajustar DistilBERT y usarlo para inferencia!
+
+### Respuesta a preguntas
+
+Para usar BERT en la respuesta a preguntas, aรฑade una cabecera de clasificaciรณn de span encima del modelo base de BERT. Esta capa lineal acepta los estados ocultos finales y realiza una transformaciรณn lineal para calcular los logits de inicio y fin del `span` correspondiente a la respuesta. Se calcula la pรฉrdida de entropรญa cruzada entre los logits y la posiciรณn de la etiqueta para encontrar el span mรกs probable de texto correspondiente a la respuesta.
+
+ยฟListo para probar la respuesta a preguntas? ยกConsulta nuestra guรญa completa de [respuesta a preguntas](tasks/question_answering) para aprender cรณmo ajustar DistilBERT y usarlo para inferencia!
+
+
+
+๐ก ยกObserva lo fรกcil que es usar BERT para diferentes tareas una vez que ha sido preentrenado! ยกSolo necesitas aรฑadir una cabecera especรญfica al modelo preentrenado para manipular los estados ocultos en tu salida deseada!
+
+
+
+### Generaciรณn de texto
+
+[GPT-2](https://huggingface.co/docs/transformers/model_doc/gpt2) es un modelo que solo tiene decodificador y se preentrena en una gran cantidad de texto. Puede generar texto convincente (ยกaunque no siempre verdadero!) dado un estรญmulo y completar otras tareas de procesamiento del lenguaje natural como responder preguntas, a pesar de no haber sido entrenado explรญcitamente para ello.
+
+
+
+
+
+1. GPT-2 utiliza [codificaciรณn de pares de bytes (BPE)](https://huggingface.co/docs/transformers/tokenizer_summary#bytepair-encoding-bpe) para tokenizar palabras y generar una incrustaciรณn de token. Se aรฑaden incrustaciones posicionales a las incrustaciones de token para indicar la posiciรณn de cada token en la secuencia. Las incrustaciones de entrada se pasan a travรฉs de varios bloques decodificadores para producir algรบn estado oculto final. Dentro de cada bloque decodificador, GPT-2 utiliza una capa de *autoatenciรณn enmascarada*, lo que significa que GPT-2 no puede atender a los tokens futuros. Solo puede atender a los tokens a la izquierda. Esto es diferente al token [`mask`] de BERT porque, en la autoatenciรณn enmascarada, se utiliza una mรกscara de atenciรณn para establecer la puntuaciรณn en `0` para los tokens futuros.
+
+2. La salida del decodificador se pasa a una cabecera de modelado de lenguaje, que realiza una transformaciรณn lineal para convertir los estados ocultos en logits. La etiqueta es el siguiente token en la secuencia, que se crea desplazando los logits a la derecha en uno. Se calcula la pรฉrdida de entropรญa cruzada entre los logits desplazados y las etiquetas para obtener el siguiente token mรกs probable.
+
+El objetivo del preentrenamiento de GPT-2 se basa completamente en el [modelado de lenguaje causal](glossary#causal-language-modeling), prediciendo la siguiente palabra en una secuencia. Esto hace que GPT-2 sea especialmente bueno en tareas que implican la generaciรณn de texto.
+
+ยฟListo para probar la generaciรณn de texto? ยกConsulta nuestra guรญa completa de [modelado de lenguaje causal](tasks/language_modeling#modelado-de-lenguaje-causal) para aprender cรณmo ajustar DistilGPT-2 y usarlo para inferencia!
+
+
+
+Para obtener mรกs informaciรณn sobre la generaciรณn de texto, ยกconsulta la guรญa de [estrategias de generaciรณn de texto](https://huggingface.co/docs/transformers/generation_strategies)!
+
+
+
+### Resumir
+
+Los modelos codificador-decodificador como [BART](https://huggingface.co/docs/transformers/model_doc/bart) y [T5](https://huggingface.co/docs/transformers/model_doc/t5) estรกn diseรฑados para el patrรณn de secuencia a secuencia de una tarea de resumen. Explicaremos cรณmo funciona BART en esta secciรณn, y luego podrรกs probar el ajuste fino de T5 al final.
+
+
+
+
+
+1. La arquitectura del codificador de BART es muy similar a la de BERT y acepta una incrustaciรณn de token y posicional del texto. BART se preentrena corrompiendo la entrada y luego reconstruyรฉndola con el decodificador. A diferencia de otros codificadores con estrategias especรญficas de corrupciรณn, BART puede aplicar cualquier tipo de corrupciรณn. Sin embargo, la estrategia de corrupciรณn de *relleno de texto* funciona mejor. En el relleno de texto, varios fragmentos de texto se reemplazan con un **รบnico** token [`mask`]. Esto es importante porque el modelo tiene que predecir los tokens enmascarados, y le enseรฑa al modelo a predecir la cantidad de tokens faltantes. Las incrustaciones de entrada y los fragmentos enmascarados se pasan a travรฉs del codificador para producir algunos estados ocultos finales, pero a diferencia de BERT, BART no aรฑade una red feedforward final al final para predecir una palabra.
+
+2. La salida del codificador se pasa al decodificador, que debe predecir los tokens enmascarados y cualquier token no corrompido de la salida del codificador. Esto proporciona un contexto adicional para ayudar al decodificador a restaurar el texto original. La salida del decodificador se pasa a una cabeza de modelado de lenguaje, que realiza una transformaciรณn lineal para convertir los estados ocultos en logits. Se calcula la pรฉrdida de entropรญa cruzada entre los logits y la etiqueta, que es simplemente el token desplazado hacia la derecha.
+
+ยฟListo para probar la sumarizaciรณn? ยกConsulta nuestra guรญa completa de [Generaciรณn de resรบmenes](tasks/summarization) para aprender cรณmo ajustar T5 y usarlo para inferencia!
+
+
+
+Para obtener mรกs informaciรณn sobre la generaciรณn de texto, ยกconsulta la guรญa de [estrategias de generaciรณn de texto](https://huggingface.co/docs/transformers/generation_strategies)!
+
+
+
+### Traducciรณn
+
+La traducciรณn es otro ejemplo de una tarea de secuencia a secuencia, lo que significa que puedes usar un modelo codificador-decodificador como [BART](https://huggingface.co/docs/transformers/model_doc/bart) o [T5](https://huggingface.co/docs/transformers/model_doc/t5) para hacerlo. Explicaremos cรณmo funciona BART en esta secciรณn, y luego podrรกs probar el ajuste fino de T5 al final.
+
+BART se adapta a la traducciรณn aรฑadiendo un codificador separado inicializado aleatoriamente para mapear un idioma fuente a una entrada que pueda ser decodificada en el idioma objetivo. Las incrustaciones de este nuevo codificador se pasan al codificador preentrenado en lugar de las incrustaciones de palabras originales. El codificador de origen se entrena actualizando el codificador de origen, las incrustaciones posicionales y las incrustaciones de entrada con la pรฉrdida de entropรญa cruzada de la salida del modelo. Los parรกmetros del modelo estรกn congelados en este primer paso, y todos los parรกmetros del modelo se entrenan juntos en el segundo paso.
+
+Desde entonces, BART ha sido seguido por una versiรณn multilingรผe, mBART, destinada a la traducciรณn y preentrenada en muchos idiomas diferentes.
+
+ยฟListo para probar la traducciรณn? ยกConsulta nuestra guรญa completa de [traducciรณn](https://huggingface.co/docs/transformers/tasks/translation) para aprender cรณmo ajustar T5 y usarlo para inferencia!
+
+
+
+Para obtener mรกs informaciรณn sobre la generaciรณn de texto, ยกconsulta la guรญa de [estrategias de generaciรณn de texto](https://huggingface.co/docs/transformers/generation_strategies)!
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tokenizer_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tokenizer_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..c4c8ee1783b251f917b37b2df7d661b1812fe49f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/tokenizer_summary.md
@@ -0,0 +1,175 @@
+
+
+# Descripciรณn general de los tokenizadores
+
+[[open-in-colab]]
+
+En esta pรกgina, veremos mรกs de cerca la tokenizaciรณn.
+
+
+
+Como vimos en [el tutorial de preprocesamiento](preprocessing), tokenizar un texto es dividirlo en palabras o subpalabras, que luego se convierten en indices o ids a travรฉs de una tabla de bรบsqueda. Convertir palabras o subpalabras en ids es sencillo, asรญ que en esta descripciรณn general, nos centraremos en dividir un texto en palabras o subpalabras (es decir, tokenizar un texto). Mรกs especรญficamente, examinaremos los tres principales tipos de tokenizadores utilizados en ๐ค Transformers: [Byte-Pair Encoding (BPE)](#byte-pair-encoding), [WordPiece](#wordpiece) y [SentencePiece](#sentencepiece), y mostraremos ejemplos de quรฉ tipo de tokenizador se utiliza en cada modelo.
+
+Ten en cuenta que en las pรกginas de los modelos, puedes ver la documentaciรณn del tokenizador asociado para saber quรฉ tipo de tokenizador se utilizรณ en el modelo preentrenado. Por ejemplo, si miramos [BertTokenizer](https://huggingface.co/docs/transformers/en/model_doc/bert#transformers.BertTokenizer), podemos ver que dicho modelo utiliza [WordPiece](#wordpiece).
+
+## Introducciรณn
+
+Dividir un texto en trozos mรกs pequeรฑos es mรกs difรญcil de lo que parece, y hay mรบltiples formas de hacerlo. Por ejemplo, veamos la oraciรณn `"Don't you love ๐ค Transformers? We sure do."`
+
+
+
+Una forma sencilla de tokenizar este texto es dividirlo por espacios, lo que darรญa:
+
+```
+["Don't", "you", "love", "๐ค", "Transformers?", "We", "sure", "do."]
+```
+
+Este es un primer paso sensato, pero si miramos los tokens `"Transformers?"` y `"do."`, notamos que las puntuaciones estรกn unidas a las palabras `"Transformer"` y `"do"`, lo que es subรณptimo. Deberรญamos tener en cuenta la puntuaciรณn para que un modelo no tenga que aprender una representaciรณn diferente de una palabra y cada posible sรญmbolo de puntuaciรณn que podrรญa seguirle, lo que explotarรญa el nรบmero de representaciones que el modelo tiene que aprender. Teniendo en cuenta la puntuaciรณn, tokenizar nuestro texto darรญa:
+
+```
+["Don", "'", "t", "you", "love", "๐ค", "Transformers", "?", "We", "sure", "do", "."]
+```
+
+Mejor. Sin embargo, es desventajoso cรณmo la tokenizaciรณn trata la palabra `"Don't"`. `"Don't"` significa `"do not"`, asรญ que serรญa mejor tokenizada como `["Do", "n't"]`. Aquรญ es donde las cosas comienzan a complicarse, y es la razon por la que cada modelo tiene su propio tipo de tokenizador. Dependiendo de las reglas que apliquemos para tokenizar un texto, se genera una salida tokenizada diferente para el mismo texto. Un modelo preentrenado solo se desempeรฑa correctamente si se le proporciona una entrada que fue tokenizada con las mismas reglas que se utilizaron para tokenizar sus datos de entrenamiento.
+
+[spaCy](https://spacy.io/) y [Moses](http://www.statmt.org/moses/?n=Development.GetStarted) son dos tokenizadores basados en reglas populares. Al aplicarlos en nuestro ejemplo, *spaCy* y *Moses* generarรญan algo como:
+
+```
+["Do", "n't", "you", "love", "๐ค", "Transformers", "?", "We", "sure", "do", "."]
+```
+
+Como se puede ver, aquรญ se utiliza tokenizaciรณn de espacio y puntuaciรณn, asรญ como tokenizaciรณn basada en reglas. La tokenizaciรณn de espacio y puntuaciรณn y la tokenizaciรณn basada en reglas son ambos ejemplos de tokenizaciรณn de palabras, que se define de manera simple como dividir oraciones en palabras. Aunque es la forma mรกs intuitiva de dividir textos en trozos mรกs pequeรฑos, este mรฉtodo de tokenizaciรณn puede generar problemas para corpus de texto masivos. En este caso, la tokenizaciรณn de espacio y puntuaciรณn suele generar un vocabulario muy grande (el conjunto de todas las palabras y tokens รบnicos utilizados). *Ej.*, [Transformer XL](https://huggingface.co/docs/transformers/main/en/model_doc/transfo-xl) utiliza tokenizaciรณn de espacio y puntuaciรณn, lo que resulta en un tamaรฑo de vocabulario de 267,735.
+
+Un tamaรฑo de vocabulario tan grande fuerza al modelo a tener una matriz de embeddings enormemente grande como capa de entrada y salida, lo que causa un aumento tanto en la complejidad de memoria como en la complejidad de tiempo. En general, los modelos de transformadores rara vez tienen un tamaรฑo de vocabulario mayor que 50,000, especialmente si estรกn preentrenados solo en un idioma.
+
+Entonces, si la simple tokenizaciรณn de espacios y puntuaciรณn es insatisfactoria, ยฟpor quรฉ no tokenizar simplemente en caracteres?
+
+
+
+Aunque la tokenizaciรณn de caracteres es muy simple y reducirรญa significativamente la complejidad de memoria y tiempo, hace que sea mucho mรกs difรญcil para el modelo aprender representaciones de entrada significativas. *Ej.* aprender una representaciรณn independiente del contexto para la letra `"t"` es mucho mรกs difรญcil que aprender una representaciรณn independiente del contexto para la palabra `"today"`. Por lo tanto, la tokenizaciรณn de caracteres suele acompaรฑarse de una pรฉrdida de rendimiento. Asรญ que para obtener lo mejor de ambos mundos, los modelos de transformadores utilizan un hรญbrido entre la tokenizaciรณn de nivel de palabra y de nivel de carรกcter llamada **tokenizaciรณn de subpalabras**.
+
+## Tokenizaciรณn de subpalabras
+
+
+
+Los algoritmos de tokenizaciรณn de subpalabras se basan en el principio de que las palabras frecuentemente utilizadas no deberรญan dividirse en subpalabras mรกs pequeรฑas, pero las palabras raras deberรญan descomponerse en subpalabras significativas. Por ejemplo, `"annoyingly"` podrรญa considerarse una palabra rara y descomponerse en `"annoying"` y `"ly"`. Ambas `"annoying"` y `"ly"` como subpalabras independientes aparecerรญan con mรกs frecuencia al mismo tiempo que se mantiene el significado de `"annoyingly"` por el significado compuesto de `"annoying"` y `"ly"`. Esto es especialmente รบtil en lenguas aglutinantes como el turco, donde puedes formar palabras complejas (casi) arbitrariamente largas concatenando subpalabras.
+
+La tokenizaciรณn de subpalabras permite al modelo tener un tamaรฑo de vocabulario razonable mientras puede aprender representaciones contextuales independientes significativas. Ademรกs, la tokenizaciรณn de subpalabras permite al modelo procesar palabras que nunca ha visto antes, descomponiรฉndolas en subpalabras conocidas. Por ejemplo, el tokenizador [BertTokenizer](https://huggingface.co/docs/transformers/en/model_doc/bert#transformers.BertTokenizer) tokeniza `"I have a new GPU!"` de la siguiente manera:
+
+```py
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+>>> tokenizer.tokenize("I have a new GPU!")
+["i", "have", "a", "new", "gp", "##u", "!"]
+```
+
+Debido a que estamos considerando el modelo sin mayรบsculas, la oraciรณn se convirtiรณ a minรบsculas primero. Podemos ver que las palabras `["i", "have", "a", "new"]` estรกn presentes en el vocabulario del tokenizador, pero la palabra `"gpu"` no. En consecuencia, el tokenizador divide `"gpu"` en subpalabras conocidas: `["gp" y "##u"]`. `"##"` significa que el resto del token deberรญa adjuntarse al anterior, sin espacio (para decodificar o revertir la tokenizaciรณn).
+
+Como otro ejemplo, el tokenizador [XLNetTokenizer](https://huggingface.co/docs/transformers/en/model_doc/xlnet#transformers.XLNetTokenizer) tokeniza nuestro texto de ejemplo anterior de la siguiente manera:
+
+```py
+>>> from transformers import XLNetTokenizer
+
+>>> tokenizer = XLNetTokenizer.from_pretrained("xlnet/xlnet-base-cased")
+>>> tokenizer.tokenize("Don't you love ๐ค Transformers? We sure do.")
+["โDon", "'", "t", "โyou", "โlove", "โ", "๐ค", "โ", "Transform", "ers", "?", "โWe", "โsure", "โdo", "."]
+```
+
+Hablaremos del significado de esos `"โ"` cuando veamos [SentencePiece](#sentencepiece). Como se puede ver, la palabra rara `"Transformers"` se ha dividido en las subpalabras mรกs frecuentes `"Transform"` y `"ers"`.
+
+Ahora, veamos cรณmo funcionan los diferentes algoritmos de tokenizaciรณn de subpalabras. Ten en cuenta que todos esos algoritmos de tokenizaciรณn se basan en alguna forma de entrenamiento que usualmente se realiza en el corpus en el que se entrenarรก el modelo correspondiente.
+
+
+
+### Byte-Pair Encoding (BPE)
+
+La Codificaciรณn por Pares de Bytes (BPE por sus siglas en inglรฉs) fue introducida en [Neural Machine Translation of Rare Words with Subword Units (Sennrich et al., 2015)](https://arxiv.org/abs/1508.07909). BPE se basa en un pre-tokenizador que divide los datos de entrenamiento en palabras. La pre-tokenizaciรณn puede ser tan simple como la tokenizaciรณn por espacio, por ejemplo, [GPT-2](https://huggingface.co/docs/transformers/en/model_doc/gpt2), [RoBERTa](https://huggingface.co/docs/transformers/en/model_doc/roberta). La pre-tokenizaciรณn mรกs avanzada incluye la tokenizaciรณn basada en reglas, por ejemplo, [XLM](https://huggingface.co/docs/transformers/en/model_doc/xlm), [FlauBERT](https://huggingface.co/docs/transformers/en/model_doc/flaubert) que utiliza Moses para la mayorรญa de los idiomas, o [GPT](https://huggingface.co/docs/transformers/en/model_doc/openai-gpt) que utiliza spaCy y ftfy, para contar la frecuencia de cada palabra en el corpus de entrenamiento.
+
+Despuรฉs de la pre-tokenizaciรณn, se ha creado un conjunto de palabras รบnicas y ha determinado la frecuencia con la que cada palabra apareciรณ en los datos de entrenamiento. A continuaciรณn, BPE crea un vocabulario base que consiste en todos los sรญmbolos que aparecen en el conjunto de palabras รบnicas y aprende reglas de fusiรณn para formar un nuevo sรญmbolo a partir de dos sรญmbolos del vocabulario base. Lo hace hasta que el vocabulario ha alcanzado el tamaรฑo de vocabulario deseado. Tenga en cuenta que el tamaรฑo de vocabulario deseado es un hiperparรกmetro que se debe definir antes de entrenar el tokenizador.
+
+Por ejemplo, supongamos que despuรฉs de la pre-tokenizaciรณn, se ha determinado el siguiente conjunto de palabras, incluyendo su frecuencia:
+
+```
+("hug", 10), ("pug", 5), ("pun", 12), ("bun", 4), ("hugs", 5)
+```
+
+En consecuencia, el vocabulario base es `["b", "g", "h", "n", "p", "s", "u"]`. Dividiendo todas las palabras en sรญmbolos del vocabulario base, obtenemos:
+
+```
+("h" "u" "g", 10), ("p" "u" "g", 5), ("p" "u" "n", 12), ("b" "u" "n", 4), ("h" "u" "g" "s", 5)
+```
+
+Luego, BPE cuenta la frecuencia de cada par de sรญmbolos posible y selecciona el par de sรญmbolos que ocurre con mรกs frecuencia. En el ejemplo anterior, `"h"` seguido de `"u"` estรก presente _10 + 5 = 15_ veces (10 veces en las 10 ocurrencias de `"hug"`, 5 veces en las 5 ocurrencias de `"hugs"`). Sin embargo, el par de sรญmbolos mรกs frecuente es `"u"` seguido de `"g"`, que ocurre _10 + 5 + 5 = 20_ veces en total. Por lo tanto, la primera regla de fusiรณn que aprende el tokenizador es agrupar todos los sรญmbolos `"u"` seguidos de un sรญmbolo `"g"` juntos. A continuaciรณn, `"ug"` se agrega al vocabulario. El conjunto de palabras entonces se convierte en
+
+```
+("h" "ug", 10), ("p" "ug", 5), ("p" "u" "n", 12), ("b" "u" "n", 4), ("h" "ug" "s", 5)
+```
+
+Seguidamente, BPE identifica el prรณximo par de sรญmbolos mรกs comรบn. Es `"u"` seguido de `"n"`, que ocurre 16 veces. `"u"`, `"n"` se fusionan en `"un"` y se agregan al vocabulario. El prรณximo par de sรญmbolos mรกs frecuente es `"h"` seguido de `"ug"`, que ocurre 15 veces. De nuevo, el par se fusiona y `"hug"` se puede agregar al vocabulario.
+
+En este momento, el vocabulario es `["b", "g", "h", "n", "p", "s", "u", "ug", "un", "hug"]` y nuestro conjunto de palabras รบnicas se representa como:
+
+```
+("hug", 10), ("p" "ug", 5), ("p" "un", 12), ("b" "un", 4), ("hug" "s", 5)
+```
+
+Suponiendo que el entrenamiento por Byte-Pair Encoding se detuviera en este punto, las reglas de combinaciรณn aprendidas se aplicarรญan entonces a nuevas palabras (siempre que esas nuevas palabras no incluyan sรญmbolos que no estuvieran en el vocabulario base). Por ejemplo, la palabra `"bug"` se tokenizarรญa como `["b", "ug"]`, pero `"mug"` se tokenizarรญa como `["", "ug"]` ya que el sรญmbolo `"m"` no estรก en el vocabulario base. En general, las letras individuales como `"m"` no se reemplazan por el sรญmbolo `""` porque los datos de entrenamiento usualmente incluyen al menos una ocurrencia de cada letra, pero es probable que suceda para caracteres especiales como los emojis.
+
+Como se mencionรณ anteriormente, el tamaรฑo del vocabulario, es decir, el tamaรฑo del vocabulario base + el nรบmero de combinaciones, es un hiperparรกmetro que se debe elegir. Por ejemplo, [GPT](https://huggingface.co/docs/transformers/en/model_doc/openai-gpt) tiene un tamaรฑo de vocabulario de 40,478 ya que tienen 478 caracteres base y eligieron detener el entrenamiento despuรฉs de 40,000 combinaciones.
+
+#### Byte-level BPE
+
+Un vocabulario base que incluya todos los caracteres base posibles puede ser bastante extenso si, por ejemplo, se consideran todos los caracteres unicode como caracteres base. Para tener un vocabulario base mejor, [GPT-2](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) utiliza bytes como vocabulario base, lo que es un truco astuto para forzar el vocabulario base a ser de tamaรฑo 256 mientras se asegura de que cada carรกcter base estรฉ incluido en el vocabulario. Con algunas reglas adicionales para tratar con la puntuaciรณn, el tokenizador de GPT2 puede tokenizar cualquier texto sin la necesidad del sรญmbolo ``. [GPT-2](https://huggingface.co/docs/transformers/en/model_doc/gpt2) tiene un tamaรฑo de vocabulario de 50,257, lo que corresponde a los 256 tokens base de bytes, un token especial de fin de texto y los sรญmbolos aprendidos con 50,000 combinaciones.
+
+
+
+### WordPiece
+
+WordPiece es el algoritmo de tokenizaciรณn de subpalabras utilizado por [BERT](https://huggingface.co/docs/transformers/en/model_doc/bert), [DistilBERT](https://huggingface.co/docs/transformers/main/en/model_doc/distilbert) y [Electra](https://huggingface.co/docs/transformers/main/en/model_doc/electra). El algoritmo fue descrito en [Japanese and Korean Voice Search (Schuster et al., 2012)](https://static.googleusercontent.com/media/research.google.com/ja//pubs/archive/37842.pdf) y es muy similar a BPE. WordPiece inicializa el vocabulario para incluir cada carรกcter presente en los datos de entrenamiento y aprende progresivamente un nรบmero determinado de reglas de fusiรณn. A diferencia de BPE, WordPiece no elige el par de sรญmbolos mรกs frecuente, sino el que maximiza la probabilidad de los datos de entrenamiento una vez agregado al vocabulario.
+
+ยฟQuรฉ significa esto exactamente? Refiriรฉndonos al ejemplo anterior, maximizar la probabilidad de los datos de entrenamiento es equivalente a encontrar el par de sรญmbolos cuya probabilidad dividida entre las probabilidades de su primer sรญmbolo seguido de su segundo sรญmbolo es la mayor entre todos los pares de sรญmbolos. *Ej.* `"u"` seguido de `"g"` solo habrรญa sido combinado si la probabilidad de `"ug"` dividida entre `"u"` y `"g"` habrรญa sido mayor que para cualquier otro par de sรญmbolos. Intuitivamente, WordPiece es ligeramente diferente a BPE en que evalรบa lo que _pierde_ al fusionar dos sรญmbolos para asegurarse de que _valga la pena_.
+
+
+
+### Unigram
+
+Unigram es un algoritmo de tokenizaciรณn de subpalabras introducido en [Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidates (Kudo, 2018)](https://arxiv.org/pdf/1804.10959.pdf). A diferencia de BPE o WordPiece, Unigram inicializa su vocabulario base con un gran nรบmero de sรญmbolos y progresivamente recorta cada sรญmbolo para obtener un vocabulario mรกs pequeรฑo. El vocabulario base podrรญa corresponder, por ejemplo, a todas las palabras pre-tokenizadas y las subcadenas mรกs comunes. Unigram no se utiliza directamente para ninguno de los modelos transformers, pero se utiliza en conjunto con [SentencePiece](#sentencepiece).
+
+En cada paso de entrenamiento, el algoritmo Unigram define una pรฉrdida (a menudo definida como la probabilidad logarรญtmica) sobre los datos de entrenamiento dados el vocabulario actual y un modelo de lenguaje unigram. Luego, para cada sรญmbolo en el vocabulario, el algoritmo calcula cuรกnto aumentarรญa la pรฉrdida general si el sรญmbolo se eliminara del vocabulario. Luego, Unigram elimina un porcentaje `p` de los sรญmbolos cuyo aumento de pรฉrdida es el mรกs bajo (siendo `p` generalmente 10% o 20%), es decir, aquellos sรญmbolos que menos afectan la pรฉrdida general sobre los datos de entrenamiento. Este proceso se repite hasta que el vocabulario haya alcanzado el tamaรฑo deseado. El algoritmo Unigram siempre mantiene los caracteres base para que cualquier palabra pueda ser tokenizada.
+
+Debido a que Unigram no se basa en reglas de combinaciรณn (en contraste con BPE y WordPiece), el algoritmo tiene varias formas de tokenizar nuevo texto despuรฉs del entrenamiento. Por ejemplo, si un tokenizador Unigram entrenado exhibe el vocabulario:
+
+```
+["b", "g", "h", "n", "p", "s", "u", "ug", "un", "hug"],
+```
+
+`"hugs"` podrรญa ser tokenizado tanto como `["hug", "s"]`, `["h", "ug", "s"]` o `["h", "u", "g", "s"]`. ยฟCuรกl elegir? Unigram guarda la probabilidad de cada token en el corpus de entrenamiento junto con el vocabulario, para que la probabilidad de que cada posible tokenizaciรณn pueda ser computada despuรฉs del entrenamiento. El algoritmo simplemente elige la tokenizaciรณn mรกs probable en la prรกctica, pero tambiรฉn ofrece la posibilidad de muestrear una posible tokenizaciรณn segรบn sus probabilidades.
+
+Esas probabilidades estรกn definidas por la pรฉrdida en la que se entrena el tokenizador. Suponiendo que los datos de entrenamiento constan de las palabras \\(x_{1}, \dots, x_{N}\\) y que el conjunto de todas las posibles tokenizaciones para una palabra \\(x_{i}\\) se define como \\(S(x_{i})\\), entonces la pรฉrdida general se define como:
+
+$$\mathcal{L} = -\sum_{i=1}^{N} \log \left ( \sum_{x \in S(x_{i})} p(x) \right )$$
+
+
+
+### SentencePiece
+
+Todos los algoritmos de tokenizaciรณn descritos hasta ahora tienen el mismo problema: se asume que el texto de entrada utiliza espacios para separar palabras. Sin embargo, no todos los idiomas utilizan espacios para separar palabras. Una posible soluciรณn es utilizar pre-tokenizadores especรญficos del idioma, *ej.* [XLM](https://huggingface.co/docs/transformers/en/model_doc/xlm) utiliza un pre-tokenizador especรญfico para chino, japonรฉs y tailandรฉs. Para resolver este problema de manera mรกs general, [SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing (Kudo et al., 2018)](https://arxiv.org/pdf/1808.06226.pdf) trata el texto de entrada como una corriente de entrada bruta, por lo que incluye el espacio en el conjunto de caracteres para utilizar. Luego utiliza el algoritmo BPE o unigram para construir el vocabulario apropiado.
+
+Por ejemplo, [`XLNetTokenizer`](https://huggingface.co/docs/transformers/en/model_doc/xlnet#transformers.XLNetTokenizer) utiliza SentencePiece, razรณn por la cual en el ejemplo anterior se incluyรณ el carรกcter `"โ"` en el vocabulario. Decodificar con SentencePiece es muy fรกcil, ya que todos los tokens pueden simplemente concatenarse y `"โ"` se reemplaza por un espacio.
+
+Todos los modelos transformers de nuestra biblioteca que utilizan SentencePiece lo utilizan en combinaciรณn con Unigram. Ejemplos de los modelos que utilizan SentencePiece son [ALBERT](https://huggingface.co/docs/transformers/en/model_doc/albert), [XLNet](https://huggingface.co/docs/transformers/en/model_doc/xlnet), [Marian](https://huggingface.co/docs/transformers/en/model_doc/marian) y [T5](https://huggingface.co/docs/transformers/main/en/model_doc/t5).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/torchscript.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/torchscript.md
new file mode 100644
index 0000000000000000000000000000000000000000..93873fadcae80043f57af5418768e561244501ef
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/torchscript.md
@@ -0,0 +1,167 @@
+
+
+# Exportar a TorchScript
+
+
+Este es el comienzo de nuestros experimentos con TorchScript y todavรญa estamos explorando sus capacidades con modelos de variables de entrada. Es un tema de interรฉs para nosotros y profundizaremos en nuestro anรกlisis en las prรณximas versiones, con mรกs ejemplos de cรณdigo, una implementaciรณn mรกs flexible y comparativas de rendimiento comparando cรณdigos basados en Python con TorchScript compilado.
+
+
+
+De acuerdo con la documentaciรณn de TorchScript:
+
+> "TorchScript es una manera de crear modelos serializables y optimizables a partir del cรณdigo PyTorch."
+
+Hay dos mรณdulos de PyTorch, [JIT y TRACE](https://pytorch.org/docs/stable/jit.html), que permiten a los desarrolladores exportar sus modelos para ser reusados en otros programas, como los programas de C++ orientados a la eficiencia.
+
+Nosotros proveemos una interface que te permite exportar los modelos ๐คTransformers a TorchScript para que puedan ser reusados en un entorno diferente al de los programas Python basados en PyTorch. Aquรญ explicamos como exportar y usar nuestros modelos utilizando TorchScript.
+
+Exportar un modelo requiere de dos cosas:
+
+- La instanciaciรณn del modelo con la bandera TorchScript.
+- Un paso hacia adelante con entradas ficticias.
+
+Estas necesidades implican varias cosas de las que los desarrolladores deben tener cuidado, como se detalla a continuaciรณn.
+
+## Bandera TorchScript y pesos atados.
+
+La bandera `torchscript` es necesaria porque la mayorรญa de los modelos de lenguaje de ๐คTransformers tienen pesos atados entre su `capa de incrustaciรณn` (`Embedding`) y su `capa de decodificaciรณn` (`Decoding`). TorchScript no te permite exportar modelos que tienen pesos atados, por lo que es necesario desatar y clonar los pesos de antemano.
+
+Los modelos instanciados con la bandera `torchscript` tienen su `capa de incrustaciรณn` (`Embedding`) y su `capa de decodificaciรณn` (`Decoding`) separadas, lo que significa que no deben ser entrenados mรกs adelante. Entrenar desincronizarรญa las dos capas, lo que llevarรญa a resultados inesperados.
+
+Esto no es asรญ para los modelos que no tienen una cabeza de modelo de lenguaje, ya que esos modelos no tienen pesos atados. Estos modelos pueden ser exportados de manera segura sin la bandera `torchscript`.
+
+## Entradas ficticias y longitudes estรกndar
+
+Las entradas ficticias se utilizan para un paso del modelo hacia adelante. Mientras los valores de las entradas se propagan a travรฉs de las capas, PyTorch realiza un seguimiento de las diferentes operaciones ejecutadas en cada tensor. Estas operaciones registradas se utilizan luego para crear *la traza* del modelo.
+La traza se crea en relaciรณn con las dimensiones de las entradas. Por lo tanto, estรก limitada por las dimensiones de la entrada ficticia y no funcionarรก para ninguna otra longitud de secuencia o tamaรฑo de lote. Cuando se intenta con un tamaรฑo diferente, se genera el siguiente error:
+
+```
+`El tamaรฑo expandido del tensor (3) debe coincidir con el tamaรฑo existente (7) en la dimensiรณn no singleton 2`.
+```
+
+Recomendamos trazar el modelo con un tamaรฑo de entrada ficticio al menos tan grande como la entrada mรกs grande con la que se alimentarรก al modelo durante la inferencia. El relleno puede ayudar a completar los valores faltantes. Sin embargo, dado que el modelo se traza con un tamaรฑo de entrada mรกs grande, las dimensiones de la matriz tambiรฉn serรกn grandes, lo que resultarรก en mรกs cรกlculos.
+
+Ten cuidado con el nรบmero total de operaciones realizadas en cada entrada y sigue de cerca el rendimiento al exportar modelos con longitudes de secuencia variables.
+
+## Usando TorchScript en Python
+
+Esta secciรณn demuestra cรณmo guardar y cargar modelos, asรญ como cรณmo usar la traza para la inferencia.
+
+### Guardando un modelo
+
+Para exportar un `BertModel` con TorchScript, instancia `BertModel` a partir de la clase `BertConfig` y luego guรกrdalo en disco bajo el nombre de archivo `traced_bert.pt`:
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+
+enc = BertTokenizer.from_pretrained("bert-base-uncased")
+
+# Tokenizing input text
+text = "[CLS] Who was Jim Henson ? [SEP] Jim Henson was a puppeteer [SEP]"
+tokenized_text = enc.tokenize(text)
+
+# Masking one of the input tokens
+masked_index = 8
+tokenized_text[masked_index] = "[MASK]"
+indexed_tokens = enc.convert_tokens_to_ids(tokenized_text)
+segments_ids = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
+
+# Creating a dummy input
+tokens_tensor = torch.tensor([indexed_tokens])
+segments_tensors = torch.tensor([segments_ids])
+dummy_input = [tokens_tensor, segments_tensors]
+
+# Initializing the model with the torchscript flag
+# Flag set to True even though it is not necessary as this model does not have an LM Head.
+config = BertConfig(
+ vocab_size_or_config_json_file=32000,
+ hidden_size=768,
+ num_hidden_layers=12,
+ num_attention_heads=12,
+ intermediate_size=3072,
+ torchscript=True,
+)
+
+# Instantiating the model
+model = BertModel(config)
+
+# The model needs to be in evaluation mode
+model.eval()
+
+# If you are instantiating the model with *from_pretrained* you can also easily set the TorchScript flag
+model = BertModel.from_pretrained("bert-base-uncased", torchscript=True)
+
+# Creating the trace
+traced_model = torch.jit.trace(model, [tokens_tensor, segments_tensors])
+torch.jit.save(traced_model, "traced_bert.pt")
+```
+### Cargando un modelo
+
+Ahora puedes cargar el `BertModel` guardado anteriormente, `traced_bert.pt`, desde el disco y usarlo en la entrada ficticia (`dummy_input`) previamente inicializada:
+
+```python
+loaded_model = torch.jit.load("traced_bert.pt")
+loaded_model.eval()
+
+all_encoder_layers, pooled_output = loaded_model(*dummy_input)
+```
+
+## Usando un modelo trazado para inferencia
+
+Utiliza el modelo trazado para inferencia utilizando su mรฉtodo `_call_` dunder:
+
+```python
+traced_model(tokens_tensor, segments_tensors)
+```
+## Despliega modelos TorchScript de Hugging Face en AWS con el Neuron SDK
+
+AWS introdujo la familia de instancias [Amazon EC2 Inf1](https://aws.amazon.com/ec2/instance-types/inf1/) para inferencia de aprendizaje automรกtico de alto rendimiento y bajo costo en la nube. Las instancias Inf1 estรกn alimentadas por el chip AWS Inferentia, un acelerador de hardware personalizado que se especializa en cargas de trabajo de inferencia de aprendizaje profundo. [AWS Neuron](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/#) es el SDK para Inferentia que admite el trazado y la optimizaciรณn de modelos de transformers para implementaciรณn en Inf1. El SDK Neuron proporciona:
+
+1. Una API fรกcil de usar con un solo cambio de lรญnea de cรณdigo para trazar y optimizar un modelo TorchScript para inferencia en la nube.
+
+2. Optimizaciones de rendimiento listas para usar [para mejorar el rendimiento y el costo](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/benchmark/>).
+
+3. Soporte para modelos de transformers de Hugging Face construidos tanto con [PyTorch](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/bert_tutorial/tutorial_pretrained_bert.html) como con [TensorFlow](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/tensorflow/huggingface_bert/huggingface_bert.html).
+
+### Implicaciones
+
+Los modelos transformers basados en la arquitectura [BERT (Bidirectional Encoder Representations from Transformers)](https://huggingface.co/docs/transformers/main/model_doc/bert), o sus variantes como [distilBERT](https://huggingface.co/docs/transformers/main/model_doc/distilbert) y [roBERTa](https://huggingface.co/docs/transformers/main/model_doc/roberta), funcionan mejor en Inf1 para tareas no generativas como la respuesta a preguntas extractivas, la clasificaciรณn de secuencias y la clasificaciรณn de tokens. Sin embargo, las tareas de generaciรณn de texto aรบn pueden adaptarse para ejecutarse en Inf1 segรบn este [tutorial de AWS Neuron MarianMT](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/transformers-marianmt.html). Se puede encontrar mรกs informaciรณn sobre los modelos que se pueden convertir fรกcilmente para usar en Inferentia en la secciรณn de [Model Architecture Fit](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/models/models-inferentia.html#models-inferentia) de la documentaciรณn de Neuron.
+
+### Dependencias
+
+El uso de AWS Neuron para convertir modelos requiere un [entorno de Neuron SDK](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/neuron-frameworks/pytorch-neuron/index.html#installation-guide) que viene preconfigurado en [la AMI de AWS Deep Learning](https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-inferentia-launching.html).
+
+### Convertir un modelo para AWS Neuron
+
+Convierte un modelo para AWS NEURON utilizando el mismo cรณdigo de [Uso de TorchScript en Python](torchscript#using-torchscript-in-python) para trazar un `BertModel`. Importa la extensiรณn del framework `torch.neuron` para acceder a los componentes del Neuron SDK a travรฉs de una API de Python:
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+import torch.neuron
+```
+Solo necesitas la linea sigueda:
+
+```diff
+- torch.jit.trace(model, [tokens_tensor, segments_tensors])
++ torch.neuron.trace(model, [token_tensor, segments_tensors])
+```
+
+Esto permite que el Neuron SDK trace el modelo y lo optimice para las instancias Inf1.
+
+Para obtener mรกs informaciรณn sobre las caracterรญsticas, herramientas, tutoriales de ejemplo y รบltimas actualizaciones del AWS Neuron SDK, consulta [la documentaciรณn de AWS NeuronSDK](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/index.html).
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/trainer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/trainer.md
new file mode 100644
index 0000000000000000000000000000000000000000..dab83e9a9d9ebcb5b55b33a7cc79952a4403bbe5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/trainer.md
@@ -0,0 +1,409 @@
+
+
+# El Trainer
+
+El [`Trainer`] es un bucle completo de entrenamiento y evaluaciรณn para modelos de PyTorch implementado en la biblioteca Transformers. Solo necesitas pasarle las piezas necesarias para el entrenamiento (modelo, tokenizador, conjunto de datos, funciรณn de evaluaciรณn, hiperparรกmetros de entrenamiento, etc.), y la clase [`Trainer`] se encarga del resto. Esto facilita comenzar a entrenar mรกs rรกpido sin tener que escribir manualmente tu propio bucle de entrenamiento. Pero al mismo tiempo, [`Trainer`] es muy personalizable y ofrece una gran cantidad de opciones de entrenamiento para que puedas adaptarlo a tus necesidades exactas de entrenamiento.
+
+
+
+Ademรกs de la clase [`Trainer`], Transformers tambiรฉn proporciona una clase [`Seq2SeqTrainer`] para tareas de secuencia a secuencia como traducciรณn o resumen. Tambiรฉn estรก la clase [~trl.SFTTrainer] de la biblioteca [TRL](https://hf.co/docs/trl) que envuelve la clase [`Trainer`] y estรก optimizada para entrenar modelos de lenguaje como Llama-2 y Mistral con tรฉcnicas autoregresivas. [`~trl.SFTTrainer`] tambiรฉn admite funciones como el empaquetado de secuencias, LoRA, cuantizaciรณn y DeepSpeed para escalar eficientemente a cualquier tamaรฑo de modelo.
+
+
+
+Siรฉntete libre de consultar [la referencia de API](./main_classes/trainer) para estas otras clases tipo [`Trainer`] para aprender mรกs sobre cuรกndo usar cada una. En general, [`Trainer`] es la opciรณn mรกs versรกtil y es apropiada para una amplia gama de tareas. [`Seq2SeqTrainer`] estรก diseรฑado para tareas de secuencia a secuencia y [`~trl.SFTTrainer`] estรก diseรฑado para entrenar modelos de lenguaje.
+
+
+
+Antes de comenzar, asegรบrate de tener instalado [Accelerate](https://hf.co/docs/accelerate), una biblioteca para habilitar y ejecutar el entrenamiento de PyTorch en entornos distribuidos.
+
+```bash
+pip install accelerate
+
+# upgrade
+pip install accelerate --upgrade
+```
+Esta guรญa proporciona una visiรณn general de la clase [`Trainer`].
+
+## Uso bรกsico
+
+[`Trainer`] incluye todo el cรณdigo que encontrarรญas en un bucle de entrenamiento bรกsico:
+1. Realiza un paso de entrenamiento para calcular la pรฉrdida
+2. Calcula los gradientes con el mรฉtodo [~accelerate.Accelerator.backward]
+3. Actualiza los pesos basados en los gradientes
+4. Repite este proceso hasta alcanzar un nรบmero predeterminado de รฉpocas
+
+La clase [`Trainer`] abstrae todo este cรณdigo para que no tengas que preocuparte por escribir manualmente un bucle de entrenamiento cada vez o si estรกs empezando con PyTorch y el entrenamiento. Solo necesitas proporcionar los componentes esenciales requeridos para el entrenamiento, como un modelo y un conjunto de datos, y la clase [`Trainer`] maneja todo lo demรกs.
+
+Si deseas especificar opciones de entrenamiento o hiperparรกmetros, puedes encontrarlos en la clase [`TrainingArguments`]. Por ejemplo, vamos a definir dรณnde guardar el modelo en output_dir y subir el modelo al Hub despuรฉs del entrenamiento con `push_to_hub=True`.
+
+```py
+from transformers import TrainingArguments
+
+training_args = TrainingArguments(
+ output_dir="your-model",
+ learning_rate=2e-5,
+ per_device_train_batch_size=16,
+ per_device_eval_batch_size=16,
+ num_train_epochs=2,
+ weight_decay=0.01,
+ eval_strategy="epoch",
+ save_strategy="epoch",
+ load_best_model_at_end=True,
+ push_to_hub=True,
+)
+```
+
+Pase `training_args` al [`Trainer`] con un modelo, un conjunto de datos o algo para preprocesar el conjunto de datos (dependiendo en el tipo de datos pueda ser un tokenizer, extractor de caracteristicas o procesor del imagen), un recopilador de datos y una funciรณn para calcular las mรฉtricas que desea rastrear durante el entrenamiento.
+
+Finalmente, llame [`~Trainer.train`] para empezar entrenamiento!
+
+```py
+from transformers import Trainer
+
+trainer = Trainer(
+ model=model,
+ args=training_args,
+ train_dataset=dataset["train"],
+ eval_dataset=dataset["test"],
+ processing_class=tokenizer,
+ data_collator=data_collator,
+ compute_metrics=compute_metrics,
+)
+
+trainer.train()
+```
+
+### Los puntos de control
+
+La clase [`Trainer`] guarda los puntos de control del modelo en el directorio especificado en el parรกmetro `output_dir` de [`TrainingArguments`]. Encontrarรกs los puntos de control guardados en una subcarpeta checkpoint-000 donde los nรบmeros al final corresponden al paso de entrenamiento. Guardar puntos de control es รบtil para reanudar el entrenamiento mรกs tarde.
+
+```py
+# resume from latest checkpoint
+trainer.train(resume_from_checkpoint=True)
+
+# resume from specific checkpoint saved in output directory
+trainer.train(resume_from_checkpoint="your-model/checkpoint-1000")
+```
+
+Puedes guardar tus puntos de control (por defecto, el estado del optimizador no se guarda) en el Hub configurando `push_to_hub=True` en [`TrainingArguments`] para confirmar y enviarlos. Otras opciones para decidir cรณmo se guardan tus puntos de control estรกn configuradas en el parรกmetro [`hub_strategy`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.hub_strategy):
+
+* hub_strategy="checkpoint" envรญa el รบltimo punto de control a una subcarpeta llamada "last-checkpoint" desde la cual puedes reanudar el entrenamiento.
+
+* hub_strategy="all_checkpoints" envรญa todos los puntos de control al directorio definido en `output_dir` (verรกs un punto de control por carpeta en tu repositorio de modelos).
+
+Cuando reanudas el entrenamiento desde un punto de control, el [`Trainer`] intenta mantener los estados de los generadores de nรบmeros aleatorios (RNG) de Python, NumPy y PyTorch iguales a como estaban cuando se guardรณ el punto de control. Pero debido a que PyTorch tiene varias configuraciones predeterminadas no determinรญsticas, no se garantiza que los estados de RNG sean los mismos. Si deseas habilitar la plena determinismo, echa un vistazo a la guรญa ["Controlling sources of randomness"](https://pytorch.org/docs/stable/notes/randomness#controlling-sources-of-randomness) para aprender quรฉ puedes habilitar para hacer que tu entrenamiento sea completamente determinista. Sin embargo, ten en cuenta que al hacer ciertas configuraciones deterministas, el entrenamiento puede ser mรกs lento.
+
+## Personaliza el Trainer
+
+Si bien la clase [`Trainer`] estรก diseรฑada para ser accesible y fรกcil de usar, tambiรฉn ofrece mucha capacidad de personalizaciรณn para usuarios mรกs aventureros. Muchos de los mรฉtodos del [`Trainer`] pueden ser subclasificados y sobrescritos para admitir la funcionalidad que deseas, sin tener que reescribir todo el bucle de entrenamiento desde cero para adaptarlo. Estos mรฉtodos incluyen:
+
+* [~Trainer.get_train_dataloader] crea un entrenamiento de DataLoader
+* [~Trainer.get_eval_dataloader] crea una evaluaciรณn DataLoader
+* [~Trainer.get_test_dataloader] crea una prueba de DataLoader
+* [~Trainer.log] anota la informaciรณn de los objetos varios que observa el entrenamiento
+* [~Trainer.create_optimizer_and_scheduler] crea un optimizador y la tasa programada de aprendizaje si no lo pasaron enย __init__; estos pueden ser personalizados independientes con [~Trainer.create_optimizer] y [~Trainer.create_scheduler] respectivamente
+* [~Trainer.compute_loss] computa la pรฉrdida en lote con las aportes del entrenamiento
+* [~Trainer.training_step] realiza el paso del entrenamiento
+* [~Trainer.prediction_step] realiza la predicciรณn y paso de prueba
+* [~Trainer.evaluate] evalua el modelo y da las metricas evaluativas
+* [~Trainer.predict] hace las predicciones (con las metricas si hay etiquetas disponibles) en lote de prueba
+
+Por ejemplo, si deseas personalizar el mรฉtodo [`~Trainer.compute_loss`] para usar una pรฉrdida ponderada en su lugar, puedes hacerlo de la siguiente manera:
+
+```py
+from torch import nn
+from transformers import Trainer
+
+class CustomTrainer(Trainer):
+ def compute_loss(self, model, inputs, return_outputs=False):
+ labels = inputs.pop("labels")
+ # forward pass
+ outputs = model(**inputs)
+ logits = outputs.get("logits")
+ # compute custom loss for 3 labels with different weights
+ loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([1.0, 2.0, 3.0], device=model.device))
+ loss = loss_fct(logits.view(-1, self.model.config.num_labels), labels.view(-1))
+ return (loss, outputs) if return_outputs else loss
+```
+### Callbacks
+
+Otra opciรณn para personalizar el [`Trainer`] es utilizar [callbacks](callbacks). Los callbacks *no cambian nada* en el bucle de entrenamiento. Inspeccionan el estado del bucle de entrenamiento y luego ejecutan alguna acciรณn (detenciรณn anticipada, registro de resultados, etc.) segรบn el estado. En otras palabras, un callback no puede usarse para implementar algo como una funciรณn de pรฉrdida personalizada y necesitarรกs subclasificar y sobrescribir el mรฉtodo [`~Trainer.compute_loss`] para eso.
+
+Por ejemplo, si deseas agregar un callback de detenciรณn anticipada al bucle de entrenamiento despuรฉs de 10 pasos.
+
+```py
+from transformers import TrainerCallback
+
+class EarlyStoppingCallback(TrainerCallback):
+ def __init__(self, num_steps=10):
+ self.num_steps = num_steps
+
+ def on_step_end(self, args, state, control, **kwargs):
+ if state.global_step >= self.num_steps:
+ return {"should_training_stop": True}
+ else:
+ return {}
+
+```
+Luego, pรกsalo al parรกmetro `callback` del [`Trainer`]:
+
+```py
+from transformers import Trainer
+
+trainer = Trainer(
+ model=model,
+ args=training_args,
+ train_dataset=dataset["train"],
+ eval_dataset=dataset["test"],
+ processing_class=tokenizer,
+ data_collator=data_collator,
+ compute_metrics=compute_metrics,
+ callback=[EarlyStoppingCallback()],
+)
+```
+
+## Logging
+
+
+
+Comprueba el API referencia [logging](./main_classes/logging) para mas informaciรณn sobre los niveles differentes de logging.
+
+
+
+El [`Trainer`] estรก configurado a `logging.INFO` de forma predeterminada el cual informa errores, advertencias y otra informaciรณn basica. Un [`Trainer`] rรฉplica - en entornos distributos - estรก configurado a `logging.WARNING` el cual solamente informa errores y advertencias. Puedes cambiar el nivel de logging con los parametros [`log_level`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.log_level) y [`log_level_replica`](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.log_level_replica) en [`TrainingArguments`].
+
+Para configurar el nivel de registro para cada nodo, usa el parรกmetro [`log_on_each_node`](https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments.log_on_each_node) para determinar si deseas utilizar el nivel de registro en cada nodo o solo en el nodo principal.
+
+
+
+[`Trainer`] establece el nivel de registro por separado para cada nodo en el mรฉtodo [`Trainer.init`], por lo que es posible que desees considerar establecer esto antes si estรกs utilizando otras funcionalidades de Transformers antes de crear el objeto [`Trainer`].
+
+
+
+Por ejemplo, para establecer que tu cรณdigo principal y los mรณdulos utilicen el mismo nivel de registro segรบn cada nodo:
+
+```py
+logger = logging.getLogger(__name__)
+
+logging.basicConfig(
+ format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
+ datefmt="%m/%d/%Y %H:%M:%S",
+ handlers=[logging.StreamHandler(sys.stdout)],
+)
+
+log_level = training_args.get_process_log_level()
+logger.setLevel(log_level)
+datasets.utils.logging.set_verbosity(log_level)
+transformers.utils.logging.set_verbosity(log_level)
+
+trainer = Trainer(...)
+```
+
+
+
+Usa diferentes combinaciones de `log_level` y `log_level_replica` para configurar quรฉ se registra en cada uno de los nodos.
+
+```bash
+my_app.py ... --log_level warning --log_level_replica error
+```
+
+
+
+
+Agrega el parรกmetro `log_on_each_node 0` para entornos multi-nodo.
+
+```bash
+my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0
+
+# set to only report errors
+my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0
+```
+
+
+
+
+## NEFTune
+
+[NEFTune](https://hf.co/papers/2310.05914) es una tรฉcnica que puede mejorar el rendimiento al agregar ruido a los vectores de incrustaciรณn durante el entrenamiento. Para habilitarlo en [`Trainer`], establece el parรกmetro `neftune_noise_alpha` en [`TrainingArguments`] para controlar cuรกnto ruido se agrega.
+
+```py
+from transformers import TrainingArguments, Trainer
+
+training_args = TrainingArguments(..., neftune_noise_alpha=0.1)
+trainer = Trainer(..., args=training_args)
+```
+
+NEFTune se desactiva despuรฉs del entrenamiento para restaurar la capa de incrustaciรณn original y evitar cualquier comportamiento inesperado.
+
+## Accelerate y Trainer
+
+La clase [`Trainer`] estรก impulsada por [Accelerate](https://hf.co/docs/accelerate), una biblioteca para entrenar fรกcilmente modelos de PyTorch en entornos distribuidos con soporte para integraciones como [FullyShardedDataParallel (FSDP)](https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/) y [DeepSpeed](https://www.deepspeed.ai/).
+
+
+
+Aprende mรกs sobre las estrategias de fragmentaciรณn FSDP, descarga de CPU y mรกs con el [`Trainer`] en la guรญa [Paralela de Datos Completamente Fragmentados](fsdp).
+
+
+
+Para usar Accelerate con [`Trainer`], ejecuta el comando [`accelerate.config`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-config) para configurar el entrenamiento para tu entorno de entrenamiento. Este comando crea un `config_file.yaml` que se utilizarรก cuando inicies tu script de entrenamiento. Por ejemplo, algunas configuraciones de ejemplo que puedes configurar son:
+
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+distributed_type: MULTI_GPU
+downcast_bf16: 'no'
+gpu_ids: all
+machine_rank: 0 #change rank as per the node
+main_process_ip: 192.168.20.1
+main_process_port: 9898
+main_training_function: main
+mixed_precision: fp16
+num_machines: 2
+num_processes: 8
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+distributed_type: FSDP
+downcast_bf16: 'no'
+fsdp_config:
+ fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
+ fsdp_backward_prefetch_policy: BACKWARD_PRE
+ fsdp_forward_prefetch: true
+ fsdp_offload_params: false
+ fsdp_sharding_strategy: 1
+ fsdp_state_dict_type: FULL_STATE_DICT
+ fsdp_sync_module_states: true
+ fsdp_transformer_layer_cls_to_wrap: BertLayer
+ fsdp_use_orig_params: true
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 2
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+deepspeed_config:
+ deepspeed_config_file: /home/user/configs/ds_zero3_config.json
+ zero3_init_flag: true
+distributed_type: DEEPSPEED
+downcast_bf16: 'no'
+machine_rank: 0
+main_training_function: main
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+
+
+```yml
+compute_environment: LOCAL_MACHINE
+deepspeed_config:
+ gradient_accumulation_steps: 1
+ gradient_clipping: 0.7
+ offload_optimizer_device: cpu
+ offload_param_device: cpu
+ zero3_init_flag: true
+ zero_stage: 2
+distributed_type: DEEPSPEED
+downcast_bf16: 'no'
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+
+```
+
+
+
+
+El comando [`accelerate_launch`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch) es la forma recomendada de lanzar tu script de entrenamiento en un sistema distribuido con Accelerate y [`Trainer`] con los parรกmetros especificados en `config_file.yaml`. Este archivo se guarda en la carpeta de cachรฉ de Accelerate y se carga automรกticamente cuando ejecutas `accelerate_launch`.
+
+Por ejemplo, para ejecutar el script de entrenamiento [`run_glue.py`](https://github.com/huggingface/transformers/blob/f4db565b695582891e43a5e042e5d318e28f20b8/examples/pytorch/text-classification/run_glue.py#L4) con la configuraciรณn de FSDP:
+
+```bash
+accelerate launch \
+ ./examples/pytorch/text-classification/run_glue.py \
+ --model_name_or_path bert-base-cased \
+ --task_name $TASK_NAME \
+ --do_train \
+ --do_eval \
+ --max_seq_length 128 \
+ --per_device_train_batch_size 16 \
+ --learning_rate 5e-5 \
+ --num_train_epochs 3 \
+ --output_dir /tmp/$TASK_NAME/ \
+ --overwrite_output_dir
+```
+
+Tambiรฉn puedes especificar los parรกmetros del archivo config_file.yaml directamente en la lรญnea de comandos:
+
+```bash
+accelerate launch --num_processes=2 \
+ --use_fsdp \
+ --mixed_precision=bf16 \
+ --fsdp_auto_wrap_policy=TRANSFORMER_BASED_WRAP \
+ --fsdp_transformer_layer_cls_to_wrap="BertLayer" \
+ --fsdp_sharding_strategy=1 \
+ --fsdp_state_dict_type=FULL_STATE_DICT \
+ ./examples/pytorch/text-classification/run_glue.py
+ --model_name_or_path bert-base-cased \
+ --task_name $TASK_NAME \
+ --do_train \
+ --do_eval \
+ --max_seq_length 128 \
+ --per_device_train_batch_size 16 \
+ --learning_rate 5e-5 \
+ --num_train_epochs 3 \
+ --output_dir /tmp/$TASK_NAME/ \
+ --overwrite_output_dir
+```
+
+Consulta el tutorial [Lanzamiento de tus scripts con Accelerate](https://huggingface.co/docs/accelerate/basic_tutorials/launch) para obtener mรกs informaciรณn sobre `accelerate_launch` y las configuraciones personalizadas.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/training.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/training.md
new file mode 100644
index 0000000000000000000000000000000000000000..f10f49d08997ac5f37b763c6b5f3cb284e400c88
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/es/training.md
@@ -0,0 +1,371 @@
+
+
+# Fine-tuning a un modelo pre-entrenado
+
+[[open-in-colab]]
+
+El uso de un modelo pre-entrenado tiene importantes ventajas. Reduce los costos de computaciรณn, la huella de carbono y te permite utilizar modelos de รบltima generaciรณn sin tener que entrenar uno desde cero.
+
+* Fine-tuning a un modelo pre-entrenado con ๐ค Transformers [`Trainer`].
+* Fine-tuning a un modelo pre-entrenado en TensorFlow con Keras.
+* Fine-tuning a un modelo pre-entrenado en PyTorch nativo.
+
+
+
+## Prepara un dataset
+
+
+
+Antes de aplicar fine-tuning a un modelo pre-entrenado, descarga un dataset y prepรกralo para el entrenamiento. El tutorial anterior nos enseรฑรณ cรณmo procesar los datos para el entrenamiento, y ahora es la oportunidad de poner a prueba estas habilidades.
+
+Comienza cargando el dataset de [Yelp Reviews](https://huggingface.co/datasets/yelp_review_full):
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("yelp_review_full")
+>>> dataset[100]
+{'label': 0,
+ 'text': 'My expectations for McDonalds are t rarely high. But for one to still fail so spectacularly...that takes something special!\\nThe cashier took my friends\'s order, then promptly ignored me. I had to force myself in front of a cashier who opened his register to wait on the person BEHIND me. I waited over five minutes for a gigantic order that included precisely one kid\'s meal. After watching two people who ordered after me be handed their food, I asked where mine was. The manager started yelling at the cashiers for \\"serving off their orders\\" when they didn\'t have their food. But neither cashier was anywhere near those controls, and the manager was the one serving food to customers and clearing the boards.\\nThe manager was rude when giving me my order. She didn\'t make sure that I had everything ON MY RECEIPT, and never even had the decency to apologize that I felt I was getting poor service.\\nI\'ve eaten at various McDonalds restaurants for over 30 years. I\'ve worked at more than one location. I expect bad days, bad moods, and the occasional mistake. But I have yet to have a decent experience at this store. It will remain a place I avoid unless someone in my party needs to avoid illness from low blood sugar. Perhaps I should go back to the racially biased service of Steak n Shake instead!'}
+```
+
+Como ya sabes, necesitas un tokenizador para procesar el texto e incluir una estrategia para el padding y el truncamiento para manejar cualquier longitud de secuencia variable. Para procesar tu dataset en un solo paso, utiliza el mรฉtodo de ๐ค Datasets map para aplicar una funciรณn de preprocesamiento sobre todo el dataset:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+
+>>> def tokenize_function(examples):
+... return tokenizer(examples["text"], padding="max_length", truncation=True)
+
+
+>>> tokenized_datasets = dataset.map(tokenize_function, batched=True)
+```
+
+Si lo deseas, puedes crear un subconjunto mรกs pequeรฑo del dataset completo para aplicarle fine-tuning y asรญ reducir el tiempo.
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+
+
+## Fine-tuning con `Trainer`
+
+
+
+๐ค Transformers proporciona una clase [`Trainer`] optimizada para el entrenamiento de modelos de ๐ค Transformers, haciendo mรกs fรกcil el inicio del entrenamiento sin necesidad de escribir manualmente tu propio ciclo. La API del [`Trainer`] soporta una amplia gama de opciones de entrenamiento y caracterรญsticas como el logging, el gradient accumulation y el mixed precision.
+
+Comienza cargando tu modelo y especifica el nรบmero de labels previstas. A partir del [Card Dataset](https://huggingface.co/datasets/yelp_review_full#data-fields) de Yelp Review, que como ya sabemos tiene 5 labels:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+
+
+Verรกs una advertencia acerca de que algunos de los pesos pre-entrenados no estรกn siendo utilizados y que algunos pesos estรกn siendo inicializados al azar. No te preocupes, esto es completamente normal.
+El head/cabezal pre-entrenado del modelo BERT se descarta y se sustituye por un head de clasificaciรณn inicializado aleatoriamente. Puedes aplicar fine-tuning a este nuevo head del modelo en tu tarea de clasificaciรณn de secuencias haciendo transfer learning del modelo pre-entrenado.
+
+
+
+### Hiperparรกmetros de entrenamiento
+
+A continuaciรณn, crea una clase [`TrainingArguments`] que contenga todos los hiperparรกmetros que puedes ajustar asรญ como los indicadores para activar las diferentes opciones de entrenamiento. Para este tutorial puedes empezar con los [hiperparรกmetros](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments) de entrenamiento por defecto, pero siรฉntete libre de experimentar con ellos para encontrar tu configuraciรณn รณptima.
+
+Especifica dรณnde vas a guardar los checkpoints de tu entrenamiento:
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> training_args = TrainingArguments(output_dir="test_trainer")
+```
+
+### Mรฉtricas
+
+El [`Trainer`] no evalรบa automรกticamente el rendimiento del modelo durante el entrenamiento. Tendrรกs que pasarle a [`Trainer`] una funciรณn para calcular y hacer un reporte de las mรฉtricas. La biblioteca de ๐ค Datasets proporciona una funciรณn de [`accuracy`](https://huggingface.co/metrics/accuracy) simple que puedes cargar con la funciรณn `load_metric` (ver este [tutorial](https://huggingface.co/docs/datasets/metrics) para mรกs informaciรณn):
+
+```py
+>>> import numpy as np
+>>> from datasets import load_metric
+
+>>> metric = load_metric("accuracy")
+```
+
+Define la funciรณn `compute` en `metric` para calcular el accuracy de tus predicciones. Antes de pasar tus predicciones a `compute`, necesitas convertir las predicciones a logits (recuerda que todos los modelos de ๐ค Transformers devuelven logits).
+
+```py
+>>> def compute_metrics(eval_pred):
+... logits, labels = eval_pred
+... predictions = np.argmax(logits, axis=-1)
+... return metric.compute(predictions=predictions, references=labels)
+```
+
+Si quieres controlar tus mรฉtricas de evaluaciรณn durante el fine-tuning, especifica el parรกmetro `eval_strategy` en tus argumentos de entrenamiento para que el modelo tenga en cuenta la mรฉtrica de evaluaciรณn al final de cada รฉpoca:
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> training_args = TrainingArguments(output_dir="test_trainer", eval_strategy="epoch")
+```
+
+### Trainer
+
+Crea un objeto [`Trainer`] con tu modelo, argumentos de entrenamiento, datasets de entrenamiento y de prueba, y tu funciรณn de evaluaciรณn:
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+A continuaciรณn, aplica fine-tuning a tu modelo llamando [`~transformers.Trainer.train`]:
+
+```py
+>>> trainer.train()
+```
+
+
+
+## Fine-tuning con Keras
+
+
+
+Los modelos de ๐ค Transformers tambiรฉn permiten realizar el entrenamiento en TensorFlow con la API de Keras. Solo es necesario hacer algunos cambios antes de hacer fine-tuning.
+
+### Convierte el dataset al formato de TensorFlow
+
+El [`DefaultDataCollator`] junta los tensores en un batch para que el modelo se entrene en รฉl. Asegรบrate de especificar `return_tensors` para devolver los tensores de TensorFlow:
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+```
+
+
+
+[`Trainer`] utiliza [`DataCollatorWithPadding`] por defecto por lo que no es necesario especificar explรญcitamente un intercalador de datos (data collator, en inglรฉs).
+
+
+
+A continuaciรณn, convierte los datasets tokenizados en datasets de TensorFlow con el mรฉtodo [`to_tf_dataset`](https://huggingface.co/docs/datasets/package_reference/main_classes#datasets.Dataset.to_tf_dataset). Especifica tus entradas en `columns` y tu etiqueta en `label_cols`:
+
+```py
+>>> tf_train_dataset = small_train_dataset.to_tf_dataset(
+... columns=["attention_mask", "input_ids", "token_type_ids"],
+... label_cols="labels",
+... shuffle=True,
+... collate_fn=data_collator,
+... batch_size=8,
+... )
+
+>>> tf_validation_dataset = small_eval_dataset.to_tf_dataset(
+... columns=["attention_mask", "input_ids", "token_type_ids"],
+... label_cols="labels",
+... shuffle=False,
+... collate_fn=data_collator,
+... batch_size=8,
+... )
+```
+
+### Compila y ajusta
+
+Carguemos un modelo TensorFlow con el nรบmero esperado de labels:
+
+```py
+>>> import tensorflow as tf
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+A continuaciรณn, compila y aplica fine-tuning a tu modelo con [`fit`](https://keras.io/api/models/model_training_apis/) como lo harรญas con cualquier otro modelo de Keras:
+
+```py
+>>> model.compile(
+... optimizer=tf.keras.optimizers.Adam(learning_rate=5e-5),
+... loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
+... metrics=tf.metrics.SparseCategoricalAccuracy(),
+... )
+
+>>> model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3)
+```
+
+
+
+## Fine-tune en PyTorch nativo
+
+
+
+El [`Trainer`] se encarga del ciclo de entrenamiento y permite aplicar fine-tuning a un modelo en una sola lรญnea de cรณdigo. Para los que prefieran escribir su propio ciclo de entrenamiento, tambiรฉn pueden aplicar fine-tuning a un modelo de ๐ค Transformers en PyTorch nativo.
+
+En este punto, es posible que necesites reiniciar tu notebook o ejecutar el siguiente cรณdigo para liberar algo de memoria:
+
+```py
+del model
+del pytorch_model
+del trainer
+torch.cuda.empty_cache()
+```
+
+A continuaciรณn, haremos un post-procesamiento manual al `tokenized_dataset` y asรญ prepararlo para el entrenamiento.
+
+1. Elimina la columna de `text` porque el modelo no acepta texto en crudo como entrada:
+
+ ```py
+ >>> tokenized_datasets = tokenized_datasets.remove_columns(["text"])
+ ```
+
+2. Cambia el nombre de la columna de `label` a `labels` porque el modelo espera que el argumento se llame `labels`:
+
+ ```py
+ >>> tokenized_datasets = tokenized_datasets.rename_column("label", "labels")
+ ```
+
+3. Establece el formato del dataset para devolver tensores PyTorch en lugar de listas:
+
+ ```py
+ >>> tokenized_datasets.set_format("torch")
+ ```
+
+A continuaciรณn, crea un subconjunto mรกs pequeรฑo del dataset como se ha mostrado anteriormente para acelerar el fine-tuning:
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+### DataLoader
+
+Crea un `DataLoader` para tus datasets de entrenamiento y de prueba para poder iterar sobre batches de datos:
+
+```py
+>>> from torch.utils.data import DataLoader
+
+>>> train_dataloader = DataLoader(small_train_dataset, shuffle=True, batch_size=8)
+>>> eval_dataloader = DataLoader(small_eval_dataset, batch_size=8)
+```
+
+Carga tu modelo con el nรบmero de labels previstas:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+### Optimiza y programa el learning rate
+
+Crea un optimizador y el learning rate para aplicar fine-tuning al modelo. Vamos a utilizar el optimizador [`AdamW`](https://pytorch.org/docs/stable/generated/torch.optim.AdamW.html) de PyTorch:
+
+```py
+>>> from torch.optim import AdamW
+
+>>> optimizer = AdamW(model.parameters(), lr=5e-5)
+```
+
+Crea el learning rate desde el [`Trainer`]:
+
+```py
+>>> from transformers import get_scheduler
+
+>>> num_epochs = 3
+>>> num_training_steps = num_epochs * len(train_dataloader)
+>>> lr_scheduler = get_scheduler(
+... name="linear", optimizer=optimizer, num_warmup_steps=0, num_training_steps=num_training_steps
+... )
+```
+
+Por รบltimo, especifica el `device` o entorno de ejecuciรณn para utilizar una GPU si tienes acceso a una. De lo contrario, el entrenamiento en una CPU puede llevarte varias horas en lugar de un par de minutos.
+
+```py
+>>> import torch
+
+>>> device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+>>> model.to(device)
+```
+
+
+
+Consigue acceso gratuito a una GPU en la nube si es que no tienes este recurso de forma local con un notebook alojado en [Colaboratory](https://colab.research.google.com/) o [SageMaker StudioLab](https://studiolab.sagemaker.aws/).
+
+
+
+Genial, ยกahora podemos entrenar! ๐ฅณ
+
+### Ciclo de entrenamiento
+
+Para hacer un seguimiento al progreso del entrenamiento, utiliza la biblioteca [tqdm](https://tqdm.github.io/) para aรฑadir una barra de progreso sobre el nรบmero de pasos de entrenamiento:
+
+```py
+>>> from tqdm.auto import tqdm
+
+>>> progress_bar = tqdm(range(num_training_steps))
+
+>>> model.train()
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... outputs = model(**batch)
+... loss = outputs.loss
+... loss.backward()
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+### Mรฉtricas
+
+De la misma manera que necesitas aรฑadir una funciรณn de evaluaciรณn al [`Trainer`], necesitas hacer lo mismo cuando escribas tu propio ciclo de entrenamiento. Pero en lugar de calcular y reportar la mรฉtrica al final de cada รฉpoca, esta vez acumularรกs todos los batches con [`add_batch`](https://huggingface.co/docs/datasets/package_reference/main_classes?highlight=add_batch#datasets.Metric.add_batch) y calcularรกs la mรฉtrica al final.
+
+```py
+>>> metric = load_metric("accuracy")
+>>> model.eval()
+>>> for batch in eval_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... with torch.no_grad():
+... outputs = model(**batch)
+
+... logits = outputs.logits
+... predictions = torch.argmax(logits, dim=-1)
+... metric.add_batch(predictions=predictions, references=batch["labels"])
+
+>>> metric.compute()
+```
+
+
+
+## Recursos adicionales
+
+Para mรกs ejemplos de fine-tuning consulta:
+
+- [๐ค Transformers Examples](https://github.com/huggingface/transformers/tree/main/examples) incluye scripts
+ para entrenar tareas comunes de NLP en PyTorch y TensorFlow.
+
+- [๐ค Transformers Notebooks](notebooks) contiene varios notebooks sobre cรณmo aplicar fine-tuning a un modelo para tareas especรญficas en PyTorch y TensorFlow.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/_config.py b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/_config.py
new file mode 100644
index 0000000000000000000000000000000000000000..f3f59bf5202b3fdefbbee649a16dc9ef61aa0411
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/_config.py
@@ -0,0 +1,14 @@
+# docstyle-ignore
+INSTALL_CONTENT = """
+# Installation de Transformers
+! pip install transformers datasets evaluate accelerate
+# Pour installer ร partir du code source au lieu de la derniรจre version, commentez la commande ci-dessus et dรฉcommentez la suivante.
+# ! pip install git+https://github.com/huggingface/transformers.git
+"""
+
+notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
+black_avoid_patterns = {
+ "{processor_class}": "FakeProcessorClass",
+ "{model_class}": "FakeModelClass",
+ "{object_class}": "FakeObjectClass",
+}
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/_toctree.yml b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/_toctree.yml
new file mode 100644
index 0000000000000000000000000000000000000000..a16283c719671a3bbd51e8a11a0239b813287d96
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/_toctree.yml
@@ -0,0 +1,36 @@
+- sections:
+ - local: index
+ title: ๐ค Transformers
+ - local: quicktour
+ title: Visite rapide
+ - local: installation
+ title: Installation
+ title: Dรฉmarrer
+- sections:
+ - local: tutoriel_pipeline
+ title: Pipelines pour l'infรฉrence
+ - local: autoclass_tutorial
+ title: Chargement d'instances prรฉ-entraรฎnรฉes avec une AutoClass
+ - local: in_translation
+ title: Prรฉparation des donnรฉes
+ - local: in_translation
+ title: Fine-tune un modรจle prรฉ-entraรฎnรฉ
+ - local: run_scripts_fr
+ title: Entraรฎnement avec un script
+ - local: in_translation
+ title: Entraรฎnement distribuรฉ avec ๐ค Accelerate
+ - local: in_translation
+ title: Chargement et entraรฎnement des adaptateurs avec ๐ค PEFT
+ - local: in_translation
+ title: Partager un modรจle
+ - local: in_translation
+ title: Agents
+ - local: in_translation
+ title: Gรฉnรฉration avec LLMs
+ title: Tutoriels
+- sections:
+ - local: task_summary
+ title: Ce que ๐ค Transformers peut faire
+ - local: tasks_explained
+ title: Comment ๐ค Transformers rรฉsout ces tรขches
+ title: Guides conceptuels
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/autoclass_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/autoclass_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..1f3baac07ce69993d49dc597b03a2d76f53add8a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/autoclass_tutorial.md
@@ -0,0 +1,186 @@
+
+
+# Chargement d'instances prรฉ-entraรฎnรฉes avec une AutoClass
+
+Avec autant d'architectures Transformer diffรฉrentes, il peut รชtre difficile d'en crรฉer une pour votre ensemble de poids (aussi appelรฉs "weights" ou "checkpoint" en anglais). Dans l'idรฉe de crรฉer une librairie facile, simple et flexible ร utiliser, ๐ค Transformers fournit une `AutoClass` qui infรจre et charge automatiquement l'architecture correcte ร partir d'un ensemble de poids donnรฉ. La fonction `from_pretrained()` vous permet de charger rapidement un modรจle prรฉ-entraรฎnรฉ pour n'importe quelle architecture afin que vous n'ayez pas ร consacrer du temps et des ressources ร l'entraรฎnement d'un modรจle ร partir de zรฉro. Produire un tel code indรฉpendant d'un ensemble de poids signifie que si votre code fonctionne pour un ensemble de poids, il fonctionnera avec un autre ensemble - tant qu'il a รฉtรฉ entraรฎnรฉ pour une tรขche similaire - mรชme si l'architecture est diffรฉrente.
+
+
+
+Rappel, l'architecture fait rรฉfรฉrence au squelette du modรจle et l'ensemble de poids contient les poids pour une architecture donnรฉe. Par exemple, [BERT](https://huggingface.co/google-bert/bert-base-uncased) est une architecture, tandis que `google-bert/bert-base-uncased` est un ensemble de poids. Le terme modรจle est gรฉnรฉral et peut signifier soit architecture soit ensemble de poids.
+
+
+
+Dans ce tutoriel, vous apprendrez ร :
+
+ * Charger un tokenizer prรฉ-entraรฎnรฉ.
+ * Charger un processeur d'image prรฉ-entraรฎnรฉ.
+ * Charger un extracteur de caractรฉristiques prรฉ-entraรฎnรฉ.
+ * Charger un processeur prรฉ-entraรฎnรฉ.
+ * Charger un modรจle prรฉ-entraรฎnรฉ.
+
+## AutoTokenizer
+
+Quasiment toutes les tรขches de traitement du langage (NLP) commencent avec un tokenizer. Un tokenizer convertit votre texte initial dans un format qui peut รชtre traitรฉ par le modรจle.
+
+Chargez un tokenizer avec [`AutoTokenizer.from_pretrained`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
+```
+
+Puis, transformez votre texte initial comme montrรฉ ci-dessous:
+
+```py
+>>> sequence = "In a hole in the ground there lived a hobbit."
+>>> print(tokenizer(sequence))
+{'input_ids': [101, 1999, 1037, 4920, 1999, 1996, 2598, 2045, 2973, 1037, 7570, 10322, 4183, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+## AutoImageProcessor
+
+Pour les tรขches de vision, un processeur d'image traite l'image pour la formater correctment.
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+```
+
+## AutoBackbone
+
+
+
+
Un backbone Swin avec plusieurs รฉtapes pour produire une carte de caractรฉristiques.
+
+
+[`AutoBackbone`] vous permet d'utiliser des modรจles prรฉ-entraรฎnรฉs comme backbones pour obtenir des cartes de caractรฉristiques ร partir de diffรฉrentes รฉtapes du backbone. Vous devez spรฉcifier l'un des paramรจtres suivants dans [`~PretrainedConfig.from_pretrained`] :
+
+* `out_indices` est l'index de la couche dont vous souhaitez obtenir la carte de caractรฉristiques
+* `out_features` est le nom de la couche dont vous souhaitez obtenir la carte de caractรฉristiques
+
+Ces paramรจtres peuvent รชtre utilisรฉs de maniรจre interchangeable, mais si vous utilisez les deux, assurez-vous qu'ils sont alignรฉs l'un avec l'autre ! Si vous ne passez aucun de ces paramรจtres, le backbone renvoie la carte de caractรฉristiques de la derniรจre couche.
+
+
+
+
Une carte de caractรฉristiques de la premiรจre รฉtape du backbone. La partition de patch fait rรฉfรฉrence ร la tige du modรจle.
+
+
+Par exemple, dans le diagramme ci-dessus, pour renvoyer la carte de caractรฉristiques de la premiรจre รฉtape du backbone Swin, vous pouvez dรฉfinir `out_indices=(1,)` :
+
+```py
+>>> from transformers import AutoImageProcessor, AutoBackbone
+>>> import torch
+>>> from PIL import Image
+>>> import requests
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+>>> processor = AutoImageProcessor.from_pretrained("microsoft/swin-tiny-patch4-window7-224")
+>>> model = AutoBackbone.from_pretrained("microsoft/swin-tiny-patch4-window7-224", out_indices=(1,))
+
+>>> inputs = processor(image, return_tensors="pt")
+>>> outputs = model(**inputs)
+>>> feature_maps = outputs.feature_maps
+```
+
+Vous pouvez maintenant accรฉder ร l'objet `feature_maps` de la premiรจre รฉtape du backbone :
+
+
+```py
+>>> list(feature_maps[0].shape)
+[1, 96, 56, 56]
+```
+
+## AutoFeatureExtractor
+
+Pour les tรขches audio, un extracteur de caractรฉristiques (aussi appelรฉs "features" en anglais) traite le signal audio pour le formater correctement.
+
+Chargez un extracteur de caractรฉristiques avec [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained(
+... "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
+... )
+```
+
+## AutoProcessor
+
+Les tรขches multimodales nรฉcessitent un processeur qui combine deux types d'outils de prรฉtraitement. Par exemple, le modรจle [LayoutLMV2](model_doc/layoutlmv2) nรฉcessite un processeur d'image pour traiter les images et un tokenizer pour traiter le texte ; un processeur combine les deux.
+
+Chargez un processeur avec [`AutoProcessor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("microsoft/layoutlmv2-base-uncased")
+```
+
+## AutoModel
+
+
+
+Enfin, les classes `AutoModelFor` vous permettent de charger un modรจle prรฉ-entraรฎnรฉ pour une tรขche donnรฉe (voir [ici](model_doc/auto) pour une liste complรจte des tรขches disponibles). Par exemple, chargez un modรจle pour la classification de sรฉquence avec [`AutoModelForSequenceClassification.from_pretrained`]:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Rรฉutilisez facilement le mรชme ensemble de poids pour charger une architecture pour une tรขche diffรฉrente :
+
+```py
+>>> from transformers import AutoModelForTokenClassification
+
+>>> model = AutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+Pour les modรจles PyTorch, la fonction `from_pretrained()` utilise `torch.load()` qui utilise `pickle` en interne et est connu pour รชtre non sรฉcurisรฉ. En gรฉnรฉral, ne chargez jamais un modรจle qui pourrait provenir d'une source non fiable, ou qui pourrait avoir รฉtรฉ altรฉrรฉ. Ce risque de sรฉcuritรฉ est partiellement attรฉnuรฉ pour les modรจles hรฉbergรฉs publiquement sur le Hugging Face Hub, qui sont [scannรฉs pour les logiciels malveillants](https://huggingface.co/docs/hub/security-malware) ร chaque modification. Consultez la [documentation du Hub](https://huggingface.co/docs/hub/security) pour connaรฎtre les meilleures pratiques comme la [vรฉrification des modifications signรฉes](https://huggingface.co/docs/hub/security-gpg#signing-commits-with-gpg) avec GPG.
+
+Les points de contrรดle TensorFlow et Flax ne sont pas concernรฉs, et peuvent รชtre chargรฉs dans des architectures PyTorch en utilisant les arguments `from_tf` et `from_flax` de la fonction `from_pretrained` pour contourner ce problรจme.
+
+
+
+En gรฉnรฉral, nous recommandons d'utiliser les classes `AutoTokenizer` et `AutoModelFor` pour charger des instances prรฉ-entraรฎnรฉes de tokenizers et modรจles respectivement. Cela vous permettra de charger la bonne architecture ร chaque fois. Dans le prochain [tutoriel](preprocessing), vous apprenez ร utiliser un tokenizer, processeur d'image, extracteur de caractรฉristiques et processeur pour prรฉ-traiter un jeu de donnรฉes pour le fine-tuning.
+
+
+Enfin, les classes `TFAutoModelFor` vous permettent de charger un modรจle prรฉ-entraรฎnรฉ pour une tรขche donnรฉe (voir [ici](model_doc/auto) pour une liste complรจte des tรขches disponibles). Par exemple, chargez un modรจle pour la classification de sรฉquence avec [`TFAutoModelForSequenceClassification.from_pretrained`]:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Rรฉutilisez facilement le mรชme ensemble de poids pour charger une architecture pour une tรขche diffรฉrente :
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+En gรฉnรฉral, nous recommandons d'utiliser les classes `AutoTokenizer` et `TFAutoModelFor` pour charger des instances prรฉ-entraรฎnรฉes de tokenizers et modรจles respectivement. Cela vous permettra de charger la bonne architecture ร chaque fois. Dans le prochain [tutoriel](preprocessing), vous apprenez ร utiliser un tokenizer, processeur d'image, extracteur de caractรฉristiques et processeur pour prรฉ-traiter un jeu de donnรฉes pour le fine-tuning.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/in_translation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/in_translation.md
new file mode 100644
index 0000000000000000000000000000000000000000..910559ef6c9a0af10f6991c5464f52d4659f3426
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/in_translation.md
@@ -0,0 +1,5 @@
+
+
+# Traduction en cours.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/index.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/index.md
new file mode 100644
index 0000000000000000000000000000000000000000..51d35b76e877dbe80676c4e12508c36d16fd2a44
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/index.md
@@ -0,0 +1,412 @@
+
+
+# ๐ค Transformers
+
+Apprentissage automatique de pointe pour [PyTorch](https://pytorch.org/), [TensorFlow](https://www.tensorflow.org/), et [JAX](https://jax.readthedocs.io/en/latest/).
+
+๐ค Transformers fournit des API et des outils pour tรฉlรฉcharger et entraรฎner facilement des modรจles prรฉ-entraรฎnรฉs de pointe. L'utilisation de modรจles prรฉ-entraรฎnรฉs peut rรฉduire vos coรปts de calcul, votre empreinte carbone, et vous faire รฉconomiser le temps et les ressources nรฉcessaires pour entraรฎner un modรจle ร partir de zรฉro. Ces modรจles prennent en charge des tรขches courantes dans diffรฉrentes modalitรฉs, telles que :
+
+๐ **Traitement automatique des langues**: classification de texte, reconnaissance d'entitรฉs, systรจme de question-rรฉponse, modรจle de langage, gรฉnรฉration de rรฉsumรฉ, traduction, question ร choix multiples et gรฉnรฉration de texte.
+๐ผ๏ธ **Vision par ordinateur**: classification d'image, dรฉtection d'objet et segmentation.
+๐ฃ๏ธ **Audio**: reconnaissance automatique de la parole et classification audio.
+๐ **Multimodalitรฉ**: systรจme de question-rรฉponse avec des tableaux ou images, reconnaissance optique de caractรจres, extraction d'information depuis des documents scannรฉs et classification de vidรฉo.
+
+๐ค Transformers prend en charge l'interopรฉrabilitรฉ entre PyTorch, TensorFlow et JAX. Cela permet d'utiliser un framework diffรฉrent ร chaque รฉtape de la vie d'un modรจle, par exemple entraรฎner un modรจle en trois lignes de code avec un framework, et le charger pour l'infรฉrence avec un autre. Les modรจles peuvent รฉgalement รชtre exportรฉs dans un format comme ONNX et TorchScript pour รชtre dรฉployรฉs dans des environnements de production.
+
+Rejoignez la communautรฉ grandissante sur le [Hub](https://huggingface.co/models), le [forum](https://discuss.huggingface.co/) ou [Discord](https://discord.com/invite/JfAtkvEtRb) dรจs aujourd'hui !
+
+## Si vous cherchez un support personnalisรฉ de l'รฉquipe Hugging Face
+
+
+
+
+
+## Contenu
+
+La documentation est organisรฉe en 5 parties:
+
+- **DEMARRER** propose une visite rapide de la bibliothรจque et des instructions d'installation pour รชtre opรฉrationnel.
+- **TUTORIELS** excellent point de dรฉpart pour les dรฉbutants. Cette section vous aidera ร acquรฉrir les compรฉtences de base dont vous avez besoin pour commencer ร utiliser la bibliothรจque.
+- **GUIDES D'UTILISATION** pour diffรฉrentes tรขches comme par exemple le finetuning d'un modรจle prรฉ-entraรฎnรฉ pour la classification de texte ou comment crรฉer et partager votre propre modรจle.
+- **GUIDES CONCEPTUELS** pour plus de discussions et d'explications sur les concepts et les idรฉes sous-jacentes aux modรจles, aux tรขches et ร la philosophie de conception de ๐ค Transformers.
+- **API** dรฉcrit toutes les classes et fonctions :
+
+ - **CLASSES PRINCIPALES** dรฉtaille les classes les plus importantes comme la configuration, le modรจle, le tokenizer et le pipeline..
+ - **MODELES** dรฉtaille les classes et les fonctions propres ร chaque modรจle de la bibliothรจque.
+ - **UTILITAIRES INTERNES** dรฉtaille les classes et fonctions utilitaires utilisรฉes en interne.
+
+### Modรจles supportรฉs
+
+
+
+1. **[ALBERT](model_doc/albert)** (from Google Research and the Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), by Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.
+1. **[ALIGN](model_doc/align)** (from Google Research) released with the paper [Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision](https://arxiv.org/abs/2102.05918) by Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yunhsuan Sung, Zhen Li, Tom Duerig.
+1. **[AltCLIP](model_doc/altclip)** (from BAAI) released with the paper [AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities](https://arxiv.org/abs/2211.06679) by Chen, Zhongzhi and Liu, Guang and Zhang, Bo-Wen and Ye, Fulong and Yang, Qinghong and Wu, Ledell.
+1. **[Audio Spectrogram Transformer](model_doc/audio-spectrogram-transformer)** (from MIT) released with the paper [AST: Audio Spectrogram Transformer](https://arxiv.org/abs/2104.01778) by Yuan Gong, Yu-An Chung, James Glass.
+1. **[BART](model_doc/bart)** (from Facebook) released with the paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/abs/1910.13461) by Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov and Luke Zettlemoyer.
+1. **[BARThez](model_doc/barthez)** (from รcole polytechnique) released with the paper [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321) by Moussa Kamal Eddine, Antoine J.-P. Tixier, Michalis Vazirgiannis.
+1. **[BARTpho](model_doc/bartpho)** (from VinAI Research) released with the paper [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese](https://arxiv.org/abs/2109.09701) by Nguyen Luong Tran, Duong Minh Le and Dat Quoc Nguyen.
+1. **[BEiT](model_doc/beit)** (from Microsoft) released with the paper [BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) by Hangbo Bao, Li Dong, Furu Wei.
+1. **[BERT](model_doc/bert)** (from Google) released with the paper [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) by Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova.
+1. **[BERT For Sequence Generation](model_doc/bert-generation)** (from Google) released with the paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) by Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[BERTweet](model_doc/bertweet)** (from VinAI Research) released with the paper [BERTweet: A pre-trained language model for English Tweets](https://aclanthology.org/2020.emnlp-demos.2/) by Dat Quoc Nguyen, Thanh Vu and Anh Tuan Nguyen.
+1. **[BigBird-Pegasus](model_doc/bigbird_pegasus)** (from Google Research) released with the paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) by Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[BigBird-RoBERTa](model_doc/big_bird)** (from Google Research) released with the paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) by Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[BioGpt](model_doc/biogpt)** (from Microsoft Research AI4Science) released with the paper [BioGPT: generative pre-trained transformer for biomedical text generation and mining](https://academic.oup.com/bib/advance-article/doi/10.1093/bib/bbac409/6713511?guestAccessKey=a66d9b5d-4f83-4017-bb52-405815c907b9) by Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon and Tie-Yan Liu.
+1. **[BiT](model_doc/bit)** (from Google AI) released with the paper [Big Transfer (BiT): General Visual Representation Learning](https://arxiv.org/abs/1912.11370) by Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, Neil Houlsby.
+1. **[Blenderbot](model_doc/blenderbot)** (from Facebook) released with the paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) by Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BlenderbotSmall](model_doc/blenderbot-small)** (from Facebook) released with the paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) by Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BLIP](model_doc/blip)** (from Salesforce) released with the paper [BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation](https://arxiv.org/abs/2201.12086) by Junnan Li, Dongxu Li, Caiming Xiong, Steven Hoi.
+1. **[BLOOM](model_doc/bloom)** (from BigScience workshop) released by the [BigScience Workshop](https://bigscience.huggingface.co/).
+1. **[BORT](model_doc/bort)** (from Alexa) released with the paper [Optimal Subarchitecture Extraction For BERT](https://arxiv.org/abs/2010.10499) by Adrian de Wynter and Daniel J. Perry.
+1. **[BridgeTower](model_doc/bridgetower)** (from Harbin Institute of Technology/Microsoft Research Asia/Intel Labs) released with the paper [BridgeTower: Building Bridges Between Encoders in Vision-Language Representation Learning](https://arxiv.org/abs/2206.08657) by Xiao Xu, Chenfei Wu, Shachar Rosenman, Vasudev Lal, Wanxiang Che, Nan Duan.
+1. **[ByT5](model_doc/byt5)** (from Google Research) released with the paper [ByT5: Towards a token-free future with pre-trained byte-to-byte models](https://arxiv.org/abs/2105.13626) by Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, Colin Raffel.
+1. **[CamemBERT](model_doc/camembert)** (from Inria/Facebook/Sorbonne) released with the paper [CamemBERT: a Tasty French Language Model](https://arxiv.org/abs/1911.03894) by Louis Martin*, Benjamin Muller*, Pedro Javier Ortiz Suรกrez*, Yoann Dupont, Laurent Romary, รric Villemonte de la Clergerie, Djamรฉ Seddah and Benoรฎt Sagot.
+1. **[CANINE](model_doc/canine)** (from Google Research) released with the paper [CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representation](https://arxiv.org/abs/2103.06874) by Jonathan H. Clark, Dan Garrette, Iulia Turc, John Wieting.
+1. **[Chinese-CLIP](model_doc/chinese_clip)** (from OFA-Sys) released with the paper [Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese](https://arxiv.org/abs/2211.01335) by An Yang, Junshu Pan, Junyang Lin, Rui Men, Yichang Zhang, Jingren Zhou, Chang Zhou.
+1. **[CLIP](model_doc/clip)** (from OpenAI) released with the paper [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020) by Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever.
+1. **[CLIPSeg](model_doc/clipseg)** (from University of Gรถttingen) released with the paper [Image Segmentation Using Text and Image Prompts](https://arxiv.org/abs/2112.10003) by Timo Lรผddecke and Alexander Ecker.
+1. **[CodeGen](model_doc/codegen)** (from Salesforce) released with the paper [A Conversational Paradigm for Program Synthesis](https://arxiv.org/abs/2203.13474) by Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, Caiming Xiong.
+1. **[Conditional DETR](model_doc/conditional_detr)** (from Microsoft Research Asia) released with the paper [Conditional DETR for Fast Training Convergence](https://arxiv.org/abs/2108.06152) by Depu Meng, Xiaokang Chen, Zejia Fan, Gang Zeng, Houqiang Li, Yuhui Yuan, Lei Sun, Jingdong Wang.
+1. **[ConvBERT](model_doc/convbert)** (from YituTech) released with the paper [ConvBERT: Improving BERT with Span-based Dynamic Convolution](https://arxiv.org/abs/2008.02496) by Zihang Jiang, Weihao Yu, Daquan Zhou, Yunpeng Chen, Jiashi Feng, Shuicheng Yan.
+1. **[ConvNeXT](model_doc/convnext)** (from Facebook AI) released with the paper [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545) by Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, Saining Xie.
+1. **[ConvNeXTV2](model_doc/convnextv2)** (from Facebook AI) released with the paper [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://arxiv.org/abs/2301.00808) by Sanghyun Woo, Shoubhik Debnath, Ronghang Hu, Xinlei Chen, Zhuang Liu, In So Kweon, Saining Xie.
+1. **[CPM](model_doc/cpm)** (from Tsinghua University) released with the paper [CPM: A Large-scale Generative Chinese Pre-trained Language Model](https://arxiv.org/abs/2012.00413) by Zhengyan Zhang, Xu Han, Hao Zhou, Pei Ke, Yuxian Gu, Deming Ye, Yujia Qin, Yusheng Su, Haozhe Ji, Jian Guan, Fanchao Qi, Xiaozhi Wang, Yanan Zheng, Guoyang Zeng, Huanqi Cao, Shengqi Chen, Daixuan Li, Zhenbo Sun, Zhiyuan Liu, Minlie Huang, Wentao Han, Jie Tang, Juanzi Li, Xiaoyan Zhu, Maosong Sun.
+1. **[CTRL](model_doc/ctrl)** (from Salesforce) released with the paper [CTRL: A Conditional Transformer Language Model for Controllable Generation](https://arxiv.org/abs/1909.05858) by Nitish Shirish Keskar*, Bryan McCann*, Lav R. Varshney, Caiming Xiong and Richard Socher.
+1. **[CvT](model_doc/cvt)** (from Microsoft) released with the paper [CvT: Introducing Convolutions to Vision Transformers](https://arxiv.org/abs/2103.15808) by Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, Lei Zhang.
+1. **[Data2Vec](model_doc/data2vec)** (from Facebook) released with the paper [Data2Vec: A General Framework for Self-supervised Learning in Speech, Vision and Language](https://arxiv.org/abs/2202.03555) by Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, Michael Auli.
+1. **[DeBERTa](model_doc/deberta)** (from Microsoft) released with the paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) by Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[DeBERTa-v2](model_doc/deberta-v2)** (from Microsoft) released with the paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) by Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[Decision Transformer](model_doc/decision_transformer)** (from Berkeley/Facebook/Google) released with the paper [Decision Transformer: Reinforcement Learning via Sequence Modeling](https://arxiv.org/abs/2106.01345) by Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, Igor Mordatch.
+1. **[Deformable DETR](model_doc/deformable_detr)** (from SenseTime Research) released with the paper [Deformable DETR: Deformable Transformers for End-to-End Object Detection](https://arxiv.org/abs/2010.04159) by Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, Jifeng Dai.
+1. **[DeiT](model_doc/deit)** (from Facebook) released with the paper [Training data-efficient image transformers & distillation through attention](https://arxiv.org/abs/2012.12877) by Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, Hervรฉ Jรฉgou.
+1. **[DETA](model_doc/deta)** (from The University of Texas at Austin) released with the paper [NMS Strikes Back](https://arxiv.org/abs/2212.06137) by Jeffrey Ouyang-Zhang, Jang Hyun Cho, Xingyi Zhou, Philipp Krรคhenbรผhl.
+1. **[DETR](model_doc/detr)** (from Facebook) released with the paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) by Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko.
+1. **[DialoGPT](model_doc/dialogpt)** (from Microsoft Research) released with the paper [DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation](https://arxiv.org/abs/1911.00536) by Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, Bill Dolan.
+1. **[DiNAT](model_doc/dinat)** (from SHI Labs) released with the paper [Dilated Neighborhood Attention Transformer](https://arxiv.org/abs/2209.15001) by Ali Hassani and Humphrey Shi.
+1. **[DistilBERT](model_doc/distilbert)** (from HuggingFace), released together with the paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter](https://arxiv.org/abs/1910.01108) by Victor Sanh, Lysandre Debut and Thomas Wolf. The same method has been applied to compress GPT2 into [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), RoBERTa into [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), Multilingual BERT into [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation) and a German version of DistilBERT.
+1. **[DiT](model_doc/dit)** (from Microsoft Research) released with the paper [DiT: Self-supervised Pre-training for Document Image Transformer](https://arxiv.org/abs/2203.02378) by Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei.
+1. **[Donut](model_doc/donut)** (from NAVER), released together with the paper [OCR-free Document Understanding Transformer](https://arxiv.org/abs/2111.15664) by Geewook Kim, Teakgyu Hong, Moonbin Yim, Jeongyeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, Seunghyun Park.
+1. **[DPR](model_doc/dpr)** (from Facebook) released with the paper [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906) by Vladimir Karpukhin, Barlas Oฤuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih.
+1. **[DPT](master/model_doc/dpt)** (from Intel Labs) released with the paper [Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413) by Renรฉ Ranftl, Alexey Bochkovskiy, Vladlen Koltun.
+1. **[EfficientFormer](model_doc/efficientformer)** (from Snap Research) released with the paper [EfficientFormer: Vision Transformers at MobileNetSpeed](https://arxiv.org/abs/2206.01191) by Yanyu Li, Geng Yuan, Yang Wen, Ju Hu, Georgios Evangelidis, Sergey Tulyakov, Yanzhi Wang, Jian Ren.
+1. **[ELECTRA](model_doc/electra)** (from Google Research/Stanford University) released with the paper [ELECTRA: Pre-training text encoders as discriminators rather than generators](https://arxiv.org/abs/2003.10555) by Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning.
+1. **[EncoderDecoder](model_doc/encoder-decoder)** (from Google Research) released with the paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) by Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[ERNIE](model_doc/ernie)** (from Baidu) released with the paper [ERNIE: Enhanced Representation through Knowledge Integration](https://arxiv.org/abs/1904.09223) by Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Xuyi Chen, Han Zhang, Xin Tian, Danxiang Zhu, Hao Tian, Hua Wu.
+1. **[ESM](model_doc/esm)** (from Meta AI) are transformer protein language models. **ESM-1b** was released with the paper [Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences](https://www.pnas.org/content/118/15/e2016239118) by Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott, C. Lawrence Zitnick, Jerry Ma, and Rob Fergus. **ESM-1v** was released with the paper [Language models enable zero-shot prediction of the effects of mutations on protein function](https://doi.org/10.1101/2021.07.09.450648) by Joshua Meier, Roshan Rao, Robert Verkuil, Jason Liu, Tom Sercu and Alexander Rives. **ESM-2 and ESMFold** were released with the paper [Language models of protein sequences at the scale of evolution enable accurate structure prediction](https://doi.org/10.1101/2022.07.20.500902) by Zeming Lin, Halil Akin, Roshan Rao, Brian Hie, Zhongkai Zhu, Wenting Lu, Allan dos Santos Costa, Maryam Fazel-Zarandi, Tom Sercu, Sal Candido, Alexander Rives.
+1. **[FastSpeech2Conformer](model_doc/fastspeech2_conformer)** (from ESPnet) released with the paper [Recent Developments On Espnet Toolkit Boosted By Conformer](https://arxiv.org/abs/2010.13956) by Pengcheng Guo, Florian Boyer, Xuankai Chang, Tomoki Hayashi, Yosuke Higuchi, Hirofumi Inaguma, Naoyuki Kamo, Chenda Li, Daniel Garcia-Romero, Jiatong Shi, Jing Shi, Shinji Watanabe, Kun Wei, Wangyou Zhang, and Yuekai Zhang.
+1. **[FLAN-T5](model_doc/flan-t5)** (from Google AI) released in the repository [google-research/t5x](https://github.com/google-research/t5x/blob/main/docs/models.md#flan-t5-checkpoints) by Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei
+1. **[FlauBERT](model_doc/flaubert)** (from CNRS) released with the paper [FlauBERT: Unsupervised Language Model Pre-training for French](https://arxiv.org/abs/1912.05372) by Hang Le, Loรฏc Vial, Jibril Frej, Vincent Segonne, Maximin Coavoux, Benjamin Lecouteux, Alexandre Allauzen, Benoรฎt Crabbรฉ, Laurent Besacier, Didier Schwab.
+1. **[FLAVA](model_doc/flava)** (from Facebook AI) released with the paper [FLAVA: A Foundational Language And Vision Alignment Model](https://arxiv.org/abs/2112.04482) by Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela.
+1. **[FNet](model_doc/fnet)** (from Google Research) released with the paper [FNet: Mixing Tokens with Fourier Transforms](https://arxiv.org/abs/2105.03824) by James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, Santiago Ontanon.
+1. **[Funnel Transformer](model_doc/funnel)** (from CMU/Google Brain) released with the paper [Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing](https://arxiv.org/abs/2006.03236) by Zihang Dai, Guokun Lai, Yiming Yang, Quoc V. Le.
+1. **[GIT](model_doc/git)** (from Microsoft Research) released with the paper [GIT: A Generative Image-to-text Transformer for Vision and Language](https://arxiv.org/abs/2205.14100) by Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, Lijuan Wang.
+1. **[GLPN](model_doc/glpn)** (from KAIST) released with the paper [Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth](https://arxiv.org/abs/2201.07436) by Doyeon Kim, Woonghyun Ga, Pyungwhan Ahn, Donggyu Joo, Sehwan Chun, Junmo Kim.
+1. **[GPT](model_doc/openai-gpt)** (from OpenAI) released with the paper [Improving Language Understanding by Generative Pre-Training](https://openai.com/research/language-unsupervised/) by Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever.
+1. **[GPT Neo](model_doc/gpt_neo)** (from EleutherAI) released in the repository [EleutherAI/gpt-neo](https://github.com/EleutherAI/gpt-neo) by Sid Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy.
+1. **[GPT NeoX](model_doc/gpt_neox)** (from EleutherAI) released with the paper [GPT-NeoX-20B: An Open-Source Autoregressive Language Model](https://arxiv.org/abs/2204.06745) by Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Pieler, USVSN Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, Samuel Weinbach
+1. **[GPT NeoX Japanese](model_doc/gpt_neox_japanese)** (from ABEJA) released by Shinya Otani, Takayoshi Makabe, Anuj Arora, and Kyo Hattori.
+1. **[GPT-2](model_doc/gpt2)** (from OpenAI) released with the paper [Language Models are Unsupervised Multitask Learners](https://openai.com/research/better-language-models/) by Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei and Ilya Sutskever.
+1. **[GPT-J](model_doc/gptj)** (from EleutherAI) released in the repository [kingoflolz/mesh-transformer-jax](https://github.com/kingoflolz/mesh-transformer-jax/) by Ben Wang and Aran Komatsuzaki.
+1. **[GPT-Sw3](model_doc/gpt-sw3)** (from AI-Sweden) released with the paper [Lessons Learned from GPT-SW3: Building the First Large-Scale Generative Language Model for Swedish](http://www.lrec-conf.org/proceedings/lrec2022/pdf/2022.lrec-1.376.pdf) by Ariel Ekgren, Amaru Cuba Gyllensten, Evangelia Gogoulou, Alice Heiman, Severine Verlinden, Joey รhman, Fredrik Carlsson, Magnus Sahlgren.
+1. **[Graphormer](model_doc/graphormer)** (from Microsoft) released with the paper [Do Transformers Really Perform Bad for Graph Representation?](https://arxiv.org/abs/2106.05234) by Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen, Tie-Yan Liu.
+1. **[GroupViT](model_doc/groupvit)** (from UCSD, NVIDIA) released with the paper [GroupViT: Semantic Segmentation Emerges from Text Supervision](https://arxiv.org/abs/2202.11094) by Jiarui Xu, Shalini De Mello, Sifei Liu, Wonmin Byeon, Thomas Breuel, Jan Kautz, Xiaolong Wang.
+1. **[Hubert](model_doc/hubert)** (from Facebook) released with the paper [HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447) by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, Abdelrahman Mohamed.
+1. **[I-BERT](model_doc/ibert)** (from Berkeley) released with the paper [I-BERT: Integer-only BERT Quantization](https://arxiv.org/abs/2101.01321) by Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer.
+1. **[ImageGPT](model_doc/imagegpt)** (from OpenAI) released with the paper [Generative Pretraining from Pixels](https://openai.com/blog/image-gpt/) by Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, Ilya Sutskever.
+1. **[Jukebox](model_doc/jukebox)** (from OpenAI) released with the paper [Jukebox: A Generative Model for Music](https://arxiv.org/pdf/2005.00341.pdf) by Prafulla Dhariwal, Heewoo Jun, Christine Payne, Jong Wook Kim, Alec Radford, Ilya Sutskever.
+1. **[LayoutLM](model_doc/layoutlm)** (from Microsoft Research Asia) released with the paper [LayoutLM: Pre-training of Text and Layout for Document Image Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou.
+1. **[LayoutLMv2](model_doc/layoutlmv2)** (from Microsoft Research Asia) released with the paper [LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding](https://arxiv.org/abs/2012.14740) by Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, Lidong Zhou.
+1. **[LayoutLMv3](model_doc/layoutlmv3)** (from Microsoft Research Asia) released with the paper [LayoutLMv3: Pre-training for Document AI with Unified Text and Image Masking](https://arxiv.org/abs/2204.08387) by Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, Furu Wei.
+1. **[LayoutXLM](model_doc/layoutxlm)** (from Microsoft Research Asia) released with the paper [LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding](https://arxiv.org/abs/2104.08836) by Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Furu Wei.
+1. **[LED](model_doc/led)** (from AllenAI) released with the paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) by Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[LeViT](model_doc/levit)** (from Meta AI) released with the paper [LeViT: A Vision Transformer in ConvNet's Clothing for Faster Inference](https://arxiv.org/abs/2104.01136) by Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Hervรฉ Jรฉgou, Matthijs Douze.
+1. **[LiLT](model_doc/lilt)** (from South China University of Technology) released with the paper [LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding](https://arxiv.org/abs/2202.13669) by Jiapeng Wang, Lianwen Jin, Kai Ding.
+1. **[Longformer](model_doc/longformer)** (from AllenAI) released with the paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) by Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[LongT5](model_doc/longt5)** (from Google AI) released with the paper [LongT5: Efficient Text-To-Text Transformer for Long Sequences](https://arxiv.org/abs/2112.07916) by Mandy Guo, Joshua Ainslie, David Uthus, Santiago Ontanon, Jianmo Ni, Yun-Hsuan Sung, Yinfei Yang.
+1. **[LUKE](model_doc/luke)** (from Studio Ousia) released with the paper [LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention](https://arxiv.org/abs/2010.01057) by Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, Yuji Matsumoto.
+1. **[LXMERT](model_doc/lxmert)** (from UNC Chapel Hill) released with the paper [LXMERT: Learning Cross-Modality Encoder Representations from Transformers for Open-Domain Question Answering](https://arxiv.org/abs/1908.07490) by Hao Tan and Mohit Bansal.
+1. **[M-CTC-T](model_doc/mctct)** (from Facebook) released with the paper [Pseudo-Labeling For Massively Multilingual Speech Recognition](https://arxiv.org/abs/2111.00161) by Loren Lugosch, Tatiana Likhomanenko, Gabriel Synnaeve, and Ronan Collobert.
+1. **[M2M100](model_doc/m2m_100)** (from Facebook) released with the paper [Beyond English-Centric Multilingual Machine Translation](https://arxiv.org/abs/2010.11125) by Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky, Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, Armand Joulin.
+1. **[MarianMT](model_doc/marian)** Machine translation models trained using [OPUS](http://opus.nlpl.eu/) data by Jรถrg Tiedemann. The [Marian Framework](https://marian-nmt.github.io/) is being developed by the Microsoft Translator Team.
+1. **[MarkupLM](model_doc/markuplm)** (from Microsoft Research Asia) released with the paper [MarkupLM: Pre-training of Text and Markup Language for Visually-rich Document Understanding](https://arxiv.org/abs/2110.08518) by Junlong Li, Yiheng Xu, Lei Cui, Furu Wei.
+1. **[Mask2Former](model_doc/mask2former)** (from FAIR and UIUC) released with the paper [Masked-attention Mask Transformer for Universal Image Segmentation](https://arxiv.org/abs/2112.01527) by Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar.
+1. **[MaskFormer](model_doc/maskformer)** (from Meta and UIUC) released with the paper [Per-Pixel Classification is Not All You Need for Semantic Segmentation](https://arxiv.org/abs/2107.06278) by Bowen Cheng, Alexander G. Schwing, Alexander Kirillov.
+1. **[mBART](model_doc/mbart)** (from Facebook) released with the paper [Multilingual Denoising Pre-training for Neural Machine Translation](https://arxiv.org/abs/2001.08210) by Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, Luke Zettlemoyer.
+1. **[mBART-50](model_doc/mbart)** (from Facebook) released with the paper [Multilingual Translation with Extensible Multilingual Pretraining and Finetuning](https://arxiv.org/abs/2008.00401) by Yuqing Tang, Chau Tran, Xian Li, Peng-Jen Chen, Naman Goyal, Vishrav Chaudhary, Jiatao Gu, Angela Fan.
+1. **[Megatron-BERT](model_doc/megatron-bert)** (from NVIDIA) released with the paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) by Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper and Bryan Catanzaro.
+1. **[Megatron-GPT2](model_doc/megatron_gpt2)** (from NVIDIA) released with the paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) by Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper and Bryan Catanzaro.
+1. **[mLUKE](model_doc/mluke)** (from Studio Ousia) released with the paper [mLUKE: The Power of Entity Representations in Multilingual Pretrained Language Models](https://arxiv.org/abs/2110.08151) by Ryokan Ri, Ikuya Yamada, and Yoshimasa Tsuruoka.
+1. **[MobileBERT](model_doc/mobilebert)** (from CMU/Google Brain) released with the paper [MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices](https://arxiv.org/abs/2004.02984) by Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou.
+1. **[MobileNetV1](model_doc/mobilenet_v1)** (from Google Inc.) released with the paper [MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications](https://arxiv.org/abs/1704.04861) by Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam.
+1. **[MobileNetV2](model_doc/mobilenet_v2)** (from Google Inc.) released with the paper [MobileNetV2: Inverted Residuals and Linear Bottlenecks](https://arxiv.org/abs/1801.04381) by Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, Liang-Chieh Chen.
+1. **[MobileViT](model_doc/mobilevit)** (from Apple) released with the paper [MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer](https://arxiv.org/abs/2110.02178) by Sachin Mehta and Mohammad Rastegari.
+1. **[MPNet](model_doc/mpnet)** (from Microsoft Research) released with the paper [MPNet: Masked and Permuted Pre-training for Language Understanding](https://arxiv.org/abs/2004.09297) by Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu.
+1. **[MT5](model_doc/mt5)** (from Google AI) released with the paper [mT5: A massively multilingual pre-trained text-to-text transformer](https://arxiv.org/abs/2010.11934) by Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, Colin Raffel.
+1. **[MVP](model_doc/mvp)** (from RUC AI Box) released with the paper [MVP: Multi-task Supervised Pre-training for Natural Language Generation](https://arxiv.org/abs/2206.12131) by Tianyi Tang, Junyi Li, Wayne Xin Zhao and Ji-Rong Wen.
+1. **[NAT](model_doc/nat)** (from SHI Labs) released with the paper [Neighborhood Attention Transformer](https://arxiv.org/abs/2204.07143) by Ali Hassani, Steven Walton, Jiachen Li, Shen Li, and Humphrey Shi.
+1. **[Nezha](model_doc/nezha)** (from Huawei Noahโs Ark Lab) released with the paper [NEZHA: Neural Contextualized Representation for Chinese Language Understanding](https://arxiv.org/abs/1909.00204) by Junqiu Wei, Xiaozhe Ren, Xiaoguang Li, Wenyong Huang, Yi Liao, Yasheng Wang, Jiashu Lin, Xin Jiang, Xiao Chen and Qun Liu.
+1. **[NLLB](model_doc/nllb)** (from Meta) released with the paper [No Language Left Behind: Scaling Human-Centered Machine Translation](https://arxiv.org/abs/2207.04672) by the NLLB team.
+1. **[Nystrรถmformer](model_doc/nystromformer)** (from the University of Wisconsin - Madison) released with the paper [Nystrรถmformer: A Nystrรถm-Based Algorithm for Approximating Self-Attention](https://arxiv.org/abs/2102.03902) by Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, Vikas Singh.
+1. **[OneFormer](model_doc/oneformer)** (from SHI Labs) released with the paper [OneFormer: One Transformer to Rule Universal Image Segmentation](https://arxiv.org/abs/2211.06220) by Jitesh Jain, Jiachen Li, MangTik Chiu, Ali Hassani, Nikita Orlov, Humphrey Shi.
+1. **[OPT](master/model_doc/opt)** (from Meta AI) released with the paper [OPT: Open Pre-trained Transformer Language Models](https://arxiv.org/abs/2205.01068) by Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen et al.
+1. **[OWL-ViT](model_doc/owlvit)** (from Google AI) released with the paper [Simple Open-Vocabulary Object Detection with Vision Transformers](https://arxiv.org/abs/2205.06230) by Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, and Neil Houlsby.
+1. **[Pegasus](model_doc/pegasus)** (from Google) released with the paper [PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization](https://arxiv.org/abs/1912.08777) by Jingqing Zhang, Yao Zhao, Mohammad Saleh and Peter J. Liu.
+1. **[PEGASUS-X](model_doc/pegasus_x)** (from Google) released with the paper [Investigating Efficiently Extending Transformers for Long Input Summarization](https://arxiv.org/abs/2208.04347) by Jason Phang, Yao Zhao, and Peter J. Liu.
+1. **[Perceiver IO](model_doc/perceiver)** (from Deepmind) released with the paper [Perceiver IO: A General Architecture for Structured Inputs & Outputs](https://arxiv.org/abs/2107.14795) by Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, Olivier Hรฉnaff, Matthew M. Botvinick, Andrew Zisserman, Oriol Vinyals, Joรฃo Carreira.
+1. **[PhoBERT](model_doc/phobert)** (from VinAI Research) released with the paper [PhoBERT: Pre-trained language models for Vietnamese](https://www.aclweb.org/anthology/2020.findings-emnlp.92/) by Dat Quoc Nguyen and Anh Tuan Nguyen.
+1. **[PLBart](model_doc/plbart)** (from UCLA NLP) released with the paper [Unified Pre-training for Program Understanding and Generation](https://arxiv.org/abs/2103.06333) by Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang.
+1. **[PoolFormer](model_doc/poolformer)** (from Sea AI Labs) released with the paper [MetaFormer is Actually What You Need for Vision](https://arxiv.org/abs/2111.11418) by Yu, Weihao and Luo, Mi and Zhou, Pan and Si, Chenyang and Zhou, Yichen and Wang, Xinchao and Feng, Jiashi and Yan, Shuicheng.
+1. **[ProphetNet](model_doc/prophetnet)** (from Microsoft Research) released with the paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) by Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang and Ming Zhou.
+1. **[QDQBert](model_doc/qdqbert)** (from NVIDIA) released with the paper [Integer Quantization for Deep Learning Inference: Principles and Empirical Evaluation](https://arxiv.org/abs/2004.09602) by Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev and Paulius Micikevicius.
+1. **[RAG](model_doc/rag)** (from Facebook) released with the paper [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401) by Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kรผttler, Mike Lewis, Wen-tau Yih, Tim Rocktรคschel, Sebastian Riedel, Douwe Kiela.
+1. **[REALM](model_doc/realm.html)** (from Google Research) released with the paper [REALM: Retrieval-Augmented Language Model Pre-Training](https://arxiv.org/abs/2002.08909) by Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat and Ming-Wei Chang.
+1. **[Reformer](model_doc/reformer)** (from Google Research) released with the paper [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451) by Nikita Kitaev, ลukasz Kaiser, Anselm Levskaya.
+1. **[RegNet](model_doc/regnet)** (from META Platforms) released with the paper [Designing Network Design Space](https://arxiv.org/abs/2003.13678) by Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollรกr.
+1. **[RemBERT](model_doc/rembert)** (from Google Research) released with the paper [Rethinking embedding coupling in pre-trained language models](https://arxiv.org/abs/2010.12821) by Hyung Won Chung, Thibault Fรฉvry, Henry Tsai, M. Johnson, Sebastian Ruder.
+1. **[ResNet](model_doc/resnet)** (from Microsoft Research) released with the paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) by Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun.
+1. **[RoBERTa](model_doc/roberta)** (from Facebook), released together with the paper [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) by Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov.
+1. **[RoBERTa-PreLayerNorm](model_doc/roberta-prelayernorm)** (from Facebook) released with the paper [fairseq: A Fast, Extensible Toolkit for Sequence Modeling](https://arxiv.org/abs/1904.01038) by Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, Michael Auli.
+1. **[RoCBert](model_doc/roc_bert)** (from WeChatAI) released with the paper [RoCBert: Robust Chinese Bert with Multimodal Contrastive Pretraining](https://aclanthology.org/2022.acl-long.65.pdf) by HuiSu, WeiweiShi, XiaoyuShen, XiaoZhou, TuoJi, JiaruiFang, JieZhou.
+1. **[RoFormer](model_doc/roformer)** (from ZhuiyiTechnology), released together with the paper [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/abs/2104.09864) by Jianlin Su and Yu Lu and Shengfeng Pan and Bo Wen and Yunfeng Liu.
+1. **[SegFormer](model_doc/segformer)** (from NVIDIA) released with the paper [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) by Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping Luo.
+1. **[SEW](model_doc/sew)** (from ASAPP) released with the paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) by Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SEW-D](model_doc/sew_d)** (from ASAPP) released with the paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) by Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SpeechT5](model_doc/speecht5)** (from Microsoft Research) released with the paper [SpeechT5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing](https://arxiv.org/abs/2110.07205) by Junyi Ao, Rui Wang, Long Zhou, Chengyi Wang, Shuo Ren, Yu Wu, Shujie Liu, Tom Ko, Qing Li, Yu Zhang, Zhihua Wei, Yao Qian, Jinyu Li, Furu Wei.
+1. **[SpeechToTextTransformer](model_doc/speech_to_text)** (from Facebook), released together with the paper [fairseq S2T: Fast Speech-to-Text Modeling with fairseq](https://arxiv.org/abs/2010.05171) by Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Dmytro Okhonko, Juan Pino.
+1. **[SpeechToTextTransformer2](model_doc/speech_to_text_2)** (from Facebook), released together with the paper [Large-Scale Self- and Semi-Supervised Learning for Speech Translation](https://arxiv.org/abs/2104.06678) by Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.
+1. **[Splinter](model_doc/splinter)** (from Tel Aviv University), released together with the paper [Few-Shot Question Answering by Pretraining Span Selection](https://arxiv.org/abs/2101.00438) by Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, Omer Levy.
+1. **[SqueezeBERT](model_doc/squeezebert)** (from Berkeley) released with the paper [SqueezeBERT: What can computer vision teach NLP about efficient neural networks?](https://arxiv.org/abs/2006.11316) by Forrest N. Iandola, Albert E. Shaw, Ravi Krishna, and Kurt W. Keutzer.
+1. **[Swin Transformer](model_doc/swin)** (from Microsoft) released with the paper [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030) by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.
+1. **[Swin Transformer V2](model_doc/swinv2)** (from Microsoft) released with the paper [Swin Transformer V2: Scaling Up Capacity and Resolution](https://arxiv.org/abs/2111.09883) by Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo.
+1. **[Swin2SR](model_doc/swin2sr)** (from University of Wรผrzburg) released with the paper [Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration](https://arxiv.org/abs/2209.11345) by Marcos V. Conde, Ui-Jin Choi, Maxime Burchi, Radu Timofte.
+1. **[SwitchTransformers](model_doc/switch_transformers)** (from Google) released with the paper [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://arxiv.org/abs/2101.03961) by William Fedus, Barret Zoph, Noam Shazeer.
+1. **[T5](model_doc/t5)** (from Google AI) released with the paper [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu.
+1. **[T5v1.1](model_doc/t5v1.1)** (from Google AI) released in the repository [google-research/text-to-text-transfer-transformer](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#t511) by Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu.
+1. **[Table Transformer](model_doc/table-transformer)** (from Microsoft Research) released with the paper [PubTables-1M: Towards Comprehensive Table Extraction From Unstructured Documents](https://arxiv.org/abs/2110.00061) by Brandon Smock, Rohith Pesala, Robin Abraham.
+1. **[TAPAS](model_doc/tapas)** (from Google AI) released with the paper [TAPAS: Weakly Supervised Table Parsing via Pre-training](https://arxiv.org/abs/2004.02349) by Jonathan Herzig, Paweล Krzysztof Nowak, Thomas Mรผller, Francesco Piccinno and Julian Martin Eisenschlos.
+1. **[TAPEX](model_doc/tapex)** (from Microsoft Research) released with the paper [TAPEX: Table Pre-training via Learning a Neural SQL Executor](https://arxiv.org/abs/2107.07653) by Qian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, Jian-Guang Lou.
+1. **[Time Series Transformer](model_doc/time_series_transformer)** (from HuggingFace).
+1. **[TimeSformer](model_doc/timesformer)** (from Facebook) released with the paper [Is Space-Time Attention All You Need for Video Understanding?](https://arxiv.org/abs/2102.05095) by Gedas Bertasius, Heng Wang, Lorenzo Torresani.
+1. **[Trajectory Transformer](model_doc/trajectory_transformers)** (from the University of California at Berkeley) released with the paper [Offline Reinforcement Learning as One Big Sequence Modeling Problem](https://arxiv.org/abs/2106.02039) by Michael Janner, Qiyang Li, Sergey Levine
+1. **[Transformer-XL](model_doc/transfo-xl)** (from Google/CMU) released with the paper [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860) by Zihang Dai*, Zhilin Yang*, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov.
+1. **[TrOCR](model_doc/trocr)** (from Microsoft), released together with the paper [TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282) by Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, Furu Wei.
+1. **[UL2](model_doc/ul2)** (from Google Research) released with the paper [Unifying Language Learning Paradigms](https://arxiv.org/abs/2205.05131v1) by Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, Donald Metzler
+1. **[UniSpeech](model_doc/unispeech)** (from Microsoft Research) released with the paper [UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data](https://arxiv.org/abs/2101.07597) by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael Zeng, Xuedong Huang.
+1. **[UniSpeechSat](model_doc/unispeech-sat)** (from Microsoft Research) released with the paper [UNISPEECH-SAT: UNIVERSAL SPEECH REPRESENTATION LEARNING WITH SPEAKER AWARE PRE-TRAINING](https://arxiv.org/abs/2110.05752) by Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu.
+1. **[UPerNet](model_doc/upernet)** (from Peking University) released with the paper [Unified Perceptual Parsing for Scene Understanding](https://arxiv.org/abs/1807.10221) by Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, Jian Sun.
+1. **[VAN](model_doc/van)** (from Tsinghua University and Nankai University) released with the paper [Visual Attention Network](https://arxiv.org/abs/2202.09741) by Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, Shi-Min Hu.
+1. **[VideoMAE](model_doc/videomae)** (from Multimedia Computing Group, Nanjing University) released with the paper [VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training](https://arxiv.org/abs/2203.12602) by Zhan Tong, Yibing Song, Jue Wang, Limin Wang.
+1. **[ViLT](model_doc/vilt)** (from NAVER AI Lab/Kakao Enterprise/Kakao Brain) released with the paper [ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision](https://arxiv.org/abs/2102.03334) by Wonjae Kim, Bokyung Son, Ildoo Kim.
+1. **[Vision Transformer (ViT)](model_doc/vit)** (from Google AI) released with the paper [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, Neil Houlsby.
+1. **[VisualBERT](model_doc/visual_bert)** (from UCLA NLP) released with the paper [VisualBERT: A Simple and Performant Baseline for Vision and Language](https://arxiv.org/pdf/1908.03557) by Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang.
+1. **[ViT Hybrid](model_doc/vit_hybrid)** (from Google AI) released with the paper [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, Neil Houlsby.
+1. **[ViTMAE](model_doc/vit_mae)** (from Meta AI) released with the paper [Masked Autoencoders Are Scalable Vision Learners](https://arxiv.org/abs/2111.06377) by Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollรกr, Ross Girshick.
+1. **[ViTMSN](model_doc/vit_msn)** (from Meta AI) released with the paper [Masked Siamese Networks for Label-Efficient Learning](https://arxiv.org/abs/2204.07141) by Mahmoud Assran, Mathilde Caron, Ishan Misra, Piotr Bojanowski, Florian Bordes, Pascal Vincent, Armand Joulin, Michael Rabbat, Nicolas Ballas.
+1. **[Wav2Vec2](model_doc/wav2vec2)** (from Facebook AI) released with the paper [wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations](https://arxiv.org/abs/2006.11477) by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli.
+1. **[Wav2Vec2-Conformer](model_doc/wav2vec2-conformer)** (from Facebook AI) released with the paper [FAIRSEQ S2T: Fast Speech-to-Text Modeling with FAIRSEQ](https://arxiv.org/abs/2010.05171) by Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Sravya Popuri, Dmytro Okhonko, Juan Pino.
+1. **[Wav2Vec2Phoneme](model_doc/wav2vec2_phoneme)** (from Facebook AI) released with the paper [Simple and Effective Zero-shot Cross-lingual Phoneme Recognition](https://arxiv.org/abs/2109.11680) by Qiantong Xu, Alexei Baevski, Michael Auli.
+1. **[WavLM](model_doc/wavlm)** (from Microsoft Research) released with the paper [WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing](https://arxiv.org/abs/2110.13900) by Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, Jian Wu, Long Zhou, Shuo Ren, Yanmin Qian, Yao Qian, Jian Wu, Michael Zeng, Furu Wei.
+1. **[Whisper](model_doc/whisper)** (from OpenAI) released with the paper [Robust Speech Recognition via Large-Scale Weak Supervision](https://cdn.openai.com/papers/whisper.pdf) by Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, Ilya Sutskever.
+1. **[X-CLIP](model_doc/xclip)** (from Microsoft Research) released with the paper [Expanding Language-Image Pretrained Models for General Video Recognition](https://arxiv.org/abs/2208.02816) by Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling.
+1. **[XGLM](model_doc/xglm)** (From Facebook AI) released with the paper [Few-shot Learning with Multilingual Language Models](https://arxiv.org/abs/2112.10668) by Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O'Horo, Jeff Wang, Luke Zettlemoyer, Zornitsa Kozareva, Mona Diab, Veselin Stoyanov, Xian Li.
+1. **[XLM](model_doc/xlm)** (from Facebook) released together with the paper [Cross-lingual Language Model Pretraining](https://arxiv.org/abs/1901.07291) by Guillaume Lample and Alexis Conneau.
+1. **[XLM-ProphetNet](model_doc/xlm-prophetnet)** (from Microsoft Research) released with the paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) by Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang and Ming Zhou.
+1. **[XLM-RoBERTa](model_doc/xlm-roberta)** (from Facebook AI), released together with the paper [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116) by Alexis Conneau*, Kartikay Khandelwal*, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmรกn, Edouard Grave, Myle Ott, Luke Zettlemoyer and Veselin Stoyanov.
+1. **[XLM-RoBERTa-XL](model_doc/xlm-roberta-xl)** (from Facebook AI), released together with the paper [Larger-Scale Transformers for Multilingual Masked Language Modeling](https://arxiv.org/abs/2105.00572) by Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau.
+1. **[XLNet](model_doc/xlnet)** (from Google/CMU) released with the paper [โXLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) by Zhilin Yang*, Zihang Dai*, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, Quoc V. Le.
+1. **[XLS-R](model_doc/xls_r)** (from Facebook AI) released with the paper [XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale](https://arxiv.org/abs/2111.09296) by Arun Babu, Changhan Wang, Andros Tjandra, Kushal Lakhotia, Qiantong Xu, Naman Goyal, Kritika Singh, Patrick von Platen, Yatharth Saraf, Juan Pino, Alexei Baevski, Alexis Conneau, Michael Auli.
+1. **[XLSR-Wav2Vec2](model_doc/xlsr_wav2vec2)** (from Facebook AI) released with the paper [Unsupervised Cross-Lingual Representation Learning For Speech Recognition](https://arxiv.org/abs/2006.13979) by Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael Auli.
+1. **[YOLOS](model_doc/yolos)** (from Huazhong University of Science & Technology) released with the paper [You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection](https://arxiv.org/abs/2106.00666) by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
+1. **[YOSO](model_doc/yoso)** (from the University of Wisconsin - Madison) released with the paper [You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling](https://arxiv.org/abs/2111.09714) by Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh.
+
+
+### Frameworks compatibles
+
+Le tableau ci-dessous reprรฉsente la prise en charge actuelle dans la bibliothรจque pour chacun de ces modรจles, qu'ils aient ou non un tokenizer Python (appelรฉ "slow"). Un tokenizer rapide ("fast") soutenu par la bibliothรจque ๐ค Tokenizers, qu'ils aient un support en Jax (via Flax), PyTorch, et/ou TensorFlow.
+
+
+
+| Modรจle | Tokenizer slow | Tokenizer fast | PyTorch support | TensorFlow support | Flax Support |
+|:-----------------------------:|:--------------:|:--------------:|:---------------:|:------------------:|:------------:|
+| ALBERT | โ
| โ
| โ
| โ
| โ
|
+| AltCLIP | โ | โ | โ
| โ | โ |
+| Audio Spectrogram Transformer | โ | โ | โ
| โ | โ |
+| BART | โ
| โ
| โ
| โ
| โ
|
+| BEiT | โ | โ | โ
| โ | โ
|
+| BERT | โ
| โ
| โ
| โ
| โ
|
+| Bert Generation | โ
| โ | โ
| โ | โ |
+| BigBird | โ
| โ
| โ
| โ | โ
|
+| BigBird-Pegasus | โ | โ | โ
| โ | โ |
+| BioGpt | โ
| โ | โ
| โ | โ |
+| BiT | โ | โ | โ
| โ | โ |
+| Blenderbot | โ
| โ
| โ
| โ
| โ
|
+| BlenderbotSmall | โ
| โ
| โ
| โ
| โ
|
+| BLIP | โ | โ | โ
| โ | โ |
+| BLOOM | โ | โ
| โ
| โ | โ |
+| BridgeTower | โ | โ | โ
| โ | โ |
+| CamemBERT | โ
| โ
| โ
| โ
| โ |
+| CANINE | โ
| โ | โ
| โ | โ |
+| Chinese-CLIP | โ | โ | โ
| โ | โ |
+| CLIP | โ
| โ
| โ
| โ
| โ
|
+| CLIPSeg | โ | โ | โ
| โ | โ |
+| CodeGen | โ
| โ
| โ
| โ | โ |
+| Conditional DETR | โ | โ | โ
| โ | โ |
+| ConvBERT | โ
| โ
| โ
| โ
| โ |
+| ConvNeXT | โ | โ | โ
| โ
| โ |
+| CTRL | โ
| โ | โ
| โ
| โ |
+| CvT | โ | โ | โ
| โ
| โ |
+| Data2VecAudio | โ | โ | โ
| โ | โ |
+| Data2VecText | โ | โ | โ
| โ | โ |
+| Data2VecVision | โ | โ | โ
| โ
| โ |
+| DeBERTa | โ
| โ
| โ
| โ
| โ |
+| DeBERTa-v2 | โ
| โ
| โ
| โ
| โ |
+| Decision Transformer | โ | โ | โ
| โ | โ |
+| Deformable DETR | โ | โ | โ
| โ | โ |
+| DeiT | โ | โ | โ
| โ
| โ |
+| DETA | โ | โ | โ
| โ | โ |
+| DETR | โ | โ | โ
| โ | โ |
+| DiNAT | โ | โ | โ
| โ | โ |
+| DistilBERT | โ
| โ
| โ
| โ
| โ
|
+| DonutSwin | โ | โ | โ
| โ | โ |
+| DPR | โ
| โ
| โ
| โ
| โ |
+| DPT | โ | โ | โ
| โ | โ |
+| EfficientFormer | โ | โ | โ
| โ | โ |
+| ELECTRA | โ
| โ
| โ
| โ
| โ
|
+| Encoder decoder | โ | โ | โ
| โ
| โ
|
+| ERNIE | โ | โ | โ
| โ | โ |
+| ESM | โ
| โ | โ
| โ
| โ |
+| FairSeq Machine-Translation | โ
| โ | โ
| โ | โ |
+| FastSpeech2Conformer | โ
| โ | โ
| โ | โ |
+| FlauBERT | โ
| โ | โ
| โ
| โ |
+| FLAVA | โ | โ | โ
| โ | โ |
+| FNet | โ
| โ
| โ
| โ | โ |
+| Funnel Transformer | โ
| โ
| โ
| โ
| โ |
+| GIT | โ | โ | โ
| โ | โ |
+| GLPN | โ | โ | โ
| โ | โ |
+| GPT Neo | โ | โ | โ
| โ | โ
|
+| GPT NeoX | โ | โ
| โ
| โ | โ |
+| GPT NeoX Japanese | โ
| โ | โ
| โ | โ |
+| GPT-J | โ | โ | โ
| โ
| โ
|
+| GPT-Sw3 | โ
| โ
| โ
| โ
| โ
|
+| Graphormer | โ | โ | โ
| โ | โ |
+| GroupViT | โ | โ | โ
| โ
| โ |
+| Hubert | โ | โ | โ
| โ
| โ |
+| I-BERT | โ | โ | โ
| โ | โ |
+| ImageGPT | โ | โ | โ
| โ | โ |
+| Jukebox | โ
| โ | โ
| โ | โ |
+| LayoutLM | โ
| โ
| โ
| โ
| โ |
+| LayoutLMv2 | โ
| โ
| โ
| โ | โ |
+| LayoutLMv3 | โ
| โ
| โ
| โ
| โ |
+| LED | โ
| โ
| โ
| โ
| โ |
+| LeViT | โ | โ | โ
| โ | โ |
+| LiLT | โ | โ | โ
| โ | โ |
+| Longformer | โ
| โ
| โ
| โ
| โ |
+| LongT5 | โ | โ | โ
| โ | โ
|
+| LUKE | โ
| โ | โ
| โ | โ |
+| LXMERT | โ
| โ
| โ
| โ
| โ |
+| M-CTC-T | โ | โ | โ
| โ | โ |
+| M2M100 | โ
| โ | โ
| โ | โ |
+| Marian | โ
| โ | โ
| โ
| โ
|
+| MarkupLM | โ
| โ
| โ
| โ | โ |
+| Mask2Former | โ | โ | โ
| โ | โ |
+| MaskFormer | โ | โ | โ
| โ | โ |
+| MaskFormerSwin | โ | โ | โ | โ | โ |
+| mBART | โ
| โ
| โ
| โ
| โ
|
+| Megatron-BERT | โ | โ | โ
| โ | โ |
+| MobileBERT | โ
| โ
| โ
| โ
| โ |
+| MobileNetV1 | โ | โ | โ
| โ | โ |
+| MobileNetV2 | โ | โ | โ
| โ | โ |
+| MobileViT | โ | โ | โ
| โ
| โ |
+| MPNet | โ
| โ
| โ
| โ
| โ |
+| MT5 | โ
| โ
| โ
| โ
| โ
|
+| MVP | โ
| โ
| โ
| โ | โ |
+| NAT | โ | โ | โ
| โ | โ |
+| Nezha | โ | โ | โ
| โ | โ |
+| Nystrรถmformer | โ | โ | โ
| โ | โ |
+| OneFormer | โ | โ | โ
| โ | โ |
+| OpenAI GPT | โ
| โ
| โ
| โ
| โ |
+| OpenAI GPT-2 | โ
| โ
| โ
| โ
| โ
|
+| OPT | โ | โ | โ
| โ
| โ
|
+| OWL-ViT | โ | โ | โ
| โ | โ |
+| Pegasus | โ
| โ
| โ
| โ
| โ
|
+| PEGASUS-X | โ | โ | โ
| โ | โ |
+| Perceiver | โ
| โ | โ
| โ | โ |
+| PLBart | โ
| โ | โ
| โ | โ |
+| PoolFormer | โ | โ | โ
| โ | โ |
+| ProphetNet | โ
| โ | โ
| โ | โ |
+| QDQBert | โ | โ | โ
| โ | โ |
+| RAG | โ
| โ | โ
| โ
| โ |
+| REALM | โ
| โ
| โ
| โ | โ |
+| Reformer | โ
| โ
| โ
| โ | โ |
+| RegNet | โ | โ | โ
| โ
| โ
|
+| RemBERT | โ
| โ
| โ
| โ
| โ |
+| ResNet | โ | โ | โ
| โ
| โ |
+| RetriBERT | โ
| โ
| โ
| โ | โ |
+| RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| RoBERTa-PreLayerNorm | โ | โ | โ
| โ
| โ
|
+| RoCBert | โ
| โ | โ
| โ | โ |
+| RoFormer | โ
| โ
| โ
| โ
| โ
|
+| SegFormer | โ | โ | โ
| โ
| โ |
+| SEW | โ | โ | โ
| โ | โ |
+| SEW-D | โ | โ | โ
| โ | โ |
+| Speech Encoder decoder | โ | โ | โ
| โ | โ
|
+| Speech2Text | โ
| โ | โ
| โ
| โ |
+| Speech2Text2 | โ
| โ | โ | โ | โ |
+| SpeechT5 | โ
| โ | โ
| โ | โ |
+| Splinter | โ
| โ
| โ
| โ | โ |
+| SqueezeBERT | โ
| โ
| โ
| โ | โ |
+| Swin Transformer | โ | โ | โ
| โ
| โ |
+| Swin Transformer V2 | โ | โ | โ
| โ | โ |
+| Swin2SR | โ | โ | โ
| โ | โ |
+| SwitchTransformers | โ | โ | โ
| โ | โ |
+| T5 | โ
| โ
| โ
| โ
| โ
|
+| Table Transformer | โ | โ | โ
| โ | โ |
+| TAPAS | โ
| โ | โ
| โ
| โ |
+| Time Series Transformer | โ | โ | โ
| โ | โ |
+| TimeSformer | โ | โ | โ
| โ | โ |
+| Trajectory Transformer | โ | โ | โ
| โ | โ |
+| Transformer-XL | โ
| โ | โ
| โ
| โ |
+| TrOCR | โ | โ | โ
| โ | โ |
+| UniSpeech | โ | โ | โ
| โ | โ |
+| UniSpeechSat | โ | โ | โ
| โ | โ |
+| UPerNet | โ | โ | โ
| โ | โ |
+| VAN | โ | โ | โ
| โ | โ |
+| VideoMAE | โ | โ | โ
| โ | โ |
+| ViLT | โ | โ | โ
| โ | โ |
+| Vision Encoder decoder | โ | โ | โ
| โ
| โ
|
+| VisionTextDualEncoder | โ | โ | โ
| โ | โ
|
+| VisualBERT | โ | โ | โ
| โ | โ |
+| ViT | โ | โ | โ
| โ
| โ
|
+| ViT Hybrid | โ | โ | โ
| โ | โ |
+| ViTMAE | โ | โ | โ
| โ
| โ |
+| ViTMSN | โ | โ | โ
| โ | โ |
+| Wav2Vec2 | โ
| โ | โ
| โ
| โ
|
+| Wav2Vec2-Conformer | โ | โ | โ
| โ | โ |
+| WavLM | โ | โ | โ
| โ | โ |
+| Whisper | โ
| โ | โ
| โ
| โ |
+| X-CLIP | โ | โ | โ
| โ | โ |
+| XGLM | โ
| โ
| โ
| โ
| โ
|
+| XLM | โ
| โ | โ
| โ
| โ |
+| XLM-ProphetNet | โ
| โ | โ
| โ | โ |
+| XLM-RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| XLM-RoBERTa-XL | โ | โ | โ
| โ | โ |
+| XLNet | โ
| โ
| โ
| โ
| โ |
+| YOLOS | โ | โ | โ
| โ | โ |
+| YOSO | โ | โ | โ
| โ | โ |
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/installation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/installation.md
new file mode 100644
index 0000000000000000000000000000000000000000..da3e585df7aee38ae672fa46c6913b867c3d5c2f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/installation.md
@@ -0,0 +1,258 @@
+
+
+# Installation
+
+Installez ๐ค Transformers pour n'importe quelle librairie d'apprentissage profond avec laquelle vous avez l'habitude de travaillez, configurez votre cache et configurez ๐ค Transformers pour un usage hors ligne (facultatif).
+
+๐ค Transformers est testรฉ avec Python 3.6+, PyTorch 1.1.0+, TensorFlow 2.0+ et Flax.
+Consulter les instructions d'installation ci-dessous pour la librairie d'apprentissage profond que vous utilisez:
+
+ * Instructions d'installation pour [PyTorch](https://pytorch.org/get-started/locally/).
+ * Instructions d'installation pour [TensorFlow 2.0](https://www.tensorflow.org/install/pip).
+ * Instructions d'installation pour [Flax](https://flax.readthedocs.io/en/latest/).
+
+## Installation avec pip
+
+Vous devriez installer ๐ค Transformers dans un [environnement virtuel](https://docs.python.org/3/library/venv.html).
+Si vous n'รชtes pas ร l'aise avec les environnements virtuels, consultez ce [guide](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/).
+Utiliser un environnement virtuel permet de facilement gรฉrer diffรฉrents projets et d'รฉviter des erreurs de compatibilitรฉ entre les diffรฉrentes dรฉpendances.
+
+Commencez par crรฉer un environnement virtuel dans l'espace de travail de votre projet :
+
+```bash
+python -m venv .env
+```
+
+Activez l'environnement virtuel. Sur Linux ou MacOs :
+
+```bash
+source .env/bin/activate
+```
+
+Activez l'environnement virtuel sur Windows :
+
+```bash
+.env/Scripts/activate
+```
+
+Maintenant, ๐ค Transformers peut รชtre installรฉ avec la commande suivante :
+
+```bash
+pip install transformers
+```
+
+Pour une utilisation avec CPU seulement, ๐ค Transformers et la librairie d'apprentissage profond de votre choix peuvent รชtre installรฉs en une seule ligne.
+Par exemple, installez ๐ค Transformers et PyTorch avec la commande suivante :
+
+```bash
+pip install 'transformers[torch]'
+```
+
+๐ค Transformers et TensorFlow 2.0 :
+
+```bash
+pip install 'transformers[tf-cpu]'
+```
+
+
+
+Pour les architectures mac M1 / ARM
+
+Vous devez installer les outils suivants avant d'installer TensorFLow 2.0
+
+```bash
+brew install cmake
+brew install pkg-config
+```
+
+
+
+๐ค Transformers et Flax :
+
+```bash
+pip install 'transformers[flax]'
+```
+
+Vรฉrifiez que ๐ค Transformers a bien รฉtรฉ installรฉ avec la commande suivante. La commande va tรฉlรฉcharger un modรจle prรฉ-entraรฎnรฉ :
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
+```
+
+Le label et score sont ensuite affichรฉs :
+
+```bash
+[{'label': 'POSITIVE', 'score': 0.9998704791069031}]
+```
+
+## Installation depuis le code source
+
+Installez ๐ค Transformers depuis le code source avec la commande suivante :
+
+```bash
+pip install git+https://github.com/huggingface/transformers
+```
+
+Cette commande installe la version depuis la branche `main` au lieu de la derniรจre version stable. La version de la branche `main` est utile pour avoir les derniers dรฉveloppements. Par exemple, si un bug a รฉtรฉ rรฉsolu depuis la derniรจre version stable mais n'a pas encore รฉtรฉ publiรฉ officiellement. Cependant, cela veut aussi dire que la version de la branche `main` n'est pas toujours stable. Nous nous efforรงons de maintenir la version de la branche `main` opรฉrationnelle, et la plupart des problรจmes sont gรฉnรฉralement rรฉsolus en l'espace de quelques heures ou d'un jour. Si vous recontrez un problรจme, n'hรฉsitez pas ร crรฉer une [Issue](https://github.com/huggingface/transformers/issues) pour que l'on puisse trouver une solution au plus vite !
+
+Vรฉrifiez que ๐ค Transformers a bien รฉtรฉ installรฉ avec la commande suivante :
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))"
+```
+
+## Installation modifiable
+
+Vous aurez besoin d'une installation modifiable si vous le souhaitez :
+
+ * Utiliser la version de la branche `main` du code source.
+ * Contribuer ร ๐ค Transformers et vouler tester vos modifications du code source.
+
+Clonez le projet et installez ๐ค Transformers avec les commandes suivantes :
+
+```bash
+git clone https://github.com/huggingface/transformers.git
+cd transformers
+pip install -e .
+```
+
+Ces commandes crรฉent des liens entre le dossier oรน le projet a รฉtรฉ clonรฉ et les chemins de vos librairies Python. Python regardera maintenant dans le dossier que vous avez clonรฉ en plus des dossiers oรน sont installรฉes vos autres librairies. Par exemple, si vos librairies Python sont installรฉes dans `~/anaconda3/envs/main/lib/python3.7/site-packages/`, Python cherchera aussi dans le dossier oรน vous avez clonรฉ : `~/transformers/`.
+
+
+
+Vous devez garder le dossier `transformers` si vous voulez continuer d'utiliser la librairie.
+
+
+
+Maintenant, vous pouvez facilement mettre ร jour votre clone avec la derniรจre version de ๐ค Transformers en utilisant la commande suivante :
+
+```bash
+cd ~/transformers/
+git pull
+```
+
+Votre environnement Python utilisera la version de la branche `main` lors de la prochaine exรฉcution.
+
+## Installation avec conda
+
+Installation via le canal `conda-forge` de conda :
+
+```bash
+conda install conda-forge::transformers
+```
+
+## Configuration du cache
+
+Les modรจles prรฉ-entraรฎnรฉs sont tรฉlรฉchargรฉs et mis en cache localement dans le dossier suivant : `~/.cache/huggingface/hub`. C'est le dossier par dรฉfaut donnรฉ par la variable d'environnement `TRANSFORMERS_CACHE`. Sur Windows, le dossier par dรฉfaut est `C:\Users\nom_utilisateur\.cache\huggingface\hub`. Vous pouvez modifier les variables d'environnement indiquรฉes ci-dessous - par ordre de prioritรฉ - pour spรฉcifier un dossier de cache diffรฉrent :
+
+1. Variable d'environnement (par dรฉfaut) : `HF_HUB_CACHE` ou `TRANSFORMERS_CACHE`.
+2. Variable d'environnement : `HF_HOME`.
+3. Variable d'environnement : `XDG_CACHE_HOME` + `/huggingface`.
+
+
+
+๐ค Transformers utilisera les variables d'environnement `PYTORCH_TRANSFORMERS_CACHE` ou `PYTORCH_PRETRAINED_BERT_CACHE` si vous utilisez une version prรฉcรฉdente de cette librairie et avez dรฉfini ces variables d'environnement, sauf si vous spรฉcifiez la variable d'environnement `TRANSFORMERS_CACHE`.
+
+
+
+## Mode hors ligne
+
+๐ค Transformers peut fonctionner dans un environnement cloisonnรฉ ou hors ligne en n'utilisant que des fichiers locaux. Dรฉfinissez la variable d'environnement `HF_HUB_OFFLINE=1` pour activer ce mode.
+
+
+
+Ajoutez [๐ค Datasets](https://huggingface.co/docs/datasets/) ร votre processus d'entraรฎnement hors ligne en dรฉfinissant la variable d'environnement `HF_DATASETS_OFFLINE=1`.
+
+
+
+```bash
+HF_DATASETS_OFFLINE=1 HF_HUB_OFFLINE=1 \
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+Le script devrait maintenant s'exรฉcuter sans rester en attente ou attendre une expiration, car il n'essaiera pas de tรฉlรฉcharger des modรจle sur le Hub.
+
+Vous pouvez aussi รฉviter de tรฉlรฉcharger un modรจle ร chaque appel de la fonction [`~PreTrainedModel.from_pretrained`] en utilisant le paramรจtre [local_files_only]. Seuls les fichiers locaux sont chargรฉs lorsque ce paramรจtre est activรฉ (c.-ร -d. `local_files_only=True`) :
+
+```py
+from transformers import T5Model
+
+model = T5Model.from_pretrained("./path/to/local/directory", local_files_only=True)
+```
+
+### Rรฉcupรฉrer des modรจles et des tokenizers pour une utilisation hors ligne
+
+Une autre option pour utiliser ๐ค Transformers hors ligne est de tรฉlรฉcharger les fichiers ร l'avance, puis d'utiliser les chemins locaux lorsque vous en avez besoin en mode hors ligne. Il existe trois faรงons de faire cela :
+
+ * Tรฉlรฉchargez un fichier via l'interface utilisateur sur le [Model Hub](https://huggingface.co/models) en cliquant sur l'icรดne โ.
+
+ 
+
+ * Utilisez les fonctions [`PreTrainedModel.from_pretrained`] et [`PreTrainedModel.save_pretrained`] :
+
+ 1. Tรฉlรฉchargez vos fichiers ร l'avance avec [`PreTrainedModel.from_pretrained`]:
+
+ ```py
+ >>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("bigscience/T0_3B")
+ >>> model = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0_3B")
+ ```
+
+ 2. Sauvegardez les fichiers dans un dossier de votre choix avec [`PreTrainedModel.save_pretrained`]:
+
+ ```py
+ >>> tokenizer.save_pretrained("./your/path/bigscience_t0")
+ >>> model.save_pretrained("./your/path/bigscience_t0")
+ ```
+
+ 3. Maintenant, lorsque vous รชtes hors ligne, rechargez vos fichiers avec [`PreTrainedModel.from_pretrained`] depuis le dossier oรน vous les avez sauvegardรฉs :
+
+ ```py
+ >>> tokenizer = AutoTokenizer.from_pretrained("./your/path/bigscience_t0")
+ >>> model = AutoModel.from_pretrained("./your/path/bigscience_t0")
+ ```
+
+ * Tรฉlรฉchargez des fichiers de maniรจre automatique avec la librairie [huggingface_hub](https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub) :
+
+ 1. Installez la librairie `huggingface_hub` dans votre environnement virtuel :
+
+ ```bash
+ python -m pip install huggingface_hub
+ ```
+
+ 2. Utilisez la fonction [`hf_hub_download`](https://huggingface.co/docs/hub/adding-a-library#download-files-from-the-hub) pour tรฉlรฉcharger un fichier vers un chemin de votre choix. Par exemple, la commande suivante tรฉlรฉcharge le fichier `config.json` du modรจle [T0](https://huggingface.co/bigscience/T0_3B) vers le chemin de votre choix :
+
+ ```py
+ >>> from huggingface_hub import hf_hub_download
+
+ >>> hf_hub_download(repo_id="bigscience/T0_3B", filename="config.json", cache_dir="./your/path/bigscience_t0")
+ ```
+
+Une fois que votre fichier est tรฉlรฉchargรฉ et cachรฉ localement, spรฉcifiez son chemin local pour le charger et l'utiliser :
+
+```py
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("./your/path/bigscience_t0/config.json")
+```
+
+
+
+Consultez la section [How to download files from the Hub (Comment tรฉlรฉcharger des fichiers depuis le Hub)](https://huggingface.co/docs/hub/how-to-downstream) pour plus de dรฉtails sur le tรฉlรฉchargement de fichiers stockรฉs sur le Hub.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/quicktour.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/quicktour.md
new file mode 100644
index 0000000000000000000000000000000000000000..dcf21562316d5d1d1991a098f0ef039b5b62372d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/quicktour.md
@@ -0,0 +1,550 @@
+
+
+# Visite rapide
+
+[[open-in-colab]]
+
+Soyez opรฉrationnel avec ๐ค Transformers ! Que vous soyez un dรฉveloppeur ou un utilisateur lambda, cette visite rapide vous aidera ร dรฉmarrer et vous montrera comment utiliser le [`pipeline`] pour l'infรฉrence, charger un modรจle prรฉ-entraรฎnรฉ et un prรฉprocesseur avec une [AutoClass](./model_doc/auto), et entraรฎner rapidement un modรจle avec PyTorch ou TensorFlow. Si vous รชtes un dรฉbutant, nous vous recommandons de consulter nos tutoriels ou notre [cours](https://huggingface.co/course/chapter1/1) suivant pour des explications plus approfondies des concepts prรฉsentรฉs ici.
+
+Avant de commencer, assurez-vous que vous avez installรฉ toutes les bibliothรจques nรฉcessaires :
+
+```bash
+!pip install transformers datasets evaluate accelerate
+```
+
+Vous aurez aussi besoin d'installer votre bibliothรจque d'apprentissage profond favorite :
+
+
+
+
+```bash
+pip install torch
+```
+
+
+
+```bash
+pip install tensorflow
+```
+
+
+
+## Pipeline
+
+
+
+Le [`pipeline`] est le moyen le plus simple d'utiliser un modรจle prรฉ-entraรฎnรฉ pour l'infรฉrence. Vous pouvez utiliser le [`pipeline`] prรชt ร l'emploi pour de nombreuses tรขches dans diffรฉrentes modalitรฉs. Consultez le tableau ci-dessous pour connaรฎtre les tรขches prises en charge :
+
+| **Tรขche** | **Description** | **Modalitรฉ** | **Identifiant du pipeline** |
+|------------------------------|--------------------------------------------------------------------------------------------------------------|----------------------|-----------------------------------------------|
+| Classification de texte | Attribue une catรฉgorie ร une sรฉquence de texte donnรฉe | Texte | pipeline(task="sentiment-analysis") |
+| Gรฉnรฉration de texte | Gรฉnรจre du texte ร partir d'une consigne donnรฉe | Texte | pipeline(task="text-generation") |
+| Reconnaissance de token nommรฉ | Attribue une catรฉgorie ร chaque token dans une sรฉquence (personnes, organisation, localisation, etc.) | Texte | pipeline(task="ner") |
+| Question rรฉponse | Extrait une rรฉponse du texte en fonction du contexte et d'une question | Texte | pipeline(task="question-answering") |
+| Prรฉdiction de token masquรฉ | Prรฉdit correctement le token masquรฉ dans une sรฉquence | Texte | pipeline(task="fill-mask") |
+| Gรฉnรฉration de rรฉsumรฉ | Gรฉnรจre un rรฉsumรฉ d'une sรฉquence de texte donnรฉe ou d'un document | Texte | pipeline(task="summarization") |
+| Traduction | Traduit du texte d'un langage ร un autre | Texte | pipeline(task="translation") |
+| Classification d'image | Attribue une catรฉgorie ร une image | Image | pipeline(task="image-classification") |
+| Segmentation d'image | Attribue une catรฉgorie ร chaque pixel d'une image (supporte la segmentation sรฉmantique, panoptique et d'instance) | Image | pipeline(task="image-segmentation") |
+| Dรฉtection d'objets | Prรฉdit les dรฉlimitations et catรฉgories d'objets dans une image | Image | pipeline(task="object-detection") |
+| Classification d'audio | Attribue une catรฉgorie ร un fichier audio | Audio | pipeline(task="audio-classification") |
+| Reconnaissance automatique de la parole | Extrait le discours d'un fichier audio en texte | Audio | pipeline(task="automatic-speech-recognition") |
+| Question rรฉponse visuels | Etant donnรฉes une image et une question, rรฉpond correctement ร une question sur l'image | Modalitรฉs multiples | pipeline(task="vqa") |
+
+Commencez par crรฉer une instance de [`pipeline`] et spรฉcifiez la tรขche pour laquelle vous souhaitez l'utiliser. Vous pouvez utiliser le [`pipeline`] pour n'importe laquelle des tรขches mentionnรฉes dans le tableau prรฉcรฉdent. Pour obtenir une liste complรจte des tรขches prises en charge, consultez la documentation de l'[API pipeline](./main_classes/pipelines). Dans ce guide, nous utiliserons le [`pipeline`] pour l'analyse des sentiments ร titre d'exemple :
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("sentiment-analysis")
+```
+
+Le [`pipeline`] tรฉlรฉcharge et stocke en cache un [modรจle prรฉ-entraรฎnรฉ](https://huggingface.co/distilbert/distilbert-base-uncased-finetuned-sst-2-english) et un tokenizer par dรฉfaut pour l'analyse des sentiments. Vous pouvez maintenant utiliser le `classifier` sur le texte de votre choix :
+
+```py
+>>> classifier("We are very happy to show you the ๐ค Transformers library.")
+[{'label': 'POSITIVE', 'score': 0.9998}]
+```
+
+Si vous voulez classifier plus qu'un texte, donnez une liste de textes au [`pipeline`] pour obtenir une liste de dictionnaires en retour :
+
+```py
+>>> results = classifier(["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."])
+>>> for result in results:
+... print(f"label: {result['label']}, avec le score de: {round(result['score'], 4)}")
+label: POSITIVE, avec le score de: 0.9998
+label: NEGATIVE, avec le score de: 0.5309
+```
+
+Le [`pipeline`] peut aussi itรฉrer sur un jeu de donnรฉes entier pour n'importe quelle tรขche. Prenons par exemple la reconnaissance automatique de la parole :
+
+```py
+>>> import torch
+>>> from transformers import pipeline
+
+>>> speech_recognizer = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")
+```
+
+Chargez un jeu de donnรฉes audio (voir le ๐ค Datasets [Quick Start](https://huggingface.co/docs/datasets/quickstart#audio) pour plus de dรฉtails) sur lequel vous souhaitez itรฉrer. Pour cet exemple, nous chargeons le jeu de donnรฉes [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) :
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train") # doctest: +IGNORE_RESULT
+```
+
+Vous devez vous assurer que le taux d'รฉchantillonnage de l'ensemble de donnรฉes correspond au taux d'รฉchantillonnage sur lequel [`facebook/wav2vec2-base-960h`](https://huggingface.co/facebook/wav2vec2-base-960h) a รฉtรฉ entraรฎnรฉ :
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=speech_recognizer.feature_extractor.sampling_rate))
+```
+
+Les fichiers audio sont automatiquement chargรฉs et rรฉรฉchantillonnรฉs lors de l'appel de la colonne `"audio"`.
+Extrayez les tableaux de formes d'ondes brutes des quatre premiers รฉchantillons et passez-les comme une liste au pipeline :
+
+```py
+>>> result = speech_recognizer(dataset[:4]["audio"])
+>>> print([d["text"] for d in result])
+['I WOULD LIKE TO SET UP A JOINT ACCOUNT WITH MY PARTNER HOW DO I PROCEED WITH DOING THAT', "FODING HOW I'D SET UP A JOIN TO HET WITH MY WIFE AND WHERE THE AP MIGHT BE", "I I'D LIKE TOY SET UP A JOINT ACCOUNT WITH MY PARTNER I'M NOT SEEING THE OPTION TO DO IT ON THE AP SO I CALLED IN TO GET SOME HELP CAN I JUST DO IT OVER THE PHONE WITH YOU AND GIVE YOU THE INFORMATION OR SHOULD I DO IT IN THE AP AND I'M MISSING SOMETHING UQUETTE HAD PREFERRED TO JUST DO IT OVER THE PHONE OF POSSIBLE THINGS", 'HOW DO I THURN A JOIN A COUNT']
+```
+
+Pour les ensembles de donnรฉes plus importants oรน les entrรฉes sont volumineuses (comme dans les domaines de la parole ou de la vision), utilisez plutรดt un gรฉnรฉrateur au lieu d'une liste pour charger toutes les entrรฉes en mรฉmoire. Pour plus d'informations, consultez la documentation de l'[API pipeline](./main_classes/pipelines).
+
+### Utiliser une autre modรจle et tokenizer dans le pipeline
+
+Le [`pipeline`] peut รชtre utilisรฉ avec n'importe quel modรจle du [Hub](https://huggingface.co/models), ce qui permet d'adapter facilement le [`pipeline`] ร d'autres cas d'utilisation. Par exemple, si vous souhaitez un modรจle capable de traiter du texte franรงais, utilisez les filtres du Hub pour trouver un modรจle appropriรฉ. Le premier rรฉsultat renvoie un [modรจle BERT](https://huggingface.co/nlptown/bert-base-multilingual-uncased-sentiment) multilingue finetunรฉ pour l'analyse des sentiments que vous pouvez utiliser pour le texte franรงais :
+
+```py
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+```
+
+
+
+Utilisez [`AutoModelForSequenceClassification`] et [`AutoTokenizer`] pour charger le modรจle prรฉ-entraรฎnรฉ et le tokenizer adaptรฉ (plus de dรฉtails sur une `AutoClass` dans la section suivante) :
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+Utilisez [`TFAutoModelForSequenceClassification`] et [`AutoTokenizer`] pour charger le modรจle prรฉ-entraรฎnรฉ et le tokenizer adaptรฉ (plus de dรฉtails sur une `TFAutoClass` dans la section suivante) :
+
+```py
+>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+
+Spรฉcifiez le modรจle et le tokenizer dans le [`pipeline`], et utilisez le `classifier` sur le texte en franรงais :
+
+```py
+>>> classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
+>>> classifier("Nous sommes trรจs heureux de vous prรฉsenter la bibliothรจque ๐ค Transformers.")
+[{'label': '5 stars', 'score': 0.7273}]
+```
+
+Si vous ne parvenez pas ร trouver un modรจle adaptรฉ ร votre cas d'utilisation, vous devrez finetuner un modรจle prรฉ-entraรฎnรฉ sur vos donnรฉes. Jetez un coup d'ลil ร notre [tutoriel sur le finetuning](./training) pour apprendre comment faire. Enfin, aprรจs avoir finetunรฉ votre modรจle prรฉ-entraรฎnรฉ, pensez ร [partager](./model_sharing) le modรจle avec la communautรฉ sur le Hub afin de dรฉmocratiser l'apprentissage automatique pour tous ! ๐ค
+
+## AutoClass
+
+
+
+Les classes [`AutoModelForSequenceClassification`] et [`AutoTokenizer`] fonctionnent ensemble pour crรฉer un [`pipeline`] comme celui que vous avez utilisรฉ ci-dessus. Une [AutoClass](./model_doc/auto) est un raccourci qui rรฉcupรจre automatiquement l'architecture d'un modรจle prรฉ-entraรฎnรฉ ร partir de son nom ou de son emplacement. Il vous suffit de sรฉlectionner l'`AutoClass` appropriรฉe ร votre tรขche et la classe de prรฉtraitement qui lui est associรฉe.
+
+Reprenons l'exemple de la section prรฉcรฉdente et voyons comment vous pouvez utiliser l'`AutoClass` pour reproduire les rรฉsultats du [`pipeline`].
+
+### AutoTokenizer
+
+Un tokenizer est chargรฉ de prรฉtraiter le texte pour en faire un tableau de chiffres qui servira d'entrรฉe ร un modรจle. De nombreuses rรจgles rรฉgissent le processus de tokenisation, notamment la maniรจre de diviser un mot et le niveau auquel les mots doivent รชtre divisรฉs (pour en savoir plus sur la tokenisation, consultez le [rรฉsumรฉ](./tokenizer_summary)). La chose la plus importante ร retenir est que vous devez instancier un tokenizer avec le mรชme nom de modรจle pour vous assurer que vous utilisez les mรชmes rรจgles de tokenisation que celles avec lesquelles un modรจle a รฉtรฉ prรฉ-entraรฎnรฉ.
+
+Chargez un tokenizer avec [`AutoTokenizer`] :
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+Passez votre texte au tokenizer :
+
+```py
+>>> encoding = tokenizer("We are very happy to show you the ๐ค Transformers library.")
+>>> print(encoding)
+{'input_ids': [101, 11312, 10320, 12495, 19308, 10114, 11391, 10855, 10103, 100, 58263, 13299, 119, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+Le tokenizer retourne un dictionnaire contenant :
+
+* [input_ids](./glossary#input-ids): la reprรฉsentation numรฉrique des tokens.
+* [attention_mask](.glossary#attention-mask): indique quels tokens doivent faire l'objet d'une attention particuliรจre (plus particuliรจrement les tokens de remplissage).
+
+Un tokenizer peut รฉgalement accepter une liste de textes, et remplir et tronquer le texte pour retourner un รฉchantillon de longueur uniforme :
+
+
+
+
+```py
+>>> pt_batch = tokenizer(
+... ["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="pt",
+... )
+```
+
+
+
+```py
+>>> tf_batch = tokenizer(
+... ["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="tf",
+... )
+```
+
+
+
+
+
+Consultez le tutoriel [prรฉtraitement](./preprocessing) pour plus de dรฉtails sur la tokenisation, et sur la maniรจre d'utiliser un [`AutoImageProcessor`], un [`AutoFeatureExtractor`] et un [`AutoProcessor`] pour prรฉtraiter les images, l'audio et les contenus multimodaux.
+
+
+
+### AutoModel
+
+
+
+๐ค Transformers fournit un moyen simple et unifiรฉ de charger des instances prรฉ-entraรฎnรฉes. Cela signifie que vous pouvez charger un [`AutoModel`] comme vous chargeriez un [`AutoTokenizer`]. La seule diffรฉrence est de sรฉlectionner l'[`AutoModel`] appropriรฉ pour la tรขche. Pour une classification de texte (ou de sรฉquence de textes), vous devez charger [`AutoModelForSequenceClassification`] :
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+
+Voir le [rรฉsumรฉ de la tรขche](./task_summary) pour vรฉrifier si elle est prise en charge par une classe [`AutoModel`].
+
+
+
+Maintenant, passez votre รฉchantillon d'entrรฉes prรฉtraitรฉes directement au modรจle. Il vous suffit de dรฉcompresser le dictionnaire en ajoutant `**` :
+
+```py
+>>> pt_outputs = pt_model(**pt_batch)
+```
+
+Le modรจle produit les activations finales dans l'attribut `logits`. Appliquez la fonction softmax aux `logits` pour rรฉcupรฉrer les probabilitรฉs :
+
+```py
+>>> from torch import nn
+
+>>> pt_predictions = nn.functional.softmax(pt_outputs.logits, dim=-1)
+>>> print(pt_predictions)
+tensor([[0.0021, 0.0018, 0.0115, 0.2121, 0.7725],
+ [0.2084, 0.1826, 0.1969, 0.1755, 0.2365]], grad_fn=)
+```
+
+
+๐ค Transformers fournit un moyen simple et unifiรฉ de charger des instances prรฉ-entraรฎnรฉs. Cela signifie que vous pouvez charger un [`TFAutoModel`] comme vous chargeriez un [`AutoTokenizer`]. La seule diffรฉrence est de sรฉlectionner le [`TFAutoModel`] appropriรฉ pour la tรขche. Pour une classification de texte (ou de sรฉquence de textes), vous devez charger [`TFAutoModelForSequenceClassification`] :
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+
+Voir le [rรฉsumรฉ de la tรขche](./task_summary) pour vรฉrifier si elle est prise en charge par une classe [`AutoModel`].
+
+
+
+Passez maintenant votre รฉchantillon d'entrรฉes prรฉtraitรฉes directement au modรจle en passant les clรฉs du dictionnaire directement aux tensors :
+
+```py
+>>> tf_outputs = tf_model(tf_batch)
+```
+
+Le modรจle produit les activations finales dans l'attribut `logits`. Appliquez la fonction softmax aux `logits` pour rรฉcupรฉrer les probabilitรฉs :
+
+```py
+>>> import tensorflow as tf
+
+>>> tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
+>>> tf_predictions # doctest: +IGNORE_RESULT
+```
+
+
+
+
+
+Tous les modรจles ๐ค Transformers (PyTorch ou TensorFlow) produisent les tensors *avant* la fonction d'activation finale (comme softmax) car la fonction d'activation finale est souvent fusionnรฉe avec le calcul de la perte. Les structures produites par le modรจle sont des classes de donnรฉes spรฉciales, de sorte que leurs attributs sont autocomplรฉtรฉs dans un environnement de dรฉveloppement. Les structures produites par le modรจle se comportent comme un tuple ou un dictionnaire (vous pouvez les indexer avec un entier, une tranche ou une chaรฎne), auquel cas les attributs qui sont None sont ignorรฉs.
+
+
+
+### Sauvegarder un modรจle
+
+
+
+Une fois que votre modรจle est finetunรฉ, vous pouvez le sauvegarder avec son tokenizer en utilisant [`PreTrainedModel.save_pretrained`] :
+
+```py
+>>> pt_save_directory = "./pt_save_pretrained"
+>>> tokenizer.save_pretrained(pt_save_directory) # doctest: +IGNORE_RESULT
+>>> pt_model.save_pretrained(pt_save_directory)
+```
+
+Lorsque vous voulez rรฉutiliser le modรจle, rechargez-le avec [`PreTrainedModel.from_pretrained`] :
+
+```py
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained("./pt_save_pretrained")
+```
+
+
+Une fois que votre modรจle est finetunรฉ, vous pouvez le sauvegarder avec son tokenizer en utilisant [`TFPreTrainedModel.save_pretrained`] :
+
+```py
+>>> tf_save_directory = "./tf_save_pretrained"
+>>> tokenizer.save_pretrained(tf_save_directory) # doctest: +IGNORE_RESULT
+>>> tf_model.save_pretrained(tf_save_directory)
+```
+
+Lorsque vous voulez rรฉutiliser le modรจle, rechargez-le avec [`TFPreTrainedModel.from_pretrained`] :
+
+```py
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained("./tf_save_pretrained")
+```
+
+
+
+Une fonctionnalitรฉ particuliรจrement cool ๐ค Transformers est la possibilitรฉ d'enregistrer un modรจle et de le recharger en tant que modรจle PyTorch ou TensorFlow. Le paramรจtre `from_pt` ou `from_tf` permet de convertir le modรจle d'un framework ร l'autre :
+
+
+
+
+```py
+>>> from transformers import AutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(pt_save_directory, from_pt=True)
+```
+
+
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(tf_save_directory, from_tf=True)
+```
+
+
+
+## Constructions de modรจles personnalisรฉs
+
+Vous pouvez modifier la configuration du modรจle pour changer la faรงon dont un modรจle est construit. La configuration spรฉcifie les attributs d'un modรจle, tels que le nombre de couches ou de tรชtes d'attention. Vous partez de zรฉro lorsque vous initialisez un modรจle ร partir d'une configuration personnalisรฉe. Les attributs du modรจle sont initialisรฉs de maniรจre alรฉatoire et vous devrez entraรฎner le modรจle avant de pouvoir l'utiliser pour obtenir des rรฉsultats significatifs.
+
+Commencez par importer [`AutoConfig`], puis chargez le modรจle prรฉ-entraรฎnรฉ que vous voulez modifier. Dans [`AutoConfig.from_pretrained`], vous pouvez spรฉcifier l'attribut que vous souhaitez modifier, tel que le nombre de tรชtes d'attention :
+
+```py
+>>> from transformers import AutoConfig
+
+>>> my_config = AutoConfig.from_pretrained("distilbert/distilbert-base-uncased", n_heads=12)
+```
+
+
+
+Crรฉez un modรจle personnalisรฉ ร partir de votre configuration avec [`AutoModel.from_config`] :
+
+```py
+>>> from transformers import AutoModel
+
+>>> my_model = AutoModel.from_config(my_config)
+```
+
+
+Crรฉez un modรจle personnalisรฉ ร partir de votre configuration avec [`TFAutoModel.from_config`] :
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> my_model = TFAutoModel.from_config(my_config)
+```
+
+
+
+Consultez le guide [Crรฉer une architecture personnalisรฉe](./create_a_model) pour plus d'informations sur la crรฉation de configurations personnalisรฉes.
+
+## Trainer - une boucle d'entraรฎnement optimisรฉe par PyTorch
+
+Tous les modรจles sont des [`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) standard, vous pouvez donc les utiliser dans n'importe quelle boucle d'entraรฎnement typique. Bien que vous puissiez รฉcrire votre propre boucle d'entraรฎnement, ๐ค Transformers fournit une classe [`Trainer`] pour PyTorch, qui contient la boucle d'entraรฎnement de base et ajoute des fonctionnalitรฉs supplรฉmentaires comme l'entraรฎnement distribuรฉ, la prรฉcision mixte, et plus encore.
+
+En fonction de votre tรขche, vous passerez gรฉnรฉralement les paramรจtres suivants ร [`Trainer`] :
+
+1. Un [`PreTrainedModel`] ou un [`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module):
+
+ ```py
+ >>> from transformers import AutoModelForSequenceClassification
+
+ >>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+2. [`TrainingArguments`] contient les hyperparamรจtres du modรจle que vous pouvez changer comme le taux d'apprentissage, la taille de l'รฉchantillon, et le nombre d'รฉpoques pour s'entraรฎner. Les valeurs par dรฉfaut sont utilisรฉes si vous ne spรฉcifiez pas d'hyperparamรจtres d'apprentissage :
+
+ ```py
+ >>> from transformers import TrainingArguments
+
+ >>> training_args = TrainingArguments(
+ ... output_dir="path/to/save/folder/",
+ ... learning_rate=2e-5,
+ ... per_device_train_batch_size=8,
+ ... per_device_eval_batch_size=8,
+ ... num_train_epochs=2,
+ ... )
+ ```
+
+3. Une classe de prรฉtraitement comme un tokenizer, un processeur d'images ou un extracteur de caractรฉristiques :
+
+ ```py
+ >>> from transformers import AutoTokenizer
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+4. Chargez un jeu de donnรฉes :
+
+ ```py
+ >>> from datasets import load_dataset
+
+ >>> dataset = load_dataset("rotten_tomatoes") # doctest: +IGNORE_RESULT
+ ```
+
+5. Crรฉez une fonction qui transforme le texte du jeu de donnรฉes en token :
+
+ ```py
+ >>> def tokenize_dataset(dataset):
+ ... return tokenizer(dataset["text"])
+ ```
+
+ Puis appliquez-la ร l'intรฉgralitรฉ du jeu de donnรฉes avec [`~datasets.Dataset.map`]:
+
+ ```py
+ >>> dataset = dataset.map(tokenize_dataset, batched=True)
+ ```
+
+6. Un [`DataCollatorWithPadding`] pour crรฉer un รฉchantillon d'exemples ร partir de votre jeu de donnรฉes :
+
+ ```py
+ >>> from transformers import DataCollatorWithPadding
+
+ >>> data_collator = DataCollatorWithPadding(tokenizer=tokenizer)
+ ```
+
+Maintenant, rassemblez tous ces รฉlรฉments dans un [`Trainer`] :
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=dataset["train"],
+... eval_dataset=dataset["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... ) # doctest: +SKIP
+```
+
+Une fois que vous รชtes prรชt, appelez la fonction [`~Trainer.train`] pour commencer l'entraรฎnement :
+
+```py
+>>> trainer.train() # doctest: +SKIP
+```
+
+
+
+Pour les tรขches - comme la traduction ou la gรฉnรฉration de rรฉsumรฉ - qui utilisent un modรจle sรฉquence ร sรฉquence, utilisez plutรดt les classes [`Seq2SeqTrainer`] et [`Seq2SeqTrainingArguments`].
+
+
+
+Vous pouvez personnaliser le comportement de la boucle d'apprentissage en redรฉfinissant les mรฉthodes ร l'intรฉrieur de [`Trainer`]. Cela vous permet de personnaliser des caractรฉristiques telles que la fonction de perte, l'optimiseur et le planificateur. Consultez la documentation de [`Trainer`] pour savoir quelles mรฉthodes peuvent รชtre redรฉfinies.
+
+L'autre moyen de personnaliser la boucle d'apprentissage est d'utiliser les [Callbacks](./main_classes/callback). Vous pouvez utiliser les callbacks pour intรฉgrer d'autres bibliothรจques et inspecter la boucle d'apprentissage afin de suivre la progression ou d'arrรชter l'apprentissage plus tรดt. Les callbacks ne modifient rien dans la boucle d'apprentissage elle-mรชme. Pour personnaliser quelque chose comme la fonction de perte, vous devez redรฉfinir le [`Trainer`] ร la place.
+
+## Entraรฎnement avec TensorFlow
+
+Tous les modรจles sont des modรจles standard [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) afin qu'ils puissent รชtre entraรฎnรฉs avec TensorFlow avec l'API [Keras](https://keras.io/). ๐ค Transformers fournit la fonction [`~TFPreTrainedModel.prepare_tf_dataset`] pour charger facilement votre jeu de donnรฉes comme un `tf.data.Dataset` afin que vous puissiez commencer l'entraรฎnement immรฉdiatement avec les fonctions [`compile`](https://keras.io/api/models/model_training_apis/#compile-method) et [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) de Keras.
+
+1. Vous commencez avec un modรจle [`TFPreTrainedModel`] ou [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) :
+
+ ```py
+ >>> from transformers import TFAutoModelForSequenceClassification
+
+ >>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+2. Une classe de prรฉtraitement comme un tokenizer, un processeur d'images ou un extracteur de caractรฉristiques :
+
+ ```py
+ >>> from transformers import AutoTokenizer
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+3. Crรฉez une fonction qui transforme le texte du jeu de donnรฉes en token :
+
+ ```py
+ >>> def tokenize_dataset(dataset):
+ ... return tokenizer(dataset["text"]) # doctest: +SKIP
+ ```
+
+4. Appliquez le tokenizer ร l'ensemble du jeu de donnรฉes avec [`~datasets.Dataset.map`] et passez ensuite le jeu de donnรฉes et le tokenizer ร [`~TFPreTrainedModel.prepare_tf_dataset`]. Vous pouvez รฉgalement modifier la taille de l'รฉchantillon et mรฉlanger le jeu de donnรฉes ici si vous le souhaitez :
+
+ ```py
+ >>> dataset = dataset.map(tokenize_dataset) # doctest: +SKIP
+ >>> tf_dataset = model.prepare_tf_dataset(
+ ... dataset, batch_size=16, shuffle=True, tokenizer=tokenizer
+ ... ) # doctest: +SKIP
+ ```
+
+5. Une fois que vous รชtes prรชt, appelez les fonctions `compile` et `fit` pour commencer l'entraรฎnement :
+
+ ```py
+ >>> from tensorflow.keras.optimizers import Adam
+
+ >>> model.compile(optimizer=Adam(3e-5))
+ >>> model.fit(dataset) # doctest: +SKIP
+ ```
+
+## Et aprรจs ?
+
+Maintenant que vous avez terminรฉ la visite rapide de ๐ค Transformers, consultez nos guides et apprenez ร faire des choses plus spรฉcifiques comme crรฉer un modรจle personnalisรฉ, finetuner un modรจle pour une tรขche, et comment entraรฎner un modรจle avec un script. Si vous souhaitez en savoir plus sur les concepts fondamentaux de ๐ค Transformers, jetez un ลil ร nos guides conceptuels !
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/run_scripts_fr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/run_scripts_fr.md
new file mode 100644
index 0000000000000000000000000000000000000000..0344ff2cec3d2d4f964dbacfc27344aa90e56447
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/run_scripts_fr.md
@@ -0,0 +1,355 @@
+
+
+# Entraรฎner avec un script
+
+En plus des [notebooks](./notebooks) de ๐ค Transformers, il existe รฉgalement des exemples de scripts dรฉmontrant comment entraรฎner un modรจle pour une tรขche avec [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch), [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow) ou [JAX/Flax](https://github.com/huggingface/transformers/tree/main/examples/flax).
+
+
+Vous trouverez รฉgalement des scripts que nous avons utilisรฉ dans nos [projets de recherche](https://github.com/huggingface/transformers/tree/main/examples/research_projects) et des [exemples "legacy"](https://github.com/huggingface/transformers/tree/main/examples/legacy) qui sont des contributions de la communautรฉ. Ces scripts ne sont pas activement maintenus et nรฉcessitent une version spรฉcifique de ๐ค Transformers qui sera probablement incompatible avec la derniรจre version de la librairie.
+
+Les exemples de scripts ne sont pas censรฉs fonctionner immรฉdiatement pour chaque problรจme, et il se peut que vous ayez besoin d'adapter le script au problรจme que vous essayez de rรฉsoudre. Pour vous aider dans cette tรขche, la plupart des scripts exposent entiรจrement la maniรจre dont les donnรฉes sont prรฉtraitรฉes, vous permettant de les modifier selon vos besoins.
+
+Pour toute fonctionnalitรฉ que vous souhaitez implรฉmenter dans un script d'exemple, veuillez en discuter sur le [forum](https://discuss.huggingface.co/) ou dans une [issue](https://github.com/huggingface/transformers/issues) avant de soumettre une Pull Request. Bien que nous acceptions les corrections de bugs, il est peu probable que nous fusionnions une Pull Request (opรฉration "merge" dans Git) ajoutant plus de fonctionnalitรฉs au dรฉtriment de la lisibilitรฉ.
+
+Ce guide vous montrera comment exรฉcuter un script d'entraรฎnement de rรฉsumรฉ en exemple avec [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization) et [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization). Tous les exemples sont censรฉs fonctionner avec les deux frameworks, sauf indication contraire.
+
+## Configuration
+
+Pour exรฉcuter avec succรจs la derniรจre version des scripts d'exemple, vous devez **installer ๐ค Transformers ร partir du code source** dans un nouvel environnement virtuel :
+
+```bash
+git clone https://github.com/huggingface/transformers
+cd transformers
+pip install .
+```
+
+Pour les versions plus anciennes des exemples de scripts, cliquez sur le bouton ci-dessous :
+
+
+ Exemples pour les anciennes versions de Transformers ๐ค
+
+
+
+Ensuite, changez votre clone actuel de ๐ค Transformers pour une version spรฉcifique, comme par exemple v3.5.1 :
+
+```bash
+git checkout tags/v3.5.1
+```
+
+Aprรจs avoir configurรฉ la bonne version de la librairie, accรฉdez au dossier d'exemple de votre choix et installez les prรฉrequis spรฉcifiques ร l'exemple.
+
+```bash
+pip install -r requirements.txt
+```
+
+## Exรฉcuter un script
+
+
+
+
+Le script d'exemple tรฉlรฉcharge et prรฉtraite un jeu de donnรฉes ร partir de la bibliothรจque ๐ค [Datasets](https://huggingface.co/docs/datasets/). Ensuite, le script affine un ensemble de donnรฉes ร l'aide de [Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) sur une architecture qui prend en charge la tรขche de rรฉsumรฉ. L'exemple suivant montre comment ajuster le modรจle [T5-small](https://huggingface.co/google-t5/t5-small) sur les donnรฉes [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail). Le modรจle T5 nรฉcessite un argument supplรฉmentaire `source_prefix` en raison de la faรงon dont il a รฉtรฉ entraรฎnรฉ. Cette invite permet ร T5 de savoir qu'il s'agit d'une tรขche de rรฉsumรฉ.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+
+Le script d'exemple tรฉlรฉcharge et prรฉtraite un jeu de donnรฉes ร partir de la bibliothรจque ๐ค [Datasets](https://huggingface.co/docs/datasets/). Ensuite, le script ajuste un modรจle ร l'aide de Keras sur une architecture qui prend en charge la tรขche de rรฉsumรฉ. L'exemple suivant montre comment ajuster le modรจle [T5-small](https://huggingface.co/google-t5/t5-small) sur le jeu de donnรฉes [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail). Le modรจle T5 nรฉcessite un argument supplรฉmentaire source_prefix en raison de la faรงon dont il a รฉtรฉ entraรฎnรฉ. Cette invite permet ร T5 de savoir qu'il s'agit d'une tรขche de rรฉsumรฉ.
+
+```bash
+python examples/tensorflow/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Entraรฎnement distribuรฉ et prรฉcision mixte
+
+[Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) prend en charge l'entraรฎnement distribuรฉ et la prรฉcision mixte, ce qui signifie que vous pouvez รฉgalement les utiliser dans un script. Pour activer ces deux fonctionnalitรฉs :
+
+- Ajoutez l'argument fp16 pour activer la prรฉcision mixte.
+- Dรฉfinissez le nombre de GPU ร utiliser avec l'argument `nproc_per_node`.
+
+```bash
+torchrun \
+ --nproc_per_node 8 pytorch/summarization/run_summarization.py \
+ --fp16 \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+Les scripts TensorFlow utilisent une Strategie en Miroir [`MirroredStrategy`](https://www.tensorflow.org/guide/distributed_training#mirroredstrategy) pour l'entraรฎnement distribuรฉ, et vous n'avez pas besoin d'ajouter d'arguments supplรฉmentaires au script d'entraรฎnement. Le script TensorFlow utilisera plusieurs GPU par dรฉfaut s'ils sont disponibles.
+
+## Exรฉcuter un script sur un TPU
+
+
+
+
+Les unitรฉs de traitement de tenseurs (UTT) (TPU) sont spรฉcialement conรงues pour accรฉlรฉrer les performances. PyTorch prend en charge les TPU avec le compilateur de deep learning [XLA](https://www.tensorflow.org/xla). Pour utiliser un TPU, lancez le script xla_spawn.py et utilisez l'argument num_cores pour dรฉfinir le nombre de cลurs TPU que vous souhaitez utilise
+
+```bash
+python xla_spawn.py --num_cores 8 \
+ summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+Les scripts TensorFlow utilisent une [`TPUStrategy`](https://www.tensorflow.org/guide/distributed_training#tpustrategy) pour l'entraรฎnement sur TPU. Pour utiliser un TPU, passez le nom de la ressource TPU ร l'argument tpu.
+
+```bash
+python run_summarization.py \
+ --tpu name_of_tpu_resource \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Exรฉcuter un script avec ๐ค Accelerate
+
+๐ค [Accelerate](https://huggingface.co/docs/accelerate) est une bibliothรจque uniquement pour PyTorch qui offre une mรฉthode unifiรฉe pour entraรฎner un modรจle sur plusieurs types de configurations (CPU uniquement, plusieurs GPU, TPU) tout en maintenant une visibilitรฉ complรจte sur la boucle d'entraรฎnement PyTorch. Assurez-vous que vous avez installรฉ ๐ค Accelerate si ce n'est pas dรฉjร le cas.
+
+> Note : Comme Accelerate est en dรฉveloppement rapide, la version git d'accelerate doit รชtre installรฉe pour exรฉcuter les scripts.
+```bash
+pip install git+https://github.com/huggingface/accelerate
+```
+
+Au lieu du script `run_summarization.py`, vous devez utiliser le script `run_summarization_no_trainer.py`. Les scripts compatibles avec ๐ค Accelerate auront un fichier `task_no_trainer.py` dans le dossier. Commencez par exรฉcuter la commande suivante pour crรฉer et enregistrer un fichier de configuration.
+
+```bash
+accelerate config
+```
+
+Testez votre configuration pour vous assurer qu'elle est correctement configurรฉe :
+
+```bash
+accelerate test
+```
+
+Maintenant, vous รชtes prรชt ร lancer l'entraรฎnement :
+
+```bash
+accelerate launch run_summarization_no_trainer.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir ~/tmp/tst-summarization
+```
+
+## Utiliser un jeu de donnรฉes personnalisรฉ
+
+Le script de rรฉsumรฉ prend en charge les jeux de donnรฉes personnalisรฉs tant qu'ils sont au format CSV ou JSON Line. Lorsque vous utilisez votre propre jeu de donnรฉes, vous devez spรฉcifier plusieurs arguments supplรฉmentaires :
+
+- `train_file` et `validation_file` spรฉcifient le chemin vers vos fichiers d'entraรฎnement et de validation.
+- `text_column` est le texte d'entrรฉe ร rรฉsumer.
+- `summary_column` est le texte cible ร produire.
+
+Un exemple de script de rรฉsumรฉ utilisant un ensemble de donnรฉes personnalisรฉ ressemblerait ร ceci :
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --train_file path_to_csv_or_jsonlines_file \
+ --validation_file path_to_csv_or_jsonlines_file \
+ --text_column text_column_name \
+ --summary_column summary_column_name \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --overwrite_output_dir \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --predict_with_generate
+```
+
+## Tester un script
+Il est souvent judicieux d'exรฉcuter votre script sur un plus petit nombre d'exemples de jeu de donnรฉes pour s'assurer que tout fonctionne comme prรฉvu avant de s'engager sur un jeu de donnรฉes complet qui pourrait prendre des heures ร traiter. Utilisez les arguments suivants pour tronquer le jeu de donnรฉes ร un nombre maximal d'รฉchantillons :
+
+- `max_train_samples`
+- `max_eval_samples`
+- `max_predict_samples`
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --max_train_samples 50 \
+ --max_eval_samples 50 \
+ --max_predict_samples 50 \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+Tous les scripts d'exemple ne prennent pas en charge l'argument `max_predict_samples`. Si vous n'รชtes pas sรปr que votre script prenne en charge cet argument, ajoutez l'argument `-h` pour vรฉrifier.
+
+```bash
+examples/pytorch/summarization/run_summarization.py -h
+```
+
+## Reprendre l'entraรฎnement ร partir d'un point de contrรดle
+
+Une autre option utile est de reprendre l'entraรฎnement ร partir d'un point de contrรดle prรฉcรฉdent. Cela vous permettra de reprendre lร oรน vous vous รฉtiez arrรชtรฉ sans recommencer si votre entraรฎnement est interrompu. Il existe deux mรฉthodes pour reprendre l'entraรฎnement ร partir d'un point de contrรดle.
+
+La premiรจre mรฉthode utilise l'argument `output_dir previous_output_dir` pour reprendre l'entraรฎnement ร partir du dernier point de contrรดle stockรฉ dans `output_dir`. Dans ce cas, vous devez supprimer l'argument `overwrite_output_dir`.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --output_dir previous_output_dir \
+ --predict_with_generate
+```
+
+La seconde mรฉthode utilise l'argument `resume_from_checkpoint path_to_specific_checkpoint` pour reprendre l'entraรฎnement ร partir d'un dossier de point de contrรดle spรฉcifique.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --resume_from_checkpoint path_to_specific_checkpoint \
+ --predict_with_generate
+```
+
+## Partage ton modรจle
+
+Tous les scripts peuvent tรฉlรฉcharger votre modรจle final sur le Model Hub. Assurez-vous que vous รชtes connectรฉ ร Hugging Face avant de commencer :
+
+```bash
+huggingface-cli login
+```
+
+Ensuite, ajoutez l'argument `push_to_hub` au script. Cet argument crรฉera un dรฉpรดt avec votre nom d'utilisateur Hugging Face et le nom du dossier spรฉcifiรฉ dans `output_dir`.
+
+
+Pour donner un nom spรฉcifique ร votre dรฉpรดt, utilisez l'argument `push_to_hub_model_id` pour l'ajouter. Le dรฉpรดt sera automatiquement listรฉ sous votre namespace.
+
+L'exemple suivant montre comment tรฉlรฉcharger un modรจle avec un nom de dรฉpรดt spรฉcifique :
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --push_to_hub \
+ --push_to_hub_model_id finetuned-t5-cnn_dailymail \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/task_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/task_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..f730264f95e86fe8bb44cbb338f72e48af607125
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/task_summary.md
@@ -0,0 +1,341 @@
+
+
+# Ce que ๐ค Transformers peut faire
+
+๐ค Transformers est une bibliothรจque de modรจles prรฉentraรฎnรฉs ร la pointe de la technologie pour les tรขches de traitement du langage naturel (NLP), de vision par ordinateur et de traitement audio et de la parole. Non seulement la bibliothรจque contient des modรจles Transformer, mais elle inclut รฉgalement des modรจles non-Transformer comme des rรฉseaux convolutionnels modernes pour les tรขches de vision par ordinateur. Si vous regardez certains des produits grand public les plus populaires aujourd'hui, comme les smartphones, les applications et les tรฉlรฉviseurs, il est probable qu'une technologie d'apprentissage profond soit derriรจre. Vous souhaitez supprimer un objet de fond d'une photo prise avec votre smartphone ? C'est un exemple de tรขche de segmentation panoptique (ne vous inquiรฉtez pas si vous ne savez pas encore ce que cela signifie, nous le dรฉcrirons dans les sections suivantes !).
+
+Cette page fournit un aperรงu des diffรฉrentes tรขches de traitement de la parole et de l'audio, de vision par ordinateur et de NLP qui peuvent รชtre rรฉsolues avec la bibliothรจque ๐ค Transformers en seulement trois lignes de code !
+
+## Audio
+
+Les tรขches de traitement audio et de la parole sont lรฉgรจrement diffรฉrentes des autres modalitรฉs principalement parce que l'audio en tant que donnรฉe d'entrรฉe est un signal continu. Contrairement au texte, un signal audio brut ne peut pas discrรฉtisรฉ de la maniรจre dont une phrase peut รชtre divisรฉe en mots. Pour contourner cela, le signal audio brut est gรฉnรฉralement รฉchantillonnรฉ ร intervalles rรฉguliers. Si vous prenez plus d'รฉchantillons dans un intervalle, le taux d'รฉchantillonnage est plus รฉlevรฉ et l'audio ressemble davantage ร la source audio originale.
+
+Les approches prรฉcรฉdentes prรฉtraitaient l'audio pour en extraire des caractรฉristiques utiles. Il est maintenant plus courant de commencer les tรขches de traitement audio et de la parole en donnant directement le signal audio brut ร un encodeur de caractรฉristiques (*feature encoder* en anglais) pour extraire une reprรฉsentation de l'audio. Cela correspond ร l'รฉtape de prรฉtraitement et permet au modรจle d'apprendre les caractรฉristiques les plus essentielles du signal.
+
+### Classification audio
+
+La classification audio est une tรขche qui consiste ร attribuer une classe, parmi un ensemble de classes prรฉdรฉfini, ร un audio. La classification audio englobe de nombreuses applications spรฉcifiques, dont certaines incluent :
+
+* la classification d'environnements sonores : attribuer une classe (catรฉgorie) ร l'audio pour indiquer l'environnement associรฉ, tel que "bureau", "plage" ou "stade".
+* la dรฉtection d'รฉvรฉnements sonores : รฉtiqueter l'audio avec une รฉtiquette d'รฉvรฉnement sonore ("klaxon de voiture", "appel de baleine", "verre brisรฉ")
+* l'identification d'รฉlรฉments sonores : attribuer des tags (*รฉtiquettes* en franรงais) ร l'audio pour marquer des sons spรฉcifiques, comme "chant des oiseaux" ou "identification du locuteur lors d'une rรฉunion".
+* la classification musicale : attribuer un genre ร la musique, comme "metal", "hip-hop" ou "country".
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="audio-classification", model="superb/hubert-base-superb-er")
+>>> preds = classifier("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4532, 'label': 'hap'},
+ {'score': 0.3622, 'label': 'sad'},
+ {'score': 0.0943, 'label': 'neu'},
+ {'score': 0.0903, 'label': 'ang'}]
+```
+
+### Reconnaissance vocale
+
+La reconnaissance vocale (*Automatic Speech Recognition* ou ASR en anglais) transcrit la parole en texte. C'est l'une des tรขches audio les plus courantes en partie parce que la parole est une forme de communication la plus naturelle pour nous, humains. Aujourd'hui, les systรจmes ASR sont intรฉgrรฉs dans des produits technologiques "intelligents" comme les enceintes, les tรฉlรฉphones et les voitures. Il est dรฉsormais possible de demander ร nos assistants virtuels de jouer de la musique, de dรฉfinir des rappels et de nous indiquer la mรฉtรฉo.
+
+Mais l'un des principaux dรฉfis auxquels les architectures Transformer contribuent ร rรฉsoudre est celui des langues ร faibles ressources, c'est-ร -dire des langues pour lesquelles il existe peu de donnรฉes รฉtiquetรฉes. En prรฉentraรฎnant sur de grandes quantitรฉs de donnรฉes vocales d'un autre language plus ou moins similaire, le rรฉglage fin (*fine-tuning* en anglais) du modรจle avec seulement une heure de donnรฉes vocales รฉtiquetรฉes dans une langue ร faibles ressources peut tout de mรชme produire des rรฉsultats de haute qualitรฉ comparรฉs aux systรจmes ASR prรฉcรฉdents entraรฎnรฉs sur 100 fois plus de donnรฉes รฉtiquetรฉes.
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition", model="openai/whisper-small")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+## Vision par ordinateur
+
+L'une des premiรจres rรฉussites en vision par ordinateur a รฉtรฉ la reconnaissance des numรฉros de code postal ร l'aide d'un [rรฉseau de neurones convolutionnel (CNN)](glossary#convolution). Une image est composรฉe de pixels, chacun ayant une valeur numรฉrique, ce qui permet de reprรฉsenter facilement une image sous forme de matrice de valeurs de pixels. Chaque combinaison de valeurs de pixels correspond aux couleurs d'une image.
+
+Il existe deux approches principales pour rรฉsoudre les tรขches de vision par ordinateur :
+
+1. Utiliser des convolutions pour apprendre les caractรฉristiques hiรฉrarchiques d'une image, des dรฉtails de bas niveau aux รฉlรฉments abstraits de plus haut niveau.
+2. Diviser l'image en morceaux (*patches* en anglais) et utiliser un Transformer pour apprendre progressivement comment chaque morceau est liรฉ aux autres pour former l'image complรจte. Contrairement ร l'approche ascendante des CNNs, cette mรฉthode ressemble ร un processus oรน l'on dรฉmarre avec une image floue pour ensuite la mettre au point petit ร petit.
+
+### Classification d'images
+
+La classification d'images consiste ร attribuer une classe, parmi un ensemble de classes prรฉdรฉfini, ร toute une image. Comme pour la plupart des tรขches de classification, les cas d'utilisation pratiques sont nombreux, notamment :
+
+- Santรฉ : classification d'images mรฉdicales pour dรฉtecter des maladies ou surveiller l'รฉtat de santรฉ des patients.
+- Environnement : classification d'images satellites pour suivre la dรฉforestation, aider ร la gestion des terres ou dรฉtecter les incendies de forรชt.
+- Agriculture : classification d'images de cultures pour surveiller la santรฉ des plantes ou des images satellites pour analyser l'utilisation des terres.
+- รcologie : classification d'images d'espรจces animales ou vรฉgรฉtales pour suivre les populations fauniques ou les espรจces menacรฉes.
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="image-classification")
+>>> preds = classifier(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.4335, 'label': 'lynx, catamount'}
+{'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}
+{'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}
+{'score': 0.0239, 'label': 'Egyptian cat'}
+{'score': 0.0229, 'label': 'tiger cat'}
+```
+
+### Dรฉtection d'objets
+
+La dรฉtection d'objets, ร la diffรฉrence de la classification d'images, identifie plusieurs objets dans une image ainsi que leurs positions, gรฉnรฉralement dรฉfinies par des boรฎtes englobantes (*bounding boxes* en anglais). Voici quelques exemples d'applications :
+
+- Vรฉhicules autonomes : dรฉtection des objets de la circulation, tels que les vรฉhicules, piรฉtons et feux de signalisation.
+- Tรฉlรฉdรฉtection : surveillance des catastrophes, planification urbaine et prรฉvisions mรฉtรฉorologiques.
+- Dรฉtection de dรฉfauts : identification des fissures ou dommages structurels dans les bรขtiments, ainsi que des dรฉfauts de fabrication.
+
+```py
+>>> from transformers import pipeline
+
+>>> detector = pipeline(task="object-detection")
+>>> preds = detector(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"], "box": pred["box"]} for pred in preds]
+>>> preds
+[{'score': 0.9865,
+ 'label': 'cat',
+ 'box': {'xmin': 178, 'ymin': 154, 'xmax': 882, 'ymax': 598}}]
+```
+
+### Segmentation d'images
+
+La segmentation d'images est une tรขche qui consiste ร attribuer une classe ร chaque pixel d'une image, ce qui la rend plus prรฉcise que la dรฉtection d'objets, qui se limite aux boรฎtes englobantes (*bounding boxes* en anglais). Elle permet ainsi de dรฉtecter les objets ร la prรฉcision du pixel. Il existe plusieurs types de segmentation d'images :
+
+- Segmentation d'instances : en plus de classifier un objet, elle identifie chaque instance distincte d'un mรชme objet (par exemple, "chien-1", "chien-2").
+- Segmentation panoptique : combine segmentation sรฉmantique et segmentation d'instances, attribuant ร chaque pixel une classe sรฉmantique **et** une instance spรฉcifique.
+
+Ces techniques sont utiles pour les vรฉhicules autonomes, qui doivent cartographier leur environnement pixel par pixel pour naviguer en toute sรฉcuritรฉ autour des piรฉtons et des vรฉhicules. Elles sont รฉgalement prรฉcieuses en imagerie mรฉdicale, oรน la prรฉcision au niveau des pixels permet de dรฉtecter des anomalies cellulaires ou des caractรฉristiques d'organes. Dans le commerce en ligne, la segmentation est utilisรฉe pour des essayages virtuels de vรชtements ou des expรฉriences de rรฉalitรฉ augmentรฉe, en superposant des objets virtuels sur des images du monde rรฉel via la camรฉra.
+
+```py
+>>> from transformers import pipeline
+
+>>> segmenter = pipeline(task="image-segmentation")
+>>> preds = segmenter(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.9879, 'label': 'LABEL_184'}
+{'score': 0.9973, 'label': 'snow'}
+{'score': 0.9972, 'label': 'cat'}
+```
+
+### Estimation de la profondeur
+
+L'estimation de la profondeur consiste ร prรฉdire la distance de chaque pixel d'une image par rapport ร la camรฉra. Cette tรขche est cruciale pour comprendre et reconstruire des scรจnes rรฉelles. Par exemple, pour les voitures autonomes, il est essentiel de dรฉterminer la distance des objets tels que les piรฉtons, les panneaux de signalisation et les autres vรฉhicules pour รฉviter les collisions. L'estimation de la profondeur permet รฉgalement de crรฉer des modรจles 3D ร partir d'images 2D, ce qui est utile pour gรฉnรฉrer des reprรฉsentations dรฉtaillรฉes de structures biologiques ou de bรขtiments.
+
+Il existe deux principales approches pour estimer la profondeur :
+
+- Stรฉrรฉo : la profondeur est estimรฉe en comparant deux images d'une mรชme scรจne prises sous des angles lรฉgรจrement diffรฉrents.
+- Monoculaire : la profondeur est estimรฉe ร partir d'une seule image.
+
+```py
+>>> from transformers import pipeline
+
+>>> depth_estimator = pipeline(task="depth-estimation")
+>>> preds = depth_estimator(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+```
+
+## Traitement du langage naturel
+
+Les tรขches de traitement du langage naturel (*Natural Language Processing* ou *NLP* en anglais) sont courantes car le texte est une forme naturelle de communication pour nous. Pour qu'un modรจle puisse traiter le texte, celui-ci doit รชtre *tokenisรฉ*, c'est-ร -dire divisรฉ en mots ou sous-mots appelรฉs "*tokens*", puis converti en nombres. Ainsi, une sรฉquence de texte peut รชtre reprรฉsentรฉe comme une sรฉquence de nombres, qui peut ensuite รชtre utilisรฉe comme donnรฉes d'entrรฉe pour un modรจle afin de rรฉsoudre diverses tรขches de traitement du langage naturel.
+
+### Classification de texte
+
+La classification de texte attribue une classe ร une sรฉquence de texte (au niveau d'une phrase, d'un paragraphe ou d'un document) ร partir d'un ensemble de classes prรฉdรฉfini. Voici quelques applications pratiques :
+
+- **Analyse des sentiments** : รฉtiqueter le texte avec une polaritรฉ telle que `positive` ou `nรฉgative`, ce qui aide ร la prise de dรฉcision dans des domaines comme la politique, la finance et le marketing.
+- **Classification de contenu** : organiser et filtrer les informations en attribuant des *tags* sur des sujets spรฉcifiques, comme `mรฉtรฉo`, `sports` ou `finance`, dans les flux d'actualitรฉs et les rรฉseaux sociaux.
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="sentiment-analysis")
+>>> preds = classifier("Hugging Face is the best thing since sliced bread!")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.9991, 'label': 'POSITIVE'}]
+```
+
+### Classification des tokens
+
+Dans les tรขches de traitement du language naturel, le texte est d'abord prรฉtraitรฉ en le sรฉparant en mots ou sous-mots individuels, appelรฉs *[tokens](glossary#token)*. La classification des tokens attribue une classe ร chaque token ร partir d'un ensemble de classes prรฉdรฉfini.
+
+Voici deux types courants de classification des tokens :
+
+- **Reconnaissance d'entitรฉs nommรฉes (*Named Entity Recognition* ou *NER* en anglais)** : รฉtiqueter un token selon une catรฉgorie d'entitรฉ, telle qu'organisation, personne, lieu ou date. La NER est particuliรจrement utilisรฉe dans les contextes biomรฉdicaux pour identifier des gรจnes, des protรฉines et des noms de mรฉdicaments.
+- **รtiquetage des parties du discours (*Part of Speech* ou *POS* en anglais)** : รฉtiqueter un token en fonction de sa partie du discours, comme nom, verbe ou adjectif. Le POS est utile pour les systรจmes de traduction afin de comprendre comment deux mots identiques peuvent avoir des rรดles grammaticaux diffรฉrents (par exemple, "banque" comme nom versus "banque" comme verbe).
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="ner")
+>>> preds = classifier("Hugging Face is a French company based in New York City.")
+>>> preds = [
+... {
+... "entity": pred["entity"],
+... "score": round(pred["score"], 4),
+... "index": pred["index"],
+... "word": pred["word"],
+... "start": pred["start"],
+... "end": pred["end"],
+... }
+... for pred in preds
+... ]
+>>> print(*preds, sep="\n")
+{'entity': 'I-ORG', 'score': 0.9968, 'index': 1, 'word': 'Hu', 'start': 0, 'end': 2}
+{'entity': 'I-ORG', 'score': 0.9293, 'index': 2, 'word': '##gging', 'start': 2, 'end': 7}
+{'entity': 'I-ORG', 'score': 0.9763, 'index': 3, 'word': 'Face', 'start': 8, 'end': 12}
+{'entity': 'I-MISC', 'score': 0.9983, 'index': 6, 'word': 'French', 'start': 18, 'end': 24}
+{'entity': 'I-LOC', 'score': 0.999, 'index': 10, 'word': 'New', 'start': 42, 'end': 45}
+{'entity': 'I-LOC', 'score': 0.9987, 'index': 11, 'word': 'York', 'start': 46, 'end': 50}
+{'entity': 'I-LOC', 'score': 0.9992, 'index': 12, 'word': 'City', 'start': 51, 'end': 55}
+```
+
+### Rรฉponse ร des questions - (*Question Answering*)
+
+La rรฉponse ร des questions (*Question Answering* ou *QA* en anglais) est une tรขche de traitement du language naturel qui consiste ร fournir une rรฉponse ร une question, parfois avec l'aide d'un contexte (domaine ouvert) et d'autres fois sans contexte (domaine fermรฉ). Cette tรขche intervient lorsqu'on interroge un assistant virtuel, par exemple pour savoir si un restaurant est ouvert. Elle est รฉgalement utilisรฉe pour le support client, technique, et pour aider les moteurs de recherche ร fournir des informations pertinentes.
+
+Il existe deux types courants de rรฉponse ร des questions :
+
+- **Extractive** : pour une question donnรฉe et un contexte fourni, la rรฉponse est extraite directement du texte du contexte par le modรจle.
+- **Abstractive** : pour une question donnรฉe et un contexte, la rรฉponse est gรฉnรฉrรฉe ร partir du contexte. Cette approche utilise le [`Text2TextGenerationPipeline`] plutรดt que le [`QuestionAnsweringPipeline`] montrรฉ ci-dessous.
+
+
+```py
+>>> from transformers import pipeline
+
+>>> question_answerer = pipeline(task="question-answering")
+>>> preds = question_answerer(
+... question="What is the name of the repository?",
+... context="The name of the repository is huggingface/transformers",
+... )
+>>> print(
+... f"score: {round(preds['score'], 4)}, start: {preds['start']}, end: {preds['end']}, answer: {preds['answer']}"
+... )
+score: 0.9327, start: 30, end: 54, answer: huggingface/transformers
+```
+
+### Rรฉsumรฉ de texte - (*Summarization*)
+
+Le rรฉsumรฉ de text consiste ร crรฉer une version plus courte d'un texte tout en conservant l'essentiel du sens du document original. C'est une tรขche de sรฉquence ร sรฉquence qui produit un texte plus condensรฉ ร partir du texte initial. Cette technique est utile pour aider les lecteurs ร saisir rapidement les points clรฉs de longs documents, comme les projets de loi, les documents juridiques et financiers, les brevets, et les articles scientifiques.
+
+Il existe deux types courants de summarization :
+
+- **Extractive** : identifier et extraire les phrases les plus importantes du texte original.
+- **Abstractive** : gรฉnรฉrer un rรฉsumรฉ qui peut inclure des mots nouveaux non prรฉsents dans le texte d'origine. Le [`SummarizationPipeline`] utilise l'approche abstractive.
+
+```py
+>>> from transformers import pipeline
+
+>>> summarizer = pipeline(task="summarization")
+>>> summarizer(
+... "In this work, we presented the Transformer, the first sequence transduction model based entirely on attention, replacing the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention. For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers. On both WMT 2014 English-to-German and WMT 2014 English-to-French translation tasks, we achieve a new state of the art. In the former task our best model outperforms even all previously reported ensembles."
+... )
+[{'summary_text': ' The Transformer is the first sequence transduction model based entirely on attention . It replaces the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention . For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers .'}]
+```
+
+### Traduction
+
+La traduction convertit un texte d'une langue ร une autre. Elle facilite la communication entre personnes de diffรฉrentes langues, permet de toucher des audiences plus larges et peut aussi servir d'outil d'apprentissage pour ceux qui apprennent une nouvelle langue. Comme le rรฉsumรฉ de texte, la traduction est une tรขche de sรฉquence ร sรฉquence, oรน le modรจle reรงoit une sรฉquence d'entrรฉe (un texte est ici vu comme une sรฉquence de mots, ou plus prรฉcisรฉment de tokens) et produit une sรฉquence de sortie dans la langue cible.
+
+Initialement, les modรจles de traduction รฉtaient principalement monolingues, mais il y a eu rรฉcemment un intรฉrรชt croissant pour les modรจles multilingues capables de traduire entre plusieurs paires de langues.
+
+```py
+>>> from transformers import pipeline
+
+>>> text = "translate English to French: Hugging Face is a community-based open-source platform for machine learning."
+>>> translator = pipeline(task="translation", model="google-t5/t5-small")
+>>> translator(text)
+[{'translation_text': "Hugging Face est une tribune communautaire de l'apprentissage des machines."}]
+```
+
+### Modรฉlisation du langage
+
+La modรฉlisation du langage consiste ร prรฉdire un mot dans un texte. Cette tรขche est devenue trรจs populaire en traitement du language naturel, car un modรจle de langage prรฉentraรฎnรฉ sur cette tรขche peut ensuite รชtre ajustรฉ (*finetuned*) pour accomplir de nombreuses autres tรขches. Rรฉcemment, les grands modรจles de langage (LLMs) ont suscitรฉ beaucoup d'intรฉrรชt pour leur capacitรฉ ร apprendre avec peu ou pas de donnรฉes spรฉcifiques ร une tรขche, ce qui leur permet de rรฉsoudre des problรจmes pour lesquels ils n'ont pas รฉtรฉ explicitement entraรฎnรฉs. Ces modรจles peuvent gรฉnรฉrer du texte fluide et convaincant, bien qu'il soit important de vรฉrifier leur prรฉcision.
+
+Il existe deux types de modรฉlisation du langage :
+
+- **Causale** : le modรจle prรฉdit le token suivant dans une sรฉquence, avec les tokens futurs masquรฉs.
+
+ ```py
+ >>> from transformers import pipeline
+
+ >>> prompt = "Hugging Face is a community-based open-source platform for machine learning."
+ >>> generator = pipeline(task="text-generation")
+ >>> generator(prompt) # doctest: +SKIP
+ ```
+
+- **Masquรฉe** : le modรจle prรฉdit un token masquรฉ dans une sรฉquence en ayant accรจs ร tous les autres tokens de la sรฉquence (passรฉ et futur).
+
+ ```py
+ >>> text = "Hugging Face is a community-based open-source for machine learning."
+ >>> fill_mask = pipeline(task="fill-mask")
+ >>> preds = fill_mask(text, top_k=1)
+ >>> preds = [
+ ... {
+ ... "score": round(pred["score"], 4),
+ ... "token": pred["token"],
+ ... "token_str": pred["token_str"],
+ ... "sequence": pred["sequence"],
+ ... }
+ ... for pred in preds
+ ... ]
+ >>> preds
+ [{'score': 0.2236,
+ 'token': 1761,
+ 'token_str': ' platform',
+ 'sequence': 'Hugging Face is a community-based open-source platform for machine learning.'}]
+ ```
+
+## Multimodal
+
+Les tรขches multimodales nรฉcessitent qu'un modรจle traite plusieurs types de donnรฉes (texte, image, audio, vidรฉo) pour rรฉsoudre un problรจme spรฉcifique. Par exemple, la gรฉnรฉration de lรฉgendes pour les images est une tรขche multimodale oรน le modรจle prend une image en entrรฉe et produit une sรฉquence de texte dรฉcrivant l'image ou ses propriรฉtรฉs.
+
+Bien que les modรจles multimodaux traitent divers types de donnรฉes, ils convertissent toutes ces donnรฉes en *embeddings* (vecteurs ou listes de nombres contenant des informations significatives). Pour des tรขches comme la gรฉnรฉration de lรฉgendes pour les images, le modรจle apprend les relations entre les *embeddings* d'images et ceux de texte.
+
+### Rรฉponse ร des questions sur des documents - (*Document Question Answering*)
+
+La rรฉponse ร des questions sur des documents consiste ร rรฉpondre ร des questions en langage naturel en utilisant un document comme rรฉfรฉrence. Contrairement ร la rรฉponse ร des questions au niveau des tokens, qui prend du texte en entrรฉe, cette tรขche prend une image d'un document ainsi qu'une question concernant ce document, et fournit une rรฉponse. Elle est utile pour analyser des donnรฉes structurรฉes et extraire des informations clรฉes. Par exemple, ร partir d'un reรงu, on peut extraire des informations telles que le montant total et le change dรป.
+
+```py
+>>> from transformers import pipeline
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://huggingface.co/datasets/hf-internal-testing/example-documents/resolve/main/jpeg_images/2.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> doc_question_answerer = pipeline("document-question-answering", model="magorshunov/layoutlm-invoices")
+>>> preds = doc_question_answerer(
+... question="What is the total amount?",
+... image=image,
+... )
+>>> preds
+[{'score': 0.8531, 'answer': '17,000', 'start': 4, 'end': 4}]
+```
+
+En espรฉrant que cette page vous ait donnรฉ plus d'informations sur les diffรฉrents types de tรขches dans chaque modalitรฉ et l'importance pratique de chacune d'elles. Dans la [section suivante](tasks_explained), vous dรฉcouvrirez **comment** ๐ค Transformers fonctionne pour rรฉsoudre ces tรขches.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/tasks_explained.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/tasks_explained.md
new file mode 100644
index 0000000000000000000000000000000000000000..a39096b2b86258ac4aaf03086385f70ba7d68d2a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/tasks_explained.md
@@ -0,0 +1,294 @@
+
+
+# Comment ๐ค Transformers rรฉsout ces tรขches
+
+Dans [Ce que ๐ค Transformers peut faire](task_summary), vous avez dรฉcouvert les tรขches de traitement du langage naturel (NLP), de traitement de la parole et de l'audio, de vision par ordinateur, ainsi que certaines de leurs applications importantes. Cette page se penche sur la maniรจre dont les modรจles rรฉsolvent ces tรขches et explique les processus en arriรจre-plan. Bien que diffรฉrents modรจles puissent utiliser diverses techniques ou approches innovantes, les modรจles Transformer suivent gรฉnรฉralement une idรฉe commune. Grรขce ร leur architecture flexible, la plupart des modรจles sont basรฉs sur un encodeur, un dรฉcodeur ou une combinaison encodeur-dรฉcodeur. En plus des modรจles Transformer, notre bibliothรจque comprend รฉgalement des rรฉseaux de neurones convolutifs (CNN), qui restent utilisรฉs pour les tรขches de vision par ordinateur. Nous expliquerons aussi le fonctionnement d'un CNN moderne.
+
+Voici comment diffรฉrents modรจles rรฉsolvent des tรขches spรฉcifiques :
+
+- [Wav2Vec2](model_doc/wav2vec2) pour la classification audio et la reconnaissance vocale (*ASR* en anglais)
+- [Vision Transformer (ViT)](model_doc/vit) et [ConvNeXT](model_doc/convnext) pour la classification d'images
+- [DETR](model_doc/detr) pour la dรฉtection d'objets
+- [Mask2Former](model_doc/mask2former) pour la segmentation d'images
+- [GLPN](model_doc/glpn) pour l'estimation de la profondeur
+- [BERT](model_doc/bert) pour les tรขches de traitement du language naturel telles que la classification de texte, la classification des tokens et la rรฉponse ร des questions utilisant un encodeur
+- [GPT2](model_doc/gpt2) pour les tรขches de traitement du language naturel telles que la gรฉnรฉration de texte utilisant un dรฉcodeur
+- [BART](model_doc/bart) pour les tรขches de traitement du language naturel telles que le rรฉsumรฉ de texte et la traduction utilisant un encodeur-dรฉcodeur
+
+
+
+Avant de poursuivre, il est utile d'avoir quelques connaissances de base sur l'architecture des Transformers. Comprendre le fonctionnement des encodeurs, des dรฉcodeurs et du mรฉcanisme d'attention vous aidera ร saisir comment les diffรฉrents modรจles Transformer fonctionnent. Si vous dรฉbutez ou avez besoin d'un rappel, consultez notre [cours](https://huggingface.co/course/chapter1/4?fw=pt) pour plus d'informations !
+
+
+
+## Paroles et audio
+
+[Wav2Vec2](model_doc/wav2vec2) est un modรจle auto-supervisรฉ qui est prรฉentraรฎnรฉ sur des donnรฉes de parole non รฉtiquetรฉes et ajustรฉ sur des donnรฉes รฉtiquetรฉes pour des tรขches telles que la classification audio et la reconnaissance vocale (ASR).
+
+
+
+
+
+Ce modรจle comporte quatre composants principaux :
+
+1. **Encodeur de caractรฉristiques** (*feature encoder*): Il prend le signal audio brut, le normalise pour avoir une moyenne nulle et une variance unitaire, et le convertit en une sรฉquence de vecteurs de caractรฉristiques, chacun reprรฉsentant une durรฉe de 20 ms.
+
+2. **Module de quantification** (*quantization module*): Les vecteurs de caractรฉristiques sont passรฉs ร ce module pour apprendre des unitรฉs de parole discrรจtes. Chaque vecteur est associรฉ ร un *codebook* (une collection de mots-clรฉs), et l'unitรฉ de parole la plus reprรฉsentative est sรฉlectionnรฉe parmi celles du codebook et transmise au modรจle.
+
+3. **Rรฉseau de contexte** (*context network*): Environ la moitiรฉ des vecteurs de caractรฉristiques sont masquรฉs alรฉatoirement. Les vecteurs masquรฉs sont ensuite envoyรฉs ร un *rรฉseau de contexte*, qui est un encodeur qui ajoute des embeddings positionnels relatifs.
+
+4. **Tรขche contrastive** (*contrastive task*): Le rรฉseau de contexte est prรฉentraรฎnรฉ avec une tรขche contrastive. Le modรจle doit prรฉdire la vรฉritable unitรฉ de parole quantifiรฉe ร partir de la prรฉdiction masquรฉe parmi un ensemble de fausses, ce qui pousse le modรจle ร trouver l'unitรฉ de parole quantifiรฉe la plus proche de la prรฉdiction.
+
+Une fois prรฉentraรฎnรฉ, wav2vec2 peut รชtre ajustรฉ sur vos propres donnรฉes pour des tรขches comme la classification audio ou la reconnaissance automatique de la parole !
+
+### Classification audio
+
+Pour utiliser le modรจle prรฉentraรฎnรฉ pour la classification audio, ajoutez une tรชte de classification de sรฉquence au-dessus du modรจle Wav2Vec2 de base. Cette tรชte de classification est une couche linรฉaire qui reรงoit les รฉtats cachรฉs (*hidden states*) de l'encodeur. Ces รฉtats cachรฉs, qui reprรฉsentent les caractรฉristiques apprises de chaque trame audio, peuvent avoir des longueurs variables. Pour obtenir un vecteur de longueur fixe, les รฉtats cachรฉs sont d'abord regroupรฉs, puis transformรฉs en logits correspondant aux รฉtiquettes de classe. La perte d'entropie croisรฉe est calculรฉe entre les logits et la cible pour dรฉterminer la classe la plus probable.
+
+Prรชt ร vous lancer dans la classification audio ? Consultez notre [guide complet de classification audio](tasks/audio_classification) pour apprendre ร ajuster Wav2Vec2 et ร l'utiliser pour l'infรฉrence !
+
+### Reconnaissance vocale
+
+Pour utiliser le modรจle prรฉentraรฎnรฉ pour la reconnaissance vocale, ajoutez une tรชte de modรฉlisation du langage au-dessus du modรจle Wav2Vec2 de base pour la [classification temporelle connexionniste (CTC)](glossary#connectionist-temporal-classification-ctc). Cette tรชte de modรฉlisation du langage est une couche linรฉaire qui prend les รฉtats cachรฉs (*hidden states*) de l'encodeur et les convertit en logits. Chaque logit correspond ร une classe de token (le nombre de tokens provient du vocabulaire de la tรขche). La perte CTC est calculรฉe entre les logits et les cibles (*targets*) pour identifier la sรฉquence de tokens la plus probable, qui est ensuite dรฉcodรฉe en transcription.
+
+Prรชt ร vous lancer dans la reconnaissance automatique de la parole ? Consultez notre [guide complet de reconnaissance automatique de la parole](tasks/asr) pour apprendre ร ajuster Wav2Vec2 et ร l'utiliser pour l'infรฉrence !
+
+## Vision par ordinateur
+
+Il existe deux faรงons d'aborder les tรขches de vision par ordinateur :
+
+1. **Diviser une image en une sรฉquence de patches** et les traiter en parallรจle avec un Transformer.
+2. **Utiliser un CNN moderne**, comme [ConvNeXT](model_doc/convnext), qui repose sur des couches convolutionnelles mais adopte des conceptions de rรฉseau modernes.
+
+
+
+Une troisiรจme approche combine les Transformers avec des convolutions (par exemple, [Convolutional Vision Transformer](model_doc/cvt) ou [LeViT](model_doc/levit)). Nous ne discuterons pas de ces approches ici, car elles mรฉlangent simplement les deux approches que nous examinons.
+
+
+
+ViT et ConvNeXT sont couramment utilisรฉs pour la classification d'images. Pour d'autres tรขches de vision par ordinateur comme la dรฉtection d'objets, la segmentation et l'estimation de la profondeur, nous examinerons respectivement DETR, Mask2Former et GLPN, qui sont mieux adaptรฉs ร ces tรขches.
+
+### Classification d'images
+
+ViT et ConvNeXT peuvent tous deux รชtre utilisรฉs pour la classification d'images ; la principale diffรฉrence rรฉside dans leurs approches : ViT utilise un mรฉcanisme d'attention tandis que ConvNeXT repose sur des convolutions.
+
+#### Transformer
+
+[ViT](model_doc/vit) remplace entiรจrement les convolutions par une architecture Transformer pure. Si vous รชtes dรฉjร familiarisรฉ avec le Transformer original, vous trouverez que ViT suit des principes similaires, mais adaptรฉs pour traiter les images comme des sรฉquences de patches.
+
+
+
+
+
+Le principal changement introduit par ViT concerne la faรงon dont les images sont fournies ร un Transformer :
+
+1. **Tokenisation des images** : L'image est divisรฉe en patches carrรฉs non chevauchants, chacun รฉtant transformรฉ en un vecteur ou *embedding de patch*. Ces embeddings de patch sont gรฉnรฉrรฉs ร partir d'une couche convolutionnelle 2D pour adapter les dimensions d'entrรฉe (par exemple, 768 valeurs pour chaque embedding de patch). Si vous avez une image de 224x224 pixels, elle peut รชtre divisรฉe en 196 patches de 16x16 pixels. Ainsi, une image est "tokenisรฉe" en une sรฉquence de patches.
+
+2. **Token `[CLS]`** : Un *embedding apprenables* spรฉcial, appelรฉ token `[CLS]`, est ajoutรฉ au dรฉbut des embeddings de patch, similaire ร BERT. L'รฉtat cachรฉ final du token `[CLS]` est utilisรฉ comme entrรฉe pour la tรชte de classification attachรฉe, tandis que les autres sorties sont ignorรฉes. Ce token aide le modรจle ร encoder une reprรฉsentation globale de l'image.
+
+3. **Embeddings de position** : Pour que le modรจle comprenne l'ordre des patches, des *embeddings de position* sont ajoutรฉs aux embeddings de patch. Ces embeddings de position, รฉgalement apprenables et de la mรชme taille que les embeddings de patch, permettent au modรจle de saisir la structure spatiale de l'image.
+
+4. **Classification** : Les embeddings, enrichis des embeddings de position, sont ensuite traitรฉs par l'encodeur Transformer. La sortie associรฉe au token `[CLS]` est passรฉe ร une tรชte de perceptron multicouche (MLP) pour la classification. La tรชte MLP convertit cette sortie en logits pour chaque รฉtiquette de classe, et la perte d'entropie croisรฉe est calculรฉe pour dรฉterminer la classe la plus probable.
+
+Prรชt ร vous essayer ร la classification d'images ? Consultez notre [guide complet de classification d'images](tasks/image_classification) pour apprendre ร ajuster ViT et ร l'utiliser pour l'infรฉrence !
+
+#### CNN
+
+
+
+Cette section explique briรจvement les convolutions, mais il serait utile d'avoir une comprรฉhension prรฉalable de la faรงon dont elles modifient la forme et la taille d'une image. Si vous n'รชtes pas familier avec les convolutions, consultez le [chapitre sur les rรฉseaux de neurones convolutionnels](https://github.com/fastai/fastbook/blob/master/13_convolutions.ipynb) du livre fastai !
+
+
+
+[ConvNeXT](model_doc/convnext) est une architecture CNN qui adopte des conceptions de rรฉseau modernes pour amรฉliorer les performances. Cependant, les convolutions restent au cลur du modรจle. D'un point de vue gรฉnรฉral, une [convolution](glossary#convolution) est une opรฉration oรน une matrice plus petite (*noyau*) est multipliรฉe par une petite fenรชtre de pixels de l'image. Elle calcule certaines caractรฉristiques ร partir de cette fenรชtre, comme une texture particuliรจre ou la courbure d'une ligne. Ensuite, elle se dรฉplace vers la fenรชtre suivante de pixels ; la distance parcourue par la convolution est appelรฉe le *stride*.
+
+
+
+
+
+Une convolution de base sans padding ni stride, tirรฉe de Un guide des calculs de convolution pour l'apprentissage profond.
+
+Vous pouvez alimenter la sortie d'une couche convolutionnelle ร une autre couche convolutionnelle. ร chaque couche successive, le rรฉseau apprend des caractรฉristiques de plus en plus complexes et abstraites, telles que des objets spรฉcifiques comme des hot-dogs ou des fusรฉes. Entre les couches convolutionnelles, il est courant d'ajouter des couches de pooling pour rรฉduire la dimensionnalitรฉ et rendre le modรจle plus robuste aux variations de position des caractรฉristiques.
+
+
+
+
+
+ConvNeXT modernise un CNN de cinq maniรจres :
+
+1. **Modification du nombre de blocs** : ConvNeXT utilise une approche similaire ร ViT en "patchifiant" l'image avec un stride plus grand et une taille de noyau correspondante, divisant ainsi l'image en patches non chevauchants.
+
+2. **Couche de goulot d'รฉtranglement** (*bottleneck layer*) : Cette couche rรฉduit puis restaure le nombre de canaux pour accรฉlรฉrer les convolutions 1x1, permettant une plus grande profondeur du rรฉseau. Un goulot d'รฉtranglement inversรฉ augmente d'abord le nombre de canaux avant de les rรฉduire, optimisant ainsi l'utilisation de la mรฉmoire.
+
+3. **Convolution en profondeur** (*depthwise convolution*): Remplace la convolution 3x3 traditionnelle par une convolution appliquรฉe ร chaque canal d'entrรฉe sรฉparรฉment, amรฉliorant ainsi la largeur du rรฉseau et ses performances.
+
+4. **Augmentation de la taille du noyau** : ConvNeXT utilise un noyau de 7x7 pour imiter le champ rรฉceptif global de ViT, ce qui permet de capturer des informations sur une plus grande partie de l'image.
+
+5. **Changements de conception des couches** : Le modรจle adopte des modifications inspirรฉes des Transformers, telles que moins de couches d'activation et de normalisation, l'utilisation de GELU au lieu de ReLU, et LayerNorm plutรดt que BatchNorm.
+
+La sortie des blocs de convolution est ensuite passรฉe ร une tรชte de classification, qui convertit les sorties en logits et calcule la perte d'entropie croisรฉe pour dรฉterminer l'รฉtiquette la plus probable.
+
+### Object detection
+
+[DETR](model_doc/detr), *DEtection TRansformer*, est un modรจle de dรฉtection d'objets de bout en bout qui combine un CNN avec un encodeur-dรฉcodeur Transformer.
+
+
+
+
+
+Dรฉcomposons le fonctionnement de DETR (DEtection TRansformer) pour la dรฉtection d'objets :
+
+1. **Extraction des caractรฉristiques avec le CNN** : Un CNN prรฉentraรฎnรฉ, appelรฉ *backbone*, prend une image et gรฉnรจre une carte de caractรฉristiques (*feature map*) ร basse rรฉsolution. Une convolution 1x1 est ensuite appliquรฉe pour rรฉduire la dimensionnalitรฉ et crรฉer une nouvelle carte de caractรฉristiques qui reprรฉsente des abstractions de plus haut niveau de l'image. Cette derniรจre est ensuite aplatie en une sรฉquence de vecteurs de caractรฉristiques, qui sont combinรฉs avec des embeddings positionnels.
+
+2. **Traitement avec l'encodeur et le dรฉcodeur** : Les vecteurs de caractรฉristiques sont passรฉs ร l'encodeur, qui apprend les reprรฉsentations de l'image avec ses couches d'attention. Les รฉtats cachรฉs de l'encodeur sont ensuite combinรฉs avec des *objects queries* dans le dรฉcodeur. Ces *objects queries* sont des embeddings appris qui se concentrent sur diffรฉrentes rรฉgions de l'image et sont mis ร jour ร chaque couche d'attention. Les รฉtats cachรฉs du dรฉcodeur sont utilisรฉs pour prรฉdire les coordonnรฉes de la boรฎte englobante (*bounding box*) et le label de la classe pour chaque objet query, ou `pas d'objet` si aucun objet n'est dรฉtectรฉ.
+
+3. **Perte de correspondance bipartite** : Lors de l'entraรฎnement, DETR utilise une *perte de correspondance bipartite* pour comparer un nombre fixe de prรฉdictions avec un ensemble fixe de labels de vรฉritรฉ terrain. Si le nombre de labels de vรฉritรฉ terrain est infรฉrieur au nombre de *N* labels, ils sont complรฉtรฉs avec une classe `pas d'objet`. Cette fonction de perte encourage DETR ร trouver une correspondance un ร un entre les prรฉdictions et les labels de vรฉritรฉ terrain. Si les boรฎtes englobantes ou les labels de classe ne sont pas corrects, une perte est encourue. De mรชme, si DETR prรฉdit un objet inexistant, il est pรฉnalisรฉ. Cela encourage DETR ร trouver d'autres objets dans l'image au lieu de se concentrer sur un seul objet trรจs proรฉminent.
+
+Une tรชte de dรฉtection d'objets est ajoutรฉe au-dessus de DETR pour trouver le label de la classe et les coordonnรฉes de la boรฎte englobante. Cette tรชte de dรฉtection d'objets comprend deux composants : une couche linรฉaire pour transformer les รฉtats cachรฉs du dรฉcodeur en logits sur les labels de classe, et un MLP pour prรฉdire la boรฎte englobante.
+
+Prรชt ร essayer la dรฉtection d'objets ? Consultez notre guide complet sur la [dรฉtection d'objets](tasks/object_detection) pour apprendre ร affiner DETR et ร l'utiliser pour l'infรฉrence !
+
+### Segmentation d'image
+
+[Mask2Former](model_doc/mask2former) est une architecture polyvalente conรงue pour traiter tous les types de tรขches de segmentation d'image. Contrairement aux modรจles de segmentation traditionnels, qui sont gรฉnรฉralement spรฉcialisรฉs dans des sous-tรขches spรฉcifiques comme la segmentation d'instances, sรฉmantique ou panoptique, Mask2Former aborde chaque tรขche comme un problรจme de *classification de masques*. Cette approche regroupe les pixels en *N* segments et prรฉdit pour chaque image *N* masques ainsi que leur รฉtiquette de classe correspondante. Dans cette section, nous vous expliquerons le fonctionnement de Mask2Former et vous aurez la possibilitรฉ d'effectuer un rรฉglage fin (*fine-tuning*) de SegFormer ร la fin.
+
+
+
+
+
+Il y a trois composants principaux dans Mask2Former :
+
+1. Un [backbone Swin](model_doc/swin) qui prend une image en entrรฉe et gรฉnรจre une carte de caractรฉristiques (*feature map*) ร basse rรฉsolution aprรจs trois convolutions successives de 3x3.
+
+2. Cette carte de caractรฉristiques est ensuite envoyรฉe ร un *dรฉcodeur de pixels*, qui augmente progressivement la rรฉsolution des caractรฉristiques pour obtenir des embeddings par pixel en haute rรฉsolution. Le dรฉcodeur de pixels produit des caractรฉristiques multi-รฉchelles, comprenant des rรฉsolutions de 1/32, 1/16, et 1/8 de l'image originale.
+
+3. Les cartes de caractรฉristiques ร diffรฉrentes รฉchelles sont successivement traitรฉes par une couche de dรฉcodeur Transformer, permettant de capturer les petits objets ร partir des caractรฉristiques haute rรฉsolution. Le point central de Mask2Former est le mรฉcanisme de *masquage d'attention* dans le dรฉcodeur. Contrairement ร l'attention croisรฉe, qui peut se concentrer sur l'ensemble de l'image, l'attention masquรฉe se focalise uniquement sur certaines zones spรฉcifiques. Cette approche est plus rapide et amรฉliore les performances en permettant au modรจle de se concentrer sur les dรฉtails locaux de l'image.
+
+4. ร l'instar de [DETR](tasks_explained#object-detection), Mask2Former utilise รฉgalement des requรชtes d'objet apprises, qu'il combine avec les caractรฉristiques de l'image du dรฉcodeur de pixels pour faire des prรฉdictions globales (c'est-ร -dire, `รฉtiquette de classe`, `prรฉdiction de masque`). Les รฉtats cachรฉs du dรฉcodeur sont passรฉs dans une couche linรฉaire pour รชtre transformรฉs en logits correspondant aux รฉtiquettes de classe. La perte d'entropie croisรฉe est alors calculรฉe entre les logits et l'รฉtiquette de classe pour dรฉterminer la plus probable.
+
+ Les prรฉdictions de masque sont gรฉnรฉrรฉes en combinant les embeddings de pixels avec les รฉtats cachรฉs finaux du dรฉcodeur. La perte d'entropie croisรฉe sigmoรฏde et la perte de Dice sont calculรฉes entre les logits et le masque de vรฉritรฉ terrain pour dรฉterminer le masque le plus probable.
+
+Prรชt ร vous lancer dans la dรฉtection d'objets ? Consultez notre [guide complet sur la segmentation d'image](tasks/semantic_segmentation) pour apprendre ร affiner SegFormer et l'utiliser pour l'infรฉrence !
+
+### Estimation de la profondeur
+
+[GLPN](model_doc/glpn), *Global-Local Path Network*, est un Transformer pour l'estimation de profondeur qui combine un encodeur [SegFormer](model_doc/segformer) avec un dรฉcodeur lรฉger.
+
+
+
+
+1. Comme avec ViT, une image est divisรฉe en une sรฉquence de patches, mais ces patches sont plus petits. Cette approche est particuliรจrement adaptรฉe aux tรขches de prรฉdiction dense telles que la segmentation ou l'estimation de profondeur. Les patches d'image sont transformรฉs en embeddings (voir la section [classification d'image](#image-classification) pour plus de dรฉtails sur la crรฉation des embeddings), puis envoyรฉs ร l'encodeur.
+
+2. L'encodeur traite les embeddings de patches ร travers plusieurs blocs d'encodeur. Chaque bloc comprend des couches d'attention et de Mix-FFN, conรงues pour fournir des informations positionnelles. ร la fin de chaque bloc, une couche de *fusion de patches* crรฉe des reprรฉsentations hiรฉrarchiques. Les caractรฉristiques des groupes de patches voisins sont concatรฉnรฉes, et une couche linรฉaire est appliquรฉe pour rรฉduire le nombre de patches ร une rรฉsolution de 1/4. Ce processus est rรฉpรฉtรฉ dans les blocs suivants jusqu'ร obtenir des caractรฉristiques d'image avec des rรฉsolutions de 1/8, 1/16, et 1/32.
+
+3. Un dรฉcodeur lรฉger prend la derniรจre carte de caractรฉristiques (ร l'รฉchelle 1/32) de l'encodeur et l'agrandit ร l'รฉchelle 1/16. Ensuite, cette caractรฉristique passe par un module de *Fusion de Caractรฉristiques Sรฉlective (SFF)*, qui sรฉlectionne et combine les caractรฉristiques locales et globales ร partir d'une carte d'attention pour chaque caractรฉristique, puis l'agrandit ร 1/8. Ce processus est rรฉpรฉtรฉ jusqu'ร ce que les caractรฉristiques dรฉcodรฉes aient la mรชme taille que l'image originale. La sortie est ensuite traitรฉe par deux couches de convolution, suivies d'une activation sigmoรฏde pour prรฉdire la profondeur de chaque pixel.
+
+## Traitement du langage naturel
+
+Le Transformer a รฉtรฉ initialement conรงu pour la traduction automatique, et depuis, il est devenu pratiquement l'architecture par dรฉfaut pour rรฉsoudre toutes les tรขches de traitement du langage naturel (NLP). Certaines tรขches se prรชtent bien ร la structure d'encodeur du Transformer, tandis que d'autres sont mieux adaptรฉes au dรฉcodeur. D'autres tรขches encore utilisent ร la fois la structure encodeur-dรฉcodeur du Transformer.
+
+### Classification de texte
+
+[BERT](model_doc/bert) est un modรจle basรฉ uniquement sur l'encodeur, qui a รฉtรฉ le premier ร intรฉgrer efficacement la bidirectionnalitรฉ profonde pour obtenir des reprรฉsentations plus riches du texte en tenant compte des mots en amont et en aval.
+
+1. BERT utilise la tokenisation [WordPiece](tokenizer_summary#wordpiece) pour gรฉnรฉrer des embeddings de tokens ร partir du texte. Pour diffรฉrencier une seule phrase d'une paire de phrases, un token spรฉcial `[SEP]` est ajoutรฉ. De plus, un token spรฉcial `[CLS]` est placรฉ au dรฉbut de chaque sรฉquence de texte. La sortie finale associรฉe au token `[CLS]` est utilisรฉe comme entrรฉe pour la tรชte de classification des tรขches. BERT ajoute รฉgalement un embedding de segment pour indiquer si un token appartient ร la premiรจre ou ร la deuxiรจme phrase dans une paire.
+
+2. BERT est prรฉentraรฎnรฉ avec deux objectifs : le masquage de mots (masked language modeling) et la prรฉdiction de la phrase suivante. Pour le masquage de mots, un pourcentage des tokens d'entrรฉe est masquรฉ alรฉatoirement, et le modรจle doit prรฉdire ces mots. Cela permet de surmonter le problรจme de la bidirectionnalitรฉ, oรน le modรจle pourrait autrement tricher en voyant tous les mots et en "prรฉdire" le mot suivant. Les รฉtats cachรฉs finaux des tokens masquรฉs sont passรฉs ร un rรฉseau feedforward avec une fonction softmax sur le vocabulaire pour prรฉdire le mot masquรฉ.
+
+ Le deuxiรจme objectif de prรฉentraรฎnement est la prรฉdiction de la phrase suivante. Le modรจle doit dรฉterminer si la phrase B suit la phrase A. Dans la moitiรฉ des cas, la phrase B est la phrase suivante, et dans l'autre moitiรฉ, elle est alรฉatoire. Cette prรฉdiction (phrase suivante ou non) est envoyรฉe ร un rรฉseau feedforward avec une softmax sur les deux classes (`IsNext` et `NotNext`).
+
+3. Les embeddings d'entrรฉe sont traitรฉs par plusieurs couches d'encodeur pour produire des รฉtats cachรฉs finaux.
+
+Pour utiliser le modรจle prรฉentraรฎnรฉ pour la classification de texte, ajoutez une tรชte de classification de sรฉquence au-dessus du modรจle BERT de base. Cette tรชte est une couche linรฉaire qui prend les รฉtats cachรฉs finaux et les transforme en logits. La perte d'entropie croisรฉe est ensuite calculรฉe entre les logits et les cibles pour dรฉterminer l'รฉtiquette la plus probable.
+
+Prรชt ร essayer la classification de texte ? Consultez notre [guide complet sur la classification de texte](tasks/sequence_classification) pour apprendre ร effectuer un rรฉglagle fin (*fine-tuning*) de DistilBERT et l'utiliser pour l'infรฉrence !
+
+### Classification de tokens
+
+Pour utiliser BERT dans des tรขches de classification de tokens, comme la reconnaissance d'entitรฉs nommรฉes (NER), ajoutez une tรชte de classification de tokens au-dessus du modรจle BERT de base. Cette tรชte est une couche linรฉaire qui prend les รฉtats cachรฉs finaux et les transforme en logits. La perte d'entropie croisรฉe est ensuite calculรฉe entre les logits et les labels de chaque token pour dรฉterminer l'รฉtiquette la plus probable.
+
+Prรชt ร essayer la classification de tokens ? Consultez notre [guide complet sur la classification de tokens](tasks/token_classification) pour dรฉcouvrir comment effectuer un rรฉglagle fin (*fine-tuning*) de DistilBERT et l'utiliser pour l'infรฉrence !
+
+### Rรฉponse aux questions - (*Question Answering*)
+
+Pour utiliser BERT pour la rรฉponse aux questions, ajoutez une tรชte de classification de span au-dessus du modรจle BERT de base. Cette tรชte est une couche linรฉaire qui transforme les รฉtats cachรฉs finaux en logits pour les positions de dรฉbut et de fin du `span` correspondant ร la rรฉponse. La perte d'entropie croisรฉe est calculรฉe entre les logits et les positions rรฉelles pour dรฉterminer le span de texte le plus probable en tant que rรฉponse.
+
+Prรชt ร essayer la rรฉponse aux questions ? Consultez notre [guide complet sur la rรฉponse aux questions](tasks/question_answering) pour dรฉcouvrir comment effectuer un rรฉglagle fin (*fine-tuning*) de DistilBERT et l'utiliser pour l'infรฉrence !
+
+
+
+๐ก Une fois BERT prรฉentraรฎnรฉ, il est incroyablement facile de lโadapter ร diverses tรขches ! Il vous suffit dโajouter une tรชte spรฉcifique au modรจle prรฉentraรฎnรฉ pour transformer les รฉtats cachรฉs en la sortie souhaitรฉe.
+
+
+
+### Gรฉnรฉration de texte
+
+[GPT-2](model_doc/gpt2) est un modรจle basรฉ uniquement sur le dรฉcodeur, prรฉentraรฎnรฉ sur une grande quantitรฉ de texte. Il peut gรฉnรฉrer du texte convaincant (bien que parfois inexact !) ร partir d'une invite et accomplir d'autres tรขches de NLP, comme la rรฉponse aux questions, mรชme s'il n'a pas รฉtรฉ spรฉcifiquement entraรฎnรฉ pour ces tรขches.
+
+
+
+
+
+1. GPT-2 utilise le [byte pair encoding (BPE)](tokenizer_summary#bytepair-encoding-bpe) pour tokeniser les mots et gรฉnรฉrer des embeddings de tokens. Des encodages positionnels sont ajoutรฉs pour indiquer la position de chaque token dans la sรฉquence. Les embeddings d'entrรฉe passent ร travers plusieurs blocs de dรฉcodeur pour produire des รฉtats cachรฉs finaux. Chaque bloc de dรฉcodeur utilise une couche d'*attention masquรฉe*, ce qui signifie que GPT-2 ne peut pas se concentrer sur les tokens futurs et est uniquement autorisรฉ ร se focaliser sur les tokens ร gauche dans le texte. Cela diffรจre du token [`mask`] de BERT, car ici, dans l'attention masquรฉe, un masque d'attention est utilisรฉ pour attribuer un score de `0` aux tokens futurs.
+
+2. La sortie du dรฉcodeur est ensuite envoyรฉe ร une tรชte de modรฉlisation du langage, qui effectue une transformation linรฉaire pour convertir les รฉtats cachรฉs en logits. L'รฉtiquette est le token suivant dans la sรฉquence, obtenue en dรฉcalant les logits vers la droite d'une position. La perte d'entropie croisรฉe est calculรฉe entre les logits dรฉcalรฉs et les รฉtiquettes pour dรฉterminer le token suivant le plus probable.
+
+L'objectif de prรฉentraรฎnement de GPT-2 est basรฉ sur la [modรฉlisation du langage causale](glossary#causal-language-modeling), qui consiste ร prรฉdire le mot suivant dans une sรฉquence. Cette approche rend GPT-2 particuliรจrement efficace pour les tรขches de gรฉnรฉration de texte.
+
+Prรชt ร essayer la gรฉnรฉration de texte ? Consultez notre [guide complet sur la modรฉlisation du langage causale](tasks/language_modeling#causal-language-modeling) pour dรฉcouvrir comment effectuer un rรฉglagle fin (*fine-tuning*) de DistilGPT-2 et l'utiliser pour l'infรฉrence !
+
+
+
+Pour plus d'informations sur la gรฉnรฉration de texte, consultez le guide sur les [stratรฉgies de gรฉnรฉration de texte](generation_strategies) !
+
+
+
+### Rรฉsumรฉ de texte
+
+Les modรจles encodeur-dรฉcodeur tels que [BART](model_doc/bart) et [T5](model_doc/t5) sont conรงus pour les tรขches de rรฉsumรฉ en mode sรฉquence-ร -sรฉquence. Dans cette section, nous expliquerons le fonctionnement de BART, puis vous aurez l'occasion de dรฉcouvrir comment rรฉaliser un rรฉglagle fin (*fine-tuning*) de T5.
+
+
+
+
+
+1. L'architecture de l'encodeur de BART est trรจs similaire ร celle de BERT, acceptant des embeddings de tokens et des embeddings positionnels du texte. BART est prรฉentraรฎnรฉ en corrompant l'entrรฉe et en la reconstruisant avec le dรฉcodeur. Contrairement ร d'autres encodeurs utilisant des stratรฉgies de corruption spรฉcifiques, BART peut appliquer divers types de corruption, parmi lesquelles la stratรฉgie de *text infilling* est la plus efficace. Dans le text infilling, plusieurs segments de texte sont remplacรฉs par un **seul** token [`mask`]. Cette approche est cruciale car elle force le modรจle ร prรฉdire les tokens masquรฉs et ร estimer le nombre de tokens manquants. Les embeddings d'entrรฉe et les spans masquรฉs sont passรฉs ร l'encodeur pour produire des รฉtats cachรฉs finaux. Contrairement ร BERT, BART ne comporte pas de rรฉseau feedforward final pour prรฉdire un mot.
+
+2. La sortie de l'encodeur est transmise au dรฉcodeur, qui doit prรฉdire ร la fois les tokens masquรฉs et les tokens non corrompus. Ce contexte supplรฉmentaire aide le dรฉcodeur ร restaurer le texte original. La sortie du dรฉcodeur est ensuite envoyรฉe ร une tรชte de modรฉlisation du langage, qui transforme les รฉtats cachรฉs en logits. La perte d'entropie croisรฉe est calculรฉe entre les logits et l'รฉtiquette, qui est simplement le token dรฉcalรฉ vers la droite.
+
+Prรชt ร essayer le rรฉsumรฉ ? Consultez notre [guide complet sur le rรฉsumรฉ](tasks/summarization) pour apprendre ร effectuer un rรฉglage fin (*fine-tuning*) de T5 et l'utiliser pour l'infรฉrence !
+
+
+
+Pour plus d'informations sur la gรฉnรฉration de texte, consultez le guide sur les [stratรฉgies de gรฉnรฉration de texte](generation_strategies) !
+
+
+
+### Traduction
+
+La traduction est un autre exemple de tรขche sรฉquence-ร -sรฉquence, ce qui signifie qu'un modรจle encodeur-dรฉcodeur comme [BART](model_doc/bart) ou [T5](model_doc/t5) peut รชtre utilisรฉ pour cette tรขche. Nous expliquerons ici comment BART fonctionne pour la traduction, puis vous pourrez dรฉcouvrir comment affiner T5.
+
+BART adapte le modรจle ร la traduction en ajoutant un encodeur sรฉparรฉ, initialisรฉ alรฉatoirement, pour mapper la langue source en une entrรฉe qui peut รชtre dรฉcodรฉe dans la langue cible. Les embeddings de cet encodeur sont ensuite passรฉs ร l'encodeur prรฉentraรฎnรฉ au lieu des embeddings de mots originaux. L'encodeur source est entraรฎnรฉ en mettant ร jour l'encodeur source, les embeddings positionnels et les embeddings d'entrรฉe avec la perte d'entropie croisรฉe provenant de la sortie du modรจle. Les paramรจtres du modรจle sont figรฉs lors de cette premiรจre รฉtape, et tous les paramรจtres du modรจle sont entraรฎnรฉs ensemble lors de la deuxiรจme รฉtape.
+
+BART a รฉtรฉ suivi par une version multilingue, mBART, qui est spรฉcifiquement conรงue pour la traduction et prรฉentraรฎnรฉe sur de nombreuses langues diffรฉrentes.
+
+Prรชt ร essayer la traduction ? Consultez notre [guide complet sur la traduction](tasks/translation) pour apprendre ร affiner T5 et l'utiliser pour l'infรฉrence !
+
+
+
+Pour plus d'informations sur la gรฉnรฉration de texte, consultez le guide sur les [stratรฉgies de gรฉnรฉration de texte](generation_strategies) !
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/tutoriel_pipeline.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/tutoriel_pipeline.md
new file mode 100644
index 0000000000000000000000000000000000000000..d398f2c0f0f51b8cdb3c350a1c431f1a2a6d3de3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/fr/tutoriel_pipeline.md
@@ -0,0 +1,313 @@
+
+
+# Pipelines pour l'infรฉrence
+
+L'objet [`pipeline`] rend simple l'utilisation de n'importe quel modรจle du [Hub](https://huggingface.co/models) pour l'infรฉrence sur n'importe quelle langue, tรขches de vision par ordinateur, d'audio et multimodales. Mรชme si vous n'avez pas d'expรฉrience avec une modalitรฉ spรฉcifique ou si vous n'รชtes pas familier avec le code ci-dessous des modรจles, vous pouvez toujours les utiliser pour l'infรฉrence avec la [`pipeline`] ! Ce tutoriel vous apprendra ร :
+
+* Utiliser un [`pipeline`] pour l'infรฉrence.
+* Utiliser un tokenizer ou modรจle spรฉcifique.
+* Utiliser un [`pipeline`] pour des tรขches audio, de vision et multimodales.
+
+
+
+Consultez la documentation du [`pipeline`] pour une liste complรจte des tรขches prises en charge et des paramรจtres disponibles.
+
+
+
+## Utilisation du pipeline
+
+Bien que chaque tรขche ait son propre [`pipeline`], il est plus simple d'utiliser le [`pipeline`] gรฉnรฉrale qui inclut tous les pipelines spรฉcifiques aux diffรฉrentes tรขches. Cette approche charge automatiquement un modรจle par dรฉfaut et une classe de prรฉtraitement adaptรฉe ร votre tรขche, simplifiant ainsi votre utilisation. Prenons l'exemple de l'utilisation du [`pipeline`] pour la reconnaissance automatique de la parole (ASR) ou de la transcription de la parole en texte.
+
+1. Commencez par crรฉer un [`pipeline`] et spรฉcifiez la tรขche d'infรฉrence :
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition")
+```
+
+2. Passez votre entrรฉe au [`pipeline`]. Dans le cas de la reconnaissance vocale, il s'agit d'un fichier audio :
+
+```py
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': 'I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES'}
+```
+
+Pas le rรฉsultat que vous aviez en tรชte ? Consultez certains des [modรจles de reconnaissance vocale automatique les plus tรฉlรฉchargรฉs](https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=trending)
+sur le Hub pour voir si vous pouvez obtenir une meilleure transcription.
+
+Essayons le modรจle [Whisper large-v2](https://huggingface.co/openai/whisper-large) de OpenAI. Whisper a รฉtรฉ publiรฉ 2 ans aprรจs Wav2Vec2 et a รฉtรฉ entraรฎnรฉ sur prรจs de 10 fois plus de donnรฉes. En tant que tel, il surpasse Wav2Vec2 sur la plupart des benchmarks en aval. Il a รฉgalement l'avantage supplรฉmentaire de prรฉdire la ponctuation et la casse, ce qui n'est pas possible avec Wav2Vec2.
+
+Essayons-le ici pour voir comment il fonctionne :
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+Maintenant, ce rรฉsultat semble plus prรฉcis ! Pour une comparaison approfondie entre Wav2Vec2 et Whisper, consultez le [cours Audio Transformers](https://huggingface.co/learn/audio-course/chapter5/asr_models).
+Nous vous encourageons vraiment ร consulter le Hub pour des modรจles dans diffรฉrentes langues, des modรจles spรฉcialisรฉs dans votre domaine, et plus encore.
+Vous pouvez consulter et comparer les rรฉsultats des modรจles directement depuis votre navigateur sur le Hub pour voir s'ils conviennent ou gรจrent mieux les cas particuliers que d'autres.
+Et si vous ne trouvez pas de modรจle pour votre cas d'utilisation, vous pouvez toujours commencer ร [entraรฎner](training) le vรดtre !
+
+Si vous avez plusieurs entrรฉes, vous pouvez passer votre entrรฉe sous forme de liste :
+
+```py
+transcriber(
+ [
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac",
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac",
+ ]
+)
+```
+
+Les pipelines sont excellents pour l'expรฉrimentation car passer d'un modรจle ร un autre est trivial ; cependant, il existe des moyens de les optimiser pour des charges de travail plus importantes que l'expรฉrimentation. Consultez les guides suivants qui expliquent comment itรฉrer sur des ensembles de donnรฉes complets ou utiliser des pipelines dans un serveur web :
+de la documentation :
+* [Utilisation des pipelines sur un ensemble de donnรฉes](#using-pipelines-on-a-dataset)
+* [Utilisation des pipelines pour un serveur web](./pipeline_webserver)
+
+## Paramรจtres
+
+[`pipeline`] prend en charge de nombreux paramรจtres ; certains sont spรฉcifiques ร la tรขche et d'autres sont gรฉnรฉraux pour tous les pipelines.
+En gรฉnรฉral, vous pouvez spรฉcifier les paramรจtres oรน vous le souhaitez :
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", my_parameter=1)
+
+out = transcriber(...) # This will use `my_parameter=1`.
+out = transcriber(..., my_parameter=2) # This will override and use `my_parameter=2`.
+out = transcriber(...) # This will go back to using `my_parameter=1`.
+```
+
+Voyons 3 paramรจtres importants :
+
+### Device
+
+Si vous utilisez `device=n`, le pipeline met automatiquement le modรจle sur l'appareil spรฉcifiรฉ.
+Cela fonctionnera que vous utilisiez PyTorch ou Tensorflow.
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0)
+```
+
+Si le modรจle est trop grand pour un seul GPU et que vous utilisez PyTorch, vous pouvez dรฉfinir `device_map="auto"` pour dรฉterminer automatiquement comment charger et stocker les poids du modรจle. L'utilisation de l'argument `device_map` nรฉcessite le package ๐ค [Accelerate](https://huggingface.co/docs/accelerate) :
+
+```bash
+pip install --upgrade accelerate
+```
+
+Le code suivant charge et stocke automatiquement les poids du modรจle sur plusieurs appareils :
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device_map="auto")
+```
+
+Notez que si `device_map="auto"` est passรฉ, il n'est pas nรฉcessaire d'ajouter l'argument `device=device` lors de l'instanciation de votre `pipeline` car vous pourriez rencontrer des comportements inattendus !
+
+### Batch size
+
+Par dรฉfaut, les pipelines ne feront pas d'infรฉrence en batch pour des raisons expliquรฉes en dรฉtail [ici](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching). La raison est que le batching n'est pas nรฉcessairement plus rapide, et peut en fait รชtre beaucoup plus lent dans certains cas.
+
+Mais si cela fonctionne dans votre cas d'utilisation, vous pouvez utiliser :
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0, batch_size=2)
+audio_filenames = [f"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/{i}.flac" for i in range(1, 5)]
+texts = transcriber(audio_filenames)
+```
+
+Cela exรฉcute le pipeline sur les 4 fichiers audio fournis, mais les passera par batch de 2 au modรจle (qui est sur un GPU, oรน le batching est plus susceptible d'aider) sans nรฉcessiter de code supplรฉmentaire de votre part.
+La sortie doit toujours correspondre ร ce que vous auriez reรงu sans batching. Il s'agit uniquement d'un moyen de vous aider ร obtenir plus de vitesse avec un pipeline.
+
+Les pipelines peuvent รฉgalement attรฉnuer certaines des complexitรฉs du batching car, pour certains pipelines, un seul รฉlรฉment (comme un long fichier audio) doit รชtre divisรฉ en plusieurs parties pour รชtre traitรฉ par un modรจle. Le pipeline effectue ce [*batching par morceaux*](./main_classes/pipelines#pipeline-chunk-batching) pour vous.
+
+### Paramรจtres spรฉcifiques ร la tรขche
+
+Toutes les tรขches fournissent des paramรจtres spรฉcifiques ร la tรขche qui permettent une flexibilitรฉ et des options supplรฉmentaires pour vous aider ร accomplir votre travail.
+Par exemple, la mรฉthode [`transformers.AutomaticSpeechRecognitionPipeline.__call__`] dispose d'un paramรจtre `return_timestamps` qui semble prometteur pour le sous-titrage des vidรฉos :
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2", return_timestamps=True)
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.', 'chunks': [{'timestamp': (0.0, 11.88), 'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its'}, {'timestamp': (11.88, 12.38), 'text': ' creed.'}]}
+```
+
+Comme vous pouvez le voir, le modรจle a infรฉrรฉ le texte et a รฉgalement indiquรฉ **quand** les diffรฉrentes phrases ont รฉtรฉ prononcรฉes.
+
+Il existe de nombreux paramรจtres disponibles pour chaque tรขche, alors consultez la rรฉfรฉrence API de chaque tรขche pour voir ce que vous pouvez ajuster !
+Par exemple, le [`~transformers.AutomaticSpeechRecognitionPipeline`] dispose d'un paramรจtre `chunk_length_s` qui est utile pour travailler sur des fichiers audio trรจs longs (par exemple, le sous-titrage de films entiers ou de vidรฉos d'une heure) qu'un modรจle ne peut gรฉnรฉralement pas gรฉrer seul :
+
+```python
+>>> transcriber = pipeline(model="openai/whisper-large-v2", chunk_length_s=30)
+>>> transcriber("https://huggingface.co/datasets/reach-vb/random-audios/resolve/main/ted_60.wav")
+{'text': " So in college, I was a government major, which means I had to write a lot of papers. Now, when a normal student writes a paper, they might spread the work out a little like this. So, you know. You get started maybe a little slowly, but you get enough done in the first week that with some heavier days later on, everything gets done and things stay civil. And I would want to do that like that. That would be the plan. I would have it all ready to go, but then actually the paper would come along, and then I would kind of do this. And that would happen every single paper. But then came my 90-page senior thesis, a paper you're supposed to spend a year on. I knew for a paper like that, my normal workflow was not an option, it was way too big a project. So I planned things out and I decided I kind of had to go something like this. This is how the year would go. So I'd start off light and I'd bump it up"}
+```
+
+Si vous ne trouvez pas un paramรจtre qui vous aiderait vraiment, n'hรฉsitez pas ร [le demander](https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml) !
+
+## Utilisation des pipelines sur un ensemble de donnรฉes
+
+Le pipeline peut รฉgalement exรฉcuter des infรฉrences sur un grand ensemble de donnรฉes. Le moyen le plus simple que nous recommandons pour cela est d'utiliser un itรฉrateur :
+
+```py
+def data():
+ for i in range(1000):
+ yield f"My example {i}"
+
+
+pipe = pipeline(model="openai-community/gpt2", device=0)
+generated_characters = 0
+for out in pipe(data()):
+ generated_characters += len(out[0]["generated_text"])
+```
+
+
+L'itรฉrateur `data()` gรฉnรจre chaque rรฉsultat, et le pipeline reconnaรฎt automatiquement que l'entrรฉe est itรฉrable et commencera ร rรฉcupรฉrer les donnรฉes tout en continuant ร les traiter sur le GPU (cela utilise [DataLoader](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader) sous le capot).
+C'est important car vous n'avez pas besoin d'allouer de mรฉmoire pour l'ensemble de donnรฉes complet et vous pouvez alimenter le GPU aussi rapidement que possible.
+
+รtant donnรฉ que le lotissement pourrait accรฉlรฉrer les choses, il peut รชtre utile d'essayer de rรฉgler le paramรจtre `batch_size` ici.
+
+La faรงon la plus simple d'itรฉrer sur un ensemble de donnรฉes est d'en charger un depuis ๐ค [Datasets](https://github.com/huggingface/datasets) :
+
+```py
+# KeyDataset is a util that will just output the item we're interested in.
+from transformers.pipelines.pt_utils import KeyDataset
+from datasets import load_dataset
+
+pipe = pipeline(model="hf-internal-testing/tiny-random-wav2vec2", device=0)
+dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:10]")
+
+for out in pipe(KeyDataset(dataset, "audio")):
+ print(out)
+```
+
+## Utilisation des pipelines pour un serveur web
+
+
+Crรฉer un moteur d'infรฉrence est un sujet complexe qui mรฉrite sa propre page.
+
+
+[Lien](./pipeline_webserver)
+
+## Pipeline de vision
+
+Utiliser un [`pipeline`] pour les tรขches de vision est pratiquement identique.
+
+Spรฉcifiez votre tรขche et passez votre image au classificateur. L'image peut รชtre un lien, un chemin local ou une image encodรฉe en base64. Par exemple, quelle espรจce de chat est montrรฉe ci-dessous ?
+
+
+
+```py
+>>> from transformers import pipeline
+
+>>> vision_classifier = pipeline(model="google/vit-base-patch16-224")
+>>> preds = vision_classifier(
+... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]
+```
+
+
+## Pipeline de texte
+
+Utiliser un [`pipeline`] pour les tรขches de NLP est pratiquement identique.
+
+```py
+>>> from transformers import pipeline
+
+>>> # This model is a `zero-shot-classification` model.
+>>> # It will classify text, except you are free to choose any label you might imagine
+>>> classifier = pipeline(model="facebook/bart-large-mnli")
+>>> classifier(
+... "I have a problem with my iphone that needs to be resolved asap!!",
+... candidate_labels=["urgent", "not urgent", "phone", "tablet", "computer"],
+... )
+{'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}
+```
+
+
+## Pipeline multimodal
+
+Le [`pipeline`] prend en charge plus d'une modalitรฉ. Par exemple, une tรขche de rรฉponse ร des questions visuelles (VQA) combine texte et image. N'hรฉsitez pas ร utiliser n'importe quel lien d'image que vous aimez et une question que vous souhaitez poser ร propos de l'image. L'image peut รชtre une URL ou un chemin local vers l'image.
+
+Par exemple, si vous utilisez cette [image de facture](https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png) :
+
+```py
+>>> from transformers import pipeline
+
+>>> vqa = pipeline(model="impira/layoutlm-document-qa")
+>>> output = vqa(
+... image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png",
+... question="What is the invoice number?",
+... )
+>>> output[0]["score"] = round(output[0]["score"], 3)
+>>> output
+[{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]
+```
+
+
+
+Pour exรฉcuter l'exemple ci-dessus, vous devez avoir [`pytesseract`](https://pypi.org/project/pytesseract/) installรฉ en plus de ๐ค Transformers :
+
+```bash
+sudo apt install -y tesseract-ocr
+pip install pytesseract
+```
+
+
+
+## Utilisation de `pipeline` sur de grands modรจles avec ๐ค `accelerate` :
+
+Vous pouvez facilement exรฉcuter `pipeline` sur de grands modรจles en utilisant ๐ค `accelerate` ! Assurez-vous d'abord d'avoir installรฉ `accelerate` avec `pip install accelerate`.
+
+Chargez d'abord votre modรจle en utilisant `device_map="auto"` ! Nous utiliserons `facebook/opt-1.3b` pour notre exemple.
+
+```py
+# pip install accelerate
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", torch_dtype=torch.bfloat16, device_map="auto")
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+Vous pouvez รฉgalement passer des modรจles chargรฉs en 8 bits si vous installez `bitsandbytes` et ajoutez l'argument `load_in_8bit=True`
+Notez que vous pouvez remplacer le point de contrรดle par n'importe quel modรจle.
+
+```py
+# pip install accelerate bitsandbytes
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", device_map="auto", model_kwargs={"load_in_8bit": True})
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+## Crรฉation de dรฉmonstrations web ร partir de pipelines avec `gradio`
+
+Hugging Face prenant en charge le chargement de grands modรจles, comme BLOOM.
+Les pipelines sont automatiquement pris en charge dans [Gradio](https://github.com/gradio-app/gradio/), une bibliothรจque qui facilite la crรฉation d'applications d'apprentissage automatique belles et conviviales sur le web. Tout d'abord, assurez-vous que Gradio est installรฉ :
+
+```
+pip install gradio
+```
+
+Ensuite, vous pouvez crรฉer une dรฉmonstration web autour d'un pipeline de classification d'images (ou tout autre pipeline) en une seule ligne de code en appelant la fonction [`Interface.from_pipeline`](https://www.gradio.app/docs/interface#interface-from-pipeline) de Gradio pour lancer le pipeline. Cela crรฉe une interface intuitive de glisser-dรฉposer dans votre navigateur :
+
+```py
+from transformers import pipeline
+import gradio as gr
+
+pipe = pipeline("image-classification", model="google/vit-base-patch16-224")
+
+gr.Interface.from_pipeline(pipe).launch()
+```
+
+
+
+
+Par dรฉfaut, la dรฉmonstration web s'exรฉcute sur un serveur local. Si vous souhaitez la partager avec d'autres, vous pouvez gรฉnรฉrer un lien public temporaire en dรฉfinissant `share=True` dans `launch()`. Vous pouvez รฉgalement hรฉberger votre dรฉmonstration sur [Hugging Face Spaces](https://huggingface.co/spaces) pour obtenir un lien permanent.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/_toctree.yml b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/_toctree.yml
new file mode 100644
index 0000000000000000000000000000000000000000..72759457a5c83a57620984bce73695b989f41cba
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/_toctree.yml
@@ -0,0 +1,7 @@
+- sections:
+ - local: pipeline_tutorial
+ title: เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเฅ เคธเคพเคฅ เค
เคจเฅเคฎเคพเคจ เคเคฒเคพเคเค
+ - local: accelerate
+ title: ๐ค Accelerate เคเฅ เคธเคพเคฅ เคตเคฟเคคเคฐเคฟเคค เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคธเฅเค เคเคฐเฅเค
+ - local: tflite
+ title: TFLite เคฎเฅเค เคจเคฟเคฐเฅเคฏเคพเคค เคเคฐเฅเค
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/accelerate.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/accelerate.md
new file mode 100644
index 0000000000000000000000000000000000000000..3d568217a1299b179d28804660bf3a8124bbaa45
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/accelerate.md
@@ -0,0 +1,136 @@
+
+
+# เคตเคฟเคคเคฐเคฟเคค เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเฅ เคธเคพเคฅ ๐ค Accelerate
+
+เคเฅเคธเฅ-เคเฅเคธเฅ เคฎเฅเคกเคฒ เคฌเคกเคผเฅ เคนเฅเคคเฅ เคนเฅเค, เคธเคฎเคพเคจเคพเคเคคเคฐเคคเคพ เคธเฅเคฎเคฟเคค เคนเคพเคฐเฅเคกเคตเฅเคฏเคฐ เคชเคฐ เคฌเคกเคผเฅ เคฎเฅเคกเคฒ เคเฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฟเคค เคเคฐเคจเฅ เคเคฐ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเฅ เคเคคเคฟ เคเฅ เคเค เคเคฆเฅเคถเฅเค เคเฅ เคเคเคพเคฐ เคฎเฅเค เคคเฅเค เคเคฐเคจเฅ เคเฅ เคฒเคฟเค เคเค เคฐเคฃเคจเฅเคคเคฟ เคเฅ เคฐเฅเคช เคฎเฅเค เคเคญเคฐเฅ เคนเฅเฅค เคนเคเคฟเคเค เคซเฅเคธ เคฎเฅเค, เคนเคฎเคจเฅ เคเคชเคฏเฅเคเคเคฐเฅเคคเคพเคเค เคเฅ เคเคฟเคธเฅ เคญเฅ เคชเฅเคฐเคเคพเคฐ เคเฅ เคตเคฟเคคเคฐเคฟเคค เคธเฅเคเค
เคช เคชเคฐ ๐ค เคเฅเคฐเคพเคเคธเคซเคพเคฐเฅเคฎเคฐเฅเคธ เคฎเฅเคกเคฒ เคเฅ เคเคธเคพเคจเฅ เคธเฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฟเคค เคเคฐเคจเฅ เคฎเฅเค เคฎเคฆเคฆ เคเคฐเคจเฅ เคเฅ เคฒเคฟเค [๐ค Accelerate](https://huggingface.co/docs/accelerate) เคชเฅเคธเฅเคคเคเคพเคฒเคฏ เคฌเคจเคพเคฏเคพ เคนเฅ, เคเคพเคนเฅ เคตเคน เคเค เคฎเคถเฅเคจ เคชเคฐ เคเค GPU เคนเฅเค เคฏเคพ เคเค เคฎเคถเฅเคจเฅเค เคฎเฅเค เคเค GPUเฅค เคเคธ เคเฅเคฏเฅเคเฅเคฐเคฟเคฏเคฒ เคฎเฅเค, เคเคพเคจเฅเค เคเคฟ เค
เคชเคจเฅ เคฎเฅเคฒ PyTorch เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคฒเฅเคช เคเฅ เคเฅเคธเฅ เค
เคจเฅเคเฅเคฒเคฟเคค เคเคฟเคฏเคพ เคเคพเค เคคเคพเคเคฟ เคตเคฟเคคเคฐเคฟเคค เคตเคพเคคเคพเคตเคฐเคฃ เคฎเฅเค เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคธเคเฅเคทเคฎ เคนเฅ เคธเคเฅเฅค
+
+## เคธเฅเคเค
เคช
+
+๐ค Accelerate เคธเฅเคฅเคพเคชเคฟเคค เคเคฐเคเฅ เคถเฅเคฐเฅ เคเคฐเฅเค:
+
+```bash
+pip install accelerate
+```
+
+เคซเคฟเคฐ เคเค [`~accelerate.Accelerator`] เคเคฌเฅเคเฅเคเฅเค เคเคฏเคพเคค เคเคฐเฅเค เคเคฐ เคฌเคจเคพเคเคเฅค [`~accelerate.Accelerator`] เคธเฅเคตเคเคพเคฒเคฟเคค เคฐเฅเคช เคธเฅ เคเคชเคเฅ เคตเคฟเคคเคฐเคฟเคค เคธเฅเคเค
เคช เคเฅ เคชเฅเคฐเคเคพเคฐ เคเคพ เคชเคคเคพ เคฒเคเคพเคเคเคพ เคเคฐ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเฅ เคฒเคฟเค เคธเคญเฅ เคเคตเคถเฅเคฏเค เคเคเคเฅเค เคเฅ เคชเฅเคฐเคพเคฐเคเคญ เคเคฐเฅเคเคพเฅค เคเคชเคเฅ เค
เคชเคจเฅ เคฎเฅเคกเคฒ เคเฅ เคเคฟเคธเฅ เคกเคฟเคตเคพเคเคธ เคชเคฐ เคธเฅเคชเคทเฅเค เคฐเฅเคช เคธเฅ เคฐเคเคจเฅ เคเฅ เคเคตเคถเฅเคฏเคเคคเคพ เคจเคนเฅเค เคนเฅเฅค
+
+```py
+>>> from accelerate import Accelerator
+
+>>> accelerator = Accelerator()
+```
+
+## เคคเฅเคเฅ เคฒเคพเคจเฅ เคเฅ เคคเฅเคฏเคพเคฐเฅ
+
+เค
เคเคฒเคพ เคเคฆเคฎ เคธเคญเฅ เคชเฅเคฐเคพเคธเคเคเคฟเค เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคตเคธเฅเคคเฅเคเค เคเฅ [`~accelerate.Accelerator.prepare`] เคตเคฟเคงเคฟ เคฎเฅเค เคชเคพเคธ เคเคฐเคจเคพ เคนเฅเฅค เคเคธเคฎเฅเค เคเคชเคเฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเคฐ เคฎเฅเคฒเฅเคฏเคพเคเคเคจ DataLoaders, เคเค เคฎเฅเคกเคฒ เคเคฐ เคเค เคเคชเฅเคเคฟเคฎเคพเคเคเคผเคฐ เคถเคพเคฎเคฟเคฒ เคนเฅเค:
+
+```py
+>>> train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
+... train_dataloader, eval_dataloader, model, optimizer
+... )
+```
+
+## เคฌเฅเคเคตเคฐเฅเคก
+
+เค
เคเคคเคฟเคฎ เคเฅเคกเคผ เคฏเคน เคนเฅ เคเคฟ เคเคชเคเฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคฒเฅเคช เคฎเฅเค เคธเคพเคฎเคพเคจเฅเคฏ `loss.backward()` เคเฅ ๐ค Accelerate เคเฅ [`~accelerate.Accelerator.backward`] เคตเคฟเคงเคฟ เคธเฅ เคฌเคฆเคฒเฅเค:
+
+```py
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... outputs = model(**batch)
+... loss = outputs.loss
+... accelerator.backward(loss)
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+เคเฅเคธเคพ เคเคฟ เคเคช เคจเคฟเคฎเฅเคจเคฒเคฟเคเคฟเคค เคเฅเคก เคฎเฅเค เคฆเฅเค เคธเคเคคเฅ เคนเฅเค, เคเคชเคเฅ เคตเคฟเคคเคฐเคฟเคค เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคธเคเฅเคทเคฎ เคเคฐเคจเฅ เคเฅ เคฒเคฟเค เค
เคชเคจเฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคฒเฅเคช เคฎเฅเค เคเฅเคตเคฒ เคเคพเคฐ เค
เคคเคฟเคฐเคฟเคเฅเคค เคเฅเคก เคเฅ เคชเคเคเฅเคคเคฟเคฏเคพเค เคเฅเคกเคผเคจเฅ เคเฅ เคเคตเคถเฅเคฏเคเคคเคพ เคนเฅ!
+
+```diff
++ from accelerate import Accelerator
+ from transformers import AdamW, AutoModelForSequenceClassification, get_scheduler
+
++ accelerator = Accelerator()
+
+ model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
+ optimizer = AdamW(model.parameters(), lr=3e-5)
+
+- device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+- model.to(device)
+
++ train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
++ train_dataloader, eval_dataloader, model, optimizer
++ )
+
+ num_epochs = 3
+ num_training_steps = num_epochs * len(train_dataloader)
+ lr_scheduler = get_scheduler(
+ "linear",
+ optimizer=optimizer,
+ num_warmup_steps=0,
+ num_training_steps=num_training_steps
+ )
+
+ progress_bar = tqdm(range(num_training_steps))
+
+ model.train()
+ for epoch in range(num_epochs):
+ for batch in train_dataloader:
+- batch = {k: v.to(device) for k, v in batch.items()}
+ outputs = model(**batch)
+ loss = outputs.loss
+- loss.backward()
++ accelerator.backward(loss)
+
+ optimizer.step()
+ lr_scheduler.step()
+ optimizer.zero_grad()
+ progress_bar.update(1)
+```
+
+## เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ
+
+เคเค เคฌเคพเคฐ เคเคฌ เคเคชเคจเฅ เคชเฅเคฐเคพเคธเคเคเคฟเค เคเฅเคก เคเฅ เคชเคเคเฅเคคเคฟเคฏเคพเค เคเฅเคกเคผ เคฆเฅ เคนเฅเค, เคคเฅ เค
เคชเคจเฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเฅ เคธเฅเคเฅเคฐเคฟเคชเฅเค เคฏเคพ เคเฅเคฒเฅเคฌเฅเคฐเฅเคเคฐเฅ เคเฅเคธเฅ เคจเฅเคเคฌเฅเค เคฎเฅเค เคฒเฅเคจเฅเค เคเคฐเฅเคเฅค
+
+### เคธเฅเคเฅเคฐเคฟเคชเฅเค เคเฅ เคธเคพเคฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ
+
+เคฏเคฆเคฟ เคเคช เคธเฅเคเฅเคฐเคฟเคชเฅเค เคธเฅ เค
เคชเคจเคพ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเคฒเคพ เคฐเคนเฅ เคนเฅเค, เคคเฅ เคเค เคเฅเคจเฅเคซเคผเคฟเคเคฐเฅเคถเคจ เคซเคผเคพเคเคฒ เคฌเคจเคพเคจเฅ เคเคฐ เคธเคนเฅเคเคจเฅ เคเฅ เคฒเคฟเค เคจเคฟเคฎเฅเคจเคฒเคฟเคเคฟเคค เคเคฎเคพเคเคก เคเคฒเคพเคเค:
+
+```bash
+accelerate config
+```
+
+เคซเคฟเคฐ เค
เคชเคจเฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเฅ เคเคธ เคคเคฐเคน เคฒเฅเคจเฅเค เคเคฐเฅเค:
+
+```bash
+accelerate launch train.py
+```
+
+### เคจเฅเคเคฌเฅเค เคเฅ เคธเคพเคฅ เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ
+
+๐ค Accelerate เคเค เคจเฅเคเคฌเฅเค เคฎเฅเค เคญเฅ เคเคฒ เคธเคเคคเคพ เคนเฅ เคฏเคฆเคฟ เคเคช Colaboratory เคเฅ TPU เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเฅ เคเฅ เคฏเฅเคเคจเคพ เคฌเคจเคพ เคฐเคนเฅ เคนเฅเคเฅค เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ เคเฅ เคฒเคฟเค เคเคฟเคฎเฅเคฎเฅเคฆเคพเคฐ เคธเคญเฅ เคเฅเคก เคเฅ เคเค เคซเคผเคเคเฅเคถเคจ เคฎเฅเค เคฒเคชเฅเคเฅเค, เคเคฐ เคเคธเฅ [`~accelerate.notebook_launcher`] เคฎเฅเค เคชเคพเคธ เคเคฐเฅเค:
+
+```py
+>>> from accelerate import notebook_launcher
+
+>>> notebook_launcher(training_function)
+```
+
+๐ค Accelerate เคเคฐ เคเคธเคเฅ เคธเคฎเฅเคฆเฅเคง เคธเฅเคตเคฟเคงเคพเคเค เคเฅ เคฌเคพเคฐเฅ เคฎเฅเค เค
เคงเคฟเค เคเคพเคจเคเคพเคฐเฅ เคเฅ เคฒเคฟเค, [เคฆเคธเฅเคคเคพเคตเฅเคเคผเฅเคเคฐเคฃ](https://huggingface.co/docs/accelerate) เคฆเฅเคเฅเคเฅค
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/pipeline_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/pipeline_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..d20d5d617a972763eb864992ee63fd32887fdd9a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/pipeline_tutorial.md
@@ -0,0 +1,319 @@
+
+
+# เค
เคจเฅเคฎเคพเคจ เคเฅ เคฒเคฟเค เคชเคพเคเคชเคฒเคพเคเคจ
+
+[`pipeline`] เคเคฟเคธเฅ เคญเฅ เคญเคพเคทเคพ, เคเคเคชเฅเคฏเฅเคเคฐ เคฆเฅเคทเฅเคเคฟ, เคญเคพเคทเคฃ เคเคฐ เคฎเคฒเฅเคเฅเคฎเฅเคกเคฒ เคเคพเคฐเฅเคฏเฅเค เคชเคฐ เค
เคจเฅเคฎเคพเคจ เคฒเคเคพเคจเฅ เคเฅ เคฒเคฟเค [Hub](https://huggingface.co/models) เคธเฅ เคเคฟเคธเฅ เคญเฅ เคฎเฅเคกเคฒ เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ เคเคธเคพเคจ เคฌเคจเคพเคคเคพ เคนเฅเฅค เคญเคฒเฅ เคนเฅ เคเคชเคเฅ เคชเคพเคธ เคเคฟเคธเฅ เคตเคฟเคถเคฟเคทเฅเค เคคเฅเคฐ-เคคเคฐเฅเคเฅ เคเคพ เค
เคจเฅเคญเคต เคจ เคนเฅ เคฏเคพ เคเคช เคฎเฅเคกเคฒเฅเค เคเฅ เคชเฅเคเฅ เค
เคเคคเคฐเฅเคจเคฟเคนเคฟเคค เคเฅเคก เคธเฅ เคชเคฐเคฟเคเคฟเคค เคจ เคนเฅเค, เคซเคฟเคฐ เคญเฅ เคเคช [`pipeline`] เคเฅ เค
เคจเฅเคฎเคพเคจ เคเฅ เคฒเคฟเค เคเคจเคเคพ เคเคชเคฏเฅเค เคเคฐ เคธเคเคคเฅ เคนเฅเค! เคฏเคน เคเฅเคฏเฅเคเฅเคฐเคฟเคฏเคฒ เคเคชเคเฅ เคฏเฅ เคธเคฟเคเคพเคเคเคพ:
+
+* เค
เคจเฅเคฎเคพเคจ เคเฅ เคฒเคฟเค [`pipeline`] เคเคพ เคเคชเคฏเฅเค เคเคฐเฅเคเฅค
+* เคเค เคตเคฟเคถเคฟเคทเฅเค เคเฅเคเคจเคจเคพเคเคเคผเคฐ เคฏเคพ เคฎเฅเคกเคฒ เคเคพ เคเคชเคฏเฅเค เคเคฐเฅเคเฅค
+* เคเคกเคฟเคฏเฅ, เคตเคฟเคเคผเคจ เคเคฐ เคฎเคฒเฅเคเฅเคฎเฅเคกเคฒ เคเคพเคฐเฅเคฏเฅเค เคเฅ เคฒเคฟเค [`pipeline`] เคเคพ เคเคชเคฏเฅเค เคเคฐเฅเคเฅค
+
+
+
+เคธเคฎเคฐเฅเคฅเคฟเคค เคเคพเคฐเฅเคฏเฅเค เคเคฐ เคเคชเคฒเคฌเฅเคง เคฎเคพเคชเคฆเคเคกเฅเค เคเฅ เคชเฅเคฐเฅ เคธเฅเคเฅ เคเฅ เคฒเคฟเค [`pipeline`] เคฆเคธเฅเคคเคพเคตเฅเคเคผ เคชเคฐ เคเค เคจเคเคผเคฐ เคกเคพเคฒเฅเคเฅค
+
+
+
+## เคชเคพเคเคชเคฒเคพเคเคจ เคเคพ เคเคชเคฏเฅเค
+
+เคเคฌเคเคฟ เคชเฅเคฐเคคเฅเคฏเฅเค เคเคพเคฐเฅเคฏ เคฎเฅเค เคเค เคธเคเคฌเคฆเฅเคง [`pipeline`] เคนเฅเคคเคพ เคนเฅ, เคธเคพเคฎเคพเคจเฅเคฏ [`pipeline`] เค
เคฎเฅเคฐเฅเคค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ เคเคธเคพเคจ เคนเฅเคคเคพ เคนเฅ เคเคฟเคธเคฎเฅเค เคถเคพเคฎเคฟเคฒ เคนเฅเคคเคพ เคนเฅ
+เคธเคญเฅ เคเคพเคฐเฅเคฏ-เคตเคฟเคถเคฟเคทเฅเค เคชเคพเคเคชเคฒเคพเคเคจเฅเคเฅค [`pipeline`] เคธเฅเคตเคเคพเคฒเคฟเคค เคฐเฅเคช เคธเฅ เคเค เคกเคฟเคซเคผเฅเคฒเฅเค เคฎเฅเคกเคฒ เคเคฐ เคธเคเฅเคทเคฎ เคชเฅเคฐเฅเคชเฅเคฐเฅเคธเฅเคธเคฟเคเค เคเฅเคฒเคพเคธ เคฒเฅเคก เคเคฐเคคเคพ เคนเฅ
+เคเคชเคเฅ เคเคพเคฐเฅเคฏ เคเฅ เคฒเคฟเค เค
เคจเฅเคฎเคพเคจ เคเคพ. เคเคเค เคธเฅเคตเคเคพเคฒเคฟเคค เคตเคพเคเฅ เคชเคนเคเคพเคจ (เคเคเคธเคเคฐ) เคเฅ เคฒเคฟเค [`pipeline`] เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเฅ เคเคพ เคเคฆเคพเคนเคฐเคฃ เคฒเฅเค, เคฏเคพ
+เคตเคพเคเฅ-เคธเฅ-เคชเคพเค .
+
+
+1. เคเค [`pipeline`] เคฌเคจเคพเคเคฐ เคชเฅเคฐเคพเคฐเคเคญ เคเคฐเฅเค เคเคฐ เค
เคจเฅเคฎเคพเคจ เคเคพเคฐเฅเคฏ เคจเคฟเคฐเฅเคฆเคฟเคทเฅเค เคเคฐเฅเค:
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition")
+```
+
+2. เค
เคชเคจเคพ เคเคจเคชเฅเค [`pipeline`] เคชเคฐ เคญเฅเคเฅเคเฅค เคตเคพเคเฅ เคชเคนเคเคพเคจ เคเฅ เคฎเคพเคฎเคฒเฅ เคฎเฅเค, เคฏเคน เคเค เคเคกเคฟเคฏเฅ เคเคจเคชเฅเค เคซเคผเคพเคเคฒ เคนเฅ:
+
+```py
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': 'I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES'}
+```
+
+เคเฅเคฏเคพ เคตเคน เคชเคฐเคฟเคฃเคพเคฎ เคจเคนเฅเค เคเฅ เคเคชเคเฅ เคฎเคจ เคฎเฅเค เคฅเคพ? เคเฅเค [เคธเคฌเคธเฅ เค
เคงเคฟเค เคกเคพเคเคจเคฒเฅเคก เคเคฟเค เคเค เคธเฅเคตเคเคพเคฒเคฟเคค เคตเคพเคเฅ เคชเคนเคเคพเคจ เคฎเฅเคกเคฒ](https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=trending) เคฆเฅเคเฅเค
+เคฏเคน เคฆเฅเคเคจเฅ เคเฅ เคฒเคฟเค เคนเคฌ เคชเคฐ เคเคพเคเค เคเคฟ เคเฅเคฏเคพ เคเคชเคเฅ เคฌเฅเคนเคคเคฐ เคเฅเคฐเคพเคเคธเฅเคเฅเคฐเคฟเคชเฅเคถเคจ เคฎเคฟเคฒ เคธเคเคคเคพ เคนเฅเฅค
+
+เคเคเค OpenAI เคธเฅ [เคตเฅเคนเคฟเคธเฅเคชเคฐ เคฒเคพเคฐเฅเค-v2](https://huggingface.co/openai/whisper-large) เคฎเฅเคกเคฒ เคเคเคผเคฎเคพเคเคเฅค เคตเฅเคนเคฟเคธเฅเคชเคฐ เคเคพเคฐเฅ เคเคฟเคฏเคพ เคเคฏเคพ
+Wav2Vec2 เคเฅ เคคเฅเคฒเคจเคพ เคฎเฅเค 2 เคธเคพเคฒ เคฌเคพเคฆ, เคเคฐ เคฒเคเคญเค 10 เคเฅเคจเคพ เค
เคงเคฟเค เคกเฅเคเคพ เคชเคฐ เคชเฅเคฐเคถเคฟเคเฅเคทเคฟเคค เคเคฟเคฏเคพ เคเคฏเคพ เคฅเคพเฅค เคเคธ เคชเฅเคฐเคเคพเคฐ, เคฏเคน เค
เคงเคฟเคเคพเคเคถ เคกเคพเคเคจเคธเฅเคเฅเคฐเฅเคฎ เคชเคฐ Wav2Vec2 เคเฅ เคฎเคพเคค เคฆเฅเคคเคพ เคนเฅ
+เคฌเฅเคเคเคฎเคพเคฐเฅเค. เคเคธเคฎเฅเค เคตเคฟเคฐเคพเคฎ เคเคฟเคนเฅเคจ เคเคฐ เคเคตเคฐเคฃ เคเฅ เคญเคตเคฟเคทเฅเคฏเคตเคพเคฃเฅ เคเคฐเคจเฅ เคเคพ เค
เคคเคฟเคฐเคฟเคเฅเคค เคฒเคพเคญ เคญเฅ เคนเฅ, เคเคฟเคจเคฎเฅเค เคธเฅ เคเฅเค เคญเฅ เคธเคเคญเคต เคจเคนเฅเค เคนเฅ
+Wav2Vec2.
+
+เคเคเค เคเคธเฅ เคฏเคนเคพเค เคเคเคผเคฎเคพเคเคฐ เคฆเฅเคเฅเค เคเคฟ เคฏเคน เคเฅเคธเคพ เคชเฅเคฐเคฆเคฐเฅเคถเคจ เคเคฐเคคเคพ เคนเฅ:
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+เค
เคฌ เคฏเคน เคชเคฐเคฟเคฃเคพเคฎ เค
เคงเคฟเค เคธเคเฅเค เคฆเคฟเคเคคเคพ เคนเฅ! Wav2Vec2 เคฌเคจเคพเคฎ เคตเฅเคนเคฟเคธเฅเคชเคฐ เคชเคฐ เคเคนเคจ เคคเฅเคฒเคจเคพ เคเฅ เคฒเคฟเค, [เคเคกเคฟเคฏเฅ เคเฅเคฐเคพเคเคธเคซเฅเคฐเฅเคฎเคฐเฅเคธ เคเฅเคฐเฅเคธ](https://huggingface.co/learn/audio-course/chapter5/asr_models) เคฆเฅเคเฅเคเฅค
+เคนเคฎ เคตเคพเคธเฅเคคเคต เคฎเฅเค เคเคชเคเฅ เคตเคฟเคญเคฟเคจเฅเคจ เคญเคพเคทเคพเคเค เคฎเฅเค เคฎเฅเคกเคฒ, เคเคชเคเฅ เคเฅเคทเฅเคคเฅเคฐ เคฎเฅเค เคตเคฟเคถเฅเคทเฅเคเฅเคค เคฎเฅเคกเคฒ เคเคฐ เคฌเคนเฅเคค เคเฅเค เคเฅ เคฒเคฟเค เคนเคฌ เคเฅ เคเคพเคเค เคเคฐเคจเฅ เคเฅ เคฒเคฟเค เคชเฅเคฐเฅเคคเฅเคธเคพเคนเคฟเคค เคเคฐเคคเฅ เคนเฅเคเฅค
+เคเคช เคนเคฌ เคชเคฐ เคธเฅเคงเฅ เค
เคชเคจเฅ เคฌเฅเคฐเคพเคเคเคผเคฐ เคธเฅ เคฎเฅเคกเคฒ เคชเคฐเคฟเคฃเคพเคฎเฅเค เคเฅ เคเคพเคเค เคเคฐ เคคเฅเคฒเคจเคพ เคเคฐ เคธเคเคคเฅ เคนเฅเค เคเคฟ เคฏเคน เคซเคฟเค เคฌเฅเค เคคเคพ เคนเฅ เคฏเคพ เคจเคนเฅเค
+เค
เคจเฅเคฏ เคฎเคพเคฎเคฒเฅเค เคเฅ เคคเฅเคฒเคจเคพ เคฎเฅเค เคเฅเคจเฅ เคเฅ เคฎเคพเคฎเคฒเฅเค เคเฅ เคฌเฅเคนเคคเคฐ เคขเคเค เคธเฅ เคธเคเคญเคพเคฒเคคเคพ เคนเฅเฅค
+เคเคฐ เคฏเคฆเคฟ เคเคชเคเฅ เค
เคชเคจเฅ เคเคชเคฏเฅเค เคเฅ เคฎเคพเคฎเคฒเฅ เคเฅ เคฒเคฟเค เคเฅเค เคฎเฅเคกเคฒ เคจเคนเฅเค เคฎเคฟเคฒเคคเคพ เคนเฅ, เคคเฅ เคเคช เคนเคฎเฅเคถเคพ เค
เคชเคจเคพ เคเฅเคฆ เคเคพ [เคชเฅเคฐเคถเคฟเคเฅเคทเคฃ](training) เคถเฅเคฐเฅ เคเคฐ เคธเคเคคเฅ เคนเฅเค!
+
+เคฏเคฆเคฟ เคเคชเคเฅ เคชเคพเคธ เคเค เคเคจเคชเฅเค เคนเฅเค, เคคเฅ เคเคช เค
เคชเคจเฅ เคเคจเคชเฅเค เคเฅ เคเค เคธเฅเคเฅ เคเฅ เคฐเฅเคช เคฎเฅเค เคชเคพเคธ เคเคฐ เคธเคเคคเฅ เคนเฅเค:
+
+```py
+transcriber(
+ [
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac",
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac",
+ ]
+)
+```
+
+เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคชเฅเคฐเคฏเฅเค เคเฅ เคฒเคฟเค เคฌเคนเฅเคค เค
เคเฅเคเฅ เคนเฅเค เคเฅเคฏเฅเคเคเคฟ เคเค เคฎเฅเคกเคฒ เคธเฅ เคฆเฅเคธเคฐเฅ เคฎเฅเคกเคฒ เคชเคฐ เคธเฅเคตเคฟเค เคเคฐเคจเคพ เคฎเคพเคฎเฅเคฒเฅ เคเคพเคฎ เคนเฅ; เคนเคพเคฒเคพเคเคเคฟ, เคชเฅเคฐเคฏเฅเค เคเฅ เคคเฅเคฒเคจเคพ เคฎเฅเค เคฌเคกเคผเฅ เคเคพเคฐเฅเคฏเคญเคพเคฐ เคเฅ เคฒเคฟเค เคเคจเฅเคนเฅเค เค
เคจเฅเคเฅเคฒเคฟเคค เคเคฐเคจเฅ เคเฅ เคเฅเค เคคเคฐเฅเคเฅ เคนเฅเคเฅค เคธเคเคชเฅเคฐเฅเคฃ เคกเฅเคเคพเคธเฅเค เคชเคฐ เคชเฅเคจเคฐเคพเคตเฅเคคเฅเคคเคฟ เคเคฐเคจเฅ เคฏเคพ เคตเฅเคฌเคธเคฐเฅเคตเคฐ เคฎเฅเค เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเฅ เคเฅ เคฌเคพเคฐเฅ เคฎเฅเค เคจเคฟเคฎเฅเคจเคฒเคฟเคเคฟเคค เคฎเคพเคฐเฅเคเคฆเคฐเฅเคถเคฟเคเคพเคเค เคฆเฅเคเฅเค:
+เคฆเคธเฅเคคเคพเคตเฅเคเคผเฅเค เคฎเฅเค เคธเฅ:
+* [เคกเฅเคเคพเคธเฅเค เคชเคฐ เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ](#using-pipelines-on-a-dataset)
+* [เคตเฅเคฌเคธเคฐเฅเคตเคฐ เคเฅ เคฒเคฟเค เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ](./pipeline_webserver)
+
+## เคชเฅเคฐเคพเคเคฒ
+
+[`pipeline`] เคเค เคฎเคพเคชเคฆเคเคกเฅเค เคเคพ เคธเคฎเคฐเฅเคฅเคจ เคเคฐเคคเคพ เคนเฅ; เคเฅเค เคเคพเคฐเฅเคฏ เคตเคฟเคถเคฟเคทเฅเค เคนเฅเค, เคเคฐ เคเฅเค เคธเคญเฅ เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเฅ เคฒเคฟเค เคธเคพเคฎเคพเคจเฅเคฏ เคนเฅเคเฅค
+เคธเคพเคฎเคพเคจเฅเคฏ เคคเฅเคฐ เคชเคฐ, เคเคช เค
เคชเคจเฅ เคเคเฅเคเคพเคจเฅเคธเคพเคฐ เคเคนเฅเค เคญเฅ เคชเฅเคฐเคพเคฎเฅเคเคฐ เคจเคฟเคฐเฅเคฆเคฟเคทเฅเค เคเคฐ เคธเคเคคเฅ เคนเฅเค:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", my_parameter=1)
+
+out = transcriber(...) # This will use `my_parameter=1`.
+out = transcriber(..., my_parameter=2) # This will override and use `my_parameter=2`.
+out = transcriber(...) # This will go back to using `my_parameter=1`.
+```
+
+เคเคเค 3 เคฎเคนเคคเฅเคตเคชเฅเคฐเฅเคฃ เคฌเคพเคคเฅเค เคชเคฐ เคเฅเคฐ เคเคฐเฅเค:
+
+### เคเคชเคเคฐเคฃ
+
+เคฏเคฆเคฟ เคเคช `device=0` เคเคพ เคเคชเคฏเฅเค เคเคฐเคคเฅ เคนเฅเค, เคคเฅ เคชเคพเคเคชเคฒเคพเคเคจ เคธเฅเคตเคเคพเคฒเคฟเคค เคฐเฅเคช เคธเฅ เคฎเฅเคกเคฒ เคเฅ เคจเคฟเคฐเฅเคฆเคฟเคทเฅเค เคกเคฟเคตเคพเคเคธ เคชเคฐ เคกเคพเคฒ เคฆเฅเคคเฅ เคนเฅเฅค
+เคฏเคน เคเคธ เคชเคฐ เคงเฅเคฏเคพเคจ เคฆเคฟเค เคฌเคฟเคจเคพ เคเคพเคฎ เคเคฐเฅเคเคพ เคเคฟ เคเคช PyTorch เคฏเคพ Tensorflow เคเคพ เคเคชเคฏเฅเค เคเคฐ เคฐเคนเฅ เคนเฅเค เคฏเคพ เคจเคนเฅเคเฅค
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0)
+```
+
+เคฏเคฆเคฟ เคฎเฅเคกเคฒ เคเคเคฒ GPU เคเฅ เคฒเคฟเค เคฌเคนเฅเคค เคฌเคกเคผเคพ เคนเฅ เคเคฐ เคเคช PyTorch เคเคพ เคเคชเคฏเฅเค เคเคฐ เคฐเคนเฅ เคนเฅเค, เคคเฅ เคเคช `device_map="auto"` เคเฅ เคธเฅเคตเคเคพเคฒเคฟเคค เคฐเฅเคช เคธเฅ เคธเฅเค เคเคฐ เคธเคเคคเฅ เคนเฅเค
+เคจเคฟเคฐเฅเคงเคพเคฐเคฟเคค เคเคฐเฅเค เคเคฟ เคฎเฅเคกเคฒ เคตเคเคผเคจ เคเฅ เคเฅเคธเฅ เคฒเฅเคก เคเคฐ เคธเคเคเฅเคฐเคนเฅเคค เคเคฟเคฏเคพ เคเคพเคเฅค `device_map` เคคเคฐเฅเค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเฅ เคเฅ เคฒเคฟเค ๐ค [Accelerate](https://huggingface.co/docs/accelerate) เคเฅ เคเคตเคถเฅเคฏเคเคคเคพ เคนเฅเคคเฅ เคนเฅ
+เคชเฅเคเฅเค:
+
+```bash
+pip install --upgrade accelerate
+```
+
+เคจเคฟเคฎเฅเคจเคฒเคฟเคเคฟเคค เคเฅเคก เคธเฅเคตเคเคพเคฒเคฟเคค เคฐเฅเคช เคธเฅ เคธเคญเฅ เคกเคฟเคตเคพเคเคธเฅเค เคฎเฅเค เคฎเฅเคกเคฒ เคญเคพเคฐ เคเฅ เคฒเฅเคก เคเคฐ เคธเคเคเฅเคฐเคนเฅเคค เคเคฐเคคเคพ เคนเฅ:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device_map="auto")
+```
+
+เคงเฅเคฏเคพเคจ เคฆเฅเค เคเคฟ เคฏเคฆเคฟ `device_map='auto'` เคชเคพเคฐเคฟเคค เคนเฅ เคเคฏเคพ เคนเฅ, เคคเฅ เค
เคชเคจเฅ `pipeline` เคเฅ เคเคพเคฒเฅ เคเคฐเคคเฅ เคธเคฎเคฏ `device=device` เคคเคฐเฅเค เคเฅเคกเคผเคจเฅ เคเฅ เคเฅเค เคเคตเคถเฅเคฏเคเคคเคพ เคจเคนเฅเค เคนเฅ เคเฅเคฏเฅเคเคเคฟ เคเคชเคเฅ เคเฅเค เค
เคชเฅเคฐเคคเฅเคฏเคพเคถเคฟเคค เคตเฅเคฏเคตเคนเคพเคฐ เคเคพ เคธเคพเคฎเคจเคพ เคเคฐเคจเคพ เคชเคกเคผ เคธเคเคคเคพ เคนเฅ!
+
+### เคฌเฅเค เคเคพ เคเคเคพเคฐ
+
+เคกเคฟเคซเคผเฅเคฒเฅเค เคฐเฅเคช เคธเฅ, เคชเคพเคเคชเคฒเคพเคเคจเฅเค [เคฏเคนเคพเค](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching) เคตเคฟเคธเฅเคคเคพเคฐ เคธเฅ เคฌเคคเคพเค เคเค เคเคพเคฐเคฃเฅเค เคเฅ เคฒเคฟเค เคฌเฅเค เค
เคจเฅเคฎเคพเคจ เคจเคนเฅเค เคฒเคเคพเคเคเคเฅเฅค เคเคธเคเคพ เคเคพเคฐเคฃ เคฏเคน เคนเฅ เคเคฟ เคฌเฅเคเคฟเคเค เคเคตเคถเฅเคฏเค เคฐเฅเคช เคธเฅ เคคเฅเคเคผ เคจเคนเฅเค เคนเฅ, เคเคฐ เคตเคพเคธเฅเคคเคต เคฎเฅเค เคเฅเค เคฎเคพเคฎเคฒเฅเค เคฎเฅเค เคเคพเคซเฅ เคงเฅเคฎเฅ เคนเฅ เคธเคเคคเฅ เคนเฅเฅค
+
+เคฒเฅเคเคฟเคจ เค
เคเคฐ เคฏเคน เคเคชเคเฅ เคเคชเคฏเฅเค เคเฅ เคฎเคพเคฎเคฒเฅ เคฎเฅเค เคเคพเคฎ เคเคฐเคคเคพ เคนเฅ, เคคเฅ เคเคช เคเคธเคเคพ เคเคชเคฏเฅเค เคเคฐ เคธเคเคคเฅ เคนเฅเค:
+
+```py
+transcriber = pipeline(model="openai/whisper-large-v2", device=0, batch_size=2)
+audio_filenames = [f"https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/{i}.flac" for i in range(1, 5)]
+texts = transcriber(audio_filenames)
+```
+
+เคฏเคน เคชเฅเคฐเคฆเคพเคจ เคเฅ เคเค 4 เคเคกเคฟเคฏเฅ เคซเคพเคเคฒเฅเค เคชเคฐ เคชเคพเคเคชเคฒเคพเคเคจ เคเคฒเคพเคคเคพ เคนเฅ, เคฒเฅเคเคฟเคจ เคฏเคน เคเคจเฅเคนเฅเค 2 เคเฅ เคฌเฅเค เคฎเฅเค เคชเคพเคธ เคเคฐเฅเคเคพ
+เคเคชเคธเฅ เคเคฟเคธเฅ เคเคฐ เคเฅเคก เคเฅ เคเคตเคถเฅเคฏเคเคคเคพ เคเฅ เคฌเคฟเคจเคพ เคฎเฅเคกเคฒ (เคเฅ เคเค เคเฅเคชเฅเคฏเฅ เคชเคฐ เคนเฅ, เคเคนเคพเค เคฌเฅเคเคฟเคเค เคธเฅ เคฎเคฆเคฆ เคฎเคฟเคฒเคจเฅ เคเฅ เค
เคงเคฟเค เคธเคเคญเคพเคตเคจเคพ เคนเฅ) เคชเคฐ เคเคพเคเคเฅค
+เคเคเคเคชเฅเค เคนเคฎเฅเคถเคพ เคเคธเฅ เคธเฅ เคฎเฅเคฒ เคเคพเคจเคพ เคเคพเคนเคฟเค เคเฅ เคเคชเคเฅ เคฌเฅเคเคฟเคเค เคเฅ เคฌเคฟเคจเคพ เคชเฅเคฐเคพเคชเฅเคค เคนเฅเค เคนเฅเคเคพเฅค เคเคธเคเคพ เคเคฆเฅเคฆเฅเคถเฅเคฏ เคเฅเคตเคฒ เคชเคพเคเคชเคฒเคพเคเคจ เคธเฅ เค
เคงเคฟเค เคเคคเคฟ เคชเฅเคฐเคพเคชเฅเคค เคเคฐเคจเฅ เคฎเฅเค เคเคชเคเฅ เคธเคนเคพเคฏเคคเคพ เคเคฐเคจเคพ เคนเฅเฅค
+
+เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคฌเฅเคเคฟเคเค เคเฅ เคเฅเค เคเคเคฟเคฒเคคเคพเคเค เคเฅ เคญเฅ เคเคฎ เคเคฐ เคธเคเคคเฅ เคนเฅเค เคเฅเคฏเฅเคเคเคฟ, เคเฅเค เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเฅ เคฒเคฟเค, เคเค เคเคเคฒ เคเคเคเคฎ (เคเฅเคธเฅ เคเค เคฒเคเคฌเฅ เคเคกเคฟเคฏเฅ เคซเคผเคพเคเคฒ) เคเฅ เคเค เคฎเฅเคกเคฒ เคฆเฅเคตเคพเคฐเคพ เคธเคเคธเคพเคงเคฟเคค เคเคฐเคจเฅ เคเฅ เคฒเคฟเค เคเค เคญเคพเคเฅเค เคฎเฅเค เคตเคฟเคญเคพเคเคฟเคค เคเคฐเคจเฅ เคเฅ เคเคตเคถเฅเคฏเคเคคเคพ เคนเฅเคคเฅ เคนเฅเฅค เคชเคพเคเคชเคฒเคพเคเคจ เคเคชเคเฅ เคฒเคฟเค เคฏเคน [*chunk batching*](./main_classes/pipelines#pipeline-chunk-batching) เคเคฐเคคเฅ เคนเฅเฅค
+
+### เคเคพเคฐเฅเคฏ เคตเคฟเคถเคฟเคทเฅเค เคชเฅเคฐเคพเคเคฒ
+
+เคธเคญเฅ เคเคพเคฐเฅเคฏ เคเคพเคฐเฅเคฏ เคตเคฟเคถเคฟเคทเฅเค เคชเฅเคฐเคพเคเคฒ เคชเฅเคฐเคฆเคพเคจ เคเคฐเคคเฅ เคนเฅเค เคเฅ เคเคชเคเฅ เค
เคชเคจเคพ เคเคพเคฎ เคชเฅเคฐเคพ เคเคฐเคจเฅ เคฎเฅเค เคฎเคฆเคฆ เคเคฐเคจเฅ เคเฅ เคฒเคฟเค เค
เคคเคฟเคฐเคฟเคเฅเคค เคฒเคเฅเคฒเฅเคชเคจ เคเคฐ เคตเคฟเคเคฒเฅเคชเฅเค เคเฅ เค
เคจเฅเคฎเคคเคฟ เคฆเฅเคคเฅ เคนเฅเคเฅค
+เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค, [`transformers.AutomaticSpeechRecognitionPipeline.__call__`] เคตเคฟเคงเคฟ เคฎเฅเค เคเค `return_timestamps` เคชเฅเคฐเคพเคเคฒ เคนเฅ เคเฅ เคตเฅเคกเคฟเคฏเฅ เคเคชเคถเฅเคฐเฅเคทเค เคเฅ เคฒเคฟเค เคเคถเคพเคเคจเค เคฒเคเคคเคพ เคนเฅ:
+
+
+```py
+>>> transcriber = pipeline(model="openai/whisper-large-v2", return_timestamps=True)
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.', 'chunks': [{'timestamp': (0.0, 11.88), 'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its'}, {'timestamp': (11.88, 12.38), 'text': ' creed.'}]}
+```
+
+เคเฅเคธเคพ เคเคฟ เคเคช เคฆเฅเค เคธเคเคคเฅ เคนเฅเค, เคฎเฅเคกเคฒ เคจเฅ เคชเคพเค เคเคพ เค
เคจเฅเคฎเคพเคจ เคฒเคเคพเคฏเคพ เคเคฐ **when** เคตเคฟเคญเคฟเคจเฅเคจ เคตเคพเคเฅเคฏเฅเค เคเคพ เคเคเฅเคเคพเคฐเคฃ เคเคฟเคฏเคพ เคเคฏเคพ เคคเฅ เคเคเคเคชเฅเค เคญเฅ เคฆเคฟเคฏเคพเฅค
+
+เคชเฅเคฐเคคเฅเคฏเฅเค เคเคพเคฐเฅเคฏ เคเฅ เคฒเคฟเค เคเค เคชเฅเคฐเคพเคเคฒ เคเคชเคฒเคฌเฅเคง เคนเฅเค, เคเคธเคฒเคฟเค เคฏเคน เคฆเฅเคเคจเฅ เคเฅ เคฒเคฟเค เคเคฟ เคเคช เคเคฟเคธเคเฅ เคธเคพเคฅ เคเฅเคกเคผเคเคพเคกเคผ เคเคฐ เคธเคเคคเฅ เคนเฅเค, เคชเฅเคฐเคคเฅเคฏเฅเค เคเคพเคฐเฅเคฏ เคเคพ API เคธเคเคฆเคฐเฅเคญ เคฆเฅเคเฅเค!
+เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค, [`~transformers.AutomaticSpeechRecognitionPipeline`] เคฎเฅเค เคเค `chunk_length_s` เคชเฅเคฐเคพเคเคฒ เคนเฅ เคเฅ เคธเคนเคพเคฏเค เคนเฅ
+เคตเคพเคธเฅเคคเคต เคฎเฅเค เคฒเคเคฌเฅ เคเคกเคฟเคฏเฅ เคซเคผเคพเคเคฒเฅเค เคชเคฐ เคเคพเคฎ เคเคฐเคจเฅ เคเฅ เคฒเคฟเค (เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค, เคธเคเคชเฅเคฐเฅเคฃ เคซเคฟเคฒเฅเคฎเฅเค เคฏเคพ เคเคเคเฅ-เคฒเคเคฌเฅ เคตเฅเคกเคฟเคฏเฅ เคเฅ เคเคชเคถเฅเคฐเฅเคทเค เคฆเฅเคจเคพ) เคเฅ เคเคฎเคคเฅเคฐ เคชเคฐ เคเค เคฎเฅเคกเคฒ เคนเฅเคคเคพ เคนเฅ
+เค
เคชเคจเฅ เคเคช เคธเคเคญเคพเคฒ เคจเคนเฅเค เคธเคเคคเคพ:
+
+```python
+>>> transcriber = pipeline(model="openai/whisper-large-v2", chunk_length_s=30, return_timestamps=True)
+>>> transcriber("https://huggingface.co/datasets/sanchit-gandhi/librispeech_long/resolve/main/audio.wav")
+{'text': " Chapter 16. I might have told you of the beginning of this liaison in a few lines, but I wanted you to see every step by which we came. I, too, agree to whatever Marguerite wished, Marguerite to be unable to live apart from me. It was the day after the evening...
+```
+
+เคฏเคฆเคฟ เคเคชเคเฅ เคเฅเค เคเคธเคพ เคชเฅเคฐเคพเคฎเฅเคเคฐ เคจเคนเฅเค เคฎเคฟเคฒ เคฐเคนเคพ เคนเฅ เคเฅ เคตเคพเคธเฅเคคเคต เคฎเฅเค เคเคชเคเฅ เคฎเคฆเคฆ เคเคฐเฅเคเคพ, เคคเฅ เคฌเฅเคเคฟเคเค [เค
เคจเฅเคฐเฅเคง เคเคฐเฅเค](https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml)!
+
+
+## เคกเฅเคเคพเคธเฅเค เคชเคฐ เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ
+
+เคชเคพเคเคชเคฒเคพเคเคจ เคฌเคกเคผเฅ เคกเฅเคเคพเคธเฅเค เคชเคฐ เคญเฅ เค
เคจเฅเคฎเคพเคจ เคเคฒเคพ เคธเคเคคเฅ เคนเฅเฅค เคเคธเคพ เคเคฐเคจเฅ เคเคพ เคธเคฌเคธเฅ เคเคธเคพเคจ เคคเคฐเฅเคเคพ เคนเคฎ เคเค เคชเฅเคจเคฐเคพเคตเคฐเฅเคคเค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเฅ เคเฅ เคธเคฒเคพเคน เคฆเฅเคคเฅ เคนเฅเค:
+
+```py
+def data():
+ for i in range(1000):
+ yield f"My example {i}"
+
+
+pipe = pipeline(model="openai-community/gpt2", device=0)
+generated_characters = 0
+for out in pipe(data()):
+ generated_characters += len(out[0]["generated_text"])
+```
+
+เคชเฅเคจเคฐเคพเคตเคฐเฅเคคเค `data()` เคชเฅเคฐเคคเฅเคฏเฅเค เคชเคฐเคฟเคฃเคพเคฎ เคเคฐ เคชเคพเคเคชเคฒเคพเคเคจ เคธเฅเคตเคเคพเคฒเคฟเคค เคฐเฅเคช เคธเฅ เคเคคเฅเคชเคจเฅเคจ เคเคฐเคคเคพ เคนเฅ
+เคชเคนเคเคพเคจเคคเคพ เคนเฅ เคเคฟ เคเคจเคชเฅเค เคชเฅเคจเคฐเคพเคตเคฐเฅเคคเคจเฅเคฏ เคนเฅ เคเคฐ เคกเฅเคเคพ เคชเฅเคฐเคพเคชเฅเคค เคเคฐเคจเคพ เคถเฅเคฐเฅ เคเคฐ เคฆเฅเคเคพ
+เคฏเคน เคเคธเฅ GPU เคชเคฐ เคชเฅเคฐเฅเคธเฅเคธ เคเคฐเคจเคพ เคเคพเคฐเฅ เคฐเคเคคเคพ เคนเฅ (เคฏเคน เคนเฅเคก เคเฅ เคคเคนเคค [DataLoader](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader) เคเคพ เคเคชเคฏเฅเค เคเคฐเคคเคพ เคนเฅ)เฅค
+เคฏเคน เคฎเคนเคคเฅเคตเคชเฅเคฐเฅเคฃ เคนเฅ เคเฅเคฏเฅเคเคเคฟ เคเคชเคเฅ เคธเคเคชเฅเคฐเฅเคฃ เคกเฅเคเคพเคธเฅเค เคเฅ เคฒเคฟเค เคฎเฅเคฎเฅเคฐเฅ เคเคตเคเคเคฟเคค เคเคฐเคจเฅ เคเฅ เคเคตเคถเฅเคฏเคเคคเคพ เคจเคนเฅเค เคนเฅ
+เคเคฐ เคเคช เคเคฟเคคเคจเฅ เคเคฒเฅเคฆเฅ เคนเฅ เคธเคเฅ GPU เคเฅ เคซเฅเคก เคเคฐ เคธเคเคคเฅ เคนเฅเคเฅค
+
+เคเฅเคเคเคฟ เคฌเฅเคเคฟเคเค เคธเฅ เคเฅเคเคผเฅเค เคคเฅเคเคผ เคนเฅ เคธเคเคคเฅ เคนเฅเค, เคเคธเคฒเคฟเค เคฏเคนเคพเค `batch_size` เคชเฅเคฐเคพเคเคฒ เคเฅ เคเฅเคฏเฅเคจ เคเคฐเคจเฅ เคเคพ เคชเฅเคฐเคฏเคพเคธ เคเคฐเคจเคพ เคเคชเคฏเฅเคเฅ เคนเฅ เคธเคเคคเคพ เคนเฅเฅค
+
+เคเคฟเคธเฅ เคกเฅเคเคพเคธเฅเค เคชเคฐ เคชเฅเคจเคฐเคพเคตเฅเคคเคฟ เคเคฐเคจเฅ เคเคพ เคธเคฌเคธเฅ เคธเคฐเคฒ เคคเคฐเฅเคเคพ เคฌเคธ เคเค เคเฅ ๐ค [Dataset](https://github.com/huggingface/datasets/) เคธเฅ เคฒเฅเคก เคเคฐเคจเคพ เคนเฅ:
+
+```py
+# KeyDataset is a util that will just output the item we're interested in.
+from transformers.pipelines.pt_utils import KeyDataset
+from datasets import load_dataset
+
+pipe = pipeline(model="hf-internal-testing/tiny-random-wav2vec2", device=0)
+dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:10]")
+
+for out in pipe(KeyDataset(dataset, "audio")):
+ print(out)
+```
+
+
+## เคตเฅเคฌเคธเคฐเฅเคตเคฐ เคเฅ เคฒเคฟเค เคชเคพเคเคชเคฒเคพเคเคจเฅเค เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ
+
+
+เคเค เค
เคจเฅเคฎเคพเคจ เคเคเคเคจ เคฌเคจเคพเคจเคพ เคเค เคเคเคฟเคฒ เคตเคฟเคทเคฏ เคนเฅ เคเฅ เค
เคชเคจเฅ เคเคช เคฎเฅเค เคเคชเคฏเฅเคเฅเคค เคนเฅ
+เคชเฅเคทเฅเค เฅค
+
+
+[Link](./pipeline_webserver)
+
+## เคตเคฟเคเคผเคจ เคชเคพเคเคชเคฒเคพเคเคจ
+
+เคฆเฅเคทเฅเคเคฟ เคเคพเคฐเฅเคฏเฅเค เคเฅ เคฒเคฟเค [`pipeline`] เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ เคตเฅเคฏเคพเคตเคนเคพเคฐเคฟเค เคฐเฅเคช เคธเฅ เคธเคฎเคพเคจ เคนเฅเฅค
+
+เค
เคชเคจเคพ เคเคพเคฐเฅเคฏ เคจเคฟเคฐเฅเคฆเคฟเคทเฅเค เคเคฐเฅเค เคเคฐ เค
เคชเคจเฅ เคเคตเคฟ เคเฅเคฒเคพเคธเคฟเคซเคพเคฏเคฐเคฟเคฏเคฐ เคเฅ เคญเฅเคเฅเคเฅค เคเคตเคฟ เคเค เคฒเคฟเคเค, เคเค เคธเฅเคฅเคพเคจเฅเคฏ เคชเคฅ เคฏเคพ เคฌเฅเคธ64-เคเคจเฅเคเฅเคกเฅเคก เคเคตเคฟ เคนเฅ เคธเคเคคเฅ เคนเฅเฅค เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค, เคฌเคฟเคฒเฅเคฒเฅ เคเฅ เคเฅเคจ เคธเฅ เคชเฅเคฐเคเคพเคคเคฟ เคจเฅเคเฅ เคฆเคฟเคเคพเค เคเค เคนเฅ?
+
+
+
+```py
+>>> from transformers import pipeline
+
+>>> vision_classifier = pipeline(model="google/vit-base-patch16-224")
+>>> preds = vision_classifier(
+... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]
+```
+
+## เคชเคพเค เคชเคพเคเคชเคฒเคพเคเคจ
+
+NLP เคเคพเคฐเฅเคฏเฅเค เคเฅ เคฒเคฟเค [`pipeline`] เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ เคตเฅเคฏเคพเคตเคนเคพเคฐเคฟเค เคฐเฅเคช เคธเฅ เคธเคฎเคพเคจ เคนเฅเฅค
+
+```py
+>>> from transformers import pipeline
+
+>>> # This model is a `zero-shot-classification` model.
+>>> # It will classify text, except you are free to choose any label you might imagine
+>>> classifier = pipeline(model="facebook/bart-large-mnli")
+>>> classifier(
+... "I have a problem with my iphone that needs to be resolved asap!!",
+... candidate_labels=["urgent", "not urgent", "phone", "tablet", "computer"],
+... )
+{'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}
+```
+
+## เคฌเคนเฅเคตเคฟเคง เคชเคพเคเคชเคฒเคพเคเคจ
+
+[`pipeline`] เคเค เคธเฅ เค
เคงเคฟเค เคคเฅเคฐ-เคคเคฐเฅเคเฅเค เคเคพ เคธเคฎเคฐเฅเคฅเคจ เคเคฐเคคเฅ เคนเฅเฅค เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค, เคเค เคฆเฅเคถเฅเคฏ เคชเฅเคฐเคถเฅเคจ เคเคคเฅเคคเคฐ (VQA) เคเคพเคฐเฅเคฏ เคชเคพเค เคเคฐ เคเคตเคฟ เคเฅ เคเฅเคกเคผเคคเคพ เคนเฅเฅค เค
เคชเคจเฅ เคชเคธเคเคฆ เคเฅ เคเคฟเคธเฅ เคญเฅ เคเคตเคฟ เคฒเคฟเคเค เคเคฐ เคเคตเคฟ เคเฅ เคฌเคพเคฐเฅ เคฎเฅเค เคเฅเค เคชเฅเคฐเคถเฅเคจ เคชเฅเคเคจเฅ เคเฅ เคฒเคฟเค เคธเฅเคตเคคเคเคคเฅเคฐ เคฎเคนเคธเฅเคธ เคเคฐเฅเคเฅค เคเคตเคฟ เคเค URL เคฏเคพ เคเคตเคฟ เคเคพ เคธเฅเคฅเคพเคจเฅเคฏ เคชเคฅ เคนเฅ เคธเคเคคเฅ เคนเฅเฅค
+
+เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค, เคฏเคฆเคฟ เคเคช เคเคธ [invoice image](https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png) เคเคพ เคเคชเคฏเฅเค เคเคฐเคคเฅ เคนเฅเค:
+
+```py
+>>> from transformers import pipeline
+
+>>> vqa = pipeline(model="impira/layoutlm-document-qa")
+>>> output = vqa(
+... image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png",
+... question="What is the invoice number?",
+... )
+>>> output[0]["score"] = round(output[0]["score"], 3)
+>>> output
+[{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]
+```
+
+
+
+เคเคชเคฐ เคฆเคฟเค เคเค เคเคฆเคพเคนเคฐเคฃ เคเฅ เคเคฒเคพเคจเฅ เคเฅ เคฒเคฟเค เคเคชเคเฅ ๐ค เคเฅเคฐเคพเคเคธเคซเฅเคฐเฅเคฎเคฐ เคเฅ เค
เคฒเคพเคตเคพ [`pytesseract`](https://pypi.org/project/pytesseract/) เคเคเคธเฅเคเฅเคฒ เคเคฐเคจเคพ เคนเฅเคเคพ:
+
+```bash
+sudo apt install -y tesseract-ocr
+pip install pytesseract
+```
+
+
+
+## ๐ค `เคคเฅเคตเคฐเคฃ` เคเฅ เคธเคพเคฅ เคฌเคกเคผเฅ เคฎเฅเคกเคฒเฅเค เคชเคฐ `pipeline` เคเคพ เคเคชเคฏเฅเค เคเคฐเคจเคพ:
+
+เคเคช ๐ค `accelerate` เคเคพ เคเคชเคฏเฅเค เคเคฐเคเฅ เคฌเคกเคผเฅ เคฎเฅเคกเคฒเฅเค เคชเคฐ เคเคธเคพเคจเฅ เคธเฅ `pipeline` เคเคฒเคพ เคธเคเคคเฅ เคนเฅเค! เคชเคนเคฒเฅ เคธเฅเคจเคฟเคถเฅเคเคฟเคค เคเคฐเฅเค เคเคฟ เคเคชเคจเฅ `accelerate` เคเฅ `pip install accelerate` เคเฅ เคธเคพเคฅ เคเคเคธเฅเคเฅเคฒ เคเคฟเคฏเคพ เคนเฅเฅค
+
+เคธเคฌเคธเฅ เคชเคนเคฒเฅ `device_map='auto'` เคเคพ เคเคชเคฏเฅเค เคเคฐเคเฅ เค
เคชเคจเคพ เคฎเฅเคกเคฒ เคฒเฅเคก เคเคฐเฅเค! เคนเคฎ เค
เคชเคจเฅ เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค `facebook/opt-1.3b` เคเคพ เคเคชเคฏเฅเค เคเคฐเฅเคเคเฅเฅค
+
+```py
+# pip install accelerate
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", torch_dtype=torch.bfloat16, device_map="auto")
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+เคฏเคฆเคฟ เคเคช `bitsandbytes` เคเคเคธเฅเคเฅเคฒ เคเคฐเคคเฅ เคนเฅเค เคเคฐ `load_in_8bit=True` เคคเคฐเฅเค เคเฅเคกเคผเคคเฅ เคนเฅเค เคคเฅ เคเคช 8-เคฌเคฟเค เคฒเฅเคกเฅเคก เคฎเฅเคกเคฒ เคญเฅ เคชเคพเคธ เคเคฐ เคธเคเคคเฅ เคนเฅเค
+
+```py
+# pip install accelerate bitsandbytes
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", device_map="auto", model_kwargs={"load_in_8bit": True})
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+เคงเฅเคฏเคพเคจ เคฆเฅเค เคเคฟ เคเคช เคเฅเคเคชเฅเคเคเค เคเฅ เคเคฟเคธเฅ เคญเฅ เคนเคเคฟเคเค เคซเฅเคธ เคฎเฅเคกเคฒ เคธเฅ เคฌเคฆเคฒ เคธเคเคคเฅ เคนเฅเค เคเฅ BLOOM เคเฅเคธเฅ เคฌเคกเคผเฅ เคฎเฅเคกเคฒ เคฒเฅเคกเคฟเคเค เคเคพ เคธเคฎเคฐเฅเคฅเคจ เคเคฐเคคเคพ เคนเฅ!
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/tflite.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/tflite.md
new file mode 100644
index 0000000000000000000000000000000000000000..5a84bed94266db0de5e8fa81cfcd7c1cb2a5b643
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/hi/tflite.md
@@ -0,0 +1,55 @@
+
+
+# TFLite เคฎเฅเค เคจเคฟเคฐเฅเคฏเคพเคค เคเคฐเฅเค
+
+[TensorFlow Lite](https://www.tensorflow.org/lite/guide) เคเค เคนเคฒเฅเคเคพ เคขเคพเคเคเคพ เคนเฅ เคเฅ เคฎเคถเฅเคจ เคฒเคฐเฅเคจเคฟเคเค เคฎเฅเคกเคฒ เคเฅ เคธเคเคธเคพเคงเคจ-เคธเฅเคฎเคฟเคค เคเคชเคเคฐเคฃเฅเค, เคเฅเคธเฅ เคฎเฅเคฌเคพเคเคฒ เคซเฅเคจ, เคเคฎเฅเคฌเฅเคกเฅเคก เคธเคฟเคธเฅเคเคฎ เคเคฐ เคเคเคเคฐเคจเฅเค เคเคซ เคฅเคฟเคเคเฅเคธ (IoT) เคเคชเคเคฐเคฃเฅเค เคชเคฐ เคคเฅเคจเคพเคค เคเคฐเคจเฅ เคเฅ เคฒเคฟเค เคนเฅเฅค TFLite เคเฅ เคเคจ เคเคชเคเคฐเคฃเฅเค เคชเคฐ เคธเฅเคฎเคฟเคค เคเคฃเคจเคพเคคเฅเคฎเค เคถเคเฅเคคเคฟ, เคฎเฅเคฎเฅเคฐเฅ เคเคฐ เคเคฐเฅเคเคพ เคเคชเคค เคเฅ เคธเคพเคฅ เคฎเฅเคกเคฒ เคเฅ เคเฅเคถเคฒเคคเคพ เคธเฅ เคเคชเฅเคเคฟเคฎเคพเคเคเคผ เคเคฐ เคเคฒเคพเคจเฅ เคเฅ เคฒเคฟเค เคกเคฟเคเคผเคพเคเคจ เคเคฟเคฏเคพ เคเคฏเคพ เคนเฅเฅค เคเค TensorFlow Lite เคฎเฅเคกเคฒ เคเฅ เคเค เคตเคฟเคถเฅเคท เคเฅเคถเคฒ เคชเฅเคฐเฅเคเฅเคฌเคฒ เคชเฅเคฐเคพเคฐเฅเคช เคฎเฅเค เคฆเคฐเฅเคถเคพเคฏเคพ เคเคพเคคเคพ เคนเฅ เคเคฟเคธเฅ `.tflite` เคซเคผเคพเคเคฒ เคเคเฅเคธเคเฅเคเคถเคจ เคฆเฅเคตเคพเคฐเคพ เคชเคนเคเคพเคจเคพ เคเคพเคคเคพ เคนเฅเฅค
+
+๐ค Optimum เคฎเฅเค `exporters.tflite` เคฎเฅเคกเฅเคฏเฅเคฒ เคเฅ เคฎเคพเคงเฅเคฏเคฎ เคธเฅ ๐ค Transformers เคฎเฅเคกเคฒ เคเฅ TFLite เคฎเฅเค เคจเคฟเคฐเฅเคฏเคพเคค เคเคฐเคจเฅ เคเฅ เคเคพเคฐเฅเคฏเคเฅเคทเคฎเคคเคพ เคนเฅเฅค เคธเคฎเคฐเฅเคฅเคฟเคค เคฎเฅเคกเคฒ เคเคฐเฅเคเคฟเคเฅเคเฅเคเคฐ เคเฅ เคธเฅเคเฅ เคเฅ เคฒเคฟเค, เคเฅเคชเคฏเคพ [๐ค Optimum เคฆเคธเฅเคคเคพเคตเฅเคเคผ](https://huggingface.co/docs/optimum/exporters/tflite/overview) เคฆเฅเคเฅเคเฅค
+
+TFLite เคฎเฅเค เคเค เคฎเฅเคกเคฒ เคจเคฟเคฐเฅเคฏเคพเคค เคเคฐเคจเฅ เคเฅ เคฒเคฟเค, เคเคตเคถเฅเคฏเค เคจเคฟเคฐเฅเคญเคฐเคคเคพเคเค เคธเฅเคฅเคพเคชเคฟเคค เคเคฐเฅเค:
+
+```bash
+pip install optimum[exporters-tf]
+```
+
+เคธเคญเฅ เคเคชเคฒเคฌเฅเคง เคคเคฐเฅเคเฅเค เคเฅ เคเคพเคเค เคเคฐเคจเฅ เคเฅ เคฒเคฟเค, [๐ค Optimum เคฆเคธเฅเคคเคพเคตเฅเคเคผ](https://huggingface.co/docs/optimum/main/en/exporters/tflite/usage_guides/export_a_model) เคฆเฅเคเฅเค,
+เคฏเคพ เคเคฎเคพเคเคก เคฒเคพเคเคจ เคฎเฅเค เคฎเคฆเคฆ เคฆเฅเคเฅเค:
+
+```bash
+optimum-cli export tflite --help
+```
+
+เคฏเคฆเคฟ เคเคช ๐ค Hub เคธเฅ เคเค เคฎเฅเคกเคฒ เคเคพ เคเฅเคเคชเฅเคเคเค เคจเคฟเคฐเฅเคฏเคพเคค เคเคฐเคจเคพ เคเคพเคนเคคเฅ เคนเฅเค, เคเคฆเคพเคนเคฐเคฃ เคเฅ เคฒเคฟเค, `google-bert/bert-base-uncased`, เคจเคฟเคฎเฅเคจเคฒเคฟเคเคฟเคค เคเคฎเคพเคเคก เคเคฒเคพเคเค:
+
+```bash
+optimum-cli export tflite --model google-bert/bert-base-uncased --sequence_length 128 bert_tflite/
+```
+
+เคเคชเคเฅ เคชเฅเคฐเคเคคเคฟ เคเฅ เคฆเคฐเฅเคถเคพเคคเฅ เคนเฅเค เคฒเฅเค เคฆเคฟเคเคพเค เคฆเฅเคเคเฅ เคเคฐ เคฏเคน เคฆเคฟเคเคพเคเคเคเฅ เคเคฟ เคชเคฐเคฟเคฃเคพเคฎเคธเฅเคตเคฐเฅเคช `model.tflite` เคเคนเคพเค เคธเคนเฅเคเคพ เคเคฏเคพ เคนเฅ, เคเฅเคธเฅ:
+
+```bash
+Validating TFLite model...
+ -[โ] TFLite model output names match reference model (logits)
+ - Validating TFLite Model output "logits":
+ -[โ] (1, 128, 30522) matches (1, 128, 30522)
+ -[x] values not close enough, max diff: 5.817413330078125e-05 (atol: 1e-05)
+The TensorFlow Lite export succeeded with the warning: The maximum absolute difference between the output of the reference model and the TFLite exported model is not within the set tolerance 1e-05:
+- logits: max diff = 5.817413330078125e-05.
+ The exported model was saved at: bert_tflite
+```
+
+เคเคชเคฐเฅเคเฅเคค เคเคฆเคพเคนเคฐเคฃ ๐ค Hub เคธเฅ เคเค เคเฅเคเคชเฅเคเคเค เคจเคฟเคฐเฅเคฏเคพเคค เคเคฐเคจเฅ เคเฅ เคฆเคฐเฅเคถเคพเคคเคพ เคนเฅเฅค เคเคฌ เคเค เคธเฅเคฅเคพเคจเฅเคฏ เคฎเฅเคกเคฒ เคจเคฟเคฐเฅเคฏเคพเคค เคเคฐเคคเฅ เคนเฅเค, เคคเฅ เคชเคนเคฒเฅ เคธเฅเคจเคฟเคถเฅเคเคฟเคค เคเคฐเฅเค เคเคฟ เคเคชเคจเฅ เคฎเฅเคกเคฒ เคเฅ เคตเคเคผเคจ เคเคฐ เคเฅเคเคจเคพเคเคเคผเคฐ เคซเคผเคพเคเคฒเฅเค เคเฅ เคเค เคนเฅ เคจเคฟเคฐเฅเคฆเฅเคถเคฟเคเคพ (`local_path`) เคฎเฅเค เคธเคนเฅเคเคพ เคนเฅเฅค CLI เคเคพ เคเคชเคฏเฅเค เคเคฐเคคเฅ เคธเคฎเคฏ, เคเฅเคเคชเฅเคเคเค เคจเคพเคฎ เคเฅ เคฌเคเคพเคฏ `model` เคคเคฐเฅเค เคฎเฅเค `local_path` เคชเคพเคธ เคเคฐเฅเคเฅค
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/_config.py b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/_config.py
new file mode 100644
index 0000000000000000000000000000000000000000..72b362f9a7230a3aa8fa5ef72747bf56cec5f6b8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/_config.py
@@ -0,0 +1,15 @@
+# docstyle-ignore
+INSTALL_CONTENT = """
+# Installazione di Transformers
+! pip install transformers datasets evaluate accelerate
+# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e
+# rimuovi la modalitร commento al comando seguente.
+# ! pip install git+https://github.com/huggingface/transformers.git
+"""
+
+notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
+black_avoid_patterns = {
+ "{processor_class}": "FakeProcessorClass",
+ "{model_class}": "FakeModelClass",
+ "{object_class}": "FakeObjectClass",
+}
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/_toctree.yml b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/_toctree.yml
new file mode 100644
index 0000000000000000000000000000000000000000..47d90f9a9a85c985d2233a61e1eac1f398536272
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/_toctree.yml
@@ -0,0 +1,71 @@
+- sections:
+ - local: index
+ title: ๐ค Transformers
+ - local: quicktour
+ title: Tour rapido
+ - local: installation
+ title: Installazione
+ title: Iniziare
+- sections:
+ - local: pipeline_tutorial
+ title: Pipeline per l'inferenza
+ - local: autoclass_tutorial
+ title: Carica istanze pre-allenate con AutoClass
+ - local: preprocessing
+ title: Preprocess
+ - local: training
+ title: Fine-tuning di un modello pre-addestrato
+ - local: accelerate
+ title: Allenamento distribuito con ๐ค Accelerate
+ - local: model_sharing
+ title: Condividere un modello
+ title: Esercitazione
+- sections:
+ - local: create_a_model
+ title: Crea un'architettura personalizzata
+ - local: custom_models
+ title: Condividere modelli personalizzati
+ - local: run_scripts
+ title: Addestramento con script
+ - local: multilingual
+ title: Modelli multilingua per l'inferenza
+ - local: converting_tensorflow_models
+ title: Convertire modelli tensorflow
+ - local: serialization
+ title: Esporta modelli Transformers
+ - local: perf_train_cpu
+ title: Addestramento efficiente su CPU
+ - local: perf_train_cpu_many
+ title: Addestramento efficiente su multiple CPU
+ - local: perf_train_tpu
+ title: Addestramento su TPU
+ - local: perf_train_special
+ title: Addestramento su Hardware Specializzato
+ - local: perf_infer_cpu
+ title: Inferenza Efficiente su CPU
+ - local: perf_infer_gpu_one
+ title: Inferenza su una GPU
+ - local: perf_infer_gpu_many
+ title: Inferenza Efficiente su GPU Multiple
+ - local: perf_infer_special
+ title: Inferenza su Hardware Specializzato
+ - local: big_models
+ title: Istanziare un big model
+ - local: migration
+ title: Passaggio da pacchetti precedenti
+ - local: debugging
+ title: Debugging
+ title: Guide pratiche
+- sections:
+ - local: add_new_pipeline
+ title: Come aggiungere una pipeline a ๐ค Transformers?
+ - local: add_new_model
+ title: Come aggiungere un modello a ๐ค Transformers?
+ - local: perf_hardware
+ title: Hardware ottimizzato per l'addestramento
+ - local: community
+ title: Risorse della comunitร
+ - local: pr_checks
+ title: Controlli su una Pull Request
+ title: Guide How-to
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/accelerate.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/accelerate.md
new file mode 100644
index 0000000000000000000000000000000000000000..3114613a9a7994c0c326b5deb6da428f5be9ab3a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/accelerate.md
@@ -0,0 +1,136 @@
+
+
+# Allenamento distribuito con ๐ค Accelerate
+
+La parallelizzazione รจ emersa come strategia per allenare modelli sempre piรน grandi su hardware limitato e accelerarne la velocitร di allenamento di diversi ordini di magnitudine. In Hugging Face, abbiamo creato la libreria [๐ค Accelerate](https://huggingface.co/docs/accelerate) per aiutarti ad allenare in modo semplice un modello ๐ค Transformers su qualsiasi tipo di configurazione distribuita, sia che si tratti di piรน GPU su una sola macchina o di piรน GPU su piรน macchine. In questo tutorial, imparerai come personalizzare il training loop nativo di PyTorch per consentire l'addestramento in un ambiente distribuito.
+
+## Configurazione
+
+Inizia installando ๐ค Accelerate:
+
+```bash
+pip install accelerate
+```
+
+Poi importa e crea un oggetto [`Accelerator`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator). `Accelerator` rileverร automaticamente il tuo setup distribuito e inizializzerร tutte le componenti necessarie per l'allenamento. Non dovrai allocare esplicitamente il tuo modello su un device.
+
+```py
+>>> from accelerate import Accelerator
+
+>>> accelerator = Accelerator()
+```
+
+## Preparati ad accelerare
+
+Il prossimo passo รจ quello di passare tutti gli oggetti rilevanti per l'allenamento al metodo [`prepare`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator.prepare). Questo include i tuoi DataLoaders per l'allenamento e per la valutazione, un modello e un ottimizzatore:
+
+```py
+>>> train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
+... train_dataloader, eval_dataloader, model, optimizer
+... )
+```
+
+## Backward
+
+Infine, sostituisci il tipico metodo `loss.backward()` nel tuo loop di allenamento con il metodo [`backward`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator.backward) di ๐ค Accelerate:
+
+```py
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... outputs = model(**batch)
+... loss = outputs.loss
+... accelerator.backward(loss)
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+Come puoi vedere nel seguente codice, hai solo bisogno di aggiungere quattro righe in piรน di codice al tuo training loop per abilitare l'allenamento distribuito!
+
+```diff
++ from accelerate import Accelerator
+ from transformers import AdamW, AutoModelForSequenceClassification, get_scheduler
+
++ accelerator = Accelerator()
+
+ model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
+ optimizer = AdamW(model.parameters(), lr=3e-5)
+
+- device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+- model.to(device)
+
++ train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
++ train_dataloader, eval_dataloader, model, optimizer
++ )
+
+ num_epochs = 3
+ num_training_steps = num_epochs * len(train_dataloader)
+ lr_scheduler = get_scheduler(
+ "linear",
+ optimizer=optimizer,
+ num_warmup_steps=0,
+ num_training_steps=num_training_steps
+ )
+
+ progress_bar = tqdm(range(num_training_steps))
+
+ model.train()
+ for epoch in range(num_epochs):
+ for batch in train_dataloader:
+- batch = {k: v.to(device) for k, v in batch.items()}
+ outputs = model(**batch)
+ loss = outputs.loss
+- loss.backward()
++ accelerator.backward(loss)
+
+ optimizer.step()
+ lr_scheduler.step()
+ optimizer.zero_grad()
+ progress_bar.update(1)
+```
+
+## Allenamento
+
+Una volta che hai aggiunto le righe di codice rilevanti, lancia il tuo allenamento in uno script o in un notebook come Colaboratory.
+
+### Allenamento con uno script
+
+Se stai eseguendo il tuo allenamento da uno script, esegui il comando seguente per creare e salvare un file di configurazione:
+
+```bash
+accelerate config
+```
+
+Poi lancia il tuo allenamento con:
+
+```bash
+accelerate launch train.py
+```
+
+### Allenamento con un notebook
+
+La libreria ๐ค Accelerate puรฒ anche essere utilizzata in un notebook se stai pianificando di utilizzare le TPU di Colaboratory. Inserisci tutto il codice legato all'allenamento in una funzione, e passala al `notebook_launcher`:
+
+```py
+>>> from accelerate import notebook_launcher
+
+>>> notebook_launcher(training_function)
+```
+
+Per maggiori informazioni relative a ๐ค Accelerate e le sue numerose funzionalitร , fai riferimento alla [documentazione](https://huggingface.co/docs/accelerate).
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/add_new_model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/add_new_model.md
new file mode 100644
index 0000000000000000000000000000000000000000..9403aa46a2183bfcffa555d9804045eb0e028d9d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/add_new_model.md
@@ -0,0 +1,780 @@
+
+
+# Come aggiungere un modello a ๐ค Transformers?
+
+Aggiungere un nuovo modello รฉ spesso difficile e richiede una profonda conoscenza della libreria ๐ค Transformers e anche
+della repository originale del modello. A Hugging Face cerchiamo di dare alla community sempre piรบ poteri per aggiungere
+modelli independentemente. Quindi, per alcuni nuovi modelli che la community vuole aggiungere a ๐ค Transformers, abbiamo
+creato una specifica *call-for-model-addition* che spiega passo dopo passo come aggiungere il modello richiesto. Con
+questo *call-for-model-addition* vogliamo insegnare a volenterosi e esperti collaboratori della community come implementare
+un modello in ๐ค Transformers.
+
+Se questo รฉ qualcosa che puรฒ interessarvi, siete liberi di controllare l'attuale โcalls-for-model-additionโ [qui](https://github.com/huggingface/transformers/tree/main/templates/adding_a_new_model/open_model_proposals/README.md)
+e contattarci.
+
+Se il modello sarร selezionato, allora potrete lavorare insieme a un membro di Hugging Face per integrare il modello in ๐ค
+Transformers. Cosรฌ facendo, ci guadagnerai in una comprensione totale, sia teorica che pratica, del modello proposto. Inoltre,
+sarai l'artefice di un importante contributo open-source a ๐ค Transformers. Durante l'implementazione avrai l'opportunitร di:
+
+- ottenere piรน comprensione delle best practices in open-source
+- capire i principi di design di una della librerie NLP piรน popolari
+- capire come efficientemente testare complessi modelli NLP
+- capire come integrare utilit Python come `black`, `ruff`, `make fix-copies` in una libreria per garantire sempre di avere un codice leggibile e pulito
+
+Siamo anche contenti se vuoi aggiungere un modello che non puรฒ essere trovato nella cartella โcalls-for-model-additionโ.
+Le seguenti sezioni spiegano in dettaglio come aggiungere un nuovo modello. Puรฒ anche essere molto utile controllare modelli
+giร aggiunti [qui](https://github.com/huggingface/transformers/pulls?q=is%3Apr+label%3A%22PR+for+Model+Addition%22+is%3Aclosed),
+per capire se richiamano il modello che vorreste aggiungere.
+
+Per cominciare, vediamo una panoramica general della libreria Transformers.
+
+## Panoramica generale su ๐ค Transformers
+
+Prima di tutto, vediamo in generale ๐ค Transformers. ๐ค Transformers รฉ una libreria molto strutturata, quindi
+puร essere che a volte ci sia un disaccordo con alcune filosofie della libreria o scelte di design. Dalla nostra esperienza,
+tuttavia, abbiamo trovato che le scelte fondamentali di design della libreria sono cruciali per usare ๐ค Transformers efficacemente
+su larga scala, mantenendo i costi a un livello accettabile.
+
+Un buon primo punto di partenza per capire al meglio la libreria รฉ leggere la [documentazione sulla nostra filosofia](filosofia)
+Da qui, ci sono alcune scelte sul modo di lavorare che cerchiamo di applicare a tutti i modelli:
+
+- La composizione รฉ generalmente favorita sulla sovra-astrazione
+- Duplicare il codice non รฉ sempre male, soprattutto se migliora notevolmente la leggibilitร e accessibilitร del modello
+- Tutti i files creati per il nuovo modello devono il piu possibile "compatti". Questo vuol dire che quando qualcuno leggerรก il codice
+di uno specifico modello, potrรก vedere solo il corrispettivo file `modeling_....py` senza avere multiple dipendenze.
+
+
+La cosa piรบ importante, รฉ che consideriamo la libreria non solo un mezzo per dare un prodotto, *per esempio* dare la possibilitร
+di usare BERT per inferenza, ma รฉ anche il prodotto reale che noi vogliamo migliorare sempre piรน. Quindi, quando aggiungi
+un modello, non sei solo la persona che userร il modello, ma rappresenti anche tutti coloro che leggeranno,
+cercheranno di capire e modificare il tuo modello.
+
+Tenendo questi principi in mente, immergiamoci nel design generale della libreria.
+
+### Panoramica sui modelli
+
+Per aggiungere con successo un modello, รฉ importante capire l'interazione tra il tuo modello e la sua configurazione,
+[`PreTrainedModel`], e [`PretrainedConfig`]. Per dare un esempio, chiameremo il modello da aggiungere a ๐ค Transformers
+`BrandNewBert`.
+
+Diamo un'occhiata:
+
+
+
+Come potete vedere, ci basiamo sull'ereditarietร in ๐ค Transformers, tenendo perรฒ il livello di astrazione a un minimo
+assoluto. Non ci sono mai piรน di due livelli di astrazione per ogni modello nella libreria. `BrandNewBertModel` eredita
+da `BrandNewBertPreTrainedModel` che, a sua volta, eredita da [`PreTrainedModel`] - semplice no?
+Come regola generale, vogliamo essere sicuri che un nuovo modello dipenda solo da [`PreTrainedModel`]. Le funzionalitร
+importanti che sono automaticamente conferite a ogni nuovo modello sono [`~PreTrainedModel.from_pretrained`]
+e [`~PreTrainedModel.save_pretrained`], che sono usate per serializzazione e deserializzazione. Tutte le altre importanti
+funzionalitร , come ad esempio `BrandNewBertModel.forward` devono essere definite completamente nel nuovo script
+`modeling_brand_new_bert.py`. Inoltre, vogliamo essere sicuri che un modello con uno specifico head layer, come
+`BrandNewBertForMaskedLM` non erediti da `BrandNewBertModel`, ma piuttosto usi `BrandNewBertModel`
+come componente che puรฒ essere chiamata nel passaggio forward per mantenere il livello di astrazione basso. Ogni
+nuovo modello richieste una classe di configurazione, chiamata `BrandNewBertConfig`. Questa configurazione รฉ sempre
+mantenuta come un attributo in [`PreTrainedModel`], e quindi puรฒ essere accessibile tramite l'attributo `config`
+per tutte le classi che ereditano da `BrandNewBertPreTrainedModel`:
+
+```python
+model = BrandNewBertModel.from_pretrained("brandy/brand_new_bert")
+model.config # il modello ha accesso al suo config
+```
+
+Analogamente al modello, la configurazione eredita le funzionalitร base di serializzazione e deserializzazione da
+[`PretrainedConfig`]. ร da notare che la configurazione e il modello sono sempre serializzati in due formati differenti -
+il modello รฉ serializzato in un file *pytorch_model.bin* mentre la configurazione con *config.json*. Chiamando
+[`~PreTrainedModel.save_pretrained`] automaticamente chiamerร [`~PretrainedConfig.save_pretrained`], cosicchรฉ sia il
+modello che la configurazione siano salvati.
+
+
+### Stile per il codice
+
+Quando codifichi un nuovo modello, tieni presente che Transformers ha una sua struttura di fondo come libreria, perciรฒ
+ci sono alcuni fatti da considerare su come scrivere un codice :-)
+
+1. Il forward pass del tuo modello dev'essere scritto completamente nel file del modello, mentre dev'essere indipendente
+ da altri modelli nella libreria. Se vuoi riutilizzare un blocco di codice da un altro modello, copia e incolla il codice con un commento `# Copied from` in cima al codice (guarda [qui](https://github.com/huggingface/transformers/blob/v4.17.0/src/transformers/models/roberta/modeling_roberta.py#L160)
+ per un ottimo esempio).
+2. Il codice dev'essere interamente comprensibile, anche da persone che non parlano in inglese. Questo significa che le
+ variabili devono avere un nome descrittivo e bisogna evitare abbreviazioni. Per esempio, `activation` รฉ molto meglio
+ che `act`. Le variabili con una lettera sono da evitare fortemente, almeno che non sia per un indce in un for loop.
+3. Generamente รฉ meglio avere un codice esplicito e piรบ lungo che un codice corto e magico.
+4. Evita di subclassare `nn.Sequential` in Pytorch, puoi subclassare `nn.Module` e scrivere il forward pass, cosicchรฉ
+ chiunque puรฒ effettuare debug sul tuo codice, aggiungendo print o breaking points.
+5. La tua function-signature dev'essere type-annoted. Per il resto, รฉ meglio preferire variabili con un nome accettabile
+ piuttosto che annotazioni per aumentare la comprensione e leggibilitร del codice.
+
+### Panoramica sui tokenizers
+
+Questa sezione sarร creata al piu presto :-(
+
+## Aggiungere un modello a ๐ค Transformers passo dopo passo
+
+Ci sono differenti modi per aggiungere un modello a Hugging Face. Qui trovi una lista di blog posts da parte della community su come aggiungere un modello:
+
+1. [Aggiungere GPT2](https://medium.com/huggingface/from-tensorflow-to-pytorch-265f40ef2a28) scritto da [Thomas](https://huggingface.co/thomwolf)
+2. [Aggiungere WMT19 MT](https://huggingface.co/blog/porting-fsmt) scritto da [Stas](https://huggingface.co/stas)
+
+Per esperienza, possiamo dirti che quando si aggiunge un modello รฉ meglio tenere a mente le seguenti considerazioni:
+
+- Non sfondare una porta giรก aperta! La maggior parte del codice che aggiungerai per un nuovo modello ๐ค Transformers
+ esiste giร da qualche parte in ๐ค Transformers. Prendi un po' di tempo per trovare codici simili in modelli e tokenizers esistenti e fare un copia-incolla. Ricorda che [grep](https://www.gnu.org/software/grep/) e [rg](https://github.com/BurntSushi/ripgrep) sono tuoi buoni amici. Inoltre, ricorda che puรณ essere molto probabile che il tokenizer per il tuo modello sia basato sull'implementazione di un altro modello, e il codice del tuo modello stesso su un altro ancora. *Per esempio* il modello FSMT รฉ basato su BART, mentre il tokenizer di FSMT รฉ basato su XLM.
+- Ricorda che qui รฉ piu una sfida ingegneristica che scientifica. Spendi piรบ tempo per create un efficiente ambiente di debugging piuttosto che cercare di capire tutti gli aspetti teorici dell'articolo del modello.
+- Chiedi aiuto se sei in panne! I modelli sono la parte principale di ๐ค Transformers, perciรฒ qui a Hugging Face siamo piรน che contenti di aiutarti in ogni passo per aggiungere il tuo modello. Non esitare a chiedere se vedi che non riesci a progredire.
+
+Di seguito, diamo una ricetta generale per aiutare a portare un modello in ๐ค Transformers.
+
+La lista seguente รฉ un sommario di tutto quello che รฉ stato fatto per aggiungere un modello, e puรฒ essere usata come To-Do List:
+
+- 1. โ (Opzionale) Capire gli aspetti teorici del modello
+- 2. โ Preparare l'ambiente dev per transformers
+- 3. โ Preparare l'ambiente debugging della repository originale
+- 4. โ Create uno script che gestisca con successo il forward pass usando la repository originale e checkpoint
+- 5. โ Aggiungere con successo lo scheletro del modello a Transformers
+- 6. โ Convertire i checkpoint original a Transformers checkpoint
+- 7. โ Effettuare con successo la forward pass in Transformers, di modo che dia un output identico al checkpoint originale
+- 8. โ Finire i tests per il modello in Transformers
+- 9. โ Aggiungere con successo Tokenizer in Transformers
+- 10. โ Testare e provare gli integration tests da capo a fine
+- 11. โ Completare i docs
+- 12. โ Caricare i moedl weights all'hub
+- 13. โ Sottomettere una pull request
+- 14. โ (Opzionale) Aggiungere un notebook con una demo
+
+Per cominciare di solito consigliamo `BrandNewBert`, partendo dalla teoria, di modo da avere una buona comprensione della teoria generale. TUttavia, se preferisci imparare l'aspetto teorico del modello mentre *lavori* sul modello รฉ ok immergersi direttamente nel codice di `BrandNewBert`. Questa opzione puรณ essere buona se le tue skills ingegneristiche sono meglio che quelle teoriche, o se il paper `BrandNewBert` ti dรก problemi, o se semplicemente ti piace programmare piรบ che leggere articoli scientifici.
+
+### 1. (Opzionale) Aspetti teorici di BrandNewBert
+
+Allora con calma, prendi un po' di tempo per leggere l'articolo su *BrandNewBert* . Sicuramente, alcune sezioni dell'articolo sono molto complesse, ma non preoccuparti! L'obiettivo non รฉ avere una compresione immensa della teoria alla base, ma estrarre le informazioni necessarie per re-implementare con successo il modello in ๐ค Transformers. Quindi, non impazzire sugli aspetti teorici, ma piuttosto focalizzati su quelli pratici, ossia:
+
+- Che tipo di modello รฉ *brand_new_bert*? ร solo un encoder in stile BERT? O tipo decoder come GPT2? O encoder e decoder stile BART? Dai un'occhiata a [model_summary](model_summary) se non sei famigliare con le differenze tra questi modelli
+- Quali sono le applicazioni di *brand_new_bert*? Classificazione di testo? Generazione di testo? O per tasks del genere seq2seq?
+- Quali sono le nuove aggiunte al modello che lo rendono diverso da BERT/GPT-2/BART?
+- Quali modelli estistenti in [๐ค Transformers models](https://huggingface.co/transformers/#contents) sono molto simili a *brand_new_bert*?
+- Che tipo di tokenizer si usa in questo caso? Un sentencepiece tokenizer? O un word piece tokenizer? Il tokenizer รฉ lo stesso di BERT o BART?
+
+Una volta che senti che hai avuto una bella overview dell'architettura del modello, puoi scrivere senza problemi al team di Hugging Face per ogni domanda che tu hai. Questo puรณ includere domande sull'architettura del modello, o sull'attention layer, etc. Saremo molto felici di aiutarti :)
+
+
+### 2. Prepare il tuo ambiente
+
+1. Forka la [repository](https://github.com/huggingface/transformers) cliccando sul tasto โFork' nella pagina della repository. Questo crea una copia del codice nel tuo account GitHub
+
+2. Clona il tuo fork `transfomers` sul tuo dico locale, e aggiungi la repository base come remota:
+
+```bash
+git clone https://github.com/[your Github handle]/transformers.git
+cd transformers
+git remote add upstream https://github.com/huggingface/transformers.git
+```
+
+
+3. Crea un ambiente di sviluppo, per esempio tramite questo comando:
+
+```bash
+python -m venv .env
+source .env/bin/activate
+pip install -e ".[dev]"
+```
+
+quindi torna alla directory principale:
+
+```bash
+cd ..
+```
+
+
+4. Attenzione, raccomandiamo di aggiungere la versione di PyTorch di *brand_new_bert* a Transfomers. Per installare PyTorch, basta seguire queste istruzioni https://pytorch.org/get-started/locally/.
+
+**Nota bene:** Non c'รฉ bisogno di installare o avere installato CUDA. Il nuovo modello puรฒ funzionare senza problemi su una CPU.
+
+
+5. Per trasferire *brand_new_bert* To port *brand_new_bert* avrai bisogno anche accesso alla sua repository originale:
+
+```bash
+git clone https://github.com/org_that_created_brand_new_bert_org/brand_new_bert.git
+cd brand_new_bert
+pip install -e .
+```
+
+Ok, ora hai un ambiente di sviluppo per portare *brand_new_bert* in ๐ค Transformers.
+
+
+### 3.-4. Provare un pretrained checkpoint usando la repo originale
+
+Per cominciare, comincerai a lavorare sulla repo originale di *brand_new_bert*. Come spesso accade, l'implementazione originale รฉ molto sullo stile "ricerca". Questo significa che a volte la documentazione non รฉ al top, magari manca qualche cosa e il codice puรณ essere difficile da capire. Tuttavia, questa รฉ e dev'essere la motivazione per reimplementare *brand_new_bert*. In Hugging Face, uno degli obiettivi principali รฉ di *mettere le persone sulle spalle dei giganti*, il che si traduce, in questo contesto, di prendere un modello funzionante e riscriverlo e renderlo il piรบ possibile **accessibile, user-friendly, e leggibile**. Questa รฉ la top motivazione per re-implementare modelli in ๐ค Transformers - cercare di creare nuove complesse tecnologie NLP accessibili a **chiunque**.
+
+Riuscire a far girare il modello pretrained originale dalla repository ufficiale รฉ spesso il passo **piu arduo**. Dalla nostra esperienza, รฉ molto importante spendere un p' di tempo per diventare familiari con il codice base originale. Come test, prova a capire i seguenti punti:
+
+- Dove si trovano i pretrained weights?
+- Come caricare i pretrained weights nel modello corrispondente?
+- Come girare un tokenizer independentemente dal modello?
+- Prova a tracciare un singolo forward pass, cosicchรฉ potrai sapere che classi e funzioni sono richieste per un semplice forward pass. Di solito, dovrai reimplementare queste funzioni e basta
+- Prova a localizzare i componenti importanti del modello: Dove si trova la classe del modello? Ci sono sotto classi nel modello *per esempio* EngoderModel, DecoderMOdel? Dove si trova il self-attention layer? Ci sono molteplici differenti layer di attention, *per esempio * *self-attention*, *cross-attention*...?
+- Come puoi fare debug sul modello nell'ambiente originale della repo? Devi aggiungere dei *print* o puoi usare *ipdb* come debugger interattivo, o vabene anche un IDE efficiente per debug come PyCharm?
+
+ร molto importante che prima di cominciare a trasferire il modello nuovo tu spenda tempo a fare debug del codice originale in maniera **efficiente**! Inoltre, ricorda che tutta la library รฉ open-soruce, quindi non temere di aprire issue o fare una pull request nella repo originale. Tutti coloro che mantengono la repository saranno piรบ che felici di avere qualcuno che guarda e gioca con i loro codici!
+
+A questo punto, sta a te decidere quale ambiente per debug vuoi usare. Noi consilgiamo di evitare setup con GPU, che potrebbero costare assai, lavorare su una CPU puรณ essere un ottimo punto di partenza per indagare la repository originale e per cominciare a scrivere il codice per ๐ค Transformers. Solo alla fine, quando il modello รฉ stato portato con successo in ๐ค Transformers, allora si potrรก verificare il suo funzionamento su GPU.
+
+In generale ci sono due possibili ambienti di debug per il testare il modello originale:
+
+- [Jupyter notebooks](https://jupyter.org/) / [google colab](https://colab.research.google.com/notebooks/intro.ipynb)
+- Scripts locali in Python
+
+Il vantaggio dei Jupyter notebooks รฉ la possibilitร di eseguire cella per cella, il che puรฒ essere utile per decomporre tutte le componenti logiche, cosi da a vere un ciclo di debug piรน rapido, siccome si possono salvare i risultati da steps intermedi. Inoltre, i notebooks spesso sono molto facili da condividere con altri contributors, il che puรฒ essere molto utile se vuoi chiedere aiuto al team di Hugging Face. Se sei famigliare con Jupyter notebooks allora racommandiamo di lavorare in questa maniera.
+
+Ovviamente se non siete abituati a lavorare con i notebook, questo puรฒ essere uno svantaggio nell'usare questa tecnologia, sprecando un sacco di tempo per setup e portare tutto al nuovo ambiente, siccome non potreste neanche usare dei tools di debug come `ipdb`.
+
+Per ogni pratica code-base, รฉ sempre meglio come primo step caricare un **piccolo** checkpoint pretrained e cercare di riprodurre un singolo forward pass usando un vettore fittizio di IDs fatti da numeri interi. Un esempio per uno script simile, in pseudocodice รฉ:
+
+```python
+model = BrandNewBertModel.load_pretrained_checkpoint("/path/to/checkpoint/")
+input_ids = [0, 4, 5, 2, 3, 7, 9] # vector of input ids
+original_output = model.predict(input_ids)
+```
+
+Per quanto riguarda la strategia di debugging, si puรฒ scegliere tra:
+
+- Decomporre il modello originario in piccole componenenti e testare ognuna di esse
+- Decomporre il modello originario nel *tokenizer* originale e nel *modello* originale, testare un forward pass su questi,
+e usare dei print statement o breakpoints intermedi per verificare
+
+Ancora una volta, siete liberi di scegliere quale strategia sia ottimale per voi. Spesso una strategia รฉ piu
+avvantaggiosa di un'altra, ma tutto dipende dall'code-base originario.
+
+Se il code-base vi permette di decomporre il modello in piccole sub-componenenti, *per esempio* se il code-base
+originario puรฒ essere facilmente testato in eager mode, allora vale la pena effettuare un debugging di questo genere.
+Ricordate che ci sono dei vantaggi nel decidere di prendere la strada piu impegnativa sin da subito:
+
+- negli stage piu finali, quando bisognerร comparare il modello originario all'implementazione in Hugging Face, potrete verificare
+automaticamente ogni componente, individualmente, di modo che ci sia una corrispondenza 1:1
+- avrete l'opportunitร di decomporre un problema molto grande in piccoli passi, cosรฌ da strutturare meglio il vostro lavoro
+- separare il modello in componenti logiche vi aiuterร ad avere un'ottima overview sul design del modello, quindi una migliore
+comprensione del modello stesso
+- verso gli stage finali i test fatti componente per componente vi aiuterร ad essere sicuri di non andare avanti e indietro
+nell'implementazione, cosรฌ da continuare la modifica del codice senza interruzione
+
+Un ottimo esempio di come questo puรฒ essere fatto รฉ dato da [Lysandre](https://gist.github.com/LysandreJik/db4c948f6b4483960de5cbac598ad4ed)
+per il modello ELECTRA
+
+Tuttavia, se il code-base originale รฉ molto complesso o le componenti intermedie possono essere testate solo in tramite
+compilazione, potrebbe richiedere parecchio tempo o addirittura essere impossibile separare il modello in piccole sotto-componenti.
+Un buon esempio รฉ [MeshTensorFlow di T5](https://github.com/tensorflow/mesh/tree/master/mesh_tensorflow). Questa libreria
+รฉ molto complessa e non offre un metodo semplice di decomposizione in sotto-componenti. Per simili librerie, potrete fare
+affidamento ai print statements.
+
+In ogni caso, indipendentemente da quale strategia scegliete, la procedura raccomandata รฉ di cominciare a fare debug dal
+primo layer al layer finale.
+ร consigliato recuperare gli output dai layers, tramite print o sotto-componenti, nel seguente ordine:
+
+1. Recuperare gli IDs di input dati al modello
+2. Recuperare i word embeddings
+3. Recuperare l'input del primo Transformer layer
+4. Recuperare l'output del primo Transformer layer
+5. Recuperare l'output dei seguenti `n - 1` Transformer layers
+6. Recuperare l'output dell'intero BrandNewBert Model
+
+Gli IDs in input dovrebbero essere un arrary di interi, *per esempio* `input_ids = [0, 4, 4, 3, 2, 4, 1, 7, 19]`
+
+Gli output dei seguenti layer di solito dovrebbero essere degli array di float multi-dimensionali come questo:
+
+```
+[[
+ [-0.1465, -0.6501, 0.1993, ..., 0.1451, 0.3430, 0.6024],
+ [-0.4417, -0.5920, 0.3450, ..., -0.3062, 0.6182, 0.7132],
+ [-0.5009, -0.7122, 0.4548, ..., -0.3662, 0.6091, 0.7648],
+ ...,
+ [-0.5613, -0.6332, 0.4324, ..., -0.3792, 0.7372, 0.9288],
+ [-0.5416, -0.6345, 0.4180, ..., -0.3564, 0.6992, 0.9191],
+ [-0.5334, -0.6403, 0.4271, ..., -0.3339, 0.6533, 0.8694]]],
+```
+
+Ci aspettiamo che ogni modello aggiunto a ๐ค Transformers passi con successo un paio di test d'integrazione. Questo
+significa che il modello originale e la sua implementazione in ๐ค Transformers abbiano lo stesso output con una precisione
+di 0.001! Siccome รฉ normale che lo stesso esatto modello, scritto in librerie diverse, possa dare output leggermente
+diversi, la tolleranza accettata รฉ 1e-3 (0.001). Ricordate che i due modelli devono dare output quasi identici. Dunque,
+รฉ molto conveniente comparare gli output intermedi di ๐ค Transformers molteplici volte con gli output intermedi del
+modello originale di *brand_new_bert*. Di seguito vi diamo alcuni consigli per avere un ambiente di debug il piu efficiente
+possibile:
+
+- Trovate la migliore strategia per fare debug dei risultati intermedi. Per esempio, รฉ la repository originale scritta in PyTorch?
+Se si, molto probabilmente dovrete dedicare un po' di tempo per scrivere degli script piu lunghi, cosรฌ da decomporre il
+modello originale in piccole sotto-componenti, in modo da poter recuperare i valori intermedi. Oppure, la repo originale
+รฉ scritta in Tensorflow 1? Se รฉ cosรฌ dovrete fare affidamento ai print di Tensorflow [tf.print](https://www.tensorflow.org/api_docs/python/tf/print)
+per avere i valori intermedi. Altro caso, la repo รฉ scritta in Jax? Allora assicuratevi che il modello non sia in **jit**
+quanto testate il foward pass, *per esempio* controllate [questo link](https://github.com/google/jax/issues/196).
+- Usate i piรน piccoli pretrained checkpoint che potete trovare. Piu piccolo รฉ il checkpoint, piu velocemente sarร il vostro
+ciclo di debug. Non รฉ efficiente avere un pretrained model cosรฌ gigante che per il forward pass impieghi piu di 10 secondi.
+Nel caso in cui i checkpoints siano molto grandi, e non si possa trovare di meglio, allora รฉ buona consuetudine ricorrere
+a fare un dummy model nel nuovo ambiente, con weights inizializzati random e salvare quei weights per comprare la versione ๐ค Transformers
+con il vostro modello
+- Accertatevi di usare la via piu semplice per chiamare il forward pass nella repo originale. Sarebbe opportuno trovare
+la funzione originaria che chiami **solo** un singolo forward pass, *per esempio* questa funzione spesso viene chiamata
+`predict`, `evaluate`, `forward` o `__call__`. Siate sicuri di non fare debug su una funzione che chiami `forward` molteplici
+volte, *per esempio* per generare testo, come `autoregressive_sample`, `generate`.
+- Cercate di separare la tokenization dal forward pass del modello. Se la repo originaria mostra esempio dove potete dare
+come input una stringa, provate a cercare dove nella forward call la stringa viene cambiata in input ids e cominciate il
+debug da questo punto. Questo vi garantisce un ottimo punto di partenza per scrivere un piccolo script personale dove dare
+gli input al modello, anziche delle stringhe in input.
+- Assicuratevi che il debugging **non** sia in training mode. Spesso questo potra il modello a dare degli output random, per
+via dei molteplici dropout layers. Assicuratevi che il forward pass nell'ambiente di debug sia **deterministico**, cosicche
+i dropout non siano usati. Alternativamente, potete usare *transformers.utils.set_seed* se la vecchia e nuova implementazione
+sono nello stesso framework.
+
+La seguente sezione vi da ulteriori dettagli e accorgimenti su come potete fare tutto questo per *brand_new_bert*.
+
+
+### 5.-14. Trasferire BrandNewBert in ๐ค Transformers
+
+Allora cominciamo ad aggiungere un nuovo codice in ๐ค Transformers. Andate nel vostro fork clone di ๐ค Transformers:
+
+
+```bash
+cd transformers
+```
+
+Nel caso speciale in cui stiate aggiungendo un modello, la cui architettura sia identica a una di un modello giร esistente,
+dovrete solo aggiugnere uno script di conversione, come descritto [qui](#write-a-conversion-script).
+In questo caso, potete riutilizzare l'intera architettura del modello gia esistente.
+
+Se questo non รฉ il caso, cominciamo con il generare un nuovo modello. Ti consigliamo di utilizzare il seguente script per aggiungere un modello a partire da
+un modello esistente:
+
+```bash
+transformers-cli add-new-model-like
+```
+
+Ti verrร richiesto con un questionario di compilare le informazioni di base del tuo modello.
+
+**Aprire una Pull Request in main huggingface/transformers repo**
+
+Prime di cominciare ad adattare il codice automaticamente generato, aprite una nuova PR come "Work in progress (WIP)",
+*per esempio* "[WIP] Aggiungere *brand_new_bert*", cosicchรฉ il team di Hugging Face possa lavorare al vostro fianco nell'
+integrare il modello in ๐ค Transformers.
+
+Questi sarebbero gli step generali da seguire:
+
+1. Creare un branch dal main branch con un nome descrittivo
+
+```bash
+git checkout -b add_brand_new_bert
+```
+
+2. Commit del codice automaticamente generato
+
+```bash
+git add .
+git commit
+```
+
+3. Fare fetch e rebase del main esistente
+
+```bash
+git fetch upstream
+git rebase upstream/main
+```
+
+4. Push dei cambiamenti al proprio account:
+
+```bash
+git push -u origin a-descriptive-name-for-my-changes
+```
+
+5. Una volte che siete soddisfatti dei nuovi cambiamenti, andate sulla webpage del vostro fork su GitHub. Cliccate "Pull request".
+Assiuratevi di aggiungere alcuni membri di Hugging Face come reviewers, nel riguardo alla destra della pagina della PR, cosicche il team
+Hugging Face verrร notificato anche per i futuri cambiamenti.
+
+6. Cambiare la PR a draft, cliccando su "Convert to draft" alla destra della pagina della PR
+
+Da quel punto in poi, ricordate di fare commit di ogni progresso e cambiamento, cosicche venga mostrato nella PR. Inoltre,
+ricordatevi di tenere aggiornato il vostro lavoro con il main esistente:
+
+```bash
+git fetch upstream
+git merge upstream/main
+```
+
+In generale, tutte le domande che avrete riguardo al modello o l'implementazione dovranno essere fatte nella vostra PR
+e discusse/risolte nella PR stessa. In questa maniera, il team di Hugging Face sarร sempre notificato quando farete commit
+di un nuovo codice o se avrete qualche domanda. ร molto utile indicare al team di Hugging Face il codice a cui fate riferimento
+nella domanda, cosicche il team potra facilmente capire il problema o la domanda.
+
+Per fare questo andate sulla tab "Files changed", dove potrete vedere tutti i vostri cambiamenti al codice, andate sulla linea
+dove volete chiedere una domanda, e cliccate sul simbolo "+" per aggiungere un commento. Ogni volta che una domanda o problema
+รฉ stato risolto, cliccate sul bottone "Resolve".
+
+In questa stessa maniera, Hugging Face aprirร domande o commenti nel rivedere il vostro codice. Mi raccomando, chiedete piรน
+domande possibili nella pagina della vostra PR. Se avete domande molto generali, non molto utili per il pubblico, siete liberi
+di chiedere al team Hugging Face direttamente su slack o email.
+
+
+**5. Adattare i codici per brand_new_bert**
+
+Per prima cosa, ci focalizzeremo sul modello e non sui tokenizer. Tutto il codice relative dovrebbe trovarsi in
+`src/transformers/models/brand_new_bert/modeling_brand_new_bert.py` e
+`src/transformers/models/brand_new_bert/configuration_brand_new_bert.py`.
+
+Ora potete finalmente cominciare il codice :). Il codice generato in
+`src/transformers/models/brand_new_bert/modeling_brand_new_bert.py` avrร sia la stessa architettura di BERT se รฉ un
+modello encoder-only o BART se รฉ encoder-decoder. A questo punto, ricordatevi cio che avete imparato all'inizio, riguardo
+agli aspetti teorici del modello: *In che maniera il modello che sto implmementando รฉ diverso da BERT o BART?*. Implementare
+questi cambi spesso vuol dire cambiare il layer *self-attention*, l'ordine dei layer di normalizzazione e cosรฌ via...
+Ancora una volta ripetiamo, รฉ molto utile vedere architetture simili di modelli gia esistenti in Transformers per avere
+un'idea migliore su come implementare il modello.
+
+**Notate** che a questo punto non dovete avere subito un codice tutto corretto o pulito. Piuttosto, รฉ consigliato cominciare con un
+codice poco pulito, con copia-incolla del codice originale in `src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`
+fino a che non avrete tutto il codice necessario. In base alla nostra esperienza, รฉ molto meglio aggiungere una prima bozza
+del codice richiesto e poi correggere e migliorare iterativamente. L'unica cosa essenziale che deve funzionare qui รฉ la seguente
+instanza:
+
+```python
+from transformers import BrandNewBertModel, BrandNewBertConfig
+
+model = BrandNewBertModel(BrandNewBertConfig())
+```
+
+Questo comando creerร un modello con i parametri di default definiti in `BrandNewBergConfig()` e weights random. Questo garantisce
+che `init()` di tutte le componenti funzioni correttamente.
+
+
+**6. Scrivere uno script di conversione**
+
+Il prossimo step รฉ scrivere uno script per convertire il checkpoint che avete usato per fare debug su *brand_new_berts* nella
+repo originale in un checkpoint per la nuova implementazione di *brand_new_bert* in ๐ค Transformers. Non รฉ consigliato scrivere
+lo script di conversione da zero, ma piuttosto cercate e guardate script gia esistenti in ๐ค Transformers, cosรฌ da trovarne
+uno simile al vostro modello. Di solito basta fare una copia di uno script gia esistente e adattarlo al vostro caso.
+Non esistate a chiedre al team di Hugging Face a riguardo.
+
+- Se state convertendo un modello da TensorFlow a PyTorch, un ottimo inizio รฉ vedere [questo script di conversione per BERT](https://github.com/huggingface/transformers/blob/7acfa95afb8194f8f9c1f4d2c6028224dbed35a2/src/transformers/models/bert/modeling_bert.py#L91)
+- Se state convertendo un modello da PyTorch a PyTorch, [lo script di conversione di BART puรฒ esservi utile](https://github.com/huggingface/transformers/blob/main/src/transformers/models/bart/convert_bart_original_pytorch_checkpoint_to_pytorch.py)
+
+Qui di seguito spiegheremo come i modelli PyTorch salvano i weights per ogni layer e come i nomi dei layer sono definiti. In PyTorch,
+il nomde del layer รฉ definito dal nome della class attribute che date al layer. Definiamo un modello dummy in PyTorch,
+chiamato `SimpleModel`:
+
+```python
+from torch import nn
+
+
+class SimpleModel(nn.Module):
+ def __init__(self):
+ super().__init__()
+ self.dense = nn.Linear(10, 10)
+ self.intermediate = nn.Linear(10, 10)
+ self.layer_norm = nn.LayerNorm(10)
+```
+Ora possiamo creare un'instanza di questa definizione di modo da inizializzare a random weights: `dense`, `intermediate`, `layer_norm`.
+Possiamo usare print per vedere l'architettura del modello:
+
+```python
+model = SimpleModel()
+
+print(model)
+```
+
+Da cui si ottiene:
+
+```
+SimpleModel(
+ (dense): Linear(in_features=10, out_features=10, bias=True)
+ (intermediate): Linear(in_features=10, out_features=10, bias=True)
+ (layer_norm): LayerNorm((10,), eps=1e-05, elementwise_affine=True)
+)
+```
+
+Si puรฒ vedere come i nomi dei layers siano definiti dal nome della class attribute in PyTorch. I valori dei weights di uno
+specifico layer possono essere visualizzati:
+
+
+```python
+print(model.dense.weight.data)
+```
+
+ad esempio:
+
+```
+tensor([[-0.0818, 0.2207, -0.0749, -0.0030, 0.0045, -0.1569, -0.1598, 0.0212,
+ -0.2077, 0.2157],
+ [ 0.1044, 0.0201, 0.0990, 0.2482, 0.3116, 0.2509, 0.2866, -0.2190,
+ 0.2166, -0.0212],
+ [-0.2000, 0.1107, -0.1999, -0.3119, 0.1559, 0.0993, 0.1776, -0.1950,
+ -0.1023, -0.0447],
+ [-0.0888, -0.1092, 0.2281, 0.0336, 0.1817, -0.0115, 0.2096, 0.1415,
+ -0.1876, -0.2467],
+ [ 0.2208, -0.2352, -0.1426, -0.2636, -0.2889, -0.2061, -0.2849, -0.0465,
+ 0.2577, 0.0402],
+ [ 0.1502, 0.2465, 0.2566, 0.0693, 0.2352, -0.0530, 0.1859, -0.0604,
+ 0.2132, 0.1680],
+ [ 0.1733, -0.2407, -0.1721, 0.1484, 0.0358, -0.0633, -0.0721, -0.0090,
+ 0.2707, -0.2509],
+ [-0.1173, 0.1561, 0.2945, 0.0595, -0.1996, 0.2988, -0.0802, 0.0407,
+ 0.1829, -0.1568],
+ [-0.1164, -0.2228, -0.0403, 0.0428, 0.1339, 0.0047, 0.1967, 0.2923,
+ 0.0333, -0.0536],
+ [-0.1492, -0.1616, 0.1057, 0.1950, -0.2807, -0.2710, -0.1586, 0.0739,
+ 0.2220, 0.2358]]).
+```
+
+Nello script di conversione, dovreste riempire quei valori di inizializzazione random con gli stessi weights del corrispondente
+layer nel checkpoint. *Per esempio*
+
+```python
+# retrieve matching layer weights, e.g. by
+# recursive algorithm
+layer_name = "dense"
+pretrained_weight = array_of_dense_layer
+
+model_pointer = getattr(model, "dense")
+
+model_pointer.weight.data = torch.from_numpy(pretrained_weight)
+```
+
+Cosรฌ facendo, dovete verificare che ogni inizializzazione random di un peso del modello PyTorch e il suo corrispondente peso nel pretrained checkpoint
+siano esattamente gli stessi e uguali in **dimensione/shape e nome**. Per fare questo, รฉ **necessario** aggiungere un `assert`
+per la dimensione/shape e nome:
+
+```python
+assert (
+ model_pointer.weight.shape == pretrained_weight.shape
+), f"Pointer shape of random weight {model_pointer.shape} and array shape of checkpoint weight {pretrained_weight.shape} mismatched"
+```
+
+Inoltre, dovrete fare il print sia dei nomi che dei weights per essere sicuri che siano gli stessi:
+
+```python
+logger.info(f"Initialize PyTorch weight {layer_name} from {pretrained_weight.name}")
+```
+
+Se la dimensione o il nome non sono uguali, probabilmente avete sbagliato ad assegnare il peso nel checkpoint o nel layer costrutture di
+ ๐ค Transformers.
+
+Una dimensione sbagliata puรฒ essere dovuta ad un errore nei parameteri in `BrandNewBertConfig()`. Tuttavia, puรฒ essere anche
+che l'implementazione del layer in PyTorch richieda di fare una transposizione della matrice dei weights.
+
+Infine, controllate **tutti** che tutti i weights inizializzati e fate print di tutti i weights del checkpoint che non sono stati
+usati per l'inizializzazione, di modo da essere sicuri che il modello sia correttamente convertito. ร normale che ci siano
+errori nel test di conversione, fai per un errore in `BrandNewBertConfig()`, o un errore nell'architettura in ๐ค Transformers,
+o un bug in `init()`.
+
+Questo step dev'essere fatto tramite iterazioni fino a che non si raggiungano gli stessi valori per i weights. Una volta che
+il checkpoint รฉ stato correttamente caricato in ๐ค Transformers, potete salvare il modello in una cartella di vostra scelta
+`/path/to/converted/checkpoint/folder` che contenga sia
+`pytorch_model.bin` che `config.json`:
+
+```python
+model.save_pretrained("/path/to/converted/checkpoint/folder")
+```
+
+
+**7. Implementare il forward pass**
+
+Una volta che i weights pretrained sono stati correttamente caricati in ๐ค Transformers, dovrete assicurarvi che il forward pass
+sia correttamente implementato. [Qui](#3-4-provare-un-pretrained-checkpoint-usando-la-repo-originale), avete give creato e provato
+uno script che testi il forward pass del modello usando la repo originaria. Ora dovrete fare lo stesso con uno script analogo
+usando l'implementazione in ๐ค Transformers anzichรฉ l'originale. Piu o meno lo script dovrebbe essere:
+
+```python
+model = BrandNewBertModel.from_pretrained("/path/to/converted/checkpoint/folder")
+input_ids = [0, 4, 4, 3, 2, 4, 1, 7, 19]
+output = model(input_ids).last_hidden_states
+```
+
+Di solito l'output da ๐ค Transformers non รฉ uguale uguale all'output originario, sopratto la prima volta. Non vi abbattete -
+รฉ normale! Prima di tutto assicuratevi che non ci siano errori o che non vengano segnalati degli errori nella forward pass.
+Spesso capita che ci siano dimensioni sbagliate o data type sbagliati, *ad esempio* `torch.long` anziche `torch.float32`.
+Non esistate a chiedere al team Hugging Face!
+
+Nella parte finale assicuratevi che l'implementazione ๐ค Transformers funzioni correttamente cosi da testare che gli output
+siano equivalenti a una precisione di `1e-3`. Controllate che `outputs.shape` siano le stesse tra ๐ค Transformers e l'implementazione
+originaria. Poi, controllate che i valori in output siano identici. Questa รฉ sicuramente la parte piรน difficile, qui una serie
+di errori comuni quando gli output non sono uguali:
+
+- Alcuni layers non sono stati aggiunti, *ad esempio* un *activation* layer non รฉ stato aggiunto, o ci si รฉ scordati di una connessione
+- La matrice del word embedding non รฉ stata ripareggiata
+- Ci sono degli embeddings posizionali sbagliati perchรฉ l'implementazione originaria ha un offset
+- Il dropout รฉ in azione durante il forward pass. Per sistemare questo errore controllate che *model.training = False* e che
+il dropout non sia stato attivato nel forward pass, * per esempio * passate *self.training* a [PyTorch's functional dropout](https://pytorch.org/docs/stable/nn.functional.html?highlight=dropout#torch.nn.functional.dropout)
+
+La miglior maniera per sistemare il problema รฉ di vedere all'implementazione originaria del forward pass e in ๐ค Transformers
+fianco a fianco e vedere se ci sono delle differenze. In teoria, con debug e print degli output intermedie di entrambe le
+implementazioni nel forward pass nell'esatta posizione del network dovrebbe aiutarvi a vedere dove ci sono differenze tra
+i due frameworks. Come prima mossa controllate che `input_ids` siano identici in entrambi gli scripts. Da lรฌ andate fino
+all'ultimo layer. Potrete notare una differenza tra le due implementazioni a quel punto.
+
+Una volta che lo stesso output รฉ stato ragguingi, verificate gli output con `torch.allclose(original_output, output, atol=1e-3)`.
+A questo punto se รฉ tutto a posto: complimenti! Le parti seguenti saranno una passeggiata ๐.
+
+
+**8. Aggiungere i test necessari per il modello**
+
+A questo punto avete aggiunto con successo il vostro nuovo modello. Tuttavia, รฉ molto probabile che il modello non sia
+del tutto ok con il design richiesto. Per essere sicuri che l'implementazione sia consona e compatibile con ๐ค Transformers รฉ
+necessario implementare dei tests. Il Cookiecutter dovrebbe fornire automaticamente dei file per test per il vostro modello,
+di solito nella folder `tests/test_modeling_brand_new_bert.py`. Provate questo per verificare l'ok nei test piu comuni:
+
+```bash
+pytest tests/test_modeling_brand_new_bert.py
+```
+
+Una volta sistemati i test comuni, bisogna assicurarsi che il vostro lavoro sia correttamente testato cosicchรจ:
+
+- a) La community puo capire in maniera semplice il vostro lavoro controllando tests specifici del modello *brand_new_bert*,
+- b) Implementazioni future del vostro modello non rompano alcune feature importante del modello.
+
+Per prima cosa agguingete dei test d'integrazione. Questi sono essenziali perche fanno la stessa funzione degli scripts di
+debug usati precedentemente. Un template per questi tests esiste gia nel Cookiecutter ed รฉ sotto il nome di `BrandNewBertModelIntegrationTests`,
+voi dovrete solo completarlo. Una volta che questi tests sono OK, provate:
+
+```bash
+RUN_SLOW=1 pytest -sv tests/test_modeling_brand_new_bert.py::BrandNewBertModelIntegrationTests
+```
+
+
+
+Nel caso siate su Windows, sostituite `RUN_SLOW=1` con `SET RUN_SLOW=1`
+
+
+
+Di seguito, tutte le features che sono utili e necessarire per *brand_new_bert* devono essere testate in test separati,
+contenuti in `BrandNewBertModelTester`/ `BrandNewBertModelTest`. spesso la gente si scorda questi test, ma ricordate che sono utili per:
+
+
+- Aiuta gli utenti a capire il vostro codice meglio, richiamando l'attenzione su queste nuove features
+- Developers e contributors futuri potranno velocemente testare nuove implementazioni del modello testanto questi casi speciali.
+
+
+**9. Implementare il tokenizer**
+
+A questo punto avremo bisogno un tokenizer per *brand_new_bert*. Di solito il tokenizer รฉ uguale ad altri modelli in ๐ค Transformers.
+
+ร importante che troviate il file con il tokenizer originale e che lo carichiate in ๐ค Transformers.
+
+Per controllare che il tokenizer funzioni in modo corretto, create uno script nella repo originaria che riceva come input
+una stringa e ritorni gli `input_ids`. Piu o meno questo potrebbe essere il codice:
+
+```python
+input_str = "This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words."
+model = BrandNewBertModel.load_pretrained_checkpoint("/path/to/checkpoint/")
+input_ids = model.tokenize(input_str)
+```
+
+Potrebbe richiedere un po' di tempo, ma guardate ancora alla repo originaria per trovare la funzione corretta del tokenizer.
+A volte capita di dover riscrivere il tokenizer nella repo originaria, di modo da avere come output gli `input_ids`.
+A quel punto uno script analogo รฉ necessario in ๐ค Transformers:
+
+```python
+from transformers import BrandNewBertTokenizer
+
+input_str = "This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words."
+
+tokenizer = BrandNewBertTokenizer.from_pretrained("/path/to/tokenizer/folder/")
+
+input_ids = tokenizer(input_str).input_ids
+```
+
+Una volta che `input_ids` sono uguali, bisogna aggiungere un test per il tokenizer.
+
+Il file test per tokenizer di *brand_new_brand* dovrebbe avere un paio di hard-coded test d'integrazione.
+
+
+**10. Test end-to-end**
+
+Ora che avete il tokenizer, dovrete aggiungere dei test d'integrazione per l'intero workflow in `tests/test_modeling_brand_new_bert.py` in ๐ค Transformer.
+Questi test devono mostrare che un significante campione text-to-text funzioni come ci si aspetta nell'implementazione di ๐ค Transformers.
+*Per esempio* potreste usare dei source-to-target-translation, o un sommario di un articolo, o un domanda-risposta e cosi via.
+Se nessuno dei checkpoints รฉ stato ultra parametrizzato per task simili, allora i tests per il modello sono piu che sufficienti.
+Nello step finale dovete assicurarvi che il modello sia totalmente funzionale, e consigliamo anche di provare a testare su GPU.
+Puo succedere che ci si scordi un `.to(self.device)` ad esempio. Se non avete accesso a GPU, il team Hugging Face puo provvedere
+a testare questo aspetto per voi.
+
+**11. Aggiungere una Docstring**
+
+Siete quasi alla fine! L'ultima cosa rimasta รฉ avere una bella docstring e una pagina doc. Il Cookiecutter dovrebbe provvedere giร
+un template chiamato `docs/source/model_doc/brand_new_bert.rst`, che dovrete compilare. La prima cosa che un utente farร
+per usare il vostro modello sarร dare una bella lettura al doc. Quindi proponete una documentazione chiara e concisa. ร molto
+utile per la community avere anche delle *Tips* per mostrare come il modello puo' essere usato. Non esitate a chiedere a Hugging Face
+riguardo alle docstirng.
+
+Quindi, assicuratevi che la docstring sia stata aggiunta a `src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`.
+Assicuratevi che la docstring sia corretta e che includa tutti i necessari input e output. Abbiamo una guida dettagliata per
+scrivere la documentazione e docstring.
+
+
+**Rifattorizzare il codice**
+
+Perfetto! Ora che abbiamo tutto per *brand_new_bert* controllate che lo stile del codice sia ok:
+
+```bash
+make style
+```
+
+E che il codice passi i quality check:
+
+```bash
+make quality
+```
+
+A volte capita che manchino delle informazioninella docstring o alcuni nomi sbagliati, questo farร fallire i tests sopra.
+Ripetiamo: chiedete pure a Hugging Face, saremo lieti di aiutarvi.
+
+Per ultimo, fare del refactoring del codice una volta che รฉ stato creato.
+
+Avete finito con il codice, congratulazioni! ๐ Siete fantasticiiiiiii! ๐
+
+**12. Caricare il modello sul model hub**
+
+In questa ultima parte dovrete convertire e caricare il modello, con tutti i checkpoints, nel model hub e aggiungere una
+model card per ogni checkpoint caricato. Leggete la nostra guida [Model sharing and uploading Page](model_sharing) per
+avere familiaritร con l'hub. Di solito in questa parte lavorate a fianco di Hugging face per decidere un nome che sia ok
+per ogni checkpoint, per ottenere i permessi necessari per caricare il modello nell'organizzazione dell'autore di *brand_new_bert*.
+Il metodo `push_to_hub`, presente in tutti i modelli `transformers`, รฉ una maniera rapida e indolore per caricare il vostro checkpoint sull'hub:
+
+```python
+brand_new_bert.push_to_hub(
+ repo_path_or_name="brand_new_bert",
+ # Uncomment the following line to push to an organization
+ # organization="",
+ commit_message="Add model",
+ use_temp_dir=True,
+)
+```
+
+Vale la pena spendere un po' di tempo per creare una model card ad-hoc per ogni checkpoint. Le model cards dovrebbero
+suggerire le caratteristiche specifiche del checkpoint, *per esempio* su che dataset il checkpoint รฉ stato pretrained o fine-tuned.
+O che su che genere di task il modello lavoro? E anche buona pratica includere del codice su come usare il modello correttamente.
+
+
+**13. (Opzionale) Aggiungere un notebook**
+
+ร molto utile aggiungere un notebook, che dimostri in dettaglio come *brand_new_bert* si utilizzi per fare inferenza e/o
+fine-tuned su specifiche task. Non รฉ una cosa obbligatoria da avere nella vostra PR, ma รฉ molto utile per la community.
+
+**14. Sottomettere la PR**
+
+L'ultimissimo step! Ovvero il merge della PR nel main. Di solito il team Hugging face a questo punto vi avrร gia aiutato,
+ma รฉ ok prendere un po' di tempo per pulire la descirzione e commenti nel codice.
+
+
+### Condividete il vostro lavoro!!
+
+ร ora tempo di prendere un po' di credito dalla communitร per il vostro lavoro! Caricare e implementare un nuovo modello
+รฉ un grandissimo contributo per Transformers e l'intera community NLP. Il codice e la conversione dei modelli pre-trained sara
+sicuramente utilizzato da centinaia o migliaia di sviluppatori e ricercatori. Siate fieri e orgogliosi di condividere il vostro
+traguardo con l'intera community :)
+
+** Avete create un altro modello che รฉ super facile da usare per tutti quanti nella community! ๐คฏ**
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/add_new_pipeline.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/add_new_pipeline.md
new file mode 100644
index 0000000000000000000000000000000000000000..fcc4da1899a2b1d7ff44e9b0075fded4e271f390
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/add_new_pipeline.md
@@ -0,0 +1,246 @@
+
+
+# Come creare una pipeline personalizzata?
+
+In questa guida, scopriremo come creare una pipeline personalizzata e condividerla sull' [Hub](https://hf.co/models) o aggiungerla nella libreria
+Transformers.
+
+Innanzitutto, รจ necessario decidere gli input grezzi che la pipeline sarร in grado di accettare. Possono essere strings, raw bytes,
+dictionaries o qualsiasi cosa sia l'input desiderato piรน probabile. Cerca di mantenere questi input il piรน possibile in Python
+in quanto facilita la compatibilitร (anche con altri linguaggi tramite JSON). Questi saranno gli `inputs` della
+pipeline (`preprocess`).
+
+Poi definire gli `outputs`. Stessa strategia degli `inputs`. Piรน รจ seplice e meglio รจ. Questi saranno gli output del metodo
+`postprocess`.
+
+Si parte ereditando la classe base `Pipeline`. con i 4 metodi che bisogna implementare `preprocess`,
+`_forward`, `postprocess` e `_sanitize_parameters`.
+
+
+```python
+from transformers import Pipeline
+
+
+class MyPipeline(Pipeline):
+ def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "maybe_arg" in kwargs:
+ preprocess_kwargs["maybe_arg"] = kwargs["maybe_arg"]
+ return preprocess_kwargs, {}, {}
+
+ def preprocess(self, inputs, maybe_arg=2):
+ model_input = Tensor(inputs["input_ids"])
+ return {"model_input": model_input}
+
+ def _forward(self, model_inputs):
+ # model_inputs == {"model_input": model_input}
+ outputs = self.model(**model_inputs)
+ # Maybe {"logits": Tensor(...)}
+ return outputs
+
+ def postprocess(self, model_outputs):
+ best_class = model_outputs["logits"].softmax(-1)
+ return best_class
+```
+
+La struttura di questa suddivisione consiste nel supportare in modo relativamente continuo CPU/GPU, supportando allo stesso tempo l'esecuzione di
+pre/postelaborazione sulla CPU su thread diversi.
+
+`preprocess` prenderร gli input originariamente definiti e li trasformerร in qualcosa di alimentabile dal modello. Potrebbe
+contenere piรน informazioni e di solito รจ un `Dict`.
+
+`_forward` รจ il dettaglio dell'implementazione e non รจ destinato a essere chiamato direttamente. `forward` รจ il metodo preferito per assicurarsi che tutto funzioni correttamente perchรจ contiene delle slavaguardie. Se qualcosa รจ
+รจ collegato a un modello reale, appartiene al metodo `_forward`, tutto il resto รจ nel preprocess/postprocess.
+
+`postprocess` prende l'otput di `_forward` e lo trasforma nell'output finale che era stato deciso in precedenza.
+
+`_sanitize_parameters` esiste per consentire agli utenti di passare i parametri ogni volta che desiderano sia a inizialization time `pipeline(...., maybe_arg=4)` che al call time `pipe = pipeline(...); output = pipe(...., maybe_arg=4)`.
+
+`_sanitize_parameters` ritorna 3 dicts di kwargs che vengono passati direttamente a `preprocess`,
+`_forward` e `postprocess`. Non riempire nulla se il chiamante non ha chiamato con alcun parametro aggiuntivo. Questo
+consente di mantenere gli argomenti predefiniti nella definizione della funzione, che รจ sempre piรน "naturale".
+
+Un esempio classico potrebbe essere l'argomento `top_k` nel post processing dei classification tasks.
+
+```python
+>>> pipe = pipeline("my-new-task")
+>>> pipe("This is a test")
+[{"label": "1-star", "score": 0.8}, {"label": "2-star", "score": 0.1}, {"label": "3-star", "score": 0.05}
+{"label": "4-star", "score": 0.025}, {"label": "5-star", "score": 0.025}]
+
+>>> pipe("This is a test", top_k=2)
+[{"label": "1-star", "score": 0.8}, {"label": "2-star", "score": 0.1}]
+```
+
+In order to achieve that, we'll update our `postprocess` method with a default parameter to `5`. and edit
+`_sanitize_parameters` to allow this new parameter.
+
+
+```python
+def postprocess(self, model_outputs, top_k=5):
+ best_class = model_outputs["logits"].softmax(-1)
+ # Add logic to handle top_k
+ return best_class
+
+
+def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "maybe_arg" in kwargs:
+ preprocess_kwargs["maybe_arg"] = kwargs["maybe_arg"]
+
+ postprocess_kwargs = {}
+ if "top_k" in kwargs:
+ postprocess_kwargs["top_k"] = kwargs["top_k"]
+ return preprocess_kwargs, {}, postprocess_kwargs
+```
+
+Cercare di mantenere gli input/output molto semplici e idealmente serializzabili in JSON, in quanto ciรฒ rende l'uso della pipeline molto facile
+senza richiedere agli utenti di comprendere nuovi tipi di oggetti. ร anche relativamente comune supportare molti tipi di argomenti
+per facilitarne l'uso (ad esempio file audio, possono essere nomi di file, URL o byte puri).
+
+## Aggiungilo alla lista dei tasks supportati
+
+Per registrar il tuo `new-task` alla lista dei tasks supportati, devi aggiungerlo al `PIPELINE_REGISTRY`:
+
+```python
+from transformers.pipelines import PIPELINE_REGISTRY
+
+PIPELINE_REGISTRY.register_pipeline(
+ "new-task",
+ pipeline_class=MyPipeline,
+ pt_model=AutoModelForSequenceClassification,
+)
+```
+
+Puoi specificare il modello di default che desideri, in questo caso dovrebbe essere accompagnato da una revisione specifica (che puรฒ essere il nome di un branch o l'hash di un commit, in questo caso abbiamo preso `"abcdef"`) e anche dal type:
+
+```python
+PIPELINE_REGISTRY.register_pipeline(
+ "new-task",
+ pipeline_class=MyPipeline,
+ pt_model=AutoModelForSequenceClassification,
+ default={"pt": ("user/awesome_model", "abcdef")},
+ type="text", # current support type: text, audio, image, multimodal
+)
+```
+
+## Condividi la tua pipeline sull'Hub
+
+Per condividere la tua pipeline personalizzata sull'Hub, devi solo salvare il codice della tua sottoclasse `Pipeline` in un file
+python. Per esempio, supponiamo di voler utilizzare una pipeline personalizzata per la classificazione delle coppie di frasi come la seguente:
+
+```py
+import numpy as np
+
+from transformers import Pipeline
+
+
+def softmax(outputs):
+ maxes = np.max(outputs, axis=-1, keepdims=True)
+ shifted_exp = np.exp(outputs - maxes)
+ return shifted_exp / shifted_exp.sum(axis=-1, keepdims=True)
+
+
+class PairClassificationPipeline(Pipeline):
+ def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "second_text" in kwargs:
+ preprocess_kwargs["second_text"] = kwargs["second_text"]
+ return preprocess_kwargs, {}, {}
+
+ def preprocess(self, text, second_text=None):
+ return self.tokenizer(text, text_pair=second_text, return_tensors=self.framework)
+
+ def _forward(self, model_inputs):
+ return self.model(**model_inputs)
+
+ def postprocess(self, model_outputs):
+ logits = model_outputs.logits[0].numpy()
+ probabilities = softmax(logits)
+
+ best_class = np.argmax(probabilities)
+ label = self.model.config.id2label[best_class]
+ score = probabilities[best_class].item()
+ logits = logits.tolist()
+ return {"label": label, "score": score, "logits": logits}
+```
+
+L'implementazione รจ agnostica al framework, e lavorerร sia con modelli PyTorch che con TensorFlow. Se l'abbiamo salvato in un file chiamato `pair_classification.py`, puรฒ essere successivamente importato e registrato in questo modo:
+
+```py
+from pair_classification import PairClassificationPipeline
+from transformers.pipelines import PIPELINE_REGISTRY
+from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification
+
+PIPELINE_REGISTRY.register_pipeline(
+ "pair-classification",
+ pipeline_class=PairClassificationPipeline,
+ pt_model=AutoModelForSequenceClassification,
+ tf_model=TFAutoModelForSequenceClassification,
+)
+```
+
+Una volta fatto, possiamo usarla con un modello pretrained. L'istanza `sgugger/finetuned-bert-mrpc` รจ stata
+fine-tuned sul dataset MRPC, che classifica le coppie di frasi come parafrasi o no.
+
+```py
+from transformers import pipeline
+
+classifier = pipeline("pair-classification", model="sgugger/finetuned-bert-mrpc")
+```
+
+Successivamente possiamo condividerlo sull'Hub usando il metodo `push_to_hub`
+
+```py
+classifier.push_to_hub("test-dynamic-pipeline")
+```
+
+Questo codice copierร il file dove รจ stato definitp `PairClassificationPipeline` all'interno della cartella `"test-dynamic-pipeline"`,
+insieme al salvataggio del modello e del tokenizer della pipeline, prima di pushare il tutto nel repository
+`{your_username}/test-dynamic-pipeline`. Dopodichรฉ chiunque potrร utilizzarlo, purchรฉ fornisca l'opzione
+`trust_remote_code=True`:
+
+```py
+from transformers import pipeline
+
+classifier = pipeline(model="{your_username}/test-dynamic-pipeline", trust_remote_code=True)
+```
+
+## Aggiungere la pipeline a Transformers
+
+Se vuoi contribuire con la tua pipeline a Transformers, dovrai aggiungere un modulo nel sottomodulo `pipelines`
+con il codice della tua pipeline, quindi aggiungilo all'elenco dei tasks definiti in `pipelines/__init__.py`.
+
+Poi hai bisogno di aggiungere i test. Crea un nuovo file `tests/test_pipelines_MY_PIPELINE.py` con esempi ed altri test.
+
+La funzione `run_pipeline_test` sarร molto generica e su piccoli modelli casuali su ogni possibile
+architettura, come definito da `model_mapping` e `tf_model_mapping`.
+
+Questo รจ molto importante per testare la compatibilitร futura, nel senso che se qualcuno aggiunge un nuovo modello di
+`XXXForQuestionAnswering` allora il test della pipeline tenterร di essere eseguito su di esso. Poichรฉ i modelli sono casuali, รจ
+รจ impossibile controllare i valori effettivi, per questo esiste un aiuto `ANY` che tenterร solamente di far corrispondere l'output della pipeline TYPE.
+
+Hai anche *bisogno* di implementare 2 (idealmente 4) test.
+
+- `test_small_model_pt` : Definire 1 piccolo modello per questa pipeline (non importa se i risultati non hanno senso)
+ e testare i risultati della pipeline. I risultati dovrebbero essere gli stessi di `test_small_model_tf`.
+- `test_small_model_tf` : Definire 1 piccolo modello per questa pipeline (non importa se i risultati non hanno senso)
+ e testare i risultati della pipeline. I risultati dovrebbero essere gli stessi di `test_small_model_pt`.
+- `test_large_model_pt` (`optional`): Testare la pipeline su una pipeline reale in cui i risultati dovrebbero avere
+ senso. Questi test sono lenti e dovrebbero essere contrassegnati come tali. In questo caso l'obiettivo รจ mostrare la pipeline e assicurarsi che non ci siano derive nelle versioni future
+- `test_large_model_tf` (`optional`): Testare la pipeline su una pipeline reale in cui i risultati dovrebbero avere
+ senso. Questi test sono lenti e dovrebbero essere contrassegnati come tali. In questo caso l'obiettivo รจ mostrare la pipeline e assicurarsi
+ che non ci siano derive nelle versioni future
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/autoclass_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/autoclass_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..edb96528e705eacebdf5281e35f7ce620bd3d8bd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/autoclass_tutorial.md
@@ -0,0 +1,123 @@
+
+
+# Carica istanze pre-allenate con AutoClass
+
+Con cosรฌ tante architetture Transformer differenti, puรฒ essere sfidante crearne una per il tuo checkpoint. Come parte della filosofia centrale di ๐ค Transformers per rendere la libreria facile, semplice e flessibile da utilizzare, una `AutoClass` inferisce e carica automaticamente l'architettura corretta da un dato checkpoint. Il metodo `from_pretrained` ti permette di caricare velocemente un modello pre-allenato per qualsiasi architettura, cosรฌ non devi utilizzare tempo e risorse per allenare un modello da zero. Produrre questo codice agnostico ai checkpoint significa che se il tuo codice funziona per un checkpoint, funzionerร anche per un altro checkpoint, purchรฉ sia stato allenato per un compito simile, anche se l'architettura รจ differente.
+
+
+
+Ricorda, con architettura ci si riferisce allo scheletro del modello e con checkpoint ai pesi di una determinata architettura. Per esempio, [BERT](https://huggingface.co/google-bert/bert-base-uncased) รจ un'architettura, mentre `google-bert/bert-base-uncased` รจ un checkpoint. Modello รจ un termine generale che puรฒ significare sia architettura che checkpoint.
+
+
+
+In questo tutorial, imparerai a:
+
+* Caricare un tokenizer pre-allenato.
+* Caricare un estrattore di caratteristiche (feature extractor, in inglese) pre-allenato.
+* Caricare un processore pre-allenato.
+* Caricare un modello pre-allenato.
+
+## AutoTokenizer
+
+Quasi tutti i compiti di NLP iniziano con un tokenizer. Un tokenizer converte il tuo input in un formato che possa essere elaborato dal modello.
+
+Carica un tokenizer con [`AutoTokenizer.from_pretrained`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("FacebookAI/xlm-roberta-base")
+```
+
+Poi tokenizza il tuo input come mostrato in seguito:
+
+```py
+>>> sequenza = "In un buco nel terreno viveva uno Hobbit."
+>>> print(tokenizer(sequenza))
+{'input_ids': [0, 360, 51, 373, 587, 1718, 54644, 22597, 330, 3269, 2291, 22155, 18, 5, 2],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+## AutoFeatureExtractor
+
+Per compiti inerenti a audio e video, un feature extractor processa il segnale audio o l'immagine nel formato di input corretto.
+
+Carica un feature extractor con [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained(
+... "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
+... )
+```
+
+## AutoProcessor
+
+Compiti multimodali richiedono un processore che combini i due tipi di strumenti di elaborazione. Per esempio, il modello [LayoutLMV2](model_doc/layoutlmv2) richiede un feature extractor per gestire le immagine e un tokenizer per gestire il testo; un processore li combina entrambi.
+
+Carica un processore con [`AutoProcessor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("microsoft/layoutlmv2-base-uncased")
+```
+
+## AutoModel
+
+
+
+Infine, le classi `AutoModelFor` ti permettono di caricare un modello pre-allenato per un determinato compito (guarda [qui](model_doc/auto) per una lista completa di compiti presenti). Per esempio, carica un modello per la classificazione di sequenze con [`AutoModelForSequenceClassification.from_pretrained`]:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Semplicemente utilizza lo stesso checkpoint per caricare un'architettura per un task differente:
+
+```py
+>>> from transformers import AutoModelForTokenClassification
+
+>>> model = AutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Generalmente, raccomandiamo di utilizzare la classe `AutoTokenizer` e la classe `AutoModelFor` per caricare istanze pre-allenate dei modelli. Questo ti assicurerร di aver caricato la corretta architettura ogni volta. Nel prossimo [tutorial](preprocessing), imparerai come utilizzare il tokenizer, il feature extractor e il processore per elaborare un dataset per il fine-tuning.
+
+
+
+Infine, le classi `TFAutoModelFor` ti permettono di caricare un modello pre-allenato per un determinato compito (guarda [qui](model_doc/auto) per una lista completa di compiti presenti). Per esempio, carica un modello per la classificazione di sequenze con [`TFAutoModelForSequenceClassification.from_pretrained`]:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Semplicemente utilizza lo stesso checkpoint per caricare un'architettura per un task differente:
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Generalmente, raccomandiamo di utilizzare la classe `AutoTokenizer` e la classe `TFAutoModelFor` per caricare istanze pre-allenate dei modelli. Questo ti assicurerร di aver caricato la corretta architettura ogni volta. Nel prossimo [tutorial](preprocessing), imparerai come utilizzare il tokenizer, il feature extractor e il processore per elaborare un dataset per il fine-tuning.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/big_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/big_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..6a5c346dec890fb29b2f91a22dfe609229d8b1b8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/big_models.md
@@ -0,0 +1,123 @@
+
+
+# Istanziare un big model
+
+Quando vuoi utilizzare un modello preaddestrato (pretrained) molto grande, una sfida รจ minimizzare l'uso della RAM. Il workflow classico
+in PyTorch รจ:
+
+1. Crea il tuo modello con pesi casuali (random weights).
+2. Carica i tuoi pesi preaddestrati.
+3. Inserisci i pesi preaddestrati nel tuo modello casuale.
+
+I passi 1 e 2 una versione completa del modello in memoria, in molti casi non รจ un problema, ma se il modello inizia a pesare diversi GigaBytes, queste due copie possono sturare la nostra RAM. Ancora peggio, se stai usando `torch.distributed` per seguire l'addestramento (training) in distribuito, ogni processo caricherร il modello preaddestrato e memorizzerร queste due copie nella RAM.
+
+
+
+Nota che il modello creato casualmente รจ inizializzato con tensori "vuoti", che occupano spazio in memoria ma senza riempirlo (quindi i valori casuali sono quelli che si trovavano in questa porzione di memoria in un determinato momento). L'inizializzazione casuale che segue la distribuzione appropriata per il tipo di modello/parametri istanziato (come la distribuzione normale per le istanze) รจ eseguito solo dopo il passaggio 3 sui pesi non inizializzati, per essere piรน rapido possibile!
+
+
+
+In questa guida, esploreremo le soluzioni che Transformers offre per affrontare questo problema. C'รจ da tenere in conto che questa รจ un'area in cui si sta attualmente sviluppando, quindi le API spiegate qui possono variare velocemente in futuro.
+
+## Checkpoints condivisi
+
+Dalla versione 4.18.0, i checkpoints dei modelli che occupano piรน di 10GB di spazio vengono automaticamente frammentati in piรน parti. Per quanto riguarda la possibilitร di avere un unico checkpoint quando si utilizza `model.save_pretrained(save_dir)`, si hanno diversi checkpoint parziali (ognuno con dimensione < 10GB) e un indice che mappa i nomi dei parametri ai file in cui sono memorizzati.
+
+Puoi controllare la dimensione massima dopo la frammentazione con il parametro `max_shard_size`, nel prossimo esempio, useremo modelli di dimensioni normali con frammenti di piccoli dimensioni: prendiamo un modello BERT classico.
+
+```py
+from transformers import AutoModel
+
+model = AutoModel.from_pretrained("google-bert/bert-base-cased")
+```
+
+Se tu salvi usando [`~PreTrainedModel.save_pretrained`], avrai una nuova cartella con due file: il config del modello e i suoi pesi:
+
+```py
+>>> import os
+>>> import tempfile
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir)
+... print(sorted(os.listdir(tmp_dir)))
+['config.json', 'pytorch_model.bin']
+```
+
+Adesso usiamo una dimensione massima di frammentazione di 200MB:
+
+```py
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... print(sorted(os.listdir(tmp_dir)))
+['config.json', 'pytorch_model-00001-of-00003.bin', 'pytorch_model-00002-of-00003.bin', 'pytorch_model-00003-of-00003.bin', 'pytorch_model.bin.index.json']
+```
+
+In aggiunta alla configurazione del modello, vediamo tre differenti file dei pesi, e un file `index.json` che รจ il nostro indice. Un checkpoint puรฒ essere ricaricato totalmente usando il metodo [`~PreTrainedModel.from_pretrained`]:
+
+```py
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... new_model = AutoModel.from_pretrained(tmp_dir)
+```
+
+Il vantaggio principale di applicare questo metodo per modelli grandi รจ che durante il passo 2 del workflow illustrato in precedenza, ogni frammento del checkpoint viene caricato dopo il precedente, limitando l'utilizzo della RAM alla dimensione del modello piรน la dimensione del frammento piรน grande.
+
+Dietro le quinte, il file indice รจ utilizzato per determinare quali chiavi sono nel checkpoint, e dove i corrispondenti pesi sono memorizzati. Possiamo caricare l'indice come un qualsiasi json e ottenere un dizionario:
+
+```py
+>>> import json
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... with open(os.path.join(tmp_dir, "pytorch_model.bin.index.json"), "r") as f:
+... index = json.load(f)
+
+>>> print(index.keys())
+dict_keys(['metadata', 'weight_map'])
+```
+
+I metadati consistono solo nella dimensione totale del modello per ora. Abbiamo in programma di aggiungere altre informazioni in futuro:
+
+```py
+>>> index["metadata"]
+{'total_size': 433245184}
+```
+
+La mappa dei pesi รจ la parte principale di questo indice, che mappa ogni nome dei parametri (si trova solitamente nei modelli PyTorch come `state_dict`) al file in cui รจ memorizzato:
+
+```py
+>>> index["weight_map"]
+{'embeddings.LayerNorm.bias': 'pytorch_model-00001-of-00003.bin',
+ 'embeddings.LayerNorm.weight': 'pytorch_model-00001-of-00003.bin',
+ ...
+```
+
+Se vuoi caricare direttamente un checkpoint frammentato in un modello senza usare [`~PreTrainedModel.from_pretrained`] (come si farebbe con `model.load_state_dict()` per un checkpoint completo) devi usare [`~modeling_utils.load_sharded_checkpoint`]:
+
+```py
+>>> from transformers.modeling_utils import load_sharded_checkpoint
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... load_sharded_checkpoint(model, tmp_dir)
+```
+
+## Caricamento low memory
+
+Frammentare i checkpoint l'utilizzo di memoria al passo 2 del workflow citato in precedenza, ma per utilizzare questo modello in un ambiente con poca memoria, consigliamo di utilizzare i nostri strumenti basati sulla libreria Accelerate.
+
+Per ulteriori informazioni, leggere la seguente guida: [Large model loading using Accelerate](./main_classes/model#large-model-loading)
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/community.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/community.md
new file mode 100644
index 0000000000000000000000000000000000000000..92f6698a9a89bb8243ea84e3ab5698d2e8374f90
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/community.md
@@ -0,0 +1,68 @@
+
+
+# Comunitร
+
+Questa pagina raggruppa le risorse sviluppate dalla comunitร riguardo ๐ค Transformers.
+
+## Risorse della comunitร :
+
+| Risorsa | Descrizione | Autore |
+|:----------|:-------------|------:|
+| [Glossario delle Flashcards di Transformers](https://www.darigovresearch.com/huggingface-transformers-glossary-flashcards) | Un insieme di flashcards basate sul [glossario della documentazione di Transformers](glossary), creato in un formato tale da permettere un facile apprendimento e revisione usando [Anki](https://apps.ankiweb.net/), un'applicazione open-source e multi-piattaforma, specificatamente progettata per ricordare informazioni nel lungo termine. Guarda questo [video introduttivo su come usare le flashcards](https://www.youtube.com/watch?v=Dji_h7PILrw). | [Darigov Research](https://www.darigovresearch.com/) |
+
+## Notebook della comunitร :
+
+| Notebook | Descrizione | Autore | |
+|:----------|:-------------|:-------------|------:|
+| [Fine-tuning di un Transformer pre-addestrato, al fine di generare testi di canzoni](https://github.com/AlekseyKorshuk/huggingartists) | Come generare testi di canzoni nello stile del vostro artista preferito attraverso il fine-tuning di un modello GPT-2. | [Aleksey Korshuk](https://github.com/AlekseyKorshuk) | [](https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb) |
+| [Addestramento di T5 in Tensorflow 2](https://github.com/snapthat/TF-T5-text-to-text) | Come addestrare T5 per qualsiasi attivitร usando Tensorflow 2. Questo notebook mostra come risolvere l'attivitร di "Question Answering" usando Tensorflow 2 e SQUAD. | [Muhammad Harris](https://github.com/HarrisDePerceptron) |[](https://colab.research.google.com/github/snapthat/TF-T5-text-to-text/blob/master/snapthatT5/notebooks/TF-T5-Datasets%20Training.ipynb) |
+| [Addestramento di T5 con TPU](https://github.com/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb) | Come addestrare T5 su SQUAD con Transformers e NLP. | [Suraj Patil](https://github.com/patil-suraj) |[](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb#scrollTo=QLGiFCDqvuil) |
+| [Fine-tuning di T5 per la classificazione e scelta multipla](https://github.com/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) | Come effettuare il fine-tuning di T5 per le attivitร di classificazione a scelta multipla - usando un formato testo-a-testo - con PyTorch Lightning. | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) |
+| [Fine-tuning di DialoGPT su nuovi dataset e lingue](https://github.com/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) | Come effettuare il fine-tuning di un modello DialoGPT su un nuovo dataset per chatbots conversazionali open-dialog. | [Nathan Cooper](https://github.com/ncoop57) | [](https://colab.research.google.com/github/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) |
+| [Modellamento di una lunga sequenza con Reformer](https://github.com/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) | Come addestrare su sequenze di lunghezza fino a 500 mila token con Reformer. | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) |
+| [Fine-tuning di BART per riassumere testi](https://github.com/ohmeow/ohmeow_website/blob/master/_notebooks/2020-05-23-text-generation-with-blurr.ipynb) | Come effettuare il fine-tuning di BART per riassumere testi con fastai usando blurr. | [Wayde Gilliam](https://ohmeow.com/) | [](https://colab.research.google.com/github/ohmeow/ohmeow_website/blob/master/_notebooks/2020-05-23-text-generation-with-blurr.ipynb) |
+| [Fine-tuning di un Transformer pre-addestrato su tweet](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) | Come generare tweet nello stile del tuo account Twitter preferito attraverso il fine-tuning di un modello GPT-2. | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) |
+| [Ottimizzazione di modelli ๐ค Hugging Face con Weights & Biases](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) | Un tutorial completo che mostra l'integrazione di W&B con Hugging Face. | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) |
+| [Longformer pre-addestrato](https://github.com/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) | Come costruire una versione "long" degli esistenti modelli pre-addestrati. | [Iz Beltagy](https://beltagy.net) | [](https://colab.research.google.com/github/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) |
+| [Fine-tuning di Longformer per QA](https://github.com/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) | Come effettuare il fine-tuning di un modello longformer per un task di QA.| [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) |
+| [Valutazione di modelli con ๐คNLP](https://github.com/patrickvonplaten/notebooks/blob/master/How_to_evaluate_Longformer_on_TriviaQA_using_NLP.ipynb) | Come valutare longformer su TriviaQA con `NLP`. | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/drive/1m7eTGlPmLRgoPkkA7rkhQdZ9ydpmsdLE?usp=sharing) |
+| [Fine-tuning di T5 per Sentiment Span Extraction](https://github.com/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) | Come effettuare il fine-tuning di T5 per la sentiment span extraction - usando un formato testo-a-testo - con PyTorch Lightning. | [Lorenzo Ampil](https://github.com/enzoampil) | [](https://colab.research.google.com/github/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) |
+| [Fine-tuning di DistilBert per la classificazione multi-classe](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb) | Come effettuare il fine-tuning di DistilBert per la classificazione multi-classe con PyTorch. | [Abhishek Kumar Mishra](https://github.com/abhimishra91) | [](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb)|
+|[Fine-tuning di BERT per la classificazione multi-etichetta](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)|Come effettuare il fine-tuning di BERT per la classificazione multi-etichetta con PyTorch. |[Abhishek Kumar Mishra](https://github.com/abhimishra91) |[](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)|
+|[Accelerazione del fine-tuning con il Dynamic Padding / Bucketing](https://github.com/ELS-RD/transformers-notebook/blob/master/Divide_Hugging_Face_Transformers_training_time_by_2_or_more.ipynb)| Come velocizzare il fine-tuning di un fattore 2X usando il dynamic padding / bucketing. |[Michael Benesty](https://github.com/pommedeterresautee) |[](https://colab.research.google.com/drive/1CBfRU1zbfu7-ijiOqAAQUA-RJaxfcJoO?usp=sharing)|
+|[Pre-addestramento di Reformer per Masked Language Modeling](https://github.com/patrickvonplaten/notebooks/blob/master/Reformer_For_Masked_LM.ipynb)| Come addestrare un modello Reformer usando livelli di self-attention bi-direzionali.| [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/drive/1tzzh0i8PgDQGV3SMFUGxM7_gGae3K-uW?usp=sharing)|
+|[Espansione e fine-tuning di Sci-BERT](https://github.com/lordtt13/word-embeddings/blob/master/COVID-19%20Research%20Data/COVID-SciBERT.ipynb)| Come incrementare il vocabolario di un modello SciBERT - pre-addestrato da AllenAI sul dataset CORD - e crearne una pipeline. | [Tanmay Thakur](https://github.com/lordtt13) | [](https://colab.research.google.com/drive/1rqAR40goxbAfez1xvF3hBJphSCsvXmh8)|
+|[Fine-tuning di BlenderBotSmall per riassumere testi usando Trainer API](https://github.com/lordtt13/transformers-experiments/blob/master/Custom%20Tasks/fine-tune-blenderbot_small-for-summarization.ipynb)| Come effettuare il fine-tuning di BlenderBotSmall per riassumere testi su un dataset personalizzato, usando Trainer API. | [Tanmay Thakur](https://github.com/lordtt13) | [](https://colab.research.google.com/drive/19Wmupuls7mykSGyRN_Qo6lPQhgp56ymq?usp=sharing)|
+|[Fine-tuning di Electra e interpretazione con Integrated Gradients](https://github.com/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb) | Come effettuare il fine-tuning di Electra per l'analisi dei sentimenti e intepretare le predizioni con Captum Integrated Gradients. | [Eliza Szczechla](https://elsanns.github.io) | [](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb)|
+|[Fine-tuning di un modello GPT-2 non inglese con la classe Trainer](https://github.com/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb) | Come effettuare il fine-tuning di un modello GPT-2 non inglese con la classe Trainer. | [Philipp Schmid](https://www.philschmid.de) | [](https://colab.research.google.com/github/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb)|
+|[Fine-tuning di un modello DistilBERT per la classficazione multi-etichetta](https://github.com/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb) | Come effettuare il fine-tuning di un modello DistilBERT per l'attivitร di classificazione multi-etichetta. | [Dhaval Taunk](https://github.com/DhavalTaunk08) | [](https://colab.research.google.com/github/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb)|
+|[Fine-tuning di ALBERT per la classifcazione di coppie di frasi](https://github.com/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb) | Come effettuare il fine-tuning di un modello ALBERT - o un altro modello BERT-based - per l'attivitร di classificazione di coppie di frasi. | [Nadir El Manouzi](https://github.com/NadirEM) | [](https://colab.research.google.com/github/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb)|
+|[Fine-tuning di Roberta per l'analisi di sentimenti](https://github.com/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb) | Come effettuare il fine-tuning di un modello Roberta per l'analisi di sentimenti. | [Dhaval Taunk](https://github.com/DhavalTaunk08) | [](https://colab.research.google.com/github/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb)|
+|[Valutazione di modelli che generano domande](https://github.com/flexudy-pipe/qugeev) | Quanto sono accurante le risposte alle domande generate dal tuo modello transformer seq2seq? | [Pascal Zoleko](https://github.com/zolekode) | [](https://colab.research.google.com/drive/1bpsSqCQU-iw_5nNoRm_crPq6FRuJthq_?usp=sharing)|
+|[Classificazione di testo con DistilBERT e Tensorflow](https://github.com/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb) | Come effettuare il fine-tuning di DistilBERT per la classificazione di testo in TensorFlow. | [Peter Bayerle](https://github.com/peterbayerle) | [](https://colab.research.google.com/github/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb)|
+|[Utilizzo di BERT per riassumere testi con un modello Encoder-Decoder su CNN/Dailymail](https://github.com/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb) | Come avviare "a caldo" un *EncoderDecoderModel* attraverso l'utilizzo di un checkpoint *google-bert/bert-base-uncased* per riassumere testi su CNN/Dailymail. | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb)|
+|[Utilizzo di RoBERTa per riassumere testi con un modello Encoder-Decoder su BBC XSum](https://github.com/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb) | Come avviare "a caldo" un *EncoderDecoderModel* (condiviso) attraverso l'utilizzo di un checkpoint *FacebookAI/roberta-base* per riassumere testi su BBC/XSum. | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb)|
+|[Fine-tuning di TAPAS su Sequential Question Answering (SQA)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) | Come effettuare il fine-tuning di un modello *TapasForQuestionAnswering* attraverso l'utilizzo di un checkpoint *tapas-base* sul dataset Sequential Question Answering (SQA). | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb)|
+|[Valutazione di TAPAS su Table Fact Checking (TabFact)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb) | Come valutare un modello *TapasForSequenceClassification* - fine-tuned con un checkpoint *tapas-base-finetuned-tabfact* - usando una combinazione delle librerie ๐ค datasets e ๐ค transformers. | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb)|
+|[Fine-tuning di mBART per la traduzione](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb) | Come effettuare il fine-tuning di mBART usando Seq2SeqTrainer per la traduzione da hindi a inglese.| [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb)|
+|[Fine-tuning di LayoutLM su FUNSD (un dataset per la comprensione della forma)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb) | Come effettuare il fine-tuning di un modello *LayoutLMForTokenClassification* sul dataset FUNSD per l'estrazione di informazioni da documenti scannerizzati.| [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb)|
+|[Fine-tuning di DistilGPT2 e generazione di testo](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb) | Come effettuare il fine-tuning di DistilGPT2 e generare testo. | [Aakash Tripathi](https://github.com/tripathiaakash) | [](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb)|
+|[Fine-tuning di LED fino a 8 mila token](https://github.com/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb) | Come effettuare il fine-tuning di LED su PubMed per riassumere "lunghi" testi. | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb)|
+|[Valutazione di LED su Arxiv](https://github.com/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb) | Come valutare efficacemente LED sull'attivitร di riassumere "lunghi" testi. | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb)|
+|[Fine-tuning di LayoutLM su RVL-CDIP, un dataset per la classificazione di documenti (immagini)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb) | Come effettuare il fine-tuning di un modello *LayoutLMForSequenceClassification* sul dataset RVL-CDIP per la classificazione di documenti scannerizzati. | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb)|
+|[Decodifica Wav2Vec2 CTC con variazioni di GPT2](https://github.com/voidful/huggingface_notebook/blob/main/xlsr_gpt.ipynb) | Come decodificare sequenze CTC, variate da modelli di linguaggio. | [Eric Lam](https://github.com/voidful) | [](https://colab.research.google.com/drive/1e_z5jQHYbO2YKEaUgzb1ww1WwiAyydAj?usp=sharing)
+|[Fine-tuning di BART per riassumere testi in due lingue con la classe Trainer](https://github.com/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb) | Come effettuare il fine-tuning di BART per riassumere testi in due lingue usando la classe Trainer. | [Eliza Szczechla](https://github.com/elsanns) | [](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb)|
+|[Valutazione di Big Bird su Trivia QA](https://github.com/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb) | Come valutare BigBird su question answering di "lunghi" documenti attraverso Trivia QA. | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb)|
+| [Creazione di sottotitoli per video usando Wav2Vec2](https://github.com/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) | Come creare sottotitoli per qualsiasi video di YouTube trascrivendo l'audio con Wav2Vec. | [Niklas Muennighoff](https://github.com/Muennighoff) |[](https://colab.research.google.com/github/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) |
+| [Fine-tuning di Vision Transformer su CIFAR-10 usando PyTorch Lightning](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) | Come effettuare il fine-tuning di Vision Transformer (ViT) su CIFAR-10 usando HuggingFace Transformers, Datasets e PyTorch Lightning.| [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) |
+| [Fine-tuning di Vision Transformer su CIFAR-10 usando ๐ค Trainer](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) | Come effettuare il fine-tuning di Vision Transformer (ViT) su CIFAR-10 usando HuggingFace Transformers, Datasets e ๐ค Trainer. | [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) |
+| [Valutazione di LUKE su Open Entity, un dataset di entity typing](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) | Come valutare un modello *LukeForEntityClassification* sul dataset Open Entity. | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) |
+| [Valutazione di LUKE su TACRED, un dataset per l'estrazione di relazioni](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) | Come valutare un modello *LukeForEntityPairClassification* sul dataset TACRED. | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) |
+| [Valutazione di LUKE su CoNLL-2003, un importante benchmark NER](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) | Come valutare un modello *LukeForEntitySpanClassification* sul dataset CoNLL-2003. | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) |
+| [Valutazione di BigBird-Pegasus su dataset PubMed](https://github.com/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) | Come valutare un modello *BigBirdPegasusForConditionalGeneration* su dataset PubMed. | [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) |
+| [Classificazione di emozioni dal discorso con Wav2Vec2](https://github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) | Come utilizzare un modello pre-addestrato Wav2Vec2 per la classificazione di emozioni sul dataset MEGA. | [Mehrdad Farahani](https://github.com/m3hrdadfi) | [](https://colab.research.google.com/github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) |
+| [Rilevamento oggetti in un'immagine con DETR](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) | Come usare un modello addestrato *DetrForObjectDetection* per rilevare oggetti in un'immagine e visualizzare l'attention. | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) |
+| [Fine-tuning di DETR su un dataset personalizzato per rilevare oggetti](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) | Come effettuare fine-tuning di un modello *DetrForObjectDetection* su un dataset personalizzato per rilevare oggetti. | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) |
+| [Fine-tuning di T5 per Named Entity Recognition](https://github.com/ToluClassics/Notebooks/blob/main/T5_Ner_Finetuning.ipynb) | Come effettuare fine-tunining di *T5* per un'attivitร di Named Entity Recognition. | [Ogundepo Odunayo](https://github.com/ToluClassics) | [](https://colab.research.google.com/drive/1obr78FY_cBmWY5ODViCmzdY6O1KB65Vc?usp=sharing) |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/converting_tensorflow_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/converting_tensorflow_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..8280e58cc9208b8de719b2290d12b5d454a914de
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/converting_tensorflow_models.md
@@ -0,0 +1,144 @@
+
+
+# Convertire checkpoint di Tensorflow
+
+ร disponibile un'interfaccia a linea di comando per convertire gli originali checkpoint di Bert/GPT/GPT-2/Transformer-XL/XLNet/XLM
+in modelli che possono essere caricati utilizzando i metodi `from_pretrained` della libreria.
+
+
+
+A partire dalla versione 2.3.0 lo script di conversione รจ parte di transformers CLI (**transformers-cli**), disponibile in ogni installazione
+di transformers >=2.3.0.
+
+La seguente documentazione riflette il formato dei comandi di **transformers-cli convert**.
+
+
+
+## BERT
+
+Puoi convertire qualunque checkpoint Tensorflow di BERT (in particolare
+[i modeli pre-allenati rilasciati da Google](https://github.com/google-research/bert#pre-trained-models))
+in un file di salvataggio Pytorch utilizzando lo script
+[convert_bert_original_tf_checkpoint_to_pytorch.py](https://github.com/huggingface/transformers/tree/main/src/transformers/models/bert/convert_bert_original_tf_checkpoint_to_pytorch.py).
+
+Questo CLI prende come input un checkpoint di Tensorflow (tre files che iniziano con `bert_model.ckpt`) ed il relativo
+file di configurazione (`bert_config.json`), crea un modello Pytorch per questa configurazione, carica i pesi dal
+checkpoint di Tensorflow nel modello di Pytorch e salva il modello che ne risulta in un file di salvataggio standard di Pytorch che
+puรฒ essere importato utilizzando `from_pretrained()` (vedi l'esempio nel
+[quicktour](quicktour) , [run_glue.py](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification/run_glue.py) ).
+
+Devi soltanto lanciare questo script di conversione **una volta** per ottenere un modello Pytorch. Dopodichรจ, potrai tralasciare
+il checkpoint di Tensorflow (i tre files che iniziano con `bert_model.ckpt`), ma assicurati di tenere il file di configurazione
+(`bert_config.json`) ed il file di vocabolario (`vocab.txt`) in quanto queste componenti sono necessarie anche per il modello di Pytorch.
+
+Per lanciare questo specifico script di conversione avrai bisogno di un'installazione di Tensorflow e di Pytorch
+(`pip install tensorflow`). Il resto della repository richiede soltanto Pytorch.
+
+Questo รจ un esempio del processo di conversione per un modello `BERT-Base Uncased` pre-allenato:
+
+```bash
+export BERT_BASE_DIR=/path/to/bert/uncased_L-12_H-768_A-12
+transformers-cli convert --model_type bert \
+ --tf_checkpoint $BERT_BASE_DIR/bert_model.ckpt \
+ --config $BERT_BASE_DIR/bert_config.json \
+ --pytorch_dump_output $BERT_BASE_DIR/pytorch_model.bin
+```
+
+Puoi scaricare i modelli pre-allenati di Google per la conversione [qua](https://github.com/google-research/bert#pre-trained-models).
+
+## ALBERT
+
+Per il modello ALBERT, converti checkpoint di Tensoflow in Pytorch utilizzando lo script
+[convert_albert_original_tf_checkpoint_to_pytorch.py](https://github.com/huggingface/transformers/tree/main/src/transformers/models/albert/convert_albert_original_tf_checkpoint_to_pytorch.py).
+
+Il CLI prende come input un checkpoint di Tensorflow (tre files che iniziano con `model.ckpt-best`) e i relativi file di
+configurazione (`albert_config.json`), dopodichรจ crea e salva un modello Pytorch. Per lanciare questa conversione
+avrai bisogno di un'installazione di Tensorflow e di Pytorch.
+
+Ecco un esempio del procedimento di conversione di un modello `ALBERT Base` pre-allenato:
+
+```bash
+export ALBERT_BASE_DIR=/path/to/albert/albert_base
+transformers-cli convert --model_type albert \
+ --tf_checkpoint $ALBERT_BASE_DIR/model.ckpt-best \
+ --config $ALBERT_BASE_DIR/albert_config.json \
+ --pytorch_dump_output $ALBERT_BASE_DIR/pytorch_model.bin
+```
+
+Puoi scaricare i modelli pre-allenati di Google per la conversione [qui](https://github.com/google-research/albert#pre-trained-models).
+
+## OpenAI GPT
+
+Ecco un esempio del processo di conversione di un modello OpenAI GPT pre-allenato, assumendo che il tuo checkpoint di NumPy
+sia salvato nello stesso formato dei modelli pre-allenati OpenAI (vedi [qui](https://github.com/openai/finetune-transformer-lm)):
+```bash
+export OPENAI_GPT_CHECKPOINT_FOLDER_PATH=/path/to/openai/pretrained/numpy/weights
+transformers-cli convert --model_type gpt \
+ --tf_checkpoint $OPENAI_GPT_CHECKPOINT_FOLDER_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \
+ [--config OPENAI_GPT_CONFIG] \
+ [--finetuning_task_name OPENAI_GPT_FINETUNED_TASK] \
+```
+
+## OpenAI GPT-2
+
+Ecco un esempio del processo di conversione di un modello OpenAI GPT-2 pre-allenato (vedi [qui](https://github.com/openai/gpt-2)):
+
+```bash
+export OPENAI_GPT2_CHECKPOINT_PATH=/path/to/openai-community/gpt2/pretrained/weights
+transformers-cli convert --model_type gpt2 \
+ --tf_checkpoint $OPENAI_GPT2_CHECKPOINT_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \
+ [--config OPENAI_GPT2_CONFIG] \
+ [--finetuning_task_name OPENAI_GPT2_FINETUNED_TASK]
+```
+
+## XLNet
+
+Ecco un esempio del processo di conversione di un modello XLNet pre-allenato:
+
+```bash
+export TRANSFO_XL_CHECKPOINT_PATH=/path/to/xlnet/checkpoint
+export TRANSFO_XL_CONFIG_PATH=/path/to/xlnet/config
+transformers-cli convert --model_type xlnet \
+ --tf_checkpoint $TRANSFO_XL_CHECKPOINT_PATH \
+ --config $TRANSFO_XL_CONFIG_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT \
+ [--finetuning_task_name XLNET_FINETUNED_TASK] \
+```
+
+## XLM
+
+Ecco un esempio del processo di conversione di un modello XLM pre-allenato:
+
+```bash
+export XLM_CHECKPOINT_PATH=/path/to/xlm/checkpoint
+transformers-cli convert --model_type xlm \
+ --tf_checkpoint $XLM_CHECKPOINT_PATH \
+ --pytorch_dump_output $PYTORCH_DUMP_OUTPUT
+ [--config XML_CONFIG] \
+ [--finetuning_task_name XML_FINETUNED_TASK]
+```
+
+## T5
+
+Ecco un esempio del processo di conversione di un modello T5 pre-allenato:
+
+```bash
+export T5=/path/to/t5/uncased_L-12_H-768_A-12
+transformers-cli convert --model_type t5 \
+ --tf_checkpoint $T5/t5_model.ckpt \
+ --config $T5/t5_config.json \
+ --pytorch_dump_output $T5/pytorch_model.bin
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/create_a_model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/create_a_model.md
new file mode 100644
index 0000000000000000000000000000000000000000..caacf4fadc5db6dd6f69e6a23afaeca21009a499
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/create_a_model.md
@@ -0,0 +1,361 @@
+
+
+# Crea un'architettura personalizzata
+
+Una [`AutoClass`](model_doc/auto) deduce automaticamente il modello dell'architettura e scarica la configurazione e i pesi pre-allenati. Generalmente, noi consigliamo di usare un `AutoClass` per produrre un codice indipendente dal checkpoint. Ma gli utenti che desiderano un controllo maggiore su parametri specifici del modello possono creare un modello ๐ค Transformers personalizzato da poche classi base. Questo potrebbe essere particolarmente utile per qualunque persona sia interessata nel studiare, allenare o sperimentare con un modello ๐ค Transformers. In questa guida, approfondisci la creazione di un modello personalizzato senza `AutoClass`. Impara come:
+
+- Caricare e personalizzare una configurazione del modello.
+- Creare un'architettura modello.
+- Creare un tokenizer lento e veloce per il testo.
+- Creare un estrattore di caratteristiche per attivitร riguardanti audio o immagini.
+- Creare un processore per attivitร multimodali.
+
+## Configurazione
+
+Una [configurazione](main_classes/configuration) si riferisce agli attributi specifici di un modello. Ogni configurazione del modello ha attributi diversi; per esempio, tutti i modelli npl hanno questi attributi in comune `hidden_size`, `num_attention_heads`, `num_hidden_layers` e `vocab_size`. Questi attributi specificano il numero di attention heads o strati nascosti con cui costruire un modello.
+
+Dai un'occhiata piรน da vicino a [DistilBERT](model_doc/distilbert) accedendo a [`DistilBertConfig`] per ispezionare i suoi attributi:
+
+```py
+>>> from transformers import DistilBertConfig
+
+>>> config = DistilBertConfig()
+>>> print(config)
+DistilBertConfig {
+ "activation": "gelu",
+ "attention_dropout": 0.1,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+[`DistilBertConfig`] mostra tutti gli attributi predefiniti usati per costruire una base [`DistilBertModel`]. Tutti gli attributi sono personalizzabili, creando uno spazio per sperimentare. Per esempio, puoi configurare un modello predefinito per:
+
+- Provare un funzione di attivazione diversa con il parametro `activation`.
+- Utilizzare tasso di drop out piรน elevato per le probalitร di attention con il parametro `attention_dropout`.
+
+```py
+>>> my_config = DistilBertConfig(activation="relu", attention_dropout=0.4)
+>>> print(my_config)
+DistilBertConfig {
+ "activation": "relu",
+ "attention_dropout": 0.4,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+Nella funzione [`~PretrainedConfig.from_pretrained`] possono essere modificati gli attributi del modello pre-allenato:
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("distilbert/distilbert-base-uncased", activation="relu", attention_dropout=0.4)
+```
+
+Quando la configurazione del modello ti soddisfa, la puoi salvare con [`~PretrainedConfig.save_pretrained`]. Il file della tua configurazione รจ memorizzato come file JSON nella save directory specificata:
+
+```py
+>>> my_config.save_pretrained(save_directory="./your_model_save_path")
+```
+
+Per riutilizzare la configurazione del file, caricalo con [`~PretrainedConfig.from_pretrained`]:
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+```
+
+
+
+Puoi anche salvare il file di configurazione come dizionario oppure come la differenza tra gli attributi della tua configurazione personalizzata e gli attributi della configurazione predefinita! Guarda la documentazione [configuration](main_classes/configuration) per piรน dettagli.
+
+
+
+## Modello
+
+Il prossimo passo e di creare [modello](main_classes/models). Il modello - vagamente riferito anche come architettura - definisce cosa ogni strato deve fare e quali operazioni stanno succedendo. Attributi come `num_hidden_layers` provenienti dalla configurazione sono usati per definire l'architettura. Ogni modello condivide la classe base [`PreTrainedModel`] e alcuni metodi comuni come il ridimensionamento degli input embeddings e la soppressione delle self-attention heads . Inoltre, tutti i modelli sono la sottoclasse di [`torch.nn.Module`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html), [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) o [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html). Cio significa che i modelli sono compatibili con l'uso di ciascun di framework.
+
+
+
+Carica gli attributi della tua configurazione personalizzata nel modello:
+
+```py
+>>> from transformers import DistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+>>> model = DistilBertModel(my_config)
+```
+
+Questo crea modelli con valori casuali invece di pesi pre-allenati. Non sarai in grado di usare questo modello per niente di utile finchรฉ non lo alleni. L'allenamento รจ un processo costoso e che richiede tempo . Generalmente รจ meglio usare un modello pre-allenato per ottenere risultati migliori velocemente, utilizzando solo una frazione delle risorse neccesarie per l'allenamento.
+
+Crea un modello pre-allenato con [`~PreTrainedModel.from_pretrained`]:
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Quando carichi pesi pre-allenati, la configurazione del modello predefinito รจ automaticamente caricata se il modello รจ fornito da ๐ค Transformers. Tuttavia, puoi ancora sostituire gli attributi - alcuni o tutti - di configurazione del modello predefinito con i tuoi se lo desideri:
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+Carica gli attributi di configurazione personalizzati nel modello:
+
+```py
+>>> from transformers import TFDistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+>>> tf_model = TFDistilBertModel(my_config)
+```
+
+
+Questo crea modelli con valori casuali invece di pesi pre-allenati. Non sarai in grado di usare questo modello per niente di utile finchรฉ non lo alleni. L'allenamento รจ un processo costoso e che richiede tempo . Generalmente รจ meglio usare un modello pre-allenato per ottenere risultati migliori velocemente, utilizzando solo una frazione delle risorse neccesarie per l'allenamento.
+
+Crea un modello pre-allenoto con [`~TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Quando carichi pesi pre-allenati, la configurazione del modello predefinito รจ automaticamente caricato se il modello รจ fornito da ๐ค Transformers. Tuttavia, puoi ancora sostituire gli attributi - alcuni o tutti - di configurazione del modello predefinito con i tuoi se lo desideri:
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+
+
+### Model head
+
+A questo punto, hai un modello DistilBERT base i cui output sono gli *hidden states* (in italiano stati nascosti). Gli stati nascosti sono passati come input a un model head per produrre l'output finale. ๐ค Transformers fornisce un model head diverso per ogni attivitร fintanto che il modello supporta l'attivitร (i.e., non puoi usare DistilBERT per un attivitร sequence-to-sequence come la traduzione).
+
+
+
+Per esempio, [`DistilBertForSequenceClassification`] รจ un modello DistilBERT base con una testa di classificazione per sequenze. La sequenza di classificazione head รจ uno strato lineare sopra gli output ragruppati.
+
+```py
+>>> from transformers import DistilBertForSequenceClassification
+
+>>> model = DistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Riutilizza facilmente questo checkpoint per un'altra attivitร passando ad un model head differente. Per un attivitร di risposta alle domande, utilizzerai il model head [`DistilBertForQuestionAnswering`]. La head per compiti di question answering รจ simile alla classificazione di sequenza head tranne per il fatto che รจ uno strato lineare sopra l'output degli stati nascosti (hidden states in inglese)
+
+```py
+>>> from transformers import DistilBertForQuestionAnswering
+
+>>> model = DistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+Per esempio, [`TFDistilBertForSequenceClassification`] รจ un modello DistilBERT base con classificazione di sequenza head. La classificazione di sequenza head รจ uno strato lineare sopra gli output raggruppati.
+
+```py
+>>> from transformers import TFDistilBertForSequenceClassification
+
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Riutilizza facilmente questo checkpoint per un altra attivitร passando ad un modello head diverso. Per un attivitร di risposta alle domande, utilizzerai il model head [`TFDistilBertForQuestionAnswering`]. Il head di risposta alle domande รจ simile alla sequenza di classificazione head tranne per il fatto che รจ uno strato lineare sopra l'output degli stati nascosti (hidden states in inglese)
+
+```py
+>>> from transformers import TFDistilBertForQuestionAnswering
+
+>>> tf_model = TFDistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+## Tokenizer
+
+L'ultima classe base di cui hai bisogno prima di utilizzare un modello per i dati testuali รจ un [tokenizer](main_classes/tokenizer) per convertire il testo grezzo in tensori. Ci sono due tipi di tokenizer che puoi usare con ๐ค Transformers:
+
+- [`PreTrainedTokenizer`]: un'implementazione Python di un tokenizer.
+- [`PreTrainedTokenizerFast`]: un tokenizer dalla nostra libreria [๐ค Tokenizer](https://huggingface.co/docs/tokenizers/python/latest/) basata su Rust. Questo tipo di tokenizer รจ significativamente piรน veloce, specialmente durante la batch tokenization, grazie alla sua implementazione Rust. Il tokenizer veloce offre anche metodi aggiuntivi come *offset mapping* che associa i token alle loro parole o caratteri originali.
+
+Entrambi i tokenizer supportano metodi comuni come la codifica e la decodifica, l'aggiunta di nuovi token e la gestione di token speciali.
+
+
+
+Non tutti i modelli supportano un tokenizer veloce. Dai un'occhiata a questo [tabella](index#supported-frameworks) per verificare se un modello ha il supporto per tokenizer veloce.
+
+
+
+Se hai addestrato il tuo tokenizer, puoi crearne uno dal tuo file *vocabolario*:
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> my_tokenizer = DistilBertTokenizer(vocab_file="my_vocab_file.txt", do_lower_case=False, padding_side="left")
+```
+
+ร importante ricordare che il vocabolario di un tokenizer personalizzato sarร diverso dal vocabolario generato dal tokenizer di un modello preallenato. ร necessario utilizzare il vocabolario di un modello preallenato se si utilizza un modello preallenato, altrimenti gli input non avranno senso. Crea un tokenizer con il vocabolario di un modello preallenato con la classe [`DistilBertTokenizer`]:
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> slow_tokenizer = DistilBertTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+Crea un tokenizer veloce con la classe [`DistilBertTokenizerFast`]:
+
+```py
+>>> from transformers import DistilBertTokenizerFast
+
+>>> fast_tokenizer = DistilBertTokenizerFast.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+Per l'impostazione predefinita, [`AutoTokenizer`] proverร a caricare un tokenizer veloce. Puoi disabilitare questo comportamento impostando `use_fast=False` in `from_pretrained`.
+
+
+
+## Estrattore Di Feature
+
+Un estrattore di caratteristiche (feature in inglese) elabora input audio o immagini. Eredita dalla classe [`~feature_extraction_utils.FeatureExtractionMixin`] base e puรฒ anche ereditare dalla classe [`ImageFeatureExtractionMixin`] per l'elaborazione delle caratteristiche dell'immagine o dalla classe [`SequenceFeatureExtractor`] per l'elaborazione degli input audio.
+
+A seconda che tu stia lavorando a un'attivitร audio o visiva, crea un estrattore di caratteristiche associato al modello che stai utilizzando. Ad esempio, crea un [`ViTFeatureExtractor`] predefinito se stai usando [ViT](model_doc/vit) per la classificazione delle immagini:
+
+```py
+>>> from transformers import ViTFeatureExtractor
+
+>>> vit_extractor = ViTFeatureExtractor()
+>>> print(vit_extractor)
+ViTFeatureExtractor {
+ "do_normalize": true,
+ "do_resize": true,
+ "feature_extractor_type": "ViTFeatureExtractor",
+ "image_mean": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": 2,
+ "size": 224
+}
+```
+
+
+
+Se non stai cercando alcuna personalizzazione, usa il metodo `from_pretrained` per caricare i parametri di default dell'estrattore di caratteristiche di un modello.
+
+
+
+Modifica uno qualsiasi dei parametri [`ViTFeatureExtractor`] per creare il tuo estrattore di caratteristiche personalizzato:
+
+```py
+>>> from transformers import ViTFeatureExtractor
+
+>>> my_vit_extractor = ViTFeatureExtractor(resample="PIL.Image.BOX", do_normalize=False, image_mean=[0.3, 0.3, 0.3])
+>>> print(my_vit_extractor)
+ViTFeatureExtractor {
+ "do_normalize": false,
+ "do_resize": true,
+ "feature_extractor_type": "ViTFeatureExtractor",
+ "image_mean": [
+ 0.3,
+ 0.3,
+ 0.3
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": "PIL.Image.BOX",
+ "size": 224
+}
+```
+
+Per gli input audio, puoi creare un [`Wav2Vec2FeatureExtractor`] e personalizzare i parametri in modo simile:
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> w2v2_extractor = Wav2Vec2FeatureExtractor()
+>>> print(w2v2_extractor)
+Wav2Vec2FeatureExtractor {
+ "do_normalize": true,
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
+ "feature_size": 1,
+ "padding_side": "right",
+ "padding_value": 0.0,
+ "return_attention_mask": false,
+ "sampling_rate": 16000
+}
+```
+
+## Processore
+
+Per modelli che supportano attivitร multimodali, ๐ค Transformers offre una classe di processore che racchiude comodamente un estrattore di caratteristiche e un tokenizer in un unico oggetto. Ad esempio, utilizziamo [`Wav2Vec2Processor`] per un'attivitร di riconoscimento vocale automatico (ASR). ASR trascrive l'audio in testo, quindi avrai bisogno di un estrattore di caratteristiche e di un tokenizer.
+
+Crea un estrattore di feature per gestire gli input audio:
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> feature_extractor = Wav2Vec2FeatureExtractor(padding_value=1.0, do_normalize=True)
+```
+
+Crea un tokenizer per gestire gli input di testo:
+
+```py
+>>> from transformers import Wav2Vec2CTCTokenizer
+
+>>> tokenizer = Wav2Vec2CTCTokenizer(vocab_file="my_vocab_file.txt")
+```
+
+Combinare l'estrattore di caratteristiche e il tokenizer in [`Wav2Vec2Processor`]:
+
+```py
+>>> from transformers import Wav2Vec2Processor
+
+>>> processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)
+```
+
+Con due classi di base - configurazione e modello - e una classe di preelaborazione aggiuntiva (tokenizer, estrattore di caratteristiche o processore), puoi creare qualsiasi modello supportato da ๐ค Transformers. Ognuna di queste classi base รจ configurabile, consentendoti di utilizzare gli attributi specifici che desideri. ร possibile impostare facilmente un modello per l'addestramento o modificare un modello preallenato esistente per la messa a punto.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/custom_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/custom_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..94626937eb81be5a8d33b38dfbc51385be4ca46f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/custom_models.md
@@ -0,0 +1,359 @@
+
+
+# Condividere modelli personalizzati
+La libreria ๐ค Transformers รจ studiata per essere facilmente estendibile. Il codice di ogni modello รจ interamente
+situato in una sottocartella del repository senza alcuna astrazione, perciรฒ puoi facilmente copiare il file di un
+modello e modificarlo in base ai tuoi bisogni.
+
+Se stai scrivendo un nuovo modello, potrebbe essere piรน semplice iniziare da zero. In questo tutorial, ti mostreremo
+come scrivere un modello personalizzato e la sua configurazione in modo che possa essere utilizzato allโinterno di
+Transformers, e come condividerlo con la community (assieme al relativo codice) cosรฌ che tutte le persone possano usarlo, anche
+se non presente nella libreria ๐ค Transformers.
+
+Illustriamo tutto questo su un modello ResNet, avvolgendo la classe ResNet della
+[libreria timm](https://github.com/rwightman/pytorch-image-models) in un [`PreTrainedModel`].
+
+## Scrivere una configurazione personalizzata
+Prima di iniziare a lavorare al modello, scriviamone la configurazione. La configurazione di un modello รจ un oggetto
+che contiene tutte le informazioni necessarie per la build del modello. Come vedremo nella prossima sezione, il
+modello puรฒ soltanto essere inizializzato tramite `config`, per cui dovremo rendere tale oggetto piรน completo possibile.
+
+Nel nostro esempio, prenderemo un paio di argomenti della classe ResNet che potremmo voler modificare.
+Configurazioni differenti ci daranno quindi i differenti possibili tipi di ResNet. Salveremo poi questi argomenti,
+dopo averne controllato la validitร .
+
+```python
+from transformers import PretrainedConfig
+from typing import List
+
+
+class ResnetConfig(PretrainedConfig):
+ model_type = "resnet"
+
+ def __init__(
+ self,
+ block_type="bottleneck",
+ layers: List[int] = [3, 4, 6, 3],
+ num_classes: int = 1000,
+ input_channels: int = 3,
+ cardinality: int = 1,
+ base_width: int = 64,
+ stem_width: int = 64,
+ stem_type: str = "",
+ avg_down: bool = False,
+ **kwargs,
+ ):
+ if block_type not in ["basic", "bottleneck"]:
+ raise ValueError(f"`block_type` must be 'basic' or bottleneck', got {block_type}.")
+ if stem_type not in ["", "deep", "deep-tiered"]:
+ raise ValueError(f"`stem_type` must be '', 'deep' or 'deep-tiered', got {stem_type}.")
+
+ self.block_type = block_type
+ self.layers = layers
+ self.num_classes = num_classes
+ self.input_channels = input_channels
+ self.cardinality = cardinality
+ self.base_width = base_width
+ self.stem_width = stem_width
+ self.stem_type = stem_type
+ self.avg_down = avg_down
+ super().__init__(**kwargs)
+```
+
+Le tre cose piรน importanti da ricordare quando scrivi le tue configurazioni sono le seguenti:
+- Devi ereditare da `Pretrainedconfig`,
+- Il metodo `__init__` del tuo `Pretrainedconfig` deve accettare i kwargs,
+- I `kwargs` devono essere passati alla superclass `__init__`
+
+Lโereditร รจ importante per assicurarsi di ottenere tutte le funzionalitร della libreria ๐ค transformers,
+mentre gli altri due vincoli derivano dal fatto che un `Pretrainedconfig` ha piรน campi di quelli che stai settando.
+Quando ricarichi una config da un metodo `from_pretrained`, questi campi devono essere accettati dalla tua config e
+poi inviati alla superclasse.
+
+Definire un `model_type` per la tua configurazione (qua `model_type = โresnetโ`) non รจ obbligatorio, a meno che tu
+non voglia registrare il modello con le classi Auto (vedi l'ultima sezione).
+
+Una volta completato, puoi facilmente creare e salvare la tua configurazione come faresti con ogni altra configurazione
+di modelli della libreria. Ecco come possiamo creare la config di un resnet50d e salvarlo:
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d_config.save_pretrained("custom-resnet")
+```
+
+Questo salverร un file chiamato `config.json` all'interno della cartella `custom-resnet`. Potrai poi ricaricare la tua
+config con il metodo `from_pretrained`.
+
+```py
+resnet50d_config = ResnetConfig.from_pretrained("custom-resnet")
+```
+
+Puoi anche usare qualunque altro metodo della classe [`PretrainedConfig`], come [`~PretrainedConfig.push_to_hub`]
+per caricare direttamente la tua configurazione nell'hub.
+
+## Scrivere un modello personalizzato
+
+Ora che abbiamo la nostra configurazione ResNet, possiamo continuare a scrivere il modello. In realtร , ne scriveremo
+due: uno che estrae le features nascoste da una batch di immagini (come [`BertModel`]) e uno che รจ utilizzabile per
+la classificazione di immagini (come [`BertModelForSequenceClassification`]).
+
+Come abbiamo menzionato in precedenza, scriveremo soltanto un wrapper del modello, per mantenerlo semplice ai fini di
+questo esempio. L'unica cosa che dobbiamo fare prima di scrivere questa classe รจ una mappatura fra i tipi di blocco e
+le vere classi dei blocchi. Successivamente il modello รจ definito tramite la configurazione, passando tutto quanto alla
+classe `ResNet`.
+
+```py
+from transformers import PreTrainedModel
+from timm.models.resnet import BasicBlock, Bottleneck, ResNet
+from .configuration_resnet import ResnetConfig
+
+
+BLOCK_MAPPING = {"basic": BasicBlock, "bottleneck": Bottleneck}
+
+
+class ResnetModel(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor):
+ return self.model.forward_features(tensor)
+```
+
+Per il modello che classificherร le immagini, cambiamo soltanto il metodo forward:
+
+```py
+import torch
+
+
+class ResnetModelForImageClassification(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor, labels=None):
+ logits = self.model(tensor)
+ if labels is not None:
+ loss = torch.nn.functional.cross_entropy(logits, labels)
+ return {"loss": loss, "logits": logits}
+ return {"logits": logits}
+```
+
+Nota come, in entrambi i casi, ereditiamo da `PreTrainedModel` e chiamiamo l'inizializzazione della superclasse
+con il metodo `config` (un po' come quando scrivi un normale `torch.nn.Module`). La riga che imposta la `config_class`
+non รจ obbligatoria, a meno che tu non voglia registrare il modello con le classi Auto (vedi l'ultima sezione).
+
+
+
+Se il tuo modello รจ molto simile a un modello all'interno della libreria, puoi ri-usare la stessa configurazione di quel modello.
+
+
+
+Puoi fare in modo che il tuo modello restituisca in output qualunque cosa tu voglia, ma far restituire un dizionario
+come abbiamo fatto per `ResnetModelForImageClassification`, con la funzione di perdita inclusa quando vengono passate le labels,
+renderร il tuo modello direttamente utilizzabile all'interno della classe [`Trainer`]. Utilizzare altri formati di output va bene
+se hai in progetto di utilizzare un tuo loop di allenamento, o se utilizzerai un'altra libreria per l'addestramento.
+
+Ora che abbiamo la classe del nostro modello, creiamone uno:
+
+```py
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+```
+
+Ribadiamo, puoi usare qualunque metodo dei [`PreTrainedModel`], come [`~PreTrainedModel.save_pretrained`] o
+[`~PreTrainedModel.push_to_hub`]. Utilizzeremo quest'ultimo nella prossima sezione, e vedremo come caricare i pesi del
+modello assieme al codice del modello stesso. Ma prima, carichiamo alcuni pesi pre-allenati all'interno del nostro modello.
+
+Nel tuo caso specifico, probabilmente allenerai il tuo modello sui tuoi dati. Per velocizzare in questo tutorial,
+utilizzeremo la versione pre-allenata del resnet50d. Dato che il nostro modello รจ soltanto un wrapper attorno a quel modello,
+sarร facile trasferirne i pesi:
+
+```py
+import timm
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+Vediamo adesso come assicurarci che quando facciamo [`~PreTrainedModel.save_pretrained`] o [`~PreTrainedModel.push_to_hub`],
+il codice del modello venga salvato.
+
+## Inviare il codice all'Hub
+
+
+
+Questa API รจ sperimentale e potrebbe avere alcuni cambiamenti nei prossimi rilasci.
+
+
+
+Innanzitutto, assicurati che il tuo modello sia completamente definito in un file `.py`. Puรฒ sfruttare import relativi
+ad altri file, purchรจ questi siano nella stessa directory (non supportiamo ancora sotto-moduli per questa funzionalitร ).
+Per questo esempio, definiremo un file `modeling_resnet.py` e un file `configuration_resnet.py` in una cartella dell'attuale
+working directory chiamata `resnet_model`. Il file configuration contiene il codice per `ResnetConfig` e il file modeling
+contiene il codice di `ResnetModel` e `ResnetModelForImageClassification`.
+
+```
+.
+โโโ resnet_model
+ โโโ __init__.py
+ โโโ configuration_resnet.py
+ โโโ modeling_resnet.py
+```
+
+Il file `__init__.py` puรฒ essere vuoto, serve solo perchรจ Python capisca che `resnet_model` puรฒ essere utilizzato come un modulo.
+
+
+
+Se stai copiando i file relativi alla modellazione della libreria, dovrai sostituire tutti gli import relativi in cima al file con import del
+ pacchetto `transformers`.
+
+
+
+Nota che puoi ri-utilizzare (o usare come sottoclassi) un modello/configurazione esistente.
+
+Per condividere il tuo modello con la community, segui questi passi: prima importa il modello ResNet e la sua configurazione
+dai nuovi file creati:
+
+```py
+from resnet_model.configuration_resnet import ResnetConfig
+from resnet_model.modeling_resnet import ResnetModel, ResnetModelForImageClassification
+```
+
+Dopodichรจ dovrai dire alla libreria che vuoi copiare i file con il codice di quegli oggetti quando utilizzi il metodo
+`save_pretrained` e registrarli in modo corretto con una Auto classe (specialmente per i modelli). Utilizza semplicemente:
+
+```py
+ResnetConfig.register_for_auto_class()
+ResnetModel.register_for_auto_class("AutoModel")
+ResnetModelForImageClassification.register_for_auto_class("AutoModelForImageClassification")
+```
+
+Nota che non c'รจ bisogno di specificare una Auto classe per la configurazione (c'รจ solo una Auto classe per le configurazioni,
+[`AutoConfig`], ma รจ diversa per i modelli). Il tuo modello personalizato potrebbe essere utilizzato per diverse tasks,
+per cui devi specificare quale delle classi Auto รจ quella corretta per il tuo modello.
+
+Successivamente, creiamo i modelli e la config come abbiamo fatto in precedenza:
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+Adesso, per inviare il modello all'Hub, assicurati di aver effettuato l'accesso. Lancia dal tuo terminale:
+
+```bash
+huggingface-cli login
+```
+
+O da un notebook:
+
+```py
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+Potrai poi inviare il tutto sul tuo profilo (o di un'organizzazione di cui fai parte) in questo modo:
+
+```py
+resnet50d.push_to_hub("custom-resnet50d")
+```
+
+Oltre ai pesi del modello e alla configurazione in formato json, questo ha anche copiato i file `.py` modeling e
+configuration all'interno della cartella `custom-resnet50d` e ha caricato i risultati sull'Hub. Puoi controllare
+i risultati in questa [model repo](https://huggingface.co/sgugger/custom-resnet50d).
+
+Puoi controllare il tutorial di condivisione [tutorial di condivisione](model_sharing) per piรน informazioni sul
+metodo con cui inviare all'Hub.
+
+## Usare un modello con codice personalizzato
+
+Puoi usare ogni configurazione, modello o tokenizer con file di codice personalizzati nella sua repository
+con le classi Auto e il metodo `from_pretrained`. Tutti i files e il codice caricati sull'Hub sono scansionati da malware
+(fai riferimento alla documentazione [Hub security](https://huggingface.co/docs/hub/security#malware-scanning) per piรน informazioni),
+ma dovresti comunque assicurarti dell'affidabilitร del codice e dell'autore per evitare di eseguire codice dannoso sulla tua macchina.
+Imposta `trust_remote_code=True` per usare un modello con codice personalizzato:
+
+```py
+from transformers import AutoModelForImageClassification
+
+model = AutoModelForImageClassification.from_pretrained("sgugger/custom-resnet50d", trust_remote_code=True)
+```
+
+Inoltre, raccomandiamo fortemente di passare un hash del commit come `revision` per assicurarti che le autrici o gli autori del modello
+non abbiano modificato il codice con alcune nuove righe dannose (a meno che non ti fidi completamente della fonte):
+
+```py
+commit_hash = "ed94a7c6247d8aedce4647f00f20de6875b5b292"
+model = AutoModelForImageClassification.from_pretrained(
+ "sgugger/custom-resnet50d", trust_remote_code=True, revision=commit_hash
+)
+```
+
+Nota che quando cerchi la storia dei commit della repo del modello sull'Hub, c'รจ un bottone con cui facilmente copiare il
+commit hash di ciascun commit.
+
+## Registrare un modello con codice personalizzato nelle classi Auto
+
+Se stai scrivendo una libreria che estende ๐ค Transformers, potresti voler estendere le classi Auto per includere il tuo modello.
+Questo รจ diverso dall'inviare codice nell'Hub: gli utenti dovranno importare la tua libreria per ottenere il modello personalizzato
+(anzichรจ scaricare automaticamente il modello dall'Hub).
+
+Finchรจ il tuo file di configurazione ha un attributo `model_type` diverso dai model types esistenti, e finchรจ le tue
+classi modello hanno i corretti attributi `config_class`, potrai semplicemente aggiungerli alle classi Auto come segue:
+
+```py
+from transformers import AutoConfig, AutoModel, AutoModelForImageClassification
+
+AutoConfig.register("resnet", ResnetConfig)
+AutoModel.register(ResnetConfig, ResnetModel)
+AutoModelForImageClassification.register(ResnetConfig, ResnetModelForImageClassification)
+```
+
+Nota che il primo argomento utilizzato quando registri la configurazione di un modello personalizzato con [`AutoConfig`]
+deve corrispondere al `model_type` della tua configurazione personalizzata, ed il primo argomento utilizzato quando
+registri i tuoi modelli personalizzati in una qualunque classe Auto del modello deve corrispondere alla `config_class`
+di quei modelli.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/debugging.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/debugging.md
new file mode 100644
index 0000000000000000000000000000000000000000..5c1dab51bd11793a62eabc916c7bbf7e95209934
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/debugging.md
@@ -0,0 +1,318 @@
+
+
+# Debugging
+
+## Debug dei problemi di rete multi-GPU
+
+Quando addestri o fai inferenza con `DistributedDataParallel` e GPU multiple, se si verificano problemi di intercomunicazione tra processi e/o nodi, puoi utilizzare il seguente script per diagnosticare i problemi della rete.
+
+```bash
+wget https://raw.githubusercontent.com/huggingface/transformers/main/scripts/distributed/torch-distributed-gpu-test.py
+```
+
+Per esempio per testare come 2 GPU interagiscono fai:
+
+```bash
+python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-gpu-test.py
+```
+
+Se entrambi i processi sono in grado di comunicare tra loro e di allocare la memoria della GPU, ciascuno di essi stamperร lo stato OK.
+
+Per piรน GPU o nodi adatta gli argumenti nello script.
+
+All'interno dello script di diagnostica troverai molti altri dettagli e anche una guida per eseguirlo in ambiente SLURM.
+
+Un livello di debug superiore รจ aggiungere la variabile d'ambiente `NCCL_DEBUG=INFO` come di seguito:
+
+```bash
+NCCL_DEBUG=INFO python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-gpu-test.py
+```
+
+In questo modo si scaricano molte informazioni di debug relative a NCCL, che puoi cercare online in caso di problemi. Oppure, se non hai la sicurezza di come interpretare l'output, puoi condividere il file di log in una Issue.
+
+## Rilevamento di Underflow e Overflow
+
+
+
+Questa funzionalitร al momento รจ disponibile solo per PyTorch.
+
+
+
+
+
+Per addestramento multi-GPU richiede DDP (`torch.distributed.launch`).
+
+
+
+
+
+Questa funzionalitร puรฒ essere usata con modelli basati su `nn.Module`.
+
+
+
+Se inizi a ottenere `loss=NaN` o il modello presenta qualche altro comportamento anomalo a causa di valori `inf` o `nan` in
+attivazioni o nei pesi, รจ necessario scoprire dove si verifica il primo underflow o overflow e cosa lo ha determinato. Fortunatamente
+รจ possibile farlo facilmente attivando un modulo speciale che effettuerร il rilevamento automaticamente.
+
+Se stai usando [`Trainer`], hai bisogno di aggiungere solo:
+
+```bash
+--debug underflow_overflow
+```
+
+ai normali argomenti della riga di comando, o passa `debug="underflow_overflow"` quando viene creato l'oggetto
+[`TrainingArguments`].
+
+Se stai usando il tuo ciclo di allenamento o un altro trainer, puoi ottenere lo stesso risultato con:
+
+```python
+from .debug_utils import DebugUnderflowOverflow
+
+debug_overflow = DebugUnderflowOverflow(model)
+```
+
+[`~debug_utils.DebugUnderflowOverflow`] inserisce dei ganci nel modello che dopo ogni chiamata
+testeranno le variabili di ingresso e di uscita e anche i pesi del modulo corrispondente. Non appena viene rilevato `inf` o
+o `nan` in almeno un elemento delle attivazioni o dei pesi, il programma lo notifica e stampa un rapporto come il seguente (questo รจ stato rilevato con `google/mt5-small` sotto fp16 mixed precision):
+
+```
+Detected inf/nan during batch_number=0
+Last 21 forward frames:
+abs min abs max metadata
+ encoder.block.1.layer.1.DenseReluDense.dropout Dropout
+0.00e+00 2.57e+02 input[0]
+0.00e+00 2.85e+02 output
+[...]
+ encoder.block.2.layer.0 T5LayerSelfAttention
+6.78e-04 3.15e+03 input[0]
+2.65e-04 3.42e+03 output[0]
+ None output[1]
+2.25e-01 1.00e+04 output[2]
+ encoder.block.2.layer.1.layer_norm T5LayerNorm
+8.69e-02 4.18e-01 weight
+2.65e-04 3.42e+03 input[0]
+1.79e-06 4.65e+00 output
+ encoder.block.2.layer.1.DenseReluDense.wi_0 Linear
+2.17e-07 4.50e+00 weight
+1.79e-06 4.65e+00 input[0]
+2.68e-06 3.70e+01 output
+ encoder.block.2.layer.1.DenseReluDense.wi_1 Linear
+8.08e-07 2.66e+01 weight
+1.79e-06 4.65e+00 input[0]
+1.27e-04 2.37e+02 output
+ encoder.block.2.layer.1.DenseReluDense.dropout Dropout
+0.00e+00 8.76e+03 input[0]
+0.00e+00 9.74e+03 output
+ encoder.block.2.layer.1.DenseReluDense.wo Linear
+1.01e-06 6.44e+00 weight
+0.00e+00 9.74e+03 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.DenseReluDense T5DenseGatedGeluDense
+1.79e-06 4.65e+00 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.dropout Dropout
+3.18e-04 6.27e+04 input[0]
+0.00e+00 inf output
+```
+
+L'output di esempio รจ stato tagliato al centro per brevitร .
+
+La seconda colonna mostra il valore dell'elemento piรน grande in assoluto,cosรฌ se osserviamo da vicino gli ultimi istanti,
+input e output sono nel range di `1e4`. Questo addestramento รจ stato eseguito con una mixed precision fp16 e l'ultimo passo usciva fuori (sotto `fp16` il valore piรน grande prima di `inf` รจ `64e3`). Per evitare overflows sotto `fp16` le attivazionioni devono rimanere molto al di sotto di `1e4`, perchรฉ `1e4 * 1e4 = 1e8` quindi qualsiasi moltiplicazione di matrice con grandi attivazioni porterร a una condizione di overflow numerico.
+
+All'inizio della traccia รจ possibile scoprire a quale lotto si รจ verificato il problema (questo `Detected inf/nan during batch_number=0` significa che il problema si รจ verificato nel primo lotto).
+
+Ogni frame segnalato inizia dichiarando la voce completamente qualificata per il modulo corrispondente per il quale il frame รจ stato segnalato.
+Se osserviamo il seguente frame:
+
+```
+ encoder.block.2.layer.1.layer_norm T5LayerNorm
+8.69e-02 4.18e-01 weight
+2.65e-04 3.42e+03 input[0]
+1.79e-06 4.65e+00 output
+```
+
+Questo, `encoder.block.2.layer.1.layer_norm` indica che si tratta di un layer norm nel primo layer, del secondo blocco dell'encoder. E le chiamata specifica di `forward` รจ `T5LayerNorm`.
+
+Osserviamo gli ultimi frame del report:
+
+```
+Detected inf/nan during batch_number=0
+Last 21 forward frames:
+abs min abs max metadata
+[...]
+ encoder.block.2.layer.1.DenseReluDense.wi_0 Linear
+2.17e-07 4.50e+00 weight
+1.79e-06 4.65e+00 input[0]
+2.68e-06 3.70e+01 output
+ encoder.block.2.layer.1.DenseReluDense.wi_1 Linear
+8.08e-07 2.66e+01 weight
+1.79e-06 4.65e+00 input[0]
+1.27e-04 2.37e+02 output
+ encoder.block.2.layer.1.DenseReluDense.wo Linear
+1.01e-06 6.44e+00 weight
+0.00e+00 9.74e+03 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.DenseReluDense T5DenseGatedGeluDense
+1.79e-06 4.65e+00 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.dropout Dropout
+3.18e-04 6.27e+04 input[0]
+0.00e+00 inf output
+```
+
+L'ultimo frame report per la funzione `Dropout.forward` con la prima voce per l'unico input e la seconda per l'unico output. Si puรฒ notare che รจ stato richiamato da un attibuto `dropout` dentro la classe `DenseReluDense`. Si puรฒ notare che ciรฒ รจ avvenuto durante il primo strato, del 2ยฐ blocco, durante il primissimo lotto. Infine, gli elementi di input piรน grandi in assoluto sono stati `6.27e+04` e l'equivalente per l'output era `inf`.
+
+Puoi vedere qui, che `T5DenseGatedGeluDense.forward` risulta in output activations, il cui valore massimo assoluto era circa 62,7K, che รจ molto vicino al limite massimo di 64K di fp16. Nel prossimo frame abbiamo `Dropout` che rinormalizza i pesi, dopo aver azzerato alcuni elementi, il che spinge il valore massimo assoluto a piรน di 64K e si verifica un overflow.(`inf`).
+
+Come puoi notare, รจ nei frames precedenti che occorre esaminare quando i numeri iniziano a diventare molto grandi per i valori fp16.
+
+Confrontiamo il report al codice `models/t5/modeling_t5.py`:
+
+```python
+class T5DenseGatedGeluDense(nn.Module):
+ def __init__(self, config):
+ super().__init__()
+ self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False)
+ self.wi_1 = nn.Linear(config.d_model, config.d_ff, bias=False)
+ self.wo = nn.Linear(config.d_ff, config.d_model, bias=False)
+ self.dropout = nn.Dropout(config.dropout_rate)
+ self.gelu_act = ACT2FN["gelu_new"]
+
+ def forward(self, hidden_states):
+ hidden_gelu = self.gelu_act(self.wi_0(hidden_states))
+ hidden_linear = self.wi_1(hidden_states)
+ hidden_states = hidden_gelu * hidden_linear
+ hidden_states = self.dropout(hidden_states)
+ hidden_states = self.wo(hidden_states)
+ return hidden_states
+```
+
+Ora รจ facile vedere la chiamata `dropout`, e tutte le chiamate precedenti.
+
+Poichรฉ il rilevamento avviene in un avanzamento (forward hook in eng.), i rapporti vengono creati immeditamente dopo ogni rientro da `forward` (forward returns in eng.).
+
+Tornando al rapporto completo, per agire e risolvere il problema, dobbiamo andare qualche frame piรน in alto, dove i numeri hanno iniziato a salire, e probabilmente passare alla modalitร `fp32`, in modo che i numeri non trabocchino quando vengono moltiplicati o sommati. Naturalmente, potrebbero esserci altre soluzioni. Per esempio, potremmo spegnere temporanemante `amp` se รจ abilitato, successivamente spostare `forward` in un helper wrapper, come:
+
+```python
+def _forward(self, hidden_states):
+ hidden_gelu = self.gelu_act(self.wi_0(hidden_states))
+ hidden_linear = self.wi_1(hidden_states)
+ hidden_states = hidden_gelu * hidden_linear
+ hidden_states = self.dropout(hidden_states)
+ hidden_states = self.wo(hidden_states)
+ return hidden_states
+
+
+import torch
+
+
+def forward(self, hidden_states):
+ if torch.is_autocast_enabled():
+ with torch.cuda.amp.autocast(enabled=False):
+ return self._forward(hidden_states)
+ else:
+ return self._forward(hidden_states)
+```
+
+Poichรฉ il rilevatore automatico riporta solo gli ingressi e le uscite di fotogrammi completi, una volta che si sa dove cercare, si puรฒ
+analizzare anche le fasi intermedie di una specifica funzione `forward`. In alcuni casi puoi usare la funzione di supporto `detect_overflow` per indirizzare il rilevatore dove preferisci, ad esempio:
+
+```python
+from debug_utils import detect_overflow
+
+
+class T5LayerFF(nn.Module):
+ [...]
+
+ def forward(self, hidden_states):
+ forwarded_states = self.layer_norm(hidden_states)
+ detect_overflow(forwarded_states, "after layer_norm")
+ forwarded_states = self.DenseReluDense(forwarded_states)
+ detect_overflow(forwarded_states, "after DenseReluDense")
+ return hidden_states + self.dropout(forwarded_states)
+```
+
+Si puรฒ vedere che abbiamo aggiunto 2 di questi e ora teniamo traccia se `inf` o `nan` per `forwarded_states` รจ stato rilevato
+da qualche parte.
+
+In realtร , il rilevatore li riporta giร , perchรฉ ciascuna delle chiamate nell'esempio precedente รจ un `nn.Module`, ma
+diciamo che se avessimo dei calcoli diretti locali, questo รจ il modo in cui lo faremmo.
+
+Inoltre, se si istanzia il debugger nel proprio codice, รจ possibile modificare il numero di fotogrammi stampati rispetto a
+predefinito, ad esempio.:
+
+```python
+from .debug_utils import DebugUnderflowOverflow
+
+debug_overflow = DebugUnderflowOverflow(model, max_frames_to_save=100)
+```
+
+### Tracciamento della mistura assoluta del lotto specifico e del valore massimo
+
+La stessa classe di debug puรฒ essere utilizzata per il tracciamento per-batch con la funzione di rilevamento di underflow/overflow disattivata.
+
+Supponiamo di voler osservare i valori minimi e massimi assoluti per tutti gli ingredienti di ogni chiamata `forward` di un dato lotto.
+lotto, e che lo si voglia fare solo per i lotti 1 e 3. Si istanzia questa classe come:
+
+```python
+debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3])
+```
+
+Ora i batch completi 1 e 3 saranno tracciati utilizzando lo stesso formato del rilevatore di underflow/overflow.
+
+I batches sono 0-indexed.
+
+Questo รจ utile se si sa che il programma inizia a comportarsi male dopo un certo numero di batch, in modo da poter avanzare velocemente fino a quell'area.
+direttamente a quell'area. Ecco un esempio di output troncato per questa configurazione:
+
+```
+ *** Starting batch number=1 ***
+abs min abs max metadata
+ shared Embedding
+1.01e-06 7.92e+02 weight
+0.00e+00 2.47e+04 input[0]
+5.36e-05 7.92e+02 output
+[...]
+ decoder.dropout Dropout
+1.60e-07 2.27e+01 input[0]
+0.00e+00 2.52e+01 output
+ decoder T5Stack
+ not a tensor output
+ lm_head Linear
+1.01e-06 7.92e+02 weight
+0.00e+00 1.11e+00 input[0]
+6.06e-02 8.39e+01 output
+ T5ForConditionalGeneration
+ not a tensor output
+
+ *** Starting batch number=3 ***
+abs min abs max metadata
+ shared Embedding
+1.01e-06 7.92e+02 weight
+0.00e+00 2.78e+04 input[0]
+5.36e-05 7.92e+02 output
+[...]
+```
+
+Qui verrร scaricato un numero enorme di fotogrammi, tanti quanti sono le chiamate in avanti nel modello, quindi puรฒ essere o non essere quello che volete, ma a volte puรฒ essere piรน utile usarlo di un classico debugger. Per esempio, se il problema inizia a verificarsi a partire dal lotto numero 150. Quindi รจ possibile scaricare le tracce dei lotti 149 e 150 e confrontare i punti in cui i numeri hanno iniziato a divergere.
+
+ร inoltre possibile specificare il numero di batch dopo il quale interrompere l'addestramento, con:
+
+```python
+debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3], abort_after_batch_num=3)
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/index.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/index.md
new file mode 100644
index 0000000000000000000000000000000000000000..76cdc0ad246104f15a291413e7f03b9b662ead5f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/index.md
@@ -0,0 +1,300 @@
+
+
+# ๐ค Transformers
+
+Machine Learning allo stato dell'arte per PyTorch, TensorFlow e JAX.
+
+๐ค Transformers fornisce delle API per scaricare in modo semplice e allenare modelli pre-allenati allo stato dell'arte. L'utilizzo di modelli pre-allenati puรฒ ridurre i tuoi costi computazionali, l'impatto ambientale, e farti risparmiare il tempo che utilizzeresti per allenare un modello da zero. I modelli possono essere utilizzati in diverse modalitร come ad esempio:
+
+* ๐ Testo: classificazione del testo, estrazione delle informazioni, rispondere a domande, riassumere, traduzione e generazione del testo in piรน di 100 lingue.
+* ๐ผ๏ธ Immagini: classificazione di immagini, rilevazione di oggetti e segmentazione.
+* ๐ฃ๏ธ Audio: riconoscimento vocale e classificazione dell'audio.
+* ๐ Multimodale: rispondere a domande inerenti dati tabulari, riconoscimento ottico dei caratteri, estrazione di informazioni a partire da documenti scannerizzati, classificazione di video e risposta visuale a domande.
+
+La nostra libreria supporta un'integrazione perfetta tra tre delle librerie per il deep learning piรน popolari: [PyTorch](https://pytorch.org/), [TensorFlow](https://www.tensorflow.org/) e [JAX](https://jax.readthedocs.io/en/latest/). Allena il tuo modello in tre righe di codice in un framework, e caricalo per l'inferenza in un altro.
+
+Ogni architettura di ๐ค Transformers รจ definita in un modulo Python indipendente cosรฌ da poter essere personalizzata in modo semplice per la ricerca e gli esperimenti.
+
+## Se stai cercando supporto personalizzato dal team di Hugging Face
+
+
+
+
+
+## Contenuti
+
+La documentazione รจ organizzata in cinque parti:
+
+- **INIZIARE** contiene un tour rapido e le istruzioni di installazione per cominciare ad utilizzare ๐ค Transformers.
+- **TUTORIALS** รจ un buon posto da cui iniziare se per te la nostra libreria รจ nuova. Questa sezione ti aiuterร ad acquisire le competenze basilari di cui hai bisogno per iniziare ad utilizzare ๐ค Transformers.
+- **GUIDE PRATICHE** ti mostrerร come raggiungere obiettivi specifici come fare fine-tuning di un modello pre-allenato per la modellizzazione del linguaggio o come creare una testa per un modello personalizzato.
+- **GUIDE CONCETTUALI** fornisce discussioni e spiegazioni dei concetti sottostanti alle idee dietro ai modelli, compiti, e la filosofia di progettazione di ๐ค Transformers.
+- **API** descrive ogni classe e funzione, raggruppate in:
+ - **CLASSI PRINCIPALI** per le classi principali che espongono le API importanti della libreria.
+ - **MODELLI** per le classi e le funzioni relative ad ogni modello implementato all'interno della libreria.
+ - **HELPERS INTERNI** per le classi e le funzioni che utilizziamo internamente.
+
+La libreria attualmente contiene implementazioni in JAX, PyTorch e TensorFlow, pesi di modelli pre-allenati, script di utilizzo e strumenti di conversione per i seguenti modelli.
+
+### Modelli supportati
+
+
+
+1. **[ALBERT](model_doc/albert)** (da Google Research e l'Istituto Tecnologico di Chicago) rilasciato con il paper [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), da Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.
+1. **[ALIGN](model_doc/align)** (from Google Research) rilasciato con il paper [Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision](https://arxiv.org/abs/2102.05918) da Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V. Le, Yunhsuan Sung, Zhen Li, Tom Duerig.
+1. **[BART](model_doc/bart)** (da Facebook) rilasciato con il paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/abs/1910.13461) da Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov e Luke Zettlemoyer.
+1. **[BARThez](model_doc/barthez)** (da politecnico di รcole) rilasciato con il paper [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321) da Moussa Kamal Eddine, Antoine J.-P. Tixier, Michalis Vazirgiannis.
+1. **[BARTpho](model_doc/bartpho)** (da VinAI Research) rilasciato con il paper [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese](https://arxiv.org/abs/2109.09701) da Nguyen Luong Tran, Duong Minh Le e Dat Quoc Nguyen.
+1. **[BEiT](model_doc/beit)** (da Microsoft) rilasciato con il paper [BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) da Hangbo Bao, Li Dong, Furu Wei.
+1. **[BERT](model_doc/bert)** (da Google) rilasciato con il paper [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) da Jacob Devlin, Ming-Wei Chang, Kenton Lee e Kristina Toutanova.
+1. **[BERTweet](model_doc/bertweet)** (da VinAI Research) rilasciato con il paper [BERTweet: A pre-trained language model for English Tweets](https://aclanthology.org/2020.emnlp-demos.2/) da Dat Quoc Nguyen, Thanh Vu e Anh Tuan Nguyen.
+1. **[BERT For Sequence Generation](model_doc/bert-generation)** (da Google) rilasciato con il paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) da Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[BigBird-RoBERTa](model_doc/big_bird)** (da Google Research) rilasciato con il paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) da Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[BigBird-Pegasus](model_doc/bigbird_pegasus)** (v Google Research) rilasciato con il paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) da Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[Blenderbot](model_doc/blenderbot)** (da Facebook) rilasciato con il paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) da Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BlenderbotSmall](model_doc/blenderbot-small)** (da Facebook) rilasciato con il paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) da Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BORT](model_doc/bort)** (da Alexa) rilasciato con il paper [Optimal Subarchitecture Extraction For BERT](https://arxiv.org/abs/2010.10499) da Adrian de Wynter e Daniel J. Perry.
+1. **[ByT5](model_doc/byt5)** (da Google Research) rilasciato con il paper [ByT5: Towards a token-free future with pre-trained byte-to-byte models](https://arxiv.org/abs/2105.13626) da Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, Colin Raffel.
+1. **[CamemBERT](model_doc/camembert)** (da Inria/Facebook/Sorbonne) rilasciato con il paper [CamemBERT: a Tasty French Language Model](https://arxiv.org/abs/1911.03894) da Louis Martin*, Benjamin Muller*, Pedro Javier Ortiz Suรกrez*, Yoann Dupont, Laurent Romary, รric Villemonte de la Clergerie, Djamรฉ Seddah e Benoรฎt Sagot.
+1. **[CANINE](model_doc/canine)** (da Google Research) rilasciato con il paper [CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representation](https://arxiv.org/abs/2103.06874) da Jonathan H. Clark, Dan Garrette, Iulia Turc, John Wieting.
+1. **[ConvNeXT](model_doc/convnext)** (da Facebook AI) rilasciato con il paper [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545) da Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, Saining Xie.
+1. **[ConvNeXTV2](model_doc/convnextv2)** (da Facebook AI) rilasciato con il paper [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://arxiv.org/abs/2301.00808) da Sanghyun Woo, Shoubhik Debnath, Ronghang Hu, Xinlei Chen, Zhuang Liu, In So Kweon, Saining Xie.
+1. **[CLIP](model_doc/clip)** (da OpenAI) rilasciato con il paper [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020) da Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever.
+1. **[ConvBERT](model_doc/convbert)** (da YituTech) rilasciato con il paper [ConvBERT: Improving BERT with Span-based Dynamic Convolution](https://arxiv.org/abs/2008.02496) da Zihang Jiang, Weihao Yu, Daquan Zhou, Yunpeng Chen, Jiashi Feng, Shuicheng Yan.
+1. **[CPM](model_doc/cpm)** (dalla Universitร di Tsinghua) rilasciato con il paper [CPM: A Large-scale Generative Chinese Pre-trained Language Model](https://arxiv.org/abs/2012.00413) da Zhengyan Zhang, Xu Han, Hao Zhou, Pei Ke, Yuxian Gu, Deming Ye, Yujia Qin, Yusheng Su, Haozhe Ji, Jian Guan, Fanchao Qi, Xiaozhi Wang, Yanan Zheng, Guoyang Zeng, Huanqi Cao, Shengqi Chen, Daixuan Li, Zhenbo Sun, Zhiyuan Liu, Minlie Huang, Wentao Han, Jie Tang, Juanzi Li, Xiaoyan Zhu, Maosong Sun.
+1. **[CTRL](model_doc/ctrl)** (da Salesforce) rilasciato con il paper [CTRL: A Conditional Transformer Language Model for Controllable Generation](https://arxiv.org/abs/1909.05858) da Nitish Shirish Keskar*, Bryan McCann*, Lav R. Varshney, Caiming Xiong e Richard Socher.
+1. **[CvT](model_doc/cvt)** (da Microsoft) rilasciato con il paper [CvT: Introducing Convolutions to Vision Transformers](https://arxiv.org/abs/2103.15808) da Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, Lei Zhang.
+1. **[Data2Vec](model_doc/data2vec)** (da Facebook) rilasciato con il paper [Data2Vec: A General Framework for Self-supervised Learning in Speech, Vision and Language](https://arxiv.org/abs/2202.03555) da Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, Michael Auli.
+1. **[DeBERTa](model_doc/deberta)** (da Microsoft) rilasciato con il paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) da Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[DeBERTa-v2](model_doc/deberta-v2)** (da Microsoft) rilasciato con il paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) da Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[Decision Transformer](model_doc/decision_transformer)** (da Berkeley/Facebook/Google) rilasciato con il paper [Decision Transformer: Reinforcement Learning via Sequence Modeling](https://arxiv.org/abs/2106.01345) da Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, Igor Mordatch.
+1. **[DiT](model_doc/dit)** (da Microsoft Research) rilasciato con il paper [DiT: Self-supervised Pre-training for Document Image Transformer](https://arxiv.org/abs/2203.02378) da Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei.
+1. **[DeiT](model_doc/deit)** (da Facebook) rilasciato con il paper [Training data-efficient image transformers & distillation through attention](https://arxiv.org/abs/2012.12877) da Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, Hervรฉ Jรฉgou.
+1. **[DETR](model_doc/detr)** (da Facebook) rilasciato con il paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) da Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko.
+1. **[DialoGPT](model_doc/dialogpt)** (da Microsoft Research) rilasciato con il paper [DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation](https://arxiv.org/abs/1911.00536) da Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, Bill Dolan.
+1. **[DistilBERT](model_doc/distilbert)** (da HuggingFace), rilasciato assieme al paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter](https://arxiv.org/abs/1910.01108) da Victor Sanh, Lysandre Debut e Thomas Wolf. La stessa tecnica รจ stata applicata per comprimere GPT2 in [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), RoBERTa in [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), Multilingual BERT in [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation) and a German version of DistilBERT.
+1. **[DPR](model_doc/dpr)** (da Facebook) rilasciato con il paper [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906) da Vladimir Karpukhin, Barlas Oฤuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, e Wen-tau Yih.
+1. **[DPT](master/model_doc/dpt)** (da Intel Labs) rilasciato con il paper [Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413) da Renรฉ Ranftl, Alexey Bochkovskiy, Vladlen Koltun.
+1. **[EfficientNet](model_doc/efficientnet)** (from Google Research) released with the paper [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks](https://arxiv.org/abs/1905.11946) by Mingxing Tan and Quoc V. Le.
+1. **[EncoderDecoder](model_doc/encoder-decoder)** (da Google Research) rilasciato con il paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) da Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[ELECTRA](model_doc/electra)** (da Google Research/Stanford University) rilasciato con il paper [ELECTRA: Pre-training text encoders as discriminators rather than generators](https://arxiv.org/abs/2003.10555) da Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning.
+1. **[FlauBERT](model_doc/flaubert)** (da CNRS) rilasciato con il paper [FlauBERT: Unsupervised Language Model Pre-training for French](https://arxiv.org/abs/1912.05372) da Hang Le, Loรฏc Vial, Jibril Frej, Vincent Segonne, Maximin Coavoux, Benjamin Lecouteux, Alexandre Allauzen, Benoรฎt Crabbรฉ, Laurent Besacier, Didier Schwab.
+1. **[FLAVA](model_doc/flava)** (da Facebook AI) rilasciato con il paper [FLAVA: A Foundational Language And Vision Alignment Model](https://arxiv.org/abs/2112.04482) da Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, e Douwe Kiela.
+1. **[FNet](model_doc/fnet)** (da Google Research) rilasciato con il paper [FNet: Mixing Tokens with Fourier Transforms](https://arxiv.org/abs/2105.03824) da James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, Santiago Ontanon.
+1. **[Funnel Transformer](model_doc/funnel)** (da CMU/Google Brain) rilasciato con il paper [Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing](https://arxiv.org/abs/2006.03236) da Zihang Dai, Guokun Lai, Yiming Yang, Quoc V. Le.
+1. **[GLPN](model_doc/glpn)** (da KAIST) rilasciato con il paper [Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth](https://arxiv.org/abs/2201.07436) da Doyeon Kim, Woonghyun Ga, Pyungwhan Ahn, Donggyu Joo, Sehwan Chun, Junmo Kim.
+1. **[GPT](model_doc/openai-gpt)** (da OpenAI) rilasciato con il paper [Improving Language Understanding by Generative Pre-Training](https://openai.com/research/language-unsupervised/) da Alec Radford, Karthik Narasimhan, Tim Salimans e Ilya Sutskever.
+1. **[GPT-2](model_doc/gpt2)** (da OpenAI) rilasciato con il paper [Language Models are Unsupervised Multitask Learners](https://openai.com/research/better-language-models/) da Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei e Ilya Sutskever.
+1. **[GPT-J](model_doc/gptj)** (da EleutherAI) rilasciato nel repository [kingoflolz/mesh-transformer-jax](https://github.com/kingoflolz/mesh-transformer-jax/) da Ben Wang e Aran Komatsuzaki.
+1. **[GPT Neo](model_doc/gpt_neo)** (da EleutherAI) rilasciato nel repository [EleutherAI/gpt-neo](https://github.com/EleutherAI/gpt-neo) da Sid Black, Stella Biderman, Leo Gao, Phil Wang e Connor Leahy.
+1. **[GPT NeoX](model_doc/gpt_neox)** (da EleutherAI) rilasciato con il paper [GPT-NeoX-20B: An Open-Source Autoregressive Language Model](https://arxiv.org/abs/2204.06745) da Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Pieler, USVSN Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, Samuel Weinbach
+1. **[Hubert](model_doc/hubert)** (da Facebook) rilasciato con il paper [HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447) da Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, Abdelrahman Mohamed.
+1. **[I-BERT](model_doc/ibert)** (da Berkeley) rilasciato con il paper [I-BERT: Integer-only BERT Quantization](https://arxiv.org/abs/2101.01321) da Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer.
+1. **[ImageGPT](model_doc/imagegpt)** (da OpenAI) rilasciato con il paper [Generative Pretraining from Pixels](https://openai.com/blog/image-gpt/) da Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, Ilya Sutskever.
+1. **[LayoutLM](model_doc/layoutlm)** (da Microsoft Research Asia) rilasciato con il paper [LayoutLM: Pre-training of Text and Layout for Document Image Understanding](https://arxiv.org/abs/1912.13318) da Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou.
+1. **[LayoutLMv2](model_doc/layoutlmv2)** (da Microsoft Research Asia) rilasciato con il paper [LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding](https://arxiv.org/abs/2012.14740) da Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, Lidong Zhou.
+1. **[LayoutLMv3](model_doc/layoutlmv3)** (da Microsoft Research Asia) rilasciato con il paper [LayoutLMv3: Pre-training for Document AI with Unified Text and Image Masking](https://arxiv.org/abs/2204.08387) da Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, Furu Wei.
+1. **[LayoutXLM](model_doc/layoutlxlm)** (da Microsoft Research Asia) rilasciato con il paper [LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding](https://arxiv.org/abs/2104.08836) da Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Furu Wei.
+1. **[LED](model_doc/led)** (da AllenAI) rilasciato con il paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) da Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[Longformer](model_doc/longformer)** (da AllenAI) rilasciato con il paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) da Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[LUKE](model_doc/luke)** (da Studio Ousia) rilasciato con il paper [LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention](https://arxiv.org/abs/2010.01057) da Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, Yuji Matsumoto.
+1. **[mLUKE](model_doc/mluke)** (da Studio Ousia) rilasciato con il paper [mLUKE: The Power of Entity Representations in Multilingual Pretrained Language Models](https://arxiv.org/abs/2110.08151) da Ryokan Ri, Ikuya Yamada, e Yoshimasa Tsuruoka.
+1. **[LXMERT](model_doc/lxmert)** (da UNC Chapel Hill) rilasciato con il paper [LXMERT: Learning Cross-Modality Encoder Representations from Transformers for Open-Domain Question Answering](https://arxiv.org/abs/1908.07490) da Hao Tan e Mohit Bansal.
+1. **[M2M100](model_doc/m2m_100)** (da Facebook) rilasciato con il paper [Beyond English-Centric Multilingual Machine Translation](https://arxiv.org/abs/2010.11125) da Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky, Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, Armand Joulin.
+1. **[MarianMT](model_doc/marian)** Modello di machine learning per le traduzioni allenato utilizzando i dati [OPUS](http://opus.nlpl.eu/) di Jรถrg Tiedemann. Il [Framework Marian](https://marian-nmt.github.io/) รจ stato sviluppato dal Microsoft Translator Team.
+1. **[Mask2Former](model_doc/mask2former)** (da FAIR e UIUC) rilasciato con il paper [Masked-attention Mask Transformer for Universal Image Segmentation](https://arxiv.org/abs/2112.01527) da Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar.
+1. **[MaskFormer](model_doc/maskformer)** (da Meta e UIUC) rilasciato con il paper [Per-Pixel Classification is Not All You Need for Semantic Segmentation](https://arxiv.org/abs/2107.06278) da Bowen Cheng, Alexander G. Schwing, Alexander Kirillov.
+1. **[MBart](model_doc/mbart)** (da Facebook) rilasciato con il paper [Multilingual Denoising Pre-training for Neural Machine Translation](https://arxiv.org/abs/2001.08210) da Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, Luke Zettlemoyer.
+1. **[MBart-50](model_doc/mbart)** (da Facebook) rilasciato con il paper [Multilingual Translation with Extensible Multilingual Pretraining and Finetuning](https://arxiv.org/abs/2008.00401) da Yuqing Tang, Chau Tran, Xian Li, Peng-Jen Chen, Naman Goyal, Vishrav Chaudhary, Jiatao Gu, Angela Fan.
+1. **[Megatron-BERT](model_doc/megatron-bert)** (da NVIDIA) rilasciato con il paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) da Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper e Bryan Catanzaro.
+1. **[Megatron-GPT2](model_doc/megatron_gpt2)** (da NVIDIA) rilasciato con il paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) da Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper e Bryan Catanzaro.
+1. **[MPNet](model_doc/mpnet)** (da Microsoft Research) rilasciato con il paper [MPNet: Masked and Permuted Pre-training for Language Understanding](https://arxiv.org/abs/2004.09297) da Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu.
+1. **[MT5](model_doc/mt5)** (da Google AI) rilasciato con il paper [mT5: A massively multilingual pre-trained text-to-text transformer](https://arxiv.org/abs/2010.11934) da Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, Colin Raffel.
+1. **[Nystrรถmformer](model_doc/nystromformer)** (dalla Universitร del Wisconsin - Madison) rilasciato con il paper [Nystrรถmformer: A Nystrรถm-Based Algorithm for Approximating Self-Attention](https://arxiv.org/abs/2102.03902) da Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, Vikas Singh.
+1. **[OneFormer](model_doc/oneformer)** (da SHI Labs) rilasciato con il paper [OneFormer: One Transformer to Rule Universal Image Segmentation](https://arxiv.org/abs/2211.06220) da Jitesh Jain, Jiachen Li, MangTik Chiu, Ali Hassani, Nikita Orlov, Humphrey Shi.
+1. **[OPT](master/model_doc/opt)** (da Meta AI) rilasciato con il paper [OPT: Open Pre-trained Transformer Language Models](https://arxiv.org/abs/2205.01068) da Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen et al.
+1. **[Pegasus](model_doc/pegasus)** (da Google) rilasciato con il paper [PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization](https://arxiv.org/abs/1912.08777) da Jingqing Zhang, Yao Zhao, Mohammad Saleh e Peter J. Liu.
+1. **[Perceiver IO](model_doc/perceiver)** (da Deepmind) rilasciato con il paper [Perceiver IO: A General Architecture for Structured Inputs & Outputs](https://arxiv.org/abs/2107.14795) da Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, Olivier Hรฉnaff, Matthew M. Botvinick, Andrew Zisserman, Oriol Vinyals, Joรฃo Carreira.
+1. **[PhoBERT](model_doc/phobert)** (da VinAI Research) rilasciato con il paper [PhoBERT: Pre-trained language models for Vietnamese](https://www.aclweb.org/anthology/2020.findings-emnlp.92/) da Dat Quoc Nguyen e Anh Tuan Nguyen.
+1. **[PLBart](model_doc/plbart)** (da UCLA NLP) rilasciato con il paper [Unified Pre-training for Program Understanding and Generation](https://arxiv.org/abs/2103.06333) da Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang.
+1. **[PoolFormer](model_doc/poolformer)** (da Sea AI Labs) rilasciato con il paper [MetaFormer is Actually What You Need for Vision](https://arxiv.org/abs/2111.11418) da Yu, Weihao e Luo, Mi e Zhou, Pan e Si, Chenyang e Zhou, Yichen e Wang, Xinchao e Feng, Jiashi e Yan, Shuicheng.
+1. **[ProphetNet](model_doc/prophetnet)** (da Microsoft Research) rilasciato con il paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) da Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang e Ming Zhou.
+1. **[QDQBert](model_doc/qdqbert)** (da NVIDIA) rilasciato con il paper [Integer Quantization for Deep Learning Inference: Principles and Empirical Evaluation](https://arxiv.org/abs/2004.09602) da Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev e Paulius Micikevicius.
+1. **[REALM](model_doc/realm.html)** (da Google Research) rilasciato con il paper [REALM: Retrieval-Augmented Language Model Pre-Training](https://arxiv.org/abs/2002.08909) da Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat e Ming-Wei Chang.
+1. **[Reformer](model_doc/reformer)** (da Google Research) rilasciato con il paper [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451) da Nikita Kitaev, ลukasz Kaiser, Anselm Levskaya.
+1. **[RemBERT](model_doc/rembert)** (da Google Research) rilasciato con il paper [Rethinking embedding coupling in pre-trained language models](https://arxiv.org/abs/2010.12821) da Hyung Won Chung, Thibault Fรฉvry, Henry Tsai, M. Johnson, Sebastian Ruder.
+1. **[RegNet](model_doc/regnet)** (da META Platforms) rilasciato con il paper [Designing Network Design Space](https://arxiv.org/abs/2003.13678) da Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollรกr.
+1. **[ResNet](model_doc/resnet)** (da Microsoft Research) rilasciato con il paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) da Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun.
+1. **[RoBERTa](model_doc/roberta)** (da Facebook), rilasciato assieme al paper [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) da Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov.
+1. **[RoFormer](model_doc/roformer)** (da ZhuiyiTechnology), rilasciato assieme al paper [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/abs/2104.09864) da Jianlin Su e Yu Lu e Shengfeng Pan e Bo Wen e Yunfeng Liu.
+1. **[SegFormer](model_doc/segformer)** (da NVIDIA) rilasciato con il paper [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) da Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping Luo.
+1. **[SEW](model_doc/sew)** (da ASAPP) rilasciato con il paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) da Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SEW-D](model_doc/sew_d)** (da ASAPP) rilasciato con il paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) da Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SpeechToTextTransformer](model_doc/speech_to_text)** (da Facebook), rilasciato assieme al paper [fairseq S2T: Fast Speech-to-Text Modeling with fairseq](https://arxiv.org/abs/2010.05171) da Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Dmytro Okhonko, Juan Pino.
+1. **[SpeechToTextTransformer2](model_doc/speech_to_text_2)** (da Facebook), rilasciato assieme al paper [Large-Scale Self- and Semi-Supervised Learning for Speech Translation](https://arxiv.org/abs/2104.06678) da Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.
+1. **[Splinter](model_doc/splinter)** (dalla Universitร di Tel Aviv), rilasciato assieme al paper [Few-Shot Question Answering by Pretraining Span Selection](https://arxiv.org/abs/2101.00438) da Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, Omer Levy.
+1. **[SqueezeBert](model_doc/squeezebert)** (da Berkeley) rilasciato con il paper [SqueezeBERT: What can computer vision teach NLP about efficient neural networks?](https://arxiv.org/abs/2006.11316) da Forrest N. Iandola, Albert E. Shaw, Ravi Krishna, e Kurt W. Keutzer.
+1. **[Swin Transformer](model_doc/swin)** (da Microsoft) rilasciato con il paper [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030) da Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.
+1. **[T5](model_doc/t5)** (da Google AI) rilasciato con il paper [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) da Colin Raffel e Noam Shazeer e Adam Roberts e Katherine Lee e Sharan Narang e Michael Matena e Yanqi Zhou e Wei Li e Peter J. Liu.
+1. **[T5v1.1](model_doc/t5v1.1)** (da Google AI) rilasciato nel repository [google-research/text-to-text-transfer-transformer](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#t511) da Colin Raffel e Noam Shazeer e Adam Roberts e Katherine Lee e Sharan Narang e Michael Matena e Yanqi Zhou e Wei Li e Peter J. Liu.
+1. **[TAPAS](model_doc/tapas)** (da Google AI) rilasciato con il paper [TAPAS: Weakly Supervised Table Parsing via Pre-training](https://arxiv.org/abs/2004.02349) da Jonathan Herzig, Paweล Krzysztof Nowak, Thomas Mรผller, Francesco Piccinno e Julian Martin Eisenschlos.
+1. **[TAPEX](model_doc/tapex)** (da Microsoft Research) rilasciato con il paper [TAPEX: Table Pre-training via Learning a Neural SQL Executor](https://arxiv.org/abs/2107.07653) da Qian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, Jian-Guang Lou.
+1. **[Trajectory Transformer](model_doc/trajectory_transformers)** (dall'Universitร della California a Berkeley) rilasciato con il paper [Offline Reinforcement Learning as One Big Sequence Modeling Problem](https://arxiv.org/abs/2106.02039) da Michael Janner, Qiyang Li, Sergey Levine
+1. **[Transformer-XL](model_doc/transfo-xl)** (da Google/CMU) rilasciato con il paper [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860) da Zihang Dai*, Zhilin Yang*, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov.
+1. **[TrOCR](model_doc/trocr)** (da Microsoft), rilasciato assieme al paper [TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282) da Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, Furu Wei.
+1. **[UniSpeech](model_doc/unispeech)** (da Microsoft Research) rilasciato con il paper [UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data](https://arxiv.org/abs/2101.07597) da Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael Zeng, Xuedong Huang.
+1. **[UniSpeechSat](model_doc/unispeech-sat)** (da Microsoft Research) rilasciato con il paper [UNISPEECH-SAT: UNIVERSAL SPEECH REPRESENTATION LEARNING WITH SPEAKER AWARE PRE-TRAINING](https://arxiv.org/abs/2110.05752) da Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu.
+1. **[VAN](model_doc/van)** (dalle Universitร di Tsinghua e Nankai) rilasciato con il paper [Visual Attention Network](https://arxiv.org/abs/2202.09741) da Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, Shi-Min Hu.
+1. **[ViLT](model_doc/vilt)** (da NAVER AI Lab/Kakao Enterprise/Kakao Brain) rilasciato con il paper [ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision](https://arxiv.org/abs/2102.03334) da Wonjae Kim, Bokyung Son, Ildoo Kim.
+1. **[Vision Transformer (ViT)](model_doc/vit)** (da Google AI) rilasciato con il paper [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) da Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, Neil Houlsby.
+1. **[ViTMAE](model_doc/vit_mae)** (da Meta AI) rilasciato con il paper [Masked Autoencoders Are Scalable Vision Learners](https://arxiv.org/abs/2111.06377) da Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollรกr, Ross Girshick.
+1. **[VisualBERT](model_doc/visual_bert)** (da UCLA NLP) rilasciato con il paper [VisualBERT: A Simple and Performant Baseline for Vision and Language](https://arxiv.org/pdf/1908.03557) da Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang.
+1. **[WavLM](model_doc/wavlm)** (da Microsoft Research) rilasciato con il paper [WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing](https://arxiv.org/abs/2110.13900) da Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, Jian Wu, Long Zhou, Shuo Ren, Yanmin Qian, Yao Qian, Jian Wu, Michael Zeng, Furu Wei.
+1. **[Wav2Vec2](model_doc/wav2vec2)** (da Facebook AI) rilasciato con il paper [wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations](https://arxiv.org/abs/2006.11477) da Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli.
+1. **[Wav2Vec2Phoneme](model_doc/wav2vec2_phoneme)** (da Facebook AI) rilasciato con il paper [Simple and Effective Zero-shot Cross-lingual Phoneme Recognition](https://arxiv.org/abs/2109.11680) da Qiantong Xu, Alexei Baevski, Michael Auli.
+1. **[XGLM](model_doc/xglm)** (da Facebook AI) rilasciato con il paper [Few-shot Learning with Multilingual Language Models](https://arxiv.org/abs/2112.10668) da Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O'Horo, Jeff Wang, Luke Zettlemoyer, Zornitsa Kozareva, Mona Diab, Veselin Stoyanov, Xian Li.
+1. **[XLM](model_doc/xlm)** (v Facebook) rilasciato assieme al paper [Cross-lingual Language Model Pretraining](https://arxiv.org/abs/1901.07291) da Guillaume Lample e Alexis Conneau.
+1. **[XLM-ProphetNet](model_doc/xlm-prophetnet)** (da Microsoft Research) rilasciato con il paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) da Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang e Ming Zhou.
+1. **[XLM-RoBERTa](model_doc/xlm-roberta)** (da Facebook AI), rilasciato assieme al paper [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116) da Alexis Conneau*, Kartikay Khandelwal*, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmรกn, Edouard Grave, Myle Ott, Luke Zettlemoyer e Veselin Stoyanov.
+1. **[XLM-RoBERTa-XL](model_doc/xlm-roberta-xl)** (da Facebook AI), rilasciato assieme al paper [Larger-Scale Transformers for Multilingual Masked Language Modeling](https://arxiv.org/abs/2105.00572) da Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau.
+1. **[XLNet](model_doc/xlnet)** (da Google/CMU) rilasciato con il paper [โXLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) da Zhilin Yang*, Zihang Dai*, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, Quoc V. Le.
+1. **[XLSR-Wav2Vec2](model_doc/xlsr_wav2vec2)** (da Facebook AI) rilasciato con il paper [Unsupervised Cross-Lingual Representation Learning For Speech Recognition](https://arxiv.org/abs/2006.13979) da Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael Auli.
+1. **[XLS-R](model_doc/xls_r)** (da Facebook AI) rilasciato con il paper [XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale](https://arxiv.org/abs/2111.09296) da Arun Babu, Changhan Wang, Andros Tjandra, Kushal Lakhotia, Qiantong Xu, Naman Goyal, Kritika Singh, Patrick von Platen, Yatharth Saraf, Juan Pino, Alexei Baevski, Alexis Conneau, Michael Auli.
+1. **[YOLOS](model_doc/yolos)** (dalla Universitร della scienza e tecnologia di Huazhong) rilasciato con il paper [You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection](https://arxiv.org/abs/2106.00666) da Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
+1. **[YOSO](model_doc/yoso)** (dall'Universitร del Wisconsin - Madison) rilasciato con il paper [You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling](https://arxiv.org/abs/2111.09714) da Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh.
+
+
+### Framework supportati
+
+La tabella seguente rappresenta il supporto attuale nella libreria per ognuno di questi modelli, si puรฒ identificare se questi hanno un Python
+tokenizer (chiamato "slow"). Un tokenizer "fast" supportato dalla libreria ๐ค Tokenizers, e se hanno supporto in Jax (via Flax), PyTorch, e/o TensorFlow.
+
+
+
+| Model | Tokenizer slow | Tokenizer fast | PyTorch support | TensorFlow support | Flax Support |
+|:---------------------------:|:--------------:|:--------------:|:---------------:|:------------------:|:------------:|
+| ALBERT | โ
| โ
| โ
| โ
| โ
|
+| BART | โ
| โ
| โ
| โ
| โ
|
+| BEiT | โ | โ | โ
| โ | โ
|
+| BERT | โ
| โ
| โ
| โ
| โ
|
+| Bert Generation | โ
| โ | โ
| โ | โ |
+| BigBird | โ
| โ
| โ
| โ | โ
|
+| BigBirdPegasus | โ | โ | โ
| โ | โ |
+| Blenderbot | โ
| โ
| โ
| โ
| โ
|
+| BlenderbotSmall | โ
| โ
| โ
| โ
| โ
|
+| CamemBERT | โ
| โ
| โ
| โ
| โ |
+| Canine | โ
| โ | โ
| โ | โ |
+| CLIP | โ
| โ
| โ
| โ
| โ
|
+| ConvBERT | โ
| โ
| โ
| โ
| โ |
+| ConvNext | โ | โ | โ
| โ
| โ |
+| CTRL | โ
| โ | โ
| โ
| โ |
+| CvT | โ | โ | โ
| โ | โ |
+| Data2VecAudio | โ | โ | โ
| โ | โ |
+| Data2VecText | โ | โ | โ
| โ | โ |
+| Data2VecVision | โ | โ | โ
| โ
| โ |
+| DeBERTa | โ
| โ
| โ
| โ
| โ |
+| DeBERTa-v2 | โ
| โ
| โ
| โ
| โ |
+| Decision Transformer | โ | โ | โ
| โ | โ |
+| DeiT | โ | โ | โ
| โ | โ |
+| DETR | โ | โ | โ
| โ | โ |
+| DistilBERT | โ
| โ
| โ
| โ
| โ
|
+| DPR | โ
| โ
| โ
| โ
| โ |
+| DPT | โ | โ | โ
| โ | โ |
+| ELECTRA | โ
| โ
| โ
| โ
| โ
|
+| Encoder decoder | โ | โ | โ
| โ
| โ
|
+| FairSeq Machine-Translation | โ
| โ | โ
| โ | โ |
+| FlauBERT | โ
| โ | โ
| โ
| โ |
+| Flava | โ | โ | โ
| โ | โ |
+| FNet | โ
| โ
| โ
| โ | โ |
+| Funnel Transformer | โ
| โ
| โ
| โ
| โ |
+| GLPN | โ | โ | โ
| โ | โ |
+| GPT Neo | โ | โ | โ
| โ | โ
|
+| GPT NeoX | โ | โ
| โ
| โ | โ |
+| GPT-J | โ | โ | โ
| โ
| โ
|
+| Hubert | โ | โ | โ
| โ
| โ |
+| I-BERT | โ | โ | โ
| โ | โ |
+| ImageGPT | โ | โ | โ
| โ | โ |
+| LayoutLM | โ
| โ
| โ
| โ
| โ |
+| LayoutLMv2 | โ
| โ
| โ
| โ | โ |
+| LayoutLMv3 | โ
| โ
| โ
| โ
| โ |
+| LED | โ
| โ
| โ
| โ
| โ |
+| Longformer | โ
| โ
| โ
| โ
| โ |
+| LUKE | โ
| โ | โ
| โ | โ |
+| LXMERT | โ
| โ
| โ
| โ
| โ |
+| M2M100 | โ
| โ | โ
| โ | โ |
+| Marian | โ
| โ | โ
| โ
| โ
|
+| MaskFormer | โ | โ | โ
| โ | โ |
+| mBART | โ
| โ
| โ
| โ
| โ
|
+| MegatronBert | โ | โ | โ
| โ | โ |
+| MobileBERT | โ
| โ
| โ
| โ
| โ |
+| MPNet | โ
| โ
| โ
| โ
| โ |
+| mT5 | โ
| โ
| โ
| โ
| โ
|
+| Nystromformer | โ | โ | โ
| โ | โ |
+| OpenAI GPT | โ
| โ
| โ
| โ
| โ |
+| OpenAI GPT-2 | โ
| โ
| โ
| โ
| โ
|
+| OPT | โ | โ | โ
| โ | โ |
+| Pegasus | โ
| โ
| โ
| โ
| โ
|
+| Perceiver | โ
| โ | โ
| โ | โ |
+| PLBart | โ
| โ | โ
| โ | โ |
+| PoolFormer | โ | โ | โ
| โ | โ |
+| ProphetNet | โ
| โ | โ
| โ | โ |
+| QDQBert | โ | โ | โ
| โ | โ |
+| RAG | โ
| โ | โ
| โ
| โ |
+| Realm | โ
| โ
| โ
| โ | โ |
+| Reformer | โ
| โ
| โ
| โ | โ |
+| RegNet | โ | โ | โ
| โ
| โ
|
+| RemBERT | โ
| โ
| โ
| โ
| โ |
+| ResNet | โ | โ | โ
| โ
| โ
|
+| RetriBERT | โ
| โ
| โ
| โ | โ |
+| RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| RoFormer | โ
| โ
| โ
| โ
| โ
|
+| SegFormer | โ | โ | โ
| โ | โ |
+| SEW | โ | โ | โ
| โ | โ |
+| SEW-D | โ | โ | โ
| โ | โ |
+| Speech Encoder decoder | โ | โ | โ
| โ | โ
|
+| Speech2Text | โ
| โ | โ
| โ
| โ |
+| Speech2Text2 | โ
| โ | โ | โ | โ |
+| Splinter | โ
| โ
| โ
| โ | โ |
+| SqueezeBERT | โ
| โ
| โ
| โ | โ |
+| Swin | โ | โ | โ
| โ
| โ |
+| T5 | โ
| โ
| โ
| โ
| โ
|
+| TAPAS | โ
| โ | โ
| โ
| โ |
+| Trajectory Transformer | โ | โ | โ
| โ | โ |
+| Transformer-XL | โ
| โ | โ
| โ
| โ |
+| TrOCR | โ | โ | โ
| โ | โ |
+| UniSpeech | โ | โ | โ
| โ | โ |
+| UniSpeechSat | โ | โ | โ
| โ | โ |
+| VAN | โ | โ | โ
| โ | โ |
+| ViLT | โ | โ | โ
| โ | โ |
+| Vision Encoder decoder | โ | โ | โ
| โ
| โ
|
+| VisionTextDualEncoder | โ | โ | โ
| โ | โ
|
+| VisualBert | โ | โ | โ
| โ | โ |
+| ViT | โ | โ | โ
| โ
| โ
|
+| ViTMAE | โ | โ | โ
| โ
| โ |
+| Wav2Vec2 | โ
| โ | โ
| โ
| โ
|
+| Wav2Vec2-Conformer | โ | โ | โ
| โ | โ |
+| WavLM | โ | โ | โ
| โ | โ |
+| XGLM | โ
| โ
| โ
| โ | โ
|
+| XLM | โ
| โ | โ
| โ
| โ |
+| XLM-RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| XLM-RoBERTa-XL | โ | โ | โ
| โ | โ |
+| XLMProphetNet | โ
| โ | โ
| โ | โ |
+| XLNet | โ
| โ
| โ
| โ
| โ |
+| YOLOS | โ | โ | โ
| โ | โ |
+| YOSO | โ | โ | โ
| โ | โ |
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/installation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/installation.md
new file mode 100644
index 0000000000000000000000000000000000000000..a4f444c1eb0c4cbb71218c7a7f66ffe7ff230456
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/installation.md
@@ -0,0 +1,239 @@
+
+
+# Installazione
+
+Installa ๐ค Transformers per qualsiasi libreria di deep learning con cui stai lavorando, imposta la tua cache, e opzionalmente configura ๐ค Transformers per l'esecuzione offline.
+
+๐ค Transformers รจ testato su Python 3.6+, PyTorch 1.1.0+, TensorFlow 2.0+, e Flax. Segui le istruzioni di installazione seguenti per la libreria di deep learning che stai utilizzando:
+
+* [PyTorch](https://pytorch.org/get-started/locally/) istruzioni di installazione.
+* [TensorFlow 2.0](https://www.tensorflow.org/install/pip) istruzioni di installazione.
+* [Flax](https://flax.readthedocs.io/en/latest/) istruzioni di installazione.
+
+## Installazione con pip
+
+Puoi installare ๐ค Transformers in un [ambiente virtuale](https://docs.python.org/3/library/venv.html). Se non sei familiare con gli ambienti virtuali in Python, dai un'occhiata a questa [guida](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/). Un ambiente virtuale rende piรน semplice la gestione di progetti differenti, evitando problemi di compatibilitร tra dipendenze.
+
+Inizia creando un ambiente virtuale nella directory del tuo progetto:
+
+```bash
+python -m venv .env
+```
+
+Attiva l'ambiente virtuale:
+
+```bash
+source .env/bin/activate
+```
+
+Ora puoi procedere con l'installazione di ๐ค Transformers eseguendo il comando seguente:
+
+```bash
+pip install transformers
+```
+
+Per il solo supporto della CPU, puoi installare facilmente ๐ค Transformers e una libreria di deep learning in solo una riga. Ad esempio, installiamo ๐ค Transformers e PyTorch con:
+
+```bash
+pip install transformers[torch]
+```
+
+๐ค Transformers e TensorFlow 2.0:
+
+```bash
+pip install transformers[tf-cpu]
+```
+
+๐ค Transformers e Flax:
+
+```bash
+pip install transformers[flax]
+```
+
+Infine, verifica se ๐ค Transformers รจ stato installato in modo appropriato eseguendo il seguente comando. Questo scaricherร un modello pre-allenato:
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
+```
+
+Dopodichรฉ stampa l'etichetta e il punteggio:
+
+```bash
+[{'label': 'POSITIVE', 'score': 0.9998704791069031}]
+```
+
+## Installazione dalla fonte
+
+Installa ๐ค Transformers dalla fonte con il seguente comando:
+
+```bash
+pip install git+https://github.com/huggingface/transformers
+```
+
+Questo comando installa la versione `main` piรน attuale invece dell'ultima versione stabile. Questo รจ utile per stare al passo con gli ultimi sviluppi. Ad esempio, se un bug รจ stato sistemato da quando รจ uscita l'ultima versione ufficiale ma non รจ stata ancora rilasciata una nuova versione. Tuttavia, questo significa che questa versione `main` puรฒ non essere sempre stabile. Ci sforziamo per mantenere la versione `main` operativa, e la maggior parte dei problemi viene risolta in poche ore o in un giorno. Se riscontri un problema, per favore apri una [Issue](https://github.com/huggingface/transformers/issues) cosรฌ possiamo sistemarlo ancora piรน velocemente!
+
+Controlla se ๐ค Transformers รจ stata installata in modo appropriato con il seguente comando:
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))"
+```
+
+## Installazione modificabile
+
+Hai bisogno di un'installazione modificabile se vuoi:
+
+* Usare la versione `main` del codice dalla fonte.
+* Contribuire a ๐ค Transformers e hai bisogno di testare i cambiamenti nel codice.
+
+Clona il repository e installa ๐ค Transformers con i seguenti comandi:
+
+```bash
+git clone https://github.com/huggingface/transformers.git
+cd transformers
+pip install -e .
+```
+
+Questi comandi collegheranno la cartella in cui รจ stato clonato il repository e i path delle librerie Python. Python guarderร ora all'interno della cartella clonata, oltre ai normali path delle librerie. Per esempio, se i tuoi pacchetti Python sono installati tipicamente in `~/anaconda3/envs/main/lib/python3.7/site-packages/`, Python cercherร anche nella cartella clonata: `~/transformers/`.
+
+
+
+Devi tenere la cartella `transformers` se vuoi continuare ad utilizzare la libreria.
+
+
+
+Ora puoi facilmente aggiornare il tuo clone all'ultima versione di ๐ค Transformers con il seguente comando:
+
+```bash
+cd ~/transformers/
+git pull
+```
+
+Il tuo ambiente Python troverร la versione `main` di ๐ค Transformers alla prossima esecuzione.
+
+## Installazione con conda
+
+Installazione dal canale conda `conda-forge`:
+
+```bash
+conda install conda-forge::transformers
+```
+
+## Impostazione della cache
+
+I modelli pre-allenati sono scaricati e memorizzati localmente nella cache in: `~/.cache/huggingface/transformers/`. Questa รจ la directory di default data dalla variabile d'ambiente della shell `TRANSFORMERS_CACHE`. Su Windows, la directory di default รจ data da `C:\Users\username\.cache\huggingface\transformers`. Puoi cambiare le variabili d'ambiente della shell indicate in seguito, in ordine di prioritร , per specificare una directory differente per la cache:
+
+1. Variabile d'ambiente della shell (default): `TRANSFORMERS_CACHE`.
+2. Variabile d'ambiente della shell: `HF_HOME` + `transformers/`.
+3. Variabile d'ambiente della shell: `XDG_CACHE_HOME` + `/huggingface/transformers`.
+
+
+
+๐ค Transformers utilizzerร le variabili d'ambiente della shell `PYTORCH_TRANSFORMERS_CACHE` o `PYTORCH_PRETRAINED_BERT_CACHE` se si proviene da un'iterazione precedente di questa libreria e sono state impostate queste variabili d'ambiente, a meno che non si specifichi la variabile d'ambiente della shell `TRANSFORMERS_CACHE`.
+
+
+
+## Modalitร Offline
+
+๐ค Transformers puรฒ essere eseguita in un ambiente firewalled o offline utilizzando solo file locali. Imposta la variabile d'ambiente `HF_HUB_OFFLINE=1` per abilitare questo comportamento.
+
+
+
+Aggiungi [๐ค Datasets](https://huggingface.co/docs/datasets/) al tuo flusso di lavoro offline di training impostando la variabile d'ambiente `HF_DATASETS_OFFLINE=1`.
+
+
+
+Ad esempio, in genere si esegue un programma su una rete normale, protetta da firewall per le istanze esterne, con il seguente comando:
+
+```bash
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+Esegui lo stesso programma in un'istanza offline con:
+
+```bash
+HF_DATASETS_OFFLINE=1 HF_HUB_OFFLINE=1 \
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+Lo script viene ora eseguito senza bloccarsi o attendere il timeout, perchรฉ sa di dover cercare solo file locali.
+
+### Ottenere modelli e tokenizer per l'uso offline
+
+Un'altra opzione per utilizzare offline ๐ค Transformers รจ scaricare i file in anticipo, e poi puntare al loro path locale quando hai la necessitร di utilizzarli offline. Ci sono tre modi per fare questo:
+
+* Scarica un file tramite l'interfaccia utente sul [Model Hub](https://huggingface.co/models) premendo sull'icona โ.
+
+ 
+
+* Utilizza il flusso [`PreTrainedModel.from_pretrained`] e [`PreTrainedModel.save_pretrained`]:
+
+ 1. Scarica i tuoi file in anticipo con [`PreTrainedModel.from_pretrained`]:
+
+ ```py
+ >>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("bigscience/T0_3B")
+ >>> model = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0_3B")
+ ```
+
+ 2. Salva i tuoi file in una directory specificata con [`PreTrainedModel.save_pretrained`]:
+
+ ```py
+ >>> tokenizer.save_pretrained("./il/tuo/path/bigscience_t0")
+ >>> model.save_pretrained("./il/tuo/path/bigscience_t0")
+ ```
+
+ 3. Ora quando sei offline, carica i tuoi file con [`PreTrainedModel.from_pretrained`] dalla directory specificata:
+
+ ```py
+ >>> tokenizer = AutoTokenizer.from_pretrained("./il/tuo/path/bigscience_t0")
+ >>> model = AutoModel.from_pretrained("./il/tuo/path/bigscience_t0")
+ ```
+
+* Scarica in maniera programmatica i file con la libreria [huggingface_hub](https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub):
+
+ 1. Installa la libreria `huggingface_hub` nel tuo ambiente virtuale:
+
+ ```bash
+ python -m pip install huggingface_hub
+ ```
+
+ 2. Utilizza la funzione [`hf_hub_download`](https://huggingface.co/docs/hub/adding-a-library#download-files-from-the-hub) per scaricare un file in un path specifico. Per esempio, il seguente comando scarica il file `config.json` dal modello [T0](https://huggingface.co/bigscience/T0_3B) nel path che desideri:
+
+ ```py
+ >>> from huggingface_hub import hf_hub_download
+
+ >>> hf_hub_download(repo_id="bigscience/T0_3B", filename="config.json", cache_dir="./il/tuo/path/bigscience_t0")
+ ```
+
+Una volta che il tuo file รจ scaricato e salvato in cache localmente, specifica il suo path locale per caricarlo e utilizzarlo:
+
+```py
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("./il/tuo/path/bigscience_t0/config.json")
+```
+
+
+
+Fai riferimento alla sezione [How to download files from the Hub](https://huggingface.co/docs/hub/how-to-downstream) per avere maggiori dettagli su come scaricare modelli presenti sull Hub.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/migration.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/migration.md
new file mode 100644
index 0000000000000000000000000000000000000000..07d31705784e7fa626a9aadf011aaf5a88e96e09
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/migration.md
@@ -0,0 +1,313 @@
+
+
+# Migrazione da pacchetti precedenti
+
+## Migrazione da transformers `v3.x` a `v4.x`
+
+Un paio di modifiche sono state introdotte nel passaggio dalla versione 3 alla versione 4. Di seguito รจ riportato un riepilogo delle
+modifiche previste:
+
+#### 1. AutoTokenizer e pipeline ora utilizzano tokenizer veloci (rust) per impostazione predefinita.
+
+I tokenizer python e rust hanno all'incirca le stesse API, ma i tokenizer rust hanno un set di funzionalitร piรน completo.
+
+Ciรฒ introduce due modifiche sostanziali:
+- La gestione dei token in overflow tra i tokenizer Python e Rust รจ diversa.
+- I tokenizers di rust non accettano numeri interi nei metodi di codifica.
+
+##### Come ottenere lo stesso comportamento di v3.x in v4.x
+
+- Le pipeline ora contengono funzionalitร aggiuntive pronte all'uso. Vedi la [pipeline di classificazione dei token con il flag `grouped_entities`](main_classes/pipelines#transformers.TokenClassificationPipeline).
+- Gli auto-tokenizer ora restituiscono tokenizer rust. Per ottenere invece i tokenizer python, l'utente deve usare il flag `use_fast` impostandolo `False`:
+
+Nella versione `v3.x`:
+```py
+from transformers import AutoTokenizer
+
+tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+```
+per ottenere lo stesso nella versione `v4.x`:
+```py
+from transformers import AutoTokenizer
+
+tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased", use_fast=False)
+```
+
+#### 2. SentencePiece รจ stato rimosso dalle dipendenze richieste
+
+Il requisito sulla dipendenza SentencePiece รจ stato rimosso da `setup.py`. ร stato fatto per avere un canale su anaconda cloud senza basarsi su `conda-forge`. Ciรฒ significa che i tokenizer che dipendono dalla libreria SentencePiece non saranno disponibili con un'installazione standard di `transformers`.
+
+Ciรฒ include le versioni **lente** di:
+- `XLNetTokenizer`
+- `AlbertTokenizer`
+- `CamembertTokenizer`
+- `MBartTokenizer`
+- `PegasusTokenizer`
+- `T5Tokenizer`
+- `ReformerTokenizer`
+- `XLMRobertaTokenizer`
+
+##### Come ottenere lo stesso comportamento della v3.x nella v4.x
+
+Per ottenere lo stesso comportamento della versione `v3.x`, devi installare anche `sentencepiece`:
+
+Nella versione `v3.x`:
+```bash
+pip install transformers
+```
+per ottenere lo stesso nella versione `v4.x`:
+```bash
+pip install transformers[sentencepiece]
+```
+o
+```bash
+pip install transformers stentencepiece
+```
+#### 3. L'architettura delle repo รจ stato aggiornata in modo che ogni modello abbia la propria cartella
+
+Con lโaggiunta di nuovi modelli, il numero di file nella cartella `src/transformers` continua a crescere e diventa piรน difficile navigare e capire. Abbiamo fatto la scelta di inserire ogni modello e i file che lo accompagnano nelle proprie sottocartelle.
+
+Si tratta di una modifica sostanziale in quanto l'importazione di layer intermedi utilizzando direttamente il modulo di un modello deve essere eseguita tramite un percorso diverso.
+
+##### Come ottenere lo stesso comportamento della v3.x nella v4.x
+
+Per ottenere lo stesso comportamento della versione `v3.x`, devi aggiornare il percorso utilizzato per accedere ai layer.
+
+Nella versione `v3.x`:
+```bash
+from transformers.modeling_bert import BertLayer
+```
+per ottenere lo stesso nella versione `v4.x`:
+```bash
+from transformers.models.bert.modeling_bert import BertLayer
+```
+
+#### 4. Impostare l'argomento `return_dict` su `True` per impostazione predefinita
+
+L'[argomento `return_dict`](main_classes/output) abilita la restituzione di oggetti python dict-like contenenti gli output del modello, invece delle tuple standard. Questo oggetto รจ self-documented poichรฉ le chiavi possono essere utilizzate per recuperare valori, comportandosi anche come una tupla e gli utenti possono recuperare oggetti per indexing o slicing.
+
+Questa รจ una modifica sostanziale poichรฉ la tupla non puรฒ essere decompressa: `value0, value1 = outputs` non funzionerร .
+
+##### Come ottenere lo stesso comportamento della v3.x nella v4.x
+
+Per ottenere lo stesso comportamento della versione `v3.x`, specifica l'argomento `return_dict` come `False`, sia nella configurazione del modello che nel passaggio successivo.
+
+Nella versione `v3.x`:
+```bash
+model = BertModel.from_pretrained("google-bert/bert-base-cased")
+outputs = model(**inputs)
+```
+per ottenere lo stesso nella versione `v4.x`:
+```bash
+model = BertModel.from_pretrained("google-bert/bert-base-cased")
+outputs = model(**inputs, return_dict=False)
+```
+o
+```bash
+model = BertModel.from_pretrained("google-bert/bert-base-cased", return_dict=False)
+outputs = model(**inputs)
+```
+
+#### 5. Rimozione di alcuni attributi deprecati
+
+Gli attributi sono stati rimossi se deprecati da almeno un mese. L'elenco completo degli attributi obsoleti รจ disponibile in [#8604](https://github.com/huggingface/transformers/pull/8604).
+
+Ecco un elenco di questi attributi/metodi/argomenti e quali dovrebbero essere le loro sostituzioni:
+
+In diversi modelli, le etichette diventano coerenti con gli altri modelli:
+- `masked_lm_labels` diventa `labels` in `AlbertForMaskedLM` e `AlbertForPreTraining`.
+- `masked_lm_labels` diventa `labels` in `BertForMaskedLM` e `BertForPreTraining`.
+- `masked_lm_labels` diventa `labels` in `DistilBertForMaskedLM`.
+- `masked_lm_labels` diventa `labels` in `ElectraForMaskedLM`.
+- `masked_lm_labels` diventa `labels` in `LongformerForMaskedLM`.
+- `masked_lm_labels` diventa `labels` in `MobileBertForMaskedLM`.
+- `masked_lm_labels` diventa `labels` in `RobertaForMaskedLM`.
+- `lm_labels` diventa `labels` in `BartForConditionalGeneration`.
+- `lm_labels` diventa `labels` in `GPT2DoubleHeadsModel`.
+- `lm_labels` diventa `labels` in `OpenAIGPTDoubleHeadsModel`.
+- `lm_labels` diventa `labels` in `T5ForConditionalGeneration`.
+
+In diversi modelli, il meccanismo di memorizzazione nella cache diventa coerente con gli altri:
+- `decoder_cached_states` diventa `past_key_values` in tutti i modelli BART-like, FSMT e T5.
+- `decoder_past_key_values` diventa `past_key_values` in tutti i modelli BART-like, FSMT e T5.
+- `past` diventa `past_key_values` in tutti i modelli CTRL.
+- `past` diventa `past_key_values` in tutti i modelli GPT-2.
+
+Per quanto riguarda le classi tokenizer:
+- L'attributo tokenizer `max_len` diventa `model_max_length`.
+- L'attributo tokenizer `return_lengths` diventa `return_length`.
+- L'argomento di codifica del tokenizer `is_pretokenized` diventa `is_split_into_words`.
+
+Per quanto riguarda la classe `Trainer`:
+- L'argomento `tb_writer` di `Trainer` รจ stato rimosso in favore della funzione richiamabile `TensorBoardCallback(tb_writer=...)`.
+- L'argomento `prediction_loss_only` di `Trainer` รจ stato rimosso in favore dell'argomento di classe `args.prediction_loss_only`.
+- L'attributo `data_collator` di `Trainer` sarร richiamabile.
+- Il metodo `_log` di `Trainer` รจ deprecato a favore di `log`.
+- Il metodo `_training_step` di `Trainer` รจ deprecato a favore di `training_step`.
+- Il metodo `_prediction_loop` di `Trainer` รจ deprecato a favore di `prediction_loop`.
+- Il metodo `is_local_master` di `Trainer` รจ deprecato a favore di `is_local_process_zero`.
+- Il metodo `is_world_master` di `Trainer` รจ deprecato a favore di `is_world_process_zero`.
+
+Per quanto riguarda la classe `TrainingArguments`:
+- L'argomento `evaluate_during_training` di `TrainingArguments` รจ deprecato a favore di `eval_strategy`.
+
+Per quanto riguarda il modello Transfo-XL:
+- L'attributo di configurazione `tie_weight` di Transfo-XL diventa `tie_words_embeddings`.
+- Il metodo di modellazione `reset_length` di Transfo-XL diventa `reset_memory_length`.
+
+Per quanto riguarda le pipeline:
+- L'argomento `topk` di `FillMaskPipeline` diventa `top_k`.
+
+
+
+## Passaggio da pytorch-transformers a ๐ค Transformers
+
+Ecco un breve riepilogo di ciรฒ a cui prestare attenzione durante il passaggio da `pytorch-transformers` a ๐ค Transformers.
+
+### Lโordine posizionale di alcune parole chiave di input dei modelli (`attention_mask`, `token_type_ids`...) รจ cambiato
+
+Per usare Torchscript (vedi #1010, #1204 e #1195) l'ordine specifico delle **parole chiave di input** di alcuni modelli (`attention_mask`, `token_type_ids`...) รจ stato modificato.
+
+Se inizializzavi i modelli usando parole chiave per gli argomenti, ad esempio `model(inputs_ids, attention_mask=attention_mask, token_type_ids=token_type_ids)`, questo non dovrebbe causare alcun cambiamento.
+
+Se inizializzavi i modelli con input posizionali per gli argomenti, ad esempio `model(inputs_ids, attention_mask, token_type_ids)`, potrebbe essere necessario ricontrollare l'ordine esatto degli argomenti di input.
+
+## Migrazione da pytorch-pretrained-bert
+
+Ecco un breve riepilogo di ciรฒ a cui prestare attenzione durante la migrazione da `pytorch-pretrained-bert` a ๐ค Transformers
+
+### I modelli restituiscono sempre `tuple`
+
+La principale modifica di rilievo durante la migrazione da `pytorch-pretrained-bert` a ๐ค Transformers รจ che il metodo dei modelli di previsione dร sempre una `tupla` con vari elementi a seconda del modello e dei parametri di configurazione.
+
+Il contenuto esatto delle tuple per ciascun modello รจ mostrato in dettaglio nelle docstring dei modelli e nella [documentazione](https://huggingface.co/transformers/).
+
+In quasi tutti i casi, andrร bene prendendo il primo elemento dell'output come quello che avresti precedentemente utilizzato in `pytorch-pretrained-bert`.
+
+Ecco un esempio di conversione da `pytorch-pretrained-bert`
+ a ๐ค Transformers per un modello di classificazione `BertForSequenceClassification`:
+
+```python
+# Carichiamo il nostro modello
+model = BertForSequenceClassification.from_pretrained("google-bert/bert-base-uncased")
+
+# Se usavi questa riga in pytorch-pretrained-bert :
+loss = model(input_ids, labels=labels)
+
+# Ora usa questa riga in ๐ค Transformers per estrarre la perdita dalla tupla di output:
+outputs = model(input_ids, labels=labels)
+loss = outputs[0]
+
+# In ๐ค Transformers puoi anche avere accesso ai logit:
+loss, logits = outputs[:2]
+
+# Ed anche agli attention weight se configuri il modello per restituirli (e anche altri output, vedi le docstring e la documentazione)
+model = BertForSequenceClassification.from_pretrained(" google-bert/bert-base-uncased", output_attentions=True)
+outputs = model(input_ids, labels=labels)
+loss, logits, attentions = outputs
+```
+
+### Serializzazione
+
+Modifica sostanziale nel metodo `from_pretrained()`:
+
+1. I modelli sono ora impostati in modalitร di valutazione in maniera predefinita quando usi il metodo `from_pretrained()`. Per addestrarli non dimenticare di riportarli in modalitร di addestramento (`model.train()`) per attivare i moduli di dropout.
+
+2. Gli argomenti aggiuntivi `*inputs` e `**kwargs` forniti al metodo `from_pretrained()` venivano passati direttamente al metodo `__init__()` della classe sottostante del modello. Ora sono usati per aggiornare prima l'attributo di configurazione del modello, che puรฒ non funzionare con le classi del modello derivate costruite basandosi sui precedenti esempi di `BertForSequenceClassification`. Piรน precisamente, gli argomenti posizionali `*inputs` forniti a `from_pretrained()` vengono inoltrati direttamente al metodo `__init__()` del modello mentre gli argomenti keyword `**kwargs` (i) che corrispondono agli attributi della classe di configurazione, vengono utilizzati per aggiornare tali attributi (ii) che non corrispondono ad alcun attributo della classe di configurazione, vengono inoltrati al metodo `__init__()`.
+
+Inoltre, sebbene non si tratti di una modifica sostanziale, i metodi di serializzazione sono stati standardizzati e probabilmente dovresti passare al nuovo metodo `save_pretrained(save_directory)` se prima usavi qualsiasi altro metodo di serializzazione.
+
+Ecco un esempio:
+
+```python
+### Carichiamo un modello e un tokenizer
+model = BertForSequenceClassification.from_pretrained("google-bert/bert-base-uncased")
+tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+
+### Facciamo fare alcune cose al nostro modello e tokenizer
+# Es: aggiungiamo nuovi token al vocabolario e agli embending del nostro modello
+tokenizer.add_tokens(["[SPECIAL_TOKEN_1]", "[SPECIAL_TOKEN_2]"])
+model.resize_token_embeddings(len(tokenizer))
+# Alleniamo il nostro modello
+train(model)
+
+### Ora salviamo il nostro modello e il tokenizer in una cartella
+model.save_pretrained("./my_saved_model_directory/")
+tokenizer.save_pretrained("./my_saved_model_directory/")
+
+### Ricarichiamo il modello e il tokenizer
+model = BertForSequenceClassification.from_pretrained("./my_saved_model_directory/")
+tokenizer = BertTokenizer.from_pretrained("./my_saved_model_directory/")
+```
+
+### Ottimizzatori: BertAdam e OpenAIAdam ora sono AdamW, lo scheduling รจ quello standard PyTorch
+
+I due ottimizzatori precedenti inclusi, `BertAdam` e `OpenAIAdam`, sono stati sostituiti da un singolo `AdamW` che presenta alcune differenze:
+
+- implementa solo la correzione del weights decay,
+- lo scheduling ora รจ esterno (vedi sotto),
+- anche il gradient clipping ora รจ esterno (vedi sotto).
+
+Il nuovo ottimizzatore `AdamW` corrisponde alle API di `Adam` di PyTorch e ti consente di utilizzare metodi PyTorch o apex per lo scheduling e il clipping.
+
+Lo scheduling รจ ora standard [PyTorch learning rate schedulers](https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate) e non fanno piรน parte dell'ottimizzatore.
+
+Ecco un esempio di linear warmup e decay con `BertAdam` e con `AdamW`:
+
+```python
+# Parametri:
+lr = 1e-3
+max_grad_norm = 1.0
+num_training_steps = 1000
+num_warmup_steps = 100
+warmup_proportion = float( num_warmup_steps) / float(num_training_steps) # 0.1
+
+### In precedenza l'ottimizzatore BertAdam veniva istanziato in questo modo:
+optimizer = BertAdam(
+ model.parameters(),
+ lr=lr,
+ schedule="warmup_linear",
+ warmup=warmup_proportion,
+ num_training_steps=num_training_steps,
+)
+### e usato in questo modo:
+for batch in train_data:
+ loss = model(batch)
+ loss.backward()
+ optimizer.step()
+
+### In ๐ค Transformers, ottimizzatore e schedule sono divisi e usati in questo modo:
+optimizer = AdamW(
+ model.parameters(), lr=lr, correct_bias=False
+) # Per riprodurre il comportamento specifico di BertAdam impostare correct_bias=False
+scheduler = get_linear_schedule_with_warmup(
+ optimizer, num_warmup_steps=num_warmup_steps, num_training_steps=num_training_steps
+) # PyTorch scheduler
+### e va usato cosรฌ:
+for batch in train_data:
+ loss = model(batch)
+ loss.backward()
+ torch.nn.utils.clip_grad_norm_(
+ model.parameters(), max_grad_norm
+ ) # Gradient clipping non รจ piรน in AdamW (quindi puoi usare amp senza problemi)
+ optimizer.step()
+ scheduler.step()
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/model_sharing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/model_sharing.md
new file mode 100644
index 0000000000000000000000000000000000000000..6505658616baa568de39dd63324803d6c5a00bbe
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/model_sharing.md
@@ -0,0 +1,238 @@
+
+
+# Condividi un modello
+
+Gli ultimi due tutorial ti hanno mostrato come puoi fare fine-tuning di un modello con PyTorch, Keras e ๐ค Accelerate per configurazioni distribuite. Il prossimo passo รจ quello di condividere il tuo modello con la community! In Hugging Face, crediamo nella condivisione della conoscenza e delle risorse in modo da democratizzare l'intelligenza artificiale per chiunque. Ti incoraggiamo a considerare di condividere il tuo modello con la community per aiutare altre persone a risparmiare tempo e risorse.
+
+In questo tutorial, imparerai due metodi per la condivisione di un modello trained o fine-tuned nel [Model Hub](https://huggingface.co/models):
+
+- Condividi in modo programmatico i tuoi file nell'Hub.
+- Trascina i tuoi file nell'Hub mediante interfaccia grafica.
+
+VIDEO
+
+
+
+Per condividere un modello con la community, hai bisogno di un account su [huggingface.co](https://huggingface.co/join). Puoi anche unirti ad un'organizzazione esistente o crearne una nuova.
+
+
+
+## Caratteristiche dei repository
+
+Ogni repository nel Model Hub si comporta come un tipico repository di GitHub. I nostri repository offrono il versionamento, la cronologia dei commit, e la possibilitร di visualizzare le differenze.
+
+Il versionamento all'interno del Model Hub รจ basato su git e [git-lfs](https://git-lfs.github.com/). In altre parole, puoi trattare un modello come un unico repository, consentendo un maggiore controllo degli accessi e maggiore scalabilitร . Il controllo delle versioni consente *revisions*, un metodo per appuntare una versione specifica di un modello con un hash di commit, un tag o un branch.
+
+Come risultato, puoi caricare una specifica versione di un modello con il parametro `revision`:
+
+```py
+>>> model = AutoModel.from_pretrained(
+... "julien-c/EsperBERTo-small", revision="4c77982" # nome di un tag, di un branch, o commit hash
+... )
+```
+
+Anche i file possono essere modificati facilmente in un repository ed รจ possibile visualizzare la cronologia dei commit e le differenze:
+
+
+
+## Configurazione
+
+Prima di condividere un modello nell'Hub, hai bisogno delle tue credenziali di Hugging Face. Se hai accesso ad un terminale, esegui il seguente comando nell'ambiente virtuale in cui รจ installata la libreria ๐ค Transformers. Questo memorizzerร il tuo token di accesso nella cartella cache di Hugging Face (di default `~/.cache/`):
+
+```bash
+huggingface-cli login
+```
+
+Se stai usando un notebook come Jupyter o Colaboratory, assicurati di avere la libreria [`huggingface_hub`](https://huggingface.co/docs/hub/adding-a-library) installata. Questa libreria ti permette di interagire in maniera programmatica con l'Hub.
+
+```bash
+pip install huggingface_hub
+```
+
+Utilizza `notebook_login` per accedere all'Hub, e segui il link [qui](https://huggingface.co/settings/token) per generare un token con cui effettuare il login:
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Converti un modello per tutti i framework
+
+Per assicurarti che il tuo modello possa essere utilizzato da persone che lavorano con un framework differente, ti raccomandiamo di convertire e caricare il tuo modello sia con i checkpoint di PyTorch che con quelli di TensorFlow. Anche se รจ possibile caricare il modello da un framework diverso, se si salta questo passaggio, il caricamento sarร piรน lento perchรฉ ๐ค Transformers ha bisogno di convertire i checkpoint al momento.
+
+Convertire un checkpoint per un altro framework รจ semplice. Assicurati di avere PyTorch e TensorFlow installati (vedi [qui](installation) per le istruzioni d'installazione), e poi trova il modello specifico per il tuo compito nell'altro framework.
+
+
+
+Specifica `from_tf=True` per convertire un checkpoint da TensorFlow a PyTorch:
+
+```py
+>>> pt_model = DistilBertForSequenceClassification.from_pretrained(
+... "path/verso/il-nome-magnifico-che-hai-scelto", from_tf=True
+... )
+>>> pt_model.save_pretrained("path/verso/il-nome-magnifico-che-hai-scelto")
+```
+
+
+Specifica `from_pt=True` per convertire un checkpoint da PyTorch a TensorFlow:
+
+```py
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained(
+... "path/verso/il-nome-magnifico-che-hai-scelto", from_pt=True
+... )
+```
+
+Poi puoi salvare il tuo nuovo modello in TensorFlow con il suo nuovo checkpoint:
+
+```py
+>>> tf_model.save_pretrained("path/verso/il-nome-magnifico-che-hai-scelto")
+```
+
+
+Se un modello รจ disponibile in Flax, puoi anche convertire un checkpoint da PyTorch a Flax:
+
+```py
+>>> flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
+... "path/verso/il-nome-magnifico-che-hai-scelto", from_pt=True
+... )
+```
+
+
+
+## Condividi un modello durante il training
+
+
+
+
+
+Condividere un modello nell'Hub รจ tanto semplice quanto aggiungere un parametro extra o un callback. Ricorda dal [tutorial sul fine-tuning](training), la classe [`TrainingArguments`] รจ dove specifichi gli iperparametri e le opzioni addizionali per l'allenamento. Una di queste opzioni di training include l'abilitร di condividere direttamente un modello nell'Hub. Imposta `push_to_hub=True` in [`TrainingArguments`]:
+
+```py
+>>> training_args = TrainingArguments(output_dir="il-mio-bellissimo-modello", push_to_hub=True)
+```
+
+Passa gli argomenti per il training come di consueto al [`Trainer`]:
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+Dopo aver effettuato il fine-tuning del tuo modello, chiama [`~transformers.Trainer.push_to_hub`] sul [`Trainer`] per condividere il modello allenato nell'Hub. ๐ค Transformers aggiungerร in modo automatico persino gli iperparametri, i risultati del training e le versioni del framework alla scheda del tuo modello (model card, in inglese)!
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+Condividi un modello nell'Hub con [`PushToHubCallback`]. Nella funzione [`PushToHubCallback`], aggiungi:
+
+- Una directory di output per il tuo modello.
+- Un tokenizer.
+- L'`hub_model_id`, che รจ il tuo username sull'Hub e il nome del modello.
+
+```py
+>>> from transformers import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="./il_path_dove_salvare_il_tuo_modello",
+... tokenizer=tokenizer,
+... hub_model_id="il-tuo-username/il-mio-bellissimo-modello",
+... )
+```
+
+Aggiungi il callback a [`fit`](https://keras.io/api/models/model_training_apis/), e ๐ค Transformers caricherร il modello allenato nell'Hub:
+
+```py
+>>> model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3, callbacks=push_to_hub_callback)
+```
+
+
+
+## Utilizzare la funzione `push_to_hub`
+
+Puoi anche chiamare `push_to_hub` direttamente sul tuo modello per caricarlo nell'Hub.
+
+Specifica il nome del tuo modello in `push_to_hub`:
+
+```py
+>>> pt_model.push_to_hub("il-mio-bellissimo-modello")
+```
+
+Questo crea un repository sotto il proprio username con il nome del modello `il-mio-bellissimo-modello`. Ora chiunque puรฒ caricare il tuo modello con la funzione `from_pretrained`:
+
+```py
+>>> from transformers import AutoModel
+
+>>> model = AutoModel.from_pretrained("il-tuo-username/il-mio-bellissimo-modello")
+```
+
+Se fai parte di un'organizzazione e vuoi invece condividere un modello sotto il nome dell'organizzazione, aggiungi il parametro `organization`:
+
+```py
+>>> pt_model.push_to_hub("il-mio-bellissimo-modello", organization="la-mia-fantastica-org")
+```
+
+La funzione `push_to_hub` puรฒ essere anche utilizzata per aggiungere altri file al repository del modello. Per esempio, aggiungi un tokenizer ad un repository di un modello:
+
+```py
+>>> tokenizer.push_to_hub("il-mio-bellissimo-modello")
+```
+
+O magari potresti voler aggiungere la versione di TensorFlow del tuo modello PyTorch a cui hai fatto fine-tuning:
+
+```py
+>>> tf_model.push_to_hub("il-mio-bellissimo-modello")
+```
+
+Ora quando navighi nel tuo profilo Hugging Face, dovresti vedere il tuo repository del modello appena creato. Premendo sulla scheda **Files** vengono visualizzati tutti i file caricati nel repository.
+
+Per maggiori dettagli su come creare e caricare file ad un repository, fai riferimento alla documentazione [qui](https://huggingface.co/docs/hub/how-to-upstream).
+
+## Carica un modello utilizzando l'interfaccia web
+
+Chi preferisce un approccio senza codice puรฒ caricare un modello tramite l'interfaccia web dell'hub. Visita [huggingface.co/new](https://huggingface.co/new) per creare un nuovo repository:
+
+
+
+Da qui, aggiungi alcune informazioni sul tuo modello:
+
+- Seleziona il/la **owner** del repository. Puoi essere te o qualunque organizzazione di cui fai parte.
+- Scegli un nome per il tuo modello, il quale sarร anche il nome del repository.
+- Scegli se il tuo modello รจ pubblico o privato.
+- Specifica la licenza utilizzata per il tuo modello.
+
+Ora premi sulla scheda **Files** e premi sul pulsante **Add file** per caricare un nuovo file al tuo repository. Trascina poi un file per caricarlo e aggiungere un messaggio di commit.
+
+
+
+## Aggiungi una scheda del modello
+
+Per assicurarti che chiunque possa comprendere le abilitร , limitazioni, i potenziali bias e le considerazioni etiche del tuo modello, per favore aggiungi una scheda del modello (model card, in inglese) al tuo repository. La scheda del modello รจ definita nel file `README.md`. Puoi aggiungere una scheda del modello:
+
+* Creando manualmente e caricando un file `README.md`.
+* Premendo sul pulsante **Edit model card** nel repository del tuo modello.
+
+Dai un'occhiata alla [scheda del modello](https://huggingface.co/distilbert/distilbert-base-uncased) di DistilBert per avere un buon esempio del tipo di informazioni che una scheda di un modello deve includere. Per maggiori dettagli legati ad altre opzioni che puoi controllare nel file `README.md`, come l'impatto ambientale o widget di esempio, fai riferimento alla documentazione [qui](https://huggingface.co/docs/hub/models-cards).
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/multilingual.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/multilingual.md
new file mode 100644
index 0000000000000000000000000000000000000000..e9e85beec1d96642c72fd88b4c4c09929d95f7d0
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/multilingual.md
@@ -0,0 +1,178 @@
+
+
+# Modelli multilingue per l'inferenza
+
+[[open-in-colab]]
+
+Ci sono diversi modelli multilingue in ๐ค Transformers, e il loro utilizzo per l'inferenza differisce da quello dei modelli monolingua. Non *tutti* gli utilizzi dei modelli multilingue sono perรฒ diversi. Alcuni modelli, come [google-bert/bert-base-multilingual-uncased](https://huggingface.co/google-bert/bert-base-multilingual-uncased), possono essere usati come un modello monolingua. Questa guida ti mostrerร come utilizzare modelli multilingue che utilizzano un modo diverso per fare l'inferenza.
+
+## XLM
+
+XLM ha dieci diversi checkpoint, di cui solo uno รจ monolingua. I nove checkpoint rimanenti possono essere suddivisi in due categorie: i checkpoint che utilizzano i language embeddings e quelli che non li utilizzano.
+
+### XLM con language embeddings
+
+I seguenti modelli XLM utilizzano gli embeddings linguistici per specificare la lingua utilizzata per l'inferenza:
+
+- `FacebookAI/xlm-mlm-ende-1024` (Modellazione mascherata del linguaggio (Masked language modeling, in inglese), Inglese-Tedesco)
+- `FacebookAI/xlm-mlm-enfr-1024` (Modellazione mascherata del linguaggio, Inglese-Francese)
+- `FacebookAI/xlm-mlm-enro-1024` (Modellazione mascherata del linguaggio, Inglese-Rumeno)
+- `FacebookAI/xlm-mlm-xnli15-1024` (Modellazione mascherata del linguaggio, lingue XNLI)
+- `FacebookAI/xlm-mlm-tlm-xnli15-1024` (Modellazione mascherata del linguaggio + traduzione, lingue XNLI)
+- `FacebookAI/xlm-clm-enfr-1024` (Modellazione causale del linguaggio, Inglese-Francese)
+- `FacebookAI/xlm-clm-ende-1024` (Modellazione causale del linguaggio, Inglese-Tedesco)
+
+Gli embeddings linguistici sono rappresentati come un tensore delle stesse dimensioni dell' `input_ids` passato al modello. I valori in questi tensori dipendono dal linguaggio usato e sono identificati dagli attributi `lang2id` e `id2lang` del tokenizer.
+
+In questo esempio, carica il checkpoint `FacebookAI/xlm-clm-enfr-1024` (Modellazione causale del linguaggio, Inglese-Francese):
+
+```py
+>>> import torch
+>>> from transformers import XLMTokenizer, XLMWithLMHeadModel
+
+>>> tokenizer = XLMTokenizer.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+>>> model = XLMWithLMHeadModel.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+```
+
+L'attributo `lang2id` del tokenizer mostra il linguaggio del modello e il suo ids:
+
+```py
+>>> print(tokenizer.lang2id)
+{'en': 0, 'fr': 1}
+```
+
+Poi, crea un esempio di input:
+
+```py
+>>> input_ids = torch.tensor([tokenizer.encode("Wikipedia was used to")]) # batch size of 1
+```
+
+Imposta l'id del linguaggio a `"en"` e usalo per definire il language embedding. Il language embedding รจ un tensore riempito con `0` perchรฉ questo รจ il language id per l'inglese. Questo tensore dovrebbe avere la stessa dimensione di `input_ids`.
+
+```py
+>>> language_id = tokenizer.lang2id["en"] # 0
+>>> langs = torch.tensor([language_id] * input_ids.shape[1]) # torch.tensor([0, 0, 0, ..., 0])
+
+>>> # We reshape it to be of size (batch_size, sequence_length)
+>>> langs = langs.view(1, -1) # is now of shape [1, sequence_length] (we have a batch size of 1)
+```
+
+Adesso puoi inserire `input_ids` e language embedding nel modello:
+
+```py
+>>> outputs = model(input_ids, langs=langs)
+```
+
+Lo script [run_generation.py](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation/run_generation.py) puรฒ generare testo tramite i language embeddings usando i checkpoints `xlm-clm`.
+
+### XLM senza language embeddings
+
+I seguenti modelli XLM non richiedono l'utilizzo dei language embeddings per fare inferenza:
+
+- `FacebookAI/xlm-mlm-17-1280` (Modellazione mascherata del linguaggio, 17 lingue)
+- `FacebookAI/xlm-mlm-100-1280` (Modellazione mascherata del linguaggio, 100 lingue)
+
+Questi modelli sono utilizzati per rappresentazioni generiche di frasi, a differenza dei precedenti checkpoints XML.
+
+## BERT
+
+Il seguente modello BERT puรฒ essere usato per compiti multilingue:
+
+- `google-bert/bert-base-multilingual-uncased` (Modellazione mascherata del linguaggio + Previsione della prossima frase, 102 lingue)
+- `google-bert/bert-base-multilingual-cased` (Modellazione mascherata del linguaggio + Previsione della prossima frase, 104 lingue)
+
+Questi modelli non richiedono language embeddings per fare inferenza. Riescono ad identificare il linguaggio dal contesto e inferire di conseguenza.
+
+## XLM-RoBERTa
+
+Il seguente modello XLM-RoBERTa puรฒ essere usato per compiti multilingue:
+
+- `FacebookAI/xlm-roberta-base` (Modellazione mascherata del linguaggio, 100 lingue)
+- `FacebookAI/xlm-roberta-large` (Modellazione mascherata del linguaggio, 100 lingue)
+
+XLM-RoBERTa รจ stato addestrato su 2.5TB di dati CommonCrawl appena creati e puliti in 100 lingue. Offre notevoli vantaggi rispetto ai modelli multilingue rilasciati in precedenza, come mBERT o XLM, in compiti come la classificazione, l'etichettatura delle sequenze e la risposta alle domande.
+
+## M2M100
+
+Il seguente modello M2M100 puรฒ essere usato per compiti multilingue:
+
+- `facebook/m2m100_418M` (Traduzione)
+- `facebook/m2m100_1.2B` (Traduzione)
+
+In questo esempio, carica il checkpoint `facebook/m2m100_418M` per tradurre dal cinese all'inglese. Puoi impostare la lingua di partenza nel tokenizer:
+
+```py
+>>> from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> chinese_text = "ไธ่ฆๆๆๅทซๅธซ็ไบๅ, ๅ ็บไปๅๆฏๅพฎๅฆ็, ๅพๅฟซๅฐฑๆ็ผๆ."
+
+>>> tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M", src_lang="zh")
+>>> model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
+```
+
+Applica il tokenizer al testo:
+
+```py
+>>> encoded_zh = tokenizer(chinese_text, return_tensors="pt")
+```
+
+M2M100 forza l'id della lingua obiettivo come primo token generato per tradurre nella lingua obiettivo. Imposta il parametro `forced_bos_token_id` a `en` nel metodo `generate` per tradurre in inglese:
+
+```py
+>>> generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id("en"))
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+'Do not interfere with the matters of the witches, because they are delicate and will soon be angry.'
+```
+
+## MBart
+
+Il seguente modello MBart puรฒ essere usato per compiti multilingue:
+
+- `facebook/mbart-large-50-one-to-many-mmt` (Traduzione automatica multilingue uno-a-molti, 50 lingue)
+- `facebook/mbart-large-50-many-to-many-mmt` (Traduzione automatica multilingue molti-a-molti, 50 lingue)
+- `facebook/mbart-large-50-many-to-one-mmt` (Traduzione automatica multilingue molti-a-uno, 50 lingue)
+- `facebook/mbart-large-50` (Traduzione multilingue, 50 lingue)
+- `facebook/mbart-large-cc25`
+
+In questo esempio, carica il checkpoint `facebook/mbart-large-50-many-to-many-mmt` per tradurre dal finlandese all'inglese. Puoi impostare la lingua di partenza nel tokenizer:
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> fi_text = "รlรค sekaannu velhojen asioihin, sillรค ne ovat hienovaraisia ja nopeasti vihaisia."
+
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/mbart-large-50-many-to-many-mmt", src_lang="fi_FI")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
+```
+
+Applica il tokenizer sul testo:
+
+```py
+>>> encoded_en = tokenizer(en_text, return_tensors="pt")
+```
+
+MBart forza l'id della lingua obiettivo come primo token generato per tradurre nella lingua obiettivo. Imposta il parametro `forced_bos_token_id` a `en` nel metodo `generate` per tradurre in inglese:
+
+```py
+>>> generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id("en_XX"))
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+"Don't interfere with the wizard's affairs, because they are subtle, will soon get angry."
+```
+
+Se stai usando il checkpoint `facebook/mbart-large-50-many-to-one-mmt`, non hai bisogno di forzare l'id della lingua obiettivo come primo token generato altrimenti l'uso รจ lo stesso.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_hardware.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_hardware.md
new file mode 100644
index 0000000000000000000000000000000000000000..946dcb3238d057def0a73a86e7f483610effafa4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_hardware.md
@@ -0,0 +1,155 @@
+
+
+
+# Hardware ottimizzato per l'addestramento
+
+L'hardware utilizzato per eseguire l'addestramento del modello e l'inferenza puรฒ avere un grande effetto sulle prestazioni. Per un analisi approfondita delle GPUs, assicurati di dare un'occhiata all'eccellente [blog post](https://timdettmers.com/2020/09/07/which-gpu-for-deep-learning/) di Tim Dettmer.
+
+Diamo un'occhiata ad alcuni consigli pratici per la configurazione della GPU.
+
+## GPU
+Quando si addestrano modelli piรน grandi ci sono essenzialmente tre opzioni:
+- GPUs piu' grandi
+- Piu' GPUs
+- Piu' CPU e piu' NVMe (scaricato da [DeepSpeed-Infinity](main_classes/deepspeed#nvme-support))
+
+Iniziamo dal caso in cui ci sia una singola GPU.
+
+### Potenza e Raffreddamento
+
+Se hai acquistato una costosa GPU di fascia alta, assicurati di darle la potenza corretta e un raffreddamento sufficiente.
+
+**Potenza**:
+
+Alcune schede GPU consumer di fascia alta hanno 2 e talvolta 3 prese di alimentazione PCI-E a 8 pin. Assicurati di avere tanti cavi PCI-E a 8 pin indipendenti da 12 V collegati alla scheda quante sono le prese. Non utilizzare le 2 fessure a un'estremitร dello stesso cavo (noto anche come cavo a spirale). Cioรจ se hai 2 prese sulla GPU, vuoi 2 cavi PCI-E a 8 pin che vanno dall'alimentatore alla scheda e non uno che abbia 2 connettori PCI-E a 8 pin alla fine! In caso contrario, non otterrai tutte le prestazioni ufficiali.
+
+Ciascun cavo di alimentazione PCI-E a 8 pin deve essere collegato a una guida da 12 V sul lato dell'alimentatore e puรฒ fornire fino a 150 W di potenza.
+
+Alcune altre schede possono utilizzare connettori PCI-E a 12 pin e questi possono fornire fino a 500-600 W di potenza.
+
+Le schede di fascia bassa possono utilizzare connettori a 6 pin, che forniscono fino a 75 W di potenza.
+
+Inoltre vuoi un alimentatore (PSU) di fascia alta che abbia una tensione stabile. Alcuni PSU di qualitร inferiore potrebbero non fornire alla scheda la tensione stabile di cui ha bisogno per funzionare al massimo.
+
+E ovviamente l'alimentatore deve avere abbastanza Watt inutilizzati per alimentare la scheda.
+
+**Raffreddamento**:
+
+Quando una GPU si surriscalda, inizierร a rallentare e non fornirร le prestazioni mssimali e potrebbe persino spegnersi se diventasse troppo calda.
+
+ร difficile dire l'esatta temperatura migliore a cui aspirare quando una GPU รจ molto caricata, ma probabilmente qualsiasi cosa al di sotto di +80ยฐC va bene, ma piรน bassa รจ meglio - forse 70-75ยฐC รจ un intervallo eccellente in cui trovarsi. ร probabile che il rallentamento inizi a circa 84-90ยฐC. Ma oltre alla limitazione delle prestazioni, una temperatura molto elevata prolungata รจ probabile che riduca la durata di una GPU.
+
+Diamo quindi un'occhiata a uno degli aspetti piรน importanti quando si hanno piรน GPU: la connettivitร .
+
+### Connettivitร multi-GPU
+
+Se utilizzi piรน GPU, il modo in cui le schede sono interconnesse puรฒ avere un enorme impatto sul tempo totale di allenamento. Se le GPU si trovano sullo stesso nodo fisico, puoi eseguire:
+
+```bash
+nvidia-smi topo -m
+```
+
+e ti dirร come sono interconnesse le GPU. Su una macchina con doppia GPU e collegata a NVLink, molto probabilmente vedrai qualcosa del tipo:
+
+```
+ GPU0 GPU1 CPU Affinity NUMA Affinity
+GPU0 X NV2 0-23 N/A
+GPU1 NV2 X 0-23 N/A
+```
+
+su una macchina diversa senza NVLink potremmo vedere:
+
+```
+ GPU0 GPU1 CPU Affinity NUMA Affinity
+GPU0 X PHB 0-11 N/A
+GPU1 PHB X 0-11 N/A
+```
+
+Il rapporto include questa legenda:
+
+```
+ X = Self
+ SYS = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
+ NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
+ PHB = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
+ PXB = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
+ PIX = Connection traversing at most a single PCIe bridge
+ NV# = Connection traversing a bonded set of # NVLinks
+```
+
+Quindi il primo rapporto `NV2` ci dice che le GPU sono interconnesse con 2 NVLinks e nel secondo report `PHB` abbiamo una tipica configurazione PCIe+Bridge a livello di consumatore.
+
+Controlla che tipo di connettivitร hai sulla tua configurazione. Alcuni di questi renderanno la comunicazione tra le carte piรน veloce (es. NVLink), altri piรน lenta (es. PHB).
+
+A seconda del tipo di soluzione di scalabilitร utilizzata, la velocitร di connettivitร potrebbe avere un impatto maggiore o minore. Se le GPU devono sincronizzarsi raramente, come in DDP, l'impatto di una connessione piรน lenta sarร meno significativo. Se le GPU devono scambiarsi messaggi spesso, come in ZeRO-DP, una connettivitร piรน veloce diventa estremamente importante per ottenere un addestramento piรน veloce.
+
+#### NVlink
+
+[NVLink](https://en.wikipedia.org/wiki/NVLink) รจ un collegamento di comunicazione a corto raggio multilinea seriale basato su cavo sviluppato da Nvidia.
+
+Ogni nuova generazione fornisce una larghezza di banda piรน veloce, ad es. ecco una citazione da [Nvidia Ampere GA102 GPU Architecture](https://www.nvidia.com/content/dam/en-zz/Solutions/geforce/ampere/pdf/NVIDIA-ampere-GA102-GPU-Architecture-Whitepaper-V1.pdf):
+
+> Third-Generation NVLinkยฎ
+> GA102 GPUs utilize NVIDIAโs third-generation NVLink interface, which includes four x4 links,
+> with each link providing 14.0625 GB/sec bandwidth in each direction between two GPUs. Four
+> links provide 56.25 GB/sec bandwidth in each direction, and 112.5 GB/sec total bandwidth
+> between two GPUs. Two RTX 3090 GPUs can be connected together for SLI using NVLink.
+> (Note that 3-Way and 4-Way SLI configurations are not supported.)
+
+Quindi piรน `X` si ottiene nel rapporto di `NVX` nell'output di `nvidia-smi topo -m`, meglio รจ. La generazione dipenderร dall'architettura della tua GPU.
+
+Confrontiamo l'esecuzione di un training del modello di linguaggio openai-community/gpt2 su un piccolo campione di wikitext
+
+I risultati sono:
+
+
+| NVlink | Time |
+| ----- | ---: |
+| Y | 101s |
+| N | 131s |
+
+
+Puoi vedere che NVLink completa l'addestramento circa il 23% piรน velocemente. Nel secondo benchmark utilizziamo `NCCL_P2P_DISABLE=1` per dire alle GPU di non utilizzare NVLink.
+
+Ecco il codice benchmark completo e gli output:
+
+```bash
+# DDP w/ NVLink
+
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 torchrun \
+--nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py --model_name_or_path openai-community/gpt2 \
+--dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 --do_train \
+--output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 101.9003, 'train_samples_per_second': 1.963, 'epoch': 0.69}
+
+# DDP w/o NVLink
+
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 NCCL_P2P_DISABLE=1 torchrun \
+--nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py --model_name_or_path openai-community/gpt2 \
+--dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 --do_train
+--output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 131.4367, 'train_samples_per_second': 1.522, 'epoch': 0.69}
+```
+
+Hardware: 2x TITAN RTX 24GB each + NVlink with 2 NVLinks (`NV2` in `nvidia-smi topo -m`)
+Software: `pytorch-1.8-to-be` + `cuda-11.0` / `transformers==4.3.0.dev0`
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_cpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_cpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..baae51a5a97897fdb28e9a321862e9617f6cc8e1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_cpu.md
@@ -0,0 +1,79 @@
+
+
+# Inferenza Efficiente su CPU
+
+Questa guida si concentra sull'inferenza di modelli di grandi dimensioni in modo efficiente sulla CPU.
+
+## `BetterTransformer` per inferenza piรน rapida
+
+Abbiamo integrato di recente `BetterTransformer` per fare inferenza piรน rapidamente con modelli per testi, immagini e audio. Visualizza la documentazione sull'integrazione [qui](https://huggingface.co/docs/optimum/bettertransformer/overview) per maggiori dettagli.
+
+## PyTorch JIT-mode (TorchScript)
+
+TorchScript รจ un modo di creare modelli serializzabili e ottimizzabili da codice PyTorch. Ogni programmma TorchScript puรฒ esere salvato da un processo Python e caricato in un processo dove non ci sono dipendenze Python.
+Comparandolo con l'eager mode di default, jit mode in PyTorch normalmente fornisce prestazioni migliori per l'inferenza del modello da parte di metodologie di ottimizzazione come la operator fusion.
+
+Per una prima introduzione a TorchScript, vedi la Introduction to [PyTorch TorchScript tutorial](https://pytorch.org/tutorials/beginner/Intro_to_TorchScript_tutorial.html#tracing-modules).
+
+### IPEX Graph Optimization con JIT-mode
+
+Intelยฎ Extension per PyTorch fornnisce ulteriori ottimizzazioni in jit mode per i modelli della serie Transformers. Consigliamo vivamente agli utenti di usufruire dei vantaggi di Intelยฎ Extension per PyTorch con jit mode. Alcuni operator patterns usati fequentemente dai modelli Transformers models sono giร supportati in Intelยฎ Extension per PyTorch con jit mode fusions. Questi fusion patterns come Multi-head-attention fusion, Concat Linear, Linear+Add, Linear+Gelu, Add+LayerNorm fusion and etc. sono abilitati e hanno buone performance. I benefici della fusion รจ fornito agli utenti in modo trasparente. In base alle analisi, il ~70% dei problemi piรน popolari in NLP question-answering, text-classification, and token-classification possono avere benefici sulle performance grazie ai fusion patterns sia per Float32 precision che per BFloat16 Mixed precision.
+
+Vedi maggiori informazioni per [IPEX Graph Optimization](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/graph_optimization.html).
+
+#### Installazione di IPEX
+
+I rilasci di IPEX seguono PyTorch, verifica i vari approcci per [IPEX installation](https://intel.github.io/intel-extension-for-pytorch/).
+
+### Utilizzo del JIT-mode
+
+Per abilitare JIT-mode in Trainer per evaluation e prediction, devi aggiungere `jit_mode_eval` negli argomenti di Trainer.
+
+
+
+per PyTorch >= 1.14.0. JIT-mode potrebe giovare a qualsiasi modello di prediction e evaluaion visto che il dict input รจ supportato in jit.trace
+
+per PyTorch < 1.14.0. JIT-mode potrebbe giovare ai modelli il cui ordine dei parametri corrisponde all'ordine delle tuple in ingresso in jit.trace, come i modelli per question-answering.
+Nel caso in cui l'ordine dei parametri seguenti non corrisponda all'ordine delle tuple in ingresso in jit.trace, come nei modelli di text-classification, jit.trace fallirร e lo cattureremo con una eccezione al fine di renderlo un fallback. Il logging รจ usato per notificare gli utenti.
+
+
+
+Trovi un esempo con caso d'uso in [Transformers question-answering](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)
+
+- Inference using jit mode on CPU:
+
+python run_qa.py \
+--model_name_or_path csarron/bert-base-uncased-squad-v1 \
+--dataset_name squad \
+--do_eval \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/ \
+--no_cuda \
+--jit_mode_eval
+
+- Inference with IPEX using jit mode on CPU:
+
+python run_qa.py \
+--model_name_or_path csarron/bert-base-uncased-squad-v1 \
+--dataset_name squad \
+--do_eval \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/ \
+--no_cuda \
+--use_ipex \
+--jit_mode_eval
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_gpu_many.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_gpu_many.md
new file mode 100644
index 0000000000000000000000000000000000000000..b78cb34e1d6d813f28a41f98a367f5574cab547b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_gpu_many.md
@@ -0,0 +1,28 @@
+
+
+# Inferenza Efficiente su GPU Multiple
+
+Questo documento contiene informazioni su come fare inferenza in maniera efficiente su GPU multiple.
+
+
+
+Nota: Un setup con GPU multiple puรฒ utilizzare la maggior parte delle strategie descritte nella [sezione con GPU singola](./perf_infer_gpu_one). Tuttavia, รจ necessario conoscere delle tecniche semplici che possono essere utilizzate per un risultato migliore.
+
+
+
+## `BetterTransformer` per inferenza piรน rapida
+
+Abbiamo recentemente integrato `BetterTransformer` per inferenza piรน rapida su multi-GPU per modelli su testo, immagini e audio. Controlla il documento con queste integrazioni [qui](https://huggingface.co/docs/optimum/bettertransformer/overview) per maggiori dettagli.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_gpu_one.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_gpu_one.md
new file mode 100644
index 0000000000000000000000000000000000000000..e618ec34a1bd06a683b6db1a62c11fb563486ffe
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_gpu_one.md
@@ -0,0 +1,112 @@
+
+
+# Inferenza efficiente su GPU singola
+
+Questo documento sarร presto completato con informazioni su come effetture l'inferenza su una singola GPU. Nel frattempo รจ possibile consultare [la guida per l'addestramento su una singola GPU](perf_train_gpu_one) e [la guida per l'inferenza su CPU](perf_infer_cpu).
+
+## `BetterTransformer` per l'inferenza piรน veloce
+
+Abbiamo recentemente integrato `BetterTransformer` per velocizzare l'inferenza su GPU per modelli di testo, immagini e audio. Per maggiori dettagli, consultare la documentazione su questa integrazione [qui](https://huggingface.co/docs/optimum/bettertransformer/overview).
+
+## Integrazione di `bitsandbytes` per Int8 mixed-precision matrix decomposition
+
+
+
+Nota che questa funzione puรฒ essere utilizzata anche nelle configurazioni multi GPU.
+
+
+
+Dal paper [`LLM.int8() : 8-bit Matrix Multiplication for Transformers at Scale`](https://arxiv.org/abs/2208.07339), noi supportiamo l'integrazione di Hugging Face per tutti i modelli dell'Hub con poche righe di codice.
+Il metodo `nn.Linear` riduce la dimensione di 2 per i pesi `float16` e `bfloat16` e di 4 per i pesi `float32`, con un impatto quasi nullo sulla qualitร , operando sugli outlier in half-precision.
+
+
+
+Il metodo Int8 mixed-precision matrix decomposition funziona separando la moltiplicazione tra matrici in due flussi: (1) una matrice di flusso di outlier di caratteristiche sistematiche moltiplicata in fp16, (2) in flusso regolare di moltiplicazione di matrici int8 (99,9%). Con questo metodo, รจ possibile effettutare inferenza int8 per modelli molto grandi senza degrado predittivo.
+Per maggiori dettagli sul metodo, consultare il [paper](https://arxiv.org/abs/2208.07339) o il nostro [blogpost sull'integrazione](https://huggingface.co/blog/hf-bitsandbytes-integration).
+
+
+
+Nota che รจ necessaria una GPU per eseguire modelli di tipo mixed-8bit, poichรฉ i kernel sono stati compilati solo per le GPU. Prima di utilizzare questa funzione, assicurarsi di disporre di memoria sufficiente sulla GPU per memorizzare un quarto del modello (o la metร se i pesi del modello sono in mezza precisione).
+Di seguito sono riportate alcune note per aiutarvi a utilizzare questo modulo, oppure seguite le dimostrazioni su [Google colab](#colab-demos).
+
+### Requisiti
+
+- Se si dispone di `bitsandbytes<0.37.0`, assicurarsi di eseguire su GPU NVIDIA che supportano tensor cores a 8 bit (Turing, Ampere o architetture piรน recenti - ad esempio T4, RTX20s RTX30s, A40-A100). Per `bitsandbytes>=0.37.0`, tutte le GPU dovrebbero essere supportate.
+- Installare la versione corretta di `bitsandbytes` eseguendo:
+`pip install bitsandbytes>=0.31.5`.
+- Installare `accelerate`
+`pip install accelerate>=0.12.0`
+
+### Esecuzione di modelli mixed-Int8 - configurazione per singola GPU
+
+Dopo aver installato le librerie necessarie, per caricare il tuo modello mixed 8-bit รจ il seguente:
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+model_name = "bigscience/bloom-2b5"
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+
+Per la generazione di testo, si consiglia di:
+
+* utilizzare il metodo `generate()` del modello invece della funzione `pipeline()`. Sebbene l'inferenza sia possibile con la funzione `pipeline()`, essa non รจ ottimizzata per i modelli mixed-8bit e sarร piรน lenta rispetto all'uso del metodo `generate()`. Inoltre, alcune strategie di campionamento, come il campionamento nucleaus, non sono supportate dalla funzione `pipeline()` per i modelli mixed-8bit.
+* collocare tutti gli ingressi sullo stesso dispositivo del modello.
+
+Ecco un semplice esempio:
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model_name = "bigscience/bloom-2b5"
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+
+text = "Hello, my llama is cute"
+inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
+generated_ids = model.generate(**inputs)
+outputs = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
+```
+
+
+### Esecuzione di modelli mixed-8bit - configurazione multi GPU
+
+Usare il seguente modo caricare il modello mixed-8bit su piรน GPU (stesso comando della configurazione a GPU singola):
+```py
+model_name = "bigscience/bloom-2b5"
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+Puoi controllare la RAM della GPU che si vuole allocare su ogni GPU usando `accelerate`. Utilizzare l'argomento `max_memory` come segue:
+
+```py
+max_memory_mapping = {0: "1GB", 1: "2GB"}
+model_name = "bigscience/bloom-3b"
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ model_name, device_map="auto", load_in_8bit=True, max_memory=max_memory_mapping
+)
+```
+In questo esempio, la prima GPU utilizzerร 1 GB di memoria e la seconda 2 GB.
+
+### Colab demos
+
+Con questo metodo รจ possibile inferire modelli che prima non era possibile inferire su Google Colab.
+Guardate la demo per l'esecuzione di T5-11b (42GB in fp32)! Utilizzo la quantizzazione a 8 bit su Google Colab:
+
+[](https://colab.research.google.com/drive/1YORPWx4okIHXnjW7MSAidXN29mPVNT7F?usp=sharing)
+
+Oppure questa demo di BLOOM-3B:
+
+[](https://colab.research.google.com/drive/1qOjXfQIAULfKvZqwCen8-MoWKGdSatZ4?usp=sharing)
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_special.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_special.md
new file mode 100644
index 0000000000000000000000000000000000000000..3e2c0a5c288e379f4aa029bc2cbf6d3d72ea260f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_infer_special.md
@@ -0,0 +1,18 @@
+
+
+# Inferenza su Hardware Specializzato
+
+Questo documento sarร completato a breve con la documentazione per l'inferenza su hardware specializzato. Nel frattempo puoi controllare [la guida per fare inferenza sulle CPU](perf_infer_cpu).
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_cpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_cpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..ff71d10d5c9d6c1fdbc0ddeecc4126a35558cf54
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_cpu.md
@@ -0,0 +1,69 @@
+
+
+# Addestramento efficiente su CPU
+
+Questa guida si concentra su come addestrare in maniera efficiente grandi modelli su CPU.
+
+## Mixed precision con IPEX
+
+IPEX รจ ottimizzato per CPU con AVX-512 o superiore, e funziona per le CPU con solo AVX2. Pertanto, si prevede che le prestazioni saranno piรน vantaggiose per le le CPU Intel con AVX-512 o superiori, mentre le CPU con solo AVX2 (ad esempio, le CPU AMD o le CPU Intel piรน vecchie) potrebbero ottenere prestazioni migliori con IPEX, ma non sono garantite. IPEX offre ottimizzazioni delle prestazioni per l'addestramento della CPU sia con Float32 che con BFloat16. L'uso di BFloat16 รจ l'argomento principale delle seguenti sezioni.
+
+Il tipo di dati a bassa precisione BFloat16 รจ stato supportato in modo nativo su 3rd Generation Xeonยฎ Scalable Processors (aka Cooper Lake) con AVX512 e sarร supportata dalla prossima generazione di Intelยฎ Xeonยฎ Scalable Processors con Intelยฎ Advanced Matrix Extensions (Intelยฎ AMX) instruction set con prestazioni ulteriormente migliorate. L'Auto Mixed Precision per il backende della CPU รจ stato abilitato da PyTorch-1.10. allo stesso tempo, il supporto di Auto Mixed Precision con BFloat16 per CPU e l'ottimizzazione degli operatori BFloat16 รจ stata abilitata in modo massiccio in Intelยฎ Extension per PyTorch, and parzialmente aggiornato al branch master di PyTorch. Gli utenti possono ottenere prestazioni migliori ed users experience con IPEX Auto Mixed Precision..
+
+Vedi informazioni piรน dettagliate su [Auto Mixed Precision](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/amp.html).
+
+### Installazione di IPEX:
+
+Il rilascio di IPEX segue quello di PyTorch, da installare via pip:
+
+| PyTorch Version | IPEX version |
+| :---------------: | :----------: |
+| 1.13 | 1.13.0+cpu |
+| 1.12 | 1.12.300+cpu |
+| 1.11 | 1.11.200+cpu |
+| 1.10 | 1.10.100+cpu |
+
+```bash
+pip install intel_extension_for_pytorch== -f https://developer.intel.com/ipex-whl-stable-cpu
+```
+
+Vedi altri approcci per [IPEX installation](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/installation.html).
+
+### Utilizzo nel Trainer
+
+Per abilitare la auto mixed precision con IPEX in Trainer, l'utende dovrebbe aggiungere `use_ipex`, `bf16` e `no_cuda` negli argomenti del comando di addestramento.
+
+Vedi un sempio di un caso d'uso [Transformers question-answering](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)
+
+- Training with IPEX using BF16 auto mixed precision on CPU:
+
+ python run_qa.py \
+--model_name_or_path google-bert/bert-base-uncased \
+--dataset_name squad \
+--do_train \
+--do_eval \
+--per_device_train_batch_size 12 \
+--learning_rate 3e-5 \
+--num_train_epochs 2 \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/debug_squad/ \
+--use_ipex \
+--bf16 --no_cuda
+
+### Esempi pratici
+
+Blog: [Accelerating PyTorch Transformers with Intel Sapphire Rapids](https://huggingface.co/blog/intel-sapphire-rapids)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_cpu_many.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_cpu_many.md
new file mode 100644
index 0000000000000000000000000000000000000000..c1f8833829ac3bc0df0481f4a64c6102538d27dd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_cpu_many.md
@@ -0,0 +1,141 @@
+
+
+# Addestramento effciente su multiple CPU
+
+Quando l'addestramento su una singola CPU รจ troppo lento, possiamo usare CPU multiple. Quasta guida si concentra su DDP basato su PyTorch abilitando l'addetramento distribuito su CPU in maniera efficiente.
+
+## Intelยฎ oneCCL Bindings per PyTorch
+
+[Intelยฎ oneCCL](https://github.com/oneapi-src/oneCCL) (collective communications library) รจ una libreria per l'addestramento efficiente del deep learning in distribuito e implementa collettivi come allreduce, allgather, alltoall. Per maggiori informazioni su oneCCL, fai riferimento a [oneCCL documentation](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html) e [oneCCL specification](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html).
+
+Il modulo `oneccl_bindings_for_pytorch` (`torch_ccl` precedentemente alla versione 1.12) implementa PyTorch C10D ProcessGroup API e puรฒ essere caricato dinamicamente com external ProcessGroup e funziona solo su piattaforma Linux al momento.
+
+Qui trovi informazioni piรน dettagliate per [oneccl_bind_pt](https://github.com/intel/torch-ccl).
+
+### Intelยฎ oneCCL Bindings per l'installazione PyTorch:
+
+I file wheel sono disponibili per le seguenti versioni di Python:
+
+| Extension Version | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 | Python 3.10 |
+| :---------------: | :--------: | :--------: | :--------: | :--------: | :---------: |
+| 1.13.0 | | โ | โ | โ | โ |
+| 1.12.100 | | โ | โ | โ | โ |
+| 1.12.0 | | โ | โ | โ | โ |
+| 1.11.0 | | โ | โ | โ | โ |
+| 1.10.0 | โ | โ | โ | โ | |
+
+```bash
+pip install oneccl_bind_pt=={pytorch_version} -f https://developer.intel.com/ipex-whl-stable-cpu
+```
+
+dove `{pytorch_version}` deve essere la tua versione di PyTorch, per l'stanza 1.13.0.
+Verifica altri approcci per [oneccl_bind_pt installation](https://github.com/intel/torch-ccl).
+Le versioni di oneCCL e PyTorch devono combaciare.
+
+
+
+oneccl_bindings_for_pytorch 1.12.0 prebuilt wheel does not work with PyTorch 1.12.1 (it is for PyTorch 1.12.0)
+PyTorch 1.12.1 should work with oneccl_bindings_for_pytorch 1.12.100
+
+
+
+## Intelยฎ MPI library
+
+Usa questa implementazione basata su standard MPI per fornire una architettura flessibile, efficiente, scalabile su cluster per Intelยฎ. Questo componente รจ parte di Intelยฎ oneAPI HPC Toolkit.
+
+oneccl_bindings_for_pytorch รจ installato insieme al set di strumenti MPI. Necessitร di reperire l'ambiente prima di utilizzarlo.
+
+per Intelยฎ oneCCL >= 1.12.0
+
+```bash
+oneccl_bindings_for_pytorch_path=$(python -c "from oneccl_bindings_for_pytorch import cwd; print(cwd)")
+source $oneccl_bindings_for_pytorch_path/env/setvars.sh
+```
+
+per Intelยฎ oneCCL con versione < 1.12.0
+
+```bash
+torch_ccl_path=$(python -c "import torch; import torch_ccl; import os; print(os.path.abspath(os.path.dirname(torch_ccl.__file__)))")
+source $torch_ccl_path/env/setvars.sh
+```
+
+#### Installazione IPEX:
+
+IPEX fornisce ottimizzazioni delle prestazioni per l'addestramento della CPU sia con Float32 che con BFloat16; puoi fare riferimento a [single CPU section](./perf_train_cpu).
+
+Il seguente "Utilizzo in Trainer" prende come esempio mpirun nella libreria Intelยฎ MPI.
+
+## Utilizzo in Trainer
+
+Per abilitare l'addestramento distribuito multi CPU nel Trainer con il ccl backend, gli utenti devono aggiungere **`--ddp_backend ccl`** negli argomenti del comando.
+
+Vediamo un esempio per il [question-answering example](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)
+
+Il seguente comando abilita due processi sul nodo Xeon, con un processo in esecuzione per ogni socket. Le variabili OMP_NUM_THREADS/CCL_WORKER_COUNT possono essere impostate per una prestazione ottimale.
+
+```shell script
+ export CCL_WORKER_COUNT=1
+ export MASTER_ADDR=127.0.0.1
+ mpirun -n 2 -genv OMP_NUM_THREADS=23 \
+ python3 run_qa.py \
+ --model_name_or_path google-bert/bert-large-uncased \
+ --dataset_name squad \
+ --do_train \
+ --do_eval \
+ --per_device_train_batch_size 12 \
+ --learning_rate 3e-5 \
+ --num_train_epochs 2 \
+ --max_seq_length 384 \
+ --doc_stride 128 \
+ --output_dir /tmp/debug_squad/ \
+ --no_cuda \
+ --ddp_backend ccl \
+ --use_ipex
+```
+
+Il seguente comando abilita l'addestramento per un totale di quattro processi su due Xeon (node0 e node1, prendendo node0 come processo principale), ppn (processes per node) รจ impostato a 2, on un processo in esecuzione per ogni socket. Le variabili OMP_NUM_THREADS/CCL_WORKER_COUNT possono essere impostate per una prestazione ottimale.
+
+In node0, รจ necessario creare un file di configurazione che contenga gli indirizzi IP di ciascun nodo (per esempio hostfile) e passare il percorso del file di configurazione come parametro.
+
+```shell script
+ cat hostfile
+ xxx.xxx.xxx.xxx #node0 ip
+ xxx.xxx.xxx.xxx #node1 ip
+```
+
+A questo punto, esegui il seguente comando nel nodo0 e **4DDP** sarร abilitato in node0 e node1 con BF16 auto mixed precision:
+
+```shell script
+ export CCL_WORKER_COUNT=1
+ export MASTER_ADDR=xxx.xxx.xxx.xxx #node0 ip
+ mpirun -f hostfile -n 4 -ppn 2 \
+ -genv OMP_NUM_THREADS=23 \
+ python3 run_qa.py \
+ --model_name_or_path google-bert/bert-large-uncased \
+ --dataset_name squad \
+ --do_train \
+ --do_eval \
+ --per_device_train_batch_size 12 \
+ --learning_rate 3e-5 \
+ --num_train_epochs 2 \
+ --max_seq_length 384 \
+ --doc_stride 128 \
+ --output_dir /tmp/debug_squad/ \
+ --no_cuda \
+ --ddp_backend ccl \
+ --use_ipex \
+ --bf16
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_special.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_special.md
new file mode 100644
index 0000000000000000000000000000000000000000..afe05d801d66e3cfd731964335aedd33a6cb79b8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_special.md
@@ -0,0 +1,24 @@
+
+
+# Addestramento su Hardware Specializzato
+
+
+
+ Nota: Molte delle strategie introdotte nella [sezione sulla GPU singola](perf_train_gpu_one) (come mixed precision training o gradient accumulation) e [sezione multi-GPU](perf_train_gpu_many) sono generiche e applicabili all'addestramento di modelli in generale quindi assicurati di dargli un'occhiata prima di immergerti in questa sezione.
+
+
+
+Questo documento sarร presto completato con informazioni su come effettuare la formazione su hardware specializzato.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_tpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_tpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..663f83c499cba41e8910916b861380cc9072daae
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/perf_train_tpu.md
@@ -0,0 +1,24 @@
+
+
+# Addestramento su TPU
+
+
+
+ Nota: Molte delle strategie introdotte nella [sezione sulla GPU singola](perf_train_gpu_one) (come mixed precision training o gradient accumulation) e [sezione multi-GPU](perf_train_gpu_many) sono generiche e applicabili all'addestramento di modelli in generale quindi assicurati di dargli un'occhiata prima di immergerti in questa sezione.
+
+
+
+Questo documento sarร presto completato con informazioni su come effettuare la formazione su TPU.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/pipeline_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/pipeline_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..87f3166623b05a31beecbae1893dc5bc6d12192a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/pipeline_tutorial.md
@@ -0,0 +1,152 @@
+
+
+# Pipeline per l'inferenza
+
+La [`pipeline`] rende semplice usare qualsiasi modello dal [Model Hub](https://huggingface.co/models) per fare inferenza su diversi compiti come generazione del testo, segmentazione di immagini e classificazione di audio. Anche se non hai esperienza con una modalitร specifica o non comprendi bene il codice che alimenta i modelli, รจ comunque possibile utilizzarli con l'opzione [`pipeline`]! Questa esercitazione ti insegnerร a:
+
+* Usare una [`pipeline`] per fare inferenza.
+* Usare uno specifico tokenizer o modello.
+* Usare una [`pipeline`] per compiti che riguardano audio e video.
+
+
+
+Dai un'occhiata alla documentazione di [`pipeline`] per una lista completa dei compiti supportati.
+
+
+
+## Utilizzo della Pipeline
+
+Nonostante ogni compito abbia una [`pipeline`] associata, รจ piรน semplice utilizzare l'astrazione generica della [`pipeline`] che contiene tutte quelle specifiche per ogni mansione. La [`pipeline`] carica automaticamente un modello predefinito e un tokenizer in grado di fare inferenza per il tuo compito.
+
+1. Inizia creando una [`pipeline`] e specificando il compito su cui fare inferenza:
+
+```py
+>>> from transformers import pipeline
+
+>>> generator = pipeline(task="text-generation")
+```
+
+2. Inserisci il testo in input nella [`pipeline`]:
+
+```py
+>>> generator(
+... "Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone"
+... ) # doctest: +SKIP
+[{'generated_text': 'Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Seven for the Iron-priests at the door to the east, and thirteen for the Lord Kings at the end of the mountain'}]
+```
+
+Se hai piรน di un input, inseriscilo in una lista:
+
+```py
+>>> generator(
+... [
+... "Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone",
+... "Nine for Mortal Men, doomed to die, One for the Dark Lord on his dark throne",
+... ]
+... ) # doctest: +SKIP
+```
+
+Qualsiasi parametro addizionale per il tuo compito puรฒ essere incluso nella [`pipeline`]. La mansione `text-generation` ha un metodo [`~generation.GenerationMixin.generate`] con diversi parametri per controllare l'output. Ad esempio, se desideri generare piรน di un output, utilizza il parametro `num_return_sequences`:
+
+```py
+>>> generator(
+... "Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone",
+... num_return_sequences=2,
+... ) # doctest: +SKIP
+```
+
+### Scegliere modello e tokenizer
+
+La [`pipeline`] accetta qualsiasi modello dal [Model Hub](https://huggingface.co/models). Ci sono tag nel Model Hub che consentono di filtrare i modelli per attivitร . Una volta che avrai scelto il modello appropriato, caricalo usando la corrispondente classe `AutoModelFor` e [`AutoTokenizer`]. Ad esempio, carica la classe [`AutoModelForCausalLM`] per un compito di causal language modeling:
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForCausalLM
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilgpt2")
+>>> model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+```
+
+Crea una [`pipeline`] per il tuo compito, specificando il modello e il tokenizer che hai caricato:
+
+```py
+>>> from transformers import pipeline
+
+>>> generator = pipeline(task="text-generation", model=model, tokenizer=tokenizer)
+```
+
+Inserisci il testo di input nella [`pipeline`] per generare del testo:
+
+```py
+>>> generator(
+... "Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone"
+... ) # doctest: +SKIP
+[{'generated_text': 'Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Seven for the Dragon-lords (for them to rule in a world ruled by their rulers, and all who live within the realm'}]
+```
+
+## Audio pipeline
+
+La flessibilitร della [`pipeline`] fa si che possa essere estesa ad attivitร sugli audio.
+
+Per esempio, classifichiamo le emozioni in questo clip audio:
+
+```py
+>>> from datasets import load_dataset
+>>> import torch
+
+>>> torch.manual_seed(42) # doctest: +IGNORE_RESULT
+>>> ds = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation")
+>>> audio_file = ds[0]["audio"]["path"]
+```
+
+Trova un modello per la [classificazione audio](https://huggingface.co/models?pipeline_tag=audio-classification) sul Model Hub per eseguire un compito di riconoscimento automatico delle emozioni e caricalo nella [`pipeline`]:
+
+```py
+>>> from transformers import pipeline
+
+>>> audio_classifier = pipeline(
+... task="audio-classification", model="ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
+... )
+```
+
+Inserisci il file audio nella [`pipeline`]:
+
+```py
+>>> preds = audio_classifier(audio_file)
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.1315, 'label': 'calm'}, {'score': 0.1307, 'label': 'neutral'}, {'score': 0.1274, 'label': 'sad'}, {'score': 0.1261, 'label': 'fearful'}, {'score': 0.1242, 'label': 'happy'}]
+```
+
+## Vision pipeline
+
+Infine, usare la [`pipeline`] per le attivitร sulle immagini รจ praticamente la stessa cosa.
+
+Specifica la tua attivitร e inserisci l'immagine nel classificatore. L'immagine puรฒ essere sia un link che un percorso sul tuo pc in locale. Per esempio, quale specie di gatto รจ raffigurata qui sotto?
+
+
+
+```py
+>>> from transformers import pipeline
+
+>>> vision_classifier = pipeline(task="image-classification")
+>>> preds = vision_classifier(
+... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/pr_checks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/pr_checks.md
new file mode 100644
index 0000000000000000000000000000000000000000..caa5fe32965bde77bb52065d94f5f829a432091f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/pr_checks.md
@@ -0,0 +1,135 @@
+
+
+# Controlli su una Pull Request
+
+Quando apri una pull request sui ๐ค Transformers, vengono eseguiti un discreto numero di controlli per assicurarsi che la patch che stai aggiungendo non stia rompendo qualcosa di esistente. Questi controlli sono di quattro tipi:
+- test regolari
+- costruzione della documentazione
+- stile del codice e della documentazione
+- coerenza generale del repository
+
+In questo documento, cercheremo di spiegare quali sono i vari controlli e le loro ragioni, oltre a spiegare come eseguire il debug locale se uno di essi fallisce sulla tua PR.
+
+Nota che tutti richiedono un'installazione dev:
+
+```bash
+pip install transformers[dev]
+```
+
+o un'installazione modificabile:
+
+```bash
+pip install -e .[dev]
+```
+
+all'interno del repo Transformers.
+
+## Tests
+
+Tutti i job che iniziano con `ci/circleci: run_tests_` eseguono parti della suite di test dei Transformers. Ognuno di questi job si concentra su una parte della libreria in un determinato ambiente: per esempio `ci/circleci: run_tests_pipelines_tf` esegue il test delle pipeline in un ambiente in cui รจ installato solo TensorFlow.
+
+Nota che per evitare di eseguire i test quando non ci sono cambiamenti reali nei moduli che si stanno testando, ogni volta viene eseguita solo una parte della suite di test: viene eseguita una utility per determinare le differenze nella libreria tra prima e dopo la PR (ciรฒ che GitHub mostra nella scheda "Files changes") e sceglie i test che sono stati impattati dalla diff. Questa utility puรฒ essere eseguita localmente con:
+
+```bash
+python utils/tests_fetcher.py
+```
+
+dalla root del repo Transformers. Di seguito ciรฒ che farร :
+
+1. Controlla per ogni file nel diff se le modifiche sono nel codice o solo nei commenti o nelle docstrings. Vengono mantenuti solo i file con modifiche reali al codice.
+2. Costruisce una mappa interna che fornisce per ogni file del codice sorgente della libreria tutti i file su cui ha un impatto ricorsivo. Si dice che il modulo A ha un impatto sul modulo B se il modulo B importa il modulo A. Per l'impatto ricorsivo, abbiamo bisogno di una catena di moduli che va dal modulo A al modulo B in cui ogni modulo importa il precedente.
+3. Applica questa mappa ai file raccolti nel passaggio 1, si ottiene l'elenco dei file del modello interessati dalla PR.
+4. Mappa ciascuno di questi file con i corrispondenti file di test e ottiene l'elenco dei test da eseguire.
+
+Quando esegui lo script in locale, dovresti ottenere la stampa dei risultati dei passi 1, 3 e 4 e quindi sapere quali test sono stati eseguiti. Lo script creerร anche un file chiamato `test_list.txt` che contiene l'elenco dei test da eseguire e che puoi eseguire localmente con il seguente comando:
+
+```bash
+python -m pytest -n 8 --dist=loadfile -rA -s $(cat test_list.txt)
+```
+
+Nel caso in cui qualcosa sia sfuggito, l'intera suite di test viene eseguita quotidianamente.
+
+## Build della documentazione
+
+Il job `ci/circleci: build_doc` esegue una build della documentazione per assicurarsi che tutto sia a posto una volta che la PR รจ stata unita. Se questo passaggio fallisce, puoi controllare localmente entrando nella cartella `docs` del repo Transformers e digitare
+
+```bash
+make html
+```
+
+Sphinx non รจ noto per i suoi messaggi di errore chiari, quindi potrebbe essere necessario che provi alcune cose per trovare davvero la fonte dell'errore.
+
+## Stile del codice e della documentazione
+
+La formattazione del codice viene applicata a tutti i file sorgenti, agli esempi e ai test usando `black` e `isort`. Abbiamo anche uno strumento personalizzato che si occupa della formattazione delle docstring e dei file `rst` (`utils/style_doc.py`), cosรฌ come dell'ordine dei lazy imports eseguiti nei file `__init__.py` dei Transformers (`utils/custom_init_isort.py`). Tutto questo puรฒ essere lanciato eseguendo
+
+```bash
+make style
+```
+
+I controlli della CI sono applicati all'interno del controllo `ci/circleci: check_code_quality`. Esegue anche `flake8`, che dร un'occhiata di base al codice e si lamenta se trova una variabile non definita o non utilizzata. Per eseguire questo controllo localmente, usare
+
+```bash
+make quality
+```
+
+Questa operazione puรฒ richiedere molto tempo, quindi per eseguire la stessa operazione solo sui file modificati nel branch corrente, eseguire
+
+```bash
+make fixup
+```
+
+Quest'ultimo comando eseguirร anche tutti i controlli aggiuntivi per la consistenza del repository. Diamogli un'occhiata.
+
+## Coerenza del repository
+
+All'interno sono raggruppati tutti i test per assicurarsi che la tua PR lasci il repository in un buono stato ed รจ eseguito dal controllo `ci/circleci: check_repository_consistency`. Puoi eseguire localmente questo controllo eseguendo quanto segue:
+
+```bash
+make repo-consistency
+```
+
+Questo verifica che:
+
+- Tutti gli oggetti aggiunti all'init sono documentati (eseguito da `utils/check_repo.py`)
+- Tutti i file `__init__.py` hanno lo stesso contenuto nelle loro due sezioni (eseguito da `utils/check_inits.py`)
+- Tutto il codice identificato come copia da un altro modulo รจ coerente con l'originale (eseguito da `utils/check_copies.py`)
+- Le traduzioni dei README e l'indice della documentazione hanno lo stesso elenco di modelli del README principale (eseguito da `utils/check_copies.py`)
+- Le tabelle autogenerate nella documentazione sono aggiornate (eseguito da `utils/check_table.py`)
+- La libreria ha tutti gli oggetti disponibili anche se non tutte le dipendenze opzionali sono installate (eseguito da `utils/check_dummies.py`)
+
+Se questo controllo fallisce, le prime due voci richiedono una correzione manuale, mentre le ultime quattro possono essere corrette automaticamente per te eseguendo il comando
+
+```bash
+make fix-copies
+```
+
+Ulteriori controlli riguardano le PR che aggiungono nuovi modelli, principalmente che:
+
+- Tutti i modelli aggiunti sono in un Auto-mapping (eseguita da `utils/check_repo.py`)
+
+- Tutti i modelli sono testati correttamente (eseguito da `utils/check_repo.py`)
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/preprocessing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/preprocessing.md
new file mode 100644
index 0000000000000000000000000000000000000000..6d7bc5b2e3df7e05a92f7b806fd470c457be1c03
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/preprocessing.md
@@ -0,0 +1,491 @@
+
+
+# Preprocess
+
+[[open-in-colab]]
+
+Prima di poter usare i dati in un modello, bisogna processarli in un formato accettabile per quest'ultimo. Un modello non comprende il testo grezzo, le immagini o l'audio. Bisogna convertire questi input in numeri e assemblarli all'interno di tensori. In questa esercitazione, tu potrai:
+
+* Preprocessare dati testuali con un tokenizer.
+* Preprocessare immagini o dati audio con un estrattore di caratteristiche.
+* Preprocessare dati per attivitร multimodali mediante un processore.
+
+## NLP
+
+
+
+Lo strumento principale per processare dati testuali รจ un [tokenizer](main_classes/tokenizer). Un tokenizer inizia separando il testo in *tokens* secondo una serie di regole. I tokens sono convertiti in numeri, questi vengono utilizzati per costruire i tensori di input del modello. Anche altri input addizionali se richiesti dal modello vengono aggiunti dal tokenizer.
+
+
+
+Se stai pensando si utilizzare un modello preaddestrato, รจ importante utilizzare il tokenizer preaddestrato associato. Questo assicura che il testo sia separato allo stesso modo che nel corpus usato per l'addestramento, e venga usata la stessa mappatura tokens-to-index (solitamente indicato come il *vocabolario*) come nel preaddestramento.
+
+
+
+Iniziamo subito caricando un tokenizer preaddestrato con la classe [`AutoTokenizer`]. Questo scarica il *vocabolario* usato quando il modello รจ stato preaddestrato.
+
+### Tokenize
+
+Carica un tokenizer preaddestrato con [`AutoTokenizer.from_pretrained`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+```
+
+Poi inserisci le tue frasi nel tokenizer:
+
+```py
+>>> encoded_input = tokenizer("Do not meddle in the affairs of wizards, for they are subtle and quick to anger.")
+>>> print(encoded_input)
+{'input_ids': [101, 2079, 2025, 19960, 10362, 1999, 1996, 3821, 1997, 16657, 1010, 2005, 2027, 2024, 11259, 1998, 4248, 2000, 4963, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+Il tokenizer restituisce un dizionario contenente tre oggetti importanti:
+
+* [input_ids](glossary#input-ids) sono gli indici che corrispondono ad ogni token nella frase.
+* [attention_mask](glossary#attention-mask) indicata se un token deve essere elaborato o no.
+* [token_type_ids](glossary#token-type-ids) identifica a quale sequenza appartiene un token se รจ presente piรน di una sequenza.
+
+Si possono decodificare gli `input_ids` per farsi restituire l'input originale:
+
+```py
+>>> tokenizer.decode(encoded_input["input_ids"])
+'[CLS] Do not meddle in the affairs of wizards, for they are subtle and quick to anger. [SEP]'
+```
+
+Come si puรฒ vedere, il tokenizer aggiunge due token speciali - `CLS` e `SEP` (classificatore e separatore) - alla frase. Non tutti i modelli hanno bisogno dei token speciali, ma se servono, il tokenizer li aggiungerร automaticamente.
+
+Se ci sono piรน frasi che vuoi processare, passale come una lista al tokenizer:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_inputs = tokenizer(batch_sentences)
+>>> print(encoded_inputs)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1]]}
+```
+
+### Pad
+
+Questo รจ un argomento importante. Quando processi un insieme di frasi potrebbero non avere tutte la stessa lunghezza. Questo รจ un problema perchรจ i tensori, in input del modello, devono avere dimensioni uniformi. Il padding รจ una strategia per assicurarsi che i tensori siano rettangolari aggiungendo uno speciale *padding token* alle frasi piรน corte.
+
+Imposta il parametro `padding` a `True` per imbottire le frasi piรน corte nel gruppo in modo che combacino con la massima lunghezza presente:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+Nota che il tokenizer aggiunge alle sequenze degli `0` perchรจ sono troppo corte!
+
+### Truncation
+
+L'altra faccia della medaglia รจ che avolte le sequenze possono essere troppo lunghe per essere gestite dal modello. In questo caso, avrai bisogno di troncare la sequenza per avere una lunghezza minore.
+
+Imposta il parametro `truncation` a `True` per troncare una sequenza alla massima lunghezza accettata dal modello:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+### Costruire i tensori
+
+Infine, vuoi che il tokenizer restituisca i tensori prodotti dal modello.
+
+Imposta il parametro `return_tensors` su `pt` per PyTorch, o `tf` per TensorFlow:
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch, padding=True, truncation=True, return_tensors="pt")
+>>> print(encoded_input)
+{'input_ids': tensor([[ 101, 153, 7719, 21490, 1122, 1114, 9582, 1623, 102],
+ [ 101, 5226, 1122, 9649, 1199, 2610, 1236, 102, 0]]),
+ 'token_type_ids': tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0]]),
+ 'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 1, 0]])}
+===PT-TF-SPLIT===
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch, padding=True, truncation=True, return_tensors="tf")
+>>> print(encoded_input)
+{'input_ids': ,
+ 'token_type_ids': ,
+ 'attention_mask': }
+```
+
+## Audio
+
+Gli input audio sono processati in modo differente rispetto al testo, ma l'obiettivo rimane lo stesso: creare sequenze numeriche che il modello puรฒ capire. Un [estrattore di caratteristiche](main_classes/feature_extractor) รจ progettato con lo scopo preciso di estrarre caratteristiche da immagini o dati audio grezzi e convertirli in tensori. Prima di iniziare, installa ๐ค Datasets per caricare un dataset audio e sperimentare:
+
+```bash
+pip install datasets
+```
+
+Carica il dataset [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) (vedi il ๐ค [Datasets tutorial](https://huggingface.co/docs/datasets/load_hub) per avere maggiori dettagli su come caricare un dataset):
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
+```
+
+Accedi al primo elemento della colonna `audio` per dare uno sguardo all'input. Richiamando la colonna `audio` sarร caricato automaticamente e ricampionato il file audio:
+
+```py
+>>> dataset[0]["audio"]
+{'array': array([ 0. , 0.00024414, -0.00024414, ..., -0.00024414,
+ 0. , 0. ], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~JOINT_ACCOUNT/602ba55abb1e6d0fbce92065.wav',
+ 'sampling_rate': 8000}
+```
+
+Questo restituisce tre oggetti:
+
+* `array` รจ il segnale vocale caricato - e potenzialmente ricampionato - come vettore 1D.
+* `path` il percorso del file audio.
+* `sampling_rate` si riferisce al numero di campioni del segnale vocale misurati al secondo.
+
+### Ricampionamento
+
+Per questo tutorial, puoi usare il modello [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base). Come puoi vedere dalla model card, il modello Wav2Vec2 รจ preaddestrato su un campionamento vocale a 16kHz.ร importante che la frequenza di campionamento dei tuoi dati audio combaci con la frequenza di campionamento del dataset usato per preaddestrare il modello. Se la frequenza di campionamento dei tuoi dati non รจ uguale dovrai ricampionare i tuoi dati audio.
+
+Per esempio, il dataset [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) ha una frequenza di campionamento di 8000kHz. Utilizzando il modello Wav2Vec2 su questo dataset, alzala a 16kHz:
+
+```py
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
+>>> dataset[0]["audio"]
+{'array': array([ 0. , 0.00024414, -0.00024414, ..., -0.00024414,
+ 0. , 0. ], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~JOINT_ACCOUNT/602ba55abb1e6d0fbce92065.wav',
+ 'sampling_rate': 8000}
+```
+
+1. Usa il metodo di ๐ค Datasets' [`cast_column`](https://huggingface.co/docs/datasets/package_reference/main_classes#datasets.Dataset.cast_column) per alzare la frequenza di campionamento a 16kHz:
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+2. Carica il file audio:
+
+```py
+>>> dataset[0]["audio"]
+{'array': array([ 2.3443763e-05, 2.1729663e-04, 2.2145823e-04, ...,
+ 3.8356509e-05, -7.3497440e-06, -2.1754686e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~JOINT_ACCOUNT/602ba55abb1e6d0fbce92065.wav',
+ 'sampling_rate': 16000}
+```
+
+Come puoi notare, la `sampling_rate` adesso รจ 16kHz!
+
+### Feature extractor
+
+Il prossimo passo รจ caricare un estrattore di caratteristiche per normalizzare e fare padding sull'input. Quando applichiamo il padding sui dati testuali, uno `0` รจ aggiunto alle sequenze piรน brevi. La stessa idea si applica ai dati audio, l'estrattore di caratteristiche per gli audio aggiungerร uno `0` - interpretato come silenzio - agli `array`.
+
+Carica l'estrattore delle caratteristiche con [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
+```
+
+Inserisci l' `array` audio nell'estrattore delle caratteristiche. Noi raccomandiamo sempre di aggiungere il parametro `sampling_rate` nell'estrattore delle caratteristiche per correggere meglio qualche errore, dovuto ai silenzi, che potrebbe verificarsi.
+
+```py
+>>> audio_input = [dataset[0]["audio"]["array"]]
+>>> feature_extractor(audio_input, sampling_rate=16000)
+{'input_values': [array([ 3.8106556e-04, 2.7506407e-03, 2.8015103e-03, ...,
+ 5.6335266e-04, 4.6588284e-06, -1.7142107e-04], dtype=float32)]}
+```
+
+### Pad e truncate
+
+Come per il tokenizer, puoi applicare le operazioni padding o truncation per manipolare sequenze di variabili a lotti. Dai uno sguaro alla lunghezza delle sequenze di questi due campioni audio:
+
+```py
+>>> dataset[0]["audio"]["array"].shape
+(173398,)
+
+>>> dataset[1]["audio"]["array"].shape
+(106496,)
+```
+
+Come puoi vedere, il primo campione ha una sequenza piรน lunga del secondo. Crea una funzione che preprocesserร il dataset. Specifica una lunghezza massima del campione, e l'estrattore di features si occuperร di riempire o troncare la sequenza per coincidervi:
+
+```py
+>>> def preprocess_function(examples):
+... audio_arrays = [x["array"] for x in examples["audio"]]
+... inputs = feature_extractor(
+... audio_arrays,
+... sampling_rate=16000,
+... padding=True,
+... max_length=100000,
+... truncation=True,
+... )
+... return inputs
+```
+
+Applica la funzione ai primi esempi nel dataset:
+
+```py
+>>> processed_dataset = preprocess_function(dataset[:5])
+```
+
+Adesso guarda la lunghezza dei campioni elaborati:
+
+```py
+>>> processed_dataset["input_values"][0].shape
+(100000,)
+
+>>> processed_dataset["input_values"][1].shape
+(100000,)
+```
+
+La lunghezza dei campioni adesso coincide con la massima lunghezza impostata nelle funzione.
+
+## Vision
+
+Un estrattore di caratteristiche si puรฒ usare anche per processare immagini e per compiti di visione. Ancora una volta, l'obiettivo รจ convertire l'immagine grezza in un lotto di tensori come input.
+
+Carica il dataset [food101](https://huggingface.co/datasets/food101) per questa esercitazione. Usa il parametro `split` di ๐ค Datasets per caricare solo un piccolo campione dal dataset di addestramento poichรจ il set di dati รจ molto grande:
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("food101", split="train[:100]")
+```
+
+Secondo passo, dai uno sguardo alle immagini usando la caratteristica [`Image`](https://huggingface.co/docs/datasets/package_reference/main_classes.html?highlight=image#datasets.Image) di ๐ค Datasets:
+
+```py
+>>> dataset[0]["image"]
+```
+
+
+
+### Feature extractor
+
+Carica l'estrattore di caratteristiche [`AutoFeatureExtractor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("google/vit-base-patch16-224")
+```
+
+### Data augmentation
+
+Per le attivitร di visione, รจ usuale aggiungere alcuni tipi di data augmentation alle immagini come parte del preprocessing. Puoi aggiungere augmentations con qualsiasi libreria che preferisci, ma in questa esercitazione, userai il modulo [`transforms`](https://pytorch.org/vision/stable/transforms.html) di torchvision.
+
+1. Normalizza l'immagine e usa [`Compose`](https://pytorch.org/vision/master/generated/torchvision.transforms.Compose.html) per concatenare alcune trasformazioni - [`RandomResizedCrop`](https://pytorch.org/vision/main/generated/torchvision.transforms.RandomResizedCrop.html) e [`ColorJitter`](https://pytorch.org/vision/main/generated/torchvision.transforms.ColorJitter.html) - insieme:
+
+```py
+>>> from torchvision.transforms import Compose, Normalize, RandomResizedCrop, ColorJitter, ToTensor
+
+>>> normalize = Normalize(mean=feature_extractor.image_mean, std=feature_extractor.image_std)
+>>> _transforms = Compose(
+... [RandomResizedCrop(feature_extractor.size), ColorJitter(brightness=0.5, hue=0.5), ToTensor(), normalize]
+... )
+```
+
+2. Il modello accetta [`pixel_values`](model_doc/visionencoderdecoder#transformers.VisionEncoderDecoderModel.forward.pixel_values) come input. Questo valore รจ generato dall'estrattore di caratteristiche. Crea una funzione che genera `pixel_values` dai transforms:
+
+```py
+>>> def transforms(examples):
+... examples["pixel_values"] = [_transforms(image.convert("RGB")) for image in examples["image"]]
+... return examples
+```
+
+3. Poi utilizza ๐ค Datasets [`set_transform`](https://huggingface.co/docs/datasets/process#format-transform)per applicare al volo la trasformazione:
+
+```py
+>>> dataset.set_transform(transforms)
+```
+
+4. Adesso quando accedi all'immagine, puoi notare che l'estrattore di caratteristiche ha aggiunto `pixel_values` allo schema di input:
+
+```py
+>>> dataset[0]["image"]
+{'image': ,
+ 'label': 6,
+ 'pixel_values': tensor([[[ 0.0353, 0.0745, 0.1216, ..., -0.9922, -0.9922, -0.9922],
+ [-0.0196, 0.0667, 0.1294, ..., -0.9765, -0.9843, -0.9922],
+ [ 0.0196, 0.0824, 0.1137, ..., -0.9765, -0.9686, -0.8667],
+ ...,
+ [ 0.0275, 0.0745, 0.0510, ..., -0.1137, -0.1216, -0.0824],
+ [ 0.0667, 0.0824, 0.0667, ..., -0.0588, -0.0745, -0.0980],
+ [ 0.0353, 0.0353, 0.0431, ..., -0.0039, -0.0039, -0.0588]],
+
+ [[ 0.2078, 0.2471, 0.2863, ..., -0.9451, -0.9373, -0.9451],
+ [ 0.1608, 0.2471, 0.3098, ..., -0.9373, -0.9451, -0.9373],
+ [ 0.2078, 0.2706, 0.3020, ..., -0.9608, -0.9373, -0.8275],
+ ...,
+ [-0.0353, 0.0118, -0.0039, ..., -0.2392, -0.2471, -0.2078],
+ [ 0.0196, 0.0353, 0.0196, ..., -0.1843, -0.2000, -0.2235],
+ [-0.0118, -0.0039, -0.0039, ..., -0.0980, -0.0980, -0.1529]],
+
+ [[ 0.3961, 0.4431, 0.4980, ..., -0.9216, -0.9137, -0.9216],
+ [ 0.3569, 0.4510, 0.5216, ..., -0.9059, -0.9137, -0.9137],
+ [ 0.4118, 0.4745, 0.5216, ..., -0.9137, -0.8902, -0.7804],
+ ...,
+ [-0.2314, -0.1922, -0.2078, ..., -0.4196, -0.4275, -0.3882],
+ [-0.1843, -0.1686, -0.2000, ..., -0.3647, -0.3804, -0.4039],
+ [-0.1922, -0.1922, -0.1922, ..., -0.2941, -0.2863, -0.3412]]])}
+```
+
+Di seguito come si vede l'immagine dopo la fase di preprocessing. Come ci si aspetterebbe dalle trasformazioni applicate, l'immagine รจ stata ritagliata in modo casuale e le proprietร del colore sono diverse.
+
+```py
+>>> import numpy as np
+>>> import matplotlib.pyplot as plt
+
+>>> img = dataset[0]["pixel_values"]
+>>> plt.imshow(img.permute(1, 2, 0))
+```
+
+
+
+## Multimodal
+
+Per attivitร multimodali userai una combinazione di tutto quello che hai imparato poco fa e applicherai le tue competenze alla comprensione automatica del parlato (Automatic Speech Recognition - ASR). Questo significa che avrai bisogno di:
+
+* Un estrattore delle caratteristiche per processare i dati audio.
+* Il Tokenizer per processare i testi.
+
+Ritorna sul datasere [LJ Speech](https://huggingface.co/datasets/lj_speech):
+
+```py
+>>> from datasets import load_dataset
+
+>>> lj_speech = load_dataset("lj_speech", split="train")
+```
+
+Visto che sei interessato solo alle colonne `audio` e `text`, elimina tutte le altre:
+
+```py
+>>> lj_speech = lj_speech.map(remove_columns=["file", "id", "normalized_text"])
+```
+
+Adesso guarda le colonne `audio` e `text`:
+
+```py
+>>> lj_speech[0]["audio"]
+{'array': array([-7.3242188e-04, -7.6293945e-04, -6.4086914e-04, ...,
+ 7.3242188e-04, 2.1362305e-04, 6.1035156e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/917ece08c95cf0c4115e45294e3cd0dee724a1165b7fc11798369308a465bd26/LJSpeech-1.1/wavs/LJ001-0001.wav',
+ 'sampling_rate': 22050}
+
+>>> lj_speech[0]["text"]
+'Printing, in the only sense with which we are at present concerned, differs from most if not from all the arts and crafts represented in the Exhibition'
+```
+
+Ricorda dalla sezione precedente sull'elaborazione dei dati audio, tu dovresti sempre [ricampionare](preprocessing#audio) la frequenza di campionamento dei tuoi dati audio per farla coincidere con quella del dataset usato dal modello preaddestrato:
+
+```py
+>>> lj_speech = lj_speech.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+### Processor
+
+Un processor combina un estrattore di caratteristiche e un tokenizer. Carica un processor con [`AutoProcessor.from_pretrained`]:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
+```
+
+1. Crea una funzione che processi i dati audio in `input_values`, e tokenizza il testo in `labels`. Questi sono i tuoi input per il modello:
+
+```py
+>>> def prepare_dataset(example):
+... audio = example["audio"]
+
+... example.update(processor(audio=audio["array"], text=example["text"], sampling_rate=16000))
+
+... return example
+```
+
+2. Applica la funzione `prepare_dataset` ad un campione:
+
+```py
+>>> prepare_dataset(lj_speech[0])
+```
+
+Nota che il processor ha aggiunto `input_values` e `labels`. La frequenza di campionamento รจ stata corretta riducendola a 16kHz.
+
+Fantastico, ora dovresti essere in grado di preelaborare i dati per qualsiasi modalitร e persino di combinare modalitร diverse! Nella prossima esercitazione, impareremo a mettere a punto un modello sui dati appena pre-elaborati.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/quicktour.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/quicktour.md
new file mode 100644
index 0000000000000000000000000000000000000000..f0291a6167715a860af1dad07d41ada4d667a405
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/quicktour.md
@@ -0,0 +1,401 @@
+
+
+# Quick tour
+
+[[open-in-colab]]
+
+Entra in azione con ๐ค Transformers! Inizia utilizzando [`pipeline`] per un'inferenza veloce, carica un modello pre-allenato e un tokenizer con una [AutoClass](./model_doc/auto) per risolvere i tuoi compiti legati a testo, immagini o audio.
+
+
+
+Tutti gli esempi di codice presenti in questa documentazione hanno un pulsante in alto a sinistra che permette di selezionare tra PyTorch e TensorFlow. Se
+questo non รจ presente, ci si aspetta che il codice funzioni per entrambi i backend senza alcun cambiamento.
+
+
+
+## Pipeline
+
+[`pipeline`] รจ il modo piรน semplice per utilizzare un modello pre-allenato per un dato compito.
+
+
+
+La [`pipeline`] supporta molti compiti comuni:
+
+**Testo**:
+* Analisi del Sentimento (Sentiment Analysis, in inglese): classifica la polaritร di un testo dato.
+* Generazione del Testo (Text Generation, in inglese): genera del testo a partire da un dato input.
+* Riconoscimento di Entitร (Name Entity Recognition o NER, in inglese): etichetta ogni parola con l'entitร che questa rappresenta (persona, data, luogo, ecc.).
+* Rispondere a Domande (Question answering, in inglese): estrae la risposta da un contesto, dato del contesto e una domanda.
+* Riempimento di Maschere (Fill-mask, in inglese): riempie gli spazi mancanti in un testo che ha parole mascherate.
+* Riassumere (Summarization, in inglese): genera una sintesi di una lunga sequenza di testo o di un documento.
+* Traduzione (Translation, in inglese): traduce un testo in un'altra lingua.
+* Estrazione di Caratteristiche (Feature Extraction, in inglese): crea un tensore che rappresenta un testo.
+
+**Immagini**:
+* Classificazione di Immagini (Image Classification, in inglese): classifica un'immagine.
+* Segmentazione di Immagini (Image Segmentation, in inglese): classifica ogni pixel di un'immagine.
+* Rilevazione di Oggetti (Object Detection, in inglese): rileva oggetti all'interno di un'immagine.
+
+**Audio**:
+* Classificazione di Audio (Audio Classification, in inglese): assegna un'etichetta ad un segmento di audio dato.
+* Riconoscimento Vocale Automatico (Automatic Speech Recognition o ASR, in inglese): trascrive il contenuto di un audio dato in un testo.
+
+
+
+Per maggiori dettagli legati alla [`pipeline`] e ai compiti ad essa associati, fai riferimento alla documentazione [qui](./main_classes/pipelines).
+
+
+
+### Utilizzo della Pipeline
+
+Nel seguente esempio, utilizzerai la [`pipeline`] per l'analisi del sentimento.
+
+Installa le seguenti dipendenze se non lo hai giร fatto:
+
+
+
+
+```bash
+pip install torch
+```
+
+
+
+```bash
+pip install tensorflow
+```
+
+
+
+Importa [`pipeline`] e specifica il compito che vuoi completare:
+
+```py
+>>> from transformers import pipeline
+
+>>> classificatore = pipeline("sentiment-analysis", model="MilaNLProc/feel-it-italian-sentiment")
+```
+
+La pipeline scarica e salva il [modello pre-allenato](https://huggingface.co/MilaNLProc/feel-it-italian-sentiment) e il tokenizer per l'analisi del sentimento. Se non avessimo scelto un modello, la pipeline ne avrebbe scelto uno di default. Ora puoi utilizzare il `classifier` sul tuo testo obiettivo:
+
+```py
+>>> classificatore("Siamo molto felici di mostrarti la libreria ๐ค Transformers.")
+[{'label': 'positive', 'score': 0.9997}]
+```
+
+Per piรน di una frase, passa una lista di frasi alla [`pipeline`] la quale restituirร una lista di dizionari:
+
+```py
+>>> risultati = classificatore(
+... ["Siamo molto felici di mostrarti la libreria ๐ค Transformers.", "Speriamo te non la odierai."]
+... )
+>>> for risultato in risultati:
+... print(f"etichetta: {risultato['label']}, con punteggio: {round(risultato['score'], 4)}")
+etichetta: positive, con punteggio: 0.9998
+etichetta: negative, con punteggio: 0.9998
+```
+
+La [`pipeline`] puรฒ anche iterare su un dataset intero. Inizia installando la libreria [๐ค Datasets](https://huggingface.co/docs/datasets/):
+
+```bash
+pip install datasets
+```
+
+Crea una [`pipeline`] con il compito che vuoi risolvere e con il modello che vuoi utilizzare.
+
+```py
+>>> import torch
+>>> from transformers import pipeline
+
+>>> riconoscitore_vocale = pipeline(
+... "automatic-speech-recognition", model="radiogroup-crits/wav2vec2-xls-r-1b-italian-doc4lm-5gram"
+... )
+```
+
+Poi, carica un dataset (vedi ๐ค Datasets [Quick Start](https://huggingface.co/docs/datasets/quickstart) per maggiori dettagli) sul quale vuoi iterare. Per esempio, carichiamo il dataset [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14):
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="it-IT", split="train") # doctest: +IGNORE_RESULT
+```
+
+Dobbiamo assicurarci che la frequenza di campionamento del set di dati corrisponda alla frequenza di campionamento con cui รจ stato addestrato `radiogroup-crits/wav2vec2-xls-r-1b-italian-doc4lm-5gram`.
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=riconoscitore_vocale.feature_extractor.sampling_rate))
+```
+
+I file audio vengono caricati automaticamente e ri-campionati quando chiamiamo la colonna "audio".
+Estraiamo i vettori delle forme d'onda grezze delle prime 4 osservazioni e passiamoli come lista alla pipeline:
+
+```py
+>>> risultato = riconoscitore_vocale(dataset[:4]["audio"])
+>>> print([d["text"] for d in risultato])
+['dovrei caricare dei soldi sul mio conto corrente', 'buongiorno e senza vorrei depositare denaro sul mio conto corrente come devo fare per cortesia', 'sรฌ salve vorrei depositare del denaro sul mio conto', 'e buon pomeriggio vorrei depositare dei soldi sul mio conto bancario volleo sapere come posso fare se e posso farlo online ed un altro conto o andandoo tramite bancomut']
+```
+
+Per un dataset piรน grande dove gli input sono di dimensione maggiore (come nel parlato/audio o nella visione), dovrai passare un generatore al posto di una lista che carica tutti gli input in memoria. Guarda la [documentazione della pipeline](./main_classes/pipelines) per maggiori informazioni.
+
+### Utilizzare un altro modello e tokenizer nella pipeline
+
+La [`pipeline`] puรฒ ospitare qualsiasi modello del [Model Hub](https://huggingface.co/models), rendendo semplice l'adattamento della [`pipeline`] per altri casi d'uso. Per esempio, se si vuole un modello capace di trattare testo in francese, usa i tag presenti nel Model Hub in modo da filtrare per ottenere un modello appropriato. Il miglior risultato filtrato restituisce un modello multi-lingua [BERT model](https://huggingface.co/nlptown/bert-base-multilingual-uncased-sentiment) fine-tuned per l'analisi del sentimento. Ottimo, utilizziamo questo modello!
+
+```py
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+```
+
+
+
+Usa [`AutoModelForSequenceClassification`] e [`AutoTokenizer`] per caricare il modello pre-allenato e il suo tokenizer associato (maggiori informazioni su una `AutoClass` in seguito):
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+Usa [`TFAutoModelForSequenceClassification`] e [`AutoTokenizer`] per caricare il modello pre-allenato e il suo tokenizer associato (maggiori informazioni su una `TFAutoClass` in seguito):
+
+```py
+>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+
+Poi puoi specificare il modello e il tokenizer nella [`pipeline`], e applicare il `classifier` sul tuo testo obiettivo:
+
+```py
+>>> classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
+>>> classifier("Nous sommes trรจs heureux de vous prรฉsenter la bibliothรจque ๐ค Transformers.")
+[{'label': '5 stars', 'score': 0.7273}]
+```
+
+Se non riesci a trovare un modello per il tuo caso d'uso, dovrai fare fine-tuning di un modello pre-allenato sui tuoi dati. Dai un'occhiata al nostro tutorial [fine-tuning tutorial](./training) per imparare come. Infine, dopo che hai completato il fine-tuning del tuo modello pre-allenato, considera per favore di condividerlo (vedi il tutorial [qui](./model_sharing)) con la comunitร sul Model Hub per democratizzare l'NLP! ๐ค
+
+## AutoClass
+
+
+
+Al suo interno, le classi [`AutoModelForSequenceClassification`] e [`AutoTokenizer`] lavorano assieme per dare potere alla [`pipeline`]. Una [AutoClass](./model_doc/auto) รจ una scorciatoia che automaticamente recupera l'architettura di un modello pre-allenato a partire dal suo nome o path. Hai solo bisogno di selezionare la `AutoClass` appropriata per il tuo compito e il suo tokenizer associato con [`AutoTokenizer`].
+
+Ritorniamo al nostro esempio e vediamo come puoi utilizzare la `AutoClass` per replicare i risultati della [`pipeline`].
+
+### AutoTokenizer
+
+Un tokenizer รจ responsabile dell'elaborazione del testo in modo da trasformarlo in un formato comprensibile dal modello. Per prima cosa, il tokenizer dividerร il testo in parole chiamate *token*. Ci sono diverse regole che governano il processo di tokenizzazione, tra cui come dividere una parola e a quale livello (impara di piรน sulla tokenizzazione [qui](./tokenizer_summary)). La cosa piรน importante da ricordare comunque รจ che hai bisogno di inizializzare il tokenizer con lo stesso nome del modello in modo da assicurarti che stai utilizzando le stesse regole di tokenizzazione con cui il modello รจ stato pre-allenato.
+
+Carica un tokenizer con [`AutoTokenizer`]:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> nome_del_modello = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tokenizer = AutoTokenizer.from_pretrained(nome_del_modello)
+```
+
+Dopodichรฉ, il tokenizer converte i token in numeri in modo da costruire un tensore come input del modello. Questo รจ conosciuto come il *vocabolario* del modello.
+
+Passa il tuo testo al tokenizer:
+
+```py
+>>> encoding = tokenizer("Siamo molto felici di mostrarti la libreria ๐ค Transformers.")
+>>> print(encoding)
+{'input_ids': [101, 56821, 10132, 14407, 13019, 13007, 10120, 47201, 10330, 10106, 91686, 100, 58263, 119, 102],
+'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+Il tokenizer restituirร un dizionario contenente:
+
+* [input_ids](./glossary#input-ids): rappresentazioni numeriche dei tuoi token.
+* [attention_mask](.glossary#attention-mask): indica quali token devono essere presi in considerazione.
+
+Come con la [`pipeline`], il tokenizer accetterร una lista di input. In piรน, il tokenizer puรฒ anche completare (pad, in inglese) e troncare il testo in modo da restituire un lotto (batch, in inglese) di lunghezza uniforme:
+
+
+
+```py
+>>> pt_batch = tokenizer(
+... ["Siamo molto felici di mostrarti la libreria ๐ค Transformers.", "Speriamo te non la odierai."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="pt",
+... )
+```
+
+
+```py
+>>> tf_batch = tokenizer(
+... ["Siamo molto felici di mostrarti la libreria ๐ค Transformers.", "Speriamo te non la odierai."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="tf",
+... )
+```
+
+
+
+Leggi il tutorial sul [preprocessing](./preprocessing) per maggiori dettagli sulla tokenizzazione.
+
+### AutoModel
+
+
+
+๐ค Transformers fornisce un metodo semplice e unificato per caricare istanze pre-allenate. Questo significa che puoi caricare un [`AutoModel`] come caricheresti un [`AutoTokenizer`]. L'unica differenza รจ selezionare l'[`AutoModel`] corretto per il compito di interesse. Dato che stai facendo classificazione di testi, o sequenze, carica [`AutoModelForSequenceClassification`]:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+
+Guarda il [task summary](./task_summary) per sapere quale classe di [`AutoModel`] utilizzare per quale compito.
+
+
+
+Ora puoi passare il tuo lotto di input pre-processati direttamente al modello. Devi solo spacchettare il dizionario aggiungendo `**`:
+
+```py
+>>> pt_outputs = pt_model(**pt_batch)
+```
+
+Il modello produrrร le attivazioni finali nell'attributo `logits`. Applica la funzione softmax a `logits` per ottenere le probabilitร :
+
+```py
+>>> from torch import nn
+
+>>> pt_predictions = nn.functional.softmax(pt_outputs.logits, dim=-1)
+>>> print(pt_predictions)
+tensor([[0.0041, 0.0037, 0.0203, 0.2005, 0.7713],
+ [0.3766, 0.3292, 0.1832, 0.0558, 0.0552]], grad_fn=)
+```
+
+
+๐ค Transformers fornisce un metodo semplice e unificato per caricare istanze pre-allenate. Questo significa che puoi caricare un [`TFAutoModel`] come caricheresti un [`AutoTokenizer`]. L'unica differenza รจ selezionare il [`TFAutoModel`] corretto per il compito di interesse. Dato che stai facendo classificazione di testi, o sequenze, carica [`TFAutoModelForSequenceClassification`]:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> nome_del_modello = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(nome_del_modello)
+```
+
+
+
+Guarda il [task summary](./task_summary) per sapere quale classe di [`AutoModel`] utilizzare per quale compito.
+
+
+
+Ora puoi passare il tuo lotto di input pre-processati direttamente al modello passando le chiavi del dizionario al tensore:
+
+```py
+>>> tf_outputs = tf_model(tf_batch)
+```
+
+Il modello produrrร le attivazioni finali nell'attributo `logits`. Applica la funzione softmax a `logits` per ottenere le probabilitร :
+```py
+>>> import tensorflow as tf
+
+>>> tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
+>>> tf_predictions # doctest: +IGNORE_RESULT
+```
+
+
+
+
+
+Tutti i modelli di ๐ค Transformers (PyTorch e TensorFlow) restituiscono i tensori *prima* della funzione finale
+di attivazione (come la softmax) perchรฉ la funzione di attivazione finale viene spesso unita a quella di perdita.
+
+
+
+I modelli sono [`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) o [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) standard cosรฌ puoi utilizzarli all'interno del tuo training loop usuale. Tuttavia, per rendere le cose piรน semplici, ๐ค Transformers fornisce una classe [`Trainer`] per PyTorch che aggiunge delle funzionalitร per l'allenamento distribuito, precisione mista, e altro ancora. Per TensorFlow, puoi utilizzare il metodo `fit` di [Keras](https://keras.io/). Fai riferimento al [tutorial per il training](./training) per maggiori dettagli.
+
+
+
+Gli output del modello di ๐ค Transformers sono delle dataclasses speciali in modo che i loro attributi vengano auto-completati all'interno di un IDE.
+Gli output del modello si comportano anche come una tupla o un dizionario (ad esempio, puoi indicizzare con un intero, una slice o una stringa) nel qual caso gli attributi che sono `None` vengono ignorati.
+
+
+
+### Salva un modello
+
+
+
+Una volta completato il fine-tuning del tuo modello, puoi salvarlo con il suo tokenizer utilizzando [`PreTrainedModel.save_pretrained`]:
+
+```py
+>>> pt_save_directory = "./pt_save_pretrained"
+>>> tokenizer.save_pretrained(pt_save_directory) # doctest: +IGNORE_RESULT
+>>> pt_model.save_pretrained(pt_save_directory)
+```
+
+Quando desideri utilizzare il tuo modello nuovamente, puoi ri-caricarlo con [`PreTrainedModel.from_pretrained`]:
+
+```py
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained("./pt_save_pretrained")
+```
+
+
+Una volta completato il fine-tuning del tuo modello, puoi salvarlo con il suo tokenizer utilizzando [`TFPreTrainedModel.save_pretrained`]:
+
+```py
+>>> tf_save_directory = "./tf_save_pretrained"
+>>> tokenizer.save_pretrained(tf_save_directory) # doctest: +IGNORE_RESULT
+>>> tf_model.save_pretrained(tf_save_directory)
+```
+
+Quando desideri utilizzare il tuo modello nuovamente, puoi ri-caricarlo con [`TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained("./tf_save_pretrained")
+```
+
+
+
+Una caratteristica particolarmente interessante di ๐ค Transformers รจ la sua abilitร di salvare un modello e ri-caricarlo sia come modello di PyTorch che di TensorFlow. I parametri `from_pt` o `from_tf` possono convertire un modello da un framework all'altro:
+
+
+
+
+```py
+>>> from transformers import AutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(pt_save_directory, from_pt=True)
+```
+
+
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(tf_save_directory, from_tf=True)
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/run_scripts.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/run_scripts.md
new file mode 100644
index 0000000000000000000000000000000000000000..b437efb9fb18f650e1486f5673a0dd8610623964
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/run_scripts.md
@@ -0,0 +1,351 @@
+
+
+# Addestramento con script
+
+Insieme ai [notebooks](./notebooks) ๐ค Transformers, ci sono anche esempi di script che dimostrano come addestrare un modello per un task con [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch), [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow), o [JAX/Flax](https://github.com/huggingface/transformers/tree/main/examples/flax).
+
+Troverai anche script che abbiamo usato nei nostri [progetti di ricerca](https://github.com/huggingface/transformers/tree/main/examples/research_projects) e [precedenti esempi](https://github.com/huggingface/transformers/tree/main/examples/legacy) a cui contribuisce per lo piรน la comunitร . Questi script non sono attivamente mantenuti e richiedono una specifica versione di ๐ค Transformers che sarร molto probabilmente incompatibile con l'ultima versione della libreria.
+
+Non รจ dato per scontato che gli script di esempio funzionino senza apportare modifiche per ogni problema, bensรฌ potrebbe essere necessario adattare lo script al tuo caso specifico. Per aiutarti in ciรฒ, la maggioranza degli script espone le modalitร di pre-processamento dei dati, consentendoti di modificare lo script come preferisci.
+
+Per qualsiasi feature che vorresti implementare in uno script d'esempio, per favore discutine nel [forum](https://discuss.huggingface.co/) o in un'[issue](https://github.com/huggingface/transformers/issues) prima di inviare una Pull Request. Mentre accogliamo con piacere la correzione di bug, รจ piรน improbabile che faremo la stessa con una PR che aggiunge funzionalitร sacrificando la leggibilitร .
+
+Questa guida ti mostrerร come eseguire uno script di esempio relativo al task di summarization in [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization) e [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization). Tutti gli esempi funzioneranno con entrambi i framework a meno che non sia specificato altrimenti.
+
+## Installazione
+
+Per eseguire con successo l'ultima versione degli script di esempio, devi **installare ๐ค Transformers dalla fonte** in un nuovo ambiente virtuale:
+
+```bash
+git clone https://github.com/huggingface/transformers
+cd transformers
+pip install .
+```
+Per le precedenti versioni degli script di esempio, clicca sul pulsante di seguito:
+
+
+ Esempi per versioni precedenti di ๐ค Transformers
+
+
+
+Successivamente, cambia la tua attuale copia di ๐ค Transformers specificandone la versione, ad esempio v3.5.1:
+
+```bash
+git checkout tags/v3.5.1
+```
+
+ Dopo aver configurato correttamente la versione della libreria, naviga nella cartella degli esempi di tua scelta e installa i requisiti:
+
+```bash
+pip install -r requirements.txt
+```
+
+## Esegui uno script
+
+
+
+
+Lo script di esempio scarica e pre-processa un dataset dalla libreria ๐ค [Datasets](https://huggingface.co/docs/datasets/). Successivamente, lo script esegue il fine-tuning su un dataset usando il [Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) su un'architettura che supporta la summarization. Il seguente esempio mostra come eseguire il fine-tuning di [T5-small](https://huggingface.co/google-t5/t5-small) sul dataset [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail). Il modello T5 richiede un parametro addizionale `source_prefix` a causa del modo in cui รจ stato addestrato. Questo prefisso permette a T5 di sapere che si tratta di un task di summarization.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+Lo script di esempio scarica e pre-processa un dataset dalla libreria ๐ค [Datasets](https://huggingface.co/docs/datasets/). Successivamente, lo script esegue il fine-tuning su un dataset usando Keras su un'architettura che supporta la summarization. Il seguente esempio mostra come eseguire il fine-tuning di [T5-small](https://huggingface.co/google-t5/t5-small) sul dataset [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail). Il modello T5 richiede un parametro addizionale `source_prefix` a causa del modo in cui รจ stato addestrato. Questo prefisso permette a T5 di sapere che si tratta di un task di summarization.
+
+```bash
+python examples/tensorflow/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Addestramento distribuito e precisione mista
+
+Il [Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) supporta l'addestramento distribuito e la precisione mista, che significa che puoi anche usarla in uno script. Per abilitare entrambe le funzionalitร :
+
+- Aggiunto l'argomento `fp16` per abilitare la precisione mista.
+- Imposta un numero di GPU da usare con l'argomento `nproc_per_node`.
+
+```bash
+torchrun \
+ --nproc_per_node 8 pytorch/summarization/run_summarization.py \
+ --fp16 \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+Gli script TensorFlow utilizzano una [`MirroredStrategy`](https://www.tensorflow.org/guide/distributed_training#mirroredstrategy) per il training distribuito e non devi aggiungere alcun argomento addizionale allo script di training. Lo script TensorFlow userร multiple GPU in modo predefinito se quest'ultime sono disponibili:
+
+## Esegui uno script su TPU
+
+
+
+Le Tensor Processing Units (TPU) sono state progettate per migliorare le prestazioni. PyTorch supporta le TPU con il compilatore per deep learning [XLA](https://www.tensorflow.org/xla) (guarda [questo link](https://github.com/pytorch/xla/blob/master/README.md) per maggiori dettagli). Per usare una TPU, avvia lo script `xla_spawn.py` e usa l'argomento `num_cores` per impostare il numero di core TPU che intendi usare.
+
+```bash
+python xla_spawn.py --num_cores 8 \
+ summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+Le Tensor Processing Units (TPU) sono state progettate per migliorare le prestazioni. Gli script TensorFlow utilizzano una [`TPUStrategy`](https://www.tensorflow.org/guide/distributed_training#tpustrategy) per eseguire l'addestramento su TPU. Per usare una TPU, passa il nome della risorsa TPU all'argomento `tpu`.
+
+```bash
+python run_summarization.py \
+ --tpu name_of_tpu_resource \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Esegui uno script con ๐ค Accelerate
+
+๐ค [Accelerate](https://huggingface.co/docs/accelerate) รจ una libreria compatibile solo con PyTorch che offre un metodo unificato per addestrare modelli su diverse tipologie di configurazioni (CPU, multiple GPU, TPU) mantenendo una completa visibilitร rispetto al ciclo di training di PyTorch. Assicurati di aver effettuato l'installazione di ๐ค Accelerate, nel caso non lo avessi fatto:
+
+> Nota: dato che Accelerate รจ in rapido sviluppo, รจ necessario installare la versione proveniente da git per eseguire gli script:
+```bash
+pip install git+https://github.com/huggingface/accelerate
+```
+
+Invece che usare lo script `run_summarization.py`, devi usare lo script `run_summarization_no_trainer.py`. Gli script supportati in ๐ค Accelerate avranno un file chiamato `task_no_trainer.py` nella rispettiva cartella. Per iniziare, esegui il seguente comando per creare e salvare un file di configurazione:
+
+```bash
+accelerate config
+```
+
+Testa la tua configurazione per assicurarti della sua correttezza:
+
+```bash
+accelerate test
+```
+
+Ora sei pronto per avviare l'addestramento:
+
+```bash
+accelerate launch run_summarization_no_trainer.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir ~/tmp/tst-summarization
+```
+
+## Uso di un dataset personalizzato
+
+Lo script di summarization supporta dataset personalizzati purchรฉ siano file CSV o JSON Line. Quando usi il tuo dataset, devi specificare diversi argomenti aggiuntivi:
+
+- `train_file` e `validation_file` specificano dove si trovano i file di addestramento e validazione.
+- `text_column` รจ il file di input da riassumere.
+- `summary_column` รจ il file di destinazione per l'output.
+
+Uno script di summarization usando un dataset personalizzato sarebbe simile a questo:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --train_file path_to_csv_or_jsonlines_file \
+ --validation_file path_to_csv_or_jsonlines_file \
+ --text_column text_column_name \
+ --summary_column summary_column_name \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --overwrite_output_dir \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --predict_with_generate
+```
+
+## Testare uno script
+
+ร spesso una buona idea avviare il tuo script su un numero inferiore di esempi tratti dal dataset, per assicurarti che tutto funzioni come previsto prima di eseguire lo script sull'intero dataset, che potrebbe necessitare di ore. Usa i seguenti argomenti per limitare il dataset ad un massimo numero di esempi:
+
+- `max_train_samples`
+- `max_eval_samples`
+- `max_predict_samples`
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --max_train_samples 50 \
+ --max_eval_samples 50 \
+ --max_predict_samples 50 \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+Non tutti gli esempi di script supportano l'argomento `max_predict_samples`. Se non sei sicuro circa il supporto di questo argomento da parte del tuo script, aggiungi l'argomento `-h` per controllare:
+
+```bash
+examples/pytorch/summarization/run_summarization.py -h
+```
+
+## Riavviare addestramento da un checkpoint
+
+Un'altra utile opzione รจ riavviare un addestramento da un checkpoint precedente. Questo garantirร che tu possa riprendere da dove hai interrotto senza ricominciare se l'addestramento viene interrotto. Ci sono due metodi per riavviare l'addestramento da un checkpoint:
+
+Il primo metodo usa l'argomento `output_dir previous_output_dir` per riavviare l'addestramento dall'ultima versione del checkpoint contenuto in `output_dir`. In questo caso, dovresti rimuovere `overwrite_output_dir`:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --output_dir previous_output_dir \
+ --predict_with_generate
+```
+
+Il secondo metodo usa l'argomento `resume_from_checkpoint path_to_specific_checkpoint` per riavviare un addestramento da una specifica cartella di checkpoint.
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --resume_from_checkpoint path_to_specific_checkpoint \
+ --predict_with_generate
+```
+
+## Condividi il tuo modello
+
+Tutti gli script possono caricare il tuo modello finale al [Model Hub](https://huggingface.co/models). Prima di iniziare, assicurati di aver effettuato l'accesso su Hugging Face:
+
+```bash
+huggingface-cli login
+```
+
+Poi, aggiungi l'argomento `push_to_hub` allo script. Questo argomento consentirร di creare un repository con il tuo username Hugging Face e la cartella specificata in `output_dir`.
+
+Per dare uno specifico nome al repository, usa l'argomento `push_to_hub_model_id`. Il repository verrร automaticamente elencata sotto al tuo namespace.
+
+Il seguente esempio mostra come caricare un modello specificando il nome del repository:
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --push_to_hub \
+ --push_to_hub_model_id finetuned-t5-cnn_dailymail \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/serialization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/serialization.md
new file mode 100644
index 0000000000000000000000000000000000000000..974aee0d81cae0425fbd6a6fa3052dd5c2c25282
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/serialization.md
@@ -0,0 +1,676 @@
+
+
+# Esporta modelli ๐ค Transformers
+
+Se devi implementare ๐ค modelli Transformers in ambienti di produzione, noi
+consigliamo di esportarli in un formato serializzato che puรฒ essere caricato ed eseguito
+su runtime e hardware specializzati. In questa guida ti mostreremo come farlo
+esporta ๐ค Modelli Transformers in due formati ampiamente utilizzati: ONNX e TorchScript.
+
+Una volta esportato, un modello puรฒ essere ottimizato per l'inferenza tramite tecniche come
+la quantizzazione e soppressione. Se sei interessato a ottimizzare i tuoi modelli per l'esecuzione
+con la massima efficienza, dai un'occhiata a [๐ค Optimum
+library](https://github.com/huggingface/optimum).
+
+## ONNX
+
+Il progetto [ONNX (Open Neural Network eXchange)](http://onnx.ai) Il progetto onnx รจ un open
+standard che definisce un insieme comune di operatori e un formato di file comune a
+rappresentano modelli di deep learning in un'ampia varietร di framework, tra cui
+PyTorch e TensorFlow. Quando un modello viene esportato nel formato ONNX, questi
+operatori sono usati per costruire un grafico computazionale (often called an
+_intermediate representation_) che rappresenta il flusso di dati attraverso la
+rete neurale.
+
+Esponendo un grafico con operatori e tipi di dati standardizzati, ONNX rende
+piรน facile passare da un framework all'altro. Ad esempio, un modello allenato in PyTorch puรฒ
+essere esportato in formato ONNX e quindi importato in TensorFlow (e viceversa).
+
+๐ค Transformers fornisce un pacchetto `transformers.onnx` che ti consente di
+convertire i checkpoint del modello in un grafico ONNX sfruttando gli oggetti di configurazione.
+Questi oggetti di configurazione sono giร pronti per una serie di architetture di modelli,
+e sono progettati per essere facilmente estensibili ad altre architetture.
+
+Le configurazioni pronte includono le seguenti architetture:
+
+
+
+- ALBERT
+- BART
+- BEiT
+- BERT
+- BigBird
+- BigBird-Pegasus
+- Blenderbot
+- BlenderbotSmall
+- CamemBERT
+- ConvBERT
+- Data2VecText
+- Data2VecVision
+- DeiT
+- DistilBERT
+- ELECTRA
+- FlauBERT
+- GPT Neo
+- GPT-J
+- I-BERT
+- LayoutLM
+- M2M100
+- Marian
+- mBART
+- MobileBERT
+- OpenAI GPT-2
+- Perceiver
+- PLBart
+- RoBERTa
+- RoFormer
+- SqueezeBERT
+- T5
+- ViT
+- XLM
+- XLM-RoBERTa
+- XLM-RoBERTa-XL
+
+Nelle prossime due sezioni, ti mostreremo come:
+
+* Esporta un modello supportato usando il pacchetto `transformers.onnx`.
+* Esporta un modello personalizzato per un'architettura non supportata.
+
+### Esportazione di un modello in ONNX
+
+Per esportare un modello ๐ค Transformers in ONNX, dovrai prima installarne alcune
+dipendenze extra:
+
+```bash
+pip install transformers[onnx]
+```
+
+Il pacchetto `transformers.onnx` puรฒ essere usato come modulo Python:
+
+```bash
+python -m transformers.onnx --help
+
+usage: Hugging Face Transformers ONNX exporter [-h] -m MODEL [--feature {causal-lm, ...}] [--opset OPSET] [--atol ATOL] output
+
+positional arguments:
+ output Path indicating where to store generated ONNX model.
+
+optional arguments:
+ -h, --help show this help message and exit
+ -m MODEL, --model MODEL
+ Model ID on huggingface.co or path on disk to load model from.
+ --feature {causal-lm, ...}
+ The type of features to export the model with.
+ --opset OPSET ONNX opset version to export the model with.
+ --atol ATOL Absolute difference tolerance when validating the model.
+```
+
+L'esportazione di un checkpoint utilizzando una configurazione giร pronta puรฒ essere eseguita come segue:
+
+```bash
+python -m transformers.onnx --model=distilbert/distilbert-base-uncased onnx/
+```
+
+che dovrebbe mostrare i seguenti log:
+
+```bash
+Validating ONNX model...
+ -[โ] ONNX model output names match reference model ({'last_hidden_state'})
+ - Validating ONNX Model output "last_hidden_state":
+ -[โ] (2, 8, 768) matches (2, 8, 768)
+ -[โ] all values close (atol: 1e-05)
+All good, model saved at: onnx/model.onnx
+```
+
+Questo esporta un grafico ONNX del checkpoint definito dall'argomento `--model`.
+In questo esempio รจ `distilbert/distilbert-base-uncased`, ma puรฒ essere qualsiasi checkpoint
+Hugging Face Hub o uno memorizzato localmente.
+
+Il file risultante `model.onnx` puรฒ quindi essere eseguito su uno dei [tanti
+acceleratori](https://onnx.ai/supported-tools.html#deployModel) che supportano il
+lo standard ONNX. Ad esempio, possiamo caricare ed eseguire il modello con [ONNX
+Runtime](https://onnxruntime.ai/) come segue:
+
+```python
+>>> from transformers import AutoTokenizer
+>>> from onnxruntime import InferenceSession
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> session = InferenceSession("onnx/model.onnx")
+>>> # ONNX Runtime expects NumPy arrays as input
+>>> inputs = tokenizer("Using DistilBERT with ONNX Runtime!", return_tensors="np")
+>>> outputs = session.run(output_names=["last_hidden_state"], input_feed=dict(inputs))
+```
+
+I nomi di output richiesti (cioรจ `["last_hidden_state"]`) possono essere ottenuti
+dando un'occhiata alla configurazione ONNX di ogni modello. Ad esempio, per
+DistilBERT abbiamo:
+
+```python
+>>> from transformers.models.distilbert import DistilBertConfig, DistilBertOnnxConfig
+
+>>> config = DistilBertConfig()
+>>> onnx_config = DistilBertOnnxConfig(config)
+>>> print(list(onnx_config.outputs.keys()))
+["last_hidden_state"]
+```
+
+Il processo รจ identico per i checkpoint TensorFlow sull'hub. Ad esempio, noi
+possiamo esportare un checkpoint TensorFlow puro da [Keras
+organizzazione](https://huggingface.co/keras-io) come segue:
+
+```bash
+python -m transformers.onnx --model=keras-io/transformers-qa onnx/
+```
+
+Per esportare un modello memorizzato localmente, devi disporre dei pesi del modello
+e file tokenizer memorizzati in una directory. Ad esempio, possiamo caricare e salvare un
+checkpoint come segue:
+
+
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> # Load tokenizer and PyTorch weights form the Hub
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+>>> # Save to disk
+>>> tokenizer.save_pretrained("local-pt-checkpoint")
+>>> pt_model.save_pretrained("local-pt-checkpoint")
+```
+
+Una volta salvato il checkpoint, possiamo esportarlo su ONNX puntando l'argomento `--model`
+del pacchetto `transformers.onnx` nella directory desiderata:
+
+```bash
+python -m transformers.onnx --model=local-pt-checkpoint onnx/
+```
+
+
+```python
+>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
+
+>>> # Load tokenizer and TensorFlow weights from the Hub
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+>>> # Save to disk
+>>> tokenizer.save_pretrained("local-tf-checkpoint")
+>>> tf_model.save_pretrained("local-tf-checkpoint")
+```
+
+Once the checkpoint is saved, we can export it to ONNX by pointing the `--model`
+argument of the `transformers.onnx` package to the desired directory:
+
+```bash
+python -m transformers.onnx --model=local-tf-checkpoint onnx/
+```
+
+
+
+### Selezione delle caratteristiche per diverse topologie di modello
+
+Ogni configurazione giร pronta viene fornita con una serie di _caratteristiche_ che ti consentono di
+esportare modelli per diversi tipi di topologie o attivitร . Come mostrato nella tabella
+di seguito, ogni caratteristica รจ associata a una diversa Auto Class:
+
+| Caratteristica | Auto Class |
+| ------------------------------------ | ------------------------------------ |
+| `causal-lm`, `causal-lm-with-past` | `AutoModelForCausalLM` |
+| `default`, `default-with-past` | `AutoModel` |
+| `masked-lm` | `AutoModelForMaskedLM` |
+| `question-answering` | `AutoModelForQuestionAnswering` |
+| `seq2seq-lm`, `seq2seq-lm-with-past` | `AutoModelForSeq2SeqLM` |
+| `sequence-classification` | `AutoModelForSequenceClassification` |
+| `token-classification` | `AutoModelForTokenClassification` |
+
+Per ciascuna configurazione, puoi trovare l'elenco delle funzionalitร supportate tramite il
+`FeaturesManager`. Ad esempio, per DistilBERT abbiamo:
+
+```python
+>>> from transformers.onnx.features import FeaturesManager
+
+>>> distilbert_features = list(FeaturesManager.get_supported_features_for_model_type("distilbert").keys())
+>>> print(distilbert_features)
+["default", "masked-lm", "causal-lm", "sequence-classification", "token-classification", "question-answering"]
+```
+
+Puoi quindi passare una di queste funzionalitร all'argomento `--feature` nel
+pacchetto `transformers.onnx`. Ad esempio, per esportare un modello di classificazione del testo
+possiamo scegliere un modello ottimizzato dall'Hub ed eseguire:
+
+```bash
+python -m transformers.onnx --model=distilbert/distilbert-base-uncased-finetuned-sst-2-english \
+ --feature=sequence-classification onnx/
+```
+
+che visualizzerร i seguenti registri:
+
+```bash
+Validating ONNX model...
+ -[โ] ONNX model output names match reference model ({'logits'})
+ - Validating ONNX Model output "logits":
+ -[โ] (2, 2) matches (2, 2)
+ -[โ] all values close (atol: 1e-05)
+All good, model saved at: onnx/model.onnx
+```
+
+Puoi notare che in questo caso, i nomi di output del modello ottimizzato sono
+`logits` invece di `last_hidden_state` che abbiamo visto con il
+checkpoint `distilbert/distilbert-base-uncased` precedente. Questo รจ previsto dal
+modello ottimizato visto che ha una testa di e.
+
+
+
+Le caratteristiche che hanno un suffisso `wtih-past` (ad es. `causal-lm-with-past`)
+corrispondono a topologie di modello con stati nascosti precalcolati (chiave e valori
+nei blocchi di attenzione) che possono essere utilizzati per la decodifica autoregressiva veloce.
+
+
+
+
+### Esportazione di un modello per un'architettura non supportata
+
+Se desideri esportare un modello la cui architettura non รจ nativamente supportata dalla
+libreria, ci sono tre passaggi principali da seguire:
+
+1. Implementare una configurazione ONNX personalizzata.
+2. Esportare il modello in ONNX.
+3. Convalidare gli output di PyTorch e dei modelli esportati.
+
+In questa sezione, vedremo come DistilBERT รจ stato implementato per mostrare cosa รจ
+coinvolto in ogni passaggio.
+
+#### Implementazione di una configurazione ONNX personalizzata
+
+Iniziamo con l'oggetto di configurazione ONNX. Forniamo tre classi
+astratte da cui ereditare, a seconda del tipo di archittettura
+del modello che desideri esportare:
+
+* I modelli basati su encoder ereditano da [`~onnx.config.OnnxConfig`]
+* I modelli basati su decoder ereditano da [`~onnx.config.OnnxConfigWithPast`]
+* I modelli encoder-decoder ereditano da[`~onnx.config.OnnxSeq2SeqConfigWithPast`]
+
+
+
+Un buon modo per implementare una configurazione ONNX personalizzata รจ guardare l'implementazione
+esistente nel file `configuration_.py` di un'architettura simile.
+
+
+
+Poichรฉ DistilBERT รจ un modello basato su encoder, la sua configurazione eredita da
+`OnnxConfig`:
+
+```python
+>>> from typing import Mapping, OrderedDict
+>>> from transformers.onnx import OnnxConfig
+
+
+>>> class DistilBertOnnxConfig(OnnxConfig):
+... @property
+... def inputs(self) -> Mapping[str, Mapping[int, str]]:
+... return OrderedDict(
+... [
+... ("input_ids", {0: "batch", 1: "sequence"}),
+... ("attention_mask", {0: "batch", 1: "sequence"}),
+... ]
+... )
+```
+
+Ogni oggetto di configurazione deve implementare la proprietร `inputs` e restituire una
+mappatura, dove ogni chiave corrisponde a un input previsto e ogni valore
+indica l'asse di quell'input. Per DistilBERT, possiamo vedere che sono richiesti
+due input: `input_ids` e `attention_mask`. Questi inputs hanno la stessa forma di
+`(batch_size, sequence_length)` per questo motivo vediamo gli stessi assi usati nella
+configurazione.
+
+
+
+Puoi notare che la proprietร `inputs` per `DistilBertOnnxConfig` restituisce un
+`OrdinatoDict`. Ciรฒ garantisce che gli input corrispondano alla loro posizione
+relativa all'interno del metodo `PreTrainedModel.forward()` durante il tracciamento del grafico.
+Raccomandiamo di usare un `OrderedDict` per le proprietร `inputs` e `outputs`
+quando si implementano configurazioni ONNX personalizzate.
+
+
+
+Dopo aver implementato una configurazione ONNX, รจ possibile istanziarla
+fornendo alla configurazione del modello base come segue:
+
+```python
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("distilbert/distilbert-base-uncased")
+>>> onnx_config = DistilBertOnnxConfig(config)
+```
+
+L'oggetto risultante ha diverse proprietร utili. Ad esempio รจ possibile visualizzare il
+Set operatore ONNX che verrร utilizzato durante l'esportazione:
+
+```python
+>>> print(onnx_config.default_onnx_opset)
+11
+```
+
+ร inoltre possibile visualizzare gli output associati al modello come segue:
+
+```python
+>>> print(onnx_config.outputs)
+OrderedDict([("last_hidden_state", {0: "batch", 1: "sequence"})])
+```
+
+Puoi notare che la proprietร degli output segue la stessa struttura degli input; esso
+restituisce un `OrderedDict` di output con nome e le loro forme. La struttura di output
+รจ legato alla scelta della funzione con cui viene inizializzata la configurazione.
+Per impostazione predefinita, la configurazione ONNX viene inizializzata con la funzione 'predefinita'
+che corrisponde all'esportazione di un modello caricato con la classe `AutoModel`. Se tu
+desideri esportare una topologia di modello diversa, รจ sufficiente fornire una funzionalitร diversa a
+l'argomento `task` quando inizializzi la configurazione ONNX. Ad esempio, se
+volevamo esportare DistilBERT con una testa di classificazione per sequenze, potremmo
+usare:
+
+```python
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("distilbert/distilbert-base-uncased")
+>>> onnx_config_for_seq_clf = DistilBertOnnxConfig(config, task="sequence-classification")
+>>> print(onnx_config_for_seq_clf.outputs)
+OrderedDict([('logits', {0: 'batch'})])
+```
+
+
+
+Tutte le proprietร e i metodi di base associati a [`~onnx.config.OnnxConfig`] e le
+altre classi di configurazione possono essere sovrascritte se necessario. Guarda
+[`BartOnnxConfig`] per un esempio avanzato.
+
+
+
+#### Esportazione del modello
+
+Una volta implementata la configurazione ONNX, il passaggio successivo consiste nell'esportare il
+modello. Qui possiamo usare la funzione `export()` fornita dal
+pacchetto `transformers.onnx`. Questa funzione prevede la configurazione ONNX, insieme
+con il modello base e il tokenizer e il percorso per salvare il file esportato:
+
+```python
+>>> from pathlib import Path
+>>> from transformers.onnx import export
+>>> from transformers import AutoTokenizer, AutoModel
+
+>>> onnx_path = Path("model.onnx")
+>>> model_ckpt = "distilbert/distilbert-base-uncased"
+>>> base_model = AutoModel.from_pretrained(model_ckpt)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
+
+>>> onnx_inputs, onnx_outputs = export(tokenizer, base_model, onnx_config, onnx_config.default_onnx_opset, onnx_path)
+```
+
+Gli `onnx_inputs` e `onnx_outputs` restituiti dalla funzione `export()` sono
+liste di chiavi definite nelle proprietร di `input` e `output` della
+configurazione. Una volta esportato il modello, puoi verificare che il modello sia ben
+formato come segue:
+
+```python
+>>> import onnx
+
+>>> onnx_model = onnx.load("model.onnx")
+>>> onnx.checker.check_model(onnx_model)
+```
+
+
+
+Se il tuo modello รจ piรน largo di 2 GB, vedrai che molti file aggiuntivi sono
+creati durante l'esportazione. Questo รจ _previsto_ perchรฉ ONNX utilizza [Protocol
+Buffer](https://developers.google.com/protocol-buffers/) per memorizzare il modello e
+questi hanno un limite di dimensione 2 GB. Vedi la [Documentazione
+ONNX](https://github.com/onnx/onnx/blob/master/docs/ExternalData.md)
+per istruzioni su come caricare modelli con dati esterni.
+
+
+
+#### Convalida degli output del modello
+
+Il passaggio finale consiste nel convalidare gli output dal modello di base e quello esportato
+corrispondere entro una soglia di tolleranza assoluta. Qui possiamo usare la
+Funzione `validate_model_outputs()` fornita dal pacchetto `transformers.onnx`
+come segue:
+
+```python
+>>> from transformers.onnx import validate_model_outputs
+
+>>> validate_model_outputs(
+... onnx_config, tokenizer, base_model, onnx_path, onnx_outputs, onnx_config.atol_for_validation
+... )
+```
+
+Questa funzione usa il metodo `OnnxConfig.generate_dummy_inputs()` per generare
+input per il modello di base e quello esportato e la tolleranza assoluta puรฒ essere
+definita nella configurazione. Generalmente troviamo una corrispondenza numerica nell'intervallo da 1e-6
+a 1e-4, anche se รจ probabile che qualsiasi cosa inferiore a 1e-3 vada bene.
+
+### Contribuire con una nuova configurazione a ๐ค Transformers
+
+Stiamo cercando di espandere l'insieme di configurazioni giร pronte e di accettare
+contributi della community! Se vuoi contribuire con la tua aggiunta
+nella libreria, dovrai:
+
+* Implementare la configurazione ONNX nella corrispondente `configuration file
+_.py`
+* Includere l'architettura del modello e le funzioni corrispondenti in [`~onnx.features.FeatureManager`]
+* Aggiungere la tua architettura del modello ai test in `test_onnx_v2.py`
+
+Scopri come stato contribuito la configurazione per [IBERT](https://github.com/huggingface/transformers/pull/14868/files) per
+avere un'idea di cosa รจ coinvolto.
+
+## TorchScript
+
+
+
+Questo รจ l'inizio dei nostri esperimenti con TorchScript e stiamo ancora esplorando le sue capacitร con
+modelli con variable-input-size. ร una nostra prioritร e approfondiremo le nostre analisi nelle prossime versioni,
+con piรน esempi di codici, un'implementazione piรน flessibile e benchmark che confrontano i codici basati su Python con quelli compilati con
+TorchScript.
+
+
+
+Secondo la documentazione di Pytorch: "TorchScript รจ un modo per creare modelli serializzabili e ottimizzabili da codice
+Pytorch". I due moduli di Pytorch [JIT e TRACE](https://pytorch.org/docs/stable/jit.html) consentono allo sviluppatore di esportare
+il loro modello da riutilizzare in altri programmi, come i programmi C++ orientati all'efficienza.
+
+Abbiamo fornito un'interfaccia che consente l'esportazione di modelli ๐ค Transformers in TorchScript in modo che possano essere riutilizzati
+in un ambiente diverso rispetto a un programma Python basato su Pytorch. Qui spieghiamo come esportare e utilizzare i nostri modelli utilizzando
+TorchScript.
+
+Esportare un modello richiede due cose:
+
+- Un passaggio in avanti con input fittizzi.
+- Istanziazione del modello con flag `torchscript`.
+
+Queste necessitร implicano diverse cose a cui gli sviluppatori dovrebbero prestare attenzione. Questi dettagli mostrati sotto.
+
+### Flag TorchScript e pesi legati
+
+Questo flag รจ necessario perchรฉ la maggior parte dei modelli linguistici in questo repository hanno pesi legati tra il loro
+strato "Embedding" e lo strato "Decoding". TorchScript non consente l'esportazione di modelli che hanno pesi
+legati, quindi รจ necessario prima slegare e clonare i pesi.
+
+Ciรฒ implica che i modelli istanziati con il flag `torchscript` hanno il loro strato `Embedding` e strato `Decoding`
+separato, il che significa che non dovrebbero essere addestrati in futuro. L'allenamento de-sincronizza i due
+strati, portando a risultati inaspettati.
+
+Questo non รจ il caso per i modelli che non hanno una testa del modello linguistico, poichรฉ quelli non hanno pesi legati. Questi modelli
+puรฒ essere esportato in sicurezza senza il flag `torchscript`.
+
+### Input fittizi e standard lengths
+
+Gli input fittizzi sono usati per fare un modello passaggio in avanti . Mentre i valori degli input si propagano attraverso i strati,
+Pytorch tiene traccia delle diverse operazioni eseguite su ciascun tensore. Queste operazioni registrate vengono quindi utilizzate per
+creare la "traccia" del modello.
+
+La traccia viene creata relativamente alle dimensioni degli input. ร quindi vincolato dalle dimensioni dell'input
+fittizio e non funzionerร per altre lunghezze di sequenza o dimensioni batch. Quando si proverร con una dimensione diversa, ci sarร errore
+come:
+
+`La dimensione espansa del tensore (3) deve corrispondere alla dimensione esistente (7) nella dimensione non singleton 2`
+
+will be raised. Si consiglia pertanto di tracciare il modello con una dimensione di input fittizia grande almeno quanto il piรน grande
+input che verrร fornito al modello durante l'inferenza. ร possibile eseguire il padding per riempire i valori mancanti. Il modello
+sarร tracciato con una grande dimensione di input, tuttavia, anche le dimensioni della diverse matrici saranno grandi,
+risultando in piรน calcoli.
+
+Si raccomanda di prestare attenzione al numero totale di operazioni eseguite su ciascun input e di seguire da vicino le prestazioni
+durante l'esportazione di modelli di sequenza-lunghezza variabili.
+
+### Usare TorchSscript in Python
+
+Di seguito รจ riportato un esempio, che mostra come salvare, caricare modelli e come utilizzare la traccia per l'inferenza.
+
+#### Salvare un modello
+
+Questo frammento di codice mostra come usare TorchScript per esportare un `BertModel`. Qui il `BertModel` รจ istanziato secondo
+una classe `BertConfig` e quindi salvato su disco con il nome del file `traced_bert.pt`
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+
+enc = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+
+# Tokenizing input text
+text = "[CLS] Who was Jim Henson ? [SEP] Jim Henson was a puppeteer [SEP]"
+tokenized_text = enc.tokenize(text)
+
+# Masking one of the input tokens
+masked_index = 8
+tokenized_text[masked_index] = "[MASK]"
+indexed_tokens = enc.convert_tokens_to_ids(tokenized_text)
+segments_ids = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
+
+# Creating a dummy input
+tokens_tensor = torch.tensor([indexed_tokens])
+segments_tensors = torch.tensor([segments_ids])
+dummy_input = [tokens_tensor, segments_tensors]
+
+# Initializing the model with the torchscript flag
+# Flag set to True even though it is not necessary as this model does not have an LM Head.
+config = BertConfig(
+ vocab_size_or_config_json_file=32000,
+ hidden_size=768,
+ num_hidden_layers=12,
+ num_attention_heads=12,
+ intermediate_size=3072,
+ torchscript=True,
+)
+
+# Instantiating the model
+model = BertModel(config)
+
+# The model needs to be in evaluation mode
+model.eval()
+
+# If you are instantiating the model with *from_pretrained* you can also easily set the TorchScript flag
+model = BertModel.from_pretrained("google-bert/bert-base-uncased", torchscript=True)
+
+# Creating the trace
+traced_model = torch.jit.trace(model, [tokens_tensor, segments_tensors])
+torch.jit.save(traced_model, "traced_bert.pt")
+```
+
+#### Caricare un modello
+
+Questo frammento di codice mostra come caricare il `BertModel` che era stato precedentemente salvato su disco con il nome `traced_bert.pt`.
+Stiamo riutilizzando il `dummy_input` precedentemente inizializzato.
+
+```python
+loaded_model = torch.jit.load("traced_bert.pt")
+loaded_model.eval()
+
+all_encoder_layers, pooled_output = loaded_model(*dummy_input)
+```
+
+#### Utilizzare un modello tracciato per l'inferenza
+
+Usare il modello tracciato per l'inferenza รจ semplice come usare il suo metodo dunder `__call__`:
+
+```python
+traced_model(tokens_tensor, segments_tensors)
+```
+
+### Implementare modelli HuggingFace TorchScript su AWS utilizzando Neuron SDK
+
+AWS ha introdotto [Amazon EC2 Inf1](https://aws.amazon.com/ec2/instance-types/inf1/)
+famiglia di istanze per l'inferenza di machine learning a basso costo e ad alte prestazioni nel cloud.
+Le istanze Inf1 sono alimentate dal chip AWS Inferentia, un acceleratore hardware personalizzato,
+specializzato in carichi di lavoro di inferenza di deep learning.
+[AWS Neuron](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/#)
+รจ l'SDK per Inferentia che supporta il tracciamento e l'ottimizzazione dei modelli transformers per
+distribuzione su Inf1. L'SDK Neuron fornisce:
+
+
+1. API di facile utilizzo con una riga di modifica del codice per tracciare e ottimizzare un modello TorchScript per l'inferenza nel cloud.
+2. Ottimizzazioni delle prestazioni pronte all'uso per [miglioramento dei costi-prestazioni](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/benchmark/>)
+3. Supporto per i modelli di trasformatori HuggingFace costruiti con [PyTorch](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/bert_tutorial/tutorial_pretrained_bert.html)
+ o [TensorFlow](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/tensorflow/huggingface_bert/huggingface_bert.html).
+
+#### Implicazioni
+
+Modelli Transformers basati su architettura [BERT (Bidirectional Encoder Representations from Transformers)](https://huggingface.co/docs/transformers/main/model_doc/bert),
+o sue varianti come [distilBERT](https://huggingface.co/docs/transformers/main/model_doc/distilbert)
+e [roBERTa](https://huggingface.co/docs/transformers/main/model_doc/roberta)
+funzioneranno meglio su Inf1 per attivitร non generative come la question answering estrattive,
+Classificazione della sequenza, Classificazione dei token. In alternativa, generazione di testo
+le attivitร possono essere adattate per essere eseguite su Inf1, secondo questo [tutorial AWS Neuron MarianMT](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/transformers-marianmt.html).
+Ulteriori informazioni sui modelli che possono essere convertiti fuori dagli schemi su Inferentia possono essere
+trovati nella [sezione Model Architecture Fit della documentazione Neuron](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/models/models-inferentia.html#models-inferentia).
+
+#### Dipendenze
+
+L'utilizzo di AWS Neuron per convertire i modelli richiede le seguenti dipendenze e l'ambiente:
+
+* A [Neuron SDK environment](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/neuron-frameworks/pytorch-neuron/index.html#installation-guide),
+ which comes pre-configured on [AWS Deep Learning AMI](https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-inferentia-launching.html).
+
+#### Convertire un modello per AWS Neuron
+
+Usando lo stesso script come in [Usando TorchScipt in Python](https://huggingface.co/docs/transformers/main/en/serialization#using-torchscript-in-python)
+per tracciare un "BertModel", importi l'estensione del framework `torch.neuron` per accedere
+i componenti di Neuron SDK tramite un'API Python.
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+import torch.neuron
+```
+E modificare solo la riga di codice di traccia
+
+Da:
+
+```python
+torch.jit.trace(model, [tokens_tensor, segments_tensors])
+```
+
+A:
+
+```python
+torch.neuron.trace(model, [token_tensor, segments_tensors])
+```
+
+Questa modifica consente a Neuron SDK di tracciare il modello e ottimizzarlo per l'esecuzione nelle istanze Inf1.
+
+Per ulteriori informazioni sulle funzionalitร , gli strumenti, i tutorial di esempi e gli ultimi aggiornamenti di AWS Neuron SDK,
+consultare la [documentazione AWS NeuronSDK](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/index.html).
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/training.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/training.md
new file mode 100644
index 0000000000000000000000000000000000000000..21008a92bf7c6f0e091d1573791c06540dfeae13
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/it/training.md
@@ -0,0 +1,376 @@
+
+
+# Fine-tuning di un modello pre-addestrato
+
+[[open-in-colab]]
+
+Ci sono benefici significativi nell'usare un modello pre-addestrato. Si riducono i costi computazionali, l'impronta di carbonio e ti consente di usare modelli stato dell'arte senza doverli addestrare da zero. ๐ค Transformers consente l'accesso a migliaia di modelli pre-addestrati per un'ampia gamma di compiti. Quando usi un modello pre-addestrato, lo alleni su un dataset specifico per il tuo compito. Questo รจ conosciuto come fine-tuning, una tecnica di addestramento incredibilmente potente. In questa esercitazione, potrai fare il fine-tuning di un modello pre-addestrato, con un framework di deep learning a tua scelta:
+
+* Fine-tuning di un modello pre-addestrato con ๐ค Transformers [`Trainer`].
+* Fine-tuning di un modello pre-addestrato in TensorFlow con Keras.
+* Fine-tuning di un modello pre-addestrato con PyTorch.
+
+
+
+## Preparare un dataset
+
+
+
+Prima di poter fare il fine-tuning di un modello pre-addestrato, scarica un dataset e preparalo per l'addestramento. La precedente esercitazione ti ha mostrato come processare i dati per l'addestramento e adesso hai l'opportunitร di metterti alla prova!
+
+Inizia caricando il dataset [Yelp Reviews](https://huggingface.co/datasets/yelp_review_full):
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("yelp_review_full")
+>>> dataset["train"][100]
+{'label': 0,
+ 'text': 'My expectations for McDonalds are t rarely high. But for one to still fail so spectacularly...that takes something special!\\nThe cashier took my friends\'s order, then promptly ignored me. I had to force myself in front of a cashier who opened his register to wait on the person BEHIND me. I waited over five minutes for a gigantic order that included precisely one kid\'s meal. After watching two people who ordered after me be handed their food, I asked where mine was. The manager started yelling at the cashiers for \\"serving off their orders\\" when they didn\'t have their food. But neither cashier was anywhere near those controls, and the manager was the one serving food to customers and clearing the boards.\\nThe manager was rude when giving me my order. She didn\'t make sure that I had everything ON MY RECEIPT, and never even had the decency to apologize that I felt I was getting poor service.\\nI\'ve eaten at various McDonalds restaurants for over 30 years. I\'ve worked at more than one location. I expect bad days, bad moods, and the occasional mistake. But I have yet to have a decent experience at this store. It will remain a place I avoid unless someone in my party needs to avoid illness from low blood sugar. Perhaps I should go back to the racially biased service of Steak n Shake instead!'}
+```
+
+Come giร sai, hai bisogno di un tokenizer per processare il testo e includere una strategia di padding e truncation per gestire sequenze di lunghezza variabile. Per processare il dataset in un unico passo, usa il metodo [`map`](https://huggingface.co/docs/datasets/process#map) di ๐ค Datasets che applica la funzione di preprocessing all'intero dataset:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+
+>>> def tokenize_function(examples):
+... return tokenizer(examples["text"], padding="max_length", truncation=True)
+
+
+>>> tokenized_datasets = dataset.map(tokenize_function, batched=True)
+```
+
+Se vuoi, puoi creare un sottoinsieme piรน piccolo del dataset per il fine-tuning cosรฌ da ridurre il tempo necessario:
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+
+
+## Addestramento
+
+
+
+
+
+๐ค Transformers mette a disposizione la classe [`Trainer`] ottimizzata per addestrare modelli ๐ค Transformers, rendendo semplice iniziare l'addestramento senza scrivere manualmente il tuo ciclo di addestramento. L'API [`Trainer`] supporta un'ampia gamma di opzioni e funzionalitร di addestramento come logging, gradient accumulation e mixed precision.
+
+Inizia caricando il tuo modello e specificando il numero di etichette (labels) attese. Nel dataset Yelp Review [dataset card](https://huggingface.co/datasets/yelp_review_full#data-fields), sai che ci sono cinque etichette:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+
+
+Potresti vedere un warning dato che alcuni dei pesi pre-addestrati non sono stati utilizzati e altri pesi sono stati inizializzati casualmente. Non preoccuparti, รจ completamente normale! L'head pre-addestrata del modello BERT viene scartata e rimpiazzata da una classification head inizializzata casualmente. Farai il fine-tuning di questa nuova head del modello sul tuo compito di classificazione, trasferendogli la conoscenza del modello pre-addestrato.
+
+
+
+### Iperparametri per il training
+
+Successivamente, crea una classe [`TrainingArguments`] contenente tutti gli iperparametri che si possono regore nonchรฉ le variabili per attivare le differenti opzioni di addestramento. Per questa esercitazione puoi iniziare con gli [iperparametri](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments) di ddestramento predefiniti, ma sentiti libero di sperimentare per trovare la configurazione ottimale per te.
+
+Specifica dove salvare i checkpoints del tuo addestramento:
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> training_args = TrainingArguments(output_dir="test_trainer")
+```
+
+### Metriche
+
+[`Trainer`] non valuta automaticamente le performance del modello durante l'addestramento. Dovrai passare a [`Trainer`] una funzione che calcola e restituisce le metriche. La libreria ๐ค Datasets mette a disposizione una semplice funzione [`accuracy`](https://huggingface.co/metrics/accuracy) che puoi caricare con la funzione `load_metric` (guarda questa [esercitazione](https://huggingface.co/docs/datasets/metrics) per maggiori informazioni):
+
+```py
+>>> import numpy as np
+>>> from datasets import load_metric
+
+>>> metric = load_metric("accuracy")
+```
+
+Richiama `compute` su `metric` per calcolare l'accuratezza delle tue previsioni. Prima di passare le tue previsioni a `compute`, hai bisogno di convertirle in logits (ricorda che tutti i modelli ๐ค Transformers restituiscono logits):
+
+```py
+>>> def compute_metrics(eval_pred):
+... logits, labels = eval_pred
+... predictions = np.argmax(logits, axis=-1)
+... return metric.compute(predictions=predictions, references=labels)
+```
+
+Se preferisci monitorare le tue metriche di valutazione durante il fine-tuning, specifica il parametro `eval_strategy` nei tuoi training arguments per restituire le metriche di valutazione ad ogni epoca di addestramento:
+
+```py
+>>> from transformers import TrainingArguments, Trainer
+
+>>> training_args = TrainingArguments(output_dir="test_trainer", eval_strategy="epoch")
+```
+
+### Trainer
+
+Crea un oggetto [`Trainer`] col tuo modello, training arguments, dataset di training e test, e funzione di valutazione:
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+Poi metti a punto il modello richiamando [`~transformers.Trainer.train`]:
+
+```py
+>>> trainer.train()
+```
+
+
+
+
+
+
+I modelli ๐ค Transformers supportano anche l'addestramento in TensorFlow usando l'API di Keras.
+
+### Convertire dataset nel formato per TensorFlow
+
+Il [`DefaultDataCollator`] assembla tensori in lotti su cui il modello si addestrerร . Assicurati di specificare di restituire tensori per TensorFlow in `return_tensors`:
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+```
+
+
+
+[`Trainer`] usa [`DataCollatorWithPadding`] in maniera predefinita in modo da non dover specificare esplicitamente un collettore di dati.
+
+
+
+Successivamente, converti i datasets tokenizzati in TensorFlow datasets con il metodo [`to_tf_dataset`](https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.to_tf_dataset). Specifica il tuo input in `columns` e le tue etichette in `label_cols`:
+
+```py
+>>> tf_train_dataset = small_train_dataset.to_tf_dataset(
+... columns=["attention_mask", "input_ids", "token_type_ids"],
+... label_cols=["labels"],
+... shuffle=True,
+... collate_fn=data_collator,
+... batch_size=8,
+... )
+
+>>> tf_validation_dataset = small_eval_dataset.to_tf_dataset(
+... columns=["attention_mask", "input_ids", "token_type_ids"],
+... label_cols=["labels"],
+... shuffle=False,
+... collate_fn=data_collator,
+... batch_size=8,
+... )
+```
+
+### Compilazione e addestramento
+
+Carica un modello TensorFlow col numero atteso di etichette:
+
+```py
+>>> import tensorflow as tf
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+Poi compila e fai il fine-tuning del tuo modello usando [`fit`](https://keras.io/api/models/model_training_apis/) come faresti con qualsiasi altro modello di Keras:
+
+```py
+>>> model.compile(
+... optimizer=tf.keras.optimizers.Adam(learning_rate=5e-5),
+... loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
+... metrics=tf.metrics.SparseCategoricalAccuracy(),
+... )
+
+>>> model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3)
+```
+
+
+
+
+
+## Addestramento in PyTorch nativo
+
+
+
+
+
+[`Trainer`] si occupa del ciclo di addestramento e ti consente di mettere a punto un modello con una sola riga di codice. Per chi preferisse scrivere un proprio ciclo di addestramento personale, puoi anche fare il fine-tuning di un modello ๐ค Transformers in PyTorch nativo.
+
+A questo punto, potresti avere bisogno di riavviare il tuo notebook o eseguire il seguente codice per liberare un po' di memoria:
+
+```py
+del model
+del pytorch_model
+del trainer
+torch.cuda.empty_cache()
+```
+
+Successivamente, postprocessa manualmente il `tokenized_dataset` per prepararlo ad essere allenato.
+
+1. Rimuovi la colonna `text` perchรฉ il modello non accetta testo grezzo come input:
+
+ ```py
+ >>> tokenized_datasets = tokenized_datasets.remove_columns(["text"])
+ ```
+
+2. Rinomina la colonna `label` in `labels` perchรฉ il modello si aspetta che questo argomento si chiami `labels`:
+
+ ```py
+ >>> tokenized_datasets = tokenized_datasets.rename_column("label", "labels")
+ ```
+
+3. Imposta il formato del dataset per farti restituire tensori di PyTorch all'interno delle liste:
+
+ ```py
+ >>> tokenized_datasets.set_format("torch")
+ ```
+
+Poi crea un piccolo sottocampione del dataset come visto precedentemente per velocizzare il fine-tuning:
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+### DataLoader
+
+Crea un `DataLoader` per i tuoi datasets di train e test cosรฌ puoi iterare sui lotti di dati:
+
+```py
+>>> from torch.utils.data import DataLoader
+
+>>> train_dataloader = DataLoader(small_train_dataset, shuffle=True, batch_size=8)
+>>> eval_dataloader = DataLoader(small_eval_dataset, batch_size=8)
+```
+
+Carica il tuo modello con il numero atteso di etichette:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+### Ottimizzatore e learning rate scheduler
+
+Crea un ottimizzatore e il learning rate scheduler per fare il fine-tuning del modello. Usa l'ottimizzatore [`AdamW`](https://pytorch.org/docs/stable/generated/torch.optim.AdamW.html) di PyTorch:
+
+```py
+>>> from torch.optim import AdamW
+
+>>> optimizer = AdamW(model.parameters(), lr=5e-5)
+```
+
+Crea il learning rate scheduler predefinito da [`Trainer`]:
+
+```py
+>>> from transformers import get_scheduler
+
+>>> num_epochs = 3
+>>> num_training_steps = num_epochs * len(train_dataloader)
+>>> lr_scheduler = get_scheduler(
+... name="linear", optimizer=optimizer, num_warmup_steps=0, num_training_steps=num_training_steps
+... )
+```
+
+Infine specifica come `device` da usare una GPU se ne hai una. Altrimenti, l'addestramento su una CPU puรฒ richiedere diverse ore invece di un paio di minuti.
+
+```py
+>>> import torch
+
+>>> device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+>>> model.to(device)
+```
+
+
+
+Ottieni l'accesso gratuito a una GPU sul cloud se non ne possiedi una usando un notebook sul web come [Colaboratory](https://colab.research.google.com/) o [SageMaker StudioLab](https://studiolab.sagemaker.aws/).
+
+
+
+Ottimo, adesso possiamo addestrare! ๐ฅณ
+
+### Training loop
+
+Per tenere traccia dei tuoi progressi durante l'addestramento, usa la libreria [tqdm](https://tqdm.github.io/) per aggiungere una progress bar sopra il numero dei passi di addestramento:
+
+```py
+>>> from tqdm.auto import tqdm
+
+>>> progress_bar = tqdm(range(num_training_steps))
+
+>>> model.train()
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... outputs = model(**batch)
+... loss = outputs.loss
+... loss.backward()
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+### Metriche
+
+Proprio come รจ necessario aggiungere una funzione di valutazione del [`Trainer`], รจ necessario fare lo stesso quando si scrive il proprio ciclo di addestramento. Ma invece di calcolare e riportare la metrica alla fine di ogni epoca, questa volta accumulerai tutti i batch con [`add_batch`](https://huggingface.co/docs/datasets/package_reference/main_classes?highlight=add_batch#datasets.Metric.add_batch) e calcolerai la metrica alla fine.
+
+```py
+>>> metric = load_metric("accuracy")
+>>> model.eval()
+>>> for batch in eval_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... with torch.no_grad():
+... outputs = model(**batch)
+
+... logits = outputs.logits
+... predictions = torch.argmax(logits, dim=-1)
+... metric.add_batch(predictions=predictions, references=batch["labels"])
+
+>>> metric.compute()
+```
+
+
+
+
+
+## Altre risorse
+
+Per altri esempi sul fine-tuning, fai riferimento a:
+
+- [๐ค Transformers Examples](https://github.com/huggingface/transformers/tree/main/examples) include scripts per addestrare compiti comuni di NLP in PyTorch e TensorFlow.
+
+- [๐ค Transformers Notebooks](notebooks) contiene diversi notebooks su come mettere a punto un modello per compiti specifici in PyTorch e TensorFlow.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/_toctree.yml b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/_toctree.yml
new file mode 100644
index 0000000000000000000000000000000000000000..cbc19313f3a03e3a3c52e4dcfe1d3f4ce8fad207
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/_toctree.yml
@@ -0,0 +1,396 @@
+- sections:
+ - local: index
+ title: ๐ค Transformers
+ - local: quicktour
+ title: ใฏใคใใฏใใขใผ
+ - local: installation
+ title: ใคใณในใใผใซ
+ title: Get started
+- sections:
+ - local: pipeline_tutorial
+ title: ใใคใใฉใคใณใไฝฟ็จใใฆๆจ่ซใๅฎ่กใใ
+ - local: autoclass_tutorial
+ title: AutoClass ใไฝฟ็จใใฆ็งปๆคๅฏ่ฝใชใณใผใใไฝๆใใ
+ - local: preprocessing
+ title: ใใผใฟใฎๅๅฆ็
+ - local: training
+ title: ไบๅใใฌใผใใณใฐใใใใขใใซใๅพฎ่ชฟๆดใใ
+ - local: run_scripts
+ title: ในใฏใชใใใไฝฟ็จใใฆใใฌใผใใณใฐใใ
+ - local: accelerate
+ title: ๐ค Accelerate ใไฝฟ็จใใฆๅๆฃใใฌใผใใณใฐใใปใใใขใใใใ
+ - local: peft
+ title: ๐ค PEFT ใไฝฟ็จใใฆใขใใใฟใผใใญใผใใใฆใใฌใผใใณใฐใใ
+ - local: model_sharing
+ title: ใขใใซใๅ
ฑๆใใ
+ - local: transformers_agents
+ title: ใจใผใธใงใณใ
+ - local: llm_tutorial
+ title: LLM ใไฝฟ็จใใ็ๆ
+ title: Tutorials
+- sections:
+ - isExpanded: false
+ sections:
+ - local: tasks/sequence_classification
+ title: ใใญในใใฎๅ้ก
+ - local: tasks/token_classification
+ title: ใใผใฏใณใฎๅ้ก
+ - local: tasks/question_answering
+ title: ่ณช็ๅฟ็ญ
+ - local: tasks/language_modeling
+ title: ๅ ๆ่จ่ชใขใใชใณใฐ
+ - local: tasks/masked_language_modeling
+ title: ใในใฏใใใ่จ่ชใขใใชใณใฐ
+ - local: tasks/translation
+ title: ็ฟป่จณ
+ - local: tasks/summarization
+ title: ่ฆ็ด
+ - local: tasks/multiple_choice
+ title: ่คๆฐใฎ้ธๆ่ข
+ title: ่ช็ถ่จ่ชๅฆ็
+ - isExpanded: false
+ sections:
+ - local: tasks/audio_classification
+ title: ้ณๅฃฐใฎๅ้ก
+ - local: tasks/asr
+ title: ่ชๅ้ณๅฃฐ่ช่ญ
+ title: ใชใผใใฃใช
+ - isExpanded: false
+ sections:
+ - local: tasks/image_classification
+ title: ็ปๅๅ้ก
+ - local: tasks/semantic_segmentation
+ title: ใปใใณใใฃใใฏใปใฐใกใณใใผใทใงใณ
+ - local: tasks/video_classification
+ title: ใใใชใฎๅ้ก
+ - local: tasks/object_detection
+ title: ็ฉไฝๆคๅบ
+ - local: tasks/zero_shot_object_detection
+ title: ใผใญใทใงใใ็ฉไฝๆคๅบ
+ - local: tasks/zero_shot_image_classification
+ title: ใผใญใทใงใใ็ปๅๅ้ก
+ - local: tasks/monocular_depth_estimation
+ title: ๆทฑใใฎๆจๅฎ
+ - local: tasks/image_to_image
+ title: ็ปๅใใ็ปๅใธ
+ - local: tasks/knowledge_distillation_for_image_classification
+ title: ใณใณใใฅใผใฟใใธใงใณใฎใใใฎ็ฅ่ญใฎ่ธ็
+ title: ใณใณใใฅใผใฟใใธใงใณ
+ - isExpanded: false
+ sections:
+ - local: tasks/image_captioning
+ title: ็ปๅใฎใญใฃใใทใงใณ
+ - local: tasks/document_question_answering
+ title: ๆๆธใฎ่ณชๅใธใฎๅ็ญ
+ - local: tasks/visual_question_answering
+ title: ่ฆ่ฆ็ใช่ณชๅใธใฎๅ็ญ
+ - local: tasks/text-to-speech
+ title: ใใญในใ่ชญใฟไธใ
+ title: ใใซใใขใผใใซ
+ - isExpanded: false
+ sections:
+ - local: generation_strategies
+ title: ็ๆๆฆ็ฅใใซในใฟใใคใบใใ
+ title: ไธไปฃ
+ - isExpanded: false
+ sections:
+ - local: tasks/idefics
+ title: IDEFICS ใไฝฟ็จใใใคใกใผใธ ใฟในใฏ
+ - local: tasks/prompting
+ title: LLM ใใญใณใใ ใฌใคใ
+ title: ใใญใณใใ
+ title: Task Guides
+- sections:
+ - local: fast_tokenizers
+ title: ๐ค ใใผใฏใใคใถใผใฎ้ซ้ใใผใฏใใคใถใผใไฝฟ็จใใ
+ - local: multilingual
+ title: ๅค่จ่ชใขใใซใงๆจ่ซใๅฎ่กใใ
+ - local: create_a_model
+ title: ใขใใซๅบๆใฎ API ใไฝฟ็จใใ
+ - local: custom_models
+ title: ใซในใฟใ ใขใใซใๅ
ฑๆใใ
+ - local: chat_templating
+ title: ใใฃใใใขใใซใฎใใณใใฌใผใ
+ - local: serialization
+ title: ONNX ใธใฎใจใฏในใใผใ
+ - local: tflite
+ title: TFLite ใธใฎใจใฏในใใผใ
+ - local: torchscript
+ title: ใใผใในใฏใชใใใธใฎใจใฏในใใผใ
+ - local: benchmarks
+ title: ใใณใใใผใฏ
+ - local: community
+ title: ใณใใฅใใใฃใชใฝใผใน
+ - local: custom_tools
+ title: ใซในใฟใ ใใผใซใจใใญใณใใ
+ - local: troubleshooting
+ title: ใใฉใใซใทใฅใผใใฃใณใฐ
+ title: ้็บ่
ใฌใคใ
+- sections:
+ - local: performance
+ title: ๆฆ่ฆ
+ - sections:
+ - local: perf_train_gpu_one
+ title: ๅไธใฎ GPU ใงๅน็็ใซใใฌใผใใณใฐใใใใใฎๆนๆณใจใใผใซ
+ - local: perf_train_gpu_many
+ title: ่คๆฐใฎ GPU ใจไธฆๅๅฆ็
+ - local: perf_train_cpu
+ title: CPU ใงใฎๅน็็ใชใใฌใผใใณใฐ
+ - local: perf_train_cpu_many
+ title: ๅๆฃCPUใใฌใผใใณใฐ
+ - local: perf_train_tpu
+ title: TPU ใซ้ขใใใใฌใผใใณใฐ
+ - local: perf_train_tpu_tf
+ title: TensorFlow ใไฝฟ็จใใ TPU ใฎใใฌใผใใณใฐ
+ - local: perf_train_special
+ title: ็นๆฎใชใใผใใฆใงใขใซ้ขใใใใฌใผใใณใฐ
+ - local: perf_hardware
+ title: ใใฌใผใใณใฐ็จใฎใซในใฟใ ใใผใใฆใงใข
+ - local: hpo_train
+ title: Trainer API ใไฝฟ็จใใใใคใใผใใฉใกใผใฟๆค็ดข
+ title: ๅน็็ใชใใฌใผใใณใฐใใฏใใใฏ
+ - sections:
+ - local: perf_infer_cpu
+ title: CPUใงใฎๆจ่ซ
+ - local: perf_infer_gpu_one
+ title: 1 ใคใฎ GPU ใงใฎๆจ่ซ
+ - local: perf_infer_gpu_many
+ title: ๅคใใฎ GPU ใงใฎๆจ่ซ
+ - local: perf_infer_special
+ title: ็นๆฎใชใใผใใฆใงใขใงใฎๆจ่ซ
+ title: ๆจ่ซใฎๆ้ฉๅ
+ - local: big_models
+ title: ๅคงใใชใขใใซใฎใคใณในใฟใณในๅ
+ - local: tf_xla
+ title: TensorFlowใขใใซใฎXLA็ตฑๅ
+ - local: perf_torch_compile
+ title: torch.compile()ใไฝฟ็จใใๆจ่ซใฎๆ้ฉๅ
+ title: ใใใฉใผใใณในใจในใฑใผใฉใใชใใฃ
+- sections:
+ - local: add_new_model
+ title: ๐ค Transformersใซใขใใซใ่ฟฝๅ ใใๆนๆณ
+ - local: testing
+ title: ใในใ
+ - local: pr_checks
+ title: ใใซใชใฏใจในใใฎใใงใใฏ
+ title: ่ฒข็ฎใใ
+- sections:
+ - local: philosophy
+ title: ใใฃใญใฝใใฃใผ
+ - local: glossary
+ title: ็จ่ช้
+ - local: task_summary
+ title: ๐ค Transformersใฎๆฉ่ฝ
+ - local: tasks_explained
+ title: ๐ค Transformersใใฟในใฏใ่งฃๆฑบใใๆนๆณ
+ - local: model_summary
+ title: Transformerใขใใซใใกใใชใผ
+ - local: tokenizer_summary
+ title: ใใผใฏใใคใถใผใฎๆฆ่ฆ
+ - local: attention
+ title: ๆณจๆๆฉๆง
+ - local: pad_truncation
+ title: ใใใฃใณใฐใจๅใ่ฉฐใ
+ - local: bertology
+ title: BERTology
+ - local: perplexity
+ title: ๅบๅฎ้ทใขใใซใฎใใผใใฌใญใทใใฃ
+ - local: pipeline_webserver
+ title: Webใตใผใใผๆจ่ซ็จใใคใใฉใคใณ
+ - local: model_memory_anatomy
+ title: ใขใใซใใฌใผใใณใฐใฎ่งฃๅๅญฆ
+ title: ใณใณใปใใใฅใขใซใฌใคใ
+- sections:
+ - sections:
+ - local: main_classes/agent
+ title: ใจใผใธใงใณใใจใใผใซ
+ - local: model_doc/auto
+ title: Auto Classes
+ - local: main_classes/callback
+ title: ใณใผใซใใใฏ
+ - local: main_classes/configuration
+ title: ๆงๆ
+ - local: main_classes/data_collator
+ title: ใใผใฟ็
งๅ่
+ - local: main_classes/keras_callbacks
+ title: Keras ใณใผใซใใใฏ
+ - local: main_classes/logging
+ title: ใญใฎใณใฐ
+ - local: main_classes/model
+ title: ใขใใซ
+ - local: main_classes/text_generation
+ title: ใใญในใใฎ็ๆ
+ - local: main_classes/onnx
+ title: ONNX
+ - local: main_classes/optimizer_schedules
+ title: ๆ้ฉๅ
+ - local: main_classes/output
+ title: ใขใใซใฎๅบๅ
+ - local: main_classes/pipelines
+ title: ใใคใใฉใคใณ
+ - local: main_classes/processors
+ title: ใใญใปใใตใผ
+ - local: main_classes/quantization
+ title: ้ๅญๅ
+ - local: main_classes/tokenizer
+ title: ใใผใฏใใคใถใผ
+ - local: main_classes/trainer
+ title: ใใฌใผใใผ
+ - local: main_classes/deepspeed
+ title: ใใฃใผใในใใผใใฎ็ตฑๅ
+ - local: main_classes/feature_extractor
+ title: ็นๅพดๆฝๅบๅจ
+ - local: main_classes/image_processor
+ title: ็ปๅๅฆ็ใใญใปใใต
+ title: ไธป่ฆใชใฏใฉใน
+ - sections:
+ - isExpanded: false
+ sections:
+ - local: model_doc/albert
+ title: ALBERT
+ - local: model_doc/bart
+ title: BART
+ - local: model_doc/barthez
+ title: BARThez
+ - local: model_doc/bartpho
+ title: BARTpho
+ - local: model_doc/bert
+ title: BERT
+ - local: model_doc/bert-generation
+ title: BertGeneration
+ - local: model_doc/bert-japanese
+ title: BertJapanese
+ - local: model_doc/bertweet
+ title: Bertweet
+ - local: model_doc/big_bird
+ title: BigBird
+ - local: model_doc/bigbird_pegasus
+ title: BigBirdPegasus
+ - local: model_doc/biogpt
+ title: BioGpt
+ - local: model_doc/blenderbot
+ title: Blenderbot
+ - local: model_doc/blenderbot-small
+ title: Blenderbot Small
+ - local: model_doc/bloom
+ title: BLOOM
+ - local: model_doc/bort
+ title: BORT
+ - local: model_doc/byt5
+ title: ByT5
+ - local: model_doc/camembert
+ title: CamemBERT
+ - local: model_doc/canine
+ title: CANINE
+ - local: model_doc/codegen
+ title: CodeGen
+ - local: model_doc/code_llama
+ title: CodeLlama
+ - local: model_doc/convbert
+ title: ConvBERT
+ - local: model_doc/cpm
+ title: CPM
+ - local: model_doc/cpmant
+ title: CPMANT
+ - local: model_doc/ctrl
+ title: CTRL
+ - local: model_doc/deberta
+ title: DeBERTa
+ - local: model_doc/deberta-v2
+ title: DeBERTa-v2
+ - local: model_doc/dialogpt
+ title: DialoGPT
+ title: ๆ็ซ ใขใใซ
+ - isExpanded: false
+ sections:
+ - local: model_doc/beit
+ title: BEiT
+ - local: model_doc/bit
+ title: BiT
+ - local: model_doc/conditional_detr
+ title: Conditional DETR
+ - local: model_doc/convnext
+ title: ConvNeXT
+ - local: model_doc/convnextv2
+ title: ConvNeXTV2
+ - local: model_doc/cvt
+ title: CvT
+ - local: model_doc/deformable_detr
+ title: Deformable DETR
+ - local: model_doc/deit
+ title: DeiT
+ - local: model_doc/deta
+ title: DETA
+ - local: model_doc/detr
+ title: DETR
+ - local: model_doc/dinat
+ title: DiNAT
+ title: ใใธใงใณใขใใซ
+ - isExpanded: false
+ sections:
+ - local: model_doc/audio-spectrogram-transformer
+ title: Audio Spectrogram Transformer
+ - local: model_doc/bark
+ title: Bark
+ - local: model_doc/clap
+ title: CLAP
+ title: ้ณๅฃฐใขใใซ
+ - isExpanded: false
+ sections:
+ - local: model_doc/align
+ title: ALIGN
+ - local: model_doc/altclip
+ title: AltCLIP
+ - local: model_doc/blip
+ title: BLIP
+ - local: model_doc/blip-2
+ title: BLIP-2
+ - local: model_doc/bridgetower
+ title: BridgeTower
+ - local: model_doc/bros
+ title: BROS
+ - local: model_doc/chinese_clip
+ title: Chinese-CLIP
+ - local: model_doc/clip
+ title: CLIP
+ - local: model_doc/clipseg
+ title: CLIPSeg
+ - local: model_doc/clvp
+ title: CLVP
+ - local: model_doc/data2vec
+ title: Data2Vec
+ - local: model_doc/deplot
+ title: DePlot
+ title: ใใซใใขใผใใซใขใใซ
+ - isExpanded: false
+ sections:
+ - local: model_doc/decision_transformer
+ title: Decision Transformer
+ title: ๅผทๅๅญฆ็ฟใขใใซ
+ - isExpanded: false
+ sections:
+ - local: model_doc/autoformer
+ title: Autoformer
+ title: ๆ็ณปๅใขใใซ
+ title: ใขใใซ
+ - sections:
+ - local: internal/modeling_utils
+ title: ใซในใฟใ ใฌใคใคใผใจใฆใผใใฃใชใใฃ
+ - local: internal/pipelines_utils
+ title: ใใคใใฉใคใณ็จใฎใฆใผใใฃใชใใฃ
+ - local: internal/tokenization_utils
+ title: ใ=ใผใฏใใคใถใผ็จใฎใฆใผใใฃใชใใฃ
+ - local: internal/trainer_utils
+ title: ใใฌใผใใผ็จใฆใผใใฃใชใใฃ
+ - local: internal/generation_utils
+ title: ็บ้ป็จใฆใผใใฃใชใใฃ
+ - local: internal/image_processing_utils
+ title: ็ปๅใใญใปใใต็จใฆใผใใฃใชใใฃ
+ - local: internal/audio_utils
+ title: ใชใผใใฃใชๅฆ็็จใฎใฆใผใใฃใชใใฃ
+ - local: internal/file_utils
+ title: ไธ่ฌๅ
ฌๅ
ฑไบๆฅญ
+ - local: internal/time_series_utils
+ title: ๆ็ณปๅ็จใฎใฆใผใใฃใชใใฃ
+ title: ๅ
้จใใซใใผ
+ title: API
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/accelerate.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/accelerate.md
new file mode 100644
index 0000000000000000000000000000000000000000..73e45b9cd3c5ecbbf950698cdb7a3dd34d6f2f92
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/accelerate.md
@@ -0,0 +1,136 @@
+
+
+# ๐ค Accelerate ใ็จใใๅๆฃๅญฆ็ฟ
+
+ใขใใซใๅคงใใใชใใซใคใใฆใ้ใใใใใผใใฆใงใขใงใใๅคงใใชใขใใซใ่จ็ทดใใ่จ็ทด้ๅบฆใๅคงๅน
ใซไธๆใใใใใใฎๆนๆณใจใใฆไธฆๅๅฆ็ใๆตฎไธใใฆใใพใใใ1ๅฐใฎใใทใณใซ่คๆฐใฎGPUใใใฃใฆใใ่คๆฐใฎใใทใณใซใพใใใ่คๆฐใฎGPUใใใฃใฆใใใใใใใฟใคใใฎๅๆฃๅฆ็ใปใใใขใใไธใงใฆใผใถใผใ็ฐกๅใซ ๐ค Transformers ใขใใซใ่จ็ทดใงใใใใใซใ Hugging Face ใงใฏ [๐ค Accelerate](https://huggingface.co/docs/accelerate) ใฉใคใใฉใชใไฝๆใใพใใใใใฎใใฅใผใใชใขใซใงใฏใPyTorch ใฎ่จ็ทดใซใผใใใซในใฟใใคใบใใฆใๅๆฃๅฆ็็ฐๅขใงใฎ่จ็ทดใๅฏ่ฝใซใใๆนๆณใซใคใใฆๅญฆใณใพใใ
+
+## ใปใใใขใใ
+
+ใฏใใใซ ๐ค Accelerate ใใคใณในใใผใซใใพใใใ:
+
+```bash
+pip install accelerate
+```
+
+ใใใใใคใณใใผใใใฆ [`~accelerate.Accelerator`] ใชใใธใงใฏใใไฝๆใใพใใใใ[`~accelerate.Accelerator`] ใฏๅๆฃๅฆ็ใปใใใขใใใ่ชๅ็ใซๆคๅบใใ่จ็ทดใฎใใใซๅฟ
่ฆใชๅ
จใฆใฎใณใณใใผใใณใใๅๆๅใใพใใใขใใซใใใใคในใซๆ็คบ็ใซ้
็ฝฎใใๅฟ
่ฆใฏใใใพใใใ
+
+```py
+>>> from accelerate import Accelerator
+
+>>> accelerator = Accelerator()
+```
+
+## Accelerate ใใๆบๅใใใพใใใ
+
+ๆฌกใซใ้ข้ฃใใๅ
จใฆใฎ่จ็ทดใชใใธใงใฏใใ [`~accelerate.Accelerator.prepare`] ใกใฝใใใซๆธกใใพใใใใใซใฏใ่จ็ทดใจ่ฉไพกใใใใใฎDataloaderใใขใใซใoptimizer ใๅซใพใใพใ:
+
+```py
+>>> train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
+... train_dataloader, eval_dataloader, model, optimizer
+... )
+```
+
+## Backward
+
+ๆๅพใซ่จ็ทดใซใผใๅ
ใฎ `loss.backward()` ใ ๐ค Accelerate ใฎ [`~accelerate.Accelerator.backward`] ใกใฝใใใง็ฝฎใๆใใพใ๏ผ
+
+```py
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... outputs = model(**batch)
+... loss = outputs.loss
+... accelerator.backward(loss)
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+ไปฅไธใฎใณใผใใง็ขบ่ชใงใใ้ใใ่จ็ทดใซใผใใซ4่กใฎใณใผใใ่ฟฝๅ ใใใ ใใงๅๆฃๅญฆ็ฟใๅฏ่ฝใงใ๏ผ
+
+```diff
++ from accelerate import Accelerator
+ from transformers import AdamW, AutoModelForSequenceClassification, get_scheduler
+
++ accelerator = Accelerator()
+
+ model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
+ optimizer = AdamW(model.parameters(), lr=3e-5)
+
+- device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+- model.to(device)
+
++ train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
++ train_dataloader, eval_dataloader, model, optimizer
++ )
+
+ num_epochs = 3
+ num_training_steps = num_epochs * len(train_dataloader)
+ lr_scheduler = get_scheduler(
+ "linear",
+ optimizer=optimizer,
+ num_warmup_steps=0,
+ num_training_steps=num_training_steps
+ )
+
+ progress_bar = tqdm(range(num_training_steps))
+
+ model.train()
+ for epoch in range(num_epochs):
+ for batch in train_dataloader:
+- batch = {k: v.to(device) for k, v in batch.items()}
+ outputs = model(**batch)
+ loss = outputs.loss
+- loss.backward()
++ accelerator.backward(loss)
+
+ optimizer.step()
+ lr_scheduler.step()
+ optimizer.zero_grad()
+ progress_bar.update(1)
+```
+
+## ่จ็ทดใใ
+
+้ข้ฃใใใณใผใใ่ฟฝๅ ใใใใในใฏใชใใใพใใฏ Colaboratory ใชใฉใฎใใผใใใใฏใง่จ็ทดใ้ๅงใใพใใ
+
+### ในใฏใชใใใง่จ็ทดใใ
+
+ในใฏใชใใใใ่จ็ทดใใใฆใใๅ ดๅใฏใ่จญๅฎใใกใคใซใไฝๆใปไฟๅญใใใใใซไปฅไธใฎใณใใณใใๅฎ่กใใฆใใ ใใ:
+
+```bash
+accelerate config
+```
+
+ใใใฆๆฌกใฎใใใซใใฆ่จ็ทดใ้ๅงใใพใ:
+
+```bash
+accelerate launch train.py
+```
+
+### ใใผใใใใฏใง่จ็ทดใใ
+
+Colaboratory ใฎ TPU ใฎๅฉ็จใใ่ใใฎๅ ดๅใ๐ค Accelerate ใฏใใผใใใใฏไธใงๅฎ่กใใใใจใใงใใพใใ่จ็ทดใซๅฟ
่ฆใชๅ
จใฆใฎใณใผใใ้ขๆฐใซๅซใใ[`~accelerate.notebook_launcher`] ใซๆธกใใฆใใ ใใ:
+
+```py
+>>> from accelerate import notebook_launcher
+
+>>> notebook_launcher(training_function)
+```
+
+๐ค Accelerate ใจ่ฑๅฏใชๆฉ่ฝใซใคใใฆใใฃใจ็ฅใใใๆนใฏ[ใใญใฅใกใณใ](https://huggingface.co/docs/accelerate)ใๅ็
งใใฆใใ ใใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/add_new_model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/add_new_model.md
new file mode 100644
index 0000000000000000000000000000000000000000..1067cbaac72eca77fbf484ae0b8738a852b69058
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/add_new_model.md
@@ -0,0 +1,751 @@
+
+
+# How to add a model to ๐ค Transformers?
+
+๐ค Transformersใฉใคใใฉใชใฏใใณใใฅใใใฃใฎ่ฒข็ฎ่
ใฎใใใใงๆฐใใใขใใซใๆไพใงใใใใจใใใใใใพใใ
+ใใใใใใใฏ้ฃใใใใญใธใงใฏใใงใใใ๐ค Transformersใฉใคใใฉใชใจๅฎ่ฃ
ใใใขใใซใซใคใใฆใฎๆทฑใ็ฅ่ญใๅฟ
่ฆใงใใ
+Hugging Faceใงใฏใใณใใฅใใใฃใฎๅคใใฎไบบใ
ใซ็ฉๆฅต็ใซใขใใซใ่ฟฝๅ ใใๅใไธใใใใจๅชๅใใฆใใใ
+ใใฎใฌใคใใใพใจใใฆใPyTorchใขใใซใ่ฟฝๅ ใใใใญใปในใ่ชฌๆใใพใ๏ผ[PyTorchใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใ](https://pytorch.org/get-started/locally/)๏ผใ
+
+ใใฎ้็จใงใไปฅไธใฎใใจใๅญฆใณใพใ๏ผ
+
+- ใชใผใใณใฝใผในใฎใในใใใฉใฏใใฃในใซ้ขใใๆดๅฏ
+- ๆใไบบๆฐใฎใใๆทฑๅฑคๅญฆ็ฟใฉใคใใฉใชใฎ่จญ่จๅๅใ็่งฃใใ
+- ๅคง่ฆๆจกใชใขใใซใๅน็็ใซใในใใใๆนๆณใๅญฆใถ
+- `black`ใ`ruff`ใใใใณ`make fix-copies`ใชใฉใฎPythonใฆใผใใฃใชใใฃใ็ตฑๅใใฆใใฏใชใผใณใง่ชญใฟใใใใณใผใใ็ขบไฟใใๆนๆณใๅญฆใถ
+
+Hugging Faceใใผใ ใฎใกใณใใผใใตใใผใใๆไพใใใฎใงใไธไบบใผใฃใกใซใชใใใจใฏใใใพใใใ ๐ค โค๏ธ
+
+ใใใๅงใใพใใใ๏ผ๐ค Transformersใง่ฆใใใขใใซใซใคใใฆใฎ[New model addition](https://github.com/huggingface/transformers/issues/new?assignees=&labels=New+model&template=new-model-addition.yml)ใฎใคใทใฅใผใ้ใใฆใใ ใใใ
+็นๅฎใฎใขใใซใๆไพใใใใจใซ็นใซใใ ใใใใชใๅ ดๅใ[New model label](https://github.com/huggingface/transformers/labels/New%20model)ใงๆชๅฒใๅฝใฆใฎใขใใซใชใฏใจในใใใใใใฉใใใ็ขบ่ชใใฆใใใใซๅใ็ตใใใจใใงใใพใใ
+
+ๆฐใใใขใใซใชใฏใจในใใ้ใใใใๆๅใฎในใใใใฏ๐ค Transformersใใใ็่งฃใใใใจใงใ๏ผ
+
+## General overview of ๐ค Transformers
+
+ใพใใ๐ค Transformersใฎไธ่ฌ็ใชๆฆ่ฆใๆๆกใใๅฟ
่ฆใใใใพใใ๐ค Transformersใฏ้ๅธธใซๆ่ฆใๅใใใใฉใคใใฉใชใงใใฎใงใ
+ใฉใคใใฉใชใฎๅฒๅญฆใ่จญ่จ้ธๆใซใคใใฆๅๆใงใใชใๅฏ่ฝๆงใใใใพใใใใ ใใ็งใใกใฎ็ต้จใใใใฉใคใใฉใชใฎๅบๆฌ็ใช่จญ่จ้ธๆใจๅฒๅญฆใฏใ
+๐ค Transformersใๅน็็ใซในใฑใผใชใณใฐใใ้ฉๅใชใฌใใซใงไฟๅฎใณในใใๆใใใใใซไธๅฏๆฌ ใงใใ
+
+ใฉใคใใฉใชใฎ็่งฃใๆทฑใใใใใฎ่ฏใๅบ็บ็นใฏใ[ๅฒๅญฆใฎใใญใฅใกใณใ](philosophy)ใ่ชญใใใจใงใใ
+็งใใกใฎไฝๆฅญๆนๆณใฎ็ตๆใใในใฆใฎใขใใซใซ้ฉ็จใใใใจใใใใใคใใฎ้ธๆ่ขใใใใพใ๏ผ
+
+- ไธ่ฌ็ใซใๆฝ่ฑกๅใใใๆงๆใๅชๅ
ใใใพใใ
+- ใณใผใใฎ้่คใฏใ่ชญใฟใใใใใขใฏใปในๅฏ่ฝๆงใๅคงๅน
ใซๅไธใใใๅ ดๅใๅฟ
ใใใๆชใใใใงใฏใใใพใใใ
+- ใขใใซใใกใคใซใฏใงใใใ ใ่ชๅทฑๅฎ็ต็ใงใใในใใงใ็นๅฎใฎใขใใซใฎใณใผใใ่ชญใ้ใซใฏใ็ๆณ็ใซใฏ่ฉฒๅฝใใ`modeling_....py`ใใกใคใซใฎใฟใ่ฆใๅฟ
่ฆใใใใพใใ
+
+็งใใกใฎๆ่ฆใงใฏใใใฎใฉใคใใฉใชใฎใณใผใใฏๅใชใ่ฃฝๅใๆไพใใๆๆฎตใ ใใงใชใใ*ไพใใฐใๆจ่ซใฎใใใซBERTใไฝฟ็จใใ่ฝๅ*ใชใฉใฎ่ฃฝๅใใฎใใฎ.
+
+### Overview of models
+
+ใขใใซใๆญฃๅธธใซ่ฟฝๅ ใใใใใซใฏใใขใใซใจใใฎ่จญๅฎใ[`PreTrainedModel`]ใใใใณ[`PretrainedConfig`]ใฎ็ธไบไฝ็จใ็่งฃใใใใจใ้่ฆใงใใ
+ไพ็คบ็ใช็ฎ็ใงใ๐ค Transformersใซ่ฟฝๅ ใใใขใใซใใBrandNewBertใใจๅผใณใพใใ
+
+ไปฅไธใใ่ฆงใใ ใใ๏ผ
+
+
+
+ใ่ฆงใฎใใใซใ๐ค Transformersใงใฏ็ถๆฟใไฝฟ็จใใฆใใพใใใๆฝ่ฑกๅใฎใฌใใซใๆๅฐ้ใซไฟใฃใฆใใพใใ
+ใฉใคใใฉใชๅ
ใฎใฉใฎใขใใซใซใใๆฝ่ฑกๅใฎใฌใใซใ2ใคใ่ถ
ใใใใจใฏใใใพใใใ
+`BrandNewBertModel` ใฏ `BrandNewBertPreTrainedModel` ใ็ถๆฟใใใใใซ[`PreTrainedModel`]ใ็ถๆฟใใฆใใพใใ
+ใใใ ใใงใใ
+ไธ่ฌ็ใชใซใผใซใจใใฆใๆฐใใใขใใซใฏ[`PreTrainedModel`]ใซใฎใฟไพๅญใใใใใซใใใใจ่ใใฆใใพใใ
+ใในใฆใฎๆฐใใใขใใซใซ่ชๅ็ใซๆไพใใใ้่ฆใชๆฉ่ฝใฏใ[`~PreTrainedModel.from_pretrained`]ใใใณ
+[`~PreTrainedModel.save_pretrained`]ใงใใ
+ใใใใฏใทใชใขใฉใคใผใผใทใงใณใจใใทใชใขใฉใคใผใผใทใงใณใซไฝฟ็จใใใพใใ
+`BrandNewBertModel.forward`ใชใฉใฎไปใฎ้่ฆใชๆฉ่ฝใฏใๆฐใใใmodeling_brand_new_bert.pyใในใฏใชใใใงๅฎๅ
จใซๅฎ็พฉใใใในใใงใใ
+ๆฌกใซใ็นๅฎใฎใใใใฌใคใคใผใๆใคใขใใซ๏ผใใจใใฐ `BrandNewBertForMaskedLM` ๏ผใ `BrandNewBertModel` ใ็ถๆฟใใใฎใงใฏใชใใ
+ๆฝ่ฑกๅใฎใฌใใซใไฝใไฟใคใใใซใใใฎใใฉใฏใผใใในใง `BrandNewBertModel` ใๅผใณๅบใใณใณใใผใใณใใจใใฆไฝฟ็จใใใใใใซใใใใจ่ใใฆใใพใใ
+ๆฐใใใขใใซใซใฏๅธธใซ `BrandNewBertConfig` ใจใใ่จญๅฎใฏใฉในใๅฟ
่ฆใงใใใใฎ่จญๅฎใฏๅธธใซ[`PreTrainedModel`]ใฎๅฑๆงใจใใฆไฟๅญใใใ
+ใใใใฃใฆใ`BrandNewBertPreTrainedModel`ใใ็ถๆฟใใใในใฆใฎใฏใฉในใง`config`ๅฑๆงใไปใใฆใขใฏใปในใงใใพใใ
+
+```python
+model = BrandNewBertModel.from_pretrained("brandy/brand_new_bert")
+model.config # model has access to its config
+```
+
+ใขใใซใจๅๆงใซใ่จญๅฎใฏ[`PretrainedConfig`]ใใๅบๆฌ็ใชใทใชใขใซๅใใใณ้ใทใชใขใซๅใฎๆฉ่ฝใ็ถๆฟใใฆใใพใใๆณจๆใในใใฏใ่จญๅฎใจใขใใซใฏๅธธใซ2ใคใฎ็ฐใชใๅฝขๅผใซใทใชใขใซๅใใใใใจใงใ - ใขใใซใฏ*pytorch_model.bin*ใใกใคใซใซใ่จญๅฎใฏ*config.json*ใใกใคใซใซใทใชใขใซๅใใใพใใ[`~PreTrainedModel.save_pretrained`]ใๅผใณๅบใใจใ่ชๅ็ใซ[`~PretrainedConfig.save_pretrained`]ใๅผใณๅบใใใใขใใซใจ่จญๅฎใฎไธกๆนใไฟๅญใใใพใใ
+
+### Code style
+
+ๆฐใใใขใใซใใณใผใใฃใณใฐใใ้ใซใฏใTransformersใฏๆ่ฆใใใใฉใคใใฉใชใงใใใใณใผใใฎๆธใๆนใซ้ขใใฆใใใคใใฎ็ฌ่ชใฎ่ใๆนใใใใพใ :-)
+
+1. ใขใใซใฎใใฉใฏใผใใในใฏใขใใชใณใฐใใกใคใซใซๅฎๅ
จใซ่จ่ฟฐใใใใฉใคใใฉใชๅ
ใฎไปใฎใขใใซใจใฏๅฎๅ
จใซ็ฌ็ซใใฆใใๅฟ
่ฆใใใใพใใไปใฎใขใใซใใใใญใใฏใๅๅฉ็จใใใๅ ดๅใใณใผใใใณใใผใใฆใใใใซ`# Copied from`ใณใกใณใใไปใใฆ่ฒผใไปใใพใ๏ผ่ฏใไพใฏ[ใใกใ](https://github.com/huggingface/transformers/blob/v4.17.0/src/transformers/models/roberta/modeling_roberta.py#L160)ใใณใใผใซ้ขใใ่ฉณ็ดฐใชใใญใฅใกใณใใผใทใงใณใฏ[ใใ](pr_checks#check-copies)ใๅ็
งใใฆใใ ใใ๏ผใ
+2. ใณใผใใฏๅฎๅ
จใซ็่งฃๅฏ่ฝใงใชใใใฐใชใใพใใใใใใฏ่จ่ฟฐ็ใชๅคๆฐๅใ้ธๆใใ็็ฅๅฝขใ้ฟใใในใใงใใใใจใๆๅณใใพใใไพใใฐใ`act`ใงใฏใชใ`activation`ใๅฅฝใพใใพใใ1ๆๅญใฎๅคๆฐๅใฏใforใซใผใๅ
ใฎใคใณใใใฏในใงใชใ้ใใๅผทใ้ๆจๅฅจใงใใ
+3. ใใไธ่ฌ็ใซใ้ญๆณใฎใใใช็ญใใณใผใใใใ้ทใใฆๆ็คบ็ใชใณใผใใๅฅฝใฟใพใใ
+4. PyTorchใงใฏ`nn.Sequential`ใใตใใฏใฉในๅใใใซใ`nn.Module`ใใตใใฏใฉในๅใใใใฉใฏใผใใในใ่จ่ฟฐใใใณใผใใไฝฟ็จใใไปใฎไบบใ็ฐกๅใซใใใใฐใงใใใใใซใใพใใใใชใณใในใใผใใกใณใใใใฌใผใฏใใคใณใใ่ฟฝๅ ใใฆใใใใฐใงใใใใใซใใพใใ
+5. ้ขๆฐใฎใทใฐใใใฃใฏๅใขใใใผใทใงใณใไปใใในใใงใใใใฎไปใฎ้จๅใซ้ขใใฆใฏใๅใขใใใผใทใงใณใใใ่ฏใๅคๆฐๅใ่ชญใฟใใใ็่งฃใใใใใใจใใใใพใใ
+
+### Overview of tokenizers
+
+ใพใ ๅฎไบใใฆใใพใใ :-( ใใฎใปใฏใทใงใณใฏ่ฟๆฅไธญใซ่ฟฝๅ ใใใพใ๏ผ
+
+## Step-by-step recipe to add a model to ๐ค Transformers
+
+ใขใใซใ่ฟฝๅ ใใๆนๆณใฏไบบใใใใ็ฐใชใใใใไปใฎใณใณใใชใใฅใผใฟใผใ๐ค Transformersใซใขใใซใ่ฟฝๅ ใใ้ใฎ่ฆ็ดใ็ขบ่ชใใใใจใ้ๅธธใซๅฝน็ซใคๅ ดๅใใใใพใใไปฅไธใฏใไปใฎใณใณใใชใใฅใผใฟใผใ๐ค Transformersใซใขใใซใใใผใใใ้ใฎใณใใฅใใใฃใใญใฐๆ็จฟใฎใชในใใงใใ
+
+1. [GPT2ใขใใซใฎใใผใใฃใณใฐ](https://medium.com/huggingface/from-tensorflow-to-pytorch-265f40ef2a28) by [Thomas](https://huggingface.co/thomwolf)
+2. [WMT19 MTใขใใซใฎใใผใใฃใณใฐ](https://huggingface.co/blog/porting-fsmt) by [Stas](https://huggingface.co/stas)
+
+็ต้จใใ่จใใใใจใฏใใขใใซใ่ฟฝๅ ใใ้ใซๆใ้่ฆใชใใจใฏๆฌกใฎใใใซใชใใพใ๏ผ
+
+- ่ป่ผชใฎๅ็บๆใใใชใใงใใ ใใ๏ผๆฐใใ๐ค Transformersใขใใซใฎใใใซ่ฟฝๅ ใใใณใผใใฎใปใจใใฉใฏใใงใซ๐ค Transformersๅ
ใฎใฉใใใซๅญๅจใใฆใใพใใ้กไผผใใๆขๅญใฎใขใใซใใใผใฏใใคใถใ่ฆใคใใใใใซใใใใคใใฎๆ้ใใใใฆๆขใใใจใ้่ฆใงใใ[grep](https://www.gnu.org/software/grep/)ใจ[rg](https://github.com/BurntSushi/ripgrep)ใฏใใชใใฎๅ้ใงใใใขใใซใฎใใผใฏใใคใถใฏ1ใคใฎใขใใซๅฎ่ฃ
ใซๅบใฅใใฆใใใใใใใพใใใใใขใใซใฎใขใใชใณใฐใณใผใใฏๅฅใฎๅฎ่ฃ
ใซๅบใฅใใฆใใใใจใใใใใจใซๆณจๆใใฆใใ ใใใไพใใฐใFSMTใฎใขใใชใณใฐใณใผใใฏBARTใซๅบใฅใใฆใใใFSMTใฎใใผใฏใใคใถใณใผใใฏXLMใซๅบใฅใใฆใใพใใ
+- ใใใฏ็งๅญฆ็ใช่ชฒ้กใใใใจใณใธใใขใชใณใฐใฎ่ชฒ้กใงใใใขใใซใฎ่ซๆใฎ็่ซ็ใชๅด้ขใใในใฆ็่งฃใใใใจใใใใใใๅน็็ใชใใใใฐ็ฐๅขใไฝๆใใใใใซๆ้ใ่ฒปใใในใใงใใ
+- ่กใ่ฉฐใพใฃใๅ ดๅใฏๅฉใใๆฑใใฆใใ ใใ๏ผใขใใซใฏ๐ค TransformersใฎใณใขใณใณใใผใใณใใงใใใHugging Faceใงใฏใขใใซใ่ฟฝๅ ใใใใใฎๅในใใใใงใๆไผใใใใฎใๅใใงใใพใใ้ฒ่กใใชใใใจใซๆฐไปใใๅ ดๅใฏใ้ฒๅฑใใฆใใชใใใจใๆฐใซใใชใใงใใ ใใใ
+
+ไปฅไธใงใฏใ๐ค Transformersใซใขใใซใใใผใใใ้ใซๆใๅฝน็ซใคใจ่ใใใใไธ่ฌ็ใชใฌใทใใๆไพใใใใจใใฆใใพใใ
+
+ๆฌกใฎใชในใใฏใใขใใซใ่ฟฝๅ ใใใใใซ่กใๅฟ
่ฆใใใใในใฆใฎใใจใฎ่ฆ็ดใงใใใTo-Doใชในใใจใใฆไฝฟ็จใงใใพใ๏ผ
+
+- โ ๏ผใชใใทใงใณ๏ผใขใใซใฎ็่ซ็ใชๅด้ขใ็่งฃใใพใใ
+- โ ๐ค Transformersใฎ้็บ็ฐๅขใๆบๅใใพใใ
+- โ ใชใชใธใใซใฎใชใใธใใชใฎใใใใฐ็ฐๅขใใปใใใขใใใใพใใ
+- โ `forward()` ใในใใชใชใธใใซใฎใชใใธใใชใจใใงใใฏใใคใณใใงๆญฃๅธธใซๅฎ่กใใในใฏใชใใใไฝๆใใพใใ
+- โ ใขใใซใฎ้ชจๆ ผใ๐ค Transformersใซๆญฃๅธธใซ่ฟฝๅ ใใพใใ
+- โ ใชใชใธใใซใฎใใงใใฏใใคใณใใ๐ค Transformersใฎใใงใใฏใใคใณใใซๆญฃๅธธใซๅคๆใใพใใ
+- โ ๐ค Transformersใงๅฎ่กใใใ `forward()` ใในใๆญฃๅธธใซๅฎ่กใใใชใชใธใใซใฎใใงใใฏใใคใณใใจๅไธใฎๅบๅใๅพใพใใ
+- โ ๐ค Transformersใงใฎใขใใซใในใใๅฎไบใใพใใ
+- โ ๐ค Transformersใซใใผใฏใใคใถใๆญฃๅธธใซ่ฟฝๅ ใใพใใ
+- โ ใจใณใใใผใจใณใใฎ็ตฑๅใในใใๅฎ่กใใพใใ
+- โ ใใญใฅใกใณใใๅฎๆใใใพใใ
+- โ ใขใใซใฎใฆใงใคใใHubใซใขใใใญใผใใใพใใ
+- โ ใใซใชใฏใจในใใๆๅบใใพใใ
+- โ ๏ผใชใใทใงใณ๏ผใใขใใผใใใใฏใ่ฟฝๅ ใใพใใ
+
+ใพใใ้ๅธธใ`BrandNewBert`ใฎ็่ซ็ใช็่งฃใๆทฑใใใใจใใๅงใใใพใใ
+ใใ ใใใใใขใใซใฎ็่ซ็ใชๅด้ขใใๅฎๅไธญใซ็่งฃใใใๆนใๅฅฝใพใใๅ ดๅใ`BrandNewBert`ใฎใณใผใใใผในใซ็ดๆฅใขใฏใปในใใใฎใๅ้กใใใพใใใ
+ใใฎใชใใทใงใณใฏใใจใณใธใใขใชใณใฐใฎในใญใซใ็่ซ็ใชในใญใซใใใๅชใใฆใใๅ ดๅใ
+`BrandNewBert`ใฎ่ซๆใ็่งฃใใใฎใซ่ฆๅดใใฆใใๅ ดๅใใพใใฏ็งๅญฆ็ใช่ซๆใ่ชญใใใใใใญใฐใฉใใณใฐใๆฅฝใใใงใใๅ ดๅใซ้ฉใใฆใใพใใ
+
+### 1. (Optional) Theoretical aspects of BrandNewBert
+
+BrandNewBertใฎ่ซๆใใใๅ ดๅใใใฎ่ชฌๆใ่ชญใใใใฎๆ้ใๅใในใใงใใ่ซๆใฎไธญใซใฏ็่งฃใ้ฃใใ้จๅใใใใใใใใพใใใ
+ใใฎๅ ดๅใงใๅฟ้
ใใชใใงใใ ใใใ็ฎๆจใฏ่ซๆใฎๆทฑใ็่ซ็็่งฃใๅพใใใจใงใฏใชใใ
+๐ค Transformersใงใขใใซใๅนๆ็ใซๅๅฎ่ฃ
ใใใใใซๅฟ
่ฆใชๆ
ๅ ฑใๆฝๅบใใใใจใงใใ
+ใใ ใใ็่ซ็ใชๅด้ขใซใใพใๅคใใฎๆ้ใใใใๅฟ
่ฆใฏใใใพใใใไปฃใใใซใๅฎ่ทต็ใชๅด้ขใซ็ฆ็นใๅฝใฆใพใใใใๅ
ทไฝ็ใซใฏๆฌกใฎ็นใงใ๏ผ
+
+- *brand_new_bert*ใฏใฉใฎ็จฎ้กใฎใขใใซใงใใ๏ผ BERTใฎใใใชใจใณใณใผใใผใฎใฟใฎใขใใซใงใใ๏ผ GPT2ใฎใใใชใใณใผใใผใฎใฟใฎใขใใซใงใใ๏ผ BARTใฎใใใชใจใณใณใผใใผ-ใใณใผใใผใขใใซใงใใ๏ผ
+ [model_summary](model_summary)ใๅ็
งใใฆใใใใใฎ้ใใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใใใใพใใ
+- *brand_new_bert*ใฎๅฟ็จๅ้ใฏไฝใงใใ๏ผ ใใญในใๅ้กใงใใ๏ผ ใใญในใ็ๆใงใใ๏ผ Seq2Seqใฟในใฏใไพใใฐ่ฆ็ดใงใใ๏ผ
+- ใขใใซใBERT/GPT-2/BARTใจใฏ็ฐใชใใใฎใซใใๆฐใใๆฉ่ฝใฏไฝใงใใ๏ผ
+- ๆขๅญใฎ[๐ค Transformersใขใใซ](https://huggingface.co/transformers/#contents)ใฎไธญใง*brand_new_bert*ใซๆใไผผใฆใใใขใใซใฏใฉใใงใใ๏ผ
+- ไฝฟ็จใใใฆใใใใผใฏใใคใถใฎ็จฎ้กใฏไฝใงใใ๏ผ SentencePieceใใผใฏใใคใถใงใใ๏ผ WordPieceใใผใฏใใคใถใงใใ๏ผ BERTใBARTใงไฝฟ็จใใใฆใใใใผใฏใใคใถใจๅใใงใใ๏ผ
+
+ใขใใซใฎใขใผใญใใฏใใฃใฎ่ฏใๆฆ่ฆใๅพใใจๆใใใใHugging Faceใใผใ ใซ่ณชๅใ้ใใใจใใงใใพใใ
+ใใใซใฏใขใใซใฎใขใผใญใใฏใใฃใๆณจๆๅฑคใชใฉใซ้ขใใ่ณชๅใๅซใพใใใใใใใพใใใ
+็งใใกใฏๅใใงใๆไผใใใพใใ
+
+### 2. Next prepare your environment
+
+1. ใชใใธใใชใฎใใผใธใงใForkใใใฟใณใใฏใชใใฏใใฆใ[ใชใใธใใช](https://github.com/huggingface/transformers)ใใใฉใผใฏใใพใใ
+ ใใใซใใใใณใผใใฎใณใใผใGitHubใฆใผใถใผใขใซใฆใณใใฎไธใซไฝๆใใใพใใ
+
+2. ใญใผใซใซใใฃในใฏใซใใ`transformers`ใใฉใผใฏใใฏใญใผใณใใใใผในใชใใธใใชใใชใขใผใใจใใฆ่ฟฝๅ ใใพใ๏ผ
+
+```bash
+git clone https://github.com/[your Github handle]/transformers.git
+cd transformers
+git remote add upstream https://github.com/huggingface/transformers.git
+```
+
+```bash
+python -m venv .env
+source .env/bin/activate
+pip install -e ".[dev]"
+```
+
+3. ้็บ็ฐๅขใใปใใใขใใใใใใใซใๆฌกใฎใณใใณใใๅฎ่กใใฆใใ ใใ๏ผ
+
+```bash
+python -m venv .env
+source .env/bin/activate
+pip install -e ".[dev]"
+```
+
+ใไฝฟใใฎOSใซๅฟใใฆใใใใณTransformersใฎใชใใทใงใณใฎไพๅญ้ขไฟใฎๆฐใๅขใใฆใใใใใใใฎใณใใณใใงใจใฉใผใ็บ็ใใๅฏ่ฝๆงใใใใพใใ
+ใใฎๅ ดๅใฏใไฝๆฅญใใฆใใDeep Learningใใฌใผใ ใฏใผใฏ๏ผPyTorchใTensorFlowใใใใณ/ใพใใฏFlax๏ผใใคใณในใใผใซใใๆฌกใฎๆ้ ใๅฎ่กใใฆใใ ใใ๏ผ
+
+```bash
+pip install -e ".[quality]"
+```
+
+ใใใฏใปใจใใฉใฎใฆใผในใฑใผในใซใฏๅๅใงใใใฏใใงใใใใฎๅพใ่ฆชใใฃใฌใฏใใชใซๆปใใใจใใงใใพใใ
+
+```bash
+cd ..
+```
+
+4. Transformersใซ*brand_new_bert*ใฎPyTorchใใผใธใงใณใ่ฟฝๅ ใใใใจใใๅงใใใพใใPyTorchใใคใณในใใผใซใใใซใฏใ
+ https://pytorch.org/get-started/locally/ ใฎๆ็คบใซๅพใฃใฆใใ ใใใ
+
+ **ๆณจๆ:** CUDAใใคใณในใใผใซใใๅฟ
่ฆใฏใใใพใใใๆฐใใใขใใซใCPUใงๅไฝใใใใใจใงๅๅใงใใ
+
+5. *brand_new_bert*ใ็งปๆคใใใซใฏใๅ
ใฎใชใใธใใชใธใฎใขใฏใปในใๅฟ
่ฆใงใใ
+
+```bash
+git clone https://github.com/org_that_created_brand_new_bert_org/brand_new_bert.git
+cd brand_new_bert
+pip install -e .
+```
+
+
+*brand_new_bert*ใ๐ค Transformersใซใใผใใใใใใฎ้็บ็ฐๅขใ่จญๅฎใใพใใใ
+
+### 3.-4. Run a pretrained checkpoint using the original repository
+
+ๆๅใซใใชใชใธใใซใฎ*brand_new_bert*ใชใใธใใชใงไฝๆฅญใใพใใ้ๅธธใใชใชใธใใซใฎๅฎ่ฃ
ใฏ้ๅธธใซใ็ ็ฉถ็ใใงใใใใใญใฅใกใณใใผใทใงใณใไธ่ถณใใฆใใใใใณใผใใ็่งฃใใซใใใใจใใใใพใใใใใใใใใ*brand_new_bert*ใๅๅฎ่ฃ
ใใๅๆฉใจใชใในใใงใใHugging Faceใงใฏใไธป่ฆใช็ฎๆจใฎ1ใคใใๅไฝใใใขใใซใๅใใใใใใงใใใ ใ**ใขใฏใปในๅฏ่ฝใงใฆใผใถใผใใฌใณใใชใผใง็พใใ**ใใฎใซๆธใ็ดใใใจใงใใใใใฏใ๐ค Transformersใซใขใใซใๅๅฎ่ฃ
ใใๆใ้่ฆใชๅๆฉใงใ - ่ค้ใชๆฐใใNLPๆ่กใ**่ชฐใซใงใ**ใขใฏใปในๅฏ่ฝใซใใใใจใใ่ฉฆใฟใงใใ
+
+ใพใใใชใชใธใใซใฎใชใใธใใชใซๅ
ฅใ่พผใใใจใใๅงใใในใใงใใ
+
+ๅ
ฌๅผใฎไบๅๅญฆ็ฟๆธใฟใขใใซใใชใชใธใใซใฎใชใใธใใชใงๆญฃๅธธใซๅฎ่กใใใใจใฏใ้ๅธธใ**ๆใๅฐ้ฃใช**ในใใใใงใใ
+็งใใกใฎ็ต้จใใใใชใชใธใใซใฎใณใผใใใผในใซๆ
ฃใใใฎใซๆ้ใใใใใใจใ้ๅธธใซ้่ฆใงใใไปฅไธใฎใใจใ็่งฃใใๅฟ
่ฆใใใใพใ๏ผ
+
+- ไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใใฉใใง่ฆใคใใใ๏ผ
+- ๅฏพๅฟใใใขใใซใซไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใใญใผใใใๆนๆณใฏ๏ผ
+- ใขใใซใใ็ฌ็ซใใฆใใผใฏใใคใถใๅฎ่กใใๆนๆณใฏ๏ผ
+- 1ใคใฎใใฉใฏใผใใในใ่ฟฝ่ทกใใฆใๅ็ดใชใใฉใฏใผใใในใซๅฟ
่ฆใชใฏใฉในใจ้ขๆฐใใใใใใใซใใพใใ้ๅธธใใใใใฎ้ขๆฐใ ใใๅๅฎ่ฃ
ใใๅฟ
่ฆใใใใพใใ
+- ใขใใซใฎ้่ฆใชใณใณใใผใใณใใ็นๅฎใงใใใใจ๏ผใขใใซใฎใฏใฉในใฏใฉใใซใใใพใใ๏ผใขใใซใฎใตใใฏใฉในใ*ไพ* EncoderModelใDecoderModelใใใใพใใ๏ผ่ชๅทฑๆณจๆใฌใคใคใผใฏใฉใใซใใใพใใ๏ผ่คๆฐใฎ็ฐใชใๆณจๆใฌใคใคใผใ*ไพ* *่ชๅทฑๆณจๆ*ใ*ใฏใญในใขใใณใทใงใณ*ใชใฉใๅญๅจใใพใใ๏ผ
+- ใชใชใธใใซใฎใชใใธใใชใฎ็ฐๅขใงใขใใซใใใใใฐใใๆนๆณใฏ๏ผ*print*ในใใผใใกใณใใ่ฟฝๅ ใใๅฟ
่ฆใใใใใ*ipdb*ใฎใใใชๅฏพ่ฉฑๅใใใใฌใไฝฟ็จใงใใใใPyCharmใฎใใใชๅน็็ใชIDEใไฝฟ็จใใฆใขใใซใใใใใฐใใๅฟ
่ฆใใใใพใใ๏ผ
+
+้่ฆใชใฎใฏใใใผใใฃใณใฐใใญใปในใ้ๅงใใๅใซใใชใชใธใใซใฎใชใใธใใชใงใณใผใใ**ๅน็็ใซ**ใใใใฐใงใใใใจใงใ๏ผใพใใใใใฏใชใผใใณใฝใผในใฉใคใใฉใชใงไฝๆฅญใใฆใใใใจใ่ฆใใฆใใใฆใใ ใใใใชใชใธใใซใฎใชใใธใใชใงใณใผใใ่ชฟในใ่ชฐใใๆญ่ฟใใใใใซใๅ้กใใชใผใใณใซใใใใใใซใชใฏใจในใใ้ไฟกใใใใใใใจใใใใใใชใใงใใ ใใใใใฎใชใใธใใชใฎใกใณใใใผใฏใๅฝผใใฎใณใผใใ่ชฟในใฆใใใไบบใซๅฏพใใฆ้ๅธธใซๅใใงใใๅฏ่ฝๆงใ้ซใใงใ๏ผ
+
+ใใฎๆฎต้ใงใฏใใชใชใธใใซใฎใขใใซใฎใใใใฐใซใฉใฎใใใช็ฐๅขใจๆฆ็ฅใไฝฟ็จใใใใฏใใใชใๆฌก็ฌฌใงใใๆๅใซใชใชใธใใซใฎใชใใธใใชใซ้ขใใใณใผใใใใใใฐใงใใใใจใ้ๅธธใซ้่ฆใงใใใพใใGPU็ฐๅขใใปใใใขใใใใใใจใฏใๅงใใใพใใใใพใใCPUไธใงไฝๆฅญใใใขใใซใใใงใซ๐ค Transformersใซๆญฃๅธธใซใใผใใใใฆใใใใจใ็ขบ่ชใใพใใๆๅพใซใใขใใซใGPUไธใงใๆๅพ
้ใใซๅไฝใใใใฉใใใๆค่จผใใๅฟ
่ฆใใใใพใใ
+
+ไธ่ฌ็ใซใใชใชใธใใซใฎใขใใซใๅฎ่กใใใใใฎ2ใคใฎใใใใฐ็ฐๅขใใใใพใ๏ผ
+
+- [Jupyter notebooks](https://jupyter.org/) / [google colab](https://colab.research.google.com/notebooks/intro.ipynb)
+- ใญใผใซใซใชPythonในใฏใชใใใ
+
+Jupyterใใผใใใใฏใฏใใปใซใใจใซๅฎ่กใงใใใใใ่ซ็็ใชใณใณใใผใใณใใใใๅๅฒใใไธญ้็ตๆใไฟๅญใงใใใใใใใใใฐใตใคใฏใซใ้ใใชใใจใใๅฉ็นใใใใพใใใพใใใใผใใใใฏใฏไปใฎๅ
ฑๅไฝๆฅญ่
ใจ็ฐกๅใซๅ
ฑๆใงใใใใจใๅคใใHugging Faceใใผใ ใซๅฉใใๆฑใใๅ ดๅใซ้ๅธธใซๅฝน็ซใคๅ ดๅใใใใพใใJupyterใใผใใใใฏใซ็ฒพ้ใใฆใใๅ ดๅใใใ
+
+
+```python
+model = BrandNewBertModel.load_pretrained_checkpoint("/path/to/checkpoint/")
+input_ids = [0, 4, 5, 2, 3, 7, 9] # vector of input ids
+original_output = model.predict(input_ids)
+```
+
+ใใใใฐๆฆ็ฅใซใคใใฆใฏใ้ๅธธใใใใคใใฎ้ธๆ่ขใใใใพใ๏ผ
+
+- ๅ
ใฎใขใใซใๅคใใฎๅฐใใชใในใๅฏ่ฝใชใณใณใใผใใณใใซๅ่งฃใใใใใใใซๅฏพใใฆๅๆนใในใๅฎ่กใใฆๆค่จผใใพใ
+- ๅ
ใฎใขใใซใๅ
ใฎใใผใฏใใคใถใจๅ
ใฎใขใใซใซใฎใฟๅ่งฃใใใใใใซๅฏพใใฆๅๆนใในใๅฎ่กใใๆค่จผใฎใใใซไธญ้ใฎใใชใณใในใใผใใกใณใใพใใฏใใฌใผใฏใใคใณใใไฝฟ็จใใพใ
+
+ๅๅบฆใใฉใฎๆฆ็ฅใ้ธๆใใใใฏใใชใๆฌก็ฌฌใงใใๅ
ใฎใณใผใใใผในใซไพๅญใใใใจใๅคใใๅ
ใฎใณใผใใใผในใซๅฟใใฆไธๆนใพใใฏไปๆนใๆๅฉใชใใจใใใใพใใ
+
+ๅ
ใฎใณใผใใใผในใใขใใซใๅฐใใชใตใใณใณใใผใใณใใซๅ่งฃใงใใๅ ดๅใ*ไพใใฐ*ๅ
ใฎใณใผใใใผในใ็ฐกๅใซใคใผใฌใผใขใผใใงๅฎ่กใงใใๅ ดๅใใใใ่กใไพกๅคใ้ๅธธใใใพใใๆๅใใใใ้ฃใใๆนๆณใ้ธๆใใใใจใซใฏใใใคใใฎ้่ฆใชๅฉ็นใใใใพใ๏ผ
+
+- ๅพใงๅ
ใฎใขใใซใ๐ค Transformersใฎๅฎ่ฃ
ใจๆฏ่ผใใ้ใซใๅใณใณใใผใใณใใๅฏพๅฟใใ๐ค Transformersๅฎ่ฃ
ใฎใณใณใใผใใณใใจไธ่ดใใใใจใ่ชๅ็ใซๆค่จผใงใใใใใ่ฆ่ฆ็ใชๆฏ่ผใซไพๅญใใใซๆธใฟใพใ
+- ๅคงใใชๅ้กใๅฐใใชๅ้กใซๅ่งฃใใใใคใพใๅใ
ใฎใณใณใใผใใณใใฎใฟใใใผใใฃใณใฐใใๅ้กใซๅๅฒใใใฎใซๅฝน็ซใกใไฝๆฅญใๆง้ ๅใใใฎใซๅฝน็ซใกใพใ
+- ใขใใซใ่ซ็็ใชๆๅณใฎใใใณใณใใผใใณใใซๅๅฒใใใใจใงใใขใใซใฎ่จญ่จใใใใใ็่งฃใใใใใใใขใใซใใใใใ็่งฃใใใฎใซๅฝน็ซใกใพใ
+- ๅพใงใใณใณใใผใใณใใใจใฎใในใใ่กใใใจใงใใณใผใใๅคๆดใ็ถใใ้ใซใชใฐใฌใใทใงใณใ็บ็ใใชใใใจใ็ขบ่ชใใใฎใซๅฝน็ซใกใพใ
+
+[Lysandreใฎ](https://gist.github.com/LysandreJik/db4c948f6b4483960de5cbac598ad4ed) ELECTRAใฎ็ตฑๅใใงใใฏใฏใใใใใฉใฎใใใซ่กใใใใใฎ่ฏใไพใงใใ
+
+ใใ ใใๅ
ใฎใณใผใใใผในใ้ๅธธใซ่ค้ใงใไธญ้ใณใณใใผใใณใใใณใณใใคใซใขใผใใงๅฎ่กใใใใจใใ่จฑๅฏใใชใๅ ดๅใใขใใซใๅฐใใชใในใๅฏ่ฝใชใตใใณใณใใผใใณใใซๅ่งฃใใใใจใๆ้ใใใใใใใใใไธๅฏ่ฝใงใใใใจใใใใพใใ
+่ฏใไพใฏ[T5ใฎMeshTensorFlow](https://github.com/tensorflow/mesh/tree/master/mesh_tensorflow)ใฉใคใใฉใชใงใใใ้ๅธธใซ่ค้ใงใขใใซใใตใใณใณใใผใใณใใซๅ่งฃใใ็ฐกๅใชๆนๆณใๆไพใใชใใใจใใใใพใใใใฎใใใชใฉใคใใฉใชใงใฏใ้ๅธธใใใชใณใในใใผใใกใณใใๆค่จผใใใใจใซไพๅญใใพใใ
+
+ใฉใฎๆฆ็ฅใ้ธๆใใฆใใๆจๅฅจใใใๆ้ ใฏ้ๅธธๅใใงใๆๅใฎใฌใคใคใผใใใใใใฐใ้ๅงใใๆๅพใฎใฌใคใคใผใใใใใใฐใ่กใในใใงใใ
+
+้ๅธธใไปฅไธใฎ้ ๅบใงๆฌกใฎใฌใคใคใผใใใฎๅบๅใๅๅพใใใใจใใๅงใใใพใ๏ผ
+
+1. ใขใใซใซๆธกใใใๅ
ฅๅIDใๅๅพใใ
+2. ๅ่ชใฎๅใ่พผใฟใๅๅพใใ
+3. ๆๅใฎTransformerใฌใคใคใผใฎๅ
ฅๅใๅๅพใใ
+4. ๆๅใฎTransformerใฌใคใคใผใฎๅบๅใๅๅพใใ
+5. ๆฌกใฎn - 1ใคใฎTransformerใฌใคใคใผใฎๅบๅใๅๅพใใ
+6. BrandNewBertใขใใซๅ
จไฝใฎๅบๅใๅๅพใใ
+
+ๅ
ฅๅIDใฏๆดๆฐใฎ้
ๅใงใใๅฟ
่ฆใใใใ*ไพ๏ผ* `input_ids = [0, 4, 4, 3, 2, 4, 1, 7, 19]` ใฎใใใซใชใใพใใ
+
+ไปฅไธใฎใฌใคใคใผใฎๅบๅใฏๅคๆฌกๅ
ใฎๆตฎๅๅฐๆฐ็น้
ๅใงใใใใจใๅคใใๆฌกใฎใใใซใชใใใจใใใใพใ๏ผ
+
+
+```
+[[
+ [-0.1465, -0.6501, 0.1993, ..., 0.1451, 0.3430, 0.6024],
+ [-0.4417, -0.5920, 0.3450, ..., -0.3062, 0.6182, 0.7132],
+ [-0.5009, -0.7122, 0.4548, ..., -0.3662, 0.6091, 0.7648],
+ ...,
+ [-0.5613, -0.6332, 0.4324, ..., -0.3792, 0.7372, 0.9288],
+ [-0.5416, -0.6345, 0.4180, ..., -0.3564, 0.6992, 0.9191],
+ [-0.5334, -0.6403, 0.4271, ..., -0.3339, 0.6533, 0.8694]]],
+```
+
+๐ค Transformersใซ่ฟฝๅ ใใใใในใฆใฎใขใใซใฏใ็ตฑๅใในใใๆฐๅๅๆ ผใใใใจใๆๅพ
ใใใฆใใใๅ
ใฎใขใใซใจ๐ค Transformersใงๅๅฎ่ฃ
ใใใใใผใธใงใณใใ0.001ใฎ็ฒพๅบฆใพใงใพใฃใใๅใๅบๅใๆไพใใๅฟ
่ฆใใใใพใใ
+็ฐใชใใฉใคใใฉใชใใฌใผใ ใฏใผใฏใงๅใใขใใซใๆธใใๅ ดๅใใใใใซ็ฐใชใๅบๅใ่ฟใใใจใๆญฃๅธธใงใใใใใ่ชคๅทฎ่จฑๅฎนๅคใจใใฆ1e-3๏ผ0.001๏ผใๅใๅ
ฅใใฆใใพใใใขใใซใใปใผๅใๅบๅใ่ฟใใ ใใงใฏไธๅๅใงใใปใผๅไธใงใใๅฟ
่ฆใใใใพใใใใฎใใใ๐ค Transformersใใผใธใงใณใฎไธญ้ๅบๅใๅ
ใฎ*brand_new_bert*ใฎๅฎ่ฃ
ใฎไธญ้ๅบๅใจ่คๆฐๅใซใใใฃใฆๆฏ่ผใใใใจใซใชใใงใใใใใใฎ้ใๅ
ใฎใชใใธใใชใฎ**ๅน็็ใช**ใใใใฐ็ฐๅขใ้ๅธธใซ้่ฆใงใใไปฅไธใฏใใใใใฐ็ฐๅขใใงใใใ ใๅน็็ใซใใใใใฎใขใใใคในใงใใ
+
+- ไธญ้็ตๆใใใใใฐใใๆ้ฉใชๆนๆณใ่ฆใคใใใๅ
ใฎใชใใธใใชใฏPyTorchใงๆธใใใฆใใพใใ๏ผใใฎๅ ดๅใๅ
ใฎใขใใซใใใๅฐใใชใตใใณใณใใผใใณใใซๅ่งฃใใฆไธญ้ๅคใๅๅพใใ้ทใในใฏใชใใใๆธใใใจใใใใใ้ฉๅใงใใๅ
ใฎใชใใธใใชใTensorflow 1ใงๆธใใใฆใใๅ ดๅใ[tf.print](https://www.tensorflow.org/api_docs/python/tf/print)ใชใฉใฎTensorFlowใฎใใชใณใๆไฝใไฝฟ็จใใฆไธญ้ๅคใๅบๅใใๅฟ
่ฆใใใใใใใใพใใใๅ
ใฎใชใใธใใชใJaxใงๆธใใใฆใใๅ ดๅใใใฉใฏใผใใในใฎๅฎ่กๆใซใขใใซใ**jittedใใใฆใใชใ**ใใจใ็ขบ่ชใใฆใใ ใใใไพ๏ผ[ใใฎใชใณใฏ](https://github.com/google/jax/issues/196)ใใใงใใฏใ
+- ไฝฟ็จๅฏ่ฝใชๆๅฐใฎไบๅๅญฆ็ฟๆธใฟใใงใใฏใใคใณใใไฝฟ็จใใพใใใใงใใฏใใคใณใใๅฐใใใปใฉใใใใใฐใตใคใฏใซใ้ใใชใใพใใไบๅๅญฆ็ฟๆธใฟใขใใซใใใฉใฏใผใใในใซ10็งไปฅไธใใใๅ ดๅใๅน็็ใงใฏใใใพใใใ้ๅธธใซๅคงใใชใใงใใฏใใคใณใใใๅฉ็จใงใใชใๅ ดๅใๆฐใใ็ฐๅขใงใฉใณใใ ใซๅๆๅใใใใฆใงใคใใๆใคใใใผใขใใซใไฝๆใใใใใใฎใฆใงใคใใ๐ค Transformersใใผใธใงใณใฎใขใใซใจๆฏ่ผใใๆนใ่ฏใใใใใใพใใใ
+- ๅ
ใฎใชใใธใใชใงใใฉใฏใผใใในใๅผใณๅบใๆใ็ฐกๅใชๆนๆณใไฝฟ็จใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ็ๆณ็ใซใฏใๅ
ใฎใชใใธใใชใง**ๅไธใฎใใฉใฏใผใใใน**ใๅผใณๅบใ้ขๆฐใ่ฆใคใใใใงใใใใใฏ้ๅธธใpredictใใใevaluateใใใforwardใใใ__call__ใใจๅผใฐใใพใใ่คๆฐๅใforwardใใๅผใณๅบใ้ขๆฐใใใใใฐใใใใใใพใใใไพ๏ผใใญในใใ็ๆใใใใใซใautoregressive_sampleใใใgenerateใใจๅผใฐใใ้ขๆฐใ
+- ใใผใฏใใคใผใผใทใงใณใจใขใใซใฎใใใฉใฏใผใใใในใๅ้ขใใใใจใใฆใใ ใใใๅ
ใฎใชใใธใใชใๅ
ฅๅๆๅญๅใๅ
ฅๅใใๅฟ
่ฆใใใไพใ็คบใๅ ดๅใใใฉใฏใผใใณใผใซๅ
ใงๆๅญๅๅ
ฅๅใๅ
ฅๅIDใซๅคๆดใใใๅ ดๆใ็นๅฎใใใใฎใใคใณใใใ้ๅงใใพใใใใใฏใในใฏใชใใใ่ชๅใงๆธใใใๅ
ฅๅๆๅญๅใงใฏใชใๅ
ฅๅIDใ็ดๆฅๅ
ฅๅใงใใใใใซๅ
ใฎใณใผใใๅคๆดใใๅฟ
่ฆใใใใใใใใพใใใ
+- ใใใใฐใปใใใขใใๅ
ใฎใขใใซใใใฌใผใใณใฐใขใผใใงใฏใชใใใจใ็ขบ่ชใใฆใใ ใใใใใฌใผใใณใฐใขใผใใงใฏใใขใใซๅ
ใฎ่คๆฐใฎใใญใใใขใฆใใฌใคใคใผใฎใใใซใฉใณใใ ใชๅบๅใ็ๆใใใใใจใใใใพใใใใใใฐ็ฐๅขใฎใใฉใฏใผใใในใ**ๆฑบๅฎ่ซ็**ใงใใใใจใ็ขบ่ชใใใใญใใใขใฆใใฌใคใคใผใไฝฟ็จใใใชใใใใซใใพใใใพใใฏใๆฐใใๅฎ่ฃ
ใๅใใใฌใผใ ใฏใผใฏๅ
ใซใใๅ ดๅใ*transformers.utils.set_seed*ใไฝฟ็จใใฆใใ ใใใ
+
+ไปฅไธใฎใปใฏใทใงใณใงใฏใ*brand_new_bert*ใซใคใใฆใใใๅ
ทไฝ็ใซใฉใฎใใใซ่กใใใซใคใใฆใฎ่ฉณ็ดฐ/ใใณใใๆไพใใพใใ
+
+### 5.-14. Port BrandNewBert to ๐ค Transformers
+
+ๆฌกใซใใคใใซๆฐใใใณใผใใ๐ค Transformersใซ่ฟฝๅ ใงใใพใใ๐ค Transformersใฎใใฉใผใฏใฎใฏใญใผใณใซ็งปๅใใฆใใ ใใ๏ผ
+
+```bash
+cd transformers
+```
+
+็นๅฅใชใฑใผในใจใใฆใๆขๅญใฎใขใใซใจๅฎๅ
จใซไธ่ดใใใขใผใญใใฏใใฃใฎใขใใซใ่ฟฝๅ ใใๅ ดๅใ
+[ใใฎใปใฏใทใงใณ](#write-a-conversion-script)ใง่ชฌๆใใใฆใใใใใซใๅคๆในใฏใชใใใ่ฟฝๅ ใใใ ใใงๆธใฟใพใใ
+ใใฎๅ ดๅใๆขๅญใฎใขใใซใฎๅฎๅ
จใชใขใใซใขใผใญใใฏใใฃใๅๅฉ็จใงใใพใใ
+
+
+ใใไปฅๅคใฎๅ ดๅใฏใๆฐใใใขใใซใฎ็ๆใ้ๅงใใพใใใใ ๆฌกใฎในใฏใชใใใไฝฟ็จใใฆใไปฅไธใใๅงใพใใขใใซใ่ฟฝๅ ใใใใจใใๅงใใใพใใ
+ๆขๅญใฎใขใใซ:
+
+```bash
+transformers-cli add-new-model-like
+```
+
+ใขใใซใฎๅบๆฌๆ
ๅ ฑใๅ
ฅๅใใใใใฎใขใณใฑใผใใ่กจ็คบใใใพใใ
+
+**ไธป่ฆใช huggingface/transformers ใชใใธใใชใงใใซใชใฏใจในใใ้ใ**
+
+่ชๅ็ๆใใใใณใผใใ้ฉๅฟใๅงใใๅใซใ๐ค Transformers ใซใไฝๆฅญไธญ๏ผWIP๏ผใใใซใชใฏใจในใใ้ใใฟใคใใณใฐใงใใ
+ไพ๏ผใ[WIP] *brand_new_bert* ใ่ฟฝๅ ใใชใฉใงใใ
+ใใใซใใใใฆใผใถใผใจ Hugging Face ใใผใ ใ๐ค Transformers ใซใขใใซใ็ตฑๅใใไฝๆฅญใไธฆ่กใใฆ่กใใใจใใงใใพใใ
+
+ไปฅไธใฎๆ้ ใๅฎ่กใใฆใใ ใใ๏ผ
+
+1. ใกใคใณใใฉใณใใใๅใใใใใๅๅใฎใใฉใณใใไฝๆใใพใใ
+
+```bash
+git checkout -b add_brand_new_bert
+```
+
+2. ่ชๅ็ๆใใใใณใผใใใณใใใใใฆใใ ใใ:
+
+```bash
+git add .
+git commit
+```
+
+3. ็พๅจใฎ main ใใฉใณใใซใใงใใใใฆใชใใผใน
+
+```bash
+git fetch upstream
+git rebase upstream/main
+```
+
+4. ๅคๆดใใใชใใฎใขใซใฆใณใใซใใใทใฅใใใซใฏใๆฌกใฎใณใใณใใไฝฟ็จใใพใ๏ผ
+
+```bash
+git push -u origin a-descriptive-name-for-my-changes
+```
+
+5. ๆบ่ถณใใใใGitHubไธใฎใใฉใผใฏใฎใฆใงใใใผใธใซ็งปๅใใพใใ[ใใซใชใฏใจในใ]ใใฏใชใใฏใใพใใๅฐๆฅใฎๅคๆดใซๅใใฆใHugging Face ใใผใ ใฎใกใณใใผใฎGitHubใใณใใซใใฌใใฅใขใผใจใใฆ่ฟฝๅ ใใฆใใ ใใใ
+
+6. GitHubใฎใใซใชใฏใจในใใฆใงใใใผใธใฎๅณๅดใซใใใใใฉใใใซๅคๆใใใฏใชใใฏใใฆใPRใใใฉใใใซๅคๆดใใพใใ
+
+ไปฅไธใงใฏใ้ฒๆใใใฃใๅ ดๅใฏๅธธใซไฝๆฅญใใณใใใใใใใใทใฅใใฆใใซใชใฏใจในใใซ่กจ็คบใใใใใใซใใฆใใ ใใใใใใซใๅฎๆ็ใซใกใคใณใใใฎๆๆฐใฎๅคๆดใๅใ่พผใใใใซใๆฌกใฎใใใซ่กใใใจใๅฟใใชใใงใใ ใใ๏ผ
+
+```bash
+git fetch upstream
+git merge upstream/main
+```
+
+ไธ่ฌ็ใซใใขใใซใๅฎ่ฃ
ใซ้ขใใ่ณชๅใฏPull Request (PR) ใง่กใใPRๅ
ใง่ญฐ่ซใใ่งฃๆฑบใใพใใ
+ใใใซใใใHugging Face ใใผใ ใฏๆฐใใใณใผใใใณใใใใใ้ใ่ณชๅใใใๅ ดๅใซๅธธใซ้็ฅใๅใใใใจใใงใใพใใ
+่ณชๅใๅ้กใ่งฃๆฑบใใใ้ใซใๅ้กใ่ณชๅใ็่งฃใใใใใใใใซใHugging Face ใใผใ ใซใณใผใใๆๆใใใใจใ้ๅธธใซๅฝน็ซใกใพใใ
+
+ใใฎใใใซใฏใใFiles changedใใฟใใซ็งปๅใใฆใในใฆใฎๅคๆดใ่กจ็คบใใ่ณชๅใใใ่กใซ็งปๅใใฆใ+ใใทใณใใซใใฏใชใใฏใใฆใณใกใณใใ่ฟฝๅ ใใพใใ
+่ณชๅใๅ้กใ่งฃๆฑบใใใๅ ดๅใฏใไฝๆใใใใณใกใณใใฎใResolveใใใฟใณใใฏใชใใฏใงใใพใใ
+
+ๅๆงใซใHugging Face ใใผใ ใฏใณใผใใใฌใใฅใผใใ้ใซใณใกใณใใ้ใใพใใ
+PRไธใงใฎใปใจใใฉใฎ่ณชๅใฏGitHubไธใง่กใใใจใใๅงใใใพใใ
+ไธ่ฌ็ใช่ณชๅใซ้ขใใฆใฏใๅ
ฌใซใฏใใพใๅฝน็ซใใชใ่ณชๅใซใคใใฆใฏใSlackใใกใผใซใงHugging Face ใใผใ ใซ้ฃ็ตกใใใใจใใงใใพใใ
+
+**5. ็ๆใใใใขใใซใณใผใใ"brand_new_bert"ใซ้ฉๅฟใใใ**
+
+ๆๅใซใใขใใซ่ชไฝใซ็ฆ็นใๅฝใฆใใใผใฏใใคใถใซใฏๆฐใซใใชใใงใใ ใใใ
+้ข้ฃใใใณใผใใฏใ็ๆใใใใใกใคใซ`src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`ใใใณ`src/transformers/models/brand_new_bert/configuration_brand_new_bert.py`ใง่ฆใคใใใฏใใงใใ
+
+ใใฆใใคใใซใณใผใใฃใณใฐใๅงใใใใจใใงใใพใ :smile:ใ
+`src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`ใซใใ็ๆใใใใณใผใใฏใใจใณใณใผใใผใฎใฟใฎใขใใซใงใใใฐBERTใจๅใใขใผใญใใฏใใฃใๆใฃใฆใใใใใจใณใณใผใใผ-ใใณใผใใผใขใใซใงใใใฐBARTใจๅใใขใผใญใใฏใใฃใๆใฃใฆใใใฏใใงใใ
+ใใฎๆฎต้ใงใฏใใขใใซใฎ็่ซ็ใชๅด้ขใซใคใใฆๅญฆใใ ใใจใๆใๅบใในใใงใใใคใพใใใใใฎใขใใซใฏBERTใพใใฏBARTใจใฉใฎใใใซ็ฐใชใใฎใ๏ผใใจใใใใจใงใใ
+ใใใใฎๅคๆดใๅฎ่ฃ
ใใพใใใใใใฏ้ๅธธใใปใซใใขใใณใทใงใณใฌใคใคใผใๆญฃ่ฆๅใฌใคใคใผใฎ้ ๅบใชใฉใๅคๆดใใใใจใๆๅณใใพใใ
+ๅใณใใใชใใฎใขใใซใใฉใฎใใใซๅฎ่ฃ
ใใใในใใใใใ่ฏใ็่งฃใใใใใซใTransformersๅ
ใซๆขๅญใฎใขใใซใฎ้กไผผใขใผใญใใฏใใฃใ่ฆใใใจใๅฝน็ซใคใใจใใใใพใใ
+
+ใใฎๆ็นใงใฏใใณใผใใๅฎๅ
จใซๆญฃ็ขบใพใใฏใฏใชใผใณใงใใๅฟ
่ฆใฏใใใพใใใ
+ใใใใใพใใฏๅฟ
่ฆใชใณใผใใฎๆๅใฎ*ใฏใชใผใณใงใชใ*ใณใใผ๏ผใใผในใใใผใธใงใณใ
+`src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`ใซ่ฟฝๅ ใใๅฟ
่ฆใชใณใผใใใในใฆ่ฟฝๅ ใใใฆใใใจๆใใใพใงๆนๅ/ไฟฎๆญฃใๅๅพฉ็ใซ่กใใใจใใๅงใใงใใ
+็งใใกใฎ็ต้จใใใๅฟ
่ฆใชใณใผใใฎๆๅใฎใใผใธใงใณใ่ฟ
้ใซ่ฟฝๅ ใใๆฌกใฎใปใฏใทใงใณใง่ชฌๆใใๅคๆในใฏใชใใใไฝฟ็จใใฆใณใผใใ็นฐใ่ฟใๆนๅ/ไฟฎๆญฃใใๆนใๅน็็ใงใใใใจใๅคใใงใใ
+ใใฎๆ็นใงๅไฝใใๅฟ
่ฆใใใใฎใฏใ๐ค Transformersใฎ"brand_new_bert"ใฎๅฎ่ฃ
ใใคใณในใฟใณในๅใงใใใใจใ ใใงใใใคใพใใไปฅไธใฎใณใใณใใๆฉ่ฝใใๅฟ
่ฆใใใใพใ๏ผ
+
+```python
+from transformers import BrandNewBertModel, BrandNewBertConfig
+
+model = BrandNewBertModel(BrandNewBertConfig())
+```
+
+ไธ่จใฎใณใใณใใฏใ`BrandNewBertConfig()` ใงๅฎ็พฉใใใใใใฉใซใใใฉใกใผใฟใซๅพใฃใฆใขใใซใไฝๆใใ
+ใในใฆใฎใณใณใใผใใณใใฎ `init()` ใกใฝใใใๆญฃๅธธใซๅไฝใใใใจใ็ขบ่ชใใพใใ
+
+ใในใฆใฎใฉใณใใ ใชๅๆๅใฏใ`BrandnewBertPreTrainedModel` ใฏใฉในใฎ `_init_weights` ใกใฝใใใง่กใๅฟ
่ฆใใใใพใใ
+ใใฎใกใฝใใใฏใ่จญๅฎๅคๆฐใซไพๅญใใใในใฆใฎใชใผใใขใธใฅใผใซใๅๆๅใใๅฟ
่ฆใใใใพใใไปฅไธใฏใBERT ใฎ `_init_weights` ใกใฝใใใฎไพใงใ๏ผ
+
+```py
+def _init_weights(self, module):
+ """Initialize the weights"""
+ if isinstance(module, nn.Linear):
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
+ if module.bias is not None:
+ module.bias.data.zero_()
+ elif isinstance(module, nn.Embedding):
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
+ if module.padding_idx is not None:
+ module.weight.data[module.padding_idx].zero_()
+ elif isinstance(module, nn.LayerNorm):
+ module.bias.data.zero_()
+ module.weight.data.fill_(1.0)
+```
+
+็นๅฎใฎใขใธใฅใผใซใซ็นๅฅใชๅๆๅใๅฟ
่ฆใชๅ ดๅใใซในใฟใ ในใญใผใ ใใใใซๆใคใใจใใงใใพใใใใจใใฐใ
+`Wav2Vec2ForPreTraining`ใงใฏใๆๅพใฎ2ใคใฎ็ทๅฝขๅฑคใซใฏ้ๅธธใฎPyTorchใฎ`nn.Linear`ใฎๅๆๅใๅฟ
่ฆใงใใใ
+ไปใฎใในใฆใฎๅฑคใฏไธ่จใฎใใใชๅๆๅใไฝฟ็จใใๅฟ
่ฆใใใใพใใใใใฏไปฅไธใฎใใใซใณใผใใฃใณใฐใใใฆใใพใ๏ผ
+
+```py
+def _init_weights(self, module):
+ """Initialize the weights"""
+ if isinstance(module, Wav2Vec2ForPreTraining):
+ module.project_hid.reset_parameters()
+ module.project_q.reset_parameters()
+ module.project_hid._is_hf_initialized = True
+ module.project_q._is_hf_initialized = True
+ elif isinstance(module, nn.Linear):
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
+ if module.bias is not None:
+ module.bias.data.zero_()
+```
+
+`_is_hf_initialized`ใใฉใฐใฏใใตใใขใธใฅใผใซใไธๅบฆใ ใๅๆๅใใใใจใ็ขบๅฎใซใใใใใซๅ
้จใงไฝฟ็จใใใพใใ
+`module.project_q`ใจ`module.project_hid`ใฎใใใซใใใ`True`ใซ่จญๅฎใใใใจใงใ
+ใซในใฟใ ๅๆๅใๅพใงไธๆธใใใใชใใใใซใใ`_init_weights`้ขๆฐใใใใใซ้ฉ็จใใใชใใใใซใใพใใ
+
+**6. ๅคๆในใฏใชใใใๆธใ**
+
+ๆฌกใซใ*brand_new_bert* ใฎๅ
ใฎใชใใธใใชใงใใใใฐใซไฝฟ็จใใใใงใใฏใใคใณใใใๆฐใใไฝๆใใ ๐ค Transformers ๅฎ่ฃ
ใฎ *brand_new_bert* ใจไบๆๆงใฎใใใใงใใฏใใคใณใใซๅคๆใงใใๅคๆในใฏใชใใใๆธใๅฟ
่ฆใใใใพใใ
+ๅคๆในใฏใชใใใใผใญใใๆธใใใจใฏใๅงใใใใพใใใใไปฃใใใซ ๐ค Transformers ใงๆขใซๅญๅจใใ้กไผผใฎใขใใซใๅใใใฌใผใ ใฏใผใฏใงๅคๆใใในใฏใชใใใ่ชฟในใใใจใ่ฏใใงใใใใ
+้ๅธธใๆขๅญใฎๅคๆในใฏใชใใใใณใใผใใฆใ่ชๅใฎใฆใผในใฑใผในใซใใใใซ้ฉๅฟใใใใใจใงๅๅใงใใ
+Hugging Face ใใผใ ใซๆขๅญใฎใขใใซใซ้กไผผใใๅคๆในใฏใชใใใๆใใฆใใใใใจใ่บ่บใใชใใงใใ ใใใ
+
+- TensorFlowใใPyTorchใซใขใใซใ็งปๆคใใฆใใๅ ดๅใ่ฏใๅบ็บ็นใฏBERTใฎๅคๆในใฏใชใใใใใใใพใใ [here](https://github.com/huggingface/transformers/blob/7acfa95afb8194f8f9c1f4d2c6028224dbed35a2/src/transformers/models/bert/modeling_bert.py#L91)
+- PyTorchใใPyTorchใซใขใใซใ็งปๆคใใฆใใๅ ดๅใ่ฏใๅบ็บ็นใฏBARTใฎๅคๆในใฏใชใใใใใใใพใใ [here](https://github.com/huggingface/transformers/blob/main/src/transformers/models/bart/convert_bart_original_pytorch_checkpoint_to_pytorch.py)
+
+ไปฅไธใงใฏใPyTorchใขใใซใๅฑคใฎ้ใฟใใฉใฎใใใซไฟๅญใใๅฑคใฎๅๅใๅฎ็พฉใใใใซใคใใฆ็ฐกๅใซ่ชฌๆใใพใใ
+PyTorchใงใฏใๅฑคใฎๅๅใฏๅฑคใซไธใใใฏใฉในๅฑๆงใฎๅๅใซใใฃใฆๅฎ็พฉใใใพใใ
+PyTorchใง `SimpleModel` ใจใใใใใผใขใใซใๅฎ็พฉใใพใใใ๏ผ
+
+```python
+from torch import nn
+
+
+class SimpleModel(nn.Module):
+ def __init__(self):
+ super().__init__()
+ self.dense = nn.Linear(10, 10)
+ self.intermediate = nn.Linear(10, 10)
+ self.layer_norm = nn.LayerNorm(10)
+```
+
+ใใใงใใใฎใขใใซๅฎ็พฉใฎใคใณในใฟใณในใไฝๆใใ`dense`ใ`intermediate`ใ`layer_norm`ใฎใในใฆใฎ้ใฟใใฉใณใใ ใช้ใฟใงๅใใใขใใซใไฝๆใงใใพใใใขใใซใฎใขใผใญใใฏใใฃใ็ขบ่ชใใใใใซใใขใใซใๅฐๅทใใฆใฟใพใใใใ
+
+```python
+model = SimpleModel()
+
+print(model)
+```
+ใใใฏไปฅไธใๅบๅใใพใ๏ผ
+
+```
+SimpleModel(
+ (dense): Linear(in_features=10, out_features=10, bias=True)
+ (intermediate): Linear(in_features=10, out_features=10, bias=True)
+ (layer_norm): LayerNorm((10,), eps=1e-05, elementwise_affine=True)
+)
+```
+
+ๅฑคใฎๅๅใฏPyTorchใฎใฏใฉในๅฑๆงใฎๅๅใซใใฃใฆๅฎ็พฉใใใฆใใพใใ็นๅฎใฎๅฑคใฎ้ใฟๅคใๅบๅใใใใจใใงใใพใ๏ผ
+
+
+```python
+print(model.dense.weight.data)
+```
+
+ใฉใณใใ ใซๅๆๅใใใ้ใฟใ็ขบ่ชใใใใใซ
+
+```
+tensor([[-0.0818, 0.2207, -0.0749, -0.0030, 0.0045, -0.1569, -0.1598, 0.0212,
+ -0.2077, 0.2157],
+ [ 0.1044, 0.0201, 0.0990, 0.2482, 0.3116, 0.2509, 0.2866, -0.2190,
+ 0.2166, -0.0212],
+ [-0.2000, 0.1107, -0.1999, -0.3119, 0.1559, 0.0993, 0.1776, -0.1950,
+ -0.1023, -0.0447],
+ [-0.0888, -0.1092, 0.2281, 0.0336, 0.1817, -0.0115, 0.2096, 0.1415,
+ -0.1876, -0.2467],
+ [ 0.2208, -0.2352, -0.1426, -0.2636, -0.2889, -0.2061, -0.2849, -0.0465,
+ 0.2577, 0.0402],
+ [ 0.1502, 0.2465, 0.2566, 0.0693, 0.2352, -0.0530, 0.1859, -0.0604,
+ 0.2132, 0.1680],
+ [ 0.1733, -0.2407, -0.1721, 0.1484, 0.0358, -0.0633, -0.0721, -0.0090,
+ 0.2707, -0.2509],
+ [-0.1173, 0.1561, 0.2945, 0.0595, -0.1996, 0.2988, -0.0802, 0.0407,
+ 0.1829, -0.1568],
+ [-0.1164, -0.2228, -0.0403, 0.0428, 0.1339, 0.0047, 0.1967, 0.2923,
+ 0.0333, -0.0536],
+ [-0.1492, -0.1616, 0.1057, 0.1950, -0.2807, -0.2710, -0.1586, 0.0739,
+ 0.2220, 0.2358]]).
+```
+
+ในใฏใชใใๅ
ใฎๅคๆในใฏใชใใใงใฏใใฉใณใใ ใซๅๆๅใใใ้ใฟใใๅฏพๅฟใใใใงใใฏใใคใณใๅ
ใฎๆญฃ็ขบใช้ใฟใงๅใใๅฟ
่ฆใใใใพใใไพใใฐใไปฅไธใฎใใใซ็ฟป่จณใใพใ๏ผ
+
+
+```python
+# retrieve matching layer weights, e.g. by
+# recursive algorithm
+layer_name = "dense"
+pretrained_weight = array_of_dense_layer
+
+model_pointer = getattr(model, "dense")
+
+model_pointer.weight.data = torch.from_numpy(pretrained_weight)
+```
+
+PyTorchใขใใซใฎๅใฉใณใใ ๅๆๅใใใ้ใฟใจๅฏพๅฟใใไบๅๅญฆ็ฟๆธใฟใใงใใฏใใคใณใใฎ้ใฟใ
+**ๅฝข็ถใจๅๅใฎไธกๆน**ใงๆญฃ็ขบใซไธ่ดใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+ใใใ่กใใใใซใๅฝข็ถใซๅฏพใใassertในใใผใใกใณใใ่ฟฝๅ ใใใใงใใฏใใคใณใใฎ้ใฟใฎๅๅใๅบๅใใใใจใ
+**ๅฟ
่ฆไธๅฏๆฌ **ใงใใไพใใฐใๆฌกใฎใใใชในใใผใใกใณใใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใ๏ผ
+
+
+```python
+assert (
+ model_pointer.weight.shape == pretrained_weight.shape
+), f"Pointer shape of random weight {model_pointer.shape} and array shape of checkpoint weight {pretrained_weight.shape} mismatched"
+```
+
+ใพใใไธกๆนใฎ้ใฟใฎๅๅใๅฐๅทใใฆใไธ่ดใใฆใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใไพใใฐใๆฌกใฎใใใซใใพใ๏ผ
+
+```python
+logger.info(f"Initialize PyTorch weight {layer_name} from {pretrained_weight.name}")
+```
+
+ใใๅฝข็ถใพใใฏๅๅใฎใใใใใไธ่ดใใชใๅ ดๅใใใใใ่ชคใฃใฆ๐ค Transformersใฎๅฎ่ฃ
ใซๅๆๅใใใใฌใคใคใผใซ้้ใฃใใใงใใฏใใคใณใใฎ้ใฟใๅฒใๅฝใฆใฆใใพใฃใๅฏ่ฝๆงใใใใพใใ
+
+่ชคใฃใๅฝข็ถใฏใใใใใ`BrandNewBertConfig()`ใงใฎ่จญๅฎใใฉใกใผใฟใผใใๅคๆใใใใใงใใฏใใคใณใใงไฝฟ็จใใใใใฎใจๆญฃ็ขบใซไธ่ดใใชใใใใงใใ
+ใใ ใใPyTorchใฎใฌใคใคใผใฎๅฎ่ฃ
ใซใใฃใฆใฏใ้ใฟใไบๅใซ่ปข็ฝฎใใๅฟ
่ฆใใใๅ ดๅใใใใพใใ
+
+ๆๅพใซใ**ใในใฆ**ใฎๅฟ
่ฆใช้ใฟใๅๆๅใใใฆใใใใจใ็ขบ่ชใใๅๆๅใซไฝฟ็จใใใชใใฃใใในใฆใฎใใงใใฏใใคใณใใฎ้ใฟใ่กจ็คบใใฆใใขใใซใๆญฃใใๅคๆใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+ๅคๆใใฉใคใขใซใ่ชคใฃใๅฝข็ถในใใผใใกใณใใพใใฏ่ชคใฃใๅๅๅฒใๅฝใฆใงๅคฑๆใใใฎใฏๅฎๅ
จใซๆญฃๅธธใงใใ
+ใใใฏใใใใใ`BrandNewBertConfig()`ใง่ชคใฃใใใฉใกใผใฟใผใไฝฟ็จใใใใ๐ค Transformersใฎๅฎ่ฃ
ใซ่ชคใฃใใขใผใญใใฏใใฃใใใใใ๐ค Transformersใฎๅฎ่ฃ
ใฎ1ใคใฎใณใณใใผใใณใใฎ`init()`้ขๆฐใซใใฐใใใใใใใงใใฏใใคใณใใฎ้ใฟใฎ1ใคใ่ปข็ฝฎใใๅฟ
่ฆใใใใใใงใใ
+
+ใใฎในใใใใฏใไปฅๅใฎในใใใใจ็นฐใ่ฟใในใใงใใใในใฆใฎใใงใใฏใใคใณใใฎ้ใฟใๆญฃใใ๐ค Transformersใขใใซใซ่ชญใฟ่พผใพใใใพใง็นฐใ่ฟใในใใงใใ
+๐ค Transformersๅฎ่ฃ
ใซๆญฃใใใใงใใฏใใคใณใใ่ชญใฟ่พผใใ ๅพใ้ธๆใใใใฉใซใใผใซใขใใซใไฟๅญใงใใพใ `/path/to/converted/checkpoint/folder`ใใใฎใใฉใซใใซใฏ`pytorch_model.bin`ใใกใคใซใจ`config.json`ใใกใคใซใฎไธกๆนใๅซใพใใใฏใใงใใ
+
+
+```python
+model.save_pretrained("/path/to/converted/checkpoint/folder")
+```
+
+**7. ้ ไผๆญ๏ผforward pass๏ผใฎๅฎ่ฃ
**
+
+๐ค Transformersๅฎ่ฃ
ใงไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใๆญฃใใ่ชญใฟ่พผใใ ๅพใ้ ไผๆญใๆญฃใใๅฎ่ฃ
ใใใฆใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ[ๅ
ใฎใชใใธใใชใ็่งฃใใ](#3-4-run-a-pretrained-checkpoint-using-the-original-repository)ใงใๅ
ใฎใชใใธใใชใไฝฟ็จใใฆใขใใซใฎ้ ไผๆญใๅฎ่กใใในใฏใชใใใใใงใซไฝๆใใพใใใไปๅบฆใฏใๅ
ใฎใชใใธใใชใฎไปฃใใใซ๐ค Transformersๅฎ่ฃ
ใไฝฟ็จใใฆ้กไผผใฎในใฏใชใใใไฝๆใใๅฟ
่ฆใใใใพใใไปฅไธใฎใใใซใชใใพใ๏ผ
+
+```python
+model = BrandNewBertModel.from_pretrained("/path/to/converted/checkpoint/folder")
+input_ids = [0, 4, 4, 3, 2, 4, 1, 7, 19]
+output = model(input_ids).last_hidden_states
+```
+
+๐ค Transformersใฎๅฎ่ฃ
ใจๅ
ใฎใขใใซใฎๅฎ่ฃ
ใๆๅใฎๅฎ่กใงๅฎๅ
จใซๅใๅบๅใๆไพใใชใใใ
+ใใฉใฏใผใใในใงใจใฉใผใ็บ็ใใๅฏ่ฝๆงใ้ๅธธใซ้ซใใงใใๅคฑๆใใชใใงใใ ใใ - ใใใฏไบๆณใใใฆใใใใจใงใ๏ผ
+ใพใใใใฉใฏใผใใในใใจใฉใผใในใญใผใใชใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+้้ใฃใๆฌกๅ
ใไฝฟ็จใใใ*ๆฌกๅ
ใฎไธไธ่ด*ใจใฉใผใใ่ชคใฃใใใผใฟๅใชใใธใงใฏใใไฝฟ็จใใใใใจใใใใใใพใใ
+ไพใใฐใ`torch.long`ใงใฏใชใ`torch.float32`ใไฝฟ็จใใใพใใ็นๅฎใฎใจใฉใผใ่งฃๆฑบใงใใชใๅ ดๅใฏใ
+Hugging Faceใใผใ ใซๅฉใใๆฑใใใใจใ่บ่บใใชใใงใใ ใใใ
+
+๐ค Transformersๅฎ่ฃ
ใๆญฃใใๆฉ่ฝใใใใจใ็ขบ่ชใใๆ็ต็ใช้จๅใฏใๅบๅใ`1e-3`ใฎ็ฒพๅบฆใงๅ็ญใงใใใใจใ็ขบ่ชใใใใจใงใใ
+ใพใใๅบๅใฎๅฝข็ถใๅไธใงใใใใจใใคใพใในใฏใชใใใฎ๐ค Transformersๅฎ่ฃ
ใจๅ
ใฎๅฎ่ฃ
ใฎไธกๆนใง`outputs.shape`ใๅใๅคใ็ๆใใๅฟ
่ฆใใใใพใใ
+ๆฌกใซใๅบๅๅคใๅไธใงใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+ใใใฏๆฐใใใขใใซใ่ฟฝๅ ใใ้ใฎๆใ้ฃใใ้จๅใฎ1ใคใงใใ
+ๅบๅใๅไธใงใชใ็็ฑใฎไธ่ฌ็ใช้้ใใฏไปฅไธใฎ้ใใงใใ
+
+- ไธ้จใฎใฌใคใคใผใ่ฟฝๅ ใใใฆใใชใใใคใพใ*ๆดปๆงๅ*ใฌใคใคใผใ่ฟฝๅ ใใใฆใใชใใใใชใถใใซๆฅ็ถใๅฟใใใใฆใใ
+- ๅ่ชๅใ่พผใฟ่กๅใ็ตใฐใใฆใใชใ
+- ใชใชใธใใซใฎๅฎ่ฃ
ใใชใใปใใใไฝฟ็จใใฆใใใใใ่ชคใฃใไฝ็ฝฎๅใ่พผใฟใไฝฟ็จใใใฆใใ
+- ใใฉใฏใผใใในไธญใซใใญใใใขใฆใใ้ฉ็จใใใฆใใพใใใใใไฟฎๆญฃใใใซใฏใ*model.trainingใFalse*ใงใใใใจใ็ขบ่ชใใใใฉใฏใผใใในไธญใซ่ชคใฃใฆใใญใใใขใฆใใฌใคใคใผใใขใฏใใฃใๅใใใชใใใใซใใพใใ
+*ใคใพใ* [PyTorchใฎfunctional dropout](https://pytorch.org/docs/stable/nn.functional.html?highlight=dropout#torch.nn.functional.dropout)ใซ*model.training*ใๆธกใใพใใ
+
+ๅ้กใไฟฎๆญฃใใๆ่ฏใฎๆนๆณใฏใ้ๅธธใๅ
ใฎๅฎ่ฃ
ใจ๐ค Transformersๅฎ่ฃ
ใฎใใฉใฏใผใใในใไธฆในใฆ่กจ็คบใใ้ใใใใใใฉใใใ็ขบ่ชใใใใจใงใใ
+็ๆณ็ใซใฏใใใฉใฏใผใใในใฎไธกๆนใฎๅฎ่ฃ
ใฎไธญ้ๅบๅใใใใใฐ/ใใชใณใใขใฆใใใฆใ๐ค Transformersๅฎ่ฃ
ใๅ
ใฎๅฎ่ฃ
ใจ็ฐใชใๅบๅใ็คบใใใใใฏใผใฏๅ
ใฎๆญฃ็ขบใชไฝ็ฝฎใ่ฆใคใใใใจใใงใใพใใ
+ๆๅใซใไธกๆนใฎในใฏใชใใใฎใใผใใณใผใใฃใณใฐใใใ`input_ids`ใๅไธใงใใใใจใ็ขบ่ชใใพใใ
+ๆฌกใซใ`input_ids`ใฎๆๅใฎๅคๆ๏ผ้ๅธธใๅ่ชๅใ่พผใฟ๏ผใฎๅบๅใๅไธใงใใใใจใ็ขบ่ชใใพใใ
+ใใฎๅพใใใใใฏใผใฏใฎๆๅพใฎใฌใคใคใผใพใงไฝๆฅญใ้ฒใใพใใ
+ใใใใใฎๆ็นใงใ2ใคใฎๅฎ่ฃ
้ใง้ใใใใใใจใซๆฐไปใใฏใใงใใใใซใใ๐ค Transformersๅฎ่ฃ
ใฎใใฐใฎๅ ดๆใ็นๅฎใใใพใใ
+็ต้จไธใๅ
ใฎๅฎ่ฃ
ใจ๐ค Transformersๅฎ่ฃ
ใฎใใฉใฏใผใใในใฎๅใไฝ็ฝฎใซๅคใใฎใใชใณใในใใผใใกใณใใ่ฟฝๅ ใใ
+ไธญ้ใใฌใผใณใใผใทใงใณใงๅใๅคใ็คบใใใชใณใในใใผใใกใณใใๆฎต้็ใซๅ้คใใใฎใใทใณใใซใใคๅนๆ็ใชๆนๆณใงใใ
+
+ไธกๆนใฎๅฎ่ฃ
ใๅใๅบๅใ็ๆใใใใจใซ่ชไฟกใๆใฃใฆใใๅ ดๅใ`torch.allclose(original_output, output, atol=1e-3)`ใไฝฟ็จใใฆๅบๅใ็ขบ่ชใใใจใๆใ้ฃใใ้จๅใๅฎไบใใพใ๏ผ
+ใใใงใจใใใใใพใ - ๅฎไบใใไฝๆฅญใฏ็ฐกๅใชใใฎใซใชใใฏใใงใ ๐ใ
+
+**8. ๅฟ
่ฆใชใในใฆใฎใขใใซใในใใ่ฟฝๅ **
+
+ใใฎๆ็นใงใๆฐใใใขใใซใๆญฃๅธธใซ่ฟฝๅ ใใใพใใใ
+ใใ ใใใขใใซใใพใ ๅฟ
่ฆใช่จญ่จใซๅฎๅ
จใซๆบๆ ใใฆใใชใๅฏ่ฝๆงใ้ๅธธใซ้ซใใงใใ
+๐ค Transformersใจๅฎๅ
จใซไบๆๆงใใใใใจใ็ขบ่ชใใใใใซใใในใฆใฎไธ่ฌ็ใชใในใใใในใใๅฟ
่ฆใใใใพใใ
+Cookiecutterใฏใใใใใขใใซ็จใฎใในใใใกใคใซใ่ชๅ็ใซ่ฟฝๅ ใใฆใใใฏใใงใใใใใๅใใใฃใฌใฏใใชใซ`tests/models/brand_new_bert/test_modeling_brand_new_bert.py`ใจใใฆๅญๅจใใพใใ
+ใใฎใในใใใกใคใซใๅฎ่กใใฆใใในใฆใฎไธ่ฌ็ใชใในใใใในใใใใจใ็ขบ่ชใใฆใใ ใใ๏ผ
+
+```bash
+pytest tests/models/brand_new_bert/test_modeling_brand_new_bert.py
+```
+
+ใในใฆใฎไธ่ฌ็ใชใในใใไฟฎๆญฃใใใใไปๅบฆใฏๅฎ่กใใใในใฆใฎ็ด ๆดใใใไฝๆฅญใ้ฉๅใซใในใใใใฆใใใใจใ็ขบ่ชใใใใจใ้ๅธธใซ้่ฆใงใใใใใซใใใ
+
+- a) ใณใใฅใใใฃใฏ*brand_new_bert*ใฎ็นๅฎใฎใในใใ่ฆใใใจใงใใใชใใฎไฝๆฅญใ็ฐกๅใซ็่งฃใงใใพใใ
+- b) ใขใใซใธใฎๅฐๆฅใฎๅคๆดใใขใใซใฎ้่ฆใชๆฉ่ฝใๅฃใใชใใใใซใใใใจใใงใใพใใ
+
+ใพใใ็ตฑๅใในใใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใใใใใฎ็ตฑๅใในใใฏใๅบๆฌ็ใซใฏใใใใฐในใฏใชใใใจๅใใใจใ่กใใพใใใใใใฎใขใใซใในใใฎใใณใใฌใผใใฏCookiecutterใซใใฃใฆๆขใซ่ฟฝๅ ใใใฆใใใใBrandNewBertModelIntegrationTestsใใจๅผใฐใใฆใใพใใใใฎใในใใ่จๅ
ฅใใใ ใใงใใใใใใฎใในใใๅๆ ผใใฆใใใใจใ็ขบ่ชใใใซใฏใๆฌกใฎใณใใณใใๅฎ่กใใพใใ
+
+```bash
+RUN_SLOW=1 pytest -sv tests/models/brand_new_bert/test_modeling_brand_new_bert.py::BrandNewBertModelIntegrationTests
+```
+
+
+
+Windowsใไฝฟ็จใใฆใใๅ ดๅใ`RUN_SLOW=1`ใ`SET RUN_SLOW=1`ใซ็ฝฎใๆใใฆใใ ใใใ
+
+
+
+ๆฌกใซใ*brand_new_bert*ใซ็นๆใฎใในใฆใฎ็นๅพดใฏใๅฅๅใฎใในใๅ
ใง่ฟฝๅ ใใใในใใงใใ
+`BrandNewBertModelTester`/`BrandNewBertModelTest`ใฎไธใซใใใฎ้จๅใฏใใๅฟใใใใพใใใ2ใคใฎ็นใง้ๅธธใซๅฝน็ซใกใพใ๏ผ
+
+- ใขใใซใฎ่ฟฝๅ ไธญใซ็ฒๅพใใ็ฅ่ญใใณใใฅใใใฃใซไผใใ*brand_new_bert*ใฎ็นๅฅใชๆฉ่ฝใใฉใฎใใใซๅไฝใใใใ็คบใใใจใซใใฃใฆใ็ฅ่ญใฎๅ
ฑๆใๆฏๆดใใพใใ
+- ๅฐๆฅใฎ่ฒข็ฎ่
ใฏใใใใใฎ็นๅฅใชใในใใๅฎ่กใใใใจใงใขใใซใธใฎๅคๆดใ่ฟ
้ใซใในใใงใใพใใ
+
+**9. ใใผใฏใใคใถใฎๅฎ่ฃ
**
+
+ๆฌกใซใ*brand_new_bert*ใฎใใผใฏใใคใถใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ้ๅธธใใใผใฏใใคใถใฏ๐ค Transformersใฎๆขๅญใฎใใผใฏใใคใถใจๅ็ญใ้ๅธธใซไผผใฆใใพใใ
+
+ใใผใฏใใคใถใๆญฃใใๅไฝใใใใจใ็ขบ่ชใใใใใซใฏใใพใใๅ
ใฎใชใใธใใชๅ
ใงๆๅญๅใๅ
ฅๅใใ`input_ids`ใ่ฟใในใฏใชใใใไฝๆใใใใจใใๅงใใใพใใ
+ใใฎในใฏใชใใใฏใๆฌกใฎใใใซ่ฆใใใใใใใพใใ๏ผ็ไผผใณใผใใง็คบใใพใ๏ผ๏ผ
+
+```python
+input_str = "This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words."
+model = BrandNewBertModel.load_pretrained_checkpoint("/path/to/checkpoint/")
+input_ids = model.tokenize(input_str)
+```
+
+ใชใชใธใใซใฎใชใใธใใชใ่ฉณใใ่ชฟๆปใใๆญฃใใใใผใฏใใคใถใฎ้ขๆฐใ่ฆใคใใๅฟ
่ฆใใใใใใใใพใใใ
+ใพใใฏใใชใชใธใใซใฎใชใใธใใชใฎใฏใญใผใณใๅคๆดใใฆใ`input_ids`ใ ใใๅบๅใใใใใซใใๅฟ
่ฆใใใใใใใใพใใใ
+ใชใชใธใใซใฎใชใใธใใชใไฝฟ็จใใๆฉ่ฝ็ใชใใผใฏใใคใผใผใทใงใณในใฏใชใใใไฝๆใใๅพใ
+๐ค Transformersๅใใฎ้กไผผใใในใฏใชใใใไฝๆใใๅฟ
่ฆใใใใพใใ
+ไปฅไธใฎใใใซ่ฆใใในใใงใ๏ผ
+
+```python
+from transformers import BrandNewBertTokenizer
+
+input_str = "This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words."
+
+tokenizer = BrandNewBertTokenizer.from_pretrained("/path/to/tokenizer/folder/")
+
+input_ids = tokenizer(input_str).input_ids
+```
+
+`input_ids`ใๅใๅคใ็ๆใใๅ ดๅใๆ็ตในใใใใจใใฆใใผใฏใใคใถใฎใในใใใกใคใซใ่ฟฝๅ ใใในใใงใใ
+
+*brand_new_bert*ใฎใขใใซใณใฐใในใใใกใคใซใจๅๆงใซใ*brand_new_bert*ใฎใใผใฏใใคใบใในใใใกใคใซใซใฏใใใใคใใฎใใผใใณใผใใใใ็ตฑๅใในใใๅซใพใใในใใงใใ
+
+**10. ใจใณใใใผใจใณใ็ตฑๅใในใใฎๅฎ่ก**
+
+ใใผใฏใใคใถใ่ฟฝๅ ใใๅพใ`๐ค Transformers`ๅ
ใฎ`tests/models/brand_new_bert/test_modeling_brand_new_bert.py`ใซ
+ใขใใซใจใใผใฏใใคใถใฎไธกๆนใไฝฟ็จใใใใใคใใฎใจใณใใใผใจใณใ็ตฑๅใในใใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+ใใฎใใใชใในใใฏใ๐ค Transformersใฎๅฎ่ฃ
ใๆๅพ
ใฉใใใซๆฉ่ฝใใใใจใ็คบใในใใงใใ
+ๆๅณใฎใใใใญในใๅฏพใใญในใใฎใตใณใใซใๅซใพใใพใใๆ็จใชใใญในใๅฏพใใญในใใฎใตใณใใซใซใฏใใฝใผในใใใฟใผใฒใใใธใฎ็ฟป่จณใใขใ่จไบใใ่ฆ็ดใธใฎใใขใ่ณชๅใใๅ็ญใธใฎใใขใชใฉใๅซใพใใพใใ
+ใใผใใใใใใงใใฏใใคใณใใใใฆใณในใใชใผใ ใฟในใฏใงใใกใคใณใใฅใผใใณใฐใใใฆใใชใๅ ดๅใใขใใซใฎใในใใซไพๅญใใใ ใใงๅๅใงใใ
+ใขใใซใๅฎๅ
จใซๆฉ่ฝใใฆใใใใจใ็ขบ่ชใใใใใซใใในใฆใฎใในใใGPUไธใงๅฎ่กใใใใจใใๅงใใใพใใ
+ใขใใซใฎๅ
้จใใณใฝใซใซ`.to(self.device)`ในใใผใใกใณใใ่ฟฝๅ ใใใฎใๅฟใใๅฏ่ฝๆงใใใใใใใใฎใใใชใในใใงใฏใจใฉใผใ่กจ็คบใใใใใจใใใใพใใ
+GPUใซใขใฏใปในใงใใชใๅ ดๅใHugging Faceใใผใ ใไปฃใใใซใใใใฎใในใใๅฎ่กใงใใพใใ
+
+**11. ใใญใฅใกใณใใฎ่ฟฝๅ **
+
+ใใใงใ*brand_new_bert*ใฎๅฟ
่ฆใชใในใฆใฎๆฉ่ฝใ่ฟฝๅ ใใใพใใ - ใปใผๅฎไบใงใ๏ผๆฎใใฎ่ฟฝๅ ใในใใใจใฏใ่ฏใใใญใฅใกใณใใจใใญใฅใกใณใใใผใธใงใใ
+Cookiecutterใ`docs/source/model_doc/brand_new_bert.md`ใจใใใใณใใฌใผใใใกใคใซใ่ฟฝๅ ใใฆใใใฏใใงใใใใ่จๅ
ฅใใๅฟ
่ฆใใใใพใใ
+ใขใใซใฎใฆใผใถใผใฏ้ๅธธใใขใใซใไฝฟ็จใใๅใซใพใใใฎใใผใธใ่ฆใพใใใใใใฃใฆใใใญใฅใกใณใใผใทใงใณใฏ็่งฃใใใใ็ฐกๆฝใงใใๅฟ
่ฆใใใใพใใ
+ใขใใซใฎไฝฟ็จๆนๆณใ็คบใใใใซใใใคใใฎ*Tips*ใ่ฟฝๅ ใใใใจใฏใณใใฅใใใฃใซใจใฃใฆ้ๅธธใซๅฝน็ซใกใพใใใใญใฅใกใณใใผใทใงใณใซ้ขใใฆใฏใHugging Faceใใผใ ใซๅใๅใใใใใจใใใใใใชใใงใใ ใใใ
+
+ๆฌกใซใ`src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`ใซ่ฟฝๅ ใใใใใญใฅใกใณใใผใทใงใณๆๅญๅใๆญฃใใใใจใใใใณใในใฆใฎๅฟ
่ฆใชๅ
ฅๅใใใณๅบๅใๅซใใงใใใใจใ็ขบ่ชใใฆใใ ใใใ
+ใใญใฅใกใณใใผใทใงใณใฎๆธใๆนใจใใญใฅใกใณใใผใทใงใณๆๅญๅใฎใใฉใผใใใใซใคใใฆ่ฉณ็ดฐใชใฌใคใใ[ใใกใ](writing-documentation)ใซใใใพใใ
+ใใญใฅใกใณใใผใทใงใณใฏ้ๅธธใใณใใฅใใใฃใจใขใใซใฎๆๅใฎๆฅ่งฆ็นใงใใใใใใณใผใใจๅใใใใๆณจๆๆทฑใๆฑใในใใงใใใใจใๅธธใซๅฟต้ ญใซ็ฝฎใใฆใใ ใใใ
+
+**ใณใผใใฎใชใใกใฏใฟใชใณใฐ**
+
+็ด ๆดใใใใใใใง*brand_new_bert*ใซๅฟ
่ฆใชใในใฆใฎใณใผใใ่ฟฝๅ ใใใพใใใ
+ใใฎๆ็นใงใๆฌกใฎใใใชใใใณใทใฃใซใชใณใผใในใฟใคใซใฎ่ชคใใ่จๆญฃใใใใใซไปฅไธใๅฎ่กใใๅฟ
่ฆใใใใพใ๏ผ
+
+```bash
+make style
+```
+
+ใใชใใฎใณใผใใฃใณใฐในใฟใคใซใๅ่ณชใใงใใฏใใในใใใใจใ็ขบ่ชใใฆใใ ใใ:
+
+```bash
+make quality
+```
+
+๐ค Transformersใฎ้ๅธธใซๅณๆ ผใชใใถใคใณใในใใซใฏใใพใ ๅๆ ผใใฆใใชใๅฏ่ฝๆงใใใใใใคใใฎไปใฎใในใใๅญๅจใใใใใใใพใใใ
+ใใใฏใใใญใฅใกใณใๆๅญๅใซๆ
ๅ ฑใไธ่ถณใใฆใใใใๅๅใ้้ใฃใฆใใใใจใๅๅ ใงใใใใจใๅคใใงใใHugging Faceใใผใ ใฏใใใใง่ฉฐใพใฃใฆใใๅ ดๅใซใฏๅฟ
ใๅฉใใฆใใใใงใใใใ
+
+ๆๅพใซใใณใผใใๆญฃใใๆฉ่ฝใใใใจใ็ขบ่ชใใๅพใใณใผใใใชใใกใฏใฟใชใณใฐใใใฎใฏๅธธใซ่ฏใใขใคใใขใงใใ
+ใในใฆใฎใในใใใในใใไปใ่ฟฝๅ ใใใณใผใใๅๅบฆ็ขบ่ชใใฆใชใใกใฏใฟใชใณใฐใ่กใใฎใฏ่ฏใใฟใคใใณใฐใงใใ
+
+ใใใงใณใผใใฃใณใฐใฎ้จๅใฏๅฎไบใใพใใใใใใงใจใใใใใพใ๏ผ ๐ ใใชใใฏ็ด ๆดใใใใงใ๏ผ ๐
+
+**12. ใขใใซใใขใใซใใใซใขใใใญใผใ**
+
+ๆๅพใฎใใผใใงใฏใใในใฆใฎใใงใใฏใใคใณใใใขใใซใใใซๅคๆใใฆใขใใใญใผใใใๅใขใใใญใผใใใใขใใซใใงใใฏใใคใณใใซใขใใซใซใผใใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+ใขใใซใใใฎๆฉ่ฝใซใคใใฆ่ฉณใใใฏใ[Model sharing and uploading Page](model_sharing)ใ่ชญใใง็่งฃใงใใพใใ
+ใใใงใฏใ*brand_new_bert*ใฎ่่
็ต็นใฎไธใซใขใใซใใขใใใญใผใใงใใใใใซๅฟ
่ฆใชใขใฏใปในๆจฉใๅๅพใใใใใซใHugging Faceใใผใ ใจๅๅใใๅฟ
่ฆใใใใพใใ
+`transformers`ใฎใในใฆใฎใขใใซใซๅญๅจใใ`push_to_hub`ใกใฝใใใฏใใใงใใฏใใคใณใใใใใซใใใทใฅใใ่ฟ
้ใใคๅน็็ใชๆนๆณใงใใ
+ไปฅไธใซใๅฐใใฎใณใผใในใใใใใ็คบใใพใ๏ผ
+
+```python
+brand_new_bert.push_to_hub("brand_new_bert")
+# Uncomment the following line to push to an organization.
+# brand_new_bert.push_to_hub("/brand_new_bert")
+```
+
+ๅใใงใใฏใใคใณใใซ้ฉๅใชใขใใซใซใผใใไฝๆใใไพกๅคใใใใพใใใขใใซใซใผใใฏใใใฎ็นๅฎใฎใใงใใฏใใคใณใใฎ็นๆงใใใคใฉใคใใใในใใงใใไพใใฐใใใฎใใงใใฏใใคใณใใฏใฉใฎใใผใฟใปใใใงไบๅๅญฆ็ฟ/ใใกใคใณใใฅใผใใณใฐใใใใใใฉใฎใใใชไธๆตใฟในใฏใงใขใใซใไฝฟ็จใในใใใ็คบใในใใงใใใพใใใขใใซใฎๆญฃใใไฝฟ็จๆนๆณใซ้ขใใใณใผใใๅซใใในใใงใใ
+
+**13.๏ผใชใใทใงใณ๏ผใใผใใใใฏใฎ่ฟฝๅ **
+
+*brand_new_bert*ใๆจ่ซใพใใฏไธๆตใฟในใฏใฎใใกใคใณใใฅใผใใณใฐใซใฉใฎใใใซ่ฉณ็ดฐใซไฝฟ็จใงใใใใ็คบใใใผใใใใฏใ่ฟฝๅ ใใใใจใฏ้ๅธธใซๅฝน็ซใกใพใใใใใฏใใชใใฎPRใใใผใธใใใใใซๅฟ
้ ใงใฏใใใพใใใใใณใใฅใใใฃใซใจใฃใฆ้ๅธธใซๆ็จใงใใ
+
+**14. ๅฎๆใใPRใฎๆๅบ**
+
+ใใญใฐใฉใใณใฐใๅฎไบใใใใๆๅพใฎในใใใใซ็งปๅใใPRใใกใคใณใใฉใณใใซใใผใธใใพใใใใ้ๅธธใHugging Faceใใผใ ใฏใใฎๆ็นใงๆขใซใใชใใใตใใผใใใฆใใใฏใใงใใใPRใซ่ฏใ่ชฌๆใ่ฟฝๅ ใใใณใผใใซใณใกใณใใ่ฟฝๅ ใใฆใใฌใใฅใขใผใซ็นๅฎใฎ่จญ่จใฎ้ธๆ่ขใๆๆใใใๅ ดๅใฏใณใกใณใใ่ฟฝๅ ใใใใจใไพกๅคใใใใพใใ
+
+### Share your work!!
+
+ใใใใณใใฅใใใฃใใใใชใใฎไฝๆฅญใซๅฏพใใ่ฉไพกใๅพใๆใๆฅใพใใ๏ผใขใใซใฎ่ฟฝๅ ใๅฎไบใใใใจใฏใTransformersใใใณNLPใณใใฅใใใฃใซใจใฃใฆ้่ฆใช่ฒข็ฎใงใใใใชใใฎใณใผใใจใใผใใใใไบๅๅญฆ็ฟๆธใฟใขใใซใฏใไฝ็พไบบใไฝๅไบบใจใใ้็บ่
ใ็ ็ฉถ่
ใซใใฃใฆ็ขบๅฎใซไฝฟ็จใใใใงใใใใใใชใใฎไปไบใซ่ชใใๆใกใใณใใฅใใใฃใจใใชใใฎๆๆใๅ
ฑๆใใพใใใใ
+
+**ใใชใใฏใณใใฅใใใฃใฎ่ชฐใงใ็ฐกๅใซใขใฏใปในใงใใๅฅใฎใขใใซใไฝๆใใพใใ๏ผ ๐คฏ**
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/attention.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/attention.md
new file mode 100644
index 0000000000000000000000000000000000000000..4c452ffa42229936883510abd652bd5e5ab0f4e8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/attention.md
@@ -0,0 +1,52 @@
+
+
+# Attention mechanism
+
+ใปใจใใฉใฎTransformerใขใใซใฏใใขใใณใทใงใณ่กๅใๆญฃๆนๅฝขใงใใใจใใๆๅณใงๅฎๅ
จใชใขใใณใทใงใณใไฝฟ็จใใพใใ
+ใใใฏใ้ทใใใญในใใๆฑใๅ ดๅใซ่จ็ฎใฎใใใซใใใฏใจใชใใใจใใใใพใใLongformerใReformerใฏใใใๅน็็ใงใใฌใผใใณใฐใ้ซ้ๅใใใใใซใขใใณใทใงใณ่กๅใฎในใใผในใใผใธใงใณใไฝฟ็จใใใใจใใใขใใซใงใใ
+
+## LSH attention
+
+[Reformer](model_doc/reformer)ใฏLSH๏ผๅฑๆ็ใซๆฃๅจใใใทใฅ๏ผใขใใณใทใงใณใไฝฟ็จใใพใใ
+ใฝใใใใใฏใน(QK^t)ใงใฏใ่กๅQK^tใฎไธญใง๏ผใฝใใใใใฏในๆฌกๅ
ใง๏ผๆใๅคงใใช่ฆ็ด ใฎใฟใๆ็จใชๅฏไธใๆไพใใพใใ
+ใใใใฃใฆใๅใฏใจใชqใซใคใใฆใใฏใจใชqใซ่ฟใใญใผkใฎใฟใ่ๆ
ฎใงใใพใใ
+qใจkใ่ฟใใใฉใใใๆฑบๅฎใใใใใซใใใใทใฅ้ขๆฐใไฝฟ็จใใใพใใ
+ใขใใณใทใงใณใในใฏใฏๅคๆดใใใ็พๅจใฎใใผใฏใณใใในใฏๅใใพใ๏ผๆๅใฎไฝ็ฝฎใ้คใ๏ผใ
+ใชใใชใใใใใฏใฏใจใชใจใญใผใ็ญใใ๏ผใคใพใ้ๅธธใซไผผใฆใใ๏ผใฏใจใชใจใญใผใๆไพใใใใใงใใ
+ใใใทใฅใฏๅคๅฐใฉใณใใ ใใใใใชใใใใๅฎ้ใซใฏใใใคใใฎใใใทใฅ้ขๆฐใไฝฟ็จใใ๏ผn_roundsใใฉใกใผใฟใงๆฑบๅฎใใใพใ๏ผใใใใใๅนณๅๅใใใพใใ
+
+## Local attention
+
+[Longformer](model_doc/longformer)ใฏใญใผใซใซใขใใณใทใงใณใไฝฟ็จใใพใใ
+ใใฐใใฐใใญใผใซใซใณใณใใญในใ๏ผไพ๏ผๅทฆๅณใฎ2ใคใฎใใผใฏใณใฏไฝใงใใ๏ผ๏ผใฏใ็นๅฎใฎใใผใฏใณใซๅฏพใใฆ่กๅใ่ตทใใใฎใซๅๅใงใใ
+ใพใใๅฐใใชใฆใฃใณใใฆใๆใคใขใใณใทใงใณใฌใคใคใผใ็ฉใฟ้ใญใใใจใงใๆๅพใฎใฌใคใคใผใฏใฆใฃใณใใฆๅ
ใฎใใผใฏใณใ ใใงใชใใใฆใฃใณใใฆๅ
ใฎใใผใฏใณใ่ถ
ใใฆๅๅฎน้ใๆใคใใใซใชใใๆๅ
จไฝใฎ่กจ็พใๆง็ฏใงใใพใใ
+
+ไธ้จใฎไบๅ้ธๆใใใๅ
ฅๅใใผใฏใณใซใฏใฐใญใผใใซใขใใณใทใงใณใไธใใใใพใใ
+ใใใใฎๅฐๆฐใฎใใผใฏใณใซๅฏพใใฆใใขใใณใทใงใณ่กๅใฏใในใฆใฎใใผใฏใณใซใขใฏใปในใงใใใใฎใใญใปในใฏๅฏพ็งฐ็ใงใใ
+ไปใฎใในใฆใฎใใผใฏใณใฏใใใใใฎ็นๅฎใฎใใผใฏใณใซใขใฏใปในใงใใพใ๏ผใญใผใซใซใฆใฃใณใใฆๅ
ใฎใใผใฏใณใซๅ ใใฆ๏ผใ
+ใใใฏใ่ซๆใฎๅณ2dใซ็คบใใใฆใใใไปฅไธใฏใตใณใใซใฎใขใใณใทใงใณใในใฏใงใ๏ผ
+
+
+
+
+
+
+## Other tricks
+
+### Axial positional encodings
+
+[Reformer](model_doc/reformer)ใฏ่ปธๆนๅใฎไฝ็ฝฎใจใณใณใผใใฃใณใฐใไฝฟ็จใใฆใใพใใไผ็ตฑ็ใชใใฉใณในใใฉใผใใผใขใใซใงใฏใไฝ็ฝฎใจใณใณใผใใฃใณใฐEใฏใตใคใบใ \\(l\\) ร \\(d\\) ใฎ่กๅใงใ\\(l\\) ใฏใทใผใฑใณในใฎ้ทใใ\\(d\\) ใฏ้ ใ็ถๆ
ใฎๆฌกๅ
ใงใใ้ๅธธใซ้ทใใใญในใใๆฑใๅ ดๅใใใฎ่กๅใฏ้ๅธธใซๅคงใใใGPUไธใงๅคง้ใฎในใใผในใๅ ๆใใพใใใใใ็ทฉๅใใใใใซใ่ปธๆนๅใฎไฝ็ฝฎใจใณใณใผใใฃใณใฐใฏใใใฎๅคงใใช่กๅEใ2ใคใฎๅฐใใช่กๅE1ใจE2ใซๅ่งฃใใพใใใใใใใฎ่กๅใฏใตใคใบ \\(l_{1} \times d_{1}\\) ใใใณ \\(l_{2} \times d_{2}\\) ใๆใกใ \\(l_{1} \times l_{2} = l\\) ใใใณ \\(d_{1} + d_{2} = d\\) ใจใใๆกไปถใๆบใใใพใ๏ผ้ทใใฎ็ฉใ่ใใใจใใใใใฏใใใซๅฐใใใชใใพใ๏ผใ่กๅEๅ
ใฎๆๅป \\(j\\) ใฎๅใ่พผใฟใฏใE1ๅ
ใฎๆๅป \\(j \% l1\\) ใฎๅใ่พผใฟใจE2ๅ
ใฎๆๅป \\(j // l1\\) ใฎๅใ่พผใฟใ้ฃ็ตใใใใจใซใใฃใฆๅพใใใพใใ
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/autoclass_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/autoclass_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..f8fbeaa221f6aa34e41d0718a4933e06445a2bce
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/autoclass_tutorial.md
@@ -0,0 +1,161 @@
+
+
+# AutoClassใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใคใณในใฟใณในใใญใผใใใ
+
+ใใพใใพใชTransformerใขใผใญใใฏใใฃใๅญๅจใใใใใ่ชๅใฎใฟในใฏใซๅใฃใใขใใซใไฝๆใใใฎใฏ้ฃใใใใจใใใใพใใ
+๐ค Transformersใฎใณใขๅฒๅญฆใฎไธ็ฐใจใใฆใใฉใคใใฉใชใไฝฟ็จใใใใใใทใณใใซใงๆ่ปใซใใใใใซใ
+`AutoClass`ใฏไธใใใใใใงใใฏใใคใณใใใๆญฃใใใขใผใญใใฏใใฃใ่ชๅ็ใซๆจ่ซใใฆใญใผใใใพใใ
+`from_pretrained()`ใกใฝใใใไฝฟ็จใใใจใไบๅๅญฆ็ฟๆธใฟใขใใซใ็ด ๆฉใใญใผใใงใใใใใใขใใซใใผใญใใใใฌใผใใณใฐใใใใใซๆ้ใจใชใฝใผในใ่ฒปใใๅฟ
่ฆใใใใพใใใ
+ใใฎ็จฎใฎใใงใใฏใใคใณใใซไพๅญใใชใใณใผใใ็ๆใใใใจใฏใ
+ใณใผใใ1ใคใฎใใงใใฏใใคใณใใงๅไฝใใใฐใใขใผใญใใฏใใฃใ็ฐใชใฃใฆใใฆใใๅใใฟในใฏใซๅใใฆใใฌใผใใณใฐใใใๅ ดๅใฏๅฅใฎใใงใใฏใใคใณใใงใๅไฝใใใใจใๆๅณใใพใใ
+
+
+
+ใขใผใญใใฏใใฃใฏใขใใซใฎ้ชจๆ ผใๆใใใใงใใฏใใคใณใใฏ็นๅฎใฎใขใผใญใใฏใใฃใฎ้ใฟใงใใ
+ใใจใใฐใ[BERT](https://huggingface.co/google-bert/bert-base-uncased)ใฏใขใผใญใใฏใใฃใงใใใ`google-bert/bert-base-uncased`ใฏใใงใใฏใใคใณใใงใใ
+ใขใใซใฏใขใผใญใใฏใใฃใพใใฏใใงใใฏใใคใณใใฎใฉใกใใๆใไธ่ฌ็ใช็จ่ชใงใใ
+
+
+
+ใใฎใใฅใผใใชใขใซใงใฏใไปฅไธใๅญฆ็ฟใใพใ๏ผ
+
+* ไบๅๅญฆ็ฟๆธใฟใใผใฏใใคใถใใญใผใใใใ
+* ไบๅๅญฆ็ฟๆธใฟ็ปๅใใญใปใใตใใญใผใใใใ
+* ไบๅๅญฆ็ฟๆธใฟ็นๅพด้ๆฝๅบๅจใใญใผใใใใ
+* ไบๅๅญฆ็ฟๆธใฟใใญใปใใตใใญใผใใใใ
+* ไบๅๅญฆ็ฟๆธใฟใขใใซใใญใผใใใใ
+
+## AutoTokenizer
+
+ใปใจใใฉใฎNLPใฟในใฏใฏใใผใฏใใคใถใงๅงใพใใพใใใใผใฏใใคใถใฏๅ
ฅๅใใขใใซใงๅฆ็ใงใใๅฝขๅผใซๅคๆใใพใใ
+
+[`AutoTokenizer.from_pretrained`]ใไฝฟ็จใใฆใใผใฏใใคใถใใญใผใใใพใ๏ผ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
+```
+
+
+ๆฌกใซใไปฅไธใฎใใใซๅ
ฅๅใใใผใฏใใคใบใใพใ๏ผ
+
+```py
+>>> sequence = "In a hole in the ground there lived a hobbit."
+>>> print(tokenizer(sequence))
+{'input_ids': [101, 1999, 1037, 4920, 1999, 1996, 2598, 2045, 2973, 1037, 7570, 10322, 4183, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+## AutoImageProcessor
+
+ใใธใงใณใฟในใฏใฎๅ ดๅใ็ปๅใใญใปใใตใ็ปๅใๆญฃใใๅ
ฅๅๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+```
+
+## AutoFeatureExtractor
+
+ใชใผใใฃใชใฟในใฏใฎๅ ดๅใ็นๅพด้ๆฝๅบๅจใใชใผใใฃใชไฟกๅทใๆญฃใใๅ
ฅๅๅฝขๅผใซๅคๆใใพใใ
+
+[`AutoFeatureExtractor.from_pretrained`]ใไฝฟ็จใใฆ็นๅพด้ๆฝๅบๅจใใญใผใใใพใ.
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained(
+... "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
+... )
+```
+
+## AutoProcessor
+
+ใใซใใขใผใใซใฟในใฏใฎๅ ดๅใ2ใคใฎๅๅฆ็ใใผใซใ็ตใฟๅใใใใใญใปใใตใๅฟ
่ฆใงใใใใจใใฐใ
+[LayoutLMV2](model_doc/layoutlmv2)ใขใใซใฏ็ปๅใๅฆ็ใใใใใฎ็ปๅใใญใปใใตใจใใญในใใๅฆ็ใใใใใฎใใผใฏใใคใถใๅฟ
่ฆใงใใ
+ใใญใปใใตใฏใใใใฎไธกๆนใ็ตใฟๅใใใพใใ
+
+[`AutoProcessor.from_pretrained`]ใไฝฟ็จใใฆใใญใปใใตใใญใผใใใพใ๏ผ
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("microsoft/layoutlmv2-base-uncased")
+```
+
+## AutoModel
+
+
+
+ๆๅพใซใ`AutoModelFor`ใฏใฉในใฏ็นๅฎใฎใฟในใฏใซๅฏพใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใใญใผใใงใใพใ๏ผไฝฟ็จๅฏ่ฝใชใฟในใฏใฎๅฎๅ
จใชไธ่ฆงใซใคใใฆใฏ[ใใกใ](model_doc/auto)ใๅ็
ง๏ผใ
+ใใจใใฐใ[`AutoModelForSequenceClassification.from_pretrained`]ใไฝฟ็จใใฆใทใผใฑใณในๅ้ก็จใฎใขใใซใใญใผใใงใใพใ๏ผ
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ๅใใใงใใฏใใคใณใใๅๅฉ็จใใฆ็ฐใชใใฟในใฏใฎใขใผใญใใฏใใฃใใญใผใใงใใพใ๏ผ
+
+```py
+>>> from transformers import AutoModelForTokenClassification
+
+>>> model = AutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+PyTorchใขใใซใฎๅ ดๅใ `from_pretrained()`ใกใฝใใใฏๅ
้จใง`torch.load()`ใไฝฟ็จใใๅ
้จ็ใซใฏ`pickle`ใไฝฟ็จใใฆใใใใปใญใฅใชใใฃใฎๅ้กใ็ฅใใใฆใใพใใ
+ไธ่ฌ็ใซใฏใไฟก้ ผๆงใฎใชใใฝใผในใใๅๅพใใๅฏ่ฝๆงใใใใขใใซใๆนใใใใใๅฏ่ฝๆงใฎใใใขใใซใใญใผใใใชใใงใใ ใใใ
+ใใฎใปใญใฅใชใใฃใชในใฏใฏใ`Hugging Face Hub`ใงใในใใใใฆใใๅ
ฌ้ใขใใซใซๅฏพใใฆ้จๅ็ใซ็ทฉๅใใใฆใใใๅใณใใใใงใใซใฆใงใขใฎในใญใฃใณใ่กใใใฆใใพใใ
+GPGใไฝฟ็จใใ็ฝฒๅๆธใฟใณใใใใฎๆค่จผใชใฉใฎใในใใใฉใฏใใฃในใซใคใใฆใฏใHubใฎใใญใฅใกใณใใผใทใงใณใๅ็
งใใฆใใ ใใใ
+
+TensorFlowใใใณFlaxใฎใใงใใฏใใคใณใใซใฏๅฝฑ้ฟใใชใใ`from_pretrained`ใกใฝใใใฎ`from_tf`ใใใณ`from_flax`ๅผๆฐใไฝฟ็จใใฆPyTorchใขใผใญใใฏใใฃๅ
ใงใญใผใใงใใพใใ
+
+
+
+ไธ่ฌ็ใซใไบๅๅญฆ็ฟๆธใฟใขใใซใฎใคใณในใฟใณในใใญใผใใใใใใซ`AutoTokenizer`ใฏใฉในใจ`AutoModelFor`ใฏใฉในใฎไฝฟ็จใใๅงใใใพใใ
+ใใใซใใใๅธธใซๆญฃใใใขใผใญใใฏใใฃใใญใผใใงใใพใใ
+ๆฌกใฎ[tutorial](preprocessing)ใงใฏใๆฐใใใญใผใใใใใผใฏใใคใถใ็ปๅใใญใปใใตใ็นๅพด้ๆฝๅบๅจใใใใณใใญใปใใตใไฝฟ็จใใฆใใใกใคใณใใฅใผใใณใฐ็จใซใใผใฟใปใใใๅๅฆ็ใใๆนๆณใๅญฆใณใพใใ
+
+
+ๆๅพใซใ`TFAutoModelFor`ใฏใฉในใฏ็นๅฎใฎใฟในใฏใซๅฏพใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใใญใผใใงใใพใ๏ผไฝฟ็จๅฏ่ฝใชใฟในใฏใฎๅฎๅ
จใชไธ่ฆงใซใคใใฆใฏใใกใใๅ็
ง๏ผใ
+ใใจใใฐใ[`TFAutoModelForSequenceClassification.from_pretrained`]ใไฝฟ็จใใฆใทใผใฑใณในๅ้ก็จใฎใขใใซใใญใผใใงใใพใ๏ผ
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ๅใใใงใใฏใใคใณใใๅๅฉ็จใใฆ็ฐใชใใฟในใฏใฎใขใผใญใใฏใใฃใใญใผใใงใใพใ๏ผ
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ไธ่ฌ็ใซใฏใไบๅๅญฆ็ฟๆธใฟใขใใซใฎใคใณในใฟใณในใใญใผใใใใใใซ`AutoTokenizer`ใฏใฉในใจ`TFAutoModelFor`ใฏใฉในใฎไฝฟ็จใใๅงใใใพใใ
+ใใใซใใใๅธธใซๆญฃใใใขใผใญใใฏใใฃใใญใผใใงใใพใใ
+ๆฌกใฎ[tutorial](preproccesing)ใงใฏใๆฐใใใญใผใใใใใผใฏใใคใถใ็ปๅใใญใปใใตใ็นๅพด้ๆฝๅบๅจใใใใณใใญใปใใตใไฝฟ็จใใฆใใใกใคใณใใฅใผใใณใฐ็จใซใใผใฟใปใใใๅๅฆ็ใใๆนๆณใๅญฆใณใพใใ
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/benchmarks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/benchmarks.md
new file mode 100644
index 0000000000000000000000000000000000000000..7312aae8ce5b7cade6efae449b0ede5cb13779e0
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/benchmarks.md
@@ -0,0 +1,381 @@
+
+
+# Benchmarks
+
+
+
+Hugging Faceใฎใใณใใใผใฏใใผใซใฏ้ๆจๅฅจใงใใใTransformerใขใใซใฎ้ๅบฆใจใกใขใชใฎ่ค้ใใๆธฌๅฎใใใใใซๅค้จใฎใใณใใใผใฏใฉใคใใฉใชใไฝฟ็จใใใใจใใๅงใใใพใใ
+
+
+
+[[open-in-colab]]
+
+๐ค Transformersใขใใซใใใณใใใผใฏใใใในใใใฉใฏใใฃในใใใงใซๅฉ็จๅฏ่ฝใชใใณใใใผใฏใซใคใใฆ่ฆใฆใฟใพใใใใ
+
+๐ค Transformersใขใใซใใใณใใใผใฏใใๆนๆณใซใคใใฆ่ฉณใใ่ชฌๆใใใใผใใใใฏใฏ[ใใกใ](https://github.com/huggingface/notebooks/tree/main/examples/benchmark.ipynb)ใงๅฉ็จใงใใพใใ
+
+## How to benchmark ๐ค Transformers models
+
+[`PyTorchBenchmark`]ใฏใฉในใจ[`TensorFlowBenchmark`]ใฏใฉในใไฝฟ็จใใใจใ๐ค Transformersใขใใซใๆ่ปใซใใณใใใผใฏใงใใพใใ
+ใใณใใใผใฏใฏใฉในใไฝฟ็จใใใจใ_ใใผใฏใกใขใชไฝฟ็จ้_ ใใใณ _ๅฟ
่ฆใชๆ้_ ใ _ๆจ่ซ_ ใใใณ _ใใฌใผใใณใฐ_ ใฎไธกๆนใซใคใใฆๆธฌๅฎใงใใพใใ
+
+
+
+ใใใงใฎ _ๆจ่ซ_ ใฏใๅไธใฎใใฉใฏใผใใในใซใใฃใฆๅฎ็พฉใใใ _ใใฌใผใใณใฐ_ ใฏๅไธใฎใใฉใฏใผใใในใจ
+ใใใฏใฏใผใใในใซใใฃใฆๅฎ็พฉใใใพใใ
+
+
+
+ใใณใใใผใฏใฏใฉใน[`PyTorchBenchmark`]ใจ[`TensorFlowBenchmark`]ใฏใใใใใใฎใใณใใใผใฏใฏใฉในใซๅฏพใใ้ฉๅใช่จญๅฎใๅซใ [`PyTorchBenchmarkArguments`] ใใใณ [`TensorFlowBenchmarkArguments`] ใฟใคใใฎใชใใธใงใฏใใๅฟ
่ฆใจใใพใใ
+[`PyTorchBenchmarkArguments`] ใใใณ [`TensorFlowBenchmarkArguments`] ใฏใใผใฟใฏใฉในใงใใใใใใใใฎใใณใใใผใฏใฏใฉในใซๅฏพใใใในใฆใฎ้ข้ฃใใ่จญๅฎใๅซใใงใใพใใ
+ๆฌกใฎไพใงใฏใใฟใคใ _bert-base-cased_ ใฎBERTใขใใซใใใณใใใผใฏใใๆนๆณใ็คบใใใฆใใพใใ
+
+
+
+```py
+>>> from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments
+
+>>> args = PyTorchBenchmarkArguments(models=["google-bert/bert-base-uncased"], batch_sizes=[8], sequence_lengths=[8, 32, 128, 512])
+>>> benchmark = PyTorchBenchmark(args)
+```
+
+
+```py
+>>> from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments
+
+>>> args = TensorFlowBenchmarkArguments(
+... models=["google-bert/bert-base-uncased"], batch_sizes=[8], sequence_lengths=[8, 32, 128, 512]
+... )
+>>> benchmark = TensorFlowBenchmark(args)
+```
+
+
+
+
+ใใใงใฏใใใณใใใผใฏๅผๆฐใฎใใผใฟใฏใฉในใซๅฏพใใฆใ`models`ใ`batch_sizes`
+ใใใณ`sequence_lengths`ใฎ3ใคใฎๅผๆฐใๆๅฎใใใฆใใพใใๅผๆฐ`models`ใฏๅฟ
้ ใงใ
+[ใขใใซใใ](https://huggingface.co/models)ใใใฎใขใใซ่ญๅฅๅญใฎ`ใชในใ`ใๆๅพ
ใ
+ใพใใ`batch_sizes`ใจ`sequence_lengths`ใฎ2ใคใฎ`ใชในใ`ๅผๆฐใฏ
+ใขใใซใฎใใณใใใผใฏๅฏพ่ฑกใจใชใ`input_ids`ใฎใตใคใบใๅฎ็พฉใใพใใ
+ใใณใใใผใฏๅผๆฐใใผใฟใฏใฉในใไปใใฆ่จญๅฎใงใใไปใฎๅคใใฎใใฉใกใผใฟใใใใพใใใใใใฎ่ฉณ็ดฐใซใคใใฆใฏใ็ดๆฅใใกใคใซ
+`src/transformers/benchmark/benchmark_args_utils.py`ใ
+`src/transformers/benchmark/benchmark_args.py`๏ผPyTorch็จ๏ผใใใใณ`src/transformers/benchmark/benchmark_args_tf.py`๏ผTensorflow็จ๏ผ
+ใๅ็
งใใใใๆฌกใฎใทใงใซใณใใณใใใซใผใใใๅฎ่กใใใจใPyTorchใจTensorflowใฎใใใใใซๅฏพใใฆ่จญๅฎๅฏ่ฝใชใในใฆใฎใใฉใกใผใฟใฎ่จ่ฟฐ็ใชใชในใใ่กจ็คบใใใพใใ
+
+
+
+```bash
+python examples/pytorch/benchmarking/run_benchmark.py --help
+```
+
+ใคใณในใฟใณในๅใใใใใณใใใผใฏใชใใธใงใฏใใฏใๅใซ `benchmark.run()` ใๅผใณๅบใใใจใงๅฎ่กใงใใพใใ
+
+
+```py
+>>> results = benchmark.run()
+>>> print(results)
+==================== INFERENCE - SPEED - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Time in s
+--------------------------------------------------------------------------------
+google-bert/bert-base-uncased 8 8 0.006
+google-bert/bert-base-uncased 8 32 0.006
+google-bert/bert-base-uncased 8 128 0.018
+google-bert/bert-base-uncased 8 512 0.088
+--------------------------------------------------------------------------------
+
+==================== INFERENCE - MEMORY - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Memory in MB
+--------------------------------------------------------------------------------
+google-bert/bert-base-uncased 8 8 1227
+google-bert/bert-base-uncased 8 32 1281
+google-bert/bert-base-uncased 8 128 1307
+google-bert/bert-base-uncased 8 512 1539
+--------------------------------------------------------------------------------
+
+==================== ENVIRONMENT INFORMATION ====================
+
+- transformers_version: 2.11.0
+- framework: PyTorch
+- use_torchscript: False
+- framework_version: 1.4.0
+- python_version: 3.6.10
+- system: Linux
+- cpu: x86_64
+- architecture: 64bit
+- date: 2020-06-29
+- time: 08:58:43.371351
+- fp16: False
+- use_multiprocessing: True
+- only_pretrain_model: False
+- cpu_ram_mb: 32088
+- use_gpu: True
+- num_gpus: 1
+- gpu: TITAN RTX
+- gpu_ram_mb: 24217
+- gpu_power_watts: 280.0
+- gpu_performance_state: 2
+- use_tpu: False
+```
+
+
+```bash
+python examples/tensorflow/benchmarking/run_benchmark_tf.py --help
+```
+
+ใคใณในใฟใณในๅใใใใใณใใใผใฏใชใใธใงใฏใใฏใๅใซ `benchmark.run()` ใๅผใณๅบใใใจใงๅฎ่กใงใใพใใ
+
+
+
+```py
+>>> results = benchmark.run()
+>>> print(results)
+>>> results = benchmark.run()
+>>> print(results)
+==================== INFERENCE - SPEED - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Time in s
+--------------------------------------------------------------------------------
+google-bert/bert-base-uncased 8 8 0.005
+google-bert/bert-base-uncased 8 32 0.008
+google-bert/bert-base-uncased 8 128 0.022
+google-bert/bert-base-uncased 8 512 0.105
+--------------------------------------------------------------------------------
+
+==================== INFERENCE - MEMORY - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Memory in MB
+--------------------------------------------------------------------------------
+google-bert/bert-base-uncased 8 8 1330
+google-bert/bert-base-uncased 8 32 1330
+google-bert/bert-base-uncased 8 128 1330
+google-bert/bert-base-uncased 8 512 1770
+--------------------------------------------------------------------------------
+
+==================== ENVIRONMENT INFORMATION ====================
+
+- transformers_version: 2.11.0
+- framework: Tensorflow
+- use_xla: False
+- framework_version: 2.2.0
+- python_version: 3.6.10
+- system: Linux
+- cpu: x86_64
+- architecture: 64bit
+- date: 2020-06-29
+- time: 09:26:35.617317
+- fp16: False
+- use_multiprocessing: True
+- only_pretrain_model: False
+- cpu_ram_mb: 32088
+- use_gpu: True
+- num_gpus: 1
+- gpu: TITAN RTX
+- gpu_ram_mb: 24217
+- gpu_power_watts: 280.0
+- gpu_performance_state: 2
+- use_tpu: False
+```
+
+
+
+ใใใฉใซใใงใฏใ_ๆจ่ซๆ้_ ใจ _ๅฟ
่ฆใชใกใขใช_ ใใใณใใใผใฏใใใพใใ
+ไธ่จใฎไพใฎๅบๅใงใฏใๆๅใฎ2ใคใฎใปใฏใทใงใณใ _ๆจ่ซๆ้_ ใจ _ๆจ่ซใกใขใช_
+ใซๅฏพๅฟใใ็ตๆใ็คบใใฆใใพใใใใใซใ่จ็ฎ็ฐๅขใซ้ขใใใในใฆใฎ้ข้ฃๆ
ๅ ฑใ
+ไพใใฐ GPU ใฟใคใใใทในใใ ใใฉใคใใฉใชใฎใใผใธใงใณใชใฉใใ_ENVIRONMENT INFORMATION_ ใฎไธใซ่กจ็คบใใใพใใใใฎๆ
ๅ ฑใฏใ[`PyTorchBenchmarkArguments`]
+ใใใณ [`TensorFlowBenchmarkArguments`] ใซๅผๆฐ `save_to_csv=True`
+ใ่ฟฝๅ ใใใใจใงใใชใใทใงใณใง _.csv_ ใใกใคใซใซไฟๅญใใใใจใใงใใพใใใใฎๅ ดๅใๅใปใฏใทใงใณใฏๅฅใ
ใฎ _.csv_ ใใกใคใซใซไฟๅญใใใพใใ_.csv_
+ใใกใคใซใธใฎใในใฏใใใผใฟใฏใฉในใฎๅผๆฐใไฝฟ็จใใฆใชใใทใงใณใงๅฎ็พฉใงใใพใใ
+
+ใขใใซ่ญๅฅๅญใไพใใฐ `google-bert/bert-base-uncased` ใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใใใณใใใผใฏใใไปฃใใใซใๅฉ็จๅฏ่ฝใชไปปๆใฎใขใใซใฏใฉในใฎไปปๆใฎ่จญๅฎใใใณใใใผใฏใใใใจใใงใใพใใใใฎๅ ดๅใใใณใใใผใฏๅผๆฐใจๅ
ฑใซ่จญๅฎใฎ `list` ใๆฟๅ
ฅใใๅฟ
่ฆใใใใพใใ
+
+
+
+
+```py
+>>> from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments, BertConfig
+
+>>> args = PyTorchBenchmarkArguments(
+... models=["bert-base", "bert-384-hid", "bert-6-lay"], batch_sizes=[8], sequence_lengths=[8, 32, 128, 512]
+... )
+>>> config_base = BertConfig()
+>>> config_384_hid = BertConfig(hidden_size=384)
+>>> config_6_lay = BertConfig(num_hidden_layers=6)
+
+>>> benchmark = PyTorchBenchmark(args, configs=[config_base, config_384_hid, config_6_lay])
+>>> benchmark.run()
+==================== INFERENCE - SPEED - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Time in s
+--------------------------------------------------------------------------------
+bert-base 8 128 0.006
+bert-base 8 512 0.006
+bert-base 8 128 0.018
+bert-base 8 512 0.088
+bert-384-hid 8 8 0.006
+bert-384-hid 8 32 0.006
+bert-384-hid 8 128 0.011
+bert-384-hid 8 512 0.054
+bert-6-lay 8 8 0.003
+bert-6-lay 8 32 0.004
+bert-6-lay 8 128 0.009
+bert-6-lay 8 512 0.044
+--------------------------------------------------------------------------------
+
+==================== INFERENCE - MEMORY - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Memory in MB
+--------------------------------------------------------------------------------
+bert-base 8 8 1277
+bert-base 8 32 1281
+bert-base 8 128 1307
+bert-base 8 512 1539
+bert-384-hid 8 8 1005
+bert-384-hid 8 32 1027
+bert-384-hid 8 128 1035
+bert-384-hid 8 512 1255
+bert-6-lay 8 8 1097
+bert-6-lay 8 32 1101
+bert-6-lay 8 128 1127
+bert-6-lay 8 512 1359
+--------------------------------------------------------------------------------
+
+==================== ENVIRONMENT INFORMATION ====================
+
+- transformers_version: 2.11.0
+- framework: PyTorch
+- use_torchscript: False
+- framework_version: 1.4.0
+- python_version: 3.6.10
+- system: Linux
+- cpu: x86_64
+- architecture: 64bit
+- date: 2020-06-29
+- time: 09:35:25.143267
+- fp16: False
+- use_multiprocessing: True
+- only_pretrain_model: False
+- cpu_ram_mb: 32088
+- use_gpu: True
+- num_gpus: 1
+- gpu: TITAN RTX
+- gpu_ram_mb: 24217
+- gpu_power_watts: 280.0
+- gpu_performance_state: 2
+- use_tpu: False
+```
+
+
+```py
+>>> from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments, BertConfig
+
+>>> args = TensorFlowBenchmarkArguments(
+... models=["bert-base", "bert-384-hid", "bert-6-lay"], batch_sizes=[8], sequence_lengths=[8, 32, 128, 512]
+... )
+>>> config_base = BertConfig()
+>>> config_384_hid = BertConfig(hidden_size=384)
+>>> config_6_lay = BertConfig(num_hidden_layers=6)
+
+>>> benchmark = TensorFlowBenchmark(args, configs=[config_base, config_384_hid, config_6_lay])
+>>> benchmark.run()
+==================== INFERENCE - SPEED - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Time in s
+--------------------------------------------------------------------------------
+bert-base 8 8 0.005
+bert-base 8 32 0.008
+bert-base 8 128 0.022
+bert-base 8 512 0.106
+bert-384-hid 8 8 0.005
+bert-384-hid 8 32 0.007
+bert-384-hid 8 128 0.018
+bert-384-hid 8 512 0.064
+bert-6-lay 8 8 0.002
+bert-6-lay 8 32 0.003
+bert-6-lay 8 128 0.0011
+bert-6-lay 8 512 0.074
+--------------------------------------------------------------------------------
+
+==================== INFERENCE - MEMORY - RESULT ====================
+--------------------------------------------------------------------------------
+Model Name Batch Size Seq Length Memory in MB
+--------------------------------------------------------------------------------
+bert-base 8 8 1330
+bert-base 8 32 1330
+bert-base 8 128 1330
+bert-base 8 512 1770
+bert-384-hid 8 8 1330
+bert-384-hid 8 32 1330
+bert-384-hid 8 128 1330
+bert-384-hid 8 512 1540
+bert-6-lay 8 8 1330
+bert-6-lay 8 32 1330
+bert-6-lay 8 128 1330
+bert-6-lay 8 512 1540
+--------------------------------------------------------------------------------
+
+==================== ENVIRONMENT INFORMATION ====================
+
+- transformers_version: 2.11.0
+- framework: Tensorflow
+- use_xla: False
+- framework_version: 2.2.0
+- python_version: 3.6.10
+- system: Linux
+- cpu: x86_64
+- architecture: 64bit
+- date: 2020-06-29
+- time: 09:38:15.487125
+- fp16: False
+- use_multiprocessing: True
+- only_pretrain_model: False
+- cpu_ram_mb: 32088
+- use_gpu: True
+- num_gpus: 1
+- gpu: TITAN RTX
+- gpu_ram_mb: 24217
+- gpu_power_watts: 280.0
+- gpu_performance_state: 2
+- use_tpu: False
+```
+
+
+
+ใซในใฟใใคใบใใใBertModelใฏใฉในใฎๆงๆใซๅฏพใใๆจ่ซๆ้ใจๅฟ
่ฆใชใกใขใชใฎใใณใใใผใฏ
+
+ใใฎๆฉ่ฝใฏใใขใใซใใใฌใผใใณใฐใใ้ใซใฉใฎๆงๆใ้ธๆใในใใใๆฑบๅฎใใ้ใซ็นใซๅฝน็ซใคใใจใใใใพใใ
+
+## Benchmark best practices
+
+ใใฎใปใฏใทใงใณใงใฏใใขใใซใใใณใใใผใฏใใ้ใซๆณจๆใในใใใใคใใฎใในใใใฉใฏใใฃในใใชในใใขใใใใฆใใพใใ
+
+- ็พๅจใๅไธใใใคในใฎใใณใใใผใฏใใใตใใผใใใใฆใใพใใใGPUใงใใณใใใผใฏใๅฎ่กใใๅ ดๅใใณใผใใๅฎ่กใใใใใคในใใฆใผใถใผใๆๅฎใใใใจใๆจๅฅจใใพใใ
+ ใใใฏใทใงใซใง`CUDA_VISIBLE_DEVICES`็ฐๅขๅคๆฐใ่จญๅฎใใใใจใง่กใใพใใไพ๏ผ`export CUDA_VISIBLE_DEVICES=0`ใๅฎ่กใใฆใใใณใผใใๅฎ่กใใพใใ
+- `no_multi_processing`ใชใใทใงใณใฏใใในใใใใณใใใใฐ็จใซใฎใฟ`True`ใซ่จญๅฎใในใใงใใๆญฃ็ขบใชใกใขใช่จๆธฌใ็ขบไฟใใใใใซใๅใกใขใชใใณใใใผใฏใๅฅใ
ใฎใใญใปในใงๅฎ่กใใใใจใใๅงใใใพใใใใใซใใใ`no_multi_processing`ใ`True`ใซ่จญๅฎใใใพใใ
+- ใขใใซใฎใใณใใใผใฏ็ตๆใๅ
ฑๆใใ้ใซใฏใๅธธใซ็ฐๅขๆ
ๅ ฑใ่จ่ฟฐใใในใใงใใ็ฐใชใGPUใใใคในใใฉใคใใฉใชใใผใธใงใณใชใฉใงใใณใใใผใฏ็ตๆใๅคงใใ็ฐใชใๅฏ่ฝๆงใใใใใใใใณใใใผใฏ็ตๆๅไฝใงใฏใณใใฅใใใฃใซใจใฃใฆใใพใๆ็จใงใฏใใใพใใใ
+
+## Sharing your benchmark
+
+ไปฅๅใใในใฆใฎๅฉ็จๅฏ่ฝใชใณใขใขใใซ๏ผๅฝๆ10ใขใใซ๏ผใซๅฏพใใฆใๅคใใฎ็ฐใชใ่จญๅฎใงๆจ่ซๆ้ใฎใใณใใใผใฏใ่กใใใพใใ๏ผPyTorchใไฝฟ็จใใTorchScriptใฎๆ็กใTensorFlowใไฝฟ็จใใXLAใฎๆ็กใชใฉใงใใใใใใฎใในใใฏใในใฆCPUใง่กใใใพใใ๏ผTensorFlow XLAใ้คใ๏ผใ
+
+ใใฎใขใใญใผใใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ๆฌกใฎใใญใฐใในใ](https://medium.com/huggingface/benchmarking-transformers-pytorch-and-tensorflow-e2917fb891c2)ใซ่ฉณใใ่ชฌๆใใใฆใใใ็ตๆใฏ[ใใกใ](https://docs.google.com/spreadsheets/d/1sryqufw2D0XlUH4sq3e9Wnxu5EAQkaohzrJbd5HdQ_w/edit?usp=sharing)ใงๅฉ็จใงใใพใใ
+
+ๆฐใใใใณใใใผใฏใใผใซใไฝฟ็จใใใจใใณใใฅใใใฃใจใใณใใใผใฏ็ตๆใๅ
ฑๆใใใใจใใใใพใงไปฅไธใซ็ฐกๅใซใชใใพใใ
+
+- [PyTorchใใณใใใผใฏ็ตๆ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/benchmarking/README.md)ใ
+- [TensorFlowใใณใใใผใฏ็ตๆ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/benchmarking/README.md)ใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/bertology.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/bertology.md
new file mode 100644
index 0000000000000000000000000000000000000000..167ed007bbe4374d0983c95e3e9a104725bef947
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/bertology.md
@@ -0,0 +1,34 @@
+
+
+
+# BERTology
+
+ๅคง่ฆๆจกใชใใฉใณในใใฉใผใใผใไพใใฐBERTใฎๅ
้จๅไฝใ่ชฟๆปใใ็ ็ฉถ้ ๅใๆฅๆ้ทใใฆใใพใ๏ผใใใใBERTologyใใจใๅผใณใพใ๏ผใใใฎๅ้ใฎ่ฏใไพใฏไปฅไธใงใ๏ผ
+
+- BERT Rediscovers the Classical NLP Pipeline by Ian Tenney, Dipanjan Das, Ellie Pavlick:
+ [่ซๆใชใณใฏ](https://arxiv.org/abs/1905.05950)
+- Are Sixteen Heads Really Better than One? by Paul Michel, Omer Levy, Graham Neubig: [่ซๆใชใณใฏ](https://arxiv.org/abs/1905.10650)
+- What Does BERT Look At? An Analysis of BERT's Attention by Kevin Clark, Urvashi Khandelwal, Omer Levy, Christopher D. Manning: [่ซๆใชใณใฏ](https://arxiv.org/abs/1906.04341)
+- CAT-probing: A Metric-based Approach to Interpret How Pre-trained Models for Programming Language Attend Code Structure: [่ซๆใชใณใฏ](https://arxiv.org/abs/2210.04633)
+
+ใใฎๆฐใใๅ้ใฎ็บๅฑใๆฏๆดใใใใใซใBERT/GPT/GPT-2ใขใใซใซใใใคใใฎ่ฟฝๅ ๆฉ่ฝใ็ตใฟ่พผใฟใไบบใ
ใๅ
้จ่กจ็พใซใขใฏใปในใงใใใใใซใใพใใใใใใใฎๆฉ่ฝใฏใไธปใซPaul Michelๆฐใฎๅชใใ็ ็ฉถ๏ผ[่ซๆใชใณใฏ](https://arxiv.org/abs/1905.10650)๏ผใซๅบใฅใใฆใใพใใๅ
ทไฝ็ใซใฏใไปฅไธใฎๆฉ่ฝใๅซใพใใฆใใพใ๏ผ
+
+- BERT/GPT/GPT-2ใฎใในใฆใฎ้ ใ็ถๆ
ใซใขใฏใปในใใใใจใใงใใพใใ
+- BERT/GPT/GPT-2ใฎๅใใใใฎๆณจๆ้ใฟใซใขใฏใปในใงใใพใใ
+- ใใใใฎๅบๅๅคใจๅพ้
ใๅๅพใใใใใใฎ้่ฆๆงในใณใขใ่จ็ฎใใ[่ซๆใชใณใฏ](https://arxiv.org/abs/1905.10650)ใง่ชฌๆใใใฆใใใใใซใใใใๅๆธใงใใพใใ
+
+ใใใใฎๆฉ่ฝใ็่งฃใใไฝฟ็จใใใฎใๆฏๆดใใใใใซใ็นๅฎใฎใตใณใใซในใฏใชใใใ[bertology.py](https://github.com/huggingface/transformers/tree/main/examples/research_projects/bertology/run_bertology.py)ใใ่ฟฝๅ ใใพใใใใใฎในใฏใชใใใฏใGLUEใงไบๅใใฌใผใใณใฐใใใใขใใซใใๆ
ๅ ฑใๆฝๅบใใใใใใๅๆธใใๅฝนๅฒใๆใใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/big_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/big_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..78852dc4374cceafdded1d91a69a0ae04e3d90ea
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/big_models.md
@@ -0,0 +1,130 @@
+
+
+# Instantiating a big model
+
+้ๅธธใซๅคง่ฆๆจกใชไบๅๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใๅ ดๅใRAMใฎไฝฟ็จ้ใๆๅฐ้ใซๆใใใใจใฏ่ชฒ้กใฎ1ใคใงใใ้ๅธธใฎPyTorchใฎใฏใผใฏใใญใผใฏๆฌกใฎใจใใใงใ๏ผ
+
+1. ใฉใณใใ ใช้ใฟใๆใคใขใใซใไฝๆใใพใใ
+2. ไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใใญใผใใใพใใ
+3. ใใใใฎไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใใฉใณใใ ใชใขใใซใซ้
็ฝฎใใพใใ
+
+ในใใใ1ใจ2ใฎไธกๆนใใกใขใชใซใขใใซใฎๅฎๅ
จใชใใผใธใงใณใๅฟ
่ฆใจใใใปใจใใฉใฎๅ ดๅใฏๅ้กใใใพใใใใใขใใซใฎใตใคใบใๆฐใฎใฌใใคใใซใชใใจใใใใใฎ2ใคใฎใณใใผใRAMใใๆ้คใใใใจใใงใใชใใชใๅฏ่ฝๆงใใใใพใใใใใซๆชใใใจใซใๅๆฃใใฌใผใใณใฐใๅฎ่กใใใใใซ`torch.distributed`ใไฝฟ็จใใฆใใๅ ดๅใๅใใญใปในใฏไบๅๅญฆ็ฟๆธใฟใขใใซใใญใผใใใใใใใฎ2ใคใฎใณใใผใRAMใซไฟๅญใใพใใ
+
+
+
+ใฉใณใใ ใซไฝๆใใใใขใใซใฏใใกใขใชๅ
ใซใ็ฉบใฎใใใณใฝใซใงๅๆๅใใใพใใใใใใฎใฉใณใใ ใชๅคใฏใใกใขใชใฎ็นๅฎใฎใใฃใณใฏใซใใฃใใใฎใไฝฟ็จใใพใ๏ผใใใใฃใฆใใฉใณใใ ใชๅคใฏใใฎๆ็นใงใฎใกใขใชใใฃใณใฏๅ
ใฎๅคใงใ๏ผใใขใใซ/ใใฉใกใผใฟใฎ็จฎ้กใซ้ฉใใๅๅธ๏ผใใจใใฐใๆญฃ่ฆๅๅธ๏ผใซๅพใใฉใณใใ ใชๅๆๅใฏใในใใใ3ใงๅๆๅใใใฆใใชใ้ใฟใซๅฏพใใฆใใงใใใ ใ้ซ้ใซๅฎ่กใใใพใ๏ผ
+
+
+
+ใใฎใฌใคใใงใฏใTransformersใใใฎๅ้กใซๅฏพๅฆใใใใใซๆไพใใใฝใชใฅใผใทใงใณใๆขใใพใใใชใใใใใฏ็พๅจใ้็บใ้ฒ่กไธญใฎๅ้ใงใใใๅฐๆฅใใใใง่ชฌๆใใใฆใใAPIใใใใใซๅคๆดใใใๅฏ่ฝๆงใใใใใจใซๆณจๆใใฆใใ ใใใ
+
+## Sharded checkpoints
+
+ใใผใธใงใณ4.18.0ใใใ10GBใ่ถ
ใใใตใคใบใฎใขใใซใใงใใฏใใคใณใใฏ่ชๅ็ใซ่คๆฐใฎๅฐใใช้จๅใซๅๅฒใใใพใใ`model.save_pretrained(save_dir)`ใๅฎ่กใใ้ใซ1ใคใฎๅไธใฎใใงใใฏใใคใณใใๆใคไปฃใใใซใใใใคใใฎ้จๅ็ใชใใงใใฏใใคใณใ๏ผใใใใใฎใตใคใบใ<10GB๏ผใจใใใฉใกใผใฟๅใใใใใๆ ผ็ดใใใฆใใใใกใคใซใซใใใใใใคใณใใใฏในใ็ๆใใใพใใ
+
+`max_shard_size`ใใฉใกใผใฟใงใทใฃใผใใฃใณใฐๅใฎๆๅคงใตใคใบใๅถๅพกใงใใใใใไพใจใใฆ้ๅธธใตใคใบใฎใขใใซใจๅฐใใชใทใฃใผใใตใคใบใไฝฟ็จใใพใใๅพๆฅใฎBERTใขใใซใไฝฟ็จใใฆใฟใพใใใใ
+
+
+```py
+from transformers import AutoModel
+
+model = AutoModel.from_pretrained("google-bert/bert-base-cased")
+```
+
+ใใ[`~PreTrainedModel.save_pretrained`]ใไฝฟ็จใใฆไฟๅญใใๅ ดๅใๆฐใใใใฉใซใใ2ใคใฎใใกใคใซใๅซใๅฝขใงไฝๆใใใพใ: ใขใใซใฎ่จญๅฎๆ
ๅ ฑใจใใฎ้ใฟๆ
ๅ ฑใงใใ
+
+```py
+>>> import os
+>>> import tempfile
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir)
+... print(sorted(os.listdir(tmp_dir)))
+['config.json', 'pytorch_model.bin']
+```
+
+ๆๅคงใทใฃใผใใตใคใบใ200MBใซ่จญๅฎใใพใ๏ผ
+
+```py
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... print(sorted(os.listdir(tmp_dir)))
+['config.json', 'pytorch_model-00001-of-00003.bin', 'pytorch_model-00002-of-00003.bin', 'pytorch_model-00003-of-00003.bin', 'pytorch_model.bin.index.json']
+```
+
+ใขใใซใฎ่จญๅฎใฎไธใซใ3ใคใฎ็ฐใชใ้ใฟใใกใคใซใจใ`index.json`ใใกใคใซใ่ฆใใใพใใใใใฏ็งใใกใฎใคใณใใใฏในใงใใ
+ใใฎใใใชใใงใใฏใใคใณใใฏใ[`~PreTrainedModel.from_pretrained`]ใกใฝใใใไฝฟ็จใใฆๅฎๅ
จใซๅใญใผใใงใใพใ๏ผ
+
+```py
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... new_model = AutoModel.from_pretrained(tmp_dir)
+```
+
+ไธป่ฆใชๅฉ็นใฏใๅคง่ฆๆจกใชใขใใซใฎๅ ดๅใไธ่จใฎใฏใผใฏใใญใผใฎในใใใ2ใซใใใฆใๅใใงใใฏใใคใณใใฎใทใฃใผใใๅใฎใทใฃใผใใฎๅพใซใญใผใใใใRAMใฎใกใขใชไฝฟ็จ้ใใขใใซใฎใตใคใบใจๆๅคงใฎใทใฃใผใใฎใตใคใบใๅใใใใใฎใซๅถ้ใงใใใใจใงใใ
+
+ๅ
้จใงใฏใใคใณใใใฏในใใกใคใซใไฝฟ็จใใใใฉใฎใญใผใใใงใใฏใใคใณใใซๅญๅจใใๅฏพๅฟใใ้ใฟใใฉใใซๆ ผ็ดใใใฆใใใใๅคๆญใใพใใใใฎใคใณใใใฏในใฏ้ๅธธใฎJSONใใกใคใซใฎใใใซ่ชญใฟ่พผใใใจใใงใใ่พๆธใจใใฆๅๅพใงใใพใใ
+
+
+```py
+>>> import json
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... with open(os.path.join(tmp_dir, "pytorch_model.bin.index.json"), "r") as f:
+... index = json.load(f)
+
+>>> print(index.keys())
+dict_keys(['metadata', 'weight_map'])
+```
+
+ใกใฟใใผใฟใซใฏ็พๆ็นใงใฏใขใใซใฎ็ทใตใคใบใฎใฟใๅซใพใใฆใใพใใ
+ๅฐๆฅ็ใซใฏไปใฎๆ
ๅ ฑใ่ฟฝๅ ใใไบๅฎใงใ๏ผ
+
+```py
+>>> index["metadata"]
+{'total_size': 433245184}
+```
+
+้ใฟใใใใฏใใฎใคใณใใใฏในใฎไธป่ฆใช้จๅใงใใใๅใใฉใกใผใฟๅ๏ผ้ๅธธใฏPyTorchใขใใซใฎ`state_dict`ใง่ฆใคใใใใฎ๏ผใใใฎๆ ผ็ดใใใฆใใใใกใคใซใซใใใใใพใ๏ผ
+
+```py
+>>> index["weight_map"]
+{'embeddings.LayerNorm.bias': 'pytorch_model-00001-of-00003.bin',
+ 'embeddings.LayerNorm.weight': 'pytorch_model-00001-of-00003.bin',
+ ...
+```
+
+็ดๆฅใขใใซๅ
ใง[`~PreTrainedModel.from_pretrained`]ใไฝฟ็จใใใซใ
+ใทใฃใผใใฃใณใฐใใใใใงใใฏใใคใณใใใญใผใใใใๅ ดๅ๏ผใใซใใงใใฏใใคใณใใฎๅ ดๅใซ`model.load_state_dict()`ใไฝฟ็จใใใใใซ่กใๆนๆณ๏ผใ[`~modeling_utils.load_sharded_checkpoint`]ใไฝฟ็จใใๅฟ
่ฆใใใใพใ๏ผ
+
+
+```py
+>>> from transformers.modeling_utils import load_sharded_checkpoint
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... load_sharded_checkpoint(model, tmp_dir)
+```
+
+
+## Low memory loading
+
+ใทใฃใผใใใใใใงใใฏใใคใณใใฏใไธ่จใฎใฏใผใฏใใญใผใฎในใใใ2ใซใใใใกใขใชไฝฟ็จ้ใๅๆธใใพใใใ
+ไฝใกใขใชใฎ็ฐๅขใงใใฎใขใใซใไฝฟ็จใใใใใซใAccelerateใฉใคใใฉใชใซๅบใฅใใๅฝ็คพใฎใใผใซใๆดป็จใใใใจใใๅงใใใพใใ
+
+่ฉณ็ดฐใซใคใใฆใฏใไปฅไธใฎใฌใคใใใ่ฆงใใ ใใ๏ผ[Accelerateใไฝฟ็จใใๅคง่ฆๆจกใขใใซใฎ่ชญใฟ่พผใฟ](./main_classes/model#large-model-loading)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/chat_templating.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/chat_templating.md
new file mode 100644
index 0000000000000000000000000000000000000000..ebe0a68fd42cca8aedf5c0166c88e7fa49e0069e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/chat_templating.md
@@ -0,0 +1,249 @@
+
+
+# Chat Templates
+
+## Introduction
+
+LLM๏ผLanguage Model๏ผใฎใพใใพใไธ่ฌ็ใชไฝฟ็จไบไพใฎ1ใคใฏใใใฃใใใใงใใ
+ใใฃใใใฎใณใณใใญในใใงใฏใ้ๅธธใฎ่จ่ชใขใใซใฎใใใซๅไธใฎใใญในใในใใชใณใฐใ็ถ็ถใใใฎใงใฏใชใใใขใใซใฏ1ใคไปฅไธใฎใใกใใปใผใธใใใใชใไผ่ฉฑใ็ถ็ถใใพใใ
+ๅใกใใปใผใธใซใฏใใญใผใซใใจใกใใปใผใธใใญในใใๅซใพใใพใใ
+
+ๆใไธ่ฌ็ใซใใใใใฎใญใผใซใฏใฆใผใถใผใใใฎใกใใปใผใธใซใฏใใฆใผใถใผใใใขใใซใใใฎใกใใปใผใธใซใฏใใขใทในใฟใณใใใๅฒใๅฝใฆใใใพใใ
+ไธ้จใฎใขใใซใฏใใทในใใ ใใญใผใซใใตใใผใใใฆใใพใใ
+ใทในใใ ใกใใปใผใธใฏ้ๅธธไผ่ฉฑใฎ้ๅงๆใซ้ไฟกใใใใขใใซใฎๅไฝๆนๆณใซ้ขใใๆ็คบใๅซใพใใพใใ
+
+ใในใฆใฎ่จ่ชใขใใซใใใฃใใ็จใซๅพฎ่ชฟๆดใใใใขใใซใๅซใใในใฆใฎใขใใซใฏใใใผใฏใณใฎใชใใขใทใผใฑใณในใงๅไฝใใใญใผใซใซ็นๆใฎ็นๅฅใชๅฆ็ใๆใกใพใใใ
+ใคใพใใใญใผใซๆ
ๅ ฑใฏ้ๅธธใใกใใปใผใธ้ใซๅถๅพกใใผใฏใณใ่ฟฝๅ ใใฆๆณจๅ
ฅใใใใกใใปใผใธใฎๅข็ใจ้ข้ฃใใใญใผใซใ็คบใใใจใงๆไพใใใพใใ
+
+ๆฎๅฟตใชใใใใใผใฏใณใฎไฝฟ็จๆนๆณใซใคใใฆใฏ๏ผใพใ ๏ผ๏ผๆจๆบใๅญๅจใใใ็ฐใชใใขใใซใฏใใฃใใ็จใฎใใฉใผใใใใๅถๅพกใใผใฏใณใๅคงใใ็ฐใชใๅฝขๅผใงใใฌใผใใณใฐใใใฆใใพใใ
+ใใใฏใฆใผใถใผใซใจใฃใฆๅฎ้ใฎๅ้กใซใชใๅฏ่ฝๆงใใใใพใใๆญฃใใใใฉใผใใใใไฝฟ็จใใชใใจใใขใใซใฏๅ
ฅๅใซๆททไนฑใใใใใฉใผใใณในใๆฌๆฅใใใ้ฅใใซไฝไธใใพใใ
+ใใใใใใฃใใใใณใใฌใผใใใ่งฃๆฑบใใใใจใใๅ้กใงใใ
+
+ใใฃใใไผ่ฉฑใฏ้ๅธธใๅ่พๆธใใใญใผใซใใจใใณใณใใณใใใฎใญใผใๅซใฟใๅไธใฎใใฃใใใกใใปใผใธใ่กจใใชในใใจใใฆ่กจ็พใใใพใใ
+ใใฃใใใใณใใฌใผใใฏใๆๅฎใใใใขใใซใฎไผ่ฉฑใๅไธใฎใใผใฏใณๅๅฏ่ฝใชใทใผใฑใณในใซใฉใฎใใใซใใฉใผใใใใใใใๆๅฎใใJinjaใใณใใฌใผใใๅซใๆๅญๅใงใใ
+ใใผใฏใใคใถใจใใฎๆ
ๅ ฑใไฟๅญใใใใจใซใใใใขใใซใๆๅพ
ใใๅฝขๅผใฎๅ
ฅๅใใผใฟใๅๅพใงใใใใใซใชใใพใใ
+
+ใใฃใใใ`BlenderBot` ใขใใซใไฝฟ็จใใไพใ็คบใใฆๅ
ทไฝ็ใซใใพใใใใ`BlenderBot` ใฎใใใฉใซใใใณใใฌใผใใฏ้ๅธธใซใทใณใใซใงใใปใจใใฉใๅฏพ่ฉฑใฎใฉใฆใณใ้ใซ็ฉบ็ฝใ่ฟฝๅ ใใใ ใใงใใ
+
+
+```python
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
+
+>>> chat = [
+... {"role": "user", "content": "Hello, how are you?"},
+... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
+... {"role": "user", "content": "I'd like to show off how chat templating works!"},
+... ]
+
+>>> tokenizer.apply_chat_template(chat, tokenize=False)
+" Hello, how are you? I'm doing great. How can I help you today? I'd like to show off how chat templating works!"
+```
+
+ๆๅฎใใใ้ใใใใฃใใๅ
จไฝใๅไธใฎๆๅญๅใซใพใจใใใใฆใใพใใใใใฉใซใใฎ่จญๅฎใงใใใtokenize=Trueใใไฝฟ็จใใใจใ
+ใใฎๆๅญๅใใใผใฏใณๅใใใพใใใใใใใใ่ค้ใชใใณใใฌใผใใๅฎ้ใซใฉใฎใใใซๆฉ่ฝใใใใ็ขบ่ชใใใใใซใ
+ใmeta-llama/Llama-2-7b-chat-hfใใขใใซใไฝฟ็จใใฆใฟใพใใใใใใ ใใใใฎใขใใซใฏใฒใผใไปใใขใฏใปในใๆใฃใฆใใใ
+ใใฎใณใผใใๅฎ่กใใๅ ดๅใฏ[ใชใใธใใชใงใขใฏใปในใใชใฏใจในใ](https://huggingface.co/meta-llama/Llama-2-7b-chat-hf)ใใๅฟ
่ฆใใใใพใใ
+
+```python
+>> from transformers import AutoTokenizer
+>> tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-2-7b-chat-hf")
+
+>> chat = [
+... {"role": "user", "content": "Hello, how are you?"},
+... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
+... {"role": "user", "content": "I'd like to show off how chat templating works!"},
+... ]
+
+>> tokenizer.use_default_system_prompt = False
+>> tokenizer.apply_chat_template(chat, tokenize=False)
+"[INST] Hello, how are you? [/INST] I'm doing great. How can I help you today? [INST] I'd like to show off how chat templating works! [/INST]"
+```
+
+ไปๅใใใผใฏใใคใถใฏๅถๅพกใใผใฏใณ [INST] ใจ [/INST] ใ่ฟฝๅ ใใพใใใใใใใฏใฆใผใถใผใกใใปใผใธใฎ้ๅงใจ็ตไบใ็คบใใใใฎใใฎใงใ๏ผใใ ใใใขใทในใฟใณใใกใใปใผใธใซใฏ้ฉ็จใใใพใใ๏ผ๏ผ
+
+## How do chat templates work?
+
+ใขใใซใฎใใฃใใใใณใใฌใผใใฏใ`tokenizer.chat_template`ๅฑๆงใซๆ ผ็ดใใใฆใใพใใใใฃใใใใณใใฌใผใใ่จญๅฎใใใฆใใชใๅ ดๅใใใฎใขใใซใฏใฉในใฎใใใฉใซใใใณใใฌใผใใไปฃใใใซไฝฟ็จใใใพใใ`BlenderBot`ใฎใใณใใฌใผใใ่ฆใฆใฟใพใใใ:
+
+```python
+
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
+
+>>> tokenizer.chat_template
+"{% for message in messages %}{% if message['role'] == 'user' %}{{ ' ' }}{% endif %}{{ message['content'] }}{% if not loop.last %}{{ ' ' }}{% endif %}{% endfor %}{{ eos_token }}"
+```
+
+
+ใใใฏๅฐใๆๅง็ใงใใญใๅฏ่ชญๆงใ้ซใใใใใซใๆฐใใ่กใจใคใณใใณใใ่ฟฝๅ ใใพใใใใ
+ๅใใญใใฏใฎ็ดๅใฎ็ฉบ็ฝใจใใใญใใฏใฎ็ดๅพใฎๆๅใฎๆน่กใฏใใใใฉใซใใงJinjaใฎ `trim_blocks` ใใใณ `lstrip_blocks` ใใฉใฐใไฝฟ็จใใฆๅ้คใใพใใ
+ใใใซใใใใคใณใใณใใจๆน่กใๅซใใใณใใฌใผใใๆธใใฆใๆญฃๅธธใซๆฉ่ฝใใใใจใใงใใพใใ
+
+```
+{% for message in messages %}
+ {% if message['role'] == 'user' %}
+ {{ ' ' }}
+ {% endif %}
+ {{ message['content'] }}
+ {% if not loop.last %}
+ {{ ' ' }}
+ {% endif %}
+{% endfor %}
+{{ eos_token }}
+```
+
+ใใใๅใใฆ่ฆใๆนใธใใใใฏ[Jinjaใใณใใฌใผใ](https://jinja.palletsprojects.com/en/3.1.x/templates/)ใงใใ
+Jinjaใฏใใญในใใ็ๆใใใใใฎใทใณใใซใชใณใผใใ่จ่ฟฐใงใใใใณใใฌใผใ่จ่ชใงใใๅคใใฎ็นใงใใณใผใใจ
+ๆงๆใฏPythonใซไผผใฆใใพใใ็ด็ฒใชPythonใงใฏใใใฎใใณใใฌใผใใฏๆฌกใฎใใใซใชใใงใใใ๏ผ
+
+```python
+for idx, message in enumerate(messages):
+ if message['role'] == 'user':
+ print(' ')
+ print(message['content'])
+ if not idx == len(messages) - 1: # Check for the last message in the conversation
+ print(' ')
+print(eos_token)
+```
+
+ๅฎ้ใซใใใฎใใณใใฌใผใใฏๆฌกใฎ3ใคใฎใใจใ่กใใพใ๏ผ
+1. ๅใกใใปใผใธใซๅฏพใใฆใใกใใปใผใธใใฆใผใถใผใกใใปใผใธใงใใๅ ดๅใใใใฎๅใซ็ฉบ็ฝใ่ฟฝๅ ใใใใไปฅๅคใฎๅ ดๅใฏไฝใ่กจ็คบใใพใใใ
+2. ใกใใปใผใธใฎๅ
ๅฎนใ่ฟฝๅ ใใพใใ
+3. ใกใใปใผใธใๆๅพใฎใกใใปใผใธใงใชใๅ ดๅใใใฎๅพใซ2ใคใฎในใใผในใ่ฟฝๅ ใใพใใๆๅพใฎใกใใปใผใธใฎๅพใซใฏEOSใใผใฏใณใ่กจ็คบใใพใใ
+
+ใใใฏ้ๅธธใซใทใณใใซใชใใณใใฌใผใใงใใๅถๅพกใใผใฏใณใ่ฟฝๅ ใใชใใใใขใใซใซๅฏพใใๆ็คบใไผใใไธ่ฌ็ใชๆนๆณใงใใใใทในใใ ใใกใใปใผใธใใตใใผใใใฆใใพใใใ
+ใใ ใใJinjaใฏใใใใฎใใจใ่กใใใใฎๅคใใฎๆ่ปๆงใๆไพใใฆใใพใ๏ผ
+LLaMAใใใฉใผใใใใใๆนๆณใซ้กไผผใใๅ
ฅๅใใใฉใผใใใใใใใใฎJinjaใใณใใฌใผใใ่ฆใฆใฟใพใใใ
+๏ผๅฎ้ใฎLLaMAใใณใใฌใผใใฏใใใฉใซใใฎใทในใใ ใกใใปใผใธใฎๅฆ็ใใไธ่ฌ็ใชใทในใใ ใกใใปใผใธใฎๅฆ็ใ่ฅๅนฒ็ฐใชใใใใ
+ๅฎ้ใฎใณใผใใงใฏใใฎใใณใใฌใผใใไฝฟ็จใใชใใงใใ ใใ๏ผ๏ผ
+
+
+```
+{% for message in messages %}
+ {% if message['role'] == 'user' %}
+ {{ bos_token + '[INST] ' + message['content'] + ' [/INST]' }}
+ {% elif message['role'] == 'system' %}
+ {{ '<>\\n' + message['content'] + '\\n< >\\n\\n' }}
+ {% elif message['role'] == 'assistant' %}
+ {{ ' ' + message['content'] + ' ' + eos_token }}
+ {% endif %}
+{% endfor %}
+```
+
+้กใใใฐใๅฐใ่ฆใคใใฆใใใ ใใใฐใใใฎใใณใใฌใผใใไฝใ่กใฃใฆใใใใใใใใใใใใพใใใ
+ใใฎใใณใใฌใผใใฏใๅใกใใปใผใธใฎใๅฝนๅฒใใซๅบใฅใใฆ็นๅฎใฎใใผใฏใณใ่ฟฝๅ ใใพใใใใใใฎใใผใฏใณใฏใใกใใปใผใธใ้ไฟกใใไบบใ่กจใใใฎใงใใ
+ใฆใผใถใผใใขใทในใฟใณใใใใใณใทในใใ ใกใใปใผใธใฏใใใใใๅซใพใใใใผใฏใณใซใใฃใฆใขใใซใซใใฃใฆๆ็ขบใซๅบๅฅใใใพใใ
+
+
+## How do I create a chat template?
+
+็ฐกๅใงใใๅ็ดใซJinjaใใณใใฌใผใใๆธใใฆใ`tokenizer.chat_template`ใ่จญๅฎใใพใใ
+ไปใฎใขใใซใใๆขๅญใฎใใณใใฌใผใใๅง็นใซใใฆใๅฟ
่ฆใซๅฟใใฆ็ทจ้ใใใจไพฟๅฉใใใใใพใใ๏ผ
+ไพใใฐใไธ่จใฎLLaMAใใณใใฌใผใใๅใฃใฆใใขใทในใฟใณใใกใใปใผใธใซ"[ASST]"ใจ"[/ASST]"ใ่ฟฝๅ ใงใใพใใ
+
+```
+{% for message in messages %}
+ {% if message['role'] == 'user' %}
+ {{ bos_token + '[INST] ' + message['content'].strip() + ' [/INST]' }}
+ {% elif message['role'] == 'system' %}
+ {{ '<>\\n' + message['content'].strip() + '\\n< >\\n\\n' }}
+ {% elif message['role'] == 'assistant' %}
+ {{ '[ASST] ' + message['content'] + ' [/ASST]' + eos_token }}
+ {% endif %}
+{% endfor %}
+```
+
+ๆฌกใซใๅใซ`tokenizer.chat_template`ๅฑๆงใ่จญๅฎใใฆใใ ใใใ
+ๆฌกๅใ[`~PreTrainedTokenizer.apply_chat_template`]ใไฝฟ็จใใ้ใซใๆฐใใใใณใใฌใผใใไฝฟ็จใใใพใ๏ผ
+ใใฎๅฑๆงใฏ`tokenizer_config.json`ใใกใคใซใซไฟๅญใใใใใใ[`~utils.PushToHubMixin.push_to_hub`]ใไฝฟ็จใใฆ
+ๆฐใใใใณใใฌใผใใHubใซใขใใใญใผใใใใฟใใชใๆญฃใใใใณใใฌใผใใไฝฟ็จใใฆใใใใจใ็ขบ่ชใงใใพใ๏ผ
+
+```python
+template = tokenizer.chat_template
+template = template.replace("SYS", "SYSTEM") # Change the system token
+tokenizer.chat_template = template # Set the new template
+tokenizer.push_to_hub("model_name") # Upload your new template to the Hub!
+```
+
+[`~PreTrainedTokenizer.apply_chat_template`] ใกใฝใใใฏใใใชใใฎใใฃใใใใณใใฌใผใใไฝฟ็จใใใใใซ `TextGenerationPipeline` ใฏใฉในใซใใฃใฆๅผใณๅบใใใพใใ
+ใใใใฃใฆใๆญฃใใใใฃใใใใณใใฌใผใใ่จญๅฎใใใจใใใชใใฎใขใใซใฏ่ชๅ็ใซ [`TextGenerationPipeline`] ใจไบๆๆงใใใใใใซใชใใพใใ
+
+
+## What are "default" templates?
+
+ใใฃใใใใณใใฌใผใใฎๅฐๅ
ฅๅใซใใใฃใใใฎๅฆ็ใฏใขใใซใฏใฉในใฌใใซใงใใผใใณใผใใใใฆใใพใใใ
+ๅพๆนไบๆๆงใฎใใใซใใใฎใฏใฉในๅบๆใฎๅฆ็ใใใใฉใซใใใณใใฌใผใใจใใฆไฟๆใใใฏใฉในใฌใใซใง่จญๅฎใใใฆใใพใใ
+ใขใใซใซใใฃใใใใณใใฌใผใใ่จญๅฎใใใฆใใชใๅ ดๅใใใ ใใขใใซใฏใฉในใฎใใใฉใซใใใณใใฌใผใใใใๅ ดๅใ
+`TextGenerationPipeline`ใฏใฉในใ`apply_chat_template`ใชใฉใฎใกใฝใใใฏใฏใฉในใใณใใฌใผใใไฝฟ็จใใพใใ
+ใใผใฏใใคใถใฎใใใฉใซใใฎใใฃใใใใณใใฌใผใใ็ขบ่ชใใใซใฏใ`tokenizer.default_chat_template`ๅฑๆงใใใงใใฏใใฆใใ ใใใ
+
+ใใใฏใๅพๆนไบๆๆงใฎใใใซ็ด็ฒใซ่กใฃใฆใใใใจใงใๆขๅญใฎใฏใผใฏใใญใผใๅฃใใชใใใใซใใฆใใพใใ
+ใขใใซใซใจใฃใฆใฏใฉในใใณใใฌใผใใ้ฉๅใงใใๅ ดๅใงใใใใใฉใซใใใณใใฌใผใใใชใผใใผใฉใคใใใฆ
+`chat_template`ๅฑๆงใๆ็คบ็ใซ่จญๅฎใใใใจใๅผทใใๅงใใใพใใใใใซใใใใฆใผใถใผใซใจใฃใฆ
+ใขใใซใใใฃใใ็จใซๆญฃใใๆงๆใใใฆใใใใจใๆ็ขบใซใชใใใใใฉใซใใใณใใฌใผใใๅคๆดใใใใๅปๆญขใใใๅ ดๅใซๅใใใใจใใงใใพใใ
+
+## What template should I use?
+
+ใใงใซใใฃใใใฎใใฌใผใใณใฐใๅใใใขใใซใฎใใณใใฌใผใใ่จญๅฎใใๅ ดๅใใใณใใฌใผใใใใฌใผใใณใฐไธญใซใขใใซใ่ฆใใกใใปใผใธใฎใใฉใผใใใใจใพใฃใใไธ่ดใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+ใใใงใชใๅ ดๅใๆง่ฝใฎไฝไธใ็ต้จใใๅฏ่ฝๆงใ้ซใใงใใใใใฏใขใใซใใใใซใใฌใผใใณใฐใใฆใใๅ ดๅใงใๅๆงใงใ - ใใฃใใใใผใฏใณใไธๅฎใซไฟใคใจใใใใใๆ้ซใฎๆง่ฝใๅพใใใพใใ
+ใใใฏใใผใฏใณๅใจ้ๅธธใซ้กไผผใใฆใใใ้ๅธธใฏใใฌใผใใณใฐไธญใซไฝฟ็จใใใใใผใฏใณๅใจๆญฃ็ขบใซไธ่ดใใๅ ดๅใซใๆจ่ซใพใใฏใใกใคใณใใฅใผใใณใฐใฎ้ใซๆ่ฏใฎๆง่ฝใๅพใใใพใใ
+
+ไธๆนใใผใญใใใขใใซใใใฌใผใใณใฐใใใใใใฃใใใฎใใใซใใผใน่จ่ชใขใใซใใใกใคใณใใฅใผใใณใฐใใๅ ดๅใ้ฉๅใชใใณใใฌใผใใ้ธๆใใ่ช็ฑๅบฆใใใใพใใ
+LLM๏ผLanguage Model๏ผใฏใใพใใพใชๅ
ฅๅๅฝขๅผใๅฆ็ใงใใใปใฉในใใผใใงใใใฏใฉในๅบๆใฎใใณใใฌใผใใใชใใขใใซ็จใฎใใใฉใซใใใณใใฌใผใใฏใไธ่ฌ็ใชใฆใผในใฑใผในใซๅฏพใใฆ่ฏใๆ่ปใช้ธๆ่ขใงใใ
+ใใใฏใ`ChatMLใใฉใผใใใ`ใซๅพใฃใใใฎใงใๅคใใฎใฆใผในใฑใผในใซ้ฉใใฆใใพใใๆฌกใฎใใใซใชใใพใ๏ผ
+
+```
+{% for message in messages %}
+ {{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}
+{% endfor %}
+```
+
+If you like this one, here it is in one-liner form, ready to copy into your code:
+
+```python
+tokenizer.chat_template = "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}"
+```
+
+ใใฎใใณใใฌใผใใฏใๅใกใใปใผใธใใ``ใใใผใฏใณใงๅฒใฟใๅฝนๅฒใๆๅญๅใจใใฆๅ็ดใซ่จ่ฟฐใใพใใ
+ใใใซใใใใใฌใผใใณใฐใงไฝฟ็จใใๅฝนๅฒใซๅฏพใใๆ่ปๆงใๅพใใใพใใๅบๅใฏไปฅไธใฎใใใซใชใใพใ๏ผ
+
+
+```
+<|im_start|>system
+You are a helpful chatbot that will do its best not to say anything so stupid that people tweet about it.<|im_end|>
+<|im_start|>user
+How are you?<|im_end|>
+<|im_start|>assistant
+I'm doing great!<|im_end|>
+```
+
+ใใฆใผใถใผใใใใทในใใ ใใใใใณใใขใทในใฟใณใใใฎๅฝนๅฒใฏใใใฃใใใฎๆจๆบใงใใ
+็นใซใ`TextGenerationPipeline`ใจใฎ้ฃๆบใในใ ใผใบใซ่กใๅ ดๅใซใฏใใใใใฎๅฝนๅฒใไฝฟ็จใใใใจใใๅงใใใพใใใใ ใใใใใใฎๅฝนๅฒใซๅถ็ดใฏใใใพใใใใใณใใฌใผใใฏ้ๅธธใซๆ่ปใงใไปปๆใฎๆๅญๅใๅฝนๅฒใจใใฆไฝฟ็จใงใใพใใ
+
+## I want to use chat templates! How should I get started?
+
+ใใฃใใใขใใซใๆใฃใฆใใๅ ดๅใใใฎใขใใซใฎ`tokenizer.chat_template`ๅฑๆงใ่จญๅฎใใ[`~PreTrainedTokenizer.apply_chat_template`]ใไฝฟ็จใใฆใในใใใๅฟ
่ฆใใใใพใใ
+ใใใฏใขใใซใฎๆๆ่
ใงใชใๅ ดๅใงใ้ฉ็จใใใพใใใขใใซใฎใชใใธใใชใ็ฉบใฎใใฃใใใใณใใฌใผใใไฝฟ็จใใฆใใๅ ดๅใใพใใฏใใใฉใซใใฎใฏใฉในใใณใใฌใผใใไฝฟ็จใใฆใใๅ ดๅใงใใ
+ใใฎๅฑๆงใ้ฉๅใซ่จญๅฎใงใใใใใซ[ใใซใชใฏใจในใ](https://huggingface.co/docs/hub/repositories-pull-requests-discussions)ใ้ใใฆใใ ใใใ
+
+ไธๅบฆๅฑๆงใ่จญๅฎใใใใฐใใใใงๅฎไบใงใ๏ผ `tokenizer.apply_chat_template`ใฏใใใฎใขใใซใซๅฏพใใฆๆญฃใใๅไฝใใใใใซใชใใพใใใใใฏใ
+`TextGenerationPipeline` ใชใฉใฎๅ ดๆใงใ่ชๅ็ใซใตใใผใใใใพใใ
+
+ใขใใซใใใฎๅฑๆงใๆใคใใจใ็ขบ่ชใใใใจใงใใชใผใใณใฝใผในใขใใซใฎๅ
จใณใใฅใใใฃใใใฎใใซใใฏใผใไฝฟ็จใงใใใใใซใชใใพใใ
+ใใฉใผใใใใฎไธไธ่ดใฏใใฎๅ้ใซๆฉใฟ็ถใใใใใฉใผใใณในใซ้ปใฃใฆๅฝฑ้ฟใไธใใฆใใพใใใใใใ็ตใใใใๆใๆฅใพใใ๏ผ
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/community.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/community.md
new file mode 100644
index 0000000000000000000000000000000000000000..ffe28d042d237e6ddfaeec7d554b690d140a7411
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/community.md
@@ -0,0 +1,69 @@
+
+
+# Community
+
+ใใฎใใผใธใฏใใณใใฅใใใฃใซใใฃใฆ้็บใใใ๐ค Transformersใซ้ขใใใชใฝใผในใใพใจใใใใฎใงใใ
+
+## Community resources:
+
+| ใชใฝใผใน | ่ชฌๆ | ไฝ่
|
+|:----------|:-------------|------:|
+| [Hugging Face Transformers Glossary Flashcards](https://www.darigovresearch.com/huggingface-transformers-glossary-flashcards) | [Transformers Docs Glossary](glossary)ใซๅบใฅใใใใฉใใทใฅใซใผใใปใใใงใใใใฎใปใใใฏใ้ทๆใฎ็ฅ่ญๅฎ็ใ็นใซ่ๆ
ฎใใฆ่จญ่จใใใใชใผใใณใฝใผในใฎใฏใญในใใฉใใใใฉใผใ ใขใใชใงใใ[Anki](https://apps.ankiweb.net/)ใไฝฟ็จใใฆ็ฐกๅใซๅญฆ็ฟ/ๅพฉ็ฟใงใใๅฝขๅผใซใชใฃใฆใใพใใ[ใใฉใใทใฅใซใผใใฎไฝฟ็จๆนๆณใซ้ขใใ็ดนไปใใใชใฏใใกใ](https://www.youtube.com/watch?v=Dji_h7PILrw)ใใ่ฆงใใ ใใใ | [Darigov Research](https://www.darigovresearch.com/) |
+
+## Community notebooks:
+
+| ใใผใใใใฏ | ่ชฌๆ | ่่
| |
+|:----------|:-------------|:-------------|------:|
+| [ไบๅๅญฆ็ฟๆธใฟใฎTransformerใๅพฎ่ชฟๆดใใฆๆญ่ฉใ็ๆ](https://github.com/AlekseyKorshuk/huggingartists) | GPT-2ใขใใซใๅพฎ่ชฟๆดใใฆใๆฐใซๅ
ฅใใฎใขใผใใฃในใใฎในใฟใคใซใงๆญ่ฉใ็ๆใใๆนๆณ | [Aleksey Korshuk](https://github.com/AlekseyKorshuk) | [](https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb) |
+| [Tensorflow 2ใงT5ใใใฌใผใใณใฐ](https://github.com/snapthat/TF-T5-text-to-text) | Tensorflow 2ใไฝฟ็จใใฆไปปๆใฎใฟในใฏใซๅฏพใใฆT5ใใใฌใผใใณใฐใใๆนๆณใใใฎใใผใใใใฏใฏTensorflow 2ใไฝฟ็จใใฆSQUADใงๅฎ่ฃ
ใใใ่ณชๅใจๅ็ญใฟในใฏใ็คบใใฆใใพใใ | [Muhammad Harris](https://github.com/HarrisDePerceptron) | [](https://colab.research.google.com/github/snapthat/TF-T5-text-to-text/blob/master/snapthatT5/notebooks/TF-T5-Datasets%20Training.ipynb) |
+| [TPUใงT5ใใใฌใผใใณใฐ](https://github.com/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb) | TransformersใจNlpใไฝฟ็จใใฆSQUADใงT5ใใใฌใผใใณใฐใใๆนๆณ | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb#scrollTo=QLGiFCDqvuil) |
+| [ๅ้กใจๅค่ข้ธๆใฎใใใซT5ใๅพฎ่ชฟๆด](https://github.com/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) | PyTorch Lightningใไฝฟ็จใใฆใใญในใๅฏพใใญในใๅฝขๅผใงT5ใๅ้กใจๅค่ข้ธๆใฟในใฏใซๅพฎ่ชฟๆดใใๆนๆณ | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) |
+| [ๆฐใใใใผใฟใปใใใจ่จ่ชใงDialoGPTใๅพฎ่ชฟๆด](https://github.com/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) | DialoGPTใขใใซใๆฐใใใใผใฟใปใใใงใชใผใใณใใคใขใญใฐไผ่ฉฑ็จใฎๅพฎ่ชฟๆดใใๆนๆณ | [Nathan Cooper](https://github.com/ncoop57) | [](https://colab.research.google.com/github/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) |
+| [Reformerใไฝฟ็จใใ้ทใใทใผใฑใณในใขใใชใณใฐ](https://github.com/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) | Reformerใไฝฟ็จใใฆ500,000ใใผใฏใณใพใงใฎใทใผใฑใณในใใใฌใผใใณใฐใใๆนๆณ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) |
+| [่ฆ็ดใฎใใใซBARTใๅพฎ่ชฟๆด](https://github.com/ohmeow/ohmeow_website/blob/master/posts/2021-05-25-mbart-sequence-classification-with-blurr.ipynb) | Blurrใไฝฟ็จใใฆ่ฆ็ดใฎใใใซBARTใๅพฎ่ชฟๆดใใๆนๆณ | [Wayde Gilliam](https://ohmeow.com/) | [](https://colab.research.google.com/github/ohmeow/ohmeow_website/blob/master/posts/2021-05-25-mbart-sequence-classification-with-blurr.ipynb) |
+| [ไบๅๅญฆ็ฟๆธใฟใฎTransformerใๅพฎ่ชฟๆดใใฆ่ชฐใใฎใใคใผใใ็ๆ](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) | GPT-2ใขใใซใๅพฎ่ชฟๆดใใฆใๆฐใซๅ
ฅใใฎTwitterใขใซใฆใณใใฎในใฟใคใซใงใใคใผใใ็ๆใใๆนๆณ | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) |
+| [๐ค Hugging FaceใขใใซใWeights & Biasesใงๆ้ฉๅ](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) | Hugging FaceใจWeights & Biasesใฎ็ตฑๅใ็คบใๅฎๅ
จใชใใฅใผใใชใขใซ | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) |
+| [Longformerใฎไบๅๅญฆ็ฟ](https://github.com/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) | ๆขๅญใฎไบๅๅญฆ็ฟๆธใฟใขใใซใฎใ้ทใใใใผใธใงใณใๆง็ฏใใๆนๆณ | [Iz Beltagy](https://beltagy.net) | [](https://colab.research.google.com/github/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) |
+| [QAใฟในใฏใฎใใใซLongformerใๅพฎ่ชฟๆด](https://github.com/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) | QAใฟในใฏใฎใใใซLongformerใขใใซใๅพฎ่ชฟๆดใใๆนๆณ | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) |
+| [๐คnlpใไฝฟ็จใใใขใใซใฎ่ฉไพก](https://github.com/patrickvonplaten/notebooks/blob/master/How_to_evaluate_Longformer_on_TriviaQA_using_NLP.ipynb) | `nlp`ใไฝฟ็จใใฆTriviaQAใงLongformerใ่ฉไพกใใๆนๆณ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/drive/1m7eTGlPmLRgoPkkA7rkhQdZ9ydpmsdLE?usp=sharing) |
+| [ๆๆ
ในใใณๆฝๅบใฎใใใซT5ใๅพฎ่ชฟๆด](https://github.com/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) | PyTorch Lightningใไฝฟ็จใใฆๆๆ
ในใใณๆฝๅบใฎใใใซT5ใๅพฎ่ชฟๆดใใๆนๆณ | [Lorenzo Ampil](https://github.com/enzoampil) | [](https://colab.research.google.com/github/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) |
+| [DistilBertใใใซใใฏใฉในๅ้กใซใใกใคใณใใฅใผใใณใฐ](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb) | PyTorchใไฝฟ็จใใฆDistilBertใใใซใใฏใฉในๅ้กใซใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Abhishek Kumar Mishra](https://github.com/abhimishra91) | [](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb)|
+|[BERTใใใซใใฉใใซๅ้กใซใใกใคใณใใฅใผใใณใฐ](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)|PyTorchใไฝฟ็จใใฆBERTใใใซใใฉใใซๅ้กใซใใกใคใณใใฅใผใใณใฐใใๆนๆณ|[Abhishek Kumar Mishra](https://github.com/abhimishra91) |[](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)|
+|[T5ใ่ฆ็ดใซใใกใคใณใใฅใผใใณใฐ](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb)|PyTorchใไฝฟ็จใใฆT5ใ่ฆ็ดใซใใกใคใณใใฅใผใใณใฐใใWandBใงๅฎ้จใใใฉใใญใณใฐใใๆนๆณ|[Abhishek Kumar Mishra](https://github.com/abhimishra91) |[](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb)|
+|[ใใคใใใใฏใใใฃใณใฐ/ใใฑใใใฃใณใฐใไฝฟ็จใใฆTransformersใฎใใกใคใณใใฅใผใใณใฐใ้ซ้ๅ](https://github.com/ELS-RD/transformers-notebook/blob/master/Divide_Hugging_Face_Transformers_training_time_by_2_or_more.ipynb)|ใใคใใใใฏใใใฃใณใฐ/ใใฑใใใฃใณใฐใไฝฟ็จใใฆใใกใคใณใใฅใผใใณใฐใ2ๅ้ซ้ๅใใๆนๆณ|[Michael Benesty](https://github.com/pommedeterresautee) |[](https://colab.research.google.com/drive/1CBfRU1zbfu7-ijiOqAAQUA-RJaxfcJoO?usp=sharing)|
+|[ใในใฏ่จ่ชใขใใชใณใฐใฎใใใฎReformerใฎไบๅๅญฆ็ฟ](https://github.com/patrickvonplaten/notebooks/blob/master/Reformer_For_Masked_LM.ipynb)|ๅๆนๅใปใซใใขใใณใทใงใณใฌใคใคใผใๅใใReformerใขใใซใฎใใฌใผใใณใฐๆนๆณ|[Patrick von Platen](https://github.com/patrickvonplaten) |[](https://colab.research.google.com/drive/1tzzh0i8PgDQGV3SMFUGxM7_gGae3K-uW?usp=sharing)|
+|[Sci-BERTใๆกๅผตใใฆใใกใคใณใใฅใผใใณใฐ](https://github.com/lordtt13/word-embeddings/blob/master/COVID-19%20Research%20Data/COVID-SciBERT.ipynb)|AllenAIใฎCORDใใผใฟใปใใใงไบๅๅญฆ็ฟๆธใฟใฎSciBERTใขใใซใฎ่ชๅฝใๆกๅผตใใใใคใใฉใคใณๅใใๆนๆณ|[Tanmay Thakur](https://github.com/lordtt13) |[](https://colab.research.google.com/drive/1rqAR40goxbAfez1xvF3hBJphSCsvXmh8)|
+|[Trainer APIใไฝฟ็จใใฆBlenderBotSmallใ่ฆ็ดใฎใใใซใใกใคใณใใฅใผใใณใฐ](https://github.com/lordtt13/transformers-experiments/blob/master/Custom%20Tasks/fine-tune-blenderbot_small-for-summarization.ipynb)|ใซในใฟใ ใใผใฟใปใใใงBlenderBotSmallใ่ฆ็ดใฎใใใซใใกใคใณใใฅใผใใณใฐใใๆนๆณใTrainer APIใไฝฟ็จ|[Tanmay Thakur](https://github.com/lordtt13) |[](https://colab.research.google.com/drive/19Wmupuls7mykSGyRN_Qo6lPQhgp56ymq?usp=sharing)|
+|[ElectraใใใกใคใณใใฅใผใใณใฐใใฆCaptum Integrated Gradientsใง่งฃ้](https://github.com/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb) |Electraใๆๆ
ๅๆใฎใใใซใใกใคใณใใฅใผใใณใฐใใCaptum Integrated Gradientsใงไบๆธฌใ่งฃ้ใใๆนๆณ|[Eliza Szczechla](https://elsanns.github.io) |[](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb)|
+|[Trainerใฏใฉในใไฝฟ็จใใฆ้่ฑ่ชใฎGPT-2ใขใใซใใใกใคใณใใฅใผใใณใฐ](https://github.com/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb) |Trainerใฏใฉในใไฝฟ็จใใฆ้่ฑ่ชใฎGPT-2ใขใใซใใใกใคใณใใฅใผใใณใฐใใๆนๆณ|[Philipp Schmid](https://www.philschmid.de) |[](https://colab.research.google.com/github/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb)|
+|[DistilBERTใขใใซใใใซใใฉใใซๅ้กใฟในใฏใฎใใใซใใกใคใณใใฅใผใใณใฐ](https://github.com/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb) |DistilBERTใขใใซใใใซใใฉใใซๅ้กใฟในใฏใฎใใใซใใกใคใณใใฅใผใใณใฐใใๆนๆณ|[Dhaval Taunk](https://github.com/DhavalTaunk08) |[](https://colab.research.google.com/github/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb)|
+|[ALBERTใๆใใขๅ้กใฟในใฏใฎใใใซใใกใคใณใใฅใผใใณใฐ](https://github.com/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb) |ALBERTใขใใซใพใใฏไปใฎBERTใใผในใฎใขใใซใๆใใขๅ้กใฟในใฏใฎใใใซใใกใคใณใใฅใผใใณใฐใใๆนๆณ|[Nadir El Manouzi](https://github.com/NadirEM) |[](https://colab.research.google.com/github/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb)|
+|[RoBERTaใๆๆ
ๅๆใฎใใใซใใกใคใณใใฅใผใใณใฐ](https://github.com/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb) |RoBERTaใขใใซใๆๆ
ๅๆใฎใใใซใใกใคใณใใฅใผใใณใฐใใๆนๆณ|[Dhaval Taunk](https://github.com/DhavalTaunk08) |[](https://colab.research.google.com/github/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb)|
+|[่ณชๅ็ๆใขใใซใฎ่ฉไพก](https://github.com/flexudy-pipe/qugeev) | seq2seqใใฉใณในใใฉใผใใผใขใใซใซใใฃใฆ็ๆใใใ่ณชๅใฎๅ็ญใฎๆญฃ็ขบใใ่ฉไพกใใๆนๆณ | [Pascal Zoleko](https://github.com/zolekode) | [](https://colab.research.google.com/drive/1bpsSqCQU-iw_5nNoRm_crPq6FRuJthq_?usp=sharing)|
+|[DistilBERTใจTensorflowใไฝฟ็จใใฆใใญในใใๅ้ก](https://github.com/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb) | TensorFlowใงใใญในใๅ้กใฎใใใซDistilBERTใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Peter Bayerle](https://github.com/peterbayerle) | [](https://colab.research.google.com/github/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb)|
+|[CNN/Dailymailใงใฎใจใณใณใผใใผใใณใผใใผ่ฆ็ดใซBERTใๆดป็จ](https://github.com/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb) | *google-bert/bert-base-uncased* ใใงใใฏใใคใณใใไฝฟ็จใใฆCNN/Dailymailใฎ่ฆ็ดใฎใใใซ *EncoderDecoderModel* ใใฆใฉใผใ ในใฟใผใใใๆนๆณ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb)|
+|[BBC XSumใงใฎใจใณใณใผใใผใใณใผใใผ่ฆ็ดใซRoBERTaใๆดป็จ](https://github.com/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb) | *FacebookAI/roberta-base* ใใงใใฏใใคใณใใไฝฟ็จใใฆBBC/XSumใฎ่ฆ็ดใฎใใใฎๅ
ฑๆ *EncoderDecoderModel* ใใฆใฉใผใ ในใฟใผใใใๆนๆณ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb)|
+|[TAPASใใทใผใฑใณใทใฃใซ่ณชๅๅฟ็ญ๏ผSQA๏ผใงใใกใคใณใใฅใผใใณใฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) | ใทใผใฑใณใทใฃใซ่ณชๅๅฟ็ญ๏ผSQA๏ผใใผใฟใปใใใง *tapas-base* ใใงใใฏใใคใณใใไฝฟ็จใใฆ *TapasForQuestionAnswering* ใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb)|
+|[TabFactใงTAPASใ่ฉไพก](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb) | *tapas-base-finetuned-tabfact* ใใงใใฏใใคใณใใไฝฟ็จใใฆใใกใคใณใใฅใผใใณใฐใใใ *TapasForSequenceClassification* ใ่ฉไพกใใๆนๆณใ๐ค datasets ใจ ๐ค transformers ใฉใคใใฉใชใ็ตใฟๅใใใฆไฝฟ็จ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb)|
+|[็ฟป่จณใฎใใใฎmBARTใใใกใคใณใใฅใผใใณใฐ](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb) | Seq2SeqTrainerใไฝฟ็จใใฆHindiใใEnglishใธใฎ็ฟป่จณใฎใใใซmBARTใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb)|
+|[FUNSD๏ผใใฉใผใ ็่งฃใใผใฟใปใใ๏ผใงLayoutLMใใใกใคใณใใฅใผใใณใฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb) | ในใญใฃใณใใใใใญใฅใกใณใใใใฎๆ
ๅ ฑๆฝๅบใฎใใใซFUNSDใใผใฟใปใใใง *LayoutLMForTokenClassification* ใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb)|
+| [DistilGPT2ใฎใใกใคใณใใฅใผใใณใฐใจใใญในใ็ๆ](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb) | DistilGPT2ใฎใใกใคใณใใฅใผใใณใฐใจใใญในใ็ๆๆนๆณ | [Aakash Tripathi](https://github.com/tripathiaakash) | [](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb)|
+| [ๆๅคง8KใใผใฏใณใงใฎLEDใฎใใกใคใณใใฅใผใใณใฐ](https://github.com/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb) | ใญใณใฐใฌใณใธ่ฆ็ดใฎใใใฎpubmedใงLEDใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb)|
+| [ArxivใงใฎLEDใฎ่ฉไพก](https://github.com/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb) | ใญใณใฐใฌใณใธ่ฆ็ดใฎใใใฎLEDใฎๅนๆ็ใช่ฉไพกๆนๆณ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb)|
+| [RVL-CDIP๏ผๆๆธ็ปๅๅ้กใใผใฟใปใใ๏ผใงใฎLayoutLMใฎใใกใคใณใใฅใผใใณใฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb) | ในใญใฃใณใใใๆๆธใฎๅ้กใฎใใใฎRVL-CDIPใใผใฟใปใใใง*LayoutLMForSequenceClassification*ใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb)|
+| [Wav2Vec2 CTCใใณใผใใฃใณใฐใจGPT2ใฎ่ชฟๆด](https://github.com/voidful/huggingface_notebook/blob/main/xlsr_gpt.ipynb) | ่จ่ชใขใใซใฎ่ชฟๆดใไผดใCTCใทใผใฑใณในใฎใใณใผใใฃใณใฐๆนๆณ | [Eric Lam](https://github.com/voidful) | [](https://colab.research.google.com/drive/1e_z5jQHYbO2YKEaUgzb1ww1WwiAyydAj?usp=sharing)|
+| [Trainerใฏใฉในใไฝฟ็จใใ2่จ่ชใฎ่ฆ็ด็จใซBARTใใใกใคใณใใฅใผใใณใฐ](https://github.com/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb) | ใใฌใผใใผใฏใฉในใไฝฟ็จใใฆ2ใคใฎ่จ่ชใงใฎ่ฆ็ด็จใซBARTใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Eliza Szczechla](https://github.com/elsanns) | [](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb)|
+| [PubMedใใผใฟใปใใใงBigBirdใฎ่ฉไพก](https://github.com/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb) | Trivia QAใฎ้ทใใใญใฅใกใณใ่ณชๅๅฟ็ญใงBigBirdใฎ่ฉไพกๆนๆณ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb)|
+| [Wav2Vec2ใไฝฟ็จใใฆใใใชใฎๅญๅนใไฝๆใใ](https://github.com/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) | Wav2Vecใงใชใผใใฃใชใ่ปข่จใใฆไปปๆใฎใใใชใใYouTubeใฎๅญๅนใไฝๆใใๆนๆณ | [Niklas Muennighoff](https://github.com/Muennighoff) |[](https://colab.research.google.com/github/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) |
+| [PyTorch Lightningใไฝฟ็จใใCIFAR-10ใงใฎVision Transformerใฎใใกใคใณใใฅใผใใณใฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) | HuggingFace TransformersใDatasetsใใใใณPyTorch Lightningใไฝฟ็จใใฆCIFAR-10ใงVision Transformer๏ผViT๏ผใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) |
+| [๐ค Trainerใไฝฟ็จใใCIFAR-10ใงใฎVision Transformerใฎใใกใคใณใใฅใผใใณใฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) | HuggingFace TransformersใDatasetsใใใใณ๐ค Trainerใไฝฟ็จใใฆCIFAR-10ใงVision Transformer๏ผViT๏ผใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) |
+| [Open EntityใใจใณใใฃใใฃใฟใคใใณใฐใใผใฟใปใใใงLUKEใฎ่ฉไพก](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) | Open Entityใใผใฟใปใใใง*LukeForEntityClassification*ใฎ่ฉไพกๆนๆณ | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) |
+| [TACREDใ้ขไฟๆฝๅบใใผใฟใปใใใงLUKEใฎ่ฉไพก](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) | TACREDใใผใฟใปใใใง*LukeForEntityPairClassification*ใฎ่ฉไพกๆนๆณ | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) |
+| [CoNLL-2003ใ้่ฆใชNERใใณใใใผใฏใงLUKEใฎ่ฉไพก](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) | CoNLL-2003ใใผใฟใปใใใง*LukeForEntitySpanClassification*ใฎ่ฉไพกๆนๆณ | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) |
+| [PubMedใใผใฟใปใใใงBigBird-Pegasusใฎ่ฉไพก](https://github.com/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) | PubMedใใผใฟใปใใใง*BigBirdPegasusForConditionalGeneration*ใฎ่ฉไพกๆนๆณ | [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) |
+| [Wav2Vec2ใไฝฟ็จใใในใใผใใจใขใผใทใงใณๅ้ก](https://github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) | MEGAใใผใฟใปใใใงใฎๆๆ
ๅ้กใฎใใใฎไบๅๅญฆ็ฟๆธใฟWav2Vec2ใขใใซใฎๅฉ็จๆนๆณ | [Mehrdad Farahani](https://github.com/m3hrdadfi) | [](https://colab.research.google.com/github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) |
+| [DETRใไฝฟ็จใใฆ็ปๅๅ
ใฎใชใใธใงใฏใใๆคๅบใใ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) | ใใฌใผใใณใฐๆธใฟ*DetrForObjectDetection*ใขใใซใไฝฟ็จใใฆ็ปๅๅ
ใฎใชใใธใงใฏใใๆคๅบใใๆณจๆใๅฏ่ฆๅใใๆนๆณ | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) |
+| [ใซในใฟใ ใชใใธใงใฏใๆคๅบใใผใฟใปใใใงDETRใใใกใคใณใใฅใผใใณใฐใใ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) | ใซในใฟใ ใชใใธใงใฏใๆคๅบใใผใฟใปใใใง*DetrForObjectDetection*ใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) |
+| [Named Entity RecognitionใฎใใใซT5ใใใกใคใณใใฅใผใใณใฐ](https://github.com/ToluClassics/Notebooks/blob/main/T5_Ner_Finetuning.ipynb) | Named Entity RecognitionใฟในใฏใงT5ใใใกใคใณใใฅใผใใณใฐใใๆนๆณ | [Ogundepo Odunayo](https://github.com/ToluClassics) | [](https://colab.research.google.com/drive/1obr78FY_cBmWY5ODViCmzdY6O1KB65Vc?usp=sharing) |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/create_a_model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/create_a_model.md
new file mode 100644
index 0000000000000000000000000000000000000000..fdb23f98e7b1077631f034290f69718421749e1a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/create_a_model.md
@@ -0,0 +1,420 @@
+
+
+# Create a custom architecture
+
+[`AutoClass`](model_doc/auto)ใฏใใขใใซใฎใขใผใญใใฏใใฃใ่ชๅ็ใซๆจ่ซใใไบๅๅญฆ็ฟๆธใฟใฎ่จญๅฎใจ้ใฟใใใฆใณใญใผใใใพใใไธ่ฌ็ใซใฏใใใงใใฏใใคใณใใซไพๅญใใชใใณใผใใ็ๆใใใใใซ`AutoClass`ใไฝฟ็จใใใใจใใๅงใใใพใใใใ ใใ็นๅฎใฎใขใใซใใฉใกใผใฟใซๅฏพใใๅถๅพกใใใ่ฉณ็ดฐใซ่กใใใใฆใผใถใผใฏใใใใคใใฎๅบๆฌใฏใฉในใใใซในใฟใ ๐ค Transformersใขใใซใไฝๆใงใใพใใใใใฏใ๐ค Transformersใขใใซใ็ ็ฉถใใใฌใผใใณใฐใใพใใฏๅฎ้จใใ่ๅณใใใใฆใผใถใผใซ็นใซๅฝน็ซใคใใใใใพใใใใใฎใฌใคใใงใฏใ`AutoClass`ใไฝฟ็จใใชใใซในใฟใ ใขใใซใฎไฝๆใซใคใใฆ่ฉณใใ่ชฌๆใใพใใๆฌกใฎๆนๆณใๅญฆใณใพใ๏ผ
+
+- ใขใใซใฎ่จญๅฎใใญใผใใใใณใซในใฟใใคใบใใใ
+- ใขใใซใขใผใญใใฏใใฃใไฝๆใใใ
+- ใใญในใ็จใฎ้
ใใใผใฏใใคใถใจ้ซ้ใใผใฏใใคใถใไฝๆใใใ
+- ใใธใงใณใฟในใฏ็จใฎ็ปๅใใญใปใใตใไฝๆใใใ
+- ใชใผใใฃใชใฟในใฏ็จใฎ็นๅพดๆฝๅบๅจใไฝๆใใใ
+- ใใซใใขใผใใซใฟในใฏ็จใฎใใญใปใใตใไฝๆใใใ
+
+## Configuration
+
+[่จญๅฎ](main_classes/configuration)ใฏใใขใใซใฎ็นๅฎใฎๅฑๆงใๆใใพใใๅใขใใซใฎ่จญๅฎใซใฏ็ฐใชใๅฑๆงใใใใพใใใใจใใฐใใในใฆใฎNLPใขใใซใซใฏใ`hidden_size`ใ`num_attention_heads`ใ`num_hidden_layers`ใใใใณ`vocab_size`ๅฑๆงใๅ
ฑ้ใใฆใใใพใใใใใใฎๅฑๆงใฏใใขใใซใๆง็ฏใใใใใฎๆณจๆใใใใฎๆฐใ้ ใๅฑคใฎๆฐใๆๅฎใใพใใ
+
+[DistilBERT](model_doc/distilbert)ใใใ่ฉณใใ่ชฟในใใใใซใ[`DistilBertConfig`]ใซใขใฏใปในใใฆใใฎๅฑๆงใ่ชฟในใฆใฟใพใใใ๏ผ
+
+```py
+>>> from transformers import DistilBertConfig
+
+>>> config = DistilBertConfig()
+>>> print(config)
+DistilBertConfig {
+ "activation": "gelu",
+ "attention_dropout": 0.1,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+[`DistilBertConfig`]ใฏใๅบๆฌใฎ[`DistilBertModel`]ใๆง็ฏใใใใใซไฝฟ็จใใใใในใฆใฎใใใฉใซใๅฑๆงใ่กจ็คบใใพใใ
+ใในใฆใฎๅฑๆงใฏใซในใฟใใคใบๅฏ่ฝใงใๅฎ้จใฎใใใฎในใใผในใๆไพใใพใใไพใใฐใใใใฉใซใใฎใขใใซใใซในใฟใใคใบใใฆไปฅไธใฎใใใชใใจใใงใใพใ๏ผ
+
+- `activation`ใใฉใกใผใฟใง็ฐใชใๆดปๆงๅ้ขๆฐใ่ฉฆใใ
+- `attention_dropout`ใใฉใกใผใฟใงๆณจๆ็ขบ็ใฎ้ซใใใญใใใขใฆใ็ใไฝฟ็จใใใ
+
+
+```py
+>>> my_config = DistilBertConfig(activation="relu", attention_dropout=0.4)
+>>> print(my_config)
+DistilBertConfig {
+ "activation": "relu",
+ "attention_dropout": 0.4,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+ไบๅๅญฆ็ฟๆธใฟใขใใซใฎๅฑๆงใฏใ[`~PretrainedConfig.from_pretrained`] ้ขๆฐใงๅคๆดใงใใพใ๏ผ
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("distilbert/distilbert-base-uncased", activation="relu", attention_dropout=0.4)
+```
+
+Once you are satisfied with your model configuration, you can save it with [`PretrainedConfig.save_pretrained`]. Your configuration file is stored as a JSON file in the specified save directory.
+
+```py
+>>> my_config.save_pretrained(save_directory="./your_model_save_path")
+```
+
+่จญๅฎใใกใคใซใๅๅฉ็จใใใซใฏใ[`~PretrainedConfig.from_pretrained`]ใไฝฟ็จใใฆใใใใญใผใใใพใ๏ผ
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/config.json")
+```
+
+
+
+ใซในใฟใ ๆงๆใใกใคใซใ่พๆธใจใใฆไฟๅญใใใใจใใใซในใฟใ ๆงๆๅฑๆงใจใใใฉใซใใฎๆงๆๅฑๆงใฎ้ใใ ใใไฟๅญใใใใจใใงใใพใ๏ผ่ฉณ็ดฐใซใคใใฆใฏ[configuration](main_classes/configuration)ใฎใใญใฅใกใณใใผใทใงใณใใ่ฆงใใ ใใใ
+
+
+
+## Model
+
+ๆฌกใฎในใใใใฏใ[ใขใใซ](main_classes/models)ใไฝๆใใใใจใงใใใขใใซ๏ผใขใผใญใใฏใใฃใจใ็ทฉใ่จใใใใใจใใใใพใ๏ผใฏใๅใฌใคใคใผใไฝใใใฆใใใใใฉใฎๆไฝใ่กใใใฆใใใใๅฎ็พฉใใพใใๆงๆใใใฎ `num_hidden_layers` ใฎใใใชๅฑๆงใฏใขใผใญใใฏใใฃใๅฎ็พฉใใใใใซไฝฟ็จใใใพใใ
+ใในใฆใฎใขใใซใฏ [`PreTrainedModel`] ใใใผในใฏใฉในใจใใๅ
ฅๅๅใ่พผใฟใฎใชใตใคใบใใปใซใใขใใณใทใงใณใใใใฎใใซใผใใณใฐใชใฉใๅ
ฑ้ใฎใกใฝใใใใใใคใใใใพใใ
+ใใใซใใในใฆใฎใขใใซใฏ [`torch.nn.Module`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html)ใ[`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model)ใใพใใฏ [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html) ใฎใใใใใฎใตใใฏใฉในใงใใใใพใใใคใพใใใขใใซใฏใใใใใฎใใฌใผใ ใฏใผใฏใฎไฝฟ็จๆณใจไบๆๆงใใใใพใใ
+
+
+
+ใขใใซใซใซในใฟใ ๆงๆๅฑๆงใใญใผใใใพใ๏ผ
+
+```py
+>>> from transformers import DistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/config.json")
+>>> model = DistilBertModel(my_config)
+```
+
+ใใใซใใใไบๅใใฌใผใใณใฐๆธใฟใฎ้ใฟใงใฏใชใใฉใณใใ ใชๅคใๆใคใขใใซใไฝๆใใใพใใ
+ใใใฏใใใฌใผใใณใฐใ่กใใใใพใงใใพใ ๆ็จใชใใฎใจใใฆไฝฟ็จใใใใจใฏใงใใพใใใ
+ใใฌใผใใณใฐใฏใณในใใจๆ้ใใใใใใญใปในใงใใ
+้ๅธธใใใฌใผใใณใฐใซๅฟ
่ฆใชใชใฝใผในใฎไธ้จใใไฝฟ็จใใใใใ้ใใใ่ฏใ็ตๆใๅพใใใใซไบๅๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใใใจใ่ฏใใงใใใใ
+
+[`~PreTrainedModel.from_pretrained`]ใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใไฝๆใใพใ๏ผ
+
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใใญใผใใใ้ใใขใใซใ๐ค Transformersใซใใฃใฆๆไพใใใฆใใๅ ดๅใใใใฉใซใใฎใขใใซ่จญๅฎใ่ชๅ็ใซใญใผใใใใพใใใใ ใใๅฟ
่ฆใซๅฟใใฆใใใฉใซใใฎใขใใซ่จญๅฎๅฑๆงใฎไธ้จใพใใฏใในใฆใ็ฌ่ชใฎใใฎใง็ฝฎใๆใใใใจใใงใใพใใ
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+ใขใใซใซใซในใฟใ ่จญๅฎๅฑๆงใใญใผใใใฆใใ ใใ๏ผ
+
+```py
+>>> from transformers import TFDistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+>>> tf_model = TFDistilBertModel(my_config)
+```
+
+ใใใซใใใไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใงใฏใชใใฉใณใใ ใชๅคใๆใคใขใใซใไฝๆใใใพใใ
+ใใฎใขใใซใๆ็จใช็ฎ็ใซใฏใพใ ไฝฟ็จใใใใจใฏใงใใพใใใใใฌใผใใณใฐใฏใณในใใใใใใๆ้ใใใใใใญใปในใงใใ
+ไธ่ฌ็ใซใฏใใใฌใผใใณใฐใซๅฟ
่ฆใชใชใฝใผในใฎไธ้จใใไฝฟ็จใใใซใใใ้ใๅชใใ็ตๆใๅพใใใใซไบๅๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใใใจใ่ฏใใงใใใใ
+
+[`~TFPreTrainedModel.from_pretrained`]ใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใไฝๆใใพใ๏ผ
+
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใใญใผใใใ้ใใขใใซใ๐ค Transformersใซใใฃใฆๆไพใใใฆใใๅ ดๅใใใใฉใซใใฎใขใใซๆงๆใ่ชๅ็ใซใญใผใใใใพใใใใ ใใๅฟ
่ฆใงใใใฐใใใฉใซใใฎใขใใซๆงๆๅฑๆงใฎไธ้จใพใใฏใในใฆใ็ฌ่ชใฎใใฎใง็ฝฎใๆใใใใจใใงใใพใ๏ผ
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+
+
+### Model heads
+
+ใใฎๆ็นใงใใใผในใฎDistilBERTใขใใซใใใใใใใฏ้ ใใ็ถๆ
ใๅบๅใใพใใ้ ใใ็ถๆ
ใฏใขใใซใฎใใใใธใฎๅ
ฅๅใจใใฆๆธกใใใๆ็ต็ใชๅบๅใ็ๆใใพใใ๐ค Transformersใฏใใขใใซใใใฎใฟในใฏใใตใใผใใใฆใใ้ใใๅใฟในใฏใซๅฏพๅฟใใ็ฐใชใใขใใซใใใใๆไพใใพใ๏ผใคใพใใDistilBERTใ็ฟป่จณใฎใใใชใทใผใฑใณในๅฏพใทใผใฑใณในใฟในใฏใซไฝฟ็จใใใใจใฏใงใใพใใ๏ผใ
+
+
+
+ใใจใใฐใ[`DistilBertForSequenceClassification`]ใฏใใทใผใฑใณในๅ้กใใใใๆใคใใผในใฎDistilBERTใขใใซใงใใใทใผใฑใณในๅ้กใใใใฏใใใผใซใใใๅบๅใฎไธใซใใ็ทๅฝขๅฑคใงใใ
+
+```py
+>>> from transformers import DistilBertForSequenceClassification
+
+>>> model = DistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ๆฐใใใฟในใฏใซใใฎใใงใใฏใใคใณใใ็ฐกๅใซๅๅฉ็จใใใซใฏใ็ฐใชใใขใใซใใใใซๅใๆฟใใพใใ
+่ณชๅๅฟ็ญใฟในใฏใฎๅ ดๅใ[`DistilBertForQuestionAnswering`] ใขใใซใใใใไฝฟ็จใใพใใ
+่ณชๅๅฟ็ญใใใใฏใทใผใฑใณในๅ้กใใใใจ้กไผผใใฆใใพใใใ้ ใ็ถๆ
ใฎๅบๅใฎไธใซ็ทๅฝขๅฑคใใใใพใใ
+
+```py
+>>> from transformers import DistilBertForQuestionAnswering
+
+>>> model = DistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+ไพใใฐใ[`TFDistilBertForSequenceClassification`]ใฏใใทใผใฑใณในๅ้กใใใใๆใคใใผในใฎDistilBERTใขใใซใงใใใทใผใฑใณในๅ้กใใใใฏใใใผใซใใใๅบๅใฎไธใซใใ็ทๅฝขๅฑคใงใใ
+
+```py
+>>> from transformers import TFDistilBertForSequenceClassification
+
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ๅฅใฎใฟในใฏใซใใฎใใงใใฏใใคใณใใ็ฐกๅใซๅๅฉ็จใใใใจใใงใใ็ฐใชใใขใใซใใใใซๅใๆฟใใใ ใใงใใ
+่ณชๅๅฟ็ญใฟในใฏใฎๅ ดๅใ[`TFDistilBertForQuestionAnswering`]ใขใใซใใใใไฝฟ็จใใพใใ
+่ณชๅๅฟ็ญใใใใฏใทใผใฑใณในๅ้กใใใใจไผผใฆใใพใใใ้ ใ็ถๆ
ใฎๅบๅใฎไธใซ็ทๅฝขๅฑคใใใใ ใใงใใ
+
+
+```py
+>>> from transformers import TFDistilBertForQuestionAnswering
+
+>>> tf_model = TFDistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+## Tokenizer
+
+ใใญในใใใผใฟใใขใใซใงไฝฟ็จใใๅใซๅฟ
่ฆใชๆๅพใฎใใผในใฏใฉในใฏใ็ใฎใใญในใใใใณใฝใซใซๅคๆใใใใใฎ[ใใผใฏใใคใถ](main_classes/tokenizer)ใงใใ
+๐ค Transformersใงไฝฟ็จใงใใ2ใคใฎใฟใคใใฎใใผใฏใใคใถใใใใพใ๏ผ
+
+- [`PreTrainedTokenizer`]: ใใผใฏใใคใถใฎPythonๅฎ่ฃ
ใงใใ
+- [`PreTrainedTokenizerFast`]: Rustใใผในใฎ[๐ค Tokenizer](https://huggingface.co/docs/tokenizers/python/latest/)ใฉใคใใฉใชใใใฎใใผใฏใใคใถใงใใ
+ใใฎใใผใฏใใคใถใฎใฟใคใใฏใใใฎRustๅฎ่ฃ
ใซใใใ็นใซใใใใใผใฏใใคใผใผใทใงใณไธญใซ้ซ้ใงใใ
+้ซ้ใชใใผใฏใใคใถใฏใใใผใฏใณใๅ
ใฎๅ่ชใพใใฏๆๅญใซใใใใณใฐใใ*ใชใใปใใใใใใณใฐ*ใชใฉใฎ่ฟฝๅ ใกใฝใใใๆไพใใพใใ
+
+ไธกๆนใฎใใผใฏใใคใถใฏใใจใณใณใผใใจใใณใผใใๆฐใใใใผใฏใณใฎ่ฟฝๅ ใ็นๅฅใชใใผใฏใณใฎ็ฎก็ใชใฉใๅ
ฑ้ใฎใกใฝใใใใตใใผใใใฆใใพใใ
+
+
+
+ใในใฆใฎใขใใซใ้ซ้ใชใใผใฏใใคใถใใตใใผใใใฆใใใใใงใฏใใใพใใใ
+ใขใใซใ้ซ้ใชใใผใฏใใคใถใใตใใผใใใฆใใใใฉใใใ็ขบ่ชใใใซใฏใใใฎ[่กจ](index#supported-frameworks)ใใ่ฆงใใ ใใใ
+
+
+
+็ฌ่ชใฎใใผใฏใใคใถใใใฌใผใใณใฐใใๅ ดๅใ*ใใญใฃใใฉใชใผ*ใใกใคใซใใใใผใฏใใคใถใไฝๆใงใใพใใ
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> my_tokenizer = DistilBertTokenizer(vocab_file="my_vocab_file.txt", do_lower_case=False, padding_side="left")
+```
+
+ใซในใฟใ ใใผใฏใใคใถใผใใ็ๆใใใ่ชๅฝใฏใไบๅๅญฆ็ฟๆธใฟใขใใซใฎใใผใฏใใคใถใผใ็ๆใใ่ชๅฝใจใฏ็ฐใชใใใจใ่ฆใใฆใใใใจใฏ้่ฆใงใใ
+ไบๅๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใๅ ดๅใฏใไบๅๅญฆ็ฟๆธใฟใขใใซใฎ่ชๅฝใไฝฟ็จใใๅฟ
่ฆใใใใพใใใใใใชใใจใๅ
ฅๅใๆๅณใใชใใชใใชใใพใใ
+[`DistilBertTokenizer`]ใฏใฉในใไฝฟ็จใใฆใไบๅๅญฆ็ฟๆธใฟใขใใซใฎ่ชๅฝใๆใคใใผใฏใใคใถใผใไฝๆใใพใ:
+
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> slow_tokenizer = DistilBertTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+[`DistilBertTokenizerFast`]ใฏใฉในใไฝฟ็จใใฆ้ซ้ใชใใผใฏใใคใถใไฝๆใใพใ๏ผ
+
+```py
+>>> from transformers import DistilBertTokenizerFast
+
+>>> fast_tokenizer = DistilBertTokenizerFast.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+ใใใฉใซใใงใฏใ[`AutoTokenizer`]ใฏ้ซ้ใชใใผใฏใใคใถใ่ชญใฟ่พผใใใจใใพใใ`from_pretrained`ๅ
ใง`use_fast=False`ใ่จญๅฎใใใใจใงใใใฎๅไฝใ็กๅนใซใใใใจใใงใใพใใ
+
+
+
+## Image Processor
+
+็ปๅใใญใปใใตใฏใใธใงใณๅ
ฅๅใๅฆ็ใใพใใใใใฏๅบๆฌใฏใฉใน [`~image_processing_utils.ImageProcessingMixin`] ใ็ถๆฟใใฆใใพใใ
+
+ไฝฟ็จใใใซใฏใไฝฟ็จใใฆใใใขใใซใซ้ข้ฃไปใใใใ็ปๅใใญใปใใตใไฝๆใใพใใ
+ใใจใใฐใ็ปๅๅ้กใซ[ViT](model_doc/vit)ใไฝฟ็จใใๅ ดๅใใใใฉใซใใฎ [`ViTImageProcessor`] ใไฝๆใใพใใ
+
+```py
+>>> from transformers import ViTImageProcessor
+
+>>> vit_extractor = ViTImageProcessor()
+>>> print(vit_extractor)
+ViTImageProcessor {
+ "do_normalize": true,
+ "do_resize": true,
+ "image_processor_type": "ViTImageProcessor",
+ "image_mean": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": 2,
+ "size": 224
+}
+```
+
+
+
+ใซในใฟใใคใบใๅฟ
่ฆใจใใชใๅ ดๅใใขใใซใฎใใใฉใซใใฎ็ปๅใใญใปใใตใใฉใกใผใฟใใญใผใใใใซใฏใๅ็ดใซ`from_pretrained`ใกใฝใใใไฝฟ็จใใฆใใ ใใใ
+
+
+
+[`ViTImageProcessor`]ใฎใใฉใกใผใฟใๅคๆดใใฆใใซในใฟใ ใฎ็ปๅใใญใปใใตใไฝๆใงใใพใ๏ผ
+
+
+```py
+>>> from transformers import ViTImageProcessor
+
+>>> my_vit_extractor = ViTImageProcessor(resample="PIL.Image.BOX", do_normalize=False, image_mean=[0.3, 0.3, 0.3])
+>>> print(my_vit_extractor)
+ViTImageProcessor {
+ "do_normalize": false,
+ "do_resize": true,
+ "image_processor_type": "ViTImageProcessor",
+ "image_mean": [
+ 0.3,
+ 0.3,
+ 0.3
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": "PIL.Image.BOX",
+ "size": 224
+}
+```
+
+## Feature Extractor
+
+ใใฃใผใใฃใผๆฝๅบๅจใฏ้ณๅฃฐๅ
ฅๅใๅฆ็ใใพใใใใใฏๅบๆฌ็ใช [`~feature_extraction_utils.FeatureExtractionMixin`] ใฏใฉในใใ็ถๆฟใใใ้ณๅฃฐๅ
ฅๅใๅฆ็ใใใใใฎ [`SequenceFeatureExtractor`] ใฏใฉในใใใ็ถๆฟใใใใใจใใใใพใใ
+
+ไฝฟ็จใใใซใฏใใขใใซใซ้ข้ฃไปใใใใใใฃใผใใฃใผๆฝๅบๅจใไฝๆใใพใใใใจใใฐใ้ณๅฃฐๅ้กใซ [Wav2Vec2](model_doc/wav2vec2) ใไฝฟ็จใใๅ ดๅใใใใฉใซใใฎ [`Wav2Vec2FeatureExtractor`] ใไฝๆใใพใใ
+
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> w2v2_extractor = Wav2Vec2FeatureExtractor()
+>>> print(w2v2_extractor)
+Wav2Vec2FeatureExtractor {
+ "do_normalize": true,
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
+ "feature_size": 1,
+ "padding_side": "right",
+ "padding_value": 0.0,
+ "return_attention_mask": false,
+ "sampling_rate": 16000
+}
+```
+
+
+
+ใซในใฟใใคใบใ่กใใชใๅ ดๅใใขใใซใฎใใใฉใซใใฎ็นๅพดๆฝๅบๅจใใฉใกใผใฟใผใใญใผใใใใซใฏใๅใซ `from_pretrained` ใกใฝใใใไฝฟ็จใใฆใใ ใใใ
+
+
+
+[`Wav2Vec2FeatureExtractor`] ใฎใใฉใกใผใฟใผใๅคๆดใใฆใใซในใฟใ ็นๅพดๆฝๅบๅจใไฝๆใงใใพใ:
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> w2v2_extractor = Wav2Vec2FeatureExtractor(sampling_rate=8000, do_normalize=False)
+>>> print(w2v2_extractor)
+Wav2Vec2FeatureExtractor {
+ "do_normalize": false,
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
+ "feature_size": 1,
+ "padding_side": "right",
+ "padding_value": 0.0,
+ "return_attention_mask": false,
+ "sampling_rate": 8000
+}
+```
+
+## Processor
+
+ใใซใใขใผใใซใฟในใฏใใตใใผใใใใขใใซใซๅฏพใใฆใ๐ค Transformersใฏไพฟๅฉใชใใญใปใใตใฏใฉในใๆไพใใฆใใพใใ
+ใใฎใใญใปใใตใฏใฉในใฏใ็นๅพด้ๆฝๅบๅจใใใผใฏใใคใถใชใฉใฎๅฆ็ใฏใฉในใไพฟๅฉใซใฉใใใใๅไธใฎใชใใธใงใฏใใซ็ตๅใใพใใ
+ใใจใใฐใ่ชๅ้ณๅฃฐ่ช่ญใฟในใฏ๏ผASR๏ผ็จใซ[`Wav2Vec2Processor`]ใไฝฟ็จใใฆใฟใพใใใใ
+ASRใฏ้ณๅฃฐใใใญในใใซ่ปขๅใใใฟในใฏใงใใใ้ณๅฃฐๅ
ฅๅใๅฆ็ใใใใใซ็นๅพด้ๆฝๅบๅจใจใใผใฏใใคใถใๅฟ
่ฆใงใใ
+
+้ณๅฃฐๅ
ฅๅใๅฆ็ใใ็นๅพด้ๆฝๅบๅจใไฝๆใใพใ๏ผ
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> feature_extractor = Wav2Vec2FeatureExtractor(padding_value=1.0, do_normalize=True)
+```
+
+ใใญในใๅ
ฅๅใๅฆ็ใใใใผใฏใใคใถใไฝๆใใพใ:
+
+```py
+>>> from transformers import Wav2Vec2CTCTokenizer
+
+>>> tokenizer = Wav2Vec2CTCTokenizer(vocab_file="my_vocab_file.txt")
+```
+
+[`Wav2Vec2Processor`]ใง็นๅพด้ๆฝๅบๅจใจใใผใฏใใคใถใ็ตใฟๅใใใพใ๏ผ
+
+
+```py
+>>> from transformers import Wav2Vec2Processor
+
+>>> processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)
+```
+
+ไบใคใฎๅบๆฌใฏใฉใน - ่จญๅฎใจใขใใซ - ใใใณ่ฟฝๅ ใฎๅๅฆ็ใฏใฉใน๏ผใใผใฏใใคใถใ็ปๅใใญใปใใตใ็นๅพดๆฝๅบๅจใใพใใฏใใญใปใใต๏ผใไฝฟ็จใใใใจใงใ๐ค Transformers ใใตใใผใใใใขใใซใฎใใใใใไฝๆใงใใพใใใใใใฎๅบๆฌใฏใฉในใฏ่จญๅฎๅฏ่ฝใงใๅฟ
่ฆใช็นๆงใไฝฟ็จใงใใพใใใขใใซใใใฌใผใใณใฐ็จใซ็ฐกๅใซใปใใใขใใใใใใๆขๅญใฎไบๅๅญฆ็ฟๆธใฟใขใใซใๅพฎ่ชฟๆดใใใใจใใงใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/custom_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/custom_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..588e804494e556861f40d0292d5d5a0259fe1ced
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/custom_models.md
@@ -0,0 +1,336 @@
+
+
+# Sharing custom models
+
+๐ค Transformersใฉใคใใฉใชใฏใ็ฐกๅใซๆกๅผตใงใใใใใซ่จญ่จใใใฆใใพใใใในใฆใฎใขใใซใฏใชใใธใใชใฎ็นๅฎใฎใตใใใฉใซใใซๅฎๅ
จใซใณใผใๅใใใฆใใใๆฝ่ฑกๅใฏใใใพใใใใใใใฃใฆใใขใใชใณใฐใใกใคใซใใณใใผใใฆ่ชฟๆดใใใใจใ็ฐกๅใงใใ
+
+ๆฐใใใขใใซใๆธใใฆใใๅ ดๅใใผใญใใๅงใใๆนใ็ฐกๅใใใใใพใใใใใฎใใฅใผใใชใขใซใงใฏใใซในใฟใ ใขใใซใจใใฎ่จญๅฎใใฉใฎใใใซๆธใใTransformersๅ
ใงไฝฟ็จใงใใใใใซใใใณใผใใซไพๅญใใๅ
ฑๅไฝใจๅ
ฑๆใใๆนๆณใ่ชฌๆใใพใใใฉใคใใฉใชใซๅญๅจใใชใๅ ดๅใงใใ่ชฐใงใไฝฟ็จใงใใใใใซใใพใใ
+
+ใใใๅฎ่จผใใใใใซใ[timmใฉใคใใฉใช](https://github.com/rwightman/pytorch-image-models)ใฎResNetใฏใฉในใ[`PreTrainedModel`]ใซใฉใใใใใใจใซใใฃใฆใResNetใขใใซใไฝฟ็จใใพใใ
+
+## Writing a custom configuration
+
+ใขใใซใซๅใ็ตใๅใซใใพใใใฎ่จญๅฎใๆธใใพใใใใใขใใซใฎ่จญๅฎใฏใใขใใซใๆง็ฏใใใใใซๅฟ
่ฆใชใในใฆใฎๆ
ๅ ฑใๅซใใชใใธใงใฏใใงใใๆฌกใฎใปใฏใทใงใณใง่ฆใใใใซใใขใใซใฏๅๆๅใใใใใซ`config`ใใๅใๅใใใจใใงใใชใใใใใใฎใชใใธใงใฏใใใงใใใ ใๅฎๅ
จใงใใๅฟ
่ฆใใใใพใใ
+
+ใใฎไพใงใฏใResNetใฏใฉในใฎใใใคใใฎๅผๆฐใๅๅพใใ่ชฟๆดใใใใใใใใชใใจใใพใใ็ฐใชใ่จญๅฎใฏใ็ฐใชใใฟใคใใฎResNetใๆไพใใพใใใใฎๅพใใใใใฎๅผๆฐใ็ขบ่ชใใๅพใใใใใฎๅผๆฐใๅใซๆ ผ็ดใใพใใ
+
+```python
+from transformers import PretrainedConfig
+from typing import List
+
+
+class ResnetConfig(PretrainedConfig):
+ model_type = "resnet"
+
+ def __init__(
+ self,
+ block_type="bottleneck",
+ layers: List[int] = [3, 4, 6, 3],
+ num_classes: int = 1000,
+ input_channels: int = 3,
+ cardinality: int = 1,
+ base_width: int = 64,
+ stem_width: int = 64,
+ stem_type: str = "",
+ avg_down: bool = False,
+ **kwargs,
+ ):
+ if block_type not in ["basic", "bottleneck"]:
+ raise ValueError(f"`block_type` must be 'basic' or bottleneck', got {block_type}.")
+ if stem_type not in ["", "deep", "deep-tiered"]:
+ raise ValueError(f"`stem_type` must be '', 'deep' or 'deep-tiered', got {stem_type}.")
+
+ self.block_type = block_type
+ self.layers = layers
+ self.num_classes = num_classes
+ self.input_channels = input_channels
+ self.cardinality = cardinality
+ self.base_width = base_width
+ self.stem_width = stem_width
+ self.stem_type = stem_type
+ self.avg_down = avg_down
+ super().__init__(**kwargs)
+```
+
+้่ฆใชใใจใ3ใค่ฆใใฆใใในใใใคใณใใฏๆฌกใฎใจใใใงใ๏ผ
+- `PretrainedConfig` ใ็ถๆฟใใๅฟ
่ฆใใใใพใใ
+- ใใชใใฎ `PretrainedConfig` ใฎ `__init__` ใฏไปปๆใฎ kwargs ใๅใๅ
ฅใใๅฟ
่ฆใใใใพใใ
+- ใใใใฎ `kwargs` ใฏ่ฆชใฏใฉในใฎ `__init__` ใซๆธกใๅฟ
่ฆใใใใพใใ
+
+็ถๆฟใฏใ๐ค Transformers ใฉใคใใฉใชใฎใในใฆใฎๆฉ่ฝใๅๅพใงใใใใใซใใใใใงใใไปใฎ2ใคใฎๅถ็ดใฏใ
+`PretrainedConfig` ใ่จญๅฎใใฆใใใใฃใผใซใไปฅๅคใซใๅคใใฎใใฃใผใซใใๆใฃใฆใใใใจใใๆฅใฆใใพใใ
+`from_pretrained` ใกใฝใใใง่จญๅฎใๅใญใผใใใๅ ดๅใใใใใฎใใฃใผใซใใฏใใชใใฎ่จญๅฎใซๅใๅ
ฅใใใใ
+ใใฎๅพใ่ฆชใฏใฉในใซ้ไฟกใใใๅฟ
่ฆใใใใพใใ
+
+่จญๅฎใฎ `model_type` ใๅฎ็พฉใใใใจ๏ผใใใงใฏ `model_type="resnet"`๏ผใฏใ
+่ชๅใฏใฉในใซใขใใซใ็ป้ฒใใใๅ ดๅใ้คใใฆใฏๅฟ
้ ใงใฏใใใพใใ๏ผๆๅพใฎใปใฏใทใงใณใๅ็
ง๏ผใ
+
+ใใใงใใฉใคใใฉใชใฎไปใฎใขใใซ่จญๅฎใจๅๆงใซใ่จญๅฎใ็ฐกๅใซไฝๆใใฆไฟๅญใงใใพใใ
+ไปฅไธใฏใresnet50d ่จญๅฎใไฝๆใใฆไฟๅญใใๆนๆณใฎไพใงใ๏ผ
+
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d_config.save_pretrained("custom-resnet")
+```
+
+ใใใซใใใ`custom-resnet` ใใฉใซใๅ
ใซ `config.json` ใจใใๅๅใฎใใกใคใซใไฟๅญใใใพใใใใฎๅพใ`from_pretrained` ใกใฝใใใไฝฟ็จใใฆๆงๆใๅใญใผใใงใใพใใ
+
+
+```py
+resnet50d_config = ResnetConfig.from_pretrained("custom-resnet")
+```
+
+ใพใใ[`PretrainedConfig`] ใฏใฉในใฎไปใฎใกใฝใใใไฝฟ็จใใใใจใใงใใพใใใใจใใฐใ[`~PretrainedConfig.push_to_hub`] ใไฝฟ็จใใฆใ่จญๅฎใ็ดๆฅ Hub ใซใขใใใญใผใใงใใพใใ
+
+## Writing a custom model
+
+ResNet ใฎ่จญๅฎใใงใใใฎใงใใขใใซใๆธใๅงใใใใจใใงใใพใใๅฎ้ใซใฏ2ใคใฎใขใใซใๆธใใพใใ1ใคใฏใใใใฎ็ปๅใใ้ ใใ็นๅพดใๆฝๅบใใใขใใซ๏ผ[`BertModel`] ใฎใใใชใใฎ๏ผใงใใใ1ใคใฏ็ปๅๅ้กใซ้ฉใใใขใใซ๏ผ[`BertForSequenceClassification`] ใฎใใใชใใฎ๏ผใงใใ
+
+ๅ่ฟฐใใใใใซใใใฎไพใใทใณใใซใซไฟใคใใใซใใขใใซใฎ็ทฉใใฉใใใผใฎใฟใๆธใใพใใใใฎใฏใฉในใๆธใๅใซ่กใๅฟ
่ฆใใใๅฏไธใฎใใจใฏใใใญใใฏใฟใคใใจๅฎ้ใฎใใญใใฏใฏใฉในใฎ้ใฎใใใใงใใใใฎๅพใใในใฆใ `ResNet` ใฏใฉในใซๆธกใใฆ่จญๅฎใใใขใใซใๅฎ็พฉใใพใ๏ผ
+
+```py
+from transformers import PreTrainedModel
+from timm.models.resnet import BasicBlock, Bottleneck, ResNet
+from .configuration_resnet import ResnetConfig
+
+
+BLOCK_MAPPING = {"basic": BasicBlock, "bottleneck": Bottleneck}
+
+
+class ResnetModel(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor):
+ return self.model.forward_features(tensor)
+```
+
+็ปๅใๅ้กใใใขใใซใฎๅ ดๅใforwardใกใฝใใใๅคๆดใใใ ใใงใ๏ผ
+
+```py
+import torch
+
+
+class ResnetModelForImageClassification(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor, labels=None):
+ logits = self.model(tensor)
+ if labels is not None:
+ loss = torch.nn.functional.cross_entropy(logits, labels)
+ return {"loss": loss, "logits": logits}
+ return {"logits": logits}
+```
+
+ไธกๆนใฎๅ ดๅใ`PreTrainedModel`ใใ็ถๆฟใใ`config`ใไฝฟ็จใใฆในใผใใผใฏใฉในใฎๅๆๅใๅผใณๅบใใพใ๏ผ้ๅธธใฎ`torch.nn.Module`ใๆธใใจใใฎใใใชๆใใงใ๏ผใ
+`config_class`ใ่จญๅฎใใ่กใฏๅฟ
้ ใงใฏใใใพใใใใ๏ผๆๅพใฎใปใฏใทใงใณใๅ็
ง๏ผใใขใใซใ่ชๅใฏใฉในใซ็ป้ฒใใใๅ ดๅใซไฝฟ็จใงใใพใใ
+
+
+
+ใขใใซใใฉใคใใฉใชๅ
ใฎใขใใซใจ้ๅธธใซไผผใฆใใๅ ดๅใใใฎใขใใซใจๅใๆงๆใๅๅฉ็จใงใใพใใ
+
+
+
+ใขใใซใ่ฟใๅ
ๅฎนใฏไฝใงใๆงใใพใใใใใฉใใซใๆธกใใใใจใใซๆๅคฑใๅซใ่พๆธใ่ฟใ๏ผ`ResnetModelForImageClassification`ใฎใใใซ่กใฃใใใฎ๏ผใจใ
+ใขใใซใ[`Trainer`]ใฏใฉในๅ
ใง็ดๆฅไฝฟ็จใงใใใใใซใชใใพใใ็ฌ่ชใฎใใฌใผใใณใฐใซใผใใพใใฏไปใฎใฉใคใใฉใชใไฝฟ็จใใไบๅฎใงใใ้ใใ
+ๅฅใฎๅบๅๅฝขๅผใไฝฟ็จใใใใจใๅ้กใใใพใใใ
+
+ใใฆใใขใใซใฏใฉในใใงใใใฎใงใ1ใคไฝๆใใพใใใ๏ผ
+
+```py
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+```
+
+ๅๅบฆใ[`PreTrainedModel`]ใฎใใใใใฎใกใฝใใใไพใใฐ[`~PreTrainedModel.save_pretrained`]ใ
+[`~PreTrainedModel.push_to_hub`]ใชใฉใไฝฟ็จใงใใพใใๆฌกใฎใปใฏใทใงใณใงใฏใใขใใซใฎ้ใฟใใณใผใใจไธ็ทใซ
+Hugging Face Hub ใซใใใทใฅใใๆนๆณใ่ฆใฆใฟใพใใ
+ใใใใใพใใฏใขใใซๅ
ใซไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใใญใผใใใพใใใใ
+
+็ฌ่ชใฎใฆใผในใฑใผในใงใฏใใใใใ็ฌ่ชใฎใใผใฟใงใซในใฟใ ใขใใซใใใฌใผใใณใฐใใใใจใซใชใใงใใใใ
+ใใฎใใฅใผใใชใขใซใงใฏในใใผใใขใใใฎใใใซใresnet50dใฎไบๅๅญฆ็ฟๆธใฟใใผใธใงใณใไฝฟ็จใใพใใ
+็งใใกใฎใขใใซใฏใใใใฉใใใใใ ใใชใฎใงใใใใใฎ้ใฟใ่ปข้ใใใฎใฏ็ฐกๅใงใ๏ผ
+
+
+```py
+import timm
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+ใใฆใ[`~PreTrainedModel.save_pretrained`]ใพใใฏ[`~PreTrainedModel.push_to_hub`]ใๅฎ่กใใใจใใซใ
+ใขใใซใฎใณใผใใไฟๅญใใใใใใซใใๆนๆณใ่ฆใฆใฟใพใใใใ
+
+## Sending the code to the Hub
+
+
+
+ใใฎAPIใฏๅฎ้จ็ใงใใใๆฌกใฎใชใชใผในใงใใใใชๅคๆดใใใใใใใใพใใใ
+
+
+
+ใพใใใขใใซใ`.py`ใใกใคใซใซๅฎๅ
จใซๅฎ็พฉใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+ใใกใคใซใฏ็ธๅฏพใคใณใใผใใไปใฎใใกใคใซใซไพๅญใงใใพใใใใในใฆใฎใใกใคใซใๅใใใฃใฌใฏใใชใซใใ้ใ๏ผใพใ ใใฎๆฉ่ฝใงใฏใตใใขใธใฅใผใซใฏใตใใผใใใฆใใพใใ๏ผใๅ้กใใใพใใใ
+ใใฎไพใงใฏใ็พๅจใฎไฝๆฅญใใฃใฌใฏใใชๅ
ใซๅๅใใresnet_modelใใฎใใฉใซใใไฝๆใใใใฎไธญใซ`modeling_resnet.py`ใใกใคใซใจ`configuration_resnet.py`ใใกใคใซใๅฎ็พฉใใพใใ
+ๆงๆใใกใคใซใซใฏ`ResnetConfig`ใฎใณใผใใๅซใพใใใขใใชใณใฐใใกใคใซใซใฏ`ResnetModel`ใจ`ResnetModelForImageClassification`ใฎใณใผใใๅซใพใใฆใใพใใ
+
+
+```
+.
+โโโ resnet_model
+ โโโ __init__.py
+ โโโ configuration_resnet.py
+ โโโ modeling_resnet.py
+```
+
+`__init__.py`ใฏ็ฉบใงใใฃใฆใๅ้กใใใพใใใPythonใ`resnet_model`ใใขใธใฅใผใซใจใใฆๆคๅบใงใใใใใซใใใใใซๅญๅจใใพใใ
+
+
+
+ใฉใคใใฉใชใใใขใใชใณใฐใใกใคใซใใณใใผใใๅ ดๅใใใกใคใซใฎๅ
้ ญใซใใใในใฆใฎ็ธๅฏพใคใณใใผใใ`transformers`ใใใฑใผใธใใใคใณใใผใใซ็ฝฎใๆใใๅฟ
่ฆใใใใพใใ
+
+
+
+ๆขๅญใฎ่จญๅฎใใขใใซใๅๅฉ็จ๏ผใพใใฏใตใใฏใฉในๅ๏ผใงใใใใจใซๆณจๆใใฆใใ ใใใ
+
+ใณใใฅใใใฃใจใขใใซใๅ
ฑๆใใใใใซใๆฌกใฎๆ้ ใซๅพใฃใฆใใ ใใ๏ผใพใใๆฐใใไฝๆใใใใกใคใซใใResNetใขใใซใจ่จญๅฎใใคใณใใผใใใพใ๏ผ
+
+
+```py
+from resnet_model.configuration_resnet import ResnetConfig
+from resnet_model.modeling_resnet import ResnetModel, ResnetModelForImageClassification
+```
+
+ๆฌกใซใ`save_pretrained`ใกใฝใใใไฝฟ็จใใฆใใใใฎใชใใธใงใฏใใฎใณใผใใใกใคใซใใณใใผใใ็นๅฎใฎAutoใฏใฉใน๏ผ็นใซใขใใซใฎๅ ดๅ๏ผใซๆญฃใใ็ป้ฒใใใใใฉใคใใฉใชใซๆ็คบใใๅฟ
่ฆใใใใพใใๆฌกใฎใใใซๅฎ่กใใพใ๏ผ
+
+```py
+ResnetConfig.register_for_auto_class()
+ResnetModel.register_for_auto_class("AutoModel")
+ResnetModelForImageClassification.register_for_auto_class("AutoModelForImageClassification")
+```
+
+ๆณจๆ: ่จญๅฎใซใคใใฆใฏ่ชๅใฏใฉในใๆๅฎใใๅฟ
่ฆใฏใใใพใใ๏ผ่จญๅฎ็จใฎ่ชๅใฏใฉในใฏ1ใคใใใชใใ[`AutoConfig`]ใงใ๏ผใใ
+ใขใใซใซใคใใฆใฏ็ฐใชใใพใใใซในใฟใ ใขใใซใฏๅคใใฎ็ฐใชใใฟในใฏใซ้ฉใใฆใใๅฏ่ฝๆงใใใใใใ
+ใขใใซใๆญฃ็ขบใช่ชๅใฏใฉในใฎใใกใฉใใซ้ฉใใฆใใใใๆๅฎใใๅฟ
่ฆใใใใพใใ
+
+ๆฌกใซใๅ่ฟฐใฎใใใซ่จญๅฎใจใขใใซใไฝๆใใพใใใ๏ผ
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+ใขใใซใHubใซ้ไฟกใใใซใฏใใญใฐใคใณใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใใฟใผใใใซใงๆฌกใฎใณใใณใใๅฎ่กใใพใ๏ผ
+
+```bash
+huggingface-cli login
+```
+
+ใพใใฏใใผใใใใฏใใ๏ผ
+
+```py
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+ๆฌกใซใๆฌกใฎใใใซใใฆใ็ฌ่ชใฎๅๅ็ฉบ้ใซใใใทใฅใงใใพใ๏ผใพใใฏใใกใณใใผใงใใ็ต็นใซใใใทใฅใงใใพใ๏ผ๏ผ
+
+```py
+resnet50d.push_to_hub("custom-resnet50d")
+```
+
+ใขใใชใณใฐใฎ้ใฟใจJSONๅฝขๅผใฎๆงๆใซๅ ใใฆใใใฎใใฉใซใใผใcustom-resnet50dใๅ
ใฎใขใใชใณใฐใใใณๆงๆใ.pyใใใกใคใซใใณใใผใใใ็ตๆใฏHubใซใขใใใญใผใใใใพใใใ็ตๆใฏใใฎ[model repo](https://huggingface.co/sgugger/custom-resnet50d)ใง็ขบ่ชใงใใพใใ
+
+่ฉณ็ดฐใซใคใใฆใฏใ[Hubใธใฎใใใทใฅๆนๆณ](model_sharing)ใๅ็
งใใฆใใ ใใใ
+
+## Using a model with custom code
+
+่ชๅใฏใฉในใจ `from_pretrained` ใกใฝใใใไฝฟ็จใใฆใใชใใธใใชๅ
ใฎใซในใฟใ ใณใผใใใกใคใซใจๅ
ฑใซไปปๆใฎๆงๆใใขใใซใใพใใฏใใผใฏใใคใถใไฝฟ็จใงใใพใใ Hubใซใขใใใญใผใใใใใในใฆใฎใใกใคใซใจใณใผใใฏใใซใฆใงใขใฎในใญใฃใณใๅฎๆฝใใใพใ๏ผ่ฉณ็ดฐใฏ[Hubใปใญใฅใชใใฃ](https://huggingface.co/docs/hub/security#malware-scanning)ใใญใฅใกใณใใผใทใงใณใๅ็
งใใฆใใ ใใ๏ผใใใใใไพ็ถใจใใฆๆชๆใฎใใใณใผใใๅฎ่กใใชใใใใซใใขใใซใณใผใใจไฝ่
ใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+`trust_remote_code=True` ใ่จญๅฎใใฆใซในใฟใ ใณใผใใๆใคใขใใซใไฝฟ็จใงใใพใ๏ผ
+
+
+```py
+from transformers import AutoModelForImageClassification
+
+model = AutoModelForImageClassification.from_pretrained("sgugger/custom-resnet50d", trust_remote_code=True)
+```
+
+ใณใใใใใใทใฅใใrevisionใใจใใฆๆธกใใใจใๅผทใๆจๅฅจใใใฆใใพใใใใใซใใใใขใใซใฎไฝ่
ใใณใผใใๆชๆใฎใใๆฐใใ่กใงๆดๆฐใใชใใฃใใใจใ็ขบ่ชใงใใพใ๏ผใขใใซใฎไฝ่
ใๅฎๅ
จใซไฟก้ ผใใฆใใๅ ดๅใ้คใใพใ๏ผใ
+
+
+```py
+commit_hash = "ed94a7c6247d8aedce4647f00f20de6875b5b292"
+model = AutoModelForImageClassification.from_pretrained(
+ "sgugger/custom-resnet50d", trust_remote_code=True, revision=commit_hash
+)
+```
+
+ใขใใซใชใใธใใชใฎใณใใใๅฑฅๆญดใใใฉใฆใธใณใฐใใ้ใซใฏใไปปๆใฎใณใใใใฎใณใใใใใใทใฅใ็ฐกๅใซใณใใผใงใใใใฟใณใใใใพใใ
+
+## Registering a model with custom code to the auto classes
+
+๐ค Transformersใๆกๅผตใใใฉใคใใฉใชใไฝๆใใฆใใๅ ดๅใ็ฌ่ชใฎใขใใซใๅซใใใใใซ่ชๅใฏใฉในใๆกๅผตใใใๅ ดๅใใใใพใใ
+ใใใฏใณใผใใHubใซใใใทใฅใใใใจใจใฏ็ฐใชใใใฆใผใถใผใฏใซในใฟใ ใขใใซใๅๅพใใใใใซใใชใใฎใฉใคใใฉใชใใคใณใใผใใใๅฟ
่ฆใใใใพใ
+๏ผHubใใใขใใซใณใผใใ่ชๅ็ใซใใฆใณใญใผใใใใฎใจใฏๅฏพ็
ง็ใงใ๏ผใ
+
+ๆงๆใซๆขๅญใฎใขใใซใฟใคใใจ็ฐใชใ `model_type` ๅฑๆงใใใ้ใใใพใใใชใใฎใขใใซใฏใฉในใ้ฉๅใช `config_class` ๅฑๆงใๆใฃใฆใใ้ใใ
+ๆฌกใฎใใใซใใใใ่ชๅใฏใฉในใซ่ฟฝๅ ใงใใพใ๏ผ
+
+```py
+from transformers import AutoConfig, AutoModel, AutoModelForImageClassification
+
+AutoConfig.register("resnet", ResnetConfig)
+AutoModel.register(ResnetConfig, ResnetModel)
+AutoModelForImageClassification.register(ResnetConfig, ResnetModelForImageClassification)
+```
+
+ๆณจๆ: `AutoConfig` ใซใซในใฟใ ่จญๅฎใ็ป้ฒใใ้ใฎๆๅใฎๅผๆฐใฏใใซในใฟใ ่จญๅฎใฎ `model_type` ใจไธ่ดใใๅฟ
่ฆใใใใพใใ
+ใพใใไปปๆใฎ่ชๅใขใใซใฏใฉในใซใซในใฟใ ใขใใซใ็ป้ฒใใ้ใฎๆๅใฎๅผๆฐใฏใใใใใฎใขใใซใฎ `config_class` ใจไธ่ดใใๅฟ
่ฆใใใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/custom_tools.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/custom_tools.md
new file mode 100644
index 0000000000000000000000000000000000000000..4a9926ba2c2204ee27dd6669c47d34551573cbbb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/custom_tools.md
@@ -0,0 +1,26 @@
+
+
+# Custom Tools and Prompts
+
+
+
+The Agents framework has significantly changed in version v4.41.0.
+This document has been removed as it was referencing an older API.
+
+We eagerly welcome new contributions for the updated API.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/fast_tokenizers.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/fast_tokenizers.md
new file mode 100644
index 0000000000000000000000000000000000000000..d97e59ed0ed25344e26508f868b1dbe317437242
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/fast_tokenizers.md
@@ -0,0 +1,73 @@
+
+
+# Use tokenizers from ๐ค Tokenizers
+
+[`PreTrainedTokenizerFast`]ใฏ[๐ค Tokenizers](https://huggingface.co/docs/tokenizers)ใฉใคใใฉใชใซไพๅญใใฆใใพใใ๐ค Tokenizersใฉใคใใฉใชใใๅๅพใใใใผใฏใใคใถใผใฏใ้ๅธธใซ็ฐกๅใซ๐ค Transformersใซใญใผใใงใใพใใ
+
+ๅ
ทไฝ็ใชๅ
ๅฎนใซๅ
ฅใๅใซใใพใใฏใใใคใใฎ่กใงใใใผใฎใใผใฏใใคใถใผใไฝๆใใใใจใใๅงใใพใใใ๏ผ
+
+
+```python
+>>> from tokenizers import Tokenizer
+>>> from tokenizers.models import BPE
+>>> from tokenizers.trainers import BpeTrainer
+>>> from tokenizers.pre_tokenizers import Whitespace
+
+>>> tokenizer = Tokenizer(BPE(unk_token="[UNK]"))
+>>> trainer = BpeTrainer(special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"])
+
+>>> tokenizer.pre_tokenizer = Whitespace()
+>>> files = [...]
+>>> tokenizer.train(files, trainer)
+```
+
+็งใใกใฏไปใๅฎ็พฉใใใใกใคใซใซใใฌใผใใณใฐใใใใใผใฏใใคใถใผใๆใฃใฆใใพใใใใใใฉใณใฟใคใ ใงๅผใ็ถใไฝฟ็จใใใใ
+ๅฐๆฅใฎๅๅฉ็จใฎใใใซJSONใใกใคใซใซไฟๅญใใใใจใใงใใพใใ
+
+## Loading directly from the tokenizer object
+
+๐ค Transformersใฉใคใใฉใชใงใใฎใใผใฏใใคใถใผใชใใธใงใฏใใใฉใฎใใใซๆดป็จใงใใใใ่ฆใฆใฟใพใใใใ[`PreTrainedTokenizerFast`]ใฏใฉในใฏใ
+*tokenizer*ใชใใธใงใฏใใๅผๆฐใจใใฆๅใๅ
ฅใใ็ฐกๅใซใคใณในใฟใณในๅใงใใใใใซใใพใใ
+
+
+```python
+>>> from transformers import PreTrainedTokenizerFast
+
+>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_object=tokenizer)
+```
+
+ใใฎใชใใธใงใฏใใฏใ๐ค Transformers ใใผใฏใใคใถใผใๅ
ฑๆใใใในใฆใฎใกใฝใใใจไธ็ทใซไฝฟ็จใงใใพใ๏ผ่ฉณ็ดฐใซใคใใฆใฏใ[ใใผใฏใใคใถใผใใผใธ](main_classes/tokenizer)ใใ่ฆงใใ ใใใ
+
+## Loading from a JSON file
+
+JSONใใกใคใซใใใใผใฏใใคใถใผใ่ชญใฟ่พผใใซใฏใใพใใใผใฏใใคใถใผใไฟๅญใใใใจใใๅงใใพใใใ๏ผ
+
+```python
+>>> tokenizer.save("tokenizer.json")
+```
+
+ใใฎใใกใคใซใไฟๅญใใใในใฏใ`PreTrainedTokenizerFast` ใฎๅๆๅใกใฝใใใซ `tokenizer_file` ใใฉใกใผใฟใไฝฟ็จใใฆๆธกใใใจใใงใใพใ๏ผ
+
+
+```python
+>>> from transformers import PreTrainedTokenizerFast
+
+>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json")
+```
+
+ใใฎใชใใธใงใฏใใฏใ๐ค Transformers ใใผใฏใใคใถใผใๅ
ฑๆใใใในใฆใฎใกใฝใใใจไธ็ทใซไฝฟ็จใงใใใใใซใชใใพใใ๏ผ่ฉณ็ดฐใซใคใใฆใฏใ[ใใผใฏใใคใถใผใใผใธ](main_classes/tokenizer)ใใ่ฆงใใ ใใใ
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/generation_strategies.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/generation_strategies.md
new file mode 100644
index 0000000000000000000000000000000000000000..ff71d0c9b15d1019fbfca0420d7322992049efd5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/generation_strategies.md
@@ -0,0 +1,345 @@
+
+
+# Text generation strategies
+
+ใใญในใ็ๆใฏใใชใผใใณใจใณใใฎใใญในใ็ๆใ่ฆ็ดใ็ฟป่จณใชใฉใๅคใใฎ่ช็ถ่จ่ชๅฆ็ใฟในใฏใซไธๅฏๆฌ ใงใใใพใใใใญในใใๅบๅใจใใใใพใใพใชๆททๅจใขใใชใใฃใขใใชใฑใผใทใงใณใซใๅฝฑ้ฟใไธใใฆใใใไพใใฐ้ณๅฃฐใใใใญในใใธใฎๅคๆใ็ปๅใใใใญในใใธใฎๅคๆใชใฉใใใใพใใใใญในใใ็ๆใงใใใใใคใใฎใขใใซใซใฏใGPT2ใXLNetใOpenAI GPTใCTRLใTransformerXLใXLMใBartใT5ใGITใWhisperใๅซใพใใพใใ
+
+[`~generation.GenerationMixin.generate`] ใกใฝใใใไฝฟ็จใใฆใ็ฐใชใใฟในใฏใฎใใญในใๅบๅใ็ๆใใใใใคใใฎไพใใ็ดนไปใใพใ๏ผ
+* [ใใญในใ่ฆ็ด](./tasks/summarization#inference)
+* [็ปๅใฎใญใฃใใทใงใณ](./model_doc/git#transformers.GitForCausalLM.forward.example)
+* [้ณๅฃฐใฎ่ปข่จ](./model_doc/whisper#transformers.WhisperForConditionalGeneration.forward.example)
+
+generateใกใฝใใใธใฎๅ
ฅๅใฏใใขใใซใฎใขใใชใใฃใซไพๅญใใพใใใใใใฎๅ
ฅๅใฏใAutoTokenizerใAutoProcessorใชใฉใฎใขใใซใฎใใชใใญใปใใตใฏใฉในใซใใฃใฆ่ฟใใใพใใใขใใซใฎใใชใใญใปใใตใ่คๆฐใฎ็จฎ้กใฎๅ
ฅๅใ็ๆใใๅ ดๅใฏใใในใฆใฎๅ
ฅๅใgenerate()ใซๆธกใใพใใๅใขใใซใฎใใชใใญใปใใตใซใคใใฆใฎ่ฉณ็ดฐใฏใๅฏพๅฟใใใขใใซใฎใใญใฅใกใณใใผใทใงใณใง็ขบ่ชใงใใพใใ
+
+ใใญในใใ็ๆใใใใใฎใใผใฏใณใฎ้ธๆใใญใปในใฏใใณใผใใฃใณใฐใจใใฆ็ฅใใใ`generate()`ใกใฝใใใไฝฟ็จใใใใณใผใใฃใณใฐๆฆ็ฅใใซในใฟใใคใบใงใใพใใใใณใผใใฃใณใฐๆฆ็ฅใๅคๆดใใใใจใฏใ่จ็ทดๅฏ่ฝใชใใฉใกใผใฟใฎๅคใๅคๆดใใพใใใใ็ๆใใใใใญในใใฎๅ่ณชใซ้ก่ใชๅฝฑ้ฟใไธใใใใจใใใใพใใใใใซใใใใใญในใๅ
ใฎ็นฐใ่ฟใใๆธๅฐใใใใใไธ่ฒซๆงใฎใใใใญในใใ็ๆใใใฎใซๅฝน็ซใกใพใใ
+
+ใใฎใฌใคใใงใฏไปฅไธใฎๅ
ๅฎนใ่ชฌๆใใใฆใใพใ๏ผ
+* ใใใฉใซใใฎใใญในใ็ๆ่จญๅฎ
+* ไธ่ฌ็ใชใใณใผใใฃใณใฐๆฆ็ฅใจใใฎไธป่ฆใชใใฉใกใผใฟ
+* ๐ค Hubใฎใใชใใฎใใกใคใณใใฅใผใณใขใใซใจใซในใฟใ ็ๆ่จญๅฎใฎไฟๅญใจๅ
ฑๆ
+
+## Default text generation configuration
+
+ใขใใซใฎใใณใผใใฃใณใฐๆฆ็ฅใฏใใใฎ็ๆ่จญๅฎใงๅฎ็พฉใใใฆใใพใใ[`pipeline`] ๅ
ใงๆจ่ซใซไบๅ่จ็ทดใขใใซใไฝฟ็จใใ้ใซใฏใใขใใซใฏใใใฉใซใใฎ็ๆ่จญๅฎใๅ
้จใง้ฉ็จใใ `PreTrainedModel.generate()` ใกใฝใใใๅผใณๅบใใพใใใใใฉใซใใฎ่จญๅฎใฏใใขใใซใซใซในใฟใ ่จญๅฎใไฟๅญใใใฆใใชใๅ ดๅใซใไฝฟ็จใใใพใใ
+
+ใขใใซใๆ็คบ็ใซ่ชญใฟ่พผใๅ ดๅใใใใซไปๅฑใใ็ๆ่จญๅฎใ `model.generation_config` ใไปใใฆ็ขบ่ชใงใใพใใ
+
+```python
+>>> from transformers import AutoModelForCausalLM
+
+>>> model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+>>> model.generation_config
+GenerationConfig {
+ "bos_token_id": 50256,
+ "eos_token_id": 50256,
+}
+```
+
+`model.generation_config` ใๅบๅใใใจใใใใฉใซใใฎ็ๆ่จญๅฎใใ็ฐใชใๅคใฎใฟใ่กจ็คบใใใใใใฉใซใใฎๅคใฏใชในใใใใพใใใ
+
+ใใใฉใซใใฎ็ๆ่จญๅฎใงใฏใๅบๅใฎใตใคใบใฏๅ
ฅๅใใญใณใใใจใฎ็ตใฟๅใใใงๆๅคง20ใใผใฏใณใซๅถ้ใใใฆใใใใชใฝใผในๅถ้ใซ้ใใชใใใใซใใฆใใพใใใใใฉใซใใฎใใณใผใใฃใณใฐๆฆ็ฅใฏ่ฒชๆฌฒๆข็ดขใงใๆใ็ขบ็ใฎ้ซใใใผใฏใณใๆฌกใฎใใผใฏใณใจใใฆ้ธๆใใๆใๅ็ดใชใใณใผใใฃใณใฐๆฆ็ฅใงใใๅคใใฎใฟในใฏใๅฐใใชๅบๅใตใคใบใฎๅ ดๅใใใใฏใใพใๆฉ่ฝใใพใใใใ ใใ้ทใๅบๅใ็ๆใใใใใซไฝฟ็จใใใๅ ดๅใ่ฒชๆฌฒๆข็ดขใฏ้ซๅบฆใซ็นฐใ่ฟใใใ็ตๆใ็ๆใๅงใใใใจใใใใพใใ
+
+## Customize text generation
+
+`generate` ใกใฝใใใซ็ดๆฅใใฉใกใผใฟใจใใฎๅคใๆธกใใใจใงใ`generation_config` ใไธๆธใใงใใพใใ
+
+```python
+>>> my_model.generate(**inputs, num_beams=4, do_sample=True) # doctest: +SKIP
+```
+
+ใใใฉใซใใฎใใณใผใใฃใณใฐๆฆ็ฅใใปใจใใฉใฎใฟในใฏใงใใพใๆฉ่ฝใใๅ ดๅใงใใใใใคใใฎ่จญๅฎใๅพฎ่ชฟๆดใงใใพใใไธ่ฌ็ใซ่ชฟๆดใใใใใฉใกใผใฟใซใฏๆฌกใฎใใฎใใใใพใ๏ผ
+
+- `max_new_tokens`: ็ๆใใใใผใฏใณใฎๆๅคงๆฐใใคใพใใๅบๅใทใผใฑใณในใฎใตใคใบใงใใใใใญใณใใๅ
ใฎใใผใฏใณใฏๅซใพใใพใใใ
+- `num_beams`: 1ใใใๅคงใใชใใผใ ๆฐใๆๅฎใใใใจใงใ่ฒชๆฌฒๆค็ดขใใใใผใ ใตใผใใซๅใๆฟใใใใจใใงใใพใใใใฎๆฆ็ฅใงใฏใๅๆ้ในใใใใงใใใคใใฎไปฎ่ชฌใ่ฉไพกใใๆ็ต็ใซๅ
จไฝใฎใทใผใฑใณในใซๅฏพใใๆใ้ซใ็ขบ็ใๆใคไปฎ่ชฌใ้ธๆใใพใใใใใซใใใๅๆใฎ็ขบ็ใไฝใใใผใฏใณใงๅงใพใ้ซ็ขบ็ใฎใทใผใฑใณในใ่ฒชๆฌฒๆค็ดขใซใใฃใฆ็ก่ฆใใใใใจใใชใใชใใพใใ
+- `do_sample`: ใใฎใใฉใกใผใฟใ`True`ใซ่จญๅฎใใใจใๅค้
ๅๅธใตใณใใชใณใฐใใใผใ ใตใผใๅค้
ๅๅธใตใณใใชใณใฐใTop-KใตใณใใชใณใฐใTop-pใตใณใใชใณใฐใชใฉใฎใใณใผใใฃใณใฐๆฆ็ฅใๆๅนใซใชใใพใใใใใใฎๆฆ็ฅใฏใๅๆฆ็ฅๅบๆใฎ่ชฟๆดใๅซใๅ่ชๅฝๅ
จไฝใฎ็ขบ็ๅๅธใใๆฌกใฎใใผใฏใณใ้ธๆใใพใใ
+- `num_return_sequences`: ๅๅ
ฅๅใซๅฏพใใฆ่ฟใใทใผใฑใณในๅ่ฃใฎๆฐใใใใฏใ่คๆฐใฎใทใผใฑใณในๅ่ฃใใตใใผใใใใใณใผใใฃใณใฐๆฆ็ฅ๏ผใใผใ ใตใผใใใตใณใใชใณใฐใฎใใชใจใผใทใงใณใชใฉ๏ผใซใฎใฟ้ฉ็จใใใพใใ่ฒชๆฌฒๆค็ดขใๅฏพ็
ง็ใชๆค็ดขใชใฉใๅไธใฎๅบๅใทใผใฑใณในใ่ฟใใใณใผใใฃใณใฐๆฆ็ฅใงใฏไฝฟ็จใงใใพใใใ
+
+## Save a custom decoding strategy with your model
+
+็นๅฎใฎ็ๆๆงๆใง่ชฟๆดใใใขใใซใๅ
ฑๆใใใๅ ดๅใไปฅไธใฎๆ้ ใๅฎ่กใงใใพใ๏ผ
+* [`GenerationConfig`] ใฏใฉในใฎใคใณในใฟใณในใไฝๆใใ
+* ใใณใผใใฃใณใฐๆฆ็ฅใฎใใฉใกใผใฟใๆๅฎใใ
+* [`GenerationConfig.save_pretrained`] ใไฝฟ็จใใฆ็ๆๆงๆใไฟๅญใใ`config_file_name` ๅผๆฐใ็ฉบใซใใใใจใๅฟใใชใใงใใ ใใ
+* `push_to_hub` ใ `True` ใซ่จญๅฎใใฆใๆงๆใใขใใซใฎใชใใธใใชใซใขใใใญใผใใใพใ
+
+```python
+>>> from transformers import AutoModelForCausalLM, GenerationConfig
+
+>>> model = AutoModelForCausalLM.from_pretrained("my_account/my_model") # doctest: +SKIP
+>>> generation_config = GenerationConfig(
+... max_new_tokens=50, do_sample=True, top_k=50, eos_token_id=model.config.eos_token_id
+... )
+>>> generation_config.save_pretrained("my_account/my_model", push_to_hub=True) # doctest: +SKIP
+```
+
+1ใคใฎใใฃใฌใฏใใชใซ่คๆฐใฎ็ๆ่จญๅฎใไฟๅญใใใใจใใงใใ[`GenerationConfig.save_pretrained`] ใฎ `config_file_name`
+ๅผๆฐใไฝฟ็จใใพใใๅพใง [`GenerationConfig.from_pretrained`] ใงใใใใใคใณในใฟใณในๅใงใใพใใใใใฏใ1ใคใฎใขใใซใซๅฏพใใฆ่คๆฐใฎ็ๆ่จญๅฎใไฟๅญใใใๅ ดๅใซไพฟๅฉใงใ
+๏ผไพ๏ผใตใณใใชใณใฐใไฝฟ็จใใใฏใชใจใคใใฃใใชใใญในใ็ๆ็จใฎ1ใคใจใใใผใ ใตใผใใไฝฟ็จใใ่ฆ็ด็จใฎ1ใค๏ผใใขใใซใซ่จญๅฎใใกใคใซใ่ฟฝๅ ใใใซใฏใ้ฉๅใช Hub ๆจฉ้ใๅฟ
่ฆใงใใ
+
+
+```python
+>>> from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, GenerationConfig
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-t5/t5-small")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("google-t5/t5-small")
+
+>>> translation_generation_config = GenerationConfig(
+... num_beams=4,
+... early_stopping=True,
+... decoder_start_token_id=0,
+... eos_token_id=model.config.eos_token_id,
+... pad_token=model.config.pad_token_id,
+... )
+
+>>> # Tip: add `push_to_hub=True` to push to the Hub
+>>> translation_generation_config.save_pretrained("/tmp", "translation_generation_config.json")
+
+>>> # You could then use the named generation config file to parameterize generation
+>>> generation_config = GenerationConfig.from_pretrained("/tmp", "translation_generation_config.json")
+>>> inputs = tokenizer("translate English to French: Configuration files are easy to use!", return_tensors="pt")
+>>> outputs = model.generate(**inputs, generation_config=generation_config)
+>>> print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+['Les fichiers de configuration sont faciles ร utiliser!']
+```
+
+## Streaming
+
+`generate()` ใฏใใใฎ `streamer` ๅ
ฅๅใไปใใฆในใใชใผใใณใฐใใตใใผใใใฆใใพใใ`streamer` ๅ
ฅๅใฏใๆฌกใฎใกใฝใใใๆใคใฏใฉในใฎใคใณในใฟใณในใจไบๆๆงใใใใพใ๏ผ`put()` ใจ `end()`ใๅ
้จ็ใซใฏใ`put()` ใฏๆฐใใใใผใฏใณใใใใทใฅใใใใใซไฝฟ็จใใใ`end()` ใฏใใญในใ็ๆใฎ็ตไบใใใฉใฐไปใใใใใใซไฝฟ็จใใใพใใ
+
+
+
+ในใใชใผใใผใฏใฉในใฎAPIใฏใพใ ้็บไธญใงใใใๅฐๆฅๅคๆดใใใๅฏ่ฝๆงใใใใพใใ
+
+
+
+ๅฎ้ใซใฏใใใพใใพใช็ฎ็ใซๅฏพใใฆ็ฌ่ชใฎในใใชใผใใณใฐใฏใฉในใไฝๆใงใใพใ๏ผใพใใไฝฟ็จใงใใๅบๆฌ็ใชในใใชใผใใณใฐใฏใฉในใ็จๆใใใฆใใพใใไพใใฐใ[`TextStreamer`] ใฏใฉในใไฝฟ็จใใฆใ`generate()` ใฎๅบๅใ็ป้ขใซๅ่ชใใจใซในใใชใผใ ใใใใจใใงใใพใ๏ผ
+
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
+
+>>> tok = AutoTokenizer.from_pretrained("openai-community/gpt2")
+>>> model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+>>> inputs = tok(["An increasing sequence: one,"], return_tensors="pt")
+>>> streamer = TextStreamer(tok)
+
+>>> # Despite returning the usual output, the streamer will also print the generated text to stdout.
+>>> _ = model.generate(**inputs, streamer=streamer, max_new_tokens=20)
+An increasing sequence: one, two, three, four, five, six, seven, eight, nine, ten, eleven,
+```
+
+## Decoding strategies
+
+็นๅฎใฎ `generate()` ใใฉใกใผใฟใฎ็ตใฟๅใใใใใใฆๆ็ต็ใซ `generation_config` ใฏใ็นๅฎใฎใใณใผใใฃใณใฐๆฆ็ฅใๆๅนใซใใใใใซไฝฟ็จใงใใพใใใใฎใณใณใปใใใๆฐใใๅ ดๅใ[ใใฎใใญใฐใในใ](https://huggingface.co/blog/how-to-generate)ใ่ชญใใใจใใๅงใใใพใใใใฎใใญใฐใในใใงใฏใไธ่ฌ็ใชใใณใผใใฃใณใฐๆฆ็ฅใใฉใฎใใใซๅไฝใใใใ่ชฌๆใใใฆใใพใใ
+
+ใใใงใฏใใใณใผใใฃใณใฐๆฆ็ฅใๅถๅพกใใใใใคใใฎใใฉใกใผใฟใ็คบใใใใใใใฉใฎใใใซไฝฟ็จใงใใใใ่ชฌๆใใพใใ
+
+### Greedy Search
+
+[`generate`] ใฏใใใฉใซใใง่ฒชๆฌฒๆข็ดขใใณใผใใฃใณใฐใไฝฟ็จใใใใใๆๅนใซใใใใใซใใฉใกใผใฟใๆธกใๅฟ
่ฆใฏใใใพใใใใใใฏใใใฉใกใผใฟ `num_beams` ใ 1 ใซ่จญๅฎใใใ`do_sample=False` ใงใใใใจใๆๅณใใพใใ
+
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> prompt = "I look forward to"
+>>> checkpoint = "distilbert/distilgpt2"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+>>> outputs = model.generate(**inputs)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['I look forward to seeing you all again!\n\n\n\n\n\n\n\n\n\n\n']
+```
+
+### Contrastive search
+
+ใณใณใใฉในใใฃใๆค็ดขใใณใผใใฃใณใฐๆฆ็ฅใฏใ2022ๅนดใฎ่ซๆ[A Contrastive Framework for Neural Text Generation](https://arxiv.org/abs/2202.06417)ใงๆๆกใใใพใใใ
+ใใใฏใ้ๅๅพฉ็ใงใใใชใใไธ่ฒซๆงใฎใใ้ทใๅบๅใ็ๆใใใใใซๅชใใ็ตๆใ็คบใใฆใใพใใใณใณใใฉในใใฃใๆค็ดขใฎๅไฝๅ็ใๅญฆใถใซใฏใ[ใใฎใใญใฐใในใ](https://huggingface.co/blog/introducing-csearch)ใใ่ฆงใใ ใใใ
+ใณใณใใฉในใใฃใๆค็ดขใฎๅไฝใๆๅนใซใใๅถๅพกใใ2ใคใฎไธป่ฆใชใใฉใกใผใฟใฏใpenalty_alphaใใจใtop_kใใงใ๏ผ
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForCausalLM
+
+>>> checkpoint = "openai-community/gpt2-large"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+
+>>> prompt = "Hugging Face Company is"
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> outputs = model.generate(**inputs, penalty_alpha=0.6, top_k=4, max_new_tokens=100)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Hugging Face Company is a family owned and operated business. We pride ourselves on being the best
+in the business and our customer service is second to none.\n\nIf you have any questions about our
+products or services, feel free to contact us at any time. We look forward to hearing from you!']
+```
+
+### Multinomial sampling
+
+ๅธธใซๆ้ซ็ขบ็ใฎใใผใฏใณใๆฌกใฎใใผใฏใณใจใใฆ้ธๆใใ่ฒชๆฌฒๆค็ดขใจใฏ็ฐใชใใๅค้
ๅๅธใตใณใใชใณใฐ๏ผใพใใฏ็ฅๅ
ใตใณใใชใณใฐใจใๅผใฐใใพใ๏ผใฏใขใใซใซใใฃใฆๆไพใใใ่ชๅฝๅ
จไฝใฎ็ขบ็ๅๅธใซๅบใฅใใฆๆฌกใฎใใผใฏใณใใฉใณใใ ใซ้ธๆใใพใใใผใญไปฅๅคใฎ็ขบ็ใๆใคใในใฆใฎใใผใฏใณใซใฏ้ธๆใใใๅฏ่ฝๆงใใใใใใใซใใ็นฐใ่ฟใใฎใชในใฏใๆธๅฐใใพใใ
+
+ๅค้
ๅๅธใตใณใใชใณใฐใๆๅนใซใใใซใฏใ`do_sample=True` ใใใณ `num_beams=1` ใ่จญๅฎใใพใใ
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed
+>>> set_seed(0) # For reproducibility
+
+>>> checkpoint = "openai-community/gpt2-large"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+
+>>> prompt = "Today was an amazing day because"
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> outputs = model.generate(**inputs, do_sample=True, num_beams=1, max_new_tokens=100)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Today was an amazing day because when you go to the World Cup and you don\'t, or when you don\'t get invited,
+that\'s a terrible feeling."']
+```
+
+### Beam-search decoding
+
+่ฒชๆฌฒๆข็ดขใจใฏ็ฐใชใใใใผใ ใตใผใใใณใผใใฃใณใฐใฏๅๆ้ในใใใใงใใใคใใฎไปฎ่ชฌใไฟๆใใๆ็ต็ใซใทใผใฑใณในๅ
จไฝใงๆใ็ขบ็ใ้ซใไปฎ่ชฌใ้ธๆใใพใใใใใซใใใ่ฒชๆฌฒๆข็ดขใงใฏ็ก่ฆใใใฆใใพใๅๆใใผใฏใณใฎ็ขบ็ใไฝใ้ซ็ขบ็ใฎใทใผใฑใณในใ็นๅฎใใๅฉ็นใใใใพใใ
+
+ใใฎใใณใผใใฃใณใฐๆฆ็ฅใๆๅนใซใใใซใฏใ`num_beams`๏ผ่ฟฝ่ทกใใไปฎ่ชฌใฎๆฐ๏ผใ1ใใใๅคงใใชๅคใซๆๅฎใใพใใ
+
+ๅธๆใใใใใญในใใฎ็ฟป่จณใใๆไผใใงใใฆๅฌใใใงใ๏ผใใใใใชใ่ณชๅใใตใใผใใๅฟ
่ฆใชๅ ดๅใฏใใๆฐ่ปฝใซใ็ฅใใใใ ใใใ
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> prompt = "It is astonishing how one can"
+>>> checkpoint = "openai-community/gpt2-medium"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+
+>>> outputs = model.generate(**inputs, num_beams=5, max_new_tokens=50)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['It is astonishing how one can have such a profound impact on the lives of so many people in such a short period of
+time."\n\nHe added: "I am very proud of the work I have been able to do in the last few years.\n\n"I have']
+```
+
+### Beam-search multinomial sampling
+
+ใใฎๅๅใใใใใใใใใซใใใฎใใณใผใใฃใณใฐๆฆ็ฅใฏใใผใ ใตใผใใจๅค้
ใตใณใใชใณใฐใ็ตใฟๅใใใฆใใพใใใใฎใใณใผใใฃใณใฐๆฆ็ฅใไฝฟ็จใใใซใฏใ`num_beams` ใ1ใใๅคงใใชๅคใซ่จญๅฎใใ`do_sample=True` ใ่จญๅฎใใๅฟ
่ฆใใใใพใใ
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, set_seed
+>>> set_seed(0) # For reproducibility
+
+>>> prompt = "translate English to German: The house is wonderful."
+>>> checkpoint = "google-t5/t5-small"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+
+>>> outputs = model.generate(**inputs, num_beams=5, do_sample=True)
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'Das Haus ist wunderbar.'
+```
+
+### Diverse beam search decoding
+
+ๅคๆงใชใใผใ ใตใผใใใณใผใใฃใณใฐๆฆ็ฅใฏใใใผใ ใตใผใๆฆ็ฅใฎๆกๅผตใงใใใ้ธๆ่ขใใใใๅคๆงใชใใผใ ใทใผใฑใณในใ็ๆใงใใใใใซใใพใใใใฎไป็ตใฟใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Diverse Beam Search: Decoding Diverse Solutions from Neural Sequence Models](https://arxiv.org/pdf/1610.02424.pdf) ใใๅ็
งใใ ใใใใใฎใขใใญใผใใซใฏใ`num_beams`ใ`num_beam_groups`ใใใใณ `diversity_penalty` ใจใใ3ใคใฎไธป่ฆใชใใฉใกใผใฟใใใใพใใๅคๆงๆงใใใซใใฃใฏใๅบๅใใฐใซใผใใใจใซ็ฐใชใใใจใไฟ่จผใใใใผใ ใตใผใใฏๅใฐใซใผใๅ
ใงไฝฟ็จใใใพใใ
+
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+>>> checkpoint = "google/pegasus-xsum"
+>>> prompt = (
+... "The Permaculture Design Principles are a set of universal design principles "
+... "that can be applied to any location, climate and culture, and they allow us to design "
+... "the most efficient and sustainable human habitation and food production systems. "
+... "Permaculture is a design system that encompasses a wide variety of disciplines, such "
+... "as ecology, landscape design, environmental science and energy conservation, and the "
+... "Permaculture design principles are drawn from these various disciplines. Each individual "
+... "design principle itself embodies a complete conceptual framework based on sound "
+... "scientific principles. When we bring all these separate principles together, we can "
+... "create a design system that both looks at whole systems, the parts that these systems "
+... "consist of, and how those parts interact with each other to create a complex, dynamic, "
+... "living system. Each design principle serves as a tool that allows us to integrate all "
+... "the separate parts of a design, referred to as elements, into a functional, synergistic, "
+... "whole system, where the elements harmoniously interact and work together in the most "
+... "efficient way possible."
+... )
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+
+>>> outputs = model.generate(**inputs, num_beams=5, num_beam_groups=5, max_new_tokens=30, diversity_penalty=1.0)
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'The Design Principles are a set of universal design principles that can be applied to any location, climate and
+culture, and they allow us to design the'
+```
+
+### Assisted Decoding
+
+ใขใทในใใใณใผใใฃใณใฐใฏใไธ่จใฎใใณใผใใฃใณใฐๆฆ็ฅใๅคๆดใใใใฎใงใๅใใใผใฏใใคใถใผ๏ผ็ๆณ็ใซใฏใฏใใใซๅฐใใชใขใใซ๏ผใไฝฟ็จใใฆใใใใคใใฎๅ่ฃใใผใฏใณใ่ฒชๆฌฒใซ็ๆใใใขใทในใฟใณใใขใใซใไฝฟ็จใใพใใใใฎๅพใไธป่ฆใชใขใใซใฏๅ่ฃใใผใฏใณใ1ใคใฎๅๅใใในใงๆค่จผใใใใณใผใใฃใณใฐใใญใปในใ้ซ้ๅใใพใใ็พๅจใใขใทในใใใณใผใใฃใณใฐใงใฏ่ฒชๆฌฒๆค็ดขใจใตใณใใชใณใฐใฎใฟใใตใใผใใใใฆใใใใใใๅ
ฅๅใฏใตใใผใใใใฆใใพใใใใขใทในใใใณใผใใฃใณใฐใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ใใฎใใญใฐ่จไบ](https://huggingface.co/blog/assisted-generation) ใใ่ฆงใใ ใใใ
+
+ใขใทในใใใณใผใใฃใณใฐใๆๅนใซใใใซใฏใ`assistant_model` ๅผๆฐใใขใใซใง่จญๅฎใใพใใ
+
+ใใฎใฌใคใใฏใใใพใใพใชใใณใผใใฃใณใฐๆฆ็ฅใๅฏ่ฝใซใใไธป่ฆใชใใฉใกใผใฟใผใ่ชฌๆใใฆใใพใใใใใซ้ซๅบฆใชใใฉใกใผใฟใผใฏ [`generate`] ใกใฝใใใซๅญๅจใใ[`generate`] ใกใฝใใใฎๅไฝใใใใซๅถๅพกใงใใพใใไฝฟ็จๅฏ่ฝใชใใฉใกใผใฟใผใฎๅฎๅ
จใชใชในใใซใคใใฆใฏใ[APIใใญใฅใกใณใ](./main_classes/text_generation.md) ใๅ็
งใใฆใใ ใใใ
+
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> prompt = "Alice and Bob"
+>>> checkpoint = "EleutherAI/pythia-1.4b-deduped"
+>>> assistant_checkpoint = "EleutherAI/pythia-160m-deduped"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+>>> assistant_model = AutoModelForCausalLM.from_pretrained(assistant_checkpoint)
+>>> outputs = model.generate(**inputs, assistant_model=assistant_model)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Alice and Bob are sitting in a bar. Alice is drinking a beer and Bob is drinking a']
+```
+
+ใตใณใใชใณใฐๆนๆณใไฝฟ็จใใๅ ดๅใใขใทในใใใณใผใใฃใณใฐใงใฏ `temperature` ๅผๆฐใไฝฟ็จใใฆใๅค้
ใตใณใใชใณใฐใจๅๆงใซใฉใณใใ ๆงใๅถๅพกใงใใพใใใใ ใใใขใทในใใใณใผใใฃใณใฐใงใฏใๆธฉๅบฆใไฝใใใใใจใง้
ๅปถใฎๆนๅใซๅฝน็ซใกใพใใ
+
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer, set_seed
+>>> set_seed(42) # For reproducibility
+
+>>> prompt = "Alice and Bob"
+>>> checkpoint = "EleutherAI/pythia-1.4b-deduped"
+>>> assistant_checkpoint = "EleutherAI/pythia-160m-deduped"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+>>> assistant_model = AutoModelForCausalLM.from_pretrained(assistant_checkpoint)
+>>> outputs = model.generate(**inputs, assistant_model=assistant_model, do_sample=True, temperature=0.5)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Alice and Bob are going to the same party. It is a small party, in a small']
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/glossary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/glossary.md
new file mode 100644
index 0000000000000000000000000000000000000000..39148f5d0f48c1a6db1e5cd6b5dd4a6aa2b2ce3f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/glossary.md
@@ -0,0 +1,444 @@
+
+
+# Glossary
+
+ใใฎ็จ่ช้ใฏใไธ่ฌ็ใชๆฉๆขฐๅญฆ็ฟใจ ๐ค ใใฉใณในใใฉใผใใผใฎ็จ่ชใๅฎ็พฉใใใใญใฅใกใณใใผใทใงใณใใใ็่งฃใใใฎใซๅฝน็ซใกใพใใ
+
+## A
+
+### attention mask
+
+ใขใใณใทใงใณ ใในใฏใฏใใทใผใฑใณในใใใใๅฆ็ใใ้ใซไฝฟ็จใใใใชใใทใงใณใฎๅผๆฐใงใใ
+
+
+
+ใใฎๅผๆฐใฏใใขใใซใซใฉใฎใใผใฏใณใๆณจ่ฆใในใใใใฉใฎใใผใฏใณใๆณจ่ฆใใชใใใ็คบใใพใใ
+
+ไพใใฐใๆฌกใฎ2ใคใฎใทใผใฑใณในใ่ใใฆใฟใฆใใ ใใ๏ผ
+
+```python
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+>>> sequence_a = "This is a short sequence."
+>>> sequence_b = "This is a rather long sequence. It is at least longer than the sequence A."
+
+>>> encoded_sequence_a = tokenizer(sequence_a)["input_ids"]
+>>> encoded_sequence_b = tokenizer(sequence_b)["input_ids"]
+```
+
+The encoded versions have different lengths:
+
+```python
+>>> len(encoded_sequence_a), len(encoded_sequence_b)
+(8, 19)
+```
+
+ใใใใฃใฆใใใใใฎใทใผใฑใณในใใใฎใพใพๅใใใณใฝใซใซ้
็ฝฎใใใใจใฏใงใใพใใใๆๅใฎใทใผใฑใณในใฏใ
+2็ช็ฎใฎใทใผใฑใณในใฎ้ทใใซๅใใใฆใใใฃใณใฐใใๅฟ
่ฆใใใใพใใใพใใฏใ2็ช็ฎใฎใทใผใฑใณในใฏใๆๅใฎใทใผใฑใณในใฎ
+้ทใใซๅใ่ฉฐใใๅฟ
่ฆใใใใพใใ
+
+ๆๅใฎๅ ดๅใIDใฎใชในใใฏใใใฃใณใฐใคใณใใใฏในใงๆกๅผตใใใพใใใใผใฏใใคใถใซใชในใใๆธกใใๆฌกใฎใใใซใใใฃใณใฐใใใใใซ
+ไพ้ ผใงใใพใ:
+
+
+```python
+>>> padded_sequences = tokenizer([sequence_a, sequence_b], padding=True)
+```
+
+0sใ่ฟฝๅ ใใใฆใๆๅใฎๆใ2็ช็ฎใฎๆใจๅใ้ทใใซใชใใฎใใใใใพใ๏ผ
+
+```python
+>>> padded_sequences["input_ids"]
+[[101, 1188, 1110, 170, 1603, 4954, 119, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [101, 1188, 1110, 170, 1897, 1263, 4954, 119, 1135, 1110, 1120, 1655, 2039, 1190, 1103, 4954, 138, 119, 102]]
+```
+
+ใใใฏใPyTorchใพใใฏTensorFlowใงใใณใฝใซใซๅคๆใงใใพใใๆณจๆใในใฏใฏใใขใใซใใใใใซๆณจๆใๆใใชใใใใซใๅใ่พผใพใใใคใณใใใฏในใฎไฝ็ฝฎใ็คบใใใคใใชใใณใฝใซใงใใ[`BertTokenizer`]ใงใฏใ`1`ใฏๆณจๆใๆใๅฟ
่ฆใใใๅคใ็คบใใ`0`ใฏๅใ่พผใพใใๅคใ็คบใใพใใใใฎๆณจๆใในใฏใฏใใใผใฏใใคใถใ่ฟใ่พๆธใฎใญใผใattention_maskใใฎไธใซใใใพใใ
+
+
+
+```python
+>>> padded_sequences["attention_mask"]
+[[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
+```
+
+### autoencoding models
+
+[ใจใณใณใผใใผใขใใซ](#encoder-models) ใใใณ [ใในใฏ่จ่ชใขใใชใณใฐ](#masked-language-modeling-mlm) ใๅ็
งใใฆใใ ใใใ
+
+### autoregressive models
+
+[ๅ ๆ่จ่ชใขใใชใณใฐ](#causal-language-modeling) ใใใณ [ใใณใผใใผใขใใซ](#decoder-models) ใๅ็
งใใฆใใ ใใใ
+
+## B
+
+### backbone
+
+ใใใฏใใผใณใฏใ็ใฎ้ ใใ็ถๆ
ใ็นๅพดใๅบๅใใใใใใฏใผใฏ๏ผๅใ่พผใฟใจๅฑค๏ผใงใใ้ๅธธใ็นๅพดใๅ
ฅๅใจใใฆๅใๅใใใใซ [ใใใ](#head) ใซๆฅ็ถใใใฆใใใไบๆธฌใ่กใใพใใใใจใใฐใ[`ViTModel`] ใฏ็นๅฎใฎใใใใไธใซใชใใใใฏใใผใณใงใใไปใฎใขใใซใ [`VitModel`] ใใใใฏใใผใณใจใใฆไฝฟ็จใงใใพใใไพใใฐ [DPT](model_doc/dpt) ใงใใ
+
+## C
+
+### causal language modeling
+
+ใขใใซใใใญในใใ้ ็ชใซ่ชญใฟใๆฌกใฎๅ่ชใไบๆธฌใใไบๅใใฌใผใใณใฐใฟในใฏใงใใ้ๅธธใใขใใซใฏๆๅ
จไฝใ่ชญใฟๅใใพใใใ็นๅฎใฎใฟใคใ ในใใใใงๆชๆฅใฎใใผใฏใณใ้ ใใใใซใขใใซๅ
ใงใในใฏใไฝฟ็จใใพใใ
+
+### channel
+
+ใซใฉใผ็ปๅใฏใ่ตคใ็ทใ้๏ผRGB๏ผใฎ3ใคใฎใใฃใใซใฎๅคใฎ็ตใฟๅใใใใๆใ็ซใฃใฆใใใใฐใฌใผในใฑใผใซ็ปๅใฏ1ใคใฎใใฃใใซใใๆใกใพใใใ๐ค Transformers ใงใฏใใใฃใใซใฏ็ปๅใฎใใณใฝใซใฎๆๅใพใใฏๆๅพใฎๆฌกๅ
ใซใชใใใจใใใใพใ๏ผ[`n_channels`, `height`, `width`] ใพใใฏ [`height`, `width`, `n_channels`]ใ
+
+### connectionist temporal classification (CTC)
+
+ๅ
ฅๅใจๅบๅใๆญฃ็ขบใซใฉใฎใใใซๆดๅใใใใๆญฃ็ขบใซ็ฅใใชใใฆใใขใใซใๅญฆ็ฟใใใใขใซใดใชใบใ ใCTC ใฏใ็นๅฎใฎๅ
ฅๅใซๅฏพใใฆใในใฆใฎๅฏ่ฝใชๅบๅใฎๅๅธใ่จ็ฎใใใใฎไธญใใๆใๅฏ่ฝๆงใฎ้ซใๅบๅใ้ธๆใใพใใCTC ใฏใในใใผใซใผใฎ็ฐใชใ็บ่ฉฑ้ๅบฆใชใฉใใใพใใพใช็็ฑใง้ณๅฃฐใใใฉใณในใฏใชใใใจๅฎๅ
จใซๆดๅใใชใๅ ดๅใซใ้ณๅฃฐ่ช่ญใฟในใฏใงไธ่ฌ็ใซไฝฟ็จใใใพใใ
+
+### convolution
+
+ใใฅใผใฉใซใใใใฏใผใฏใฎไธ็จฎใงใๅ
ฅๅ่กๅใ่ฆ็ด ใใจใซๅฐใใช่กๅ๏ผใซใผใใซใพใใฏใใฃใซใฟใผ๏ผใจไน็ฎใใใๅคใๆฐใใ่กๅใซๅ่จใใใใฌใคใคใผใฎใฟใคใใใใใฏๅ
ฅๅ่กๅๅ
จไฝใซๅฏพใใฆ็นฐใ่ฟใใใ็ณใฟ่พผใฟๆไฝใจใใฆ็ฅใใใๅๆไฝใฏๅ
ฅๅ่กๅใฎ็ฐใชใใปใฐใกใณใใซ้ฉ็จใใใพใใ็ณใฟ่พผใฟใใฅใผใฉใซใใใใฏใผใฏ๏ผCNN๏ผใฏใใณใณใใฅใผใฟใใธใงใณใงไธ่ฌ็ใซไฝฟ็จใใใฆใใพใใ
+
+## D
+
+### decoder input IDs
+
+ใใฎๅ
ฅๅใฏใจใณใณใผใใผใใณใผใใผใขใใซใซ็นๆใงใใใใใณใผใใผใซไพ็ตฆใใใๅ
ฅๅIDใๅซใฟใพใใใใใใฎๅ
ฅๅใฏใ็ฟป่จณใ่ฆ็ดใชใฉใฎใทใผใฑใณในใใผใทใผใฑใณในใฟในใฏใซไฝฟ็จใใใ้ๅธธใๅใขใใซใซๅบๆใฎๆนๆณใงๆง็ฏใใใพใใ
+
+ใปใจใใฉใฎใจใณใณใผใใผใใณใผใใผใขใใซ๏ผBARTใT5๏ผใฏใ`labels` ใใ็ฌ่ชใซ `decoder_input_ids` ใไฝๆใใพใใใใฎใใใชใขใใซใงใฏใ`labels` ใๆธกใใใจใใใฌใผใใณใฐใๅฆ็ใใๅชใใๆนๆณใงใใ
+
+ใทใผใฑใณในใใผใทใผใฑใณในใใฌใผใใณใฐใซใใใใใใใฎๅ
ฅๅIDใฎๅฆ็ๆนๆณใ็ขบ่ชใใใใใซใๅใขใใซใฎใใญใฅใกใณใใ็ขบ่ชใใฆใใ ใใใ
+
+### decoder models
+
+ใชใผใใชใฐใฌใใทใงใณใขใใซใจใๅผใฐใใใขใใซใใใญในใใ้ ็ชใซ่ชญใฟใๆฌกใฎๅ่ชใไบๆธฌใใไบๅใใฌใผใใณใฐใฟในใฏ๏ผๅ ๆ่จ่ชใขใใชใณใฐ๏ผใซ้ขไธใใพใใ้ๅธธใใขใใซใฏๆๅ
จไฝใ่ชญใฟๅใใ็นๅฎใฎใฟใคใ ในใใใใงๆชๆฅใฎใใผใฏใณใ้ ใใในใฏใไฝฟ็จใใฆ่กใใใพใใ
+
+
+
+
+### deep learning (DL)
+
+ใใฅใผใฉใซใใใใฏใผใฏใไฝฟ็จใใๆฉๆขฐๅญฆ็ฟใขใซใดใชใบใ ใงใ่คๆฐใฎๅฑคใๆใฃใฆใใพใใ
+
+## E
+
+### encoder models
+
+ใชใผใใจใณใณใผใใฃใณใฐใขใใซใจใใฆใ็ฅใใใฆใใใใจใณใณใผใใผใขใใซใฏๅ
ฅๅ๏ผใใญในใใ็ปๅใชใฉ๏ผใใๅใ่พผใฟใจๅผใฐใใ็ฐก็ฅๅใใใๆฐๅค่กจ็พใซๅคๆใใพใใใจใณใณใผใใผใขใใซใฏใใใฐใใฐ[ใในใฏใใใ่จ่ชใขใใชใณใฐ๏ผ#masked-language-modeling-mlm๏ผ](#masked-language-modeling-mlm)ใชใฉใฎๆ่กใไฝฟ็จใใฆไบๅใซใใฌใผใใณใฐใใใๅ
ฅๅใทใผใฑใณในใฎไธ้จใใในใฏใใใขใใซใซใใๆๅณใฎใใ่กจ็พใไฝๆใใใใจใๅผทๅถใใใพใใ
+
+
+
+## F
+
+### feature extraction
+
+็ใใผใฟใใใๆ
ๅ ฑ่ฑใใงๆฉๆขฐๅญฆ็ฟใขใซใดใชใบใ ใซใจใฃใฆๆ็จใช็นๅพดใฎใปใใใซ้ธๆใใใณๅคๆใใใใญใปในใ็นๅพดๆฝๅบใฎไพใซใฏใ็ใฎใใญในใใๅ่ชๅใ่พผใฟใซๅคๆใใใใ็ปๅ/ใใใชใใผใฟใใใจใใธใๅฝข็ถใชใฉใฎ้่ฆใช็นๅพดใๆฝๅบใใใใใใใจใๅซใพใใพใใ
+
+### feed forward chunking
+
+ใใฉใณในใใฉใผใใผๅ
ใฎๅๆฎๅทฎๆณจๆใใญใใฏใงใฏใ้ๅธธใ่ชๅทฑๆณจๆๅฑคใฎๅพใซ2ใคใฎใใฃใผใใใฉใฏใผใๅฑคใ็ถใใพใใ
+ใใฃใผใใใฉใฏใผใๅฑคใฎไธญ้ๅใ่พผใฟใตใคใบใฏใใขใใซใฎ้ ใใใตใคใบใใใๅคงใใใใจใใใใใใพใ๏ผใใจใใฐใ`google-bert/bert-base-uncased`ใฎๅ ดๅ๏ผใ
+
+ๅ
ฅๅใตใคใบใ `[batch_sizeใsequence_length]` ใฎๅ ดๅใไธญ้ใใฃใผใใใฉใฏใผใๅใ่พผใฟ `[batch_sizeใsequence_lengthใconfig.intermediate_size]` ใไฟๅญใใใใใซๅฟ
่ฆใชใกใขใชใฏใใกใขใชใฎๅคง้จๅใๅ ใใใใจใใใใพใใ[Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451)ใฎ่่
ใฏใ่จ็ฎใ `sequence_length` ๆฌกๅ
ใซไพๅญใใชใใใใไธกๆนใฎใใฃใผใใใฉใฏใผใๅฑคใฎๅบๅๅใ่พผใฟ `[batch_sizeใconfig.hidden_size]_0ใ...ใ[batch_sizeใconfig.hidden_size]_n` ใๅๅฅใซ่จ็ฎใใๅพใง `[batch_sizeใsequence_lengthใconfig.hidden_size]` ใซ้ฃ็ตใใใใจใฏๆฐๅญฆ็ใซ็ญไพกใงใใใจๆฐไปใใพใใใใใใซใใใๅขๅ ใใ่จ็ฎๆ้ใจใกใขใชไฝฟ็จ้ใฎใใฌใผใใชใใ็ใใพใใใๆฐๅญฆ็ใซ็ญไพกใช็ตๆใๅพใใใพใใ
+
+[`apply_chunking_to_forward`] ้ขๆฐใไฝฟ็จใใใขใใซใฎๅ ดๅใ`chunk_size` ใฏไธฆๅใซ่จ็ฎใใใๅบๅๅใ่พผใฟใฎๆฐใๅฎ็พฉใใใกใขใชใจๆ้ใฎ่ค้ใใฎใใฌใผใใชใใๅฎ็พฉใใพใใ`chunk_size` ใ 0 ใซ่จญๅฎใใใฆใใๅ ดๅใใใฃใผใใใฉใฏใผใใฎใใฃใณใญใณใฐใฏ่กใใใพใใใ
+
+### finetuned models
+
+ใใกใคใณใใฅใผใใณใฐใฏใไบๅใซใใฌใผใใณใฐใใใใขใใซใๅใใใใฎ้ใฟใๅบๅฎใใๆฐใใ่ฟฝๅ ใใใ[model head](#head)ใงๅบๅใฌใคใคใผใ็ฝฎใๆใใๅฝขๅผใฎ่ปข็งปๅญฆ็ฟใงใใใขใใซใใใใฏๅฏพ่ฑกใฎใใผใฟใปใใใงใใฌใผใใณใฐใใใพใใ
+
+่ฉณ็ดฐใซใคใใฆใฏใ[Fine-tune a pretrained model](https://huggingface.co/docs/transformers/training) ใใฅใผใใชใขใซใๅ็
งใใฆใ๐ค Transformersใไฝฟ็จใใใขใใซใฎใใกใคใณใใฅใผใใณใฐๆนๆณใๅญฆใณใพใใใใ
+
+## H
+
+### head
+
+ใขใใซใใใใฏใใใฅใผใฉใซใใใใฏใผใฏใฎๆๅพใฎใฌใคใคใผใๆใใ็ใฎ้ ใใ็ถๆ
ใๅใๅ
ฅใใฆ็ฐใชใๆฌกๅ
ใซๅฐๅฝฑใใพใใๅใฟในใฏใซๅฏพใใฆ็ฐใชใใขใใซใใใใใใใพใใไพใใฐ๏ผ
+
+ * [`GPT2ForSequenceClassification`] ใฏใใใผในใฎ[`GPT2Model`]ใฎไธใซใใใทใผใฑใณในๅ้กใใใ๏ผ็ทๅฝขๅฑค๏ผใงใใ
+ * [`ViTForImageClassification`] ใฏใใใผในใฎ[`ViTModel`]ใฎ`CLS`ใใผใฏใณใฎๆ็ต้ ใใ็ถๆ
ใฎไธใซใใ็ปๅๅ้กใใใ๏ผ็ทๅฝขๅฑค๏ผใงใใ
+ * [`Wav2Vec2ForCTC`] ใฏใ[CTC](#connectionist-temporal-classification-ctc)ใๆใคใใผในใฎ[`Wav2Vec2Model`]ใฎ่จ่ชใขใใชใณใฐใใใใงใใ
+
+## I
+
+### image patch
+
+ใใธใงใณใใผในใฎใใฉใณในใใฉใผใใผใขใใซใฏใ็ปๅใใใๅฐใใชใใใใซๅๅฒใใใใใใ็ทๅฝขใซๅใ่พผใฟใใขใใซใซใทใผใฑใณในใจใใฆๆธกใใพใใใขใใซใฎ
+
+### inference
+
+ๆจ่ซใฏใใใฌใผใใณใฐใๅฎไบใใๅพใซๆฐใใใใผใฟใงใขใใซใ่ฉไพกใใใใญใปในใงใใ ๐ค Transformers ใไฝฟ็จใใฆๆจ่ซใๅฎ่กใใๆนๆณใซใคใใฆใฏใ[ๆจ่ซใฎใใคใใฉใคใณ](https://huggingface.co/docs/transformers/pipeline_tutorial) ใใฅใผใใชใขใซใๅ็
งใใฆใใ ใใใ
+
+### input IDs
+
+ๅ
ฅๅIDใฏใใขใใซใธใฎๅ
ฅๅใจใใฆๆธกใๅฟ
่ฆใใใใใฉใกใผใฟใผใฎไธญใงๆใไธ่ฌ็ใชใใฎใงใใใใใใฏใใผใฏใณใฎใคใณใใใฏในใงใใใใขใใซใซใใฃใฆๅ
ฅๅใจใใฆไฝฟ็จใใใใทใผใฑใณในใๆง็ฏใใใใผใฏใณใฎๆฐๅค่กจ็พใงใใ
+
+
+
+ๅใใผใฏใใคใถใผใฏ็ฐใชใๆนๆณใงๅไฝใใพใใใๅบๆฌ็ใชใกใซใใบใ ใฏๅใใงใใไปฅไธใฏBERTใใผใฏใใคใถใผใไฝฟ็จใใไพใงใใBERTใใผใฏใใคใถใผใฏ[WordPiece](https://arxiv.org/pdf/1609.08144.pdf)ใใผใฏใใคใถใผใงใใ
+
+
+```python
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+>>> sequence = "A Titan RTX has 24GB of VRAM"
+```
+
+ใใผใฏใใคใถใผใฏใใทใผใฑใณในใใใผใฏใใคใถใผ่ชๅฝใงไฝฟ็จๅฏ่ฝใชใใผใฏใณใซๅๅฒใใพใใ
+
+```python
+>>> tokenized_sequence = tokenizer.tokenize(sequence)
+```
+
+ใใผใฏใณใฏๅ่ชใพใใฏใตใใฏใผใใงใใ ใใจใใฐใใใใงใฏ "VRAM" ใฏใขใใซใฎ่ชๅฝใซๅซใพใใฆใใชใใฃใใใใ"V"ใ"RA"ใ"M" ใซๅๅฒใใใพใใใ
+ใใใใฎใใผใฏใณใๅฅใ
ใฎๅ่ชใงใฏใชใใๅใๅ่ชใฎไธ้จใงใใใใจใ็คบใใใใซใ"RA" ใจ "M" ใซใฏใใใซใใใทใฅใฎใใฌใใฃใใฏในใ่ฟฝๅ ใใใพใใ
+
+```python
+>>> print(tokenized_sequence)
+['A', 'Titan', 'R', '##T', '##X', 'has', '24', '##GB', 'of', 'V', '##RA', '##M']
+```
+
+ใใใใฎใใผใฏใณใฏใใขใใซใ็่งฃใงใใใใใซIDใซๅคๆใงใใพใใใใใฏใๆใใใผใฏใใคใถใผใซ็ดๆฅไพ็ตฆใใฆ่กใใใจใใงใใพใใใใผใฏใใคใถใผใฏใใใใฉใผใใณในใฎๅไธใฎใใใซ[๐ค Tokenizers](https://github.com/huggingface/tokenizers)ใฎRustๅฎ่ฃ
ใๆดป็จใใฆใใพใใ
+
+```python
+>>> inputs = tokenizer(sequence)
+```
+
+ใใผใฏใใคใถใผใฏใๅฏพๅฟใใใขใใซใๆญฃใใๅไฝใใใใใซๅฟ
่ฆใชใในใฆใฎๅผๆฐใๅซใ่พๆธใ่ฟใใพใใใใผใฏใณใฎใคใณใใใฏในใฏใใญใผ `input_ids` ใฎไธใซใใใพใใ
+
+```python
+>>> encoded_sequence = inputs["input_ids"]
+>>> print(encoded_sequence)
+[101, 138, 18696, 155, 1942, 3190, 1144, 1572, 13745, 1104, 159, 9664, 2107, 102]
+```
+
+ๆณจๆ๏ผใใผใฏใใคใถใฏใ้ข้ฃใใใขใใซใใใใใๅฟ
่ฆใจใใๅ ดๅใซ่ชๅ็ใซใ็นๅฅใชใใผใฏใณใใ่ฟฝๅ ใใพใใใใใใฏใใขใใซใๆๆไฝฟ็จใใ็นๅฅใชIDใงใใ
+
+ๅใฎIDใทใผใฑใณในใใใณใผใใใๅ ดๅใ
+
+
+```python
+>>> decoded_sequence = tokenizer.decode(encoded_sequence)
+```
+
+็งใใกใฏ่ฆใพใ
+
+```python
+>>> print(decoded_sequence)
+[CLS] A Titan RTX has 24GB of VRAM [SEP]
+```
+
+ใใใฏ[`BertModel`]ใใใฎๅ
ฅๅใๆๅพ
ใใๆนๆณใงใใ
+
+
+## L
+
+### Labels
+
+ใฉใใซใฏใใขใใซใๆๅคฑใ่จ็ฎใใใใใซๆธกใใใจใใงใใใชใใทใงใณใฎๅผๆฐใงใใใใใใฎใฉใใซใฏใใขใใซใฎไบๆธฌใฎๆๅพ
ๅคใงใใในใใงใใใขใใซใฏใ้ๅธธใฎๆๅคฑใไฝฟ็จใใฆใใใฎไบๆธฌใจๆๅพ
ๅค๏ผใฉใใซ๏ผใจใฎ้ใฎๆๅคฑใ่จ็ฎใใพใใ
+
+ใใใใฎใฉใใซใฏใขใใซใฎใใใใซๅฟใใฆ็ฐใชใใพใใใใจใใฐ๏ผ
+
+- ใทใผใฑใณในๅ้กใขใใซ๏ผ[`BertForSequenceClassification`]๏ผใฎๅ ดๅใใขใใซใฏๆฌกๅ
ใ `(batch_size)` ใฎใใณใฝใซใๆๅพ
ใใใใใๅ
ใฎๅๅคใใทใผใฑใณในๅ
จไฝใฎไบๆธฌใฉใใซใซๅฏพๅฟใใพใใ
+- ใใผใฏใณๅ้กใขใใซ๏ผ[`BertForTokenClassification`]๏ผใฎๅ ดๅใใขใใซใฏๆฌกๅ
ใ `(batch_size, seq_length)` ใฎใใณใฝใซใๆๅพ
ใใๅๅคใๅๅใ
ใฎใใผใฏใณใฎไบๆธฌใฉใใซใซๅฏพๅฟใใพใใ
+- ใในใฏ่จ่ชใขใใชใณใฐใฎๅ ดๅ๏ผ[`BertForMaskedLM`]๏ผใใขใใซใฏๆฌกๅ
ใ `(batch_size, seq_length)` ใฎใใณใฝใซใๆๅพ
ใใๅๅคใๅๅใ
ใฎใใผใฏใณใฎไบๆธฌใฉใใซใซๅฏพๅฟใใพใใใใใงใฎใฉใใซใฏใในใฏใใใใใผใฏใณใฎใใผใฏใณIDใงใใใไปใฎใใผใฏใณใซใฏ้ๅธธ -100 ใชใฉใฎๅคใ่จญๅฎใใใพใใ
+- ใทใผใฑใณใน้ใฎใฟในใฏใฎๅ ดๅ๏ผ[`BartForConditionalGeneration`]ใ[`MBartForConditionalGeneration`]๏ผใใขใใซใฏๆฌกๅ
ใ `(batch_size, tgt_seq_length)` ใฎใใณใฝใซใๆๅพ
ใใๅๅคใๅๅ
ฅๅใทใผใฑใณในใซ้ข้ฃไปใใใใใฟใผใฒใใใทใผใฑใณในใซๅฏพๅฟใใพใใใใฌใผใใณใฐไธญใBARTใจT5ใฎไธกๆนใฏ้ฉๅใช `decoder_input_ids` ใจใใณใผใใผใฎใขใใณใทใงใณใในใฏใๅ
้จใง็ๆใใพใใ้ๅธธใใใใใๆไพใใๅฟ
่ฆใฏใใใพใใใใใใฏใจใณใณใผใใผใใณใผใใผใใฌใผใ ใฏใผใฏใๅฉ็จใใใขใใซใซใฏ้ฉ็จใใใพใใใ
+- ็ปๅๅ้กใขใใซใฎๅ ดๅ๏ผ[`ViTForImageClassification`]๏ผใใขใใซใฏๆฌกๅ
ใ `(batch_size)` ใฎใใณใฝใซใๆๅพ
ใใใใใๅ
ใฎๅๅคใๅๅใ
ใฎ็ปๅใฎไบๆธฌใฉใใซใซๅฏพๅฟใใพใใ
+- ใปใใณใใฃใใฏใปใฐใกใณใใผใทใงใณใขใใซใฎๅ ดๅ๏ผ[`SegformerForSemanticSegmentation`]๏ผใใขใใซใฏๆฌกๅ
ใ `(batch_size, height, width)` ใฎใใณใฝใซใๆๅพ
ใใใใใๅ
ใฎๅๅคใๅๅใ
ใฎใใฏใปใซใฎไบๆธฌใฉใใซใซๅฏพๅฟใใพใใ
+- ็ฉไฝๆคๅบใขใใซใฎๅ ดๅ๏ผ[`DetrForObjectDetection`]๏ผใใขใใซใฏๅๅใ
ใฎ็ปๅใฎไบๆธฌใฉใใซใจๅข็ใใใฏในใฎๆฐใซๅฏพๅฟใใ `class_labels` ใจ `boxes` ใญใผใๆใค่พๆธใฎใชในใใๆๅพ
ใใพใใ
+- ่ชๅ้ณๅฃฐ่ช่ญใขใใซใฎๅ ดๅ๏ผ[`Wav2Vec2ForCTC`]๏ผใใขใใซใฏๆฌกๅ
ใ `(batch_size, target_length)` ใฎใใณใฝใซใๆๅพ
ใใๅๅคใๅๅใ
ใฎใใผใฏใณใฎไบๆธฌใฉใใซใซๅฏพๅฟใใพใใ
+
+
+
+ๅใขใใซใฎใฉใใซใฏ็ฐใชใๅ ดๅใใใใใใๅธธใซๅใขใใซใฎใใญใฅใกใณใใ็ขบ่ชใใฆใใใใใฎ็นๅฎใฎใฉใใซใซ้ขใใ่ฉณ็ดฐๆ
ๅ ฑใ็ขบ่ชใใฆใใ ใใ๏ผ
+
+
+
+ใใผในใขใใซ๏ผ[`BertModel`]๏ผใฏใฉใใซใๅใๅ
ฅใใพใใใใใใใฏใใผในใฎใใฉใณในใใฉใผใใผใขใใซใงใใใๅใซ็นๅพดใๅบๅใใพใใ
+
+
+### large language models (LLM)
+
+ๅคง้ใฎใใผใฟใงใใฌใผใใณใฐใใใๅคๆๅจ่จ่ชใขใใซ๏ผGPT-3ใBLOOMใOPT๏ผใๆใไธ่ฌ็ใช็จ่ชใงใใใใใใฎใขใใซใฏ้ๅธธใๅคใใฎๅญฆ็ฟๅฏ่ฝใชใใฉใกใผใฟใๆใฃใฆใใพใ๏ผใใจใใฐใGPT-3ใฎๅ ดๅใ1750ๅๅ๏ผใ
+
+## M
+
+### masked language modeling (MLM)
+
+ใขใใซใฏใใญในใใฎ็ ดๆใใผใธใงใณใ่ฆใไบๅใใฌใผใใณใฐใฟในใฏใงใ้ๅธธใฏใฉใณใใ ใซไธ้จใฎใใผใฏใณใใในใญใณใฐใใฆๅ
ใฎใใญในใใไบๆธฌใใๅฟ
่ฆใใใใพใใ
+
+### multimodal
+
+ใใญในใใจๅฅใฎ็จฎ้กใฎๅ
ฅๅ๏ผใใจใใฐ็ปๅ๏ผใ็ตใฟๅใใใใฟในใฏใงใใ
+
+## N
+
+### Natural language generation (NLG)
+
+ใใญในใใ็ๆใใ้ข้ฃใใใในใฆใฎใฟในใฏ๏ผใใจใใฐใ[Transformersใงๆธใ](https://transformer.huggingface.co/)ใ็ฟป่จณใชใฉ๏ผใ
+
+### Natural language processing (NLP)
+
+ใใญในใใๆฑใๆนๆณใไธ่ฌ็ใซ่กจ็พใใใใฎใงใใ
+
+### Natural language understanding (NLU)
+
+ใใญในใๅ
ใซไฝใใใใใ็่งฃใใ้ข้ฃใใใในใฆใฎใฟในใฏ๏ผใใจใใฐใใใญในใๅ
จไฝใฎๅ้กใๅใ
ใฎๅ่ชใฎๅ้กใชใฉ๏ผใ
+
+## P
+
+### pipeline
+
+๐ค Transformersใฎใใคใใฉใคใณใฏใใใผใฟใฎๅๅฆ็ใจๅคๆใ็นๅฎใฎ้ ๅบใงๅฎ่กใใฆใใผใฟใๅฆ็ใใใขใใซใใไบๆธฌใ่ฟใไธ้ฃใฎในใใใใๆใๆฝ่ฑกๅใงใใใใคใใฉใคใณใซ่ฆใใใใใใคใใฎในใใผใธใฎไพใซใฏใใใผใฟใฎๅๅฆ็ใ็นๅพดๆฝๅบใๆญฃ่ฆๅใชใฉใใใใพใใ
+
+่ฉณ็ดฐใซใคใใฆใฏใ[ๆจ่ซใฎใใใฎใใคใใฉใคใณ](https://huggingface.co/docs/transformers/pipeline_tutorial)ใๅ็
งใใฆใใ ใใใ
+
+### pixel values
+
+ใขใใซใซๆธกใใใ็ปๅใฎๆฐๅค่กจ็พใฎใใณใฝใซใงใใใใฏใปใซๅคใฏใๅฝข็ถใ [`ใใใใตใคใบ`, `ใใฃใใซๆฐ`, `้ซใ`, `ๅน
`] ใฎ่กๅใงใ็ปๅใใญใปใใตใใ็ๆใใใพใใ
+
+### pooling
+
+่กๅใๅฐใใช่กๅใซ็ธฎๅฐใใๆไฝใงใใใผใซๅฏพ่ฑกใฎๆฌกๅ
ใฎๆๅคงๅคใพใใฏๅนณๅๅคใๅใใใจใไธ่ฌ็ใงใใใใผใชใณใฐใฌใคใคใผใฏไธ่ฌ็ใซ็ณใฟ่พผใฟใฌใคใคใผใฎ้ใซ่ฆใใใ็นๅพด่กจ็พใใใฆใณใตใณใใชใณใฐใใพใใ
+
+### position IDs
+
+ใใผใฏใณใใจใฎไฝ็ฝฎใๅใ่พผใพใใฆใใRNNใจใฏ็ฐใชใใใใฉใณในใใฉใผใใผใฏๅใใผใฏใณใฎไฝ็ฝฎใๆๆกใใฆใใพใใใใใใใฃใฆใใขใใซใฏใใผใฏใณใฎไฝ็ฝฎใ่ญๅฅใใใใใซไฝ็ฝฎID๏ผ`position_ids`๏ผใไฝฟ็จใใพใใ
+
+ใใใฏใชใใทใงใณใฎใใฉใกใผใฟใงใใใขใใซใซ `position_ids` ใๆธกใใใชใๅ ดๅใIDใฏ่ชๅ็ใซ็ตถๅฏพ็ใชไฝ็ฝฎๅใ่พผใฟใจใใฆไฝๆใใใพใใ
+
+็ตถๅฏพ็ใชไฝ็ฝฎๅใ่พผใฟใฏ็ฏๅฒ `[0ใconfig.max_position_embeddings - 1]` ใใ้ธๆใใใพใใไธ้จใฎใขใใซใฏใๆญฃๅผฆๆณขไฝ็ฝฎๅใ่พผใฟใ็ธๅฏพไฝ็ฝฎๅใ่พผใฟใชใฉใไปใฎใฟใคใใฎไฝ็ฝฎๅใ่พผใฟใไฝฟ็จใใใใจใใใใพใใ
+
+
+### preprocessing
+
+็ใใผใฟใๆฉๆขฐๅญฆ็ฟใขใใซใง็ฐกๅใซๅฆ็ใงใใๅฝขๅผใซๆบๅใใใฟในใฏใงใใไพใใฐใใใญในใใฏ้ๅธธใใใผใฏใณๅใซใใฃใฆๅๅฆ็ใใใพใใไปใฎๅ
ฅๅใฟใคใใซๅฏพใใๅๅฆ็ใฎๅ
ทไฝ็ใชๆนๆณใ็ฅใใใๅ ดๅใฏใ[Preprocess](https://huggingface.co/docs/transformers/preprocessing) ใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+### pretrained model
+
+ใใใใผใฟ๏ผใใจใใฐใWikipediaๅ
จไฝใชใฉ๏ผใงไบๅใซๅญฆ็ฟใใใใขใใซใงใใไบๅๅญฆ็ฟใฎๆนๆณใซใฏใ่ชๅทฑๆๅธซใใใฎ็ฎ็ใๅซใพใใใใญในใใ่ชญใฟๅใใๆฌกใฎๅ่ชใไบๆธฌใใใใจใใใใฎ๏ผ[ๅ ๆ่จ่ชใขใใชใณใฐ](#causal-language-modeling)ใๅ็
ง๏ผใใไธ้จใฎๅ่ชใใในใฏใใใใใใไบๆธฌใใใใจใใใใฎ๏ผ[ใในใฏ่จ่ชใขใใชใณใฐ](#masked-language-modeling-mlm)ใๅ็
ง๏ผใใใใพใใ
+
+้ณๅฃฐใจใใธใงใณใขใใซใซใฏ็ฌ่ชใฎไบๅๅญฆ็ฟใฎ็ฎ็ใใใใพใใใใจใใฐใWav2Vec2ใฏ้ณๅฃฐใขใใซใงใใขใใซใซๅฏพใใฆใ็ใฎใ้ณๅฃฐ่กจ็พใๅฝใฎ้ณๅฃฐ่กจ็พใฎใปใใใใ่ญๅฅใใๅฟ
่ฆใใใๅฏพๆฏ็ใชใฟในใฏใงไบๅๅญฆ็ฟใใใฆใใพใใไธๆนใBEiTใฏใใธใงใณใขใใซใงใไธ้จใฎ็ปๅใใใใใในใฏใใใขใใซใซใในใฏใใใใใใใไบๆธฌใใใใฟในใฏ๏ผใในใฏ่จ่ชใขใใชใณใฐใฎ็ฎ็ใจไผผใฆใใพใ๏ผใงไบๅๅญฆ็ฟใใใฆใใพใใ
+
+## R
+
+### recurrent neural network (RNN)
+
+ใใญในใใๅฆ็ใใใใใซๅฑคใใซใผใใใใใขใใซใฎไธ็จฎใงใใ
+
+### representation learning
+
+็ใใผใฟใฎๆๅณใฎใใ่กจ็พใๅญฆ็ฟใใๆฉๆขฐๅญฆ็ฟใฎใตใใใฃใผใซใใงใใ่กจ็พๅญฆ็ฟใฎๆ่กใฎไธ้จใซใฏๅ่ชๅใ่พผใฟใใชใผใใจใณใณใผใใผใGenerative Adversarial Networks๏ผGANs๏ผใชใฉใใใใพใใ
+
+## S
+
+### sampling rate
+
+็งใใจใซๅใใใใตใณใใซ๏ผใชใผใใฃใชไฟกๅทใชใฉ๏ผใฎๆฐใใใซใๅไฝใงๆธฌๅฎใใใใฎใงใใใตใณใใชใณใฐใฌใผใใฏ้ณๅฃฐใชใฉใฎ้ฃ็ถไฟกๅทใ้ขๆฃๅใใ็ตๆใงใใ
+
+### self-attention
+
+ๅ
ฅๅใฎๅ่ฆ็ด ใฏใใฉใฎไปใฎ่ฆ็ด ใซๆณจๆใๆใในใใใๆคๅบใใพใใ
+
+### self-supervised learning
+
+ใขใใซใใฉใใซใฎใชใใใผใฟใใ่ชๅ่ช่บซใฎๅญฆ็ฟ็ฎๆจใไฝๆใใๆฉๆขฐๅญฆ็ฟๆ่กใฎใซใใดใชใงใใใใใฏ[ๆๅธซใชใๅญฆ็ฟ](#unsupervised-learning)ใ[ๆๅธซใใๅญฆ็ฟ](#supervised-learning)ใจใฏ็ฐใชใใๅญฆ็ฟใใญใปในใฏใฆใผใถใผใใใฏๆ็คบ็ใซใฏ็ฃ็ฃใใใฆใใชใ็นใ็ฐใชใใพใใ
+
+่ชๅทฑๆๅธซใใๅญฆ็ฟใฎ1ใคใฎไพใฏ[ใในใฏ่จ่ชใขใใชใณใฐ](#masked-language-modeling-mlm)ใงใใขใใซใซใฏไธ้จใฎใใผใฏใณใๅ้คใใใๆใไธใใใใๆฌ ่ฝใใใใผใฏใณใไบๆธฌใใใใใซๅญฆ็ฟใใพใใ
+
+### semi-supervised learning
+
+ใฉใใซไปใใใผใฟใฎๅฐ้ใจใฉใใซใฎใชใใใผใฟใฎๅคง้ใ็ตใฟๅใใใฆใขใใซใฎ็ฒพๅบฆใๅไธใใใๅบ็ฏใชๆฉๆขฐๅญฆ็ฟใใฌใผใใณใฐๆ่กใฎใซใใดใชใงใใ[ๆๅธซใใๅญฆ็ฟ](#supervised-learning)ใ[ๆๅธซใชใๅญฆ็ฟ](#unsupervised-learning)ใจใฏ็ฐใชใใๅๆๅธซใใๅญฆ็ฟใฎใขใใญใผใใฎ1ใคใฏใใปใซใใใฌใผใใณใฐใใงใใใใขใใซใฏใฉใใซไปใใใผใฟใงใใฌใผใใณใฐใใใๆฌกใซใฉใใซใฎใชใใใผใฟใงไบๆธฌใ่กใใพใใใขใใซใๆใ่ชไฟกใๆใฃใฆไบๆธฌใใ้จๅใใฉใใซไปใใใผใฟใปใใใซ่ฟฝๅ ใใใใขใใซใฎๅใใฌใผใใณใฐใซไฝฟ็จใใใพใใ
+
+### sequence-to-sequence (seq2seq)
+
+ๅ
ฅๅใใๆฐใใใทใผใฑใณในใ็ๆใใใขใใซใงใใ็ฟป่จณใขใใซใ่ฆ็ดใขใใซ๏ผ[Bart](model_doc/bart)ใ[T5](model_doc/t5)ใชใฉ๏ผใชใฉใใใใซ่ฉฒๅฝใใพใใ
+
+### stride
+
+[็ณใฟ่พผใฟ](#convolution)ใพใใฏ[ใใผใชใณใฐ](#pooling)ใซใใใฆใในใใฉใคใใฏใซใผใใซใ่กๅไธใง็งปๅใใ่ท้ขใๆใใพใใในใใฉใคใใ1ใฎๅ ดๅใใซใผใใซใฏ1ใใฏใปใซใใค็งปๅใใในใใฉใคใใ2ใฎๅ ดๅใใซใผใใซใฏ2ใใฏใปใซใใค็งปๅใใพใใ
+
+### supervised learning
+
+ใขใใซใฎใใฌใผใใณใฐๆนๆณใฎไธใคใงใ็ดๆฅใฉใใซไปใใใผใฟใไฝฟ็จใใฆใขใใซใฎๆง่ฝใไฟฎๆญฃใๆๅฐใใพใใใใผใฟใใใฌใผใใณใฐใใใฆใใใขใใซใซไพ็ตฆใใใใใฎไบๆธฌใๆข็ฅใฎใฉใใซใจๆฏ่ผใใใพใใใขใใซใฏไบๆธฌใใฉใใ ใ่ชคใฃใฆใใใใซๅบใฅใใฆ้ใฟใๆดๆฐใใใใญใปในใฏใขใใซใฎๆง่ฝใๆ้ฉๅใใใใใซ็นฐใ่ฟใใใพใใ
+
+## T
+
+### token
+
+ๆใฎไธ้จใงใใใ้ๅธธใฏๅ่ชใงใใใใตใใฏใผใ๏ผไธ่ฌ็ใงใชใๅ่ชใฏใใฐใใฐใตใใฏใผใใซๅๅฒใใใใใจใใใใพใ๏ผใพใใฏๅฅ่ชญ็นใฎ่จๅทใงใใใใจใใใใพใใ
+
+### token Type IDs
+
+ไธ้จใฎใขใใซใฏใๆใฎใใขใฎๅ้กใ่ณชๅๅฟ็ญใ่กใใใจใ็ฎ็ใจใใฆใใพใใ
+
+
+
+ใใใซใฏ็ฐใชใ2ใคใฎใทใผใฑใณในใๅไธใฎใinput_idsใใจใณใใชใซ็ตๅใใๅฟ
่ฆใใใใ้ๅธธใฏๅ้กๅญ๏ผ`[CLS]`๏ผใๅบๅใ่จๅท๏ผ`[SEP]`๏ผใชใฉใฎ็นๅฅใชใใผใฏใณใฎๅฉใใๅใใฆๅฎ่กใใใพใใไพใใฐใBERTใขใใซใฏๆฌกใฎใใใซ2ใคใฎใทใผใฑใณในๅ
ฅๅใๆง็ฏใใพใ๏ผ
+
+ๆฅๆฌ่ช่จณใๆไพใใฆใใใ ใใใใงใใMarkdownๅฝขๅผใง่จ่ฟฐใใฆใใ ใใใ
+
+
+```python
+>>> # [CLS] SEQUENCE_A [SEP] SEQUENCE_B [SEP]
+```
+
+ๆใ
ใฏใๅ่ฟฐใฎใใใซใ2ใคใฎใทใผใฑใณในใ2ใคใฎๅผๆฐใจใใฆ `tokenizer` ใซๆธกใใใจใงใใใฎใใใชๆใ่ชๅ็ใซ็ๆใใใใจใใงใใพใ๏ผไปฅๅใฎใใใซใชในใใงใฏใชใ๏ผใไปฅไธใฎใใใซ๏ผ
+
+```python
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-cased")
+>>> sequence_a = "HuggingFace is based in NYC"
+>>> sequence_b = "Where is HuggingFace based?"
+
+>>> encoded_dict = tokenizer(sequence_a, sequence_b)
+>>> decoded = tokenizer.decode(encoded_dict["input_ids"])
+```
+
+ใใใซๅฏพๅฟใใใณใผใใฏไปฅไธใงใ๏ผ
+
+```python
+>>> print(decoded)
+[CLS] HuggingFace is based in NYC [SEP] Where is HuggingFace based? [SEP]
+```
+
+ไธ้จใฎใขใใซใงใฏใ1ใคใฎใทใผใฑใณในใใฉใใง็ตใใใๅฅใฎใทใผใฑใณในใใฉใใงๅงใพใใใ็่งฃใใใฎใซๅๅใชๆ
ๅ ฑใๅใใฃใฆใใพใใใใ ใใBERTใชใฉใฎไปใฎใขใใซใงใฏใใใผใฏใณใฟใคใID๏ผใปใฐใกใณใIDใจใๅผใฐใใ๏ผใไฝฟ็จใใใฆใใพใใใใใฏใใขใใซๅ
ใฎ2ใคใฎใทใผใฑใณในใ่ญๅฅใใใใคใใชใในใฏใจใใฆ่กจใใใพใใ
+
+ใใผใฏใใคใถใฏใใใฎใในใฏใใtoken_type_idsใใจใใฆ่ฟใใพใใ
+
+```python
+>>> encoded_dict["token_type_ids"]
+[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1]
+```
+
+ๆๅใฎใทใผใฑใณในใใคใพใ่ณชๅใฎใใใซไฝฟ็จใใใใใณใณใใญในใใใฏใใในใฆใฎใใผใฏใณใใ0ใใง่กจใใใฆใใพใใไธๆนใ2็ช็ฎใฎใทใผใฑใณในใ่ณชๅใซๅฏพๅฟใใใใฎใฏใใในใฆใฎใใผใฏใณใใ1ใใง่กจใใใฆใใพใใ
+
+ไธ้จใฎใขใใซใไพใใฐ [`XLNetModel`] ใฎใใใซใ่ฟฝๅ ใฎใใผใฏใณใใ2ใใง่กจใใใพใใ
+
+
+### transfer learning
+
+ไบๅใซๅญฆ็ฟใใใใขใใซใๅใใใใใใฟในใฏๅบๆใฎใใผใฟใปใใใซ้ฉๅฟใใใๆ่กใใผใญใใใขใใซใ่จ็ทดใใไปฃใใใซใๆขๅญใฎใขใใซใใๅพใ็ฅ่ญใๅบ็บ็นใจใใฆๆดป็จใงใใพใใใใใซใใๅญฆ็ฟใใญใปในใๅ ้ใใๅฟ
่ฆใช่จ็ทดใใผใฟใฎ้ใๆธๅฐใใพใใ
+
+### transformer
+
+่ชๅทฑๆณจๆใใผในใฎๆทฑๅฑคๅญฆ็ฟใขใใซใขใผใญใใฏใใฃใ
+
+## U
+
+### unsupervised learning
+
+ใขใใซใซๆไพใใใใใผใฟใใฉใใซไปใใใใฆใใชใใขใใซใใฌใผใใณใฐใฎๅฝขๆ
ใๆๅธซใชใๅญฆ็ฟใฎๆ่กใฏใใฟในใฏใซๅฝน็ซใคใใฟใผใณใ่ฆใคใใใใใซใใผใฟๅๅธใฎ็ตฑ่จๆ
ๅ ฑใๆดป็จใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/hpo_train.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/hpo_train.md
new file mode 100644
index 0000000000000000000000000000000000000000..90591daf8b204ff72cd62fb997eba74e7c744e4c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/hpo_train.md
@@ -0,0 +1,144 @@
+
+
+# Hyperparameter Search using Trainer API
+
+๐ค Transformersใฏใ๐ค Transformersใขใใซใฎใใฌใผใใณใฐใๆ้ฉๅใใ[`Trainer`]ใฏใฉในใๆไพใใ็ฌ่ชใฎใใฌใผใใณใฐใซใผใใๆๅใง่จ่ฟฐใใใซใใฌใผใใณใฐใ้ๅงใใใฎใ็ฐกๅใซใชใใพใใ[`Trainer`]ใฏใใคใใผใใฉใกใผใฟใผๆค็ดขใฎAPIใๆไพใใฆใใพใใใใฎใใญใฅใกใณใใงใฏใใใใไพ็คบใใพใใ
+
+## Hyperparameter Search backend
+
+[`Trainer`]ใฏ็พๅจใ4ใคใฎใใคใใผใใฉใกใผใฟใผๆค็ดขใใใฏใจใณใใใตใใผใใใฆใใพใ๏ผ
+[optuna](https://optuna.org/)ใ[sigopt](https://sigopt.com/)ใ[raytune](https://docs.ray.io/en/latest/tune/index.html)ใใใใณ[wandb](https://wandb.ai/site/sweeps)ใ
+
+ใใใใไฝฟ็จใใๅใซใใใคใใผใใฉใกใผใฟใผๆค็ดขใใใฏใจใณใใใคใณในใใผใซใใๅฟ
่ฆใใใใพใใ
+```bash
+pip install optuna/sigopt/wandb/ray[tune]
+```
+
+## How to enable Hyperparameter search in example
+
+ใใคใใผใใฉใกใผใฟใฎๆค็ดขในใใผในใๅฎ็พฉใใ็ฐใชใใใใฏใจใณใใซใฏ็ฐใชใใใฉใผใใใใๅฟ
่ฆใงใใ
+
+Sigoptใฎๅ ดๅใsigopt [object_parameter](https://docs.sigopt.com/ai-module-api-references/api_reference/objects/object_parameter) ใๅ็
งใใฆใใ ใใใใใใฏไปฅไธใฎใใใชใใฎใงใ๏ผ
+```py
+>>> def sigopt_hp_space(trial):
+... return [
+... {"bounds": {"min": 1e-6, "max": 1e-4}, "name": "learning_rate", "type": "double"},
+... {
+... "categorical_values": ["16", "32", "64", "128"],
+... "name": "per_device_train_batch_size",
+... "type": "categorical",
+... },
+... ]
+```
+
+
+Optunaใซ้ขใใฆใฏใ[object_parameter](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/002_configurations.html#sphx-glr-tutorial-10-key-features-002-configurations-py)ใใ่ฆงใใ ใใใไปฅไธใฎใใใซใชใใพใ๏ผ
+
+
+```py
+>>> def optuna_hp_space(trial):
+... return {
+... "learning_rate": trial.suggest_float("learning_rate", 1e-6, 1e-4, log=True),
+... "per_device_train_batch_size": trial.suggest_categorical("per_device_train_batch_size", [16, 32, 64, 128]),
+... }
+```
+
+Optunaใฏใๅค็ฎ็ใฎใใคใใผใใฉใกใผใฟๆ้ฉๅ๏ผHPO๏ผใๆไพใใฆใใพใใ `hyperparameter_search` ใง `direction` ใๆธกใใ่คๆฐใฎ็ฎ็้ขๆฐๅคใ่ฟใใใใฎ็ฌ่ชใฎ `compute_objective` ใๅฎ็พฉใใใใจใใงใใพใใ Pareto Front๏ผ`List[BestRun]`๏ผใฏ `hyperparameter_search` ใง่ฟใใใ[test_trainer](https://github.com/huggingface/transformers/blob/main/tests/trainer/test_trainer.py) ใฎใในใใฑใผใน `TrainerHyperParameterMultiObjectOptunaIntegrationTest` ใๅ็
งใใๅฟ
่ฆใใใใพใใใใใฏไปฅไธใฎใใใซใชใใพใใ
+
+
+```py
+>>> best_trials = trainer.hyperparameter_search(
+... direction=["minimize", "maximize"],
+... backend="optuna",
+... hp_space=optuna_hp_space,
+... n_trials=20,
+... compute_objective=compute_objective,
+... )
+```
+
+Ray Tuneใซ้ขใใฆใ[object_parameter](https://docs.ray.io/en/latest/tune/api/search_space.html)ใๅ็
งใใฆใใ ใใใไปฅไธใฎใใใซใชใใพใ๏ผ
+
+
+```py
+>>> def ray_hp_space(trial):
+... return {
+... "learning_rate": tune.loguniform(1e-6, 1e-4),
+... "per_device_train_batch_size": tune.choice([16, 32, 64, 128]),
+... }
+```
+
+Wandbใซใคใใฆใฏใ[object_parameter](https://docs.wandb.ai/guides/sweeps/configuration)ใใ่ฆงใใ ใใใใใใฏไปฅไธใฎใใใซใชใใพใ๏ผ
+
+```py
+>>> def wandb_hp_space(trial):
+... return {
+... "method": "random",
+... "metric": {"name": "objective", "goal": "minimize"},
+... "parameters": {
+... "learning_rate": {"distribution": "uniform", "min": 1e-6, "max": 1e-4},
+... "per_device_train_batch_size": {"values": [16, 32, 64, 128]},
+... },
+... }
+```
+
+`model_init` ้ขๆฐใๅฎ็พฉใใใใใ [`Trainer`] ใซๆธกใไพใ็คบใใพใ๏ผ
+
+
+```py
+>>> def model_init(trial):
+... return AutoModelForSequenceClassification.from_pretrained(
+... model_args.model_name_or_path,
+... from_tf=bool(".ckpt" in model_args.model_name_or_path),
+... config=config,
+... cache_dir=model_args.cache_dir,
+... revision=model_args.model_revision,
+... token=True if model_args.use_auth_token else None,
+... )
+```
+
+[`Trainer`] ใ `model_init` ้ขๆฐใใใฌใผใใณใฐๅผๆฐใใใฌใผใใณใฐใใผใฟใปใใใใในใใใผใฟใปใใใใใใณ่ฉไพก้ขๆฐใจๅ
ฑใซไฝๆใใฆใใ ใใ:
+
+
+```py
+>>> trainer = Trainer(
+... model=None,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... processing_class=tokenizer,
+... model_init=model_init,
+... data_collator=data_collator,
+... )
+```
+
+ใใคใใผใใฉใกใผใฟใผใฎๆข็ดขใๅผใณๅบใใๆ่ฏใฎใใฉใคใขใซ ใใฉใกใผใฟใผใๅๅพใใพใใใใใฏใจใณใใฏ `"optuna"` / `"sigopt"` / `"wandb"` / `"ray"` ใงใใๅฏ่ฝๆงใใใใพใใๆนๅใฏ `"minimize"` ใพใใฏ `"maximize"` ใงใใใ็ฎๆจใใใๅคงใใใใใๅฐใใใใใใ็คบใใพใใ
+
+`compute_objective` ้ขๆฐใ็ฌ่ชใซๅฎ็พฉใใใใจใใงใใพใใๅฎ็พฉใใใฆใใชใๅ ดๅใใใใฉใซใใฎ `compute_objective` ใๅผใณๅบใใใF1ใชใฉใฎ่ฉไพกใกใใชใใฏใฎๅ่จใ็ฎๆจๅคใจใใฆ่ฟใใใพใใ
+
+
+```py
+>>> best_trial = trainer.hyperparameter_search(
+... direction="maximize",
+... backend="optuna",
+... hp_space=optuna_hp_space,
+... n_trials=20,
+... compute_objective=compute_objective,
+... )
+```
+
+## Hyperparameter search For DDP finetune
+็พๅจใDDP๏ผDistributed Data Parallel๏ผใฎใใใฎใใคใใผใใฉใกใผใฟใผๆค็ดขใฏใOptuna ใจ SigOpt ใซๅฏพใใฆๆๅนใซใชใฃใฆใใพใใใฉใณใฏใผใญใใญใปในใฎใฟใๆค็ดขใใฉใคใขใซใ็ๆใใไปใฎใฉใณใฏใซๅผๆฐใๆธกใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/index.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/index.md
new file mode 100644
index 0000000000000000000000000000000000000000..c3baa0888fc887376ba8a1a38d74c2f41701163f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/index.md
@@ -0,0 +1,399 @@
+
+
+# ๐ค Transformers
+
+[PyTorch](https://pytorch.org/), [TensorFlow](https://www.tensorflow.org/), [JAX](https://jax.readthedocs.io/en/latest/)ใฎใใใฎๆๅ
็ซฏๆฉๆขฐๅญฆ็ฟใ
+
+๐ค Transformers ใฏๆๅ
็ซฏใฎๅญฆ็ฟๆธใฟใขใใซใ็ฐกๅใซใใฆใณใญใผใใใฆๅญฆ็ฟใใAPIใจใใผใซใๆไพใใพใใๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใใใจใง่จ็ฎใณในใใจไบ้
ธๅ็ญ็ด ใฎๆๅบ้ใๅๆธใงใใใพใใผใญใใใขใใซใๅญฆ็ฟใใใใใซ่ฆๆฑใใใๆ้ใจใชใฝใผในใ็ฏ็ดใใใใจใใงใใพใใ ใใใใฎใขใใซใฏไปฅไธใฎใใใช็ฐใชใใขใใชใใฃใซใใใไธ่ฌ็ใชใฟในใฏใใตใใผใใใพใ:
+
+๐ **่ช็ถ่จ่ชๅฆ็**: ใใญในใๅ้กใ ๅบๆ่กจ็พๆฝๅบใ ่ณชๅๅฟ็ญใ ่จ่ชใขใใชใณใฐใ ๆ็ซ ่ฆ็ดใ ๆฉๆขฐ็ฟป่จณใ ่คๆฐ้ธๆใใใญในใ็ๆใ
+๐ผ๏ธ **ใณใณใใฅใผใฟใใธใงใณ**: ็ปๅๅ้กใ ็ฉไฝๆคๅบใ ใปใฐใกใณใใผใทใงใณใ
+๐ฃ๏ธ **้ณๅฃฐ**: ่ชๅ้ณๅฃฐ่ช่ญใ้ณๅฃฐๅ้กใ
+๐ **ใใซใใขใผใใซ**: ใใผใใซ่ณชๅๅฟ็ญใ ๅ
ๅญฆๆๅญ่ช่ญ(OCR)ใ ในใญใฃใณใใใใใญใฅใกใณใใใใฎๆ
ๅ ฑๆฝๅบใ ๅ็ปๅ้กใ visual question answering(่ฆ่ฆ็่ณชๅๅฟ็ญ)ใ
+
+๐ค Transformers ใฏPyTorch, TensorFlow, JAX้ใฎใใฌใผใ ใฏใผใฏ็ธไบ้็จๆงใใตใใผใใใฆใใพใใ ใใใฏใขใใซใฎๅๆฎต้ใง็ฐใชใใใฌใผใ ใฏใผใฏใไฝฟใใใใฎๆ่ปๆงใๆไพใใพใใใใใใฌใผใ ใฏใผใฏใง3่กใฎใณใผใใงใขใใซใๅญฆ็ฟใใๅฅใฎใใฌใผใ ใฏใผใฏใงๆจ่ซใฎใใใซใขใใซใใญใผใใใใใจใๅฏ่ฝใงใใใพใใๆฌ็ช็ฐๅขใฎใใใญใคใฎใใใซใขใใซใONNXใTorchScriptใฎใใใชๅฝขๅผใงใจใฏในใใผใใใใใจใๅฏ่ฝใงใใ
+
+[Hub](https://huggingface.co/models), [forum](https://discuss.huggingface.co/), [Discord](https://discord.com/invite/JfAtkvEtRb)ใงๆ้ทไธญใฎใณใใฅใใใฃใซไปๆฅๅๅ ใใพใใใ๏ผ
+
+## Hugging Faceใใผใ ใซใใใซในใฟใ ใตใใผใใใๅธๆใฎๅ ดๅ
+
+
+
+
+
+## ็ฎๆฌก
+
+ใใญใฅใกใณใใฏไปฅไธใฎ5ใคใฎใปใฏใทใงใณใงๆงๆใใใฆใใพใ:
+
+- **ใฏใใใซ** ใฏใใฉใคใใฉใชใฎใฏใคใใฏใใขใผใจใฉใคใใฉใชใไฝฟใๅงใใใใใฎใคใณในใใผใซๆ้ ใๆไพใใฆใใพใใ
+- **ใใฅใผใใชใขใซ** ใฏใๅๅฟ่
ใๅงใใใฎใซๆ้ฉใชๅ ดๆใงใใใใฎใปใฏใทใงใณใงใฏใใฉใคใใฉใชใไฝฟใๅงใใใใใซๅฟ
่ฆใชๅบๆฌ็ใชในใญใซใ็ฟๅพใงใใพใใ
+- **HOW-TOใฌใคใ** ใฏใ่จ่ชใขใใชใณใฐใฎใใใซๅญฆ็ฟๆธใฟใขใใซใfinetuningใใใใจใใซในใฟใ ใขใใซใฎไฝๆใจๅ
ฑๆใฎๆนๆณใชใฉใจใใฃใ็นๅฎใฎ็ฎๆจใ้ๆใใใใใฎๆนๆณใ็คบใใฆใใพใใ
+- **ใณใณใปใใใฌใคใ** ใฏใใขใใซใใฟในใฏใใใใฆ ๐ค Transformersใฎ่จญ่จๆๆณใฎ่ๆฏใซใใๅบๆฌ็ใซใณใณใปใใใ่ใๆนใซใคใใฆใใๆทฑใ่ๅฏใ่งฃ่ชฌใใฆใใพใใ
+- **API** ๅ
จใฆใฎใฏใฉในใจ้ขๆฐใ่ชฌๆใใพใ:
+
+ - **MAIN CLASSES** ใฏใconfiguration, model, tokenizer, pipelineใจใใฃใๆใ้่ฆใชใฏใฉในใซใคใใฆ่ฉณ็ดฐใซ่ชฌๆใใฆใใพใใ
+ - **MODELS** ใฏใใฉใคใใฉใชใงๅฎ่ฃ
ใใใฆใใใใใใใฎใขใใซใซ้ข้ฃใใใฏใฉในใจ้ขๆฐใ่ฉณ็ดฐใซ่ชฌๆใใฆใใพใใ
+ - **INTERNAL HELPERS** ใฏใๅ
้จใงไฝฟ็จใใใฆใใใฆใผใใฃใชใใฃใฏใฉในใ้ขๆฐใ่ฉณ็ดฐใซ่ชฌๆใใฆใใพใใ
+
+### ใตใใผใใใใฆใใใขใใซ
+
+
+
+1. **[ALBERT](https://huggingface.co/docs/transformers/model_doc/albert)** (Google Research and the Toyota Technological Institute at Chicago ใใ) Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942)
+1. **[AltCLIP](https://huggingface.co/docs/transformers/main/model_doc/altclip)** (BAAI ใใ) Chen, Zhongzhi and Liu, Guang and Zhang, Bo-Wen and Ye, Fulong and Yang, Qinghong and Wu, Ledell ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities](https://arxiv.org/abs/2211.06679)
+1. **[Audio Spectrogram Transformer](https://huggingface.co/docs/transformers/model_doc/audio-spectrogram-transformer)** (MIT ใใ) Yuan Gong, Yu-An Chung, James Glass ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [AST: Audio Spectrogram Transformer](https://arxiv.org/abs/2104.01778)
+1. **[BART](https://huggingface.co/docs/transformers/model_doc/bart)** (Facebook ใใ) Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov and Luke Zettlemoyer ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/abs/1910.13461)
+1. **[BARThez](https://huggingface.co/docs/transformers/model_doc/barthez)** (รcole polytechnique ใใ) Moussa Kamal Eddine, Antoine J.-P. Tixier, Michalis Vazirgiannis ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321)
+1. **[BARTpho](https://huggingface.co/docs/transformers/model_doc/bartpho)** (VinAI Research ใใ) Nguyen Luong Tran, Duong Minh Le and Dat Quoc Nguyen ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese](https://arxiv.org/abs/2109.09701)
+1. **[BEiT](https://huggingface.co/docs/transformers/model_doc/beit)** (Microsoft ใใ) Hangbo Bao, Li Dong, Furu Wei ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254)
+1. **[BERT](https://huggingface.co/docs/transformers/model_doc/bert)** (Google ใใ) Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805)
+1. **[BERT For Sequence Generation](https://huggingface.co/docs/transformers/model_doc/bert-generation)** (Google ใใ) Sascha Rothe, Shashi Narayan, Aliaksei Severyn ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461)
+1. **[BERTweet](https://huggingface.co/docs/transformers/model_doc/bertweet)** (VinAI Research ใใ) Dat Quoc Nguyen, Thanh Vu and Anh Tuan Nguyen ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BERTweet: A pre-trained language model for English Tweets](https://aclanthology.org/2020.emnlp-demos.2/)
+1. **[BigBird-Pegasus](https://huggingface.co/docs/transformers/model_doc/bigbird_pegasus)** (Google Research ใใ) Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062)
+1. **[BigBird-RoBERTa](https://huggingface.co/docs/transformers/model_doc/big_bird)** (Google Research ใใ) Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062)
+1. **[BioGpt](https://huggingface.co/docs/transformers/main/model_doc/biogpt)** (Microsoft Research AI4Science ใใ) Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon and Tie-Yan Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BioGPT: generative pre-trained transformer for biomedical text generation and mining](https://academic.oup.com/bib/advance-article/doi/10.1093/bib/bbac409/6713511?guestAccessKey=a66d9b5d-4f83-4017-bb52-405815c907b9)
+1. **[BiT](https://huggingface.co/docs/transformers/main/model_doc/bit)** (Google AI ใใ) Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, Neil ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Big Transfer (BiT)](https://arxiv.org/abs/1912.11370)Houlsby.
+1. **[Blenderbot](https://huggingface.co/docs/transformers/model_doc/blenderbot)** (Facebook ใใ) Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637)
+1. **[BlenderbotSmall](https://huggingface.co/docs/transformers/model_doc/blenderbot-small)** (Facebook ใใ) Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637)
+1. **[BLIP](https://huggingface.co/docs/transformers/main/model_doc/blip)** (Salesforce ใใ) Junnan Li, Dongxu Li, Caiming Xiong, Steven Hoi ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation](https://arxiv.org/abs/2201.12086)
+1. **[BLOOM](https://huggingface.co/docs/transformers/model_doc/bloom)** (BigScience workshop ใใ) [BigScience Workshop](https://bigscience.huggingface.co/) ใใๅ
ฌ้ใใใพใใ.
+1. **[BORT](https://huggingface.co/docs/transformers/model_doc/bort)** (Alexa ใใ) Adrian de Wynter and Daniel J. Perry ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Optimal Subarchitecture Extraction For BERT](https://arxiv.org/abs/2010.10499)
+1. **[ByT5](https://huggingface.co/docs/transformers/model_doc/byt5)** (Google Research ใใ) Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, Colin Raffel ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ByT5: Towards a token-free future with pre-trained byte-to-byte models](https://arxiv.org/abs/2105.13626)
+1. **[CamemBERT](https://huggingface.co/docs/transformers/model_doc/camembert)** (Inria/Facebook/Sorbonne ใใ) Louis Martin*, Benjamin Muller*, Pedro Javier Ortiz Suรกrez*, Yoann Dupont, Laurent Romary, รric Villemonte de la Clergerie, Djamรฉ Seddah and Benoรฎt Sagot ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [CamemBERT: a Tasty French Language Model](https://arxiv.org/abs/1911.03894)
+1. **[CANINE](https://huggingface.co/docs/transformers/model_doc/canine)** (Google Research ใใ) Jonathan H. Clark, Dan Garrette, Iulia Turc, John Wieting ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representation](https://arxiv.org/abs/2103.06874)
+1. **[Chinese-CLIP](https://huggingface.co/docs/transformers/model_doc/chinese_clip)** (OFA-Sys ใใ) An Yang, Junshu Pan, Junyang Lin, Rui Men, Yichang Zhang, Jingren Zhou, Chang Zhou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese](https://arxiv.org/abs/2211.01335)
+1. **[CLIP](https://huggingface.co/docs/transformers/model_doc/clip)** (OpenAI ใใ) Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020)
+1. **[CLIPSeg](https://huggingface.co/docs/transformers/model_doc/clipseg)** (University of Gรถttingen ใใ) Timo Lรผddecke and Alexander Ecker ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Image Segmentation Using Text and Image Prompts](https://arxiv.org/abs/2112.10003)
+1. **[CodeGen](https://huggingface.co/docs/transformers/model_doc/codegen)** (Salesforce ใใ) Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, Caiming Xiong ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [A Conversational Paradigm for Program Synthesis](https://arxiv.org/abs/2203.13474)
+1. **[Conditional DETR](https://huggingface.co/docs/transformers/model_doc/conditional_detr)** (Microsoft Research Asia ใใ) Depu Meng, Xiaokang Chen, Zejia Fan, Gang Zeng, Houqiang Li, Yuhui Yuan, Lei Sun, Jingdong Wang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Conditional DETR for Fast Training Convergence](https://arxiv.org/abs/2108.06152)
+1. **[ConvBERT](https://huggingface.co/docs/transformers/model_doc/convbert)** (YituTech ใใ) Zihang Jiang, Weihao Yu, Daquan Zhou, Yunpeng Chen, Jiashi Feng, Shuicheng Yan ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ConvBERT: Improving BERT with Span-based Dynamic Convolution](https://arxiv.org/abs/2008.02496)
+1. **[ConvNeXT](https://huggingface.co/docs/transformers/model_doc/convnext)** (Facebook AI ใใ) Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, Saining Xie ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545)
+1. **[ConvNeXTV2](model_doc/convnextv2)** (from Facebook AI) released with the paper [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://arxiv.org/abs/2301.00808) by Sanghyun Woo, Shoubhik Debnath, Ronghang Hu, Xinlei Chen, Zhuang Liu, In So Kweon, Saining Xie.
+1. **[CPM](https://huggingface.co/docs/transformers/model_doc/cpm)** (Tsinghua University ใใ) Zhengyan Zhang, Xu Han, Hao Zhou, Pei Ke, Yuxian Gu, Deming Ye, Yujia Qin, Yusheng Su, Haozhe Ji, Jian Guan, Fanchao Qi, Xiaozhi Wang, Yanan Zheng, Guoyang Zeng, Huanqi Cao, Shengqi Chen, Daixuan Li, Zhenbo Sun, Zhiyuan Liu, Minlie Huang, Wentao Han, Jie Tang, Juanzi Li, Xiaoyan Zhu, Maosong Sun ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [CPM: A Large-scale Generative Chinese Pre-trained Language Model](https://arxiv.org/abs/2012.00413)
+1. **[CTRL](https://huggingface.co/docs/transformers/model_doc/ctrl)** (Salesforce ใใ) Nitish Shirish Keskar*, Bryan McCann*, Lav R. Varshney, Caiming Xiong and Richard Socher ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [CTRL: A Conditional Transformer Language Model for Controllable Generation](https://arxiv.org/abs/1909.05858)
+1. **[CvT](https://huggingface.co/docs/transformers/model_doc/cvt)** (Microsoft ใใ) Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, Lei Zhang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [CvT: Introducing Convolutions to Vision Transformers](https://arxiv.org/abs/2103.15808)
+1. **[Data2Vec](https://huggingface.co/docs/transformers/model_doc/data2vec)** (Facebook ใใ) Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, Michael Auli ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Data2Vec: A General Framework for Self-supervised Learning in Speech, Vision and Language](https://arxiv.org/abs/2202.03555)
+1. **[DeBERTa](https://huggingface.co/docs/transformers/model_doc/deberta)** (Microsoft ใใ) Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654)
+1. **[DeBERTa-v2](https://huggingface.co/docs/transformers/model_doc/deberta-v2)** (Microsoft ใใ) Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654)
+1. **[Decision Transformer](https://huggingface.co/docs/transformers/model_doc/decision_transformer)** (Berkeley/Facebook/Google ใใ) Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, Igor Mordatch ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Decision Transformer: Reinforcement Learning via Sequence Modeling](https://arxiv.org/abs/2106.01345)
+1. **[Deformable DETR](https://huggingface.co/docs/transformers/model_doc/deformable_detr)** (SenseTime Research ใใ) Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, Jifeng Dai ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Deformable DETR: Deformable Transformers for End-to-End Object Detection](https://arxiv.org/abs/2010.04159)
+1. **[DeiT](https://huggingface.co/docs/transformers/model_doc/deit)** (Facebook ใใ) Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, Hervรฉ Jรฉgou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Training data-efficient image transformers & distillation through attention](https://arxiv.org/abs/2012.12877)
+1. **[DETR](https://huggingface.co/docs/transformers/model_doc/detr)** (Facebook ใใ) Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872)
+1. **[DialoGPT](https://huggingface.co/docs/transformers/model_doc/dialogpt)** (Microsoft Research ใใ) Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, Bill Dolan ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation](https://arxiv.org/abs/1911.00536)
+1. **[DiNAT](https://huggingface.co/docs/transformers/model_doc/dinat)** (SHI Labs ใใ) Ali Hassani and Humphrey Shi ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Dilated Neighborhood Attention Transformer](https://arxiv.org/abs/2209.15001)
+1. **[DistilBERT](https://huggingface.co/docs/transformers/model_doc/distilbert)** (HuggingFace ใใ), Victor Sanh, Lysandre Debut and Thomas Wolf. ๅใๆๆณใง GPT2, RoBERTa ใจ Multilingual BERT ใฎๅง็ธฎใ่กใใพใใ.ๅง็ธฎใใใใขใใซใฏใใใใ [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation)ใ[DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation)ใ[DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation) ใจๅไปใใใใพใใ. ๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter](https://arxiv.org/abs/1910.01108)
+1. **[DiT](https://huggingface.co/docs/transformers/model_doc/dit)** (Microsoft Research ใใ) Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [DiT: Self-supervised Pre-training for Document Image Transformer](https://arxiv.org/abs/2203.02378)
+1. **[Donut](https://huggingface.co/docs/transformers/model_doc/donut)** (NAVER ใใ), Geewook Kim, Teakgyu Hong, Moonbin Yim, Jeongyeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, Seunghyun Park ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [OCR-free Document Understanding Transformer](https://arxiv.org/abs/2111.15664)
+1. **[DPR](https://huggingface.co/docs/transformers/model_doc/dpr)** (Facebook ใใ) Vladimir Karpukhin, Barlas Oฤuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906)
+1. **[DPT](https://huggingface.co/docs/transformers/master/model_doc/dpt)** (Intel Labs ใใ) Renรฉ Ranftl, Alexey Bochkovskiy, Vladlen Koltun ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413)
+1. **[EfficientNet](https://huggingface.co/docs/transformers/model_doc/efficientnet)** (from Google Research) released with the paper [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks](https://arxiv.org/abs/1905.11946) by Mingxing Tan and Quoc V. Le.
+1. **[ELECTRA](https://huggingface.co/docs/transformers/model_doc/electra)** (Google Research/Stanford University ใใ) Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ELECTRA: Pre-training text encoders as discriminators rather than generators](https://arxiv.org/abs/2003.10555)
+1. **[EncoderDecoder](https://huggingface.co/docs/transformers/model_doc/encoder-decoder)** (Google Research ใใ) Sascha Rothe, Shashi Narayan, Aliaksei Severyn ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461)
+1. **[ERNIE](https://huggingface.co/docs/transformers/model_doc/ernie)** (Baidu ใใ) Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Xuyi Chen, Han Zhang, Xin Tian, Danxiang Zhu, Hao Tian, Hua Wu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ERNIE: Enhanced Representation through Knowledge Integration](https://arxiv.org/abs/1904.09223)
+1. **[ESM](https://huggingface.co/docs/transformers/model_doc/esm)** (Meta AI ใใ) ใฏใใฉใณในใใฉใผใใผใใญใใคใณ่จ่ชใขใใซใงใ. **ESM-1b** ใฏ Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott, C. Lawrence Zitnick, Jerry Ma, and Rob Fergus ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences](https://www.pnas.org/content/118/15/e2016239118). **ESM-1v** ใฏ Joshua Meier, Roshan Rao, Robert Verkuil, Jason Liu, Tom Sercu and Alexander Rivesใใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Language models enable zero-shot prediction of the effects of mutations on protein function](https://doi.org/10.1101/2021.07.09.450648). **ESM-2** ใจใ**ESMFold** ใฏ Zeming Lin, Halil Akin, Roshan Rao, Brian Hie, Zhongkai Zhu, Wenting Lu, Allan dos Santos Costa, Maryam Fazel-Zarandi, Tom Sercu, Sal Candido, Alexander Rives ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Language models of protein sequences at the scale of evolution enable accurate structure prediction](https://doi.org/10.1101/2022.07.20.500902)
+1. **[FLAN-T5](https://huggingface.co/docs/transformers/model_doc/flan-t5)** (Google AI ใใ) Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V ใใๅ
ฌ้ใใใใฌใใธใใชใผ [google-research/t5x](https://github.com/google-research/t5x/blob/main/docs/models.md#flan-t5-checkpoints) Le, and Jason Wei
+1. **[FlauBERT](https://huggingface.co/docs/transformers/model_doc/flaubert)** (CNRS ใใ) Hang Le, Loรฏc Vial, Jibril Frej, Vincent Segonne, Maximin Coavoux, Benjamin Lecouteux, Alexandre Allauzen, Benoรฎt Crabbรฉ, Laurent Besacier, Didier Schwab ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [FlauBERT: Unsupervised Language Model Pre-training for French](https://arxiv.org/abs/1912.05372)
+1. **[FLAVA](https://huggingface.co/docs/transformers/model_doc/flava)** (Facebook AI ใใ) Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [FLAVA: A Foundational Language And Vision Alignment Model](https://arxiv.org/abs/2112.04482)
+1. **[FNet](https://huggingface.co/docs/transformers/model_doc/fnet)** (Google Research ใใ) James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, Santiago Ontanon ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [FNet: Mixing Tokens with Fourier Transforms](https://arxiv.org/abs/2105.03824)
+1. **[Funnel Transformer](https://huggingface.co/docs/transformers/model_doc/funnel)** (CMU/Google Brain ใใ) Zihang Dai, Guokun Lai, Yiming Yang, Quoc V. Le ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing](https://arxiv.org/abs/2006.03236)
+1. **[GIT](https://huggingface.co/docs/transformers/main/model_doc/git)** (Microsoft Research ใใ) Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, Lijuan Wang. ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ [GIT: A Generative Image-to-text Transformer for Vision and Language](https://arxiv.org/abs/2205.14100)
+1. **[GLPN](https://huggingface.co/docs/transformers/model_doc/glpn)** (KAIST ใใ) Doyeon Kim, Woonghyun Ga, Pyungwhan Ahn, Donggyu Joo, Sehwan Chun, Junmo Kim ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth](https://arxiv.org/abs/2201.07436)
+1. **[GPT](https://huggingface.co/docs/transformers/model_doc/openai-gpt)** (OpenAI ใใ) Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Improving Language Understanding by Generative Pre-Training](https://openai.com/research/language-unsupervised/)
+1. **[GPT Neo](https://huggingface.co/docs/transformers/model_doc/gpt_neo)** (EleutherAI ใใ) Sid Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy ใใๅ
ฌ้ใใใใฌใใธใใชใผ : [EleutherAI/gpt-neo](https://github.com/EleutherAI/gpt-neo)
+1. **[GPT NeoX](https://huggingface.co/docs/transformers/model_doc/gpt_neox)** (EleutherAI ใใ) Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Pieler, USVSN Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, Samuel Weinbach ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [GPT-NeoX-20B: An Open-Source Autoregressive Language Model](https://arxiv.org/abs/2204.06745)
+1. **[GPT NeoX Japanese](https://huggingface.co/docs/transformers/model_doc/gpt_neox_japanese)** (ABEJA ใใ) Shinya Otani, Takayoshi Makabe, Anuj Arora, and Kyo Hattori ใใใชใชใผใน.
+1. **[GPT-2](https://huggingface.co/docs/transformers/model_doc/gpt2)** (OpenAI ใใ) Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei and Ilya Sutskever ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Language Models are Unsupervised Multitask Learners](https://openai.com/research/better-language-models/)
+1. **[GPT-J](https://huggingface.co/docs/transformers/model_doc/gptj)** (EleutherAI ใใ) Ben Wang and Aran Komatsuzaki ใใๅ
ฌ้ใใใใฌใใธใใชใผ [kingoflolz/mesh-transformer-jax](https://github.com/kingoflolz/mesh-transformer-jax/)
+1. **[GPT-Sw3](https://huggingface.co/docs/transformers/main/model_doc/gpt-sw3)** (AI-Sweden ใใ) Ariel Ekgren, Amaru Cuba Gyllensten, Evangelia Gogoulou, Alice Heiman, Severine Verlinden, Joey รhman, Fredrik Carlsson, Magnus Sahlgren ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Lessons Learned from GPT-SW3: Building the First Large-Scale Generative Language Model for Swedish](http://www.lrec-conf.org/proceedings/lrec2022/pdf/2022.lrec-1.376.pdf)
+1. **[GroupViT](https://huggingface.co/docs/transformers/model_doc/groupvit)** (UCSD, NVIDIA ใใ) Jiarui Xu, Shalini De Mello, Sifei Liu, Wonmin Byeon, Thomas Breuel, Jan Kautz, Xiaolong Wang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [GroupViT: Semantic Segmentation Emerges from Text Supervision](https://arxiv.org/abs/2202.11094)
+1. **[Hubert](https://huggingface.co/docs/transformers/model_doc/hubert)** (Facebook ใใ) Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, Abdelrahman Mohamed ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447)
+1. **[I-BERT](https://huggingface.co/docs/transformers/model_doc/ibert)** (Berkeley ใใ) Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [I-BERT: Integer-only BERT Quantization](https://arxiv.org/abs/2101.01321)
+1. **[ImageGPT](https://huggingface.co/docs/transformers/model_doc/imagegpt)** (OpenAI ใใ) Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, Ilya Sutskever ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Generative Pretraining from Pixels](https://openai.com/blog/image-gpt/)
+1. **[Jukebox](https://huggingface.co/docs/transformers/model_doc/jukebox)** (OpenAI ใใ) Prafulla Dhariwal, Heewoo Jun, Christine Payne, Jong Wook Kim, Alec Radford, Ilya Sutskever ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Jukebox: A Generative Model for Music](https://arxiv.org/pdf/2005.00341.pdf)
+1. **[LayoutLM](https://huggingface.co/docs/transformers/model_doc/layoutlm)** (Microsoft Research Asia ใใ) Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LayoutLM: Pre-training of Text and Layout for Document Image Understanding](https://arxiv.org/abs/1912.13318)
+1. **[LayoutLMv2](https://huggingface.co/docs/transformers/model_doc/layoutlmv2)** (Microsoft Research Asia ใใ) Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, Lidong Zhou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding](https://arxiv.org/abs/2012.14740)
+1. **[LayoutLMv3](https://huggingface.co/docs/transformers/model_doc/layoutlmv3)** (Microsoft Research Asia ใใ) Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, Furu Wei ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LayoutLMv3: Pre-training for Document AI with Unified Text and Image Masking](https://arxiv.org/abs/2204.08387)
+1. **[LayoutXLM](https://huggingface.co/docs/transformers/model_doc/layoutxlm)** (Microsoft Research Asia ใใ) Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Furu Wei ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding](https://arxiv.org/abs/2104.08836)
+1. **[LED](https://huggingface.co/docs/transformers/model_doc/led)** (AllenAI ใใ) Iz Beltagy, Matthew E. Peters, Arman Cohan ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150)
+1. **[LeViT](https://huggingface.co/docs/transformers/model_doc/levit)** (Meta AI ใใ) Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Hervรฉ Jรฉgou, Matthijs Douze ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LeViT: A Vision Transformer in ConvNet's Clothing for Faster Inference](https://arxiv.org/abs/2104.01136)
+1. **[LiLT](https://huggingface.co/docs/transformers/model_doc/lilt)** (South China University of Technology ใใ) Jiapeng Wang, Lianwen Jin, Kai Ding ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding](https://arxiv.org/abs/2202.13669)
+1. **[Longformer](https://huggingface.co/docs/transformers/model_doc/longformer)** (AllenAI ใใ) Iz Beltagy, Matthew E. Peters, Arman Cohan ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150)
+1. **[LongT5](https://huggingface.co/docs/transformers/model_doc/longt5)** (Google AI ใใ) Mandy Guo, Joshua Ainslie, David Uthus, Santiago Ontanon, Jianmo Ni, Yun-Hsuan Sung, Yinfei Yang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LongT5: Efficient Text-To-Text Transformer for Long Sequences](https://arxiv.org/abs/2112.07916)
+1. **[LUKE](https://huggingface.co/docs/transformers/model_doc/luke)** (Studio Ousia ใใ) Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, Yuji Matsumoto ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention](https://arxiv.org/abs/2010.01057)
+1. **[LXMERT](https://huggingface.co/docs/transformers/model_doc/lxmert)** (UNC Chapel Hill ใใ) Hao Tan and Mohit Bansal ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [LXMERT: Learning Cross-Modality Encoder Representations from Transformers for Open-Domain Question Answering](https://arxiv.org/abs/1908.07490)
+1. **[M-CTC-T](https://huggingface.co/docs/transformers/model_doc/mctct)** (Facebook ใใ) Loren Lugosch, Tatiana Likhomanenko, Gabriel Synnaeve, and Ronan Collobert ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Pseudo-Labeling For Massively Multilingual Speech Recognition](https://arxiv.org/abs/2111.00161)
+1. **[M2M100](https://huggingface.co/docs/transformers/model_doc/m2m_100)** (Facebook ใใ) Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky, Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, Armand Joulin ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Beyond English-Centric Multilingual Machine Translation](https://arxiv.org/abs/2010.11125)
+1. **[MarianMT](https://huggingface.co/docs/transformers/model_doc/marian)** Jรถrg Tiedemann ใใ. [OPUS](http://opus.nlpl.eu/) ใไฝฟใใชใใๅญฆ็ฟใใใ "Machine translation" (ใใทใณใใฉใณในใฌใผใทใงใณ) ใขใใซ. [Marian Framework](https://marian-nmt.github.io/) ใฏMicrosoft Translator Teamใใ็พๅจ้็บไธญใงใ.
+1. **[MarkupLM](https://huggingface.co/docs/transformers/model_doc/markuplm)** (Microsoft Research Asia ใใ) Junlong Li, Yiheng Xu, Lei Cui, Furu Wei ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MarkupLM: Pre-training of Text and Markup Language for Visually-rich Document Understanding](https://arxiv.org/abs/2110.08518)
+1. **[Mask2Former](https://huggingface.co/docs/transformers/main/model_doc/mask2former)** (FAIR and UIUC ใใ) Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar. ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ [Masked-attention Mask Transformer for Universal Image Segmentation](https://arxiv.org/abs/2112.01527)
+1. **[MaskFormer](https://huggingface.co/docs/transformers/model_doc/maskformer)** (Meta and UIUC ใใ) Bowen Cheng, Alexander G. Schwing, Alexander Kirillov ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Per-Pixel Classification is Not All You Need for Semantic Segmentation](https://arxiv.org/abs/2107.06278)
+1. **[mBART](https://huggingface.co/docs/transformers/model_doc/mbart)** (Facebook ใใ) Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, Luke Zettlemoyer ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Multilingual Denoising Pre-training for Neural Machine Translation](https://arxiv.org/abs/2001.08210)
+1. **[mBART-50](https://huggingface.co/docs/transformers/model_doc/mbart)** (Facebook ใใ) Yuqing Tang, Chau Tran, Xian Li, Peng-Jen Chen, Naman Goyal, Vishrav Chaudhary, Jiatao Gu, Angela Fan ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Multilingual Translation with Extensible Multilingual Pretraining and Finetuning](https://arxiv.org/abs/2008.00401)
+1. **[Megatron-BERT](https://huggingface.co/docs/transformers/model_doc/megatron-bert)** (NVIDIA ใใ) Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper and Bryan Catanzaro ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053)
+1. **[Megatron-GPT2](https://huggingface.co/docs/transformers/model_doc/megatron_gpt2)** (NVIDIA ใใ) Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper and Bryan Catanzaro ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053)
+1. **[mLUKE](https://huggingface.co/docs/transformers/model_doc/mluke)** (Studio Ousia ใใ) Ryokan Ri, Ikuya Yamada, and Yoshimasa Tsuruoka ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [mLUKE: The Power of Entity Representations in Multilingual Pretrained Language Models](https://arxiv.org/abs/2110.08151)
+1. **[MobileBERT](https://huggingface.co/docs/transformers/model_doc/mobilebert)** (CMU/Google Brain ใใ) Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices](https://arxiv.org/abs/2004.02984)
+1. **[MobileNetV1](https://huggingface.co/docs/transformers/model_doc/mobilenet_v1)** (Google Inc. ใใ) Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications](https://arxiv.org/abs/1704.04861)
+1. **[MobileNetV2](https://huggingface.co/docs/transformers/model_doc/mobilenet_v2)** (Google Inc. ใใ) Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, Liang-Chieh Chen ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MobileNetV2: Inverted Residuals and Linear Bottlenecks](https://arxiv.org/abs/1801.04381)
+1. **[MobileViT](https://huggingface.co/docs/transformers/model_doc/mobilevit)** (Apple ใใ) Sachin Mehta and Mohammad Rastegari ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer](https://arxiv.org/abs/2110.02178)
+1. **[MPNet](https://huggingface.co/docs/transformers/model_doc/mpnet)** (Microsoft Research ใใ) Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MPNet: Masked and Permuted Pre-training for Language Understanding](https://arxiv.org/abs/2004.09297)
+1. **[MT5](https://huggingface.co/docs/transformers/model_doc/mt5)** (Google AI ใใ) Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, Colin Raffel ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [mT5: A massively multilingual pre-trained text-to-text transformer](https://arxiv.org/abs/2010.11934)
+1. **[MVP](https://huggingface.co/docs/transformers/model_doc/mvp)** (RUC AI Box ใใ) Tianyi Tang, Junyi Li, Wayne Xin Zhao and Ji-Rong Wen ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MVP: Multi-task Supervised Pre-training for Natural Language Generation](https://arxiv.org/abs/2206.12131)
+1. **[NAT](https://huggingface.co/docs/transformers/model_doc/nat)** (SHI Labs ใใ) Ali Hassani, Steven Walton, Jiachen Li, Shen Li, and Humphrey Shi ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Neighborhood Attention Transformer](https://arxiv.org/abs/2204.07143)
+1. **[Nezha](https://huggingface.co/docs/transformers/model_doc/nezha)** (Huawei Noahโs Ark Lab ใใ) Junqiu Wei, Xiaozhe Ren, Xiaoguang Li, Wenyong Huang, Yi Liao, Yasheng Wang, Jiashu Lin, Xin Jiang, Xiao Chen and Qun Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [NEZHA: Neural Contextualized Representation for Chinese Language Understanding](https://arxiv.org/abs/1909.00204)
+1. **[NLLB](https://huggingface.co/docs/transformers/model_doc/nllb)** (Meta ใใ) the NLLB team ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [No Language Left Behind: Scaling Human-Centered Machine Translation](https://arxiv.org/abs/2207.04672)
+1. **[Nystrรถmformer](https://huggingface.co/docs/transformers/model_doc/nystromformer)** (the University of Wisconsin - Madison ใใ) Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, Vikas Singh ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Nystrรถmformer: A Nystrรถm-Based Algorithm for Approximating Self-Attention](https://arxiv.org/abs/2102.03902)
+1. **[OneFormer](https://huggingface.co/docs/transformers/main/model_doc/oneformer)** (SHI Labs ใใ) Jitesh Jain, Jiachen Li, MangTik Chiu, Ali Hassani, Nikita Orlov, Humphrey Shi ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [OneFormer: One Transformer to Rule Universal Image Segmentation](https://arxiv.org/abs/2211.06220)
+1. **[OPT](https://huggingface.co/docs/transformers/master/model_doc/opt)** (Meta AI ใใ) Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen et al ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [OPT: Open Pre-trained Transformer Language Models](https://arxiv.org/abs/2205.01068)
+1. **[OWL-ViT](https://huggingface.co/docs/transformers/model_doc/owlvit)** (Google AI ใใ) Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, and Neil Houlsby ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Simple Open-Vocabulary Object Detection with Vision Transformers](https://arxiv.org/abs/2205.06230)
+1. **[Pegasus](https://huggingface.co/docs/transformers/model_doc/pegasus)** (Google ใใ) Jingqing Zhang, Yao Zhao, Mohammad Saleh and Peter J. Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization](https://arxiv.org/abs/1912.08777)
+1. **[PEGASUS-X](https://huggingface.co/docs/transformers/model_doc/pegasus_x)** (Google ใใ) Jason Phang, Yao Zhao, and Peter J. Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Investigating Efficiently Extending Transformers for Long Input Summarization](https://arxiv.org/abs/2208.04347)
+1. **[Perceiver IO](https://huggingface.co/docs/transformers/model_doc/perceiver)** (Deepmind ใใ) Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, Olivier Hรฉnaff, Matthew M. Botvinick, Andrew Zisserman, Oriol Vinyals, Joรฃo Carreira ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Perceiver IO: A General Architecture for Structured Inputs & Outputs](https://arxiv.org/abs/2107.14795)
+1. **[PhoBERT](https://huggingface.co/docs/transformers/model_doc/phobert)** (VinAI Research ใใ) Dat Quoc Nguyen and Anh Tuan Nguyen ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [PhoBERT: Pre-trained language models for Vietnamese](https://www.aclweb.org/anthology/2020.findings-emnlp.92/)
+1. **[PLBart](https://huggingface.co/docs/transformers/model_doc/plbart)** (UCLA NLP ใใ) Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Unified Pre-training for Program Understanding and Generation](https://arxiv.org/abs/2103.06333)
+1. **[PoolFormer](https://huggingface.co/docs/transformers/model_doc/poolformer)** (Sea AI Labs ใใ) Yu, Weihao and Luo, Mi and Zhou, Pan and Si, Chenyang and Zhou, Yichen and Wang, Xinchao and Feng, Jiashi and Yan, Shuicheng ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [MetaFormer is Actually What You Need for Vision](https://arxiv.org/abs/2111.11418)
+1. **[ProphetNet](https://huggingface.co/docs/transformers/model_doc/prophetnet)** (Microsoft Research ใใ) Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang and Ming Zhou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063)
+1. **[QDQBert](https://huggingface.co/docs/transformers/model_doc/qdqbert)** (NVIDIA ใใ) Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev and Paulius Micikevicius ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Integer Quantization for Deep Learning Inference: Principles and Empirical Evaluation](https://arxiv.org/abs/2004.09602)
+1. **[RAG](https://huggingface.co/docs/transformers/model_doc/rag)** (Facebook ใใ) Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kรผttler, Mike Lewis, Wen-tau Yih, Tim Rocktรคschel, Sebastian Riedel, Douwe Kiela ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401)
+1. **[REALM](https://huggingface.co/docs/transformers/model_doc/realm.html)** (Google Research ใใ) Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat and Ming-Wei Chang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [REALM: Retrieval-Augmented Language Model Pre-Training](https://arxiv.org/abs/2002.08909)
+1. **[Reformer](https://huggingface.co/docs/transformers/model_doc/reformer)** (Google Research ใใ) Nikita Kitaev, ลukasz Kaiser, Anselm Levskaya ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451)
+1. **[RegNet](https://huggingface.co/docs/transformers/model_doc/regnet)** (META Platforms ใใ) Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollรกr ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Designing Network Design Space](https://arxiv.org/abs/2003.13678)
+1. **[RemBERT](https://huggingface.co/docs/transformers/model_doc/rembert)** (Google Research ใใ) Hyung Won Chung, Thibault Fรฉvry, Henry Tsai, M. Johnson, Sebastian Ruder ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Rethinking embedding coupling in pre-trained language models](https://arxiv.org/abs/2010.12821)
+1. **[ResNet](https://huggingface.co/docs/transformers/model_doc/resnet)** (Microsoft Research ใใ) Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385)
+1. **[RoBERTa](https://huggingface.co/docs/transformers/model_doc/roberta)** (Facebook ใใ), Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692)
+1. **[RoBERTa-PreLayerNorm](https://huggingface.co/docs/transformers/main/model_doc/roberta-prelayernorm)** (Facebook ใใ) Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, Michael Auli ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [fairseq: A Fast, Extensible Toolkit for Sequence Modeling](https://arxiv.org/abs/1904.01038)
+1. **[RoCBert](https://huggingface.co/docs/transformers/main/model_doc/roc_bert)** (WeChatAI ใใ) HuiSu, WeiweiShi, XiaoyuShen, XiaoZhou, TuoJi, JiaruiFang, JieZhou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [RoCBert: Robust Chinese Bert with Multimodal Contrastive Pretraining](https://aclanthology.org/2022.acl-long.65.pdf)
+1. **[RoFormer](https://huggingface.co/docs/transformers/model_doc/roformer)** (ZhuiyiTechnology ใใ), Jianlin Su and Yu Lu and Shengfeng Pan and Bo Wen and Yunfeng Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/abs/2104.09864)
+1. **[SegFormer](https://huggingface.co/docs/transformers/model_doc/segformer)** (NVIDIA ใใ) Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping Luo ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203)
+1. **[SEW](https://huggingface.co/docs/transformers/model_doc/sew)** (ASAPP ใใ) Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870)
+1. **[SEW-D](https://huggingface.co/docs/transformers/model_doc/sew_d)** (ASAPP ใใ) Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870)
+1. **[SpeechToTextTransformer](https://huggingface.co/docs/transformers/model_doc/speech_to_text)** (Facebook ใใ), Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Dmytro Okhonko, Juan Pino ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [fairseq S2T: Fast Speech-to-Text Modeling with fairseq](https://arxiv.org/abs/2010.05171)
+1. **[SpeechToTextTransformer2](https://huggingface.co/docs/transformers/model_doc/speech_to_text_2)** (Facebook ใใ), Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Large-Scale Self- and Semi-Supervised Learning for Speech Translation](https://arxiv.org/abs/2104.06678)
+1. **[Splinter](https://huggingface.co/docs/transformers/model_doc/splinter)** (Tel Aviv University ใใ), Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, Omer Levy ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Few-Shot Question Answering by Pretraining Span Selection](https://arxiv.org/abs/2101.00438)
+1. **[SqueezeBERT](https://huggingface.co/docs/transformers/model_doc/squeezebert)** (Berkeley ใใ) Forrest N. Iandola, Albert E. Shaw, Ravi Krishna, and Kurt W. Keutzer ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [SqueezeBERT: What can computer vision teach NLP about efficient neural networks?](https://arxiv.org/abs/2006.11316)
+1. **[Swin Transformer](https://huggingface.co/docs/transformers/model_doc/swin)** (Microsoft ใใ) Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030)
+1. **[Swin Transformer V2](https://huggingface.co/docs/transformers/model_doc/swinv2)** (Microsoft ใใ) Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Swin Transformer V2: Scaling Up Capacity and Resolution](https://arxiv.org/abs/2111.09883)
+1. **[Swin2SR](https://huggingface.co/docs/transformers/main/model_doc/swin2sr)** (University of Wรผrzburg ใใ) Marcos V. Conde, Ui-Jin Choi, Maxime Burchi, Radu Timofte ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Swin2SR: SwinV2 Transformer for Compressed Image Super-Resolution and Restoration](https://arxiv.org/abs/2209.11345)
+1. **[SwitchTransformers](https://huggingface.co/docs/transformers/main/model_doc/switch_transformers)** (Google ใใ) William Fedus, Barret Zoph, Noam Shazeer ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity](https://arxiv.org/abs/2101.03961)
+1. **[T5](https://huggingface.co/docs/transformers/model_doc/t5)** (Google AI ใใ) Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683)
+1. **[T5v1.1](https://huggingface.co/docs/transformers/model_doc/t5v1.1)** (Google AI ใใ) Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu ใใๅ
ฌ้ใใใใฌใใธใใชใผ [google-research/text-to-text-transfer-transformer](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#t511)
+1. **[Table Transformer](https://huggingface.co/docs/transformers/model_doc/table-transformer)** (Microsoft Research ใใ) Brandon Smock, Rohith Pesala, Robin Abraham ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [PubTables-1M: Towards Comprehensive Table Extraction From Unstructured Documents](https://arxiv.org/abs/2110.00061)
+1. **[TAPAS](https://huggingface.co/docs/transformers/model_doc/tapas)** (Google AI ใใ) Jonathan Herzig, Paweล Krzysztof Nowak, Thomas Mรผller, Francesco Piccinno and Julian Martin Eisenschlos ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [TAPAS: Weakly Supervised Table Parsing via Pre-training](https://arxiv.org/abs/2004.02349)
+1. **[TAPEX](https://huggingface.co/docs/transformers/model_doc/tapex)** (Microsoft Research ใใ) Qian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, Jian-Guang Lou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [TAPEX: Table Pre-training via Learning a Neural SQL Executor](https://arxiv.org/abs/2107.07653)
+1. **[Time Series Transformer](https://huggingface.co/docs/transformers/model_doc/time_series_transformer)** (HuggingFace ใใ).
+1. **[TimeSformer](https://huggingface.co/docs/transformers/main/model_doc/timesformer)** (Facebook ใใ) Gedas Bertasius, Heng Wang, Lorenzo Torresani ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Is Space-Time Attention All You Need for Video Understanding?](https://arxiv.org/abs/2102.05095)
+1. **[Trajectory Transformer](https://huggingface.co/docs/transformers/model_doc/trajectory_transformers)** (the University of California at Berkeley ใใ) Michael Janner, Qiyang Li, Sergey Levine ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Offline Reinforcement Learning as One Big Sequence Modeling Problem](https://arxiv.org/abs/2106.02039)
+1. **[Transformer-XL](https://huggingface.co/docs/transformers/model_doc/transfo-xl)** (Google/CMU ใใ) Zihang Dai*, Zhilin Yang*, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860)
+1. **[TrOCR](https://huggingface.co/docs/transformers/model_doc/trocr)** (Microsoft ใใ), Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, Furu Wei ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282)
+1. **[UL2](https://huggingface.co/docs/transformers/model_doc/ul2)** (Google Research ใใ) Yi Tay, Mostafa Dehghani, Vinh Q ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Unifying Language Learning Paradigms](https://arxiv.org/abs/2205.05131v1) Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, Donald Metzler
+1. **[UniSpeech](https://huggingface.co/docs/transformers/model_doc/unispeech)** (Microsoft Research ใใ) Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael Zeng, Xuedong Huang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data](https://arxiv.org/abs/2101.07597)
+1. **[UniSpeechSat](https://huggingface.co/docs/transformers/model_doc/unispeech-sat)** (Microsoft Research ใใ) Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [UNISPEECH-SAT: UNIVERSAL SPEECH REPRESENTATION LEARNING WITH SPEAKER AWARE PRE-TRAINING](https://arxiv.org/abs/2110.05752)
+1. **[UPerNet](https://huggingface.co/docs/transformers/main/model_doc/upernet)** (Peking University ใใ) Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, Jian Sun. ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ [Unified Perceptual Parsing for Scene Understanding](https://arxiv.org/abs/1807.10221)
+1. **[VAN](https://huggingface.co/docs/transformers/model_doc/van)** (Tsinghua University and Nankai University ใใ) Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, Shi-Min Hu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Visual Attention Network](https://arxiv.org/abs/2202.09741)
+1. **[VideoMAE](https://huggingface.co/docs/transformers/model_doc/videomae)** (Multimedia Computing Group, Nanjing University ใใ) Zhan Tong, Yibing Song, Jue Wang, Limin Wang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training](https://arxiv.org/abs/2203.12602)
+1. **[ViLT](https://huggingface.co/docs/transformers/model_doc/vilt)** (NAVER AI Lab/Kakao Enterprise/Kakao Brain ใใ) Wonjae Kim, Bokyung Son, Ildoo Kim ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision](https://arxiv.org/abs/2102.03334)
+1. **[Vision Transformer (ViT)](https://huggingface.co/docs/transformers/model_doc/vit)** (Google AI ใใ) Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, Neil Houlsby ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929)
+1. **[VisualBERT](https://huggingface.co/docs/transformers/model_doc/visual_bert)** (UCLA NLP ใใ) Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [VisualBERT: A Simple and Performant Baseline for Vision and Language](https://arxiv.org/pdf/1908.03557)
+1. **[ViT Hybrid](https://huggingface.co/docs/transformers/main/model_doc/vit_hybrid)** (Google AI ใใ) Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, Neil Houlsby ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929)
+1. **[ViTMAE](https://huggingface.co/docs/transformers/model_doc/vit_mae)** (Meta AI ใใ) Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollรกr, Ross Girshick ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Masked Autoencoders Are Scalable Vision Learners](https://arxiv.org/abs/2111.06377)
+1. **[ViTMSN](https://huggingface.co/docs/transformers/model_doc/vit_msn)** (Meta AI ใใ) Mahmoud Assran, Mathilde Caron, Ishan Misra, Piotr Bojanowski, Florian Bordes, Pascal Vincent, Armand Joulin, Michael Rabbat, Nicolas Ballas ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Masked Siamese Networks for Label-Efficient Learning](https://arxiv.org/abs/2204.07141)
+1. **[Wav2Vec2](https://huggingface.co/docs/transformers/model_doc/wav2vec2)** (Facebook AI ใใ) Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations](https://arxiv.org/abs/2006.11477)
+1. **[Wav2Vec2-Conformer](https://huggingface.co/docs/transformers/model_doc/wav2vec2-conformer)** (Facebook AI ใใ) Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Sravya Popuri, Dmytro Okhonko, Juan Pino ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [FAIRSEQ S2T: Fast Speech-to-Text Modeling with FAIRSEQ](https://arxiv.org/abs/2010.05171)
+1. **[Wav2Vec2Phoneme](https://huggingface.co/docs/transformers/model_doc/wav2vec2_phoneme)** (Facebook AI ใใ) Qiantong Xu, Alexei Baevski, Michael Auli ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Simple and Effective Zero-shot Cross-lingual Phoneme Recognition](https://arxiv.org/abs/2109.11680)
+1. **[WavLM](https://huggingface.co/docs/transformers/model_doc/wavlm)** (Microsoft Research ใใ) Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, Jian Wu, Long Zhou, Shuo Ren, Yanmin Qian, Yao Qian, Jian Wu, Michael Zeng, Furu Wei ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing](https://arxiv.org/abs/2110.13900)
+1. **[Whisper](https://huggingface.co/docs/transformers/model_doc/whisper)** (OpenAI ใใ) Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, Ilya Sutskever ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Robust Speech Recognition via Large-Scale Weak Supervision](https://cdn.openai.com/papers/whisper.pdf)
+1. **[X-CLIP](https://huggingface.co/docs/transformers/model_doc/xclip)** (Microsoft Research ใใ) Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Expanding Language-Image Pretrained Models for General Video Recognition](https://arxiv.org/abs/2208.02816)
+1. **[XGLM](https://huggingface.co/docs/transformers/model_doc/xglm)** (From Facebook AI) Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O'Horo, Jeff Wang, Luke Zettlemoyer, Zornitsa Kozareva, Mona Diab, Veselin Stoyanov, Xian Li ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Few-shot Learning with Multilingual Language Models](https://arxiv.org/abs/2112.10668)
+1. **[XLM](https://huggingface.co/docs/transformers/model_doc/xlm)** (Facebook ใใ) Guillaume Lample and Alexis Conneau ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Cross-lingual Language Model Pretraining](https://arxiv.org/abs/1901.07291)
+1. **[XLM-ProphetNet](https://huggingface.co/docs/transformers/model_doc/xlm-prophetnet)** (Microsoft Research ใใ) Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang and Ming Zhou ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063)
+1. **[XLM-RoBERTa](https://huggingface.co/docs/transformers/model_doc/xlm-roberta)** (Facebook AI ใใ), Alexis Conneau*, Kartikay Khandelwal*, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmรกn, Edouard Grave, Myle Ott, Luke Zettlemoyer and Veselin Stoyanov ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116)
+1. **[XLM-RoBERTa-XL](https://huggingface.co/docs/transformers/model_doc/xlm-roberta-xl)** (Facebook AI ใใ), Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Larger-Scale Transformers for Multilingual Masked Language Modeling](https://arxiv.org/abs/2105.00572)
+1. **[XLNet](https://huggingface.co/docs/transformers/model_doc/xlnet)** (Google/CMU ใใ) Zhilin Yang*, Zihang Dai*, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, Quoc V. Le ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [โXLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237)
+1. **[XLS-R](https://huggingface.co/docs/transformers/model_doc/xls_r)** (Facebook AI ใใ) Arun Babu, Changhan Wang, Andros Tjandra, Kushal Lakhotia, Qiantong Xu, Naman Goyal, Kritika Singh, Patrick von Platen, Yatharth Saraf, Juan Pino, Alexei Baevski, Alexis Conneau, Michael Auli ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale](https://arxiv.org/abs/2111.09296)
+1. **[XLSR-Wav2Vec2](https://huggingface.co/docs/transformers/model_doc/xlsr_wav2vec2)** (Facebook AI ใใ) Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael Auli ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [Unsupervised Cross-Lingual Representation Learning For Speech Recognition](https://arxiv.org/abs/2006.13979)
+1. **[YOLOS](https://huggingface.co/docs/transformers/model_doc/yolos)** (Huazhong University of Science & Technology ใใ) Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection](https://arxiv.org/abs/2106.00666)
+1. **[YOSO](https://huggingface.co/docs/transformers/model_doc/yoso)** (the University of Wisconsin - Madison ใใ) Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh ใใๅ
ฌ้ใใใ็ ็ฉถ่ซๆ: [You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling](https://arxiv.org/abs/2111.09714)
+
+
+### ใตใใผใใใใฆใใใใฌใผใ ใฏใผใฏ
+
+ไปฅไธใฎใใผใใซใฏใใใใใฎใขใใซใงใตใใผใใใใฆใใใฉใคใใฉใชใ็คบใใฆใใพใใ"slow"ใจๅผใฐใใPythonใใผใฏใใคใถใผใ๐ค Tokenizers ใฉใคใใฉใชใซใใ"fast"ใใผใฏใใคใถใผใPyTorch, TensorFlow, Flaxใฎ5ใคใฎใใใใใใตใใผใใใใฆใใใใ็คบใใฆใใพใใ
+
+
+
+| Model | Tokenizer slow | Tokenizer fast | PyTorch support | TensorFlow support | Flax Support |
+|:-----------------------------:|:--------------:|:--------------:|:---------------:|:------------------:|:------------:|
+| ALBERT | โ
| โ
| โ
| โ
| โ
|
+| AltCLIP | โ | โ | โ
| โ | โ |
+| Audio Spectrogram Transformer | โ | โ | โ
| โ | โ |
+| BART | โ
| โ
| โ
| โ
| โ
|
+| BEiT | โ | โ | โ
| โ | โ
|
+| BERT | โ
| โ
| โ
| โ
| โ
|
+| Bert Generation | โ
| โ | โ
| โ | โ |
+| BigBird | โ
| โ
| โ
| โ | โ
|
+| BigBird-Pegasus | โ | โ | โ
| โ | โ |
+| BioGpt | โ
| โ | โ
| โ | โ |
+| BiT | โ | โ | โ
| โ | โ |
+| Blenderbot | โ
| โ
| โ
| โ
| โ
|
+| BlenderbotSmall | โ
| โ
| โ
| โ
| โ
|
+| BLIP | โ | โ | โ
| โ | โ |
+| BLOOM | โ | โ
| โ
| โ | โ |
+| CamemBERT | โ
| โ
| โ
| โ
| โ |
+| CANINE | โ
| โ | โ
| โ | โ |
+| Chinese-CLIP | โ | โ | โ
| โ | โ |
+| CLIP | โ
| โ
| โ
| โ
| โ
|
+| CLIPSeg | โ | โ | โ
| โ | โ |
+| CodeGen | โ
| โ
| โ
| โ | โ |
+| Conditional DETR | โ | โ | โ
| โ | โ |
+| ConvBERT | โ
| โ
| โ
| โ
| โ |
+| ConvNeXT | โ | โ | โ
| โ
| โ |
+| CTRL | โ
| โ | โ
| โ
| โ |
+| CvT | โ | โ | โ
| โ
| โ |
+| Data2VecAudio | โ | โ | โ
| โ | โ |
+| Data2VecText | โ | โ | โ
| โ | โ |
+| Data2VecVision | โ | โ | โ
| โ
| โ |
+| DeBERTa | โ
| โ
| โ
| โ
| โ |
+| DeBERTa-v2 | โ
| โ
| โ
| โ
| โ |
+| Decision Transformer | โ | โ | โ
| โ | โ |
+| Deformable DETR | โ | โ | โ
| โ | โ |
+| DeiT | โ | โ | โ
| โ
| โ |
+| DETR | โ | โ | โ
| โ | โ |
+| DiNAT | โ | โ | โ
| โ | โ |
+| DistilBERT | โ
| โ
| โ
| โ
| โ
|
+| DonutSwin | โ | โ | โ
| โ | โ |
+| DPR | โ
| โ
| โ
| โ
| โ |
+| DPT | โ | โ | โ
| โ | โ |
+| ELECTRA | โ
| โ
| โ
| โ
| โ
|
+| Encoder decoder | โ | โ | โ
| โ
| โ
|
+| ERNIE | โ | โ | โ
| โ | โ |
+| ESM | โ
| โ | โ
| โ
| โ |
+| FairSeq Machine-Translation | โ
| โ | โ
| โ | โ |
+| FlauBERT | โ
| โ | โ
| โ
| โ |
+| FLAVA | โ | โ | โ
| โ | โ |
+| FNet | โ
| โ
| โ
| โ | โ |
+| Funnel Transformer | โ
| โ
| โ
| โ
| โ |
+| GIT | โ | โ | โ
| โ | โ |
+| GLPN | โ | โ | โ
| โ | โ |
+| GPT Neo | โ | โ | โ
| โ | โ
|
+| GPT NeoX | โ | โ
| โ
| โ | โ |
+| GPT NeoX Japanese | โ
| โ | โ
| โ | โ |
+| GPT-J | โ | โ | โ
| โ
| โ
|
+| GPT-Sw3 | โ
| โ
| โ
| โ
| โ
|
+| GroupViT | โ | โ | โ
| โ
| โ |
+| Hubert | โ | โ | โ
| โ
| โ |
+| I-BERT | โ | โ | โ
| โ | โ |
+| ImageGPT | โ | โ | โ
| โ | โ |
+| Jukebox | โ
| โ | โ
| โ | โ |
+| LayoutLM | โ
| โ
| โ
| โ
| โ |
+| LayoutLMv2 | โ
| โ
| โ
| โ | โ |
+| LayoutLMv3 | โ
| โ
| โ
| โ
| โ |
+| LED | โ
| โ
| โ
| โ
| โ |
+| LeViT | โ | โ | โ
| โ | โ |
+| LiLT | โ | โ | โ
| โ | โ |
+| Longformer | โ
| โ
| โ
| โ
| โ |
+| LongT5 | โ | โ | โ
| โ | โ
|
+| LUKE | โ
| โ | โ
| โ | โ |
+| LXMERT | โ
| โ
| โ
| โ
| โ |
+| M-CTC-T | โ | โ | โ
| โ | โ |
+| M2M100 | โ
| โ | โ
| โ | โ |
+| Marian | โ
| โ | โ
| โ
| โ
|
+| MarkupLM | โ
| โ
| โ
| โ | โ |
+| Mask2Former | โ | โ | โ
| โ | โ |
+| MaskFormer | โ | โ | โ
| โ | โ |
+| MaskFormerSwin | โ | โ | โ | โ | โ |
+| mBART | โ
| โ
| โ
| โ
| โ
|
+| Megatron-BERT | โ | โ | โ
| โ | โ |
+| MobileBERT | โ
| โ
| โ
| โ
| โ |
+| MobileNetV1 | โ | โ | โ
| โ | โ |
+| MobileNetV2 | โ | โ | โ
| โ | โ |
+| MobileViT | โ | โ | โ
| โ
| โ |
+| MPNet | โ
| โ
| โ
| โ
| โ |
+| MT5 | โ
| โ
| โ
| โ
| โ
|
+| MVP | โ
| โ
| โ
| โ | โ |
+| NAT | โ | โ | โ
| โ | โ |
+| Nezha | โ | โ | โ
| โ | โ |
+| Nystrรถmformer | โ | โ | โ
| โ | โ |
+| OpenAI GPT | โ
| โ
| โ
| โ
| โ |
+| OpenAI GPT-2 | โ
| โ
| โ
| โ
| โ
|
+| OPT | โ | โ | โ
| โ
| โ
|
+| OWL-ViT | โ | โ | โ
| โ | โ |
+| Pegasus | โ
| โ
| โ
| โ
| โ
|
+| PEGASUS-X | โ | โ | โ
| โ | โ |
+| Perceiver | โ
| โ | โ
| โ | โ |
+| PLBart | โ
| โ | โ
| โ | โ |
+| PoolFormer | โ | โ | โ
| โ | โ |
+| ProphetNet | โ
| โ | โ
| โ | โ |
+| QDQBert | โ | โ | โ
| โ | โ |
+| RAG | โ
| โ | โ
| โ
| โ |
+| REALM | โ
| โ
| โ
| โ | โ |
+| Reformer | โ
| โ
| โ
| โ | โ |
+| RegNet | โ | โ | โ
| โ
| โ
|
+| RemBERT | โ
| โ
| โ
| โ
| โ |
+| ResNet | โ | โ | โ
| โ
| โ
|
+| RetriBERT | โ
| โ
| โ
| โ | โ |
+| RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| RoBERTa-PreLayerNorm | โ | โ | โ
| โ
| โ
|
+| RoCBert | โ
| โ | โ
| โ | โ |
+| RoFormer | โ
| โ
| โ
| โ
| โ
|
+| SegFormer | โ | โ | โ
| โ
| โ |
+| SEW | โ | โ | โ
| โ | โ |
+| SEW-D | โ | โ | โ
| โ | โ |
+| Speech Encoder decoder | โ | โ | โ
| โ | โ
|
+| Speech2Text | โ
| โ | โ
| โ
| โ |
+| Speech2Text2 | โ
| โ | โ | โ | โ |
+| Splinter | โ
| โ
| โ
| โ | โ |
+| SqueezeBERT | โ
| โ
| โ
| โ | โ |
+| Swin Transformer | โ | โ | โ
| โ
| โ |
+| Swin Transformer V2 | โ | โ | โ
| โ | โ |
+| Swin2SR | โ | โ | โ
| โ | โ |
+| SwitchTransformers | โ | โ | โ
| โ | โ |
+| T5 | โ
| โ
| โ
| โ
| โ
|
+| Table Transformer | โ | โ | โ
| โ | โ |
+| TAPAS | โ
| โ | โ
| โ
| โ |
+| Time Series Transformer | โ | โ | โ
| โ | โ |
+| TimeSformer | โ | โ | โ
| โ | โ |
+| Trajectory Transformer | โ | โ | โ
| โ | โ |
+| Transformer-XL | โ
| โ | โ
| โ
| โ |
+| TrOCR | โ | โ | โ
| โ | โ |
+| UniSpeech | โ | โ | โ
| โ | โ |
+| UniSpeechSat | โ | โ | โ
| โ | โ |
+| UPerNet | โ | โ | โ
| โ | โ |
+| VAN | โ | โ | โ
| โ | โ |
+| VideoMAE | โ | โ | โ
| โ | โ |
+| ViLT | โ | โ | โ
| โ | โ |
+| Vision Encoder decoder | โ | โ | โ
| โ
| โ
|
+| VisionTextDualEncoder | โ | โ | โ
| โ | โ
|
+| VisualBERT | โ | โ | โ
| โ | โ |
+| ViT | โ | โ | โ
| โ
| โ
|
+| ViT Hybrid | โ | โ | โ
| โ | โ |
+| ViTMAE | โ | โ | โ
| โ
| โ |
+| ViTMSN | โ | โ | โ
| โ | โ |
+| Wav2Vec2 | โ
| โ | โ
| โ
| โ
|
+| Wav2Vec2-Conformer | โ | โ | โ
| โ | โ |
+| WavLM | โ | โ | โ
| โ | โ |
+| Whisper | โ
| โ | โ
| โ
| โ |
+| X-CLIP | โ | โ | โ
| โ | โ |
+| XGLM | โ
| โ
| โ
| โ
| โ
|
+| XLM | โ
| โ | โ
| โ
| โ |
+| XLM-ProphetNet | โ
| โ | โ
| โ | โ |
+| XLM-RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| XLM-RoBERTa-XL | โ | โ | โ
| โ | โ |
+| XLNet | โ
| โ
| โ
| โ
| โ |
+| YOLOS | โ | โ | โ
| โ | โ |
+| YOSO | โ | โ | โ
| โ | โ |
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/installation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/installation.md
new file mode 100644
index 0000000000000000000000000000000000000000..cb4919caf50571b95ffd9bacd6292c0fdf5d6294
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/installation.md
@@ -0,0 +1,244 @@
+
+
+# ใคใณในใใผใซ
+
+ไฝฟ็จใใฆใใDeep Learningใฉใคใใฉใชใซๅฏพใใฆใ๐ค Transformersใใคใณในใใผใซใใฆใญใฃใใทใฅใ่จญๅฎใใใใฆใชใใทใงใณใงใชใใฉใคใณใงๅฎ่กใงใใใใใซ ๐ค Transformersใ่จญๅฎใใพใใ
+
+๐ค TransformersใฏPython 3.6+, PyTorch 1.1.0+, TensorFlow 2.0+, Flaxใงๅไฝ็ขบ่ชใใฆใใพใใ ไฝฟ็จใใฆใใDeep Learningใฉใคใใฉใชใซๅใใใฆใไปฅไธใฎใคใณในใใผใซๆนๆณใซๅพใฃใฆใใ ใใ:
+
+* [PyTorch](https://pytorch.org/get-started/locally/)ใฎใคใณในใใผใซๆ้ ใ
+* [TensorFlow 2.0](https://www.tensorflow.org/install/pip)ใฎใคใณในใใผใซๆ้ ใ
+* [Flax](https://flax.readthedocs.io/en/latest/)ใฎใคใณในใใผใซๆ้ ใ
+
+## pipใงใฎใคใณในใใผใซ
+
+๐ค Transformersใ[ไปฎๆณ็ฐๅข](https://docs.python.org/3/library/venv.html)ใซใคใณในใใผใซใใๅฟ
่ฆใใใใพใใ ใใใPythonใฎไปฎๆณ็ฐๅขใซ้ฆดๆใฟใใชใๅ ดๅใฏใใใฎ[ใฌใคใ](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)ใใ่ฆงใใ ใใใไปฎๆณ็ฐๅขใซใใฃใฆ็ฐใชใใใญใธใงใฏใใฎ็ฎก็ใใใ็ฐกๅใซใชใใไพๅญ้ขไฟ้ใฎไบๆๆงใฎๅ้กใๅ้ฟใงใใพใใ
+
+ใพใใใใญใธใงใฏใใใฃใฌใฏใใชใซไปฎๆณ็ฐๅขใไฝๆใใใใจใใๅงใใพใใใ:
+
+```bash
+python -m venv .env
+```
+
+ไปฎๆณ็ฐๅขใ่ตทๅใใพใใใใLinuxใจMacOsใฎๅ ดๅใฏไปฅไธใฎใณใใณใใง่ตทๅใใพใ:
+
+```bash
+source .env/bin/activate
+```
+Windowsใงไปฎๆณ็ฐๅขใ่ตทๅใใพใ
+
+```bash
+.env/Scripts/activate
+```
+
+ใใใงใๆฌกใฎใณใใณใใง๐ค Transformersใใคใณในใใผใซใใๆบๅใๆดใใพใใ:
+
+```bash
+pip install transformers
+```
+
+CPUๅฏพๅฟใฎใฟๅฟ
่ฆใชๅ ดๅใ๐ค TransformersใจDeep Learningใฉใคใใฉใชใ1่กใงใคใณในใใผใซใงใใใใใซใชใฃใฆใใฆไพฟๅฉใงใใไพใใฐใ๐ค TransformersใจPyTorchใไปฅไธใฎใใใซไธ็ทใซใคใณในใใผใซใงใใพใ:
+
+```bash
+pip install transformers[torch]
+```
+
+๐ค TransformersใจTensorFlow 2.0:
+
+```bash
+pip install transformers[tf-cpu]
+```
+
+๐ค TransformersใจFlax:
+
+```bash
+pip install transformers[flax]
+```
+
+ๆๅพใซใไปฅไธใฎใณใใณใใๅฎ่กใใใใจใง๐ค Transformersใๆญฃใใใคใณในใใผใซใใใฆใใใใ็ขบ่ชใใพใใๅญฆ็ฟๆธใฟใขใใซใใใฆใณใญใผใใใใพใ:
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
+```
+
+ใใฎๅพใใฉใใซใจในใณใขใๅบๅใใใพใ:
+
+```bash
+[{'label': 'POSITIVE', 'score': 0.9998704791069031}]
+```
+
+## ใฝใผในใใใฎใคใณในใใผใซ
+
+ไปฅไธใฎใณใใณใใงใฝใผในใใ๐ค Transformersใใคใณในใใผใซใใพใ:
+
+```bash
+pip install git+https://github.com/huggingface/transformers
+```
+
+ใใฎใณใใณใใฏๆๆฐใฎๅฎๅฎ็ใงใฏใชใใ้็บใซใใใๆๆฐใฎ`main`ใใผใธใงใณใใคใณในใใผใซใใพใใ`main`ใใผใธใงใณใฏๆๆฐใฎ้็บ็ถๆณใซๅฏพๅฟใใใฎใซไพฟๅฉใงใใไพใใฐใๆๅพใฎๅ
ฌๅผใชใชใผในไปฅ้ใซใใฐใไฟฎๆญฃใใใใใๆฐใใใชใชใผในใใพใ ๅฑ้ใใใฆใใชใๅ ดๅใชใฉใงใใใใใใใใใฏ`main`ใใผใธใงใณใๅธธใซๅฎๅฎใใฆใใใจใฏ้ใใชใใใจใๆๅณใใพใใ็งใใกใฏ`main`ใใผใธใงใณใฎ้็จใ็ถญๆใใใใๅชใใใปใจใใฉใฎๅ้กใฏ้ๅธธใๆฐๆ้ใใ1ๆฅไปฅๅ
ใซ่งฃๆฑบใใใพใใใใๅ้กใซ้ญ้ใใๅ ดๅใฏใใใๆฉใไฟฎๆญฃใงใใใใใซ[Issue](https://github.com/huggingface/transformers/issues)ใไฝๆใใฆใใ ใใ๏ผ
+
+ไปฅไธใฎใณใใณใใๅฎ่กใใฆใ๐ค Transformersใๆญฃใใใคใณในใใผใซใใใฆใใใใฉใใใ็ขบ่ชใใพใ:
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))"
+```
+
+## ็ทจ้ๅฏ่ฝใชใคใณในใใผใซ
+
+ๅฟ
่ฆใซๅฟใใฆใ็ทจ้ๅฏ่ฝใชใคใณในใใผใซใใใพใ:
+
+* ใฝใผในใณใผใใฎ`main`ใใผใธใงใณใไฝฟใใพใใ
+* ๐ค Transformersใซใณใณใใชใใฅใผใใใใณใผใใฎๅคๆดใใในใใใๅฟ
่ฆใใใใพใใ
+
+ไปฅไธใฎใณใใณใใงใฌใใธใใชใใฏใญใผใณใใฆใ๐ค Transformersใใคใณในใใผใซใใพใ:
+
+```bash
+git clone https://github.com/huggingface/transformers.git
+cd transformers
+pip install -e .
+```
+
+ไธ่จใฎใณใใณใใฏใใฌใใธใใชใใฏใญใผใณใใใใฉใซใใจPythonใฎใฉใคใใฉใชใใในใใชใณใฏใใพใใPythonใฏ้ๅธธใฎใฉใคใใฉใชใในใซๅ ใใฆใใใชใใใฏใญใผใณใใใใฉใซใใฎไธญใ่ฆใใใใซใชใใพใใไพใใฐใPythonใใใฑใผใธใ้ๅธธใ`~/anaconda3/envs/main/lib/python3.7/site-packages/`ใซใคใณในใใผใซใใใฆใใๅ ดๅใPythonใฏใฏใญใผใณใใใใฉใซใใๆค็ดขใใใใใซใชใใพใ: `~/transformers/`.
+
+
+
+ใฉใคใใฉใชใผใไฝฟใ็ถใใใๅ ดๅใฏใtransformersใใฉใซใใผใไฟๆใใคใฅใใๅฟ
่ฆใใใใพใใ
+
+
+
+ใใใงใๆฌกใฎใณใใณใใง็ฐกๅใซใฏใญใผใณใ๐ค Transformersใฎๆๆฐ็ใซๆดๆฐใงใใพใ:
+
+```bash
+cd ~/transformers/
+git pull
+```
+
+Python็ฐๅขใฏๆฌกๅใฎๅฎ่กๆใซ๐ค Transformersใฎ`main`ใใผใธใงใณใ่ฆใคใใใใใซใชใใพใใ
+
+## condaใงใฎใคใณในใใผใซ
+
+`conda-forge`ใฎcondaใใฃใณใใซใใใคใณในใใผใซใใพใ:
+
+```bash
+conda install conda-forge::transformers
+```
+
+## ใญใฃใใทใฅใฎ่จญๅฎ
+
+ๅญฆ็ฟๆธใฟใขใใซใฏใใฆใณใญใผใใใใใญใผใซใซใซใญใฃใใทใฅใใใพใ: `~/.cache/huggingface/hub`. ใใใฏใทใงใซ็ฐๅขๅคๆฐ`TRANSFORMERS_CACHE`ใงๆๅฎใใใใใใฉใซใใฎใใฃใฌใฏใใชใงใใWindowsใงใฏใใใใฉใซใใฎใใฃใฌใฏใใชใฏ`C:\Users\username\.cache\huggingface\hub`ใซใชใฃใฆใใพใใ็ฐใชใใญใฃใใทใฅใใฃใฌใฏใใชใๆๅฎใใใใใซใไปฅไธใฎใทใงใซ็ฐๅขๅคๆฐใๅคๆดใใใใจใๅฏ่ฝใงใใๅชๅ
ๅบฆใฏไปฅไธใฎ้ ็ชใซๅฏพๅฟใใพใ:
+
+1. ใทใงใซ็ฐๅขๅคๆฐ (ใใใฉใซใ): `HF_HUB_CACHE` ใพใใฏ `TRANSFORMERS_CACHE`.
+2. ใทใงใซ็ฐๅขๅคๆฐ: `HF_HOME`.
+3. ใทใงใซ็ฐๅขๅคๆฐ: `XDG_CACHE_HOME` + `/huggingface`.
+
+
+
+ใใใไปฅๅใฎใใผใธใงใณใฎใฉใคใใฉใชใไฝฟ็จใใฆใใไบบใงใ`PYTORCH_TRANSFORMERS_CACHE`ใพใใฏ`PYTORCH_PRETRAINED_BERT_CACHE`ใ่จญๅฎใใฆใใๅ ดๅใใทใงใซ็ฐๅขๅคๆฐ`TRANSFORMERS_CACHE`ใๆๅฎใใชใ้ใ๐ค Transformersใฏใใใใฎใทใงใซ็ฐๅขๅคๆฐใไฝฟ็จใใพใใ
+
+
+
+## ใชใใฉใคใณใขใผใ
+
+๐ค Transformersใฏใญใผใซใซใใกใคใซใฎใฟใไฝฟ็จใใใใจใงใใกใคใขใฆใฉใผใซใใชใใฉใคใณใฎ็ฐๅขใงใๅไฝใใใใใจใใงใใพใใใใฎๅไฝใๆๅนใซใใใใใซใฏใ็ฐๅขๅคๆฐ`HF_HUB_OFFLINE=1`ใ่จญๅฎใใพใใ
+
+
+
+็ฐๅขๅคๆฐ`HF_DATASETS_OFFLINE=1`ใ่จญๅฎใใใชใใฉใคใณใใฌใผใใณใฐใฏใผใฏใใญใผใซ[๐ค Datasets](https://huggingface.co/docs/datasets/)ใ่ฟฝๅ ใใพใใ
+
+
+
+ไพใใฐใๅค้จใคใณในใฟใณในใซๅฏพใใฆใใกใคใขใฆใฉใผใซใงไฟ่ญทใใใ้ๅธธใฎใใใใฏใผใฏไธใงใใญใฐใฉใ ใๅฎ่กใใๅ ดๅใ้ๅธธไปฅไธใฎใใใชใณใใณใใงๅฎ่กใใใใจใซใชใใพใ:
+
+```bash
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+ใชใใฉใคใณใคใณในใฟใณในใงใใฎๅใใใญใฐใฉใ ใๅฎ่กใใพใ:
+
+```bash
+HF_DATASETS_OFFLINE=1 HF_HUB_OFFLINE=1 \
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+ใใฎในใฏใชใใใฏใใญใผใซใซใใกใคใซใฎใฟใๆค็ดขใใใใจใๅใใฃใฆใใใฎใงใใใณใฐใขใใใใใใฟใคใ ใขใฆใใๅพ
ใฃใใใใใใจใชใๅฎ่กใใใใฏใใงใใ
+
+### ใชใใฉใคใณใงไฝฟ็จใใใใใซใขใใซใใใผใฏใใคใถใผใๅๅพใใ
+
+ใชใใฉใคใณใง๐ค Transformersใไฝฟ็จใใใใ1ใคใฎๆนๆณใฏใๅใใฃใฆใใกใคใซใใใฆใณใญใผใใใฆใใใใชใใฉใคใณใงไฝฟ็จใใๅฟ
่ฆใใใใจใใซใใฎใญใผใซใซใในใๆๅฎใใใใจใงใใใใใซใฏ3ใคใฎๆนๆณใใใใพใ:
+
+* [Model Hub](https://huggingface.co/models)ใฎใฆใผใถใผใคใณใฟใผใใงใผในไธใใโใขใคใณใณใใฏใชใใฏใใฆใใกใคใซใใใฆใณใญใผใใใๆนๆณใ
+
+ 
+
+* [`PreTrainedModel.from_pretrained`]ใใใณ[`PreTrainedModel.save_pretrained`]ใฎใฏใผใฏใใญใผใไฝฟ็จใใๆนๆณ:
+
+ 1. [`PreTrainedModel.from_pretrained`]ใงๅใใฃใฆใใกใคใซใใใฆใณใญใผใใใพใ:
+
+ ```py
+ >>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("bigscience/T0_3B")
+ >>> model = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0_3B")
+ ```
+
+ 2. [`PreTrainedModel.save_pretrained`]ใงๆๅฎใใใใใฃใฌใฏใใชใซใใกใคใซใไฟๅญใใฆใใใพใ:
+
+ ```py
+ >>> tokenizer.save_pretrained("./your/path/bigscience_t0")
+ >>> model.save_pretrained("./your/path/bigscience_t0")
+ ```
+
+ 3. ใชใใฉใคใณใซใใๆใ[`PreTrainedModel.from_pretrained`]ใซๆๅฎใใใใฃใฌใฏใใชใใใใกใคใซใใชใญใผใใใพใ:
+
+ ```py
+ >>> tokenizer = AutoTokenizer.from_pretrained("./your/path/bigscience_t0")
+ >>> model = AutoModel.from_pretrained("./your/path/bigscience_t0")
+ ```
+
+* ใใญใฐใฉใ ็ใซ[huggingface_hub](https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub)ใฉใคใใฉใชใ็จใใฆใใใกใคใซใใใฆใณใญใผใใใๆนๆณ:
+
+ 1. ไปฎๆณ็ฐๅขใซ`huggingface_hub`ใฉใคใใฉใชใใคใณในใใผใซใใพใ:
+
+ ```bash
+ python -m pip install huggingface_hub
+ ```
+
+ 2. ๆๅฎใฎใในใซใใกใคใซใใใฆใณใญใผใใใใใใซใ[`hf_hub_download`](https://huggingface.co/docs/hub/adding-a-library#download-files-from-the-hub)้ขๆฐใไฝฟ็จใใพใใไพใใฐใไปฅไธใฎใณใใณใใงใ[T0](https://huggingface.co/bigscience/T0_3B)ใขใใซใฎ`config.json`ใใกใคใซใๆๅฎใฎใในใซใใฆใณใญใผใใงใใพใ:
+
+ ```py
+ >>> from huggingface_hub import hf_hub_download
+
+ >>> hf_hub_download(repo_id="bigscience/T0_3B", filename="config.json", cache_dir="./your/path/bigscience_t0")
+ ```
+
+ใใกใคใซใใใฆใณใญใผใใใใใญใผใซใซใซใญใฃใใทใฅใใใใใใใฎใญใผใซใซใในใๆๅฎใใฆใใกใคใซใใญใผใใใฆไฝฟ็จใใพใ:
+
+```py
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("./your/path/bigscience_t0/config.json")
+```
+
+
+
+Hubใซไฟๅญใใใฆใใใใกใคใซใใใฆใณใญใผใใใๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใ[How to download files from the Hub](https://huggingface.co/docs/hub/how-to-downstream)ใปใฏใทใงใณใๅ็
งใใฆใใ ใใใ
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/audio_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/audio_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..967c716cd2f93ce104c4f6ebcedc97a9bee79963
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/audio_utils.md
@@ -0,0 +1,39 @@
+
+
+# `FeatureExtractor` ็จใฎใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใ*็ญๆ้ใใผใชใจๅคๆ* ใ *ใญใฐ ใกใซ ในใใฏใใญใฐใฉใ * ใชใฉใฎไธ่ฌ็ใชใขใซใดใชใบใ ใไฝฟ็จใใฆ็ใฎใชใผใใฃใชใใ็นๅฅใช็นๅพดใ่จ็ฎใใใใใซใใชใผใใฃใช [`FeatureExtractor`] ใงไฝฟ็จใงใใใในใฆใฎใฆใผใใฃใชใใฃ้ขๆฐใใชในใใใใฆใใพใใ
+
+ใใใใฎใปใจใใฉใฏใใฉใคใใฉใชๅ
ใฎใชใผใใฃใช ใใญใปใใตใฎใณใผใใๅญฆ็ฟใใๅ ดๅใซใฎใฟๅฝนใซ็ซใกใพใใ
+
+## ใชใผใใฃใชๅคๆ
+
+[[autodoc]] audio_utils.hertz_to_mel
+
+[[autodoc]] audio_utils.mel_to_hertz
+
+[[autodoc]] audio_utils.mel_filter_bank
+
+[[autodoc]] audio_utils.optimal_fft_length
+
+[[autodoc]] audio_utils.window_function
+
+[[autodoc]] audio_utils.spectrogram
+
+[[autodoc]] audio_utils.power_to_db
+
+[[autodoc]] audio_utils.amplitude_to_db
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/file_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/file_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..51a025bfc67f17f6b463294a04ba7f6111d9e77e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/file_utils.md
@@ -0,0 +1,49 @@
+
+
+# ไธ่ฌ็ใชใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใใใกใคใซ `utils.py` ใซใใ Transformers ใฎไธ่ฌ็ใชใฆใผใใฃใชใใฃ้ขๆฐใใในใฆใชในใใใใฆใใพใใ
+
+ใใใใฎใปใจใใฉใฏใใฉใคใใฉใชใงไธ่ฌ็ใชใณใผใใๅญฆ็ฟใใๅ ดๅใซใฎใฟๅฝนใซ็ซใกใพใใ
+
+## ๅๆๅใจๅๅไปใใฟใใซ
+
+[[autodoc]] utils.ExplicitEnum
+
+[[autodoc]] utils.PaddingStrategy
+
+[[autodoc]] utils.TensorType
+
+## ็นๅฅใชใใณใฌใผใฟใผ
+
+[[autodoc]] utils.add_start_docstrings
+
+[[autodoc]] utils.add_start_docstrings_to_model_forward
+
+[[autodoc]] utils.add_end_docstrings
+
+[[autodoc]] utils.add_code_sample_docstrings
+
+[[autodoc]] utils.replace_return_docstrings
+
+## ็นๆฎใชใใญใใใฃ
+
+[[autodoc]] utils.cached_property
+
+## ใใฎไปใฎใฆใผใใฃใชใใฃ
+
+[[autodoc]] utils._LazyModule
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/generation_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/generation_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..1a5cc1dec079584f471ff3179c868971957ac855
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/generation_utils.md
@@ -0,0 +1,336 @@
+
+
+# ็บ้ป็จใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใ[`~generation.GenerationMixin.generate`] ใงไฝฟ็จใใใใในใฆใฎใฆใผใใฃใชใใฃ้ขๆฐใใชในใใใใฆใใพใใ
+
+## ๅบๅใ็ๆใใ
+
+[`~generation.GenerationMixin.generate`] ใฎๅบๅใฏใๆฌกใฎใตใใฏใฉในใฎใคใณในใฟใณในใงใใ
+[`~utils.ModelOutput`]ใใใฎๅบๅใฏใ่ฟใใใใในใฆใฎๆ
ๅ ฑใๅซใใใผใฟๆง้ ใงใใ
+[`~generation.GenerationMixin.generate`] ใซใใฃใฆไฝๆใใใพใใใใฟใใซใพใใฏ่พๆธใจใใฆใไฝฟ็จใงใใพใใ
+
+ไปฅไธใซไพใ็คบใใพใใ
+
+```python
+from transformers import GPT2Tokenizer, GPT2LMHeadModel
+
+tokenizer = GPT2Tokenizer.from_pretrained("openai-community/gpt2")
+model = GPT2LMHeadModel.from_pretrained("openai-community/gpt2")
+
+inputs = tokenizer("Hello, my dog is cute and ", return_tensors="pt")
+generation_output = model.generate(**inputs, return_dict_in_generate=True, output_scores=True)
+```
+
+`generation_output` ใชใใธใงใฏใใฏใใงใใ้ใ [`~generation.GenerateDecoderOnlyOutput`] ใงใใ
+ไปฅไธใฎใใฎใฏใฉในใฎใใญใฅใกใณใใๅ็
งใใฆใใ ใใใใใใฏใๆฌกใฎๅฑๆงใใใใใจใๆๅณใใพใใ
+
+- `sequences`: ็ๆใใใใใผใฏใณใฎใทใผใฑใณใน
+- `scores` (ใชใใทใงใณ): ๅ็ๆในใใใใฎ่จ่ชใขใใชใณใฐ ใใใใฎไบๆธฌในใณใข
+- `hidden_โโstates` (ใชใใทใงใณ): ็ๆในใใใใใจใฎใขใใซใฎ้ ใใ็ถๆ
+- `attentions` (ใชใใทใงใณ): ็ๆในใใใใใจใฎใขใใซใฎใขใใณใทใงใณใฎ้ใฟ
+
+ใใใงใฏใ`output_scores=True`ใๆธกใใใฎใง `scores` ใใใใพใใใ`hidden_โโstates` ใฏใใใพใใใ
+`attentions` ใฏใ`output_hidden_โโstates=True`ใพใใฏ`output_attentions=True`ใๆธกใใชใใฃใใใใงใใ
+
+้ๅธธใจๅใใใใซๅๅฑๆงใซใขใฏใปในใงใใพใใใใฎๅฑๆงใใขใใซใใ่ฟใใใชใใฃใๅ ดๅใฏใ
+ใฏใใชใใใๅๅพใใพใใใใใงใใใจใใฐ`generation_output.scores`ใฏใ็ๆใใใใในใฆใฎไบๆธฌในใณใขใงใใ
+่จ่ชใขใใชใณใฐใฎใใใใงใใใ`generation_output.attentions`ใฏ`None`ใงใใ
+
+`generation_output` ใชใใธใงใฏใใใฟใใซใจใใฆไฝฟ็จใใๅ ดๅใ`None` ๅคใๆใใชใๅฑๆงใฎใฟใไฟๆใใใพใใ
+ใใจใใฐใใใใซใฏ 2 ใคใฎ่ฆ็ด ใ`loss`ใๆฌกใซ`logits`ใใใใพใใ
+
+```python
+generation_output[:2]
+```
+
+ใใจใใฐใใฟใใซ `(generation_output.sequences,generation_output.scores)` ใ่ฟใใพใใ
+
+`generation_output` ใชใใธใงใฏใใ่พๆธใจใใฆไฝฟ็จใใๅ ดๅใ`None` ใๆใใชใๅฑๆงใฎใฟใไฟๆใใใพใใ
+ใใใงใฏใใใจใใฐใ`sequences`ใจ`scores`ใจใใ 2 ใคใฎใญใผใใใใพใใ
+
+ใใใงใฏใในใฆใฎๅบๅใฟใคใใๆๆธๅใใพใใ
+
+### PyTorch
+
+[[autodoc]] generation.GenerateDecoderOnlyOutput
+
+[[autodoc]] generation.GenerateEncoderDecoderOutput
+
+[[autodoc]] generation.GenerateBeamDecoderOnlyOutput
+
+[[autodoc]] generation.GenerateBeamEncoderDecoderOutput
+
+### TensorFlow
+
+[[autodoc]] generation.TFGreedySearchEncoderDecoderOutput
+
+[[autodoc]] generation.TFGreedySearchDecoderOnlyOutput
+
+[[autodoc]] generation.TFSampleEncoderDecoderOutput
+
+[[autodoc]] generation.TFSampleDecoderOnlyOutput
+
+[[autodoc]] generation.TFBeamSearchEncoderDecoderOutput
+
+[[autodoc]] generation.TFBeamSearchDecoderOnlyOutput
+
+[[autodoc]] generation.TFBeamSampleEncoderDecoderOutput
+
+[[autodoc]] generation.TFBeamSampleDecoderOnlyOutput
+
+[[autodoc]] generation.TFContrastiveSearchEncoderDecoderOutput
+
+[[autodoc]] generation.TFContrastiveSearchDecoderOnlyOutput
+
+### FLAX
+
+[[autodoc]] generation.FlaxSampleOutput
+
+[[autodoc]] generation.FlaxGreedySearchOutput
+
+[[autodoc]] generation.FlaxBeamSearchOutput
+
+## LogitsProcessor
+
+[`LogitsProcessor`] ใไฝฟ็จใใฆใ่จ่ชใขใใซใฎใใใใฎไบๆธฌในใณใขใๅคๆดใงใใพใใ
+ไธไปฃใ
+
+### PyTorch
+
+[[autodoc]] AlternatingCodebooksLogitsProcessor
+ - __call__
+
+[[autodoc]] ClassifierFreeGuidanceLogitsProcessor
+ - __call__
+
+[[autodoc]] EncoderNoRepeatNGramLogitsProcessor
+ - __call__
+
+[[autodoc]] EncoderRepetitionPenaltyLogitsProcessor
+ - __call__
+
+[[autodoc]] EpsilonLogitsWarper
+ - __call__
+
+[[autodoc]] EtaLogitsWarper
+ - __call__
+
+[[autodoc]] ExponentialDecayLengthPenalty
+ - __call__
+
+[[autodoc]] ForcedBOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] ForcedEOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] HammingDiversityLogitsProcessor
+ - __call__
+
+[[autodoc]] InfNanRemoveLogitsProcessor
+ - __call__
+
+[[autodoc]] LogitNormalization
+ - __call__
+
+[[autodoc]] LogitsProcessor
+ - __call__
+
+[[autodoc]] LogitsProcessorList
+ - __call__
+
+[[autodoc]] MinLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] MinNewTokensLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] NoBadWordsLogitsProcessor
+ - __call__
+
+[[autodoc]] NoRepeatNGramLogitsProcessor
+ - __call__
+
+[[autodoc]] PrefixConstrainedLogitsProcessor
+ - __call__
+
+[[autodoc]] RepetitionPenaltyLogitsProcessor
+ - __call__
+
+[[autodoc]] SequenceBiasLogitsProcessor
+ - __call__
+
+[[autodoc]] SuppressTokensAtBeginLogitsProcessor
+ - __call__
+
+[[autodoc]] SuppressTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] TemperatureLogitsWarper
+ - __call__
+
+[[autodoc]] TopKLogitsWarper
+ - __call__
+
+[[autodoc]] TopPLogitsWarper
+ - __call__
+
+[[autodoc]] TypicalLogitsWarper
+ - __call__
+
+[[autodoc]] UnbatchedClassifierFreeGuidanceLogitsProcessor
+ - __call__
+
+[[autodoc]] WhisperTimeStampLogitsProcessor
+ - __call__
+
+### TensorFlow
+
+[[autodoc]] TFForcedBOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] TFForcedEOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] TFForceTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] TFLogitsProcessor
+ - __call__
+
+[[autodoc]] TFLogitsProcessorList
+ - __call__
+
+[[autodoc]] TFLogitsWarper
+ - __call__
+
+[[autodoc]] TFMinLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] TFNoBadWordsLogitsProcessor
+ - __call__
+
+[[autodoc]] TFNoRepeatNGramLogitsProcessor
+ - __call__
+
+[[autodoc]] TFRepetitionPenaltyLogitsProcessor
+ - __call__
+
+[[autodoc]] TFSuppressTokensAtBeginLogitsProcessor
+ - __call__
+
+[[autodoc]] TFSuppressTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] TFTemperatureLogitsWarper
+ - __call__
+
+[[autodoc]] TFTopKLogitsWarper
+ - __call__
+
+[[autodoc]] TFTopPLogitsWarper
+ - __call__
+
+### FLAX
+
+[[autodoc]] FlaxForcedBOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxForcedEOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxForceTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxLogitsProcessorList
+ - __call__
+
+[[autodoc]] FlaxLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxMinLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxSuppressTokensAtBeginLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxSuppressTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxTemperatureLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxTopKLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxTopPLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxWhisperTimeStampLogitsProcessor
+ - __call__
+
+## StoppingCriteria
+
+[`StoppingCriteria`] ใไฝฟ็จใใฆใ(EOS ใใผใฏใณไปฅๅคใฎ) ็ๆใๅๆญขใใใฟใคใใณใฐใๅคๆดใงใใพใใใใใฏ PyTorch ๅฎ่ฃ
ใงใฎใฟๅฉ็จๅฏ่ฝใงใใใใจใซๆณจๆใใฆใใ ใใใ
+
+[[autodoc]] StoppingCriteria
+ - __call__
+
+[[autodoc]] StoppingCriteriaList
+ - __call__
+
+[[autodoc]] MaxLengthCriteria
+ - __call__
+
+[[autodoc]] MaxTimeCriteria
+ - __call__
+
+## Constraints
+
+[`Constraint`] ใไฝฟ็จใใใจใ็ๆๆใซๅบๅใซ็นๅฎใฎใใผใฏใณใพใใฏใทใผใฑใณในใๅซใพใใใใใซๅผทๅถใงใใพใใใใใฏ PyTorch ๅฎ่ฃ
ใงใฎใฟๅฉ็จๅฏ่ฝใงใใใใจใซๆณจๆใใฆใใ ใใใ
+
+[[autodoc]] Constraint
+
+[[autodoc]] PhrasalConstraint
+
+[[autodoc]] DisjunctiveConstraint
+
+[[autodoc]] ConstraintListState
+
+## BeamSearch
+
+[[autodoc]] BeamScorer
+ - process
+ - finalize
+
+[[autodoc]] BeamSearchScorer
+ - process
+ - finalize
+
+[[autodoc]] ConstrainedBeamSearchScorer
+ - process
+ - finalize
+
+## Streamers
+
+[[autodoc]] TextStreamer
+
+[[autodoc]] TextIteratorStreamer
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/image_processing_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/image_processing_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..917f86875f481260c0d86c32f8ef25bc6b129d2a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/image_processing_utils.md
@@ -0,0 +1,48 @@
+
+
+# ็ปๅใใญใปใใต็จใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใ็ปๅใใญใปใใตใผใงไฝฟ็จใใใใในใฆใฎใฆใผใใฃใชใใฃใผ้ขๆฐใใชในใใใใฆใใพใใไธปใซๆฉ่ฝ็ใชใใฎใงใใ
+็ปๅใๅฆ็ใใใใใซไฝฟ็จใใใๅคๆใ
+
+ใใใใฎใปใจใใฉใฏใใฉใคใใฉใชๅ
ใฎ็ปๅใใญใปใใตใฎใณใผใใๅญฆ็ฟใใๅ ดๅใซใฎใฟๅฝนใซ็ซใกใพใใ
+
+## Image Transformations
+
+[[autodoc]] image_transforms.center_crop
+
+[[autodoc]] image_transforms.center_to_corners_format
+
+[[autodoc]] image_transforms.corners_to_center_format
+
+[[autodoc]] image_transforms.id_to_rgb
+
+[[autodoc]] image_transforms.normalize
+
+[[autodoc]] image_transforms.pad
+
+[[autodoc]] image_transforms.rgb_to_id
+
+[[autodoc]] image_transforms.rescale
+
+[[autodoc]] image_transforms.resize
+
+[[autodoc]] image_transforms.to_pil_image
+
+## ImageProcessingMixin
+
+[[autodoc]] image_processing_utils.ImageProcessingMixin
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/modeling_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/modeling_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..62aa2040c8a258cf889a5fbb2f332be2fdaf4bdb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/modeling_utils.md
@@ -0,0 +1,83 @@
+
+
+# ใซในใฟใ ใฌใคใคใผใจใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใใฉใคใใฉใชใงไฝฟ็จใใใใในใฆใฎใซในใฟใ ใฌใคใคใผใจใใขใใชใณใฐใซๆไพใใใใฆใผใใฃใชใใฃ้ขๆฐใใชในใใใใพใใ
+
+ใใใใฎใปใจใใฉใฏใใฉใคใใฉใชๅ
ใฎใขใใซใฎใณใผใใ็ ็ฉถใใๅ ดๅใซใฎใฟๅฝนใซ็ซใกใพใใ
+
+
+## Pytorch custom modules
+
+[[autodoc]] pytorch_utils.Conv1D
+
+[[autodoc]] modeling_utils.PoolerStartLogits
+ - forward
+
+[[autodoc]] modeling_utils.PoolerEndLogits
+ - forward
+
+[[autodoc]] modeling_utils.PoolerAnswerClass
+ - forward
+
+[[autodoc]] modeling_utils.SquadHeadOutput
+
+[[autodoc]] modeling_utils.SQuADHead
+ - forward
+
+[[autodoc]] modeling_utils.SequenceSummary
+ - forward
+
+## PyTorch Helper Functions
+
+[[autodoc]] pytorch_utils.apply_chunking_to_forward
+
+[[autodoc]] pytorch_utils.find_pruneable_heads_and_indices
+
+[[autodoc]] pytorch_utils.prune_layer
+
+[[autodoc]] pytorch_utils.prune_conv1d_layer
+
+[[autodoc]] pytorch_utils.prune_linear_layer
+
+## TensorFlow custom layers
+
+[[autodoc]] modeling_tf_utils.TFConv1D
+
+[[autodoc]] modeling_tf_utils.TFSequenceSummary
+
+## TensorFlow loss functions
+
+[[autodoc]] modeling_tf_utils.TFCausalLanguageModelingLoss
+
+[[autodoc]] modeling_tf_utils.TFMaskedLanguageModelingLoss
+
+[[autodoc]] modeling_tf_utils.TFMultipleChoiceLoss
+
+[[autodoc]] modeling_tf_utils.TFQuestionAnsweringLoss
+
+[[autodoc]] modeling_tf_utils.TFSequenceClassificationLoss
+
+[[autodoc]] modeling_tf_utils.TFTokenClassificationLoss
+
+## TensorFlow Helper Functions
+
+[[autodoc]] modeling_tf_utils.get_initializer
+
+[[autodoc]] modeling_tf_utils.keras_serializable
+
+[[autodoc]] modeling_tf_utils.shape_list
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/pipelines_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/pipelines_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..833c98c4d0dc18cab391e620cea02a4d5a041a9b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/pipelines_utils.md
@@ -0,0 +1,44 @@
+
+
+# ใใคใใฉใคใณ็จใฎใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใใฉใคใใฉใชใใใคใใฉใคใณใซๆไพใใใในใฆใฎใฆใผใใฃใชใใฃ้ขๆฐใใชในใใใใพใใ
+
+ใใใใฎใปใจใใฉใฏใใฉใคใใฉใชๅ
ใฎใขใใซใฎใณใผใใ็ ็ฉถใใๅ ดๅใซใฎใฟๅฝนใซ็ซใกใพใใ
+
+
+## Argument handling
+
+[[autodoc]] pipelines.ArgumentHandler
+
+[[autodoc]] pipelines.ZeroShotClassificationArgumentHandler
+
+[[autodoc]] pipelines.QuestionAnsweringArgumentHandler
+
+## Data format
+
+[[autodoc]] pipelines.PipelineDataFormat
+
+[[autodoc]] pipelines.CsvPipelineDataFormat
+
+[[autodoc]] pipelines.JsonPipelineDataFormat
+
+[[autodoc]] pipelines.PipedPipelineDataFormat
+
+## Utilities
+
+[[autodoc]] pipelines.PipelineException
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/time_series_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/time_series_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..9355ea090e14584b32f67e61a84f185cc1bc5821
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/time_series_utils.md
@@ -0,0 +1,29 @@
+
+
+# ๆ็ณปๅใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใๆ็ณปๅใใผในใฎใขใใซใซไฝฟ็จใงใใใในใฆใฎใฆใผใใฃใชใใฃ้ขๆฐใจใฏใฉในใใชในใใใใพใใ
+
+ใใใใฎใปใจใใฉใฏใๆ็ณปๅใขใใซใฎใณใผใใ็ ็ฉถใใฆใใๅ ดๅใใพใใฏๅๆฃๅบๅใฏใฉในใฎใณใฌใฏใทใงใณใซ่ฟฝๅ ใใใๅ ดๅใซใฎใฟๅฝน็ซใกใพใใ
+
+## Distributional Output
+
+[[autodoc]] time_series_utils.NormalOutput
+
+[[autodoc]] time_series_utils.StudentTOutput
+
+[[autodoc]] time_series_utils.NegativeBinomialOutput
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/tokenization_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/tokenization_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..8e36e4149e278415d7a11e7195234ea2e2bfaa04
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/tokenization_utils.md
@@ -0,0 +1,42 @@
+
+
+# Utilities for Tokenizers
+
+ใใฎใใผใธใซใฏใใใผใฏใใคใถใผใซใใฃใฆไฝฟ็จใใใใในใฆใฎใฆใผใใฃใชใใฃ้ขๆฐ (ไธปใซใฏใฉใน) ใใชในใใใใพใใ
+[`~tokenization_utils_base.PreTrainedTokenizerBase`] ้ใฎๅ
ฑ้ใกใฝใใใๅฎ่ฃ
ใใพใใ
+[`PreTrainedTokenizer`] ใจ [`PreTrainedTokenizerFast`] ใใใณใใใฏในใคใณ
+[`~tokenization_utils_base.SpecialTokensMixin`]ใ
+
+ใใใใฎใปใจใใฉใฏใใฉใคใใฉใชๅ
ใฎใใผใฏใใคใถใผใฎใณใผใใๅญฆ็ฟใใๅ ดๅใซใฎใฟๅฝนใซ็ซใกใพใใ
+
+## PreTrainedTokenizerBase
+
+[[autodoc]] tokenization_utils_base.PreTrainedTokenizerBase
+ - __call__
+ - all
+
+## SpecialTokensMixin
+
+[[autodoc]] tokenization_utils_base.SpecialTokensMixin
+
+## Enums and namedtuples
+
+[[autodoc]] tokenization_utils_base.TruncationStrategy
+
+[[autodoc]] tokenization_utils_base.CharSpan
+
+[[autodoc]] tokenization_utils_base.TokenSpan
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/trainer_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/trainer_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..dddfc7dc55ee12827447217f0e65e53dac0652e7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/internal/trainer_utils.md
@@ -0,0 +1,49 @@
+
+
+# ใใฌใผใใผ็จใฆใผใใฃใชใใฃ
+
+ใใฎใใผใธใซใฏใ[`Trainer`] ใงไฝฟ็จใใใใในใฆใฎใฆใผใใฃใชใใฃ้ขๆฐใใชในใใใใฆใใพใใ
+
+ใใใใฎใปใจใใฉใฏใใฉใคใใฉใชๅ
ใฎใใฌใผใใผใฎใณใผใใๅญฆ็ฟใใๅ ดๅใซใฎใฟๅฝนใซ็ซใกใพใใ
+
+## Utilities
+
+[[autodoc]] EvalPrediction
+
+[[autodoc]] IntervalStrategy
+
+[[autodoc]] enable_full_determinism
+
+[[autodoc]] set_seed
+
+[[autodoc]] torch_distributed_zero_first
+
+## Callbacks internals
+
+[[autodoc]] trainer_callback.CallbackHandler
+
+## Distributed Evaluation
+
+[[autodoc]] trainer_pt_utils.DistributedTensorGatherer
+
+## Trainer Argument Parser
+
+[[autodoc]] HfArgumentParser
+
+## Debug Utilities
+
+[[autodoc]] debug_utils.DebugUnderflowOverflow
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/llm_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/llm_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..156a2423eedc79cc7dc88dea1b42f1204e335329
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/llm_tutorial.md
@@ -0,0 +1,223 @@
+
+
+# Generation with LLMs
+
+[[open-in-colab]]
+
+LLMใใพใใฏLarge Language Models๏ผๅคง่ฆๆจก่จ่ชใขใใซ๏ผใฏใใใญในใ็ๆใฎ้ตใจใชใ่ฆ็ด ใงใใ่ฆใใใซใใใใใฏๅคง่ฆๆจกใชไบๅ่จ็ทดๆธใฟใใฉใณในใใฉใผใใผใขใใซใงใไธใใใใๅ
ฅๅใใญในใใซๅบใฅใใฆๆฌกใฎๅ่ช๏ผใพใใฏใใใๆญฃ็ขบใซใฏใใผใฏใณ๏ผใไบๆธฌใใใใใซ่จ็ทดใใใฆใใพใใใใผใฏใณใ1ใคใใคไบๆธฌใใใใใใขใใซใๅผใณๅบใใ ใใงใฏๆฐใใๆใ็ๆใใใใใซไฝใใใ็ฒพๅทงใชใใจใใใๅฟ
่ฆใใใใพใใ่ชๅทฑๅๅธฐ็ๆใ่กใๅฟ
่ฆใใใใพใใ
+
+่ชๅทฑๅๅธฐ็ๆใฏใๆจ่ซๆใฎๆ็ถใใงใใใใคใใฎๅๆๅ
ฅๅใไธใใ็ถๆ
ใงใใขใใซใๅๅพฉ็ใซๅผใณๅบใๆๆณใงใใ๐ค Transformersใงใฏใใใใฏ[`~generation.GenerationMixin.generate`]ใกใฝใใใซใใฃใฆๅฆ็ใใใใใใฏ็ๆ่ฝๅใๆใคใในใฆใฎใขใใซใงๅฉ็จๅฏ่ฝใงใใ
+
+ใใฎใใฅใผใใชใขใซใงใฏใไปฅไธใฎใใจใ็คบใใพใ๏ผ
+
+* LLMใไฝฟ็จใใฆใใญในใใ็ๆใใๆนๆณ
+* ไธ่ฌ็ใช่ฝใจใ็ฉดใๅ้ฟใใๆนๆณ
+* LLMใๆๅคง้ใซๆดป็จใใใใใฎๆฌกใฎในใใใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใ๏ผ
+
+
+```bash
+pip install transformers bitsandbytes>=0.39.0 -q
+```
+
+## Generate text
+
+[ๅ ๆ่จ่ชใขใใชใณใฐ](tasks/language_modeling)ใฎใใใซใใฌใผใใณใฐใใใ่จ่ชใขใใซใฏใใใญในใใใผใฏใณใฎใทใผใฑใณในใๅ
ฅๅใจใใฆๅใๅใใๆฌกใฎใใผใฏใณใฎ็ขบ็ๅๅธใ่ฟใใพใใ
+
+
+
+
+ "Forward pass of an LLM"
+
+
+
+LLM๏ผLanguage Model๏ผใซใใ่ชๅทฑๅๅธฐ็ๆใฎ้่ฆใชๅด้ขใฎ1ใคใฏใใใฎ็ขบ็ๅๅธใใๆฌกใฎใใผใฏใณใ้ธๆใใๆนๆณใงใใใใฎในใใใใงใฏใๆฌกใฎใคใใฌใผใทใงใณใฎใใใฎใใผใฏใณใๅพใใใ้ใใไฝใงใๅฏ่ฝใงใใใใใฏใ็ขบ็ๅๅธใใๆใๅฏ่ฝๆงใฎ้ซใใใผใฏใณใ้ธๆใใใ ใใฎใทใณใใซใชๆนๆณใใใ็ตๆใฎๅๅธใใใตใณใใชใณใฐใใๅใซๆฐใ
ใฎๅคๆใ้ฉ็จใใใปใฉ่ค้ใชๆนๆณใพใงใใใใใๆนๆณใ่ใใใใพใใ
+
+
+
+
+
+ "Autoregressive generation iteratively selects the next token from a probability distribution to generate text"
+
+
+ไธ่จใฎใใญใปในใฏใใใๅๆญขๆกไปถใๆบใใใใใพใงๅๅพฉ็ใซ็นฐใ่ฟใใใพใใ็ๆณ็ใซใฏใๅๆญขๆกไปถใฏใขใใซใซใใฃใฆๆ็คบใใใใขใใซใฏ็ตไบใทใผใฑใณใน๏ผ`EOS`๏ผใใผใฏใณใๅบๅใใใฟใคใใณใฐใๅญฆ็ฟใในใใงใใใใใใใใงใชใๅ ดๅใ็ๆใฏใใใใใๅฎ็พฉใใใๆๅคง้ทใซ้ใใใจใใซๅๆญขใใพใใ
+
+ใใผใฏใณ้ธๆในใใใใจๅๆญขๆกไปถใ้ฉๅใซ่จญๅฎใใใใจใฏใใขใใซใใฟในใฏใงๆๅพ
ใฉใใใซๆฏใ่ใใใใซ้่ฆใงใใใใใใๅใขใใซใซ้ข้ฃไปใใใใ [`~generation.GenerationConfig`] ใใกใคใซใใใ็็ฑใงใใใใใใซใฏๅชใใใใใฉใซใใฎ็ๆใใฉใกใผใฟๅใๅซใพใใใขใใซใจไธ็ทใซ่ชญใฟ่พผใพใใพใใ
+
+ใณใผใใซใคใใฆ่ฉฑใใพใใใ๏ผ
+
+
+
+ๅบๆฌ็ใชLLMใฎไฝฟ็จใซ่ๅณใใใๅ ดๅใ้ซใฌใใซใฎ [`Pipeline`](pipeline_tutorial) ใคใณใฟใผใใงใผในใ่ฏใๅบ็บ็นใงใใใใ ใใLLMใฏใใฐใใฐ้ๅญๅใใใผใฏใณ้ธๆในใใใใฎ็ดฐใใๅถๅพกใชใฉใฎ้ซๅบฆใชๆฉ่ฝใๅฟ
่ฆใงใใใใใใฏ [`~generation.GenerationMixin.generate`] ใไปใใฆๆ่ฏใซ่กใใใพใใLLMใจใฎ่ชๅทฑๅๅธฐ็ๆใฏใชใฝใผในใๅคใๅฟ
่ฆใงใใใ้ฉๅใชในใซใผใใใใฎใใใซGPUใงๅฎ่กใใๅฟ
่ฆใใใใพใใ
+
+
+
+
+ใพใใใขใใซใ่ชญใฟ่พผใๅฟ
่ฆใใใใพใใ
+
+
+```py
+>>> from transformers import AutoModelForCausalLM
+
+>>> model = AutoModelForCausalLM.from_pretrained(
+... "openlm-research/open_llama_7b", device_map="auto", load_in_4bit=True
+... )
+```
+
+`from_pretrained` ๅผใณๅบใใง2ใคใฎใใฉใฐใใใใใจใซๆณจๆใใฆใใ ใใ๏ผ
+
+- `device_map` ใฏใขใใซใใใชใใฎGPUใซ็งปๅใใใพใ
+- `load_in_4bit` ใฏ[4ใใใใฎๅ็้ๅญๅ](main_classes/quantization)ใ้ฉ็จใใฆใชใฝใผใน่ฆไปถใๅคงๅน
ใซๅๆธใใพใ
+
+ใขใใซใๅๆๅใใไปใฎๆนๆณใใใใพใใใใใใฏLLMใๅงใใใใใฎ่ฏใๅบๆบใงใใ
+
+ๆฌกใซใ[ใใผใฏใใคใถ](tokenizer_summary)ใไฝฟ็จใใฆใใญในใๅ
ฅๅใๅๅฆ็ใใๅฟ
่ฆใใใใพใใ
+
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("openlm-research/open_llama_7b")
+>>> model_inputs = tokenizer(["A list of colors: red, blue"], return_tensors="pt").to("cuda")
+```
+
+
+`model_inputs` ๅคๆฐใฏใใใผใฏใณๅใใใใใญในใๅ
ฅๅใจใขใใณใทใงใณใในใฏใไฟๆใใฆใใพใใ [`~generation.GenerationMixin.generate`] ใฏใใขใใณใทใงใณใในใฏใๆธกใใใฆใใชใๅ ดๅใงใใๆๅใฎๅชๅใใใฆใใใๆจๆธฌใใใใจใใพใใใใงใใ้ใๆธกใใใจใใๅงใใใพใใๆ้ฉใช็ตๆใๅพใใใใงใใ
+
+ๆๅพใซใ[`~generation.GenerationMixin.generate`] ใกใฝใใใๅผใณๅบใใฆ็ๆใใใใใผใฏใณใๅๅพใใใใใ่กจ็คบใใๅใซใใญในใใซๅคๆใใๅฟ
่ฆใใใใพใใ
+
+
+```py
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'A list of colors: red, blue, green, yellow, black, white, and brown'
+```
+
+ใใใงๅฎไบใงใ๏ผใใใใชใณใผใ่กๆฐใงใLLM๏ผLarge Language Model๏ผใฎใใฏใผใๆดป็จใงใใพใใ
+
+## Common pitfalls
+
+[็ๆๆฆ็ฅ](generation_strategies)ใฏใใใใใใใใใใฉใซใใฎๅคใใใชใใฎใฆใผในใฑใผในใซ้ฉใใฆใใชใใใจใใใใพใใๅบๅใๆๅพ
้ใใงใชใๅ ดๅใๆใไธ่ฌ็ใช่ฝใจใ็ฉดใจใใฎๅ้ฟๆนๆณใฎใชในใใไฝๆใใพใใใ
+
+```py
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("openlm-research/open_llama_7b")
+>>> tokenizer.pad_token = tokenizer.eos_token # Llama has no pad token by default
+>>> model = AutoModelForCausalLM.from_pretrained(
+... "openlm-research/open_llama_7b", device_map="auto", load_in_4bit=True
+... )
+```
+
+### Generated output is too short/long
+
+[`~generation.GenerationConfig`] ใใกใคใซใงๆๅฎใใใฆใใชใๅ ดๅใ`generate` ใฏใใใฉใซใใงๆๅคงใง 20 ใใผใฏใณใพใง่ฟใใพใใๆใ
ใฏ `generate` ใณใผใซใง `max_new_tokens` ใๆๅใง่จญๅฎใใใใจใๅผทใใๅงใใใพใใใใใซใใใ่ฟใใใๆฐใใใใผใฏใณใฎๆๅคงๆฐใๅถๅพกใงใใพใใLLM๏ผๆญฃ็ขบใซใฏใ[ใใณใผใใผๅฐ็จใขใใซ](https://huggingface.co/learn/nlp-course/chapter1/6?fw=pt)๏ผใๅบๅใฎไธ้จใจใใฆๅ
ฅๅใใญใณใใใ่ฟใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> model_inputs = tokenizer(["A sequence of numbers: 1, 2"], return_tensors="pt").to("cuda")
+
+>>> # By default, the output will contain up to 20 tokens
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'A sequence of numbers: 1, 2, 3, 4, 5'
+
+>>> # Setting `max_new_tokens` allows you to control the maximum length
+>>> generated_ids = model.generate(**model_inputs, max_new_tokens=50)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'A sequence of numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,'
+```
+
+### Incorrect generation mode
+
+ใใใฉใซใใงใฏใ [`~generation.GenerationConfig`] ใใกใคใซใงๆๅฎใใใฆใใชใ้ใใ`generate` ใฏๅใคใใฌใผใทใงใณใงๆใๅฏ่ฝๆงใฎ้ซใใใผใฏใณใ้ธๆใใพใ๏ผ่ฒชๆฌฒใใณใผใใฃใณใฐ๏ผใใฟในใฏใซๅฟใใฆใใใใฏๆใพใใใชใใใจใใใใพใใใใฃใใใใใใใจใใปใคใฎใใใชๅต้ ็ใชใฟในใฏใงใฏใใตใณใใชใณใฐใๆ็ใงใใไธๆนใ้ณๅฃฐใฎ่ปขๅใ็ฟป่จณใฎใใใชๅ
ฅๅใซๅบใฅใใฟในใฏใงใฏใ่ฒชๆฌฒใใณใผใใฃใณใฐใๆ็ใงใใ`do_sample=True` ใงใตใณใใชใณใฐใๆๅนใซใงใใพใใใใฎใใใใฏใซใคใใฆใฎ่ฉณ็ดฐใฏใใใฎ[ใใญใฐใในใ](https://huggingface.co/blog/how-to-generate)ใงๅญฆใถใใจใใงใใพใใ
+
+```py
+>>> # Set seed or reproducibility -- you don't need this unless you want full reproducibility
+>>> from transformers import set_seed
+>>> set_seed(0)
+
+>>> model_inputs = tokenizer(["I am a cat."], return_tensors="pt").to("cuda")
+
+>>> # LLM + greedy decoding = repetitive, boring output
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'I am a cat. I am a cat. I am a cat. I am a cat'
+
+>>> # With sampling, the output becomes more creative!
+>>> generated_ids = model.generate(**model_inputs, do_sample=True)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'I am a cat.\nI just need to be. I am always.\nEvery time'
+```
+
+### Wrong padding side
+
+LLM๏ผLarge Language Models๏ผใฏ[ใใณใผใใผๅฐ็จ](https://huggingface.co/learn/nlp-course/chapter1/6?fw=pt)ใฎใขใผใญใใฏใใฃใงใใใๅ
ฅๅใใญใณใใใ็นฐใ่ฟใๅฆ็ใใใใจใๆๅณใใพใใๅ
ฅๅใๅใ้ทใใงใชใๅ ดๅใใใใใใใใฃใณใฐใใๅฟ
่ฆใใใใพใใLLMใฏใใใใใผใฏใณใใใฎ็ถใใๅญฆ็ฟใใฆใใชใใใใๅ
ฅๅใฏๅทฆใใใฃใณใฐใใๅฟ
่ฆใใใใพใใใพใใ็ๆใซๅฏพใใฆๆณจ็ฎใในใฏใๆธกใๅฟใใชใใใใซใใฆใใ ใใ๏ผ
+
+
+```py
+>>> # The tokenizer initialized above has right-padding active by default: the 1st sequence,
+>>> # which is shorter, has padding on the right side. Generation fails.
+>>> model_inputs = tokenizer(
+... ["1, 2, 3", "A, B, C, D, E"], padding=True, return_tensors="pt"
+... ).to("cuda")
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids[0], skip_special_tokens=True)[0]
+''
+
+>>> # With left-padding, it works as expected!
+>>> tokenizer = AutoTokenizer.from_pretrained("openlm-research/open_llama_7b", padding_side="left")
+>>> tokenizer.pad_token = tokenizer.eos_token # Llama has no pad token by default
+>>> model_inputs = tokenizer(
+... ["1, 2, 3", "A, B, C, D, E"], padding=True, return_tensors="pt"
+... ).to("cuda")
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'1, 2, 3, 4, 5, 6,'
+```
+
+## Further resources
+
+ใชใผใใชใฐใฌใใทใ็ๆใใญใปในใฏๆฏ่ผ็็ฐกๅใงใใใLLMใๆๅคง้ใซๆดป็จใใใใจใฏๅคใใฎ่ฆ็ด ใ็ตกใใใใๆๆฆ็ใช่ฉฆใฟใจใชใใพใใLLMใฎไฝฟ็จใจ็่งฃใใใใซๆทฑใใใใใฎๆฌกใฎในใใใใซใคใใฆใฏไปฅไธใฎใชใฝใผในใใ่ฆงใใ ใใใ
+
+
+### Advanced generate usage
+
+1. [ใฌใคใ](generation_strategies)๏ผ็ฐใชใ็ๆๆนๆณใๅถๅพกใใๆนๆณใ็ๆๆงๆใใกใคใซใฎ่จญๅฎๆนๆณใๅบๅใฎในใใชใผใใณใฐๆนๆณใซใคใใฆใฎใฌใคใ;
+2. [`~generation.GenerationConfig`]ใ[`~generation.GenerationMixin.generate`]ใใใใณ[็ๆ้ข้ฃใฏใฉใน](internal/generation_utils)ใซ้ขใใAPIใชใใกใฌใณในใ
+
+### LLM leaderboards
+
+1. [Open LLM ใชใผใใผใใผใ](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)๏ผใชใผใใณใฝใผในใขใใซใฎๅ่ณชใซ็ฆ็นใๅฝใฆใใชใผใใผใใผใ;
+2. [Open LLM-Perf ใชใผใใผใใผใ](https://huggingface.co/spaces/optimum/llm-perf-leaderboard)๏ผLLMใฎในใซใผใใใใซ็ฆ็นใๅฝใฆใใชใผใใผใใผใใ
+
+### Latency and throughput
+
+1. [ใฌใคใ](main_classes/quantization)๏ผใใคใใใใฏใฏใชใณใฟใคใบใซ้ขใใใฌใคใใใใใซใใใกใขใช่ฆไปถใๅ็ใซๅๆธใใๆนๆณใ็คบใใใฆใใพใใ
+
+### Related libraries
+
+1. [`text-generation-inference`](https://github.com/huggingface/text-generation-inference)๏ผLLM็จใฎๆฌ็ชๅใใตใผใใผ;
+2. [`optimum`](https://github.com/huggingface/optimum)๏ผ็นๅฎใฎใใผใใฆใงใขใใใคในๅใใซๆ้ฉๅใใใ๐ค Transformersใฎๆกๅผตใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/agent.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/agent.md
new file mode 100644
index 0000000000000000000000000000000000000000..cb7f5a992427500724a6ee00150a87ced8a823d4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/agent.md
@@ -0,0 +1,26 @@
+
+
+# ใจใผใธใงใณใใจใใผใซ
+
+
+
+The Agents framework has significantly changed in version v4.41.0.
+This document has been removed as it was referencing an older API.
+
+We eagerly welcome new contributions for the updated API.
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/callback.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/callback.md
new file mode 100644
index 0000000000000000000000000000000000000000..a90044b6cd3769d89cc6fe1898041510d539f6e1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/callback.md
@@ -0,0 +1,135 @@
+
+
+
+# ใณใผใซใใใฏๆฐ
+
+ใณใผใซใใใฏใฏใPyTorch ใฎใใฌใผใใณใฐ ใซใผใใฎๅไฝใใซในใฟใใคใบใงใใใชใใธใงใฏใใงใใ
+ใใฌใผใใณใฐ ใซใผใใๆคๆปใงใใ [`Trainer`] (ใใฎๆฉ่ฝใฏ TensorFlow ใซใฏใพใ ๅฎ่ฃ
ใใใฆใใพใใ)
+็ถๆ
ใ็ขบ่ชใ (้ฒๆใฌใใผใใTensorBoard ใพใใฏไปใฎ ML ใใฉใใใใฉใผใ ใธใฎใญใฐ่จ้ฒใชใฉ)ใๆฑบๅฎใไธใใพใ (ๅๆๆฎต้ใชใฉ)ใ
+ๅๆญขไธญ๏ผใ
+
+ใณใผใซใใใฏใฏใ่ฟใใใ [`TrainerControl`] ใชใใธใงใฏใใ้คใใฐใใ่ชญใฟๅใๅฐ็จใใฎใณใผใ้จๅใงใใ
+ใใฌใผใใณใฐ ใซใผใๅ
ใงใฏไฝใๅคๆดใงใใพใใใใใฌใผใใณใฐ ใซใผใใฎๅคๆดใๅฟ
่ฆใชใซในใฟใใคใบใฎๅ ดๅใฏใๆฌกใฎใใจใ่กใๅฟ
่ฆใใใใพใใ
+[`Trainer`] ใใตใใฏใฉในๅใใๅฟ
่ฆใชใกใฝใใใใชใผใใผใฉใคใใใพใ (ไพใซใคใใฆใฏใ[trainer](trainer) ใๅ็
งใใฆใใ ใใ)ใ
+
+ใใใฉใซใใงใฏใ`TrainingArguments.report_to` ใฏ `"all"` ใซ่จญๅฎใใใฆใใใใใ[`Trainer`] ใฏๆฌกใฎใณใผใซใใใฏใไฝฟ็จใใพใใ
+
+- [`DefaultFlowCallback`] ใฏใใญใฐ่จ้ฒใไฟๅญใ่ฉไพกใฎใใใฉใซใใฎๅไฝใๅฆ็ใใพใใ
+- [`PrinterCallback`] ใพใใฏ [`ProgressCallback`] ใง้ฒ่ก็ถๆณใ่กจ็คบใใ
+ ใญใฐ (ๆๅใฎใญใฐใฏใ[`TrainingArguments`] ใ้ใใฆ tqdm ใ้ใขใฏใใฃใๅใใๅ ดๅใซไฝฟ็จใใใใใใงใชใๅ ดๅใซไฝฟ็จใใใพใ)
+ 2็ช็ฎใงใ)ใ
+- [`~integrations.TensorBoardCallback`] (PyTorch >= 1.4 ใไปใใฆ) tensorboard ใซใขใฏใปในใงใใๅ ดๅ
+ ใพใใฏใใณใฝใซใใผใX๏ผใ
+- [`~integrations.WandbCallback`] [wandb](https://www.wandb.com/) ใใคใณในใใผใซใใใฆใใๅ ดๅใ
+- [`~integrations.CometCallback`] [comet_ml](https://www.comet.com/site/) ใใคใณในใใผใซใใใฆใใๅ ดๅใ
+- [mlflow](https://www.mlflow.org/) ใใคใณในใใผใซใใใฆใใๅ ดๅใฏ [`~integrations.MLflowCallback`]ใ
+- [`~integrations.NeptuneCallback`] [neptune](https://neptune.ai/) ใใคใณในใใผใซใใใฆใใๅ ดๅใ
+- [`~integrations.AzureMLCallback`] [azureml-sdk](https://pypi.org/project/azureml-sdk/) ใฎๅ ดๅ
+ ใคใณในใใผใซใใใฆใใพใใ
+- [`~integrations.CodeCarbonCallback`] [codecarbon](https://pypi.org/project/codecarbon/) ใฎๅ ดๅ
+ ใคใณในใใผใซใใใฆใใพใใ
+- [`~integrations.ClearMLCallback`] [clearml](https://github.com/allegroai/clearml) ใใคใณในใใผใซใใใฆใใๅ ดๅใ
+- [`~integrations.DagsHubCallback`] [dagshub](https://dagshub.com/) ใใคใณในใใผใซใใใฆใใๅ ดๅใ
+- [`~integrations.FlyteCallback`] [flyte](https://flyte.org/) ใใคใณในใใผใซใใใฆใใๅ ดๅใ
+- [`~integrations.DVCLiveCallback`] [dvclive](https://www.dvc.org/doc/dvclive) ใใคใณในใใผใซใใใฆใใๅ ดๅใ
+
+ใใใฑใผใธใใคใณในใใผใซใใใฆใใใใไป้ใใ็ตฑๅใไฝฟ็จใใใใชใๅ ดๅใฏใ`TrainingArguments.report_to` ใใไฝฟ็จใใใ็ตฑๅใฎใฟใฎใชในใใซๅคๆดใงใใพใ (ไพ: `["azure_ml", "wandb"]`) ใ
+
+ใณใผใซใใใฏใๅฎ่ฃ
ใใใกใคใณใฏใฉในใฏ [`TrainerCallback`] ใงใใใใใฏใ
+[`TrainingArguments`] ใฏ [`Trainer`] ใใคใณในใฟใณในๅใใใใใซไฝฟ็จใใใใใใซใขใฏใปในใงใใพใใ
+[`TrainerState`] ใไปใใฆใใฌใผใใผใฎๅ
้จ็ถๆ
ใๅๅพใใใใฌใผใใณใฐ ใซใผใไธใงใใใคใใฎใขใฏใทใงใณใๅฎ่กใงใใพใใ
+[`TrainerControl`]ใ
+
+## ๅฉ็จๅฏ่ฝใชใณใผใซใใใฏ
+
+ใฉใคใใฉใชใงๅฉ็จๅฏ่ฝใช [`TrainerCallback`] ใฎใชในใใฏๆฌกใฎใจใใใงใใ
+
+[[autodoc]] integrations.CometCallback
+ - setup
+
+[[autodoc]] DefaultFlowCallback
+
+[[autodoc]] PrinterCallback
+
+[[autodoc]] ProgressCallback
+
+[[autodoc]] EarlyStoppingCallback
+
+[[autodoc]] integrations.TensorBoardCallback
+
+[[autodoc]] integrations.WandbCallback
+ - setup
+
+[[autodoc]] integrations.MLflowCallback
+ - setup
+
+[[autodoc]] integrations.AzureMLCallback
+
+[[autodoc]] integrations.CodeCarbonCallback
+
+[[autodoc]] integrations.NeptuneCallback
+
+[[autodoc]] integrations.ClearMLCallback
+
+[[autodoc]] integrations.DagsHubCallback
+
+[[autodoc]] integrations.FlyteCallback
+
+[[autodoc]] integrations.DVCLiveCallback
+ - setup
+
+## TrainerCallback
+
+[[autodoc]] TrainerCallback
+
+ไปฅไธใฏใใซในใฟใ ใณใผใซใใใฏใ PyTorch [`Trainer`] ใซ็ป้ฒใใๆนๆณใฎไพใงใใ
+
+```python
+class MyCallback(TrainerCallback):
+ "A callback that prints a message at the beginning of training"
+
+ def on_train_begin(self, args, state, control, **kwargs):
+ print("Starting training")
+
+
+trainer = Trainer(
+ model,
+ args,
+ train_dataset=train_dataset,
+ eval_dataset=eval_dataset,
+ callbacks=[MyCallback], # We can either pass the callback class this way or an instance of it (MyCallback())
+)
+```
+
+ใณใผใซใใใฏใ็ป้ฒใใๅฅใฎๆนๆณใฏใๆฌกใฎใใใซ `trainer.add_callback()` ใๅผใณๅบใใใจใงใใ
+
+```python
+trainer = Trainer(...)
+trainer.add_callback(MyCallback)
+# Alternatively, we can pass an instance of the callback class
+trainer.add_callback(MyCallback())
+```
+
+## TrainerState
+
+[[autodoc]] TrainerState
+
+## TrainerControl
+
+[[autodoc]] TrainerControl
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/configuration.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/configuration.md
new file mode 100644
index 0000000000000000000000000000000000000000..7fab5269e2049f61c8c83859a19b218d247cebb5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/configuration.md
@@ -0,0 +1,31 @@
+
+
+๏ผ ๆงๆ
+
+ๅบๆฌใฏใฉใน [`PretrainedConfig`] ใฏใ่จญๅฎใใญใผใ/ไฟๅญใใใใใฎไธ่ฌ็ใชใกใฝใใใๅฎ่ฃ
ใใพใใ
+ใญใผใซใซ ใใกใคใซใพใใฏใใฃใฌใฏใใชใใใใพใใฏใฉใคใใฉใช (ใใฆใณใญใผใใใใ) ใซใใฃใฆๆไพใใใไบๅใใฌใผใใณใฐๆธใฟใขใใซๆงๆใใ
+HuggingFace ใฎ AWS S3 ใชใใธใใชใใ)ใ
+
+ๅๆดพ็ๆงๆใฏใฉในใฏใขใใซๅบๆใฎๅฑๆงใๅฎ่ฃ
ใใพใใใในใฆใฎๆงๆใฏใฉในใซๅญๅจใใๅ
ฑ้ใฎๅฑๆงใฏๆฌกใฎใจใใใงใใ
+`hidden_โโsize`ใ`num_attention_heads`ใใใใณ `num_hidden_โโlayers`ใใใญในใ ใขใใซใฏใใใซไปฅไธใๅฎ่ฃ
ใใพใใ
+`vocab_size`ใ
+
+## PretrainedConfig
+
+[[autodoc]] PretrainedConfig
+ - push_to_hub
+ - all
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/data_collator.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/data_collator.md
new file mode 100644
index 0000000000000000000000000000000000000000..c37f1aeef4d1ccb17446da900b39904b92d1d68b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/data_collator.md
@@ -0,0 +1,67 @@
+
+
+# ใใผใฟ็
งๅ่
+
+ใใผใฟ็
งๅๅจใฏใใใผใฟใปใใ่ฆ็ด ใฎใชในใใๅ
ฅๅใจใใฆไฝฟ็จใใฆใใใใๅฝขๆใใใชใใธใงใฏใใงใใใใใใฎ่ฆ็ด ใฏใ
+`train_dataset` ใพใใฏ `eval_dataset` ใฎ่ฆ็ด ใจๅใๅใ
+
+ใใใใๆง็ฏใงใใใใใซใใใใใซใใใผใฟ็
งๅ่
ใฏไฝใใใฎๅฆ็ (ใใใฃใณใฐใชใฉ) ใ้ฉ็จใใๅ ดๅใใใใพใใใใฎใใกใฎใใใคใใฏ๏ผ
+[`DataCollatโโorForLanguageModeling`]) ใฉใณใใ ใชใใผใฟๆกๅผต (ใฉใณใใ ใในใญใณใฐใชใฉ) ใ้ฉ็จใใพใ
+ๅฝขๆใใใใใใไธใงใ
+
+ไฝฟ็จไพใฏใ[ใตใณใใซ ในใฏใชใใ](../examples) ใพใใฏ [ใตใณใใซ ใใผใใใใฏ](../notebooks) ใซใใใพใใ
+
+## Default data collator
+
+[[autodoc]] data.data_collator.default_data_collator
+
+## DefaultDataCollator
+
+[[autodoc]] data.data_collator.DefaultDataCollator
+
+## DataCollatorWithPadding
+
+[[autodoc]] data.data_collator.DataCollatorWithPadding
+
+## DataCollatorForTokenClassification
+
+[[autodoc]] data.data_collator.DataCollatorForTokenClassification
+
+## DataCollatorForSeq2Seq
+
+[[autodoc]] data.data_collator.DataCollatorForSeq2Seq
+
+## DataCollatorForLanguageModeling
+
+[[autodoc]] data.data_collator.DataCollatorForLanguageModeling
+ - numpy_mask_tokens
+ - tf_mask_tokens
+ - torch_mask_tokens
+
+## DataCollatorForWholeWordMask
+
+[[autodoc]] data.data_collator.DataCollatorForWholeWordMask
+ - numpy_mask_tokens
+ - tf_mask_tokens
+ - torch_mask_tokens
+
+## DataCollatorForPermutationLanguageModeling
+
+[[autodoc]] data.data_collator.DataCollatorForPermutationLanguageModeling
+ - numpy_mask_tokens
+ - tf_mask_tokens
+ - torch_mask_tokens
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/deepspeed.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/deepspeed.md
new file mode 100644
index 0000000000000000000000000000000000000000..4406ce4a34e21e3ed8287fb3bd071890dcdc070c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/deepspeed.md
@@ -0,0 +1,2254 @@
+
+
+# DeepSpeed Integration
+
+[DeepSpeed](https://github.com/microsoft/DeepSpeed) ใฏใ[ZeRO ่ซๆ](https://arxiv.org/abs/1910.02054) ใง่ชฌๆใใใฆใใใในใฆใๅฎ่ฃ
ใใพใใ็พๅจใๆฌกใฎใใฎใๅฎๅ
จใซใตใใผใใใฆใใพใใ
+
+1. ใชใใใฃใใคใถใผใฎ็ถๆ
ๅๅฒ (ZeRO ในใใผใธ 1)
+2. ๅพ้
ๅๅฒ (ZeRO ในใใผใธ 2)
+3. ใใฉใกใผใฟใผใฎๅๅฒ (ZeRO ในใใผใธ 3)
+4. ใซในใฟใ ๆททๅ็ฒพๅบฆใใฌใผใใณใฐๅฆ็
+5. ไธ้ฃใฎ้ซ้ CUDA ๆกๅผตใใผในใฎใชใใใฃใใคใถใผ
+6. CPU ใใใณ NVMe ใธใฎ ZeRO ใชใใญใผใ
+
+ZeRO-Offload ใซใฏ็ฌ่ชใฎๅฐ็จใใผใใผใใใใพใ: [ZeRO-Offload: Democratizing Billion-Scale Model Training](https://arxiv.org/abs/2101.06840)ใ NVMe ใตใใผใใซใคใใฆใฏใ่ซๆ [ZeRO-Infinity: Breaking the GPU Memory Wall for Extreme Scale Deep Learning](https://arxiv.org/abs/2104.07857)ใ
+
+DeepSpeed ZeRO-2 ใฏใใใฎๆฉ่ฝใๆจ่ซใซใฏๅฝนใซ็ซใใชใใใใไธปใซใใฌใผใใณใฐใฎใฟใซไฝฟ็จใใใพใใ
+
+DeepSpeed ZeRO-3 ใฏใๅทจๅคงใชใขใใซใ่คๆฐใฎ GPU ใซใญใผใใงใใใใใๆจ่ซใซใไฝฟ็จใงใใพใใ
+ๅไธใฎ GPU ใงใฏไธๅฏ่ฝใงใใ
+
+๐ค Transformers ใฏใ2 ใคใฎใชใใทใงใณใไปใใฆ [DeepSpeed](https://github.com/microsoft/DeepSpeed) ใ็ตฑๅใใพใใ
+
+1. [`Trainer`] ใซใใใณใข DeepSpeed ๆฉ่ฝใฎ็ตฑๅใไฝใงใใใฃใฆใใใใฟใคใใงใ
+ ็ตฑๅใฎๅ ดๅ - ใซในใฟใ ๆงๆใใกใคใซใๆๅฎใใใใใใณใใฌใผใใไฝฟ็จใใใ ใใงใไปใซไฝใใใๅฟ
่ฆใฏใใใพใใใใใใฆใใฎ
+ ใใฎใใญใฅใกใณใใงใฏใใฎๆฉ่ฝใซ็ฆ็นใๅฝใฆใฆใใพใใ
+2. [`Trainer`] ใไฝฟ็จใใใDeepSpeed ใ็ตฑๅใใ็ฌ่ชใฎใใฌใผใใผใไฝฟ็จใใใๅ ดๅ
+ `from_pretrained` ใ `from_config` ใชใฉใฎใณใขๆฉ่ฝใซใฏใ้่ฆใชๆฉ่ฝใฎ็ตฑๅใๅซใพใใฆใใพใใ
+ ZeRO ในใใผใธ 3 ไปฅ้ใฎ `zero.Init`ใชใฉใฎ DeepSpeed ใฎ้จๅใใใฎๆฉ่ฝใๆดป็จใใใซใฏใๆฌกใฎใใญใฅใกใณใใใ่ชญใฟใใ ใใใ
+ [้ใใฌใผใใผ DeepSpeed ็ตฑๅ](#nontrainer-deepspeed-integration)ใ
+
+็ตฑๅใใใฆใใใใฎ:
+
+ใใฌใผใใณใฐ๏ผ
+
+1. DeepSpeed ZeRO ใใฌใผใใณใฐใฏใZeRO-Infinity (CPU ใใใณ NVME ใชใใญใผใ) ใไฝฟ็จใใฆๅฎๅ
จใช ZeRO ในใใผใธ 1ใ2ใใใใณ 3 ใใตใใผใใใพใใ
+
+ๆจ่ซ๏ผ
+
+1. DeepSpeed ZeRO Inference ใฏใZeRO-Infinity ใซใใ ZeRO ในใใผใธ 3 ใใตใใผใใใพใใใใฌใผใใณใฐใจๅใ ZeRO ใใญใใณใซใไฝฟ็จใใพใใใ
+ ใชใใใฃใใคใถใจ lr ในใฑใธใฅใผใฉใฏไฝฟ็จใใใในใใผใธ 3 ใฎใฟใ้ข้ฃใใพใใ่ฉณ็ดฐใซใคใใฆใฏใไปฅไธใๅ็
งใใฆใใ ใใใ
+ [ใผใญๆจ่ซ](#zero-inference)ใ
+
+DeepSpeed Inference ใใใใพใใใใใฏใTensor Parallelism ใฎไปฃใใใซ Tensor Parallelism ใไฝฟ็จใใใพใฃใใ็ฐใชใใใฏใใญใธใผใงใใ
+ZeRO (่ฟๆฅๅ
ฌ้)ใ
+
+
+
+
+## Trainer Deepspeed Integration
+
+
+
+
+### Installation
+
+pypi ็ต็ฑใงใฉใคใใฉใชใใคใณในใใผใซใใพใใ
+```bash
+pip install deepspeed
+```
+
+ใพใใฏ`tansformers`, `extras`็ต็ฑ:
+
+```bash
+pip install transformers[deepspeed]
+```
+
+ใพใใฏใ[DeepSpeed ใฎ GitHub ใใผใธ](https://github.com/microsoft/deepspeed#installation) ใง่ฉณ็ดฐใ็ขบ่ชใใฆใใ ใใใ
+[้ซๅบฆใชใคใณในใใผใซ](https://www.deepspeed.ai/tutorials/advanced-install/)ใ
+
+ใใใงใใใซใใซ่ฆๅดใใๅ ดๅใฏใใพใ [CUDA ๆกๅผตๆฉ่ฝใฎใคใณในใใผใซ ใใผใ](trainer#cuda-extension-installation-notes) ใๅฟ
ใ่ชญใใงใใ ใใใ
+
+ๆกๅผตๆฉ่ฝใไบๅใใซใใใใๅฎ่กๆใซๆกๅผตๆฉ่ฝใใใซใใใใใใจใซไพๅญใใฆใใใไธ่จใฎ่งฃๆฑบ็ญใใในใฆ่ฉฆใใๅ ดๅ
+ใใใๅฝนใซ็ซใใชใใฃใๅ ดๅใๆฌกใซ่ฉฆใในใใใจใฏใใขใธใฅใผใซใใคใณในใใผใซใใๅใซใขใธใฅใผใซใไบๅใซใใซใใใใใจใงใใ
+
+DeepSpeed ใฎใญใผใซใซ ใใซใใไฝๆใใใซใฏ:
+
+```bash
+git clone https://github.com/microsoft/DeepSpeed/
+cd DeepSpeed
+rm -rf build
+TORCH_CUDA_ARCH_LIST="8.6" DS_BUILD_CPU_ADAM=1 DS_BUILD_UTILS=1 pip install . \
+--global-option="build_ext" --global-option="-j8" --no-cache -v \
+--disable-pip-version-check 2>&1 | tee build.log
+```
+
+NVMe ใชใใญใผใใไฝฟ็จใใๅ ดๅใฏใไธ่จใฎๆ้ ใซ`DS_BUILD_AIO=1`ใๅซใใๅฟ
่ฆใใใใพใ (ใพใใ
+*libaio-dev* ใทในใใ ๅ
จไฝใซใคใณในใใผใซใใพใ)ใ
+
+`TORCH_CUDA_ARCH_LIST` ใ็ทจ้ใใฆใไฝฟ็จใใ GPU ใซใผใใฎใขใผใญใใฏใใฃใฎใณใผใใๆฟๅ
ฅใใพใใใในใฆใไปฎๅฎใใใจ
+ใใชใใฎใซใผใใฏๅใใงใๆฌกใฎๆนๆณใงใขใผใใๅๅพใงใใพใใ
+
+```bash
+CUDA_VISIBLE_DEVICES=0 python -c "import torch; print(torch.cuda.get_device_capability())"
+```
+
+ใใใใฃใฆใ`8, 6`ใๅๅพใใๅ ดๅใฏใ`TORCH_CUDA_ARCH_LIST="8.6"`ใไฝฟ็จใใพใใ่คๆฐใฎ็ฐใชใใซใผใใใๆใกใฎๅ ดๅใฏใใในใฆใใชในใใใใใจใใงใใพใ
+ใใใใฎใใกใ`TORCH_CUDA_ARCH_LIST="6.1;8.6"`ใๅฅฝใใงใ
+
+่คๆฐใฎใใทใณใงๅใใปใใใขใใใไฝฟ็จใใๅฟ
่ฆใใใๅ ดๅใฏใใใคใใช ใใคใผใซใไฝๆใใพใใ
+
+```bash
+git clone https://github.com/microsoft/DeepSpeed/
+cd DeepSpeed
+rm -rf build
+TORCH_CUDA_ARCH_LIST="8.6" DS_BUILD_CPU_ADAM=1 DS_BUILD_UTILS=1 \
+python setup.py build_ext -j8 bdist_wheel
+```
+
+`dist/deepspeed-0.3.13+8cd046f-cp38-cp38-linux_x86_64.whl`ใฎใใใชใใฎใ็ๆใใใใฎใงใใใใใคใณในใใผใซใงใใพใ
+`pip install deepspeed-0.3.13+8cd046f-cp38-cp38-linux_x86_64.whl`ใจใใฆใญใผใซใซใพใใฏไปใฎใใทใณใซใคใณในใใผใซใใพใใ
+
+็นฐใ่ฟใใพใใใ`TORCH_CUDA_ARCH_LIST`ใใฟใผใฒใใ ใขใผใญใใฏใใฃใซๅใใใฆ่ชฟๆดใใใใจใๅฟใใชใใงใใ ใใใ
+
+NVIDIA GPU ใฎๅฎๅ
จใชใชในใใจใใใใซๅฏพๅฟใใ **ใณใณใใฅใผใใฃใณใฐๆฉ่ฝ** (ใใฎ่จไบใฎ Arch ใจๅใ) ใ่ฆใคใใใใจใใงใใพใใ
+ใณใณใใญในใ) [ใใ](https://developer.nvidia.com/cuda-gpus)ใ
+
+ไปฅไธใไฝฟ็จใใฆใpytorch ใๆง็ฏใใใใขใผใใ็ขบ่ชใงใใพใใ
+
+```bash
+python -c "import torch; print(torch.cuda.get_arch_list())"
+```
+
+ใใใงใฏใใคใณในใใผใซใใใฆใใ GPU ใฎ 1 ใคใฎใขใผใใ่ฆใคใใๆนๆณใ่ชฌๆใใพใใใใจใใฐใGPU 0 ใฎๅ ดๅ:
+
+```bash
+CUDA_VISIBLE_DEVICES=0 python -c "import torch; \
+print(torch.cuda.get_device_properties(torch.device('cuda')))"
+```
+
+ๅบๅใๆฌกใฎๅ ดๅ:
+
+```bash
+_CudaDeviceProperties(name='GeForce RTX 3090', major=8, minor=6, total_memory=24268MB, multi_processor_count=82)
+```
+
+ใใใใใฐใใใฎใซใผใใฎใขใผใใ`8.6`ใงใใใใจใใใใใพใใ
+
+`TORCH_CUDA_ARCH_LIST` ใๅฎๅ
จใซ็็ฅใใใใจใใงใใพใใใใใใใฐใใใซใ ใใญใฐใฉใ ใ่ชๅ็ใซใฏใจใชใๅฎ่กใใพใใ
+ใใซใใ่กใใใ GPU ใฎใขใผใญใใฏใใฃใใใใฏใใฟใผใฒใใ ใใทใณใฎ GPU ใจไธ่ดใใๅ ดๅใใใใฐใไธ่ดใใชใๅ ดๅใใใใพใใ
+็ฎ็ใฎใขใผใใๆ็คบ็ใซๆๅฎใใใใจใใๅงใใใพใใ
+
+ๆๆกใใใใใจใใในใฆ่ฉฆใใฆใใพใ ใใซใใฎๅ้กใ็บ็ใใๅ ดๅใฏใGitHub ใฎๅ้กใซ้ฒใใงใใ ใใใ
+[ใใฃใผใในใใผใ](https://github.com/microsoft/DeepSpeed/issues)ใ
+
+
+
+### Deployment with multiple GPUs
+
+DeepSpeed ็ตฑๅใใใใญใคใใใซใฏใ[`Trainer`] ใณใใณใ ใฉใคใณๅผๆฐใ่ชฟๆดใใฆๆฐใใๅผๆฐ `--deepspeed ds_config.json` ใๅซใใพใใใใใงใ`ds_config.json` ใฏ DeepSpeed ๆงๆใใกใคใซใงใใ
+ [ใใกใ](https://www.deepspeed.ai/docs/config-json/)ใซ่จ่ผใใใฆใใพใใใใกใคใซๅใฏใใชใๆฌก็ฌฌใงใใ
+ DeepSpeed ใฎ`add_config_arguments`ใฆใผใใฃใชใใฃใไฝฟ็จใใฆใๅฟ
่ฆใชใณใใณใ ใฉใคใณๅผๆฐใใณใผใใซ่ฟฝๅ ใใใใจใใๅงใใใพใใ
+ ่ฉณ็ดฐใซใคใใฆใฏใ[DeepSpeed ใฎๅผๆฐ่งฃๆ](https://deepspeed.readthedocs.io/en/latest/initialize.html#argument-parsing) ใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+
+ใใใง้ธๆใใใฉใณใใฃใผใไฝฟ็จใงใใพใใ pytorch ใฉใณใใฃใผใๅผใ็ถใไฝฟ็จใงใใพใใ
+
+```bash
+torch.distributed.run --nproc_per_node=2 your_program.py --deepspeed ds_config.json
+```
+
+ใพใใฏใ`deepspeed`ใซใใฃใฆๆไพใใใใฉใณใใฃใผใไฝฟ็จใใพใใ
+
+```bash
+deepspeed --num_gpus=2 your_program.py --deepspeed ds_config.json
+```
+
+ใ่ฆงใฎใจใใใๅผๆฐใฏๅใใงใฏใใใพใใใใใปใจใใฉใฎใใผใบใงใฏใฉใกใใงใๆฉ่ฝใใพใใใฎ
+ใใพใใพใชใใผใใจ GPU ใๆงๆใใๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ใใกใ](https://www.deepspeed.ai/getting-started/#resource-configuration-multi-node) ใๅ็
งใใฆใใ ใใใ
+
+`deepspeed`ใฉใณใใฃใผใไฝฟ็จใใๅฉ็จๅฏ่ฝใชใในใฆใฎ GPU ใไฝฟ็จใใใๅ ดๅใฏใ`--num_gpus`ใใฉใฐใ็็ฅใใใ ใใงใใ
+
+ไปฅไธใฏใๅฉ็จๅฏ่ฝใชใในใฆใฎ GPU ใใใใญใคใใ DeepSpeed ใง`run_translation.py`ใๅฎ่กใใไพใงใใ
+
+```bash
+deepspeed examples/pytorch/translation/run_translation.py \
+--deepspeed tests/deepspeed/ds_config_zero3.json \
+--model_name_or_path google-t5/t5-small --per_device_train_batch_size 1 \
+--output_dir output_dir --overwrite_output_dir --fp16 \
+--do_train --max_train_samples 500 --num_train_epochs 1 \
+--dataset_name wmt16 --dataset_config "ro-en" \
+--source_lang en --target_lang ro
+```
+
+DeepSpeed ใฎใใญใฅใกใณใใซใฏใ`--deepspeed --deepspeed_config ds_config.json`ใ่กจ็คบใใใๅฏ่ฝๆงใ้ซใใใจใซๆณจๆใใฆใใ ใใใ
+DeepSpeed ้ข้ฃใฎๅผๆฐใ 2 ใคใใใพใใใ็ฐกๅใซใใใใใงใใใๅฆ็ใในใๅผๆฐใใใงใซ้ๅธธใซๅคใใใใงใใ
+ใใฎ 2 ใคใ 1 ใคใฎๅผๆฐใซ็ตๅใใพใใใ
+
+ๅฎ้ใฎไฝฟ็จไพใซใคใใฆใฏใใใฎ [ๆ็จฟ](https://github.com/huggingface/transformers/issues/8771#issuecomment-759248400) ใๅ็
งใใฆใใ ใใใ
+
+
+
+
+### Deployment with one GPU
+
+1 ใคใฎ GPU ใง DeepSpeed ใใใใญใคใใใซใฏใ[`Trainer`] ใณใใณใ ใฉใคใณๅผๆฐใๆฌกใฎใใใซ่ชฟๆดใใพใใ
+
+```bash
+deepspeed --num_gpus=1 examples/pytorch/translation/run_translation.py \
+--deepspeed tests/deepspeed/ds_config_zero2.json \
+--model_name_or_path google-t5/t5-small --per_device_train_batch_size 1 \
+--output_dir output_dir --overwrite_output_dir --fp16 \
+--do_train --max_train_samples 500 --num_train_epochs 1 \
+--dataset_name wmt16 --dataset_config "ro-en" \
+--source_lang en --target_lang ro
+```
+
+ใใใฏ่คๆฐใฎ GPU ใฎๅ ดๅใจใปใผๅใใงใใใใใใงใฏใDeepSpeed ใซ 1 ใคใฎ GPU ใ ใใไฝฟ็จใใใใใซๆ็คบ็ใซๆ็คบใใพใใ
+`--num_gpus=1`ใใใใฉใซใใงใฏใDeepSpeed ใฏๆๅฎใใใใใผใไธใง่ช่ญใงใใใในใฆใฎ GPU ใใใใญใคใใพใใ่ตทๅใใ GPU ใ 1 ใคใ ใใฎๅ ดๅ
+ใฎๅ ดๅใใใฎๅผๆฐใฏๅฟ
่ฆใใใพใใใๆฌกใฎ [ใใญใฅใกใณใ](https://www.deepspeed.ai/getting-started/#resource-configuration-multi-node) ใงใฏใใฉใณใใฃใผ ใชใใทใงใณใซใคใใฆ่ชฌๆใใฆใใพใใ
+
+1 ใคใฎ GPU ใ ใใง DeepSpeed ใไฝฟ็จใใใใฎใฏใชใใงใใ?
+
+1. ไธ้จใฎ่จ็ฎใจใกใขใชใใในใใฎ CPU ใจ RAM ใซๅงไปปใงใใ ZeRO ใชใใญใผใๆฉ่ฝใๅใใฆใใใใใ
+ ใขใใซใฎใใผใบใซๅใใใฆใใๅคใใฎ GPU ใชใฝใผในใๆฎใใฆใใใพใใใใๅคงใใชใใใ ใตใคใบใใพใใฏ้ๅธธใซๅคงใใชใขใใซใฎใใฃใใใฃใณใฐใๅฏ่ฝใซใใ
+ ๆฎ้ใฏๅใใชใใงใใใใ
+2. ในใใผใใช GPU ใกใขใช็ฎก็ใทในใใ ใๆไพใใใกใขใชใฎๆญ็ๅใๆๅฐ้ใซๆใใพใใ
+ ใใๅคงใใชใขใใซใจใใผใฟ ใใใใ
+
+ๆฌกใซๆงๆใซใคใใฆ่ฉณใใ่ชฌๆใใพใใใๅไธใฎ GPU ใงๅคงๅน
ใชๆนๅใๅฎ็พใใใใใฎ้ตใฏๆฌกใฎใจใใใงใใ
+DeepSpeed ใไฝฟ็จใใใซใฏใๆงๆใใกใคใซใซๅฐใชใใจใๆฌกใฎๆงๆใๅฟ
่ฆใงใใ
+
+```json
+{
+ "zero_optimization": {
+ "stage": 2,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "allgather_partitions": true,
+ "allgather_bucket_size": 2e8,
+ "reduce_scatter": true,
+ "reduce_bucket_size": 2e8,
+ "overlap_comm": true,
+ "contiguous_gradients": true
+ }
+}
+```
+
+ใใใซใใใใชใใใฃใใคใถใผใฎใชใใญใผใใใใฎไปใฎ้่ฆใชๆฉ่ฝใๆๅนใซใชใใพใใใใใใก ใตใคใบใ่ฉฆใใฆใฟใใจใใใงใใใใ
+่ฉณ็ดฐใซใคใใฆใฏใไปฅไธใฎใใฃในใซใใทใงใณใๅ็
งใใฆใใ ใใใ
+
+ใใฎใฟใคใใฎใใใญใคใกใณใใฎๅฎ้็ใชไฝฟ็จไพใซใคใใฆใฏใใใฎ [ๆ็จฟ](https://github.com/huggingface/transformers/issues/8771#issuecomment-759176685) ใๅ็
งใใฆใใ ใใใ
+
+ใใฎใใญใฅใกใณใใง่ฉณใใ่ชฌๆใใใฆใใใใใซใCPU ใใใณ NVMe ใชใใญใผใใๅใใ ZeRO-3 ใ่ฉฆใใใจใใงใใพใใ
+
+ใใผใ๏ผ
+
+- GPU 0 ใจใฏ็ฐใชใ็นๅฎใฎ GPU ใงๅฎ่กใใๅฟ
่ฆใใใๅ ดๅใ`CUDA_VISIBLE_DEVICES` ใไฝฟ็จใใฆๅถ้ใใใใจใฏใงใใพใใใ
+ ๅฉ็จๅฏ่ฝใช GPU ใฎ่กจ็คบ็ฏๅฒใไปฃใใใซใๆฌกใฎๆงๆใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+ ```bash
+ deepspeed --include localhost:1 examples/pytorch/translation/run_translation.py ...
+ ```
+
+ ใใฎไพใงใฏใDeepSpeed ใซ GPU 1 (2 ็ช็ฎใฎ GPU) ใไฝฟ็จใใใใใซๆ็คบใใพใใ
+
+
+
+### ่คๆฐใฎใใผใใไฝฟ็จใใใใใญใคใกใณใ
+
+ใใฎใปใฏใทใงใณใฎๆ
ๅ ฑใฏ DeepSpeed ็ตฑๅใซๅบๆใฎใใฎใงใฏใชใใใใใใใใซใใใผใ ใใญใฐใฉใ ใซ้ฉ็จใงใใพใใใใ ใใDeepSpeed ใฏใSLURM ็ฐๅขใงใชใ้ใใไปใฎใฉใณใใฃใผใใใไฝฟใใใใ`deepspeed`ใฉใณใใฃใผใๆไพใใพใใ
+
+ใใฎใปใฏใทใงใณใงใฏใใใใใ 8 GPU ใๅใใ 2 ใคใฎใใผใใใใใจไปฎๅฎใใพใใใพใใๆๅใฎใใผใใซใฏ `ssh hostname1` ใไฝฟ็จใใฆใ2 ็ช็ฎใฎใใผใใซใฏ `ssh hostname2` ใไฝฟ็จใใฆๆฅ็ถใงใใพใใไธกๆนใจใใในใฏใผใใชใใงใญใผใซใซใฎ ssh ็ต็ฑใง็ธไบใซๆฅ็ถใงใใๅฟ
่ฆใใใใพใใใใกใใใใใใใฎใในใ (ใใผใ) ๅใใไฝๆฅญใใฆใใๅฎ้ใฎใในใๅใซๅคๆดใใๅฟ
่ฆใใใใพใใ
+
+#### The torch.distributed.run launcher
+
+
+ใใจใใฐใ`torch.distributed.run` ใไฝฟ็จใใใซใฏใๆฌกใฎใใใซใใพใใ
+
+```bash
+python -m torch.distributed.run --nproc_per_node=8 --nnode=2 --node_rank=0 --master_addr=hostname1 \
+--master_port=9901 your_program.py --deepspeed ds_config.json
+```
+
+ๅใใผใใซ SSH ใงๆฅ็ถใใใใใใใฎใใผใใงๅใใณใใณใใๅฎ่กใใๅฟ
่ฆใใใใพใใๆฅใๅฟ
่ฆใฏใใใพใใใใฉใณใใฃใผใฏไธกๆนใฎใใผใใๅๆใใใพใงๅพ
ๆฉใใพใใ
+
+่ฉณ็ดฐใซใคใใฆใฏใ[torchrun](https://pytorch.org/docs/stable/elastic/run.html) ใๅ็
งใใฆใใ ใใใใกใชใฟใซใใใใฏ pytorch ใฎๆฐใใผใธใงใณๅใฎ`torch.distributed.launch`ใ็ฝฎใๆใใใฉใณใใฃใผใงใใใใพใใ
+
+#### ใใฃใผใในใใผใ ใฉใณใใฃใผ
+
+ไปฃใใใซ`deepspeed`ใฉใณใใฃใผใไฝฟ็จใใใซใฏใใพใ`hostfile`ใใกใคใซใไฝๆใใๅฟ
่ฆใใใใพใใ
+
+```
+hostname1 slots=8
+hostname2 slots=8
+```
+
+ใใใฆใๆฌกใฎใใใซ่ตทๅใงใใพใใ
+
+```bash
+deepspeed --num_gpus 8 --num_nodes 2 --hostfile hostfile --master_addr hostname1 --master_port=9901 \
+your_program.py --deepspeed ds_config.json
+```
+
+`torch.distributed.run`ใฉใณใใฃใผใจใฏ็ฐใชใใ`deepspeed`ใฏไธกๆนใฎใใผใใงใใฎใณใใณใใ่ชๅ็ใซ่ตทๅใใพใใ
+
+่ฉณ็ดฐใซใคใใฆใฏใ[ใชใฝใผในๆงๆ (ใใซใใใผใ)](https://www.deepspeed.ai/getting-started/#resource-configuration-multi-node) ใๅ็
งใใฆใใ ใใใ
+
+#### Launching in a SLURM environment
+
+SLURM ็ฐๅขใงใฏใๆฌกใฎใขใใญใผใใไฝฟ็จใงใใพใใไปฅไธใฏใ็นๅฎใฎ SLURM ็ฐๅขใซ้ฉๅใใใใใใซๅฟ
่ฆใช slurm ในใฏใชใใ `launch.slurm` ใงใใ
+
+```bash
+#SBATCH --job-name=test-nodes # name
+#SBATCH --nodes=2 # nodes
+#SBATCH --ntasks-per-node=1 # crucial - only 1 task per dist per node!
+#SBATCH --cpus-per-task=10 # number of cores per tasks
+#SBATCH --gres=gpu:8 # number of gpus
+#SBATCH --time 20:00:00 # maximum execution time (HH:MM:SS)
+#SBATCH --output=%x-%j.out # output file name
+
+export GPUS_PER_NODE=8
+export MASTER_ADDR=$(scontrol show hostnames $SLURM_JOB_NODELIST | head -n 1)
+export MASTER_PORT=9901
+
+srun --jobid $SLURM_JOBID bash -c 'python -m torch.distributed.run \
+ --nproc_per_node $GPUS_PER_NODE --nnodes $SLURM_NNODES --node_rank $SLURM_PROCID \
+ --master_addr $MASTER_ADDR --master_port $MASTER_PORT \
+your_program.py --deepspeed ds_config.json'
+```
+
+ใใจใฏๅฎ่กใในใฑใธใฅใผใซใใใ ใใงใใ
+```bash
+sbatch launch.slurm
+```
+
+#### Use of Non-shared filesystem
+
+ใใใฉใซใใงใฏใDeepSpeed ใฏใใซใใใผใ็ฐๅขใๅ
ฑๆในใใฌใผใธใไฝฟ็จใใใใจใๆณๅฎใใฆใใพใใใใใๅฝใฆใฏใพใใใๅใใผใใใญใผใซใซ ใใกใคใซใทในใใ ใใๅ็
งใงใใชใๅ ดๅใฏใ่จญๅฎใใกใคใซใ่ชฟๆดใใฆ [`checkpoint`_section](https://www.deepspeed.ai/docs/config-json/#) ใๅซใใๅฟ
่ฆใใใใพใใใใงใใฏใใคใณใ ใชใใทใงใณ) ใๆฌกใฎ่จญๅฎใงๆๅฎใใพใใ
+
+
+```json
+{
+ "checkpoint": {
+ "use_node_local_storage": true
+ }
+}
+```
+
+ใใใใฏใ[`Trainer`] ใฎ `--save_on_each_node` ๅผๆฐใไฝฟ็จใใใใจใใงใใไธ่จใฎ่จญๅฎใฏ่ชๅ็ใซ่ฟฝๅ ใใใพใใ
+
+
+
+### Deployment in Notebooks
+
+ใใผใใใใฏใฎใปใซใในใฏใชใใใจใใฆๅฎ่กใใๅ ดๅใฎๅ้กใฏใไพๅญใใ้ๅธธใฎ`deepspeed`ใฉใณใใฃใผใใชใใใจใงใใ
+็นๅฎใฎ่จญๅฎใงใฏใใใใใจใใฅใฌใผใใใๅฟ
่ฆใใใใพใใ
+
+GPU ใ 1 ใคใ ใไฝฟ็จใใฆใใๅ ดๅใDeepSpeed ใไฝฟ็จใใใใใซใใผใใใใฏๅ
ใฎใใฌใผใใณใฐ ใณใผใใ่ชฟๆดใใๅฟ
่ฆใใใๆนๆณใฏๆฌกใฎใจใใใงใใ
+
+```python
+# DeepSpeed requires a distributed environment even when only one process is used.
+# This emulates a launcher in the notebook
+import os
+
+os.environ["MASTER_ADDR"] = "localhost"
+os.environ["MASTER_PORT"] = "9994" # modify if RuntimeError: Address already in use
+os.environ["RANK"] = "0"
+os.environ["LOCAL_RANK"] = "0"
+os.environ["WORLD_SIZE"] = "1"
+
+# Now proceed as normal, plus pass the deepspeed config file
+training_args = TrainingArguments(..., deepspeed="ds_config_zero3.json")
+trainer = Trainer(...)
+trainer.train()
+```
+
+ๆณจ: `...` ใฏใ้ขๆฐใซๆธกใ้ๅธธใฎๅผๆฐใ่กจใใพใใ
+
+่คๆฐใฎ GPU ใไฝฟ็จใใๅ ดๅใDeepSpeed ใๅไฝใใใซใฏใใซใใใญใปใน็ฐๅขใไฝฟ็จใใๅฟ
่ฆใใใใพใใใคใพใใใใชใใฏๆใฃใฆใใพใ
+ใใฎ็ฎ็ใงใฉใณใใฃใผใไฝฟ็จใใใใจใฏใงใใพใใใใใใใฏใๆ็คบใใใๅๆฃ็ฐๅขใใจใใฅใฌใผใใใใใจใซใใฃใฆใฏๅฎ็พใงใใพใใใ
+ใใฎใปใฏใทใงใณใฎๅ้ ญใงใ
+
+็พๅจใฎใใฃใฌใฏใใชใฎใใผใใใใฏใซใใฎๅ ดใงๆงๆใใกใคใซใไฝๆใใใๅ ดๅใฏใๅฐ็จใฎ
+ใปใซใฎๅ
ๅฎน:
+
+```python no-style
+%%bash
+cat <<'EOT' > ds_config_zero3.json
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": "auto",
+ "stage3_prefetch_bucket_size": "auto",
+ "stage3_param_persistence_threshold": "auto",
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ },
+
+ "gradient_accumulation_steps": "auto",
+ "gradient_clipping": "auto",
+ "steps_per_print": 2000,
+ "train_batch_size": "auto",
+ "train_micro_batch_size_per_gpu": "auto",
+ "wall_clock_breakdown": false
+}
+EOT
+```
+
+ใใฌใผใใณใฐ ในใฏใชใใใใใผใใใใฏใฎใปใซใงใฏใชใ้ๅธธใฎใใกใคใซใซใใๅ ดๅใฏใๆฌกใฎใใใซใใฆ`deepspeed`ใ้ๅธธใฉใใ่ตทๅใงใใพใใ
+็ดฐ่ใใใฎใทใงใซใใใจใใฐใ`run_translation.py` ใไฝฟ็จใใใซใฏใๆฌกใฎใใใซ่ตทๅใใพใใ
+
+```python no-style
+!git clone https://github.com/huggingface/transformers
+!cd transformers; deepspeed examples/pytorch/translation/run_translation.py ...
+```
+
+ใพใใฏใ`%%bash` ใใธใใฏใไฝฟ็จใใใจใใทใงใซ ใใญใฐใฉใ ใๅฎ่กใใใใใฎ่คๆฐ่กใฎใณใผใใ่จ่ฟฐใใใใจใใงใใพใใ
+
+```python no-style
+%%bash
+
+git clone https://github.com/huggingface/transformers
+cd transformers
+deepspeed examples/pytorch/translation/run_translation.py ...
+```
+
+ใใฎใใใชๅ ดๅใใใฎใปใฏใทใงใณใฎๆๅใซ็คบใใใณใผใใฏๅฟ
่ฆใใใพใใใ
+
+ๆณจ: `%%bash` ใใธใใฏใฏๅชใใฆใใพใใใ็พๆ็นใงใฏๅบๅใใใใใกใชใณใฐใใใใใใใญใปในใ็ตไบใใใพใงใญใฐใฏ่กจ็คบใใใพใใใ
+ๅฎไบใใพใใ
+
+
+
+### Configuration
+
+่จญๅฎใใกใคใซใงไฝฟ็จใงใใ DeepSpeed ่จญๅฎใชใใทใงใณใฎๅฎๅ
จใชใฌใคใใซใคใใฆใฏใๆฌกใๅ็
งใใฆใใ ใใใ
+[ๆฌกใฎใใญใฅใกใณใ](https://www.deepspeed.ai/docs/config-json/) ใซใขใฏใปในใใฆใใ ใใใ
+
+ใใพใใพใชๅฎ้ใฎใใผใบใซๅฏพๅฟใใๆฐๅใฎ DeepSpeed ๆงๆไพใ [DeepSpeedExamples](https://github.com/microsoft/DeepSpeedExamples)ใง่ฆใคใใใใจใใงใใพใใ
+ใชใใธใใช:
+
+```bash
+git clone https://github.com/microsoft/DeepSpeedExamples
+cd DeepSpeedExamples
+find . -name '*json'
+```
+
+ไธ่จใฎใณใผใใ็ถใใฆใLamb ใชใใใฃใใคใถใผใๆงๆใใใใจใใฆใใใจใใพใใใใใใฃใฆใๆฌกใฎไธญใใๆค็ดขใงใใพใ
+`.json` ใใกใคใซใฎไพ:
+
+```bash
+grep -i Lamb $(find . -name '*json')
+```
+
+ใใใซใใใคใใฎไพใ [ใกใคใณ ใชใใธใใช](https://github.com/microsoft/DeepSpeed) ใซใใใใพใใ
+
+DeepSpeed ใไฝฟ็จใใๅ ดๅใฏใๅธธใซ DeepSpeed ๆงๆใใกใคใซใๆๅฎใใๅฟ
่ฆใใใใพใใใไธ้จใฎๆงๆใใฉใกใผใฟใซใฏ
+ใณใใณใใฉใคใณ็ต็ฑใง่จญๅฎใใพใใๅพฎๅฆใช้ใใซใคใใฆใฏใใใฎใฌใคใใฎๆฎใใฎ้จๅใง่ชฌๆใใพใใ
+
+DeepSpeed ๆงๆใใกใคใซใใฉใฎใใใชใใฎใใ็่งฃใใใใใซใZeRO ในใใผใธ 2 ๆฉ่ฝใๆๅนใซใใๆงๆใใกใคใซใๆฌกใซ็คบใใพใใ
+ใชใใใฃใใคใถใผ็ถๆ
ใฎ CPU ใชใใญใผใใๅซใฟใ`AdamW`ใชใใใฃใใคใถใผใจ`WarmupLR`ในใฑใธใฅใผใฉใผใไฝฟ็จใใๆททๅใๆๅนใซใใพใใ
+`--fp16` ใๆธกใใใๅ ดๅใฎ็ฒพๅบฆใใฌใผใใณใฐ:
+
+
+```json
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 2,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "allgather_partitions": true,
+ "allgather_bucket_size": 2e8,
+ "overlap_comm": true,
+ "reduce_scatter": true,
+ "reduce_bucket_size": 2e8,
+ "contiguous_gradients": true
+ },
+
+ "gradient_accumulation_steps": "auto",
+ "gradient_clipping": "auto",
+ "train_batch_size": "auto",
+ "train_micro_batch_size_per_gpu": "auto",
+}
+```
+
+ใใญใฐใฉใ ใๅฎ่กใใใจใDeepSpeed ใฏ [`Trainer`] ใใๅใๅใฃใ่จญๅฎใใญใฐใซ่จ้ฒใใพใใ
+ใณใณใฝใผใซใซๆธกใใใใใใๆ็ต็ใซใฉใฎใใใช่จญๅฎใๆธกใใใใฎใใๆญฃ็ขบใซ็ขบ่ชใงใใพใใ
+
+
+
+### Passing Configuration
+
+ใใฎใใญใฅใกใณใใง่ชฌๆใใใใใซใ้ๅธธใDeepSpeed ่จญๅฎใฏ json ใใกใคใซใธใฎใในใจใใฆๆธกใใใพใใใ
+ใใฌใผใใณใฐใฎ่จญๅฎใซใณใใณใ ใฉใคใณ ใคใณใฟใผใใงใคในใไฝฟ็จใใใไปฃใใใซใคใณในใฟใณในใไฝๆใใพใใ
+[`Trainer`] via [`TrainingArguments`] ใใฎๅพใ`deepspeed` ๅผๆฐใซใคใใฆใฏๆฌกใฎใใจใใงใใพใ
+ใในใใใใ `dict` ใๆธกใใพใใใใใซใใใใใฎๅ ดใงๆงๆใไฝๆใงใใใใใๆธใ่พผใๅฟ
่ฆใใใใพใใใ
+[`TrainingArguments`] ใซๆธกใๅใซใใกใคใซ ใทในใใ ใๅคๆดใใพใใ
+
+่ฆ็ดใใใจใๆฌกใฎใใจใใงใใพใใ
+
+```python
+TrainingArguments(..., deepspeed="/path/to/ds_config.json")
+```
+
+ใพใใฏ๏ผ
+
+```python
+ds_config_dict = dict(scheduler=scheduler_params, optimizer=optimizer_params)
+TrainingArguments(..., deepspeed=ds_config_dict)
+```
+
+
+
+
+### Shared Configuration
+
+
+
+ใใฎใปใฏใทใงใณใฏๅฟ
่ชญใงใ
+
+
+
+[`Trainer`] ใจ DeepSpeed ใฎไธกๆนใๆญฃใใๆฉ่ฝใใใซใฏใใใใคใใฎ่จญๅฎๅคใๅฟ
่ฆใงใใ
+ใใใใฃใฆใๆคๅบใๅฐ้ฃใชใจใฉใผใซใคใชใใๅฏ่ฝๆงใฎใใๅฎ็พฉใฎ็ซถๅใ้ฒใใใใซใใใใใๆงๆใใใใจใซใใพใใใ
+[`Trainer`] ใณใใณใใฉใคใณๅผๆฐ็ต็ฑใ
+
+ใใใซใไธ้จใฎๆงๆๅคใฏใขใใซใฎๆงๆใซๅบใฅใใฆ่ชๅ็ใซๅฐๅบใใใพใใ
+่คๆฐใฎๅคใๆๅใง่ชฟๆดใใใใจใๅฟใใชใใงใใ ใใใ[`Trainer`] ใซๅคง้จๅใไปปใใใฎใๆๅใงใ
+ใฎ่จญๅฎใ่กใใพใใ
+
+ใใใใฃใฆใใใฎใฌใคใใฎๆฎใใฎ้จๅใงใฏใ็นๅฅใช่จญๅฎๅค `auto` ใ่กจ็คบใใใพใใใใใ่จญๅฎใใใจใ
+ๆญฃใใๅคใพใใฏๆใๅน็็ใชๅคใซ่ชๅ็ใซ็ฝฎใๆใใใใพใใใใใ็ก่ฆใใใใจใ่ช็ฑใซ้ธๆใใฆใใ ใใ
+ๆจๅฅจไบ้
ใๅ็
งใใๅคใๆ็คบ็ใซ่จญๅฎใใพใใใใฎๅ ดๅใๆฌกใฎ็นใซๅๅๆณจๆใใฆใใ ใใใ
+[`Trainer`] ๅผๆฐใจ DeepSpeed ่จญๅฎใฏไธ่ดใใพใใใใจใใฐใๅใใใฎใไฝฟ็จใใฆใใพใใ
+ๅญฆ็ฟ็ใใใใใตใคใบใใพใใฏๅพ้
็ดฏ็ฉ่จญๅฎ?ใใใใไธ่ดใใชใๅ ดๅใใใฌใผใใณใฐใฏ้ๅธธใซๅคฑๆใใๅฏ่ฝๆงใใใใพใ
+ๆนๆณใๆคๅบใใใฎใ้ฃใใใใใชใใฏ่ญฆๅใๅใใพใใใ
+
+DeepSpeed ใฎใฟใซๅบๆใฎๅคใใใใใซๅใใใฆๆๅใง่จญๅฎใใๅฟ
่ฆใใใๅคใไปใซใ่คๆฐใใใพใใ
+ใใชใใฎ่ฆๆใ
+
+็ฌ่ชใฎใใญใฐใฉใ ใงใDeepSpeed ๆงๆใใในใฟใผใจใใฆๅคๆดใใใๅ ดๅใฏใๆฌกใฎใขใใญใผใใไฝฟ็จใใใใจใใงใใพใใ
+ใใใซๅบใฅใใฆ [`TrainingArguments`] ใ่จญๅฎใใพใใๆ้ ใฏๆฌกใฎใจใใใงใใ
+
+1. ใในใฟใผๆงๆใจใใฆไฝฟ็จใใ DeepSpeed ๆงๆใไฝๆใพใใฏใญใผใใใพใ
+2. ใใใใฎๅคใซๅบใฅใใฆ [`TrainingArguments`] ใชใใธใงใฏใใไฝๆใใพใ
+
+`scheduler.params.total_num_steps`ใชใฉใฎไธ้จใฎๅคใฏๆฌกใฎใใใซ่จ็ฎใใใใใจใซๆณจๆใใฆใใ ใใใ
+`train` ไธญใซ [`Trainer`] ใๅฎ่กใใพใใใใใกใใ่ชๅใง่จ็ฎใใใใจใใงใใพใใ
+
+
+
+### ZeRO
+
+[Zero Redundancy Optimizer (ZeRO)](https://www.deepspeed.ai/tutorials/zero/) ใฏใDeepSpeed ใฎไธปๅ่ฃฝๅใงใใใใ
+3 ใคใฎ็ฐใชใใฌใใซ (ๆฎต้) ใฎๆ้ฉๅใใตใใผใใใพใใๆๅใฎใใฎใฏใในใฑใผใฉใใชใใฃใฎ่ฆณ็นใใใฏใใพใ่ๅณๆทฑใใใฎใงใฏใใใพใใใ
+ใใใใฃใฆใใใฎใใญใฅใกใณใใงใฏในใใผใธ 2 ใจ 3 ใซ็ฆ็นใๅฝใฆใพใใในใใผใธ 3 ใฏใๆๆฐใฎ ZeRO-Infinity ใฎ่ฟฝๅ ใซใใฃใฆใใใซๆนๅใใใฆใใพใใ
+่ฉณ็ดฐใซใคใใฆใฏใDeepSpeed ใฎใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+
+ๆงๆใใกใคใซใฎ `zero_optimization` ใปใฏใทใงใณใฏๆใ้่ฆใช้จๅใงใ ([docs](https://www.deepspeed.ai/docs/config-json/#zero-optimizations-for-fp16-training))ใใใใงๅฎ็พฉใใพใ
+ใฉใฎ ZeRO ในใใผใธใๆๅนใซใใใใใใใฆใใใใใฉใฎใใใซๆงๆใใใใๅใใฉใกใผใฟใฎ่ชฌๆใฏใ
+DeepSpeed ใฎใใญใฅใกใณใใ
+
+ใใฎใปใฏใทใงใณใฏใDeepSpeed ่จญๅฎใไปใใฆใฎใฟ่จญๅฎใใๅฟ
่ฆใใใใพใ - [`Trainer`] ใๆไพใใพใ
+ๅ็ญใฎใณใใณใใฉใคใณๅผๆฐใฏใใใพใใใ
+
+ๆณจ: ็พๅจใDeepSpeed ใฏใใฉใกใผใฟใผๅใๆค่จผใใชใใใใในใใซใ้้ใใใจใใใใฉใซใ่จญๅฎใไฝฟ็จใใใพใใ
+ในใใซใ้้ใฃใฆใใใใฉใกใผใฟใ DeepSpeed ใจใณใธใณใฎ่ตทๅใญใฐ ใกใใปใผใธใ่ฆใฆใใใฎๅคใ็ขบ่ชใงใใพใใ
+ไฝฟ็จใใใคใใใงใใ
+
+
+
+#### ZeRO-2 Config
+
+ไปฅไธใฏใZeRO ในใใผใธ 2 ใฎๆงๆไพใงใใ
+
+```json
+{
+ "zero_optimization": {
+ "stage": 2,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "allgather_partitions": true,
+ "allgather_bucket_size": 5e8,
+ "overlap_comm": true,
+ "reduce_scatter": true,
+ "reduce_bucket_size": 5e8,
+ "contiguous_gradients": true
+ }
+}
+```
+
+**ๆง่ฝ่ชฟๆด๏ผ**
+
+- `offload_optimizer` ใๆๅนใซใใใจใGPU RAM ใฎไฝฟ็จ้ใๅๆธใใใพใ (`"stage": 2` ใๅฟ
่ฆใงใ)
+- `"overlap_comm": true` ใฏใGPU RAM ไฝฟ็จ้ใฎๅขๅ ใจใใฌใผใใชใใใฆใ้
ๅปถใใในใฆๅๆธใใพใใ `overlap_comm`ใฏ 4.5x ใไฝฟ็จใใพใ
+ `allgather_bucket_size`ใจ`reduce_bucket_size`ใฎๅคใใใใใฃใฆใ5e8 ใซ่จญๅฎใใใฆใใๅ ดๅใ9GB ใๅฟ
่ฆใซใชใใพใใ
+ ใใใใใชใณใ (`5e8 x 2Bytes x 2 x 4.5`)ใใใใใฃใฆใ8GB ไปฅไธใฎ RAM ใๆญ่ผใใ GPU ใไฝฟ็จใใฆใใๅ ดๅใ
+ OOM ใจใฉใผใ็บ็ใใๅ ดๅใฏใใใใใฎใใฉใกใผใฟใ`2e8`็จๅบฆใซๆธใใๅฟ
่ฆใใใใใใใซใฏ 3.6GB ใๅฟ
่ฆใซใชใใพใใใใใใใชใใงใใใ
+ OOM ใซ้ใๅงใใฆใใๅ ดๅใฏใใใๅคงๅฎน้ใฎ GPU ใงใๅๆงใงใใ
+- ใใใใฎใใใใกใๆธใใใจใใใๅคใใฎ GPU RAM ใๅฉ็จใใใใใซ้ไฟก้ๅบฆใ็ ็ฒใซใใใใจใซใชใใพใใใใใใกใตใคใบใๅฐใใใปใฉใ
+ ้ไฟกใ้
ใใชใใไปใฎใฟในใฏใงไฝฟ็จใงใใ GPU RAM ใๅขใใพใใใใใใฃใฆใใใใใตใคใบใๅคงใใๅ ดๅใฏใ
+ ้่ฆใชใฎใฏใใใฌใผใใณใฐๆ้ใๅฐใ้
ใใใใใจใฏ่ฏใใใฌใผใใซใชใๅฏ่ฝๆงใใใใพใใ
+
+ใใใซใ`deepspeed==0.4.4`ใซใฏใๆฌกใฎใณใใณใใงๆๅนใซใงใใๆฐใใใชใใทใงใณ`round_robin_gradients`ใ่ฟฝๅ ใใใพใใใ
+
+```json
+{
+ "zero_optimization": {
+ "round_robin_gradients": true
+ }
+}
+```
+
+ใใใฏใใใ็ดฐใใๅพ้
ใใผใใฃใทใงใใณใฐใซใใฃใฆใฉใณใฏ้ใฎ CPU ใกใขใชใธใฎๅพ้
ใณใใผใไธฆๅๅใใใCPU ใชใใญใผใใฎในใใผใธ 2 ๆ้ฉๅใงใใใใใฉใผใใณในใฎๅฉ็นใฏใๅพ้
็ดฏ็ฉในใใใ (ใชใใใฃใใคใถใผ ในใใใ้ใฎใณใใผใฎๅขๅ ) ใพใใฏ GPU ๆฐ (ไธฆๅๅฆ็ใฎๅขๅ ) ใซๅฟใใฆๅขๅ ใใพใใ
+
+
+
+#### ZeRO-3 Config
+
+ไปฅไธใฏใZeRO ในใใผใธ 3 ใฎๆงๆไพใงใใ
+
+```json
+{
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": "auto",
+ "stage3_prefetch_bucket_size": "auto",
+ "stage3_param_persistence_threshold": "auto",
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ }
+}
+```
+
+ใขใใซใพใใฏใขใฏใใฃใใผใทใงใณใ GPU ใกใขใชใซ้ฉๅใใใCPU ใๆชไฝฟ็จใงใใใใใซ OOM ใ็บ็ใใฆใใๅ ดๅ
+`"device": "cpu"` ใไฝฟ็จใใฆใชใใใฃใใคใถใฎ็ถๆ
ใจใใฉใกใผใฟใ CPU ใกใขใชใซใกใขใชใชใใญใผใใใใจใใใฎๅถ้ใ่งฃๆฑบใใใๅฏ่ฝๆงใใใใพใใ
+CPU ใกใขใชใซใชใใญใผใใใใใชใๅ ดๅใฏใ`device`ใจใณใใชใซ`cpu`ใฎไปฃใใใซ`none`ใไฝฟ็จใใพใใใชใใญใผใๅ
+NVMe ใซใคใใฆใฏๅพใปใฉ่ชฌๆใใพใใ
+
+ๅบๅฎใกใขใชใฏใ`pin_memory`ใ`true`ใซ่จญๅฎใใใจๆๅนใซใชใใพใใใใฎๆฉ่ฝใซใใใๆฌกใฎใใใชใณในใใใใใฆในใซใผใใใใๅไธใใใใใจใใงใใพใใ
+ไปใฎใใญใปในใไฝฟ็จใงใใใกใขใชใๅฐใชใใชใใพใใใใณ็ใใใใใกใขใชใฏใใใใ่ฆๆฑใใ็นๅฎใฎใใญใปในใฎใใใซ็ขบไฟใใใพใใ
+้ๅธธใ้ๅธธใฎ CPU ใกใขใชใใใใฏใใใซ้ซ้ใซใขใฏใปในใใใพใใ
+
+**ๆง่ฝ่ชฟๆด๏ผ**
+
+- `stage3_max_live_parameters`: `1e9`
+- `stage3_max_reuse_distance`: `1e9`
+
+OOM ใซ้ใใๅ ดๅใฏใใstage3_max_live_parametersใใจใstage3_max_reuse_ distanceใใๆธใใใพใใๅฝฑ้ฟใฏๆๅฐ้ใซๆใใใใใฏใใงใ
+ใขใฏใใฃใๅใใงใใฏใใคใณใใๅฎ่กใใชใ้ใใใใใฉใผใใณในใซๅฝฑ้ฟใใพใใ `1e9`ใฏ็ด 2GB ใๆถ่ฒปใใพใใ่จๆถใๅ
ฑๆใใฆใใใฎใฏใ
+`stage3_max_live_parameters` ใจ `stage3_max_reuse_distance` ใชใฎใงใๅ ็ฎใใใใใฎใงใฏใชใใๅ่จใง 2GB ใซใชใใพใใ
+
+`stage3_max_live_parameters` ใฏใ็นๅฎใฎๆ็นใง GPU ไธใซไฟๆใใๅฎๅ
จใชใใฉใกใผใฟใฎๆฐใฎไธ้ใงใใ
+ๆ้ใ ใๅๅฉ็จ่ท้ขใใฏใใใฉใกใผใฟใๅฐๆฅใใคๅใณไฝฟ็จใใใใใๅคๆญใใใใใซไฝฟ็จใใๆๆจใงใใ
+`stage3_max_reuse_ distance`ใไฝฟ็จใใฆใใใฉใกใผใฟใ็ ดๆฃใใใไฟๆใใใใๆฑบๅฎใใพใใใใฉใกใผใฟใ
+่ฟใๅฐๆฅใซๅใณไฝฟ็จใใใไบๅฎ (`stage3_max_reuse_distance`ๆชๆบ) ใชใฎใงใ้ไฟกใๆธใใใใใซไฟๆใใพใใ
+ใชใผใใผใใใใใใใฏใใขใฏใใฃใใผใทใงใณ ใใงใใฏใใคใณใใๆๅนใซใใฆใใๅ ดๅใซ้ๅธธใซๅฝน็ซใกใพใใใใฉใฏใผใๅ่จ็ฎใ่กใใใ
+backward ใฏๅไธใฌใคใคใผ็ฒๅบฆใๆธกใใๅพๆนๅ่จ็ฎใพใงใใฉใกใผใฟใๅๆนๅ่จ็ฎใซไฟๆใใใใจ่ใใฆใใพใใ
+
+ๆฌกใฎๆงๆๅคใฏใใขใใซใฎ้่กจ็คบใตใคใบใซใใฃใฆ็ฐใชใใพใใ
+
+- `reduce_bucket_size`: `hidden_size*hidden_size`
+- `stage3_prefetch_bucket_size`: `0.9 * hidden_size * hidden_size`
+- `stage3_param_persistence_threshold`: `10 * hidden_size`
+
+ใใใใฃใฆใใใใใฎๅคใ `auto` ใซ่จญๅฎใใใจใ[`Trainer`] ใๆจๅฅจใใใๅคใ่ชๅ็ใซๅฒใๅฝใฆใพใใ
+ไพกๅค่ฆณใใใ ใใใใกใใใใใใใๆ็คบ็ใซ่จญๅฎใใใใจใใงใใพใใ
+
+`stage3_gather_16bit_weights_on_model_save` ใฏใใขใใซใฎไฟๅญๆใซใขใใซ fp16 ใฎ้ใฟ็ตฑๅใๆๅนใซใใพใใๅคงใใ
+ใขใใซใจ่คๆฐใฎ GPU ใฎๅ ดๅใใใใฏใกใขใชใจ้ๅบฆใฎไธกๆนใฎ็นใง้ซไพกใชๆไฝใงใใ็พๅจๅฟ
้ ใจใชใฃใฆใใใฎใฏใ
+ใใฌใผใใณใฐใๅ้ใใไบๅฎใงใใใใฎๅถ้ใๅใ้คใใใใไพฟๅฉใซใใไปๅพใฎใขใใใใผใใซๆณจ็ฎใใฆใใ ใใใ
+ใใฌใญใทใใซใ
+
+ZeRO-2 ๆงๆใใ็งป่กใใฆใใๅ ดๅใฏใ`allgather_partitions`ใ`allgather_bucket_size`ใใใใณ
+`reduce_scatter`่จญๅฎใใฉใกใผใฟใฏ ZeRO-3 ใงใฏไฝฟ็จใใใพใใใใใใใ่จญๅฎใใกใคใซใซไฟๅญใใฆใใใจใ
+็ก่ฆใใใใ
+
+- `sub_group_size`: `1e9`
+
+
+`sub_group_size` ใฏใใชใใใฃใใคใถใผใฎในใใใไธญใซใใฉใกใผใฟใผใๆดๆฐใใใ็ฒๅบฆใๅถๅพกใใพใใใใฉใกใผใฟใฏๆฌกใฎใจใใใงใใ
+`sub_group_size` ใฎใใฑใใใซใฐใซใผใๅใใใๅใใฑใใใฏไธๅบฆใซ 1 ใคใใคๆดๆฐใใใพใใ NVMeใชใใญใผใใงไฝฟ็จใใๅ ดๅ
+ใใใใฃใฆใZeRO-Infinity ใฎ `sub_group_size`ใฏใใขใใซใฎ็ถๆ
ใ CPU ใซๅบๅ
ฅใใใ็ฒๅบฆใๅถๅพกใใพใใ
+ใชใใใฃใใคใถในใใใไธญใซ NVMe ใใใกใขใชใๅๅพใใพใใใใใซใใใ้ๅธธใซๅคง่ฆๆจกใชใขใใซใฎ CPU ใกใขใชไธ่ถณใ้ฒๆญขใใใพใใ
+
+NVMe ใชใใญใผใใไฝฟ็จใใชใๅ ดๅใฏใ`sub_group_size`ใใใใฉใซใๅคใฎ *1e9* ใฎใพใพใซใใใใจใใงใใพใใๅคๆดใใใใจใใงใใพใ
+ๆฌกใฎๅ ดๅใฎใใใฉใซใๅค:
+
+1. ใชใใใฃใใคใถใผ ในใใใไธญใซ OOM ใ็บ็ใใ: `sub_group_size` ใๆธใใใฆใไธๆใใใใกใผใฎใกใขใชไฝฟ็จ้ใๅๆธใใพใใ
+2. ใชใใใฃใใคใถใผ ในใใใใซๆ้ใใใใใพใใ`sub_group_size`ใๅขใใใฆใๅธฏๅๅน
ใฎไฝฟ็จ็ใๅไธใใใพใใ
+ ใใผใฟใใใใกใฎๅขๅ ใ
+
+#### ZeRO-0 Config
+
+ในใใผใธ 0 ใจ 1 ใฏใใฃใใซไฝฟ็จใใใชใใใใๆๅพใซใชในใใใฆใใใใจใซๆณจๆใใฆใใ ใใใ
+
+ในใใผใธ 0 ใงใฏใใในใฆใฎใฟใคใใฎใทใฃใผใใฃใณใฐใ็กๅนใซใใDDP ใจใใฆ DeepSpeed ใฎใฟใไฝฟ็จใใพใใๆฌกใฎใณใใณใใงใชใณใซใงใใพใใ
+
+```json
+{
+ "zero_optimization": {
+ "stage": 0
+ }
+}
+```
+
+ใใใซใใใไปใซไฝใๅคๆดใใๅฟ
่ฆใใชใใๅบๆฌ็ใซ ZeRO ใ็กๅนใซใชใใพใใ
+
+#### ZeRO-1 Config
+
+ในใใผใธ 1 ใฏใในใใผใธ 2 ใใใฐใฉใใผใทใงใณ ใทใฃใผใใฃใณใฐใ้คใใใใฎใงใใใชใใใฃใใคใถใผใฎ็ถๆ
ใใทใฃใผใๅใใใ ใใงใๅฆ็ใๅฐใ้ซ้ๅใใใใใซใใคใงใ่ฉฆใใใจใใงใใพใใ
+
+```json
+{
+ "zero_optimization": {
+ "stage": 1
+ }
+}
+```
+
+
+
+### NVMe Support
+
+ZeRO-Infinity ใฏใGPU ใจ CPU ใกใขใชใ NVMe ใกใขใชใงๆกๅผตใใใใจใงใ้ๅธธใซๅคง่ฆๆจกใชใขใใซใฎใใฌใผใใณใฐใๅฏ่ฝใซใใพใใใใใใง
+ในใใผใ ใใผใใฃใทใงใใณใฐใใใณใฟใคใชใณใฐ ใขใซใดใชใบใ ใงใฏใๅ GPU ใ้ๅธธใซๅฐ้ใฎใใผใฟใ้ๅไฟกใใๅฟ
่ฆใใใใพใใ
+ใชใใญใผใใซใใใๆๆฐใฎ NVMe ใใใฌใผใใณใฐใซๅฉ็จใงใใๅ่จใกใขใช ใใผใซใใใใซๅคงใใใใใฎใซ้ฉใใฆใใใใจใๅคๆใใพใใใ
+ใใญใปในใ ZeRO-Infinity ใซใฏใZeRO-3 ใๆๅนใซใชใฃใฆใใๅฟ
่ฆใใใใพใใ
+
+ๆฌกใฎ่จญๅฎไพใงใฏใNVMe ใใชใใใฃใใคใถใฎ็ถๆ
ใจใใฉใกใผใฟใฎไธกๆนใใชใใญใผใใงใใใใใซใใพใใ
+
+```json
+{
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "nvme",
+ "nvme_path": "/local_nvme",
+ "pin_memory": true,
+ "buffer_count": 4,
+ "fast_init": false
+ },
+ "offload_param": {
+ "device": "nvme",
+ "nvme_path": "/local_nvme",
+ "pin_memory": true,
+ "buffer_count": 5,
+ "buffer_size": 1e8,
+ "max_in_cpu": 1e9
+ },
+ "aio": {
+ "block_size": 262144,
+ "queue_depth": 32,
+ "thread_count": 1,
+ "single_submit": false,
+ "overlap_events": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": "auto",
+ "stage3_prefetch_bucket_size": "auto",
+ "stage3_param_persistence_threshold": "auto",
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ },
+}
+```
+
+ใชใใใฃใใคใถใฎ็ถๆ
ใจใใฉใกใผใฟใฎไธกๆนใ NVMe ใซใชใใญใผใใใใใใฉใกใใ 1 ใคใ ใใใชใใญใผใใใใใใพใฃใใใชใใญใผใใใชใใใ้ธๆใงใใพใใใใจใใฐใๆฌกใฎๅ ดๅ
+ๅฉ็จๅฏ่ฝใช CPU ใกใขใชใๅคง้ใซใใๅ ดๅใฏใ้ซ้ใซใชใใใใๅฟ
ใ CPU ใกใขใชใฎใฟใซใชใใญใผใใใฆใใ ใใ (ใใณใ:
+*"device": "CPU"*)ใ
+
+[ใชใใใฃใใคใถใผใฎ็ถๆ
](https://www.deepspeed.ai/docs/config-json/#optimizer-offloading) ใจ [ใใฉใกใผใฟใผ](https://www.deepspeed.ai/docs/config-json/#parameter-offloading)ใ
+
+`nvme_path`ใๅฎ้ใซ NVMe ใงใใใใจใ็ขบ่ชใใฆใใ ใใใNVMe ใฏ้ๅธธใฎใใผใใใฉใคใใพใใฏ SSD ใงๅไฝใใพใใใ
+ใฏใใใซ้
ใใชใใพใใ้ซ้ในใฑใผใฉใใซใชใใฌใผใใณใฐใฏใๆๆฐใฎ NVMe ่ปข้้ๅบฆใๅฟต้ ญใซ็ฝฎใใฆ่จญ่จใใใพใใ (ใใฎๆ็นใงใฏ
+ๆธใ่พผใฟใงใฏใ่ชญใฟๅใๆๅคง 3.5 GB/็งใๆธใ่พผใฟๆๅคง 3 GB/็งใฎใใผใฏ้ๅบฆใๅพใใใพใ)ใ
+
+ๆ้ฉใช`aio`ๆงๆใใญใใฏใ่ฆใคใใใซใฏใใฟใผใฒใใ่จญๅฎใงใใณใใใผใฏใๅฎ่กใใๅฟ
่ฆใใใใพใใ
+[ใใใง่ชฌๆ](https://github.com/microsoft/DeepSpeed/issues/998)ใ
+
+
+
+
+#### ZeRO-2 vs ZeRO-3 Performance
+
+ZeRO-3 ใฏใไปใฎใในใฆใๅใใใใซๆงๆใใใฆใใๅ ดๅใZeRO-2 ใใใ้
ใใชใๅฏ่ฝๆงใใใใพใใๅ่
ใฏๅ้ใใๅฟ
่ฆใใใใใใงใใ
+ZeRO-2 ใฎๆฉ่ฝใซๅ ใใฆใขใใซใฎ้ใฟไปใใ่กใใพใใ ZeRO-2 ใใใผใบใๆบใใใๆฐๅใฎ GPU ใ่ถ
ใใฆๆกๅผตใใๅฟ
่ฆใใชใๅ ดๅ
+ใใใใใฐใใใใซๅบๅทใใใใจใ้ธๆใใใใจใใงใใพใใ ZeRO-3 ใซใใใใฏใใใซ้ซใในใฑใผใฉใใชใใฃๅฎน้ใๅฏ่ฝใซใชใใใจใ็่งฃใใใใจใ้่ฆใงใ
+ในใใผใใ็ ็ฒใซใใฆใ
+
+ZeRO-3 ใฎๆงๆใ่ชฟๆดใใฆใZeRO-2 ใซ่ฟใฅใใใใจใใงใใพใใ
+
+- `stage3_param_persistence_threshold` ใ้ๅธธใซๅคงใใชๆฐๅคใซ่จญๅฎใใพใใใใจใใฐใ`6 * hidden_โโsize * hidden_โโsize` ใฎใใใซใๆๅคงโโใใฉใกใผใฟใใใๅคงใใใชใใพใใใใใซใใใใใฉใกใผใฟใ GPU ใซไฟๆใใใพใใ
+- ZeRO-2 ใซใฏใใฎใชใใทใงใณใใชใใใใ`offload_params` ใใชใใซใใพใใ
+
+ๅคๆดใใชใใฆใใ`offload_params`ใใชใใซใใใ ใใงใใใฉใผใใณในใๅคงๅน
ใซๅไธใใๅฏ่ฝๆงใใใใพใใ
+`stage3_param_persistence_threshold`ใใใกใใใใใใใฎๅคๆดใฏใใฌใผใใณใฐใงใใใขใใซใฎใตใคใบใซๅฝฑ้ฟใใพใใใใใง
+ใใใใฏใใใผใบใซๅฟใใฆใในใฑใผใฉใใชใใฃใจๅผใๆใใซ้ๅบฆใๅไธใใใใฎใซๅฝน็ซใกใพใใ
+
+
+
+#### ZeRO-2 Example
+
+ไปฅไธใฏใๅฎๅ
จใช ZeRO-2 ่ชๅๆงๆใใกใคใซ `ds_config_zero2.json` ใงใใ
+
+```json
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 2,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "allgather_partitions": true,
+ "allgather_bucket_size": 2e8,
+ "overlap_comm": true,
+ "reduce_scatter": true,
+ "reduce_bucket_size": 2e8,
+ "contiguous_gradients": true
+ },
+
+ "gradient_accumulation_steps": "auto",
+ "gradient_clipping": "auto",
+ "steps_per_print": 2000,
+ "train_batch_size": "auto",
+ "train_micro_batch_size_per_gpu": "auto",
+ "wall_clock_breakdown": false
+}
+```
+
+ไปฅไธใฏใๆๅใง่จญๅฎใใใๅฎๅ
จใช ZeRO-2 ใฎใในใฆใๆๅนใชๆงๆใใกใคใซใงใใใใใงใฏไธปใซใๅ
ธๅ็ใชใใฎใ็ขบ่ชใใใใใฎใใฎใงใใ
+ๅคใฏๆฌกใฎใใใซใชใใพใใใ่คๆฐใฎ`auto`่จญๅฎใๅซใพใใๅคใไฝฟ็จใใใใจใๅผทใใๅงใใใพใใ
+
+```json
+{
+ "fp16": {
+ "enabled": true,
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": 3e-5,
+ "betas": [0.8, 0.999],
+ "eps": 1e-8,
+ "weight_decay": 3e-7
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": 0,
+ "warmup_max_lr": 3e-5,
+ "warmup_num_steps": 500
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 2,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "allgather_partitions": true,
+ "allgather_bucket_size": 2e8,
+ "overlap_comm": true,
+ "reduce_scatter": true,
+ "reduce_bucket_size": 2e8,
+ "contiguous_gradients": true
+ },
+
+ "steps_per_print": 2000,
+ "wall_clock_breakdown": false
+}
+```
+
+
+
+#### ZeRO-3 Example
+
+ไปฅไธใฏใๅฎๅ
จใช ZeRO-3 ่ชๅๆงๆใใกใคใซ`ds_config_zero3.json`ใงใใ
+
+```json
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": "auto",
+ "stage3_prefetch_bucket_size": "auto",
+ "stage3_param_persistence_threshold": "auto",
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ },
+
+ "gradient_accumulation_steps": "auto",
+ "gradient_clipping": "auto",
+ "steps_per_print": 2000,
+ "train_batch_size": "auto",
+ "train_micro_batch_size_per_gpu": "auto",
+ "wall_clock_breakdown": false
+}
+```
+
+ไปฅไธใฏใๆๅใง่จญๅฎใใใๅฎๅ
จใช ZeRO-3 ใฎใในใฆใๆๅนใชๆงๆใใกใคใซใงใใใใใงใฏไธปใซใๅ
ธๅ็ใชใใฎใ็ขบ่ชใใใใใฎใใฎใงใใ
+ๅคใฏๆฌกใฎใใใซใชใใพใใใ่คๆฐใฎ`auto`่จญๅฎใๅซใพใใๅคใไฝฟ็จใใใใจใๅผทใใๅงใใใพใใ
+
+```json
+{
+ "fp16": {
+ "enabled": true,
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": 3e-5,
+ "betas": [0.8, 0.999],
+ "eps": 1e-8,
+ "weight_decay": 3e-7
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": 0,
+ "warmup_max_lr": 3e-5,
+ "warmup_num_steps": 500
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": 1e6,
+ "stage3_prefetch_bucket_size": 0.94e6,
+ "stage3_param_persistence_threshold": 1e4,
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ },
+
+ "steps_per_print": 2000,
+ "wall_clock_breakdown": false
+}
+```
+
+#### How to Choose Which ZeRO Stage and Offloads To Use For Best Performance
+
+ใใใงใใใพใใพใชๆฎต้ใใใใใจใใใใใพใใใใฉใกใใไฝฟ็จใใใใใฉใฎใใใซๆฑบๅฎใใใฐใใใงใใใใ?ใใฎใปใฏใทใงใณใงใฏใใใฎ่ณชๅใซ็ญใใฆใใใพใใ
+
+ไธ่ฌใซใๆฌกใฎใใจใๅฝใฆใฏใพใใพใใ
+
+- ้ๅบฆใฎ็น๏ผๅทฆใฎๆนใๅณใใ้ใ๏ผ
+
+ในใใผใธ 0 (DDP) > ในใใผใธ 1 > ในใใผใธ 2 > ในใใผใธ 2 + ใชใใญใผใ > ในใใผใธ 3 > ในใใผใธ 3 + ใชใใญใผใ
+
+- GPU ใกใขใชใฎไฝฟ็จ็ถๆณ (ๅณใฏๅทฆใใใ GPU ใกใขใชๅน็ใ้ซใ)
+
+ในใใผใธ 0 (DDP) < ในใใผใธ 1 < ในใใผใธ 2 < ในใใผใธ 2 + ใชใใญใผใ < ในใใผใธ 3 < ในใใผใธ 3 + ใชใใญใผใ
+
+ใใใใฃใฆใๆๅฐ้ใฎๆฐใฎ GPU ใซๅใพใใชใใๆ้ใฎๅฎ่กใๅฎ็พใใใๅ ดๅใฏใๆฌกใฎใใญใปในใซๅพใใใจใใงใใพใใๆใ้ใใขใใญใผใใใ้ๅงใใGPU OOM ใซ้ฅใฃใๅ ดๅใฏใๆฌกใซ้
ใใขใใญใผใใซ้ฒใฟใพใใใใใใซใใไฝฟ็จใใใ GPU ใกใขใชใๅฐใชใใชใใพใใใชใฉใชใฉใ
+
+ใพใใใใใ ใตใคใบใ 1 ใซ่จญๅฎใใพใ (ๅฟ
่ฆใชๆๅนใใใ ใตใคใบใซๅฏพใใฆใใใคใงใๅพ้
็ดฏ็ฉใไฝฟ็จใงใใพใ)ใ
+
+1. `--gradient_checkpointing 1` (HF Trainer) ใพใใฏ็ดๆฅ `model.gradient_checkpointing_enable()` ใๆๅนใซใใพใ - OOM ใฎๅ ดๅ
+2. ๆๅใซ ZeRO ในใใผใธ 2 ใ่ฉฆใใฆใใ ใใใ OOMใฎๅ ดๅ
+3. ZeRO ในใใผใธ 2 + `offload_optimizer` ใ่ฉฆใใพใ - OOM ใฎๅ ดๅ
+4. ZeRO ในใใผใธ 3 ใซๅใๆฟใใ - OOM ใฎๅ ดๅ
+5. `cpu` ใซๅฏพใใฆ `offload_param` ใๆๅนใซใใพใ - OOM ใฎๅ ดๅ
+6. OOM ใฎๅ ดๅใฏใ`cpu`ใซๅฏพใใฆ`offload_optimizer`ใๆๅนใซใใพใใ
+
+7. ใใใงใใใใ ใตใคใบ 1 ใซ้ฉๅใใชใๅ ดๅใฏใใพใใใพใใพใชใใใฉใซใๅคใ็ขบ่ชใใๅฏ่ฝใงใใใฐๅคใไธใใพใใใใจใใฐใ`generate`ใไฝฟ็จใใๅบใๆค็ดขใใผใ ใไฝฟ็จใใชใๅ ดๅใฏใๅคง้ใฎใกใขใชใๆถ่ฒปใใใใใๆค็ดขใใผใ ใ็ญใใใพใใ
+
+8. fp32 ใงใฏๅฟ
ใๆททๅๅ็ฒพๅบฆใไฝฟ็จใใพใใใคใพใใAmpere ไปฅไธใฎ GPU ใงใฏ bf16ใๅคใ GPU ใขใผใญใใฏใใฃใงใฏ fp16 ใไฝฟ็จใใพใใ
+
+9. ใใใงใ OOM ใ่กใๅ ดๅใฏใใใผใใฆใงใขใ่ฟฝๅ ใใใใZeRO-Infinity ใๆๅนใซใใใใจใใงใใพใใใคใพใใใชใใญใผใ `offload_param` ใจ `offload_optimizer` ใ `nvme` ใซๅใๆฟใใพใใ้ๅธธใซ้ซ้ใช nvme ใงใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ้ธ่ฉฑใจใใฆใZeRO-Infinity ใไฝฟ็จใใฆๅฐใใช GPU ใง BLOOM-176B ใๆจ่ซใใใใจใใงใใพใใใใ้ๅธธใซ้
ใใฃใใงใใใงใใใใพใใใใพใใ๏ผ
+
+ใใกใใใๆใ GPU ใกใขใชๅน็ใฎ้ซใๆงๆใใๅงใใฆใๅพใใ้ใซ้ฒใใใจใงใใใใใฎๆ้ ใ้ใซๅฎ่กใใใใจใใงใใพใใใใใใฏไบ็ญๅใใฆใฟใฆใใ ใใใ
+
+OOM ใๅผใ่ตทใใใชใใใใ ใตใคใบ 1 ใๅๅพใใใใๅฎๅนในใซใผใใใใๆธฌๅฎใใพใใ
+
+ๆฌกใซใใใใ ใตใคใบใใงใใใ ใๅคงใใใใฆใฟใพใใใใใ ใตใคใบใๅคงใใใปใฉใไน็ฎใใ่กๅใๅทจๅคงใชๅ ดๅใซ GPU ใฎใใใฉใผใใณในใๆ้ซใซใชใใใใGPU ใฎๅน็ใๅไธใใพใใ
+
+ใใใงใใใใฉใผใใณในๆ้ฉๅใฒใผใ ใๅงใพใใพใใไธ้จใฎใชใใญใผใๆฉ่ฝใใชใใซใใใใZeRO ๆฎต้ใงในใใใใใฆใณใใฆใใใ ใตใคใบใๅขๆธใใฆใๅฎๅนในใซใผใใใใๅๅบฆๆธฌๅฎใใใใจใใงใใพใใๆบ่ถณใใใพใงๆดใๆตใใ็นฐใ่ฟใใพใใ
+
+ๆฐธ้ ใซใใใซ่ฒปใใๅฟ
่ฆใฏใใใพใใใใ3 ใๆใฎใใฌใผใใณใฐใ้ๅงใใใใจใใฆใใๅ ดๅใฏใในใซใผใใใใซ้ขใใฆๆใๅนๆ็ใช่จญๅฎใ่ฆใคใใใใใซๆฐๆฅใใใฆใใ ใใใใใฎใใใใใฌใผใใณใฐใฎใณในใใๆๅฐ้ใซใชใใใใฌใผใใณใฐใใใๆฉใๅฎไบใงใใพใใ็พๅจใฎ็ฎใพใใใใๅคๅใใ ML ใฎไธ็ใงใฏใไฝใใใใฌใผใใณใฐใใใฎใซใใใซ 1 ใๆใใใๅ ดๅใ็ตถๅฅฝใฎๆฉไผใ้ใๅฏ่ฝๆงใใใใพใใใใกใใใใใใฏ็งใๆ่ฆใๅ
ฑๆใใฆใใใ ใใงใใใๆฑบใใฆใใชใใๆฅใใใใจใใฆใใใใใงใฏใใใพใใใ BLOOM-176B ใฎใใฌใผใใณใฐใ้ๅงใใๅใซใใใฎใใญใปในใซ 2 ๆฅ้่ฒปใใใในใซใผใใใใ 90 TFLOP ใใ 150 TFLOP ใซๅไธใใใใใจใใงใใพใใใใใฎๅใ็ตใฟใซใใใใใฌใผใใณใฐๆ้ใ 1 ใๆไปฅไธ็ฏ็ดใงใใพใใใ
+
+ใใใใฎใกใขใฏไธปใซใใฌใผใใณใฐ ใขใผใ็จใซๆธใใใใใฎใงใใใใปใจใใฉใฎๅ ดๅใฏๆจ่ซใซใ้ฉ็จใใใใฏใใงใใใใจใใฐใๅพ้
ใใงใใฏใใคใณใใฏใใฌใผใใณใฐไธญใซใฎใฟๅฝน็ซใคใใใๆจ่ซไธญใฏไฝใ่กใใใพใใใใใใซใใใซใ GPU ๆจ่ซใๅฎ่กใใฆใใฆใ[DeepSpeed-Inference](https://www.deepspeed.ai/tutorials/inference-tutorial/)ใ[Accelerate](https://ใใฐใใงใคใน.co/blog/bloom-inference-pytorch-scripts) ใฏๅชใใใใใฉใผใใณในใๆไพใใใฏใใงใใ
+
+
+ใใฎไปใฎใใใฉใผใใณใน้ข้ฃใฎ็ฐกๅใชใกใข:
+- ไฝใใๆๅใใใใฌใผใใณใฐใใฆใใๅ ดๅใฏใๅธธใซ 16 ใงๅฒใๅใใๅฝข็ถใฎใใณใฝใซ (้ ใใใตใคใบใชใฉ) ใไฝฟ็จใใใใใซใใฆใใ ใใใใใใ ใตใคใบใซใคใใฆใฏใๅฐใชใใจใ 2 ใงๅฒใๅใใใใใซใใฆใใ ใใใ GPU ใใใใใซ้ซใใใใฉใผใใณในใๅผใๅบใใใๅ ดๅใฏใใใผใใฆใงใขๅบๆใฎ [ๆณขใจใฟใคใซใฎ้ๅญๅ](https://developer.nvidia.com/blog/optimizing-gpu-performance-tensor-cores/) ใฎๅฏๅๆงใใใใพใใ
+
+### Activation Checkpointing or Gradient Checkpointing
+
+ใขใฏใใฃใใผใทใงใณ ใใงใใฏใใคใณใใจๅพ้
ใใงใใฏใใคใณใใฏใๅใๆนๆณ่ซใๆใ 2 ใคใฎ็ฐใชใ็จ่ชใงใใใจใฆใใใใใใใงใใใใใใชๆใใงใใ
+
+ๅพ้
ใใงใใฏใใคใณใใไฝฟ็จใใใจใ้ๅบฆใ GPU ใกใขใชใจๅผใๆใใซใงใใพใใใใใซใใใGPU OOM ใๅ
ๆใใใใใใใ ใตใคใบใๅขใใใใจใใงใใๅคใใฎๅ ดๅใใใใฉใผใใณในใฎๅไธใซใคใชใใใพใใ
+
+HF Transformers ใขใใซใฏใDeepSpeed ใฎใขใฏใใฃใใผใทใงใณ ใใงใใฏใใคใณใใซใคใใฆไฝใ็ฅใใชใใใใDeepSpeed ๆงๆใใกใคใซใงใใฎๆฉ่ฝใๆๅนใซใใใใจใใฆใใไฝใ่ตทใใใพใใใ
+
+ใใใใฃใฆใใใฎ้ๅธธใซๆ็ใชๆฉ่ฝใๆดป็จใใใซใฏ 2 ใคใฎๆนๆณใใใใพใใ
+
+1. HF Transformers ใขใใซใไฝฟ็จใใใๅ ดๅใฏใ`model.gradient_checkpointing_enable()` ใๅฎ่กใใใใHF ใใฌใผใใผใง `--gradient_checkpointing` ใไฝฟ็จใใพใใใใใซใใใใใใ่ชๅ็ใซๆๅนใซใชใใพใใใใใงไฝฟใใใใฎใ `torch.utils.checkpoint` ใงใใ
+2. ็ฌ่ชใฎใขใใซใไฝๆใใDeepSpeed ใฎใขใฏใใฃใใผใทใงใณ ใใงใใฏใใคใณใใไฝฟ็จใใใๅ ดๅใฏใ[ใใใง่ฆๅฎใใใฆใใ API](https://deepspeed.readthedocs.io/en/latest/activation-checkpointing.html) ใไฝฟ็จใงใใพใใ HF Transformers ใขใใชใณใฐ ใณใผใใไฝฟ็จใใฆใ`torch.utils.checkpoint` ใ DeepSpeed ใฎ API ใซ็ฝฎใๆใใใใจใใงใใพใใๅพ่
ใฏใ้ ๆนๅใขใฏใใฃใใผใทใงใณใๅ่จ็ฎใใไปฃใใใซ CPU ใกใขใชใซใชใใญใผใใงใใใใใใใๆ่ปใงใใ
+
+### Optimizer and Scheduler
+
+`offload_optimizer`ใๆๅนใซใใชใ้ใใDeepSpeed ในใฑใธใฅใผใฉใผใจ HuggingFace ในใฑใธใฅใผใฉใผใ็ตใฟๅใใใฆไฝฟ็จโโใงใใพใใ
+ใชใใใฃใใคใถใผ (HuggingFace ในใฑใธใฅใผใฉใผใจ DeepSpeed ใชใใใฃใใคใถใผใฎ็ตใฟๅใใใ้คใ):
+
+| Combos | HF Scheduler | DS Scheduler |
+|:-------------|:-------------|:-------------|
+| HF Optimizer | Yes | Yes |
+| DS Optimizer | No | Yes |
+
+`offload_optimizer`ใๆๅนใชๅ ดๅใCPU ใจ
+GPU ๅฎ่ฃ
(LAMB ใ้คใ)ใ
+
+
+
+
+#### Optimizer
+
+DeepSpeed ใฎไธปใชใชใใใฃใใคใถใผใฏใAdamใAdamWใOneBitAdamใLamb ใงใใใใใใฏ ZeRO ใงๅพนๅบ็ใซใในใใใใฆใใใ
+ใใใใฃใฆใไฝฟ็จใใใใจใใๅงใใใพใใใใ ใใไปใฎใชใใใฃใใคใถใใtorchใใใใคใณใใผใใใใใจใฏใงใใพใใๅฎๅ
จใชใใญใฅใกใณใใฏ [ใใกใ](https://www.deepspeed.ai/docs/config-json/#optimizer-parameters) ใซใใใพใใ
+
+่จญๅฎใใกใคใซใง `optimizer` ใจใณใใชใ่จญๅฎใใชใๅ ดๅใ[`Trainer`] ใฏ
+่ชๅ็ใซ`AdamW`ใซ่จญๅฎใใใๆๅฎใใใๅคใพใใฏๆฌกใฎใณใใณใใฉใคใณใฎใใใฉใซใใไฝฟ็จใใใพใใ
+ๅผๆฐ: `--learning_rate`ใ`--adam_beta1`ใ`--adam_beta2`ใ`--adam_epsilon`ใใใใณ `--weight_decay`ใ
+
+ไปฅไธใฏใ`AdamW`ใฎ่ชๅๆงๆใใใ`optimizer`ใจใณใใชใฎไพใงใใ
+
+```json
+{
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ }
+}
+```
+
+ใณใใณใใฉใคใณๅผๆฐใซใใฃใฆๆงๆใใกใคใซๅ
ใฎๅคใ่จญๅฎใใใใใจใซๆณจๆใใฆใใ ใใใใใใฏ 1 ใคใใใใใงใ
+ๅคใฎๆฑบๅฎ็ใชใฝใผในใๆไพใใใใจใใฐๅญฆ็ฟ็ใๆฌกใฎใใใซ่จญๅฎใใใฆใใๅ ดๅใซใ่ฆใคใใซใใใจใฉใผใๅ้ฟใใพใใ
+ใใพใใพใชๅ ดๆใงใใพใใพใชไพกๅค่ฆณใใณใใณใใฉใคใณใฎใซใผใซใใชใผใใผใฉใคใใใใๅคใฏๆฌกใฎใจใใใงใใ
+
+- `lr` ใจ `--learning_rate` ใฎๅค
+- `betas` ใจ `--adam_beta1 --adam_beta2` ใฎๅค
+- `eps` ใจ `--adam_epsilon` ใฎๅค
+- `weight_decay` ใจ `--weight_decay` ใฎๅค
+
+ใใใใฃใฆใใณใใณใใฉใคใณใงๅ
ฑๆใใคใใผใใฉใกใผใฟใ่ชฟๆดใใใใจใๅฟใใชใใงใใ ใใใ
+
+ๅคใๆ็คบ็ใซ่จญๅฎใใใใจใใงใใพใใ
+
+```json
+{
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": 0.001,
+ "betas": [0.8, 0.999],
+ "eps": 1e-8,
+ "weight_decay": 3e-7
+ }
+ }
+}
+```
+
+ใใ ใใ[`Trainer`] ใณใใณใใฉใคใณๅผๆฐใจ DeepSpeed ใ่ชๅใงๅๆใใใใจใซใชใใพใใ
+ๆงๆใ
+
+ไธ่จใซใชในใใใใฆใใชใๅฅใฎใชใใใฃใใคใถใผใไฝฟ็จใใๅ ดๅใฏใใใใใฌใใซใฎๆงๆใซ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+
+```json
+{
+ "zero_allow_untested_optimizer": true
+}
+```
+
+`AdamW`ใจๅๆงใซใๅ
ฌๅผใซใตใใผใใใใฆใใไปใฎใชใใใฃใใคใถใผใๆงๆใงใใพใใใใใใฏ็ฐใชใ่จญๅฎๅคใๆใคๅฏ่ฝๆงใใใใใจใซๆณจๆใใฆใใ ใใใไพใใฐAdam ใฎๅ ดๅใฏใ`weight_decay`ใ`0.01`ไป่ฟใซใใๅฟ
่ฆใใใใพใใ
+
+ใใใซใใชใใญใผใใฏใDeepspeed ใฎ CPU Adam ใชใใใฃใใคใถใผใจไฝต็จใใใจๆใๅนๆ็ใซๆฉ่ฝใใพใใ `deepspeed==0.8.3` ใชใฎใงใใชใใญใผใใงๅฅใฎใชใใใฃใใคใถใผใไฝฟ็จใใใๅ ดๅใฏใไปฅไธใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+
+```json
+{
+ "zero_force_ds_cpu_optimizer": false
+}
+```
+
+ๆไธไฝใฎๆงๆใซ็งป่กใใพใใ
+
+
+
+
+#### Scheduler
+
+
+DeepSpeed ใฏใ`LRRangeTest`ใ`OneCycle`ใ`WarmupLR`ใใใใณ`WarmupDecayLR`ๅญฆ็ฟ็ในใฑใธใฅใผใฉใผใใตใใผใใใฆใใพใใๅฎๅ
จใช
+ใใญใฅใกใณใใฏ[ใใ](https://www.deepspeed.ai/docs/config-json/#scheduler-parameters)ใงใใ
+
+ใใใงใฏใ๐ค Transformers ใจ DeepSpeed ใฎ้ใงในใฑใธใฅใผใฉใผใ้่คใใๅ ดๆใ็คบใใพใใ
+
+- `--lr_scheduler_type constant_with_warmup` ็ต็ฑใฎ `WarmupLR`
+- `--lr_scheduler_type Linear` ใไปใใ `WarmupDecayLR`ใใใใฏ `--lr_scheduler_type` ใฎใใใฉใซใๅคใงใใใใพใใ
+ ใใใใฃใฆใในใฑใธใฅใผใฉใ่จญๅฎใใชใๅ ดๅใใใใใใใฉใซใใง่จญๅฎใใใในใฑใธใฅใผใฉใซใชใใพใใ
+
+่จญๅฎใใกใคใซใง `scheduler` ใจใณใใชใ่จญๅฎใใชใๅ ดๅใ[`Trainer`] ใฏ
+`--lr_scheduler_type`ใ`--learning_rate`ใใใใณ `--warmup_steps` ใพใใฏ `--warmup_ratio` ใฎๅคใ่จญๅฎใใพใใ
+๐ค ใใใฎใใฉใณในใใฉใผใใผใใผใธใงใณใ
+
+ไปฅไธใฏใ`WarmupLR`ใฎ่ชๅๆงๆใใใ`scheduler`ใจใณใใชใฎไพใงใใ
+
+```json
+{
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ }
+}
+```
+
+*"auto"* ใไฝฟ็จใใใฆใใใใใ[`Trainer`] ๅผๆฐใฏ่จญๅฎใซๆญฃใใๅคใ่จญๅฎใใพใใ
+ใใกใคใซใใใใฏใๅคใฎๆฑบๅฎ็ใชใฝใผในใ 1 ใคใใใใจใจใใใจใใฐๆฌกใฎใใใชๅ ดๅใซ่ฆใคใใซใใใจใฉใผใ้ฟใใใใใงใใ
+ๅญฆ็ฟ็ใฏใๅ ดๆใใจใซ็ฐใชใๅคใซ่จญๅฎใใใพใใใณใใณใใฉใคใณใฎใซใผใซใ่จญๅฎใใใๅคใฏๆฌกใฎใจใใใงใใ
+
+- `warmup_min_lr` ใฎๅคใฏ `0` ใงใใ
+- `warmup_max_lr` ใจ `--learning_rate` ใฎๅคใ
+- `warmup_num_steps` ใจ `--warmup_steps` ใฎๅค (ๆๅฎใใใฆใใๅ ดๅ)ใใใไปฅๅคใฎๅ ดๅใฏ `--warmup_ratio` ใไฝฟ็จใใพใ
+ ใใฌใผใใณใฐ ในใใใใฎๆฐใไน็ฎใใๅใไธใใพใใ
+- `total_num_steps` ใซใฏ `--max_steps` ใฎๅคใๆๅฎใใใใๆๅฎใใใฆใใชใๅ ดๅใฏๅฎ่กๆใซ่ชๅ็ใซๅฐๅบใใใพใใ
+ ็ฐๅขใใใผใฟใปใใใฎใตใคใบใใใใณใใฎไปใฎใณใใณใ ใฉใคใณๅผๆฐ (
+ `WarmupDecayLR`)ใ
+
+ใใกใใใๆงๆๅคใฎไธ้จใพใใฏใในใฆใๅผใ็ถใใงใ่ชๅใง่จญๅฎใใใใจใใงใใพใใ
+
+```json
+{
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": 0,
+ "warmup_max_lr": 0.001,
+ "warmup_num_steps": 1000
+ }
+ }
+}
+```
+
+ใใ ใใ[`Trainer`] ใณใใณใใฉใคใณๅผๆฐใจ DeepSpeed ใ่ชๅใงๅๆใใใใจใซใชใใพใใ
+ๆงๆใ
+
+ใใจใใฐใ`WarmupDecayLR`ใฎๅ ดๅใฏใๆฌกใฎใจใณใใชใไฝฟ็จใงใใพใใ
+
+```json
+{
+ "scheduler": {
+ "type": "WarmupDecayLR",
+ "params": {
+ "last_batch_iteration": -1,
+ "total_num_steps": "auto",
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ }
+}
+```
+
+`total_num_steps`ใ`warmup_max_lr`ใ`warmup_num_steps`ใใใใณ `total_num_steps` ใฏใญใผใๆใซ่จญๅฎใใใพใใ
+
+
+
+### fp32 Precision
+
+Deepspeed ใฏใๅฎๅ
จใช fp32 ใจ fp16 ใฎๆททๅ็ฒพๅบฆใใตใใผใใใพใใ
+
+fp16 ๆททๅ็ฒพๅบฆใไฝฟ็จใใใจใๅฟ
่ฆใชใกใขใชใๅคงๅน
ใซๅๆธใใใ้ๅบฆใๅไธใใใใใ
+ไฝฟ็จใใฆใใใขใใซใใใฎใใฌใผใใณใฐ ใขใผใใง้ฉๅใซๅไฝใใชใๅ ดๅใฏใไฝฟ็จใใชใๆนใใใใงใใใใ้ๅธธใใ
+ใขใใซใ fp16 ๆททๅ็ฒพๅบฆใงไบๅใใฌใผใใณใฐใใใฆใใชใๅ ดๅใซ็บ็ใใพใ (ใใจใใฐใใใใฏ bf16 ใงไบๅใใฌใผใใณใฐใใใๅ ดๅใซใใ็บ็ใใพใ)
+ใขใใซ๏ผใใใฎใใใชใขใใซใงใฏใใชใผใใผใใญใผใพใใฏใขใณใใผใใญใผใ็บ็ใใ`NaN`ๆๅคฑใ็บ็ใใๅฏ่ฝๆงใใใใพใใใใใใใชใใฎๅ ดๅใฏใไฝฟ็จใใใใจๆใใงใใใ
+ๅฎๅ
จใช fp32 ใขใผใใใใใฉใซใใฎ fp16 ๆททๅ็ฒพๅบฆใขใผใใๆฌกใฎใใใซๆ็คบ็ใซ็กๅนใซใใพใใ
+
+```json
+{
+ "fp16": {
+ "enabled": false,
+ }
+}
+```
+
+Ampere ใขใผใญใใฏใใฃ ใใผในใฎ GPU ใไฝฟ็จใใฆใใๅ ดๅใpytorch ใใผใธใงใณ 1.7 ไปฅ้ใฏ่ชๅ็ใซ ใไฝฟ็จใใใใใซๅใๆฟใใใพใใ
+ไธ้จใฎๆไฝใงใฏใฏใใใซๅน็็ใช tf32 ๅฝขๅผใไฝฟ็จใใพใใใ็ตๆใฏไพ็ถใจใใฆ fp32 ใซใชใใพใใ่ฉณ็ดฐใจ
+ใใณใใใผใฏใซใคใใฆใฏใ[Ampere ใใใคในไธใฎ TensorFloat-32(TF32)](https://pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-devices) ใๅ็
งใใฆใใ ใใใๆๆธใซใฏไปฅไธใๅซใพใใพใ
+ไฝใใใฎ็็ฑใงใใฎ่ชๅๅคๆใไฝฟ็จใใใใชใๅ ดๅใฏใใใฎ่ชๅๅคๆใ็กๅนใซใใๆนๆณใซใคใใฆ่ชฌๆใใพใใ
+
+๐ค ใใฌใผใใผใงใฏใ`--tf32` ใไฝฟ็จใใฆๆๅนใซใใใใ`--tf32 0` ใพใใฏ `--no_tf32` ใไฝฟ็จใใฆ็กๅนใซใใใใจใใงใใพใใใใใฉใซใใงใฏใPyTorch ใฎใใใฉใซใใไฝฟ็จใใใพใใ
+
+
+
+### Automatic Mixed Precision
+
+pytorch ใฎใใใช AMP ใฎๆนๆณใพใใฏ apex ใฎใใใชๆนๆณใง่ชๅๆททๅ็ฒพๅบฆใไฝฟ็จใงใใพใใ
+
+### fp16
+
+fp16 (float16) ใ่จญๅฎใใฆ pytorch AMP ใฎใใใชใขใผใใ่จญๅฎใใใซใฏ:
+
+```json
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ }
+}
+```
+
+[`Trainer`] ใฏใใฎๅคใซๅบใฅใใฆใใใ่ชๅ็ใซๆๅนใพใใฏ็กๅนใซใใพใใ
+`args.fp16_backend`ใๆฎใใฎ่จญๅฎๅคใฏใใชใๆฌก็ฌฌใงใใ
+
+ใใฎใขใผใใฏใ`--fp16 --fp16_backend amp`ใพใใฏ`--fp16_full_eval`ใณใใณใใฉใคใณๅผๆฐใๆธกใใใใจๆๅนใซใชใใพใใ
+
+ใใฎใขใผใใๆ็คบ็ใซๆๅน/็กๅนใซใใใใจใใงใใพใใ
+
+```json
+{
+ "fp16": {
+ "enabled": true,
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ }
+}
+```
+
+ใใ ใใ[`Trainer`] ใณใใณใใฉใคใณๅผๆฐใจ DeepSpeed ใ่ชๅใงๅๆใใใใจใซใชใใพใใ
+ๆงๆใ
+
+ใใใ[ใใญใฅใกใณใ](https://www.deepspeed.ai/docs/config-json/#fp16-training-options)ใงใใ
+
+### BF16
+
+fp16 ใฎไปฃใใใซ bf16 (bfloat16) ใๅฟ
่ฆใชๅ ดๅใฏใๆฌกใฎๆงๆใปใฏใทใงใณใไฝฟ็จใใใพใใ
+
+```json
+{
+ "bf16": {
+ "enabled": "auto"
+ }
+}
+```
+
+bf16 ใฏ fp32 ใจๅใใใคใใใใฏ ใฌใณใธใๅใใฆใใใใใๆๅคฑในใฑใผใชใณใฐใฏๅฟ
่ฆใใใพใใใ
+
+ใใฎใขใผใใฏใ`--bf16` ใพใใฏ `--bf16_full_eval` ใณใใณใใฉใคใณๅผๆฐใๆธกใใใใจๆๅนใซใชใใพใใ
+
+ใใฎใขใผใใๆ็คบ็ใซๆๅน/็กๅนใซใใใใจใใงใใพใใ
+
+```json
+{
+ "bf16": {
+ "enabled": true
+ }
+}
+```
+
+
+
+`deepspeed==0.6.0`ใฎๆ็นใงใฏใbf16 ใตใใผใใฏๆฐใใๅฎ้จ็ใชใใฎใงใใ
+
+bf16 ใๆๅนใช็ถๆ
ใง [ๅพ้
็ดฏ็ฉ](#gradient-accumulation) ใไฝฟ็จใใๅ ดๅใฏใbf16 ใงๅพ้
ใ็ดฏ็ฉใใใใใจใซๆณจๆใใๅฟ
่ฆใใใใพใใใใฎๅฝขๅผใฎ็ฒพๅบฆใไฝใใใใใใใฏๅธๆใฉใใใงใฏใชใๅฏ่ฝๆงใใใใพใใๆๅคฑใฎใใ่็ฉใซใคใชใใใพใใ
+
+ใใฎๅ้กใไฟฎๆญฃใใใใ้ซ็ฒพๅบฆใฎ `dtype` (fp16 ใพใใฏ fp32) ใไฝฟ็จใใใชใใทใงใณใๆไพใใใใใฎไฝๆฅญใ่กใใใฆใใพใใ
+
+
+
+
+### NCCL Collectives
+
+่จ็ทดไฝๅถใฎ`dtype`ใใใใใใพใใพใชๅๆธใๅ้/ๅๆฃๆไฝใชใฉใฎใณใใฅใใฑใผใทใงใณ้ๅไฝใซไฝฟ็จใใใๅฅใฎ`dtype`ใใใใพใใ
+
+ใในใฆใฎๅ้/ๅๆฃๆไฝใฏใใใผใฟใๅซใพใใฆใใใฎใจๅใ `dtype` ใงๅฎ่กใใใใใใbf16 ใใฌใผใใณใฐไฝๅถใไฝฟ็จใใฆใใๅ ดๅใใใผใฟใฏ bf16 ใงๅ้ใใใพใใๅ้ใฏๆๅคฑใฎใชใๆไฝใงใใ
+
+ใใพใใพใชใชใใฅใผในๆไฝใฏ้ๅธธใซๆๅคฑใๅคงใใๅฏ่ฝๆงใใใใพใใใใจใใฐใ่คๆฐใฎ GPU ้ใงๅพ้
ใๅนณๅๅใใใๅ ดๅใ้ไฟกใ fp16 ใพใใฏ bf16 ใง่กใใใๅ ดๅใ็ตๆใฏๆๅคฑใๅคใใชใๅฏ่ฝๆงใใใใพใใ่คๆฐใฎๆฐๅคใไฝ็ฒพๅบฆใงใขใใใฟใคใบใใใจ็ตๆใฏๆญฃ็ขบใงใฏใชใใใใงใใ ใ bf16 ใงใฏ fp16 ใใใ็ฒพๅบฆใไฝใใใใใใใซใใใงใใ้ๅธธใฏ้ๅธธใซๅฐใใ grad ใๅนณๅใใ้ใฎๆๅคฑใๆๅฐ้ใซๆใใใใใใใfp16 ใงๅๅใงใใใใจใใใใใใพใใใใใใฃใฆใใใใฉใซใใงใฏใๅ็ฒพๅบฆใใฌใผใใณใฐใงใฏ fp16 ใใชใใฏใทใงใณๆผ็ฎใฎใใใฉใซใใจใใฆไฝฟ็จใใใพใใใใ ใใใใฎๆฉ่ฝใๅฎๅ
จใซๅถๅพกใงใใๅฟ
่ฆใซๅฟใใฆๅฐใใชใชใผใใผใใใใ่ฟฝๅ ใใฆใใชใใฏใทใงใณใ็ดฏ็ฉ dtype ใจใใฆ fp32 ใไฝฟ็จใใ็ตๆใฎๆบๅใใงใใๅ ดๅใซใฎใฟๅ็ฒพๅบฆ `dtype` ใซใใฆใณใญใฃในใใใใใใซใใใใจใใงใใพใใใงใใฌใผใใณใฐไธญใงใใ
+
+ใใใฉใซใใใชใผใใผใฉใคใใใใซใฏใๆฐใใๆงๆใจใณใใชใ่ฟฝๅ ใใใ ใใงใใ
+
+```json
+{
+ "communication_data_type": "fp32"
+}
+```
+
+ใใฎ่จไบใฎๅท็ญๆ็นใงใฎๆๅนใชๅคใฏใ"fp16"ใ"bfp16"ใ"fp32"ใงใใ
+
+ๆณจ: ในใใผใธ ใผใญ 3 ใซใฏใbf16 ้ไฟกใฟใคใใซ้ขใใใใฐใใใใ`deepspeed==0.8.1`ใงไฟฎๆญฃใใใพใใใ
+
+### apex
+
+apex AMP ใฎใใใชใขใผใ ใปใใใ่จญๅฎใใใซใฏ:
+
+```json
+"amp": {
+ "enabled": "auto",
+ "opt_level": "auto"
+}
+```
+
+[`Trainer`] ใฏ `args.fp16_backend` ใฎๅคใซๅบใฅใใฆ่ชๅ็ใซ่จญๅฎใใพใใ
+`args.fp16_opt_level`ใ
+
+ใใฎใขใผใใฏใ`--fp16 --fp16_backend apex --fp16_opt_level 01`ใณใใณใ ใฉใคใณๅผๆฐใๆธกใใใใจๆๅนใซใชใใพใใ
+
+ใใฎใขใผใใๆ็คบ็ใซๆงๆใใใใจใใงใใพใใ
+
+```json
+{
+ "amp": {
+ "enabled": true,
+ "opt_level": "O1"
+ }
+}
+```
+
+ใใ ใใ[`Trainer`] ใณใใณใใฉใคใณๅผๆฐใจ DeepSpeed ใ่ชๅใงๅๆใใใใจใซใชใใพใใ
+ๆงๆใ
+
+ใใใฏ[ใใญใฅใกใณใ](https://www.deepspeed.ai/docs/config-json/#automatic-mixed-precision-amp-training-options)ใงใใ
+
+
+
+### Batch Size
+
+ใใใใตใคใบใ่จญๅฎใใใซใฏใๆฌกใไฝฟ็จใใพใใ
+
+
+```json
+{
+ "train_batch_size": "auto",
+ "train_micro_batch_size_per_gpu": "auto"
+}
+```
+
+[`Trainer`] ใฏ่ชๅ็ใซ `train_micro_batch_size_per_gpu` ใๆฌกใฎๅคใซ่จญๅฎใใพใใ
+`args.per_device_train_batch_size`ใจ`train_batch_size`ใ`args.world_size * args.per_device_train_batch_size * args.gradient_accumulation_steps`ใซๅคๆดใใพใใ
+
+ๅคใๆ็คบ็ใซ่จญๅฎใใใใจใใงใใพใใ
+
+```json
+{
+ "train_batch_size": 12,
+ "train_micro_batch_size_per_gpu": 4
+}
+```
+
+ใใ ใใ[`Trainer`] ใณใใณใใฉใคใณๅผๆฐใจ DeepSpeed ใ่ชๅใงๅๆใใใใจใซใชใใพใใ
+ๆงๆใ
+
+
+
+### Gradient Accumulation
+
+ๅพ้
็ดฏ็ฉใปใใใๆงๆใใใซใฏ:
+
+```json
+{
+ "gradient_accumulation_steps": "auto"
+}
+```
+
+[`Trainer`] ใฏ่ชๅ็ใซใใใ `args.gradient_accumulation_steps` ใฎๅคใซ่จญๅฎใใพใใ
+
+ๅคใๆ็คบ็ใซ่จญๅฎใใใใจใใงใใพใใ
+
+```json
+{
+ "gradient_accumulation_steps": 3
+}
+```
+
+ใใ ใใ[`Trainer`] ใณใใณใใฉใคใณๅผๆฐใจ DeepSpeed ใ่ชๅใงๅๆใใใใจใซใชใใพใใ
+ๆงๆใ
+
+
+
+### Gradient Clipping
+
+ใฐใฉใใผใทใงใณ ใฐใฉใใผใทใงใณ ใฏใชใใใณใฐ ใปใใใๆงๆใใใซใฏ:
+
+```json
+{
+ "gradient_clipping": "auto"
+}
+```
+
+[`Trainer`] ใฏ่ชๅ็ใซใใใ `args.max_grad_norm` ใฎๅคใซ่จญๅฎใใพใใ
+
+ๅคใๆ็คบ็ใซ่จญๅฎใใใใจใใงใใพใใ
+
+```json
+{
+ "gradient_clipping": 1.0
+}
+```
+
+ใใ ใใ[`Trainer`] ใณใใณใใฉใคใณๅผๆฐใจ DeepSpeed ใ่ชๅใงๅๆใใใใจใซใชใใพใใ
+ๆงๆใ
+
+
+
+### Getting The Model Weights Out
+
+ใใฌใผใใณใฐใ็ถ็ถใใDeepSpeed ใฎไฝฟ็จใๅ้ใใ้ใใไฝใๅฟ้
ใใๅฟ
่ฆใฏใใใพใใใ DeepSpeed ในใใข
+fp32 ใฎใซในใฟใ ใใงใใฏใใคใณใ ใชใใใฃใใคใถใผ ใใกใคใซๅ
ใฎใในใฟใผใฎ้ใฟใใใใฏ `global_step*/*optim_states.pt` (ใใใฏ glob
+ใใฟใผใณ)ใ้ๅธธใฎใใงใใฏใใคใณใใฎไธใซไฟๅญใใใพใใ
+
+**FP16 ใฆใงใคใ:**
+
+ใขใใซใ ZeRO-2 ใงไฟๅญใใใจใใขใใซใฎ้ใฟใๅซใ้ๅธธใฎ `pytorch_model.bin` ใใกใคใซใไฝๆใใใพใใใ
+ใใใใฏ้ใฟใฎ fp16 ใใผใธใงใณใซใใใพใใใ
+
+ZeRO-3 ใงใฏใใขใใซใฎ้ใฟใ่คๆฐใฎ GPU ใซๅๅฒใใใใใใ็ถๆณใฏใใใซ่ค้ใซใชใใพใใ
+ใใใใฃใฆใfp16 ใไฟๅญใใใใใฎ `Trainer` ใๅๅพใใใซใฏใ`"stage3_gather_16bit_weights_on_model_save": true` ใๅฟ
่ฆใงใใ
+้ใฟใฎใใผใธใงใณใใใฎ่จญๅฎใ`False`ใฎๅ ดๅใ`pytorch_model.bin`ใฏไฝๆใใใพใใใใใใฏใใใใฉใซใใง DeepSpeed ใฎ `state_dict` ใซๅฎ้ใฎ้ใฟใงใฏใชใใใฌใผในใใซใใผใๅซใพใใใใใงใใใใฎ `state_dict` ใไฟๅญใใๅ ดๅใใญใผใใ็ดใใใจใฏใงใใพใใใ
+
+```json
+{
+ "zero_optimization": {
+ "stage3_gather_16bit_weights_on_model_save": true
+ }
+}
+```
+
+**FP32 ้้:**
+
+fp16 ใฆใงใคใใฏใใฌใผใใณใฐใๅ้ใใใฎใซ้ฉใใฆใใพใใใใขใใซใฎๅพฎ่ชฟๆดใๅฎไบใใใใใ
+[ใขใใซ ใใ](https://huggingface.co/models) ใซใขใฏใปในใใใใfp32 ใๅ
ฅๆใใใใจๆใใใไปใฎไบบใซๆธกใใพใใ
+้ใฟใใใใฏๅคง้ใฎใกใขใชใๅฟ
่ฆใจใใใใญใปในใงใใใใใใใฌใผใใณใฐไธญใซ่กใในใใงใฏใชใใฎใ็ๆณ็ใงใใ
+ใใใใฃใฆใใใฌใผใใณใฐใฎๅฎไบๅพใซใชใใฉใคใณใงๅฎ่กใใใฎใๆ้ฉใงใใใใ ใใๅฟ
่ฆใซๅฟใใฆใ็ฉบใ CPU ใๅๅใซใใๅ ดๅใฏใ
+ๅใใใฌใผใใณใฐ ในใฏใชใใใงๅฎ่กใงใใใใจใๆใๅบใใฆใใ ใใใๆฌกใฎใปใฏใทใงใณใงใฏใไธกๆนใฎใขใใญใผใใซใคใใฆ่ชฌๆใใพใใ
+
+
+**ใฉใคใ FP32 ใฆใงใคใ ใชใซใใช:**
+
+ใขใใซใๅคงใใใใใฌใผใใณใฐใฎ็ตไบๆใซ็ฉบใ CPU ใกใขใชใใปใจใใฉๆฎใฃใฆใใชใๅ ดๅใใใฎใขใใญใผใใฏๆฉ่ฝใใชใๅฏ่ฝๆงใใใใพใใ
+
+ๅฐใชใใจใ 1 ใคใฎใใงใใฏใใคใณใใไฟๅญใใฆใใฆใๆๆฐใฎใใงใใฏใใคใณใใไฝฟ็จใใใๅ ดๅใฏใๆฌกใฎๆ้ ใๅฎ่กใงใใพใใ
+
+```python
+from transformers.trainer_utils import get_last_checkpoint
+from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
+
+checkpoint_dir = get_last_checkpoint(trainer.args.output_dir)
+fp32_model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
+```
+
+`--load_best_model_at_end` class:*~transformers.TrainingArguments* ๅผๆฐใไฝฟ็จใใฆใใๅ ดๅ (ๆ้ฉใชใขใใซใ่ฟฝ่ทกใใใใ)
+ใใงใใฏใใคใณใ)ใๆๅใซๆ็ตใขใใซใๆ็คบ็ใซไฟๅญใใฆใใใไธ่จใจๅใใใจใ่กใใใจใงใใฌใผใใณใฐใ็ตไบใงใใพใใ
+
+```python
+from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
+
+checkpoint_dir = os.path.join(trainer.args.output_dir, "checkpoint-final")
+trainer.deepspeed.save_checkpoint(checkpoint_dir)
+fp32_model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
+```
+
+
+
+`load_state_dict_from_zero_checkpoint` ใๅฎ่กใใใใจใ`model` ใฏใใฏใไฝฟ็จใงใใชใใชใใใจใซๆณจๆใใฆใใ ใใใ
+ๅใใขใใชใฑใผใทใงใณใฎ DeepSpeed ใณใณใใญในใใใคใพใใdeepspeed ใจใณใธใณใๅๅๆๅใใๅฟ
่ฆใใใใพใใ
+`model.load_state_dict(state_dict)` ใฏใใใใใในใฆใฎ DeepSpeed ใใธใใฏใๅ้คใใพใใใใใใฃใฆใใใใฏๆๅพใซใฎใฟๅฎ่กใใฆใใ ใใ
+ใใฌใผใใณใฐใฎๆงๅญใ
+
+
+
+
+ใใกใใใclass:*~transformers.Trainer* ใไฝฟ็จใใๅฟ
่ฆใฏใชใใไธ่จใฎไพใ็ฌ่ชใฎใใฎใซ่ชฟๆดใใใใจใใงใใพใใ
+ใใฌใผใใผใ
+
+ไฝใใใฎ็็ฑใงใใใซๆน่ฏใใใๅ ดๅใฏใ้ใฟใฎ fp32 `state_dict` ใๆฝๅบใใฆ้ฉ็จใใใใจใใงใใพใใ
+ๆฌกใฎไพใซ็คบใใใใซใใใใใฏ่ชๅใงไฝๆใใพใใ
+
+```python
+from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
+
+state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # already on cpu
+model = model.cpu()
+model.load_state_dict(state_dict)
+```
+
+**ใชใใฉใคใณ FP32 ใฆใงใคใ ใชใซใใช:**
+
+DeepSpeed ใฏ็นๅฅใชๅคๆในใฏใชใใ`zero_to_fp32.py`ใไฝๆใใใใงใใฏใใคใณใใฎๆไธไฝใซ้
็ฝฎใใพใใ
+ใใฉใซใใใใฎในใฏใชใใใไฝฟ็จใใใจใใใคใงใ้ใฟใๆฝๅบใงใใพใใในใฏใชใใใฏในใฟใณใใขใญใณใชใฎใงใใใๅฟ
่ฆใใใพใใใ
+ๆฝๅบใ่กใใใใฎ่จญๅฎใใกใคใซใพใใฏ `Trainer` ใๅฟ
่ฆใงใใ
+
+ใใงใใฏใใคใณใ ใใฉใซใใผใๆฌกใฎใใใซใชใฃใฆใใใจใใพใใ
+
+```bash
+$ ls -l output_dir/checkpoint-1/
+-rw-rw-r-- 1 stas stas 1.4K Mar 27 20:42 config.json
+drwxrwxr-x 2 stas stas 4.0K Mar 25 19:52 global_step1/
+-rw-rw-r-- 1 stas stas 12 Mar 27 13:16 latest
+-rw-rw-r-- 1 stas stas 827K Mar 27 20:42 optimizer.pt
+-rw-rw-r-- 1 stas stas 231M Mar 27 20:42 pytorch_model.bin
+-rw-rw-r-- 1 stas stas 623 Mar 27 20:42 scheduler.pt
+-rw-rw-r-- 1 stas stas 1.8K Mar 27 20:42 special_tokens_map.json
+-rw-rw-r-- 1 stas stas 774K Mar 27 20:42 spiece.model
+-rw-rw-r-- 1 stas stas 1.9K Mar 27 20:42 tokenizer_config.json
+-rw-rw-r-- 1 stas stas 339 Mar 27 20:42 trainer_state.json
+-rw-rw-r-- 1 stas stas 2.3K Mar 27 20:42 training_args.bin
+-rwxrw-r-- 1 stas stas 5.5K Mar 27 13:16 zero_to_fp32.py*
+```
+
+ใใฎไพใงใฏใDeepSpeed ใใงใใฏใใคใณใ ใตใใใฉใซใใผ *global_step1* ใ 1 ใคใ ใใใใพใใใใใใฃใฆใFP32ใๅๆง็ฏใใใซใฏ
+้ใฟใๅฎ่กใใใ ใใงใ:
+
+```bash
+python zero_to_fp32.py . pytorch_model.bin
+```
+
+ใใใ ใใ `pytorch_model.bin`ใซใฏใ่คๆฐใฎ GPU ใใ็ตฑๅใใใๅฎๅ
จใช fp32 ใขใใซใฎ้ใฟใๅซใพใใใใใซใชใใพใใ
+
+ในใฏใชใใใฏใZeRO-2 ใพใใฏ ZeRO-3 ใใงใใฏใใคใณใใ่ชๅ็ใซๅฆ็ใงใใใใใซใชใใพใใ
+
+`python zero_to_fp32.py -h` ใๅฎ่กใใใจใไฝฟ็จๆนๆณใฎ่ฉณ็ดฐใ่กจ็คบใใใพใใ
+
+ในใฏใชใใใฏใใใกใคใซ`latest`ใฎๅ
ๅฎนใไฝฟ็จใใฆ deepspeed ใตใใใฉใซใใผใ่ชๅๆคๅบใใพใใ
+ไพใซใฏ`global_step1`ใๅซใพใใพใใ
+
+ๆณจ: ็พๅจใในใฏใชใใใซใฏๆ็ต็ใช fp32 ใขใใซใฎ้ใฟใฎ 2 ๅใฎไธ่ฌ RAM ใๅฟ
่ฆใงใใ
+
+### ZeRO-3 ใจ Infinity Nuances
+
+ZeRO-3 ใฏใใใฉใกใผใฟ ใทใฃใผใใฃใณใฐๆฉ่ฝใฎ็นใง ZeRO-2 ใจใฏๅคงใใ็ฐใชใใพใใ
+
+ZeRO-Infinity ใฏ ZeRO-3 ใใใใซๆกๅผตใใNVMe ใกใขใชใใใฎไปใฎ่คๆฐใฎ้ๅบฆใจในใฑใผใฉใใชใใฃใฎๅไธใใตใใผใใใพใใ
+
+ใขใใซใซ็นๅฅใชๅคๆดใๅ ใใๅฟ
่ฆใใชใใฆใๆญฃๅธธใซๅไฝใใใใใซใใใใๅชๅใๆใใใฆใใพใใใใ็นๅฎใฎ็นใงใฏ
+็ถๆณใซใใฃใฆใฏใๆฌกใฎๆ
ๅ ฑใๅฟ
่ฆใซใชใๅ ดๅใใใใพใใ
+
+#### Constructing Massive Models
+
+
+DeepSpeed/ZeRO-3 ใฏใๆขๅญใฎ RAM ใซๅใพใใชใๅฏ่ฝๆงใฎใใๆฐๅ
ใฎใใฉใกใผใฟใๆใคใขใใซใๅฆ็ใงใใพใใใใฎใใใชๅ ดๅใ
+ใพใใๅๆๅใใใ้ซ้ใซๅฎ่กใใใๅ ดๅใฏใ*deepspeed.zero.Init()* ใไฝฟ็จใใฆใขใใซใๅๆๅใใพใใ
+ใณใณใใญในใ ใใใผใธใฃใผ (้ขๆฐใใณใฌใผใฟใผใงใใใใพใ)ใๆฌกใฎใใใซใชใใพใใ
+
+```python
+from transformers import T5ForConditionalGeneration, T5Config
+import deepspeed
+
+with deepspeed.zero.Init():
+ config = T5Config.from_pretrained("google-t5/t5-small")
+ model = T5ForConditionalGeneration(config)
+```
+
+ใ่ฆงใฎใจใใใใใใซใใใฉใณใใ ใซๅๆๅใใใใขใใซใๅพใใใพใใ
+
+ไบๅใใฌใผใใณใฐใใใใขใใซใไฝฟ็จใใใๅ ดๅใ`model_class.from_pretrained` ใฏๆฌกใฎๆกไปถใๆบใใ้ใใใฎๆฉ่ฝใๆๅนใซใใพใใ
+`is_deepspeed_zero3_enabled()` ใฏ `True` ใ่ฟใใพใใใใใฏ็พๅจใ
+[`TrainingArguments`] ใชใใธใงใฏใ (ๆธกใใใ DeepSpeed ๆงๆใใกใคใซใซ ZeRO-3 ๆงๆใๅซใพใใฆใใๅ ดๅ)
+ใปใฏใทใงใณใใใใใฃใฆใๅผใณๅบใใฎๅใซ** [`TrainingArguments`] ใชใใธใงใฏใใไฝๆใใๅฟ
่ฆใใใใพใใ
+`from_pretrained`ใ่ใใใใใทใผใฑใณในใฎไพใๆฌกใซ็คบใใพใใ
+
+```python
+from transformers import AutoModel, Trainer, TrainingArguments
+
+training_args = TrainingArguments(..., deepspeed=ds_config)
+model = AutoModel.from_pretrained("google-t5/t5-small")
+trainer = Trainer(model=model, args=training_args, ...)
+```
+
+ๅ
ฌๅผใฎใตใณใใซ ในใฏใชใใใไฝฟ็จใใฆใใฆใใณใใณใ ใฉใคใณๅผๆฐใซ `--deepspeed ds_config.json` ใๅซใพใใฆใใๅ ดๅ
+ZeRO-3 ่จญๅฎใๆๅนใซใใใจใใใใใตใณใใซ ในใฏใชใใใฎ่จ่ฟฐๆนๆณใงใใใใใใในใฆใใใงใซๅฎไบใใฆใใพใใ
+
+ๆณจ: ใขใใซใฎ fp16 ้ใฟใๅไธใฎ GPU ใฎใกใขใชใซๅใพใใชใๅ ดๅใฏใใใฎๆฉ่ฝใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+ใใฎๆนๆณใจใใฎไปใฎ้ข้ฃๆฉ่ฝใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ๅคง่ฆๆจกใขใใซใฎๆง็ฏ](https://deepspeed.readthedocs.io/en/latest/zero3.html#constructing-massive-models) ใๅ็
งใใฆใใ ใใใ
+
+ใพใใfp16 ใงไบๅ่จ็ทดใใใใขใใซใใญใผใใใใจใใฏใ`from_pretrained` ใซไฝฟ็จใใใใใซๆ็คบใใๅฟ
่ฆใใใใพใใ
+`torch_dtype=torch.float16`ใ่ฉณ็ดฐใซใคใใฆใฏใ[from_pretrained-torch-dtype](#from_pretrained-torch-dtype) ใๅ็
งใใฆใใ ใใใ
+
+#### Gathering Parameters
+
+่คๆฐใฎ GPU ไธใฎ ZeRO-3 ใงใฏใ็พๅจใฎ GPU ใฎใใฉใกใผใฟใงใชใ้ใใๅไธใฎ GPU ใใในใฆใฎใใฉใกใผใฟใๆใคใใจใฏใใใพใใใ
+ๅฎ่กๅฑคใใใใใฃใฆใใในใฆใฎใฌใคใคใผใฎใในใฆใฎใใฉใกใผใฟใผใซไธๅบฆใซใขใฏใปในใใๅฟ
่ฆใใใๅ ดๅใฏใใใใ่กใใใใฎ็นๅฎใฎๆนๆณใใใใพใใ
+ใปใจใใฉใฎๅ ดๅใฏๅฟ
่ฆใใใพใใใใๅฟ
่ฆใชๅ ดๅใฏใ[ใใฉใกใผใฟใฎๅ้](https://deepspeed.readthedocs.io/en/latest/zero3.html#manual-parameter-coordination) ใๅ็
งใใฆใใ ใใใ
+
+ใใ ใใใใใคใใฎๅ ดๆใงๅ
้จ็ใซไฝฟ็จใใฆใใพใใใใฎไพใฎ 1 ใคใฏใไบๅใใฌใผใใณใฐใใใใขใใซใฎ้ใฟใใญใผใใใใจใใงใใ
+`from_pretrained`ใไธๅบฆใซ 1 ใคใฎใฌใคใคใผใใญใผใใใๅๅ ใใฆใใใในใฆใฎ GPU ใซๅณๅบงใซๅๅฒใใพใใ
+ๅคง่ฆๆจกใชใขใใซใงใฏใใกใขใชใฎ้ขไฟใงใ1 ใคใฎ GPU ใซใญใผใใใฆใใ่คๆฐใฎ GPU ใซๅๆฃใใใใจใฏใงใใพใใใ
+ๅถ้ใ
+
+ใพใใZeRO-3 ใงใฏใ็ฌ่ชใฎใณใผใใไฝๆใใๆฌกใฎใใใชใขใใซ ใใฉใกใผใฟใผใฎ้ใฟใ็บ็ใใใจใใพใใ
+
+```python
+tensor([1.0], device="cuda:0", dtype=torch.float16, requires_grad=True)
+```
+
+`tensor([1.])` ใซในใใฌในใๆใใๅ ดๅใใพใใฏใใฉใกใผใฟใฎใตใคใบใ `1` ใงใใใจใใใจใฉใผใ็บ็ใใๅ ดๅ
+ใใๅคงใใชๅคๆฌกๅ
ๅฝข็ถใใใใฏใใใฉใกใผใฟใผใๅๅฒใใใฆใใใ่กจ็คบใใใใฎใฏ ZeRO-3 ใใฌใผในใใซใใผใงใใใใจใๆๅณใใพใใ
+
+
+
+
+### ZeRO Inference
+
+ZeRO Inference ใฏใZeRO-3 Training ใจๅใๆงๆใไฝฟ็จใใพใใใชใใใฃใใคใถใผใจในใฑใธใฅใผใฉใผใฎใปใฏใทใงใณใฏๅฟ
่ฆใใใพใใใใง
+ๅฎ้ใๅใใใฎใใใฌใผใใณใฐใจๅ
ฑๆใใใๅ ดๅใฏใใใใใ่จญๅฎใใกใคใซใซๆฎใใใจใใงใใพใใๅฝผใใฏใใ ใใใชใใ ใใ
+็ก่ฆใใใพใใใ
+
+ใใไปฅๅคใฎๅ ดๅใฏใ้ๅธธใฎ [`TrainingArguments`] ๅผๆฐใๆธกใใ ใใงใใไพใใฐ๏ผ
+
+```bash
+deepspeed --num_gpus=2 your_program.py --do_eval --deepspeed ds_config.json
+```
+
+ๅฏไธ้่ฆใชใใจใฏใZeRO-2 ใซใฏไฝใฎๅฉ็นใใชใใใใZeRO-3 ๆงๆใไฝฟ็จใใๅฟ
่ฆใใใใจใใใใจใงใใ
+ZeRO-3 ใฎใฟใใใฉใกใผใฟใผใฎใทใฃใผใใฃใณใฐใๅฎ่กใใใฎใซๅฏพใใZeRO-1 ใฏๅพ้
ใจใชใใใฃใใคใถใผใฎ็ถๆ
ใใทใฃใผใใฃใณใฐใใใใใๆจ่ซใซๅฝน็ซใกใพใใ
+
+ไปฅไธใฏใๅฉ็จๅฏ่ฝใชใในใฆใฎ GPU ใใใใญใคใใ DeepSpeed ใง`run_translation.py`ใๅฎ่กใใไพใงใใ
+
+
+```bash
+deepspeed examples/pytorch/translation/run_translation.py \
+--deepspeed tests/deepspeed/ds_config_zero3.json \
+--model_name_or_path google-t5/t5-small --output_dir output_dir \
+--do_eval --max_eval_samples 50 --warmup_steps 50 \
+--max_source_length 128 --val_max_target_length 128 \
+--overwrite_output_dir --per_device_eval_batch_size 4 \
+--predict_with_generate --dataset_config "ro-en" --fp16 \
+--source_lang en --target_lang ro --dataset_name wmt16 \
+--source_prefix "translate English to Romanian: "
+```
+
+ๆจ่ซใฎใใใซใใชใใใฃใใคใถใผใฎ็ถๆ
ใจๅพ้
ใซใใฃใฆไฝฟ็จใใใ่ฟฝๅ ใฎๅคงใใชใกใขใชใฏๅฟ
่ฆใชใใใใ
+ใฏใใใซๅคงใใชใใใใใทใผใฑใณใน้ทใๅใใใผใใฆใงใขใซ้ฉๅใงใใๅฟ
่ฆใใใใพใใ
+
+ใใใซใDeepSpeed ใฏ็พๅจใDeepspeed-Inference ใจๅผใฐใใ้ข้ฃ่ฃฝๅใ้็บใใฆใใพใใใใใใจใฏไฝใฎ้ขไฟใใใใพใใใ
+ZeRO ใใฏใใญใธใผใซๆบๆ ใใฆใใพใใใไปฃใใใซใใณใฝใซไธฆๅๅฆ็ใไฝฟ็จใใฆใๅไธใฎ GPU ใซๅใพใใชใใขใใซใในใฑใผใชใณใฐใใพใใใใใฏ
+็พๅจ้็บไธญใงใใ่ฃฝๅใๅฎๆใใใ็ตฑๅใๆไพใใไบๅฎใงใใ
+
+
+### Memory Requirements
+
+Deepspeed ZeRO ใฏใกใขใชใ CPU (ใใใณ NVMe) ใซใชใใญใผใใงใใใใใใใฌใผใ ใฏใผใฏใฏใไฝฟ็จใใใฆใใ GPU ใฎๆฐใซๅฟใใฆๅฟ
่ฆใช CPU ใใใณ GPU ใกใขใชใฎ้ใ็ฅใใใจใใงใใใฆใผใใฃใชใใฃใๆไพใใพใใ
+
+ๅไธใฎ GPU ใง `bigscience/T0_3B`ใๅพฎ่ชฟๆดใใใใใซๅฟ
่ฆใชใกใขใชใฎ้ใ่ฆ็ฉใใฃใฆใฟใพใใใใ
+
+```bash
+$ python -c 'from transformers import AutoModel; \
+from deepspeed.runtime.zero.stage3 import estimate_zero3_model_states_mem_needs_all_live; \
+model = AutoModel.from_pretrained("bigscience/T0_3B"); \
+estimate_zero3_model_states_mem_needs_all_live(model, num_gpus_per_node=1, num_nodes=1)'
+[...]
+Estimated memory needed for params, optim states and gradients for a:
+HW: Setup with 1 node, 1 GPU per node.
+SW: Model with 2783M total params, 65M largest layer params.
+ per CPU | per GPU | Options
+ 70.00GB | 0.25GB | offload_param=cpu , offload_optimizer=cpu , zero_init=1
+ 70.00GB | 0.25GB | offload_param=cpu , offload_optimizer=cpu , zero_init=0
+ 62.23GB | 5.43GB | offload_param=none, offload_optimizer=cpu , zero_init=1
+ 62.23GB | 5.43GB | offload_param=none, offload_optimizer=cpu , zero_init=0
+ 0.37GB | 46.91GB | offload_param=none, offload_optimizer=none, zero_init=1
+ 15.56GB | 46.91GB | offload_param=none, offload_optimizer=none, zero_init=0
+```
+
+ใใใใฃใฆใๅไธใฎ 80 GB GPU ใง CPU ใชใใญใผใใชใใงๆญ่ผใใใใจใใๅฐใใช 8 GB GPU ใงใๆๅคง 60 GB ใฎ CPU ใกใขใชใๅฟ
่ฆใซใชใใใจใๅฏ่ฝใงใใ (ใใใฏใใฉใกใผใฟใใชใใใฃใใคใถใฎ็ถๆ
ใใใใณๅพ้
ใฎใใใฎใกใขใชใงใใใใจใซๆณจๆใใฆใใ ใใใcuda ใซใผใใซใใขใฏใใฃใใผใทใงใณใใใใณไธๆใกใขใชใซใฏใใๅฐใๅคใใฎใกใขใชใๅฟ
่ฆใงใใ)
+
+ๆฌกใซใใณในใใจ้ๅบฆใฎใใฌใผใใชใใซใชใใพใใใใๅฐใใ GPU ใ่ณผๅ
ฅใพใใฏใฌใณใฟใซใใๆนใๅฎใใชใใพใ (Deepspeed ZeRO ใงใฏ่คๆฐใฎ GPU ใไฝฟ็จใงใใใใใGPU ใฎๆฐใๆธใใใใจใใงใใพใ)ใใใใใใใฎๅ ดๅใฏ้
ใใชใใพใใใใฎใใใไฝใใๅฎ่กใใ้ๅบฆใๆฐใซใใชใใฆใใ้ๅบฆใฎไฝไธใฏ GPU ใฎไฝฟ็จๆ้ใซ็ดๆฅๅฝฑ้ฟใใใณในใใๅขๅคงใใใใใใฉใใๆใๅนๆ็ใใๅฎ้จใใฆๆฏ่ผใใฆใใ ใใใ
+
+ๅๅใช GPU ใกใขใชใใใๅ ดๅใฏใใในใฆใ้ซ้ใซใชใใใใCPU/NVMe ใชใใญใผใใๅฟ
ใ็กๅนใซใใฆใใ ใใใ
+
+ใใจใใฐใ2 ใคใฎ GPU ใซๅฏพใใฆๅใใใจใ็นฐใ่ฟใใฆใฟใพใใใใ
+
+```bash
+$ python -c 'from transformers import AutoModel; \
+from deepspeed.runtime.zero.stage3 import estimate_zero3_model_states_mem_needs_all_live; \
+model = AutoModel.from_pretrained("bigscience/T0_3B"); \
+estimate_zero3_model_states_mem_needs_all_live(model, num_gpus_per_node=2, num_nodes=1)'
+[...]
+Estimated memory needed for params, optim states and gradients for a:
+HW: Setup with 1 node, 2 GPUs per node.
+SW: Model with 2783M total params, 65M largest layer params.
+ per CPU | per GPU | Options
+ 70.00GB | 0.25GB | offload_param=cpu , offload_optimizer=cpu , zero_init=1
+ 70.00GB | 0.25GB | offload_param=cpu , offload_optimizer=cpu , zero_init=0
+ 62.23GB | 2.84GB | offload_param=none, offload_optimizer=cpu , zero_init=1
+ 62.23GB | 2.84GB | offload_param=none, offload_optimizer=cpu , zero_init=0
+ 0.74GB | 23.58GB | offload_param=none, offload_optimizer=none, zero_init=1
+ 31.11GB | 23.58GB | offload_param=none, offload_optimizer=none, zero_init=0
+
+```
+
+ใใใใฃใฆใใใใงใฏใCPU ใซใชใใญใผใใใใซ 2x 32GB ไปฅไธใฎ GPU ใๅฟ
่ฆใซใชใใพใใ
+
+่ฉณ็ดฐใซใคใใฆใฏใ[ใกใขใชๆจๅฎใใผใซ](https://deepspeed.readthedocs.io/en/latest/memory.html) ใๅ็
งใใฆใใ ใใใ
+
+
+### Filing Issues
+
+
+ใใใงใฏใๅ้กใฎ็็ธใใใใซ่งฃๆใใไฝๆฅญใฎใใญใใฏใ่งฃ้คใงใใใใใๅ้กใๅ ฑๅใใๆนๆณใ่ชฌๆใใพใใ
+
+ใฌใใผใใซใฏๅฟ
ใๆฌกใฎๅ
ๅฎนใๅซใใฆใใ ใใใ
+
+1. ใฌใใผใๅ
ใฎๅฎๅ
จใช Deepspeed ๆงๆใใกใคใซ
+
+2. [`Trainer`] ใไฝฟ็จใใฆใใๅ ดๅใฏใณใใณใใฉใคใณๅผๆฐใใพใใฏ
+ ใใฌใผใใผใฎใปใใใขใใใ่ชๅใงในใฏใชใใไฝๆใใฆใใๅ ดๅใฏใ[`TrainingArguments`] ๅผๆฐใใใชใใงใใ ใใ
+ [`TrainingArguments`] ใซใฏ็ก้ขไฟใชใจใณใใชใๅคๆฐๅซใพใใฆใใใใใใใณใใใพใใ
+
+3. ๆฌกใฎๅบๅ:
+
+ ```bash
+ python -c 'import torch; print(f"torch: {torch.__version__}")'
+ python -c 'import transformers; print(f"transformers: {transformers.__version__}")'
+ python -c 'import deepspeed; print(f"deepspeed: {deepspeed.__version__}")'
+ ```
+
+4. ๅฏ่ฝใงใใใฐใๅ้กใๅ็พใงใใ Google Colab ใใผใใใใฏใธใฎใชใณใฏใๅซใใฆใใ ใใใใใใไฝฟใใพใ
+ [ใใผใใใใฏ](https://github.com/stas00/porting/blob/master/transformers/deepspeed/DeepSpeed_on_colab_CLI.ipynb) ใจใใฆ
+ ๅบ็บ็นใ
+
+5. ไธๅฏ่ฝใงใชใ้ใใใซในใฟใ ใใผใฟใปใใใงใฏใชใใๅธธใซไฝฟ็จใงใใๆจๆบใใผใฟใปใใใไฝฟ็จใใฆใใ ใใใ
+
+6. ๅฏ่ฝใงใใใฐใๆขๅญใฎ [ใตใณใใซ](https://github.com/huggingface/transformers/tree/main/examples/pytorch) ใฎใใใใใไฝฟ็จใใฆๅ้กใๅ็พใใฆใฟใฆใใ ใใใ
+
+- Deepspeed ใๅ้กใฎๅๅ ใงใฏใชใใใจใใใใใใพใใ
+
+ ๆๅบใใใๅ้กใฎไธ้จใฏใDeepspeed ใจใฏ็ก้ขไฟใงใใใใจใๅคๆใใพใใใใใใฏใDeepspeed ใใปใใใขใใใใๅ้คใใใๅพใงใใ
+ ๅ้กใฏใพใ ๆฎใฃใฆใใใ
+
+ ใใใใฃใฆใๅฎๅ
จใซๆ็ฝใงใชใๅ ดๅใฏใDeepSpeed ้ข้ฃใฎๅ้กใงใใ
+ ไพๅคใ็บ็ใใDeepSpeed ใขใธใฅใผใซใ้ขไฟใใฆใใใใจใใใใใพใใใพใใDeepSpeed ใๅซใพใชใใปใใใขใใใๅใในใใใฆใใ ใใใ
+ ๅ้กใ่งฃๆฑบใใชใๅ ดๅใซใฎใฟใDeepspeed ใซใคใใฆ่จๅใใๅฟ
่ฆใช่ฉณ็ดฐใใในใฆๆไพใใฆใใ ใใใ
+
+- ๅ้กใ็ตฑๅ้จๅใงใฏใชใ DeepSpeed ใณใขใซใใใใจใๆใใใชๅ ดๅใฏใๅ้กใๆๅบใใฆใใ ใใใ
+ [Deepspeed](https://github.com/microsoft/DeepSpeed/) ใ็ดๆฅไฝฟ็จใใพใใใใใใใใชใๅ ดๅใงใใใๅฎๅฟใใ ใใใ
+ ใฉใกใใฎๅ้กใใฉใใซใผใงใๅ้กใใใพใใใๆ็จฟใใใใใใใๅคๆญใใๆฌกใฎๅ ดๅใฏๅฅใฎๅ้กใใฉใใซใผใซใชใใคใฌใฏใใใพใใ
+ ใใใงใใๅฟ
่ฆใใใใ
+
+
+### Troubleshooting
+
+#### the `deepspeed` process gets killed at startup without a traceback
+
+`deepspeed`ใใญใปในใ่ตทๅๆใซใใฌใผในใใใฏใชใใงๅผทๅถ็ตไบใใใๅ ดๅใใใใฏ้ๅธธใใใญใฐใฉใ ใ่ฉฆ่กใใใใจใๆๅณใใพใใ
+ใทในใใ ใๆใฃใฆใใใใใๅคใใฎ CPU ใกใขใชใๅฒใๅฝใฆใใใใใญใปในใๅฒใๅฝใฆใ่จฑๅฏใใใฆใใใใใOS ใซใผใใซใใใใๅผทๅถ็ตไบใใพใใ
+ใใญใปในใใใใฏใ่จญๅฎใใกใคใซใซ `offload_optimizer` ใพใใฏ `offload_param` ใๅซใพใใฆใใๅฏ่ฝๆงใ้ซใใใใงใใ
+ใฉใกใใ`cpu`ใซใชใใญใผใใใใใใซ่จญๅฎใใใฆใใพใใ NVMe ใไฝฟ็จใใฆใใๅ ดๅใฏใๆฌกใฎ็ฐๅขใงๅฎ่กใใฆใใๅ ดๅใฏ NVMe ใธใฎใชใใญใผใใ่ฉฆใใฆใใ ใใใ
+ใผใญ-3ใ [็นๅฎใฎใขใใซใซๅฟ
่ฆใชใกใขใช้ใ่ฆ็ฉใใ]ๆนๆณใฏๆฌกใฎใจใใใงใ(https://deepspeed.readthedocs.io/en/latest/memory.html)ใ
+
+#### training and/or eval/predict loss is `NaN`
+
+ใใใฏใbf16 ๆททๅ็ฒพๅบฆใขใผใใงไบๅใใฌใผใใณใฐใใใใขใใซใๅๅพใใใใใ fp16 (ๆททๅ็ฒพๅบฆใฎๆ็กใซใใใใใ) ใงไฝฟ็จใใใใจใใๅ ดๅใซใใ็บ็ใใพใใ TPU ใงใใฌใผใใณใฐใใใใปใจใใฉใฎใขใใซใใใใณๅคใใฎๅ ดๅใGoogle ใซใใฃใฆใชใชใผในใใใใขใใซใฏใใใฎใซใใดใชใซๅ้กใใใพใ (ใใจใใฐใใปใผใในใฆใฎ t5 ใใผในใฎใขใใซ)ใใใใงใฎ่งฃๆฑบ็ญใฏใใใผใใฆใงใขใใตใใผใใใฆใใๅ ดๅ (TPUใAmpere GPU ไปฅ้)ใfp32 ใพใใฏ bf16 ใไฝฟ็จใใใใจใงใใ
+
+```json
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ }
+}
+```
+
+ใญใฐใซใฏใDeepspeed ใๆฌกใฎใใใซ`OVERFLOW!`ใๅ ฑๅใใฆใใใใจใใใใใพใใ
+
+```
+0%| | 0/189 [00:00, ?it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 262144, reducing to 262144
+ 1%|โ | 1/189 [00:00<01:26, 2.17it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 262144, reducing to 131072.0
+ 1%|โโ
+ [...]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+ 14%|โโโโโโโโโโโโโโโโโ | 27/189 [00:14<01:13, 2.21it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+ 15%|โโโโโโโโโโโโโโโโโโ | 28/189 [00:14<01:13, 2.18it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+ 15%|โโโโโโโโโโโโโโโโโโ | 29/189 [00:15<01:13, 2.18it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+[...]
+```
+
+ใใใฏใDeepspeed ๆๅคฑในใฑใผใฉใผใๆๅคฑใชใผใใผใใญใผใๅ
ๆใใในใฑใผใชใณใฐไฟๆฐใ่ฆใคใใใใชใใใจใๆๅณใใพใใ
+
+(ใญใฐใฏใใใง่ชญใฟใใใใใใใใซใใใตใผใธใใใฆใใพใใ)
+
+ใใฎๅ ดๅใ้ๅธธใฏ `initial_scale_power` ใฎๅคใไธใใๅฟ
่ฆใใใใพใใ้ๅธธใ`initial_scale_power: 32` ใซ่จญๅฎใใใจๅ้กใ่งฃๆฑบใใพใใ
+
+
+### Notes
+
+- DeepSpeed ใซใฏ pip ใงใคใณในใใผใซๅฏ่ฝใช PyPI ใใใฑใผใธใใใใพใใใใใผใใฆใงใขใซๆใ้ฉๅใใใใใซใใพใๆๅนใซใใๅฟ
่ฆใใใๅ ดๅใฏใ[ใฝใผใน](https://github.com/microsoft/deepspeed#installation) ใใใคใณในใใผใซใใใใจใๅผทใใๅงใใใพใใ
+ 1 ใใใ Adam ใชใฉใฎ็นๅฎใฎๆฉ่ฝใฏใpypi ใใฃในใใชใใฅใผใทใงใณใงใฏๅฉ็จใงใใพใใใ
+- ๐ค Transformers ใง DeepSpeed ใไฝฟ็จใใใใใซ [`Trainer`] ใไฝฟ็จใใๅฟ
่ฆใฏใใใพใใ - ไปปๆใฎใขใใซใไฝฟ็จใงใใพใ
+ ๅพ่
ใฏ [DeepSpeed ็ตฑๅๆ้ ](https://www.deepspeed.ai/getting-started/#writing-deepspeed-models) ใซๅพใฃใฆ่ชฟๆดใใๅฟ
่ฆใใใใพใใ
+
+## Non-Trainer Deepspeed Integration
+
+[`~integrations.HfDeepSpeedConfig`] ใฏใDeepspeed ใ ๐ค Transformers ใณใขใซ็ตฑๅใใใใใซไฝฟ็จใใใพใ
+[`Trainer`] ใไฝฟ็จใใชใๅ ดๅใฎๆฉ่ฝใๅฎ่กใใๅฏไธใฎใใจใฏใDeepspeed ZeRO-3 ใใฉใกใผใฟๅ้ใๅฆ็ใใ`from_pretrained`ๅผใณๅบใไธญใซใขใใซใ่คๆฐใฎ GPU ใซ่ชๅ็ใซๅๅฒใใใใจใงใใใใไปฅๅคใฏใในใฆ่ชๅใง่กใๅฟ
่ฆใใใใพใใ
+
+[`Trainer`] ใไฝฟ็จใใใจใใในใฆใ่ชๅ็ใซๅฆ็ใใใพใใ
+
+[`Trainer`] ใไฝฟ็จใใชใๅ ดๅใDeepSpeed ZeRO-3 ใๅน็็ใซๅฐๅ
ฅใใใซใฏใ
+ใขใใซใใคใณในใฟใณในๅใใๅใซ [`~integrations.HfDeepSpeedConfig`] ใชใใธใงใฏใใๅ้คใใใใฎใชใใธใงใฏใใ็ใใใพใพใซใใพใใ
+
+Deepspeed ZeRO-1 ใพใใฏ ZeRO-2 ใไฝฟ็จใใฆใใๅ ดๅใฏใ`HfDeepSpeedConfig`ใไฝฟ็จใใๅฟ
่ฆใฏใพใฃใใใใใพใใใ
+
+ใใจใใฐใไบๅใใฌใผใใณใฐใใใใขใใซใฎๅ ดๅใฏๆฌกใฎใใใซใชใใพใใ
+
+
+```python
+from transformers.integrations import HfDeepSpeedConfig
+from transformers import AutoModel
+import deepspeed
+
+ds_config = {...} # deepspeed config object or path to the file
+# must run before instantiating the model to detect zero 3
+dschf = HfDeepSpeedConfig(ds_config) # keep this object alive
+model = AutoModel.from_pretrained("openai-community/gpt2")
+engine = deepspeed.initialize(model=model, config_params=ds_config, ...)
+```
+
+ใพใใฏใไบๅใใฌใผใใณใฐใใใฆใใชใใขใใซใฎๅ ดๅ:
+
+
+```python
+from transformers.integrations import HfDeepSpeedConfig
+from transformers import AutoModel, AutoConfig
+import deepspeed
+
+ds_config = {...} # deepspeed config object or path to the file
+# must run before instantiating the model to detect zero 3
+dschf = HfDeepSpeedConfig(ds_config) # keep this object alive
+config = AutoConfig.from_pretrained("openai-community/gpt2")
+model = AutoModel.from_config(config)
+engine = deepspeed.initialize(model=model, config_params=ds_config, ...)
+```
+
+[`Trainer`] ็ตฑๅใไฝฟ็จใใฆใใชใๅ ดๅใฏใๅฎๅ
จใซ็ฌๅใง่กใใใจใซใชใใใจใซๆณจๆใใฆใใ ใใใๅบๆฌ็ใซใฏใ[Deepspeed](https://www.deepspeed.ai/) Web ใตใคใใฎใใญใฅใกใณใใซๅพใฃใฆใใ ใใใใพใใ่จญๅฎใใกใคใซใๆ็คบ็ใซ่จญๅฎใใๅฟ
่ฆใใใใพใใ`"auto"`ๅคใฏไฝฟ็จใงใใใไปฃใใใซๅฎ้ใฎๅคใๅ
ฅๅใใๅฟ
่ฆใใใใพใใ
+
+## HfDeepSpeedConfig
+
+[[autodoc]] integrations.HfDeepSpeedConfig
+ - all
+
+### Custom DeepSpeed ZeRO Inference
+
+ไปฅไธใฏใๅไธใฎ GPU ใซใขใใซใ้ฉๅใงใใชใๅ ดๅใซใ[`Trainer`] ใไฝฟ็จใใใซ DeepSpeed ZeRO ๆจ่ซใๅฎ่กใใๆนๆณใฎไพใงใใ่งฃๆฑบ็ญใซใฏใ่ฟฝๅ ใฎ GPU ใฎไฝฟ็จใใพใใฏ GPU ใกใขใชใ CPU ใกใขใชใซใชใใญใผใใใใใจใๅซใพใใพใใ
+
+ใใใง็่งฃใในใ้่ฆใชใใฅใขใณในใฏใZeRO ใฎ่จญ่จๆนๆณใซใใใ็ฐใชใ GPU ใง็ฐใชใๅ
ฅๅใไธฆ่กใใฆๅฆ็ใงใใใจใใใใจใงใใ
+
+ใใฎไพใซใฏๅคง้ใฎใกใขใใใใ่ชๅทฑๆๆธๅใใใฆใใพใใ
+
+ๅฟ
ใๆฌกใฎใใจใ่กใฃใฆใใ ใใใ
+
+1. ๅๅใช GPU ใกใขใชใใใๅ ดๅใฏใCPU ใชใใญใผใใ็กๅนใซใใพใ (้ๅบฆใไฝไธใใใใ)ใ
+2. Ampere ใพใใฏๆฐใใ GPU ใๆๆใใฆใใๅ ดๅใฏใๅฆ็ใ้ซ้ๅใใใใใซ bf16 ใๆๅนใซใใพใใใใฎใใผใใฆใงใขใใชใๅ ดๅใฏใbf16 ๆททๅ็ฒพๅบฆใงไบๅใใฌใผใใณใฐใใใใขใใซ (ใปใจใใฉใฎ t5 ใขใใซใชใฉ) ใไฝฟ็จใใชใ้ใใfp16 ใๆๅนใซใใใใจใใงใใพใใใใใใฏ้ๅธธใfp16 ใงใชใผใใผใใญใผใใๅบๅใจใใฆใฌใใผใธใ่กจ็คบใใใพใใ
+
+
+```python
+#!/usr/bin/env python
+
+# This script demonstrates how to use Deepspeed ZeRO in an inference mode when one can't fit a model
+# into a single GPU
+#
+# 1. Use 1 GPU with CPU offload
+# 2. Or use multiple GPUs instead
+#
+# First you need to install deepspeed: pip install deepspeed
+#
+# Here we use a 3B "bigscience/T0_3B" model which needs about 15GB GPU RAM - so 1 largish or 2
+# small GPUs can handle it. or 1 small GPU and a lot of CPU memory.
+#
+# To use a larger model like "bigscience/T0" which needs about 50GB, unless you have an 80GB GPU -
+# you will need 2-4 gpus. And then you can adapt the script to handle more gpus if you want to
+# process multiple inputs at once.
+#
+# The provided deepspeed config also activates CPU memory offloading, so chances are that if you
+# have a lot of available CPU memory and you don't mind a slowdown you should be able to load a
+# model that doesn't normally fit into a single GPU. If you have enough GPU memory the program will
+# run faster if you don't want offload to CPU - so disable that section then.
+#
+# To deploy on 1 gpu:
+#
+# deepspeed --num_gpus 1 t0.py
+# or:
+# python -m torch.distributed.run --nproc_per_node=1 t0.py
+#
+# To deploy on 2 gpus:
+#
+# deepspeed --num_gpus 2 t0.py
+# or:
+# python -m torch.distributed.run --nproc_per_node=2 t0.py
+
+
+from transformers import AutoTokenizer, AutoConfig, AutoModelForSeq2SeqLM
+from transformers.integrations import HfDeepSpeedConfig
+import deepspeed
+import os
+import torch
+
+os.environ["TOKENIZERS_PARALLELISM"] = "false" # To avoid warnings about parallelism in tokenizers
+
+# distributed setup
+local_rank = int(os.getenv("LOCAL_RANK", "0"))
+world_size = int(os.getenv("WORLD_SIZE", "1"))
+torch.cuda.set_device(local_rank)
+deepspeed.init_distributed()
+
+model_name = "bigscience/T0_3B"
+
+config = AutoConfig.from_pretrained(model_name)
+model_hidden_size = config.d_model
+
+# batch size has to be divisible by world_size, but can be bigger than world_size
+train_batch_size = 1 * world_size
+
+# ds_config notes
+#
+# - enable bf16 if you use Ampere or higher GPU - this will run in mixed precision and will be
+# faster.
+#
+# - for older GPUs you can enable fp16, but it'll only work for non-bf16 pretrained models - e.g.
+# all official t5 models are bf16-pretrained
+#
+# - set offload_param.device to "none" or completely remove the `offload_param` section if you don't
+# - want CPU offload
+#
+# - if using `offload_param` you can manually finetune stage3_param_persistence_threshold to control
+# - which params should remain on gpus - the larger the value the smaller the offload size
+#
+# For in-depth info on Deepspeed config see
+# https://huggingface.co/docs/transformers/main/main_classes/deepspeed
+
+# keeping the same format as json for consistency, except it uses lower case for true/false
+# fmt: off
+ds_config = {
+ "fp16": {
+ "enabled": False
+ },
+ "bf16": {
+ "enabled": False
+ },
+ "zero_optimization": {
+ "stage": 3,
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": True
+ },
+ "overlap_comm": True,
+ "contiguous_gradients": True,
+ "reduce_bucket_size": model_hidden_size * model_hidden_size,
+ "stage3_prefetch_bucket_size": 0.9 * model_hidden_size * model_hidden_size,
+ "stage3_param_persistence_threshold": 10 * model_hidden_size
+ },
+ "steps_per_print": 2000,
+ "train_batch_size": train_batch_size,
+ "train_micro_batch_size_per_gpu": 1,
+ "wall_clock_breakdown": False
+}
+# fmt: on
+
+# next line instructs transformers to partition the model directly over multiple gpus using
+# deepspeed.zero.Init when model's `from_pretrained` method is called.
+#
+# **it has to be run before loading the model AutoModelForSeq2SeqLM.from_pretrained(model_name)**
+#
+# otherwise the model will first be loaded normally and only partitioned at forward time which is
+# less efficient and when there is little CPU RAM may fail
+dschf = HfDeepSpeedConfig(ds_config) # keep this object alive
+
+# now a model can be loaded.
+model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
+
+# initialise Deepspeed ZeRO and store only the engine object
+ds_engine = deepspeed.initialize(model=model, config_params=ds_config)[0]
+ds_engine.module.eval() # inference
+
+# Deepspeed ZeRO can process unrelated inputs on each GPU. So for 2 gpus you process 2 inputs at once.
+# If you use more GPUs adjust for more.
+# And of course if you have just one input to process you then need to pass the same string to both gpus
+# If you use only one GPU, then you will have only rank 0.
+rank = torch.distributed.get_rank()
+if rank == 0:
+ text_in = "Is this review positive or negative? Review: this is the best cast iron skillet you will ever buy"
+elif rank == 1:
+ text_in = "Is this review positive or negative? Review: this is the worst restaurant ever"
+
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+inputs = tokenizer.encode(text_in, return_tensors="pt").to(device=local_rank)
+with torch.no_grad():
+ outputs = ds_engine.module.generate(inputs, synced_gpus=True)
+text_out = tokenizer.decode(outputs[0], skip_special_tokens=True)
+print(f"rank{rank}:\n in={text_in}\n out={text_out}")
+```
+
+ใใใ`t0.py`ใจใใฆไฟๅญใใฆๅฎ่กใใพใใใใ
+
+```bash
+$ deepspeed --num_gpus 2 t0.py
+rank0:
+ in=Is this review positive or negative? Review: this is the best cast iron skillet you will ever buy
+ out=Positive
+rank1:
+ in=Is this review positive or negative? Review: this is the worst restaurant ever
+ out=negative
+```
+
+ใใใฏ้ๅธธใซๅบๆฌ็ใชไพใงใใใใใผใบใซๅใใใฆ่ชฟๆดใใฆใใ ใใใ
+
+### `generate` nuances
+
+ZeRO Stage-3 ใง่คๆฐใฎ GPU ใไฝฟ็จใใๅ ดๅใ`generate(..., synced_gpus=True)`ใๅผใณๅบใใฆ GPU ใๅๆใใๅฟ
่ฆใใใใพใใใใใ่กใใชใใจใ1 ใคใฎ GPU ใไปใฎ GPU ใใๅ
ใซ็ๆใ็ตไบใใๅ ดๅใๆฎใใฎ GPU ใ็ๆใๅๆญขใใ GPU ใใใฆใงใคใใฎใทใฃใผใใๅไฟกใงใใชใใชใใใใใทในใใ ๅ
จไฝใใใณใฐใใพใใ
+
+`transformers>=4.28` ไปฅ้ใ`synced_gpus` ใๆ็คบ็ใซๆๅฎใใใฆใใชใๅ ดๅใใใใใฎๆกไปถใๆคๅบใใใใจ่ชๅ็ใซ `True` ใซ่จญๅฎใใใพใใใใ ใใๅฟ
่ฆใซๅฟใใฆ `synced_gpus` ใฎๅคใใชใผใใผใฉใคใใใใใจใใงใใพใใ
+
+## Deepspeed ็ตฑๅใฎใในใ
+
+DeepSpeed ็ตฑๅใๅซใ PR ใ้ไฟกใใๅ ดๅใฏใCircleCI PR CI ใปใใใขใใใซใฏ GPU ใใชใใใจใซๆณจๆใใฆใใ ใใใใใฎใใใGPU ใๅฟ
่ฆใจใใใในใใฏๅฅใฎ CI ใงๆฏๆฉใฎใฟๅฎ่กใใใพใใใใใใฃใฆใPR ใง็ท่ฒใฎ CI ใฌใใผใใ่กจ็คบใใใฆใใDeepSpeed ใในใใๅๆ ผใใใใจใๆๅณใใใใใงใฏใใใพใใใ
+
+DeepSpeed ใในใใๅฎ่กใใใซใฏใๅฐใชใใจใไปฅไธใๅฎ่กใใฆใใ ใใใ
+
+```bash
+RUN_SLOW=1 pytest tests/deepspeed/test_deepspeed.py
+```
+
+ใขใใชใณใฐใพใใฏ pytorch ใตใณใใซ ใณใผใใฎใใใใใๅคๆดใใๅ ดๅใฏใModel Zoo ใในใใๅฎ่กใใพใใไปฅไธใฏใในใฆใฎ DeepSpeed ใในใใๅฎ่กใใพใใ
+
+```bash
+RUN_SLOW=1 pytest tests/deepspeed
+```
+
+
+## Main DeepSpeed Resources
+
+- [ใใญใธใงใฏใใฎ github](https://github.com/microsoft/deepspeed)
+- [ไฝฟ็จๆนๆณใใญใฅใกใณใ](https://www.deepspeed.ai/getting-started/)
+- [API ใใญใฅใกใณใ](https://deepspeed.readthedocs.io/en/latest/index.html)
+- [ใใญใฐๆ็จฟ](https://www.microsoft.com/en-us/research/search/?q=deepspeed)
+
+่ซๆ:
+
+- [ZeRO: ๅ
ใใฉใกใผใฟ ใขใใซใฎใใฌใผใใณใฐใซๅใใใกใขใชใฎๆ้ฉๅ](https://arxiv.org/abs/1910.02054)
+- [ZeRO-Offload: 10 ๅ่ฆๆจกใฎใขใใซ ใใฌใผใใณใฐใฎๆฐไธปๅ](https://arxiv.org/abs/2101.06840)
+- [ZeRO-Infinity: ๆฅต้ในใฑใผใซใฎๆทฑๅฑคๅญฆ็ฟใฎใใใฎ GPU ใกใขใชใฎๅฃใๆใก็ ดใ](https://arxiv.org/abs/2104.07857)
+
+ๆๅพใซใHuggingFace [`Trainer`] ใฏ DeepSpeed ใฎใฟใ็ตฑๅใใฆใใใใจใ่ฆใใฆใใใฆใใ ใใใ
+DeepSpeed ใฎไฝฟ็จใซ้ขใใฆๅ้กใ่ณชๅใใใๅ ดๅใฏใ[DeepSpeed GitHub](https://github.com/microsoft/DeepSpeed/issues) ใซๅ้กใๆๅบใใฆใใ ใใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/feature_extractor.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/feature_extractor.md
new file mode 100644
index 0000000000000000000000000000000000000000..a2bd8c59a84f35f5a2b6bf131bb5eba4ccb2c677
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/feature_extractor.md
@@ -0,0 +1,41 @@
+
+
+# Feature Extractor
+
+
+ใใฃใผใใฃใผใจใฏในใใฉใฏใฟใฏใใชใผใใฃใชใพใใฏใใธใงใณใขใใซใฎใใใฎๅ
ฅๅใใฃใผใใฃใผใฎๆบๅใๆ
ๅฝใใฆใใพใใใใใซใฏใใทใผใฑใณในใใใฎใใฃใผใใฃใผๆฝๅบ๏ผไพ๏ผใชใผใใฃใชใใกใคใซใฎๅๅฆ็ใใLog-Melในใใฏใใญใฐใฉใ ใใฃใผใใฃใผใธใฎๅคๆ๏ผใ็ปๅใใใฎใใฃใผใใฃใผๆฝๅบ๏ผไพ๏ผ็ปๅใใกใคใซใฎใฏใญใใใณใฐ๏ผใใพใใใใฃใณใฐใๆญฃ่ฆๅใใใใฆNumpyใPyTorchใTensorFlowใใณใฝใซใธใฎๅคๆใๅซใพใใพใใ
+
+
+## FeatureExtractionMixin
+
+[[autodoc]] feature_extraction_utils.FeatureExtractionMixin
+ - from_pretrained
+ - save_pretrained
+
+## SequenceFeatureExtractor
+
+[[autodoc]] SequenceFeatureExtractor
+ - pad
+
+## BatchFeature
+
+[[autodoc]] BatchFeature
+
+## ImageFeatureExtractionMixin
+
+[[autodoc]] image_utils.ImageFeatureExtractionMixin
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/image_processor.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/image_processor.md
new file mode 100644
index 0000000000000000000000000000000000000000..bfd33b83c2e50b8f41ee0e6584ee512a1be45bbc
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/image_processor.md
@@ -0,0 +1,33 @@
+
+
+# Image Processor
+
+็ปๅใใญใปใใตใฏใใใธใงใณ ใขใใซใฎๅ
ฅๅ็นๅพดใฎๆบๅใจใใฎๅบๅใฎๅพๅฆ็ใๆ
ๅฝใใพใใใใใซใฏใใตใคใบๅคๆดใๆญฃ่ฆๅใPyTorchใTensorFlowใFlaxใNumpy ใใณใฝใซใธใฎๅคๆใชใฉใฎๅคๆใๅซใพใใพใใใญใธใใใใปใฐใกใณใใผใทใงใณ ใในใฏใซๅคๆใใใชใฉใใขใใซๅบๆใฎๅพๅฆ็ใๅซใพใใๅ ดๅใใใใพใใ
+
+## ImageProcessingMixin
+
+[[autodoc]] image_processing_utils.ImageProcessingMixin
+ - from_pretrained
+ - save_pretrained
+
+## BatchFeature
+
+[[autodoc]] BatchFeature
+
+## BaseImageProcessor
+
+[[autodoc]] image_processing_utils.BaseImageProcessor
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/keras_callbacks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/keras_callbacks.md
new file mode 100644
index 0000000000000000000000000000000000000000..ff28107a4345795ff04e11ffec7f76a93561635a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/keras_callbacks.md
@@ -0,0 +1,28 @@
+
+
+# Keras callbacks
+
+Keras ใไฝฟ็จใใฆ Transformers ใขใใซใใใฌใผใใณใฐใใๅ ดๅใไธ่ฌ็ใชๅฆ็ใ่ชๅๅใใใใใซไฝฟ็จใงใใใฉใคใใฉใชๅบๆใฎใณใผใซใใใฏใใใใคใใใใพใใ
+ใฟในใฏ:
+
+## KerasMetricCallback
+
+[[autodoc]] KerasMetricCallback
+
+## PushToHubCallback
+
+[[autodoc]] PushToHubCallback
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/logging.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/logging.md
new file mode 100644
index 0000000000000000000000000000000000000000..4b4f4a2a3e0940e353ffa7f08f9bba842cbbfbc3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/logging.md
@@ -0,0 +1,121 @@
+
+
+# Logging
+
+๐ค Transformersใซใฏใใฉใคใใฉใชใฎ่ฉณ็ดฐๅบฆใ็ฐกๅใซ่จญๅฎใงใใไธญๅคฎ้ไธญๅใฎใญใฎใณใฐใทในใใ ใใใใพใใ
+
+็พๅจใใฉใคใใฉใชใฎใใใฉใซใใฎ่ฉณ็ดฐๅบฆใฏใWARNINGใใงใใ
+
+่ฉณ็ดฐๅบฆใๅคๆดใใใซใฏใ็ดๆฅ่จญๅฎใกใฝใใใฎ1ใคใไฝฟ็จใใใ ใใงใใไพใใฐใ่ฉณ็ดฐๅบฆใINFOใฌใใซใซๅคๆดใใๆนๆณใฏไปฅไธใฎ้ใใงใใ
+
+
+```python
+import transformers
+
+transformers.logging.set_verbosity_info()
+```
+
+
+็ฐๅขๅคๆฐ `TRANSFORMERS_VERBOSITY` ใไฝฟ็จใใฆใใใใฉใซใใฎๅ้ทๆงใใชใผใใผใฉใคใใใใใจใใงใใพใใ่จญๅฎใงใใพใ
+`debug`ใ`info`ใ`warning`ใ`error`ใ`critical` ใฎใใใใใซๅคๆดใใพใใไพใใฐ๏ผ
+
+```bash
+TRANSFORMERS_VERBOSITY=error ./myprogram.py
+```
+
+
+ใใใซใไธ้จใฎใ่ญฆๅใใฏ็ฐๅขๅคๆฐใ่จญๅฎใใใใจใง็กๅนใซใงใใพใใ
+`TRANSFORMERS_NO_ADVISORY_WARNINGS` ใ *1* ใชใฉใฎ true ๅคใซ่จญๅฎใใพใใใใใซใใใๆฌกใไฝฟ็จใใฆใญใฐใซ่จ้ฒใใใ่ญฆๅใ็กๅนใซใชใใพใใ
+[`logger.warning_advice`]ใไพใใฐ๏ผ
+
+```bash
+TRANSFORMERS_NO_ADVISORY_WARNINGS=1 ./myprogram.py
+```
+
+
+ไปฅไธใฏใ็ฌ่ชใฎใขใธใฅใผใซใพใใฏในใฏใชใใใงใฉใคใใฉใชใจๅใใญใฌใผใไฝฟ็จใใๆนๆณใฎไพใงใใ
+
+```python
+from transformers.utils import logging
+
+logging.set_verbosity_info()
+logger = logging.get_logger("transformers")
+logger.info("INFO")
+logger.warning("WARN")
+```
+
+ใใฎใญใฎใณใฐ ใขใธใฅใผใซใฎใในใฆใฎใกใฝใใใฏไปฅไธใซๆๆธๅใใใฆใใพใใไธปใชใกใฝใใใฏๆฌกใฎใจใใใงใใ
+[`logging.get_verbosity`] ใญใฌใผใฎ็พๅจใฎๅ้ทใฌใใซใๅๅพใใพใใ
+[`logging.set_verbosity`] ใไฝฟ็จใใฆใๅ้ทๆงใ้ธๆใใใฌใใซใซ่จญๅฎใใพใใ้ ็ชใซ๏ผๅฐใชใใใฎใใ๏ผ
+ๅ้ทใใๆใๅ้ทใพใง)ใใใใใฎใฌใใซ (ๆฌๅผงๅ
ใฏๅฏพๅฟใใ int ๅค) ใฏๆฌกใฎใจใใใงใใ
+
+- `transformers.logging.CRITICAL` ใพใใฏ `transformers.logging.FATAL` (int ๅคใ50): ๆใๅคใใใฎใฎใฟใใฌใใผใใใพใใ
+ ้ๅคงใชใจใฉใผใ
+- `transformers.logging.ERROR` (int ๅคใ40): ใจใฉใผใฎใฟใๅ ฑๅใใพใใ
+- `transformers.logging.WARNING` ใพใใฏ `transformers.logging.WARN` (int ๅคใ30): ใจใฉใผใจ
+ ่ญฆๅใใใใฏใฉใคใใฉใชใงไฝฟ็จใใใใใใฉใซใใฎใฌใใซใงใใ
+- `transformers.logging.INFO` (int ๅคใ20): ใจใฉใผใ่ญฆๅใใใใณๅบๆฌๆ
ๅ ฑใใฌใใผใใใพใใ
+- `transformers.logging.DEBUG` (int ๅคใ10): ใในใฆใฎๆ
ๅ ฑใใฌใใผใใใพใใ
+
+ใใใฉใซใใงใฏใใขใใซใฎใใฆใณใญใผใไธญใซใtqdmใ้ฒ่ก็ถๆณใใผใ่กจ็คบใใใพใใ [`logging.disable_progress_bar`] ใใใณ [`logging.enable_progress_bar`] ใไฝฟ็จใใฆใใใฎๅไฝใๆๅถใพใใฏๆๅถ่งฃ้คใงใใพใใ
+
+## `logging` vs `warnings`
+
+Python ใซใฏใใใ็ตใฟๅใใใฆไฝฟ็จโโใใใ 2 ใคใฎใญใฎใณใฐ ใทในใใ ใใใใพใใไธใง่ชฌๆใใ `logging` ใจ `warnings` ใงใใ
+ใใใซใใใ็นๅฎใฎใใฑใใๅ
ใฎ่ญฆๅใใใใซๅ้กใงใใพใ (ไพ: ๆฉ่ฝใพใใฏใในใฎ`FutureWarning`)
+ใใใฏใใงใซ้ๆจๅฅจใซใชใฃใฆใใใ`DeprecationWarning`ใฏไปๅพใฎ้ๆจๅฅจใ็คบใใพใใ
+
+ไธกๆนใจใ`transformers`ใฉใคใใฉใชใงไฝฟ็จใใพใใ `logging`ใฎ`captureWarning`ใกใฝใใใๆดป็จใใฆ้ฉๅฟใใใฆใ
+ใใใใฎ่ญฆๅใกใใปใผใธใฏใไธ่จใฎๅ้ท่จญๅฎใใผใซใซใใฃใฆ็ฎก็ใใใพใใ
+
+ใใใฏใฉใคใใฉใชใฎ้็บ่
ใซใจใฃใฆไฝใๆๅณใใพใใ?ๆฌกใฎใใฅใผใชในใใฃใใฏใๅฐ้ใใๅฟ
่ฆใใใใพใใ
+- `warnings`ใฏใใฉใคใใฉใชใใใณ`transformers`ใซไพๅญใใใฉใคใใฉใชใฎ้็บ่
ใซๅชๅ
ใใใในใใงใใ
+- `logging`ใฏใๆฅๅธธใฎใใญใธใงใฏใใงใฉใคใใฉใชใไฝฟ็จใใใฉใคใใฉใชใฎใจใณใใฆใผใถใผใซไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+ไปฅไธใฎ`captureWarnings`ใกใฝใใใฎใชใใกใฌใณในใๅ็
งใใฆใใ ใใใ
+
+[[autodoc]] logging.captureWarnings
+
+## Base setters
+
+[[autodoc]] logging.set_verbosity_error
+
+[[autodoc]] logging.set_verbosity_warning
+
+[[autodoc]] logging.set_verbosity_info
+
+[[autodoc]] logging.set_verbosity_debug
+
+## Other functions
+
+[[autodoc]] logging.get_verbosity
+
+[[autodoc]] logging.set_verbosity
+
+[[autodoc]] logging.get_logger
+
+[[autodoc]] logging.enable_default_handler
+
+[[autodoc]] logging.disable_default_handler
+
+[[autodoc]] logging.enable_explicit_format
+
+[[autodoc]] logging.reset_format
+
+[[autodoc]] logging.enable_progress_bar
+
+[[autodoc]] logging.disable_progress_bar
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/model.md
new file mode 100644
index 0000000000000000000000000000000000000000..916040c4a3b275cf695fed54ce29622636b0d194
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/model.md
@@ -0,0 +1,160 @@
+
+
+# Models
+
+ใใผในใฏใฉในใงใใ [`PreTrainedModel`]ใ[`TFPreTrainedModel`]ใ[`FlaxPreTrainedModel`] ใฏใใขใใซใฎ่ชญใฟ่พผใฟใจไฟๅญใซ้ขใใๅ
ฑ้ใฎใกใฝใใใๅฎ่ฃ
ใใฆใใใใใใฏใญใผใซใซใฎใใกใคใซใใใฃใฌใฏใใชใใใใพใใฏใฉใคใใฉใชใๆไพใใไบๅๅญฆ็ฟใขใใซๆงๆ๏ผHuggingFaceใฎAWS S3ใชใใธใใชใใใใฆใณใญใผใ๏ผใใใขใใซใ่ชญใฟ่พผใใใใซไฝฟ็จใงใใพใใ
+
+[`PreTrainedModel`] ใจ [`TFPreTrainedModel`] ใฏใๆฌกใฎๅ
ฑ้ใฎใกใฝใใใๅฎ่ฃ
ใใฆใใพใ๏ผ
+
+- ่ชๅฝใซๆฐใใใใผใฏใณใ่ฟฝๅ ใใใๅ ดๅใซใๅ
ฅๅใใผใฏใณๅใ่พผใฟใฎใชใตใคใบใ่กใ
+- ใขใใซใฎใขใใณใทใงใณใใใใๅใ่พผใ
+
+ๅใขใใซใซๅ
ฑ้ใใใใฎไปใฎใกใฝใใใฏใ[`~modeling_utils.ModuleUtilsMixin`]๏ผPyTorchใขใใซ็จ๏ผใใใณ[`~modeling_tf_utils.TFModuleUtilsMixin`]๏ผTensorFlowใขใใซ็จ๏ผใงๅฎ็พฉใใใฆใใใใใญในใ็ๆใฎๅ ดๅใ[`~generation.GenerationMixin`]๏ผPyTorchใขใใซ็จ๏ผใ[`~generation.TFGenerationMixin`]๏ผTensorFlowใขใใซ็จ๏ผใใใใณ[`~generation.FlaxGenerationMixin`]๏ผFlax/JAXใขใใซ็จ๏ผใใใใพใใ
+
+
+## PreTrainedModel
+
+[[autodoc]] PreTrainedModel
+ - push_to_hub
+ - all
+
+
+
+
+### ๅคง่ฆๆจกใขใใซใฎ่ชญใฟ่พผใฟ
+
+Transformers 4.20.0ใงใฏใ[`~PreTrainedModel.from_pretrained`] ใกใฝใใใๅ่จญ่จใใใ[Accelerate](https://huggingface.co/docs/accelerate/big_modeling) ใไฝฟ็จใใฆๅคง่ฆๆจกใขใใซใๆฑใใใจใๅฏ่ฝใซใชใใพใใใใใใซใฏ Accelerate >= 0.9.0 ใจ PyTorch >= 1.9.0 ใๅฟ
่ฆใงใใไปฅๅใฎๆนๆณใงใใซใขใใซใไฝๆใใใใฎๅพไบๅๅญฆ็ฟใฎ้ใฟใ่ชญใฟ่พผใไปฃใใใซ๏ผใใใซใฏใกใขใชๅ
ใฎใขใใซใตใคใบใ2ๅๅฟ
่ฆใงใใฉใณใใ ใซๅๆๅใใใใขใใซ็จใจ้ใฟ็จใฎ2ใคใๅฟ
่ฆใงใใ๏ผใใขใใซใ็ฉบใฎๅคๆฎปใจใใฆไฝๆใใไบๅๅญฆ็ฟใฎ้ใฟใ่ชญใฟ่พผใพใใใจใใซใใฉใกใผใฟใผใๅฎไฝๅใใใชใใทใงใณใ่ฟฝๅ ใใใพใใใ
+
+ใใฎใชใใทใงใณใฏ `low_cpu_mem_usage=True` ใงๆๅนใซใงใใพใใใขใใซใฏใพใ็ฉบใฎ้ใฟใๆใคใกใฟใใใคในไธใซไฝๆใใใใใฎๅพ็ถๆ
่พๆธใๅ
้จใซ่ชญใฟ่พผใพใใพใ๏ผใทใฃใผใใใใใใงใใฏใใคใณใใฎๅ ดๅใใทใฃใผใใใจใซ่ชญใฟ่พผใพใใพใ๏ผใใใฎๆนๆณใงไฝฟ็จใใใๆๅคงRAMใฏใใขใใซใฎๅฎๅ
จใชใตใคใบใ ใใงใใ
+
+
+```py
+from transformers import AutoModelForSeq2SeqLM
+
+t0pp = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0pp", low_cpu_mem_usage=True)
+```
+
+ใใใซใใขใใซใๅฎๅ
จใซRAMใซๅใพใใชใๅ ดๅ๏ผ็พๆ็นใงใฏๆจ่ซใฎใฟๆๅน๏ผใ็ฐใชใใใใคในใซใขใใซใ็ดๆฅ้
็ฝฎใงใใพใใ`device_map="auto"` ใไฝฟ็จใใใจใAccelerateใฏๅใฌใคใคใผใใฉใฎใใใคในใซ้
็ฝฎใใใใๆฑบๅฎใใๆ้ใฎใใใคใน๏ผGPU๏ผใๆๅคง้ใซๆดป็จใใๆฎใใฎ้จๅใCPUใใใใใฏGPU RAMใไธ่ถณใใฆใใๅ ดๅใฏใใผใใใฉใคใใซใชใใญใผใใใพใใใขใใซใ่คๆฐใฎใใใคในใซๅๅฒใใใฆใใฆใใ้ๅธธใฉใใๅฎ่กใใใพใใ
+
+`device_map` ใๆธกใ้ใ`low_cpu_mem_usage` ใฏ่ชๅ็ใซ `True` ใซ่จญๅฎใใใใใใใใใๆๅฎใใๅฟ
่ฆใฏใใใพใใใ
+
+
+```py
+from transformers import AutoModelForSeq2SeqLM
+
+t0pp = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0pp", device_map="auto")
+```
+
+ใขใใซใใใใคใน้ใงใฉใฎใใใซๅๅฒใใใใใฏใใใฎ `hf_device_map` ๅฑๆงใ่ฆใใใจใง็ขบ่ชใงใใพใ:
+
+```py
+t0pp.hf_device_map
+```
+
+```python out
+{'shared': 0,
+ 'decoder.embed_tokens': 0,
+ 'encoder': 0,
+ 'decoder.block.0': 0,
+ 'decoder.block.1': 1,
+ 'decoder.block.2': 1,
+ 'decoder.block.3': 1,
+ 'decoder.block.4': 1,
+ 'decoder.block.5': 1,
+ 'decoder.block.6': 1,
+ 'decoder.block.7': 1,
+ 'decoder.block.8': 1,
+ 'decoder.block.9': 1,
+ 'decoder.block.10': 1,
+ 'decoder.block.11': 1,
+ 'decoder.block.12': 1,
+ 'decoder.block.13': 1,
+ 'decoder.block.14': 1,
+ 'decoder.block.15': 1,
+ 'decoder.block.16': 1,
+ 'decoder.block.17': 1,
+ 'decoder.block.18': 1,
+ 'decoder.block.19': 1,
+ 'decoder.block.20': 1,
+ 'decoder.block.21': 1,
+ 'decoder.block.22': 'cpu',
+ 'decoder.block.23': 'cpu',
+ 'decoder.final_layer_norm': 'cpu',
+ 'decoder.dropout': 'cpu',
+ 'lm_head': 'cpu'}
+```
+
+ๅใใใฉใผใใใใซๅพใฃใฆใ็ฌ่ชใฎใใใคในใใใใไฝๆใใใใจใใงใใพใ๏ผใฌใคใคใผๅใใใใใคในใธใฎ่พๆธใงใ๏ผใใขใใซใฎใในใฆใฎใใฉใกใผใฟใๆๅฎใใใใใใคในใซใใใใใๅฟ
่ฆใใใใพใใใ1ใคใฎใฌใคใคใผใๅฎๅ
จใซๅใใใใคในใซใใๅ ดๅใใใฎใฌใคใคใผใฎใตใใขใธใฅใผใซใฎใในใฆใใฉใใซ่กใใใฎ่ฉณ็ดฐใ็คบใๅฟ
่ฆใฏใใใพใใใไพใใฐใๆฌกใฎใใใคในใใใใฏT0ppใซ้ฉใใฆใใพใ๏ผGPUใกใขใชใใใๅ ดๅ๏ผ:
+
+```python
+device_map = {"shared": 0, "encoder": 0, "decoder": 1, "lm_head": 1}
+```
+
+ใขใใซใฎใกใขใชใธใฎๅฝฑ้ฟใๆๅฐ้ใซๆใใใใ 1 ใคใฎๆนๆณใฏใไฝ็ฒพๅบฆใฎ dtype (`torch.float16` ใชใฉ) ใงใขใใซใใคใณในใฟใณในๅใใใใไปฅไธใง่ชฌๆใใ็ดๆฅ้ๅญๅๆๆณใไฝฟ็จใใใใจใงใใ
+
+### Model Instantiation dtype
+
+Pytorch ใงใฏใใขใใซใฏ้ๅธธ `torch.float32` ๅฝขๅผใงใคใณในใฟใณในๅใใใพใใใใใฏใใใใใจใใใจๅ้กใซใชใๅฏ่ฝๆงใใใใพใ
+้ใฟใ fp16 ใซใใใขใใซใใญใผใใใใจใ2 ๅใฎใกใขใชใๅฟ
่ฆใซใชใใใใงใใใใฎๅถ้ใๅ
ๆใใใซใฏใๆฌกใฎใใจใใงใใพใใ
+`torch_dtype` ๅผๆฐใไฝฟ็จใใฆใ็ฎ็ใฎ `dtype` ใๆ็คบ็ใซๆธกใใพใใ
+
+```python
+model = T5ForConditionalGeneration.from_pretrained("t5", torch_dtype=torch.float16)
+```
+ใพใใฏใใขใใซใๅธธใซๆ้ฉใชใกใขใช ใใฟใผใณใงใญใผใใใใๅ ดๅใฏใ็นๅฅใชๅค `"auto"` ใไฝฟ็จใงใใพใใ
+ใใใฆใ`dtype` ใฏใขใใซใฎ้ใฟใใ่ชๅ็ใซๅฐๅบใใใพใใ
+
+```python
+model = T5ForConditionalGeneration.from_pretrained("t5", torch_dtype="auto")
+```
+
+ในใฏใฉใใใใใคใณในใฟใณในๅใใใใขใใซใซใฏใใฉใฎ `dtype` ใไฝฟ็จใใใใๆ็คบใใใใจใใงใใพใใ
+
+```python
+config = T5Config.from_pretrained("t5")
+model = AutoModel.from_config(config)
+```
+
+Pytorch ใฎ่จญ่จใซใใใใใฎๆฉ่ฝใฏๆตฎๅๅฐๆฐ็น dtype ใงใฎใฟไฝฟ็จใงใใพใใ
+
+## ModuleUtilsMixin
+
+[[autodoc]] modeling_utils.ModuleUtilsMixin
+
+## TFPreTrainedModel
+
+[[autodoc]] TFPreTrainedModel
+ - push_to_hub
+ - all
+
+## TFModelUtilsMixin
+
+[[autodoc]] modeling_tf_utils.TFModelUtilsMixin
+
+## FlaxPreTrainedModel
+
+[[autodoc]] FlaxPreTrainedModel
+ - push_to_hub
+ - all
+
+## Pushing to the Hub
+
+[[autodoc]] utils.PushToHubMixin
+
+## Sharded checkpoints
+
+[[autodoc]] modeling_utils.load_sharded_checkpoint
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/onnx.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/onnx.md
new file mode 100644
index 0000000000000000000000000000000000000000..f12427760976a0cdde8c197fd581f41bccd3dcf3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/onnx.md
@@ -0,0 +1,55 @@
+
+
+# Exporting ๐ค Transformers models to ONNX
+
+๐ค Transformers ใฏ `transformers.onnx` ใใใฑใผใธใๆไพใใพใใ
+่จญๅฎใชใใธใงใฏใใๅฉ็จใใใใจใงใใขใใซใฎใใงใใฏใใคใณใใONNXใฐใฉใใซๅคๆใใใใจใใงใใพใใ
+
+่ฉณ็ดฐใฏ[ใฌใคใ](../serialization) ใๅ็
งใใฆใใ ใใใ
+ใๅ็
งใใฆใใ ใใใ
+
+## ONNX Configurations
+
+ไปฅไธใฎ3ใคใฎๆฝ่ฑกใฏใฉในใๆไพใใฆใใพใใ
+ใจใฏในใใผใใใใใขใใซใขใผใญใใฏใใฃใฎใฟใคใใซๅฟใใฆใ็ถๆฟใในใ3ใคใฎๆฝ่ฑกใฏใฉในใๆไพใใพใ๏ผ
+
+* ใจใณใณใผใใผใใผในใฎใขใใซใฏ [`~onnx.config.OnnxConfig`] ใ็ถๆฟใใพใใ
+* ใใณใผใใผใใผในใฎใขใใซใฏ [`~onnx.config.OnnxConfigWithPast`] ใ็ถๆฟใใพใใ
+* ใจใณใณใผใใผใปใใณใผใใผใขใใซใฏ [`~onnx.config.OnnxSeq2SeqConfigWithPast`] ใ็ถๆฟใใฆใใพใใ
+
+
+### OnnxConfig
+
+[[autodoc]] onnx.config.OnnxConfig
+
+### OnnxConfigWithPast
+
+[[autodoc]] onnx.config.OnnxConfigWithPast
+
+### OnnxSeq2SeqConfigWithPast
+
+[[autodoc]] onnx.config.OnnxSeq2SeqConfigWithPast
+
+## ONNX Features
+
+ๅ ONNX ๆงๆใฏใๆฌกใฎใใจใๅฏ่ฝใซใใไธ้ฃใฎ _ๆฉ่ฝ_ ใซ้ข้ฃไปใใใใฆใใพใใ
+ใใพใใพใชใฟใคใใฎใใใญใธใพใใฏใฟในใฏใฎใขใใซใใจใฏในใใผใใใพใใ
+
+### FeaturesManager
+
+[[autodoc]] onnx.features.FeaturesManager
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/optimizer_schedules.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/optimizer_schedules.md
new file mode 100644
index 0000000000000000000000000000000000000000..fc7a13b9df531dad8691dc9a0f955eace1be5a04
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/optimizer_schedules.md
@@ -0,0 +1,77 @@
+
+
+# Optimization
+
+`.optimization` ใขใธใฅใผใซใฏไปฅไธใๆไพใใพใใ
+
+- ใขใใซใฎๅพฎ่ชฟๆดใซไฝฟ็จใงใใ้ใฟๆธ่กฐใไฟฎๆญฃใใใใชใใใฃใใคใถใผใใใใณ
+- `_LRSchedule` ใใ็ถๆฟใใในใฑใธใฅใผใซ ใชใใธใงใฏใใฎๅฝขๅผใฎใใใคใใฎในใฑใธใฅใผใซ:
+- ่คๆฐใฎใใใใฎๅพ้
ใ็ดฏ็ฉใใใใใฎๅพ้
็ดฏ็ฉใฏใฉใน
+
+## AdamW (PyTorch)
+
+[[autodoc]] AdamW
+
+## AdaFactor (PyTorch)
+
+[[autodoc]] Adafactor
+
+## AdamWeightDecay (TensorFlow)
+
+[[autodoc]] AdamWeightDecay
+
+[[autodoc]] create_optimizer
+
+## Schedules
+
+### Learning Rate Schedules (Pytorch)
+
+[[autodoc]] SchedulerType
+
+[[autodoc]] get_scheduler
+
+[[autodoc]] get_constant_schedule
+
+[[autodoc]] get_constant_schedule_with_warmup
+
+
+
+[[autodoc]] get_cosine_schedule_with_warmup
+
+
+
+[[autodoc]] get_cosine_with_hard_restarts_schedule_with_warmup
+
+
+
+[[autodoc]] get_linear_schedule_with_warmup
+
+
+
+[[autodoc]] get_polynomial_decay_schedule_with_warmup
+
+[[autodoc]] get_inverse_sqrt_schedule
+
+### Warmup (TensorFlow)
+
+[[autodoc]] WarmUp
+
+## Gradient Strategies
+
+### GradientAccumulator (TensorFlow)
+
+[[autodoc]] GradientAccumulator
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/output.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/output.md
new file mode 100644
index 0000000000000000000000000000000000000000..beb9dcbb4423556c7bafd2f0b9ad63c89727a897
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/output.md
@@ -0,0 +1,321 @@
+
+
+# Model outputs
+
+ใในใฆใฎใขใใซใซใฏใ[`~utils.ModelOutput`] ใฎใตใใฏใฉในใฎใคใณในใฟใณในใงใใๅบๅใใใใพใใใใใใฏ
+ใขใใซใซใใฃใฆ่ฟใใใใในใฆใฎๆ
ๅ ฑใๅซใใใผใฟๆง้ ใงใใใใฟใใซใพใใฏ
+่พๆธใ
+
+ใใใใฉใฎใใใซใชใใใไพใง่ฆใฆใฟใพใใใใ
+
+```python
+from transformers import BertTokenizer, BertForSequenceClassification
+import torch
+
+tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+model = BertForSequenceClassification.from_pretrained("google-bert/bert-base-uncased")
+
+inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
+labels = torch.tensor([1]).unsqueeze(0) # Batch size 1
+outputs = model(**inputs, labels=labels)
+```
+
+`outputs`ใชใใธใงใฏใใฏ[`~modeling_outputs.SequenceClassifierOutput`]ใงใใใ
+ใใใฏใใชใใทใงใณใง `loss`ใ`logits`ใใชใใทใงใณใง `hidden_states`ใใชใใทใงใณใง `attentions` ๅฑๆงใๆใคใใจใๆๅณใใพใใ
+ใชใใทใงใณใฎ `attentions` ๅฑๆงใๆใคใใจใๆๅณใใใใใใงใฏใ`labels`ใๆธกใใใฎใง`loss`ใใใใใ`hidden_states`ใจ`attentions`ใฏใชใใ
+`output_hidden_states=True`ใ`output_attentions=True`ใๆธกใใฆใใชใใฎใงใ`hidden_states`ใจ`attentions`ใฏใชใใ
+`output_attentions=True`ใๆธกใใชใใฃใใใใ ใ
+
+
+
+`output_hidden_states=True`ใๆธกใใจใ`outputs.hidden_states[-1]`ใ `outputs.last_hidden_states` ใจๆญฃ็ขบใซไธ่ดใใใใจใๆๅพ
ใใใใใใใชใใ
+ใใใใๅฟ
ใใใใใใชใใจใฏ้ใใพใใใใขใใซใซใใฃใฆใฏใๆๅพใซ้ ใใใ็ถๆ
ใ่ฟใใใใจใใซใๆญฃ่ฆๅใใใฎๅพใฎๅฆ็ใ้ฉ็จใใใใฎใใใใพใใ
+
+
+
+
+้ๅธธใจๅใใใใซๅๅฑๆงใซใขใฏใปในใงใใพใใใใฎๅฑๆงใใขใใซใใ่ฟใใใชใใฃใๅ ดๅใฏใ
+ใฏ `None`ใๅๅพใใพใใใใใงใใใจใใฐ`outputs.loss`ใฏใขใใซใซใใฃใฆ่จ็ฎใใใๆๅคฑใงใใใ`outputs.attentions`ใฏ
+`None`ใ
+
+`outputs`ใชใใธใงใฏใใใฟใใซใจใใฆ่ใใๅ ดๅใ`None`ๅคใๆใใชใๅฑๆงใฎใฟใ่ๆ
ฎใใใพใใ
+ใใจใใฐใใใใซใฏ 2 ใคใฎ่ฆ็ด ใ`loss`ใๆฌกใซ`logits`ใใใใพใใ
+
+```python
+outputs[:2]
+```
+
+ใใจใใฐใใฟใใซ `(outputs.loss, Outputs.logits)` ใ่ฟใใพใใ
+
+`outputs`ใชใใธใงใฏใใ่พๆธใจใใฆ่ๆ
ฎใใๅ ดๅใใNoneใใๆใใชใๅฑๆงใฎใฟใ่ๆ
ฎใใใพใใ
+ไพกๅค่ฆณใใใจใใฐใใใใซใฏ`loss` ใจ `logits`ใจใใ 2 ใคใฎใญใผใใใใพใใ
+
+ใใใงใฏใ่คๆฐใฎใขใใซ ใฟใคใใงไฝฟ็จใใใๆฑ็จใขใใซใฎๅบๅใๆๆธๅใใพใใๅ
ทไฝ็ใชๅบๅใฟใคใใฏๆฌกใฎใจใใใงใใ
+ๅฏพๅฟใใใขใใซใฎใใผใธใซ่จ่ผใใใฆใใพใใ
+
+## ModelOutput
+
+[[autodoc]] utils.ModelOutput
+ - to_tuple
+
+## BaseModelOutput
+
+[[autodoc]] modeling_outputs.BaseModelOutput
+
+## BaseModelOutputWithPooling
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPooling
+
+## BaseModelOutputWithCrossAttentions
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithCrossAttentions
+
+## BaseModelOutputWithPoolingAndCrossAttentions
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions
+
+## BaseModelOutputWithPast
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPast
+
+## BaseModelOutputWithPastAndCrossAttentions
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPastAndCrossAttentions
+
+## Seq2SeqModelOutput
+
+[[autodoc]] modeling_outputs.Seq2SeqModelOutput
+
+## CausalLMOutput
+
+[[autodoc]] modeling_outputs.CausalLMOutput
+
+## CausalLMOutputWithCrossAttentions
+
+[[autodoc]] modeling_outputs.CausalLMOutputWithCrossAttentions
+
+## CausalLMOutputWithPast
+
+[[autodoc]] modeling_outputs.CausalLMOutputWithPast
+
+## MaskedLMOutput
+
+[[autodoc]] modeling_outputs.MaskedLMOutput
+
+## Seq2SeqLMOutput
+
+[[autodoc]] modeling_outputs.Seq2SeqLMOutput
+
+## NextSentencePredictorOutput
+
+[[autodoc]] modeling_outputs.NextSentencePredictorOutput
+
+## SequenceClassifierOutput
+
+[[autodoc]] modeling_outputs.SequenceClassifierOutput
+
+## Seq2SeqSequenceClassifierOutput
+
+[[autodoc]] modeling_outputs.Seq2SeqSequenceClassifierOutput
+
+## MultipleChoiceModelOutput
+
+[[autodoc]] modeling_outputs.MultipleChoiceModelOutput
+
+## TokenClassifierOutput
+
+[[autodoc]] modeling_outputs.TokenClassifierOutput
+
+## QuestionAnsweringModelOutput
+
+[[autodoc]] modeling_outputs.QuestionAnsweringModelOutput
+
+## Seq2SeqQuestionAnsweringModelOutput
+
+[[autodoc]] modeling_outputs.Seq2SeqQuestionAnsweringModelOutput
+
+## Seq2SeqSpectrogramOutput
+
+[[autodoc]] modeling_outputs.Seq2SeqSpectrogramOutput
+
+## SemanticSegmenterOutput
+
+[[autodoc]] modeling_outputs.SemanticSegmenterOutput
+
+## ImageClassifierOutput
+
+[[autodoc]] modeling_outputs.ImageClassifierOutput
+
+## ImageClassifierOutputWithNoAttention
+
+[[autodoc]] modeling_outputs.ImageClassifierOutputWithNoAttention
+
+## DepthEstimatorOutput
+
+[[autodoc]] modeling_outputs.DepthEstimatorOutput
+
+## Wav2Vec2BaseModelOutput
+
+[[autodoc]] modeling_outputs.Wav2Vec2BaseModelOutput
+
+## XVectorOutput
+
+[[autodoc]] modeling_outputs.XVectorOutput
+
+## Seq2SeqTSModelOutput
+
+[[autodoc]] modeling_outputs.Seq2SeqTSModelOutput
+
+## Seq2SeqTSPredictionOutput
+
+[[autodoc]] modeling_outputs.Seq2SeqTSPredictionOutput
+
+## SampleTSPredictionOutput
+
+[[autodoc]] modeling_outputs.SampleTSPredictionOutput
+
+## TFBaseModelOutput
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutput
+
+## TFBaseModelOutputWithPooling
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPooling
+
+## TFBaseModelOutputWithPoolingAndCrossAttentions
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions
+
+## TFBaseModelOutputWithPast
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPast
+
+## TFBaseModelOutputWithPastAndCrossAttentions
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions
+
+## TFSeq2SeqModelOutput
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqModelOutput
+
+## TFCausalLMOutput
+
+[[autodoc]] modeling_tf_outputs.TFCausalLMOutput
+
+## TFCausalLMOutputWithCrossAttentions
+
+[[autodoc]] modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions
+
+## TFCausalLMOutputWithPast
+
+[[autodoc]] modeling_tf_outputs.TFCausalLMOutputWithPast
+
+## TFMaskedLMOutput
+
+[[autodoc]] modeling_tf_outputs.TFMaskedLMOutput
+
+## TFSeq2SeqLMOutput
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqLMOutput
+
+## TFNextSentencePredictorOutput
+
+[[autodoc]] modeling_tf_outputs.TFNextSentencePredictorOutput
+
+## TFSequenceClassifierOutput
+
+[[autodoc]] modeling_tf_outputs.TFSequenceClassifierOutput
+
+## TFSeq2SeqSequenceClassifierOutput
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqSequenceClassifierOutput
+
+## TFMultipleChoiceModelOutput
+
+[[autodoc]] modeling_tf_outputs.TFMultipleChoiceModelOutput
+
+## TFTokenClassifierOutput
+
+[[autodoc]] modeling_tf_outputs.TFTokenClassifierOutput
+
+## TFQuestionAnsweringModelOutput
+
+[[autodoc]] modeling_tf_outputs.TFQuestionAnsweringModelOutput
+
+## TFSeq2SeqQuestionAnsweringModelOutput
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqQuestionAnsweringModelOutput
+
+## FlaxBaseModelOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutput
+
+## FlaxBaseModelOutputWithPast
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutputWithPast
+
+## FlaxBaseModelOutputWithPooling
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutputWithPooling
+
+## FlaxBaseModelOutputWithPastAndCrossAttentions
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions
+
+## FlaxSeq2SeqModelOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqModelOutput
+
+## FlaxCausalLMOutputWithCrossAttentions
+
+[[autodoc]] modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions
+
+## FlaxMaskedLMOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxMaskedLMOutput
+
+## FlaxSeq2SeqLMOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqLMOutput
+
+## FlaxNextSentencePredictorOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxNextSentencePredictorOutput
+
+## FlaxSequenceClassifierOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxSequenceClassifierOutput
+
+## FlaxSeq2SeqSequenceClassifierOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqSequenceClassifierOutput
+
+## FlaxMultipleChoiceModelOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxMultipleChoiceModelOutput
+
+## FlaxTokenClassifierOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxTokenClassifierOutput
+
+## FlaxQuestionAnsweringModelOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxQuestionAnsweringModelOutput
+
+## FlaxSeq2SeqQuestionAnsweringModelOutput
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqQuestionAnsweringModelOutput
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/pipelines.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/pipelines.md
new file mode 100644
index 0000000000000000000000000000000000000000..3980becebbde36ed8cc224bcb721dd338ac079b0
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/pipelines.md
@@ -0,0 +1,498 @@
+
+
+# Pipelines
+
+ใใคใใฉใคใณใฏใๆจ่ซใซใขใใซใไฝฟใใใใฎ็ฐกๅใงๅชใใๆนๆณใงใใใใใคใใฉใคใณใฏใ่ค้ใชใณใผใใฎใปใจใใฉใๆฝ่ฑกๅใใใชใใธใงใฏใใงใใ
+ใใคใใฉใคใณใฏใใฉใคใใฉใชใใ่ค้ใชใณใผใใฎใปใจใใฉใๆฝ่ฑกๅใใใชใใธใงใฏใใงใๅๅไปใๅบๆ่กจ็พ่ช่ญใใในใฏ่จ่ชใขใใชใณใฐใๆๆ
ๅๆใ็นๅพดๆฝๅบใ่ณชๅๅฟ็ญใชใฉใฎใฟในใฏใซ็นๅใใใทใณใใซใชAPIใๆไพใใพใใ
+RecognitionใMasked Language ModelingใSentiment AnalysisใFeature ExtractionใQuestion Answeringใชใฉใฎใฟในใฏใซ็นๅใใใทใณใใซใชAPIใๆไพใใพใใไปฅไธใๅ็
งใฎใใจใ
+[ใฟในใฏๆฆ่ฆ](../task_summary)ใๅ็
งใใฆใใ ใใใ
+
+
+ใใคใใฉใคใณใฎๆฝ่ฑกๅใซใฏ2ใคใฎใซใใดใชใผใใใ๏ผ
+
+- [`pipeline`] ใฏใไปใฎใในใฆใฎใใคใใฉใคใณใใซใใปใซๅใใๆใๅผทๅใชใชใใธใงใฏใใงใใ
+- ใฟในใฏๅบๆใฎใใคใใฉใคใณใฏใ[ใชใผใใฃใช](#audio)ใ[ใณใณใใฅใผใฟใผ ใใธใงใณ](#computer-vision)ใ[่ช็ถ่จ่ชๅฆ็](#natural-language-processing)ใใใใณ [ใใซใใขใผใใซ](#multimodal) ใฟในใฏใงไฝฟ็จใงใใพใใ
+
+## The pipeline abstraction
+
+*ใใคใใฉใคใณ* ๆฝ่ฑกๅใฏใไปใฎใในใฆใฎๅฉ็จๅฏ่ฝใชใใคใใฉใคใณใฎใฉใใใผใงใใไปใฎใใฎใจๅๆงใซใคใณในใฟใณในๅใใใพใ
+ใใคใใฉใคใณใงใใใใใใชใ็ๆดปใฎ่ณชใๆไพใงใใพใใ
+
+1 ใคใฎ้
็ฎใซๅฏพใใๅ็ดใชๅผใณๅบใ:
+
+```python
+>>> pipe = pipeline("text-classification")
+>>> pipe("This restaurant is awesome")
+[{'label': 'POSITIVE', 'score': 0.9998743534088135}]
+```
+
+[ใใ](https://huggingface.co) ใฎ็นๅฎใฎใขใใซใไฝฟ็จใใใๅ ดๅใฏใใขใใซใใชใณใซใชใฃใฆใใๅ ดๅใฏใฟในใฏใ็ก่ฆใงใใพใใ
+ใใใฏใใงใซใใใๅฎ็พฉใใฆใใพใใ
+
+```python
+>>> pipe = pipeline(model="FacebookAI/roberta-large-mnli")
+>>> pipe("This restaurant is awesome")
+[{'label': 'NEUTRAL', 'score': 0.7313136458396912}]
+```
+
+ๅคใใฎ้
็ฎใซๅฏพใใฆใใคใใฉใคใณใๅผใณๅบใใซใฏใ*list* ใไฝฟ็จใใฆใใคใใฉใคใณใๅผใณๅบใใใจใใงใใพใใ
+
+```python
+>>> pipe = pipeline("text-classification")
+>>> pipe(["This restaurant is awesome", "This restaurant is awful"])
+[{'label': 'POSITIVE', 'score': 0.9998743534088135},
+ {'label': 'NEGATIVE', 'score': 0.9996669292449951}]
+```
+
+ๅฎๅ
จใชใใผใฟใปใใใๅๅพฉใใใซใฏใ`Dataset`ใ็ดๆฅไฝฟ็จใใใใจใใๅงใใใพใใใใใฏใๅฒใๅฝใฆใๅฟ
่ฆใใชใใใจใๆๅณใใพใ
+ใใผใฟใปใใๅ
จไฝใไธๅบฆใซๅฆ็ใใใใจใใ่ชๅใงใใใๅฆ็ใ่กใๅฟ
่ฆใใใใพใใใใใใฏใซในใฟใ ใซใผใใจๅใใใใ้ใๅไฝใใใฏใใงใใ
+GPUใใใใๅ้กใงใชใๅ ดๅใฏใใใใใใใซๅ้กใไฝๆใใฆใใ ใใใ
+
+```python
+import datasets
+from transformers import pipeline
+from transformers.pipelines.pt_utils import KeyDataset
+from tqdm.auto import tqdm
+
+pipe = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h", device=0)
+dataset = datasets.load_dataset("superb", name="asr", split="test")
+
+# KeyDataset (only *pt*) will simply return the item in the dict returned by the dataset item
+# as we're not interested in the *target* part of the dataset. For sentence pair use KeyPairDataset
+for out in tqdm(pipe(KeyDataset(dataset, "file"))):
+ print(out)
+ # {"text": "NUMBER TEN FRESH NELLY IS WAITING ON YOU GOOD NIGHT HUSBAND"}
+ # {"text": ....}
+ # ....
+```
+
+ไฝฟใใใใใใใใใซใใธใงใใฌใผใฟใผใไฝฟ็จใใใใจใใงใใพใใ
+
+```python
+from transformers import pipeline
+
+pipe = pipeline("text-classification")
+
+
+def data():
+ while True:
+ # This could come from a dataset, a database, a queue or HTTP request
+ # in a server
+ # Caveat: because this is iterative, you cannot use `num_workers > 1` variable
+ # to use multiple threads to preprocess data. You can still have 1 thread that
+ # does the preprocessing while the main runs the big inference
+ yield "This is a test"
+
+
+for out in pipe(data()):
+ print(out)
+ # {"text": "NUMBER TEN FRESH NELLY IS WAITING ON YOU GOOD NIGHT HUSBAND"}
+ # {"text": ....}
+ # ....
+```
+
+[[autodoc]] pipeline
+
+
+## Pipeline batching
+
+
+ใในใฆใฎใใคใใฉใคใณใงใใใๅฆ็ใไฝฟ็จใงใใพใใใใใฏใใพใใใใพใ
+ใใคใใฉใคใณใในใใชใผใใณใฐๆฉ่ฝใไฝฟ็จใใใจใใฏๅธธใซ (ใคใพใใใชในใใ`dataset`ใใพใใฏ `generator`ใๆธกใใจใ)ใ
+
+```python
+from transformers import pipeline
+from transformers.pipelines.pt_utils import KeyDataset
+import datasets
+
+dataset = datasets.load_dataset("imdb", name="plain_text", split="unsupervised")
+pipe = pipeline("text-classification", device=0)
+for out in pipe(KeyDataset(dataset, "text"), batch_size=8, truncation="only_first"):
+ print(out)
+ # [{'label': 'POSITIVE', 'score': 0.9998743534088135}]
+ # Exactly the same output as before, but the content are passed
+ # as batches to the model
+```
+
+
+
+
+ใใ ใใใใใซใใฃใฆใใใฉใผใใณในใ่ชๅ็ใซๅไธใใใใใงใฏใใใพใใใ็ถๆณใซๅฟใใฆใ10 ๅใฎ้ซ้ๅใพใใฏ 5 ๅใฎไฝ้ๅใฎใใใใใซใชใใพใใ
+ใใผใใฆใงใขใใใผใฟใไฝฟ็จใใใฆใใๅฎ้ใฎใขใใซใซใคใใฆใ
+
+ไธปใซ้ซ้ๅใงใใไพ:
+
+
+
+
+```python
+from transformers import pipeline
+from torch.utils.data import Dataset
+from tqdm.auto import tqdm
+
+pipe = pipeline("text-classification", device=0)
+
+
+class MyDataset(Dataset):
+ def __len__(self):
+ return 5000
+
+ def __getitem__(self, i):
+ return "This is a test"
+
+
+dataset = MyDataset()
+
+for batch_size in [1, 8, 64, 256]:
+ print("-" * 30)
+ print(f"Streaming batch_size={batch_size}")
+ for out in tqdm(pipe(dataset, batch_size=batch_size), total=len(dataset)):
+ pass
+```
+
+```
+# On GTX 970
+------------------------------
+Streaming no batching
+100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 5000/5000 [00:26<00:00, 187.52it/s]
+------------------------------
+Streaming batch_size=8
+100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 5000/5000 [00:04<00:00, 1205.95it/s]
+------------------------------
+Streaming batch_size=64
+100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 5000/5000 [00:02<00:00, 2478.24it/s]
+------------------------------
+Streaming batch_size=256
+100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 5000/5000 [00:01<00:00, 2554.43it/s]
+(diminishing returns, saturated the GPU)
+```
+
+ๆใ้ๅบฆใไฝไธใใไพ:
+
+
+```python
+class MyDataset(Dataset):
+ def __len__(self):
+ return 5000
+
+ def __getitem__(self, i):
+ if i % 64 == 0:
+ n = 100
+ else:
+ n = 1
+ return "This is a test" * n
+```
+
+ใใใฏใไปใฎๆใซๆฏในใฆ้ๅธธใซ้ทใๆใๆๆใใใพใใใใฎๅ ดๅใ**ๅ
จไฝ**ใฎใใใใฏ 400 ใงใใๅฟ
่ฆใใใใพใใ
+ใใผใฏใณใ้ทใใใใใใใๅ
จไฝใ [64, 4] ใงใฏใชใ [64, 400] ใซใชใใ้ๅบฆใๅคงๅน
ใซไฝไธใใพใใใใใซๆชใใใจใซใ
+ใใใใๅคงใใใชใใจใใใญใฐใฉใ ใฏๅ็ดใซใฏใฉใใทใฅใใพใใ
+
+```
+------------------------------
+Streaming no batching
+100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 1000/1000 [00:05<00:00, 183.69it/s]
+------------------------------
+Streaming batch_size=8
+100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 1000/1000 [00:03<00:00, 265.74it/s]
+------------------------------
+Streaming batch_size=64
+100%|โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ| 1000/1000 [00:26<00:00, 37.80it/s]
+------------------------------
+Streaming batch_size=256
+ 0%| | 0/1000 [00:00, ?it/s]
+Traceback (most recent call last):
+ File "/home/nicolas/src/transformers/test.py", line 42, in
+ for out in tqdm(pipe(dataset, batch_size=256), total=len(dataset)):
+....
+ q = q / math.sqrt(dim_per_head) # (bs, n_heads, q_length, dim_per_head)
+RuntimeError: CUDA out of memory. Tried to allocate 376.00 MiB (GPU 0; 3.95 GiB total capacity; 1.72 GiB already allocated; 354.88 MiB free; 2.46 GiB reserved in total by PyTorch)
+```
+
+ใใฎๅ้กใซๅฏพใใ้ฉๅใช (ไธ่ฌ็ใช) ่งฃๆฑบ็ญใฏใชใใไฝฟ็จใงใใ่ท้ขใฏใฆใผในใฑใผในใซใใฃใฆ็ฐใชใๅ ดๅใใใใพใใใฎใซใผใซ
+่ฆชๆ๏ผ
+
+ใฆใผใถใผใซใจใฃใฆใฎ็ต้จๅใฏๆฌกใฎใจใใใงใใ
+
+- **ใใผใใฆใงใขใไฝฟ็จใใฆใ่ฒ ่ทใซๅฏพใใใใใฉใผใใณในใๆธฌๅฎใใพใใๆธฌใฃใฆใๆธฌใฃใฆใๆธฌใ็ถใใใๅฎๆฐใจใใใฎใฏใ
+ ้ฒใในใๅฏไธใฎๆนๆณใ**
+- ใฌใคใใณใทใซๅถ็ดใใใๅ ดๅ (ๅฎ้ใฎ่ฃฝๅใๆจ่ซใๅฎ่กใใฆใใๅ ดๅ)ใใใใๅฆ็ใ่กใใชใใงใใ ใใใ
+- CPU ใไฝฟ็จใใฆใใๅ ดๅใฏใใใใๅฆ็ใ่กใใชใใงใใ ใใใ
+- GPU ใงในใซใผใใใใไฝฟ็จใใฆใใๅ ดๅ (ๅคง้ใฎ้็ใใผใฟใงใขใใซใๅฎ่กใใใๅ ดๅ)ใๆฌกใฎใใใซใใพใใ
+
+ - sequence_length (ใ่ช็ถใชใใใผใฟ) ใฎใตใคใบใซใคใใฆใพใฃใใใใใใชใๅ ดๅใฏใใใใฉใซใใงใฏใใใๅฆ็ใๆธฌๅฎใ่กใใใ
+ ๆซๅฎ็ใซ่ฟฝๅ ใใฆใฟใพใใๅคฑๆใใๅ ดๅใซๅๅพฉใใใใใซ OOM ใใงใใฏใ่ฟฝๅ ใใพใ (ๅคฑๆใใๅ ดๅใฏใใใๆ็นใงๅๅพฉใใพใ)ใ
+ sequence_length ใๅถๅพกใใพใใ)
+ - sequence_length ใ้ๅธธใซ่ฆๅ็ใงใใๅ ดๅใใใใๅฆ็ใฏ้ๅธธใซ่ๅณๆทฑใใใฎใจใชใๅฏ่ฝๆงใ้ซใใๆธฌๅฎใใฆใใใทใฅใใฆใใ ใใใ
+ OOM ใ็บ็ใใใพใง็ถใใพใใ
+ - GPU ใๅคงใใใปใฉใใใใๅฆ็ใใใ่ๅณๆทฑใใใฎใซใชใๅฏ่ฝๆงใ้ซใใชใใพใใ
+- ใใใๅฆ็ใๆๅนใซใใใใใใซใOOM ใ้ฉๅใซๅฆ็ใงใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+
+## Pipeline chunk batching
+
+`zero-shot-classification` ใจ `question-answering` ใฏใๅไธใฎๅ
ฅๅใง็ตๆใๅพใใใๅฏ่ฝๆงใใใใจใใๆๅณใงใๅฐใ็นๆฎใงใใ
+ใขใใซใฎ่คๆฐใฎๅๆนใในใ้ๅธธใฎ็ถๆณใงใฏใใใใซใใ `batch_size` ๅผๆฐใซ้ขใใๅ้กใ็บ็ใใพใใ
+
+ใใฎๅ้กใๅ้ฟใใใใใซใใใใใฎใใคใใฉใคใณใฏใฉใกใใๅฐใ็นๆฎใซใชใฃใฆใใใไปฃใใใซ `ChunkPipeline` ใซใชใฃใฆใใพใใ
+้ๅธธใฎ `Pipeline`ใ่ฆใใใซ๏ผ
+
+```python
+preprocessed = pipe.preprocess(inputs)
+model_outputs = pipe.forward(preprocessed)
+outputs = pipe.postprocess(model_outputs)
+```
+
+ไปใฏๆฌกใฎใใใซใชใใพใ:
+
+```python
+all_model_outputs = []
+for preprocessed in pipe.preprocess(inputs):
+ model_outputs = pipe.forward(preprocessed)
+ all_model_outputs.append(model_outputs)
+outputs = pipe.postprocess(all_model_outputs)
+```
+
+ใใคใใฉใคใณใฏไปฅไธใงไฝฟ็จใใใใใใใใใฏใณใผใใซๅฏพใใฆ้ๅธธใซ้้็ใงใใๅฟ
่ฆใใใใพใใ
+ๅใๆนๆณใ
+
+ใใคใใฉใคใณใฏใใใใ่ชๅ็ใซๅฆ็ใงใใใใใใใใฏ็ฐก็ฅๅใใใใใฅใผใงใใๆฐใซใใๅฟ
่ฆใฏใชใใจใใๆๅณใงใ
+ๅ
ฅๅใๅฎ้ใซใใชใฌใผใใๅๆนใในใฎๆฐใซใคใใฆใฏใ`batch_size` ใๆ้ฉๅใงใใพใใ
+ๅ
ฅๅใจใฏ็ฌ็ซใใฆใๅใฎใปใฏใทใงใณใฎๆณจๆไบ้
ใๅผใ็ถใ้ฉ็จใใใพใใ
+
+## Pipeline custom code
+
+็นๅฎใฎใใคใใฉใคใณใใชใผใใผใฉใคใใใๅ ดๅใ
+
+็ฎใฎๅใฎใฟในใฏใซ้ขใใๅ้กใไฝๆใใใใจใ่บ่บใใชใใงใใ ใใใใใคใใฉใคใณใฎ็ฎๆจใฏใไฝฟใใใใใใปใจใใฉใฎใฆใผใถใผใใตใใผใใใใใจใงใใ
+ใใใใฃใฆใ`transformers`ใใใชใใฎใฆใผในใฑใผในใใตใใผใใใๅฏ่ฝๆงใใใใพใใ
+
+
+ๅ็ดใซ่ฉฆใใฆใฟใใๅ ดๅใฏใๆฌกใฎใใจใใงใใพใใ
+
+- ้ธๆใใใใคใใฉใคใณใใตใใฏใฉในๅใใพใ
+
+```python
+class MyPipeline(TextClassificationPipeline):
+ def postprocess():
+ # Your code goes here
+ scores = scores * 100
+ # And here
+
+
+my_pipeline = MyPipeline(model=model, tokenizer=tokenizer, ...)
+# or if you use *pipeline* function, then:
+my_pipeline = pipeline(model="xxxx", pipeline_class=MyPipeline)
+```
+
+ใใใซใใใๅฟ
่ฆใชใซในใฟใ ใณใผใใใในใฆๅฎ่กใงใใใใใซใชใใพใใ
+
+## Implementing a pipeline
+
+[Implementing a new pipeline](../add_new_pipeline)
+
+## Audio
+
+ใชใผใใฃใช ใฟในใฏใซไฝฟ็จใงใใใใคใใฉใคใณใซใฏๆฌกใฎใใฎใใใใพใใ
+
+### AudioClassificationPipeline
+
+[[autodoc]] AudioClassificationPipeline
+ - __call__
+ - all
+
+### AutomaticSpeechRecognitionPipeline
+
+[[autodoc]] AutomaticSpeechRecognitionPipeline
+ - __call__
+ - all
+
+### TextToAudioPipeline
+
+[[autodoc]] TextToAudioPipeline
+ - __call__
+ - all
+
+
+### ZeroShotAudioClassificationPipeline
+
+[[autodoc]] ZeroShotAudioClassificationPipeline
+ - __call__
+ - all
+
+## Computer vision
+
+ใณใณใใฅใผใฟใผ ใใธใงใณ ใฟในใฏใซไฝฟ็จใงใใใใคใใฉใคใณใซใฏๆฌกใฎใใฎใใใใพใใ
+
+### DepthEstimationPipeline
+[[autodoc]] DepthEstimationPipeline
+ - __call__
+ - all
+
+### ImageClassificationPipeline
+
+[[autodoc]] ImageClassificationPipeline
+ - __call__
+ - all
+
+### ImageSegmentationPipeline
+
+[[autodoc]] ImageSegmentationPipeline
+ - __call__
+ - all
+
+### ImageToImagePipeline
+
+[[autodoc]] ImageToImagePipeline
+ - __call__
+ - all
+
+### ObjectDetectionPipeline
+
+[[autodoc]] ObjectDetectionPipeline
+ - __call__
+ - all
+
+### VideoClassificationPipeline
+
+[[autodoc]] VideoClassificationPipeline
+ - __call__
+ - all
+
+### ZeroShotImageClassificationPipeline
+
+[[autodoc]] ZeroShotImageClassificationPipeline
+ - __call__
+ - all
+
+### ZeroShotObjectDetectionPipeline
+
+[[autodoc]] ZeroShotObjectDetectionPipeline
+ - __call__
+ - all
+
+## Natural Language Processing
+
+่ช็ถ่จ่ชๅฆ็ใฟในใฏใซไฝฟ็จใงใใใใคใใฉใคใณใซใฏๆฌกใฎใใฎใใใใพใใ
+
+### FillMaskPipeline
+
+[[autodoc]] FillMaskPipeline
+ - __call__
+ - all
+
+### NerPipeline
+
+[[autodoc]] NerPipeline
+
+่ฉณ็ดฐใซใคใใฆใฏใ[`TokenClassificationPipeline`] ใๅ็
งใใฆใใ ใใใ
+
+### QuestionAnsweringPipeline
+
+[[autodoc]] QuestionAnsweringPipeline
+ - __call__
+ - all
+
+### SummarizationPipeline
+
+[[autodoc]] SummarizationPipeline
+ - __call__
+ - all
+
+### TableQuestionAnsweringPipeline
+
+[[autodoc]] TableQuestionAnsweringPipeline
+ - __call__
+
+### TextClassificationPipeline
+
+[[autodoc]] TextClassificationPipeline
+ - __call__
+ - all
+
+### TextGenerationPipeline
+
+[[autodoc]] TextGenerationPipeline
+ - __call__
+ - all
+
+### Text2TextGenerationPipeline
+
+[[autodoc]] Text2TextGenerationPipeline
+ - __call__
+ - all
+
+### TokenClassificationPipeline
+
+[[autodoc]] TokenClassificationPipeline
+ - __call__
+ - all
+
+### TranslationPipeline
+
+[[autodoc]] TranslationPipeline
+ - __call__
+ - all
+
+### ZeroShotClassificationPipeline
+
+[[autodoc]] ZeroShotClassificationPipeline
+ - __call__
+ - all
+
+## Multimodal
+
+ใใซใใขใผใใซ ใฟในใฏใซไฝฟ็จใงใใใใคใใฉใคใณใซใฏๆฌกใฎใใฎใใใใพใใ
+
+### DocumentQuestionAnsweringPipeline
+
+[[autodoc]] DocumentQuestionAnsweringPipeline
+ - __call__
+ - all
+
+### FeatureExtractionPipeline
+
+[[autodoc]] FeatureExtractionPipeline
+ - __call__
+ - all
+
+### ImageFeatureExtractionPipeline
+
+[[autodoc]] ImageFeatureExtractionPipeline
+ - __call__
+ - all
+
+### ImageToTextPipeline
+
+[[autodoc]] ImageToTextPipeline
+ - __call__
+ - all
+
+### ImageTextToTextPipeline
+
+[[autodoc]] ImageTextToTextPipeline
+ - __call__
+ - all
+
+### VisualQuestionAnsweringPipeline
+
+[[autodoc]] VisualQuestionAnsweringPipeline
+ - __call__
+ - all
+
+## Parent class: `Pipeline`
+
+[[autodoc]] Pipeline
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/processors.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/processors.md
new file mode 100644
index 0000000000000000000000000000000000000000..63b94af6ea43f3df9b932f56d20995bd734edb0f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/processors.md
@@ -0,0 +1,160 @@
+
+
+# Processors
+
+Transformers ใฉใคใใฉใชใงใฏใใใญใปใใตใฏ 2 ใคใฎ็ฐใชใๆๅณใๆใกใพใใ
+- [Wav2Vec2](../model_doc/wav2vec2) ใชใฉใฎใใซใใขใผใใซ ใขใใซใฎๅ
ฅๅใๅๅฆ็ใใใชใใธใงใฏใ (้ณๅฃฐใจใใญในใ)
+ ใพใใฏ [CLIP](../model_doc/clip) (ใใญในใใจใใธใงใณ)
+- ๅคใใใผใธใงใณใฎใฉใคใใฉใชใง GLUE ใพใใฏ SQUAD ใฎใใผใฟใๅๅฆ็ใใใใใซไฝฟ็จใใใฆใใใชใใธใงใฏใใฏ้ๆจๅฅจใซใชใใพใใใ
+
+## Multi-modal processors
+
+ใใซใใขใผใใซ ใขใใซใงใฏใใชใใธใงใฏใใ่คๆฐใฎใขใใชใใฃ (ใใญในใใ
+่ฆ่ฆใจ้ณๅฃฐ๏ผใใใใฏใ2 ใคไปฅไธใฎๅฆ็ใชใใธใงใฏใใใฐใซใผใๅใใใใญใปใใตใผใจๅผใฐใใใชใใธใงใฏใใซใใฃใฆๅฆ็ใใใพใใ
+ใใผใฏใใคใถใผ (ใใญในใ ใขใใชใใฃ็จ)ใ็ปๅใใญใปใใตใผ (่ฆ่ฆ็จ)ใ็นๅพดๆฝๅบๅจ (ใชใผใใฃใช็จ) ใชใฉใ
+
+ใใใใฎใใญใปใใตใฏใไฟๅญใใใณใญใผใๆฉ่ฝใๅฎ่ฃ
ใใๆฌกใฎๅบๆฌใฏใฉในใ็ถๆฟใใพใใ
+
+[[autodoc]] ProcessorMixin
+
+## Deprecated processors
+
+ใในใฆใฎใใญใปใใตใฏใๅใใขใผใญใใฏใใฃใซๅพใฃใฆใใพใใ
+[`~data.processors.utils.DataProcessor`]ใใใญใปใใตใฏๆฌกใฎใชในใใ่ฟใใพใใ
+[`~data.processors.utils.InputExample`]ใใใใ
+[`~data.processors.utils.InputExample`] ใฏๆฌกใฎใใใซๅคๆใงใใพใใ
+[`~data.processors.utils.Input features`] ใใขใใซใซใใฃใผใใใพใใ
+
+[[autodoc]] data.processors.utils.DataProcessor
+
+[[autodoc]] data.processors.utils.InputExample
+
+[[autodoc]] data.processors.utils.InputFeatures
+
+## GLUE
+
+[ไธ่ฌ่จ่ช็่งฃ่ฉไพก (GLUE)](https://gluebenchmark.com/) ใฏใ
+ๆขๅญใฎ NLU ใฟในใฏใฎๅคๆงใชใปใใใซใใใใขใใซใฎใใใฉใผใใณในใ็ดใจๅๆ็บๅฃฒใใใ [GLUE: A
+่ช็ถ่จ่ช็่งฃใฎใใใฎใใซใใฟในใฏใใณใใใผใฏใใใณๅๆใใฉใใใใฉใผใ ](https://openreview.net/pdf?id=rJ4km2R5t7)
+
+ใใฎใฉใคใใฉใชใฏใMRPCใMNLIใMNLI (ไธไธ่ด)ใCoLAใSST2ใSTSBใ
+QQPใQNLIใRTEใWNLIใ
+
+ใใใใฎใใญใปใใตใฏๆฌกใฎใจใใใงใใ
+
+- [`~data.processors.utils.MrpcProcessor`]
+- [`~data.processors.utils.MnliProcessor`]
+- [`~data.processors.utils.MnliMismatchedProcessor`]
+- [`~data.processors.utils.Sst2Processor`]
+- [`~data.processors.utils.StsbProcessor`]
+- [`~data.processors.utils.QqpProcessor`]
+- [`~data.processors.utils.QnliProcessor`]
+- [`~data.processors.utils.RteProcessor`]
+- [`~data.processors.utils.WnliProcessor`]
+
+
+ใใใซใๆฌกใฎใกใฝใใใไฝฟ็จใใฆใใใผใฟ ใใกใคใซใใๅคใใญใผใใใใใใใใชในใใซๅคๆใใใใจใใงใใพใใ
+[`~data.processors.utils.InputExample`]ใ
+
+[[autodoc]] data.processors.glue.glue_convert_examples_to_features
+
+## XNLI
+
+[ใฏใญในใชใณใฌใซ NLI ใณใผใใน (XNLI)](https://www.nyu.edu/projects/bowman/xnli/) ใฏใ
+่จ่ชใ่ถ
ใใใใญในใ่กจ็พใฎๅ่ณชใ XNLI ใฏใ[*MultiNLI*](http://www.nyu.edu/projects/bowman/multinli/) ใซๅบใฅใใฏใฉใฆใใฝใผในใฎใใผใฟใปใใใงใใใใญในใใฎใใขใซใฏใ15 ๅใฎใใญในใๅซๆใขใใใผใทใงใณใใฉใใซไปใใใใฆใใพใใ
+ใใพใใพใช่จ่ช (่ฑ่ชใชใฉใฎ้ซใชใฝใผใน่จ่ชใจในใฏใใช่ชใชใฉใฎไฝใชใฝใผใน่จ่ชใฎไธกๆนใๅซใ)ใ
+
+่ซๆ [XNLI: Evaluating Cross-lingual Sentence Representations](https://arxiv.org/abs/1809.05053) ใจๅๆใซใชใชใผในใใใพใใใ
+
+ใใฎใฉใคใใฉใชใฏใXNLI ใใผใฟใใญใผใใใใใญใปใใตใใในใใใพใใ
+
+- [`~data.processors.utils.XnliProcessor`]
+
+ใในใใปใใใซใฏใดใผใซใใฉใใซใไปใใฆใใใใใ่ฉไพกใฏใในใใปใใใง่กใใใพใใฎใงใไบๆฟใใ ใใใ
+
+ใใใใฎใใญใปใใตใไฝฟ็จใใไพใฏใ[run_xnli.py](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification/run_xnli.py) ในใฏใชใใใซ็คบใใใฆใใพใใ
+
+## SQuAD
+
+[The Stanford Question Answering Dataset (SQuAD)](https://rajpurkar.github.io/SQuAD-explorer//) ใฏใๆฌกใฎใใณใใใผใฏใงใใ
+่ณชๅๅฟ็ญใซ้ขใใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใพใใ v1.1 ใจ v2.0 ใฎ 2 ใคใฎใใผใธใงใณใๅฉ็จๅฏ่ฝใงใใๆๅใฎใใผใธใงใณ
+(v1.1) ใฏใ่ซๆ [SQuAD: 100,000+ question for Machine Comprehension of Text](https://arxiv.org/abs/1606.05250) ใจใจใใซใชใชใผในใใใพใใใ 2 ็ช็ฎใฎใใผใธใงใณ (v2.0) ใฏใ่ซๆ [Know What You Don't ใจๅๆใซใชใชใผในใใใพใใใ
+็ฅใฃใฆใใในใ: SQuAD ใฎ็ญใใใใชใ่ณชๅ](https://arxiv.org/abs/1806.03822)ใ
+
+ใใฎใฉใคใใฉใชใฏใๆฌกใฎ 2 ใคใฎใใผใธใงใณใฎใใใใใฎใใญใปใใตใใในใใใพใใ
+
+### Processors
+
+ใใใใฎใใญใปใใตใฏๆฌกใฎใจใใใงใใ
+
+- [`~data.processors.utils.SquadV1Processor`]
+- [`~data.processors.utils.SquadV2Processor`]
+
+ใฉใกใใๆฝ่ฑกใฏใฉใน [`~data.processors.utils.SquadProcessor`] ใ็ถๆฟใใฆใใพใใ
+
+[[autodoc]] data.processors.squad.SquadProcessor
+ - all
+
+ใใใซใๆฌกใฎใกใฝใใใไฝฟ็จใใฆใSQuAD ใฎไพใๆฌกใฎๅฝขๅผใซๅคๆใงใใพใใ
+ใขใใซใฎๅ
ฅๅใจใใฆไฝฟ็จใงใใ [`~data.processors.utils.SquadFeatures`]ใ
+
+[[autodoc]] data.processors.squad.squad_convert_examples_to_features
+
+ใใใใฎใใญใปใใตใจๅ่ฟฐใฎๆนๆณใฏใใใผใฟใๅซใใใกใคใซใ ใใงใชใใ
+*tensorflow_datasets* ใใใฑใผใธใไปฅไธใซไพใ็คบใใพใใ
+
+### Example usage
+
+ไปฅไธใซใใญใปใใตใไฝฟ็จใใไพใจใใใผใฟ ใใกใคใซใไฝฟ็จใใๅคๆๆนๆณใ็คบใใพใใ
+
+```python
+# Loading a V2 processor
+processor = SquadV2Processor()
+examples = processor.get_dev_examples(squad_v2_data_dir)
+
+# Loading a V1 processor
+processor = SquadV1Processor()
+examples = processor.get_dev_examples(squad_v1_data_dir)
+
+features = squad_convert_examples_to_features(
+ examples=examples,
+ tokenizer=tokenizer,
+ max_seq_length=max_seq_length,
+ doc_stride=args.doc_stride,
+ max_query_length=max_query_length,
+ is_training=not evaluate,
+)
+```
+
+*tensorflow_datasets* ใฎไฝฟ็จใฏใใใผใฟ ใใกใคใซใไฝฟ็จใใใฎใจๅใใใใ็ฐกๅใงใใ
+
+```python
+# tensorflow_datasets only handle Squad V1.
+tfds_examples = tfds.load("squad")
+examples = SquadV1Processor().get_examples_from_dataset(tfds_examples, evaluate=evaluate)
+
+features = squad_convert_examples_to_features(
+ examples=examples,
+ tokenizer=tokenizer,
+ max_seq_length=max_seq_length,
+ doc_stride=args.doc_stride,
+ max_query_length=max_query_length,
+ is_training=not evaluate,
+)
+```
+
+ใใใใฎใใญใปใใตใไฝฟ็จใใๅฅใฎไพใฏใ[run_squad.py](https://github.com/huggingface/transformers/tree/main/examples/legacy/question-answering/run_squad.py) ในใฏใชใใใซ็คบใใใฆใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/quantization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/quantization.md
new file mode 100644
index 0000000000000000000000000000000000000000..a93d06b257459e0fa441e9149084997331ca2241
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/quantization.md
@@ -0,0 +1,447 @@
+
+
+# Quantize ๐ค Transformers models
+
+## `AutoGPTQ` Integration
+
+
+๐ค Transformers ใซใฏใ่จ่ชใขใใซใง GPTQ ้ๅญๅใๅฎ่กใใใใใฎ `optimum` API ใ็ตฑๅใใใฆใใพใใใใใฉใผใใณในใๅคงๅน
ใซไฝไธใใใใใจใชใใๆจ่ซ้ๅบฆใ้ซ้ๅใใใใจใชใใใขใใซใ 8ใ4ใ3ใใใใซใฏ 2 ใใใใงใญใผใใใใณ้ๅญๅใงใใพใใใใใฏใใปใจใใฉใฎ GPU ใใผใใฆใงใขใงใตใใผใใใใฆใใพใใ
+
+้ๅญๅใขใใซใฎ่ฉณ็ดฐใซใคใใฆใฏใไปฅไธใ็ขบ่ชใใฆใใ ใใใ
+- [GPTQ](https://arxiv.org/pdf/2210.17323.pdf) ่ซๆ
+- GPTQ ้ๅญๅใซ้ขใใ `optimum` [ใฌใคใ](https://huggingface.co/docs/optimum/llm_quantization/usage_guides/quantization)
+- ใใใฏใจใณใใจใใฆไฝฟ็จใใใ [`AutoGPTQ`](https://github.com/PanQiWei/AutoGPTQ) ใฉใคใใฉใช
+
+### Requirements
+
+ไปฅไธใฎใณใผใใๅฎ่กใใใซใฏใไปฅไธใฎ่ฆไปถใใคใณในใใผใซใใใฆใใๅฟ
่ฆใใใใพใ๏ผ
+
+- ๆๆฐใฎ `AutoGPTQ` ใฉใคใใฉใชใใคใณในใใผใซใใใ
+`pip install auto-gptq` ใใคใณในใใผใซใใใ
+
+- ๆๆฐใฎ `optimum` ใใฝใผในใใใคใณในใใผใซใใใ
+`git+https://github.com/huggingface/optimum.git` ใใคใณในใใผใซใใใ
+
+- ๆๆฐใฎ `transformers` ใใฝใผในใใใคใณในใใผใซใใใ
+ๆๆฐใฎ `transformers` ใใฝใผในใใใคใณในใใผใซใใ `pip install git+https://github.com/huggingface/transformers.git`
+
+- ๆๆฐใฎ `accelerate` ใฉใคใใฉใชใใคใณในใใผใซใใใ
+`pip install --upgrade accelerate` ใๅฎ่กใใใ
+
+GPTQ็ตฑๅใฏไปใฎใจใใใใญในใใขใใซใฎใฟใใตใใผใใใฆใใใฎใงใ่ฆ่ฆใ้ณๅฃฐใใใซใใขใผใใซใขใใซใงใฏไบๆใใฌๆๅใซ้ญ้ใใใใใใใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+### Load and quantize a model
+
+GPTQ ใฏใ้ๅญๅใขใใซใไฝฟ็จใใๅใซ้ใฟใฎใญใฃใชใใฌใผใทใงใณใๅฟ
่ฆใจใใ้ๅญๅๆนๆณใงใใใใฉใณในใใฉใผใใผ ใขใใซใๆๅใใ้ๅญๅใใๅ ดๅใฏใ้ๅญๅใขใใซใไฝๆใใใพใงใซๆ้ใใใใใใจใใใใพใ (`facebook/opt-350m`ใขใใซใฎ Google colab ใงใฏ็ด 5 ๅ)ใ
+
+ใใใใฃใฆใGPTQ ้ๅญๅใขใใซใไฝฟ็จใใใทใใชใชใฏ 2 ใคใใใพใใๆๅใฎไฝฟ็จไพใฏใใใใงๅฉ็จๅฏ่ฝใชไปใฎใฆใผใถใผใซใใฃใฆใใงใซ้ๅญๅใใใใขใใซใใญใผใใใใใจใงใใ2 ็ช็ฎใฎไฝฟ็จไพใฏใใขใใซใๆๅใใ้ๅญๅใใไฟๅญใใใใใใซใใใทใฅใใฆใไปใฎใฆใผใถใผใไฝฟ็จใงใใใใใซใใใใจใงใใใใใไฝฟใฃใฆใใ ใใใ
+
+#### GPTQ Configuration
+
+ใขใใซใใญใผใใใฆ้ๅญๅใใใซใฏใ[`GPTQConfig`] ใไฝๆใใๅฟ
่ฆใใใใพใใใใผใฟใปใใใๆบๅใใใซใฏใ`bits`ใฎๆฐใ้ๅญๅใ่ชฟๆดใใใใใฎ`dataset`ใใใใณใขใใซใฎ`Tokenizer`ใๆธกใๅฟ
่ฆใใใใพใใ
+
+```python
+model_id = "facebook/opt-125m"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+gptq_config = GPTQConfig(bits=4, dataset = "c4", tokenizer=tokenizer)
+```
+
+็ฌ่ชใฎใใผใฟใปใใใๆๅญๅใฎใชในใใจใใฆๆธกใใใจใใงใใใใจใซๆณจๆใใฆใใ ใใใใใ ใใGPTQ ่ซๆใฎใใผใฟใปใใใไฝฟ็จใใใใจใๅผทใใๅงใใใพใใ
+
+```python
+dataset = ["auto-gptq is an easy-to-use model quantization library with user-friendly apis, based on GPTQ algorithm."]
+quantization = GPTQConfig(bits=4, dataset = dataset, tokenizer=tokenizer)
+```
+
+#### Quantization
+
+`from_pretrained` ใไฝฟ็จใใ`quantization_config` ใ่จญๅฎใใใใจใงใขใใซใ้ๅญๅใงใใพใใ
+
+```python
+from transformers import AutoModelForCausalLM
+model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=gptq_config)
+```
+
+ใขใใซใ้ๅญๅใใใซใฏ GPU ใๅฟ
่ฆใงใใใใจใซๆณจๆใใฆใใ ใใใใขใใซใ CPU ใซ้
็ฝฎใใ้ๅญๅใใใใใซใขใธใฅใผใซใ GPU ใซๅๅพใซ็งปๅใใใพใใ
+
+CPU ใชใใญใผใใฎไฝฟ็จไธญใซ GPU ใฎไฝฟ็จ้ใๆๅคงๅใใใๅ ดๅใฏใ`device_map = "auto"` ใ่จญๅฎใงใใพใใ
+
+```python
+from transformers import AutoModelForCausalLM
+model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", quantization_config=gptq_config)
+```
+
+ใใฃในใฏ ใชใใญใผใใฏใตใใผใใใใฆใใชใใใจใซๆณจๆใใฆใใ ใใใใใใซใใใผใฟใปใใใๅๅ ใงใกใขใชใไธ่ถณใใฆใใๅ ดๅใฏใ`from_pretained` ใง `max_memory` ใๆธกใๅฟ
่ฆใใใๅ ดๅใใใใพใใ `device_map`ใจ`max_memory`ใฎ่ฉณ็ดฐใซใคใใฆใฏใใใฎ [ใฌใคใ](https://huggingface.co/docs/accelerate/usage_guides/big_modeling#designing-a-device-map) ใๅ็
งใใฆใใ ใใใ
+
+
+GPTQ ้ๅญๅใฏใ็พๆ็นใงใฏใใญในใ ใขใใซใงใฎใฟๆฉ่ฝใใพใใใใใซใ้ๅญๅใใญใปในใฏใใผใใฆใงใขใซใใฃใฆใฏ้ทๆ้ใใใๅ ดๅใใใใพใ (NVIDIA A100 ใไฝฟ็จใใๅ ดๅใ175B ใขใใซ = 4 gpu ๆ้)ใใขใใซใฎ GPTQ ้ๅญๅใใผใธใงใณใๅญๅจใใชใๅ ดๅใฏใใใใง็ขบ่ชใใฆใใ ใใใใใใงใชใๅ ดๅใฏใgithub ใง่ฆๆฑใ้ไฟกใงใใพใใ
+
+
+### Push quantized model to ๐ค Hub
+
+ไปใฎ ๐ค ใขใใซใจๅๆงใซใ`push_to_hub` ใไฝฟ็จใใฆ้ๅญๅใขใใซใใใใซใใใทใฅใงใใพใใ้ๅญๅๆงๆใฏไฟๅญใใใใขใใซใซๆฒฟใฃใฆใใใทใฅใใใพใใ
+
+```python
+quantized_model.push_to_hub("opt-125m-gptq")
+tokenizer.push_to_hub("opt-125m-gptq")
+```
+
+้ๅญๅใใใใขใใซใใญใผใซใซ ใใทใณใซไฟๅญใใใๅ ดๅใฏใ`save_pretrained` ใไฝฟ็จใใฆ่กใใใจใใงใใพใใ
+
+
+```python
+quantized_model.save_pretrained("opt-125m-gptq")
+tokenizer.save_pretrained("opt-125m-gptq")
+```
+
+`device_map` ใไฝฟ็จใใฆใขใใซใ้ๅญๅใใๅ ดๅใฏใไฟๅญใใๅใซใขใใซๅ
จไฝใ GPU ใพใใฏ `cpu` ใฎใใใใใซ็งปๅใใฆใใ ใใใ
+
+```python
+quantized_model.to("cpu")
+quantized_model.save_pretrained("opt-125m-gptq")
+```
+
+### Load a quantized model from the ๐ค Hub
+
+`from_pretrained`ใไฝฟ็จใใฆใ้ๅญๅใใใใขใใซใใใใใใญใผใใงใใพใใ
+ๅฑๆง `quantization_config` ใใขใใซ่จญๅฎใชใใธใงใฏใใซๅญๅจใใใใจใ็ขบ่ชใใฆใใใใทใฅใใใ้ใฟใ้ๅญๅใใใฆใใใใจใ็ขบ่ชใใพใใ
+
+```python
+from transformers import AutoModelForCausalLM
+model = AutoModelForCausalLM.from_pretrained("{your_username}/opt-125m-gptq")
+```
+
+ๅฟ
่ฆไปฅไธใฎใกใขใชใๅฒใๅฝใฆใใซใขใใซใใใ้ใใญใผใใใใๅ ดๅใฏใ`device_map` ๅผๆฐใฏ้ๅญๅใขใใซใงใๆฉ่ฝใใพใใ `accelerate`ใฉใคใใฉใชใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```python
+from transformers import AutoModelForCausalLM
+model = AutoModelForCausalLM.from_pretrained("{your_username}/opt-125m-gptq", device_map="auto")
+```
+
+### Exllama kernels for faster inference
+
+4 ใใใ ใขใใซใฎๅ ดๅใๆจ่ซ้ๅบฆใ้ซใใใใใซ exllama ใซใผใใซใไฝฟ็จใงใใพใใใใใฉใซใใงๆๅนใซใชใฃใฆใใพใใ [`GPTQConfig`] ใง `disable_exllama` ใๆธกใใใจใงใใใฎๅไฝใๅคๆดใงใใพใใใใใซใใใ่จญๅฎใซไฟๅญใใใฆใใ้ๅญๅ่จญๅฎใไธๆธใใใใพใใใซใผใใซใซ้ข้ฃใใๅฑๆงใฎใฟใไธๆธใใงใใใใจใซๆณจๆใใฆใใ ใใใใใใซใexllama ใซใผใใซใไฝฟ็จใใใๅ ดๅใฏใใขใใซๅ
จไฝใ GPU ไธใซ็ฝฎใๅฟ
่ฆใใใใพใใ
+
+
+```py
+import torch
+gptq_config = GPTQConfig(bits=4, disable_exllama=False)
+model = AutoModelForCausalLM.from_pretrained("{your_username}/opt-125m-gptq", device_map="auto", quantization_config = gptq_config)
+```
+
+็พๆ็นใงใฏ 4 ใใใ ใขใใซใฎใฟใใตใใผใใใใฆใใใใจใซๆณจๆใใฆใใ ใใใใใใซใpeft ใไฝฟ็จใใฆ้ๅญๅใขใใซใๅพฎ่ชฟๆดใใฆใใๅ ดๅใฏใexllama ใซใผใใซใ้ใขใฏใใฃใๅใใใใจใใๅงใใใพใใ
+
+#### Fine-tune a quantized model
+
+Hugging Face ใจใณใทในใใ ใฎใขใใใฟใผใฎๅ
ฌๅผใตใใผใใซใใใGPTQ ใง้ๅญๅใใใใขใใซใๅพฎ่ชฟๆดใงใใพใใ
+่ฉณ็ดฐใซใคใใฆใฏใ[`peft`](https://github.com/huggingface/peft) ใฉใคใใฉใชใใ่ฆงใใ ใใใ
+
+### Example demo
+
+GPTQ ใไฝฟ็จใใฆใขใใซใ้ๅญๅใใๆนๆณใจใpeft ใไฝฟ็จใใฆ้ๅญๅใใใใขใใซใๅพฎ่ชฟๆดใใๆนๆณใซใคใใฆใฏใGoogle Colab [ใใผใใใใฏ](https://colab.research.google.com/drive/1_TIrmuKOFhuRRiTWN94iLKUFu6ZX4ceb?usp=sharing) ใๅ็
งใใฆใใ ใใใ
+
+### GPTQConfig
+
+[[autodoc]] GPTQConfig
+
+## `bitsandbytes` Integration
+
+๐ค Transformers ใฏใ`bitsandbytes` ใงๆใใใไฝฟ็จใใใใขใธใฅใผใซใจ็ทๅฏใซ็ตฑๅใใใฆใใพใใๆฐ่กใฎใณใผใใงใขใใซใ 8 ใใใ็ฒพๅบฆใงใญใผใใงใใพใใ
+ใใใฏใ`bitsandbytes`ใฎ `0.37.0`ใชใชใผในไปฅ้ใใปใจใใฉใฎ GPU ใใผใใฆใงใขใงใตใใผใใใใฆใใพใใ
+
+้ๅญๅๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใ[LLM.int8()](https://arxiv.org/abs/2208.07339) ่ซๆใใพใใฏ [ใใญใฐๆ็จฟ](https://huggingface.co/blog/hf-bitsandbytes-) ใใ่ฆงใใ ใใใ็ตฑๅ๏ผใณใฉใใฌใผใทใงใณใซใคใใฆใ
+
+`0.39.0`ใชใชใผในไปฅ้ใFP4 ใใผใฟๅใๆดป็จใใ4 ใใใ้ๅญๅใไฝฟ็จใใฆ`device_map`ใใตใใผใใใไปปๆใฎใขใใซใใญใผใใงใใพใใ
+
+็ฌ่ชใฎ pytorch ใขใใซใ้ๅญๅใใใๅ ดๅใฏใ๐ค Accelerate ใฉใคใใฉใชใฎ [ใใญใฅใกใณใ](https://huggingface.co/docs/accelerate/main/en/usage_guides/quantization) ใใใงใใฏใใฆใใ ใใใ
+
+`bitsandbytes`็ตฑๅใไฝฟ็จใใฆใงใใใใจใฏๆฌกใฎใจใใใงใ
+
+### General usage
+
+ใขใใซใ ๐ค Accelerate ใซใใ่ชญใฟ่พผใฟใใตใใผใใใ`torch.nn.Linear` ใฌใคใคใผใๅซใพใใฆใใ้ใใ [`~PreTrainedModel.from_pretrained`] ใกใฝใใใๅผใณๅบใใจใใซ `load_in_8bit` ใพใใฏ `load_in_4bit` ๅผๆฐใไฝฟ็จใใฆใขใใซใ้ๅญๅใงใใพใใใใใฏใฉใฎใใใชใขใใชใใฃใงใๅๆงใซๆฉ่ฝใใใฏใใงใใ
+
+```python
+from transformers import AutoModelForCausalLM
+
+model_8bit = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", load_in_8bit=True)
+model_4bit = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", load_in_4bit=True)
+```
+
+ใใใฉใซใใงใฏใไปใฎใในใฆใฎใขใธใฅใผใซ (ไพ: `torch.nn.LayerNorm`) ใฏ `torch.float16` ใซๅคๆใใใพใใใใใฎ `dtype` ใๅคๆดใใใๅ ดๅใฏใ`torch_dtype` ๅผๆฐใไธๆธใใงใใพใใ
+
+```python
+>>> import torch
+>>> from transformers import AutoModelForCausalLM
+
+>>> model_8bit = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", load_in_8bit=True, torch_dtype=torch.float32)
+>>> model_8bit.model.decoder.layers[-1].final_layer_norm.weight.dtype
+torch.float32
+```
+
+### FP4 quantization
+
+#### Requirements
+
+ไปฅไธใฎใณใผใ ในใใใใใๅฎ่กใใๅใซใไปฅไธใฎ่ฆไปถใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+- ๆๆฐใฎ`bitsandbytes`ใฉใคใใฉใช
+`pip install bitsandbytes>=0.39.0`
+
+- ๆๆฐใฎ`accelerate`ใใคใณในใใผใซใใ
+`pip install --upgrade accelerate`
+
+- ๆๆฐใฎ `transformers` ใใคใณในใใผใซใใ
+`pip install --upgrade transformers`
+
+#### Tips and best practices
+
+- **้ซๅบฆใชไฝฟ็จๆณ:** ๅฏ่ฝใชใในใฆใฎใชใใทใงใณใไฝฟ็จใใ 4 ใใใ้ๅญๅใฎ้ซๅบฆใชไฝฟ็จๆณใซใคใใฆใฏใ[ใใฎ Google Colab ใใผใใใใฏ](https://colab.research.google.com/drive/1ge2F1QSK8Q7h0hn3YKuBCOAS0bK8E0wf) ใๅ็
งใใฆใใ ใใใ
+
+- **`batch_size=1` ใซใใ้ซ้ๆจ่ซ :** bitsandbytes ใฎ `0.40.0` ใชใชใผในไปฅ้ใ`batch_size=1` ใงใฏ้ซ้ๆจ่ซใฎๆฉๆตใๅใใใใจใใงใใพใใ [ใใใใฎใชใชใผใน ใใผใ](https://github.com/TimDettmers/bitsandbytes/releases/tag/0.40.0) ใ็ขบ่ชใใใใฎๆฉ่ฝใๆดป็จใใใซใฏ`0.40.0`ไปฅ้ใฎใใผใธใงใณใไฝฟ็จใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ็ฎฑใฎใ
+
+- **ใใฌใผใใณใฐ:** [QLoRA ่ซๆ](https://arxiv.org/abs/2305.14314) ใซใใใจใ4 ใใใๅบๆฌใขใใซใใใฌใผใใณใฐใใๅ ดๅ (ไพ: LoRA ใขใใใฟใผใไฝฟ็จ)ใ`bnb_4bit_quant_type='nf4'` ใไฝฟ็จใใๅฟ
่ฆใใใใพใใ ใ
+
+- **ๆจ่ซ:** ๆจ่ซใฎๅ ดๅใ`bnb_4bit_quant_type` ใฏใใใฉใผใใณในใซๅคงใใชๅฝฑ้ฟใไธใใพใใใใใ ใใใขใใซใฎ้ใฟใจใฎไธ่ฒซๆงใไฟใคใใใซใๅฟ
ใๅใ `bnb_4bit_compute_dtype` ใใใณ `torch_dtype` ๅผๆฐใไฝฟ็จใใฆใใ ใใใ
+
+
+#### Load a large model in 4bit
+
+`.from_pretrained` ใกใฝใใใๅผใณๅบใใจใใซ `load_in_4bit=True` ใไฝฟ็จใใใจใใกใขใชไฝฟ็จ้ใ (ใใใใ) 4 ใงๅฒใใใจใใงใใพใใ
+
+```python
+# pip install transformers accelerate bitsandbytes
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model_id = "bigscience/bloom-1b7"
+
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", load_in_4bit=True)
+```
+
+
+
+ใขใใซใ 4 ใใใใงใญใผใใใใใจใ็พๆ็นใงใฏ้ๅญๅใใใ้ใฟใใใใซใใใทใฅใใใใจใฏใงใใชใใใจใซๆณจๆใใฆใใ ใใใ 4 ใใใใฎ้ใฟใฏใพใ ใตใใผใใใใฆใใชใใใใใใฌใผใใณใฐใงใใชใใใจใซใๆณจๆใใฆใใ ใใใใใ ใใ4 ใใใ ใขใใซใไฝฟ็จใใฆ่ฟฝๅ ใฎใใฉใกใผใฟใผใใใฌใผใใณใฐใใใใจใใงใใพใใใใใซใคใใฆใฏๆฌกใฎใปใฏใทใงใณใง่ชฌๆใใพใใ
+
+
+
+### Load a large model in 8bit
+
+`.from_pretrained` ใกใฝใใใๅผใณๅบใใจใใซ `load_in_8bit=True` ๅผๆฐใไฝฟ็จใใใจใใกใขใช่ฆไปถใใใใๅๅใซใใฆใขใใซใใญใผใใงใใพใใ
+
+```python
+# pip install transformers accelerate bitsandbytes
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model_id = "bigscience/bloom-1b7"
+
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+
+ๆฌกใซใ้ๅธธ [`PreTrainedModel`] ใไฝฟ็จใใใฎใจๅใใใใซใขใใซใไฝฟ็จใใพใใ
+
+`get_memory_footprint` ใกใฝใใใไฝฟ็จใใฆใใขใใซใฎใกใขใช ใใใใใชใณใใ็ขบ่ชใงใใพใใ
+
+```python
+print(model.get_memory_footprint())
+```
+
+ใใฎ็ตฑๅใซใใใๅคงใใชใขใใซใๅฐใใชใใใคในใซใญใผใใใๅ้กใชใๅฎ่กใงใใใใใซใชใใพใใใ
+
+
+ใขใใซใ 8 ใใใใงใญใผใใใใใจใๆๆฐใฎ `transformers`ใจ`bitsandbytes`ใไฝฟ็จใใๅ ดๅใ้คใใ้ๅญๅใใใ้ใฟใใใใซใใใทใฅใใใใจใฏ็พๅจไธๅฏ่ฝใงใใใใจใซๆณจๆใใฆใใ ใใใ 8 ใใใใฎ้ใฟใฏใพใ ใตใใผใใใใฆใใชใใใใใใฌใผใใณใฐใงใใชใใใจใซใๆณจๆใใฆใใ ใใใใใ ใใ8 ใใใ ใขใใซใไฝฟ็จใใฆ่ฟฝๅ ใฎใใฉใกใผใฟใผใใใฌใผใใณใฐใใใใจใใงใใพใใใใใซใคใใฆใฏๆฌกใฎใปใฏใทใงใณใง่ชฌๆใใพใใ
+ใพใใ`device_map` ใฏใชใใทใงใณใงใใใๅฉ็จๅฏ่ฝใชใชใฝใผในไธใงใขใใซใๅน็็ใซใใฃในใใใใใใใใๆจ่ซใซใฏ `device_map = 'auto'` ใ่จญๅฎใใใใจใๆจๅฅจใใใพใใ
+
+
+
+#### Advanced use cases
+
+ใใใงใฏใFP4 ้ๅญๅใไฝฟ็จใใฆๅฎ่กใงใใใใใคใใฎ้ซๅบฆใชไฝฟ็จไพใซใคใใฆ่ชฌๆใใพใใ
+
+##### Change the compute dtype
+
+compute dtype ใฏใ่จ็ฎไธญใซไฝฟ็จใใใ dtype ใๅคๆดใใใใใซไฝฟ็จใใใพใใใใจใใฐใ้ ใ็ถๆ
ใฏ`float32`ใซใใใพใใใ้ซ้ๅใฎใใใซ่จ็ฎใ bf16 ใซ่จญๅฎใงใใพใใใใใฉใซใใงใฏใcompute dtype ใฏ `float32` ใซ่จญๅฎใใใพใใ
+
+```python
+import torch
+from transformers import BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16)
+```
+
+##### Using NF4 (Normal Float 4) data type
+
+NF4 ใใผใฟๅใไฝฟ็จใใใใจใใงใใพใใใใใฏใๆญฃ่ฆๅๅธใไฝฟ็จใใฆๅๆๅใใใ้ใฟใซ้ฉๅใใๆฐใใ 4 ใใใ ใใผใฟๅใงใใใใฎๅฎ่กใฎใใใซ:
+
+```python
+from transformers import BitsAndBytesConfig
+
+nf4_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_quant_type="nf4",
+)
+
+model_nf4 = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=nf4_config)
+```
+
+##### Use nested quantization for more memory efficient inference
+
+ใพใใใในใใใใ้ๅญๅๆๆณใไฝฟ็จใใใใจใใๅงใใใพใใใใใซใใใใใใฉใผใใณในใ่ฟฝๅ ใใใใจใชใใใใๅคใใฎใกใขใชใ็ฏ็ดใใใพใใ็ต้จ็ใช่ฆณๅฏใใใใใใซใใใNVIDIA-T4 16GB ไธใงใทใผใฑใณใน้ท 1024ใใใใ ใตใคใบ 1ใๅพ้
็ดฏ็ฉในใใใ 4 ใฎ llama-13b ใขใใซใๅพฎ่ชฟๆดใใใใจใๅฏ่ฝใซใชใใพใใ
+
+```python
+from transformers import BitsAndBytesConfig
+
+double_quant_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_use_double_quant=True,
+)
+
+model_double_quant = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=double_quant_config)
+```
+
+
+### Push quantized models on the ๐ค Hub
+
+`push_to_hub`ใกใฝใใใๅ็ดใซไฝฟ็จใใใใจใงใ้ๅญๅใใใใขใใซใใใใซใใใทใฅใงใใพใใใใใซใใใๆๅใซ้ๅญๅๆงๆใใกใคใซใใใใทใฅใใใๆฌกใซ้ๅญๅใใใใขใใซใฎ้ใฟใใใใทใฅใใใพใใ
+ใใฎๆฉ่ฝใไฝฟ็จใงใใใใใซใใใซใฏใๅฟ
ใ `bitsandbytes>0.37.2` ใไฝฟ็จใใฆใใ ใใ (ใใฎ่จไบใฎๅท็ญๆ็นใงใฏใ`bitsandbytes==0.38.0.post1` ใงใในใใใพใใ)ใ
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model = AutoModelForCausalLM.from_pretrained("bigscience/bloom-560m", quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+tokenizer = AutoTokenizer.from_pretrained("bigscience/bloom-560m")
+
+model.push_to_hub("bloom-560m-8bit")
+```
+
+
+
+ๅคง่ฆๆจกใชใขใใซใงใฏใใใไธใง 8 ใใใ ใขใใซใใใใทใฅใใใใจใๅผทใๆจๅฅจใใใพใใใใใซใใใใณใใฅใใใฃใฏใกใขใช ใใใใใชใณใใฎๅๆธใจใใใจใใฐ Google Colab ใงใฎๅคง่ฆๆจกใชใขใใซใฎ่ชญใฟ่พผใฟใซใใๆฉๆตใๅใใใใจใใงใใพใใ
+
+
+
+### Load a quantized model from the ๐ค Hub
+
+`from_pretrained`ใกใฝใใใไฝฟ็จใใฆใใใใใ้ๅญๅใขใใซใใญใผใใงใใพใใๅฑๆง `quantization_config` ใใขใใซ่จญๅฎใชใใธใงใฏใใซๅญๅจใใใใจใ็ขบ่ชใใฆใใใใทใฅใใใ้ใฟใ้ๅญๅใใใฆใใใใจใ็ขบ่ชใใพใใ
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model = AutoModelForCausalLM.from_pretrained("{your_username}/bloom-560m-8bit", device_map="auto")
+```
+
+ใใฎๅ ดๅใๅผๆฐ `load_in_8bit=True` ใๆๅฎใใๅฟ
่ฆใฏใใใพใใใใ`bitsandbytes` ใจ `accelerate` ใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใใจใซๆณจๆใใฆใใ ใใใ
+ใพใใ`device_map` ใฏใชใใทใงใณใงใใใๅฉ็จๅฏ่ฝใชใชใฝใผในไธใงใขใใซใๅน็็ใซใใฃในใใใใใใใใๆจ่ซใซใฏ `device_map = 'auto'` ใ่จญๅฎใใใใจใๆจๅฅจใใใพใใ
+
+### Advanced use cases
+
+ใใฎใปใฏใทใงใณใฏใ8 ใใใ ใขใใซใฎใญใผใใจๅฎ่กไปฅๅคใซไฝใใงใใใใๆขๆฑใใใไธ็ดใฆใผใถใผใๅฏพ่ฑกใจใใฆใใพใใ
+
+#### Offload between `cpu` and `gpu`
+
+ใใฎ้ซๅบฆใชไฝฟ็จไพใฎ 1 ใคใฏใใขใใซใใญใผใใใ`CPU`ใจ`GPU`ใฎ้ใง้ใฟใใใฃในใใใใงใใใใจใงใใ CPU ไธใงใใฃในใใใใใใ้ใฟใฏ **8 ใใใใซๅคๆใใใชใ**ใใใ`float32`ใซไฟๆใใใใใจใซๆณจๆใใฆใใ ใใใใใฎๆฉ่ฝใฏใ้ๅธธใซๅคง่ฆๆจกใชใขใใซใ้ฉๅใใใใใฎใขใใซใ GPU ใจ CPU ใฎ้ใงใใฃในใใใใใใใฆใผใถใผใๅฏพ่ฑกใจใใฆใใพใใ
+
+ใพใใ`transformers` ใใ [`BitsAndBytesConfig`] ใใญใผใใใๅฑๆง `llm_int8_enable_fp32_cpu_offload` ใ `True` ใซ่จญๅฎใใพใใ
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(llm_int8_enable_fp32_cpu_offload=True)
+```
+
+`bigscience/bloom-1b7`ใขใใซใใญใผใใใๅฟ
่ฆใใใใ`lm_head`ใ้คใใขใใซๅ
จไฝใซโโ้ฉๅใใใฎใซๅๅใช GPU RAM ใใใใจใใพใใใใใใฃใฆใๆฌกใฎใใใซใซในใฟใ device_map ใไฝๆใใพใใ
+
+```python
+device_map = {
+ "transformer.word_embeddings": 0,
+ "transformer.word_embeddings_layernorm": 0,
+ "lm_head": "cpu",
+ "transformer.h": 0,
+ "transformer.ln_f": 0,
+}
+```
+
+ใใใฆใๆฌกใฎใใใซใขใใซใใญใผใใใพใใ
+```python
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ "bigscience/bloom-1b7",
+ device_map=device_map,
+ quantization_config=quantization_config,
+)
+```
+
+ไปฅไธใงใ๏ผใขใใซใๆฅฝใใใงใใ ใใ๏ผ
+
+#### Play with `llm_int8_threshold`
+
+`llm_int8_threshold` ๅผๆฐใๆไฝใใฆใๅคใๅคใฎใใใๅคใๅคๆดใงใใพใใ ๅคใๅค ใจใฏใ็นๅฎใฎใใใๅคใใๅคงใใ้ ใใ็ถๆ
ใฎๅคใงใใ
+ใใใฏใ`LLM.int8()`่ซๆใง่ชฌๆใใใฆใใๅคใๅคๆคๅบใฎๅคใๅคใใใๅคใซๅฏพๅฟใใพใใใใฎใใใๅคใ่ถ
ใใ้ ใ็ถๆ
ใฎๅคใฏๅคใๅคใจใฟใชใใใใใใใฎๅคใซๅฏพใใๆไฝใฏ fp16 ใงๅฎ่กใใใพใใ้ๅธธใๅคใฏๆญฃ่ฆๅๅธใใพใใใคใพใใใปใจใใฉใฎๅคใฏ [-3.5, 3.5] ใฎ็ฏๅฒๅ
ใซใใใพใใใๅคง่ฆๆจกใชใขใใซใงใฏๅคงใใ็ฐใชใๅๅธใ็คบใไพๅค็ใช็ณป็ตฑ็ๅคใๅคใใใใคใใใใพใใใใใใฎๅคใๅคใฏใๅคใใฎๅ ดๅ [-60, -6] ใพใใฏ [6, 60] ใฎ็ฏๅฒๅ
ใซใใใพใใ Int8 ้ๅญๅใฏใๅคงใใใ 5 ็จๅบฆใพใงใฎๅคใงใฏใใพใๆฉ่ฝใใพใใใใใใ่ถ
ใใใจใใใใฉใผใใณในใๅคงๅน
ใซไฝไธใใพใใ้ฉๅใชใใใฉใซใใฎใใใๅคใฏ 6 ใงใใใใใไธๅฎๅฎใชใขใใซ (ๅฐ่ฆๆจกใชใขใใซใๅพฎ่ชฟๆด) ใงใฏใใใไฝใใใใๅคใๅฟ
่ฆใซใชใๅ ดๅใใใใพใใ
+ใใฎๅผๆฐใฏใใขใใซใฎๆจ่ซ้ๅบฆใซๅฝฑ้ฟใไธใใๅฏ่ฝๆงใใใใพใใใใฎใใฉใกใผใฟใ่ฉฆใใฆใฟใฆใใฆใผในใฑใผในใซๆ้ฉใชใใฉใกใผใฟใ่ฆใคใใใใจใใๅงใใใพใใ
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model_id = "bigscience/bloom-1b7"
+
+quantization_config = BitsAndBytesConfig(
+ llm_int8_threshold=10,
+)
+
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ device_map=device_map,
+ quantization_config=quantization_config,
+)
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+```
+
+#### Skip the conversion of some modules
+
+ไธ้จใฎใขใใซใซใฏใๅฎๅฎๆงใ็ขบไฟใใใใใซ 8 ใใใใซๅคๆใใๅฟ
่ฆใใชใใขใธใฅใผใซใใใใคใใใใพใใใใจใใฐใใธใฅใผใฏใใใฏใน ใขใใซใซใฏใในใญใใใใๅฟ
่ฆใใใใใใคใใฎ `lm_head` ใขใธใฅใผใซใใใใพใใ `llm_int8_skip_modules` ใง้ใใงใฟใ
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model_id = "bigscience/bloom-1b7"
+
+quantization_config = BitsAndBytesConfig(
+ llm_int8_skip_modules=["lm_head"],
+)
+
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ device_map=device_map,
+ quantization_config=quantization_config,
+)
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+```
+
+#### Fine-tune a model that has been loaded in 8-bit
+
+Hugging Face ใจใณใทในใใ ใฎใขใใใฟใผใฎๅ
ฌๅผใตใใผใใซใใใ8 ใใใใงใญใผใใใใใขใใซใๅพฎ่ชฟๆดใงใใพใใ
+ใใใซใใใๅไธใฎ Google Colab ใง`flan-t5-large`ใ`facebook/opt-6.7b`ใชใฉใฎๅคง่ฆๆจกใขใใซใๅพฎ่ชฟๆดใใใใจใใงใใพใใ่ฉณ็ดฐใซใคใใฆใฏใ[`peft`](https://github.com/huggingface/peft) ใฉใคใใฉใชใใ่ฆงใใ ใใใ
+
+ใใฌใผใใณใฐ็จใฎใขใใซใใญใผใใใใจใใซ `device_map` ใๆธกใๅฟ
่ฆใใชใใใจใซๆณจๆใใฆใใ ใใใใขใใซใ GPU ใซ่ชๅ็ใซใญใผใใใใพใใๅฟ
่ฆใซๅฟใใฆใใใใคใน ใใใใ็นๅฎใฎใใใคในใซ่จญๅฎใใใใจใใงใใพใ (ไพ: `cuda:0`ใ`0`ใ`torch.device('cuda:0')`)ใ `device_map=auto`ใฏๆจ่ซใฎใฟใซไฝฟ็จใใๅฟ
่ฆใใใใใจใซๆณจๆใใฆใใ ใใใ
+
+### BitsAndBytesConfig
+
+[[autodoc]] BitsAndBytesConfig
+
+## Quantization with ๐ค `optimum`
+
+`optimum`ใงใตใใผใใใใฆใใ้ๅญๅๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Optimum ใใญใฅใกใณใ](https://huggingface.co/docs/optimum/index) ใๅ็
งใใใใใใ่ชๅใฎใฆใผในใฑใผในใซ้ฉ็จใงใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/text_generation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/text_generation.md
new file mode 100644
index 0000000000000000000000000000000000000000..18477d97e626d1df942604f4c806cc17268744b2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/text_generation.md
@@ -0,0 +1,56 @@
+
+
+# Generation
+
+ๅใใฌใผใ ใฏใผใฏใซใฏใใใใใใฎ `GenerationMixin` ใฏใฉในใซๅฎ่ฃ
ใใใใใญในใ็ๆใฎใใใฎ Generate ใกใฝใใใใใใพใใ
+
+- PyTorch [`~generation.GenerationMixin.generate`] ใฏ [`~generation.GenerationMixin`] ใซๅฎ่ฃ
ใใใฆใใพใใ
+- TensorFlow [`~generation.TFGenerationMixin.generate`] ใฏ [`~generation.TFGenerationMixin`] ใซๅฎ่ฃ
ใใใฆใใพใใ
+- Flax/JAX [`~generation.FlaxGenerationMixin.generate`] ใฏ [`~generation.FlaxGenerationMixin`] ใซๅฎ่ฃ
ใใใฆใใพใใ
+
+้ธๆใใใใฌใผใ ใฏใผใฏใซ้ขไฟใชใใ[`~generation.GenerationConfig`] ใไฝฟ็จใใฆ็ๆใกใฝใใใใใฉใกใผใฟๅใงใใพใใ
+ใฏใฉในใคใณในใฟใณในใๅไฝใๅถๅพกใใ็ๆใใฉใกใผใฟใฎๅฎๅ
จใชใชในใใซใคใใฆใฏใใใฎใฏใฉในใๅ็
งใใฆใใ ใใใ
+็ๆๆนๆณใฎใใจใ
+
+ใขใใซใฎ็ๆๆงๆใๆคๆปใใๆนๆณใใใใฉใซใใจใฏไฝใใใใฉใกใผใฟใผใใขใใใใฏใซๅคๆดใใๆนๆณใๅญฆ็ฟใใใซใฏใ
+ใซในใฟใใคใบใใใ็ๆๆงๆใไฝๆใใฆไฟๅญใใๆนๆณใซใคใใฆใฏใใ
+[ใใญในใ็ๆๆฆ็ฅใฌใคใ](../generation_strategies)ใใใฎใฌใคใใงใฏใ้ข้ฃๆฉ่ฝใฎไฝฟ็จๆนๆณใซใคใใฆใ่ชฌๆใใฆใใพใใ
+ใใผใฏใณในใใชใผใใณใฐใฎใใใชใ
+
+## GenerationConfig
+
+[[autodoc]] generation.GenerationConfig
+ - from_pretrained
+ - from_model_config
+ - save_pretrained
+
+## GenerationMixin
+
+[[autodoc]] generation.GenerationMixin
+ - generate
+ - compute_transition_scores
+
+## TFGenerationMixin
+
+[[autodoc]] generation.TFGenerationMixin
+ - generate
+ - compute_transition_scores
+
+## FlaxGenerationMixin
+
+[[autodoc]] generation.FlaxGenerationMixin
+ - generate
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/tokenizer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/tokenizer.md
new file mode 100644
index 0000000000000000000000000000000000000000..1cf5885bc81286d4f09dad8cca4ef1ff2e76347a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/tokenizer.md
@@ -0,0 +1,80 @@
+
+
+# Tokenizer
+
+ใใผใฏใใคใถใผใฏใใขใใซใฎๅ
ฅๅใฎๆบๅใๆ
ๅฝใใพใใใฉใคใใฉใชใซใฏใใในใฆใฎใขใใซใฎใใผใฏใใคใถใผใๅซใพใใฆใใพใใใปใจใใฉ
+ใใผใฏใใคใถใผใฎไธ้จใฏใๅฎๅ
จใช Python ๅฎ่ฃ
ใจใ
+Rust ใฉใคใใฉใช [๐ค Tokenizers](https://github.com/huggingface/tokenizers)ใ ใ้ซ้ใๅฎ่ฃ
ใงใฏๆฌกใฎใใจใๅฏ่ฝใซใชใใพใใ
+
+1. ็นใซใใใใใผใฏใณๅใ่กใๅ ดๅใฎๅคงๅน
ใชในใใผใใขใใใจ
+2. ๅ
ใฎๆๅญๅ (ๆๅญใจๅ่ช) ใจใใผใฏใณ็ฉบ้ใฎ้ใงใใใใณใฐใใ่ฟฝๅ ใฎใกใฝใใ (ไพ:
+ ็นๅฎใฎๆๅญใๅซใใใผใฏใณใฎใคใณใใใฏในใใพใใฏ็นๅฎใฎใใผใฏใณใซๅฏพๅฟใใๆๅญใฎ็ฏๅฒ๏ผใ
+
+ๅบๆฌใฏใฉใน [`PreTrainedTokenizer`] ใใใณ [`PreTrainedTokenizerFast`]
+ใขใใซๅ
ฅๅใฎๆๅญๅๅ
ฅๅใใจใณใณใผใใ (ไปฅไธใๅ็
ง)ใPython ใใคใณในใฟใณในๅ/ไฟๅญใใใใใฎไธ่ฌ็ใชใกใฝใใใๅฎ่ฃ
ใใพใใ
+ใญใผใซใซ ใใกใคใซใพใใฏใใฃใฌใฏใใชใใพใใฏใฉใคใใฉใชใซใใฃใฆๆไพใใใไบๅใใฌใผใใณใฐๆธใฟใใผใฏใใคใถใผใใใฎใ้ซ้ใใใผใฏใใคใถใผ
+(HuggingFace ใฎ AWS S3 ใชใใธใใชใใใใฆใณใญใผใ)ใไบไบบใจใ้ ผใใซใใฆใใใฎใฏใ
+ๅ
ฑ้ใกใฝใใใๅซใ [`~tokenization_utils_base.PreTrainedTokenizerBase`]
+[`~tokenization_utils_base.SpecialTokensMixin`]ใ
+
+ใใใใฃใฆใ[`PreTrainedTokenizer`] ใจ [`PreTrainedTokenizerFast`] ใฏใกใคใณใๅฎ่ฃ
ใใพใใ
+ใในใฆใฎใใผใฏใใคใถใผใไฝฟ็จใใใใใฎใกใฝใใ:
+
+- ใใผใฏใณๅ (ๆๅญๅใใตใใฏใผใ ใใผใฏใณๆๅญๅใซๅๅฒ)ใใใผใฏใณๆๅญๅใ ID ใซๅคๆใใใใใใฎ้ใฎๅคๆใ่กใฃใใใใพใใ
+ ใจใณใณใผใ/ใใณใผใ (ใคใพใใใใผใฏใณๅใจๆดๆฐใธใฎๅคๆ)ใ
+- ๅบ็คใจใชใๆง้ (BPEใSentencePiece...) ใใ็ฌ็ซใใๆนๆณใงใ่ชๅฝใซๆฐใใใใผใฏใณใ่ฟฝๅ ใใพใใ
+- ็นๅฅใชใใผใฏใณ (ใในใฏใๆใฎๅงใพใใชใฉ) ใฎ็ฎก็: ใใผใฏใณใฎ่ฟฝๅ ใๅฑๆงใธใฎๅฒใๅฝใฆใ
+ ใใผใฏใใคใถใผใซใใใ็ฐกๅใซใขใฏใปในใงใใใใผใฏใณๅไธญใซๅๅฒใใใชใใใใซใใใใจใใงใใพใใ
+
+[`BatchEncoding`] ใฏใ
+[`~tokenization_utils_base.PreTrainedTokenizerBase`] ใฎใจใณใณใผใ ใกใฝใใ (`__call__`ใ
+`encode_plus` ใใใณ `batch_encode_plus`) ใงใใใPython ่พๆธใใๆดพ็ใใฆใใพใใใใผใฏใใคใถใผใ็ด็ฒใช Python ใฎๅ ดๅ
+tokenizer ใฎๅ ดๅใใใฎใฏใฉในใฏๆจๆบใฎ Python ่พๆธใจๅใใใใซๅไฝใใใซใใฃใฆ่จ็ฎใใใใใพใใพใชใขใใซๅ
ฅๅใไฟๆใใพใใ
+ใใใใฎใกใฝใใ (`input_ids`ใ`attention_mask`...)ใใใผใฏใใคใถใผใใ้ซ้ใใใผใฏใใคใถใผใงใใๅ ดๅ (ใคใพใใ
+HuggingFace [ใใผใฏใใคใถใผ ใฉใคใใฉใช](https://github.com/huggingface/tokenizers))ใใใฎใฏใฉในใฏใใใซๆไพใใพใ
+ๅ
ใฎๆๅญๅ (ๆๅญใจๅ่ช) ใจ
+ใใผใฏใณในใใผใน (ไพ: ๆๅฎใใใๆๅญใพใใฏๅฏพๅฟใใๆๅญใฎ็ฏๅฒใๆงๆใใใใผใฏใณใฎใคใณใใใฏในใฎๅๅพ)
+ไธใใใใใใผใฏใณใซ๏ผใ
+
+## PreTrainedTokenizer
+
+[[autodoc]] PreTrainedTokenizer
+ - __call__
+ - apply_chat_template
+ - batch_decode
+ - decode
+ - encode
+ - push_to_hub
+ - all
+
+## PreTrainedTokenizerFast
+
+[`PreTrainedTokenizerFast`] ใฏ [tokenizers](https://huggingface.co/docs/tokenizers) ใฉใคใใฉใชใซไพๅญใใพใใ ๐ค ใใผใฏใใคใถใผ ใฉใคใใฉใชใใๅๅพใใใใผใฏใใคใถใผใฏใ
+๐ค ใใฉใณในใซ้ๅธธใซ็ฐกๅใซใญใผใใใใพใใใใใใฉใฎใใใซ่กใใใใใ็่งฃใใใซใฏใ[๐ค tokenizers ใใใฎ tokenizers ใไฝฟ็จใใ](../fast_tokenizers) ใใผใธใๅ็
งใใฆใใ ใใใ
+
+[[autodoc]] PreTrainedTokenizerFast
+ - __call__
+ - apply_chat_template
+ - batch_decode
+ - decode
+ - encode
+ - push_to_hub
+ - all
+
+## BatchEncoding
+
+[[autodoc]] BatchEncoding
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/trainer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/trainer.md
new file mode 100644
index 0000000000000000000000000000000000000000..61872996ab59388fb0c3e467068502240e5fda71
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/main_classes/trainer.md
@@ -0,0 +1,727 @@
+
+
+# Trainer
+
+[`Trainer`] ใฏใฉในใฏใใปใจใใฉใฎๆจๆบ็ใชใฆใผในใฑใผในใซๅฏพใใฆใPyTorch ใงๆฉ่ฝใๅฎๅ
จใซใใฌใผใใณใฐใใใใใฎ API ใๆไพใใพใใใใใฏใ[ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples) ใฎใปใจใใฉใงไฝฟ็จใใใฆใใพใใ
+
+[`Trainer`] ใใคใณในใฟใณในๅใใๅใซใใใฌใผใใณใฐไธญใซใซในใฟใใคใบใฎใในใฆใฎใใคใณใใซใขใฏใปในใใใใใซ [`TrainingArguments`] ใไฝๆใใพใใ
+
+ใใฎ API ใฏใ่คๆฐใฎ GPU/TPU ใงใฎๅๆฃใใฌใผใใณใฐใ[NVIDIA Apex](https://github.com/NVIDIA/apex) ใใใณ PyTorch ใฎใใคใใฃใ AMP ใซใใๆททๅ็ฒพๅบฆใใตใใผใใใพใใ
+
+[`Trainer`] ใซใฏใไธ่จใฎๆฉ่ฝใใตใใผใใใๅบๆฌ็ใชใใฌใผใใณใฐ ใซใผใใๅซใพใใฆใใพใใใซในใฟใ ๅไฝใๆฟๅ
ฅใใใซใฏใใใใใใตใใฏใฉในๅใใๆฌกใฎใกใฝใใใใชใผใใผใฉใคใใใพใใ
+
+- **get_train_dataloader** -- ใใฌใผใใณใฐ ใใผใฟใญใผใใผใไฝๆใใพใใ
+- **get_eval_dataloader** -- ่ฉไพก็จใใผใฟใญใผใใผใไฝๆใใพใใ
+- **get_test_dataloader** -- ใในใ ใใผใฟใญใผใใผใไฝๆใใพใใ
+- **log** -- ใใฌใผใใณใฐใ็ฃ่ฆใใฆใใใใพใใพใชใชใใธใงใฏใใซ้ขใใๆ
ๅ ฑใใญใฐใซ่จ้ฒใใพใใ
+- **create_optimizer_and_scheduler** -- ใชใใใฃใใคใถใจๅญฆ็ฟ็ในใฑใธใฅใผใฉใๆธกใใใชใใฃใๅ ดๅใซใปใใใขใใใใพใใ
+ ๅๆๅใ `create_optimizer`ใกใฝใใใจ`create_scheduler`ใกใฝใใใใตใใฏใฉในๅใพใใฏใชใผใใผใฉใคใใใใใจใใงใใใใจใซๆณจๆใใฆใใ ใใใ
+ ๅฅใ
ใซใ
+- **create_optimizer** -- init ใงๆธกใใใชใใฃใๅ ดๅใซใชใใใฃใใคใถใผใใปใใใขใใใใพใใ
+- **create_scheduler** -- init ใงๆธกใใใชใใฃใๅ ดๅใๅญฆ็ฟ็ในใฑใธใฅใผใฉใ่จญๅฎใใพใใ
+- **compute_loss** - ใใฌใผใใณใฐๅ
ฅๅใฎใใใใฎๆๅคฑใ่จ็ฎใใพใใ
+- **training_step** -- ใใฌใผใใณใฐ ในใใใใๅฎ่กใใพใใ
+- **prediction_step** -- ่ฉไพก/ใในใ ในใใใใๅฎ่กใใพใใ
+- **evaluate** -- ่ฉไพกใซใผใใๅฎ่กใใใกใใชใฏในใ่ฟใใพใใ
+- **predict** -- ใในใ ใปใใใฎไบๆธฌ (ใฉใใซใไฝฟ็จๅฏ่ฝใชๅ ดๅใฏใกใใชใฏในใๅซใ) ใ่ฟใใพใใ
+
+
+
+[`Trainer`] ใฏใฉในใฏ ๐ค Transformers ใขใใซ็จใซๆ้ฉๅใใใฆใใใ้ฉใในใๅไฝใใใๅฏ่ฝๆงใใใใพใ
+ไปใฎๆฉ็จฎใงไฝฟ็จใใๅ ดๅใ็ฌ่ชใฎใขใใซใงไฝฟ็จใใๅ ดๅใฏใๆฌกใฎ็นใ็ขบ่ชใใฆใใ ใใใ
+
+- ใขใใซใฏๅธธใซ [`~utils.ModelOutput`] ใฎใฟใใซใพใใฏใตใใฏใฉในใ่ฟใใพใใ
+- `labels` ๅผๆฐใๆๅฎใใใใใฎๆๅคฑใๆๅใฎๅคใจใใฆ่ฟใใใๅ ดๅใใขใใซใฏๆๅคฑใ่จ็ฎใงใใพใใ
+ ใฟใใซใฎ่ฆ็ด (ใขใใซใใฟใใซใ่ฟใๅ ดๅ)
+- ใขใใซใฏ่คๆฐใฎใฉใใซๅผๆฐใๅใๅ
ฅใใใใจใใงใใพใ ([`TrainingArguments`] ใง `label_names` ใไฝฟ็จใใฆใใใฎๅๅใ [`Trainer`] ใซ็คบใใพใ) ใใใใใใฎใใใใซใ `"label"` ใจใใๅๅใไปใใๅฟ
่ฆใฏใใใพใใใ
+
+
+
+ไปฅไธใฏใๅ ้ๆๅคฑใไฝฟ็จใใใใใซ [`Trainer`] ใใซในใฟใใคใบใใๆนๆณใฎไพใงใ (ไธๅ่กกใชใใฌใผใใณใฐ ใปใใใใใๅ ดๅใซๅฝน็ซใกใพใ)ใ
+
+```python
+from torch import nn
+from transformers import Trainer
+
+
+class CustomTrainer(Trainer):
+ def compute_loss(self, model, inputs, return_outputs=False):
+ labels = inputs.pop("labels")
+ # forward pass
+ outputs = model(**inputs)
+ logits = outputs.get("logits")
+ # compute custom loss (suppose one has 3 labels with different weights)
+ loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([1.0, 2.0, 3.0], device=model.device))
+ loss = loss_fct(logits.view(-1, self.model.config.num_labels), labels.view(-1))
+ return (loss, outputs) if return_outputs else loss
+```
+
+PyTorch [`Trainer`] ใฎใใฌใผใใณใฐ ใซใผใใฎๅไฝใใซในใฟใใคใบใใใใ 1 ใคใฎๆนๆณใฏใใใฌใผใใณใฐ ใซใผใใฎ็ถๆ
ใๆคๆปใงใใ [callbacks](ใณใผใซใใใฏ) ใไฝฟ็จใใใใจใงใ (้ฒ่ก็ถๆณใฌใใผใใTensorBoard ใพใใฏไปใฎ ML ใใฉใใใใฉใผใ ใงใฎใญใฐ่จ้ฒใชใฉ)ใๆฑบๅฎ๏ผๆฉๆๅๆญขใชใฉ๏ผใ
+
+## Trainer
+
+[[autodoc]] Trainer
+ - all
+
+## Seq2SeqTrainer
+
+[[autodoc]] Seq2SeqTrainer
+ - evaluate
+ - predict
+
+## TrainingArguments
+
+[[autodoc]] TrainingArguments
+ - all
+
+## Seq2SeqTrainingArguments
+
+[[autodoc]] Seq2SeqTrainingArguments
+ - all
+
+## Checkpoints
+
+ใใใฉใซใใงใฏใ[`Trainer`] ใฏใในใฆใฎใใงใใฏใใคใณใใใ
+[`TrainingArguments`] ใไฝฟ็จใใฆใใพใใใใใใฏใxxx ใๅซใ`checkpoint-xxx`ใจใใๅๅใฎใตใใใฉใซใใผใซไฟๅญใใใพใใ
+ใใใฏใใฌใผใใณใฐใฎๆฎต้ใงใใใ
+
+ใใงใใฏใใคใณใใใใใฌใผใใณใฐใๅ้ใใใซใฏใๆฌกใฎใใใใใไฝฟ็จใใฆ [`Trainer.train`] ใๅผใณๅบใใพใใ
+
+- `resume_from_checkpoint=True` ใฏๆๆฐใฎใใงใใฏใใคใณใใใใใฌใผใใณใฐใๅ้ใใพใ
+- `resume_from_checkpoint=checkpoint_dir` ใใฃใฌใฏใใชๅ
ใฎ็นๅฎใฎใใงใใฏใใคใณใใใใใฌใผใใณใฐใๅ้ใใพใ
+ ๅๆ ผใใใ
+
+ใใใซใ`push_to_hub=True` ใไฝฟ็จใใใจใใขใใซ ใใใซใใงใใฏใใคใณใใ็ฐกๅใซไฟๅญใงใใพใใใใใฉใซใใงใฏใใในใฆ
+ไธญ้ใใงใใฏใใคใณใใซไฟๅญใใใใขใใซใฏๅฅใฎใณใใใใซไฟๅญใใใพใใใใชใใใฃใใคใถใผใฎ็ถๆ
ใฏไฟๅญใใใพใใใ้ฉๅฟใงใใพใ
+[`TrainingArguments`] ใฎ `hub-strategy` ๅคใๆฌกใฎใใใใใซใใพใใ
+
+- `"checkpoint"`: ๆๆฐใฎใใงใใฏใใคใณใใ last-checkpoint ใจใใๅๅใฎใตใใใฉใซใใผใซใใใทใฅใใใพใใ
+ `trainer.train(resume_from_checkpoint="output_dir/last-checkpoint")` ใไฝฟ็จใใฆใใฌใผใใณใฐใ็ฐกๅใซๅ้ใใพใใ
+- `"all_checkpoints"`: ใในใฆใฎใใงใใฏใใคใณใใฏใๅบๅใใฉใซใใผใซ่กจ็คบใใใใใใซใใใทใฅใใใพใ (ใใใใฃใฆใ1 ใคใฎใใงใใฏใใคใณใใๅพใใใพใ)
+ ๆ็ตใชใใธใใชๅ
ใฎใใฉใซใใผใใจใฎใใงใใฏใใคใณใ ใใฉใซใใผ)
+
+## Logging
+
+ใใใฉใซใใงใฏใ[`Trainer`] ใฏใกใคใณใใญใปในใซ `logging.INFO` ใไฝฟ็จใใใฌใใชใซใใใๅ ดๅใซใฏ `logging.WARNING` ใไฝฟ็จใใพใใ
+
+ใใใใฎใใใฉใซใใฏใ[`TrainingArguments`] ใฎ 5 ใคใฎ `logging` ใฌใใซใฎใใใใใไฝฟ็จใใใใใซใชใผใใผใฉใคใใงใใพใใ
+ๅผๆฐ:
+
+- `log_level` - ใกใคใณใใญใปใน็จ
+- `log_level_replica` - ใฌใใชใซ็จ
+
+ใใใซใ[`TrainingArguments`] ใฎ `log_on_each_node` ใ `False` ใซ่จญๅฎใใใฆใใๅ ดๅใใกใคใณ ใใผใใฎใฟใ
+ใกใคใณ ใใญใปในใฎใญใฐ ใฌใใซ่จญๅฎใไฝฟ็จใใใจใไปใฎใในใฆใฎใใผใใฏใฌใใชใซใฎใญใฐ ใฌใใซ่จญๅฎใไฝฟ็จใใพใใ
+
+[`Trainer`] ใฏใ`transformers` ใฎใญใฐ ใฌใใซใใใผใใใจใซๅๅฅใซ่จญๅฎใใใใจใซๆณจๆใใฆใใ ใใใ
+[`Trainer.__init__`]ใใใใใฃใฆใไปใฎๆฉ่ฝใๅฉ็จใใๅ ดๅใฏใใใใใใๆฉใ่จญๅฎใใใใจใใๅงใใใพใ (ๆฌกใฎไพใๅ็
ง)ใ
+[`Trainer`] ใชใใธใงใฏใใไฝๆใใๅใฎ `transformers` ๆฉ่ฝใ
+
+ใใใใขใใชใฑใผใทใงใณใงไฝฟ็จใใๆนๆณใฎไพใๆฌกใซ็คบใใพใใ
+
+```python
+[...]
+logger = logging.getLogger(__name__)
+
+# Setup logging
+logging.basicConfig(
+ format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
+ datefmt="%m/%d/%Y %H:%M:%S",
+ handlers=[logging.StreamHandler(sys.stdout)],
+)
+
+# set the main code and the modules it uses to the same log-level according to the node
+log_level = training_args.get_process_log_level()
+logger.setLevel(log_level)
+datasets.utils.logging.set_verbosity(log_level)
+transformers.utils.logging.set_verbosity(log_level)
+
+trainer = Trainer(...)
+```
+
+ใใใฆใใกใคใณ ใใผใใจไปใฎใในใฆใฎใใผใใง้่คใใๅฏ่ฝๆงใ้ซใใใฎใๅบๅใใชใใใใซ่ญฆๅใใใ ใใ่กจ็คบใใใๅ ดๅใฏใ
+่ญฆๅ: ๆฌกใฎใใใซๅฎ่กใงใใพใใ
+
+```bash
+my_app.py ... --log_level warning --log_level_replica error
+```
+
+ใใซใใใผใ็ฐๅขใงใๅใใผใใฎใกใคใณใใญใปในใฎใญใฐใ็นฐใ่ฟใใใใชใๅ ดๅใฏใๆฌกใฎใใใซใใพใใ
+ไธ่จใๆฌกใฎใใใซๅคๆดใใพใใ
+
+```bash
+my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0
+```
+
+ใใฎๅพใๆๅใฎใใผใใฎใกใคใณ ใใญใปในใฎใฟใใ่ญฆๅใใฌใใซใงใญใฐใซ่จ้ฒใใใใกใคใณ ใใผใไธใฎไปใฎใในใฆใฎใใญใปในใฏใญใฐใซ่จ้ฒใใใพใใ
+ใใผใใจไปใฎใใผใไธใฎใในใฆใฎใใญใปในใฏใใจใฉใผใใฌใใซใงใญใฐใซ่จ้ฒใใใพใใ
+
+ใขใใชใฑใผใทใงใณใใงใใใ ใ้ใใซใใๅฟ
่ฆใใใๅ ดๅใฏใๆฌกใฎใใใซใใพใใ
+
+```bash
+my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0
+```
+
+(ใใซใใใผใ็ฐๅขใฎๅ ดๅใฏ `--log_on_each_node 0` ใ่ฟฝๅ ใใพใ)
+
+## Randomness
+
+[`Trainer`] ใซใใฃใฆ็ๆใใใใใงใใฏใใคใณใใใๅ้ใใๅ ดๅใใในใฆใฎๅชๅใใใฎ็ถๆ
ใๅพฉๅ
ใใใใใซ่กใใใพใใ
+_python_ใ_numpy_ใใใใณ _pytorch_ ใฎ RNG ็ถๆ
ใฏใใใฎใใงใใฏใใคใณใใไฟๅญใใๆ็นใจๅใ็ถๆ
ใซใชใใพใใ
+ใใใซใใใใๅๆญขใใฆๅ้ใใจใใในใฟใคใซใฎใใฌใผใใณใฐใใใใณในใใใใใฌใผใใณใฐใซๅฏ่ฝใช้ใ่ฟใฅใใใใใฏใใงใใ
+
+ใใ ใใใใพใใพใชใใใฉใซใใฎ้ๆฑบๅฎ็ใช pytorch ่จญๅฎใซใใใใใใฏๅฎๅ
จใซๆฉ่ฝใใชใๅฏ่ฝๆงใใใใพใใใใซใใๅธๆใฎๅ ดๅใฏ
+ๆฑบๅฎ่ซใซใคใใฆใฏใ[ใฉใณใใ ๆงใฎใฝใผในใฎๅถๅพก](https://pytorch.org/docs/stable/notes/randomness) ใๅ็
งใใฆใใ ใใใใใญใฅใกใณใใง่ชฌๆใใใฆใใใใใซใใใใใฎ่จญๅฎใฎไธ้จใฏ
+็ฉไบใๆฑบๅฎ่ซ็ใซใใใใฎ (ไพ: `torch.backends.cudnn.deterministic`) ใฏ็ฉไบใ้
ใใใๅฏ่ฝๆงใใใใใใใใใฏ
+ใใใฉใซใใงใฏๅฎ่กใงใใพใใใใๅฟ
่ฆใซๅฟใใฆ่ชๅใงๆๅนใซใใใใจใใงใใพใใ
+
+## Specific GPUs Selection
+
+ใฉใฎ GPU ใใฉใฎใใใช้ ๅบใงไฝฟ็จใใใใใใญใฐใฉใ ใซๆ็คบใใๆนๆณใซใคใใฆ่ชฌๆใใพใใ
+
+[`DistributedDataParallel`](https://pytorch.org/docs/stable/generated/torch.nn.Parallel.DistributedDataParallel.html) ใไฝฟ็จใใฆ GPU ใฎใตใใปใใใฎใฟใไฝฟ็จใใๅ ดๅใไฝฟ็จใใ GPU ใฎๆฐใๆๅฎใใใ ใใงใใ ใใใจใใฐใGPU ใ 4 ใคใใใใๆๅใฎ 2 ใคใไฝฟ็จใใใๅ ดๅใฏใๆฌกใฎใใใซใใพใใ
+
+```bash
+torchrun --nproc_per_node=2 trainer-program.py ...
+```
+
+[`accelerate`](https://github.com/huggingface/accelerate) ใพใใฏ [`deepspeed`](https://github.com/microsoft/DeepSpeed) ใใคใณในใใผใซใใใฆใใๅ ดๅใฏใๆฌกใไฝฟ็จใใฆๅใใใจใ้ๆใใใใจใใงใใพใใใฎไธใค๏ผ
+
+```bash
+accelerate launch --num_processes 2 trainer-program.py ...
+```
+
+```bash
+deepspeed --num_gpus 2 trainer-program.py ...
+```
+
+ใใใใฎใฉใณใใฃใผใไฝฟ็จใใใใใซใAccelerate ใพใใฏ [Deepspeed ็ตฑๅ](deepspeed) ๆฉ่ฝใไฝฟ็จใใๅฟ
่ฆใฏใใใพใใใ
+
+
+ใใใพใงใฏใใใญใฐใฉใ ใซไฝฟ็จใใ GPU ใฎๆฐใๆ็คบใงใใพใใใๆฌกใซใ็นๅฎใฎ GPU ใ้ธๆใใใใฎ้ ๅบใๅถๅพกใใๆนๆณใซใคใใฆ่ชฌๆใใพใใ
+
+ๆฌกใฎ็ฐๅขๅคๆฐใฏใไฝฟ็จใใ GPU ใจใใฎ้ ๅบใๅถๅพกใใใฎใซๅฝน็ซใกใพใใ
+
+**`CUDA_VISIBLE_DEVICES`**
+
+่คๆฐใฎ GPU ใใใใใใฎใใกใฎ 1 ใคใพใใฏใใใคใใฎ GPU ใ ใใไฝฟ็จใใใๅ ดๅใฏใ็ฐๅขๅคๆฐ `CUDA_VISIBLE_DEVICES` ใไฝฟ็จใใ GPU ใฎใชในใใซ่จญๅฎใใพใใ
+
+ใใจใใฐใ4 ใคใฎ GPU (0ใ1ใ2ใ3) ใใใใจใใพใใ็ฉ็ GPU 0 ใจ 2 ใฎใฟใงๅฎ่กใใใซใฏใๆฌกใฎใใใซใใพใใ
+
+```bash
+CUDA_VISIBLE_DEVICES=0,2 torchrun trainer-program.py ...
+```
+
+ใใใใฃใฆใpytorch ใฏ 2 ใคใฎ GPU ใฎใฟใ่ช่ญใใ็ฉ็ GPU 0 ใจ 2 ใฏใใใใ `cuda:0` ใจ `cuda:1` ใซใใใใณใฐใใใพใใ
+
+้ ๅบใๅคๆดใใใใจใใงใใพใใ
+
+```bash
+CUDA_VISIBLE_DEVICES=2,0 torchrun trainer-program.py ...
+```
+
+ใใใงใฏใ็ฉ็ GPU 0 ใจ 2 ใใใใใ`cuda:1`ใจ`cuda:0`ใซใใใใณใฐใใใฆใใพใใ
+
+ไธ่จใฎไพใฏใในใฆ `DistributedDataParallel` ไฝฟ็จใใฟใผใณใฎใใฎใงใใใๅใๆนๆณใ [`DataParallel`](https://pytorch.org/docs/stable/generated/torch.nn.DataParallel.html) ใงใๆฉ่ฝใใพใใ
+
+
+```bash
+CUDA_VISIBLE_DEVICES=2,0 python trainer-program.py ...
+```
+
+GPU ใฎใชใ็ฐๅขใใจใใฅใฌใผใใใใซใฏใๆฌกใฎใใใซใใฎ็ฐๅขๅคๆฐใ็ฉบใฎๅคใซ่จญๅฎใใใ ใใงใใ
+
+```bash
+CUDA_VISIBLE_DEVICES= python trainer-program.py ...
+```
+
+ไปใฎ็ฐๅขๅคๆฐใจๅๆงใซใใใใใใณใใณใ ใฉใคใณใซ่ฟฝๅ ใใไปฃใใใซใๆฌกใฎใใใซใจใฏในใใผใใใใใจใใงใใพใใ
+
+```bash
+export CUDA_VISIBLE_DEVICES=0,2
+torchrun trainer-program.py ...
+```
+
+ใใ ใใใใฎๆนๆณใงใฏใไปฅๅใซ็ฐๅขๅคๆฐใ่จญๅฎใใใใจใๅฟใใฆใใชใ้้ใฃใ GPU ใไฝฟ็จใใใฆใใใฎใ็่งฃใงใใชใๅฏ่ฝๆงใใใใใใๆททไนฑใๆใๅฏ่ฝๆงใใใใพใใใใใใฃใฆใใใฎใปใฏใทใงใณใฎใปใจใใฉใฎไพใง็คบใใใฆใใใใใซใๅใใณใใณใ ใฉใคใณใง็นๅฎใฎๅฎ่กใซๅฏพใใฆใฎใฟ็ฐๅขๅคๆฐใ่จญๅฎใใใฎใไธ่ฌ็ใงใใ
+
+**`CUDA_DEVICE_ORDER`**
+
+็ฉ็ใใใคในใฎ้ ๅบใๅถๅพกใใ่ฟฝๅ ใฎ็ฐๅขๅคๆฐ `CUDA_DEVICE_ORDER` ใใใใพใใ้ธๆ่ขใฏๆฌกใฎ 2 ใคใงใใ
+
+1. PCIe ใใน ID ้ (`nvidia-smi` ใฎ้ ๅบใจไธ่ด) - ใใใใใใฉใซใใงใใ
+
+```bash
+export CUDA_DEVICE_ORDER=PCI_BUS_ID
+```
+
+2. GPU ใณใณใใฅใผใใฃใณใฐ่ฝๅ้ ใซไธฆในใ
+
+```bash
+export CUDA_DEVICE_ORDER=FASTEST_FIRST
+```
+
+ใปใจใใฉใฎๅ ดๅใใใฎ็ฐๅขๅคๆฐใๆฐใซใใๅฟ
่ฆใฏใใใพใใใใๅคใ GPU ใจๆฐใใ GPU ใ็ฉ็็ใซๆฟๅ
ฅใใใฆใใใใใ้
ใๅคใใซใผใใ้
ใใชใฃใฆใใใใใซ่ฆใใใใใชๅใฃใใปใใใขใใใ่กใฃใฆใใๅ ดๅใซใฏใ้ๅธธใซๅฝน็ซใกใพใใๅใใใใใ่งฃๆฑบใใ 1 ใคใฎๆนๆณใฏใใซใผใใไบคๆใใใใจใงใใใใ ใใใซใผใใไบคๆใงใใชใๅ ดๅ (ใใใคในใฎๅทๅดใๅฝฑ้ฟใๅใใๅ ดๅใชใฉ)ใ`CUDA_DEVICE_ORDER=FASTEST_FIRST`ใ่จญๅฎใใใจใๅธธใซๆฐใใ้ซ้ใซใผใใๆๅใซ้
็ฝฎใใใพใใใใ ใใ`nvidia-smi`ใฏไพ็ถใจใใฆ PCIe ใฎ้ ๅบใงใฌใใผใใใใใใๅคๅฐๆททไนฑใใใงใใใใ
+
+้ ๅบใๅ
ฅใๆฟใใใใ 1 ใคใฎ่งฃๆฑบ็ญใฏใไปฅไธใไฝฟ็จใใใใจใงใใ
+
+```bash
+export CUDA_VISIBLE_DEVICES=1,0
+```
+
+ใใฎไพใงใฏ 2 ใคใฎ GPU ใ ใใไฝฟ็จใใฆใใพใใใใใกใใใใณใณใใฅใผใฟใผใซๆญ่ผใใใฆใใๆฐใฎ GPU ใซใๅใใใจใๅฝใฆใฏใพใใพใใ
+
+ใพใใใใฎ็ฐๅขๅคๆฐใ่จญๅฎใใๅ ดๅใฏใ`~/.bashrc` ใใกใคใซใพใใฏใใฎไปใฎ่ตทๅ่จญๅฎใใกใคใซใซ่จญๅฎใใฆใๅฟใใใฎใๆๅใงใใ
+
+## Trainer Integrations
+
+[`Trainer`] ใฏใใใฌใผใใณใฐใๅ็ใซๆนๅใใๅฏ่ฝๆงใฎใใใฉใคใใฉใชใใตใใผใใใใใใซๆกๅผตใใใพใใใ
+ๆ้ใจใฏใใใซๅคงใใชใขใใซใซ้ฉๅใใพใใ
+
+็พๅจใใตใผใใใผใใฃใฎใฝใชใฅใผใทใงใณ [DeepSpeed](https://github.com/microsoft/DeepSpeed) ใใใณ [PyTorch FSDP](https://pytorch.org/docs/stable/fsdp.html) ใใตใใผใใใฆใใพใใ่ซๆ [ZeRO: ใกใขใชใฎๆ้ฉๅๅ
ใใฉใกใผใฟ ใขใใซใฎใใฌใผใใณใฐใซๅใใฆใSamyam RajbhandariใJeff RasleyใOlatunji RuwaseใYuxiong He ่](https://arxiv.org/abs/1910.02054)ใ
+
+ใใฎๆไพใใใใตใใผใใฏใใใฎ่จไบใฎๅท็ญๆ็นใงใฏๆฐใใใฆๅฎ้จ็ใชใใฎใงใใ DeepSpeed ใจ PyTorch FSDP ใฎใตใใผใใฏใขใฏใใฃใใงใใใใใใซ้ขใใๅ้กใฏๆญ่ฟใใพใใใFairScale ็ตฑๅใฏ PyTorch ใกใคใณใซ็ตฑๅใใใฆใใใใใใใใตใใผใใใฆใใพใใ ([PyTorch FSDP ็ตฑๅ](#pytorch-fully-sharded-data-parallel))
+
+
+
+### CUDA Extension Installation Notes
+
+ใใฎ่จไบใฎๅท็ญๆ็นใงใฏใDeepspeed ใไฝฟ็จใใใซใฏใCUDA C++ ใณใผใใใณใณใใคใซใใๅฟ
่ฆใใใใพใใ
+
+ใในใฆใฎใคใณในใใผใซใฎๅ้กใฏใ[Deepspeed](https://github.com/microsoft/DeepSpeed/issues) ใฎๅฏพๅฟใใ GitHub ใฎๅ้กใ้ใใฆๅฏพๅฆใใๅฟ
่ฆใใใใพใใใใใซใไธญใซ็บ็ใใๅฏ่ฝๆงใฎใใไธ่ฌ็ใชๅ้กใใใใคใใใใพใใ
+CUDA ๆกๅผตๆฉ่ฝใๆง็ฏใใๅฟ
่ฆใใใ PyTorch ๆกๅผตๆฉ่ฝใ
+
+ใใใใฃใฆใๆฌกใฎๆไฝใๅฎ่กไธญใซ CUDA ้ข้ฃใฎใใซใใฎๅ้กใ็บ็ใใๅ ดๅใฏใๆฌกใฎใจใใใงใใ
+
+```bash
+pip install deepspeed
+```
+
+ใพใๆฌกใฎๆณจๆไบ้
ใใ่ชญใฟใใ ใใใ
+
+ใใใใฎใใผใใงใฏใ`pytorch` ใ CUDA `10.2` ใงใใซใใใใๅ ดๅใซไฝใใในใใใฎไพใ็คบใใพใใใใชใใฎ็ถๆณใๆฌกใฎใใใชๅ ดๅ
+็ฐใชใๅ ดๅใฏใใใผใธใงใณ็ชๅทใ็ฎ็ใฎใใผใธใงใณใซ่ชฟๆดใใใใจใๅฟใใชใใงใใ ใใใ
+
+#### Possible problem #1
+
+Pytorch ใซใฏ็ฌ่ชใฎ CUDA ใใผใซใญใใใไปๅฑใใฆใใพใใใใใใ 2 ใคใฎใใญใธใงใฏใใใใซใใใใซใฏใๅไธใใผใธใงใณใฎ CUDA ใๅฟ
่ฆใงใใ
+ใทในใใ ๅ
จไฝใซใคใณในใใผใซใใใพใใ
+
+ใใจใใฐใPython ็ฐๅขใซ `cudatoolkit==10.2` ใๆๅฎใใฆ `pytorch` ใใคใณในใใผใซใใๅ ดๅใฏใๆฌกใฎใใฎใๅฟ
่ฆใงใใ
+CUDA `10.2` ใใทในใใ ๅ
จไฝใซใคใณในใใผใซใใใพใใใ
+
+ๆญฃ็ขบใชๅ ดๆใฏใทในใใ ใซใใฃใฆ็ฐใชใๅ ดๅใใใใพใใใๅคใใฎใทในใใ ใงใฏ`/usr/local/cuda-10.2`ใๆใไธ่ฌ็ใชๅ ดๆใงใใ
+Unix ใทในใใ ใ CUDA ใๆญฃใใ่จญๅฎใใใ`PATH`็ฐๅขๅคๆฐใซ่ฟฝๅ ใใใใจใ
+ๆฌกใฎใใใซใใฆใคใณในใใผใซๅ ดๆใๆๅฎใใพใใ
+
+
+```bash
+which nvcc
+```
+
+CUDA ใใทในใใ ๅ
จไฝใซใคใณในใใผใซใใใฆใใชใๅ ดๅใฏใๆๅใซใคใณในใใผใซใใฆใใ ใใใใๆฐใซๅ
ฅใใไฝฟ็จใใฆๆ้ ใ่ฆใคใใใใจใใงใใพใ
+ๆค็ดขใจใณใธใณใใใจใใฐใUbuntu ใไฝฟ็จใใฆใใๅ ดๅใฏใ[ubuntu cuda 10.2 install](https://www.google.com/search?q=ubuntu+cuda+10.2+install) ใๆค็ดขใใใจใใใงใใใใ
+
+#### Possible problem #2
+
+ใใ 1 ใคใฎ่ใใใใไธ่ฌ็ใชๅ้กใฏใใทในใใ ๅ
จไฝใซ่คๆฐใฎ CUDA ใใผใซใญใใใใคใณในใใผใซใใใฆใใๅฏ่ฝๆงใใใใใจใงใใใใจใใฐใใชใ
+ใใใๅฏ่ฝๆงใใใ๏ผ
+
+```bash
+/usr/local/cuda-10.2
+/usr/local/cuda-11.0
+```
+
+ใใฎ็ถๆณใงใฏใ`PATH` ใใใณ `LD_LIBRARY_PATH` ็ฐๅขๅคๆฐใซไปฅไธใๅซใพใใฆใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+็ฎ็ใฎ CUDA ใใผใธใงใณใธใฎๆญฃใใใในใ้ๅธธใใใใฑใผใธ ใคใณในใใผใฉใผใฏใใใใใซใ
+ๆๅพใฎใใผใธใงใณใใคใณในใใผใซใใใพใใใ้ฉๅใชใใใฑใผใธใ่ฆใคใใใชใใใใซใใใฑใผใธใฎใใซใใๅคฑๆใใใจใใๅ้กใ็บ็ใใๅ ดๅใฏใ
+CUDA ใใผใธใงใณใใทในใใ ๅ
จไฝใซใคใณในใใผใซใใใฆใใใซใใใใใใใๅ่ฟฐใฎ 2 ใคใ่ชฟๆดใใๅฟ
่ฆใใใใใจใๆๅณใใพใ
+็ฐๅขๅคๆฐใ
+
+ใพใใใใฎๅ
ๅฎนใ่ฆใฆใฟใพใใใใ
+
+```bash
+echo $PATH
+echo $LD_LIBRARY_PATH
+```
+
+ใใใงใไธญใซไฝใๅ
ฅใฃใฆใใใใใใใใพใใ
+
+`LD_LIBRARY_PATH` ใ็ฉบใงใใๅฏ่ฝๆงใใใใพใใ
+
+`PATH` ใฏๅฎ่กๅฏ่ฝใใกใคใซใๅญๅจใใๅ ดๆใใชในใใใ`LD_LIBRARY_PATH` ใฏๅ
ฑๆใฉใคใใฉใชใฎๅ ดๆใ็คบใใพใใ
+ๆขใใใจใงใใใฉใกใใฎๅ ดๅใใๅใฎใจใณใใชใๅพใฎใจใณใใชใใๅชๅ
ใใใพใใ `:` ใฏ่คๆฐใๅบๅใใใใซไฝฟ็จใใใพใ
+ใจใณใใชใ
+
+ใใใงใใใซใ ใใญใฐใฉใ ใซ็นๅฎใฎ CUDA ใใผใซใญใใใฎๅ ดๆใๆ็คบใใใซใฏใๆๅใซใชในใใใใๅธๆใฎใในใๆฟๅ
ฅใใพใใ
+ใใฃใฆใใใใจ๏ผ
+
+```bash
+export PATH=/usr/local/cuda-10.2/bin:$PATH
+export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
+```
+
+ๆขๅญใฎๅคใไธๆธใใใใฎใงใฏใชใใๅ
้ ญใซ่ฟฝๅ ใใใใจใซๆณจๆใใฆใใ ใใใ
+
+ใใกใใใๅฟ
่ฆใซๅฟใใฆใใผใธใงใณ็ชๅทใใใซใในใ่ชฟๆดใใพใใๅฒใๅฝใฆใใใฃใฌใฏใใชใๅฎ้ใซๆฉ่ฝใใใใจใ็ขบ่ชใใฆใใ ใใ
+ๅญๅจใใใ `lib64` ใตใใใฃใฌใฏใใชใฏใ`libcudart.so` ใชใฉใฎใใพใใพใช CUDA `.so` ใชใใธใงใฏใใๅญๅจใใๅ ดๆใงใใ
+ใทในใใ ใงใฏๅฅใฎๅๅใไปใใใใพใใใ็พๅฎใๅๆ ใใใใใซ่ชฟๆดใใฆใใ ใใใ
+
+#### Possible problem #3
+
+ไธ้จใฎๅคใ CUDA ใใผใธใงใณใฏใๆฐใใใณใณใใคใฉใงใฎใใซใใๆๅฆใใๅ ดๅใใใใพใใใใจใใฐใใใชใใฏ`gcc-9`ใๆใฃใฆใใพใใใใใใๅฟ
่ฆใงใ
+`gcc-7`ใ
+
+ใใใซใฏใใพใใพใชๆนๆณใใใใพใใ
+
+ๆๆฐใฎ CUDA ใใผใซใญใใใใคใณในใใผใซใงใใๅ ดๅใฏใ้ๅธธใๆฐใใใณใณใใคใฉใใตใใผใใใใฆใใใฏใใงใใ
+
+ใใใใฏใๆขใซๆๆใใฆใใใณใณใใคใฉใซๅ ใใฆใไธไฝใใผใธใงใณใฎใณใณใใคใฉใใคใณในใใผใซใใใใจใใงใใพใใ
+ใใงใซๅญๅจใใพใใใใใใฉใซใใงใฏใชใใใใใใซใใทในใใ ใฏใใใ่ช่ญใงใใพใใใ ใgcc-7ใใใคใณในใใผใซใใใฆใใใใ
+ใใซใใทในใใ ใ่ฆใคใใใชใใจใใใกใใปใผใธใ่กจ็คบใใๅ ดๅใฏใๆฌกใฎๆนๆณใง่งฃๆฑบใงใใๅฏ่ฝๆงใใใใพใใ
+
+```bash
+sudo ln -s /usr/bin/gcc-7 /usr/local/cuda-10.2/bin/gcc
+sudo ln -s /usr/bin/g++-7 /usr/local/cuda-10.2/bin/g++
+```
+
+ใใใงใฏใ`/usr/local/cuda-10.2/bin/gcc` ใใ `gcc-7` ใธใฎใทใณใใชใใฏใชใณใฏใไฝๆใใฆใใพใใ
+`/usr/local/cuda-10.2/bin/` ใฏ `PATH` ็ฐๅขๅคๆฐๅ
ใซใใๅฟ
่ฆใใใใพใ (ๅใฎๅ้กใฎ่งฃๆฑบ็ญใๅ็
ง)ใ
+`gcc-7` (ใใใณ `g++7`) ใ่ฆใคใใใฏใใงใใใซใใฏๆๅใใพใใ
+
+ใใคใใฎใใใซใ็ถๆณใซๅใใใฆไพใฎใในใ็ทจ้ใใฆใใ ใใใ
+
+### PyTorch Fully Sharded Data parallel
+
+ใใๅคงใใชใใใ ใตใคใบใงๅทจๅคงใชใขใใซใฎใใฌใผใใณใฐใ้ซ้ๅใใใซใฏใๅฎๅ
จใซใทใฃใผใๅใใใใใผใฟไธฆๅใขใใซใไฝฟ็จใงใใพใใ
+ใใฎใฟใคใใฎใใผใฟไธฆๅใใฉใใคใ ใงใฏใใชใใใฃใใคใถใผใฎ็ถๆ
ใๅพ้
ใใใฉใกใผใฟใผใใทใฃใผใใฃใณใฐใใใใจใงใใใๅคใใฎใใผใฟใจๅคง่ฆๆจกใชใขใใซใใใฃใใใฃใณใฐใงใใพใใ
+ใใฎๆฉ่ฝใจใใฎๅฉ็นใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ๅฎๅ
จใทใฃใผใใฃใณใฐ ใใผใฟไธฆๅใใญใฐ](https://pytorch.org/blog/introducing-pytorch-full-sharded-data-Parallel-api/) ใใ่ฆงใใ ใใใ
+ๆๆฐใฎ PyTorch ใฎ Fully Sharded Data Parallel (FSDP) ใใฌใผใใณใฐๆฉ่ฝใ็ตฑๅใใพใใใ
+ๅฟ
่ฆใชใฎใฏใ่จญๅฎใ้ใใฆๆๅนใซใใใใจใ ใใงใใ
+
+**FSDP ใตใใผใใซๅฟ
่ฆใช PyTorch ใใผใธใงใณ**: PyTorch Nightly (ใชใชใผในๅพใซใใใ่ชญใใ ๅ ดๅใฏ 1.12.0)
+FSDP ใๆๅนใซใใใขใใซใฎไฟๅญใฏใๆ่ฟใฎไฟฎๆญฃใงใฎใฟๅฉ็จใงใใใใใงใใ
+
+**ไฝฟ็จๆณ**๏ผ
+
+- ้
ๅธใใใใฉใณใใฃใผใ่ฟฝๅ ใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใ
+ใพใ ไฝฟ็จใใฆใใชใๅ ดๅใฏใ`-m torch.distributed.launch --nproc_per_node=NUMBER_OF_GPUS_YOU_HAVE`ใไฝฟ็จใใพใใ
+
+- **ใทใฃใผใใฃใณใฐๆฆ็ฅ**:
+ - FULL_SHARD : ใใผใฟไธฆๅใฏใผใซใผ/GPU ใซใใใใทใฃใผใ ใชใใใฃใใคใถใผใฎ็ถๆ
+ ๅพ้
+ ใขใใซ ใใฉใกใผใฟใผใ
+ ใใฎใใใซใฏใใณใใณใใฉใคใณๅผๆฐใซ`--fsdp full_shard`ใ่ฟฝๅ ใใพใใ
+ - SHARD_GRAD_OP : ใทใฃใผใ ใชใใใฃใใคใถใผใฎ็ถๆ
+ ใใผใฟไธฆๅใฏใผใซใผ/GPU ๅ
จไฝใฎๅพ้
ใ
+ ใใฎใใใซใฏใใณใใณใใฉใคใณๅผๆฐใซ`--fsdp shard_grad_op`ใ่ฟฝๅ ใใพใใ
+ - NO_SHARD : ใทใฃใผใใฃใณใฐใชใใใใฎใใใซใฏใใณใใณใใฉใคใณๅผๆฐใซ`--fsdp no_shard`ใ่ฟฝๅ ใใพใใ
+- ใใฉใกใผใฟใจๅพ้
ใ CPU ใซใชใใญใผใใใใซใฏใ
+ ใณใใณใใฉใคใณๅผๆฐใซ`--fsdp "full_shard offload"`ใพใใฏ`--fsdp "shard_grad_op offload"`ใ่ฟฝๅ ใใพใใ
+- `default_auto_wrap_policy` ใไฝฟ็จใใฆ FSDP ใงใฌใคใคใผใ่ชๅ็ใซๅๅธฐ็ใซใฉใใใใใซใฏใ
+ ใณใใณใใฉใคใณๅผๆฐใซ`--fsdp "full_shard auto_wrap"`ใพใใฏ`--fsdp "shard_grad_op auto_wrap"`ใ่ฟฝๅ ใใพใใ
+- CPU ใชใใญใผใใจ่ชๅใฉใใใณใฐใฎไธกๆนใๆๅนใซใใใซใฏใ
+ ใณใใณใใฉใคใณๅผๆฐใซ`--fsdp "full_shard offload auto_wrap"`ใพใใฏ`--fsdp "shard_grad_op offload auto_wrap"`ใ่ฟฝๅ ใใพใใ
+- ๆฎใใฎ FSDP ๆงๆใฏใ`--fsdp_config `ใไปใใฆๆธกใใใพใใใใใฏใๆฌกใฎใใใใใฎๅ ดๆใงใใ
+ FSDP json ๆงๆใใกใคใซ (ไพ: `fsdp_config.json`)ใใพใใฏใใงใซใญใผใใใใฆใใ json ใใกใคใซใ `dict` ใจใใฆไฝฟ็จใใพใใ
+ - ่ชๅใฉใใใณใฐใๆๅนใชๅ ดๅใฏใใใฉใณในใใผในใฎ่ชๅใฉใใ ใใชใทใผใพใใฏใตใคใบ ใใผในใฎ่ชๅใฉใใ ใใชใทใผใไฝฟ็จใงใใพใใ
+ - ใใฉใณในใใฉใผใใผใใผในใฎ่ชๅใฉใใใใชใทใผใฎๅ ดๅใๆงๆใใกใคใซใง `fsdp_transformer_layer_cls_to_wrap` ใๆๅฎใใใใจใใๅงใใใพใใๆๅฎใใชใๅ ดๅใไฝฟ็จๅฏ่ฝใชๅ ดๅใใใใฉใซใๅคใฏ `model._no_split_modules` ใซใชใใพใใ
+ ใใใฏใใฉใใใใใใฉใณในใใฉใผใใผๅฑคใฏใฉในๅใฎใชในใ (ๅคงๆๅญใจๅฐๆๅญใๅบๅฅ) ใๆๅฎใใพใ (ไพ: [`BertLayer`]ใ[`GPTJBlock`]ใ[`T5Block`] ...)ใ
+ ้ใฟใๅ
ฑๆใใใตใใขใธใฅใผใซ (ๅใ่พผใฟๅฑคใชใฉ) ใ็ฐใชใ FSDP ใฉใใใใใใฆใใใใซใชใใชใใใใซใใๅฟ
่ฆใใใใใใใใใฏ้่ฆใงใใ
+ ใใฎใใชใทใผใไฝฟ็จใใใจใใใซใใใใ ใขใใณใทใงใณใจใใใซ็ถใใใใคใใฎ MLP ใฌใคใคใผใๅซใใใญใใฏใใจใซใฉใใใณใฐใ็บ็ใใพใใ
+ ๅ
ฑๆๅใ่พผใฟใๅซใๆฎใใฎๅฑคใฏใๅใๆใๅคๅดใฎ FSDP ใฆใใใใซใฉใใใใใใฎใไพฟๅฉใงใใ
+ ใใใใฃใฆใใใฉใณในใใผในใฎใขใใซใซใฏใใใไฝฟ็จใใฆใใ ใใใ
+ - ใตใคใบใใผในใฎ่ชๅใฉใใใใชใทใผใฎๅ ดๅใฏใ่จญๅฎใใกใคใซใซ`fsdp_min_num_params`ใ่ฟฝๅ ใใฆใใ ใใใ
+ ่ชๅใฉใใใณใฐใฎใใใฎ FSDP ใฎใใฉใกใผใฟใฎๆๅฐๆฐใๆๅฎใใพใใ
+ - ่จญๅฎใใกใคใซใง `fsdp_backward_prefetch` ใๆๅฎใงใใใใใซใชใใพใใใๆฌกใฎใใฉใกใผใฟใฎใปใใใใใคใใชใใงใใใใใใๅถๅพกใใพใใ
+ `backward_pre` ใจ `backward_pos` ใๅฉ็จๅฏ่ฝใชใชใใทใงใณใงใใ
+ ่ฉณ็ดฐใซใคใใฆใฏใ`torch.distributed.fsdp.full_sharded_data_Parallel.BackwardPrefetch`ใๅ็
งใใฆใใ ใใใ
+ - ่จญๅฎใใกใคใซใง `fsdp_forward_prefetch` ใๆๅฎใงใใใใใซใชใใพใใใๆฌกใฎใใฉใกใผใฟใฎใปใใใใใคใใชใใงใใใใใใๅถๅพกใใพใใ
+ `True`ใฎๅ ดๅใFSDP ใฏใใฉใฏใผใ ใในใงใฎๅฎ่กไธญใซใๆฌกใซๆฅใใชใผใซใฎใฃใถใผใๆ็คบ็ใซใใชใใงใใใใพใใ
+ - ่จญๅฎใใกใคใซใง `limit_all_gathers` ใๆๅฎใงใใใใใซใชใใพใใใ
+ `True`ใฎๅ ดๅใFSDP ใฏ CPU ในใฌใใใๆ็คบ็ใซๅๆใใฆใๅฎ่กไธญใฎใชใผใซใฎใฃใถใๅคใใใใฎใ้ฒใใพใใ
+ - `activation_checkpointing`ใ่จญๅฎใใกใคใซใงๆๅฎใงใใใใใซใชใใพใใใ
+ `True`ใฎๅ ดๅใFSDP ใขใฏใใฃใใผใทใงใณ ใใงใใฏใใคใณใใฏใFSDP ใฎใขใฏใใฃใใผใทใงใณใใฏใชใขใใใใจใงใกใขใชไฝฟ็จ้ใๅๆธใใๆๆณใงใใ
+ ็นๅฎใฎใฌใคใคใผใๅฆ็ใใใใใฏใฏใผใ ใในไธญใซใใใใๅ่จ็ฎใใพใใไบๅฎไธใใใใฏไฝๅใช่จ็ฎๆ้ใ็ ็ฒใซใใพใ
+ ใกใขใชไฝฟ็จ้ใๅๆธใใพใใ
+
+**ๆณจๆใในใๆณจๆ็นใใใใคใใใใพใ**
+- ใใใฏ `generate` ใจไบๆๆงใใชใใใใ `--predict_with_generate` ใจใไบๆๆงใใใใพใใ
+ ใในใฆใฎ seq2seq/clm ในใฏใชใใ (็ฟป่จณ/่ฆ็ด/clm ใชใฉ)ใ
+ ๅ้ก [#21667](https://github.com/huggingface/transformers/issues/21667) ใๅ็
งใใฆใใ ใใใ
+
+### PyTorch/XLA Fully Sharded Data parallel
+
+TPU ใฆใผใถใผใฎ็ๆงใซๆๅ ฑใงใใ PyTorch/XLA ใฏ FSDP ใใตใใผใใใใใใซใชใใพใใใ
+ๆๆฐใฎ Fully Sharded Data Parallel (FSDP) ใใฌใผใใณใฐใใในใฆใตใใผใใใใฆใใพใใ
+่ฉณ็ดฐใซใคใใฆใฏใ[FSDP ใไฝฟ็จใใ Cloud TPU ใงใฎ PyTorch ใขใใซใฎในใฑใผใชใณใฐ](https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/) ใใใณ [PyTorch/XLA ๅฎ่ฃ
ใๅ็
งใใฆใใ ใใใ FSDP ใฎ](https://github.com/pytorch/xla/tree/master/torch_xla/distributed/fsdp)
+ๅฟ
่ฆใชใฎใฏใ่จญๅฎใ้ใใฆๆๅนใซใใใใจใ ใใงใใ
+
+**FSDP ใตใใผใใซๅฟ
่ฆใช PyTorch/XLA ใใผใธใงใณ**: >=2.0
+
+**ไฝฟ็จๆณ**๏ผ
+
+`--fsdp "full shard"` ใใ`--fsdp_config ` ใซๅ ใใใใๆฌกใฎๅคๆดใจใจใใซๆธกใใพใใ
+- PyTorch/XLA FSDP ใๆๅนใซใใใซใฏใ`xla`ใ`True`ใซ่จญๅฎใใๅฟ
่ฆใใใใพใใ
+- `xla_fsdp_settings` ๅคใฏใXLA FSDP ใฉใใใณใฐ ใใฉใกใผใฟใๆ ผ็ดใใ่พๆธใงใใ
+ ใชใใทใงใณใฎๅฎๅ
จใชใชในใใซใคใใฆใฏใ[ใใกใ](
+ https://github.com/pytorch/xla/blob/master/torch_xla/distributed/fsdp/xla_full_sharded_data_Parallel.py)ใ
+- `xla_fsdp_grad_ckpt`ใ `True`ใฎๅ ดๅใใในใใใใ XLA FSDP ใงใฉใใใใใๅใฌใคใคใผไธใงๅพ้
ใใงใใฏใใคใณใใไฝฟ็จใใพใใ
+ ใใฎ่จญๅฎใฏใxla ใใฉใฐใ true ใซ่จญๅฎใใใฆใใใ่ชๅใฉใใใณใฐ ใใชใทใผใๆๅฎใใใฆใใๅ ดๅใซใฎใฟไฝฟ็จใงใใพใใ
+ `fsdp_min_num_params` ใพใใฏ `fsdp_transformer_layer_cls_to_wrap`ใ
+- ใใฉใณในใใฉใผใใผ ใใผในใฎ่ชๅใฉใใ ใใชใทใผใพใใฏใตใคใบ ใใผในใฎ่ชๅใฉใใ ใใชใทใผใฎใใใใใไฝฟ็จใงใใพใใ
+ - ใใฉใณในใใฉใผใใผใใผในใฎ่ชๅใฉใใใใชใทใผใฎๅ ดๅใๆงๆใใกใคใซใง `fsdp_transformer_layer_cls_to_wrap` ใๆๅฎใใใใจใใๅงใใใพใใๆๅฎใใชใๅ ดๅใไฝฟ็จๅฏ่ฝใชๅ ดๅใใใใฉใซใๅคใฏ `model._no_split_modules` ใซใชใใพใใ
+ ใใใฏใใฉใใใใใใฉใณในใใฉใผใใผๅฑคใฏใฉในๅใฎใชในใ (ๅคงๆๅญใจๅฐๆๅญใๅบๅฅ) ใๆๅฎใใพใ (ไพ: [`BertLayer`]ใ[`GPTJBlock`]ใ[`T5Block`] ...)ใ
+ ้ใฟใๅ
ฑๆใใใตใใขใธใฅใผใซ (ๅใ่พผใฟๅฑคใชใฉ) ใ็ฐใชใ FSDP ใฉใใใใใใฆใใใใซใชใใชใใใใซใใๅฟ
่ฆใใใใใใใใใฏ้่ฆใงใใ
+ ใใฎใใชใทใผใไฝฟ็จใใใจใใใซใใใใ ใขใใณใทใงใณใจใใใซ็ถใใใใคใใฎ MLP ใฌใคใคใผใๅซใใใญใใฏใใจใซใฉใใใณใฐใ็บ็ใใพใใ
+ ๅ
ฑๆๅใ่พผใฟใๅซใๆฎใใฎๅฑคใฏใๅใๆใๅคๅดใฎ FSDP ใฆใใใใซใฉใใใใใใฎใไพฟๅฉใงใใ
+ ใใใใฃใฆใใใฉใณในใใผในใฎใขใใซใซใฏใใใไฝฟ็จใใฆใใ ใใใ
+ - ใตใคใบใใผในใฎ่ชๅใฉใใใใชใทใผใฎๅ ดๅใฏใ่จญๅฎใใกใคใซใซ`fsdp_min_num_params`ใ่ฟฝๅ ใใฆใใ ใใใ
+ ่ชๅใฉใใใณใฐใฎใใใฎ FSDP ใฎใใฉใกใผใฟใฎๆๅฐๆฐใๆๅฎใใพใใ
+
+### Using Trainer for accelerated PyTorch Training on Mac
+
+PyTorch v1.12 ใชใชใผในใซใใใ้็บ่
ใจ็ ็ฉถ่
ใฏ Apple ใทใชใณใณ GPU ใๅฉ็จใใฆใขใใซ ใใฌใผใใณใฐใๅคงๅน
ใซ้ซ้ๅใงใใพใใ
+ใใใซใใใใใญใใฟใคใใณใฐใๅพฎ่ชฟๆดใชใฉใฎๆฉๆขฐๅญฆ็ฟใฏใผใฏใใญใผใ Mac ไธใงใญใผใซใซใงๅฎ่กใงใใใใใซใชใใพใใ
+PyTorch ใฎใใใฏใจใณใใจใใฆใฎ Apple ใฎ Metal Performance Shaders (MPS) ใฏใใใๅฏ่ฝใซใใๆฐใใ `"mps"` ใใใคใน็ต็ฑใงไฝฟ็จใงใใพใใ
+ใใใซใใใ่จ็ฎใฐใฉใใจใใชใใใฃใใ MPS Graph ใใฌใผใ ใฏใผใฏใจ MPS ใซใใฃใฆๆไพใใใ่ชฟๆดใใใใซใผใใซใซใใใใณใฐใใใพใใ
+่ฉณ็ดฐใซใคใใฆใฏใๅ
ฌๅผใใญใฅใกใณใ [Mac ใงใฎ Accelerated PyTorch Training ใฎ็ดนไป](https://pytorch.org/blog/introducing-accelerated-pytorch-training-on-mac/) ใๅ็
งใใฆใใ ใใใ
+ใใใณ [MPS ใใใฏใจใณใ](https://pytorch.org/docs/stable/notes/mps.html)ใ
+
+
+
+MacOS ใใทใณใซ PyTorch >= 1.13 (ๅท็ญๆ็นใงใฏใใคใใชใผ ใใผใธใงใณ) ใใคใณในใใผใซใใใใจใๅผทใใๅงใใใพใใ
+ใใฉใณในใใผในใฎใขใใซใฎใขใใซใฎๆญฃ็ขบๆงใจใใใฉใผใใณในใฎๅไธใซ้ข้ฃใใไธป่ฆใชไฟฎๆญฃใ่กใใใฆใใพใใ
+่ฉณ็ดฐใซใคใใฆใฏใhttps://github.com/pytorch/pytorch/issues/82707 ใๅ็
งใใฆใใ ใใใ
+
+
+
+**Apple Silicon ใใใใไฝฟ็จใใใใฌใผใใณใฐใจๆจ่ซใฎๅฉ็น**
+
+1. ใฆใผใถใผใใญใผใซใซใงๅคง่ฆๆจกใชใใใใฏใผใฏใใใใ ใตใคใบใใใฌใผใใณใฐใงใใใใใซใใพใ
+2. ใฆใใใกใคใ ใกใขใช ใขใผใญใใฏใใฃใซใใใใใผใฟๅๅพใฎ้
ๅปถใ็ญ็ธฎใใใGPU ใใกใขใช ในใใขๅ
จไฝใซ็ดๆฅใขใฏใปในใงใใใใใซใชใใพใใ
+ใใใใฃใฆใใจใณใใใผใจใณใใฎใใใฉใผใใณในใๅไธใใพใใ
+3. ใฏใฉใฆใใใผในใฎ้็บใซ้ข้ฃใใใณในใใ่ฟฝๅ ใฎใญใผใซใซ GPU ใฎๅฟ
่ฆๆงใๅๆธใใพใใ
+
+**ๅๆๆกไปถ**: mps ใตใใผใใๅใใใใผใใใคใณในใใผใซใใใซใฏใ
+ใใฎ็ด ๆดใใใใกใใฃใข่จไบ [GPU ใขใฏใปใฉใฌใผใทใงใณใ M1 Mac ใฎ PyTorch ใซ็ปๅ ด](https://medium.com/towards-data-science/gpu-acceleration-comes-to-pytorch-on-m1-macs-195c399efcc1) ใซๅพใฃใฆใใ ใใใ ใ
+
+**ไฝฟ็จๆณ**๏ผ
+`mps` ใใใคในใฏใ`cuda` ใใใคในใไฝฟ็จใใใๆนๆณใจๅๆงใซๅฉ็จๅฏ่ฝใชๅ ดๅใใใใฉใซใใงไฝฟ็จใใใพใใ
+ใใใใฃใฆใใฆใผใถใผใซใใใขใฏใทใงใณใฏๅฟ
่ฆใใใพใใใ
+ใใจใใฐใไปฅไธใฎใณใใณใใไฝฟ็จใใฆใApple Silicon GPU ใไฝฟ็จใใฆๅ
ฌๅผใฎ Glue ใใญในใๅ้กใฟในใฏใ (ใซใผใ ใใฉใซใใผใใ) ๅฎ่กใงใใพใใ
+
+```bash
+export TASK_NAME=mrpc
+
+python examples/pytorch/text-classification/run_glue.py \
+ --model_name_or_path google-bert/bert-base-cased \
+ --task_name $TASK_NAME \
+ --do_train \
+ --do_eval \
+ --max_seq_length 128 \
+ --per_device_train_batch_size 32 \
+ --learning_rate 2e-5 \
+ --num_train_epochs 3 \
+ --output_dir /tmp/$TASK_NAME/ \
+ --overwrite_output_dir
+```
+
+**ๆณจๆใในใใใใคใใฎๆณจๆไบ้
**
+
+1. ไธ้จใฎ PyTorch ๆไฝใฏ mps ใซๅฎ่ฃ
ใใใฆใใชใใใใใจใฉใผใในใญใผใใใพใใ
+ใใใๅ้ฟใใ 1 ใคใฎๆนๆณใฏใ็ฐๅขๅคๆฐ `PYTORCH_ENABLE_MPS_FALLBACK=1` ใ่จญๅฎใใใใจใงใใ
+ใใใใฎๆไฝใงใฏ CPU ใซใใฉใผใซใใใฏใใพใใใใ ใใใใใงใ UserWarning ใในใญใผใใใพใใ
+2. ๅๆฃใปใใใขใใ`gloo`ใใใณ`nccl`ใฏใ`mps`ใใใคในใงใฏๅไฝใใพใใใ
+ใใใฏใ็พๅจใmpsใใใใคใน ใฟใคใใฎๅไธ GPU ใฎใฟใไฝฟ็จใงใใใใจใๆๅณใใพใใ
+
+ๆๅพใซใ่ฆใใฆใใใฆใใ ใใใ ๐ค `Trainer` ใฏ MPS ใใใฏใจใณใใฎใฟใ็ตฑๅใใใใใ
+MPS ใใใฏใจใณใใฎไฝฟ็จใซ้ขใใฆๅ้กใ่ณชๅใใใๅ ดๅใฏใ
+[PyTorch GitHub](https://github.com/pytorch/pytorch/issues) ใซๅ้กใๆๅบใใฆใใ ใใใ
+
+## Using Accelerate Launcher with Trainer
+
+ๅ ้ใใฆใใฌใผใใผใซใใฏใผใไธใใพใใใใใฆใผใถใผใๆๅพ
ใใใใจใซ้ขใใฆใฏใๆฌกใฎใจใใใงใใ
+- ใใฌใผใใผๅผๆฐใซๅฏพใใฆ FSDPใDeepSpeed ใชใฉใฎใใฌใผใใผ ใคใณใใฌใผใทใงใณใๅคๆดใใใซไฝฟ็จใ็ถใใใใจใใงใใพใใ
+- ใใฌใผใใผใง Accelerate Launcher ใไฝฟ็จใงใใใใใซใชใใพใใ (ๆจๅฅจ)ใ
+
+ใใฌใผใใผใง Accelerate Launcher ใไฝฟ็จใใๆ้ :
+1. ๐ค Accelerate ใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใAccelerate ใใชใใจ `Trainer` ใไฝฟ็จใใใใจใฏใงใใพใใใใใใงใชใๅ ดๅใฏใ`pip install accelerate`ใใฆใใ ใใใ Accelerate ใฎใใผใธใงใณใๆดๆฐใใๅฟ
่ฆใใใๅ ดๅใใใใพใ: `pip install activate --upgrade`
+2. `accelerate config`ใๅฎ่กใใใขใณใฑใผใใซ่จๅ
ฅใใพใใไปฅไธใฏๅ ้่จญๅฎใฎไพใงใใ
+ ๏ฝ๏ผ DDP ใใซใใใผใ ใใซใ GPU ๆงๆ:
+ ```yaml
+ compute_environment: LOCAL_MACHINE
+ distributed_type: MULTI_GPU
+ downcast_bf16: 'no'
+ gpu_ids: all
+ machine_rank: 0 #change rank as per the node
+ main_process_ip: 192.168.20.1
+ main_process_port: 9898
+ main_training_function: main
+ mixed_precision: fp16
+ num_machines: 2
+ num_processes: 8
+ rdzv_backend: static
+ same_network: true
+ tpu_env: []
+ tpu_use_cluster: false
+ tpu_use_sudo: false
+ use_cpu: false
+ ```
+
+ b. FSDP config:
+ ```yaml
+ compute_environment: LOCAL_MACHINE
+ distributed_type: FSDP
+ downcast_bf16: 'no'
+ fsdp_config:
+ fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
+ fsdp_backward_prefetch_policy: BACKWARD_PRE
+ fsdp_forward_prefetch: true
+ fsdp_offload_params: false
+ fsdp_sharding_strategy: 1
+ fsdp_state_dict_type: FULL_STATE_DICT
+ fsdp_sync_module_states: true
+ fsdp_transformer_layer_cls_to_wrap: BertLayer
+ fsdp_use_orig_params: true
+ machine_rank: 0
+ main_training_function: main
+ mixed_precision: bf16
+ num_machines: 1
+ num_processes: 2
+ rdzv_backend: static
+ same_network: true
+ tpu_env: []
+ tpu_use_cluster: false
+ tpu_use_sudo: false
+ use_cpu: false
+ ```
+ c.ใใกใคใซใๆใ DeepSpeed ๆงๆ:
+ ```yaml
+ compute_environment: LOCAL_MACHINE
+ deepspeed_config:
+ deepspeed_config_file: /home/user/configs/ds_zero3_config.json
+ zero3_init_flag: true
+ distributed_type: DEEPSPEED
+ downcast_bf16: 'no'
+ machine_rank: 0
+ main_training_function: main
+ num_machines: 1
+ num_processes: 4
+ rdzv_backend: static
+ same_network: true
+ tpu_env: []
+ tpu_use_cluster: false
+ tpu_use_sudo: false
+ use_cpu: false
+ ```
+
+ d.ๅ ้ใใฉใฐใคใณใไฝฟ็จใใ DeepSpeed ๆงๆ:
+
+ ```yaml
+ compute_environment: LOCAL_MACHINE
+ deepspeed_config:
+ gradient_accumulation_steps: 1
+ gradient_clipping: 0.7
+ offload_optimizer_device: cpu
+ offload_param_device: cpu
+ zero3_init_flag: true
+ zero_stage: 2
+ distributed_type: DEEPSPEED
+ downcast_bf16: 'no'
+ machine_rank: 0
+ main_training_function: main
+ mixed_precision: bf16
+ num_machines: 1
+ num_processes: 4
+ rdzv_backend: static
+ same_network: true
+ tpu_env: []
+ tpu_use_cluster: false
+ tpu_use_sudo: false
+ use_cpu: false
+ ```
+
+3. ๅ ้่จญๅฎใพใใฏใฉใณใใฃใผๅผๆฐใซใใฃใฆไธ่จใงๅฆ็ใใใๅผๆฐไปฅๅคใฎๅผๆฐใไฝฟ็จใใฆใใใฌใผใใผ ในใฏใชใใใๅฎ่กใใพใใ
+ไปฅไธใฏใไธ่จใฎ FSDP ๆงๆใง`accelerate launcher`ใไฝฟ็จใใฆ`run_glue.py`ใๅฎ่กใใไพใงใใ
+
+```bash
+cd transformers
+
+accelerate launch \
+./examples/pytorch/text-classification/run_glue.py \
+--model_name_or_path google-bert/bert-base-cased \
+--task_name $TASK_NAME \
+--do_train \
+--do_eval \
+--max_seq_length 128 \
+--per_device_train_batch_size 16 \
+--learning_rate 5e-5 \
+--num_train_epochs 3 \
+--output_dir /tmp/$TASK_NAME/ \
+--overwrite_output_dir
+```
+
+4. `accelerate launch`ใใใใใฎ cmd ๅผๆฐใ็ดๆฅไฝฟ็จใใใใจใใงใใพใใไธใฎไพใฏๆฌกใฎใใใซใใใใณใฐใใใพใใ
+
+```bash
+cd transformers
+
+accelerate launch --num_processes=2 \
+--use_fsdp \
+--mixed_precision=bf16 \
+--fsdp_auto_wrap_policy=TRANSFORMER_BASED_WRAP \
+--fsdp_transformer_layer_cls_to_wrap="BertLayer" \
+--fsdp_sharding_strategy=1 \
+--fsdp_state_dict_type=FULL_STATE_DICT \
+./examples/pytorch/text-classification/run_glue.py
+--model_name_or_path google-bert/bert-base-cased \
+--task_name $TASK_NAME \
+--do_train \
+--do_eval \
+--max_seq_length 128 \
+--per_device_train_batch_size 16 \
+--learning_rate 5e-5 \
+--num_train_epochs 3 \
+--output_dir /tmp/$TASK_NAME/ \
+--overwrite_output_dir
+```
+
+่ฉณ็ดฐใซใคใใฆใฏใ๐ค Accelerate CLI ใฌใคใใๅ็
งใใฆใใ ใใ: [๐ค Accelerate ในใฏใชใใใฎ่ตทๅ](https://huggingface.co/docs/accelerate/basic_tutorials/launch)ใ
+
+็งปๅใใใใปใฏใทใงใณ:
+
+[ DeepSpeed
+| Installation
+| Deployment with multiple GPUs
+| Deployment with one GPU
+| Deployment in Notebooks
+| Configuration
+| Passing Configuration
+| Shared Configuration
+| ZeRO
+| ZeRO-2 Config
+| ZeRO-3 Config
+| NVMe Support
+| ZeRO-2 vs ZeRO-3 Performance
+| ZeRO-2 Example
+| ZeRO-3 Example
+| Optimizer
+| Scheduler
+| fp32 Precision
+| Automatic Mixed Precision
+| Batch Size
+| Gradient Accumulation
+| Gradient Clipping
+| Getting The Model Weights Out
+]
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/albert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/albert.md
new file mode 100644
index 0000000000000000000000000000000000000000..00403ea53765366def2026881ac4e47859154ee5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/albert.md
@@ -0,0 +1,193 @@
+
+
+# ALBERT
+
+
+
+## ๆฆ่ฆ
+
+ALBERTใขใใซใฏใใ[ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942)ใใจใใ่ซๆใงZhenzhong LanใMingda ChenใSebastian GoodmanใKevin GimpelใPiyush SharmaใRadu SoricutใซใใฃใฆๆๆกใใใพใใใBERTใฎใกใขใชๆถ่ฒปใๆธใใใใฌใผใใณใฐใ้ซ้ๅใใใใใฎใใฉใกใผใฟๅๆธๆ่กใ2ใค็คบใใฆใใพใ๏ผ
+
+- ๅใ่พผใฟ่กๅใ2ใคใฎๅฐใใช่กๅใซๅๅฒใใใ
+- ใฐใซใผใ้ใงๅๅฒใใใ็นฐใ่ฟใๅฑคใไฝฟ็จใใใ
+
+่ซๆใฎ่ฆๆจใฏไปฅไธใฎ้ใใงใ๏ผ
+
+*่ช็ถ่จ่ช่กจ็พใฎไบๅๅญฆ็ฟๆใซใขใใซใฎใตใคใบใๅขใใใจใไธๆตใฟในใฏใฎใใใฉใผใใณในใๅไธใใใใจใใใฐใใฐใใใพใใใใใใใใๆ็นใงใใใชใใขใใซใฎๅขๅคงใฏใGPU/TPUใฎใกใขใชๅถ้ใ้ทใ่จ็ทดๆ้ใไบๆใใฌใขใใซใฎๅฃๅใจใใฃใๅ้กใฎใใใซๅฐ้ฃใซใชใใพใใใใใใฎๅ้กใซๅฏพๅฆใใใใใซใๆใ
ใฏBERTใฎใกใขใชๆถ่ฒปใไฝๆธใใ่จ็ทด้ๅบฆใ้ซใใใใใฎ2ใคใฎใใฉใกใผใฟๅๆธๆ่กใๆๆกใใพใใๅ
ๆฌ็ใชๅฎ่จผ็่จผๆ ใฏใๆใ
ใฎๆๆกๆนๆณใๅ
ใฎBERTใซๆฏในใฆใฏใใใซใใในใฑใผใซใใใขใใซใ็ใฟๅบใใใจใ็คบใใฆใใพใใใพใใๆ้ใฎไธ่ฒซๆงใใขใใชใณใฐใซ็ฆ็นใๅฝใฆใ่ชๅทฑๆๅธซใใๆๅคฑใไฝฟ็จใใ่คๆฐใฎๆใๅซใพใใไธๆตใฟในใฏใซไธ่ฒซใใฆๅฉใใจใชใใใจใ็คบใใพใใใใฎ็ตๆใๆใ
ใฎๆ่ฏใฎใขใใซใฏใBERT-largeใซๆฏในใฆใใฉใกใผใฟใๅฐใชใใซใใใใใใใGLUEใRACEใSQuADใใณใใใผใฏใงๆฐใใชๆๅ
็ซฏใฎ็ตๆใ็ขบ็ซใใพใใ*
+
+ใใฎใขใใซใฏ[lysandre](https://huggingface.co/lysandre)ใซใใๆไพใใใพใใใใใฎใขใใซใฎjaxใใผใธใงใณใฏ[kamalkraj](https://huggingface.co/kamalkraj)ใซใใๆไพใใใพใใใใชใชใธใใซใฎใณใผใใฏ[ใใกใ](https://github.com/google-research/ALBERT)ใง่ฆใใใจใใงใใพใใ
+
+## ไฝฟ็จไธใฎใใณใ
+
+- ALBERTใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใไฝฟ็จใใใขใใซใชใฎใงใ้ๅธธใๅ
ฅๅใๅทฆๅดใงใฏใชใๅณๅดใซใใใฃใณใฐใใใใจใๆจๅฅจใใใพใใ
+- ALBERTใฏ็นฐใ่ฟใๅฑคใไฝฟ็จใใใใใกใขใชไฝฟ็จ้ใฏๅฐใใใชใใพใใใๅใๆฐใฎ๏ผ็นฐใ่ฟใ๏ผๅฑคใๅๅพฉใใชใใใฐใชใใชใใใใ้ ใๅฑคใฎๆฐใๅใใงใใใฐBERTใฎใใใชใขใผใญใใฏใใฃใจๅๆงใฎ่จ็ฎใณในใใใใใใพใใ
+- ๅใ่พผใฟใตใคใบEใฏ้ ใใตใคใบHใจ็ฐใชใใพใใใใใใฏๅใ่พผใฟใๆ่ใซไพๅญใใชใ๏ผไธใคใฎๅใ่พผใฟใใฏใใซใไธใคใฎใใผใฏใณใ่กจใ๏ผใฎใซๅฏพใใ้ ใ็ถๆ
ใฏๆ่ใซไพๅญใใ๏ผ1ใคใฎ้ ใ็ถๆ
ใใใผใฏใณ็ณปๅใ่กจใ๏ผใใใH >> Eใจใใใใจใใใ่ซ็็ใงใใใพใใๅใ่พผใฟ่กๅใฎใตใคใบใฏV x Eใจๅคงใใใงใ๏ผVใฏ่ชๅฝใตใคใบ๏ผใE < Hใงใใใฐใใใฉใกใผใฟใฏๅฐใชใใชใใพใใ
+- ๅฑคใฏใใฉใกใผใฟใๅ
ฑๆใใใฐใซใผใใซๅๅฒใใใฆใใพใ๏ผใกใขใช็ฏ็ดใฎใใ๏ผใๆฌกๆไบๆธฌ๏ผNSP: Next Sentence Prediction๏ผใฏๆใฎ้ ๅบไบๆธฌใซ็ฝฎใๆใใใใพใ๏ผๅ
ฅๅใงใฏใ2ใคใฎๆAใจB๏ผใใใใฏ้ฃ็ถใใฆใใ๏ผใใใใAใซ็ถใใฆBใไธใใใใBใซ็ถใใฆAใไธใใพใใใขใใซใฏใใใใๅ
ฅใๆฟใใฃใฆใใใใฉใใใไบๆธฌใใๅฟ
่ฆใใใใพใใ
+
+## ๅ่่ณๆ
+
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅฟ็ญใฟในใฏใฌใคใ](../tasks/question_answering)
+- [ใในใฏใใใ่จ่ชใขใใซใฟในใฏใฌใคใ](../tasks/masked_language_modeling)
+- [ๅค่ข้ธๆใฟในใฏใฌใคใ](../tasks/multiple_choice)
+
+## AlbertConfig
+
+[[autodoc]] AlbertConfig
+
+## AlbertTokenizer
+
+[[autodoc]] AlbertTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## AlbertTokenizerFast
+
+[[autodoc]] AlbertTokenizerFast
+
+## Albert specific outputs
+
+[[autodoc]] models.albert.modeling_albert.AlbertForPreTrainingOutput
+
+[[autodoc]] models.albert.modeling_tf_albert.TFAlbertForPreTrainingOutput
+
+
+
+
+## AlbertModel
+
+[[autodoc]] AlbertModel
+ - forward
+
+## AlbertForPreTraining
+
+[[autodoc]] AlbertForPreTraining
+ - forward
+
+## AlbertForMaskedLM
+
+[[autodoc]] AlbertForMaskedLM
+ - forward
+
+## AlbertForSequenceClassification
+
+[[autodoc]] AlbertForSequenceClassification
+ - forward
+
+## AlbertForMultipleChoice
+
+[[autodoc]] AlbertForMultipleChoice
+
+## AlbertForTokenClassification
+
+[[autodoc]] AlbertForTokenClassification
+ - forward
+
+## AlbertForQuestionAnswering
+
+[[autodoc]] AlbertForQuestionAnswering
+ - forward
+
+
+
+
+
+## TFAlbertModel
+
+[[autodoc]] TFAlbertModel
+ - call
+
+## TFAlbertForPreTraining
+
+[[autodoc]] TFAlbertForPreTraining
+ - call
+
+## TFAlbertForMaskedLM
+
+[[autodoc]] TFAlbertForMaskedLM
+ - call
+
+## TFAlbertForSequenceClassification
+
+[[autodoc]] TFAlbertForSequenceClassification
+ - call
+
+## TFAlbertForMultipleChoice
+
+[[autodoc]] TFAlbertForMultipleChoice
+ - call
+
+## TFAlbertForTokenClassification
+
+[[autodoc]] TFAlbertForTokenClassification
+ - call
+
+## TFAlbertForQuestionAnswering
+
+[[autodoc]] TFAlbertForQuestionAnswering
+ - call
+
+
+
+
+## FlaxAlbertModel
+
+[[autodoc]] FlaxAlbertModel
+ - __call__
+
+## FlaxAlbertForPreTraining
+
+[[autodoc]] FlaxAlbertForPreTraining
+ - __call__
+
+## FlaxAlbertForMaskedLM
+
+[[autodoc]] FlaxAlbertForMaskedLM
+ - __call__
+
+## FlaxAlbertForSequenceClassification
+
+[[autodoc]] FlaxAlbertForSequenceClassification
+ - __call__
+
+## FlaxAlbertForMultipleChoice
+
+[[autodoc]] FlaxAlbertForMultipleChoice
+ - __call__
+
+## FlaxAlbertForTokenClassification
+
+[[autodoc]] FlaxAlbertForTokenClassification
+ - __call__
+
+## FlaxAlbertForQuestionAnswering
+
+[[autodoc]] FlaxAlbertForQuestionAnswering
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/align.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/align.md
new file mode 100644
index 0000000000000000000000000000000000000000..84496e605def922dcc1e11258e07b566d12fadec
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/align.md
@@ -0,0 +1,104 @@
+
+
+# ALIGN
+
+## ๆฆ่ฆ
+
+ALIGNใขใใซใฏใใ[Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision](https://arxiv.org/abs/2102.05918)ใใจใใ่ซๆใงChao JiaใYinfei YangใYe XiaใYi-Ting ChenใZarana ParekhใHieu PhamใQuoc V. LeใYunhsuan SungใZhen LiใTom DuerigใซใใฃใฆๆๆกใใใพใใใALIGNใฏใใซใใขใผใใซใช่ฆ่ฆ่จ่ชใขใใซใงใใใใใฏ็ปๅใจใใญในใใฎ้กไผผๅบฆใใใผใญใทใงใใ็ปๅๅ้กใซไฝฟ็จใงใใพใใALIGNใฏ[EfficientNet](efficientnet)ใ่ฆ่ฆใจใณใณใผใใผใจใใฆใ[BERT](bert)ใใใญในใใจใณใณใผใใผใจใใฆๆญ่ผใใใใฅใขใซใจใณใณใผใใผๆง้ ใ็นๅพดใจใใๅฏพ็
งๅญฆ็ฟใซใใฃใฆ่ฆ่ฆใจใใญในใใฎ่กจ็พใๆดๅใใใใใจใๅญฆใณใพใใใใใพใงใฎ็ ็ฉถใจใฏ็ฐใชใใALIGNใฏๅทจๅคงใงใใคใธใผใชใใผใฟใปใใใๆดป็จใใใณใผใในใฎในใฑใผใซใๅฉ็จใใฆๅ็ดใชๆนๆณใชใใๆๅ
็ซฏใฎ่กจ็พใ้ๆใงใใใใจใ็คบใใฆใใพใใ
+
+่ซๆใฎ่ฆๆจใฏไปฅไธใฎ้ใใงใ๏ผ
+
+*ไบๅๅญฆ็ฟใใใ่กจ็พใฏใๅคใใฎ่ช็ถ่จ่ชๅฆ็๏ผNLP๏ผใใใณ็ฅ่ฆใฟในใฏใซใจใฃใฆ้่ฆใซใชใฃใฆใใพใใNLPใซใใใ่กจ็พๅญฆ็ฟใฏใไบบ้ใฎใขใใใผใทใงใณใฎใชใ็ใฎใใญในใใงใฎๅญฆ็ฟใธใจ็งป่กใใฆใใพใใใ่ฆ่ฆใใใณ่ฆ่ฆ่จ่ชใฎ่กจ็พใฏไพ็ถใจใใฆ็ฒพๅทงใชๅญฆ็ฟใใผใฟใปใใใซๅคงใใไพๅญใใฆใใใใใใฏ้ซไพกใงใใฃใใๅฐ้็ฅ่ญใๅฟ
่ฆใจใใใใใพใใ่ฆ่ฆใขใใชใฑใผใทใงใณใฎๅ ดๅใImageNetใOpenImagesใฎใใใชๆ็คบ็ใชใฏใฉในใฉใใซใๆใคใใผใฟใปใใใไฝฟ็จใใฆๅญฆ็ฟใใใใใจใใปใจใใฉใงใใ่ฆ่ฆ่จ่ชใฎๅ ดๅใConceptual CaptionsใMSCOCOใCLIPใชใฉใฎไบบๆฐใฎใใใใผใฟใปใใใฏใในใฆใใใใใ็ก่ฆใงใใชใใใผใฟๅ้๏ผใใใณใฏใชใผใใณใฐ๏ผใใญใปในใๅซใฟใพใใใใฎใณในใใฎใใใใญใฅใฌใผใทใงใณใใญใปในใฏใใผใฟใปใใใฎใตใคใบใๅถ้ใใ่จ็ทดใใใใขใใซใฎในใฑใผใชใณใฐใๅฆจใใพใใๆฌ่ซๆใงใฏใConceptual Captionsใใผใฟใปใใใฎ้ซไพกใชใใฃใซใฟใชใณใฐใๅพๅฆ็ในใใใใชใใงๅพใใใใ10ๅใ่ถ
ใใ็ปๅalt-textใใขใฎใใคใบใฎๅคใใใผใฟใปใใใๆดป็จใใพใใใทใณใใซใชใใฅใขใซใจใณใณใผใใผใขใผใญใใฏใใฃใฏใๅฏพ็
งๆๅคฑใไฝฟ็จใใฆ็ปๅใจใใญในใใใขใฎ่ฆ่ฆ็ใใใณ่จ่ช็่กจ็พใๆดๅใใใใใจใๅญฆ็ฟใใพใใๆใ
ใฏใใณใผใในใฎ่ฆๆจกใใใฎใใคใบใ่ฃใใใใฎใใใชๅ็ดใชๅญฆ็ฟในใญใผใ ใงใๆๅ
็ซฏใฎ่กจ็พใซใคใชใใใใจใ็คบใใพใใๆใ
ใฎ่ฆ่ฆ่กจ็พใฏใImageNetใVTABใชใฉใฎๅ้กใฟในใฏใธใฎ่ปข็งปใซใใใฆๅผทๅใชๆง่ฝใ็บๆฎใใพใใๆดๅใใ่ฆ่ฆ็ใใใณ่จ่ช็่กจ็พใฏใใผใญใทใงใใ็ปๅๅ้กใๅฏ่ฝใซใใใพใใใใๆด็ทดใใใใฏใญในใขใใณใทใงใณใขใใซใจๆฏ่ผใใฆใใFlickr30KใใใณMSCOCO็ปๅใใญในใๆค็ดขใใณใใใผใฏใซใใใฆๆฐใใชๆๅ
็ซฏใฎ็ตๆใ้ๆใใพใใใพใใใใใใฎ่กจ็พใฏใ่ค้ใชใใญในใใใใณใใญในใ+็ปๅใฎใฏใจใชใ็จใใใฏใญในใขใผใใซๆค็ดขใๅฏ่ฝใซใใพใใ*
+
+ใใฎใขใใซใฏ[Alara Dirik](https://huggingface.co/adirik)ใซใใๆไพใใใพใใใ
+ใชใชใธใใซใฎใณใผใใฏๅ
ฌ้ใใใฆใใใใใใฎๅฎ่ฃ
ใฏๅ
่ซๆใซๅบใฅใใKakao Brainใฎๅฎ่ฃ
ใใใผในใซใใฆใใพใใ
+
+## ไฝฟ็จไพ
+
+ALIGNใฏEfficientNetใไฝฟ็จใใฆ่ฆ่ฆ็็นๅพดใใBERTใไฝฟ็จใใฆใใญในใ็นๅพดใๅๅพใใพใใใใญในใใจ่ฆ่ฆใฎไธกๆนใฎ็นๅพดใฏใๅไธใฎๆฌกๅ
ใๆใคๆฝๅจ็ฉบ้ใซๅฐๅฝฑใใใพใใๅฐๅฝฑใใใ็ปๅใจใใญในใ็นๅพด้ใฎใใใ็ฉใ้กไผผๅบฆในใณใขใจใใฆไฝฟ็จใใใพใใ
+
+[`AlignProcessor`]ใฏใใใญในใใฎใจใณใณใผใใจ็ปๅใฎๅๅฆ็ใไธกๆน่กใใใใซใ[`EfficientNetImageProcessor`]ใจ[`BertTokenizer`]ใๅไธใฎใคใณในใฟใณในใซใฉใใใใพใใไปฅไธใฎไพใฏใ[`AlignProcessor`]ใจ[`AlignModel`]ใไฝฟ็จใใฆ็ปๅ-ใใญในใ้กไผผๅบฆในใณใขใๅๅพใใๆนๆณใ็คบใใฆใใพใใ
+
+```python
+import requests
+import torch
+from PIL import Image
+from transformers import AlignProcessor, AlignModel
+
+processor = AlignProcessor.from_pretrained("kakaobrain/align-base")
+model = AlignModel.from_pretrained("kakaobrain/align-base")
+
+url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+image = Image.open(requests.get(url, stream=True).raw)
+candidate_labels = ["an image of a cat", "an image of a dog"]
+
+inputs = processor(text=candidate_labels, images=image, return_tensors="pt")
+
+with torch.no_grad():
+ outputs = model(**inputs)
+
+# this is the image-text similarity score
+logits_per_image = outputs.logits_per_image
+
+# we can take the softmax to get the label probabilities
+probs = logits_per_image.softmax(dim=1)
+print(probs)
+```
+
+## ๅ่่ณๆ
+
+ALIGNใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผใฎHugging Faceใจใณใใฅใใใฃ๏ผ๐ใง็คบใใใฆใใ๏ผใฎๅ่่ณๆใฎไธ่ฆงใงใใ
+
+- [ALIGNใจCOYO-700Mใใผใฟใปใใ](https://huggingface.co/blog/vit-align)ใซ้ขใใใใญใฐๆ็จฟใ
+- ใผใญใทใงใใ็ปๅๅ้ก[ใใข](https://huggingface.co/spaces/adirik/ALIGN-zero-shot-image-classification)ใ
+- `kakaobrain/align-base` ใขใใซใฎ[ใขใใซใซใผใ](https://huggingface.co/kakaobrain/align-base)ใ
+
+ใใใซๅ่่ณๆใๆๅบใใใๅ ดๅใฏใๆฐๅ
ผใญใชใPull Requestใ้ใใฆใใ ใใใ็งใใกใฏใใใใฌใใฅใผใใใใพใ๏ผๅ่่ณๆใฏใๆขๅญใฎใใฎใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใจใ็คบใใใจใ็ๆณ็ใงใใ
+
+## AlignConfig
+
+[[autodoc]] AlignConfig
+ - from_text_vision_configs
+
+## AlignTextConfig
+
+[[autodoc]] AlignTextConfig
+
+## AlignVisionConfig
+
+[[autodoc]] AlignVisionConfig
+
+## AlignProcessor
+
+[[autodoc]] AlignProcessor
+
+## AlignModel
+
+[[autodoc]] AlignModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## AlignTextModel
+
+[[autodoc]] AlignTextModel
+ - forward
+
+## AlignVisionModel
+
+[[autodoc]] AlignVisionModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/altclip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/altclip.md
new file mode 100644
index 0000000000000000000000000000000000000000..87cf6cc17d6a0becd1c74cc161c3d3e3365d0b18
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/altclip.md
@@ -0,0 +1,97 @@
+
+
+# AltCLIP
+
+## ๆฆ่ฆ
+
+
+AltCLIPใขใใซใฏใใ[AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities](https://arxiv.org/abs/2211.06679v2)ใใจใใ่ซๆใงZhongzhi ChenใGuang LiuใBo-Wen ZhangใFulong YeใQinghong YangใLedell WuใซใใฃใฆๆๆกใใใพใใใAltCLIP๏ผCLIPใฎ่จ่ชใจใณใณใผใใผใฎไปฃๆฟ๏ผใฏใๆงใ
ใช็ปๅ-ใใญในใใใขใใใณใใญในใ-ใใญในใใใขใงใใฌใผใใณใฐใใใใใฅใผใฉใซใใใใฏใผใฏใงใใCLIPใฎใใญในใใจใณใณใผใใผใไบๅๅญฆ็ฟๆธใฟใฎๅค่จ่ชใใญในใใจใณใณใผใใผXLM-Rใซ็ฝฎใๆใใใใจใงใใปใผๅ
จใฆใฎใฟในใฏใงCLIPใซ้ๅธธใซ่ฟใๆง่ฝใๅพใใใใชใชใธใใซใฎCLIPใฎ่ฝๅใๅค่จ่ช็่งฃใชใฉใซๆกๅผตใใพใใใ
+
+่ซๆใฎ่ฆๆจใฏไปฅไธใฎ้ใใงใ๏ผ
+
+*ใใฎ็ ็ฉถใงใฏใๅผทๅใชใใคใชใณใฌใซใใซใใขใผใใซ่กจ็พใขใใซใ่จ็ทดใใใใใฎๆฆๅฟต็ใซๅ็ดใงๅนๆ็ใชๆนๆณใๆๆกใใพใใOpenAIใซใใฃใฆใชใชใผในใใใใใซใใขใผใใซ่กจ็พใขใใซCLIPใใ้ๅงใใใใฎใใญในใใจใณใณใผใใไบๅๅญฆ็ฟๆธใฟใฎๅค่จ่ชใใญในใใจใณใณใผใXLM-Rใซไบคๆใใๆๅธซๅญฆ็ฟใจๅฏพ็
งๅญฆ็ฟใใใชใ2ๆฎต้ใฎใใฌใผใใณใฐในใญใผใใ็จใใฆ่จ่ชใจ็ปๅใฎ่กจ็พใๆดๅใใใพใใใๅน
ๅบใใฟในใฏใฎ่ฉไพกใ้ใใฆใๆใ
ใฎๆนๆณใๆค่จผใใพใใImageNet-CNใFlicker30k-CNใCOCO-CNใๅซใๅคใใฎใฟในใฏใงๆฐใใชๆๅ
็ซฏใฎๆง่ฝใ้ๆใใพใใใใใใซใใปใผใในใฆใฎใฟในใฏใงCLIPใซ้ๅธธใซ่ฟใๆง่ฝใๅพใฆใใใใใใฏCLIPใฎใใญในใใจใณใณใผใใๅคๆดใใใ ใใงใๅค่จ่ช็่งฃใชใฉใฎๆกๅผตใๅฎ็พใงใใใใจใ็คบๅใใฆใใพใใ*
+
+ใใฎใขใใซใฏ[jongjyh](https://huggingface.co/jongjyh)ใซใใๆไพใใใพใใใ
+
+## ไฝฟ็จไธใฎใใณใใจไฝฟ็จไพ
+
+AltCLIPใฎไฝฟ็จๆนๆณใฏCLIPใซ้ๅธธใซไผผใฆใใพใใCLIPใจใฎ้ใใฏใใญในใใจใณใณใผใใผใซใใใพใใ็งใใกใฏใซใธใฅใขใซใขใใณใทใงใณใงใฏใชใๅๆนๅใขใใณใทใงใณใไฝฟ็จใใXLM-Rใฎ[CLS]ใใผใฏใณใใใญในใๅใ่พผใฟใ่กจใใใฎใจใใฆๅใใใจใซ็ๆใใฆใใ ใใใ
+
+AltCLIPใฏใใซใใขใผใใซใช่ฆ่ฆ่จ่ชใขใใซใงใใใใใฏ็ปๅใจใใญในใใฎ้กไผผๅบฆใใใผใญใทใงใใ็ปๅๅ้กใซไฝฟ็จใงใใพใใAltCLIPใฏViTใฎใใใชTransformerใไฝฟ็จใใฆ่ฆ่ฆ็็นๅพดใใๅๆนๅ่จ่ชใขใใซใไฝฟ็จใใฆใใญในใ็นๅพดใๅๅพใใพใใใใญในใใจ่ฆ่ฆใฎไธกๆนใฎ็นๅพดใฏใๅไธใฎๆฌกๅ
ใๆใคๆฝๅจ็ฉบ้ใซๅฐๅฝฑใใใพใใๅฐๅฝฑใใใ็ปๅใจใใญในใ็นๅพด้ใฎใใใ็ฉใ้กไผผๅบฆในใณใขใจใใฆไฝฟ็จใใใพใใ
+
+Transformerใจใณใณใผใใผใซ็ปๅใไธใใใซใฏใๅ็ปๅใๅบๅฎใตใคใบใฎ้่คใใชใใใใใฎ็ณปๅใซๅๅฒใใใใใใ็ทๅฝขใซๅใ่พผใฟใพใใ็ปๅๅ
จไฝใ่กจ็พใใใใใฎ[CLS]ใใผใฏใณใ่ฟฝๅ ใใใพใใ่่
ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใ่ฟฝๅ ใใ็ตๆใจใใฆๅพใใใใใฏใใซใฎ็ณปๅใๆจๆบ็ใชTransformerใจใณใณใผใใผใซไพ็ตฆใใพใใ[`CLIPImageProcessor`]ใไฝฟ็จใใฆใใขใใซใฎใใใซ็ปๅใฎใตใคใบๅคๆด๏ผใพใใฏๆกๅคง็ธฎๅฐ๏ผใจๆญฃ่ฆๅใ่กใใใจใใงใใพใใ
+
+[`AltCLIPProcessor`]ใฏใใใญในใใฎใจใณใณใผใใจ็ปๅใฎๅๅฆ็ใไธกๆน่กใใใใซใ[`CLIPImageProcessor`]ใจ[`XLMRobertaTokenizer`]ใๅไธใฎใคใณในใฟใณในใซใฉใใใใพใใไปฅไธใฎไพใฏใ[`AltCLIPProcessor`]ใจ[`AltCLIPModel`]ใไฝฟ็จใใฆ็ปๅ-ใใญในใ้กไผผในใณใขใๅๅพใใๆนๆณใ็คบใใฆใใพใใ
+
+```python
+>>> from PIL import Image
+>>> import requests
+
+>>> from transformers import AltCLIPModel, AltCLIPProcessor
+
+>>> model = AltCLIPModel.from_pretrained("BAAI/AltCLIP")
+>>> processor = AltCLIPProcessor.from_pretrained("BAAI/AltCLIP")
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
+
+>>> outputs = model(**inputs)
+>>> logits_per_image = outputs.logits_per_image # this is the image-text similarity score
+>>> probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
+```
+
+
+
+ใใฎใขใใซใฏ`CLIPModel`ใใใผในใซใใฆใใใใชใชใธใใซใฎ[CLIP](clip)ใจๅใใใใซไฝฟ็จใใฆใใ ใใใ
+
+
+
+## AltCLIPConfig
+
+[[autodoc]] AltCLIPConfig
+ - from_text_vision_configs
+
+## AltCLIPTextConfig
+
+[[autodoc]] AltCLIPTextConfig
+
+## AltCLIPVisionConfig
+
+[[autodoc]] AltCLIPVisionConfig
+
+## AltCLIPProcessor
+
+[[autodoc]] AltCLIPProcessor
+
+## AltCLIPModel
+
+[[autodoc]] AltCLIPModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## AltCLIPTextModel
+
+[[autodoc]] AltCLIPTextModel
+ - forward
+
+## AltCLIPVisionModel
+
+[[autodoc]] AltCLIPVisionModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/audio-spectrogram-transformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/audio-spectrogram-transformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..a5107b14f83a9800a2f68ac910161d3c646d7de5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/audio-spectrogram-transformer.md
@@ -0,0 +1,69 @@
+
+
+# Audio Spectrogram Transformer
+
+## ๆฆ่ฆ
+
+Audio Spectrogram Transformerใขใใซใฏใ[AST: Audio Spectrogram Transformer](https://arxiv.org/abs/2104.01778)ใจใใ่ซๆใงYuan GongใYu-An ChungใJames Glassใซใใฃใฆๆๆกใใใพใใใใใใฏใ้ณๅฃฐใ็ปๅ๏ผในใใฏใใญใฐใฉใ ๏ผใซๅคๆใใใใจใงใ้ณๅฃฐใซ[Vision Transformer](vit)ใ้ฉ็จใใพใใใใฎใขใใซใฏ้ณๅฃฐๅ้กใซใใใฆๆๅ
็ซฏใฎ็ตๆใๅพใฆใใพใใ
+
+่ซๆใฎ่ฆๆจใฏไปฅไธใฎ้ใใงใ๏ผ
+
+*้ๅป10ๅนด้ใงใ็ณใฟ่พผใฟใใฅใผใฉใซใใใใฏใผใฏ๏ผCNN๏ผใฏใ้ณๅฃฐในใใฏใใญใฐใฉใ ใใๅฏพๅฟใใใฉใใซใธใฎ็ดๆฅ็ใชใใใใณใฐใๅญฆ็ฟใใใใจใ็ฎๆใใใจใณใใใผใจใณใใฎ้ณๅฃฐๅ้กใขใใซใฎไธป่ฆใชๆงๆ่ฆ็ด ใจใใฆๅบใๆก็จใใใฆใใพใใใ้ท่ท้ขใฎใฐใญใผใใซใชใณใณใใญในใใใใ่ฏใๆใใใใใๆ่ฟใฎๅพๅใจใใฆใCNNใฎไธใซใปใซใใขใใณใทใงใณๆฉๆงใ่ฟฝๅ ใใCNN-ใขใใณใทใงใณใใคใใชใใใขใใซใๅฝขๆใใใใจใใใใพใใใใใใCNNใธใฎไพๅญใๅฟ
่ฆใใฉใใใใใใฆ็ด็ฒใซใขใใณใทใงใณใซๅบใฅใใใฅใผใฉใซใใใใฏใผใฏใ ใใง้ณๅฃฐๅ้กใซใใใฆ่ฏใใใใฉใผใใณในใๅพใใใจใใงใใใใฉใใใฏๆใใใงใฏใใใพใใใๆฌ่ซๆใงใฏใใใใใฎๅใใซ็ญใใใใใ้ณๅฃฐๅ้ก็จใงใฏๆๅใฎ็ณใฟ่พผใฟใชใใง็ด็ฒใซใขใใณใทใงใณใใผในใฎใขใใซใงใใAudio Spectrogram Transformer๏ผAST๏ผใ็ดนไปใใพใใๆใ
ใฏASTใๆงใ
ใชใชใผใใฃใชๅ้กใใณใใใผใฏใง่ฉไพกใใAudioSetใง0.485 mAPใESC-50ใง95.6%ใฎๆญฃ่งฃ็ใSpeech Commands V2ใง98.1%ใฎๆญฃ่งฃ็ใจใใๆฐใใชๆๅ
็ซฏใฎ็ตๆใ้ๆใใพใใใ*
+
+
+
+ Audio Spectrogram Transformerใฎใขใผใญใใฏใใฃใๅ
่ซๆ ใใๆ็ฒใ
+
+ใใฎใขใใซใฏ[nielsr](https://huggingface.co/nielsr)ใใๆไพใใใพใใใ
+ใชใชใธใใซใฎใณใผใใฏ[ใใกใ](https://github.com/YuanGongND/ast)ใง่ฆใใใจใใงใใพใใ
+
+## ไฝฟ็จไธใฎใใณใ
+
+- ็ฌ่ชใฎใใผใฟใปใใใงAudio Spectrogram Transformer๏ผAST๏ผใใใกใคใณใใฅใผใใณใฐใใๅ ดๅใๅ
ฅๅใฎๆญฃ่ฆๅ๏ผๅ
ฅๅใฎๅนณๅใ0ใๆจๆบๅๅทฎใ0.5ใซใใใใจ๏ผๅฆ็ใใใใจใๆจๅฅจใใใพใใ[`ASTFeatureExtractor`]ใฏใใใๅฆ็ใใพใใใใใฉใซใใงใฏAudioSetใฎๅนณๅใจๆจๆบๅๅทฎใไฝฟ็จใใฆใใใใจใซๆณจๆใใฆใใ ใใใ่่
ใไธๆตใฎใใผใฟใปใใใฎ็ตฑ่จใใฉใฎใใใซ่จ็ฎใใฆใใใใฏใ[`ast/src/get_norm_stats.py`](https://github.com/YuanGongND/ast/blob/master/src/get_norm_stats.py)ใง็ขบ่ชใใใใจใใงใใพใใ
+- ASTใฏไฝใๅญฆ็ฟ็ใๅฟ
่ฆใงใใ ่่
ใฏ[PSLA่ซๆ](https://arxiv.org/abs/2102.01243)ใงๆๆกใใใCNNใขใใซใซๆฏในใฆ10ๅๅฐใใๅญฆ็ฟ็ใไฝฟ็จใใฆใใพใ๏ผใ็ด ๆฉใๅๆใใใใใใฟในใฏใซ้ฉใใๅญฆ็ฟ็ใจๅญฆ็ฟ็ในใฑใธใฅใผใฉใผใๆขใใใจใใๅงใใใพใใ
+
+## ๅ่่ณๆ
+
+Audio Spectrogram Transformerใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผใฎHugging Faceใใใณใณใใฅใใใฃ๏ผ๐ใง็คบใใใฆใใ๏ผใฎๅ่่ณๆใฎไธ่ฆงใงใใ
+
+
+
+- ASTใ็จใใ้ณๅฃฐๅ้กใฎๆจ่ซใ่ชฌๆใใใใผใใใใฏใฏ[ใใกใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/AST)ใง่ฆใใใจใใงใใพใใ
+- [`ASTForAudioClassification`]ใฏใใใฎ[ไพ็คบในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/audio-classification)ใจ[ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb)ใซใใฃใฆใตใใผใใใใฆใใพใใ
+- ใใกใใๅ็
ง๏ผ[้ณๅฃฐๅ้กใฟในใฏ](../tasks/audio_classification)ใ
+
+ใใใซๅ่่ณๆใๆๅบใใใๅ ดๅใฏใๆฐๅ
ผใญใชใPull Requestใ้ใใฆใใ ใใใ็งใใกใฏใใใใฌใใฅใผใใใใพใ๏ผๅ่่ณๆใฏใๆขๅญใฎใใฎใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใจใ็คบใใใจใ็ๆณ็ใงใใ
+
+## ASTConfig
+
+[[autodoc]] ASTConfig
+
+## ASTFeatureExtractor
+
+[[autodoc]] ASTFeatureExtractor
+ - __call__
+
+## ASTModel
+
+[[autodoc]] ASTModel
+ - forward
+
+## ASTForAudioClassification
+
+[[autodoc]] ASTForAudioClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/auto.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/auto.md
new file mode 100644
index 0000000000000000000000000000000000000000..492c46c79ea9054f01f4d71a19644adab40b14de
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/auto.md
@@ -0,0 +1,374 @@
+
+
+# Auto Classes
+
+ๅคใใฎๅ ดๅใ`from_pretrained()`ใกใฝใใใซไธใใใใไบๅๅญฆ็ฟๆธใฟใขใใซใฎๅๅใใในใใใไฝฟ็จใใใใขใผใญใใฏใใฃใๆจๆธฌใใใใจใใงใใพใใ่ชๅใฏใฉในใฏใใฎไปไบใใใชใใซไปฃใใฃใฆ่กใใใใซใใใซใใใพใใฎใงใไบๅๅญฆ็ฟๆธใฟใฎ้ใฟ/่จญๅฎ/่ชๅฝใธใฎๅๅ/ใในใไธใใใจ่ชๅ็ใซ้ข้ฃใใใขใใซใๅๅพใงใใพใใ
+
+[`AutoConfig`]ใ[`AutoModel`]ใ[`AutoTokenizer`]ใฎใใใใใใคใณในใฟใณในๅใใใจใ้ข้ฃใใใขใผใญใใฏใใฃใฎใฏใฉในใ็ดๆฅไฝๆใใใพใใไพใใฐใ
+
+```python
+model = AutoModel.from_pretrained("google-bert/bert-base-cased")
+```
+
+ใใใฏ[`BertModel`]ใฎใคใณในใฟใณในใงใใใขใใซใไฝๆใใพใใ
+
+ๅใฟในใฏใใจใใใใฆๅใใใฏใจใณใ๏ผPyTorchใTensorFlowใใพใใฏFlax๏ผใใจใซ`AutoModel`ใฎใฏใฉในใๅญๅจใใพใใ
+
+## ่ชๅใฏใฉในใฎๆกๅผต
+
+ใใใใใฎ่ชๅใฏใฉในใซใฏใใซในใฟใ ใฏใฉในใงๆกๅผตใใใใใฎใกใฝใใใใใใพใใไพใใฐใ`NewModel`ใจใใใขใใซใฎใซในใฟใ ใฏใฉในใๅฎ็พฉใใๅ ดๅใ`NewModelConfig`ใ็ขบไฟใใฆใใใฐใใฎใใใซใใฆ่ชๅใฏใฉในใซ่ฟฝๅ ใใใใจใใงใใพใ๏ผ
+
+```python
+from transformers import AutoConfig, AutoModel
+
+AutoConfig.register("new-model", NewModelConfig)
+AutoModel.register(NewModelConfig, NewModel)
+```
+
+ใใฎๅพใ้ๅธธใฉใใauto classesใไฝฟ็จใใใใจใใงใใใใใซใชใใพใ๏ผ
+
+
+
+ใใชใใฎ`NewModelConfig`ใ[`~transformers.PretrainedConfig`]ใฎใตใใฏใฉในใงใใๅ ดๅใใใฎ`model_type`ๅฑๆงใใณใณใใฃใฐใ็ป้ฒใใใจใใซไฝฟ็จใใใญใผ๏ผใใใงใฏ`"new-model"`๏ผใจๅใใซ่จญๅฎใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+ๅๆงใซใใใชใใฎ`NewModel`ใ[`PreTrainedModel`]ใฎใตใใฏใฉในใงใใๅ ดๅใใใฎ`config_class`ๅฑๆงใใขใใซใ็ป้ฒใใ้ใซไฝฟ็จใใใฏใฉใน๏ผใใใงใฏ`NewModelConfig`๏ผใจๅใใซ่จญๅฎใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+## AutoConfig
+
+[[autodoc]] AutoConfig
+
+## AutoTokenizer
+
+[[autodoc]] AutoTokenizer
+
+## AutoFeatureExtractor
+
+[[autodoc]] AutoFeatureExtractor
+
+## AutoImageProcessor
+
+[[autodoc]] AutoImageProcessor
+
+## AutoProcessor
+
+[[autodoc]] AutoProcessor
+
+## Generic model classes
+
+ไปฅไธใฎ่ชๅใฏใฉในใฏใ็นๅฎใฎใใใใๆใใชใใใผในใขใใซใฏใฉในใใคใณในใฟใณในๅใใใใใซๅฉ็จๅฏ่ฝใงใใ
+
+### AutoModel
+
+[[autodoc]] AutoModel
+
+### TFAutoModel
+
+[[autodoc]] TFAutoModel
+
+### FlaxAutoModel
+
+[[autodoc]] FlaxAutoModel
+
+## Generic pretraining classes
+
+ไปฅไธใฎ่ชๅใฏใฉในใฏใไบๅๅญฆ็ฟใใใใๆใคใขใใซใใคใณในใฟใณในๅใใใใใซๅฉ็จๅฏ่ฝใงใใ
+
+### AutoModelForPreTraining
+
+[[autodoc]] AutoModelForPreTraining
+
+### TFAutoModelForPreTraining
+
+[[autodoc]] TFAutoModelForPreTraining
+
+### FlaxAutoModelForPreTraining
+
+[[autodoc]] FlaxAutoModelForPreTraining
+
+## Natural Language Processing
+
+ไปฅไธใฎ่ชๅใฏใฉในใฏใๆฌกใฎ่ช็ถ่จ่ชๅฆ็ใฟในใฏใซๅฉ็จๅฏ่ฝใงใใ
+
+### AutoModelForCausalLM
+
+[[autodoc]] AutoModelForCausalLM
+
+### TFAutoModelForCausalLM
+
+[[autodoc]] TFAutoModelForCausalLM
+
+### FlaxAutoModelForCausalLM
+
+[[autodoc]] FlaxAutoModelForCausalLM
+
+### AutoModelForMaskedLM
+
+[[autodoc]] AutoModelForMaskedLM
+
+### TFAutoModelForMaskedLM
+
+[[autodoc]] TFAutoModelForMaskedLM
+
+### FlaxAutoModelForMaskedLM
+
+[[autodoc]] FlaxAutoModelForMaskedLM
+
+### AutoModelForMaskGeneration
+
+[[autodoc]] AutoModelForMaskGeneration
+
+### TFAutoModelForMaskGeneration
+
+[[autodoc]] TFAutoModelForMaskGeneration
+
+### AutoModelForSeq2SeqLM
+
+[[autodoc]] AutoModelForSeq2SeqLM
+
+### TFAutoModelForSeq2SeqLM
+
+[[autodoc]] TFAutoModelForSeq2SeqLM
+
+### FlaxAutoModelForSeq2SeqLM
+
+[[autodoc]] FlaxAutoModelForSeq2SeqLM
+
+### AutoModelForSequenceClassification
+
+[[autodoc]] AutoModelForSequenceClassification
+
+### TFAutoModelForSequenceClassification
+
+[[autodoc]] TFAutoModelForSequenceClassification
+
+### FlaxAutoModelForSequenceClassification
+
+[[autodoc]] FlaxAutoModelForSequenceClassification
+
+### AutoModelForMultipleChoice
+
+[[autodoc]] AutoModelForMultipleChoice
+
+### TFAutoModelForMultipleChoice
+
+[[autodoc]] TFAutoModelForMultipleChoice
+
+### FlaxAutoModelForMultipleChoice
+
+[[autodoc]] FlaxAutoModelForMultipleChoice
+
+### AutoModelForNextSentencePrediction
+
+[[autodoc]] AutoModelForNextSentencePrediction
+
+### TFAutoModelForNextSentencePrediction
+
+[[autodoc]] TFAutoModelForNextSentencePrediction
+
+### FlaxAutoModelForNextSentencePrediction
+
+[[autodoc]] FlaxAutoModelForNextSentencePrediction
+
+### AutoModelForTokenClassification
+
+[[autodoc]] AutoModelForTokenClassification
+
+### TFAutoModelForTokenClassification
+
+[[autodoc]] TFAutoModelForTokenClassification
+
+### FlaxAutoModelForTokenClassification
+
+[[autodoc]] FlaxAutoModelForTokenClassification
+
+### AutoModelForQuestionAnswering
+
+[[autodoc]] AutoModelForQuestionAnswering
+
+### TFAutoModelForQuestionAnswering
+
+[[autodoc]] TFAutoModelForQuestionAnswering
+
+### FlaxAutoModelForQuestionAnswering
+
+[[autodoc]] FlaxAutoModelForQuestionAnswering
+
+### AutoModelForTextEncoding
+
+[[autodoc]] AutoModelForTextEncoding
+
+### TFAutoModelForTextEncoding
+
+[[autodoc]] TFAutoModelForTextEncoding
+
+## Computer vision
+
+ไปฅไธใฎ่ชๅใฏใฉในใฏใๆฌกใฎใณใณใใฅใผใฟใผใใธใงใณใฟในใฏใซๅฉ็จๅฏ่ฝใงใใ
+
+### AutoModelForDepthEstimation
+
+[[autodoc]] AutoModelForDepthEstimation
+
+### AutoModelForImageClassification
+
+[[autodoc]] AutoModelForImageClassification
+
+### TFAutoModelForImageClassification
+
+[[autodoc]] TFAutoModelForImageClassification
+
+### FlaxAutoModelForImageClassification
+
+[[autodoc]] FlaxAutoModelForImageClassification
+
+### AutoModelForVideoClassification
+
+[[autodoc]] AutoModelForVideoClassification
+
+### AutoModelForMaskedImageModeling
+
+[[autodoc]] AutoModelForMaskedImageModeling
+
+### TFAutoModelForMaskedImageModeling
+
+[[autodoc]] TFAutoModelForMaskedImageModeling
+
+### AutoModelForObjectDetection
+
+[[autodoc]] AutoModelForObjectDetection
+
+### AutoModelForImageSegmentation
+
+[[autodoc]] AutoModelForImageSegmentation
+
+### AutoModelForImageToImage
+
+[[autodoc]] AutoModelForImageToImage
+
+### AutoModelForSemanticSegmentation
+
+[[autodoc]] AutoModelForSemanticSegmentation
+
+### TFAutoModelForSemanticSegmentation
+
+[[autodoc]] TFAutoModelForSemanticSegmentation
+
+### AutoModelForInstanceSegmentation
+
+[[autodoc]] AutoModelForInstanceSegmentation
+
+### AutoModelForUniversalSegmentation
+
+[[autodoc]] AutoModelForUniversalSegmentation
+
+### AutoModelForZeroShotImageClassification
+
+[[autodoc]] AutoModelForZeroShotImageClassification
+
+### TFAutoModelForZeroShotImageClassification
+
+[[autodoc]] TFAutoModelForZeroShotImageClassification
+
+### AutoModelForZeroShotObjectDetection
+
+[[autodoc]] AutoModelForZeroShotObjectDetection
+
+## Audio
+
+ไปฅไธใฎ่ชๅใฏใฉในใฏใๆฌกใฎ้ณๅฃฐใฟในใฏใซๅฉ็จๅฏ่ฝใงใใ
+
+### AutoModelForAudioClassification
+
+[[autodoc]] AutoModelForAudioClassification
+
+### AutoModelForAudioFrameClassification
+
+[[autodoc]] TFAutoModelForAudioClassification
+
+### TFAutoModelForAudioFrameClassification
+
+[[autodoc]] AutoModelForAudioFrameClassification
+
+### AutoModelForCTC
+
+[[autodoc]] AutoModelForCTC
+
+### AutoModelForSpeechSeq2Seq
+
+[[autodoc]] AutoModelForSpeechSeq2Seq
+
+### TFAutoModelForSpeechSeq2Seq
+
+[[autodoc]] TFAutoModelForSpeechSeq2Seq
+
+### FlaxAutoModelForSpeechSeq2Seq
+
+[[autodoc]] FlaxAutoModelForSpeechSeq2Seq
+
+### AutoModelForAudioXVector
+
+[[autodoc]] AutoModelForAudioXVector
+
+### AutoModelForTextToSpectrogram
+
+[[autodoc]] AutoModelForTextToSpectrogram
+
+### AutoModelForTextToWaveform
+
+[[autodoc]] AutoModelForTextToWaveform
+
+## Multimodal
+
+ไปฅไธใฎ่ชๅใฏใฉในใฏใๆฌกใฎใใซใใขใผใใซใฟในใฏใซๅฉ็จๅฏ่ฝใงใใ
+
+### AutoModelForTableQuestionAnswering
+
+[[autodoc]] AutoModelForTableQuestionAnswering
+
+### TFAutoModelForTableQuestionAnswering
+
+[[autodoc]] TFAutoModelForTableQuestionAnswering
+
+### AutoModelForDocumentQuestionAnswering
+
+[[autodoc]] AutoModelForDocumentQuestionAnswering
+
+### TFAutoModelForDocumentQuestionAnswering
+
+[[autodoc]] TFAutoModelForDocumentQuestionAnswering
+
+### AutoModelForVisualQuestionAnswering
+
+[[autodoc]] AutoModelForVisualQuestionAnswering
+
+### AutoModelForVision2Seq
+
+[[autodoc]] AutoModelForVision2Seq
+
+### TFAutoModelForVision2Seq
+
+[[autodoc]] TFAutoModelForVision2Seq
+
+### FlaxAutoModelForVision2Seq
+
+[[autodoc]] FlaxAutoModelForVision2Seq
+
+### AutoModelForImageTextToText
+
+[[autodoc]] AutoModelForImageTextToText
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/autoformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/autoformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..b8b0948b960d6920a31f5150264ca1e1ee9c0c9f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/autoformer.md
@@ -0,0 +1,50 @@
+
+
+# Autoformer
+
+## ๆฆ่ฆ
+
+Autoformerใขใใซใฏใใ[Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting](https://arxiv.org/abs/2106.13008)ใใจใใ่ซๆใงHaixu WuใJiehui XuใJianmin WangใMingsheng Longใซใใฃใฆๆๆกใใใพใใใ
+
+ใใฎใขใใซใฏใไบๆธฌใใญใปในไธญใซใใฌใณใใจๅญฃ็ฏๆงๆๅใ้ๆฌก็ใซๅ่งฃใงใใๆทฑๅฑคๅ่งฃใขใผใญใใฏใใฃใจใใฆTransformerใๅขๅผทใใพใใ
+
+่ซๆใฎ่ฆๆจใฏไปฅไธใฎ้ใใงใ๏ผ
+
+*ไพใใฐ็ฐๅธธๆฐ่ฑกใฎๆฉๆ่ญฆๅใ้ทๆ็ใชใจใใซใฎใผๆถ่ฒป่จ็ปใจใใฃใๅฎๅฟ็จใซใใใฆใไบๆธฌๆ้ใๅปถ้ทใใใใจใฏ้่ฆใช่ฆๆฑใงใใๆฌ่ซๆใงใฏใๆ็ณปๅใฎ้ทๆไบๆธฌๅ้กใ็ ็ฉถใใฆใใพใใไปฅๅใฎTransformerใใผในใฎใขใใซใฏใ้ท่ท้ขไพๅญ้ขไฟใ็บ่ฆใใใใใซๆงใ
ใชใปใซใใขใใณใทใงใณๆฉๆงใๆก็จใใฆใใพใใใใใใ้ทๆๆชๆฅใฎ่ค้ใชๆ้็ใใฟใผใณใซใใฃใฆใขใใซใไฟก้ ผใงใใไพๅญ้ขไฟใ่ฆใคใใใใจใๅฆจใใใใพใใใพใใTransformerใฏใ้ทใ็ณปๅใฎๅน็ๅใฎใใใซใใคใณใใฏใคใบใชใปใซใใขใใณใทใงใณใฎในใใผในใใผใธใงใณใๆก็จใใๅฟ
่ฆใใใใๆ
ๅ ฑๅฉ็จใฎใใใซใใใฏใจใชใใพใใTransformerใ่ถ
ใใฆใๆใ
ใฏ่ชๅทฑ็ธ้ขๆฉๆงใๆใคๆฐใใๅ่งฃใขใผใญใใฏใใฃใจใใฆAutoformerใ่จญ่จใใพใใใ็ณปๅๅ่งฃใฎไบๅๅฆ็ใฎๆ
ฃ่กใ็ ดใใใใใๆทฑๅฑคใขใใซใฎๅบๆฌ็ใชๅ
้จใใญใใฏใจใใฆ้ฉๆฐใใพใใใใฎ่จญ่จใฏใ่ค้ใชๆ็ณปๅใซๅฏพใใAutoformerใฎ้ฒ่ก็ใชๅ่งฃ่ฝๅใๅผทๅใใพใใใใใซใ็ขบ็้็จ็่ซใซ่งฆ็บใใใฆใ็ณปๅใฎๅจๆๆงใซๅบใฅใใ่ชๅทฑ็ธ้ขๆฉๆงใ่จญ่จใใใตใ็ณปๅใฌใใซใงใฎไพๅญ้ขไฟใฎ็บ่ฆใจ่กจ็พใฎ้็ดใ่กใใพใใ่ชๅทฑ็ธ้ขใฏๅน็ใจ็ฒพๅบฆใฎไธกๆนใงใปใซใใขใใณใทใงใณใไธๅใใพใใ้ทๆไบๆธฌใซใใใฆใAutoformerใฏใใจใใซใฎใผใไบค้ใ็ตๆธใๆฐ่ฑกใ็พ็
ใฎ5ใคใฎๅฎ็จ็ใชๅฟ็จใใซใใผใใ6ใคใฎใใณใใใผใฏใง38%ใฎ็ธๅฏพ็ใชๆนๅใใใใใใๆๅ
็ซฏใฎ็ฒพๅบฆใ้ๆใใพใใ*
+
+ใใฎใขใใซใฏ[elisim](https://huggingface.co/elisim)ใจ[kashif](https://huggingface.co/kashif)ใใๆไพใใใพใใใ
+ใชใชใธใใซใฎใณใผใใฏ[ใใกใ](https://github.com/thuml/Autoformer)ใง่ฆใใใจใใงใใพใใ
+
+## ๅ่่ณๆ
+
+Autoformerใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผใฎHugging Faceใใใณใณใใฅใใใฃ๏ผ๐ใง็คบใใใฆใใ๏ผใฎๅ่่ณๆใฎไธ่ฆงใงใใใใใซๅ่่ณๆใๆๅบใใใๅ ดๅใฏใๆฐๅ
ผใญใชใPull Requestใ้ใใฆใใ ใใใ็งใใกใฏใใใใฌใใฅใผใใใใพใ๏ผๅ่่ณๆใฏใๆขๅญใฎใใฎใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใจใ็คบใใใจใ็ๆณ็ใงใใ
+
+- HuggingFaceใใญใฐใงAutoformerใซ้ขใใใใญใฐ่จไบใใใงใใฏใใฆใใ ใใ๏ผ[ใฏใใTransformersใฏๆ็ณปๅไบๆธฌใซๅนๆ็ใงใ๏ผ+ Autoformer๏ผ](https://huggingface.co/blog/autoformer)
+
+## AutoformerConfig
+
+[[autodoc]] AutoformerConfig
+
+## AutoformerModel
+
+[[autodoc]] AutoformerModel
+ - forward
+
+## AutoformerForPrediction
+
+[[autodoc]] AutoformerForPrediction
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bark.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bark.md
new file mode 100644
index 0000000000000000000000000000000000000000..508b8938889bae6960bcd2dddd155a88052174cf
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bark.md
@@ -0,0 +1,198 @@
+
+
+# Bark
+
+## Overview
+
+Bark ใฏใ[suno-ai/bark](https://github.com/suno-ai/bark) ใง Suno AI ใซใใฃใฆๆๆกใใใใใฉใณในใใฉใผใใผใใผในใฎใใญในใ่ชญใฟไธใใขใใซใงใใ
+
+
+Bark ใฏ 4 ใคใฎไธป่ฆใชใขใใซใงๆงๆใใใฆใใพใใ
+
+- [`BarkSemanticModel`] ('ใใญในใ'ใขใใซใจใๅผใฐใใ): ใใผใฏใณๅใใใใใญในใใๅ
ฅๅใจใใฆๅใๅใใใใญในใใฎๆๅณใๆใใใปใใณใใฃใใฏ ใใญในใ ใใผใฏใณใไบๆธฌใใๅ ๆ็่ชๅทฑๅๅธฐๅคๆใขใใซใ
+- [`BarkCoarseModel`] ('็ฒใ้ณ้ฟ' ใขใใซใจใๅผใฐใใ): [`BarkSemanticModel`] ใขใใซใฎ็ตๆใๅ
ฅๅใจใใฆๅใๅใๅ ๆ็่ชๅทฑๅๅธฐๅคๆๅจใ EnCodec ใซๅฟ
่ฆใชๆๅใฎ 2 ใคใฎใชใผใใฃใช ใณใผใใใใฏใไบๆธฌใใใใจใ็ฎ็ใจใใฆใใพใใ
+- [`BarkFineModel`] ('ๅพฎ็ดฐ้ณ้ฟ' ใขใใซ)ใไปๅใฏ้ๅ ๆ็ใชใผใใจใณใณใผใใผ ใใฉใณในใใฉใผใใผใงใไปฅๅใฎใณใผใใใใฏๅใ่พผใฟใฎๅ่จใซๅบใฅใใฆๆๅพใฎใณใผใใใใฏใ็นฐใ่ฟใไบๆธฌใใพใใ
+- [`EncodecModel`] ใใใในใฆใฎใณใผใใใใฏ ใใฃใใซใไบๆธฌใใใฎใงใBark ใฏใใใไฝฟ็จใใฆๅบๅใชใผใใฃใช้
ๅใใใณใผใใใพใใ
+
+ๆๅใฎ 3 ใคใฎใขใธใฅใผใซใฏใใใใใ็นๅฎใฎไบๅๅฎ็พฉใใใ้ณๅฃฐใซๅพใฃใฆๅบๅใตใฆใณใใ่ชฟๆดใใใใใฎๆกไปถไปใในใใผใซใผๅใ่พผใฟใใตใใผใใงใใใใจใซๆณจๆใใฆใใ ใใใ
+
+### Optimizing Bark
+
+Bark ใฏใใณใผใใๆฐ่ก่ฟฝๅ ใใใ ใใงๆ้ฉๅใงใใ**ใกใขใช ใใใใใชใณใใๅคงๅน
ใซๅๆธ**ใใใ**ๆจ่ซใ้ซ้ๅ**ใใใพใใ
+
+#### Using half-precision
+
+ใขใใซใๅ็ฒพๅบฆใงใญใผใใใใ ใใงใๆจ่ซใ้ซ้ๅใใใกใขใชไฝฟ็จ้ใ 50% ๅๆธใงใใพใใ
+
+```python
+from transformers import BarkModel
+import torch
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+model = BarkModel.from_pretrained("suno/bark-small", torch_dtype=torch.float16).to(device)
+```
+
+#### Using ๐ค Better Transformer
+
+Better Transformer ใฏใๅ
้จใงใซใผใใซ่ๅใๅฎ่กใใ ๐ค ๆ้ฉใชๆฉ่ฝใงใใใใใฉใผใใณในใไฝไธใใใใใจใชใใ้ๅบฆใ 20% ๏ฝ 30% ๅไธใใใใใจใใงใใพใใใขใใซใ ๐ค Better Transformer ใซใจใฏในใใผใใใใฎใซๅฟ
่ฆใชใณใผใใฏ 1 ่กใ ใใงใใ
+
+```python
+model = model.to_bettertransformer()
+```
+
+ใใฎๆฉ่ฝใไฝฟ็จใใๅใซ ๐ค Optimum ใใคใณในใใผใซใใๅฟ
่ฆใใใใใจใซๆณจๆใใฆใใ ใใใ [ใคใณในใใผใซๆนๆณใฏใใกใ](https://huggingface.co/docs/optimum/installation)
+
+#### Using CPU offload
+
+ๅ่ฟฐใใใใใซใBark ใฏ 4 ใคใฎใตใใขใใซใงๆงๆใใใฆใใใใชใผใใฃใช็ๆไธญใซ้ ็ชใซๅผใณๅบใใใพใใ่จใๆใใใฐใ1 ใคใฎใตใใขใใซใไฝฟ็จใใใฆใใ้ใไปใฎใตใใขใใซใฏใขใคใใซ็ถๆ
ใซใชใใพใใ
+
+CUDA ใใใคในใไฝฟ็จใใฆใใๅ ดๅใใกใขใช ใใใใใชใณใใฎ 80% ๅๆธใซใใๆฉๆตใๅใใ็ฐกๅใช่งฃๆฑบ็ญใฏใใขใคใใซ็ถๆ
ใฎ GPU ใฎใตใใขใใซใใชใใญใผใใใใใจใงใใใใฎๆไฝใฏ CPU ใชใใญใผใใจๅผใฐใใพใใ 1่กใฎใณใผใใงไฝฟ็จใงใใพใใ
+
+```python
+model.enable_cpu_offload()
+```
+
+ใใฎๆฉ่ฝใไฝฟ็จใใๅใซใ๐ค Accelerate ใใคใณในใใผใซใใๅฟ
่ฆใใใใใจใซๆณจๆใใฆใใ ใใใ [ใคใณในใใผใซๆนๆณใฏใใกใ](https://huggingface.co/docs/accelerate/basic_tutorials/install)
+
+#### Combining optimization techniques
+
+ๆ้ฉๅๆๆณใ็ตใฟๅใใใฆใCPU ใชใใญใผใใๅ็ฒพๅบฆใ๐ค Better Transformer ใใในใฆไธๅบฆใซไฝฟ็จใงใใพใใ
+
+```python
+from transformers import BarkModel
+import torch
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+# load in fp16
+model = BarkModel.from_pretrained("suno/bark-small", torch_dtype=torch.float16).to(device)
+
+# convert to bettertransformer
+model = BetterTransformer.transform(model, keep_original_model=False)
+
+# enable CPU offload
+model.enable_cpu_offload()
+```
+
+ๆจ่ซๆ้ฉๅๆๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ใใกใ](https://huggingface.co/docs/transformers/perf_infer_gpu_one) ใใ่ฆงใใ ใใใ
+
+### Tips
+
+Suno ใฏใๅคใใฎ่จ่ชใง้ณๅฃฐใใชใปใใใฎใฉใคใใฉใชใๆไพใใฆใใพใ [ใใกใ](https://suno-ai.notion.site/8b8e8749ed514b0cbf3f699013548683?v=bc67cff786b04b50b3ceb756fd05f68c)ใ
+ใใใใฎใใชใปใใใฏใใใ [ใใกใ](https://huggingface.co/suno/bark-small/tree/main/speaker_embeddings) ใพใใฏ [ใใกใ](https://huggingface.co/suno/bark/tree/main/speaker_embeddings)ใ
+
+```python
+>>> from transformers import AutoProcessor, BarkModel
+
+>>> processor = AutoProcessor.from_pretrained("suno/bark")
+>>> model = BarkModel.from_pretrained("suno/bark")
+
+>>> voice_preset = "v2/en_speaker_6"
+
+>>> inputs = processor("Hello, my dog is cute", voice_preset=voice_preset)
+
+>>> audio_array = model.generate(**inputs)
+>>> audio_array = audio_array.cpu().numpy().squeeze()
+```
+
+Bark ใฏใ้ๅธธใซใชใขใซใช **ๅค่จ่ช** ้ณๅฃฐใ ใใงใชใใ้ณๆฅฝใ่ๆฏใใคใบใๅ็ดใชๅนๆ้ณใชใฉใฎไปใฎ้ณๅฃฐใ็ๆใงใใพใใ
+
+```python
+>>> # Multilingual speech - simplified Chinese
+>>> inputs = processor("ๆไบบ็๏ผๆไผ่ฏดไธญๆ")
+
+>>> # Multilingual speech - French - let's use a voice_preset as well
+>>> inputs = processor("Incroyable! Je peux gรฉnรฉrer du son.", voice_preset="fr_speaker_5")
+
+>>> # Bark can also generate music. You can help it out by adding music notes around your lyrics.
+>>> inputs = processor("โช Hello, my dog is cute โช")
+
+>>> audio_array = model.generate(**inputs)
+>>> audio_array = audio_array.cpu().numpy().squeeze()
+```
+
+ใใฎใขใใซใฏใ็ฌใใใใๆฏใๆณฃใใชใฉใฎ**้่จ่ชใณใใฅใใฑใผใทใงใณ**ใ็ๆใใใใจใใงใใพใใ
+
+
+```python
+>>> # Adding non-speech cues to the input text
+>>> inputs = processor("Hello uh ... [clears throat], my dog is cute [laughter]")
+
+>>> audio_array = model.generate(**inputs)
+>>> audio_array = audio_array.cpu().numpy().squeeze()
+```
+
+ใชใผใใฃใชใไฟๅญใใใซใฏใใขใใซ่จญๅฎใจ scipy ใฆใผใใฃใชใใฃใใใตใณใใซ ใฌใผใใๅๅพใใใ ใใงใใ
+
+```python
+>>> from scipy.io.wavfile import write as write_wav
+
+>>> # save audio to disk, but first take the sample rate from the model config
+>>> sample_rate = model.generation_config.sample_rate
+>>> write_wav("bark_generation.wav", sample_rate, audio_array)
+```
+
+ใใฎใขใใซใฏใ[Yoach Lacombe (ylacombe)](https://huggingface.co/ylacombe) ใใใณ [Sanchit Gandhi (sanchit-gandhi)](https://github.com/sanchit-gandhi) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/suno-ai/bark) ใซใใใพใใ
+
+## BarkConfig
+
+[[autodoc]] BarkConfig
+ - all
+
+## BarkProcessor
+
+[[autodoc]] BarkProcessor
+ - all
+ - __call__
+
+## BarkModel
+
+[[autodoc]] BarkModel
+ - generate
+ - enable_cpu_offload
+
+## BarkSemanticModel
+
+[[autodoc]] BarkSemanticModel
+ - forward
+
+## BarkCoarseModel
+
+[[autodoc]] BarkCoarseModel
+ - forward
+
+## BarkFineModel
+
+[[autodoc]] BarkFineModel
+ - forward
+
+## BarkCausalModel
+
+[[autodoc]] BarkCausalModel
+ - forward
+
+## BarkCoarseConfig
+
+[[autodoc]] BarkCoarseConfig
+ - all
+
+## BarkFineConfig
+
+[[autodoc]] BarkFineConfig
+ - all
+
+## BarkSemanticConfig
+
+[[autodoc]] BarkSemanticConfig
+ - all
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bart.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bart.md
new file mode 100644
index 0000000000000000000000000000000000000000..5c71da37f01eb48049ab65c8ba33e5fdc49a415d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bart.md
@@ -0,0 +1,223 @@
+
+
+# BART
+
+
+
+**ๅ
่ฒฌไบ้
:** ไฝใๅฅๅฆใชใใฎใ่ฆใคใใๅ ดๅใฏใ[Github ๅ้ก](https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title) ใๆๅบใใๅฒใๅฝใฆใฆใใ ใใใ
+@patrickvonplaten
+
+## Overview
+
+Bart ใขใใซใฏใ[BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generationใ
+็ฟป่จณใจ็่งฃ](https://arxiv.org/abs/1910.13461) Mike LewisใYinhan LiuใNaman GoyalใMarjan ่
+ใฌใบใใใใธใฃใใใขใใใซใฉใใใณใปใขใใกใใใชใกใซใปใฌใดใฃใใในใปในใใคใใใใซใผใฏใปใผใใซใขใคใคใผใ2019ๅนด10ๆ29ๆฅใ
+
+่ฆ็ดใซใใใจใ
+
+- Bart ใฏใๅๆนๅใจใณใณใผใ (BERT ใชใฉ) ใๅใใๆจๆบใฎ seq2seq/ๆฉๆขฐ็ฟป่จณใขใผใญใใฏใใฃใไฝฟ็จใใพใใ
+ ๅทฆใใๅณใธใฎใใณใผใ (GPT ใชใฉ)ใ
+- ไบๅใใฌใผใใณใฐ ใฟในใฏใซใฏใๅ
ใฎๆใฎ้ ๅบใใฉใณใใ ใซใทใฃใใใซใใๆฐใใๅใ่พผใฟในใญใผใ ใๅซใพใใพใใ
+ ใใใงใใใญในใใฎ็ฏๅฒใฏๅไธใฎใในใฏ ใใผใฏใณใซ็ฝฎใๆใใใใพใใ
+- BART ใฏใใใญในใ็ๆ็จใซๅพฎ่ชฟๆดใใๅ ดๅใซ็นใซๅนๆ็ใงใใใ็่งฃใฟในใฏใซใ้ฉใใฆใใพใใใใ
+ RoBERTa ใฎใใใฉใผใใณในใ GLUE ใใใณ SQuAD ใฎๅ็ญใฎใใฌใผใใณใฐ ใชใฝใผในใจๅ็ญใซใใๆฐใใชๆๆใ้ๆใใพใใ
+ ใใพใใพใชๆฝ่ฑก็ใชๅฏพ่ฉฑใ่ณชๅๅฟ็ญใ่ฆ็ดใฟในใฏใซ้ขใใๆๅ
็ซฏใฎ็ตๆใๅพใใใๆๆใๅพใใใพใใ
+ ใซใผใธใฅใฏๆๅคง6ๆใพใงใ
+
+ใใใ๏ผ
+
+- BART ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใ
+- ใจใณใณใผใใผใจใใณใผใใผใๅใใใทใผใฑใณในใใผใทใผใฑใณใน ใขใใซใใจใณใณใผใใซใฏ็ ดๆใใใใผใธใงใณใฎใใผใฏใณใไพ็ตฆใใใใใณใผใใซใฏๅ
ใฎใใผใฏใณใไพ็ตฆใใใพใ๏ผใใ ใใ้ๅธธใฎใใฉใณในใใฉใผใใผ ใใณใผใใจๅๆงใซใๅฐๆฅใฎใฏใผใใ้ ใใใใฎใในใฏใใใใพใ๏ผใๆฌกใฎๅคๆใฎๆงๆใฏใใจใณใณใผใใผใฎไบๅใใฌใผใใณใฐ ใฟในใฏใซ้ฉ็จใใใพใใ
+
+ * ใฉใณใใ ใชใใผใฏใณใใในใฏใใพใ (BERT ใจๅๆง)
+ * ใฉใณใใ ใชใใผใฏใณใๅ้คใใพใ
+ * k ๅใฎใใผใฏใณใฎในใใณใ 1 ใคใฎใในใฏ ใใผใฏใณใงใในใฏใใพใ (0 ใใผใฏใณใฎในใใณใฏใในใฏ ใใผใฏใณใฎๆฟๅ
ฅใงใ)
+ * ๆใไธฆในๆฟใใพใ
+ * ใใญใฅใกใณใใๅ่ปขใใฆ็นๅฎใฎใใผใฏใณใใ้ๅงใใใใใซใใพใ
+
+ใใฎใขใใซใฏ [sshleifer](https://huggingface.co/sshleifer) ใซใใฃใฆๆไพใใใพใใใ่่
ใฎใณใผใใฏ [ใใ](https://github.com/pytorch/fairseq/tree/master/examples/bart) ใซใใใพใใ
+
+### Examples
+
+- ใทใผใฑใณใน้ใฟในใฏ็จใฎ BART ใใใณใใฎไปใฎใขใใซใๅพฎ่ชฟๆดใใใใใฎไพใจในใฏใชใใใฏใๆฌกใฎๅ ดๆใซใใใพใใ
+ [examples/pytorch/summarization/](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization/README.md)ใ
+- Hugging Face `datasets` ใไฝฟ็จใใฆ [`BartForConditionalGeneration`] ใใใฌใผใใณใฐใใๆนๆณใฎไพ
+ ใชใใธใงใฏใใฏใใใฎ [ใใฉใผใฉใ ใใฃในใซใใทใงใณ](https://discuss.huggingface.co/t/train-bart-for-conditional-generation-e-g-summarization/1904) ใง่ฆใคใใใใจใใงใใพใใ
+- [ๆฝๅบใใใใใงใใฏใใคใณใ](https://huggingface.co/models?search=distilbart) ใฏใใใฎ [่ซๆ](https://arxiv.org/abs/2010.13002) ใง่ชฌๆใใใฆใใพใใ
+
+## Implementation Notes
+
+- Bart ใฏใทใผใฑใณในใฎๅ้กใซ `token_type_ids` ใไฝฟ็จใใพใใใ [`BartTokenizer`] ใไฝฟ็จใใใใ
+ [`~BartTokenizer.encode`] ใไฝฟ็จใใฆ้ฉๅใซๅๅฒใใพใใ
+- [`BartModel`] ใฎใใฉใฏใผใใในใฏใๆธกใใใชใใฃใๅ ดๅใ`decoder_input_ids` ใไฝๆใใพใใ
+ ใใใฏใไปใฎใขใใชใณใฐ API ใจใฏ็ฐใชใใพใใใใฎๆฉ่ฝใฎไธ่ฌ็ใชไฝฟ็จไพใฏใใในใฏใฎๅกใใคใถใใงใใ
+- ใขใใซใฎไบๆธฌใฏใๆฌกใฎๅ ดๅใซๅ
ใฎๅฎ่ฃ
ใจๅไธใซใชใใใใซๆๅณใใใฆใใพใใ
+ `forced_bos_token_id=0`ใใใ ใใใใใฏใๆธกใๆๅญๅใๆฌกใฎๅ ดๅใซใฎใฟๆฉ่ฝใใพใใ
+ [`fairseq.encode`] ใฏในใใผในใงๅงใพใใพใใ
+- [`~generation.GenerationMixin.generate`] ใฏใๆฌกใฎใใใชๆกไปถไปใ็ๆใฟในใฏใซไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+ ่ฆ็ดใซใคใใฆใฏใใใฎ docstring ใฎไพใๅ็
งใใฆใใ ใใใ
+- *facebook/bart-large-cnn* ้ใฟใใญใผใใใใขใใซใซใฏ `mask_token_id` ใใชใใใๅฎ่กใงใใพใใใ
+ ใในใฏใๅใใใฟในใฏใ
+
+## Mask Filling
+
+`facebook/bart-base` ใใใณ `facebook/bart-large` ใใงใใฏใใคใณใใไฝฟ็จใใฆใใใซใใใผใฏใณ ใในใฏใๅใใใใจใใงใใพใใ
+
+```python
+from transformers import BartForConditionalGeneration, BartTokenizer
+
+model = BartForConditionalGeneration.from_pretrained("facebook/bart-large", forced_bos_token_id=0)
+tok = BartTokenizer.from_pretrained("facebook/bart-large")
+example_english_phrase = "UN Chief Says There Is No in Syria"
+batch = tok(example_english_phrase, return_tensors="pt")
+generated_ids = model.generate(batch["input_ids"])
+assert tok.batch_decode(generated_ids, skip_special_tokens=True) == [
+ "UN Chief Says There Is No Plan to Stop Chemical Weapons in Syria"
+]
+```
+
+## Resources
+
+BART ใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+
+
+- ใซ้ขใใใใญใฐๆ็จฟ [ๅๆฃใใฌใผใใณใฐ: ๐ค Transformers ใจ Amazon SageMaker ใไฝฟ็จใใ่ฆ็ดใฎใใใฎ BART/T5 ใฎใใฌใผใใณใฐ](https://huggingface.co/blog/sagemaker-distributed-training-seq2seq)ใ
+- ๆนๆณใซ้ขใใใใผใใใใฏ [blurr ใไฝฟ็จใใฆ fastai ใง่ฆ็ดใใใใใซ BART ใๅพฎ่ชฟๆดใใ](https://colab.research.google.com/github/ohmeow/ohmeow_website/blob/master/posts/2021-05-25-mbart-sequence-classification-with-blurr.ipynb). ๐ ๐
+- ๆนๆณใซ้ขใใใใผใใใใฏ [ใใฌใผใใผ ใฏใฉในใไฝฟ็จใใฆ 2 ใคใฎ่จ่ชใง่ฆ็ดใใใใใซ BART ใๅพฎ่ชฟๆดใใ](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb)ใ ๐
+- [`BartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb)ใ
+- [`TFBartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb)ใ
+- [`FlaxBartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/flax/summarization) ใงใตใใผใใใใฆใใพใใ
+- [่ฆ็ด](https://huggingface.co/course/chapter7/5?fw=pt#summarization) ๐ค ใใฐใใงใคในใณใผในใฎ็ซ ใ
+- [่ฆ็ดใฟในใฏใฌใคใ](../tasks/summarization.md)
+
+
+
+- [`BartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`TFBartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`FlaxBartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [ใในใฏใใใ่จ่ชใขใใชใณใฐ](https://huggingface.co/course/chapter7/3?fw=pt) ๐ค ้กใใฐ ใณใผในใฎ็ซ ใ
+- [ใในใฏใใใ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_lang_modeling)
+
+
+
+- [ใใณใใฃใผ่ชใใ่ฑ่ชใธใฎ็ฟป่จณใซ Seq2SeqTrainer ใไฝฟ็จใใฆ mBART ใๅพฎ่ชฟๆดใใๆนๆณใซ้ขใใใใผใ](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb)ใ ๐
+- [`BartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/translation) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation.ipynb)ใ
+- [`TFBartForConditionalGeneration`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/translation) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb)ใ
+- [็ฟป่จณใฟในใฏใฌใคใ](../tasks/translation)
+
+ไปฅไธใๅ็
งใใฆใใ ใใใ
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [ๆฝๅบใใใใใงใใฏใใคใณใ](https://huggingface.co/models?search=distilbart) ใฏใใใฎ [่ซๆ](https://arxiv.org/abs/2010.13002) ใง่ชฌๆใใใฆใใพใใ
+
+## BartConfig
+
+[[autodoc]] BartConfig
+ - all
+
+## BartTokenizer
+
+[[autodoc]] BartTokenizer
+ - all
+
+## BartTokenizerFast
+
+[[autodoc]] BartTokenizerFast
+ - all
+
+## BartModel
+
+[[autodoc]] BartModel
+ - forward
+
+## BartForConditionalGeneration
+
+[[autodoc]] BartForConditionalGeneration
+ - forward
+
+## BartForSequenceClassification
+
+[[autodoc]] BartForSequenceClassification
+ - forward
+
+## BartForQuestionAnswering
+
+[[autodoc]] BartForQuestionAnswering
+ - forward
+
+## BartForCausalLM
+
+[[autodoc]] BartForCausalLM
+ - forward
+
+## TFBartModel
+
+[[autodoc]] TFBartModel
+ - call
+
+## TFBartForConditionalGeneration
+
+[[autodoc]] TFBartForConditionalGeneration
+ - call
+
+## TFBartForSequenceClassification
+
+[[autodoc]] TFBartForSequenceClassification
+ - call
+
+## FlaxBartModel
+
+[[autodoc]] FlaxBartModel
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForConditionalGeneration
+
+[[autodoc]] FlaxBartForConditionalGeneration
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForSequenceClassification
+
+[[autodoc]] FlaxBartForSequenceClassification
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForQuestionAnswering
+
+[[autodoc]] FlaxBartForQuestionAnswering
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForCausalLM
+
+[[autodoc]] FlaxBartForCausalLM
+ - __call__
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/barthez.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/barthez.md
new file mode 100644
index 0000000000000000000000000000000000000000..94844c3f675d8a67fac12fb0f35027566dfd8156
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/barthez.md
@@ -0,0 +1,60 @@
+
+
+# BARThez
+
+## Overview
+
+BARThez ใขใใซใฏใMoussa Kamal EddineใAntoine J.-P ใซใใฃใฆ [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321) ใงๆๆกใใใพใใใใใฃใฏใทใจใใใซใชในใปใดใกใธใซใธใฃใณใในใ10ๆ23ๆฅใ
+2020ๅนดใ
+
+่ซๆใฎ่ฆ็ด:
+
+
+*ๅธฐ็ด็่ปข็งปๅญฆ็ฟใฏใ่ชๅทฑๆๅธซใใๅญฆ็ฟใซใใฃใฆๅฏ่ฝใซใชใใ่ช็ถ่จ่ชๅฆ็ๅ
จไฝใๅฎ่กใใพใใ
+(NLP) ๅ้ใฏใBERT ใ BART ใชใฉใฎใขใใซใซใใใ็กๆฐใฎ่ช็ถ่จ่ชใซๆฐใใชๆๅ
็ซฏๆ่กใ็ขบ็ซใใๅตใๅทปใ่ตทใใใฆใใพใใ
+ใฟในใฏใ็่งฃใใใใจใใใใคใใฎๆณจ็ฎใในใไพๅคใฏใใใพใใใๅฉ็จๅฏ่ฝใชใขใใซใจ็ ็ฉถใฎใปใจใใฉใฏใ
+่ฑ่ชใๅฏพ่ฑกใซๅฎๆฝใใใพใใใใใฎไฝๅใงใฏใใใฉใณใน่ช็จใฎๆๅใฎ BART ใขใใซใงใใ BARTez ใ็ดนไปใใพใใ
+๏ผๆใ
ใฎ็ฅใ้ใใซ๏ผใ BARThez ใฏใ้ๅปใฎ็ ็ฉถใใๅพใ้ๅธธใซๅคง่ฆๆจกใชๅไธ่จ่ชใใฉใณใน่ชใณใผใในใงไบๅใใฌใผใใณใฐใใใพใใ
+BART ใฎๆๅในใญใผใ ใซๅใใใฆ่ชฟๆดใใพใใใๆขๅญใฎ BERT ใใผในใฎใใฉใณใน่ชใขใใซใจใฏ็ฐใชใใ
+CamemBERT ใจ FlauBERTใBARThez ใฏใใจใณใณใผใใ ใใงใชใใ
+ใใฎใใณใผใใฏไบๅใใฌใผใใณใฐใใใฆใใพใใ FLUE ใใณใใใผใฏใใใฎ่ญๅฅใฟในใฏใซๅ ใใฆใBARThez ใๆฐใใ่ฉไพกใซๅบใฅใใฆ่ฉไพกใใพใใ
+ใใฎ่ซๆใจใจใใซใชใชใผในใใ่ฆ็ดใใผใฟใปใใใOrangeSumใใพใใใใงใซ่กใใใฆใใไบๅใใฌใผใใณใฐใ็ถ็ถใใพใใ
+BARTHez ใฎใณใผใในไธใงๅค่จ่ช BART ใไบๅ่จ็ทดใใ็ตๆใจใใฆๅพใใใใขใใซ (mBARTHez ใจๅผใถ) ใๆฌกใฎใใจใ็คบใใพใใ
+ใใใฉใฎ BARThez ใๅคงๅน
ใซๅผทๅใใCamemBERT ใ FlauBERT ใจๅ็ญใใใใไธๅใใพใใ*
+
+ใใฎใขใใซใฏ [moussakam](https://huggingface.co/moussakam) ใซใใฃใฆๅฏ็จฟใใใพใใใ่่
ใฎใณใผใใฏ[ใใ](https://github.com/moussaKam/BARThez)ใซใใใพใใ
+
+
+
+BARThez ใฎๅฎ่ฃ
ใฏใใใผใฏใณๅใ้คใใฆ BART ใจๅใใงใใ่ฉณ็ดฐใซใคใใฆใฏใ[BART ใใญใฅใกใณใ](bart) ใๅ็
งใใฆใใ ใใใ
+ๆงๆใฏใฉในใจใใฎใใฉใกใผใฟใ BARThez ๅบๆใฎใใผใฏใใคใถใผใซใคใใฆใฏไปฅไธใซ่จ่ผใใใฆใใพใใ
+
+
+
+### Resources
+
+- BARThez ใฏใBART ใจๅๆงใฎๆนๆณใงใทใผใฑใณใน้ใฎใฟในใฏใๅพฎ่ชฟๆดใงใใพใใไปฅไธใ็ขบ่ชใใฆใใ ใใใ
+ [examples/pytorch/summarization/](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization/README.md)ใ
+
+
+## BarthezTokenizer
+
+[[autodoc]] BarthezTokenizer
+
+## BarthezTokenizerFast
+
+[[autodoc]] BarthezTokenizerFast
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bartpho.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bartpho.md
new file mode 100644
index 0000000000000000000000000000000000000000..a9575d821ef916b55f4d06810cc4ab739a9c3504
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bartpho.md
@@ -0,0 +1,86 @@
+
+
+# BARTpho
+
+## Overview
+
+BARTpho ใขใใซใฏใNguyen Luong TranใDuong Minh LeใDat Quoc Nguyen ใซใใฃใฆ [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnam](https://arxiv.org/abs/2109.09701) ใงๆๆกใใใพใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*BARTpho ใซใฏใBARTpho_word ใจ BARTpho_syllable ใฎ 2 ใคใฎใใผใธใงใณใใใใๅใฎๅ
ฌ้ใใใๅคง่ฆๆจกใชๅไธ่จ่ชใงใใ
+ใใใใ ่ช็จใซไบๅใใฌใผใใณใฐใใใใทใผใฑใณในใใผใทใผใฑใณใน ใขใใซใๅฝ็คพใฎ BARTpho ใฏใๅคง่ฆๆจกใชใใขใผใญใใฏใใฃใจไบๅใใฌใผใใณใฐใไฝฟ็จใใพใ
+ใทใผใฑใณใน้ใใคใบ้คๅปใขใใซ BART ใฎในใญใผใ ใชใฎใงใ็ๆ NLP ใฟในใฏใซ็นใซ้ฉใใฆใใพใใๅฎ้จ
+ใใใใ ่ชใใญในใ่ฆ็ดใฎไธๆตใฟในใฏใงใฏใ่ชๅ่ฉไพกใจไบบ้ใซใใ่ฉไพกใฎไธกๆนใงใBARTpho ใ
+ๅผทๅใชใใผในใฉใคใณ mBART ใไธๅใใๆๅ
็ซฏใฎๆง่ฝใๅไธใใใพใใๅฐๆฅใๅฎนๆใซใใใใใซBARTphoใใชใชใผในใใพใ
+็ๆ็ใชใใใใ ่ช NLP ใฟในใฏใฎ็ ็ฉถใจๅฟ็จใ*
+
+ใใฎใขใใซใฏ [dqnguyen](https://huggingface.co/dqnguyen) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/VinAIResearch/BARTpho) ใซใใใพใใ
+
+## Usage example
+
+```python
+>>> import torch
+>>> from transformers import AutoModel, AutoTokenizer
+
+>>> bartpho = AutoModel.from_pretrained("vinai/bartpho-syllable")
+
+>>> tokenizer = AutoTokenizer.from_pretrained("vinai/bartpho-syllable")
+
+>>> line = "Chรบng tรดi lร nhแปฏng nghiรชn cแปฉu viรชn."
+
+>>> input_ids = tokenizer(line, return_tensors="pt")
+
+>>> with torch.no_grad():
+... features = bartpho(**input_ids) # Models outputs are now tuples
+
+>>> # With TensorFlow 2.0+:
+>>> from transformers import TFAutoModel
+
+>>> bartpho = TFAutoModel.from_pretrained("vinai/bartpho-syllable")
+>>> input_ids = tokenizer(line, return_tensors="tf")
+>>> features = bartpho(**input_ids)
+```
+
+## Usage tips
+
+- mBARTใซ็ถใใฆใBARTphoใฏBARTใฎใๅคง่ฆๆจกใชใใขใผใญใใฏใใฃใไฝฟ็จใใใใฎไธใซ่ฟฝๅ ใฎๅฑคๆญฃ่ฆๅๅฑคใๅใใฆใใพใใ
+ ใจใณใณใผใใจใใณใผใใฎไธกๆนใใใใใฃใฆใ[BART ใฎใใญใฅใกใณใ](bart) ใฎไฝฟ็จไพใฏใไฝฟ็จใซ้ฉๅฟใใๅ ดๅใซไฝฟ็จใใใพใใ
+ BARTpho ใไฝฟ็จใใๅ ดๅใฏใBART ใซ็นๅใใใฏใฉในใ mBART ใซ็นๅใใๅฏพๅฟใใใฏใฉในใซ็ฝฎใๆใใใใจใซใใฃใฆ่ชฟๆดใใๅฟ
่ฆใใใใพใใ
+ ไพใใฐ๏ผ
+
+```python
+>>> from transformers import MBartForConditionalGeneration
+
+>>> bartpho = MBartForConditionalGeneration.from_pretrained("vinai/bartpho-syllable")
+>>> TXT = "Chรบng tรดi lร nghiรชn cแปฉu viรชn."
+>>> input_ids = tokenizer([TXT], return_tensors="pt")["input_ids"]
+>>> logits = bartpho(input_ids).logits
+>>> masked_index = (input_ids[0] == tokenizer.mask_token_id).nonzero().item()
+>>> probs = logits[0, masked_index].softmax(dim=0)
+>>> values, predictions = probs.topk(5)
+>>> print(tokenizer.decode(predictions).split())
+```
+
+- ใใฎๅฎ่ฃ
ใฏใใผใฏใณๅใฎใฟใ็ฎ็ใจใใฆใใพใใ`monolingual_vocab_file`ใฏใใใใ ่ชใซ็นๅใใๅใงๆงๆใใใฆใใพใ
+ ๅค่จ่ช XLM-RoBERTa ใใๅฉ็จใงใใไบๅใใฌใผใใณใฐๆธใฟ SentencePiece ใขใใซ`vocab_file`ใใๆฝๅบใใใพใใ
+ ไปใฎ่จ่ช (ใตใใฏใผใใซใใฎไบๅใใฌใผใใณใฐๆธใฟๅค่จ่ช SentencePiece ใขใใซ`vocab_file`ใไฝฟ็จใใๅ ดๅ)
+ ใปใฐใกใณใใผใทใงใณใซใใใ็ฌ่ชใฎ่จ่ชใซ็นๅใใ`monolingual_vocab_file`ใไฝฟ็จใใฆ BartphoTokenizer ใๅๅฉ็จใงใใพใใ
+
+## BartphoTokenizer
+
+[[autodoc]] BartphoTokenizer
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/beit.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/beit.md
new file mode 100644
index 0000000000000000000000000000000000000000..45eb1efa5dd873d2e770d6cd727cb08ea26ea70b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/beit.md
@@ -0,0 +1,143 @@
+
+
+# BEiT
+
+## Overview
+
+BEiT ใขใใซใฏใ[BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) ใงๆๆกใใใพใใใ
+ใใณใใปใใชใใชใผใปใใณใใใซใปใฆใงใคใ BERT ใซ่งฆ็บใใใ BEiT ใฏใ่ชๅทฑๆๅธซใใใฎไบๅใใฌใผใใณใฐใไฝๆใใๆๅใฎ่ซๆใงใใ
+ใใธใงใณ ใใฉใณในใใฉใผใใผ (ViT) ใฏใๆๅธซไปใไบๅใใฌใผใใณใฐใใใๅชใใใใใฉใผใใณในใ็บๆฎใใพใใใฏใฉในใไบๆธฌใใใใใซใขใใซใไบๅใใฌใผใใณใฐใใใฎใงใฏใชใ
+([ใชใชใธใใซใฎ ViT ่ซๆ](https://arxiv.org/abs/2010.11929) ใง่กใใใใใใซ) ็ปๅใฎ BEiT ใขใใซใฏใๆฌกใฎใใใซไบๅใใฌใผใใณใฐใใใฆใใพใใ
+ใในใฏใใใ OpenAI ใฎ [DALL-E ใขใใซ](https://arxiv.org/abs/2102.12092) ใฎใณใผใใใใฏใใใใธใฅใขใซ ใใผใฏใณใไบๆธฌใใพใ
+ใใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*่ชๅทฑๆๅธซใใ่ฆ่ฆ่กจ็พใขใใซ BEiT (Bidirectional Encoderpresentation) ใๅฐๅ
ฅใใพใใ
+ใคใกใผใธใใฉใณในใใฉใผใใผใใใ่ช็ถ่จ่ชๅฆ็ๅ้ใง้็บใใใBERTใซๅฃใใใในใฏ็ปๅใๆๆกใใพใใ
+ใใธใงใณใใฉใณในใใฉใผใใผใไบๅใซใใฌใผใใณใฐใใใใใฎใขใใชใณใฐใฟในใฏใๅ
ทไฝ็ใซใฏใไบๅใใฌใผใใณใฐใงใฏๅ็ปๅใซ 2 ใคใฎใใฅใผใใใใพใใ
+ใใใ (16x16 ใใฏใปใซใชใฉ)ใใใใณใใธใฅใขใซ ใใผใฏใณ (ใคใพใใๅๅฅใฎใใผใฏใณ)ใใพใใๅ
ใฎ็ปๅใใใใผใฏใณๅใใใฆใ
+ใใธใฅใขใซใใผใฏใณใๆฌกใซใใใใคใใฎ็ปๅใใใใใฉใณใใ ใซใในใฏใใใใใใใใใฏใใผใณใฎ Transformer ใซไพ็ตฆใใพใใไบๅใใฌใผใใณใฐ
+็ฎ็ใฏใ็ ดๆใใใคใกใผใธ ใใใใซๅบใฅใใฆๅ
ใฎใใธใฅใขใซ ใใผใฏใณใๅๅพฉใใใใจใงใใ BEiTใฎไบๅใใฌใผใใณใฐๅพใ
+ไบๅใใฌใผใใณใฐใใใใจใณใณใผใใผใซใฟในใฏ ใฌใคใคใผใ่ฟฝๅ ใใใใจใงใใใฆใณในใใชใผใ ใฟในใฏใฎใขใใซ ใใฉใกใผใฟใผใ็ดๆฅๅพฎ่ชฟๆดใใพใใ
+็ปๅๅ้กใจใปใใณใใฃใใฏใปใฐใกใณใใผใทใงใณใซ้ขใใๅฎ้จ็ตๆใฏใ็งใใกใฎใขใใซใ็ซถไบๅใฎใใ็ตๆใ้ๆใใใใจใ็คบใใฆใใพใ
+ไปฅๅใฎไบๅใใฌใผใใณใฐๆนๆณใไฝฟ็จใใฆใใใจใใฐใๅบๆฌใตใคใบใฎ BEiT ใฏใImageNet-1K ใง 83.2% ใฎใใใ 1 ็ฒพๅบฆใ้ๆใใพใใ
+ๅใ่จญๅฎใงใผใญใใใฎ DeiT ใใฌใผใใณใฐ (81.8%) ใๅคงๅน
ใซไธๅใใพใใใใพใใๅคงๅBEiTใฏ
+86.3% ใฏ ImageNet-1K ใฎใฟใไฝฟ็จใใฆใใใImageNet-22K ใงใฎๆๅธซไปใไบๅใใฌใผใใณใฐใไฝฟ็จใใ ViT-L (85.2%) ใไธๅใฃใฆใใพใใ*
+
+## Usage tips
+
+- BEiT ใขใใซใฏ้ๅธธใฎใใธใงใณ ใใฉใณในใใฉใผใใผใงใใใๆๅธซใใใงใฏใชใ่ชๅทฑๆๅธซใใใฎๆนๆณใงไบๅใใฌใผใใณใฐใใใฆใใพใใๅฝผใใฏ
+ ImageNet-1K ใใใณ CIFAR-100 ใงๅพฎ่ชฟๆดใใใจใ[ใชใชใธใใซ ใขใใซ (ViT)](vit) ใจ [ใใผใฟๅน็ใฎ้ซใใคใกใผใธ ใใฉใณในใใฉใผใใผ (DeiT)](deit) ใฎไธกๆนใไธๅใใใใฉใผใใณในใ็บๆฎใใพใใๆจ่ซใซ้ขใใใใขใใผใใใใฏใใใงใใฏใงใใพใใ
+ ใซในใฟใ ใใผใฟใฎๅพฎ่ชฟๆดใฏ [ใใกใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer) (็ฝฎใๆใใใ ใใงๆธใฟใพใ)
+ [`BeitImageProcessor`] ใซใใ [`ViTFeatureExtractor`] ใจ
+ [`ViTForImageClassification`] by [`BeitForImageClassification`])ใ
+- DALL-E ใฎ็ปๅใใผใฏใใคใถใผใจ BEiT ใ็ตใฟๅใใใๆนๆณใ็ดนไปใใใใข ใใผใใใใฏใๅฉ็จๅฏ่ฝใงใใ
+ ใในใฏใใใ็ปๅใขใใชใณใฐใๅฎ่กใใพใใ [ใใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/BEiT) ใง่ฆใคใใใใจใใงใใพใใ
+- BEiT ใขใใซใฏๅ็ปๅใๅใใตใคใบ (่งฃๅๅบฆ) ใงใใใใจใๆๅพ
ใใฆใใใใใๆฌกใฎใใใซไฝฟ็จใงใใพใใ
+ [`BeitImageProcessor`] ใไฝฟ็จใใฆใใขใใซใฎ็ปๅใฎใตใคใบใๅคๆด (ใพใใฏๅในใฑใผใซ) ใใๆญฃ่ฆๅใใพใใ
+- ไบๅใใฌใผใใณใฐใพใใฏๅพฎ่ชฟๆดไธญใซไฝฟ็จใใใใใใ่งฃๅๅบฆใจ็ปๅ่งฃๅๅบฆใฎไธกๆนใๅๅใซๅๆ ใใใพใใ
+ ๅใใงใใฏใใคใณใใใใจใใฐใ`microsoft/beit-base-patch16-224`ใฏใใใใไปใใฎๅบๆฌใตใคใบใฎใขใผใญใใฏใใฃใๆใใพใใ
+ ่งฃๅๅบฆใฏ 16x16ใๅพฎ่ชฟๆด่งฃๅๅบฆใฏ 224x224 ใงใใใในใฆใฎใใงใใฏใใคใณใใฏ [ใใ](https://huggingface.co/models?search=microsoft/beit) ใง่ฆใคใใใใจใใงใใพใใ
+- ๅฉ็จๅฏ่ฝใชใใงใใฏใใคใณใใฏใ(1) [ImageNet-22k](http://www.image-net.org/) ใงไบๅใใฌใผใใณใฐใใใฆใใพใ (
+ 1,400 ไธใฎ็ปๅใจ 22,000 ใฎใฏใฉใน) ใฎใฟใ(2) ImageNet-22k ใงใๅพฎ่ชฟๆดใใพใใฏ (3) [ImageNet-1k](http://www.image-net.org/challenges/LSVRC)ใงใๅพฎ่ชฟๆด/2012/) (ILSVRC 2012 ใจใๅผใฐใใ130 ไธไปถใฎใณใฌใฏใทใงใณ)
+ ็ปๅใจ 1,000 ใฏใฉใน)ใ
+- BEiT ใฏใT5 ใขใใซใใใคใณในใใฌใผใทใงใณใๅพใ็ธๅฏพไฝ็ฝฎๅใ่พผใฟใไฝฟ็จใใพใใไบๅใใฌใผใใณใฐไธญใซใ่่
ใฏๆฌกใฎใใจใๅ
ฑๆใใพใใใ
+ ใใใคใใฎ่ชๅทฑๆณจๆๅฑค้ใฎ็ธๅฏพ็ใชไฝ็ฝฎใฎๅใใๅพฎ่ชฟๆดไธญใๅใฌใคใคใผใฎ็ธๅฏพไฝ็ฝฎ
+ ใใคใขในใฏใไบๅใใฌใผใใณใฐๅพใซๅๅพใใใๅ
ฑๆ็ธๅฏพไฝ็ฝฎใใคใขในใงๅๆๅใใใพใใใๅธๆใฎๅ ดๅใฏใ
+ ใขใใซใๆๅใใไบๅใใฌใผใใณใฐใใใซใฏใ`use_relative_position_bias` ใพใใฏ
+ ่ฟฝๅ ใใใซใฏใ[`BeitConfig`] ใฎ `use_relative_position_bias` ๅฑๆงใ `True` ใซ่จญๅฎใใพใใ
+ ไฝ็ฝฎใฎๅใ่พผใฟใ
+
+
+
+ BEiT ใฎไบๅใใฌใผใใณใฐใ ๅ
ใฎ่ซๆใใๆ็ฒใ
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใใใฎใขใใซใฎ JAX/FLAX ใใผใธใงใณใฏใ
+[kamalkraj](https://huggingface.co/kamalkraj) ใซใใๆ็จฟใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/microsoft/unilm/tree/master/beit) ใซใใใพใใ
+
+## Resources
+
+BEiT ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`BeitForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+- ๅ็
ง: [็ปๅๅ้กใฟในใฏ ใฌใคใ](../tasks/image_classification)
+
+**ใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณ**
+- [ใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณ ใฟในใฏ ใฌใคใ](../tasks/semantic_segmentation)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## BEiT specific outputs
+
+[[autodoc]] models.beit.modeling_beit.BeitModelOutputWithPooling
+
+[[autodoc]] models.beit.modeling_flax_beit.FlaxBeitModelOutputWithPooling
+
+## BeitConfig
+
+[[autodoc]] BeitConfig
+
+## BeitFeatureExtractor
+
+[[autodoc]] BeitFeatureExtractor
+ - __call__
+ - post_process_semantic_segmentation
+
+## BeitImageProcessor
+
+[[autodoc]] BeitImageProcessor
+ - preprocess
+ - post_process_semantic_segmentation
+
+## BeitModel
+
+[[autodoc]] BeitModel
+ - forward
+
+## BeitForMaskedImageModeling
+
+[[autodoc]] BeitForMaskedImageModeling
+ - forward
+
+## BeitForImageClassification
+
+[[autodoc]] BeitForImageClassification
+ - forward
+
+## BeitForSemanticSegmentation
+
+[[autodoc]] BeitForSemanticSegmentation
+ - forward
+
+## FlaxBeitModel
+
+[[autodoc]] FlaxBeitModel
+ - __call__
+
+## FlaxBeitForMaskedImageModeling
+
+[[autodoc]] FlaxBeitForMaskedImageModeling
+ - __call__
+
+## FlaxBeitForImageClassification
+
+[[autodoc]] FlaxBeitForImageClassification
+ - __call__
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert-generation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert-generation.md
new file mode 100644
index 0000000000000000000000000000000000000000..d2c93a4644d94375ae9d4a158e3b35942edcfea7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert-generation.md
@@ -0,0 +1,107 @@
+
+
+# BertGeneration
+
+## Overview
+
+BertGeneration ใขใใซใฏใๆฌกใไฝฟ็จใใฆใทใผใฑใณใน้ใฎใฟในใฏใซๅฉ็จใงใใ BERT ใขใใซใงใใ
+[Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) ใงๆๆกใใใฆใใ [`EncoderDecoderModel`]
+ใฟในใฏใSascha RotheใSishi NagayanใAliaksei Severyn ่ใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๅคง่ฆๆจกใชใใฅใผใฉใซ ใขใใซใฎๆๅธซใชใไบๅใใฌใผใใณใฐใฏใๆ่ฟใ่ช็ถ่จ่ชๅฆ็ใซ้ฉๅฝใใใใใใพใใใใซใใ
+NLP ๅฎ่ทต่
ใฏใๅ
ฌ้ใใใใใงใใฏใใคใณใใใใฆใฉใผใ ในใฟใผใใใฆใ่คๆฐใฎ้
็ฎใงๆๅ
็ซฏใฎๆ่กใๆจ้ฒใใฆใใพใใใ
+ใณใณใใฅใผใใฃใณใฐๆ้ใๅคงๅน
ใซ็ฏ็ดใใชใใใใณใใใผใฏใๅฎ่กใใพใใใใใพใงใฎใจใใใไธปใซ่ช็ถ่จ่ชใซ็ฆ็นใๅฝใฆใฆใใพใใใ
+ใฟในใฏใ็่งฃใใใใใฎ่ซๆใงใฏใใทใผใฑใณใน็ๆใฎใใใฎไบๅใใฌใผใใณใฐใใใใใงใใฏใใคใณใใฎๆๅนๆงใๅฎ่จผใใพใใ็งใใกใฏ
+ๅ
ฌ้ใใใฆใใไบๅใใฌใผใใณใฐๆธใฟ BERT ใจไบๆๆงใฎใใ Transformer ใใผในใฎใทใผใฑใณใน้ใขใใซใ้็บใใพใใใ
+GPT-2 ใใใณ RoBERTa ใใงใใฏใใคใณใใไฝฟ็จใใใขใใซใฎๅๆๅใฎๆ็จๆงใซใคใใฆๅบ็ฏใชๅฎ่จผ็ ็ฉถใๅฎๆฝใใพใใใ
+ใจใณใณใผใใจใใณใผใใใใใใฎใใงใใฏใใคใณใใ็งใใกใฎใขใใซใฏใๆฉๆขฐ็ฟป่จณใซ้ขใใๆฐใใๆๅ
็ซฏใฎ็ตๆใใใใใใพใใ
+ใใญในใใฎ่ฆ็ดใๆใฎๅๅฒใใใใณๆใฎ่ๅใ*
+
+## Usage examples and tips
+
+- ใขใใซใ [`EncoderDecoderModel`] ใจ็ตใฟๅใใใฆไฝฟ็จโโใใฆใ2 ใคใฎไบๅใใฌใผใใณใฐใใใใขใใซใๆดป็จใงใใพใใ
+ ๅพ็ถใฎๅพฎ่ชฟๆดใฎใใใฎ BERT ใใงใใฏใใคใณใใ
+
+```python
+>>> # leverage checkpoints for Bert2Bert model...
+>>> # use BERT's cls token as BOS token and sep token as EOS token
+>>> encoder = BertGenerationEncoder.from_pretrained("google-bert/bert-large-uncased", bos_token_id=101, eos_token_id=102)
+>>> # add cross attention layers and use BERT's cls token as BOS token and sep token as EOS token
+>>> decoder = BertGenerationDecoder.from_pretrained(
+... "google-bert/bert-large-uncased", add_cross_attention=True, is_decoder=True, bos_token_id=101, eos_token_id=102
+... )
+>>> bert2bert = EncoderDecoderModel(encoder=encoder, decoder=decoder)
+
+>>> # create tokenizer...
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-large-uncased")
+
+>>> input_ids = tokenizer(
+... "This is a long article to summarize", add_special_tokens=False, return_tensors="pt"
+... ).input_ids
+>>> labels = tokenizer("This is a short summary", return_tensors="pt").input_ids
+
+>>> # train...
+>>> loss = bert2bert(input_ids=input_ids, decoder_input_ids=labels, labels=labels).loss
+>>> loss.backward()
+```
+
+- ไบๅใใฌใผใใณใฐใใใ [`EncoderDecoderModel`] ใใขใใซ ใใใง็ดๆฅๅฉ็จใงใใพใใ
+
+```python
+>>> # instantiate sentence fusion model
+>>> sentence_fuser = EncoderDecoderModel.from_pretrained("google/roberta2roberta_L-24_discofuse")
+>>> tokenizer = AutoTokenizer.from_pretrained("google/roberta2roberta_L-24_discofuse")
+
+>>> input_ids = tokenizer(
+... "This is the first sentence. This is the second sentence.", add_special_tokens=False, return_tensors="pt"
+... ).input_ids
+
+>>> outputs = sentence_fuser.generate(input_ids)
+
+>>> print(tokenizer.decode(outputs[0]))
+```
+
+ใใใ๏ผ
+
+- [`BertGenerationEncoder`] ใจ [`BertGenerationDecoder`] ใฏใ
+ [`EncoderDecoder`] ใจ็ตใฟๅใใใพใใ
+- ่ฆ็ดใๆใฎๅๅฒใๆใฎ่ๅใใใใณ็ฟป่จณใฎๅ ดๅใๅ
ฅๅใซ็นๅฅใชใใผใฏใณใฏๅฟ
่ฆใใใพใใใ
+ ใใใใฃใฆใๅ
ฅๅใฎๆซๅฐพใซ EOS ใใผใฏใณใ่ฟฝๅ ใใชใใงใใ ใใใ
+
+ใใฎใขใใซใฏใ[patrickvonplaten](https://huggingface.co/patrickvonplaten) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏๆฌกใฎใจใใใงใ
+[ใใ](https://tfhub.dev/s?module-type=text-generation&subtype=module,placeholder) ใใใใพใใ
+
+## BertGenerationConfig
+
+[[autodoc]] BertGenerationConfig
+
+## BertGenerationTokenizer
+
+[[autodoc]] BertGenerationTokenizer
+ - save_vocabulary
+
+## BertGenerationEncoder
+
+[[autodoc]] BertGenerationEncoder
+ - forward
+
+## BertGenerationDecoder
+
+[[autodoc]] BertGenerationDecoder
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert-japanese.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert-japanese.md
new file mode 100644
index 0000000000000000000000000000000000000000..86cce741aac6cb559efefabd936646a39f9b5854
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert-japanese.md
@@ -0,0 +1,81 @@
+
+
+# BertJapanese
+
+## Overview
+
+BERT ใขใใซใฏๆฅๆฌ่ชใใญในใใงใใฌใผใใณใฐใใใพใใใ
+
+2 ใคใฎ็ฐใชใใใผใฏใณๅๆนๆณใๅใใใขใใซใใใใพใใ
+
+- MeCab ใจ WordPiece ใไฝฟ็จใใฆใใผใฏใณๅใใพใใใใใซใฏใ[MeCab](https://taku910.github.io/mecab/) ใฎใฉใใใผใงใใ [fugashi](https://github.com/polm/fugashi) ใจใใ่ฟฝๅ ใฎไพๅญ้ขไฟใๅฟ
่ฆใงใใ
+- ๆๅญใซใใผใฏใณๅใใพใใ
+
+*MecabTokenizer* ใไฝฟ็จใใใซใฏใ`pip installTransformers["ja"]` (ใพใใฏใใคใณในใใผใซใใๅ ดๅใฏ `pip install -e .["ja"]`) ใใๅฟ
่ฆใใใใพใใ
+ใฝใผในใใ๏ผไพๅญ้ขไฟใใคใณในใใผใซใใพใใ
+
+[cl-tohakuใชใใธใใชใฎ่ฉณ็ดฐ](https://github.com/cl-tohaku/bert-japanese)ใๅ็
งใใฆใใ ใใใ
+
+MeCab ใใใณ WordPiece ใใผใฏใณๅใงใขใใซใไฝฟ็จใใไพ:
+
+
+```python
+>>> import torch
+>>> from transformers import AutoModel, AutoTokenizer
+
+>>> bertjapanese = AutoModel.from_pretrained("cl-tohoku/bert-base-japanese")
+>>> tokenizer = AutoTokenizer.from_pretrained("cl-tohoku/bert-base-japanese")
+
+>>> ## Input Japanese Text
+>>> line = "ๅพ่ผฉใฏ็ซใงใใใ"
+
+>>> inputs = tokenizer(line, return_tensors="pt")
+
+>>> print(tokenizer.decode(inputs["input_ids"][0]))
+[CLS] ๅพ่ผฉ ใฏ ็ซ ใง ใใ ใ [SEP]
+
+>>> outputs = bertjapanese(**inputs)
+```
+
+ๆๅญใใผใฏใณๅใไฝฟ็จใใใขใใซใฎไฝฟ็จไพ:
+
+```python
+>>> bertjapanese = AutoModel.from_pretrained("cl-tohoku/bert-base-japanese-char")
+>>> tokenizer = AutoTokenizer.from_pretrained("cl-tohoku/bert-base-japanese-char")
+
+>>> ## Input Japanese Text
+>>> line = "ๅพ่ผฉใฏ็ซใงใใใ"
+
+>>> inputs = tokenizer(line, return_tensors="pt")
+
+>>> print(tokenizer.decode(inputs["input_ids"][0]))
+[CLS] ๅพ ่ผฉ ใฏ ็ซ ใง ใ ใ ใ [SEP]
+
+>>> outputs = bertjapanese(**inputs)
+```
+
+
+
+- ใใฎๅฎ่ฃ
ใฏใใผใฏใณๅๆนๆณใ้คใใฆ BERT ใจๅใใงใใใใฎไปใฎไฝฟ็จไพใซใคใใฆใฏใ[BERT ใฎใใญใฅใกใณใ](bert) ใๅ็
งใใฆใใ ใใใ
+
+
+
+ใใฎใขใใซใฏ[cl-tohaku](https://huggingface.co/cl-tohaku)ใใๆไพใใใพใใใ
+
+## BertJapaneseTokenizer
+
+[[autodoc]] BertJapaneseTokenizer
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert.md
new file mode 100644
index 0000000000000000000000000000000000000000..d34df9c0d5d60e7069af756bf825ef1db7cf3f74
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bert.md
@@ -0,0 +1,312 @@
+
+
+# BERT
+
+
+
+## Overview
+
+BERT ใขใใซใฏใJacob DevlinใMing-Wei ChangใKenton LeeใKristina Toutanova ใซใใฃใฆ [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) ใงๆๆกใใใพใใใใใใฏ
+ใในใฏใใใ่จ่ชใขใใชใณใฐ็ฎๆจใจๆฌกใฎๆใฎ็ตใฟๅใใใไฝฟ็จใใฆไบๅใใฌใผใใณใฐใใใๅๆนๅใใฉใณในใใฉใผใใผ
+Toronto Book Corpus ใจ Wikipedia ใใใชใๅคง่ฆๆจกใชใณใผใในใงใฎไบๆธฌใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*BERT ใจๅผใฐใใๆฐใใ่จ่ช่กจ็พใขใใซใๅฐๅ
ฅใใพใใใใใฏ Bidirectional Encoder Representations ใฎ็ฅใงใ
+ใใฉใณในใใฉใผใใผใใใๆ่ฟใฎ่จ่ช่กจ็พใขใใซใจใฏ็ฐใชใใBERT ใฏๆทฑใๅๆนๅๆงใไบๅใซใใฌใผใใณใฐใใใใใซ่จญ่จใใใฆใใพใใ
+ใในใฆใฎใฌใคใคใผใฎๅทฆใจๅณใฎไธกๆนใฎใณใณใใญในใใๅ
ฑๅใงๆกไปถไปใใใใใจใซใใใใฉใใซใฎใชใใใญในใใใ่กจ็พใใพใใ็ตๆใจใใฆใ
+ไบๅใใฌใผใใณใฐใใใ BERT ใขใใซใฏใๅบๅๅฑคใ 1 ใค่ฟฝๅ ใใใ ใใงๅพฎ่ชฟๆดใใฆใๆๅ
็ซฏใฎใขใใซใไฝๆใงใใพใใ
+ๅฎ่ณช็ใชใฟในใฏๅบๆใฎใใฎใๅฟ
่ฆใจใใใ่ณชๅๅฟ็ญใ่จ่ชๆจ่ซใชใฉใฎๅน
ๅบใใฟในใฏใซๅฏพๅฟ
+ใขใผใญใใฏใใฃใฎๅคๆดใ*
+
+*BERT ใฏๆฆๅฟต็ใซใฏใทใณใใซใงใใใ็ต้จ็ใซๅผทๅใงใใ 11 ใฎ่ช็ถใช่ฆ็ด ใซ้ขใใๆฐใใๆๅ
็ซฏใฎ็ตๆใๅพใใใพใใ
+่จ่ชๅฆ็ใฟในใฏ๏ผGLUE ในใณใขใ 80.5% ใซๆผใไธใใ๏ผ7.7% ใใคใณใใฎ็ตถๅฏพๆนๅ๏ผใMultiNLI ใๅซใ๏ผ
+็ฒพๅบฆใฏ 86.7% (็ตถๅฏพๅค 4.6% ๅไธ)ใSQuAD v1.1 ่ณชๅๅฟ็ญใในใ F1 ใฏ 93.2 (็ตถๅฏพๅค 1.5 ใใคใณใ)
+ๆนๅ) ใใใณ SQuAD v2.0 ใในใ F1 ใใ 83.1 (5.1 ใใคใณใใฎ็ตถๅฏพๆนๅ)ใ*
+
+## Usage tips
+
+- BERT ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใ
+- BERT ใฏใใในใฏ่จ่ชใขใใชใณใฐ (MLM) ใใใณๆฌกใฎๆไบๆธฌ (NSP) ใฎ็ฎๆจใไฝฟ็จใใฆใใฌใผใใณใฐใใใพใใใใใใฏ
+ ใในใฏใใใใใผใฏใณใฎไบๆธฌใ NLU ใงใฏไธ่ฌใซๅน็็ใงใใใใใญในใ็ๆใซใฏๆ้ฉใงใฏใใใพใใใ
+- ใฉใณใใ ใในใญใณใฐใไฝฟ็จใใฆๅ
ฅๅใ็ ดๅฃใใพใใใใๆญฃ็ขบใซใฏใไบๅใใฌใผใใณใฐไธญใซใใใผใฏใณใฎๆๅฎใใใๅฒๅ (้ๅธธใฏ 15%) ใๆฌกใซใใฃใฆใในใฏใใใพใใ
+
+ * ็ขบ็0.8ใฎ็นๅฅใชใในใฏใใผใฏใณ
+ * ็ขบ็ 0.1 ใงใในใฏใใใใใผใฏใณใจใฏ็ฐใชใใฉใณใใ ใชใใผใฏใณ
+ * ็ขบ็ 0.1 ใฎๅใใใผใฏใณ
+
+- ใขใใซใฏๅ
ใฎๆใไบๆธฌใใๅฟ
่ฆใใใใพใใใ2 ็ช็ฎใฎ็ฎ็ใใใใพใใๅ
ฅๅใฏ 2 ใคใฎๆ A ใจ B (้ใซๅ้ขใใผใฏใณใใ) ใงใใ็ขบ็ 50% ใงใฏใๆใฏใณใผใในๅ
ใง้ฃ็ถใใฆใใพใใใๆฎใใฎ 50% ใงใฏ้ข้ฃๆงใใใใพใใใใขใใซใฏใๆใ้ฃ็ถใใฆใใใใฉใใใไบๆธฌใใๅฟ
่ฆใใใใพใใ
+
+
+
+ใใฎใขใใซใฏ [thomwolf](https://huggingface.co/thomwolf) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/google-research/bert) ใซใใใพใใ
+
+## Resources
+
+BERT ใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใ) ใชใฝใผในใฎใชในใใใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+
+
+- ใซ้ขใใใใญใฐๆ็จฟ [ๅฅใฎ่จ่ชใงใฎ BERT ใใญในใๅ้ก](https://www.philschmid.de/bert-text-classification-in-a-different-language)ใ
+- [ใใซใใฉใใซ ใใญในใๅ้กใฎใใใฎ BERT (ใใใณใใฎๅไบบ) ใฎๅพฎ่ชฟๆด](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/BERT/Fine_tuning_BERT_(and_friends)_for_multi_label_text_classification.ipynb) ใฎใใผใใใใฏ.
+- ๆนๆณใซ้ขใใใใผใใใใฏ [PyTorch ใไฝฟ็จใใใใซใใฉใใซๅ้กใฎใใใฎ BERT ใฎๅพฎ่ชฟๆด](https://colab.research.google.com/github/abhmishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)ใ
+- ๆนๆณใซ้ขใใใใผใใใใฏ [่ฆ็ดใฎใใใซ BERT ใไฝฟ็จใใฆ EncoderDecoder ใขใใซใใฆใฉใผใ ในใฟใผใใใ](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb)ใ
+- [`BertForSequenceClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)ใ
+- [`TFBertForSequenceClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)ใ
+- [`FlaxBertForSequenceClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+
+
+
+- [Hugging Face Transformers with Keras: Fine-tune a non-English BERT for Named Entity Recognition](https://www.philschmid.de/huggingface-transformers-keras-tf) ใฎไฝฟ็จๆนๆณใซ้ขใใใใญใฐๆ็จฟใ
+- ๅๅ่ชใฎๆๅใฎๅ่ช้จๅใฎใฟใไฝฟ็จใใ [ๅบๆ่กจ็พ่ช่ญใฎใใใฎ BERT ใฎๅพฎ่ชฟๆด](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/Custom_Named_Entity_Recognition_with_BERT_only_first_wordpiece.ipynb) ใฎใใผใใใใฏใใผใฏใณๅไธญใฎๅ่ชใฉใใซๅ
ใๅ่ชใฎใฉใใซใใในใฆใฎๅ่ช้จๅใซไผๆญใใใซใฏใไปฃใใใซใใผใใใใฏใฎใใฎ [ใใผใธใงใณ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/BERT/Custom_Named_Entity_Recognition_with_BERT.ipynb) ใๅ็
งใใฆใใ ใใใ
+- [`BertForTokenClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)ใ
+- [`TFBertForTokenClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`FlaxBertForTokenClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/flax/token-classification) ใซใใฃใฆใตใใผใใใใฆใใพใใ
+- [ใใผใฏใณๅ้ก](https://huggingface.co/course/chapter7/2?fw=pt) ๐ค ใใฐใใงใคในใณใผในใฎ็ซ ใ
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+
+
+
+- [`BertForMaskedLM`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`TFBertForMaskedLM`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/lang-modeling#run_mlmpy) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)ใ
+- [`FlaxBertForMaskedLM`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [ใในใฏใใใ่จ่ชใขใใชใณใฐ](https://huggingface.co/course/chapter7/3?fw=pt) ๐ค ้กใใฐ ใณใผในใฎ็ซ ใ
+- [ใในใฏใใใ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_lang_modeling)
+
+
+
+
+- [`BertForQuestionAnswering`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`TFBertForQuestionAnswering`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`FlaxBertForQuestionAnswering`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/flax/question-answering) ใงใตใใผใใใใฆใใพใใ
+- [่ณชๅๅ็ญ](https://huggingface.co/course/chapter7/7?fw=pt) ๐ค ใใฐใใงใคในใณใผในใฎ็ซ ใ
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+
+**่คๆฐใฎ้ธๆ่ข**
+- [`BertForMultipleChoice`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`TFBertForMultipleChoice`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [ๅค่ข้ธๆใฟในใฏ ใฌใคใ](../tasks/multiple_choice)
+
+โก๏ธ **ๆจ่ซ**
+- ๆนๆณใซ้ขใใใใญใฐๆ็จฟ [Hugging Face Transformers ใจ AWS Inferentia ใไฝฟ็จใใฆ BERT ๆจ่ซใ้ซ้ๅใใ](https://huggingface.co/blog/bert-inferentia-sagemaker)ใ
+- ๆนๆณใซ้ขใใใใญใฐๆ็จฟ [GPU ไธใฎ DeepSpeed-Inference ใไฝฟ็จใใฆ BERT ๆจ่ซใ้ซ้ๅใใ](https://www.philschmid.de/bert-deepspeed-inference)ใ
+
+โ๏ธ **ไบๅใใฌใผใใณใฐ**
+- [Hugging Face Transformers ใจ Habana Gaudi ใไฝฟ็จใใ BERT ใฎไบๅใใฌใผใใณใฐ ใซ้ขใใใใญใฐๆ็จฟ](https://www.philschmid.de/pre-training-bert-habana)ใ
+
+๐ **ใใใญใค**
+- ๆนๆณใซ้ขใใใใญใฐๆ็จฟ [ใใฐใใงใคในๆ้ฉๅใงใใฉใณในใใฉใผใใผใ ONNX ใซๅคๆใใ](https://www.philschmid.de/convert-transformers-to-onnx)ใ
+- ๆนๆณใซ้ขใใใใญใฐๆ็จฟ [AWS ไธใฎ Habana Gaudi ใไฝฟ็จใใใใฐ้กใใฉใณในใใฉใผใใผใฎใใใฎๆทฑๅฑคๅญฆ็ฟ็ฐๅขใฎใปใใใขใใ](https://www.philschmid.de/getting-started-habana-gaudi#conclusion)ใ
+- ใซ้ขใใใใญใฐๆ็จฟ [Hugging Face TransformersใAmazon SageMakerใใใใณ Terraform ใขใธใฅใผใซใไฝฟ็จใใ่ชๅในใฑใผใชใณใฐ BERT](https://www.philschmid.de/terraform-huggingface-amazon-sagemaker-advanced)ใ
+- ใซ้ขใใใใญใฐๆ็จฟ [HuggingFaceใAWS LambdaใDocker ใไฝฟ็จใใใตใผใใผใฌใน BERT](https://www.philschmid.de/serverless-bert-with-huggingface-aws-lambda-docker)ใ
+- ใซ้ขใใใใญใฐๆ็จฟ [Amazon SageMaker ใจ Training Compiler ใไฝฟ็จใใ Hugging Face Transformers BERT ๅพฎ่ชฟๆด](https://www.philschmid.de/huggingface-amazon-sagemaker-training-compiler)ใ
+- ใซ้ขใใใใญใฐๆ็จฟ [Transformers ใจ Amazon SageMaker ใไฝฟ็จใใ BERT ใฎใฟในใฏๅบๆใฎ็ฅ่ญใฎ่ธ็](https://www.philschmid.de/knowledge-distillation-bert-transformers)
+
+## BertConfig
+
+[[autodoc]] BertConfig
+ - all
+
+## BertTokenizer
+
+[[autodoc]] BertTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+
+
+
+## BertTokenizerFast
+
+[[autodoc]] BertTokenizerFast
+
+
+
+
+## TFBertTokenizer
+
+[[autodoc]] TFBertTokenizer
+
+
+
+
+## Bert specific outputs
+
+[[autodoc]] models.bert.modeling_bert.BertForPreTrainingOutput
+
+[[autodoc]] models.bert.modeling_tf_bert.TFBertForPreTrainingOutput
+
+[[autodoc]] models.bert.modeling_flax_bert.FlaxBertForPreTrainingOutput
+
+
+
+
+## BertModel
+
+[[autodoc]] BertModel
+ - forward
+
+## BertForPreTraining
+
+[[autodoc]] BertForPreTraining
+ - forward
+
+## BertLMHeadModel
+
+[[autodoc]] BertLMHeadModel
+ - forward
+
+## BertForMaskedLM
+
+[[autodoc]] BertForMaskedLM
+ - forward
+
+## BertForNextSentencePrediction
+
+[[autodoc]] BertForNextSentencePrediction
+ - forward
+
+## BertForSequenceClassification
+
+[[autodoc]] BertForSequenceClassification
+ - forward
+
+## BertForMultipleChoice
+
+[[autodoc]] BertForMultipleChoice
+ - forward
+
+## BertForTokenClassification
+
+[[autodoc]] BertForTokenClassification
+ - forward
+
+## BertForQuestionAnswering
+
+[[autodoc]] BertForQuestionAnswering
+ - forward
+
+
+
+
+## TFBertModel
+
+[[autodoc]] TFBertModel
+ - call
+
+## TFBertForPreTraining
+
+[[autodoc]] TFBertForPreTraining
+ - call
+
+## TFBertModelLMHeadModel
+
+[[autodoc]] TFBertLMHeadModel
+ - call
+
+## TFBertForMaskedLM
+
+[[autodoc]] TFBertForMaskedLM
+ - call
+
+## TFBertForNextSentencePrediction
+
+[[autodoc]] TFBertForNextSentencePrediction
+ - call
+
+## TFBertForSequenceClassification
+
+[[autodoc]] TFBertForSequenceClassification
+ - call
+
+## TFBertForMultipleChoice
+
+[[autodoc]] TFBertForMultipleChoice
+ - call
+
+## TFBertForTokenClassification
+
+[[autodoc]] TFBertForTokenClassification
+ - call
+
+## TFBertForQuestionAnswering
+
+[[autodoc]] TFBertForQuestionAnswering
+ - call
+
+
+
+
+
+## FlaxBertModel
+
+[[autodoc]] FlaxBertModel
+ - __call__
+
+## FlaxBertForPreTraining
+
+[[autodoc]] FlaxBertForPreTraining
+ - __call__
+
+## FlaxBertForCausalLM
+
+[[autodoc]] FlaxBertForCausalLM
+ - __call__
+
+## FlaxBertForMaskedLM
+
+[[autodoc]] FlaxBertForMaskedLM
+ - __call__
+
+## FlaxBertForNextSentencePrediction
+
+[[autodoc]] FlaxBertForNextSentencePrediction
+ - __call__
+
+## FlaxBertForSequenceClassification
+
+[[autodoc]] FlaxBertForSequenceClassification
+ - __call__
+
+## FlaxBertForMultipleChoice
+
+[[autodoc]] FlaxBertForMultipleChoice
+ - __call__
+
+## FlaxBertForTokenClassification
+
+[[autodoc]] FlaxBertForTokenClassification
+ - __call__
+
+## FlaxBertForQuestionAnswering
+
+[[autodoc]] FlaxBertForQuestionAnswering
+ - __call__
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bertweet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bertweet.md
new file mode 100644
index 0000000000000000000000000000000000000000..3a5dddbf04cc5884576083fbddac127ff24ec8ae
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bertweet.md
@@ -0,0 +1,68 @@
+
+
+# BERTweet
+
+## Overview
+
+BERTweet ใขใใซใฏใDat Quoc NguyenใThanh Vu ใซใใฃใฆ [BERTweet: A pre-trained language model for English Tweets](https://www.aclweb.org/anthology/2020.emnlp-demos.2.pdf) ใงๆๆกใใใพใใใใขใณใปใใฅใขใณใปใฐใจใณใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*็งใใกใฏใ่ฑ่ชใใคใผใ็จใซๅใใฆๅ
ฌ้ใใใๅคง่ฆๆจกใชไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซใงใใ BERTweet ใ็ดนไปใใพใใ็งใใกใฎBERTweetใฏใ
+BERT ใใผในใจๅใใขใผใญใใฏใใฃ (Devlin et al., 2019) ใฏใRoBERTa ไบๅใใฌใผใใณใฐๆ้ (Liu et al.) ใไฝฟ็จใใฆใใฌใผใใณใฐใใใพใใ
+al.ใ2019๏ผใๅฎ้จใงใฏใBERTweet ใๅผทๅใชใใผในใฉใคใณใงใใ RoBERTa ใใผในใใใณ XLM-R ใใผในใไธๅใใใใฉใผใใณในใ็คบใใใจใ็คบใใใฆใใพใ (Conneau et al.,
+2020)ใ3 ใคใฎใใคใผใ NLP ใฟในใฏใซใใใฆใไปฅๅใฎๆๅ
็ซฏใขใใซใใใๅชใใใใใฉใผใใณใน็ตๆใๅพใใใพใใใ
+ๅ่ฉใฟใฐไปใใๅบๆ่กจ็พ่ช่ญใใใณใใญในใๅ้กใ*
+
+## Usage example
+
+```python
+>>> import torch
+>>> from transformers import AutoModel, AutoTokenizer
+
+>>> bertweet = AutoModel.from_pretrained("vinai/bertweet-base")
+
+>>> # For transformers v4.x+:
+>>> tokenizer = AutoTokenizer.from_pretrained("vinai/bertweet-base", use_fast=False)
+
+>>> # For transformers v3.x:
+>>> # tokenizer = AutoTokenizer.from_pretrained("vinai/bertweet-base")
+
+>>> # INPUT TWEET IS ALREADY NORMALIZED!
+>>> line = "SC has first two presumptive cases of coronavirus , DHEC confirms HTTPURL via @USER :cry:"
+
+>>> input_ids = torch.tensor([tokenizer.encode(line)])
+
+>>> with torch.no_grad():
+... features = bertweet(input_ids) # Models outputs are now tuples
+
+>>> # With TensorFlow 2.0+:
+>>> # from transformers import TFAutoModel
+>>> # bertweet = TFAutoModel.from_pretrained("vinai/bertweet-base")
+```
+
+
+ใใฎๅฎ่ฃ
ใฏใใใผใฏใณๅๆนๆณใ้คใใฆ BERT ใจๅใใงใใ่ฉณ็ดฐใซใคใใฆใฏใ[BERT ใใญใฅใกใณใ](bert) ใๅ็
งใใฆใใ ใใใ
+API ใชใใกใฌใณในๆ
ๅ ฑใ
+
+
+
+ใใฎใขใใซใฏ [dqnguyen](https://huggingface.co/dqnguyen) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/VinAIResearch/BERTweet) ใซใใใพใใ
+
+## BertweetTokenizer
+
+[[autodoc]] BertweetTokenizer
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/big_bird.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/big_bird.md
new file mode 100644
index 0000000000000000000000000000000000000000..4c0dabbebb46d4b9eb8bb25a8ada0d80076e5c85
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/big_bird.md
@@ -0,0 +1,176 @@
+
+
+# BigBird
+
+## Overview
+
+BigBird ใขใใซใฏใ[Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) ใงๆๆกใใใพใใใ
+ใถใใผใซใใใณใธใซใจใฐใซใฌใใทใฅใใฐใซใจใใใคใใฏใใผใซใปใขใดใฃใใดใกใจใจใคใณใบใชใผใใธใงใทใฅใขใจใขใซใใซใใฃใใฏใชในใจใชใณใฟใใณใ
+ใตใณใใฃใขใดใจใใกใ ใใใฃใชใใใจใฉใใฉใใขใใซใผใใจใฏใณใใญใผใใกใณใจใคใณใใชใผใชใฉใ BigBird ใฏๆณจ็ฎๅบฆใไฝใ
+BERT ใชใฉใฎ Transformer ใใผในใฎใขใใซใใใใซ้ทใใทใผใฑใณในใซๆกๅผตใใใTransformer ใใผในใฎใขใใซใใพใฐใใซๅ ใใฆ
+ใขใใณใทใงใณใจๅๆงใซใBigBird ใฏๅ
ฅๅใทใผใฑใณในใซใฉใณใใ ใขใใณใทใงใณใ ใใงใชใใฐใญใผใใซ ใขใใณใทใงใณใ้ฉ็จใใพใใ็่ซ็ใซใฏใ
+ใพใฐใใงๅ
จไฝ็ใงใฉใณใใ ใชๆณจๆใ้ฉ็จใใใจใๅฎๅ
จใชๆณจๆใซ่ฟใฅใใใจใ็คบใใใฆใใพใใใ
+้ทใใทใผใฑใณในใงใฏ่จ็ฎๅน็ใๅคงๅน
ใซๅไธใใพใใใใ้ทใใณใณใใญในใใๅฆ็ใงใใๆฉ่ฝใฎ็ตๆใจใใฆใ
+BigBird ใฏใ่ณชๅๅฟ็ญใ
+BERT ใพใใฏ RoBERTa ใจๆฏ่ผใใ่ฆ็ดใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*BERT ใชใฉใฎใใฉใณในใใฉใผใใผใใผในใฎใขใใซใฏใNLP ใงๆใๆๅใใๆทฑๅฑคๅญฆ็ฟใขใใซใฎ 1 ใคใงใใ
+ๆฎๅฟตใชใใใใใใใฎไธญๆ ธ็ใชๅถ้ใฎ 1 ใคใฏใใทใผใฑใณในใซๅฏพใใไบๆฌกไพๅญๆง (ไธปใซใกใขใชใซ้ขใใ) ใงใใ
+ๅฎๅ
จใชๆณจๆใกใซใใบใ ใซใใ้ทใใงใใใใใ่งฃๆฑบใใใใใซใBigBird ใฏใใพใฐใใชๆณจๆใกใซใใบใ ใๆๆกใใพใใ
+ใใฎไบๆฌกไพๅญ้ขไฟใ็ทๅฝขใซๅๆธใใพใใ BigBird ใใทใผใฑใณใน้ขๆฐใฎๆฑ็จ่ฟไผผๅจใงใใใใจใ็คบใใพใใ
+ใใฅใผใชใณใฐใฏๅฎๅ
จใงใใใใใไบๆฌกๅฎๅ
จๆณจๆใขใใซใฎใใใใฎ็นๆงใไฟๅญใใใพใใ้ไธญใ็งใใกใฎ
+็่ซๅๆใซใใใO(1) ๅใฎใฐใญใผใใซ ใใผใฏใณ (CLS ใชใฉ) ใๆใคๅฉ็นใฎไธ้จใๆใใใซใชใใ
+ในใใผในๆณจๆใกใซใใบใ ใฎไธ้จใจใใฆใฎใทใผใฑใณในใๆๆกใใใในใใผใน ใขใใณใทใงใณใฏใๆฌกใฎ้ทใใฎใทใผใฑใณในใๅฆ็ใงใใพใใ
+ๅๆงใฎใใผใใฆใงใขใไฝฟ็จใใฆไปฅๅใซๅฏ่ฝใงใใฃใใใฎใฎ 8 ๅใใใ้ทใใณใณใใญในใใๅฆ็ใงใใๆฉ่ฝใฎ็ตๆใจใใฆใ
+BigBird ใฏใ่ณชๅๅฟ็ญใ่ฆ็ดใชใฉใฎใใพใใพใช NLP ใฟในใฏใฎใใใฉใผใใณในใๅคงๅน
ใซๅไธใใใพใใ็ง้ใ
+ใฒใใใฏในใใผใฟใธใฎๆฐใใใขใใชใฑใผใทใงใณใๆๆกใใพใใ*
+
+ใใใ๏ผ
+
+- BigBird ใฎๆณจๆใใฉใฎใใใซๆฉ่ฝใใใใซใคใใฆใฎ่ฉณ็ดฐใช่ชฌๆใซใคใใฆใฏใ[ใใฎใใญใฐๆ็จฟ](https://huggingface.co/blog/big-bird) ใๅ็
งใใฆใใ ใใใ
+- BigBird ใซใฏใ**original_full** ใจ **block_sparse** ใฎ 2 ใคใฎๅฎ่ฃ
ใไปๅฑใใฆใใพใใใทใผใฑใณใน้ทใ 1024 ๆชๆบใฎๅ ดๅใๆฌกใไฝฟ็จใใพใใ
+ **block_sparse** ใไฝฟ็จใใฆใใกใชใใใใชใใใใ**original_full** ใไฝฟ็จใใใใจใใๅงใใใพใใ
+- ใณใผใใฏ็พๅจใ3 ใใญใใฏใจ 2 ใฐใญใผใใซ ใใญใใฏใฎใฆใฃใณใใฆ ใตใคใบใไฝฟ็จใใฆใใพใใ
+- ใทใผใฑใณในใฎ้ทใใฏใใญใใฏ ใตใคใบใงๅฒใๅใใๅฟ
่ฆใใใใพใใ
+- ็พๅจใฎๅฎ่ฃ
ใงใฏ **ITC** ใฎใฟใใตใใผใใใใฆใใพใใ
+- ็พๅจใฎๅฎ่ฃ
ใงใฏ **num_random_blocks = 0** ใฏใตใใผใใใใฆใใพใใ
+- BigBird ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใ
+
+ ใใฎใขใใซใฏใ[vasudevgupta](https://huggingface.co/vasudevgupta) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใ่ฆใคใใ
+[ใใกใ](https://github.com/google-research/bigbird)ใ
+
+## ใใญใฅใกใณใ ใชใฝใผใน
+
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [ใในใฏใใใ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_lang_modeling)
+- [ๅค่ข้ธๆใฟในใฏ ใฌใคใ](../tasks/multiple_choice)
+
+## BigBirdConfig
+
+[[autodoc]] BigBirdConfig
+
+## BigBirdTokenizer
+
+[[autodoc]] BigBirdTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## BigBirdTokenizerFast
+
+[[autodoc]] BigBirdTokenizerFast
+
+## BigBird specific outputs
+
+[[autodoc]] models.big_bird.modeling_big_bird.BigBirdForPreTrainingOutput
+
+
+
+
+## BigBirdModel
+
+[[autodoc]] BigBirdModel
+ - forward
+
+## BigBirdForPreTraining
+
+[[autodoc]] BigBirdForPreTraining
+ - forward
+
+## BigBirdForCausalLM
+
+[[autodoc]] BigBirdForCausalLM
+ - forward
+
+## BigBirdForMaskedLM
+
+[[autodoc]] BigBirdForMaskedLM
+ - forward
+
+## BigBirdForSequenceClassification
+
+[[autodoc]] BigBirdForSequenceClassification
+ - forward
+
+## BigBirdForMultipleChoice
+
+[[autodoc]] BigBirdForMultipleChoice
+ - forward
+
+## BigBirdForTokenClassification
+
+[[autodoc]] BigBirdForTokenClassification
+ - forward
+
+## BigBirdForQuestionAnswering
+
+[[autodoc]] BigBirdForQuestionAnswering
+ - forward
+
+
+
+
+## FlaxBigBirdModel
+
+[[autodoc]] FlaxBigBirdModel
+ - __call__
+
+## FlaxBigBirdForPreTraining
+
+[[autodoc]] FlaxBigBirdForPreTraining
+ - __call__
+
+## FlaxBigBirdForCausalLM
+
+[[autodoc]] FlaxBigBirdForCausalLM
+ - __call__
+
+## FlaxBigBirdForMaskedLM
+
+[[autodoc]] FlaxBigBirdForMaskedLM
+ - __call__
+
+## FlaxBigBirdForSequenceClassification
+
+[[autodoc]] FlaxBigBirdForSequenceClassification
+ - __call__
+
+## FlaxBigBirdForMultipleChoice
+
+[[autodoc]] FlaxBigBirdForMultipleChoice
+ - __call__
+
+## FlaxBigBirdForTokenClassification
+
+[[autodoc]] FlaxBigBirdForTokenClassification
+ - __call__
+
+## FlaxBigBirdForQuestionAnswering
+
+[[autodoc]] FlaxBigBirdForQuestionAnswering
+ - __call__
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bigbird_pegasus.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bigbird_pegasus.md
new file mode 100644
index 0000000000000000000000000000000000000000..e0132b4b5f86b53b5de6d669b35a9a41ae23e3b5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bigbird_pegasus.md
@@ -0,0 +1,95 @@
+
+
+# BigBirdPegasus
+
+## Overview
+
+BigBird ใขใใซใฏใ[Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) ใงๆๆกใใใพใใใ
+ใถใใผใซใใใณใธใซใจใฐใซใฌใใทใฅใใฐใซใจใใใคใใฏใใผใซใปใขใดใฃใใดใกใจใจใคใณใบใชใผใใธใงใทใฅใขใจใขใซใใซใใฃใใฏใชในใจใชใณใฟใใณใ
+ใตใณใใฃใขใดใจใใกใ ใใใฃใชใใใจใฉใใฉใใขใใซใผใใจใฏใณใใญใผใใกใณใจใคใณใใชใผใชใฉใ BigBird ใฏๆณจ็ฎๅบฆใไฝใ
+BERT ใชใฉใฎ Transformer ใใผในใฎใขใใซใใใใซ้ทใใทใผใฑใณในใซๆกๅผตใใใTransformer ใใผในใฎใขใใซใใพใฐใใซๅ ใใฆ
+ใขใใณใทใงใณใจๅๆงใซใBigBird ใฏๅ
ฅๅใทใผใฑใณในใซใฉใณใใ ใขใใณใทใงใณใ ใใงใชใใฐใญใผใใซ ใขใใณใทใงใณใ้ฉ็จใใพใใ็่ซ็ใซใฏใ
+ใพใฐใใงๅ
จไฝ็ใงใฉใณใใ ใชๆณจๆใ้ฉ็จใใใจใๅฎๅ
จใชๆณจๆใซ่ฟใฅใใใจใ็คบใใใฆใใพใใใ
+้ทใใทใผใฑใณในใงใฏ่จ็ฎๅน็ใๅคงๅน
ใซๅไธใใพใใใใ้ทใใณใณใใญในใใๅฆ็ใงใใๆฉ่ฝใฎ็ตๆใจใใฆใ
+BigBird ใฏใ่ณชๅๅฟ็ญใ
+BERT ใพใใฏ RoBERTa ใจๆฏ่ผใใ่ฆ็ดใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*BERT ใชใฉใฎใใฉใณในใใฉใผใใผใใผในใฎใขใใซใฏใNLP ใงๆใๆๅใใๆทฑๅฑคๅญฆ็ฟใขใใซใฎ 1 ใคใงใใ
+ๆฎๅฟตใชใใใใใใใฎไธญๆ ธ็ใชๅถ้ใฎ 1 ใคใฏใใทใผใฑใณในใซๅฏพใใไบๆฌกไพๅญๆง (ไธปใซใกใขใชใซ้ขใใ) ใงใใ
+ๅฎๅ
จใชๆณจๆใกใซใใบใ ใซใใ้ทใใงใใใใใ่งฃๆฑบใใใใใซใBigBird ใฏใใพใฐใใชๆณจๆใกใซใใบใ ใๆๆกใใพใใ
+ใใฎไบๆฌกไพๅญ้ขไฟใ็ทๅฝขใซๅๆธใใพใใ BigBird ใใทใผใฑใณใน้ขๆฐใฎๆฑ็จ่ฟไผผๅจใงใใใใจใ็คบใใพใใ
+ใใฅใผใชใณใฐใฏๅฎๅ
จใงใใใใใไบๆฌกๅฎๅ
จๆณจๆใขใใซใฎใใใใฎ็นๆงใไฟๅญใใใพใใ้ไธญใ็งใใกใฎ
+็่ซๅๆใซใใใO(1) ๅใฎใฐใญใผใใซ ใใผใฏใณ (CLS ใชใฉ) ใๆใคๅฉ็นใฎไธ้จใๆใใใซใชใใ
+ในใใผในๆณจๆใกใซใใบใ ใฎไธ้จใจใใฆใฎใทใผใฑใณในใๆๆกใใใในใใผใน ใขใใณใทใงใณใฏใๆฌกใฎ้ทใใฎใทใผใฑใณในใๅฆ็ใงใใพใใ
+ๅๆงใฎใใผใใฆใงใขใไฝฟ็จใใฆไปฅๅใซๅฏ่ฝใงใใฃใใใฎใฎ 8 ๅใใใ้ทใใณใณใใญในใใๅฆ็ใงใใๆฉ่ฝใฎ็ตๆใจใใฆใ
+BigBird ใฏใ่ณชๅๅฟ็ญใ่ฆ็ดใชใฉใฎใใพใใพใช NLP ใฟในใฏใฎใใใฉใผใใณในใๅคงๅน
ใซๅไธใใใพใใ็ง้ใ
+ใฒใใใฏในใใผใฟใธใฎๆฐใใใขใใชใฑใผใทใงใณใๆๆกใใพใใ*
+
+## Usage tips
+
+- BigBird ใฎๆณจๆใใฉใฎใใใซๆฉ่ฝใใใใซใคใใฆใฎ่ฉณ็ดฐใช่ชฌๆใซใคใใฆใฏใ[ใใฎใใญใฐๆ็จฟ](https://huggingface.co/blog/big-bird) ใๅ็
งใใฆใใ ใใใ
+- BigBird ใซใฏใ**original_full** ใจ **block_sparse** ใฎ 2 ใคใฎๅฎ่ฃ
ใไปๅฑใใฆใใพใใใทใผใฑใณใน้ทใ 1024 ๆชๆบใฎๅ ดๅใๆฌกใไฝฟ็จใใพใใ
+ **block_sparse** ใไฝฟ็จใใฆใใกใชใใใใชใใใใ**original_full** ใไฝฟ็จใใใใจใใๅงใใใพใใ
+- ใณใผใใฏ็พๅจใ3 ใใญใใฏใจ 2 ใฐใญใผใใซ ใใญใใฏใฎใฆใฃใณใใฆ ใตใคใบใไฝฟ็จใใฆใใพใใ
+- ใทใผใฑใณในใฎ้ทใใฏใใญใใฏ ใตใคใบใงๅฒใๅใใๅฟ
่ฆใใใใพใใ
+- ็พๅจใฎๅฎ่ฃ
ใงใฏ **ITC** ใฎใฟใใตใใผใใใใฆใใพใใ
+- ็พๅจใฎๅฎ่ฃ
ใงใฏ **num_random_blocks = 0** ใฏใตใใผใใใใฆใใพใใใ
+- BigBirdPegasus ใฏ [PegasusTokenizer](https://github.com/huggingface/transformers/blob/main/src/transformers/models/pegasus/tokenization_pegasus.py) ใไฝฟ็จใใพใใ
+- BigBird ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใ
+
+ๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/google-research/bigbird) ใซใใใพใใ
+
+## ใใญใฅใกใณใ ใชใฝใผใน
+
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [็ฟป่จณใฟในใฏใฌใคใ](../tasks/translation)
+- [่ฆ็ดใฟในใฏใฌใคใ](../tasks/summarization)
+
+## BigBirdPegasusConfig
+
+[[autodoc]] BigBirdPegasusConfig
+ - all
+
+## BigBirdPegasusModel
+
+[[autodoc]] BigBirdPegasusModel
+ - forward
+
+## BigBirdPegasusForConditionalGeneration
+
+[[autodoc]] BigBirdPegasusForConditionalGeneration
+ - forward
+
+## BigBirdPegasusForSequenceClassification
+
+[[autodoc]] BigBirdPegasusForSequenceClassification
+ - forward
+
+## BigBirdPegasusForQuestionAnswering
+
+[[autodoc]] BigBirdPegasusForQuestionAnswering
+ - forward
+
+## BigBirdPegasusForCausalLM
+
+[[autodoc]] BigBirdPegasusForCausalLM
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/biogpt.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/biogpt.md
new file mode 100644
index 0000000000000000000000000000000000000000..0634062a6b7214f0bc7631826c05db31b1322bcd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/biogpt.md
@@ -0,0 +1,73 @@
+
+
+# BioGPT
+
+## Overview
+
+BioGPT ใขใใซใฏใ[BioGPT: generative pre-trained transformer for biomedical text generation and mining](https://academic.oup.com/bib/advance-article/doi/10.1093/bib/bbac409/6713511?guestAccessKey=a66d9b5d-4f83-4017-bb52-405815c907b9) by Renqian LuoใLiai SunใYingce Xiaใ Tao QinใSheng ZhangใHoifung PoonใTie-Yan Liuใ BioGPT ใฏใ็็ฉๅปๅญฆใใญในใใฎ็ๆใจใใคใใณใฐใฎใใใฎใใใกใคใณๅบๆใฎ็ๆไบๅใใฌใผใใณใฐๆธใฟ Transformer ่จ่ชใขใใซใงใใ BioGPT ใฏใTransformer ่จ่ชใขใใซใฎใใใฏใใผใณใซๅพใใ1,500 ไธใฎ PubMed ๆ้ฒใงๆๅใใไบๅใใฌใผใใณใฐใใใฆใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซใฏใไธ่ฌ็ใช่ช็ถ่จ่ช้ ๅใงใฎๅคงใใชๆๅใซ่งฆ็บใใใฆใ็็ฉๅปๅญฆ้ ๅใงใพใใพใๆณจ็ฎใ้ใใฆใใพใใไธ่ฌ่จ่ชใใกใคใณใฎไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซใฎ 2 ใคใฎไธปใชใใฉใณใใใคใพใ BERT (ใใใณใใฎใใชใขใณใ) ใจ GPT (ใใใณใใฎใใชใขใณใ) ใฎใใกใ1 ใค็ฎใฏ BioBERT ใ PubMedBERT ใชใฉใฎ็็ฉๅปๅญฆใใกใคใณใงๅบใ็ ็ฉถใใใฆใใพใใใใใใฏใใพใใพใชไธๆตใฎ็็ฉๅปๅญฆ็ใฟในใฏใงๅคงใใชๆๅใๅใใฆใใพใใใ็ๆ่ฝๅใฎๆฌ ๅฆใซใใๅฟ็จ็ฏๅฒใๅถ้ใใใฆใใพใใใใฎ่ซๆใงใฏใๅคง่ฆๆจกใช็็ฉๅปๅญฆๆ็ฎใงไบๅใใฌใผใใณใฐใใใใใกใคใณๅบๆใฎ็ๆ Transformer ่จ่ชใขใใซใงใใ BioGPT ใๆๆกใใพใใ็งใใกใฏ 6 ใคใฎ็็ฉๅปๅญฆ็่ช็ถ่จ่ชๅฆ็ใฟในใฏใง BioGPT ใ่ฉไพกใใใปใจใใฉใฎใฟในใฏใง็งใใกใฎใขใใซใไปฅๅใฎใขใใซใใใๅชใใฆใใใใจใๅฎ่จผใใพใใใ็นใซใBC5CDRใKD-DTIใDDI ใฎใจใณใใใผใจใณใ้ขไฟๆฝๅบใฟในใฏใงใฏใใใใ 44.98%ใ38.42%ใ40.76% ใฎ F1 ในใณใขใ็ฒๅพใใPubMedQA ใงใฏ 78.2% ใฎ็ฒพๅบฆใ็ฒๅพใใๆฐ่จ้ฒใๆจน็ซใใพใใใใใญในใ็ๆใซ้ขใใ็งใใกใฎใฑใผในในใฟใใฃใฏใ็็ฉๅปๅญฆๆ็ฎใซใใใ BioGPT ใฎๅฉ็นใใใใซๅฎ่จผใใ็็ฉๅปๅญฆ็จ่ชใฎๆตๆขใช่ชฌๆใ็ๆใใพใใ*
+
+## Usage tips
+
+- BioGPT ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅทฆๅดใงใฏใชใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+- BioGPT ใฏๅ ๆ่จ่ชใขใใชใณใฐ (CLM) ็ฎ็ใงใใฌใผใใณใฐใใใฆใใใใใใทใผใฑใณในๅ
ใฎๆฌกใฎใใผใฏใณใไบๆธฌใใใฎใซๅผทๅใงใใ run_generation.py ใตใณใใซ ในใฏใชใใใง็ขบ่ชใงใใใใใซใใใฎๆฉ่ฝใๅฉ็จใใใจใBioGPT ใฏๆงๆ็ใซไธ่ฒซใใใใญในใใ็ๆใงใใพใใ
+- ใขใใซใฏใไปฅๅใซ่จ็ฎใใใใญใผใจๅคใฎใขใใณใทใงใณ ใใขใงใใ`past_key_values`(PyTorch ใฎๅ ดๅ) ใๅ
ฅๅใจใใฆๅใๅใใใจใใงใใพใใใใฎ (past_key_values ใพใใฏ past) ๅคใไฝฟ็จใใใจใใขใใซใใใญในใ็ๆใฎใณใณใใญในใใงไบๅใซ่จ็ฎใใใๅคใๅ่จ็ฎใงใใชใใชใใพใใ PyTorch ใฎไฝฟ็จๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใBioGptForCausalLM.forward() ใกใฝใใใฎ past_key_values ๅผๆฐใๅ็
งใใฆใใ ใใใ
+
+ใใฎใขใใซใฏใ[kamalkraj](https://huggingface.co/kamalkraj) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/microsoft/BioGPT) ใซใใใพใใ
+
+## Documentation resources
+
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+
+## BioGptConfig
+
+[[autodoc]] BioGptConfig
+
+
+## BioGptTokenizer
+
+[[autodoc]] BioGptTokenizer
+ - save_vocabulary
+
+
+## BioGptModel
+
+[[autodoc]] BioGptModel
+ - forward
+
+
+## BioGptForCausalLM
+
+[[autodoc]] BioGptForCausalLM
+ - forward
+
+
+## BioGptForTokenClassification
+
+[[autodoc]] BioGptForTokenClassification
+ - forward
+
+
+## BioGptForSequenceClassification
+
+[[autodoc]] BioGptForSequenceClassification
+ - forward
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bit.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bit.md
new file mode 100644
index 0000000000000000000000000000000000000000..76b24fa64470a2180226f0eec5e96308c3e46559
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bit.md
@@ -0,0 +1,65 @@
+
+
+# Big Transfer (BiT)
+
+## Overview
+
+BiT ใขใใซใฏใAlexander KolesnikovใLucas BeyerใXiaohua ZhaiใJoan PuigcerverใJessica YungใSylvain Gelly ใซใใฃใฆ [Big Transfer (BiT): General Visual Representation Learning](https://arxiv.org/abs/1912.11370) ใงๆๆกใใใพใใใใใผใซใปใใผใซใบใใผใ
+BiT ใฏใ[ResNet](resnet) ใฎใใใชใขใผใญใใฏใใฃ (ๅ
ทไฝ็ใซใฏ ResNetv2) ใฎไบๅใใฌใผใใณใฐใในใฑใผใซใขใใใใใใใฎ็ฐกๅใชใฌใทใใงใใใใฎๆนๆณใซใใใ่ปข็งปๅญฆ็ฟใๅคงๅน
ใซๆนๅใใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ไบๅใใฌใผใใณใฐใใใ่กจ็พใฎ่ปข้ใซใใใใตใณใใซๅน็ใๅไธใใ่ฆ่ฆ็จใฎใใฃใผใ ใใฅใผใฉใซ ใใใใฏใผใฏใใใฌใผใใณใฐใใ้ใฎใใคใใผใใฉใกใผใฟใผ่ชฟๆดใ็ฐก็ด ๅใใใพใใๅคง่ฆๆจกใชๆๅธซใใใใผใฟใปใใใงใฎไบๅใใฌใผใใณใฐใจใใฟใผใฒใใ ใฟในใฏใงใฎใขใใซใฎๅพฎ่ชฟๆดใฎใใฉใใคใ ใๅๆค่จใใพใใ็งใใกใฏไบๅใใฌใผใใณใฐใในใฑใผใซใขใใใใBig Transfer (BiT) ใจๅผใถใทใณใใซใชใฌใทใใๆๆกใใพใใใใใคใใฎๆ
้ใซ้ธๆใใใใณใณใใผใใณใใ็ตใฟๅใใใใทใณใใซใชใใฅใผใชในใใฃใใฏใไฝฟ็จใใฆ่ปข้ใใใใจใซใใใ20 ใ่ถ
ใใใใผใฟใปใใใงๅชใใใใใฉใผใใณในใๅฎ็พใใพใใ BiT ใฏใใฏใฉในใใจใซ 1 ใคใฎใตใณใใซใใๅ่จ 100 ไธใฎใตใณใใซใพใงใ้ฉใใปใฉๅบ็ฏๅฒใฎใใผใฟ้ ๅใซใใใฃใฆ่ฏๅฅฝใซใใใฉใผใใณในใ็บๆฎใใพใใ BiT ใฏใILSVRC-2012 ใง 87.5%ใCIFAR-10 ใง 99.4%ใ19 ใฟในใฏใฎ Visual Task Adaptation Benchmark (VTAB) ใง 76.3% ใฎใใใ 1 ็ฒพๅบฆใ้ๆใใพใใใๅฐ่ฆๆจกใชใใผใฟใปใใใงใฏใBiT ใฏ ILSVRC-2012 (ใฏใฉในใใใ 10 ไพ) ใง 76.8%ใCIFAR-10 (ใฏใฉในใใใ 10 ไพ) ใง 97.0% ใ้ๆใใพใใใ้ซใ่ปขๅๆง่ฝใๅฎ็พใใไธป่ฆๆๅใ่ฉณ็ดฐใซๅๆโปใ
+
+## Usage tips
+
+- BiT ใขใใซใฏใใขใผใญใใฏใใฃใฎ็นใง ResNetv2 ใจๅ็ญใงใใใๆฌกใฎ็นใ็ฐใชใใพใ: 1) ใในใฆใฎใใใๆญฃ่ฆๅๅฑคใ [ใฐใซใผใๆญฃ่ฆๅ](https://arxiv.org/abs/1803.08494) ใซ็ฝฎใๆใใใใพใใ
+2) [้ใฟใฎๆจๆบๅ](https://arxiv.org/abs/1903.10520) ใฏ็ณใฟ่พผใฟๅฑคใซไฝฟ็จใใใพใใ่่
ใใฏใไธกๆนใฎ็ตใฟๅใใใๅคงใใชใใใใตใคใบใงใฎใใฌใผใใณใฐใซๅฝน็ซใกใ้่ฆใชๅนๆใใใใใจใ็คบใใฆใใพใใ
+่ปข็งปๅญฆ็ฟใธใฎๅฝฑ้ฟใ
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/google-research/big_transfer) ใซใใใพใใ
+
+## Resources
+
+BiT ใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`BitForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+- ๅ็
ง: [็ปๅๅ้กใฟในใฏ ใฌใคใ](../tasks/image_classification)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## BitConfig
+
+[[autodoc]] BitConfig
+
+## BitImageProcessor
+
+[[autodoc]] BitImageProcessor
+ - preprocess
+
+## BitModel
+
+[[autodoc]] BitModel
+ - forward
+
+## BitForImageClassification
+
+[[autodoc]] BitForImageClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blenderbot-small.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blenderbot-small.md
new file mode 100644
index 0000000000000000000000000000000000000000..ecb9c1174b285b9954e584c0193d50cb81a91fc7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blenderbot-small.md
@@ -0,0 +1,110 @@
+
+
+# Blenderbot Small
+
+[`BlenderbotSmallModel`] ใจ
+[`BlenderbotSmallForConditionalGeneration`] ใฏใใงใใฏใใคใณใใจ็ตใฟๅใใใฆใฎใฟไฝฟ็จใใใพใ
+[facebook/blenderbot-90M](https://huggingface.co/facebook/blenderbot-90M)ใใใๅคง่ฆๆจกใช Blenderbot ใใงใใฏใใคใณใใฏใ
+ไปฃใใใซ [`BlenderbotModel`] ใจใจใใซไฝฟ็จใใฆใใ ใใใ
+[`BlenderbotForConditionalGeneration`]
+
+## Overview
+
+Blender ใใฃใใใใใ ใขใใซใฏใ[Recipes for building an open-domain chatbot](https://arxiv.org/pdf/2004.13637.pdf) Stephen RollerใEmily DinanใNaman GoyalใDa JuใMary Williamsonใyinghan Liuใใงๆๆกใใใพใใใ
+ใธใณใปใทใฅใผใใใคใซใปใชใใใใซใผใใปใทใฃในใฟใผใใจใชใใฏใปMใปในใในใY-ใฉใณใปใใผใญใผใใธใงใคใฝใณใปใฆใงในใใณใ2020ๅนด4ๆ30ๆฅใ
+
+่ซๆใฎ่ฆๆจใฏๆฌกใฎใจใใใงใใ
+
+*ใชใผใใณใใกใคใณใฎใใฃใใใใใใฎๆง็ฏใฏใๆฉๆขฐๅญฆ็ฟ็ ็ฉถใซใจใฃใฆ้ฃใใๅ้ใงใใใใใพใงใฎ็ ็ฉถใงใฏๆฌกใฎใใจใ็คบใใใฆใใพใใใ
+ใใฅใผใฉใซ ใขใใซใใใฉใกใผใฟใผใฎๆฐใจใใฌใผใใณใฐๅฏพ่ฑกใฎใใผใฟใฎใตใคใบใงในใฑใผใชใณใฐใใใจใ็ตๆใๅไธใใพใใ
+้ซๆง่ฝใฎใใฃใใใใใใซใฏไปใฎ่ฆ็ด ใ้่ฆใงใใใใจใ็คบใใพใใ่ฏใไผ่ฉฑใซใฏๅคใใฎใใจใๅฟ
่ฆใงใ
+ไผ่ฉฑใฎๅฐ้ๅฎถใใทใผใ ใฌในใซ่ๅใใในใญใซ: ้ญ
ๅ็ใช่ฉฑใฎใใคใณใใๆไพใใ่ฉฑใ่ใ
+ไธ่ฒซใใๆ
ๅบฆใ็ถญๆใใชใใใ็ฅ่ญใๅ
ฑๆใๅๆงใ้ฉๅใซ่กจ็พใใ
+ใใซใฝใใ้ฉๅใชใใฌใผใใณใฐ ใใผใฟใจ้ธๆใไธใใใใๅ ดๅใๅคง่ฆๆจกใขใใซใใใใใฎในใญใซใๅญฆ็ฟใงใใใใจใ็คบใใพใใ
+ไธไปฃๆฆ็ฅใ 90Mใ2.7Bใ9.4B ใใฉใกใผใฟใผ ใขใใซใไฝฟ็จใใฆใใใใฎใฌใทใใฎใใชใขใณใใๆง็ฏใใใขใใซใไฝๆใใพใใ
+ใณใผใใฏๅ
ฌ้ใใใฆใใพใใไบบ้ใซใใ่ฉไพกใงใฏใๅฝ็คพใฎๆ่ฏใฎใขใใซใๆขๅญใฎใขใใญใผใใใใๅชใใฆใใใใจใใใซใใฟใผใณใง็คบใใใฆใใพใ
+้ญ
ๅใจไบบ้ๆงใฎๆธฌๅฎใจใใ่ฆณ็นใใใฎๅฏพ่ฉฑใๆฌกใซใๅๆใซใใฃใฆใใฎไฝๆฅญใฎ้็ใซใคใใฆ่ชฌๆใใพใใ
+ๅผ็คพๆฉ็จฎใฎๆ
้ไบไพ*
+
+ใใใ๏ผ
+
+- Blenderbot Small ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใชใฎใงใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใ
+
+ใใฎใขใใซใฏใ[patrickvonplaten](https://huggingface.co/patrickvonplaten) ใซใใฃใฆๆไพใใใพใใใ่่
ใฎใณใผใใฏๆฌกใฎใจใใใงใ
+[ใใ](https://github.com/facebookresearch/ParlAI) ใใ่ฆงใใ ใใใ
+
+## Documentation resources
+
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [็ฟป่จณใฟในใฏใฌใคใ](../tasks/translation)
+- [่ฆ็ดใฟในใฏใฌใคใ](../tasks/summarization)
+
+## BlenderbotSmallConfig
+
+[[autodoc]] BlenderbotSmallConfig
+
+## BlenderbotSmallTokenizer
+
+[[autodoc]] BlenderbotSmallTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## BlenderbotSmallTokenizerFast
+
+[[autodoc]] BlenderbotSmallTokenizerFast
+
+## BlenderbotSmallModel
+
+[[autodoc]] BlenderbotSmallModel
+ - forward
+
+## BlenderbotSmallForConditionalGeneration
+
+[[autodoc]] BlenderbotSmallForConditionalGeneration
+ - forward
+
+## BlenderbotSmallForCausalLM
+
+[[autodoc]] BlenderbotSmallForCausalLM
+ - forward
+
+## TFBlenderbotSmallModel
+
+[[autodoc]] TFBlenderbotSmallModel
+ - call
+
+## TFBlenderbotSmallForConditionalGeneration
+
+[[autodoc]] TFBlenderbotSmallForConditionalGeneration
+ - call
+
+## FlaxBlenderbotSmallModel
+
+[[autodoc]] FlaxBlenderbotSmallModel
+ - __call__
+ - encode
+ - decode
+
+## FlaxBlenderbotForConditionalGeneration
+
+[[autodoc]] FlaxBlenderbotSmallForConditionalGeneration
+ - __call__
+ - encode
+ - decode
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blenderbot.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blenderbot.md
new file mode 100644
index 0000000000000000000000000000000000000000..f7ee23e7557d7b6fb2af1b900cd122d91bebf498
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blenderbot.md
@@ -0,0 +1,132 @@
+
+
+# Blenderbot
+
+**ๅ
่ฒฌไบ้
:** ไฝใๅฅๅฆใชใใฎใ่ฆใคใใๅ ดๅใฏใ [Github Issue](https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title) ใๅ ฑๅใใฆใใ ใใใ
+
+## Overview
+
+Blender ใใฃใใใใใ ใขใใซใฏใ[Recipes for building an open-domain chatbot](https://arxiv.org/pdf/2004.13637.pdf) Stephen RollerใEmily DinanใNaman GoyalใDa JuใMary Williamsonใyinghan Liuใใงๆๆกใใใพใใใ
+ใธใณใปใทใฅใผใใใคใซใปใชใใใใซใผใใปใทใฃในใฟใผใใจใชใใฏใปMใปในใในใY-ใฉใณใปใใผใญใผใใธใงใคใฝใณใปใฆใงในใใณใ2020ๅนด4ๆ30ๆฅใ
+
+่ซๆใฎ่ฆๆจใฏๆฌกใฎใจใใใงใใ
+
+*ใชใผใใณใใกใคใณใฎใใฃใใใใใใฎๆง็ฏใฏใๆฉๆขฐๅญฆ็ฟ็ ็ฉถใซใจใฃใฆ้ฃใใๅ้ใงใใใใใพใงใฎ็ ็ฉถใงใฏๆฌกใฎใใจใ็คบใใใฆใใพใใใ
+ใใฅใผใฉใซ ใขใใซใใใฉใกใผใฟใผใฎๆฐใจใใฌใผใใณใฐๅฏพ่ฑกใฎใใผใฟใฎใตใคใบใงในใฑใผใชใณใฐใใใจใ็ตๆใๅไธใใพใใ
+้ซๆง่ฝใฎใใฃใใใใใใซใฏไปใฎ่ฆ็ด ใ้่ฆใงใใใใจใ็คบใใพใใ่ฏใไผ่ฉฑใซใฏๅคใใฎใใจใๅฟ
่ฆใงใ
+ไผ่ฉฑใฎๅฐ้ๅฎถใใทใผใ ใฌในใซ่ๅใใในใญใซ: ้ญ
ๅ็ใช่ฉฑใฎใใคใณใใๆไพใใ่ฉฑใ่ใ
+ไธ่ฒซใใๆ
ๅบฆใ็ถญๆใใชใใใ็ฅ่ญใๅ
ฑๆใๅๆงใ้ฉๅใซ่กจ็พใใ
+ใใซใฝใใ้ฉๅใชใใฌใผใใณใฐ ใใผใฟใจ้ธๆใไธใใใใๅ ดๅใๅคง่ฆๆจกใขใใซใใใใใฎในใญใซใๅญฆ็ฟใงใใใใจใ็คบใใพใใ
+ไธไปฃๆฆ็ฅใ 90Mใ2.7Bใ9.4B ใใฉใกใผใฟใผ ใขใใซใไฝฟ็จใใฆใใใใฎใฌใทใใฎใใชใขใณใใๆง็ฏใใใขใใซใไฝๆใใพใใ
+ใณใผใใฏๅ
ฌ้ใใใฆใใพใใไบบ้ใซใใ่ฉไพกใงใฏใๅฝ็คพใฎๆ่ฏใฎใขใใซใๆขๅญใฎใขใใญใผใใใใๅชใใฆใใใใจใใใซใใฟใผใณใง็คบใใใฆใใพใ
+้ญ
ๅใจไบบ้ๆงใฎๆธฌๅฎใจใใ่ฆณ็นใใใฎๅฏพ่ฉฑใๆฌกใซใๅๆใซใใฃใฆใใฎไฝๆฅญใฎ้็ใซใคใใฆ่ชฌๆใใพใใ
+ๅผ็คพๆฉ็จฎใฎๆ
้ไบไพ*
+
+ใใใ๏ผ
+
+- Blenderbot ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใ
+
+ใใฎใขใใซใฏ [sshleifer](https://huggingface.co/sshleifer) ใซใใฃใฆๆไพใใใพใใใ่่
ใฎใณใผใใฏ [ใใ](https://github.com/facebookresearch/ParlAI) ใซใใใพใใ
+
+## Implementation Notes
+
+- Blenderbot ใฏใๆจๆบใฎ [seq2seq ใขใใซ ใใฉใณในใใฉใผใใผ](https://arxiv.org/pdf/1706.03762.pdf) ใใผในใฎใขใผใญใใฏใใฃใไฝฟ็จใใพใใ
+- ๅฉ็จๅฏ่ฝใชใใงใใฏใใคใณใใฏใ[ใขใใซ ใใ](https://huggingface.co/models?search=blenderbot) ใง่ฆใคใใใใจใใงใใพใใ
+- ใใใฏ *ใใใฉใซใ* Blenderbot ใขใใซ ใฏใฉในใงใใใใ ใใๆฌกใฎใใใชๅฐใใชใใงใใฏใใคใณใใใใใคใใใใพใใ
+ `facebook/blenderbot_small_90M` ใฏใขใผใญใใฏใใฃใ็ฐใชใใใใไธ็ทใซไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+ [BlenderbotSmall](ใใฌใณใใผใใใๅฐ)ใ
+
+## Usage
+
+ใขใใซใฎไฝฟ็จไพใๆฌกใซ็คบใใพใใ
+
+```python
+>>> from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
+
+>>> mname = "facebook/blenderbot-400M-distill"
+>>> model = BlenderbotForConditionalGeneration.from_pretrained(mname)
+>>> tokenizer = BlenderbotTokenizer.from_pretrained(mname)
+>>> UTTERANCE = "My friends are cool but they eat too many carbs."
+>>> inputs = tokenizer([UTTERANCE], return_tensors="pt")
+>>> reply_ids = model.generate(**inputs)
+>>> print(tokenizer.batch_decode(reply_ids))
+[" That's unfortunate. Are they trying to lose weight or are they just trying to be healthier? "]
+```
+
+## Documentation resources
+
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [็ฟป่จณใฟในใฏใฌใคใ](../tasks/translation)
+- [่ฆ็ดใฟในใฏใฌใคใ](../tasks/summarization)
+
+## BlenderbotConfig
+
+[[autodoc]] BlenderbotConfig
+
+## BlenderbotTokenizer
+
+[[autodoc]] BlenderbotTokenizer
+ - build_inputs_with_special_tokens
+
+## BlenderbotTokenizerFast
+
+[[autodoc]] BlenderbotTokenizerFast
+ - build_inputs_with_special_tokens
+
+## BlenderbotModel
+
+*forward* ใใใณ *generate* ใฎๅผๆฐใซใคใใฆใฏใ`transformers.BartModel`ใๅ็
งใใฆใใ ใใใ
+
+[[autodoc]] BlenderbotModel
+ - forward
+
+## BlenderbotForConditionalGeneration
+
+*forward* ใจ *generate* ใฎๅผๆฐใซใคใใฆใฏใ[`~transformers.BartForConditionalGeneration`] ใๅ็
งใใฆใใ ใใใ
+
+[[autodoc]] BlenderbotForConditionalGeneration
+ - forward
+
+## BlenderbotForCausalLM
+
+[[autodoc]] BlenderbotForCausalLM
+ - forward
+
+## TFBlenderbotModel
+
+[[autodoc]] TFBlenderbotModel
+ - call
+
+## TFBlenderbotForConditionalGeneration
+
+[[autodoc]] TFBlenderbotForConditionalGeneration
+ - call
+
+## FlaxBlenderbotModel
+
+[[autodoc]] FlaxBlenderbotModel
+ - __call__
+ - encode
+ - decode
+
+## FlaxBlenderbotForConditionalGeneration
+
+[[autodoc]] FlaxBlenderbotForConditionalGeneration
+ - __call__
+ - encode
+ - decode
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blip-2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blip-2.md
new file mode 100644
index 0000000000000000000000000000000000000000..bd110522e27d60064580370a0cde06f91bb3a90f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blip-2.md
@@ -0,0 +1,90 @@
+
+
+# BLIP-2
+
+## Overview
+
+BLIP-2 ใขใใซใฏใ[BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models](https://arxiv.org/abs/2301.12597) ใงๆๆกใใใพใใใ
+Junnan Li, Dongxu Li, Silvio Savarese, Steven Hoi.ใปใตใใฌใผใผใในใใฃใผใใณใปใใคใ BLIP-2 ใฏใ่ปฝ้ใฎ 12 ๅฑค Transformer ใใใฌใผใใณใฐใใใใจใงใใใชใผใบใใใไบๅใใฌใผใใณใฐๆธใฟ็ปๅใจใณใณใผใใผใจๅคง่ฆๆจก่จ่ชใขใใซ (LLM) ใๆดป็จใใพใใ
+ใใใใฎ้ใซใจใณใณใผใใผใ้
็ฝฎใใใใพใใพใช่ฆ่ฆ่จ่ชใฟในใฏใงๆๅ
็ซฏใฎใใใฉใผใใณในใๅฎ็พใใพใใๆใๆณจ็ฎใในใ็นใฏใBLIP-2 ใ 800 ๅใใฉใกใผใฟ ใขใใซใงใใ [Flamingo](https://arxiv.org/abs/2204.14198) ใ 8.7% ๆนๅใใฆใใใใจใงใใ
+ใผใญใทใงใใ VQAv2 ใงใฏใใฌใผใใณใฐๅฏ่ฝใชใใฉใกใผใฟใผใ 54 ๅใฎ 1 ใซๆธๅฐใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๅคง่ฆๆจกใขใใซใฎใจใณใใใผใจใณใใฎใใฌใผใใณใฐใซใใใ่ฆ่ฆใจ่จ่ชใฎไบๅใใฌใผใใณใฐใฎใณในใใฏใพใใพใๆณๅคใชใใฎใซใชใฃใฆใใฆใใพใใใใฎ่ซๆใงใฏใๅธ่ฒฉใฎๅ็ตๆธใฟไบๅใใฌใผใใณใฐ็ปๅใจใณใณใผใใจๅ็ตใใใๅคง่ฆๆจก่จ่ชใขใใซใใ่ฆ่ฆ่จ่ชใฎไบๅใใฌใผใใณใฐใใใผใในใใฉใใใใใๆฑ็จ็ใงๅน็็ใชไบๅใใฌใผใใณใฐๆฆ็ฅใงใใ BLIP-2 ใๆๆกใใพใใ BLIP-2 ใฏใ2 ๆฎต้ใงไบๅใใฌใผใใณใฐใใใ่ปฝ้ใฎ Querying Transformer ใงใขใใชใใฃใฎใฎใฃใใใๆฉๆธกใใใพใใๆๅใฎในใใผใธใงใฏใใใชใผใบใใใ็ปๅใจใณใณใผใใผใใๅญฆ็ฟใใ่ฆ่ฆ่จ่ช่กจ็พใใใผใในใใฉใใใใพใใ็ฌฌ 2 ๆฎต้ใงใฏใๅ็ตใใใ่จ่ชใขใใซใใ่ฆ่ฆใใ่จ่ชใธใฎ็ๆๅญฆ็ฟใใใผใในใใฉใใใใพใใ BLIP-2 ใฏใๆขๅญใฎๆนๆณใใใใใฌใผใใณใฐๅฏ่ฝใชใใฉใกใผใฟใผใๅคงๅน
ใซๅฐใชใใซใใใใใใใใใพใใพใช่ฆ่ฆ่จ่ชใฟในใฏใงๆๅ
็ซฏใฎใใใฉใผใใณในใๅฎ็พใใพใใใใจใใฐใ็งใใกใฎใขใใซใฏใใใฌใผใใณใฐๅฏ่ฝใชใใฉใกใผใฟใผใ 54 ๅใฎ 1 ๅฐใชใใผใญใทใงใใ VQAv2 ใงใFlamingo80B ใ 8.7% ไธๅใฃใฆใใพใใใพใใ่ช็ถ่จ่ชใฎๅฝไปคใซๅพใใใจใใงใใใใผใญใทใงใใ็ปๅใใใใญในใใธใฎ็ๆใจใใใขใใซใฎๆฐใใๆฉ่ฝใๅฎ่จผใใพใ*
+
+
+
+ BLIP-2 ใขใผใญใใฏใใฃใ ๅ
ใฎ่ซๆใใๆ็ฒใ
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/salesforce/LAVIS/tree/5ee63d688ba4cebff63acee04adaef2dee9af207) ใซใใใพใใ
+
+## Usage tips
+
+- BLIP-2 ใฏใ็ปๅใจใชใใทใงใณใฎใใญในใ ใใญใณใใใๆๅฎใใฆๆกไปถไปใใใญในใใ็ๆใใใใใซไฝฟ็จใงใใพใใๆจ่ซๆใซใฏใ [`generate`] ใกใฝใใใไฝฟ็จใใใใจใใๅงใใใพใใ
+- [`Blip2Processor`] ใไฝฟ็จใใฆใขใใซ็จใฎ็ปๅใๆบๅใใไบๆธฌใใใใใผใฏใณ ID ใใใณใผใใใฆใใญในใใซๆปใใใจใใงใใพใใ
+
+## Resources
+
+BLIP-2 ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+- ็ปๅใญใฃใใทใงใณใใใธใฅใขใซ่ณชๅๅฟ็ญ (VQA)ใใใใณใใฃใใใฎใใใชไผ่ฉฑใฎใใใฎ BLIP-2 ใฎใใข ใใผใใใใฏใฏใ[ใใกใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/BLIP-2) ใซใใใพใใ
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## Blip2Config
+
+[[autodoc]] Blip2Config
+ - from_vision_qformer_text_configs
+
+## Blip2VisionConfig
+
+[[autodoc]] Blip2VisionConfig
+
+## Blip2QFormerConfig
+
+[[autodoc]] Blip2QFormerConfig
+
+## Blip2Processor
+
+[[autodoc]] Blip2Processor
+
+## Blip2VisionModel
+
+[[autodoc]] Blip2VisionModel
+ - forward
+
+## Blip2QFormerModel
+
+[[autodoc]] Blip2QFormerModel
+ - forward
+
+## Blip2Model
+
+[[autodoc]] Blip2Model
+ - forward
+ - get_text_features
+ - get_image_features
+ - get_qformer_features
+
+## Blip2ForConditionalGeneration
+
+[[autodoc]] Blip2ForConditionalGeneration
+ - forward
+ - generate
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blip.md
new file mode 100644
index 0000000000000000000000000000000000000000..c145af701f23bb33fc0b1fa5c705c24cf98d20c2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/blip.md
@@ -0,0 +1,134 @@
+
+
+# BLIP
+
+## Overview
+
+BLIP ใขใใซใฏใ[BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation](https://arxiv.org/abs/2201.12086) ใง Junnan LiใDongxu LiใCaiming XiongใSteven Hoi ใซใใฃใฆๆๆกใใใพใใใ ใ
+
+BLIP ใฏใๆฌกใฎใใใชใใพใใพใชใใซใใขใผใใซ ใฟในใฏใๅฎ่กใงใใใขใใซใงใใ
+- ่ฆ่ฆ็ใช่ณชๅๅฟ็ญ
+- ็ปๅใจใใญในใใฎๆค็ดข๏ผ็ปๅใจใใญในใใฎใใใใณใฐ๏ผ
+- ็ปๅใญใฃใใทใงใณ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*่ฆ่ฆ่จ่ชไบๅใใฌใผใใณใฐ (VLP) ใซใใใๅคใใฎ่ฆ่ฆ่จ่ชใฟในใฏใฎใใใฉใผใใณในใๅไธใใพใใใ
+ใใ ใใๆขๅญใฎไบๅใใฌใผใใณใฐๆธใฟใขใใซใฎใปใจใใฉใฏใ็่งฃใใผในใฎใฟในใฏใพใใฏไธไปฃใใผในใฎใฟในใฏใฎใใใใใงใฎใฟๅชใใฆใใพใใใใใซใๆ้ฉใงใฏใชใ็ฃ่ฆใฝใผในใงใใ Web ใใๅ้ใใใใใคใบใฎๅคใ็ปๅใจใใญในใใฎใใขใไฝฟ็จใใฆใใผใฟใปใใใในใฑใผใซใขใใใใใใจใงใใใใฉใผใใณในใฎๅไธใๅคงๅน
ใซ้ๆใใใพใใใใใฎ่ซๆใงใฏใ่ฆ่ฆ่จ่ชใฎ็่งฃใจ็ๆใฟในใฏใฎไธกๆนใซๆ่ปใซ็งป่กใใๆฐใใ VLP ใใฌใผใ ใฏใผใฏใงใใ BLIP ใๆๆกใใพใใ BLIP ใฏใใญใฃใใทใงใณใใใผใในใใฉใใใใใใจใงใใคใบใฎๅคใ Web ใใผใฟใๅนๆ็ใซๅฉ็จใใพใใใญใฃใใทใงใใผใๅๆใญใฃใใทใงใณใ็ๆใใใใฃใซใฟใผใใใคใบใฎๅคใใญใฃใใทใงใณใ้คๅปใใพใใ็ปๅใใญในใๆค็ดข (ๅนณๅๅ็พ็ +2.7%@1)ใ็ปๅใญใฃใใทใงใณไฝๆ (CIDEr ใง +2.8%)ใVQA ( VQA ในใณใขใฏ +1.6%)ใ BLIP ใฏใใผใญใทใงใใๆนๅผใงใใใช่จ่ชใฟในใฏใซ็ดๆฅ่ปข้ใใๅ ดๅใซใใๅผทๅใชไธ่ฌๅ่ฝๅใ็บๆฎใใพใใใณใผใใใขใใซใใใผใฟใปใใใใชใชใผในใใใฆใใพใใ*
+
+
+
+ใใฎใขใใซใฏ [ybelkada](https://huggingface.co/ybelkada) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/salesforce/BLIP) ใซใใใพใใ
+
+## Resources
+
+- [Jupyter ใใผใใใใฏ](https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_blip.ipynb) ใซในใฟใ ใใผใฟใปใใใฎ็ปๅใญใฃใใทใงใณ็จใซ BLIP ใๅพฎ่ชฟๆดใใๆนๆณ
+
+## BlipConfig
+
+[[autodoc]] BlipConfig
+ - from_text_vision_configs
+
+## BlipTextConfig
+
+[[autodoc]] BlipTextConfig
+
+## BlipVisionConfig
+
+[[autodoc]] BlipVisionConfig
+
+## BlipProcessor
+
+[[autodoc]] BlipProcessor
+
+## BlipImageProcessor
+
+[[autodoc]] BlipImageProcessor
+ - preprocess
+
+
+
+
+## BlipModel
+
+[[autodoc]] BlipModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## BlipTextModel
+
+[[autodoc]] BlipTextModel
+ - forward
+
+## BlipVisionModel
+
+[[autodoc]] BlipVisionModel
+ - forward
+
+## BlipForConditionalGeneration
+
+[[autodoc]] BlipForConditionalGeneration
+ - forward
+
+## BlipForImageTextRetrieval
+
+[[autodoc]] BlipForImageTextRetrieval
+ - forward
+
+## BlipForQuestionAnswering
+
+[[autodoc]] BlipForQuestionAnswering
+ - forward
+
+
+
+
+## TFBlipModel
+
+[[autodoc]] TFBlipModel
+ - call
+ - get_text_features
+ - get_image_features
+
+## TFBlipTextModel
+
+[[autodoc]] TFBlipTextModel
+ - call
+
+## TFBlipVisionModel
+
+[[autodoc]] TFBlipVisionModel
+ - call
+
+## TFBlipForConditionalGeneration
+
+[[autodoc]] TFBlipForConditionalGeneration
+ - call
+
+## TFBlipForImageTextRetrieval
+
+[[autodoc]] TFBlipForImageTextRetrieval
+ - call
+
+## TFBlipForQuestionAnswering
+
+[[autodoc]] TFBlipForQuestionAnswering
+ - call
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bloom.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bloom.md
new file mode 100644
index 0000000000000000000000000000000000000000..1ac9396fa8ab76a296507474713f2d3ae90ca57f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bloom.md
@@ -0,0 +1,107 @@
+
+
+# BLOOM
+
+## Overview
+
+BLOOM ใขใใซใฏใ[BigScience Workshop](https://bigscience.huggingface.co/) ใ้ใใฆใใพใใพใชใใผใธใงใณใงๆๆกใใใฆใใพใใ BigScience ใฏใ็ ็ฉถ่
ใๆ้ใจใชใฝใผในใใใผใซใใฆๅ
ฑๅใงใใ้ซใๅนๆใ้ๆใใไปใฎใชใผใใณ ใตใคใจใณใน ใคใใทใขใใใใใคใณในใใฌใผใทใงใณใๅพใฆใใพใใ
+BLOOM ใฎใขใผใญใใฏใใฃใฏๅบๆฌ็ใซ GPT3 (ๆฌกใฎใใผใฏใณไบๆธฌใฎใใใฎ่ชๅทฑๅๅธฐใขใใซ) ใซไผผใฆใใพใใใ46 ใฎ็ฐใชใ่จ่ชใจ 13 ใฎใใญใฐใฉใใณใฐ่จ่ชใงใใฌใผใใณใฐใใใฆใใพใใ
+ใขใใซใฎใใใคใใฎๅฐใใใใผใธใงใณใๅใใใผใฟใปใใใงใใฌใผใใณใฐใใใฆใใพใใ BLOOM ใฏๆฌกใฎใใผใธใงใณใงๅฉ็จใงใใพใใ
+
+- [bloom-560m](https://huggingface.co/bigscience/bloom-560m)
+- [bloom-1b1](https://huggingface.co/bigscience/bloom-1b1)
+- [bloom-1b7](https://huggingface.co/bigscience/bloom-1b7)
+- [bloom-3b](https://huggingface.co/bigscience/bloom-3b)
+- [bloom-7b1](https://huggingface.co/bigscience/bloom-7b1)
+- [bloom](https://huggingface.co/bigscience/bloom) (176B parameters)
+
+## Resources
+
+BLOOM ใไฝฟใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+
+
+- [`BloomForCausalLM`] ใใใซใใฃใฆใตใใผใใใใฆใใพใ [causal language modeling example script](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling) and [notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb).
+
+ไปฅไธใๅ็
งใใฆใใ ใใใ
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+
+
+โก๏ธ ๆจ่ซ
+- ใซ้ขใใใใญใฐ [ๆ้ฉๅใฎ่ฉฑ: ใใซใผใ ๆจ่ซ](https://huggingface.co/blog/bloom-inference-optimization)ใ
+- ใซ้ขใใใใญใฐ [DeepSpeed ใจ Accelerate ใไฝฟ็จใใไฟกใใใใชใใปใฉ้ซ้ใช BLOOM ๆจ่ซ](https://huggingface.co/blog/bloom-inference-pytorch-scripts)ใ
+
+โ๏ธใใฌใผใใณใฐ
+- ใซ้ขใใใใญใฐ [BLOOM ใใฌใผใใณใฐใฎ่ๅพใซใใใใฏใใญใธใผ](https://huggingface.co/blog/bloom-megatron-deepspeed)ใ
+
+## BloomConfig
+
+[[autodoc]] BloomConfig
+ - all
+
+## BloomTokenizerFast
+
+[[autodoc]] BloomTokenizerFast
+ - all
+
+
+
+
+
+## BloomModel
+
+[[autodoc]] BloomModel
+ - forward
+
+## BloomForCausalLM
+
+[[autodoc]] BloomForCausalLM
+ - forward
+
+## BloomForSequenceClassification
+
+[[autodoc]] BloomForSequenceClassification
+ - forward
+
+## BloomForTokenClassification
+
+[[autodoc]] BloomForTokenClassification
+ - forward
+
+## BloomForQuestionAnswering
+
+[[autodoc]] BloomForQuestionAnswering
+ - forward
+
+
+
+
+## FlaxBloomModel
+
+[[autodoc]] FlaxBloomModel
+ - __call__
+
+## FlaxBloomForCausalLM
+
+[[autodoc]] FlaxBloomForCausalLM
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bort.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bort.md
new file mode 100644
index 0000000000000000000000000000000000000000..2b892a35bb9cc3a6192e1afc8af89d25c032c7d1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bort.md
@@ -0,0 +1,55 @@
+
+
+# BORT
+
+
+
+ใใฎใขใใซใฏใกใณใใใณใน ใขใผใใฎใฟใงใใใใณใผใใๅคๆดใใๆฐใใ PR ใฏๅใไปใใใใพใใใ
+
+ใใฎใขใใซใฎๅฎ่กไธญใซๅ้กใ็บ็ใใๅ ดๅใฏใใใฎใขใใซใใตใใผใใใฆใใๆๅพใฎใใผใธใงใณ (v4.30.0) ใๅใคใณในใใผใซใใฆใใ ใใใ
+ใใใ่กใใซใฏใใณใใณใ `pip install -U Transformers==4.30.0` ใๅฎ่กใใพใใ
+
+
+
+## Overview
+
+BORT ใขใใซใฏใ[Optimal Subarchitecture Extraction for BERT](https://arxiv.org/abs/2010.10499) ใงๆๆกใใใพใใใ
+Adrian de Wynter and Daniel J. Perry.ใใใฏใBERT ใฎใขใผใญใใฏใใฃ ใใฉใกใผใฟใฎๆ้ฉใชใตใใปใใใงใใ
+่่
ใฏใใใซใใใจๅผใใงใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*Devlin ใใใ BERT ใขใผใญใใฏใใฃใฎใขใผใญใใฏใใฃ ใใฉใกใผใฟใฎๆ้ฉใชใตใใปใใใๆฝๅบใใพใใ (2018)
+ใใฅใผใฉใซ ใขใผใญใใฏใใฃๆค็ดขใฎใขใซใดใชใบใ ใซใใใๆ่ฟใฎ็ปๆ็ใชๆ่กใ้ฉ็จใใพใใใใฎๆ้ฉใชใตใใปใใใๆฌกใฎใใใซๅผใณใพใใ
+"Bort" ใฏๆใใใซๅฐใใใๆๅน (ใคใพใใๅใ่พผใฟๅฑคใ่ๆ
ฎใใชใ) ใตใคใบใฏ 5.5% ใงใใ
+ใชใชใธใใซใฎ BERT ๅคง่ฆๆจกใขใผใญใใฏใใฃใใใใณใใใ ใตใคใบใฎ 16%ใ Bort ใฏ 288 GPU ๆ้ใงไบๅใใฌใผใใณใฐใใใใจใใงใใพใใ
+ๆ้ซใใใฉใผใใณในใฎ BERT ใใฉใกใใชใใฏ ใขใผใญใใฏใใฃ ใใชใขใณใใงใใ RoBERTa-large ใฎไบๅใใฌใผใใณใฐใซๅฟ
่ฆใชๆ้ใฎ 1.2%
+(Liu et al., 2019)ใๅใใใทใณใง BERT-large ใใใฌใผใใณใฐใใใฎใซๅฟ
่ฆใช GPU ๆ้ใฎไธ็่จ้ฒใฎ็ด 33%
+ใใผใใฆใงใขใใพใใCPU ไธใง 7.9 ๅ้ซ้ใงใใใ ใใงใชใใไปใฎๅง็ธฎใใผใธใงใณใใใใใใฉใผใใณในใๅชใใฆใใพใใ
+ใขใผใญใใฏใใฃใใใใณไธ้จใฎ้ๅง็ธฎใใชใขใณใ: 0.3% ๏ฝ 31% ใฎใใใฉใผใใณในๅไธใๅพใใใพใใ
+BERT-large ใซ้ขใใฆใ่คๆฐใฎๅ
ฌ้่ช็ถ่จ่ช็่งฃ (NLU) ใใณใใใผใฏใซใใใ็ตถๅฏพ็ใช่ฉไพกใ*
+
+ใใฎใขใใซใฏ [stefan-it](https://huggingface.co/stefan-it) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ[ใใ](https://github.com/alexa/bort/)ใซใใใพใใ
+
+## Usage tips
+
+- BORT ใฎใขใใซ ใขใผใญใใฏใใฃใฏ BERT ใซๅบใฅใใฆใใพใใ่ฉณ็ดฐใซใคใใฆใฏใ[BERT ใฎใใญใฅใกใณใ ใใผใธ](bert) ใๅ็
งใใฆใใ ใใใ
+ ใขใใซใฎ API ใชใใกใฌใณในใจไฝฟ็จไพใ
+- BORT ใฏ BERT ใใผใฏใใคใถใผใฎไปฃใใใซ RoBERTa ใใผใฏใใคใถใผใไฝฟ็จใใพใใใใผใฏใใคใถใผใฎ API ใชใใกใฌใณในใจไฝฟ็จไพใซใคใใฆใฏใ[RoBERTa ใฎใใญใฅใกใณใ ใใผใธ](roberta) ใๅ็
งใใฆใใ ใใใ
+- BORT ใซใฏใ [Agora](https://adewynter.github.io/notes/bort_algorithms_and_applications.html#fine-tuning-with-algebraic-topology) ใจๅผใฐใใ็นๅฎใฎๅพฎ่ชฟๆดใขใซใดใชใบใ ใๅฟ
่ฆใงใใ
+ ๆฎๅฟตใชใใใพใ ใชใผใใณใฝใผในๅใใใฆใใพใใใ่ชฐใใๅฎ่ฃ
ใใใใจใใใจใใณใใฅใใใฃใซใจใฃใฆ้ๅธธใซๅฝน็ซใกใพใใ
+ BORT ใฎๅพฎ่ชฟๆดใๆฉ่ฝใใใใใใฎใขใซใดใชใบใ ใ
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bridgetower.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bridgetower.md
new file mode 100644
index 0000000000000000000000000000000000000000..e2ce1cb4c57709bb98a15bb00a346d3d41906dfb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bridgetower.md
@@ -0,0 +1,171 @@
+
+
+# BridgeTower
+
+## Overview
+
+BridgeTower ใขใใซใฏใXiao XuใChenfei WuใShachar RosenmanใVasudev LalใWanxiang CheใNan Duan [BridgeTower: Building Bridges Between Encoders in Vision-Language Representative Learning](https://arxiv.org/abs/2206.08657) ใงๆๆกใใใพใใใใใฅใขใณใใใฎใขใใซใฎ็ฎๆจใฏใ
+ๅใฆใใขใผใใซ ใจใณใณใผใใจใฏใญในใขใผใใซ ใจใณใณใผใใฎ้ใฎใใชใใธใซใใใใฏใญในใขใผใใซ ใจใณใณใผใใฎๅๅฑคใงใฎๅ
ๆฌ็ใใค่ฉณ็ดฐใชๅฏพ่ฉฑใๅฏ่ฝใซใชใใ่ฟฝๅ ใฎใใใฉใผใใณในใจ่จ็ฎใณในใใใปใจใใฉ็ก่ฆใงใใ็จๅบฆใงใใใพใใพใชไธๆตใฟในใฏใงๅชใใใใใฉใผใใณในใๅฎ็พใใพใใ
+
+ใใฎ่ซๆใฏ [AAAI'23](https://aaai.org/Conferences/AAAI-23/) ไผ่ญฐใซๆกๆใใใพใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*TWO-TOWER ใขใผใญใใฏใใฃใๅใใใใธใงใณ่จ่ช (VL) ใขใใซใฏใ่ฟๅนดใฎ่ฆ่ฆ่จ่ช่กจ็พๅญฆ็ฟใฎไธปๆตใจใชใฃใฆใใพใใ
+็พๅจใฎ VL ใขใใซใฏใ่ปฝ้ใฎใฆใใขใผใใซ ใจใณใณใผใใผใไฝฟ็จใใฆใใใฃใผใ ใฏใญในใขใผใใซ ใจใณใณใผใใผใงไธกๆนใฎใขใใชใใฃใๅๆใซๆฝๅบใไฝ็ฝฎๅใใใ่ๅใใใใจใๅญฆ็ฟใใใใไบๅใซใใฌใผใใณใฐใใใใใฃใผใ ใฆใใขใผใใซ ใจใณใณใผใใผใใๆ็ตๅฑคใฎใฆใใขใผใใซ่กจ็พใไธ้จใฎใฏใญในใขใผใใซใจใณใณใผใใผใ
+ใฉใกใใฎใขใใญใผใใใ่ฆ่ฆ่จ่ช่กจ็พใฎๅญฆ็ฟใๅถ้ใใใขใใซใฎใใใฉใผใใณในใๅถ้ใใๅฏ่ฝๆงใใใใพใใใใฎ่ซๆใงใฏใใฆใใขใผใใซ ใจใณใณใผใใฎๆไธไฝๅฑคใจใฏใญในใขใผใใซ ใจใณใณใผใใฎๅๅฑคใฎ้ใฎๆฅ็ถใๆง็ฏใใ่คๆฐใฎใใชใใธๅฑคใๅฐๅ
ฅใใ BRIDGETOWER ใๆๆกใใพใใ
+ใใใซใใใๅนๆ็ใชใใใ ใขใใใฎใฏใญในใขใผใใซ่ชฟๆดใจใใฏใญในใขใผใใซ ใจใณใณใผใใผๅ
ใฎไบๅใใฌใผใใณใฐๆธใฟใฆใใขใผใใซ ใจใณใณใผใใผใฎใใพใใพใชใปใใณใใฃใใฏ ใฌใใซใฎ่ฆ่ฆ่กจ็พใจใใญในใ่กจ็พใฎ้ใฎ่ๅใๅฏ่ฝใซใชใใพใใ BRIDGETOWER ใฏ 4M ็ปๅใฎใฟใงไบๅใใฌใผใใณใฐใใใฆใใใใใพใใพใชไธๆตใฎ่ฆ่ฆ่จ่ชใฟในใฏใงๆๅ
็ซฏใฎใใใฉใผใใณในใๅฎ็พใใพใใ
+็นใซใVQAv2 ใในใๆจๆบใปใใใงใฏใBRIDGETOWER ใฏ 78.73% ใฎ็ฒพๅบฆใ้ๆใใๅใไบๅใใฌใผใใณใฐ ใใผใฟใจใปใผ็ก่ฆใงใใ่ฟฝๅ ใใฉใกใผใฟใจ่จ็ฎใณในใใงไปฅๅใฎๆๅ
็ซฏใขใใซ METER ใ 1.09% ไธๅใใพใใใ
+็นใซใใขใใซใใใใซในใฑใผใชใณใฐใใใจใBRIDGETOWER ใฏ 81.15% ใฎ็ฒพๅบฆใ้ๆใใๆก้ใใซๅคงใใชใใผใฟใปใใใงไบๅใใฌใผใใณใฐใใใใขใใซใไธๅใใพใใใ*
+
+
+
+ ใใชใใธใฟใฏใผ ใขใผใญใใฏใใฃใ ๅ
ใฎ่ซๆใใๆ็ฒใ
+
+ใใฎใขใใซใฏใ[Anahita Bhiwandiwalla](https://huggingface.co/anahita-b)ใ[Tiep Le](https://huggingface.co/Tile)ใ[Shaoyen Tseng](https://huggingface.co/shaoyent) ใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/microsoft/BridgeTower) ใซใใใพใใ
+
+## Usage tips and examples
+
+BridgeTower ใฏใใใธใฅใขใซ ใจใณใณใผใใผใใใญในใ ใจใณใณใผใใผใใใใณ่คๆฐใฎ่ปฝ้ใใชใใธ ใฌใคใคใผใๅใใใฏใญในใขใผใใซ ใจใณใณใผใใผใงๆงๆใใใพใใ
+ใใฎใขใใญใผใใฎ็ฎๆจใฏใๅใฆใใขใผใใซ ใจใณใณใผใใผใจใฏใญในใขใผใใซ ใจใณใณใผใใผใฎ้ใซใใชใใธใๆง็ฏใใใฏใญในใขใผใใซ ใจใณใณใผใใผใฎๅๅฑคใงๅ
ๆฌ็ใใค่ฉณ็ดฐใชๅฏพ่ฉฑใๅฏ่ฝใซใใใใจใงใใใ
+ๅๅใจใใฆใๆๆกใใใใขใผใญใใฏใใฃใงใฏใไปปๆใฎใใธใฅใขใซใใใญในใใใพใใฏใฏใญในใขใผใใซ ใจใณใณใผใใ้ฉ็จใงใใพใใ
+
+[`BridgeTowerProcessor`] ใฏใ[`RobertaTokenizer`] ใจ [`BridgeTowerImageProcessor`] ใๅไธใฎใคใณในใฟใณในใซใฉใใใใไธกๆนใฎๆฉ่ฝใๅฎ็พใใพใใ
+ใใญในใใใจใณใณใผใใใ็ปๅใใใใใ็จๆใใพใใ
+
+ๆฌกใฎไพใฏใ[`BridgeTowerProcessor`] ใจ [`BridgeTowerForContrastiveLearning`] ใไฝฟ็จใใฆๅฏพ็
งๅญฆ็ฟใๅฎ่กใใๆนๆณใ็คบใใฆใใพใใ
+
+```python
+>>> from transformers import BridgeTowerProcessor, BridgeTowerForContrastiveLearning
+>>> import requests
+>>> from PIL import Image
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+>>> texts = ["An image of two cats chilling on a couch", "A football player scoring a goal"]
+
+>>> processor = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-large-itm-mlm-itc")
+>>> model = BridgeTowerForContrastiveLearning.from_pretrained("BridgeTower/bridgetower-large-itm-mlm-itc")
+
+>>> # forward pass
+>>> scores = dict()
+>>> for text in texts:
+... # prepare inputs
+... encoding = processor(image, text, return_tensors="pt")
+... outputs = model(**encoding)
+... scores[text] = outputs
+```
+
+ๆฌกใฎไพใฏใ[`BridgeTowerProcessor`] ใจ [`BridgeTowerForImageAndTextRetrieval`] ใไฝฟ็จใใฆ็ปๅใใญในใใฎๅๅพใๅฎ่กใใๆนๆณใ็คบใใฆใใพใใ
+
+```python
+>>> from transformers import BridgeTowerProcessor, BridgeTowerForImageAndTextRetrieval
+>>> import requests
+>>> from PIL import Image
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+>>> texts = ["An image of two cats chilling on a couch", "A football player scoring a goal"]
+
+>>> processor = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
+>>> model = BridgeTowerForImageAndTextRetrieval.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
+
+>>> # forward pass
+>>> scores = dict()
+>>> for text in texts:
+... # prepare inputs
+... encoding = processor(image, text, return_tensors="pt")
+... outputs = model(**encoding)
+... scores[text] = outputs.logits[0, 1].item()
+```
+
+ๆฌกใฎไพใฏใ[`BridgeTowerProcessor`] ใจ [`BridgeTowerForMaskedLM`] ใไฝฟ็จใใฆใในใฏใใใ่จ่ชใขใใชใณใฐใๅฎ่กใใๆนๆณใ็คบใใฆใใพใใ
+
+```python
+>>> from transformers import BridgeTowerProcessor, BridgeTowerForMaskedLM
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "http://images.cocodataset.org/val2017/000000360943.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
+>>> text = "a looking out of the window"
+
+>>> processor = BridgeTowerProcessor.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
+>>> model = BridgeTowerForMaskedLM.from_pretrained("BridgeTower/bridgetower-base-itm-mlm")
+
+>>> # prepare inputs
+>>> encoding = processor(image, text, return_tensors="pt")
+
+>>> # forward pass
+>>> outputs = model(**encoding)
+
+>>> results = processor.decode(outputs.logits.argmax(dim=-1).squeeze(0).tolist())
+
+>>> print(results)
+.a cat looking out of the window.
+```
+
+ใใใ๏ผ
+
+- BridgeTower ใฎใใฎๅฎ่ฃ
ใงใฏใ[`RobertaTokenizer`] ใไฝฟ็จใใฆใใญในใๅใ่พผใฟใ็ๆใใOpenAI ใฎ CLIP/ViT ใขใใซใไฝฟ็จใใฆ่ฆ่ฆ็ๅใ่พผใฟใ่จ็ฎใใพใใ
+- ไบๅใใฌใผใใณใฐใใใ [bridgeTower-base](https://huggingface.co/BridgeTower/bridgetower-base) ใใใณ [bridgetower ใในใฏใใใ่จ่ชใขใใชใณใฐใจ็ปๅใใญในใ ใใใใณใฐ](https://huggingface.co/BridgeTower/bridgetower--base-itm-mlm) ใฎใใงใใฏใใคใณใ ใใชใชใผในใใใพใใใ
+- ็ปๅๆค็ดขใใใณใใฎไปใฎไธๆตใฟในใฏใซใใใ BridgeTower ใฎใใใฉใผใใณในใซใคใใฆใฏใ[่กจ 5](https://arxiv.org/pdf/2206.08657.pdf) ใๅ็
งใใฆใใ ใใใ
+- ใใฎใขใใซใฎ PyTorch ใใผใธใงใณใฏใtorch 1.10 ไปฅ้ใงใฎใฟไฝฟ็จใงใใพใใ
+
+## BridgeTowerConfig
+
+[[autodoc]] BridgeTowerConfig
+
+## BridgeTowerTextConfig
+
+[[autodoc]] BridgeTowerTextConfig
+
+## BridgeTowerVisionConfig
+
+[[autodoc]] BridgeTowerVisionConfig
+
+## BridgeTowerImageProcessor
+
+[[autodoc]] BridgeTowerImageProcessor
+ - preprocess
+
+## BridgeTowerProcessor
+
+[[autodoc]] BridgeTowerProcessor
+ - __call__
+
+## BridgeTowerModel
+
+[[autodoc]] BridgeTowerModel
+ - forward
+
+## BridgeTowerForContrastiveLearning
+
+[[autodoc]] BridgeTowerForContrastiveLearning
+ - forward
+
+## BridgeTowerForMaskedLM
+
+[[autodoc]] BridgeTowerForMaskedLM
+ - forward
+
+## BridgeTowerForImageAndTextRetrieval
+
+[[autodoc]] BridgeTowerForImageAndTextRetrieval
+ - forward
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bros.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bros.md
new file mode 100644
index 0000000000000000000000000000000000000000..3749a172a8286b044947acb688834ba6ffafd697
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/bros.md
@@ -0,0 +1,113 @@
+
+
+# BROS
+
+## Overview
+
+BROS ใขใใซใฏใTeakgyu HonใDonghyun KimใMingi Ji, Wonseok Hwang, Daehyun Nam, Sungrae Park ใซใใฃใฆ [BROS: A Pre-trained Language Model Focusing on Text and Layout for Better Key Information Extraction from Documents](https://arxiv.org/abs/2108.04539) ใงๆๆกใใใพใใใ
+
+BROS ใฏ *BERT Relying On Spatality* ใฎ็ฅใงใใใใใฏใไธ้ฃใฎใใผใฏใณใจใใฎๅข็ใใใฏในใๅ
ฅๅใจใใฆๅใๅใใไธ้ฃใฎ้ ใ็ถๆ
ใๅบๅใใใจใณใณใผใใผๅฐ็จใฎ Transformer ใขใใซใงใใ BROS ใฏใ็ตถๅฏพ็ใช็ฉบ้ๆ
ๅ ฑใไฝฟ็จใใไปฃใใใซใ็ธๅฏพ็ใช็ฉบ้ๆ
ๅ ฑใใจใณใณใผใใใพใใ
+
+BERT ใงไฝฟ็จใใใใใผใฏใณใในใฏ่จ่ชใขใใชใณใฐ็ฎๆจ (TMLM) ใจๆฐใใใจใชใขใในใฏ่จ่ชใขใใชใณใฐ็ฎๆจ (AMLM) ใฎ 2 ใคใฎ็ฎๆจใงไบๅใใฌใผใใณใฐใใใฆใใพใใ
+TMLM ใงใฏใใใผใฏใณใฏใฉใณใใ ใซใในใฏใใใใขใใซใฏ็ฉบ้ๆ
ๅ ฑใจไปใฎใในใฏใใใฆใใชใใใผใฏใณใไฝฟ็จใใฆใในใฏใใใใใผใฏใณใไบๆธฌใใพใใ
+AMLM ใฏ TMLM ใฎ 2D ใใผใธใงใณใงใใใใญในใ ใใผใฏใณใใฉใณใใ ใซใในใฏใใTMLM ใจๅใๆ
ๅ ฑใงไบๆธฌใใพใใใใใญในใ ใใญใใฏ (้ ๅ) ใใในใฏใใพใใ
+
+`BrosForTokenClassification`ใซใฏใBrosModel ใฎไธใซๅ็ดใช็ทๅฝขๅฑคใใใใพใใๅใใผใฏใณใฎใฉใใซใไบๆธฌใใพใใ
+`BrosSpadeEEForTokenClassification`ใซใฏใBrosModel ใฎไธใซ`initial_token_classifier`ใจ`subsequent_token_classifier`ใใใใพใใ `initial_token_classifier` ใฏๅใจใณใใฃใใฃใฎๆๅใฎใใผใฏใณใไบๆธฌใใใใใซไฝฟ็จใใใ`subsequent_token_classifier` ใฏใจใณใใฃใใฃๅ
ใฎๆฌกใฎใใผใฏใณใไบๆธฌใใใใใซไฝฟ็จใใใพใใ `BrosSpadeELForTokenClassification`ใซใฏ BrosModel ใฎไธใซ`entity_linker`ใใใใพใใ `entity_linker` ใฏ 2 ใคใฎใจใณใใฃใใฃ้ใฎ้ขไฟใไบๆธฌใใใใใซไฝฟ็จใใใพใใ
+
+`BrosForTokenClassification`ใจ`BrosSpadeEEForTokenClassification`ใฏๅบๆฌ็ใซๅใใธใงใใๅฎ่กใใพใใใใ ใใ`BrosForTokenClassification`ใฏๅ
ฅๅใใผใฏใณใๅฎๅ
จใซใทใชใขใซๅใใใฆใใใใจใๅๆใจใใฆใใพใ (ใใผใฏใณใฏ 2D ็ฉบ้ใซๅญๅจใใใใใใใใฏ้ๅธธใซๅฐ้ฃใชไฝๆฅญใงใ)ใไธๆนใ`BrosSpadeEEForTokenClassification`ใฏ 1 ใคใฎใใผใฏใณใใๆฌกใฎๆฅ็ถใใผใฏใณใไบๆธฌใใใใใใทใชใขใซๅใจใฉใผใฎๅฆ็ใใใๆ่ปใซ่กใใใจใใงใใพใใ
+
+`BrosSpadeELForTokenClassification` ใฏใจใณใใฃใใฃๅ
ใฎใชใณใฏ ใฟในใฏใๅฎ่กใใพใใใใใ 2 ใคใฎใจใณใใฃใใฃใไฝใใใฎ้ขไฟใๅ
ฑๆใใๅ ดๅใ(ใใใจใณใใฃใใฃใฎ) 1 ใคใฎใใผใฏใณใใ (ๅฅใฎใจใณใใฃใใฃใฎ) ๅฅใฎใใผใฏใณใธใฎ้ขไฟใไบๆธฌใใพใใ
+
+BROS ใฏใๆ็คบ็ใช่ฆ่ฆๆฉ่ฝใซไพๅญใใใซใFUNSDใSROIEใCORDใSciTSR ใชใฉใฎ Key Information Extraction (KIE) ใใณใใใผใฏใงๅ็ญไปฅไธใฎ็ตๆใ้ๆใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๆๆธ็ปๅใใใฎ้่ฆๆ
ๅ ฑๆฝๅบ (KIE) ใซใฏใ2 ๆฌกๅ
(2D) ็ฉบ้ใซใใใใใญในใใฎๆ่็ใใใณ็ฉบ้็ๆๅณ่ซใ็่งฃใใๅฟ
่ฆใใใใพใใๆ่ฟใฎ็ ็ฉถใฎๅคใใฏใๆๆธ็ปๅใฎ่ฆ่ฆ็็นๅพดใจใใญในใใใใณใใฎใฌใคใขใฆใใ็ตใฟๅใใใใใจใซ้็นใ็ฝฎใใไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซใ้็บใใใใจใงใใใฎ่ชฒ้กใ่งฃๆฑบใใใใจใใฆใใพใใไธๆนใใใฎใใผใใผใงใฏใใใญในใใจใฌใคใขใฆใใฎๅนๆ็ใช็ตใฟๅใใใจใใๅบๆฌใซ็ซใก่ฟใฃใฆใใฎๅ้กใซๅใ็ตใฟใพใใๅ
ทไฝ็ใซใฏใBROS (BERT Relying On Spatality) ใจใใๅๅใฎไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซใๆๆกใใพใใใใฎ่จ่ชใขใใซใฏใ2D ็ฉบ้ๅ
ใฎใใญในใใฎ็ธๅฏพไฝ็ฝฎใใจใณใณใผใใใใจใชใข ใในใญใณใฐๆฆ็ฅใไฝฟ็จใใฆใฉใใซใฎใชใใใญใฅใกใณใใใๅญฆ็ฟใใพใใ 2D ็ฉบ้ๅ
ใฎใใญในใใ็่งฃใใใใใฎใใฎๆ้ฉๅใใใใใฌใผใใณใฐ ในใญใผใ ใซใใใBROS ใฏใ่ฆ่ฆ็ใช็นๅพดใซไพๅญใใใใจใชใใ4 ใคใฎ KIE ใใณใใใผใฏ (FUNSDใSROIE*ใCORDใใใใณ SciTSR) ใงไปฅๅใฎๆนๆณใจๆฏ่ผใใฆๅ็ญไปฅไธใฎใใใฉใผใใณในใ็คบใใพใใใใพใใใใฎ่ซๆใงใฏใKIE ใฟในใฏใซใใใ 2 ใคใฎ็พๅฎไธ็ใฎ่ชฒ้ก ((1) ้้ใฃใใใญในใ้ ๅบใซใใใจใฉใผใฎๆๅฐๅใใใใณ (2) ๅฐๆฐใฎไธๆตไพใใใฎๅน็็ใชๅญฆ็ฟ) ใๆใใใซใใไปฅๅใฎๆนๆณใซๅฏพใใ BROS ใฎๅชไฝๆงใๅฎ่จผใใพใใ*
+
+ใใฎใขใใซใฏ [jinho8345](https://huggingface.co/jinho8345) ใซใใฃใฆๅฏ็จฟใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/clovaai/bros) ใซใใใพใใ
+
+## Usage tips and examples
+
+- [`~transformers.BrosModel.forward`] ใซใฏใ`input_ids` ใจ `bbox` (ใใฆใณใใฃใณใฐ ใใใฏใน) ใๅฟ
่ฆใงใใๅๅข็ใใใฏในใฏใ(x0ใy0ใx1ใy1) ๅฝขๅผ (ๅทฆไธ้
ใๅณไธ้
) ใงใใๅฟ
่ฆใใใใพใใๅข็ใใใฏในใฎๅๅพใฏๅค้จ OCR ใทในใใ ใซไพๅญใใพใใ ใxใๅบงๆจใฏใใญใฅใกใณใ็ปๅใฎๅน
ใงๆญฃ่ฆๅใใๅฟ
่ฆใใใใใyใๅบงๆจใฏใใญใฅใกใณใ็ปๅใฎ้ซใใงๆญฃ่ฆๅใใๅฟ
่ฆใใใใพใใ
+
+```python
+def expand_and_normalize_bbox(bboxes, doc_width, doc_height):
+ # here, bboxes are numpy array
+
+ # Normalize bbox -> 0 ~ 1
+ bboxes[:, [0, 2]] = bboxes[:, [0, 2]] / width
+ bboxes[:, [1, 3]] = bboxes[:, [1, 3]] / height
+```
+
+- [`~transformers.BrosForTokenClassification.forward`ใ`~transformers.BrosSpadeEEForTokenClassification.forward`ใ`~transformers.BrosSpadeEEForTokenClassification.forward`] ใงใฏใๆๅคฑ่จ็ฎใซ `input_ids` ใจ `bbox` ใ ใใงใชใ `box_first_token_mask` ใๅฟ
่ฆใงใใใใใฏใๅใใใฏในใฎๅ
้ ญไปฅๅคใฎใใผใฏใณใ้คๅคใใใใใฎใในใฏใงใใใใฎใในใฏใฏใๅ่ชใใ `input_ids` ใไฝๆใใใจใใซๅข็ใใใฏในใฎ้ๅงใใผใฏใณ ใคใณใใใฏในใไฟๅญใใใใจใงๅๅพใงใใพใใๆฌกใฎใณใผใใง`box_first_token_mask`ใไฝๆใงใใพใใ
+
+```python
+def make_box_first_token_mask(bboxes, words, tokenizer, max_seq_length=512):
+
+ box_first_token_mask = np.zeros(max_seq_length, dtype=np.bool_)
+
+ # encode(tokenize) each word from words (List[str])
+ input_ids_list: List[List[int]] = [tokenizer.encode(e, add_special_tokens=False) for e in words]
+
+ # get the length of each box
+ tokens_length_list: List[int] = [len(l) for l in input_ids_list]
+
+ box_end_token_indices = np.array(list(itertools.accumulate(tokens_length_list)))
+ box_start_token_indices = box_end_token_indices - np.array(tokens_length_list)
+
+ # filter out the indices that are out of max_seq_length
+ box_end_token_indices = box_end_token_indices[box_end_token_indices < max_seq_length - 1]
+ if len(box_start_token_indices) > len(box_end_token_indices):
+ box_start_token_indices = box_start_token_indices[: len(box_end_token_indices)]
+
+ # set box_start_token_indices to True
+ box_first_token_mask[box_start_token_indices] = True
+
+ return box_first_token_mask
+
+```
+
+## Resources
+
+- ใใข ในใฏใชใใใฏ [ใใกใ](https://github.com/clovaai/bros) ใซใใใพใใ
+
+## BrosConfig
+
+[[autodoc]] BrosConfig
+
+## BrosProcessor
+
+[[autodoc]] BrosProcessor
+ - __call__
+
+## BrosModel
+
+[[autodoc]] BrosModel
+ - forward
+
+
+## BrosForTokenClassification
+
+[[autodoc]] BrosForTokenClassification
+ - forward
+
+## BrosSpadeEEForTokenClassification
+
+[[autodoc]] BrosSpadeEEForTokenClassification
+ - forward
+
+## BrosSpadeELForTokenClassification
+
+[[autodoc]] BrosSpadeELForTokenClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/byt5.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/byt5.md
new file mode 100644
index 0000000000000000000000000000000000000000..c6796f981817dc46eeb14f913f0cf707bc2bede1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/byt5.md
@@ -0,0 +1,154 @@
+
+
+# ByT5
+
+## Overview
+
+ByT5 ใขใใซใฏใ[ByT5: Towards a token-free future with pre-trained byte-to-byte models](https://arxiv.org/abs/2105.13626) by Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir
+Kale, Adam Roberts, Colin Raffel.
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๆใๅบใไฝฟ็จใใใฆใใไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซใฏใๅ่ชใพใใฏใตใใฏใผใๅไฝใซๅฏพๅฟใใใใผใฏใณใฎใทใผใฑใณในใงๅไฝใใพใใ
+ใใญในใใใใผใฏใณใฎใทใผใฑใณในใจใใฆใจใณใณใผใใใใซใฏใใใผใฏใใคใถใผใๅฟ
่ฆใงใใใใผใฏใใคใถใผใฏ้ๅธธใ
+ใขใใซใไปฃใใใซ็ใฎใใญในใ (ใใคใใพใใฏๆๅญ) ใ็ดๆฅๆไฝใใใใผใฏใณใใชใผ ใขใใซใซใฏๅคใใฎๅฉ็นใใใใพใใ
+ใใใซไฝฟ็จใงใใใใใใ่จ่ชใฎใใญในใใๅฆ็ใงใใใใคใบใซๅฏพใใฆใใๅ
็ขใงใใใๆ่ก็่ฒ ๅตใๆๅฐ้ใซๆใใพใใ
+่ค้ใงใจใฉใผใ็บ็ใใใใใใญในใๅๅฆ็ใใคใใฉใคใณใๅ้คใใพใใใใคใใพใใฏๆๅญๅใใใผใฏใณใใ้ทใใใ
+ใใผใฏใณใใชใผ ใขใใซใซ้ขใใ้ๅปใฎ็ ็ฉถใงใฏใใทใผใฑใณในใฎใณในใใๅๅดใใใใใซ่จญ่จใใใๆฐใใใขใใซ ใขใผใญใใฏใใฃใๅฐๅ
ฅใใใใใจใใใใใใพใใใ
+็ใฎใใญในใใ็ดๆฅๆไฝใใพใใใใฎ่ซๆใงใฏใๆจๆบ็ใช Transformer ใขใผใญใใฏใใฃใๆฌกใฎใใใชใใฎใงไฝฟ็จใงใใใใจใ็คบใใพใใ
+ใใคใใทใผใฑใณในใๅฆ็ใใใใใฎๆๅฐ้ใฎๅคๆดใใใฉใกใผใฟๆฐใฎ่ฆณ็นใใใใฌใผใใชใใๆณจๆๆทฑใ็นๅพดไปใใพใใ
+FLOP ใฎใใฌใผใใณใฐใจๆจ่ซ้ๅบฆใ่ชฟในใใใคใใฌใใซใฎใขใใซใใใผใฏใณใฌใใซใจ็ซถๅใงใใใใจใ็คบใใพใใ
+ๅฏพๅฟ่
ใใพใใใใคใใฌใใซใฎใขใใซใฏใใคใบใซๅฏพใใฆๅคงๅน
ใซๅ
็ขใงใใใใใๅชใใใใใฉใผใใณในใ็บๆฎใใใใจใ็คบใใฆใใพใใ
+ในใใซใจ็บ้ณใซๆๆใชใฟในใฏใ็งใใกใฎ่ฒข็ฎใฎไธ็ฐใจใใฆใๆฐใใใปใใใใชใชใผในใใพใใ
+T5 ใขใผใญใใฏใใฃใซๅบใฅใใไบๅใใฌใผใใณใฐๆธใฟใฎใใคใใฌใใซใฎ Transformer ใขใใซใจใใใใงไฝฟ็จใใใใในใฆใฎใณใผใใจใใผใฟ
+ๅฎ้จใ*
+
+ใใฎใขใใซใฏใ[patrickvonplaten](https://huggingface.co/patrickvonplaten) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏๆฌกใฎใจใใใงใ
+[ใใ](https://github.com/google-research/byt5) ใซใใใพใใ
+
+
+
+ByT5 ใฎใขใผใญใใฏใใฃใฏ T5v1.1 ใขใใซใซๅบใฅใใฆใใพใใAPI ใชใใกใฌใณในใซใคใใฆใฏใ[T5v1.1 ใฎใใญใฅใกใณใ ใใผใธ](t5v1.1) ใๅ็
งใใฆใใ ใใใๅฝผใใฏ
+ใขใใซใฎๅ
ฅๅใๆบๅใใๆนๆณใ็ฐใชใใ ใใงใใไปฅไธใฎใณใผใไพใๅ็
งใใฆใใ ใใใ
+
+
+
+ByT5 ใฏๆๅธซใชใใงไบๅใใฌใผใใณใฐใใใฆใใใใใๅไธใฟในใฏไธญใซใฟในใฏ ใใฌใใฃใใฏในใไฝฟ็จใใๅฉ็นใฏใใใพใใใ
+ๅพฎ่ชฟๆดใใใซใใฟในใฏใฎๅพฎ่ชฟๆดใ่กใๅ ดๅใฏใใใฌใใฃใใฏในใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+## Usage Examples
+
+ByT5 ใฏ็ใฎ UTF-8 ใใคใใงๅไฝใใใใใใใผใฏใใคใถใผใชใใงไฝฟ็จใงใใพใใ
+
+```python
+>>> from transformers import T5ForConditionalGeneration
+>>> import torch
+
+>>> model = T5ForConditionalGeneration.from_pretrained("google/byt5-small")
+
+>>> num_special_tokens = 3
+>>> # Model has 3 special tokens which take up the input ids 0,1,2 of ByT5.
+>>> # => Need to shift utf-8 character encodings by 3 before passing ids to model.
+
+>>> input_ids = torch.tensor([list("Life is like a box of chocolates.".encode("utf-8"))]) + num_special_tokens
+
+>>> labels = torch.tensor([list("La vie est comme une boรฎte de chocolat.".encode("utf-8"))]) + num_special_tokens
+
+>>> loss = model(input_ids, labels=labels).loss
+>>> loss.item()
+2.66
+```
+
+ใใ ใใใใใๆจ่ซใจใใฌใผใใณใฐใฎๅ ดๅใฏใใใผใฏใใคใถใผใไฝฟ็จใใใใจใใๅงใใใพใใ
+
+
+```python
+>>> from transformers import T5ForConditionalGeneration, AutoTokenizer
+
+>>> model = T5ForConditionalGeneration.from_pretrained("google/byt5-small")
+>>> tokenizer = AutoTokenizer.from_pretrained("google/byt5-small")
+
+>>> model_inputs = tokenizer(
+... ["Life is like a box of chocolates.", "Today is Monday."], padding="longest", return_tensors="pt"
+... )
+>>> labels_dict = tokenizer(
+... ["La vie est comme une boรฎte de chocolat.", "Aujourd'hui c'est lundi."], padding="longest", return_tensors="pt"
+... )
+>>> labels = labels_dict.input_ids
+
+>>> loss = model(**model_inputs, labels=labels).loss
+>>> loss.item()
+17.9
+```
+
+[T5](t5) ใจๅๆงใซใByT5 ใฏในใใณใในใฏใใคใบ้คๅปใฟในใฏใงใใฌใผใใณใฐใใใพใใใใใใใ
+ใขใใซใฏใญใฃใฉใฏใฟใผใซ็ดๆฅไฝ็จใใใใใไบๅใใฌใผใใณใฐใฟในใฏใฏๅฐใ่ค้ใงใ
+้ใใใฎใใใคใใฎๆๅญใ็ ดๆใใฆใฟใพใใใ
+`"The dog chases a ball in the park."`ใจใใๆใๅ
ฅๅใใByT5 ใซไบๆธฌใใฆใใใใพใใ
+ใใใใใกใฎใใใ
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+>>> import torch
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google/byt5-base")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("google/byt5-base")
+
+>>> input_ids_prompt = "The dog chases a ball in the park."
+>>> input_ids = tokenizer(input_ids_prompt).input_ids
+
+>>> # Note that we cannot add "{extra_id_...}" to the string directly
+>>> # as the Byte tokenizer would incorrectly merge the tokens
+>>> # For ByT5, we need to work directly on the character level
+>>> # Contrary to T5, ByT5 does not use sentinel tokens for masking, but instead
+>>> # uses final utf character ids.
+>>> # UTF-8 is represented by 8 bits and ByT5 has 3 special tokens.
+>>> # => There are 2**8+2 = 259 input ids and mask tokens count down from index 258.
+>>> # => mask to "The dog [258]a ball [257]park."
+
+>>> input_ids = torch.tensor([input_ids[:8] + [258] + input_ids[14:21] + [257] + input_ids[28:]])
+>>> input_ids
+tensor([[ 87, 107, 104, 35, 103, 114, 106, 35, 258, 35, 100, 35, 101, 100, 111, 111, 257, 35, 115, 100, 117, 110, 49, 1]])
+
+>>> # ByT5 produces only one char at a time so we need to produce many more output characters here -> set `max_length=100`.
+>>> output_ids = model.generate(input_ids, max_length=100)[0].tolist()
+>>> output_ids
+[0, 258, 108, 118, 35, 119, 107, 104, 35, 114, 113, 104, 35, 122, 107, 114, 35, 103, 114, 104, 118, 257, 35, 108, 113, 35, 119, 107, 104, 35, 103, 108, 118, 102, 114, 256, 108, 113, 35, 119, 107, 104, 35, 115, 100, 117, 110, 49, 35, 87, 107, 104, 35, 103, 114, 106, 35, 108, 118, 35, 119, 107, 104, 35, 114, 113, 104, 35, 122, 107, 114, 35, 103, 114, 104, 118, 35, 100, 35, 101, 100, 111, 111, 35, 108, 113, 255, 35, 108, 113, 35, 119, 107, 104, 35, 115, 100, 117, 110, 49]
+
+>>> # ^- Note how 258 descends to 257, 256, 255
+
+>>> # Now we need to split on the sentinel tokens, let's write a short loop for this
+>>> output_ids_list = []
+>>> start_token = 0
+>>> sentinel_token = 258
+>>> while sentinel_token in output_ids:
+... split_idx = output_ids.index(sentinel_token)
+... output_ids_list.append(output_ids[start_token:split_idx])
+... start_token = split_idx
+... sentinel_token -= 1
+
+>>> output_ids_list.append(output_ids[start_token:])
+>>> output_string = tokenizer.batch_decode(output_ids_list)
+>>> output_string
+['', 'is the one who does', ' in the disco', 'in the park. The dog is the one who does a ball in', ' in the park.']
+```
+
+## ByT5Tokenizer
+
+[[autodoc]] ByT5Tokenizer
+
+่ฉณ็ดฐใซใคใใฆใฏใ[`ByT5Tokenizer`] ใๅ็
งใใฆใใ ใใใ
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/camembert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/camembert.md
new file mode 100644
index 0000000000000000000000000000000000000000..db8e0aa936936d52a0e850db070b66c8bd1f2d8f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/camembert.md
@@ -0,0 +1,135 @@
+
+
+# CamemBERT
+
+## Overview
+
+CamemBERT ใขใใซใฏใ[CamemBERT: a Tasty French Language Model](https://arxiv.org/abs/1911.03894) ใงๆๆกใใใพใใใ
+Louis Martin, Benjamin Muller, Pedro Javier Ortiz Suรกrez, Yoann Dupont, Laurent Romary, รric Villemonte de la
+Clergerie, Djamรฉ Seddah, and Benoรฎt Sagot. 2019ๅนดใซใชใชใผในใใใFacebookใฎRoBERTaใขใใซใใใผในใซใใใขใใซใงใใ
+138GBใฎใใฉใณใน่ชใใญในใใงใใฌใผใใณใฐใใใพใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ไบๅใใฌใผใใณใฐใใใ่จ่ชใขใใซใฏ็พๅจใ่ช็ถ่จ่ชๅฆ็ใงๅบใๆฎๅใใฆใใพใใๆๅใซใใใใใใใๅฉ็จๅฏ่ฝใชใปใจใใฉใฎ
+ใขใใซใฏ่ฑ่ชใฎใใผใฟใใพใใฏ่คๆฐ่จ่ชใฎใใผใฟใฎ้ฃ็ตใงใใฌใผใใณใฐใใใฆใใพใใใใใซใใใ
+ใใฎใใใชใขใใซใฎๅฎ้ใฎไฝฟ็จใฏใ่ฑ่ชใ้คใใในใฆใฎ่จ่ชใง้ๅธธใซ้ใใใฆใใพใใใใฉใณในไบบใซใจใฃใฆใใฎๅ้กใซๅฏพๅฆใใใใจใ็ฎๆใใฆใ
+Bi-direction Encoders for Transformers (BERT) ใฎใใฉใณใน่ช็ใงใใ CamemBERT ใใชใชใผในใใพใใๆธฌๅฎใใพใ
+่คๆฐใฎไธๆตใฟในใฏใใคใพใๅ่ฉใฟใฐไปใใซใใใๅค่จ่ชใขใใซใจๆฏ่ผใใ CamemBERT ใฎใใใฉใผใใณใน
+ไพๅญ้ขไฟ่งฃๆใๅบๆ่กจ็พ่ช่ญใ่ช็ถ่จ่ชๆจ่ซใ CamemBERT ใฏๆๅ
็ซฏๆ่กใๅไธใใใพใ
+ๆค่จใใใฆใใใปใจใใฉใฎใฟในใฏใซๅฏพๅฟใใพใใ็งใใกใฏใ็ ็ฉถใจ
+ใใฉใณใน่ช NLP ใฎไธๆตใขใใชใฑใผใทใงใณใ*
+
+ใใฎใขใใซใฏ [camembert](https://huggingface.co/camembert) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://camembert-model.fr/) ใซใใใพใใ
+
+
+
+
+ใใฎๅฎ่ฃ
ใฏRoBERTaใจๅใใงใใไฝฟ็จไพใซใคใใฆใฏ[RoBERTaใฎใใญใฅใกใณใ](roberta)ใๅ็
งใใฆใใ ใใใ
+ๅ
ฅๅใจๅบๅใซ้ขใใๆ
ๅ ฑใจใใฆใ
+
+
+
+## Resources
+
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [ใในใฏ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_language_modeling)
+- [ๅค่ข้ธๆใฟในใฏ ใฌใคใ](../tasks/multiple_choice)
+
+## CamembertConfig
+
+[[autodoc]] CamembertConfig
+
+## CamembertTokenizer
+
+[[autodoc]] CamembertTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## CamembertTokenizerFast
+
+[[autodoc]] CamembertTokenizerFast
+
+
+
+
+## CamembertModel
+
+[[autodoc]] CamembertModel
+
+## CamembertForCausalLM
+
+[[autodoc]] CamembertForCausalLM
+
+## CamembertForMaskedLM
+
+[[autodoc]] CamembertForMaskedLM
+
+## CamembertForSequenceClassification
+
+[[autodoc]] CamembertForSequenceClassification
+
+## CamembertForMultipleChoice
+
+[[autodoc]] CamembertForMultipleChoice
+
+## CamembertForTokenClassification
+
+[[autodoc]] CamembertForTokenClassification
+
+## CamembertForQuestionAnswering
+
+[[autodoc]] CamembertForQuestionAnswering
+
+
+
+
+## TFCamembertModel
+
+[[autodoc]] TFCamembertModel
+
+## TFCamembertForCasualLM
+
+[[autodoc]] TFCamembertForCausalLM
+
+## TFCamembertForMaskedLM
+
+[[autodoc]] TFCamembertForMaskedLM
+
+## TFCamembertForSequenceClassification
+
+[[autodoc]] TFCamembertForSequenceClassification
+
+## TFCamembertForMultipleChoice
+
+[[autodoc]] TFCamembertForMultipleChoice
+
+## TFCamembertForTokenClassification
+
+[[autodoc]] TFCamembertForTokenClassification
+
+## TFCamembertForQuestionAnswering
+
+[[autodoc]] TFCamembertForQuestionAnswering
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/canine.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/canine.md
new file mode 100644
index 0000000000000000000000000000000000000000..18af699967d1ad9b81edbd8cade078697f007cce
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/canine.md
@@ -0,0 +1,144 @@
+
+
+# CANINE
+
+## Overview
+
+CANINE ใขใใซใฏใ[CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language
+Representation](https://arxiv.org/abs/2103.06874)ใJonathan H. ClarkใDan GarretteใIulia TurcใJohn Wieting ่ใใใฎ
+ๆ็คบ็ใชใใผใฏใณๅในใใใ (ใใคใ ใใขใชใฉ) ใไฝฟ็จใใใซ Transformer ใใใฌใผใใณใฐใใๆๅใฎ่ซๆใฎ 1 ใค
+ใจใณใณใผใใฃใณใฐ (BPEใWordPiece ใพใใฏ SentencePiece)ใไปฃใใใซใใขใใซใฏ Unicode ๆๅญใฌใใซใง็ดๆฅใใฌใผใใณใฐใใใพใใ
+ใญใฃใฉใฏใฟใผใฌใใซใงใฎใใฌใผใใณใฐใงใฏๅฟ
็ถ็ใซใทใผใฑใณในใฎ้ทใใ้ทใใชใใพใใใCANINE ใฏใใใๅน็็ใชๆนๆณใง่งฃๆฑบใใพใใ
+ใใฃใผใ Transformer ใจใณใณใผใใ้ฉ็จใใๅใซใใใฆใณใตใณใใชใณใฐๆฆ็ฅใๅฎ่กใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ใใคใใฉใคใณ NLP ใทในใใ ใฏใใจใณใใใผใจใณใใฎใใฅใผใฉใซ ใขใใชใณใฐใซๅคง้จๅใๅใฃใฆไปฃใใใใฆใใพใใใไธ่ฌ็ใซไฝฟ็จใใใฆใใใปใผใในใฆใฎใขใใซใฏ
+ไพ็ถใจใใฆๆ็คบ็ใชใใผใฏใณๅๆ้ ใๅฟ
่ฆใงใใๆ่ฟใฎใใผใฏใณๅใขใใญใผใใฏใใผใฟ็ฑๆฅใฎใตใใฏใผใใซๅบใฅใใฆใใพใใใ
+ใฌใญใทใณใณใฏๆๅใงไฝๆใใใใใผใฏใใคใถใผใใใ่ๅผฑใงใฏใใใพใใใใใใใใฎๆ่กใฏใในใฆใฎ่จ่ชใซ็ญใใ้ฉใใฆใใใใใงใฏใใใพใใใ
+่จ่ชใๅบๅฎ่ชๅฝใฎไฝฟ็จใซใใใใขใใซใฎ้ฉๅฟ่ฝๅใๅถ้ใใใๅฏ่ฝๆงใใใใพใใใใฎ่ซๆใงใฏใCANINE ใ็ดนไปใใพใใ
+ๆ็คบ็ใชใใผใฏใณๅใ่ชๅฝใไฝฟ็จใใใซใๆๅญใทใผใฑใณในใ็ดๆฅๆไฝใใใใฅใผใฉใซ ใจใณใณใผใใผใจใ
+ๆๅญใซ็ดๆฅไฝ็จใใใใใชใใทใงใณใงใตใใฏใผใใใฝใใ่ชๅฐใใคใขในใจใใฆไฝฟ็จใใไบๅใใฌใผใใณใฐๆฆ็ฅใ
+ใใใใใฎ็ดฐใใๅ
ฅๅใๅนๆ็ใใคๅน็็ใซไฝฟ็จใใใใใซใCANINE ใฏใใฆใณใตใณใใชใณใฐใ็ตใฟๅใใใฆใๅ
ฅๅใๅๆธใใพใใ
+ใณใณใใญในใใใจใณใณใผใใใใใฃใผใใใฉใณในใใฉใผใใผในใฟใใฏใๅใใใทใผใฑใณในใฎ้ทใใ CANINE ใฏใๅ็ญใฎ mBERT ใขใใซใใใๆฌกใฎ็นใงๅชใใฆใใพใใ
+TyDi QA ใฎ 2.8 F1 ใฏใใขใใซ ใใฉใกใผใฟใ 28% ๅฐใชใใซใใใใใใใๅฐ้ฃใชๅค่จ่ชใใณใใใผใฏใงใใ*
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/google-research/language/tree/master/language/canine) ใซใใใพใใ
+
+## Usage tips
+
+- CANINE ใฏๅ
้จใงๅฐใชใใจใ 3 ใคใฎ Transformer ใจใณใณใผใใผใไฝฟ็จใใพใ: 2 ใคใฎใๆต
ใใใจใณใณใผใใผ (ๅไธใฎใจใณใณใผใใผใฎใฟใงๆงๆ)
+ ใฌใคใคใผ) ใจ 1 ใคใฎใใใฃใผใใใจใณใณใผใใผ (้ๅธธใฎ BERT ใจใณใณใผใใผ)ใใพใใใๆต
ใใใจใณใณใผใใไฝฟ็จใใฆใณใณใใญในใใ่จญๅฎใใพใใ
+ ใญใผใซใซ ใขใใณใทใงใณใไฝฟ็จใใๆๅญใฎๅใ่พผใฟใๆฌกใซใใใฆใณใตใณใใชใณใฐใฎๅพใใใใฃใผใใใจใณใณใผใใผใ้ฉ็จใใใพใใใคใใซใ
+ ใขใใใตใณใใชใณใฐๅพใใๆต
ใใใจใณใณใผใใไฝฟ็จใใฆๆ็ต็ใชๆๅญๅใ่พผใฟใไฝๆใใใพใใใขใใใจ
+ ใใฆใณใตใณใใชใณใฐใซใคใใฆใฏ่ซๆใซ่จ่ผใใใฆใใพใใ
+- CANINE ใฏใใใใฉใซใใง 2048 ๆๅญใฎๆๅคงใทใผใฑใณใน้ทใไฝฟ็จใใพใใ [`CanineTokenizer`] ใไฝฟ็จใงใใพใ
+ ใขใใซ็จใฎใใญในใใๆบๅใใพใใ
+- ็นๅฅใช [CLS] ใใผใฏใณใฎๆ็ต็ใช้่กจ็คบ็ถๆ
ใฎไธใซ็ทๅฝขใฌใคใคใผใ้
็ฝฎใใใใจใงๅ้กใ่กใใใจใใงใใพใใ
+ (ไบๅๅฎ็พฉใใใ Unicode ใณใผใ ใใคใณใใใใใพใ)ใใใ ใใใใผใฏใณๅ้กใฟในใฏใฎๅ ดๅใฏใใใฆใณใตใณใใชใณใฐใใใใทใผใฑใณใน
+ ใใผใฏใณใฏใๅ
ใฎๆๅญใทใผใฑใณในใฎ้ทใ (2048) ใจไธ่ดใใใใใซๅๅบฆใขใใใตใณใใชใณใฐใใๅฟ
่ฆใใใใพใใใฎ
+ ่ฉณ็ดฐใซใคใใฆใฏใ่ซๆใๅ็
งใใฆใใ ใใใ
+
+ใขใใซใฎใใงใใฏใใคใณใ:
+
+ - [google/canine-c](https://huggingface.co/google/canine-c): ่ชๅทฑๅๅธฐๆๅญๆๅคฑใงไบๅใใฌใผใใณใฐๆธใฟใ
+ 12 ใฌใคใคใผใ768 ้ ใใ12 ใใใใ121M ใใฉใกใผใฟใผ (ใตใคใบ ~500 MB)ใ
+ - [google/canine-s](https://huggingface.co/google/canine-s): ใตใใฏใผใๆๅคฑใงไบๅใใฌใผใใณใฐๆธใฟใ12 ๅฑคใ
+ 768 ๅใฎ้่กจ็คบใ12 ใใใใ121M ใใฉใกใผใฟใผ (ใตใคใบ ~500 MB)ใ
+
+## Usage example
+
+CANINE ใฏ็ใฎๆๅญใงๅไฝใใใใใ**ใใผใฏใใคใถใผใชใ**ใงไฝฟ็จใงใใพใใ
+
+```python
+>>> from transformers import CanineModel
+>>> import torch
+
+>>> model = CanineModel.from_pretrained("google/canine-c") # model pre-trained with autoregressive character loss
+
+>>> text = "hello world"
+>>> # use Python's built-in ord() function to turn each character into its unicode code point id
+>>> input_ids = torch.tensor([[ord(char) for char in text]])
+
+>>> outputs = model(input_ids) # forward pass
+>>> pooled_output = outputs.pooler_output
+>>> sequence_output = outputs.last_hidden_state
+```
+
+ใใ ใใใใใๆจ่ซใจใใฌใผใใณใฐใฎๅ ดๅใฏใใใผใฏใใคใถใผใไฝฟ็จใใใใจใใๅงใใใพใ๏ผใในใฆใใใใฃใณใฐ/ๅใ่ฉฐใใใใ๏ผ
+ใทใผใฑใณในใๅใ้ทใใซใใพใ):
+
+```python
+>>> from transformers import CanineTokenizer, CanineModel
+
+>>> model = CanineModel.from_pretrained("google/canine-c")
+>>> tokenizer = CanineTokenizer.from_pretrained("google/canine-c")
+
+>>> inputs = ["Life is like a box of chocolates.", "You never know what you gonna get."]
+>>> encoding = tokenizer(inputs, padding="longest", truncation=True, return_tensors="pt")
+
+>>> outputs = model(**encoding) # forward pass
+>>> pooled_output = outputs.pooler_output
+>>> sequence_output = outputs.last_hidden_state
+```
+
+## Resources
+
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ๅค่ข้ธๆใฟในใฏ ใฌใคใ](../tasks/multiple_choice)
+
+## CanineConfig
+
+[[autodoc]] CanineConfig
+
+## CanineTokenizer
+
+[[autodoc]] CanineTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+
+## CANINE specific outputs
+
+[[autodoc]] models.canine.modeling_canine.CanineModelOutputWithPooling
+
+## CanineModel
+
+[[autodoc]] CanineModel
+ - forward
+
+## CanineForSequenceClassification
+
+[[autodoc]] CanineForSequenceClassification
+ - forward
+
+## CanineForMultipleChoice
+
+[[autodoc]] CanineForMultipleChoice
+ - forward
+
+## CanineForTokenClassification
+
+[[autodoc]] CanineForTokenClassification
+ - forward
+
+## CanineForQuestionAnswering
+
+[[autodoc]] CanineForQuestionAnswering
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/chinese_clip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/chinese_clip.md
new file mode 100644
index 0000000000000000000000000000000000000000..8d7dc401d2ae7e5c232acded8b9ccdc858c8c145
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/chinese_clip.md
@@ -0,0 +1,112 @@
+
+
+# Chinese-CLIP
+
+## Overview
+
+Chinese-CLIP An Yang, Junshu Pan, Junyang Lin, Rui Men, Yichang Zhang, Jingren Zhou, Chang Zhou [Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese](https://arxiv.org/abs/2211.01335) ใงๆๆกใใใพใใใๅจใๅผตๅจใ
+Chinese-CLIP ใฏใไธญๅฝ่ชใฎ็ปๅใจใใญในใใฎใใขใฎๅคง่ฆๆจกใชใใผใฟใปใใใซๅฏพใใ CLIP (Radford et al., 2021) ใฎๅฎ่ฃ
ใงใใใฏใญในใขใผใใซๆค็ดขใๅฎ่กใงใใใปใใใผใญใทใงใใ็ปๅๅ้กใใชใผใใณใใกใคใณใชใใธใงใฏใๆคๅบใชใฉใฎใใธใงใณใฟในใฏใฎใใธใงใณใใใฏใใผใณใจใใฆใๆฉ่ฝใใพใใใชใชใธใใซใฎไธญๅฝ่ช-CLIPใณใผใใฏ[ใใฎใชใณใฏใง](https://github.com/OFA-Sys/Chinese-CLIP)ใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*CLIP ใฎๅคงๆๅ (Radford et al., 2021) ใซใใใ่ฆ่ฆ่จ่ชใฎไบๅ่จ็ทดใฎใใใฎๅฏพ็
งๅญฆ็ฟใฎ็ ็ฉถใจๅฟ็จใไฟ้ฒใใใพใใใใใฎ็ ็ฉถใงใฏใใปใจใใฉใฎใใผใฟใๅ
ฌ้ใใใฆใใใใผใฟใปใใใใๅๅพใใใไธญๅฝ่ชใฎ็ปๅใจใใญในใใฎใใขใฎๅคง่ฆๆจกใชใใผใฟใปใใใๆง็ฏใใๆฐใใใใผใฟใปใใใงไธญๅฝ่ชใฎ CLIP ใขใใซใไบๅใใฌใผใใณใฐใใพใใๅฝ็คพใงใฏใ7,700 ไธใใ 9 ๅ 5,800 ไธใฎใใฉใกใผใฟใซใใใใ่คๆฐใฎใตใคใบใฎ 5 ใคใฎไธญๅฝ CLIP ใขใใซใ้็บใใฆใใพใใใใใซใใขใใซใฎใใใฉใผใใณในใๅไธใใใใใใซใๆๅใซ็ปๅใจใณใณใผใใผใใใชใผใบใใใฆใขใใซใใใฌใผใใณใฐใใๆฌกใซใในใฆใฎใใฉใกใผใฟใผใๆ้ฉๅใใฆใใฌใผใใณใฐใใ 2 ๆฎต้ใฎไบๅใใฌใผใใณใฐๆนๆณใๆๆกใใพใใ็งใใกใฎๅ
ๆฌ็ใชๅฎ้จใงใฏใไธญๅฝใฎ CLIP ใใผใญใทใงใใๅญฆ็ฟใจๅพฎ่ชฟๆดใฎใปใใใขใใใง MUGEใFlickr30K-CNใใใใณ COCO-CN ไธใงๆๅ
็ซฏใฎใใใฉใผใใณในใ้ๆใงใใใผใญใง็ซถไบๅใฎใใใใใฉใผใใณในใ้ๆใงใใใใจใๅฎ่จผใใฆใใพใใ - ELEVATER ใใณใใใผใฏใงใฎ่ฉไพกใซๅบใฅใใทใงใใ็ปๅใฎๅ้ก (Li et al., 2022)ใใณใผใใไบๅใใฌใผใใณใฐๆธใฟใขใใซใใใขใใชใชใผในใใใพใใใ*
+
+Chinese-CLIP ใขใใซใฏใ[OFA-Sys](https://huggingface.co/OFA-Sys) ใซใใฃใฆๆไพใใใพใใใ
+
+## Usage example
+
+ไปฅไธใฎใณใผใ ในใใใใใฏใ็ปๅใจใใญในใใฎ็นๅพดใจ้กไผผๆงใ่จ็ฎใใๆนๆณใ็คบใใฆใใพใใ
+
+```python
+>>> from PIL import Image
+>>> import requests
+>>> from transformers import ChineseCLIPProcessor, ChineseCLIPModel
+
+>>> model = ChineseCLIPModel.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
+>>> processor = ChineseCLIPProcessor.from_pretrained("OFA-Sys/chinese-clip-vit-base-patch16")
+
+>>> url = "https://clip-cn-beijing.oss-cn-beijing.aliyuncs.com/pokemon.jpeg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+>>> # Squirtle, Bulbasaur, Charmander, Pikachu in English
+>>> texts = ["ๆฐๅฐผ้พ", "ๅฆ่็งๅญ", "ๅฐ็ซ้พ", "็ฎๅกไธ"]
+
+>>> # compute image feature
+>>> inputs = processor(images=image, return_tensors="pt")
+>>> image_features = model.get_image_features(**inputs)
+>>> image_features = image_features / image_features.norm(p=2, dim=-1, keepdim=True) # normalize
+
+>>> # compute text features
+>>> inputs = processor(text=texts, padding=True, return_tensors="pt")
+>>> text_features = model.get_text_features(**inputs)
+>>> text_features = text_features / text_features.norm(p=2, dim=-1, keepdim=True) # normalize
+
+>>> # compute image-text similarity scores
+>>> inputs = processor(text=texts, images=image, return_tensors="pt", padding=True)
+>>> outputs = model(**inputs)
+>>> logits_per_image = outputs.logits_per_image # this is the image-text similarity score
+>>> probs = logits_per_image.softmax(dim=1) # probs: [[1.2686e-03, 5.4499e-02, 6.7968e-04, 9.4355e-01]]
+```
+
+็พๅจใๆฌกใฎในใฑใผใซใฎไบๅใใฌใผใใณใฐๆธใฟ Chinese-CLIP ใขใใซใ ๐ค Hub ใงๅฉ็จๅฏ่ฝใงใใ
+
+- [OFA-Sys/chinese-clip-vit-base-patch16](https://huggingface.co/OFA-Sys/chinese-clip-vit-base-patch16)
+- [OFA-Sys/chinese-clip-vit-large-patch14](https://huggingface.co/OFA-Sys/chinese-clip-vit-large-patch14)
+- [OFA-Sys/chinese-clip-vit-large-patch14-336px](https://huggingface.co/OFA-Sys/chinese-clip-vit-large-patch14-336px)
+- [OFA-Sys/chinese-clip-vit-huge-patch14](https://huggingface.co/OFA-Sys/chinese-clip-vit-huge-patch14)
+
+## ChineseCLIPConfig
+
+[[autodoc]] ChineseCLIPConfig
+ - from_text_vision_configs
+
+## ChineseCLIPTextConfig
+
+[[autodoc]] ChineseCLIPTextConfig
+
+## ChineseCLIPVisionConfig
+
+[[autodoc]] ChineseCLIPVisionConfig
+
+## ChineseCLIPImageProcessor
+
+[[autodoc]] ChineseCLIPImageProcessor
+ - preprocess
+
+## ChineseCLIPFeatureExtractor
+
+[[autodoc]] ChineseCLIPFeatureExtractor
+
+## ChineseCLIPProcessor
+
+[[autodoc]] ChineseCLIPProcessor
+
+## ChineseCLIPModel
+
+[[autodoc]] ChineseCLIPModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## ChineseCLIPTextModel
+
+[[autodoc]] ChineseCLIPTextModel
+ - forward
+
+## ChineseCLIPVisionModel
+
+[[autodoc]] ChineseCLIPVisionModel
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clap.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clap.md
new file mode 100644
index 0000000000000000000000000000000000000000..f1e08d76018face65ab0ff4b28b03407e17bcaa8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clap.md
@@ -0,0 +1,80 @@
+
+
+# CLAP
+
+## Overview
+
+CLAP ใขใใซใฏใ[Large Scale Contrastive Language-Audio pretraining with
+feature fusion and keyword-to-caption augmentation](https://arxiv.org/pdf/2211.06687.pdf)ใYusong WuใKe ChenใTianyu ZhangใYuchen HuiใTaylor Berg-KirkpatrickใShlomo Dubnov ่ใ
+
+CLAP (Contrastive Language-Audio Pretraining) ใฏใใใพใใพใช (้ณๅฃฐใใใญในใ) ใใขใงใใฌใผใใณใฐใใใใใฅใผใฉใซ ใใใใฏใผใฏใงใใใฟในใฏใซๅใใใฆ็ดๆฅๆ้ฉๅใใใใจใชใใ้ณๅฃฐใไธใใใใๅ ดๅใซๆใ้ข้ฃๆงใฎ้ซใใใญในใ ในใใใใใไบๆธฌใใใใใซๆ็คบใงใใพใใ CLAP ใขใใซใฏใSWINTransformer ใไฝฟ็จใใฆ log-Mel ในใใฏใใญใฐใฉใ ๅ
ฅๅใใใชใผใใฃใช็นๅพดใๅๅพใใRoBERTa ใขใใซใไฝฟ็จใใฆใใญในใ็นๅพดใๅๅพใใพใใๆฌกใซใใใญในใใจใชใผใใฃใชใฎไธกๆนใฎ็นๅพดใใๅใๆฌกๅ
ใฎๆฝๅจ็ฉบ้ใซๆๅฝฑใใใพใใๆๅฝฑใใใใชใผใใฃใชใจใใญในใใฎ็นๅพดใฎ้ใฎใใใ็ฉใใๅๆงใฎในใณใขใจใใฆไฝฟ็จใใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๅฏพ็
งๅญฆ็ฟใฏใใใซใใขใผใใซ่กจ็พๅญฆ็ฟใฎๅ้ใง็ฎ่ฆใพใใๆๅใๅใใฆใใพใใใใฎ่ซๆใงใฏใ้ณๅฃฐใใผใฟใจ่ช็ถ่จ่ช่จ่ฟฐใ็ตใฟๅใใใฆ้ณๅฃฐ่กจ็พใ้็บใใใๅฏพ็
ง็ใช่จ่ช้ณๅฃฐไบๅใใฌใผใใณใฐใฎใใคใใฉใคใณใๆๆกใใพใใใใฎ็ฎๆจใ้ๆใใใใใซใ็งใใกใฏใพใใใใพใใพใชใใผใฟ ใฝใผในใใใฎ 633,526 ๅใฎ้ณๅฃฐใจใใญในใใฎใใขใฎๅคง่ฆๆจกใชใณใฌใฏใทใงใณใงใใ LAION-Audio-630K ใใชใชใผในใใพใใๆฌกใซใใใพใใพใชใชใผใใฃใช ใจใณใณใผใใจใใญในใ ใจใณใณใผใใ่ๆ
ฎใใฆใๅฏพ็
ง็ใช่จ่ชใจใชใผใใฃใชใฎไบๅใใฌใผใใณใฐ ใขใใซใๆง็ฏใใพใใๆฉ่ฝ่ๅใกใซใใบใ ใจใญใผใฏใผใใใใญใฃใใทใงใณใธใฎๆกๅผตใใขใใซ่จญ่จใซ็ตใฟ่พผใใงใใขใใซใๅฏๅค้ทใฎ้ณๅฃฐๅ
ฅๅใๅฆ็ใงใใใใใซใใใใใฉใผใใณในใๅไธใใใพใใ 3 ็ช็ฎใซใๅ
ๆฌ็ใชๅฎ้จใๅฎ่กใใฆใใใญในใใใ้ณๅฃฐใธใฎๅๅพใใผใญใทใงใใ้ณๅฃฐๅ้กใๆๅธซไปใ้ณๅฃฐๅ้กใฎ 3 ใคใฎใฟในใฏใซใใใฃใฆใขใใซใ่ฉไพกใใพใใ็ตๆใฏใ็งใใกใฎใขใใซใใใญในใใใ้ณๅฃฐใธใฎๆค็ดขใฟในใฏใซใใใฆๅชใใใใใฉใผใใณในใ้ๆใใฆใใใใจใ็คบใใฆใใพใใใชใผใใฃใชๅ้กใฟในใฏใงใฏใใขใใซใฏใผใญใทใงใใ่จญๅฎใงๆๅ
็ซฏใฎใใใฉใผใใณในใ้ๆใใ้ใผใญใทใงใใ่จญๅฎใงใใขใใซใฎ็ตๆใซๅนๆตใใใใใฉใผใใณในใๅพใใใจใใงใใพใใ LAION-ใชใผใใฃใช-6*
+
+ใใฎใขใใซใฏใ[Younes Belkada](https://huggingface.co/ybelkada) ใใใณ [Arthur Zucker](https://huggingface.co/ArthurZ) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/LAION-AI/Clap) ใซใใใพใใ
+
+## ClapConfig
+
+[[autodoc]] ClapConfig
+ - from_text_audio_configs
+
+## ClapTextConfig
+
+[[autodoc]] ClapTextConfig
+
+## ClapAudioConfig
+
+[[autodoc]] ClapAudioConfig
+
+## ClapFeatureExtractor
+
+[[autodoc]] ClapFeatureExtractor
+
+## ClapProcessor
+
+[[autodoc]] ClapProcessor
+
+## ClapModel
+
+[[autodoc]] ClapModel
+ - forward
+ - get_text_features
+ - get_audio_features
+
+## ClapTextModel
+
+[[autodoc]] ClapTextModel
+ - forward
+
+## ClapTextModelWithProjection
+
+[[autodoc]] ClapTextModelWithProjection
+ - forward
+
+## ClapAudioModel
+
+[[autodoc]] ClapAudioModel
+ - forward
+
+## ClapAudioModelWithProjection
+
+[[autodoc]] ClapAudioModelWithProjection
+ - forward
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clip.md
new file mode 100644
index 0000000000000000000000000000000000000000..697971e9224848bab263053d388861b4d2c21e11
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clip.md
@@ -0,0 +1,220 @@
+
+
+# CLIP
+
+## Overview
+
+CLIP ใขใใซใฏใAlec RadfordใJong Wook KimใChris HallacyใAditya RameshใGabriel Goh Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020) ใงๆๆกใใใพใใใ
+ใตใณใใฃใใปใขใฌใซใฏใซใใฎใชใใทใฅใปใตในใใชใผใใขใใณใใปใขในใฑใซใใใกใฉใปใใทใฅใญใณใใธใฃใใฏใปใฏใฉใผใฏใใฐใฌใใใงใณใปใฏใซใผใฌใผใใคใชใคใปใตใใฑใดใกใผใใฏใชใใ
+(Contrastive Language-Image Pre-Training) ใฏใใใพใใพใช (็ปๅใใใญในใ) ใใขใงใใฌใผใใณใฐใใใใใฅใผใฉใซ ใใใใฏใผใฏใงใใใใใญ
+็ดๆฅๆ้ฉๅใใใใจใชใใไธใใใใ็ปๅใใๆใ้ข้ฃๆงใฎ้ซใใใญในใ ในใใใใใไบๆธฌใใใใใซ่ช็ถ่จ่ชใงๆ็คบใใใพใใ
+GPT-2 ใใใณ 3 ใฎใผใญใทใงใใๆฉ่ฝใจๅๆงใซใใฟในใฏใซๅฏพใใฆใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๆๅ
็ซฏใฎใณใณใใฅใผใฟใผ ใใธใงใณ ใทในใใ ใฏใใใใใใๅฎใใใใใชใใธใงใฏใ ใซใใดใชใฎๅบๅฎใปใใใไบๆธฌใใใใใซใใฌใผใใณใฐใใใฆใใพใใใใ
+ๅถ้ใใใๅฝขๅผใฎ็ฃ่ฆใงใฏใๆๅฎใใใใใซ่ฟฝๅ ใฎใฉใใซไปใใใผใฟใๅฟ
่ฆใจใชใใใใไธ่ฌๆงใจไฝฟใใใใใๅถ้ใใใพใใ
+ใใฎไปใฎ่ฆ่ฆ็ใชใณใณใปใใใ็ปๅใซ้ขใใ็ใฎใใญในใใใ็ดๆฅๅญฆ็ฟใใใใจใฏใ
+ใใๅบ็ฏใช็ฃ็ฃๆบใใฉใฎใญใฃใใทใงใณใ่กจ็คบใใใใใไบๆธฌใใใจใใๅ็ดใชไบๅใใฌใผใใณใฐ ใฟในใฏใๆๅนใงใใใใจใ็คบใใพใใ
+400 ใฎใใผใฟใปใใใง SOTA ็ปๅ่กจ็พใๆๅใใๅญฆ็ฟใใใใใฎๅน็็ใใคในใฑใผใฉใใซใชๆนๆณใฏใฉใฎ็ปๅใงใใ
+ใคใณใฟใผใใใใใๅ้ใใใๆฐ็พไธใฎ๏ผ็ปๅใใใญในใ๏ผใใขใไบๅใใฌใผใใณใฐๅพใ่ช็ถ่จ่ชใไฝฟ็จใใฆๅ็
งใใพใใ
+่ฆ่ฆ็ใชๆฆๅฟตใๅญฆ็ฟใ๏ผใพใใฏๆฐใใๆฆๅฟตใ่ชฌๆใ๏ผใไธๆตใฎใฟในใฏใธใฎใขใใซใฎใผใญใทใงใใ่ปข้ใๅฏ่ฝใซใใพใใ็งใใกใฏๅๅผทใใพใ
+30 ใ่ถ
ใใใใพใใพใชๆขๅญใฎใณใณใใฅใผใฟใผ ใใธใงใณ ใใผใฟใปใใใงใฟในใฏใใพใใใฃใฆใใณใใใผใฏใ่กใใใจใซใใใใใฎใขใใญใผใใฎใใใฉใผใใณในใ่ฉไพกใใพใใ
+OCRใใใใชๅ
ใฎใขใฏใทใงใณ่ช่ญใๅฐ็็ไฝ็ฝฎ็นๅฎใใใใณใใพใใพใช็จฎ้กใฎใใ็ดฐใใใชใใธใงใฏใๅ้กใชใฉใใฎ
+ใขใใซใฏใปใจใใฉใฎใฟในใฏใซ็ฐกๅใซ็งป่กใงใใๅคใใฎๅ ดๅใๅฟ
่ฆใใชใใฆใๅฎๅ
จใซ็ฃ่ฆใใใใใผในใฉใคใณใจ็ซถๅใใพใใ
+ใใผใฟใปใใๅบๆใฎใใฌใผใใณใฐใซ้ฉใใฆใใพใใใใจใใฐใImageNet ใผใญใทใงใใใงใฏใชใชใธใใซใฎ ResNet-50 ใฎ็ฒพๅบฆใจไธ่ดใใพใใ
+ใใฌใผใใณใฐใซไฝฟ็จใใใ 128 ไธใฎใใฌใผใใณใฐ ใตใณใใซใไฝฟ็จใใๅฟ
่ฆใฏใใใพใใใใณใผใใใชใชใผในใใไบๅใใฌใผใใณใฐๆธใฟ
+ใขใใซใฎ้ใฟใฏใใฎ https URL ใง็ขบ่ชใงใใพใใ*
+
+ใใฎใขใใซใฏ [valhalla](https://huggingface.co/valhalla) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/openai/CLIP) ใซใใใพใใ
+
+## Usage tips and example
+
+CLIP ใฏใใใซใใขใผใใซใชใใธใงใณใใใณ่จ่ชใขใใซใงใใ็ปๅใจใใญในใใฎ้กไผผๆงใใผใญใทใงใใ็ปๅใซไฝฟ็จใงใใพใใ
+ๅ้กใ CLIP ใฏใViT ใฎใใใชใใฉใณในใใฉใผใใผใไฝฟ็จใใฆ่ฆ่ฆ็็นๅพดใๅๅพใใๅ ๆ่จ่ชใขใใซใไฝฟ็จใใฆใใญในใใๅๅพใใพใ
+็นๅพดใๆฌกใซใใใญในใใจ่ฆ่ฆใฎไธกๆนใฎ็นๅพดใใๅใๆฌกๅ
ใฎๆฝๅจ็ฉบ้ใซๆๅฝฑใใใพใใใใใ
+ๆๅฝฑใใใ็ปๅใจใใญในใใฎ็นๅพด้ใฎ็ฉใๅๆงใฎในใณใขใจใใฆไฝฟ็จใใใพใใ
+
+็ปๅใ Transformer ใจใณใณใผใใซไพ็ตฆใใใใใซใๅ็ปๅใฏๅบๅฎใตใคใบใฎ้่คใใชใใใใใฎใทใผใฑใณในใซๅๅฒใใใพใใ
+ใใใใฏ็ทๅฝขใซๅใ่พผใพใใพใใ [CLS] ใใผใฏใณใฏใใคใกใผใธๅ
จไฝใฎ่กจ็พใจใใฆๆฉ่ฝใใใใใซ่ฟฝๅ ใใใพใใไฝๅฎถใใก
+ใพใใ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใ่ฟฝๅ ใใ็ตๆใจใใฆๅพใใใใใฏใใซใฎใทใผใฑใณในใๆจๆบใฎ Transformer ใจใณใณใผใใซไพ็ตฆใใพใใ
+[`CLIPImageProcessor`] ใไฝฟ็จใใฆใใขใใซใฎ็ปๅใฎใตใคใบๅคๆด (ใพใใฏๅในใฑใผใซ) ใใใณๆญฃ่ฆๅใ่กใใใจใใงใใพใใ
+
+[`CLIPTokenizer`] ใฏใใญในใใฎใจใณใณใผใใซไฝฟ็จใใใพใใ [`CLIPProcessor`] ใฏใฉใใใใพใ
+[`CLIPImageProcessor`] ใจ [`CLIPTokenizer`] ใไธกๆนใฎๅไธใคใณในใฟใณในใซ็ตฑๅ
+ใใญในใใใจใณใณใผใใใฆ็ปๅใๆบๅใใพใใๆฌกใฎไพใฏใๆฌกใฎใกใฝใใใไฝฟ็จใใฆ็ปๅใจใใญในใใฎ้กไผผๆงในใณใขใๅๅพใใๆนๆณใ็คบใใฆใใพใใ
+[`CLIPProcessor`] ใจ [`CLIPModel`]ใ
+
+```python
+>>> from PIL import Image
+>>> import requests
+
+>>> from transformers import CLIPProcessor, CLIPModel
+
+>>> model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
+>>> processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
+
+>>> outputs = model(**inputs)
+>>> logits_per_image = outputs.logits_per_image # this is the image-text similarity score
+>>> probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
+```
+
+## Resources
+
+CLIP ใไฝฟใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+- [ใชใขใผใ ใปใณใทใณใฐ (่กๆ) ็ปๅใจใญใฃใใทใงใณใไฝฟ็จใใ CLIP ใฎๅพฎ่ชฟๆด](https://huggingface.co/blog/fine-tune-clip-rsicd)ใ[RSICD ใใผใฟใปใใ] ใไฝฟ็จใใฆ CLIP ใๅพฎ่ชฟๆดใใๆนๆณใซ้ขใใใใญใฐๆ็จฟ(https://github.com/201528014227051/RSICD_optimal) ใจใใใผใฟๆกๅผตใซใใใใใฉใผใใณในใฎๅคๅใฎๆฏ่ผใ
+- ใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/contrastive-image-text) ใฏใใใฌ- [COCO ใใผใฟใปใใ](https://cocodataset.org/#home) ใไฝฟ็จใใฆใใฌใผใใณใฐใใใใใธใงใณใใใณใใญในใ ใจใณใณใผใใผใ
+
+
+
+- ็ปๅใญใฃใใทใงใณใฎใใผใ ๆค็ดขใซใใๆจ่ซใซไบๅใใฌใผใใณใฐๆธใฟ CLIP ใไฝฟ็จใใๆนๆณใซ้ขใใ [ใใผใใใใฏ](https://colab.research.google.com/drive/1tuoAC5F4sC7qid56Z0ap-stR3rwdk0ZV?usp=sharing)ใ ๐
+
+**็ปๅๆค็ดข**
+
+- ไบๅใใฌใผใใณใฐใใใ CLIP ใไฝฟ็จใใ็ปๅๆค็ดขใจ MRR (ๅนณๅ็ธไบใฉใณใฏ) ในใณใขใฎ่จ็ฎใซ้ขใใ [ใใผใใใใฏ](https://colab.research.google.com/drive/1bLVwVKpAndpEDHqjzxVPr_9nGrSbuOQd?usp=sharing)ใ ๐
+- ็ปๅใฎๅๅพใจ้กไผผๆงในใณใขใฎ่กจ็คบใซ้ขใใ [ใใผใใใใฏ](https://colab.research.google.com/github/deep-diver/image_search_with_natural_language/blob/main/notebooks/Image_Search_CLIP.ipynb)ใ ๐
+- ๅค่จ่ช CLIP ใไฝฟ็จใใฆ็ปๅใจใใญในใใๅใใใฏใใซ็ฉบ้ใซใใใใณใฐใใๆนๆณใซ้ขใใ [ใใผใใใใฏ](https://colab.research.google.com/drive/1xO-wC_m_GNzgjIBQ4a4znvQkvDoZJvH4?usp=sharing)ใ ๐
+- ใไฝฟ็จใใฆใปใใณใใฃใใฏ ใคใกใผใธๆค็ดขใง CLIP ใๅฎ่กใใๆนๆณใซ้ขใใ [ใใผใใใใฏ](https://colab.research.google.com/github/vivien000/clip-demo/blob/master/clip.ipynb#scrollTo=uzdFhRGqiWkR) [Unsplash](https://unsplash.com) ใใใณ [TMDB](https://www.themoviedb.org/) ใใผใฟใปใใใ ๐
+
+**่ชฌๆๅฏ่ฝๆง**
+
+- ๅ
ฅๅใใผใฏใณใจ็ปๅใปใฐใกใณใใฎ้กไผผๆงใ่ฆ่ฆๅใใๆนๆณใซ้ขใใ [ใใผใใใใฏ](https://colab.research.google.com/github/hila-chefer/Transformer-MM-Explainability/blob/main/CLIP_explainability.ipynb)ใ ๐
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใ
+ใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## CLIPConfig
+
+[[autodoc]] CLIPConfig
+ - from_text_vision_configs
+
+## CLIPTextConfig
+
+[[autodoc]] CLIPTextConfig
+
+## CLIPVisionConfig
+
+[[autodoc]] CLIPVisionConfig
+
+## CLIPTokenizer
+
+[[autodoc]] CLIPTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## CLIPTokenizerFast
+
+[[autodoc]] CLIPTokenizerFast
+
+## CLIPImageProcessor
+
+[[autodoc]] CLIPImageProcessor
+ - preprocess
+
+## CLIPFeatureExtractor
+
+[[autodoc]] CLIPFeatureExtractor
+
+## CLIPProcessor
+
+[[autodoc]] CLIPProcessor
+
+
+
+
+## CLIPModel
+
+[[autodoc]] CLIPModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## CLIPTextModel
+
+[[autodoc]] CLIPTextModel
+ - forward
+
+## CLIPTextModelWithProjection
+
+[[autodoc]] CLIPTextModelWithProjection
+ - forward
+
+## CLIPVisionModelWithProjection
+
+[[autodoc]] CLIPVisionModelWithProjection
+ - forward
+
+## CLIPVisionModel
+
+[[autodoc]] CLIPVisionModel
+ - forward
+
+
+
+
+## TFCLIPModel
+
+[[autodoc]] TFCLIPModel
+ - call
+ - get_text_features
+ - get_image_features
+
+## TFCLIPTextModel
+
+[[autodoc]] TFCLIPTextModel
+ - call
+
+## TFCLIPVisionModel
+
+[[autodoc]] TFCLIPVisionModel
+ - call
+
+
+
+
+## FlaxCLIPModel
+
+[[autodoc]] FlaxCLIPModel
+ - __call__
+ - get_text_features
+ - get_image_features
+
+## FlaxCLIPTextModel
+
+[[autodoc]] FlaxCLIPTextModel
+ - __call__
+
+## FlaxCLIPTextModelWithProjection
+
+[[autodoc]] FlaxCLIPTextModelWithProjection
+ - __call__
+
+## FlaxCLIPVisionModel
+
+[[autodoc]] FlaxCLIPVisionModel
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clipseg.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clipseg.md
new file mode 100644
index 0000000000000000000000000000000000000000..c8bdb0a0e4789bd86c3900224069f0cda84a5658
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clipseg.md
@@ -0,0 +1,104 @@
+
+
+# CLIPSeg
+
+## Overview
+
+CLIPSeg ใขใใซใฏใTimo Lรผddecke, Alexander Ecker ใซใใฃใฆ [Image Segmentation using Text and Image Prompts](https://arxiv.org/abs/2112.10003) ใงๆๆกใใใพใใใ
+ใใใฆใขใฌใฏใตใณใใผใปใจใใซใผใ CLIPSeg ใฏใใผใญใทใงใใใใใณใฏใณใทใงใใ็ปๅใปใฐใกใณใใผใทใงใณใฎใใใซใๅ็ตใใใ [CLIP](clip) ใขใใซใฎไธใซๆๅฐ้ใฎใใณใผใใ่ฟฝๅ ใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*็ปๅใฎใปใฐใกใณใใผใทใงใณใฏ้ๅธธใใใฌใผใใณใฐใซใใฃใฆ่งฃๆฑบใใใพใใ
+ใชใใธใงใฏใ ใฏใฉในใฎๅบๅฎใปใใใฎใขใใซใๅพใง่ฟฝๅ ใฎใฏใฉในใใใ่ค้ใชใฏใจใชใ็ตใฟ่พผใใจใณในใใใใใใพใ
+ใใใใฎๅผใๅซใใใผใฟใปใใใงใขใใซใๅใใฌใผใใณใฐใใๅฟ
่ฆใใใใใใงใใใใใงใทในใใ ใๆๆกใใพใ
+ไปปๆใฎๆ
ๅ ฑใซๅบใฅใใฆ็ปๅใปใฐใกใณใใผใทใงใณใ็ๆใงใใพใใ
+ใในใๆใซใใญใณใโโใใ่กจ็คบใใใพใใใใญใณใใใฏใใญในใใพใใฏ
+็ปๅใใใฎใขใใญใผใใซใใใ็ตฑไธใใใใขใใซใไฝๆใงใใพใใ
+3 ใคใฎไธ่ฌ็ใชใปใฐใกใณใใผใทใงใณ ใฟในใฏใซใคใใฆ (1 ๅใใฌใผใใณใฐๆธใฟ)
+ๅ็
งๅผใฎใปใฐใกใณใใผใทใงใณใใผใญใทใงใใ ใปใฐใกใณใใผใทใงใณใใฏใณใทใงใใ ใปใฐใกใณใใผใทใงใณใจใใๆ็ขบใช่ชฒ้กใไผดใใพใใ
+CLIP ใขใใซใใใใฏใใผใณใจใใฆๆง็ฏใใใใใใใฉใณในใใผในใฎใใณใผใใงๆกๅผตใใฆใ้ซๅฏๅบฆใชใใผใฟ้ไฟกใๅฏ่ฝใซใใพใใ
+ไบๆธฌใใฎๆกๅผตใใผใธใงใณใงใใฌใผใใณใฐใใๅพใ
+PhraseCut ใใผใฟใปใใใ็งใใกใฎใทในใใ ใฏใใใชใผใใญในใ ใใญใณใใใพใใฏ
+ใฏใจใชใ่กจใ่ฟฝๅ ใฎ็ปๅใๅพ่
ใฎ็ปๅใใผในใฎใใญใณใใใฎใใพใใพใชใใชใจใผใทใงใณใ่ฉณ็ดฐใซๅๆใใพใใ
+ใใฎๆฐใใใใคใใชใใๅ
ฅๅใซใใใๅ็้ฉๅฟใๅฏ่ฝใซใชใใพใใ
+ๅ่ฟฐใฎ 3 ใคใฎใปใฐใกใณใใผใทใงใณ ใฟในใฏใฎใฟใงใใใ
+ใใญในใใพใใฏ็ปๅใใฏใจใชใใใใคใใช ใปใฐใกใณใใผใทใงใณ ใฟในใฏใซ
+ๅฎๅผๅใใใใจใใงใใใๆๅพใซใใทในใใ ใใใพใ้ฉๅฟใใฆใใใใจใใใใใพใใ
+ใขใใฉใผใใณในใพใใฏใใญใใใฃใๅซใไธ่ฌๅใใใใฏใจใช*
+
+
+
+ CLIPSeg ใฎๆฆ่ฆใ ๅ
ใฎ่ซๆใใๆ็ฒใ
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/timojl/clipseg) ใซใใใพใใ
+
+## Usage tips
+
+- [`CLIPSegForImageSegmentation`] ใฏใ[`CLIPSegModel`] ใฎไธใซใใณใผใใ่ฟฝๅ ใใพใใๅพ่
ใฏ [`CLIPModel`] ใจๅใใงใใ
+- [`CLIPSegForImageSegmentation`] ใฏใใในใๆใซไปปๆใฎใใญใณใใใซๅบใฅใใฆ็ปๅใปใฐใกใณใใผใทใงใณใ็ๆใงใใพใใใใญใณใใใฏใใญในใใฎใใใใใงใ
+(`input_ids` ใจใใฆใขใใซใซๆไพใใใ) ใพใใฏ็ปๅ (`conditional_pixel_values` ใจใใฆใขใใซใซๆไพใใใ)ใใซในใฟใ ใๆไพใใใใจใใงใใพใ
+ๆกไปถไปใๅใ่พผใฟ (`conditional_embeddings`ใจใใฆใขใใซใซๆไพใใใพใ)ใ
+
+## Resources
+
+CLIPSeg ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคใๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+
+
+- [CLIPSeg ใไฝฟ็จใใใผใญใทใงใใ็ปๅใปใฐใกใณใใผใทใงใณ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/CLIPSeg/Zero_shot_image_segmentation_with_CLIPSeg.ipynb) ใ่ชฌๆใใใใผใใใใฏใ
+
+## CLIPSegConfig
+
+[[autodoc]] CLIPSegConfig
+ - from_text_vision_configs
+
+## CLIPSegTextConfig
+
+[[autodoc]] CLIPSegTextConfig
+
+## CLIPSegVisionConfig
+
+[[autodoc]] CLIPSegVisionConfig
+
+## CLIPSegProcessor
+
+[[autodoc]] CLIPSegProcessor
+
+## CLIPSegModel
+
+[[autodoc]] CLIPSegModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## CLIPSegTextModel
+
+[[autodoc]] CLIPSegTextModel
+ - forward
+
+## CLIPSegVisionModel
+
+[[autodoc]] CLIPSegVisionModel
+ - forward
+
+## CLIPSegForImageSegmentation
+
+[[autodoc]] CLIPSegForImageSegmentation
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clvp.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clvp.md
new file mode 100644
index 0000000000000000000000000000000000000000..0803f5e027ce81d0227a01908ac7a87707e468e6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/clvp.md
@@ -0,0 +1,123 @@
+
+
+# CLVP
+
+## Overview
+
+CLVP (Contrastive Language-Voice Pretrained Transformer) ใขใใซใฏใJames Betker ใซใใฃใฆ [Better speech synthesis through scaling](https://arxiv.org/abs/2305.07243) ใงๆๆกใใใพใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*่ฟๅนดใ็ปๅ็ๆใฎๅ้ใฏ่ชๅทฑๅๅธฐๅคๆๅจใจ DDPM ใฎๅฟ็จใซใใฃใฆ้ฉๅฝใ่ตทใใใฆใใพใใใใใใฎใขใใญใผใใฏใ็ปๅ็ๆใฎใใญใปในใๆฎต้็ใช็ขบ็็ใใญใปในใจใใฆใขใใซๅใใๅคง้ใฎใณใณใใฅใผใใฃใณใฐใจใใผใฟใๆดป็จใใฆ็ปๅใฎๅๅธใๅญฆ็ฟใใพใใใใใฉใผใใณในใๅไธใใใใใฎๆนๆณ่ซใฏใ็ปๅใซ้ๅฎใใใๅฟ
่ฆใฏใใใพใใใใใฎ่ซๆใงใฏใ็ปๅ็ๆใใกใคใณใฎ้ฒๆญฉใ้ณๅฃฐๅๆใซ้ฉ็จใใๆนๆณใซใคใใฆ่ชฌๆใใพใใใใฎ็ตๆใ่กจ็พๅ่ฑใใชใใซใ้ณๅฃฐใใญในใ่ชญใฟไธใใทในใใ ใงใใ TorToise ใ่ช็ใใพใใใ
+
+
+ใใฎใขใใซใฏ [Susnato Dhar](https://huggingface.co/susnato) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/neonbjb/tortoise-tts) ใซใใใพใใ
+
+## Usage tips
+
+1. CLVP ใฏ Tortoise TTS ใขใใซใฎไธๅฏๆฌ ใช้จๅใงใใ
+2. CLVP ใไฝฟ็จใใฆใ็ๆใใใใใพใใพใช้ณๅฃฐๅ่ฃใๆไพใใใใใญในใใจๆฏ่ผใใใใจใใงใใๆ่ฏใฎ้ณๅฃฐใใผใฏใณใๆกๆฃใขใใซใซ่ปข้ใใใพใใ
+3. Tortoise ใฎไฝฟ็จใซใฏใ[`ClvpModelForConditionalGeneration.generate()`] ใกใฝใใใฎไฝฟ็จใๅผทใใๅงใใใพใใ
+4. 16 kHz ใๆๅพ
ใใไปใฎใชใผใใฃใช ใขใใซใจใฏๅฏพ็
ง็ใซใCLVP ใขใใซใฏใชใผใใฃใชใ 22.05 kHz ใงใตใณใใชใณใฐใใใใใจใๆๅพ
ใใฆใใใใจใซๆณจๆใใฆใใ ใใใ
+
+## Brief Explanation:
+
+- [`ClvpTokenizer`] ใฏใใญในใๅ
ฅๅใใใผใฏใณๅใใ[`ClvpFeatureExtractor`] ใฏ็ฎ็ใฎใชใผใใฃใชใใใญใฐ ใกใซ ในใใฏใใญใฐใฉใ ใๆฝๅบใใพใใ
+- [`ClvpConditioningEncoder`] ใฏใใใใใฎใใญในใ ใใผใฏใณใจใชใผใใฃใช่กจ็พใๅๅพใใใใญในใใจใชใผใใฃใชใซๅบใฅใใฆๆกไปถไปใใใใๅใ่พผใฟใซๅคๆใใพใใ
+- [`ClvpForCausalLM`] ใฏใใใใใฎๅใ่พผใฟใไฝฟ็จใใฆ่คๆฐใฎ้ณๅฃฐๅ่ฃใ็ๆใใพใใ
+- ๅ้ณๅฃฐๅ่ฃใฏ้ณๅฃฐใจใณใณใผใ ([`ClvpEncoder`]) ใ้้ใใฆใใฏใใซ่กจ็พใซๅคๆใใใใใญในใ ใจใณใณใผใ ([`ClvpEncoder`]) ใฏใใญในใ ใใผใฏใณใๅใๆฝๅจ็ฉบ้ใซๅคๆใใพใใ
+- ๆๅพใซใๅ้ณๅฃฐใใฏใใซใใใญในใ ใใฏใใซใจๆฏ่ผใใฆใใฉใฎ้ณๅฃฐใใฏใใซใใใญในใ ใใฏใใซใซๆใ้กไผผใใฆใใใใ็ขบ่ชใใพใใ
+- [`ClvpModelForConditionalGeneration.generate()`] ใฏใไธ่จใฎใในใฆใฎใญใธใใฏใ 1 ใคใฎใกใฝใใใซๅง็ธฎใใพใใ
+
+ไพ ๏ผ
+
+```python
+>>> import datasets
+>>> from transformers import ClvpProcessor, ClvpModelForConditionalGeneration
+
+>>> # Define the Text and Load the Audio (We are taking an audio example from HuggingFace Hub using `datasets` library).
+>>> text = "This is an example text."
+
+>>> ds = datasets.load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
+>>> ds = ds.cast_column("audio", datasets.Audio(sampling_rate=22050))
+>>> sample = ds[0]["audio"]
+
+>>> # Define processor and model.
+>>> processor = ClvpProcessor.from_pretrained("susnato/clvp_dev")
+>>> model = ClvpModelForConditionalGeneration.from_pretrained("susnato/clvp_dev")
+
+>>> # Generate processor output and model output.
+>>> processor_output = processor(raw_speech=sample["array"], sampling_rate=sample["sampling_rate"], text=text, return_tensors="pt")
+>>> generated_output = model.generate(**processor_output)
+```
+
+
+## ClvpConfig
+
+[[autodoc]] ClvpConfig
+ - from_sub_model_configs
+
+## ClvpEncoderConfig
+
+[[autodoc]] ClvpEncoderConfig
+
+## ClvpDecoderConfig
+
+[[autodoc]] ClvpDecoderConfig
+
+## ClvpTokenizer
+
+[[autodoc]] ClvpTokenizer
+ - save_vocabulary
+
+## ClvpFeatureExtractor
+
+[[autodoc]] ClvpFeatureExtractor
+ - __call__
+
+## ClvpProcessor
+
+[[autodoc]] ClvpProcessor
+ - __call__
+ - decode
+ - batch_decode
+
+## ClvpModelForConditionalGeneration
+
+[[autodoc]] ClvpModelForConditionalGeneration
+ - forward
+ - generate
+ - get_text_features
+ - get_speech_features
+
+## ClvpForCausalLM
+
+[[autodoc]] ClvpForCausalLM
+
+## ClvpModel
+
+[[autodoc]] ClvpModel
+
+## ClvpEncoder
+
+[[autodoc]] ClvpEncoder
+
+## ClvpDecoder
+
+[[autodoc]] ClvpDecoder
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/code_llama.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/code_llama.md
new file mode 100644
index 0000000000000000000000000000000000000000..e489bfa031dc62471a06efb6748c5fe35568d13f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/code_llama.md
@@ -0,0 +1,126 @@
+
+
+# CodeLlama
+
+## Overview
+
+Code Llama ใขใใซใฏใซใใฃใฆ [Code Llama: Open Foundation Models for Code](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/) ใงๆๆกใใใพใใใ Baptiste Roziรจre, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jรฉrรฉmy Rapin, Artyom Kozhevnikov, Ivan Evtimov, Joanna Bitton, Manish Bhatt, Cristian Canton Ferrer, Aaron Grattafiori, Wenhan Xiong, Alexandre Dรฉfossez, Jade Copet, Faisal Azhar, Hugo Touvron, Louis Martin, Nicolas Usunier, Thomas Scialom, Gabriel Synnaeve.
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*็งใใกใฏ Code Llama ใใชใชใผในใใพใใใใใฏ Llama 2 ใซๅบใฅใใณใผใใฎๅคง่ฆๆจก่จ่ชใขใใซ ใใกใใชใงใใใใชใผใใณ ใขใใซใฎไธญใงๆๅ
็ซฏใฎใใใฉใผใใณในใๅใ่พผใฟๆฉ่ฝใๅคง่ฆๆจกใชๅ
ฅๅใณใณใใญในใใฎใตใใผใใใใญใฐใฉใใณใฐ ใฟในใฏใฎใผใญใทใงใใๅฝไปค่ฟฝๅพๆฉ่ฝใๆไพใใพใใ ใๅน
ๅบใใขใใชใฑใผใทใงใณใใซใใผใใใใใฎ่คๆฐใฎใใฌใผใใผใๆไพใใฆใใพใใๅบ็คใขใใซ (Code Llama)ใPython ็นๅ (Code Llama - Python)ใใใใณใใใใ 7Bใ13Bใใใใณ 34B ใใฉใกใผใฟใผใๅใใๅฝไปค่ฟฝๅพใขใใซ (Code Llama - Instruct) ใงใใใในใฆใฎใขใใซใฏ 16,000 ใใผใฏใณใฎใทใผใฑใณในใงใใฌใผใใณใฐใใใๆๅคง 100,000 ใใผใฏใณใฎๅ
ฅๅใงๆนๅใ่ฆใใใพใใ 7B ใใใณ 13B ใณใผใ ใฉใใจใณใผใ ใฉใ - ๅฝไปคใใชใขใณใใฏใๅจๅฒใฎใณใณใใณใใซๅบใฅใใๅใ่พผใฟใใตใใผใใใพใใ Code Llama ใฏใใใใคใใฎใณใผใ ใใณใใใผใฏใงใชใผใใณ ใขใใซใฎไธญใงๆๅ
็ซฏใฎใใใฉใผใใณในใซ้ใใHumanEval ใจ MBPP ใงใใใใๆๅคง 53% ใจ 55% ใฎในใณใขใ็ฒๅพใใพใใใ็นใซใCode Llama - Python 7B ใฏ HumanEval ใใใณ MBPP ไธใง Llama 2 70B ใใใๅชใใใใใฉใผใใณในใ็คบใใใในใฆใฎใขใใซใฏ MultiPL-E ไธใงๅ
ฌ้ใใใฆใใไปใฎใในใฆใฎใขใใซใใใๅชใใฆใใพใใ็งใใกใฏใ็ ็ฉถใจๅๆฅญๅฉ็จใฎไธกๆนใ่จฑๅฏใใๅฏๅฎนใชใฉใคใปใณในใซๅบใฅใใฆ Code Llama ใใชใชใผในใใฆใใพใใ*
+
+ใในใฆใฎ Code Llama ใขใใซ ใใงใใฏใใคใณใใ [ใใกใ](https://huggingface.co/models?search=code_llama) ใง็ขบ่ชใใ[meta llama org](https://huggingface.co/meta-llama) ใงๆญฃๅผใซใชใชใผในใใใใใงใใฏใใคใณใใ็ขบ่ชใใฆใใ ใใใ
+
+ใใฎใขใใซใฏ [ArthurZucker](https://huggingface.co/ArthurZ) ใซใใฃใฆๆไพใใใพใใใ่่
ใฎใชใชใธใใซใฎใณใผใใฏ [ใใกใ](https://github.com/facebookresearch/llama) ใซใใใพใใ
+
+## Usage tips and examples
+
+
+
+Code Llama ใฎใใผในใจใชใ`Llama2`ใใกใใชใผ ใขใใซใฏใ`bfloat16`ใไฝฟ็จใใฆใใฌใผใใณใฐใใใพใใใใๅ
ใฎๆจ่ซใงใฏ`float16`ใไฝฟ็จใใพใใใใพใใพใช็ฒพๅบฆใ่ฆใฆใฟใพใใใใ
+
+* `float32`: ใขใใซใฎๅๆๅใซ้ขใใ PyTorch ใฎ่ฆ็ดใงใฏใใขใใซใฎ้ใฟใใฉใฎ `dtype` ใงๆ ผ็ดใใใใใซ้ขไฟใชใใใขใใซใ `float32` ใซใญใผใใใพใใ ใtransformersใใใPyTorch ใจใฎไธ่ฒซๆงใไฟใคใใใซใใฎ่ฆๅใซๅพใฃใฆใใพใใใใใฏใใใฉใซใใง้ธๆใใใพใใ `AutoModel` API ใงในใใฌใผใธใฎ้ใฟไปใใฟใคใใไฝฟ็จใใฆใใงใใฏใใคใณใใฎใญใผใใใญใฃในใใใๅ ดๅใฏใ`torch_dtype="auto"` ใๆๅฎใใๅฟ
่ฆใใใใพใใ `model = AutoModelForCausalLM.from_pretrained("path", torch_dtype = "auto")`ใ
+* `bfloat16`: ใณใผใ Llama ใฏใใฎ็ฒพๅบฆใงใใฌใผใใณใฐใใใฆใใใใใใใใชใใใฌใผใใณใฐใๅพฎ่ชฟๆดใซไฝฟ็จใใใใจใใๅงใใใพใใ
+* `float16`: ใใฎ็ฒพๅบฆใไฝฟ็จใใฆๆจ่ซใๅฎ่กใใใใจใใๅงใใใพใใ้ๅธธใฏ `bfloat16` ใใ้ซ้ใงใใใ่ฉไพกใกใใชใฏในใซใฏ `bfloat16` ใจๆฏในใฆๆใใใชไฝไธใ่ฆใใใชใใใใงใใ bfloat16 ใไฝฟ็จใใฆๆจ่ซใๅฎ่กใใใใจใใงใใพใใๅพฎ่ชฟๆดๅพใfloat16 ใจ bfloat16 ใฎไธกๆนใงๆจ่ซ็ตๆใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+ไธใง่ฟฐในใใใใซใใขใใซใๅๆๅใใใจใใซ `torch_dtype="auto"` ใไฝฟ็จใใชใ้ใใในใใฌใผใธใฎ้ใฟใฎ `dtype` ใฏใปใจใใฉ็ก้ขไฟใงใใใใฎ็็ฑใฏใใขใใซใๆๅใซใใฆใณใญใผใใใ (ใชใณใฉใคใณใฎใใงใใฏใใคใณใใฎ `dtype` ใไฝฟ็จ)ใๆฌกใซ `torch` ใฎใใใฉใซใใฎ `dtype` ใซใญใฃในใใใใใใใงใ (`torch.float32` ใซใชใใพใ)ใๆๅฎใใใ `torch_dtype` ใใใๅ ดๅใฏใไปฃใใใซใใใไฝฟ็จใใใพใใ
+
+
+
+ใใใ๏ผ
+- ๅ
ๅกซใฟในใฏใฏใใใซใตใใผใใใใพใใๅ
ฅๅใๅใใใๅ ดๆใซใฏ `tokenizer.fill_token` ใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+- ใขใใซๅคๆในใฏใชใใใฏใ`Llama2` ใใกใใชใฎๅ ดๅใจๅใใงใใ
+
+ไฝฟ็จไพใฏๆฌกใฎใจใใใงใใ
+
+```bash
+python src/transformers/models/llama/convert_llama_weights_to_hf.py \
+ --input_dir /path/to/downloaded/llama/weights --model_size 7B --output_dir /output/path
+```
+
+ในใฏใชใใใๅฎ่กใใใซใฏใ(ๆๅคงใฎใใผใธใงใณใงใใฃใฆใ) float16 ็ฒพๅบฆใงใขใใซๅ
จไฝใใในใใใใฎใซๅๅใช CPU RAM ใๅฟ
่ฆใงใใใใจใซๆณจๆใใฆใใ ใใใ
+ใใใคใใฎใใงใใฏใใคใณใใใใใใใใใใซใขใใซใฎๅ้ใฟใฎไธ้จใๅซใพใใฆใใใใใใในใฆใ RAM ใซใญใผใใใๅฟ
่ฆใใใใพใ)ใ
+
+ๅคๆๅพใใขใใซใจใใผใฏใใคใถใผใฏๆฌกใฎๆนๆณใงใญใผใใงใใพใใ
+
+```python
+>>> from transformers import LlamaForCausalLM, CodeLlamaTokenizer
+
+>>> tokenizer = CodeLlamaTokenizer.from_pretrained("meta-llama/CodeLlama-7b-hf")
+>>> model = LlamaForCausalLM.from_pretrained("meta-llama/CodeLlama-7b-hf")
+>>> PROMPT = '''def remove_non_ascii(s: str) -> str:
+ """
+ return result
+'''
+>>> input_ids = tokenizer(PROMPT, return_tensors="pt")["input_ids"]
+>>> generated_ids = model.generate(input_ids, max_new_tokens=128)
+
+>>> filling = tokenizer.batch_decode(generated_ids[:, input_ids.shape[1]:], skip_special_tokens = True)[0]
+>>> print(PROMPT.replace("", filling))
+def remove_non_ascii(s: str) -> str:
+ """ Remove non-ASCII characters from a string.
+
+ Args:
+ s: The string to remove non-ASCII characters from.
+
+ Returns:
+ The string with non-ASCII characters removed.
+ """
+ result = ""
+ for c in s:
+ if ord(c) < 128:
+ result += c
+ return result
+```
+
+ๅกใใคใถใใใ้จๅใ ใใๅฟ
่ฆใชๅ ดๅ:
+
+```python
+>>> from transformers import pipeline
+>>> import torch
+
+>>> generator = pipeline("text-generation",model="meta-llama/CodeLlama-7b-hf",torch_dtype=torch.float16, device_map="auto")
+>>> generator('def remove_non_ascii(s: str) -> str:\n """ \n return result', max_new_tokens = 128)
+[{'generated_text': 'def remove_non_ascii(s: str) -> str:\n """ \n return resultRemove non-ASCII characters from a string. """\n result = ""\n for c in s:\n if ord(c) < 128:\n result += c'}]
+```
+
+ๅ
้จใงใฏใใใผใฏใใคใถใผใ [`` ใซใใฃใฆ่ชๅ็ใซๅๅฒ](https://huggingface.co/docs/transformers/main/model_doc/code_llama#transformers.CodeLlamaTokenizer.fill_token) ใใฆใ[ ใซ็ถใๆธๅผ่จญๅฎใใใๅ
ฅๅๆๅญๅใไฝๆใใพใใใชใชใธใใซใฎใใฌใผใใณใฐ ใใฟใผใณ](https://github.com/facebookresearch/codellama/blob/cb51c14ec761370ba2e2bc351374a79265d0465e/llama/generation.py#L402)ใใใใฏใใใฟใผใณใ่ชๅใงๆบๅใใใใใๅ
็ขใงใใใใผใฏใณใฎๆฅ็ใชใฉใใใใใฐใ้ๅธธใซ้ฃใใ่ฝใจใ็ฉดใๅ้ฟใงใใพใใใใฎใขใใซใพใใฏไปใฎใขใใซใซๅฟ
่ฆใช CPU ใใใณ GPU ใกใขใชใฎ้ใ็ขบ่ชใใใซใฏใใใฎๅคใๆฑบๅฎใใใฎใซๅฝน็ซใค [ใใฎ่จ็ฎใใผใซ](https://huggingface.co/spaces/hf-accelerate/model-memory-usage) ใ่ฉฆใใฆใใ ใใใ
+
+LLaMA ใใผใฏใใคใถใผใฏใ[sentencepiece](https://github.com/google/sentencepiece) ใซๅบใฅใ BPE ใขใใซใงใใใปใณใใณในใใผในใฎ็ใฎ 1 ใคใฏใใทใผใฑใณในใใใณใผใใใใจใใซใๆๅใฎใใผใฏใณใๅ่ชใฎๅ
้ ญ (ไพ: ใBananaใ) ใงใใๅ ดๅใใใผใฏใใคใถใผใฏๆๅญๅใฎๅ
้ ญใซใใฌใใฃใใฏใน ในใใผในใ่ฟฝๅ ใใชใใใจใงใใ
+
+
+
+ใณใผใ Llama ใฏใ`Llama2` ใขใใซใจๅใใขใผใญใใฏใใฃใๆใฃใฆใใพใใAPI ใชใใกใฌใณในใซใคใใฆใฏใ[Llama2 ใฎใใญใฅใกใณใ ใใผใธ](llama2) ใๅ็
งใใฆใใ ใใใ
+ไปฅไธใฎ Code Llama ใใผใฏใใคใถใผใฎใชใใกใฌใณในใ่ฆใคใใฆใใ ใใใ
+
+
+## CodeLlamaTokenizer
+
+[[autodoc]] CodeLlamaTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## CodeLlamaTokenizerFast
+
+[[autodoc]] CodeLlamaTokenizerFast
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - update_post_processor
+ - save_vocabulary
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/codegen.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/codegen.md
new file mode 100644
index 0000000000000000000000000000000000000000..78caefe043319b58eb6f566d29eaf882812eb803
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/codegen.md
@@ -0,0 +1,90 @@
+
+
+# CodeGen
+
+## Overview
+
+
+CodeGen ใขใใซใฏใ[A Conversational Paradigm for Program Synthesis](https://arxiv.org/abs/2203.13474) ใง Erik NijkampใBo PangใๆๅฎๆใLifu TuใHuan WangใYingbo ZhouใSilvio SavareseใCaiming Xiong ใใใณใซใคใใณใปใทใงใณใใใ
+
+CodeGen ใฏใ[The Pile](https://pile.eleuther.ai/)ใBigQueryใBigPython ใง้ ๆฌกใใฌใผใใณใฐใใใใใญใฐใฉใ ๅๆ็จใฎ่ชๅทฑๅๅธฐ่จ่ชใขใใซใงใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ใใญใฐใฉใ ๅๆใฏใไธใใใใๅ้กไปๆงใฎ่งฃๆฑบ็ญใจใใฆใณใณใใฅใผใฟใผ ใใญใฐใฉใ ใ็ๆใใใใจใ็ฎ็ใจใใฆใใพใใๆใ
ใฏใๅคง่ฆๆจกใช่จ่ชใขใใซใไปใใไผ่ฉฑๅใใญใฐใฉใ ๅๆใขใใญใผใใๆๆกใใพใใใใใฏใๅพๆฅใฎใขใใญใผใใง็ด้ขใใๅบๅคงใชใใญใฐใฉใ ็ฉบ้ใจใฆใผใถใผใฎๆๅณใฎไปๆงใๆค็ดขใใใจใใ่ชฒ้กใซๅฏพๅฆใใพใใ็งใใกใฎๆฐใใใขใใญใผใใงใฏใไปๆงใจใใญใฐใฉใ ใไฝๆใใใใญใปในใใใฆใผใถใผใจใทในใใ ใฎ้ใฎ่คๆฐๅใฎๅฏพ่ฉฑใจใใฆๆใใพใใใใใฏใใญใฐใฉใ ๅๆใใทใผใฑใณในไบๆธฌๅ้กใจใใฆๆฑใใไปๆงใ่ช็ถ่จ่ชใง่กจ็พใใใ็ฎ็ใฎใใญใฐใฉใ ใๆกไปถไปใใงใตใณใใชใณใฐใใใพใใ็งใใกใฏใ่ช็ถ่จ่ชใจใใญใฐใฉใใณใฐ่จ่ชใฎใใผใฟใซๅบใฅใใฆใCodeGen ใจๅผใฐใใๅคง่ฆๆจกใช่จ่ชใขใใซใฎใใกใใชใผใใใฌใผใใณใฐใใพใใใใผใฟใฎ็ฃ่ฆใๅผฑใใใใผใฟ ใตใคใบใจใขใใซ ใตใคใบใๆกๅคงใใใจใๅ็ดใช่ชๅทฑๅๅธฐ่จ่ชใขใใชใณใฐใใไผ่ฉฑ่ฝๅใ็ใพใใพใใไผ่ฉฑๅใใญใฐใฉใ ๅๆใซใใใใขใใซใฎๅไฝใ็ ็ฉถใใใใใซใใใซใใฟใผใณ ใใญใฐใฉใใณใฐ ใใณใใใผใฏ (MTPB) ใ้็บใใพใใใใฎใใณใใใผใฏใงใฏใๅๅ้กใ่งฃๆฑบใใใซใฏใใฆใผใถใผใจใขใใซ้ใฎใใซใใฟใผใณไผ่ฉฑใไปใใใใซใในใใใๅๆใๅฟ
่ฆใงใใ็งใใกใฎ่ชฟๆป็ตๆใฏใไผ่ฉฑๆฉ่ฝใฎๅบ็พใจใๆๆกใใใฆใใไผ่ฉฑใใญใฐใฉใ ๅๆใใฉใใคใ ใฎๆๅนๆงใ็คบใใฆใใพใใใใใซใ็งใใกใฎใขใใซ CodeGen (TPU-v4 ใงใใฌใผใใณใฐใใใๆๅคง 16B ใใฉใกใผใฟใผใๅซใ) ใฏใHumanEval ใใณใใใผใฏใง OpenAI ใฎ Codex ใไธๅใใพใใ็งใใกใฏใใงใใฏใใคใณใใๅซใใใฌใผใใณใฐ ใฉใคใใฉใช JaxFormer ใใชใผใใณ ใฝใผในใฎใณใณใใชใใฅใผใทใงใณใจใใฆๅฉ็จใงใใใใใซใใฆใใพใ: [ใใฎ https URL](https://github.com/salesforce/codegen)*ใ
+
+ใใฎใขใใซใฏ [ๆ ๅฎๆ](https://huggingface.co/rooa) ใซใใฃใฆๅฏ็จฟใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/salesforce/codegen) ใซใใใพใใ
+
+## Checkpoint Naming
+
+* CodeGen ใขใใซ [ใใงใใฏใใคใณใ](https://huggingface.co/models?other=codegen) ใฏใๅฏๅคใตใคใบใฎใใพใใพใชไบๅใใฌใผใใณใฐ ใใผใฟใงๅฉ็จใงใใพใใ
+* ๅฝขๅผใฏใSalesforce/codegen-{size}-{data}ใใงใใใใใงใ
+ * `size`: `350M`ใ`2B`ใ`6B`ใ`16B`
+ * `data`:
+ * `nl`: ใใคใซใงไบๅใใฌใผใใณใฐๆธใฟ
+ * `multi`: `nl` ใงๅๆๅใใใ่คๆฐใฎใใญใฐใฉใใณใฐ่จ่ชใใผใฟใงใใใซไบๅใใฌใผใใณใฐใใใพใใ
+ * `mono`: `multi` ใงๅๆๅใใใPython ใใผใฟใงใใใซไบๅใใฌใผใใณใฐใใใพใใ
+* ใใจใใฐใ`Salesforce/codegen-350M-mono` ใฏใPileใ่คๆฐใฎใใญใฐใฉใใณใฐ่จ่ชใใใใณ Python ใง้ ๆฌกไบๅใใฌใผใใณใฐใใใ 3 ๅ 5,000 ไธใฎใใฉใกใผใฟใผใฎใใงใใฏใใคใณใใๆไพใใพใใ
+
+## Usage example
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> checkpoint = "Salesforce/codegen-350M-mono"
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+
+>>> text = "def hello_world():"
+
+>>> completion = model.generate(**tokenizer(text, return_tensors="pt"))
+
+>>> print(tokenizer.decode(completion[0]))
+def hello_world():
+ print("Hello World")
+
+hello_world()
+```
+
+## Resources
+
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+
+## CodeGenConfig
+
+[[autodoc]] CodeGenConfig
+ - all
+
+## CodeGenTokenizer
+
+[[autodoc]] CodeGenTokenizer
+ - save_vocabulary
+
+## CodeGenTokenizerFast
+
+[[autodoc]] CodeGenTokenizerFast
+
+## CodeGenModel
+
+[[autodoc]] CodeGenModel
+ - forward
+
+## CodeGenForCausalLM
+
+[[autodoc]] CodeGenForCausalLM
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/conditional_detr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/conditional_detr.md
new file mode 100644
index 0000000000000000000000000000000000000000..4ef09f0b6d898ec64cf6ec769e0337b8d2da7232
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/conditional_detr.md
@@ -0,0 +1,75 @@
+
+
+# Conditional DETR
+
+## Overview
+
+ๆกไปถไปใ DETR ใขใใซใฏใ[Conditional DETR for Fast Training Convergence](https://arxiv.org/abs/2108.06152) ใง Depu MengใXiaokang ChenใZejia FanใGang ZengใHouqiang LiใYuhui YuanใLei Sun, Jingdong Wang ใซใใฃใฆๆๆกใใใพใใใ็ไบฌๆฑใๆกไปถไปใ DETR ใฏใ้ซ้ DETR ใใฌใผใใณใฐใฎใใใฎๆกไปถไปใใฏใญในใขใใณใทใงใณ ใกใซใใบใ ใๆไพใใพใใๆกไปถไปใ DETR ใฏ DETR ใใใ 6.7 ๅใใ 10 ๅ้ใๅๆใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๆ่ฟ้็บใใใ DETR ใขใใญใผใใฏใใใฉใณในใใฉใผใใผ ใจใณใณใผใใผใใใณใใณใผใใผ ใขใผใญใใฏใใฃใ็ฉไฝๆคๅบใซ้ฉ็จใใๆๆใชใใใฉใผใใณในใๅฎ็พใใพใใใใฎ่ซๆใงใฏใใใฌใผใใณใฐใฎๅๆใ้
ใใจใใ้่ฆใชๅ้กใๆฑใใ้ซ้ DETR ใใฌใผใใณใฐใฎใใใฎๆกไปถไปใใฏใญในใขใใณใทใงใณ ใกใซใใบใ ใ็ดนไปใใพใใ็งใใกใฎใขใใญใผใใฏใDETR ใซใใใใฏใญในใขใใณใทใงใณใ 4 ใคใฎๅ่ขใฎไฝ็ฝฎ็นๅฎใจใใใฏในใฎไบๆธฌใซใณใณใใณใใฎๅใ่พผใฟใซๅคงใใไพๅญใใฆใใใใใ้ซๅ่ณชใฎใณใณใใณใใฎๅใ่พผใฟใฎๅฟ
่ฆๆงใ้ซใพใใใใฌใผใใณใฐใฎ้ฃๆๅบฆใ้ซใใชใใจใใ็นใซๅๆฉใฅใใใใฆใใพใใๆกไปถไปใ DETR ใจๅผใฐใใ็งใใกใฎใขใใญใผใใฏใใใณใผใใผใฎใใซใใใใ ใฏใญในใขใใณใทใงใณใฎใใใซใใณใผใใผใฎๅใ่พผใฟใใๆกไปถไปใใฎ็ฉบ้ใฏใจใชใๅญฆ็ฟใใพใใๅฉ็นใฏใๆกไปถไปใ็ฉบ้ใฏใจใชใ้ใใฆใๅใฏใญในใขใใณใทใงใณ ใใใใใๅๅฅใฎ้ ๅ (ใใจใใฐใ1 ใคใฎใชใใธใงใฏใใฎ็ซฏใพใใฏใชใใธใงใฏใ ใใใฏในๅ
ใฎ้ ๅ) ใๅซใใใณใใซๆณจ็ฎใงใใใใจใงใใใใใซใใใใชใใธใงใฏใๅ้กใจใใใฏในๅๅธฐใฎใใใฎๅๅฅใฎ้ ๅใใญใผใซใฉใคใบใใใใใฎ็ฉบ้็ฏๅฒใ็ญใพใใใณใณใใณใใฎๅใ่พผใฟใธใฎไพๅญใ็ทฉๅใใใใใฌใผใใณใฐใๅฎนๆใซใชใใพใใๅฎ้จ็ตๆใฏใๆกไปถไปใ DETR ใใใใฏใใผใณ R50 ใใใณ R101 ใง 6.7 ๅ้ใๅๆใใใใๅผทๅใชใใใฏใใผใณ DC5-R50 ใใใณ DC5-R101 ใง 10 ๅ้ใๅๆใใใใจใ็คบใใฆใใพใใใณใผใใฏ https://github.com/Atten4Vis/ConditionalDETR ใงๅ
ฅๆใงใใพใใ*
+
+
+
+ ๆกไปถไปใ DETR ใฏใๅ
ใฎ DETR ใซๆฏในใฆใฏใใใซ้ใๅๆใ็คบใใพใใ ๅ
ใฎ่ซๆ ใใๅผ็จใ
+
+ใใฎใขใใซใฏ [DepuMeng](https://huggingface.co/DepuMeng) ใซใใฃใฆๅฏ็จฟใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/Atten4Vis/ConditionalDETR) ใซใใใพใใ
+
+## Resources
+
+- [ใชใใธใงใฏใๆคๅบใฟในใฏใฌใคใ](../tasks/object_detection)
+
+## ConditionalDetrConfig
+
+[[autodoc]] ConditionalDetrConfig
+
+## ConditionalDetrImageProcessor
+
+[[autodoc]] ConditionalDetrImageProcessor
+ - preprocess
+ - post_process_object_detection
+ - post_process_instance_segmentation
+ - post_process_semantic_segmentation
+ - post_process_panoptic_segmentation
+
+## ConditionalDetrFeatureExtractor
+
+[[autodoc]] ConditionalDetrFeatureExtractor
+ - __call__
+ - post_process_object_detection
+ - post_process_instance_segmentation
+ - post_process_semantic_segmentation
+ - post_process_panoptic_segmentation
+
+## ConditionalDetrModel
+
+[[autodoc]] ConditionalDetrModel
+ - forward
+
+## ConditionalDetrForObjectDetection
+
+[[autodoc]] ConditionalDetrForObjectDetection
+ - forward
+
+## ConditionalDetrForSegmentation
+
+[[autodoc]] ConditionalDetrForSegmentation
+ - forward
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convbert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convbert.md
new file mode 100644
index 0000000000000000000000000000000000000000..5d15f86c5136b791426efd10332b16e617d50411
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convbert.md
@@ -0,0 +1,145 @@
+
+
+# ConvBERT
+
+
+
+## Overview
+
+ConvBERT ใขใใซใฏใ[ConvBERT: Improving BERT with Span-based Dynamic Convolution](https://arxiv.org/abs/2008.02496) ใง Zihang JiangใWeihao YuใDaquan ZhouใYunpeng ChenใJiashi FengใShuicheng Yan ใซใใฃใฆๆๆกใใใพใใใ
+ใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*BERT ใใใฎใใชใขใณใใชใฉใฎไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซใฏใๆ่ฟใใใพใใพใช็ฐๅขใง็ฎ่ฆใพใใใใใฉใผใใณในใ้ๆใใฆใใพใใ
+่ช็ถ่จ่ช็่งฃใฟในใฏใใใ ใใBERT ใฏใฐใญใผใใซใช่ชๅทฑๆณจๆใใญใใฏใซๅคงใใไพๅญใใฆใใใใใๅ้กใ็บ็ใใพใใ
+ใกใขใชไฝฟ็จ้ใจ่จ็ฎใณในใใๅคงใใใชใใพใใใในใฆใฎๆณจๆใๅ
ฅๅใทใผใฑใณในๅ
จไฝใซๅฏพใใฆใฏใจใชใๅฎ่กใใพใใใ
+ใฐใญใผใใซใช่ฆณ็นใใใขใใณใทใงใณ ใใใใ็ๆใใใจใไธ้จใฎใใใใฏใญใผใซใซใชไพๅญ้ขไฟใฎใฟใๅญฆ็ฟใใๅฟ
่ฆใใใใใจใใใใใพใใ
+ใใใฏใ่จ็ฎใฎๅ้ทๆงใๅญๅจใใใใจใๆๅณใใพใใใใใใฃใฆใๆใ
ใฏใๆฐใใในใใณใใผในใฎๅ็็ณใฟ่พผใฟใๆๆกใใพใใ
+ใใใใฎใปใซใใขใใณใทใงใณ ใใใใ็ฝฎใๆใใฆใใญใผใซใซใฎไพๅญ้ขไฟใ็ดๆฅใขใใซๅใใพใใๆฐใใใณใณใใชใฅใผใทใงใณใใใใจใ
+่ชๅทฑๆณจๆใฎ้ ญใไผใใใฐใญใผใใซใจใญใผใซใซใฎไธกๆนใฎ็ถๆณใงใใๅน็็ใชๆฐใใๆททๅๆณจๆใใญใใฏใๅฝขๆใใพใ
+ๅญฆใถใใใฎๆททๅๆณจๆ่จญ่จใ BERT ใซ่ฃ
ๅใใConvBERT ใขใใซใๆง็ฏใใพใใๅฎ้จใงใใใฃใใใจใฏใ
+ConvBERT ใฏใใใฌใผใใณใฐ ใณในใใไฝใใใใพใใพใชไธๆตใฟในใฏใซใใใฆ BERT ใใใณใใฎไบ็จฎใใใๅคงๅน
ใซๅชใใใใใฉใผใใณในใ็บๆฎใใพใใ
+ใขใใซใใฉใกใผใฟใๅฐใชใใชใใพใใๆณจ็ฎใในใใใจใซใConvBERTbase ใขใใซใฏ 86.4 GLUE ในใณใขใ้ๆใใELECTRAbase ใใใ 0.7 ้ซใใฎใซๅฏพใใ
+ใใฌใผใใณใฐใณในใใฏ 1/4 ๆชๆบใงใใใณใผใใจไบๅใใฌใผใใณใฐใใใใขใใซใใชใชใผในใใใพใใ*
+
+ใใฎใขใใซใฏใ[abhishek](https://huggingface.co/abhishek) ใซใใฃใฆๆไพใใใพใใใใชใชใธใใซใฎๅฎ่ฃ
ใ่ฆใคใใใพใ
+ใใ: https://github.com/yitu-opensource/ConvBert
+
+## Usage tips
+
+ConvBERT ใใฌใผใใณใฐใฎใใณใใฏ BERT ใฎใใณใใจไผผใฆใใพใใไฝฟ็จไธใฎใใณใใซใคใใฆใฏใ[BERT ใใญใฅใกใณใ](bert) ใๅ็
งใใฆใใ ใใใ
+
+## Resources
+
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ใในใฏใใใ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_lang_modeling)
+- [ๅค่ข้ธๆใฟในใฏ ใฌใคใ](../tasks/multiple_choice)
+
+## ConvBertConfig
+
+[[autodoc]] ConvBertConfig
+
+## ConvBertTokenizer
+
+[[autodoc]] ConvBertTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## ConvBertTokenizerFast
+
+[[autodoc]] ConvBertTokenizerFast
+
+
+
+
+## ConvBertModel
+
+[[autodoc]] ConvBertModel
+ - forward
+
+## ConvBertForMaskedLM
+
+[[autodoc]] ConvBertForMaskedLM
+ - forward
+
+## ConvBertForSequenceClassification
+
+[[autodoc]] ConvBertForSequenceClassification
+ - forward
+
+## ConvBertForMultipleChoice
+
+[[autodoc]] ConvBertForMultipleChoice
+ - forward
+
+## ConvBertForTokenClassification
+
+[[autodoc]] ConvBertForTokenClassification
+ - forward
+
+## ConvBertForQuestionAnswering
+
+[[autodoc]] ConvBertForQuestionAnswering
+ - forward
+
+
+
+
+## TFConvBertModel
+
+[[autodoc]] TFConvBertModel
+ - call
+
+## TFConvBertForMaskedLM
+
+[[autodoc]] TFConvBertForMaskedLM
+ - call
+
+## TFConvBertForSequenceClassification
+
+[[autodoc]] TFConvBertForSequenceClassification
+ - call
+
+## TFConvBertForMultipleChoice
+
+[[autodoc]] TFConvBertForMultipleChoice
+ - call
+
+## TFConvBertForTokenClassification
+
+[[autodoc]] TFConvBertForTokenClassification
+ - call
+
+## TFConvBertForQuestionAnswering
+
+[[autodoc]] TFConvBertForQuestionAnswering
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convnext.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convnext.md
new file mode 100644
index 0000000000000000000000000000000000000000..4386a7df8ceadb36eaaacafb5f16ced5825f3214
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convnext.md
@@ -0,0 +1,94 @@
+
+
+# ConvNeXT
+
+## Overview
+
+ConvNeXT ใขใใซใฏใ[A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545) ใง Zhuang LiuใHanzi MaoใChao-Yuan WuใChristoph FeichtenhoferใTrevor DarrellใSaining Xie ใซใใฃใฆๆๆกใใใพใใใ
+ConvNeXT ใฏใใใธใงใณ ใใฉใณในใใฉใผใใผใฎ่จญ่จใใใคใณในใใฌใผใทใงใณใๅพใ็ด็ฒใช็ณใฟ่พผใฟใขใใซ (ConvNet) ใงใใใใใธใงใณ ใใฉใณในใใฉใผใใผใใใๅชใใใใใฉใผใใณในใ็บๆฎใใใจไธปๅผตใใฆใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*่ฆ่ฆ่ช่ญใฎใ็้จใฎ 20 ๅนดไปฃใใฏใๆๅ
็ซฏใฎ็ปๅๅ้กใขใใซใจใใฆ ConvNet ใซใใใซๅใฃใฆไปฃใใใใ Vision Transformers (ViT) ใฎๅฐๅ
ฅใใๅงใพใใพใใใ
+ไธๆนใใใใฉ ViT ใฏใใชใใธใงใฏใๆคๅบใใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใชใฉใฎไธ่ฌ็ใชใณใณใใฅใผใฟใผ ใใธใงใณ ใฟในใฏใซ้ฉ็จใใใจๅฐ้ฃใซ็ด้ขใใพใใ้ๅฑคๅใใฉใณในใใฉใผใใผใงใ
+(Swin Transformers ใชใฉ) ใฏใใใใคใใฎ ConvNet ใฎไปฅๅใฎๆฉ่ฝใๅๅฐๅ
ฅใใTransformers ใๆฑ็จใใธใงใณ ใใใฏใใผใณใจใใฆๅฎ็จ็ใซๅฏ่ฝใซใใๅน
ๅบใ็ฐๅขใง้ก่ใชใใใฉใผใใณในใๅฎ่จผใใพใใใ
+ใใพใใพใช่ฆ่ฆใฟในใฏใใใ ใใใใฎใใใชใใคใใชใใ ใขใใญใผใใฎๆๅนๆงใฏใไพ็ถใจใใฆใๅบๆใฎ่ชๅฐๆงใงใฏใชใใใใฉใณในใใฉใผใใผใฎๆฌ่ณช็ใชๅชไฝๆงใซใใใจใใใๅคงใใใจ่ใใใใฆใใพใใ
+็ณใฟ่พผใฟใฎใใคใขในใใใฎไฝๆฅญใงใฏใ่จญ่จ็ฉบ้ใๅๆค่จใใ็ด็ฒใช ConvNet ใ้ๆใงใใ้็ใใในใใใพใใๆจๆบ ResNet ใ่จญ่จใซๅใใฆๅพใ
ใซใๆๆฐๅใใใพใใ
+ใใธใงใณ Transformer ใฎๆฆ่ฆใ็ขบ่ชใใ้ไธญใงใใใฉใผใใณในใฎ้ใใซๅฏไธใใใใใคใใฎ้่ฆใชใณใณใใผใใณใใ็บ่ฆใใพใใใใฎ่ชฟๆปใฎ็ตๆใฏใ็ด็ฒใช ConvNet ใขใใซใฎใใกใใชใผใงใใ
+ConvNextใจๅผใฐใใพใใ ConvNeXts ใฏๅฎๅ
จใซๆจๆบใฎ ConvNet ใขใธใฅใผใซใใๆง็ฏใใใฆใใใ็ฒพๅบฆใจๆกๅผตๆงใฎ็นใง Transformers ใจๆๅฉใซ็ซถๅใใ87.8% ใฎ ImageNet ใใใ 1 ็ฒพๅบฆใ้ๆใใฆใใพใใ
+ๆจๆบ ConvNet ใฎใทใณใใซใใจๅน็ใ็ถญๆใใชใใใCOCO ๆคๅบใจ ADE20K ใปใฐใกใณใใผใทใงใณใงใฏ Swin Transformers ใใใๅชใใใใใฉใผใใณในใ็บๆฎใใพใใ*
+
+
+
+ ConvNeXT ใขใผใญใใฏใใฃใ ๅ
ใฎ่ซๆ ใใๆ็ฒใ
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใ TensorFlow ใใผใธใงใณใฎใขใใซใฏ [ariG23498](https://github.com/ariG23498) ใซใใฃใฆๆไพใใใพใใใ
+[gante](https://github.com/gante)ใใใใณ [sayakpaul](https://github.com/sayakpaul) (ๅ็ญใฎ่ฒข็ฎ)ใๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/facebookresearch/ConvNeXt) ใซใใใพใใ
+
+## Resources
+
+ConvNeXT ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`ConvNextForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+- ๅ็
ง: [็ปๅๅ้กใฟในใฏ ใฌใคใ](../tasks/image_classification)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## ConvNextConfig
+
+[[autodoc]] ConvNextConfig
+
+## ConvNextFeatureExtractor
+
+[[autodoc]] ConvNextFeatureExtractor
+
+## ConvNextImageProcessor
+
+[[autodoc]] ConvNextImageProcessor
+ - preprocess
+
+
+
+
+## ConvNextModel
+
+[[autodoc]] ConvNextModel
+ - forward
+
+## ConvNextForImageClassification
+
+[[autodoc]] ConvNextForImageClassification
+ - forward
+
+
+
+
+## TFConvNextModel
+
+[[autodoc]] TFConvNextModel
+ - call
+
+## TFConvNextForImageClassification
+
+[[autodoc]] TFConvNextForImageClassification
+ - call
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convnextv2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convnextv2.md
new file mode 100644
index 0000000000000000000000000000000000000000..9e4d54df24b1c17659367773f40e73e8cc85a93c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/convnextv2.md
@@ -0,0 +1,68 @@
+
+
+# ConvNeXt V2
+
+## Overview
+
+ConvNeXt V2 ใขใใซใฏใSanghyun WooใShobhik DebnathใRonghang HuใXinlei ChenใZhuang Liu, In So Kweon, Saining Xie. ใซใใฃใฆ [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://arxiv.org/abs/2301.00808) ใงๆๆกใใใพใใใ
+ConvNeXt V2 ใฏใVision Transformers ใฎ่จญ่จใใใคใณในใใฌใผใทใงใณใๅพใ็ด็ฒใช็ณใฟ่พผใฟใขใใซ (ConvNet) ใงใใใ[ConvNeXT](convnext) ใฎๅพ็ถใงใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ใขใผใญใใฏใใฃใฎๆนๅใจ่กจ็พๅญฆ็ฟใใฌใผใ ใฏใผใฏใฎๆนๅใซใใใ่ฆ่ฆ่ช่ญใฎๅ้ใฏ 2020 ๅนดไปฃๅ้ ญใซๆฅ้ใช่ฟไปฃๅใจใใใฉใผใใณในใฎๅไธใๅฎ็พใใพใใใใใจใใฐใConvNeXt ใซไปฃ่กจใใใๆๆฐใฎ ConvNet ใฏใใใพใใพใชใทใใชใชใงๅผทๅใชใใใฉใผใใณในใๅฎ่จผใใฆใใพใใใใใใฎใขใใซใฏใใจใใจ ImageNet ใฉใใซใไฝฟ็จใใๆๅธซใใๅญฆ็ฟ็จใซ่จญ่จใใใพใใใใใในใฏ ใชใผใใจใณใณใผใใผ (MAE) ใชใฉใฎ่ชๅทฑๆๅธซใใๅญฆ็ฟๆๆณใใใๆฝๅจ็ใซๆฉๆตใๅใใใใจใใงใใพใใใใ ใใใใใ 2 ใคใฎใขใใญใผใใๅ็ดใซ็ตใฟๅใใใใจใใใใฉใผใใณในใๆจๆบไปฅไธใซใชใใใจใใใใใพใใใใใฎ่ซๆใงใฏใๅฎๅ
จ็ณใฟ่พผใฟใในใฏ ใชใผใใจใณใณใผใ ใใฌใผใ ใฏใผใฏใจใใใฃใใซ้ใฎๆฉ่ฝ็ซถๅใๅผทๅใใใใใซ ConvNeXt ใขใผใญใใฏใใฃใซ่ฟฝๅ ใงใใๆฐใใ Global Response Normalization (GRN) ๅฑคใๆๆกใใพใใใใฎ่ชๅทฑๆๅธซใใๅญฆ็ฟๆๆณใจใขใผใญใใฏใใฃใฎๆนๅใฎๅ
ฑๅ่จญ่จใซใใใConvNeXt V2 ใจๅผใฐใใๆฐใใใขใใซ ใใกใใชใ่ช็ใใพใใใใใใซใใใImageNet ๅ้กใCOCO ๆคๅบใADE20K ใปใฐใกใณใใผใทใงใณใชใฉใฎใใพใใพใช่ช่ญใใณใใใผใฏใซใใใ็ด็ฒใช ConvNet ใฎใใใฉใผใใณในใๅคงๅน
ใซๅไธใใพใใใพใใImageNet ใงใใใ 1 ใฎ็ฒพๅบฆ 76.7% ใ่ชใๅน็็ใช 370 ไธใใฉใกใผใฟใฎ Atto ใขใใซใใใๆๅ
็ซฏใฎ 88.9% ใ้ๆใใ 650M Huge ใขใใซใพใงใใใพใใพใชใตใคใบใฎไบๅใใฌใผใใณใฐๆธใฟ ConvNeXt V2 ใขใใซใๆไพใใฆใใพใใๅ
ฌ้ใใฌใผใใณใฐ ใใผใฟใฎใฟใไฝฟ็จใใ็ฒพๅบฆ*ใ
+
+
+
+ ConvNeXt V2 ใขใผใญใใฏใใฃใ ๅ
ใฎ่ซๆ ใใๆ็ฒใ
+
+ใใฎใขใใซใฏ [adirik](https://huggingface.co/adirik) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/facebookresearch/ConvNeXt-V2) ใซใใใพใใ
+
+## Resources
+
+ConvNeXt V2 ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`ConvNextV2ForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## ConvNextV2Config
+
+[[autodoc]] ConvNextV2Config
+
+## ConvNextV2Model
+
+[[autodoc]] ConvNextV2Model
+ - forward
+
+## ConvNextV2ForImageClassification
+
+[[autodoc]] ConvNextV2ForImageClassification
+ - forward
+
+## TFConvNextV2Model
+
+[[autodoc]] TFConvNextV2Model
+ - call
+
+
+## TFConvNextV2ForImageClassification
+
+[[autodoc]] TFConvNextV2ForImageClassification
+ - call
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cpm.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cpm.md
new file mode 100644
index 0000000000000000000000000000000000000000..afac35823e641ace9273e85296f871d2fbd48759
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cpm.md
@@ -0,0 +1,54 @@
+
+
+# CPM
+
+## Overview
+
+CPM ใขใใซใฏใZhengyan ZhangใXu HanใHao ZhouใPei KeใYuxian Gu ใซใใฃใฆ [CPM: A Large-scale Generative Chinese Pre-trained Language Model](https://arxiv.org/abs/2012.00413) ใงๆๆกใใใพใใใ่ๅพณๆใ็งฆ่ฃไฝณใ
+Yusheng SuใHaozhe JiใJian GuanใFanchao QiใXiaozi WangใYanan ZhengใGuoyang ZengใHuanqi CaoใShengqi Chenใ
+Daixuan LiใZhenbo SunใZhiyuan LiuใMinlie HuangใWentao HanใJie TangใJuanzi LiใXiaoyan ZhuใMaosong Sunใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ไบๅใใฌใผใใณใฐใใใ่จ่ชใขใใซ (PLM) ใฏใใใพใใพใชไธๆตใฎ NLP ใฟในใฏใซๆ็ใงใใใใจใ่จผๆใใใฆใใพใใๆ่ฟใงใฏGPT-3ใ
+1,750ๅๅใฎใใฉใกใผใฟใจ570GBใฎๅญฆ็ฟใใผใฟใๅใใๆฐๅใฎๆฎๅฝฑ๏ผ1ๆใงใ๏ผใฎๅฎน้ใงๅคงใใชๆณจ็ฎใ้ใใพใใ
+ใผใญใทใงใใ๏ผๅญฆ็ฟใใใ ใใGPT-3 ใ้ฉ็จใใฆไธญๅฝ่ชใฎ NLP ใฟในใฏใซๅฏพๅฆใใใใจใฏไพ็ถใจใใฆๅฐ้ฃใงใใ
+GPT-3 ใฎ่จ่ชใฏไธปใซ่ฑ่ชใงใใใใใฉใกใผใฟใผใฏๅ
ฌ้ใใใฆใใพใใใใใฎๆ่กใฌใใผใใงใฏใ
+ๅคง่ฆๆจกใชไธญๅฝ่ชใใฌใผใใณใฐ ใใผใฟใซๅฏพใใ็ๆ็ไบๅใใฌใผใใณใฐใๅใใไธญๅฝ่ชไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซ (CPM)ใๆ้ซใซ
+็งใใกใฎ็ฅ่ญใฎ้ใใงใฏใ26 ๅใฎใใฉใกใผใฟใจ 100GB ใฎไธญๅฝ่ชใใฌใผใใณใฐ ใใผใฟใๅใใ CPM ใฏใไบๅใใฌใผใใณใฐใใใไธญๅฝ่ชใจใใฆใฏๆๅคงใฎใใฎใงใใ
+่จ่ชใขใใซใฏใไผ่ฉฑใใจใใปใคใฎไฝๆใ
+ใฏใญใผใผใในใใจ่จ่ช็่งฃใๅบ็ฏใชๅฎ้จใซใใใCPM ใๅคใใฎ็ฐๅขใงๅชใใใใใฉใผใใณในใ้ๆใงใใใใจใๅฎ่จผใใใฆใใพใใ
+ๅฐๆฐใทใงใใ (ใผใญใทใงใใใงใ) ๅญฆ็ฟใฎ่จญๅฎใงใฎ NLP ใฟในใฏใ*
+
+ใใฎใขใใซใฏ [canwenxu](https://huggingface.co/canwenxu) ใซใใฃใฆๆไพใใใพใใใใชใชใธใใซใฎๅฎ่ฃ
ใ่ฆใคใใใพใ
+ใใ: https://github.com/TsinghuaAI/CPM-Generate
+
+
+
+
+CPM ใฎใขใผใญใใฏใใฃใฏใใใผใฏใณๅๆนๆณใ้คใใฆ GPT-2 ใจๅใใงใใ่ฉณ็ดฐใซใคใใฆใฏใ[GPT-2 ใใญใฅใกใณใ](openai-community/gpt2) ใๅ็
งใใฆใใ ใใใ
+API ใชใใกใฌใณในๆ
ๅ ฑใ
+
+
+
+## CpmTokenizer
+
+[[autodoc]] CpmTokenizer
+
+## CpmTokenizerFast
+
+[[autodoc]] CpmTokenizerFast
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cpmant.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cpmant.md
new file mode 100644
index 0000000000000000000000000000000000000000..ca1f65caa16c045c2a22838682dd03d3af7f897f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cpmant.md
@@ -0,0 +1,47 @@
+
+
+# CPMAnt
+
+## Overview
+
+CPM-Ant ใฏใ10B ใใฉใกใผใฟใๅใใใชใผใใณใฝใผในใฎไธญๅฝ่ชใฎไบๅใใฌใผใใณใฐๆธใฟ่จ่ชใขใใซ (PLM) ใงใใใใใฏใCPM-Live ใฎใฉใคใ ใใฌใผใใณใฐ ใใญใปในใฎๆๅใฎใใคใซในใใผใณใงใใใใพใใใใฌใผใใณใฐใใญใปในใฏ่ฒป็จๅฏพๅนๆใ้ซใใ็ฐๅขใซๅชใใใใฎใงใใ CPM-Ant ใฏใCUGE ใใณใใใผใฏใงใฎใใซใฟ ใใฅใผใใณใฐใงใๆๆใช็ตๆใ้ๆใใฆใใพใใใใซ ใขใใซใซๅ ใใฆใใใพใใพใชใใผใใฆใงใขๆงๆใฎ่ฆไปถใๆบใใใใพใใพใชๅง็ธฎใใผใธใงใณใๆไพใใฆใใพใใ [่ฉณ็ดฐใ่ฆใ](https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live)
+
+ใใฎใขใใซใฏ [OpenBMB](https://huggingface.co/openbmb) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live) ใซใใใพใใ
+
+## Resources
+
+- [CPM-Live](https://github.com/OpenBMB/CPM-Live/tree/cpm-ant/cpm-live) ใซ้ขใใใใฅใผใใชใขใซใ
+
+## CpmAntConfig
+
+[[autodoc]] CpmAntConfig
+ - all
+
+## CpmAntTokenizer
+
+[[autodoc]] CpmAntTokenizer
+ - all
+
+## CpmAntModel
+
+[[autodoc]] CpmAntModel
+ - all
+
+## CpmAntForCausalLM
+
+[[autodoc]] CpmAntForCausalLM
+ - all
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/ctrl.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/ctrl.md
new file mode 100644
index 0000000000000000000000000000000000000000..f93345d30e79bc6b16fb5fb5e7acbb3e82744125
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/ctrl.md
@@ -0,0 +1,113 @@
+
+
+# CTRL
+
+
+
+## Overview
+
+CTRL ใขใใซใฏใNitish Shirish Keskar*ใBryan McCann*ใLav R. VarshneyใCaiming Xiong, Richard Socher ใซใใฃใฆ [CTRL: A Conditional Transformer Language Model for Controllable Generation](https://arxiv.org/abs/1909.05858) ใงๆๆกใใใพใใใ
+ใชใใฃใผใใปใฝใผใใฃใผใใใใฏใ้ๅธธใซๅคง่ฆๆจกใชใณใผใในใฎ่จ่ชใขใใชใณใฐใไฝฟ็จใใฆไบๅใใฌใผใใณใฐใใใๅ ๆ็ (ไธๆนๅ) ใใฉใณในใใฉใผใใผใงใ
+ๆๅใฎใใผใฏใณใๅถๅพกใณใผใ (ใชใณใฏใๆธ็ฑใWikipedia ใชใฉ) ใจใใฆไบ็ดใใใฆใใใ็ด 140 GB ใฎใใญในใ ใใผใฟใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๅคง่ฆๆจกใช่จ่ชใขใใซใฏๆๆใชใใญในใ็ๆๆฉ่ฝใ็คบใใฆใใพใใใใฆใผใถใผใฏ็นๅฎใฎ่จ่ชใขใใซใ็ฐกๅใซๅถๅพกใงใใพใใ
+็ๆใใใใใญในใใฎๅด้ขใ 16 ๅ 3,000 ไธใใฉใกใผใฟใฎๆกไปถไปใใใฉใณในใใฉใผใใผ่จ่ชใขใใซใงใใ CTRL ใใชใชใผในใใพใใ
+ในใฟใคใซใใณใณใใณใใใฟในใฏๅบๆใฎๅไฝใๅถๅพกใใๅถๅพกใณใผใใๆกไปถไปใใใใใซ่จ็ทดใใใฆใใพใใๅถๅพกใณใผใใฏ
+็ใฎใใญในใใจ่ช็ถใซๅ
ฑ็ใใๆง้ ใใๆดพ็ใใๆๅธซใชใๅญฆ็ฟใฎๅฉ็นใ็ถญๆใใชใใใ
+ใใญในใ็ๆใใใๆ็คบ็ใซๅถๅพกใงใใใใใซใชใใพใใใใใใฎใณใผใใไฝฟ็จใใใจใCTRL ใงใฉใฎ้จๅใไบๆธฌใใใใฎใใไบๆธฌใใใใจใใงใใพใใ
+ใใฌใผใใณใฐ ใใผใฟใซใฏใทใผใฑใณในใไธใใใใๅฏ่ฝๆงใๆใ้ซใใชใใพใใใใใซใใใๅคง้ใฎใใผใฟใๅๆใใใใใฎๆฝๅจ็ใชๆนๆณใๆไพใใใพใใ
+ใขใใซใใผในใฎใฝใผในๅธฐๅฑใไปใใฆใ*
+
+ใใฎใขใใซใฏใ[keskarnitishr](https://huggingface.co/keskarnitishr) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใ่ฆใคใใ
+[ใใกใ](https://github.com/salesforce/Salesforce/ctrl)ใ
+
+## Usage tips
+
+- CTRL ใฏๅถๅพกใณใผใใๅฉ็จใใฆใใญในใใ็ๆใใพใใ็ๆใ็นๅฎใฎๅ่ชใๆใง้ๅงใใๅฟ
่ฆใใใใพใใ
+ ใพใใฏใชใณใฏใใฆไธ่ฒซใใใใญในใใ็ๆใใพใใ [ๅ
ใฎๅฎ่ฃ
](https://github.com/salesforce/Salesforce/ctrl) ใๅ็
งใใฆใใ ใใใ
+ ่ฉณใใใฏใ
+- CTRL ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใ
+- CTRL ใฏๅ ๆ่จ่ชใขใใชใณใฐ (CLM) ใฎ็ฎ็ใงใใฌใผใใณใฐใใใฆใใใใใๆฌกใฎไบๆธฌใซๅผทๅใงใใ
+ ใทใผใฑใณในๅ
ใฎใใผใฏใณใใใฎๆฉ่ฝใๅฉ็จใใใจใCTRL ใฏๆงๆ็ใซไธ่ฒซใใใใญในใใ็ๆใงใใใใใซใชใใพใใ
+ *run_generation.py* ใตใณใใซ ในใฏใชใใใง็ขบ่ชใงใใพใใ
+- PyTorch ใขใใซใฏใไปฅๅใซ่จ็ฎใใใใญใผใจๅคใฎใขใใณใทใงใณ ใใขใงใใ`past_key_values`ใๅ
ฅๅใจใใฆๅใๅใใใจใใงใใพใใ
+ TensorFlow ใขใใซใฏ`past`ใๅ
ฅๅใจใใฆๅใๅ
ฅใใพใใ `past_key_values`ๅคใไฝฟ็จใใใจใใขใใซใๅ่จ็ฎใใใชใใชใใพใใ
+ ใใญในใ็ๆใฎใณใณใใญในใใงไบๅใซ่จ็ฎใใใๅคใ [`forward`](model_doc/ctrl#transformers.CTRLModel.forward) ใๅ็
งใใฆใใ ใใใ
+ ใใฎๅผๆฐใฎไฝฟ็จๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใใกใฝใใใๅ็
งใใฆใใ ใใใ
+
+## Resources
+
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+
+## CTRLConfig
+
+[[autodoc]] CTRLConfig
+
+## CTRLTokenizer
+
+[[autodoc]] CTRLTokenizer
+ - save_vocabulary
+
+
+
+
+## CTRLModel
+
+[[autodoc]] CTRLModel
+ - forward
+
+## CTRLLMHeadModel
+
+[[autodoc]] CTRLLMHeadModel
+ - forward
+
+## CTRLForSequenceClassification
+
+[[autodoc]] CTRLForSequenceClassification
+ - forward
+
+
+
+
+## TFCTRLModel
+
+[[autodoc]] TFCTRLModel
+ - call
+
+## TFCTRLLMHeadModel
+
+[[autodoc]] TFCTRLLMHeadModel
+ - call
+
+## TFCTRLForSequenceClassification
+
+[[autodoc]] TFCTRLForSequenceClassification
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cvt.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cvt.md
new file mode 100644
index 0000000000000000000000000000000000000000..16d39d1b55d35cf3a067b2ea1efcc5247ee89827
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/cvt.md
@@ -0,0 +1,88 @@
+
+
+# Convolutional Vision Transformer (CvT)
+
+## Overview
+
+CvT ใขใใซใฏใHaping WuใBin XiaoใNoel CodellaใMengchen LiuใXiyang DaiใLu YuanใLei Zhang ใซใใฃใฆ [CvT: Introduction Convolutions to Vision Transformers](https://arxiv.org/abs/2103.15808) ใงๆๆกใใใพใใใ็ณใฟ่พผใฟใใธใงใณ ใใฉใณในใใฉใผใใผ (CvT) ใฏใViT ใซ็ณใฟ่พผใฟใๅฐๅ
ฅใใฆไธกๆนใฎ่จญ่จใฎ้ทๆใๅผใๅบใใใจใซใใใ[ใใธใงใณ ใใฉใณในใใฉใผใใผ (ViT)](vit) ใฎใใใฉใผใใณในใจๅน็ใๅไธใใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ใใฎ่ซๆใงใฏใใใธใงใณ ใใฉใณในใใฉใผใใผ (ViT) ใๆนๅใใใ็ณใฟ่พผใฟใใธใงใณ ใใฉใณในใใฉใผใใผ (CvT) ใจๅผใฐใใๆฐใใใขใผใญใใฏใใฃใ็ดนไปใใพใใ
+ViT ใซ็ณใฟ่พผใฟใๅฐๅ
ฅใใฆไธกๆนใฎ่จญ่จใฎ้ทๆใๅผใๅบใใใจใงใใใใฉใผใใณในใจๅน็ใๅไธใใใพใใใใใฏๆฌกใฎใใใซใใฆๅฎ็พใใใพใใ
+2 ใคใฎไธป่ฆใชๅคๆด: ๆฐใใ็ณใฟ่พผใฟใใผใฏใณใฎๅใ่พผใฟใๅซใใใฉใณในใใฉใผใใผใฎ้ๅฑคใจใ็ณใฟ่พผใฟใใฉใณในใใฉใผใใผ
+็ณใฟ่พผใฟๅฐๅฝฑใๅฉ็จใใใใญใใฏใใใใใฎๅคๆดใซใใใ็ณใฟ่พผใฟใใฅใผใฉใซ ใใใใฏใผใฏ (CNN) ใฎๆใพใใ็นๆงใๅฐๅ
ฅใใใพใใ
+ใใฉใณในใใฉใผใใผใฎๅฉ็น (ๅ็ใชๆณจๆๅใ
+ใฐใญใผใใซใชใณใณใใญในใใจใใ่ฏใไธ่ฌๅ)ใ็งใใกใฏๅบ็ฏใชๅฎ้จใๅฎๆฝใใใใจใง CvT ใๆค่จผใใใใฎใขใใญใผใใ้ๆใงใใใใจใ็คบใใฆใใพใใ
+ImageNet-1k ไธใฎไปใฎใใธใงใณ ใใฉใณในใใฉใผใใผใ ResNet ใใใใใใฉใกใผใฟใๅฐใชใใFLOP ใไฝใใๆๅ
็ซฏใฎใใใฉใผใใณในใๅฎ็พใใพใใๅ ใใฆใ
+ใใๅคงใใชใใผใฟใปใใ (ไพ: ImageNet-22k) ใงไบๅใใฌใผใใณใฐใใไธๆตใฎใฟในใฏใซๅใใใฆๅพฎ่ชฟๆดใใใจใใใใฉใผใใณในใฎๅไธใ็ถญๆใใใพใใไบๅใใฌใผใใณใฐๆธใฟ
+ImageNet-22kใๅฝ็คพใฎ CvT-W24 ใฏใImageNet-1k val set ใง 87.7\% ใจใใใใใ 1 ใฎ็ฒพๅบฆใ็ฒๅพใใฆใใพใใๆๅพใซใ็งใใกใฎ็ตๆใฏใไฝ็ฝฎใจใณใณใผใใฃใณใฐใใ
+ๆขๅญใฎใใธใงใณ ใใฉใณในใใฉใผใใผใฎ้่ฆใชใณใณใใผใใณใใงใใใใฎใณใณใใผใใณใใฏใใขใใซใงใฏๅฎๅ
จใซๅ้คใงใใใใใ้ซ่งฃๅๅบฆใฎใใธใงใณ ใฟในใฏใฎ่จญ่จใ็ฐก็ด ๅใใใพใใ*
+
+ใใฎใขใใซใฏ [anugunj](https://huggingface.co/anugunj) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/microsoft/CvT) ใซใใใพใใ
+
+## Usage tips
+
+- CvT ใขใใซใฏ้ๅธธใฎ Vision Transformer ใงใใใ็ณใฟ่พผใฟใงใใฌใผใใณใฐใใใฆใใพใใ ImageNet-1K ใใใณ CIFAR-100 ใงๅพฎ่ชฟๆดใใใจใ[ใชใชใธใใซ ใขใใซ (ViT)](vit) ใใใๅชใใใใใฉใผใใณในใ็บๆฎใใพใใ
+- ใซในใฟใ ใใผใฟใฎๅพฎ่ชฟๆดใ ใใงใชใๆจ่ซใซ้ขใใใใข ใใผใใใใฏใ [ใใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer) ใง็ขบ่ชใงใใพใ ([`ViTFeatureExtractor ใ็ฝฎใๆใใใ ใใงๆธใฟใพใ) `] ใซใใ [`AutoImageProcessor`] ใใใณ [`ViTForImageClassification`] ใซใใ [`CvtForImageClassification`])ใ
+- ๅฉ็จๅฏ่ฝใชใใงใใฏใใคใณใใฏใ(1) [ImageNet-22k](http://www.image-net.org/) (1,400 ไธใฎ็ปๅใจ 22,000 ใฎใฏใฉในใฎใณใฌใฏใทใงใณ) ใงใฎใฟไบๅใใฌใผใใณใฐใใใฆใใใ(2) ใๅ้กใใใพใใใ ImageNet-22k ใง่ชฟๆดใใพใใฏ (3) [ImageNet-1k](http://www.image-net.org/challenges/LSVRC/2012/) (ILSVRC 2012 ใจใๅผใฐใใใณใฌใฏใทใงใณ) ใงใๅพฎ่ชฟๆด130ไธใฎ
+ ็ปๅใจ 1,000 ใฏใฉใน)ใ
+
+## Resources
+
+CvT ใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`CvtForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+- ๅ็
ง: [็ปๅๅ้กใฟในใฏ ใฌใคใ](../tasks/image_classification)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## CvtConfig
+
+[[autodoc]] CvtConfig
+
+
+
+
+## CvtModel
+
+[[autodoc]] CvtModel
+ - forward
+
+## CvtForImageClassification
+
+[[autodoc]] CvtForImageClassification
+ - forward
+
+
+
+
+## TFCvtModel
+
+[[autodoc]] TFCvtModel
+ - call
+
+## TFCvtForImageClassification
+
+[[autodoc]] TFCvtForImageClassification
+ - call
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/data2vec.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/data2vec.md
new file mode 100644
index 0000000000000000000000000000000000000000..78ae71e6947e4d9720737dc0547c719c779ddd20
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/data2vec.md
@@ -0,0 +1,187 @@
+
+
+# Data2Vec
+
+## Overview
+
+Data2Vec ใขใใซใฏใ[data2vec: A General Framework for Self-supervised Learning in Speech, Vision and Language](https://arxiv.org/pdf/2202.03555) ใง Alexei BaevskiใWei-Ning HsuใQiantong XuใใArun Babu, Jiatao Gu and Michael Auli.
+Data2Vec ใฏใใใญในใใ้ณๅฃฐใ็ปๅใชใฉใฎใใพใใพใชใใผใฟ ใขใใชใใฃใซใใใ่ชๅทฑๆๅธซใใๅญฆ็ฟใฎใใใฎ็ตฑไธใใฌใผใ ใฏใผใฏใๆๆกใใพใใ
+้่ฆใชใฎใฏใไบๅใใฌใผใใณใฐใฎไบๆธฌใฟใผใฒใใใฏใใขใใชใใฃๅบๆใฎใณใณใใญในใใซไพๅญใใชใใฟใผใฒใใใงใฏใชใใๅ
ฅๅใฎใณใณใใญในใๅใใใๆฝๅจ่กจ็พใงใใใใจใงใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*่ชๅทฑๆๅธซใใๅญฆ็ฟใฎไธ่ฌ็ใช่ใๆนใฏใฉใฎใขใใชใใฃใงใๅใใงใใใๅฎ้ใฎใขใซใดใชใบใ ใจ
+ๅไธใฎใขใใชใใฃใๅฟต้ ญใซ็ฝฎใใฆ้็บใใใใใใ็ฎ็ใฏๅคงใใ็ฐใชใใพใใไธ่ฌใซ่ฟใฅใใใใใซ
+่ชๅทฑๆๅธซใใๅญฆ็ฟใงใฏใใฉใกใใฎ้ณๅฃฐใซๅฏพใใฆใๅใๅญฆ็ฟๆนๆณใไฝฟ็จใใใใฌใผใ ใฏใผใฏใงใใ data2vec ใ็ดนไปใใพใใ
+NLP ใพใใฏใณใณใใฅใผใฟใผ ใใธใงใณใไธญๅฟใจใชใใขใคใใขใฏใๅฎๅ
จใชๅ
ฅๅใใผใฟใฎๆฝๅจ็ใช่กจ็พใใ
+ๆจๆบใฎ Transformer ใขใผใญใใฏใใฃใไฝฟ็จใใ่ชๅทฑ่ธ็ใปใใใขใใใฎๅ
ฅๅใฎใในใฏใใใใใฅใผใ
+ๅ่ชใ่ฆ่ฆ็ใใผใฏใณใไบบ้ใฎ้ณๅฃฐๅไฝใชใฉใฎใขใใชใใฃๅบๆใฎใฟใผใฒใใใไบๆธฌใใใฎใงใฏใชใใ
+ๆฌ่ณช็ใซใญใผใซใซใงใใใใใdata2vec ใฏใใใใฎๆ
ๅ ฑใๅซใๆ่ๅใใใๆฝๅจ่กจ็พใไบๆธฌใใพใใ
+ๅ
ฅๅๅ
จไฝใ้ณๅฃฐ่ช่ญใ็ปๅๅ้กใใใใณ
+่ช็ถ่จ่ช็่งฃใฏใๆฐใใๆๅ
็ซฏๆ่กใใไธปๆตใฎใขใใญใผใใซๅนๆตใใใใใฉใผใใณในใๅฎ่จผใใพใใ
+ใขใใซใจใณใผใใฏใwww.github.com/pytorch/fairseq/tree/master/examples/data2vec.* ใงๅ
ฅๆใงใใพใใ
+
+ใใฎใขใใซใฏใ[edugp](https://huggingface.co/edugp) ใใใณ [patrickvonplaten](https://huggingface.co/patrickvonplaten) ใซใใฃใฆๆไพใใใพใใใ
+[sayakpaul](https://github.com/sayakpaul) ใจ [Rocketknight1](https://github.com/Rocketknight1) ใฏใTensorFlow ใฎใใธใงใณใซ Data2Vec ใๆไพใใพใใใ
+
+ๅ
ใฎใณใผใ (NLP ใใใณ้ณๅฃฐ็จ) ใฏใ[ใใกใ](https://github.com/pytorch/fairseq/tree/main/examples/data2vec) ใซใใใพใใ
+ใใธใงใณใฎๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/facebookresearch/data2vec_vision/tree/main/beit) ใซใใใพใใ
+
+## Usage tips
+
+- Data2VecAudioใData2VecTextใใใใณ Data2VecVision ใฏใในใฆใๅใ่ชๅทฑๆๅธซใใๅญฆ็ฟๆนๆณใไฝฟ็จใใฆใใฌใผใใณใฐใใใฆใใพใใ
+- Data2VecAudio ใฎๅ ดๅใๅๅฆ็ใฏ็นๅพดๆฝๅบใๅซใใฆ [`Wav2Vec2Model`] ใจๅใใงใใ
+- Data2VecText ใฎๅ ดๅใๅๅฆ็ใฏใใผใฏใณๅใๅซใใฆ [`RobertaModel`] ใจๅใใงใใ
+- Data2VecVision ใฎๅ ดๅใๅๅฆ็ใฏ็นๅพดๆฝๅบใๅซใใฆ [`BeitModel`] ใจๅใใงใใ
+
+## Resources
+
+Data2Vec ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`Data2VecVisionForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://cola.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+- ใซในใฟใ ใใผใฟใปใใใง [`TFData2VecVisionForImageClassification`] ใๅพฎ่ชฟๆดใใใซใฏใ[ใใฎใใผใใใใฏ](https://colab.research.google.com/github/sayakpaul/TF-2.0-Hacks/blob/master/data2vec_vision_image_classification.ipynb) ใๅ็
งใใฆใใ ใใใ ๏ผใ
+
+**Data2VecText ใใญใฅใกใณใ ใชใฝใผใน**
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ๅ ๆ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/language_modeling)
+- [ใในใฏ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_language_modeling)
+- [ๅค่ข้ธๆใฟในใฏ ใฌใคใ](../tasks/multiple_choice)
+
+**Data2VecAudio ใใญใฅใกใณใ ใชใฝใผใน**
+- [้ณๅฃฐๅ้กใฟในใฏใฌใคใ](../tasks/audio_classification)
+- [่ชๅ้ณๅฃฐ่ช่ญใฟในใฏใฌใคใ](../tasks/asr)
+
+**Data2VecVision ใใญใฅใกใณใ ใชใฝใผใน**
+- [็ปๅๅ้ก](../tasks/image_classification)
+- [ใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณ](../tasks/semantic_segmentation)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## Data2VecTextConfig
+
+[[autodoc]] Data2VecTextConfig
+
+## Data2VecAudioConfig
+
+[[autodoc]] Data2VecAudioConfig
+
+## Data2VecVisionConfig
+
+[[autodoc]] Data2VecVisionConfig
+
+
+
+
+## Data2VecAudioModel
+
+[[autodoc]] Data2VecAudioModel
+ - forward
+
+## Data2VecAudioForAudioFrameClassification
+
+[[autodoc]] Data2VecAudioForAudioFrameClassification
+ - forward
+
+## Data2VecAudioForCTC
+
+[[autodoc]] Data2VecAudioForCTC
+ - forward
+
+## Data2VecAudioForSequenceClassification
+
+[[autodoc]] Data2VecAudioForSequenceClassification
+ - forward
+
+## Data2VecAudioForXVector
+
+[[autodoc]] Data2VecAudioForXVector
+ - forward
+
+## Data2VecTextModel
+
+[[autodoc]] Data2VecTextModel
+ - forward
+
+## Data2VecTextForCausalLM
+
+[[autodoc]] Data2VecTextForCausalLM
+ - forward
+
+## Data2VecTextForMaskedLM
+
+[[autodoc]] Data2VecTextForMaskedLM
+ - forward
+
+## Data2VecTextForSequenceClassification
+
+[[autodoc]] Data2VecTextForSequenceClassification
+ - forward
+
+## Data2VecTextForMultipleChoice
+
+[[autodoc]] Data2VecTextForMultipleChoice
+ - forward
+
+## Data2VecTextForTokenClassification
+
+[[autodoc]] Data2VecTextForTokenClassification
+ - forward
+
+## Data2VecTextForQuestionAnswering
+
+[[autodoc]] Data2VecTextForQuestionAnswering
+ - forward
+
+## Data2VecVisionModel
+
+[[autodoc]] Data2VecVisionModel
+ - forward
+
+## Data2VecVisionForImageClassification
+
+[[autodoc]] Data2VecVisionForImageClassification
+ - forward
+
+## Data2VecVisionForSemanticSegmentation
+
+[[autodoc]] Data2VecVisionForSemanticSegmentation
+ - forward
+
+
+
+
+## TFData2VecVisionModel
+
+[[autodoc]] TFData2VecVisionModel
+ - call
+
+## TFData2VecVisionForImageClassification
+
+[[autodoc]] TFData2VecVisionForImageClassification
+ - call
+
+## TFData2VecVisionForSemanticSegmentation
+
+[[autodoc]] TFData2VecVisionForSemanticSegmentation
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deberta-v2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deberta-v2.md
new file mode 100644
index 0000000000000000000000000000000000000000..35da9d0a1d584ff1013825d463c0b6cee03b2260
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deberta-v2.md
@@ -0,0 +1,167 @@
+
+
+# DeBERTa-v2
+
+## Overview
+
+DeBERTa ใขใใซใฏใPengcheng HeใXiaodong LiuใJianfeng GaoใWeizhu Chen ใซใใฃใฆ [DeBERTa: Decoding-enhanced BERT with Disentangled Attendant](https://arxiv.org/abs/2006.03654) ใงๆๆกใใใพใใใGoogle ใฎใขใใซใซๅบใฅใใฆใใพใใ
+2018ๅนดใซใชใชใผในใใใBERTใขใใซใจ2019ๅนดใซใชใชใผในใใใFacebookใฎRoBERTaใขใใซใ
+
+ใใใฏใใใคใใๆณจๆใ่งฃใใปใใใไฝฟ็จใใใใใผใฟใฎๅๅใไฝฟ็จใใฆๅผทๅใใใใในใฏ ใใณใผใ ใใฌใผใใณใฐใๅใใ RoBERTa ใซๅบใฅใใฆๆง็ฏใใใฆใใพใใ
+ใญใใซใฟใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ไบๅใใฌใผใใณใฐใใใใใฅใผใฉใซ่จ่ชใขใใซใฎๆ่ฟใฎ้ฒๆญฉใซใใใๅคใใฎ่ช็ถ่จ่ชใขใใซใฎใใใฉใผใใณในใๅคงๅน
ใซๅไธใใพใใใ
+่จ่ชๅฆ็ (NLP) ใฟในใฏใใใฎ่ซๆใงใฏใๆฐใใใขใใซ ใขใผใญใใฏใใฃ DeBERTa (Decoding-enhanced BERT with
+ใใใฏใ2 ใคใฎๆฐใใๆ่กใไฝฟ็จใใฆ BERT ใขใใซใจ RoBERTa ใขใใซใๆนๅใใพใใ 1ใค็ฎใฏใ
+ใใคใใ่งฃใๆณจๆใกใซใใบใ ใๅๅ่ชใฏใใใฎๅ
ๅฎนใใจใณใณใผใใใ 2 ใคใฎใใฏใใซใไฝฟ็จใใฆ่กจ็พใใใ
+ๅ่ช้ใฎๆณจๆใฎ้ใฟใฏใใใใใฎๅ่ชใฎใใคใ่งฃ้ค่กๅใไฝฟ็จใใฆ่จ็ฎใใใพใใ
+ๅ
ๅฎนใจ็ธๅฏพ็ใชไฝ็ฝฎใ 2 ็ช็ฎใซใๅผทๅใใใใในใฏ ใใณใผใใไฝฟ็จใใฆใๅบๅใฝใใใใใฏใน ใฌใคใคใๆฌกใฎใใใซ็ฝฎใๆใใพใใ
+ใขใใซใฎไบๅใใฌใผใใณใฐ็จใซใในใฏใใใใใผใฏใณใไบๆธฌใใพใใใใใ 2 ใคใฎๆๆณใซใใๅน็ใๅคงๅน
ใซๅไธใใใใจใ็คบใใพใใ
+ใขใใซใฎไบๅใใฌใผใใณใฐใจไธๆตใฟในใฏใฎใใใฉใผใใณในใฎๅไธใ RoBERTa-Large ใจๆฏ่ผใใใจใDeBERTa ใขใใซใฏๅๅใฎใฌใใซใงใใฌใผใใณใฐใใใฆใใพใใ
+ใใฌใผใใณใฐ ใใผใฟใฏๅน
ๅบใ NLP ใฟในใฏใงไธ่ฒซใใฆๅชใใใใใฉใผใใณในใ็คบใใMNLI ใง +0.9% ใฎๆนๅใ้ๆใใพใใใ
+(90.2% ๅฏพ 91.1%)ใSQuAD v2.0 ใงใฏ +2.3% (88.4% ๅฏพ 90.7%)ใRACE ใงใฏ +3.6% (83.2% ๅฏพ 86.8%) ใงใใใ DeBERTa ใณใผใใจ
+ไบๅใใฌใผใใณใฐใใใใขใใซใฏ https://github.com/microsoft/DeBERTa ใงๅ
ฌ้ใใใพใใ*
+
+ๆฌกใฎๆ
ๅ ฑใฏใ[ๅ
ใฎๅฎ่ฃ
ใง็ดๆฅ่กจ็คบใใใพใ ใชใใธใใช](https://github.com/microsoft/DeBERTa)ใ DeBERTa v2 ใฏใDeBERTa ใขใใซใฎ 2 ็ช็ฎใฎใใผใธใงใณใงใใใใใซใฏไปฅไธใๅซใพใใพใ
+SuperGLUE ๅไธใขใใซใฎๆๅบใซไฝฟ็จใใใ 1.5B ใขใใซใฏใไบบ้ใฎใใผในใฉใคใณ 89.8 ใซๅฏพใใฆ 89.9 ใ้ๆใใพใใใใใชใใฏใงใใ
+ใใฎๆ็จฟใซ้ขใใ่ฉณ็ดฐใซใคใใฆใฏใ่่
ใฎใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+[ใใญใฐ](https://www.microsoft.com/en-us/research/blog/microsoft-deberta-surpasses-human-performance-on-the-superglue-benchmark/)
+
+v2 ใฎๆฐๆฉ่ฝ:
+
+- **่ชๅฝ** v2 ใงใฏใใใฌใผใใณใฐ ใใผใฟใใๆง็ฏใใใใตใคใบ 128K ใฎๆฐใใ่ชๅฝใไฝฟ็จใใใใใซใใผใฏใใคใถใผใๅคๆดใใใพใใใ
+ GPT2 ใใผในใฎใใผใฏใใคใถใผใฎไปฃใใใซใใใผใฏใใคใถใผใฏ
+ [sentencepiece ใใผใน](https://github.com/google/sentencepiece) ใใผใฏใใคใถใผใ
+- **nGiE(nGram Induced Input Encoding)** DeBERTa-v2 ใขใใซใฏใๆๅใฎ็ณใฟ่พผใฟๅฑคใจใฏๅฅใซ่ฟฝๅ ใฎ็ณใฟ่พผใฟๅฑคใไฝฟ็จใใพใใ
+ ใใฉใณในใใฉใผใใผๅฑคใไฝฟ็จใใฆใๅ
ฅๅใใผใฏใณใฎใญใผใซใซไพๅญ้ขไฟใใใใใๅญฆ็ฟใใพใใ
+- **ไฝ็ฝฎๅฐๅฝฑ่กๅใๆณจ็ฎใฌใคใคใผใฎใณใณใใณใๅฐๅฝฑ่กๅใจๅ
ฑๆ** ไปฅๅใซๅบใฅใ
+ ๅฎ้จใงใฏใใใใฉใผใใณในใซๅฝฑ้ฟใไธใใใใจใชใใใฉใกใผใฟใไฟๅญใงใใพใใ
+- **ใใฑใใใ้ฉ็จใใฆ็ธๅฏพไฝ็ฝฎใใจใณใณใผใใใพใ** DeBERTa-v2 ใขใใซใฏใญใฐ ใใฑใใใไฝฟ็จใใฆ็ธๅฏพไฝ็ฝฎใใจใณใณใผใใใพใ
+ T5ใซไผผใฆใใพใใ
+- **900M ใขใใซ & 1.5B ใขใใซ** 2 ใคใฎ่ฟฝๅ ใขใใซ ใตใคใบ: 900M ใจ 1.5B ใๅฉ็จๅฏ่ฝใงใใใใซใใใใใใฉใผใใณในใๅคงๅน
ใซๅไธใใพใใ
+ ไธๆตใฟในใฏใฎใใใฉใผใใณในใ
+
+ใใฎใขใใซใฏ [DeBERTa](https://huggingface.co/DeBERTa) ใซใใฃใฆๅฏ็จฟใใใพใใใใใฎใขใใซใฎ TF 2.0 ๅฎ่ฃ
ใฏใ
+[kamalkraj](https://huggingface.co/kamalkraj) ใซใใๆ็จฟใๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/microsoft/DeBERTa) ใซใใใพใใ
+
+## Resources
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+- [ใในใฏ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_language_modeling)
+- [ๅค่ข้ธๆใฟในใฏ ใฌใคใ](../tasks/multiple_choice)
+
+## DebertaV2Config
+
+[[autodoc]] DebertaV2Config
+
+## DebertaV2Tokenizer
+
+[[autodoc]] DebertaV2Tokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## DebertaV2TokenizerFast
+
+[[autodoc]] DebertaV2TokenizerFast
+ - build_inputs_with_special_tokens
+ - create_token_type_ids_from_sequences
+
+
+
+
+## DebertaV2Model
+
+[[autodoc]] DebertaV2Model
+ - forward
+
+## DebertaV2PreTrainedModel
+
+[[autodoc]] DebertaV2PreTrainedModel
+ - forward
+
+## DebertaV2ForMaskedLM
+
+[[autodoc]] DebertaV2ForMaskedLM
+ - forward
+
+## DebertaV2ForSequenceClassification
+
+[[autodoc]] DebertaV2ForSequenceClassification
+ - forward
+
+## DebertaV2ForTokenClassification
+
+[[autodoc]] DebertaV2ForTokenClassification
+ - forward
+
+## DebertaV2ForQuestionAnswering
+
+[[autodoc]] DebertaV2ForQuestionAnswering
+ - forward
+
+## DebertaV2ForMultipleChoice
+
+[[autodoc]] DebertaV2ForMultipleChoice
+ - forward
+
+
+
+
+## TFDebertaV2Model
+
+[[autodoc]] TFDebertaV2Model
+ - call
+
+## TFDebertaV2PreTrainedModel
+
+[[autodoc]] TFDebertaV2PreTrainedModel
+ - call
+
+## TFDebertaV2ForMaskedLM
+
+[[autodoc]] TFDebertaV2ForMaskedLM
+ - call
+
+## TFDebertaV2ForSequenceClassification
+
+[[autodoc]] TFDebertaV2ForSequenceClassification
+ - call
+
+## TFDebertaV2ForTokenClassification
+
+[[autodoc]] TFDebertaV2ForTokenClassification
+ - call
+
+## TFDebertaV2ForQuestionAnswering
+
+[[autodoc]] TFDebertaV2ForQuestionAnswering
+ - call
+
+## TFDebertaV2ForMultipleChoice
+
+[[autodoc]] TFDebertaV2ForMultipleChoice
+ - call
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deberta.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deberta.md
new file mode 100644
index 0000000000000000000000000000000000000000..f7e00ad3b2bccea9fbff45604be048a9c5642f4c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deberta.md
@@ -0,0 +1,164 @@
+
+
+# DeBERTa
+
+## Overview
+
+DeBERTa ใขใใซใฏใPengcheng HeใXiaodong LiuใJianfeng GaoใWeizhu Chen ใซใใฃใฆ [DeBERTa: Decoding-enhanced BERT with Disentangled Attendant](https://arxiv.org/abs/2006.03654) ใงๆๆกใใใพใใใGoogle ใฎใขใใซใซๅบใฅใใฆใใพใใ
+2018ๅนดใซใชใชใผในใใใBERTใขใใซใจ2019ๅนดใซใชใชใผในใใใFacebookใฎRoBERTaใขใใซใ
+
+ใใใฏใใใคใใๆณจๆใ่งฃใใปใใใไฝฟ็จใใใใใผใฟใฎๅๅใไฝฟ็จใใฆๅผทๅใใใใในใฏ ใใณใผใ ใใฌใผใใณใฐใๅใใ RoBERTa ใซๅบใฅใใฆๆง็ฏใใใฆใใพใใ
+ใญใใซใฟใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ไบๅใใฌใผใใณใฐใใใใใฅใผใฉใซ่จ่ชใขใใซใฎๆ่ฟใฎ้ฒๆญฉใซใใใๅคใใฎ่ช็ถ่จ่ชใขใใซใฎใใใฉใผใใณในใๅคงๅน
ใซๅไธใใพใใใ
+่จ่ชๅฆ็ (NLP) ใฟในใฏใใใฎ่ซๆใงใฏใๆฐใใใขใใซ ใขใผใญใใฏใใฃ DeBERTa (Decoding-enhanced BERT with
+ใใใฏใ2 ใคใฎๆฐใใๆ่กใไฝฟ็จใใฆ BERT ใขใใซใจ RoBERTa ใขใใซใๆนๅใใพใใ 1ใค็ฎใฏใ
+ใใคใใ่งฃใๆณจๆใกใซใใบใ ใๅๅ่ชใฏใใใฎๅ
ๅฎนใใจใณใณใผใใใ 2 ใคใฎใใฏใใซใไฝฟ็จใใฆ่กจ็พใใใ
+ๅ่ช้ใฎๆณจๆใฎ้ใฟใฏใใใใใฎๅ่ชใฎใใคใ่งฃ้ค่กๅใไฝฟ็จใใฆ่จ็ฎใใใพใใ
+ๅ
ๅฎนใจ็ธๅฏพ็ใชไฝ็ฝฎใ 2 ็ช็ฎใซใๅผทๅใใใใในใฏ ใใณใผใใไฝฟ็จใใฆใๅบๅใฝใใใใใฏใน ใฌใคใคใๆฌกใฎใใใซ็ฝฎใๆใใพใใ
+ใขใใซใฎไบๅใใฌใผใใณใฐ็จใซใในใฏใใใใใผใฏใณใไบๆธฌใใพใใใใใ 2 ใคใฎๆๆณใซใใๅน็ใๅคงๅน
ใซๅไธใใใใจใ็คบใใพใใ
+ใขใใซใฎไบๅใใฌใผใใณใฐใจไธๆตใฟในใฏใฎใใใฉใผใใณในใฎๅไธใ RoBERTa-Large ใจๆฏ่ผใใใจใDeBERTa ใขใใซใฏๅๅใฎใฌใใซใงใใฌใผใใณใฐใใใฆใใพใใ
+ใใฌใผใใณใฐ ใใผใฟใฏๅน
ๅบใ NLP ใฟในใฏใงไธ่ฒซใใฆๅชใใใใใฉใผใใณในใ็คบใใMNLI ใง +0.9% ใฎๆนๅใ้ๆใใพใใใ
+(90.2% ๅฏพ 91.1%)ใSQuAD v2.0 ใงใฏ +2.3% (88.4% ๅฏพ 90.7%)ใRACE ใงใฏ +3.6% (83.2% ๅฏพ 86.8%) ใงใใใ DeBERTa ใณใผใใจ
+ไบๅใใฌใผใใณใฐใใใใขใใซใฏ https://github.com/microsoft/DeBERTa ใงๅ
ฌ้ใใใพใใ*
+
+
+ใใฎใขใใซใฏ [DeBERTa](https://huggingface.co/DeBERTa) ใซใใฃใฆๅฏ็จฟใใใพใใใใใฎใขใใซใฎ TF 2.0 ๅฎ่ฃ
ใฏใ
+[kamalkraj](https://huggingface.co/kamalkraj) ใซใใๅฏ็จฟใๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/microsoft/DeBERTa) ใซใใใพใใ
+
+## Resources
+
+DeBERTa ใไฝฟใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใ) ใชใฝใผในใฎใชในใใใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+
+
+- DeBERTa ใไฝฟ็จใใฆ [DeepSpeed ใไฝฟ็จใใฆๅคง่ฆๆจกใขใใซใฎใใฌใผใใณใฐใๅ ้ใใ](https://huggingface.co/blog/accelerate-deepspeed) ๆนๆณใซ้ขใใใใญใฐๆ็จฟใ
+- DeBERTa ใซใใ [ๆฉๆขฐๅญฆ็ฟใซใใในใผใใผใใฃใผใธใใใ้กงๅฎขใตใผใใน](https://huggingface.co/blog/supercharge-customer-service-with-machine-learning) ใซ้ขใใใใญใฐๆ็จฟใ
+- [`DebertaForSequenceClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)ใ
+- [`TFDebertaForSequenceClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)ใ
+- [ใใญในใๅ้กใฟในใฏใฌใคใ](../tasks/sequence_classification)
+
+
+
+- [`DebertaForTokenClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)ใ
+- [`TFDebertaForTokenClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [ใใผใฏใณๅ้ก](https://huggingface.co/course/chapter7/2?fw=pt) ๐ค ใใฐใใงใคในใณใผในใฎ็ซ ใ
+- ๐ค ใใฐใใงใคในใณใผในใฎ [ใใคใใใขใจใณใณใผใใฃใณใฐใฎใใผใฏใณๅ](https://huggingface.co/course/chapter6/5?fw=pt) ใฎ็ซ ใ
+- [ใใผใฏใณๅ้กใฟในใฏใฌใคใ](../tasks/token_classification)
+
+
+
+- [`DebertaForMaskedLM`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`TFDebertaForMaskedLM`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/lang-modeling#run_mlmpy) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)ใ
+- [ใในใฏใใใ่จ่ชใขใใชใณใฐ](https://huggingface.co/course/chapter7/3?fw=pt) ๐ค ้กใฎใใฐ ใณใผในใฎ็ซ ใ
+- [ใในใฏ่จ่ชใขใใชใณใฐ ใฟในใฏ ใฌใคใ](../tasks/masked_language_modeling)
+
+
+
+- [`DebertaForQuestionAnswering`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [`TFDebertaForQuestionAnswering`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](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)ใ
+- [่ณชๅๅ็ญ](https://huggingface.co/course/chapter7/7?fw=pt) ๐ค ใใฐใใงใคในใณใผในใฎ็ซ ใ
+- [่ณชๅๅ็ญใฟในใฏ ใฌใคใ](../tasks/question_answering)
+
+## DebertaConfig
+
+[[autodoc]] DebertaConfig
+
+## DebertaTokenizer
+
+[[autodoc]] DebertaTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## DebertaTokenizerFast
+
+[[autodoc]] DebertaTokenizerFast
+ - build_inputs_with_special_tokens
+ - create_token_type_ids_from_sequences
+
+
+
+
+## DebertaModel
+
+[[autodoc]] DebertaModel
+ - forward
+
+## DebertaPreTrainedModel
+
+[[autodoc]] DebertaPreTrainedModel
+
+## DebertaForMaskedLM
+
+[[autodoc]] DebertaForMaskedLM
+ - forward
+
+## DebertaForSequenceClassification
+
+[[autodoc]] DebertaForSequenceClassification
+ - forward
+
+## DebertaForTokenClassification
+
+[[autodoc]] DebertaForTokenClassification
+ - forward
+
+## DebertaForQuestionAnswering
+
+[[autodoc]] DebertaForQuestionAnswering
+ - forward
+
+
+
+
+## TFDebertaModel
+
+[[autodoc]] TFDebertaModel
+ - call
+
+## TFDebertaPreTrainedModel
+
+[[autodoc]] TFDebertaPreTrainedModel
+ - call
+
+## TFDebertaForMaskedLM
+
+[[autodoc]] TFDebertaForMaskedLM
+ - call
+
+## TFDebertaForSequenceClassification
+
+[[autodoc]] TFDebertaForSequenceClassification
+ - call
+
+## TFDebertaForTokenClassification
+
+[[autodoc]] TFDebertaForTokenClassification
+ - call
+
+## TFDebertaForQuestionAnswering
+
+[[autodoc]] TFDebertaForQuestionAnswering
+ - call
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/decision_transformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/decision_transformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..9c7f27bbeeec2d1718838fb314a166960fa41ab1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/decision_transformer.md
@@ -0,0 +1,53 @@
+
+
+# Decision Transformer
+
+## Overview
+
+Decision Transformer ใขใใซใฏใ[Decision Transformer: Reinforcement Learning via Sequence Modeling](https://arxiv.org/abs/2106.01345) ใงๆๆกใใใพใใใ
+Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, Igor Mordatch.
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๅผทๅๅญฆ็ฟ๏ผRL๏ผใใทใผใฑใณในใขใใชใณใฐๅ้กใจใใฆๆฝ่ฑกๅใใใใฌใผใ ใฏใผใฏใ็ดนไปใใพใใ
+ใใใซใใใTransformer ใขใผใญใใฏใใฃใฎใทใณใใซใใจในใฑใผใฉใใชใใฃใใใใณ้ข้ฃใใ้ฒๆญฉใๆดป็จใงใใใใใซใชใใพใใ
+ GPT-x ใ BERT ใชใฉใฎ่จ่ชใขใใชใณใฐใงใ็นใซใDecision Transformer ใจใใใขใผใญใใฏใใฃใ็ดนไปใใพใใ
+ RL ใฎๅ้กใๆกไปถไปใใทใผใฑใณใน ใขใใชใณใฐใจใใฆๆใใใใพใใๅค้ขๆฐใซ้ฉๅใใไปฅๅใฎ RL ใขใใญใผใใจใฏ็ฐใชใใ
+ ใใชใทใผๅพ้
ใ่จ็ฎใใใจใDecision Transformer ใฏๅ ๆ็ใซใในใฏใใใใขใซใดใชใบใ ใๅฉ็จใใฆๆ้ฉใชใขใฏใทใงใณใๅบๅใใใ ใใงใใ
+ ๅคๆๅจใๆใพใใใชใฟใผใณ (ๅ ฑ้
ฌ)ใ้ๅปใฎ็ถๆ
ใใขใฏใทใงใณใซๅบใฅใใฆ่ชๅทฑๅๅธฐใขใใซใๆกไปถไปใใใใใจใซใใใ
+ Decision Transformer ใขใใซใฏใๆใพใใใชใฟใผใณใ้ๆใใๅฐๆฅใฎใขใฏใทใงใณใ็ๆใงใใพใใใใฎใทใณใใซใใซใ้ขใใใใ
+ Decision Transformer ใฏใๆๅ
็ซฏใฎใขใใซใใชใผใฎใชใใฉใคใณ RL ใใผในใฉใคใณใฎใใใฉใผใใณในใจๅ็ญใใพใใฏใใใ่ถ
ใใฆใใพใใ
+ AtariใOpenAI GymใKey-to-Door ใฟในใฏ*
+
+ใใฎใใผใธใงใณใฎใขใใซใฏใ็ถๆ
ใใใฏใใซใงใใใฟในใฏ็จใงใใ
+
+ใใฎใขใใซใฏใ[edbeeching](https://huggingface.co/edbeeching) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/kzl/decion-transformer) ใซใใใพใใ
+
+## DecisionTransformerConfig
+
+[[autodoc]] DecisionTransformerConfig
+
+
+## DecisionTransformerGPT2Model
+
+[[autodoc]] DecisionTransformerGPT2Model
+ - forward
+
+## DecisionTransformerModel
+
+[[autodoc]] DecisionTransformerModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deformable_detr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deformable_detr.md
new file mode 100644
index 0000000000000000000000000000000000000000..ccb6ec42f869b64faa4cff10e102531fc622ca69
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deformable_detr.md
@@ -0,0 +1,75 @@
+
+
+# Deformable DETR
+
+## Overview
+
+ๅคๅฝขๅฏ่ฝ DETR ใขใใซใฏใXizhou ZhuใWeijie SuใLewei LuใBin LiใXiaogang Wang, Jifeng Dai ใซใใฃใฆ [Deformable DETR: Deformable Transformers for End-to-End Object Detection](https://arxiv.org/abs/2010.04159) ใงๆๆกใใใพใใ
+ๅคๅฝขๅฏ่ฝใช DETR ใฏใๅ็
งๅจๅฒใฎๅฐๆฐใฎไธป่ฆใชใตใณใใชใณใฐ ใใคใณใใฎใฟใซๆณจ็ฎใใๆฐใใๅคๅฝขๅฏ่ฝใชใขใใณใทใงใณ ใขใธใฅใผใซใๅฉ็จใใใใจใซใใใๅๆใฎ้
ใใฎๅ้กใจๅ
ใฎ [DETR](detr) ใฎๅถ้ใใใ็นๅพดใฎ็ฉบ้่งฃๅๅบฆใ่ปฝๆธใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*DETR ใฏใๅชใใใใใฉใผใใณในใๅฎ่จผใใชใใใ็ฉไฝๆคๅบใซใใใๅคใใฎๆไฝๆฅญใง่จญ่จใใใใณใณใใผใใณใใฎๅฟ
่ฆๆงใๆ้คใใใใใซๆ่ฟๆๆกใใใพใใใใใ ใใ็ปๅ็นๅพดใใใใฎๅฆ็ใซใใใ Transformer ใขใใณใทใงใณ ใขใธใฅใผใซใฎๅถ้ใซใใใๅๆใ้
ใใ็นๅพดใฎ็ฉบ้่งฃๅๅบฆใๅถ้ใใใใจใใๅ้กใใใใพใใใใใใฎๅ้กใ่ปฝๆธใใใใใซใ็งใใกใฏ Deformable DETR ใๆๆกใใพใใใใใฎ DETR ใฎใขใใณใทใงใณ ใขใธใฅใผใซใฏใๅ็
งๅจๅฒใฎๅฐๆฐใฎไธป่ฆใชใตใณใใชใณใฐ ใใคใณใใฎใฟใซๆณจ็ฎใใพใใๅคๅฝขๅฏ่ฝใช DETR ใฏใ10 ๅใฎ 1 ใฎใใฌใผใใณใฐ ใจใใใฏใงใDETR ใใใๅชใใใใใฉใผใใณใน (็นใซๅฐใใชใชใใธใงใฏใใฎๅ ดๅ) ใ้ๆใงใใพใใ COCO ใใณใใใผใฏใซ้ขใใๅบ็ฏใชๅฎ้จใซใใใ็งใใกใฎใขใใญใผใใฎๆๅนๆงใๅฎ่จผใใใพใใใ*
+
+
+
+ ๅคๅฝขๅฏ่ฝใช DETR ใขใผใญใใฏใใฃใ ๅ
ใฎ่ซๆ ใใๆ็ฒใ
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใ](https://github.com/fundamentalvision/Deformable-DETR) ใซใใใพใใ
+
+## Usage tips
+
+
+ - ใใฌใผใใณใฐ Deformable DETR ใฏใๅ
ใฎ [DETR](detr) ใขใใซใใใฌใผใใณใฐใใใใจใจๅ็ญใงใใใใข ใใผใใใใฏใซใคใใฆใฏใไปฅไธใฎ [resources](#resources) ใปใฏใทใงใณใๅ็
งใใฆใใ ใใใ
+
+## Resources
+
+Deformable DETR ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`DeformableDetrForObjectDetection`] ใฎใซในใฟใ ใใผใฟใปใใใงใฎๆจ่ซใจๅพฎ่ชฟๆดใซ้ขใใใใข ใใผใใใใฏใฏใ[ใใกใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/Deformable-DETR) ใซใใใพใใ
+- [็ฉไฝๆคๅบใฟในใฏใฌใคใ](../tasks/object_detection) ใๅ็
งใใฆใใ ใใใ
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## DeformableDetrImageProcessor
+
+[[autodoc]] DeformableDetrImageProcessor
+ - preprocess
+ - post_process_object_detection
+
+## DeformableDetrFeatureExtractor
+
+[[autodoc]] DeformableDetrFeatureExtractor
+ - __call__
+ - post_process_object_detection
+
+## DeformableDetrConfig
+
+[[autodoc]] DeformableDetrConfig
+
+## DeformableDetrModel
+
+[[autodoc]] DeformableDetrModel
+ - forward
+
+## DeformableDetrForObjectDetection
+
+[[autodoc]] DeformableDetrForObjectDetection
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deit.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deit.md
new file mode 100644
index 0000000000000000000000000000000000000000..aa8c66c90be0b8dd8d66cce0288fb64c129188c4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deit.md
@@ -0,0 +1,148 @@
+
+
+# DeiT
+
+## Overview
+
+DeiT ใขใใซใฏใHugo TouvronใMatthieu CordใMatthijs DouzeใFrancisco MassaใAlexandre
+Sablayrolles, Hervรฉ Jรฉgou.ใซใใฃใฆ [Training data-efficient image Transformers & distillation through attention](https://arxiv.org/abs/2012.12877) ใงๆๆกใใใพใใใ
+ใตใใฌใคใญใผใซใใจใซใดใงใปใธใงใฐใผใ [Dosovitskiy et al., 2020](https://arxiv.org/abs/2010.11929) ใง็ดนไปใใใ [Vision Transformer (ViT)](vit) ใฏใๆขๅญใฎ็ณใฟ่พผใฟใใฅใผใฉใซใจๅ็ญใใพใใฏใใใไธๅใใใใฉใผใใณในใ็บๆฎใงใใใใจใ็คบใใพใใใ
+Transformer ใจใณใณใผใ (BERT ใฎใใใช) ใไฝฟ็จใใใใใใฏใผใฏใใใ ใใใใฎ่ซๆใง็ดนไปใใใ ViT ใขใใซใซใฏใๆฌกใฎใใฌใผใใณใฐใๅฟ
่ฆใงใใใ
+ๅค้จใใผใฟใไฝฟ็จใใฆใๆฐ้ฑ้ใซใใใ้ซไพกใชใคใณใใฉในใใฉใฏใใฃใ DeiT (ใใผใฟๅน็ใฎ้ซใ็ปๅๅคๆๅจ) ใฏใใใซๅชใใฆใใพใ
+็ปๅๅ้ก็จใซๅน็็ใซใใฌใผใใณใฐใใใใใฉใณในใใฉใผใใผใซใใใๅฟ
่ฆใชใใผใฟใจใณใณใใฅใผใใฃใณใฐ ใชใฝใผในใใฏใใใซๅฐใชใใชใใพใใ
+ใชใชใธใใซใฎ ViT ใขใใซใจใฎๆฏ่ผใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ๆ่ฟใ็ด็ฒใซๆณจๆใซๅบใฅใใใฅใผใฉใซ ใใใใฏใผใฏใใ็ปๅใชใฉใฎ็ปๅ็่งฃใฟในใฏใซๅฏพๅฆใงใใใใจใ็คบใใใพใใใ
+ๅ้กใใใ ใใใใใใฎใใธใฅใขใซ ใใฉใณในใใฉใผใใผใฏใ
+ใคใณใใฉในใใฉใฏใใฃใ้ซไพกใงใใใใใใใฎๆก็จใๅถ้ใใใฆใใพใใใใฎไฝๆฅญใงใฏใใณใณใใชใฅใผใทใงใณใใชใผใฎ็ซถไบๅใฎใใใฒใผใ ใไฝๆใใพใใ
+Imagenet ใฎใฟใงใใฌใผใใณใฐใใฆใใฉใณในใใฉใผใใผใไฝๆใใพใใ 1 ๅฐใฎใณใณใใฅใผใฟใผใง 3 ๆฅไปฅๅ
ใซใใฌใผใใณใฐใ่กใใพใใ็งใใกใฎๅบๆบใจใชใใใธใงใณ
+ใใฉใณใน (86M ใใฉใกใผใฟ) ใฏใๅค้จใชใใง ImageNet ไธใง 83.1% (ๅไธใฏใญใใ่ฉไพก) ใฎใใใ 1 ใฎ็ฒพๅบฆใ้ๆใใพใใ
+ใใผใฟใใใใซ้่ฆใชใฎใฏใใใฉใณในใใฉใผใใผใซ็นๆใฎๆๅธซใจ็ๅพใฎๆฆ็ฅใๅฐๅ
ฅใใใใจใงใใ่ธ็ใซไพๅญใใฆใใ
+ๅญฆ็ใๆณจๆใๆใฃใฆๆๅธซใใๅญฆใถใใจใไฟ่จผใใใใผใฏใณใ็งใใกใฏใใฎใใผใฏใณใใผในใซ่ๅณใ็คบใใพใ
+็นใซ convnet ใๆๅธซใจใใฆไฝฟ็จใใๅ ดๅใใใใซใใใconvnet ใจ็ซถๅใใ็ตๆใๅ ฑๅใงใใใใใซใชใใพใใ
+Imagenet (ๆๅคง 85.2% ใฎ็ฒพๅบฆใๅพใใใพใ) ใจไปใฎใฟในใฏใซ่ปข้ใใใจใใฎไธกๆนใงใ็งใใกใฏใณใผใใๅ
ฑๆใใ
+ใขใใซใ*
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใใใฎใขใใซใฎ TensorFlow ใใผใธใงใณใฏใ[amyeroberts](https://huggingface.co/amyeroberts) ใซใใฃใฆ่ฟฝๅ ใใใพใใใ
+
+## Usage tips
+
+- ViT ใจๆฏ่ผใใฆใDeiT ใขใใซใฏใใใใ่ธ็ใใผใฏใณใไฝฟ็จใใฆๆๅธซใใๅนๆ็ใซๅญฆ็ฟใใพใ (ใใใฏใ
+ DeiT ่ซๆใฏใResNet ใฎใใใชใขใใซใงใ)ใ่ธ็ใใผใฏใณใฏใใใใฏใใญใใฒใผใทใงใณใ้ใใฆใใจๅฏพ่ฉฑใใใใจใซใใฃใฆๅญฆ็ฟใใใพใใ
+ ใปใซใใขใใณใทใงใณๅฑคใไปใใใฏใฉใน ([CLS]) ใจใใใ ใใผใฏใณใ
+- ๆฝๅบใใใใขใใซใๅพฎ่ชฟๆดใใใซใฏ 2 ใคใฎๆนๆณใใใใพใใ(1) ไธ้จใซไบๆธฌใใใใ้
็ฝฎใใใ ใใฎๅคๅ
ธ็ใชๆนๆณใ
+ ใฏใฉใน ใใผใฏใณใฎๆ็ต็ใช้่กจ็คบ็ถๆ
ใๆฝๅบใใ่ธ็ใทใฐใใซใไฝฟ็จใใชใใใพใใฏ (2) ไธกๆนใฎ
+ ไบๆธฌใใใใฏใฏใฉใน ใใผใฏใณใฎไธใจ่ธ็ใใผใฏใณใฎไธใซใใใพใใใใฎๅ ดๅใ[CLS] ไบๆธฌใฏ
+ head ใฏใhead ใฎไบๆธฌใจใฐใฉใฆใณใ ใใฅใซใผใน ใฉใใซ้ใฎ้ๅธธใฎใฏใญในใจใณใใญใใผใไฝฟ็จใใฆใใฌใผใใณใฐใใใพใใ
+ ่ธ็ไบๆธฌใใใใฏใ็กฌ่ธ็ (ไบๆธฌใจไบๆธฌใฎ้ใฎใฏใญในใจใณใใญใใผ) ใไฝฟ็จใใฆใใฌใผใใณใฐใใใพใใ
+ ่ธ็ใใใใจๆๅธซใไบๆธฌใใใฉใใซ๏ผใๆจ่ซๆใซใๅนณๅไบๆธฌใๅๅพใใพใใ
+ ๆ็ต็ใชไบๆธฌใจใใฆไธก้ ญใฎ้ใงใ (2) ใฏใ่ธ็ใซใใๅพฎ่ชฟๆดใใจใๅผใฐใใพใใ
+ ไธๆตใฎใใผใฟใปใใใงใใงใซๅพฎ่ชฟๆดใใใฆใใๆๅธซใใขใใซ็ใซใฏ (1) ใซ็ธๅฝใใพใใ
+ [`DeiTForImageClassification`] ใจ (2) ใซๅฏพๅฟใใพใใ
+ [`DeiTForImageClassificationWithTeacher`]ใ
+- ่่
ใใฏ (2) ใซใคใใฆใใฝใใ่ธ็ใ่ฉฆใฟใใใจใซๆณจๆใใฆใใ ใใ (ใใฎๅ ดๅใ่ธ็ไบๆธฌใใใใฏ
+ ๆๅธซใฎใฝใใใใใฏในๅบๅใซไธ่ดใใใใใซ KL ใใคใใผใธใงใณในใไฝฟ็จใใฆใใฌใผใใณใฐใใพใใ๏ผใใใใผใ่ธ็ใๆ่ฏใฎ็ตๆใใใใใใพใใใ
+- ใชใชใผในใใใใในใฆใฎใใงใใฏใใคใณใใฏใImageNet-1k ใฎใฟใงไบๅใใฌใผใใณใฐใใใณๅพฎ่ชฟๆดใใใพใใใๅค้จใใผใฟใฏไฝฟ็จใใใพใใใงใใใใใใฏ
+ JFT-300M ใใผใฟใปใใ/Imagenet-21k ใชใฉใฎๅค้จใใผใฟใไฝฟ็จใใๅ
ใฎ ViT ใขใใซใจใฏๅฏพ็
ง็ใงใใ
+ ไบๅใใฌใผใใณใฐใ
+- DeiT ใฎไฝ่
ใฏใใใๅน็็ใซใใฌใผใใณใฐใใใ ViT ใขใใซใใชใชใผในใใพใใใใใใฏใ็ดๆฅใใฉใฐใคใณใงใใพใใ
+ [`ViTModel`] ใพใใฏ [`ViTForImageClassification`]ใใใผใฟใชใฉใฎใใฏใใใฏ
+ ใฏใใใซๅคง่ฆๆจกใชใใผใฟใปใใใงใฎใใฌใผใใณใฐใใทใใฅใฌใผใใใใใใซใๆกๅผตใๆ้ฉๅใๆญฃๅๅใไฝฟ็จใใใพใใใ
+ (ใใ ใใไบๅใใฌใผใใณใฐใซใฏ ImageNet-1k ใฎใฟใไฝฟ็จใใพใ)ใ 4 ใคใฎใใชใจใผใทใงใณ (3 ใคใฎ็ฐใชใใตใคใบ) ใๅฉ็จๅฏ่ฝใงใใ
+ *facebook/deit-tiny-patch16-224*ใ*facebook/deit-small-patch16-224*ใ*facebook/deit-base-patch16-224* ใใใณ
+ *facebook/deit-base-patch16-384*ใไปฅไธใ่กใใซใฏ [`DeiTImageProcessor`] ใไฝฟ็จใใๅฟ
่ฆใใใใใจใซๆณจๆใใฆใใ ใใใ
+ ใขใใซ็จใฎ็ปๅใๆบๅใใพใใ
+
+## Resources
+
+DeiT ใๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- [`DeiTForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+- ๅ็
ง: [็ปๅๅ้กใฟในใฏ ใฌใคใ](../tasks/image_classification)
+
+ใใใซๅ ใใฆ:
+
+- [`DeiTForMaskedImageModeling`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-pretraining) ใงใตใใผใใใใฆใใพใใ
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## DeiTConfig
+
+[[autodoc]] DeiTConfig
+
+## DeiTFeatureExtractor
+
+[[autodoc]] DeiTFeatureExtractor
+ - __call__
+
+## DeiTImageProcessor
+
+[[autodoc]] DeiTImageProcessor
+ - preprocess
+
+
+
+
+## DeiTModel
+
+[[autodoc]] DeiTModel
+ - forward
+
+## DeiTForMaskedImageModeling
+
+[[autodoc]] DeiTForMaskedImageModeling
+ - forward
+
+## DeiTForImageClassification
+
+[[autodoc]] DeiTForImageClassification
+ - forward
+
+## DeiTForImageClassificationWithTeacher
+
+[[autodoc]] DeiTForImageClassificationWithTeacher
+ - forward
+
+
+
+
+## TFDeiTModel
+
+[[autodoc]] TFDeiTModel
+ - call
+
+## TFDeiTForMaskedImageModeling
+
+[[autodoc]] TFDeiTForMaskedImageModeling
+ - call
+
+## TFDeiTForImageClassification
+
+[[autodoc]] TFDeiTForImageClassification
+ - call
+
+## TFDeiTForImageClassificationWithTeacher
+
+[[autodoc]] TFDeiTForImageClassificationWithTeacher
+ - call
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deplot.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deplot.md
new file mode 100644
index 0000000000000000000000000000000000000000..26871d1e7dde664126c4d857a9c29bf4f521a75a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deplot.md
@@ -0,0 +1,65 @@
+
+
+# DePlot
+
+## Overview
+
+DePlot ใฏใFangyu LiuใJulian Martin AisenschlosใFrancesco PiccinnoใSyrine KricheneใChenxi Pang, Kenton Lee, Mandar Joshi, Wenhu Chen, Nigel Collier, Yasemin Altun. ใฎ่ซๆ [DePlot: One-shot visual language reasoning by plot-to-table translation](https://arxiv.org/abs/2212.10505) ใงๆๆกใใใพใใใใใณใป
+
+่ซๆใฎ่ฆ็ดใซใฏๆฌกใฎใใใซ่จ่ผใใใฆใใพใใ
+
+*ใใฃใผใใใใญใใใชใฉใฎ่ฆ่ฆ่จ่ชใฏไบบ้ใฎไธ็ใซ้ๅจใใฆใใพใใใใญใใใใใฃใผใใ็่งฃใใใซใฏใๅผทๅใชๆจ่ซในใญใซใๅฟ
่ฆใงใใๅพๆฅใฎๆๅ
็ซฏ (SOTA) ใขใใซใซใฏๅฐใชใใจใๆฐไธใฎใใฌใผใใณใฐ ใตใณใใซใๅฟ
่ฆใงใใใใใฎๆจ่ซ่ฝๅใฏใ็นใซไบบ้ใไฝๆใใ่ค้ใชใฏใจใชใงใฏไพ็ถใจใใฆๅคงๅน
ใซๅถ้ใใใฆใใพใใใใฎ่ซๆใงใฏใ่ฆ่ฆ่จ่ชๆจ่ซใซๅฏพใใๆๅใฎใฏใณใทใงใใ ใฝใชใฅใผใทใงใณใ็ดนไปใใพใใ็งใใกใฏใ่ฆ่ฆ่จ่ชๆจ่ซใฎ่ชฒ้กใ 2 ใคใฎในใใใใซๅ่งฃใใพใใ(1) ใใญใใใใใใญในใใธใฎ็ฟป่จณใจใ(2) ็ฟป่จณใใใใใญในใใซๅฏพใใๆจ่ซใงใใใใฎๆนๆณใฎ้ตใจใชใใฎใฏใใใญใใใพใใฏใใฃใผใใฎ็ปๅใ็ทๅฝขๅใใใใใผใใซใซๅคๆใใใDePlot ใจใใๅๅใฎใขใใชใใฃๅคๆใขใธใฅใผใซใงใใใใฎๅพใDePlot ใฎๅบๅใ็ดๆฅไฝฟ็จใใฆใไบๅใใฌใผใใณใฐๆธใฟใฎๅคง่ฆๆจก่จ่ชใขใใซ (LLM) ใใใญใณใใใใLLM ใฎๅฐๆฐใทใงใใๆจ่ซๆฉ่ฝใๅฉ็จใงใใพใใ DePlot ใๅๅพใใใซใฏใ็ตฑไธใใใใฟในใฏๅฝขๅผใจใกใใชใฏในใ็ขบ็ซใใใใจใงใใญใใใใใใผใใซใธใฎใฟในใฏใๆจๆบๅใใใใฎใฟในใฏใง DePlot ใใจใณใใใผใจใณใใงใใฌใผใใณใฐใใพใใ DePlot ใฏใใใฉใฐใขใณใใใฌใคๆนๅผใง LLM ใจใจใใซๆข่ฃฝใงไฝฟ็จใงใใพใใ 28,000 ใ่ถ
ใใใใผใฟ ใใคใณใใงๅพฎ่ชฟๆดใใใ SOTA ใขใใซใจๆฏ่ผใใฆใใฏใณใทใงใใ ใใญใณใใใฎใฟใไฝฟ็จใใ DePlot+LLM ใฏใใใฃใผใ QA ใฟในใฏใใใฎไบบใไฝๆใใใฏใจใชใซ้ขใใฆใๅพฎ่ชฟๆดใใใ SOTA ใใ 24.0% ใฎๆนๅใ้ๆใใพใใใ*
+
+DePlot ใฏใ`Pix2Struct` ใขใผใญใใฏใใฃใไฝฟ็จใใฆใใฌใผใใณใฐใใใใขใใซใงใใ `Pix2Struct` ใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Pix2Struct ใใญใฅใกใณใ](https://huggingface.co/docs/transformers/main/en/model_doc/pix2struct) ใๅ็
งใใฆใใ ใใใ
+DePlot ใฏใ`Pix2Struct` ใขใผใญใใฏใใฃใฎ Visual Question Answering ใตใใปใใใงใใๅ
ฅๅใใใ่ณชๅใ็ปๅไธใซใฌใณใใชใณใฐใใ็ญใใไบๆธฌใใพใใ
+
+## Usage example
+
+็พๅจใDePlot ใงไฝฟ็จใงใใใใงใใฏใใคใณใใฏ 1 ใคใงใใ
+
+- `google/deplot`: ChartQA ใใผใฟใปใใใงๅพฎ่ชฟๆดใใใ DePlot
+
+```python
+from transformers import AutoProcessor, Pix2StructForConditionalGeneration
+import requests
+from PIL import Image
+
+model = Pix2StructForConditionalGeneration.from_pretrained("google/deplot")
+processor = AutoProcessor.from_pretrained("google/deplot")
+url = "https://raw.githubusercontent.com/vis-nlp/ChartQA/main/ChartQA%20Dataset/val/png/5090.png"
+image = Image.open(requests.get(url, stream=True).raw)
+
+inputs = processor(images=image, text="Generate underlying data table of the figure below:", return_tensors="pt")
+predictions = model.generate(**inputs, max_new_tokens=512)
+print(processor.decode(predictions[0], skip_special_tokens=True))
+```
+
+## Fine-tuning
+
+DePlot ใๅพฎ่ชฟๆดใใใซใฏใpix2struct [ๅพฎ่ชฟๆดใใผใใใใฏ](https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_pix2struct.ipynb) ใๅ็
งใใฆใใ ใใใ `Pix2Struct` ใขใใซใฎๅ ดๅใAdafactor ใจใณใตใคใณๅญฆ็ฟ็ในใฑใธใฅใผใฉใไฝฟ็จใใฆใขใใซใๅพฎ่ชฟๆดใใใจใๅๆใ้ซ้ๅใใใใใจใใใใใพใใใ
+```python
+from transformers.optimization import Adafactor, get_cosine_schedule_with_warmup
+
+optimizer = Adafactor(self.parameters(), scale_parameter=False, relative_step=False, lr=0.01, weight_decay=1e-05)
+scheduler = get_cosine_schedule_with_warmup(optimizer, num_warmup_steps=1000, num_training_steps=40000)
+```
+
+
+
+DePlot ใฏใ`Pix2Struct`ใขใผใญใใฏใใฃใไฝฟ็จใใฆใใฌใผใใณใฐใใใใขใใซใงใใ API ใชใใกใฌใณในใซใคใใฆใฏใ[`Pix2Struct` ใใญใฅใกใณใ](pix2struct) ใๅ็
งใใฆใใ ใใใ
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deta.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deta.md
new file mode 100644
index 0000000000000000000000000000000000000000..615f8396577fdb784c692972352736dcd5ef725f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/deta.md
@@ -0,0 +1,64 @@
+
+
+# DETA
+
+## Overview
+
+DETA ใขใใซใฏใ[NMS Strikes Back](https://arxiv.org/abs/2212.06137) ใง Jeffrey Ouyang-ZhangใJang Hyun ChoใXingyi ZhouใPhilipp Krรคhenbรผhl ใซใใฃใฆๆๆกใใใพใใใ
+DETA (Detection Transformers with Assignment ใฎ็ฅ) ใฏใ1 ๅฏพ 1 ใฎ 2 ้จใใณใฌใชใขใณ ใใใใณใฐๆๅคฑใ็ฝฎใๆใใใใจใซใใใ[Deformable DETR](deformable_detr) ใๆนๅใใพใใ
+้ๆๅคงๆๅถ (NMS) ใๅใใๅพๆฅใฎๆคๅบๅจใงไฝฟ็จใใใ 1 ๅฏพๅคใฎใฉใใซๅฒใๅฝใฆใไฝฟ็จใใพใใใใใซใใใๆๅคง 2.5 mAP ใฎๅคงๅน
ใชๅขๅ ใๅพใใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*Detection Transformer (DETR) ใฏใใใฌใผใใณใฐไธญใซ 1 ๅฏพ 1 ใฎ 2 ้จใใใใณใฐใไฝฟ็จใใฆใฏใจใชใไธๆใฎใชใใธใงใฏใใซ็ดๆฅๅคๆใใใจใณใใใผใจใณใใฎใชใใธใงใฏใๆคๅบใๅฏ่ฝใซใใพใใๆ่ฟใใใใใฎใขใใซใฏใ็ดใใใชใๅช้
ใใง COCO ใฎๅพๆฅใฎๆคๅบๅจใไธๅใใพใใใใใ ใใใขใใซ ใขใผใญใใฏใใฃใใใฌใผใใณใฐ ในใฑใธใฅใผใซใชใฉใใใพใใพใช่จญ่จใซใใใฆๅพๆฅใฎๆคๅบๅจใจใฏ็ฐใชใใใใ1 ๅฏพ 1 ใใใใณใฐใฎๆๅนๆงใฏๅฎๅ
จใซใฏ็่งฃใใใฆใใพใใใใใฎ็ ็ฉถใงใฏใDETR ใงใฎ 1 ๅฏพ 1 ใฎใใณใฌใชใผ่ชใใใใณใฐใจใ้ๆๅคง็ฃ่ฆ (NMS) ใๅใใๅพๆฅใฎๆคๅบๅจใงใฎ 1 ๅฏพๅคใฎใฉใใซๅฒใๅฝใฆใจใฎ้ใฎๅณๅฏใชๆฏ่ผใ่กใใพใใ้ฉใในใใใจใซใNMS ใไฝฟ็จใใ 1 ๅฏพๅคใฎๅฒใๅฝใฆใฏใๅใ่จญๅฎใฎไธใงๆจๆบ็ใช 1 ๅฏพ 1 ใฎใใใใณใฐใใใไธ่ฒซใใฆๅชใใฆใใใๆๅคง 2.5 mAP ใจใใๅคงๅน
ใชๅไธใ่ฆใใใพใใๅพๆฅใฎ IoU ใใผในใฎใฉใใซๅฒใๅฝใฆใไฝฟ็จใใฆ Deformable-DETR ใใใฌใผใใณใฐใใๅฝ็คพใฎๆคๅบๅจใฏใResNet50 ใใใฏใใผใณใไฝฟ็จใใฆ 12 ใจใใใฏ (1x ในใฑใธใฅใผใซ) ไปฅๅ
ใซ 50.2 COCO mAP ใ้ๆใใใใฎ่จญๅฎใงๆขๅญใฎใในใฆใฎๅพๆฅใฎๆคๅบๅจใพใใฏใใฉใณในใใผในใฎๆคๅบๅจใไธๅใใพใใใ่คๆฐใฎใใผใฟใปใใใในใฑใธใฅใผใซใใขใผใญใใฏใใฃใซ้ขใใฆใ็งใใกใฏไธ่ฒซใใฆใใใใฉใผใใณในใฎ้ซใๆคๅบใใฉใณในใใฉใผใใผใซใฏไบ้จใใใใณใฐใไธ่ฆใงใใใใจใ็คบใใฆใใพใใใใใซใๆคๅบใใฉใณในใฎๆๅใฏใ่กจ็พๅ่ฑใใชใใฉใณใน ใขใผใญใใฏใใฃใซใใใใฎใงใใใจ่ใใฆใใพใใ*
+
+
+
+ DETA ใฎๆฆ่ฆใ ๅ
ใฎ่ซๆ ใใๆ็ฒใ
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/jozhang97/DETA) ใซใใใพใใ
+
+## Resources
+
+DETA ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+- DETA ใฎใใข ใใผใใใใฏใฏ [ใใกใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/DETA) ใซใใใพใใ
+- ๅ็
ง: [ใชใใธใงใฏใๆคๅบใฟในใฏ ใฌใคใ](../tasks/object_detection)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## DetaConfig
+
+[[autodoc]] DetaConfig
+
+## DetaImageProcessor
+
+[[autodoc]] DetaImageProcessor
+ - preprocess
+ - post_process_object_detection
+
+## DetaModel
+
+[[autodoc]] DetaModel
+ - forward
+
+## DetaForObjectDetection
+
+[[autodoc]] DetaForObjectDetection
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/detr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/detr.md
new file mode 100644
index 0000000000000000000000000000000000000000..3342b123a01b833795847c8b46c723ddb53f45f4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/detr.md
@@ -0,0 +1,226 @@
+
+
+# DETR
+
+## Overview
+
+DETR ใขใใซใฏใ[Transformers ใไฝฟ็จใใใจใณใใใผใจใณใใฎใชใใธใงใฏใๆคๅบ](https://arxiv.org/abs/2005.12872) ใงๆๆกใใใพใใใ
+Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov and Sergey Zagoruyko ใซใคใณใ DETR
+็ณใฟ่พผใฟใใใฏใใผใณใจใใใฎๅพใซใจใณใใใผใจใณใใงใใฌใผใใณใฐใงใใใจใณใณใผใใผ/ใใณใผใใผ Transformer ใงๆงๆใใใพใใ
+็ฉไฝใฎๆคๅบใ Faster-R-CNN ใ Mask-R-CNN ใชใฉใฎใขใใซใฎ่ค้ใใฎๅคใใๅคงๅน
ใซ็ฐก็ด ๅใใใพใใ
+้ ๅๆๆกใ้ๆๅคงๆๅถๆ้ ใใขใณใซใผ็ๆใชใฉใงใใใใใซใDETR ใฏๆฌกใฎใใใซใใใใจใใงใใพใใ
+ใใณใผใๅบๅใฎไธใซใในใฏ ใใใใ่ฟฝๅ ใใใ ใใงใใใใใใฃใใฏ ใปใฐใกใณใใผใทใงใณใๅฎ่กใงใใใใใซ่ช็ถใซๆกๅผตใใใฆใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*็ฉไฝๆคๅบใ็ดๆฅ้ๅไบๆธฌๅ้กใจใใฆ่ฆใๆฐใใๆนๆณใ็ดนไปใใพใใ็งใใกใฎใขใใญใผใใฏใ
+ๆคๅบใใคใใฉใคใณใซใใใ้ๆๅคงๆๅถใชใฉใฎๅคใใฎๆไฝๆฅญใง่จญ่จใใใใณใณใใผใใณใใฎๅฟ
่ฆๆงใๅนๆ็ใซๆ้คใใใพใใ
+ใฟในใฏใซ้ขใใไบๅใฎ็ฅ่ญใๆ็คบ็ใซใจใณใณใผใใใใใญใทใผใธใฃใพใใฏใขใณใซใผใฎ็ๆใใฎไธปใชๆๅใฏใ
+DEtection TRansformer ใพใใฏ DETR ใจๅผใฐใใๆฐใใใใฌใผใ ใฏใผใฏใฏใใปใใใใผในใฎใฐใญใผใใซๆๅคฑใงใใใ
+ไบ้จใใใใณใฐใใใใณใใฉใณในใใฉใผใใผ ใจใณใณใผใใผ/ใใณใผใใผ ใขใผใญใใฏใใฃใๅญฆ็ฟใใใใชใใธใงใฏใ ใฏใจใชใฎๅบๅฎใใใๅฐใใชใปใใใไธใใใใใจใ
+DETR ใฏใใชใใธใงใฏใใจใฐใญใผใใซ ใคใกใผใธ ใณใณใใญในใใฎ้ขไฟใซใคใใฆๆจ่ซใใๆ็ตใปใใใ็ดๆฅๅบๅใใพใใ
+ไธฆ่กใใฆไบๆณใใๆฐใใใขใใซใฏๆฆๅฟต็ใซใทใณใใซใงใใใๅคใใฎใขใใซใจใฏ็ฐใชใใ็นๆฎใชใฉใคใใฉใชใๅฟ
่ฆใจใใพใใใ
+ไปใฎๆๆฐใฎๆคๅบๅจใ DETR ใฏใ็ขบ็ซใใใใใใใณๅ็ญใฎ็ฒพๅบฆใจๅฎ่กๆใฎใใใฉใผใใณในใๅฎ่จผใใพใใ
+ๅฐ้ฃใช COCO ็ฉไฝๆคๅบใใผใฟใปใใใซๅบใฅใใ้ซๅบฆใซๆ้ฉๅใใใ Faster RCNN ใใผในใฉใคใณใใใใซใDETR ใฏ็ฐกๅใซๅฎ่กใงใใพใใ
+็ตฑไธใใใๆนๆณใงใใใใใฃใใฏ ใปใฐใกใณใใผใทใงใณใ็ๆใใใใใซไธ่ฌๅใใใพใใใ็ซถๅไป็คพใๅคงๅน
ใซไธๅใใใใฉใผใใณในใ็คบใใฆใใพใ
+ใใผในใฉใคใณ*
+
+ใใฎใขใใซใฏใ[nielsr](https://huggingface.co/nielsr) ใซใใฃใฆๆไพใใใพใใใๅ
ใฎใณใผใใฏ [ใใกใ](https://github.com/facebookresearch/detr) ใซใใใพใใ
+
+## How DETR works
+
+[`~transformers.DetrForObjectDetection`] ใใฉใฎใใใซๆฉ่ฝใใใใ่ชฌๆใใ TLDR ใฏๆฌกใฎใจใใใงใใ
+
+ใพใใไบๅใซใใฌใผใใณใฐใใใ็ณใฟ่พผใฟใใใฏใใผใณใ้ใใฆ็ปๅใ้ไฟกใใใพใ (่ซๆใงใฏใ่่
ใใฏๆฌกใฎใใใซไฝฟ็จใใฆใใพใ)ใ
+ResNet-50/ResNet-101)ใใใใ ใใฃใกใณใทใงใณใ่ฟฝๅ ใใใจไปฎๅฎใใพใใใใใฏใใใใฏใใผใณใธใฎๅ
ฅๅใ
+็ปๅใซ 3 ใคใฎใซใฉใผ ใใฃใใซ (RGB) ใใใใจไปฎๅฎใใๅ ดๅใฎใๅฝข็ถ `(batch_size, 3, height, width)` ใฎใใณใฝใซใ CNNใฎใใใฏใใผใณ
+้ๅธธใฏ `(batch_size, 2048, height/32, width/32)` ใฎๅฝข็ถใฎใๆฐใใไฝ่งฃๅๅบฆใฎ็นๅพดใใใใๅบๅใใพใใใใใฏ
+ๆฌกใซใDETR ใฎ Transformer ใฎ้ ใๆฌกๅ
(ใใใฉใซใใงใฏ `256`) ใซไธ่ดใใใใใซๆๅฝฑใใใพใใ
+`nn.Conv2D` ใฌใคใคใผใใใใงใๅฝข็ถ `(batch_size, 256, height/32, width/32)` ใฎใใณใฝใซใๅฎๆใใพใใใ
+็นๅพดใใใใฏๅนณๅฆๅใใใณ่ปข็ฝฎใใใๅฝข็ถ `(batch_size, seq_len, d_model)` ใฎใใณใฝใซใๅๅพใใพใ =
+`(batch_size, width/32*height/32, 256)`ใใใใใฃใฆใNLP ใขใใซใจใฎ้ใใฏใใทใผใฑใณในใฎ้ทใใๅฎ้ใซใฏ
+้ๅธธใใใ้ทใใชใใพใใใใd_modelใใฏๅฐใใใชใใพใ (NLP ใงใฏ้ๅธธ 768 ไปฅไธใงใ)ใ
+
+ๆฌกใซใใใใใจใณใณใผใใไปใใฆ้ไฟกใใใๅใๅฝข็ถใฎ `encoder_hidden_โโstates` ใๅบๅใใใพใ (ๆฌกใฎใใใซ่ใใใใจใใงใใพใ)ใ
+ใใใใฏ็ปๅใฎ็นๅพดใจใใฆ๏ผใๆฌกใซใใใใใ **ใชใใธใงใฏใ ใฏใจใช**ใใใณใผใใ้ใใฆ้ไฟกใใใพใใใใใฏๅฝข็ถใฎใใณใฝใซใงใ
+`(batch_size, num_queries, d_model)`ใ้ๅธธใ`num_queries` ใฏ 100 ใซ่จญๅฎใใใใผใญใงๅๆๅใใใพใใ
+ใใใใฎๅ
ฅๅๅใ่พผใฟใฏๅญฆ็ฟใใใไฝ็ฝฎใจใณใณใผใใฃใณใฐใงใใใไฝๆ่
ใฏใใใใชใใธใงใฏใ ใฏใจใชใจๅผใณใๅๆงใซ
+ใจใณใณใผใใงใฏใใใใใฏๅใขใใณใทใงใณๅฑคใฎๅ
ฅๅใซ่ฟฝๅ ใใใพใใๅใชใใธใงใฏใ ใฏใจใชใฏ็นๅฎใฎใชใใธใงใฏใใๆค็ดขใใพใใ
+็ปๅใงใฏใใใณใผใใฏใ่คๆฐใฎใปใซใ ใขใใณใทใงใณ ใฌใคใคใจใจใณใณใผใ ใใณใผใ ใขใใณใทใงใณ ใฌใคใคใ้ใใฆใใใใฎๅใ่พผใฟใๆดๆฐใใพใใ
+ๅใๅฝข็ถใฎ `decoder_hidden_โโstates` ใๅบๅใใพใ: `(batch_size, num_queries, d_model)`ใๆฌกใซ้ ญใ๏ผใค
+ใชใใธใงใฏใๆคๅบใฎใใใซไธ้จใซ่ฟฝๅ ใใใพใใๅใชใใธใงใฏใ ใฏใจใชใใชใใธใงใฏใใฎ 1 ใคใซๅ้กใใใใใฎ็ทๅฝขใฌใคใคใผใใพใใฏใใใใใ
+ใชใใธใงใฏใใใใใใณๅใฏใจใชใฎๅข็ใใใฏในใไบๆธฌใใ MLPใ
+
+ใขใใซใฏ **2 ้จใใใใณใฐๆๅคฑ**ใไฝฟ็จใใฆใใฌใผใใณใฐใใใพใใใคใพใใๅฎ้ใซ่กใใใจใฏใไบๆธฌใใใใฏใฉในใๆฏ่ผใใใใจใงใ +
+ใฐใฉใฆใณใ ใใฅใซใผใน ใขใใใผใทใงใณใซๅฏพใใ N = 100 ๅใฎๅใชใใธใงใฏใ ใฏใจใชใฎๅข็ใใใฏใน (ๅใ้ทใ N ใพใงใใใฃใณใฐ)
+(ใใใใฃใฆใ็ปๅใซใชใใธใงใฏใใ 4 ใคใใๅซใพใใฆใใชใๅ ดๅใ96 ๅใฎๆณจ้ใซใฏใฏใฉในใจใใฆใใชใใธใงใฏใใชใใใใใใณใฏใฉในใจใใฆใๅข็ใใใฏในใชใใใๅซใพใใใ ใใซใชใใพใใ
+ๅข็ใใใฏใน)ใ [Hungarian matching algorithm](https://en.wikipedia.org/wiki/Hungarian_algorithm) ใฏใๆค็ดขใซไฝฟ็จใใใพใใ
+N ๅใฎใฏใจใชใฎใใใใใใ N ๅใฎๆณจ้ใฎใใใใใธใฎๆ้ฉใช 1 ๅฏพ 1 ใฎใใใใณใฐใๆฌกใซใๆจๆบใฏใญในใจใณใใญใใผ (
+ใฏใฉใน)ใใใใณ L1 ใจ [generalized IoU loss](https://giou.stanford.edu/) ใฎ็ทๅฝข็ตๅ (
+ๅข็ใใใฏใน) ใฏใใขใใซใฎใใฉใกใผใฟใผใๆ้ฉๅใใใใใซไฝฟ็จใใใพใใ
+
+DETR ใฏใใใใใใฃใใฏ ใปใฐใกใณใใผใทใงใณ (ใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใจใคใณในใฟใณในใ็ตฑๅใใ) ใๅฎ่กใใใใใซ่ช็ถใซๆกๅผตใงใใพใใ
+ใปใฐใกใณใใผใทใงใณ๏ผใ [`~transformers.DetrForSegmentation`] ใฏใปใฐใกใณใใผใทใงใณ ใในใฏ ใใใใไธใซ่ฟฝๅ ใใพใ
+[`~transformers.DetrForObjectDetection`]ใใในใฏ ใใใใฏใๅ
ฑๅใงใใฌใผใใณใฐใใใใจใใ2 ๆฎต้ใฎใใญใปในใงใใฌใผใใณใฐใใใใจใใงใใพใใ
+ใใใงใๆๅใซ [`~transformers.DetrForObjectDetection`] ใขใใซใใใฌใผใใณใฐใใฆใไธกๆนใฎๅจๅฒใฎๅข็ใใใฏในใๆคๅบใใพใใ
+ใใใฎใ๏ผใคใณในใฟใณใน๏ผใจใใใฎใ๏ผๆจใ้่ทฏใ็ฉบใชใฉใฎ่ๆฏใฎใใฎ๏ผใใในใฆๅ็ตใใใในใฆใฎ้ใฟใใใชใผใบใใฆใฎใฟใใฌใผใใณใฐใใพใใ
+25 ใจใใใฏใฎใในใฏใใใใๅฎ้จ็ใซใฏใใใใ 2 ใคใฎใขใใญใผใใฏๅๆงใฎ็ตๆใใใใใใพใใใใใฏในใฎไบๆธฌใฏ
+ใใณใฌใชใผ่ชใฎใใใใณใฐใฏใใใฏใน้ใฎ่ท้ขใไฝฟ็จใใฆ่จ็ฎใใใใใใใใฌใผใใณใฐใๅฏ่ฝใซใใใใใซใฏใใใๅฟ
่ฆใงใใ
+
+## Usage tips
+
+- DETR ใฏใใใใใ **ใชใใธใงใฏใ ใฏใจใช** ใไฝฟ็จใใฆใ็ปๅๅ
ใฎใชใใธใงใฏใใๆคๅบใใพใใใฏใจใชใฎๆฐใซใใฃใฆๆๅคงๅคใๆฑบใพใใพใ
+ ๅไธใฎ็ปๅๅ
ใงๆคๅบใงใใใชใใธใงใฏใใฎๆฐใใใใฉใซใใงใฏ 100 ใซ่จญๅฎใใใพใ (ใใฉใกใผใฟใผใๅ็
ง)
+ [`~transformers.DetrConfig`] ใฎ `num_queries`)ใใใ็จๅบฆใฎไฝ่ฃใใใใฎใฏ่ฏใใใจใงใ (COCO ใงใฏใ
+ ่่
ใฏ 100 ใไฝฟ็จใใพใใใใCOCO ใคใกใผใธๅ
ใฎใชใใธใงใฏใใฎๆๅคงๆฐใฏ็ด 70 ใงใ)ใ
+- DETR ใฎใใณใผใใผใฏใใฏใจใชใฎๅใ่พผใฟใไธฆ่กใใฆๆดๆฐใใพใใใใใฏ GPT-2 ใฎใใใช่จ่ชใขใใซใจใฏ็ฐใชใใพใใ
+ ไธฆๅใงใฏใชใ่ชๅทฑๅๅธฐใใณใผใใไฝฟ็จใใพใใใใใใฃใฆใๅ ๆ็ๆณจๆใในใฏใฏไฝฟ็จใใใพใใใ
+- DETR ใฏใๆๅฝฑๅใซๅใปใซใใขใใณใทใงใณๅฑคใจใฏใญในใขใใณใทใงใณๅฑคใฎ้ ใ็ถๆ
ใซไฝ็ฝฎๅใ่พผใฟใ่ฟฝๅ ใใพใใ
+ ใฏใจใชใจใญใผใซใ็ปๅใฎไฝ็ฝฎๅใ่พผใฟใซใคใใฆใฏใๅบๅฎๆญฃๅผฆๆณขใพใใฏๅญฆ็ฟๆธใฟใฎใฉใกใใใ้ธๆใงใใพใใ
+ ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใใใใฉใซใใงใฏใใใฉใกใผใฟ `position_embedding_type` ใฏ
+ [`~transformers.DetrConfig`] ใฏ `"sine"` ใซ่จญๅฎใใใพใใ
+- DETR ใฎไฝๆ่
ใฏใใใฌใผใใณใฐไธญใซใ็นใซใใณใผใใง่ฃๅฉๆๅคฑใไฝฟ็จใใใจๅฝน็ซใคใใจใซๆฐใฅใใพใใใ
+ ใขใใซใฏๅใฏใฉในใฎๆญฃใใๆฐใฎใชใใธใงใฏใใๅบๅใใพใใใใฉใกใผใฟ `auxiliary_loss` ใ่จญๅฎใใใจใ
+ [`~transformers.DetrConfig`] ใ`True`ใซ่จญๅฎใใใใฃใผใใใฉใฏใผใ ใใฅใผใฉใซ ใใใใฏใผใฏใจใใณใฌใชใผๆๅคฑใไบๆธฌใใพใ
+ ใฏๅใใณใผใๅฑคใฎๅพใซ่ฟฝๅ ใใใพใ (FFN ใใใฉใกใผใฟใๅ
ฑๆใใ)ใ
+- ่คๆฐใฎใใผใใซใใใๅๆฃ็ฐๅขใงใขใใซใใใฌใผใใณใฐใใๅ ดๅใฏใ
+ _modeling_detr.py_ ใฎ _DetrLoss_ ใฏใฉในใฎ _num_boxes_ ๅคๆฐใ่คๆฐใฎใใผใใงใใฌใผใใณใฐใใๅ ดๅใใใใฏๆฌกใฎใใใซใใๅฟ
่ฆใใใใพใ
+ ๅ
ใฎๅฎ่ฃ
ใง่ฆใใใใใใซใใในใฆใฎใใผใใซใใใใฟใผใฒใใ ใใใฏในใฎๅนณๅๆฐใซ่จญๅฎใใใพใ [ใใกใ](https://github.com/facebookresearch/detr/blob/a54b77800eb8e64e3ad0d8237789fcbf2f8350c5/models/detr.py#L227-L232) ใ
+- [`~transformers.DetrForObjectDetection`] ใใใณ [`~transformers.DetrForSegmentation`] ใฏๆฌกใฎใใใซๅๆๅใงใใพใใ
+ [timm ใฉใคใใฉใช](https://github.com/rwightman/pytorch-image-models) ใงๅฉ็จๅฏ่ฝใช็ณใฟ่พผใฟใใใฏใใผใณใ
+ ใใจใใฐใMobileNet ใใใฏใใผใณใไฝฟ็จใใๅๆๅใฏใๆฌกใฎ `backbone` ๅฑๆงใ่จญๅฎใใใใจใงๅฎ่กใงใใพใใ
+ [`~transformers.DetrConfig`] ใ `"tf_mobilenetv3_small_075"` ใซ่จญๅฎใใใใใไฝฟ็จใใฆใขใใซใๅๆๅใใพใใ
+ ๆงๆใ
+- DETR ใฏใๆ็ญ่พบใไธๅฎใฎใใฏใปใซๆฐไปฅไธใซใชใใๆ้ท่พบใไธๅฎ้ไปฅไธใซใชใใใใซๅ
ฅๅ็ปๅใฎใตใคใบใๅคๆดใใพใใ
+ ๆๅคง 1333 ใใฏใปใซใใใฌใผใใณใฐๆใซใๆ็ญ่พบใใฉใณใใ ใซ ใซ่จญๅฎใใใใใใซในใฑใผใซๆกๅผตใไฝฟ็จใใใพใใ
+ ๆๅฐ 480ใๆๅคง 800 ใใฏใปใซใๆจ่ซๆใซใฏใๆ็ญ่พบใ 800 ใซ่จญๅฎใใใพใใ
+
+ไฝฟ็จใงใใพใ
+ [`~transformers.DetrImageProcessor`] ็จใฎ็ปๅ (ใใใณใชใใทใงใณใฎ COCO ๅฝขๅผใฎๆณจ้) ใๆบๅใใพใใ
+ ใขใใซใใใฎใตใคใบๅคๆดใซใใใใใใๅ
ใฎ็ปๅใฎใตใคใบใ็ฐใชใๅ ดๅใใใใพใใ DETR ใฏใ็ปๅใๆๅคงใพใงใใใฃใณใฐใใใใจใงใใฎๅ้กใ่งฃๆฑบใใพใใ
+ ใฉใฎใใฏใปใซใๅฎๆฐใงใฉใฎใใฏใปใซใใใใฃใณใฐใงใใใใ็คบใใใฏใปใซ ใในใฏใไฝๆใใใใจใซใใฃใฆใใใใๅ
ใฎๆๅคงใตใคใบใๆฑบๅฎใใพใใ
+ ใใใใฏใ็ปๅใใใใๅฆ็ใใใใใซใซในใฟใ ใฎ `collatโโe_fn` ใๅฎ็พฉใใใใจใใงใใพใใ
+ [`~transformers.DetrImageProcessor.pad_and_create_pixel_mask`]ใ
+- ็ปๅใฎใตใคใบใซใใฃใฆไฝฟ็จใใใใกใขใชใฎ้ใๆฑบใพใใใใใใฃใฆใbatch_sizeใใๆฑบใพใใพใใ
+ GPU ใใใ 2 ใฎใใใ ใตใคใบใไฝฟ็จใใใใจใใๅงใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใ[ใใฎ Github ในใฌใใ](https://github.com/facebookresearch/detr/issues/150) ใๅ็
งใใฆใใ ใใใ
+
+DETR ใขใใซใใคใณในใฟใณในๅใใใซใฏ 3 ใคใฎๆนๆณใใใใพใ (ๅฅฝใฟใซๅฟใใฆ)ใ
+
+ใชใใทใงใณ 1: ใขใใซๅ
จไฝใฎไบๅใใฌใผใใณใฐใใใ้ใฟใไฝฟ็จใใฆ DETR ใใคใณในใฟใณในๅใใ
+
+```py
+>>> from transformers import DetrForObjectDetection
+
+>>> model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50")
+```
+
+ใชใใทใงใณ 2: Transformer ใซใคใใฆใฏใฉใณใใ ใซๅๆๅใใใ้ใฟใไฝฟ็จใใฆ DETR ใใคใณในใฟใณในๅใใพใใใใใใฏใใผใณใซใคใใฆใฏไบๅใซใใฌใผใใณใฐใใใ้ใฟใไฝฟ็จใใพใ
+
+```py
+>>> from transformers import DetrConfig, DetrForObjectDetection
+
+>>> config = DetrConfig()
+>>> model = DetrForObjectDetection(config)
+```
+
+ใชใใทใงใณ 3: ใใใฏใใผใณ + ใใฉใณในใใฉใผใใผใฎใฉใณใใ ใซๅๆๅใใใ้ใฟใไฝฟ็จใใฆ DETR ใใคใณในใฟใณในๅใใพใใ
+
+```py
+>>> config = DetrConfig(use_pretrained_backbone=False)
+>>> model = DetrForObjectDetection(config)
+```
+
+| Task | Object detection | Instance segmentation | Panoptic segmentation |
+|------|------------------|-----------------------|-----------------------|
+| **Description** |็ปๅๅ
ใฎใชใใธใงใฏใใฎๅจๅฒใฎๅข็ใใใฏในใจใฏใฉใน ใฉใใซใไบๆธฌใใ | ็ปๅๅ
ใฎใชใใธใงใฏใ (ใคใพใใคใณในใฟใณใน) ใฎๅจๅฒใฎใในใฏใไบๆธฌใใ | ็ปๅๅ
ใฎใชใใธใงใฏใ (ใคใณในใฟใณใน) ใจใใใฎใ (ๆจใ้่ทฏใชใฉใฎ่ๆฏ) ใฎไธกๆนใฎๅจๅฒใฎใในใฏใไบๆธฌใใพใ |
+| **Model** | [`~transformers.DetrForObjectDetection`] | [`~transformers.DetrForSegmentation`] | [`~transformers.DetrForSegmentation`] |
+| **Example dataset** | COCO detection | COCO detection, COCO panoptic | COCO panoptic | |
+| **Format of annotations to provide to** [`~transformers.DetrImageProcessor`] | {'image_id': `int`, 'annotations': `List[Dict]`} each Dict being a COCO object annotation | {'image_id': `int`, 'annotations': `List[Dict]`} (in case of COCO detection) or {'file_name': `str`, 'image_id': `int`, 'segments_info': `List[Dict]`} (in case of COCO panoptic) | {'file_name': `str`, 'image_id': `int`, 'segments_info': `List[Dict]`} and masks_path (path to directory containing PNG files of the masks) |
+| **Postprocessing** (i.e. converting the output of the model to Pascal VOC format) | [`~transformers.DetrImageProcessor.post_process`] | [`~transformers.DetrImageProcessor.post_process_segmentation`] | [`~transformers.DetrImageProcessor.post_process_segmentation`], [`~transformers.DetrImageProcessor.post_process_panoptic`] |
+| **evaluators** | `CocoEvaluator` with `iou_types="bbox"` | `CocoEvaluator` with `iou_types="bbox"` or `"segm"` | `CocoEvaluator` with `iou_tupes="bbox"` or `"segm"`, `PanopticEvaluator` |
+
+ใคใพใใCOCO ๆคๅบใพใใฏ COCO ใใใใใฃใใฏๅฝขๅผใงใใผใฟใๆบๅใใฆใใใๆฌกใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+[`~transformers.DetrImageProcessor`] `pixel_values`ใ`pixel_mask`ใใใใณใชใใทใงใณใไฝๆใใพใใ
+ใใฉใใซใใใใใไฝฟ็จใใฆใขใใซใใใฌใผใใณใฐ (ใพใใฏๅพฎ่ชฟๆด) ใงใใพใใ่ฉไพกใใใซใฏใใพใใ
+[`~transformers.DetrImageProcessor`] ใฎๅพๅฆ็ใกใฝใใใฎ 1 ใคใไฝฟ็จใใใขใใซใฎๅบๅใใใใใฏใงใใพใ
+`CocoEvaluator` ใพใใฏ `PanopticEvaluator` ใฎใใใใใซๆไพใใใๆฌกใฎใใใชใกใใชใฏในใ่จ็ฎใงใใพใใ
+ๅนณๅๅนณๅ็ฒพๅบฆ (mAP) ใจใใใฉใๅ่ณช (PQ)ใๅพ่
ใฎใชใใธใงใฏใใฏ [ๅ
ใฎใชใใธใใช](https://github.com/facebookresearch/detr) ใซๅฎ่ฃ
ใใใฆใใพใใ่ฉไพกใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ใตใณใใซ ใใผใใใใฏ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/DETR) ใๅ็
งใใฆใใ ใใใ
+
+## Resources
+
+DETR ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+- ใซในใฟใ ใใผใฟใปใใใฎ [`DetrForObjectDetection`] ใจ [`DetrForSegmentation`] ใฎๅพฎ่ชฟๆดใ่ชฌๆใใใในใฆใฎใตใณใใซ ใใผใใใใฏใฏใ[ใใกใ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/DETR) ใง่ฆใคใใใใจใใงใใพใใ ใ
+- ๅ็
ง: [ใชใใธใงใฏใๆคๅบใฟในใฏ ใฌใคใ](../tasks/object_detection)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## DetrConfig
+
+[[autodoc]] DetrConfig
+
+## DetrImageProcessor
+
+[[autodoc]] DetrImageProcessor
+ - preprocess
+ - post_process_object_detection
+ - post_process_semantic_segmentation
+ - post_process_instance_segmentation
+ - post_process_panoptic_segmentation
+
+## DetrImageProcessorFast
+
+[[autodoc]] DetrImageProcessorFast
+ - preprocess
+ - post_process_object_detection
+ - post_process_semantic_segmentation
+ - post_process_instance_segmentation
+ - post_process_panoptic_segmentation
+
+## DetrFeatureExtractor
+
+[[autodoc]] DetrFeatureExtractor
+ - __call__
+ - post_process_object_detection
+ - post_process_semantic_segmentation
+ - post_process_instance_segmentation
+ - post_process_panoptic_segmentation
+
+## DETR specific outputs
+
+[[autodoc]] models.detr.modeling_detr.DetrModelOutput
+
+[[autodoc]] models.detr.modeling_detr.DetrObjectDetectionOutput
+
+[[autodoc]] models.detr.modeling_detr.DetrSegmentationOutput
+
+## DetrModel
+
+[[autodoc]] DetrModel
+ - forward
+
+## DetrForObjectDetection
+
+[[autodoc]] DetrForObjectDetection
+ - forward
+
+## DetrForSegmentation
+
+[[autodoc]] DetrForSegmentation
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/dialogpt.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/dialogpt.md
new file mode 100644
index 0000000000000000000000000000000000000000..22ce0c9a099f7515438b08197820b3176e243742
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/dialogpt.md
@@ -0,0 +1,57 @@
+
+
+# DialoGPT
+
+## Overview
+
+DialoGPT ใฏใ[DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation](https://arxiv.org/abs/1911.00536) ใง Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao,
+Jianfeng Gao, Jingjing Liu, Bill Dolan.ใใใฏใใใๆฝๅบใใใ 147M ไธใฎไผ่ฉฑใฎใใใชใใใจใใงใใฌใผใใณใฐใใใ GPT2 ใขใใซใงใใ
+ใฌใใฃใใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*็งใใกใฏใๅคง่ฆๆจกใง่ชฟๆดๅฏ่ฝใชใใฅใผใฉใซไผ่ฉฑๅฟ็ญ็ๆใขใใซ DialoGPT (ๅฏพ่ฉฑ็ๆไบๅใใฌใผใใณใฐๆธใฟ) ใ็ดนไปใใพใใ
+ๅคๆๅจ๏ผใ Reddit ใฎใณใกใณใ ใใงใผใณใใๆฝๅบใใใ 1 ๅ 4,700 ไธไปถใฎไผ่ฉฑใฎใใใชใใๅใใๅฏพ่ฑกใซใใฌใผใใณใฐใใใพใใใ
+2005 ๅนดใใ 2017 ๅนดใซใใใฆใDialoGPT ใฏไบบ้ใซ่ฟใใใใฉใผใใณในใ้ๆใใใใใซ Hugging Face PyTorch ใใฉใณในใใฉใผใใผใๆกๅผตใใพใใใ
+ใทใณใฐใซใฟใผใณใใคใขใญใฐ่จญๅฎใซใใใ่ชๅ่ฉไพกใจไบบ้ใซใใ่ฉไพกใฎไธกๆนใไผ่ฉฑใทในใใ ใ
+DialoGPT ใๆดป็จใใใจใๅผทๅใชใใผในใฉใคใณใใใ้ข้ฃๆงใ้ซใใๅ
ๅฎนใๅ
ๅฎใใใณใณใใญในใใซไธ่ฒซๆงใฎใใๅฟ็ญใ็ๆใใใพใใ
+ใทในใใ ใ็ฅ็ตๅๅฟใฎ็ ็ฉถใไฟ้ฒใใใใใซใไบๅใใฌใผใใณใฐใใใใขใใซใจใใฌใผใใณใฐ ใใคใใฉใคใณใๅ
ฌ้ใใใฆใใพใใ
+ใใใคใณใใชใธใงใณใใชใชใผใใณใใกใคใณๅฏพ่ฉฑใทในใใ ใฎ็ๆใจ้็บใ*
+
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/microsoft/DialoGPT) ใซใใใพใใ
+
+## Usage tips
+
+
+- DialoGPT ใฏ็ตถๅฏพไฝ็ฝฎๅใ่พผใฟใๅใใใขใใซใงใใใใใ้ๅธธใฏๅ
ฅๅใๅณๅดใซใใใฃใณใฐใใใใจใใๅงใใใพใใ
+ ๅทฆใใใใ
+- DialoGPT ใฏใไผ่ฉฑใใผใฟใฎๅ ๆ่จ่ชใขใใชใณใฐ (CLM) ็ฎๆจใซๅบใฅใใฆใใฌใผใใณใฐใใใฆใใใใใๅผทๅใงใ
+ ใชใผใใณใใกใคใณๅฏพ่ฉฑใทในใใ ใซใใใๅฟ็ญ็ๆๆใ
+- DialoGPT ใไฝฟ็จใใใจใ[DialoGPT's model card](https://huggingface.co/microsoft/DialoGPT-medium) ใซ็คบใใใฆใใใใใซใใฆใผใถใผใฏใใใ 10 ่กใฎใณใผใใงใใฃใใ ใใใใไฝๆใงใใพใใ
+
+ใใฌใผใใณใฐ๏ผ
+
+DialoGPT ใใใฌใผใใณใฐใพใใฏๅพฎ่ชฟๆดใใใซใฏใๅ ๆ่จ่ชใขใใชใณใฐ ใใฌใผใใณใฐใไฝฟ็จใงใใพใใๅ
ฌๅผ่ซๆใๅผ็จใใใจ๏ผ *็งใใกใฏ
+OpenAI GPT-2ใซๅพใฃใฆใใใซใใฟใผใณๅฏพ่ฉฑใปใใทใงใณใ้ทใใใญในใใจใใฆใขใใซๅใใ็ๆใฟในใฏใ่จ่ชใจใใฆใใฌใผใ ๅใใพใ
+ใขใใชใณใฐใใพใใใใคใขใญใฐ ใปใใทใงใณๅ
ใฎใในใฆใฎใใคใขใญใฐ ใฟใผใณใ้ทใใใญในใ x_1,..., x_N ใซ้ฃ็ตใใพใ (N ใฏ
+* ่ฉณ็ดฐใซใคใใฆใฏใๅ
ใฎ่ซๆใๅ็
งใใฆใใ ใใใ
+
+
+
+DialoGPT ใฎใขใผใญใใฏใใฃใฏ GPT2 ใขใใซใซๅบใฅใใฆใใพใใAPI ใชใใกใฌใณในใจไพใซใคใใฆใฏใ[GPT2 ใฎใใญใฅใกใณใ ใใผใธ](openai-community/gpt2) ใๅ็
งใใฆใใ ใใใ
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/dinat.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/dinat.md
new file mode 100644
index 0000000000000000000000000000000000000000..a59b073d4669ef039467d84139a0c98032d71d63
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_doc/dinat.md
@@ -0,0 +1,93 @@
+
+
+# Dilated Neighborhood Attention Transformer
+
+## Overview
+
+DiNAT ใฏ [Dilated Neighborhood Attender Transformer](https://arxiv.org/abs/2209.15001) ใงๆๆกใใใพใใใ
+Ali Hassani and Humphrey Shi.
+
+[NAT](nat) ใๆกๅผตใใใใใซใๆกๅผต่ฟ้ฃใขใใณใทใงใณ ใใฟใผใณใ่ฟฝๅ ใใฆใฐใญใผใใซ ใณใณใใญในใใใญใฃใใใฃใใพใใ
+ใใใฆใใใจๆฏ่ผใใฆๅคงๅน
ใชใใใฉใผใใณในใฎๅไธใ่ฆใใใพใใ
+
+่ซๆใฎ่ฆ็ดใฏๆฌกใฎใจใใใงใใ
+
+*ใใฉใณในใใฉใผใใผใฏๆฅ้ใซใใใพใใพใชใขใใชใใฃใซใใใฃใฆๆใ้ ป็นใซ้ฉ็จใใใๆทฑๅฑคๅญฆ็ฟใขใผใญใใฏใใฃใฎ 1 ใคใซใชใใคใคใใใพใใ
+ใใกใคใณใจใฟในใฏใใใธใงใณใงใฏใๅ็ดใชใใฉใณในใใฉใผใใผใธใฎ็ถ็ถ็ใชๅใ็ตใฟใซๅ ใใฆใ้ๅฑคๅใใฉใณในใใฉใผใใผใ
+ใพใใใใฎใใใฉใผใใณในใจๆขๅญใฎใใฌใผใ ใฏใผใฏใธใฎ็ฐกๅใช็ตฑๅใฎใใใใงใๅคงใใชๆณจ็ฎใ้ใใพใใใ
+ใใใใฎใขใใซใฏ้ๅธธใในใฉใคใใฃใณใฐ ใฆใฃใณใใฆใฎ่ฟ้ฃใขใใณใทใงใณ (NA) ใชใฉใฎๅฑๆ็ใชๆณจๆใกใซใใบใ ใๆก็จใใฆใใพใใ
+ใพใใฏ Swin Transformer ใฎใทใใ ใฆใฃใณใใฆ ใปใซใ ใขใใณใทใงใณใ่ชๅทฑๆณจๆใฎไบๆฌก่ค้ใใ่ปฝๆธใใใฎใซๅนๆ็ใงใใใ
+ๅฑๆ็ใชๆณจๆใฏใ่ชๅทฑๆณจๆใฎๆใๆใพใใ 2 ใคใฎ็นๆงใๅผฑใใพใใใใใฏใ้ท่ท้ขใฎ็ธไบไพๅญๆงใขใใชใณใฐใงใใ
+ใใใฆๅ
จไฝ็ใชๅๅฎน้ใใใฎใใผใใผใงใฏใ่ช็ถใงๆ่ปใงใ
+NA ใธใฎๅน็็ใชๆกๅผตใซใใใใใใฐใญใผใใซใชใณใณใใญในใใๆๆใใๅๅฎน้ใใผใญใใๆๆฐ้ขๆฐ็ใซๆกๅผตใใใใจใใงใใพใใ
+่ฟฝๅ ่ฒป็จใ NA ใฎใญใผใซใซใชๆณจ็ฎใจ DiNA ใฎใพใฐใใชใฐใญใผใใซใชๆณจ็ฎใฏ็ธไบใซ่ฃๅฎใๅใใใใ็งใใกใฏ
+ไธกๆนใซๅบใฅใใฆๆง็ฏใใใๆฐใใ้ๅฑคๅใใธใงใณ ใใฉใณในใใฉใผใใผใงใใ Dilated Neighborhood Attendant Transformer (DiNAT) ใๅฐๅ
ฅใใพใใ
+DiNAT ใฎใใชใขใณใใฏใNATใSwinใConvNeXt ใชใฉใฎๅผทๅใชใใผในใฉใคใณใซๆฏในใฆๅคงๅน
ใซๆนๅใใใฆใใพใใ
+็งใใกใฎๅคง่ฆๆจกใขใใซใฏใCOCO ใชใใธใงใฏใๆคๅบใซใใใฆ Swin ใขใใซใใใ้ซ้ใงใใใใฏใน AP ใ 1.5% ๅชใใฆใใพใใ
+COCO ใคใณในใฟใณใน ใปใฐใกใณใใผใทใงใณใงใฏ 1.3% ใฎใในใฏ APใADE20K ใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใงใฏ 1.1% ใฎ mIoUใ
+ๆฐใใใใฌใผใ ใฏใผใฏใจ็ตใฟๅใใใๅฝ็คพใฎๅคง่ฆๆจกใใชใขใณใใฏใCOCO (58.2 PQ) ไธใฎๆฐใใๆๅ
็ซฏใฎใใใใใฃใใฏ ใปใฐใกใณใใผใทใงใณ ใขใใซใงใใ
+ใใใณ ADE20K (48.5 PQ)ใใใใณ Cityscapes (44.5 AP) ใใใณ ADE20K (35.4 AP) ใฎใคใณในใฟใณใน ใปใฐใกใณใใผใทใงใณ ใขใใซ (่ฟฝๅ ใใผใฟใชใ)ใ
+ใพใใADE20K (58.2 mIoU) ไธใฎๆๅ
็ซฏใฎ็นๆฎใชใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณ ใขใใซใจใไธ่ดใใพใใ
+้ฝๅธๆฏ่ฆณ (84.5 mIoU) ใงใฏ 2 ไฝใซใฉใณใฏใใใฆใใพใ (่ฟฝๅ ใใผใฟใชใ)ใ *
+
+
+
+
+ ็ฐใชใๆกๅผตๅคใไฝฟ็จใใ่ฟ้ฃใขใใณใทใงใณใ
+ๅ
ใฎ่ซๆ ใใๆ็ฒใ
+
+ใใฎใขใใซใฏ [Ali Hassani](https://huggingface.co/alihassanijr) ใซใใฃใฆๆไพใใใพใใใ
+ๅ
ใฎใณใผใใฏ [ใใ](https://github.com/SHI-Labs/Neighborhood-Attendance-Transformer) ใซใใใพใใ
+
+## Usage tips
+
+DiNAT ใฏ *ใใใฏใใผใณ* ใจใใฆไฝฟ็จใงใใพใใ ใoutput_hidden_โโstates = Trueใใฎๅ ดๅใ
+`hidden_โโstates` ใจ `reshaped_hidden_โโstates` ใฎไธกๆนใๅบๅใใพใใ `reshape_hidden_โโstates` ใฏใ`(batch_size, height, width, num_channels)` ใงใฏใชใใ`(batch, num_channels, height, width)` ใฎๅฝข็ถใๆใฃใฆใใพใใ
+
+ใใผใ๏ผ
+- DiNAT ใฏใ[NATTEN](https://github.com/SHI-Labs/NATTEN/) ใซใใ่ฟ้ฃใขใใณใทใงใณใจๆกๅผต่ฟ้ฃใขใใณใทใงใณใฎๅฎ่ฃ
ใซไพๅญใใฆใใพใใ
+[shi-labs.com/natten](https://shi-labs.com/natten) ใๅ็
งใใฆใLinux ็จใฎใใซใๆธใฟใใคใผใซใไฝฟ็จใใฆใคใณในใใผใซใใใใ`pip install natten` ใๅฎ่กใใฆใทในใใ ไธใซๆง็ฏใงใใพใใ
+ๅพ่
ใฏใณใณใใคใซใซๆ้ใใใใๅฏ่ฝๆงใใใใใจใซๆณจๆใใฆใใ ใใใ NATTEN ใฏใพใ Windows ใใใคในใใตใใผใใใฆใใพใใใ
+- ็พๆ็นใงใฏใใใ ใตใคใบ 4 ใฎใฟใใตใใผใใใใฆใใพใใ
+
+## Resources
+
+DiNAT ใฎไฝฟ็จใ้ๅงใใใฎใซๅฝน็ซใคๅ
ฌๅผ Hugging Face ใใใณใณใใฅใใใฃ (๐ ใง็คบใใใฆใใ) ใชใฝใผในใฎใชในใใ
+
+
+
+
+- [`DinatForImageClassification`] ใฏใใใฎ [ใตใณใใซ ในใฏใชใใ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/image-classification) ใใใณ [ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)ใ
+- ๅ็
ง: [็ปๅๅ้กใฟในใฏ ใฌใคใ](../tasks/image_classification)
+
+ใใใซๅซใใใชใฝใผในใฎ้ไฟกใซ่ๅณใใใๅ ดๅใฏใใๆฐ่ปฝใซใใซ ใชใฏใจในใใ้ใใฆใใ ใใใๅฏฉๆปใใใฆใใใ ใใพใใใชใฝใผในใฏใๆขๅญใฎใชใฝใผในใ่ค่ฃฝใใใฎใงใฏใชใใไฝใๆฐใใใใฎใ็คบใใใจใ็ๆณ็ใงใใ
+
+## DinatConfig
+
+[[autodoc]] DinatConfig
+
+## DinatModel
+
+[[autodoc]] DinatModel
+ - forward
+
+## DinatForImageClassification
+
+[[autodoc]] DinatForImageClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_memory_anatomy.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_memory_anatomy.md
new file mode 100644
index 0000000000000000000000000000000000000000..45a383d616ad3426b64a29361797611bb1adca79
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_memory_anatomy.md
@@ -0,0 +1,255 @@
+
+
+# Model training anatomy
+
+ใขใใซใใฌใผใใณใฐใฎๅน็ใๅไธใใใใใใซ้ฉ็จใงใใใใใฉใผใใณในๆ้ฉๅใใฏใใใฏใ็่งฃใใใซใฏใใใฌใผใใณใฐไธญใซGPUใใฉใฎใใใซๅฉ็จใใใใใใใใณๅฎ่กใใใๆไฝใซๅฟใใฆ่จ็ฎๅผทๅบฆใใฉใฎใใใซๅคๅใใใใ็่งฃใใใใจใๅฝน็ซใกใพใใ
+
+ใพใใฏใGPUใฎๅฉ็จไพใจใขใใซใฎใใฌใผใใณใฐๅฎ่กใซ้ขใใ็คบๅใซๅฏใไพใๆขๆฑใใใใจใใๅงใใพใใใใใใขใณในใใฌใผใทใงใณใฎใใใซใใใใคใใฎใฉใคใใฉใชใใคใณในใใผใซใใๅฟ
่ฆใใใใพใ:
+
+```bash
+pip install transformers datasets accelerate nvidia-ml-py3
+```
+
+`nvidia-ml-py3` ใฉใคใใฉใชใฏใPythonๅ
ใใใขใใซใฎใกใขใชไฝฟ็จ็ถๆณใใขใใฟใผใใใใจใๅฏ่ฝใซใใพใใใใใใใใฟใผใใใซใงใฎ `nvidia-smi` ใณใใณใใซใคใใฆใฏใ่ใใใใใใพใใใใใใฎใฉใคใใฉใชใไฝฟ็จใใใจใPythonใใๅใๆ
ๅ ฑใซใขใฏใปในใงใใพใใ
+
+ใใใใใใใใคใใฎใใใผใใผใฟใไฝๆใใพใใ100ใใ30000ใฎ้ใฎใฉใณใใ ใชใใผใฏใณIDใจใๅ้กๅจใฎใใใฎใใคใใชใฉใใซใงใใๅ่จใงใ512ใฎใทใผใฑใณในใใใใใใใใใฎ้ทใใฏ512ใงใPyTorchใใฉใผใใใใฎ [`~datasets.Dataset`] ใซๆ ผ็ดใใใพใใ
+
+
+```py
+>>> import numpy as np
+>>> from datasets import Dataset
+
+
+>>> seq_len, dataset_size = 512, 512
+>>> dummy_data = {
+... "input_ids": np.random.randint(100, 30000, (dataset_size, seq_len)),
+... "labels": np.random.randint(0, 1, (dataset_size)),
+... }
+>>> ds = Dataset.from_dict(dummy_data)
+>>> ds.set_format("pt")
+```
+
+
+[`Trainer`]ใไฝฟ็จใใฆGPUๅฉ็จ็ใจใใฌใผใใณใฐๅฎ่กใฎ่ฆ็ด็ตฑ่จๆ
ๅ ฑใ่กจ็คบใใใใใซใ2ใคใฎใใซใใผ้ขๆฐใๅฎ็พฉใใพใใ
+
+
+```py
+>>> from pynvml import *
+
+
+>>> def print_gpu_utilization():
+... nvmlInit()
+... handle = nvmlDeviceGetHandleByIndex(0)
+... info = nvmlDeviceGetMemoryInfo(handle)
+... print(f"GPU memory occupied: {info.used//1024**2} MB.")
+
+
+>>> def print_summary(result):
+... print(f"Time: {result.metrics['train_runtime']:.2f}")
+... print(f"Samples/second: {result.metrics['train_samples_per_second']:.2f}")
+... print_gpu_utilization()
+```
+
+ไปฅไธใฏใ็กๆใฎGPUใกใขใชใใ้ๅงใใฆใใใใจใ็ขบ่ชใใพใใใ๏ผ
+
+
+```py
+>>> print_gpu_utilization()
+GPU memory occupied: 0 MB.
+```
+
+GPUใกใขใชใใขใใซใ่ชญใฟ่พผใๅใฎใใใซๅ ๆใใใฆใใชใใใใซ่ฆใใพใใใใใใไฝฟใใฎใใทใณใงใฎ็ถๆณใงใชใๅ ดๅใฏใGPUใกใขใชใไฝฟ็จใใฆใใใในใฆใฎใใญใปในใๅๆญขใใฆใใ ใใใใใ ใใใในใฆใฎ็ฉบใGPUใกใขใชใใฆใผใถใผใไฝฟ็จใงใใใใใงใฏใใใพใใใใขใใซใGPUใซ่ชญใฟ่พผใพใใใจใใซใผใใซใ่ชญใฟ่พผใพใใ1ใ2GBใฎใกใขใชใไฝฟ็จใใใใจใใใใพใใใใใใฉใใใใใใ็ขบ่ชใใใใใซใGPUใซๅฐใใชใใณใฝใซใ่ชญใฟ่พผใใจใใซใผใใซใ่ชญใฟ่พผใพใใพใใ
+
+
+```py
+>>> import torch
+
+
+>>> torch.ones((1, 1)).to("cuda")
+>>> print_gpu_utilization()
+GPU memory occupied: 1343 MB.
+```
+
+ใซใผใใซใ ใใง1.3GBใฎGPUใกใขใชใไฝฟ็จใใฆใใใใจใใใใใพใใๆฌกใซใใขใใซใใฉใใ ใใฎในใใผในใไฝฟ็จใใฆใใใใ่ฆใฆใฟใพใใใใ
+
+## Load Model
+
+ใพใใ`google-bert/bert-large-uncased` ใขใใซใ่ชญใฟ่พผใฟใพใใใขใใซใฎ้ใฟใ็ดๆฅGPUใซ่ชญใฟ่พผใใใจใงใ้ใฟใ ใใใฉใใ ใใฎในใใผในใไฝฟ็จใใฆใใใใ็ขบ่ชใงใใพใใ
+
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-large-uncased").to("cuda")
+>>> print_gpu_utilization()
+GPU memory occupied: 2631 MB.
+```
+
+ใขใใซใฎ้ใฟใ ใใงใGPUใกใขใชใ1.3 GBไฝฟ็จใใฆใใใใจใใใใใพใใๆญฃ็ขบใชๆฐๅคใฏใไฝฟ็จใใฆใใๅ
ทไฝ็ใชGPUใซไพๅญใใพใใๆฐใใGPUใงใฏใใขใใซใฎ้ใฟใๆ้ฉๅใใใๆนๆณใง่ชญใฟ่พผใพใใใใใใขใใซใฎไฝฟ็จใ้ซ้ๅใใใใจใใใใใใใขใใซใใใๅคใใฎในใใผในใๅ ๆใใใใจใใใใพใใใใฆใ`nvidia-smi` CLIใจๅใ็ตๆใๅพใใใใใ็ฐกๅใซ็ขบ่ชใใใใจใใงใใพใใ
+
+
+```bash
+nvidia-smi
+```
+
+```bash
+Tue Jan 11 08:58:05 2022
++-----------------------------------------------------------------------------+
+| NVIDIA-SMI 460.91.03 Driver Version: 460.91.03 CUDA Version: 11.2 |
+|-------------------------------+----------------------+----------------------+
+| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
+| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
+| | | MIG M. |
+|===============================+======================+======================|
+| 0 Tesla V100-SXM2... On | 00000000:00:04.0 Off | 0 |
+| N/A 37C P0 39W / 300W | 2631MiB / 16160MiB | 0% Default |
+| | | N/A |
++-------------------------------+----------------------+----------------------+
+
++-----------------------------------------------------------------------------+
+| Processes: |
+| GPU GI CI PID Type Process name GPU Memory |
+| ID ID Usage |
+|=============================================================================|
+| 0 N/A N/A 3721 C ...nvs/codeparrot/bin/python 2629MiB |
++-----------------------------------------------------------------------------+
+```
+
+ๅๅใจๅใๆฐๅคใๅๅพใใ16GBใฎใกใขใชใๆญ่ผใใV100 GPUใไฝฟ็จใใฆใใใใจใใใใใพใใใใฆใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใGPUใกใขใชใฎๆถ่ฒปใใฉใฎใใใซๅคๅใใใใ็ขบ่ชใใฆใฟใพใใใใใพใใใใใคใใฎๆจๆบ็ใชใใฌใผใใณใฐๅผๆฐใ่จญๅฎใใพใ:
+
+
+```py
+default_args = {
+ "output_dir": "tmp",
+ "eval_strategy": "steps",
+ "num_train_epochs": 1,
+ "log_level": "error",
+ "report_to": "none",
+}
+```
+
+
+
+่คๆฐใฎๅฎ้จใๅฎ่กใใไบๅฎใใใๅ ดๅใๅฎ้จ้ใงใกใขใชใ้ฉๅใซใฏใชใขใใใใใซใๅฎ้จใฎ้ใซ Python ใซใผใใซใๅ่ตทๅใใฆใใ ใใใ
+
+
+
+## Memory utilization at vanilla training
+
+[`Trainer`] ใไฝฟ็จใใฆใGPU ใใใฉใผใใณในใฎๆ้ฉๅใใฏใใใฏใไฝฟ็จใใใซใใใใตใคใบ 4 ใงใขใใซใใใฌใผใใณใฐใใพใใใ๏ผ
+
+
+```py
+>>> from transformers import TrainingArguments, Trainer, logging
+
+>>> logging.set_verbosity_error()
+
+
+>>> training_args = TrainingArguments(per_device_train_batch_size=4, **default_args)
+>>> trainer = Trainer(model=model, args=training_args, train_dataset=ds)
+>>> result = trainer.train()
+>>> print_summary(result)
+```
+
+```
+Time: 57.82
+Samples/second: 8.86
+GPU memory occupied: 14949 MB.
+```
+
+ๆขใซใๆฏ่ผ็ๅฐใใใใใใตใคใบใงใใGPUใฎใปใจใใฉใฎใกใขใชใใใงใซไฝฟ็จใใใฆใใใใจใใใใใพใใใใใใใใๅคงใใชใใใใตใคใบใไฝฟ็จใใใใจใฏใใใฐใใฐใขใใซใฎๅๆใ้ใใชใฃใใใๆ็ต็ใชๆง่ฝใๅไธใใใใใใใจใใใใพใใใใใใฃใฆใ็ๆณ็ใซใฏใใใใใตใคใบใใขใใซใฎ่ฆไปถใซๅใใใฆ่ชฟๆดใใใใฎใงใใใGPUใฎๅถ้ใซๅใใใฆ่ชฟๆดใใๅฟ
่ฆใฏใใใพใใใ่ๅณๆทฑใใใจใซใใขใใซใฎใตใคใบใใใใฏใใใซๅคใใฎใกใขใชใไฝฟ็จใใฆใใพใใใชใใใใชใใฎใใๅฐใ็่งฃใใใใใซใใขใใซใฎๆไฝใจใกใขใชใฎๅฟ
่ฆๆงใ่ฆใฆใฟใพใใใใ
+
+
+## Anatomy of Model's Operations
+
+Transformerใขใผใญใใฏใใฃใซใฏใ่จ็ฎๅผทๅบฆใซใใฃใฆไปฅไธใฎ3ใคใฎไธป่ฆใชๆไฝใฐใซใผใใๅซใพใใฆใใพใใ
+
+1. **ใใณใฝใซใฎๅ็ธฎ**
+
+ ็ทๅฝขๅฑคใจMulti-Head Attentionใฎใณใณใใผใใณใใฏใใในใฆใใใๅฆ็ใใใ **่กๅ-่กๅใฎไน็ฎ** ใ่กใใพใใใใใใฎๆไฝใฏใTransformerใฎใใฌใผใใณใฐใซใใใฆๆใ่จ็ฎ้็ด็ใช้จๅใงใใ
+
+2. **็ตฑ่จ็ๆญฃ่ฆๅ**
+
+ Softmaxใจๅฑคๆญฃ่ฆๅใฏใใใณใฝใซใฎๅ็ธฎใใใ่จ็ฎ่ฒ ่ทใๅฐใชใใ1ใคใพใใฏ่คๆฐใฎ **็ธฎ็ดๆไฝ** ใๅซใฟใใใฎ็ตๆใใใใใไปใใฆ้ฉ็จใใใพใใ
+
+3. **่ฆ็ด ใใจใฎๆผ็ฎๅญ**
+
+ ใใใใฏๆฎใใฎๆผ็ฎๅญใงใ๏ผ**ใใคใขในใใใญใใใขใฆใใๆดปๆงๅใใใใณๆฎๅทฎๆฅ็ถ** ใงใใใใใใฏๆใ่จ็ฎ้็ด็ใชๆไฝใงใฏใใใพใใใ
+
+ใใใฉใผใใณในใฎใใใซใใใฏใๅๆใใ้ใซใใใฎ็ฅ่ญใฏๅฝน็ซใคใใจใใใใพใใ
+
+ใใฎ่ฆ็ดใฏใ[Data Movement Is All You Need: Optimizing Transformers 2020ใซ้ขใใใฑใผในในใฟใใฃ](https://arxiv.org/abs/2007.00072)ใใๆดพ็ใใฆใใพใใ
+
+## Anatomy of Model's Memory
+
+ใขใใซใฎใใฌใผใใณใฐใGPUใซ้
็ฝฎใใใใขใใซใใใใฏใใใซๅคใใฎใกใขใชใไฝฟ็จใใใใจใ่ฆใฆใใพใใใใใใฏใใใฌใผใใณใฐไธญใซGPUใกใขใชใไฝฟ็จใใๅคใใฎใณใณใใผใใณใใๅญๅจใใใใใงใใGPUใกใขใชไธใฎใณใณใใผใใณใใฏไปฅไธใฎ้ใใงใ๏ผ
+
+1. ใขใใซใฎ้ใฟ
+2. ใชใใใฃใใคใถใฎ็ถๆ
+3. ๅพ้
+4. ๅพ้
่จ็ฎใฎใใใซไฟๅญใใใๅๅใๆดปๆงๅ
+5. ไธๆใใใใก
+6. ๆฉ่ฝๅบๆใฎใกใขใช
+
+้ๅธธใAdamWใไฝฟ็จใใฆๆททๅ็ฒพๅบฆใงใใฌใผใใณใฐใใใใขใใซใฏใใขใใซใใฉใกใผใฟใใจใซ18ใใคใใจใขใฏใใฃใใผใทใงใณใกใขใชใๅฟ
่ฆใงใใๆจ่ซใงใฏใชใใใฃใใคใถใฎ็ถๆ
ใจๅพ้
ใฏไธ่ฆใงใใฎใงใใใใใๅทฎใๅผใใใจใใงใใพใใใใใใฃใฆใๆททๅ็ฒพๅบฆใฎๆจ่ซใซใใใฆใฏใใขใใซใใฉใกใผใฟใใจใซ6ใใคใใจใขใฏใใฃใใผใทใงใณใกใขใชใๅฟ
่ฆใงใใ
+
+่ฉณ็ดฐใ่ฆใฆใฟใพใใใใ
+
+
+**ใขใใซใฎ้ใฟ:**
+
+- fp32ใใฌใผใใณใฐใฎใใฉใกใผใฟใผๆฐ * 4ใใคใ
+- ใใใฏในใใฌใทใธใงใณใใฌใผใใณใฐใฎใใฉใกใผใฟใผๆฐ * 6ใใคใ๏ผใกใขใชๅ
ใซfp32ใจfp16ใฎใขใใซใ็ถญๆ๏ผ
+
+**ใชใใใฃใใคใถใฎ็ถๆ
:**
+
+- ้ๅธธใฎAdamWใฎใใฉใกใผใฟใผๆฐ * 8ใใคใ๏ผ2ใคใฎ็ถๆ
ใ็ถญๆ๏ผ
+- 8-bit AdamWใชใใใฃใใคใถใฎใใฉใกใผใฟใผๆฐ * 2ใใคใ๏ผ[bitsandbytes](https://github.com/TimDettmers/bitsandbytes)ใฎใใใชใชใใใฃใใคใถ๏ผ
+- ใขใผใกใณใฟใ ใๆใคSGDใฎใใใชใชใใใฃใใคใถใฎใใฉใกใผใฟใผๆฐ * 4ใใคใ๏ผ1ใคใฎ็ถๆ
ใ็ถญๆ๏ผ
+
+**ๅพ้
**
+
+- fp32ใพใใฏใใใฏในใใฌใทใธใงใณใใฌใผใใณใฐใฎใใฉใกใผใฟใผๆฐ * 4ใใคใ๏ผๅพ้
ใฏๅธธใซfp32ใงไฟๆ๏ผ
+
+**ใใฉใฏใผใใขใฏใใฃใใผใทใงใณ**
+
+- ใตใคใบใฏๅคใใฎ่ฆๅ ใซไพๅญใใไธป่ฆใช่ฆๅ ใฏใทใผใฑใณในใฎ้ทใใ้ ใๅฑคใฎใตใคใบใใใใณใใใใตใคใบใงใใ
+
+ใใฉใฏใผใใจใใใฏใฏใผใใฎ้ขๆฐใซใใฃใฆๆธกใใใ่ฟใใใๅ
ฅๅใจๅบๅใใใใณๅพ้
่จ็ฎใฎใใใซไฟๅญใใใใใฉใฏใผใใขใฏใใฃใใผใทใงใณใใใใพใใ
+
+**ไธๆ็ใชใกใขใช**
+
+ใใใซใ่จ็ฎใๅฎไบใใๅพใซ่งฃๆพใใใใใพใใพใชไธๆๅคๆฐใใใใพใใใใใใใฏไธๆ็ใซ่ฟฝๅ ใฎใกใขใชใๅฟ
่ฆใจใใOOMใซ้ใใๅฏ่ฝๆงใใใใพใใใใใใฃใฆใใณใผใใฃใณใฐๆใซใฏใใฎใใใชไธๆๅคๆฐใซๆฆ็ฅ็ใซ่ใใๅฟ
่ฆใชใใชใฃใใๆ็คบ็ใซ่งฃๆพใใใใจใ้ๅธธใซ้่ฆใงใใ
+
+**ๆฉ่ฝๅบๆใฎใกใขใช**
+
+ๆฌกใซใใฝใใใฆใงใขใซใฏ็นๅฅใชใกใขใช่ฆไปถใใใๅ ดๅใใใใพใใใใจใใฐใใใผใ ใตใผใใไฝฟ็จใใฆใใญในใใ็ๆใใๅ ดๅใใฝใใใฆใงใขใฏ่คๆฐใฎๅ
ฅๅใจๅบๅใฎใณใใผใ็ถญๆใใๅฟ
่ฆใใใใพใใ
+
+**`forward`ใจ`backward`ใฎๅฎ่ก้ๅบฆ**
+
+็ณใฟ่พผใฟๅฑคใจ็ทๅฝขๅฑคใงใฏใใใใฏใฏใผใใซใใฉใฏใผใใจๆฏในใฆ2ๅใฎFLOPSใใใใไธ่ฌ็ใซใฏ็ด2ๅ้
ใใชใใพใ๏ผใใใฏใฏใผใใฎใตใคใบใไธไพฟใงใใใใจใใใใใใใใไปฅไธใซใชใใใจใใใใพใ๏ผใ ใขใฏใใฃใใผใทใงใณใฏ้ๅธธใใใณใๅน
ๅถ้ใใใฆใใใใใใฏใฏใผใใงใขใฏใใฃใใผใทใงใณใใใฉใฏใผใใใใๅคใใฎใใผใฟใ่ชญใใใจใไธ่ฌ็ใงใ๏ผใใจใใฐใใขใฏใใฃใใผใทใงใณใใฉใฏใผใใฏ1ๅ่ชญใฟๅใใ1ๅๆธใ่พผใฟใใขใฏใใฃใใผใทใงใณใใใฏใฏใผใใฏใใฉใฏใผใใฎgradOutputใใใณๅบๅใ2ๅ่ชญใฟๅใใ1ๅๆธใ่พผใฟใพใ๏ผใ
+
+ใ่ฆงใฎ้ใใGPUใกใขใชใ็ฏ็ดใใใๆไฝใ้ซ้ๅใงใใๅฏ่ฝๆงใฎใใใใใคใใฎๅ ดๆใใใใพใใ GPUใฎๅฉ็จใจ่จ็ฎ้ๅบฆใซๅฝฑ้ฟใไธใใ่ฆๅ ใ็่งฃใใใฎใงใใใใฉใผใใณในๆ้ฉๅใฎๆ่กใซใคใใฆใฏใ[ๅไธGPUใงใฎๅน็็ใชใใฌใผใใณใฐใฎใใใฎๆนๆณใจใใผใซ](perf_train_gpu_one)ใฎใใญใฅใกใณใใผใทใงใณใใผใธใๅ็
งใใฆใใ ใใใ
+
+่ฉณ็ดฐใ่ฆใฆใฟใพใใใใ
+
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_sharing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_sharing.md
new file mode 100644
index 0000000000000000000000000000000000000000..16d47057052b95bf26eadcac6affea90fb7d0808
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_sharing.md
@@ -0,0 +1,262 @@
+
+
+# Share a Model
+
+ๆๅพใฎ2ใคใฎใใฅใผใใชใขใซใงใฏใPyTorchใKerasใใใใณ๐ค Accelerateใไฝฟ็จใใฆใขใใซใใใกใคใณใใฅใผใใณใฐใใๆนๆณใ็คบใใพใใใๆฌกใฎในใใใใฏใใขใใซใใณใใฅใใใฃใจๅ
ฑๆใใใใจใงใ๏ผHugging Faceใงใฏใ็ฅ่ญใจใชใฝใผในใๅ
ฌ้็ใซๅ
ฑๆใใไบบๅทฅ็ฅ่ฝใ่ชฐใซใงใๆไพใใใใจใไฟกใใฆใใพใใไปใฎไบบใ
ใๆ้ใจใชใฝใผในใ็ฏ็ดใงใใใใใซใใขใใซใใณใใฅใใใฃใจๅ
ฑๆใใใใจใๆค่จใใใใจใใๅงใใใพใใ
+
+ใใฎใใฅใผใใชใขใซใงใฏใ่จ็ทดๆธใฟใพใใฏใใกใคใณใใฅใผใใณใฐใใใใขใใซใ[Model Hub](https://huggingface.co/models)ใซๅ
ฑๆใใ2ใคใฎๆนๆณใๅญฆใณใพใ๏ผ
+
+- ใใญใฐใฉใ ใงใใกใคใซใHubใซใใใทใฅใใใ
+- ใฆใงใใคใณใฟใผใใงใผในใไฝฟ็จใใฆใใกใคใซใHubใซใใฉใใฐใขใณใใใญใใใใใ
+
+VIDEO
+
+
+
+ใณใใฅใใใฃใจใขใใซใๅ
ฑๆใใใซใฏใ[huggingface.co](https://huggingface.co/join)ใงใขใซใฆใณใใๅฟ
่ฆใงใใๆขๅญใฎ็ต็นใซๅๅ ใใใใๆฐใใ็ต็นใไฝๆใใใใใใใจใใงใใพใใ
+
+
+
+## Repository Features
+
+Model Hubไธใฎๅใชใใธใใชใฏใ้ๅธธใฎGitHubใชใใธใใชใฎใใใซๅไฝใใพใใใชใใธใใชใฏใใผใธใงใใณใฐใใณใใใๅฑฅๆญดใ้ใใฎ่ฆ่ฆๅใฎๆฉ่ฝใๆไพใใพใใ
+
+Model Hubใฎ็ตใฟ่พผใฟใใผใธใงใใณใฐใฏgitใใใณ[git-lfs](https://git-lfs.github.com/)ใซๅบใฅใใฆใใพใใ่จใๆใใใฐใใขใใซใ1ใคใฎใชใใธใใชใจใใฆๆฑใใใจใใงใใใใๅคงใใชใขใฏใปในๅถๅพกใจในใฑใผใฉใใชใใฃใๅฎ็พใใพใใใใผใธใงใณ็ฎก็ใซใฏ*ใชใใธใงใณ*ใใใใใณใใใใใใทใฅใใฟใฐใใพใใฏใใฉใณใๅใง็นๅฎใฎใขใใซใใผใธใงใณใใใณ็ใใใๆนๆณใงใใ
+
+ใใฎ็ตๆใ`revision`ใใฉใกใผใฟใไฝฟ็จใใฆ็นๅฎใฎใขใใซใใผใธใงใณใใญใผใใงใใพใ๏ผ
+
+```py
+>>> model = AutoModel.from_pretrained(
+... "julien-c/EsperBERTo-small", revision="4c77982" # ใฟใฐๅใใพใใฏใใฉใณใๅใใพใใฏใณใใใใใใทใฅ
+... )
+```
+
+ใใกใคใซใฏใชใใธใใชๅ
ใง็ฐกๅใซ็ทจ้ใงใใใณใใใๅฑฅๆญดใจๅทฎๅใ่กจ็คบใงใใพใ๏ผ
+
+
+
+## Set Up
+
+ใขใใซใHubใซๅ
ฑๆใใๅใซใHugging Faceใฎ่ช่จผๆ
ๅ ฑใๅฟ
่ฆใงใใใฟใผใใใซใธใฎใขใฏใปในๆจฉใใใๅ ดๅใ๐ค Transformersใใคใณในใใผใซใใใฆใใไปฎๆณ็ฐๅขใงไปฅไธใฎใณใใณใใๅฎ่กใใพใใใใใซใใใใขใฏใปในใใผใฏใณใHugging Faceใฎใญใฃใใทใฅใใฉใซใใซไฟๅญใใใพใ๏ผใใใฉใซใใงใฏ `~/.cache/` ใซไฟๅญใใใพใ๏ผ๏ผ
+
+```bash
+huggingface-cli login
+```
+
+JupyterใColaboratoryใฎใใใชใใผใใใใฏใไฝฟ็จใใฆใใๅ ดๅใ[`huggingface_hub`](https://huggingface.co/docs/hub/adding-a-library)ใฉใคใใฉใชใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+ใใฎใฉใคใใฉใชใไฝฟ็จใใใจใHubใจใใญใฐใฉใ ็ใซๅฏพ่ฉฑใงใใพใใ
+
+```bash
+pip install huggingface_hub
+```
+
+ๆฌกใซใ`notebook_login`ใไฝฟ็จใใฆHubใซใตใคใณใคใณใใ[ใใกใใฎใชใณใฏ](https://huggingface.co/settings/token)ใซใขใฏใปในใใฆใญใฐใคใณใซไฝฟ็จใใใใผใฏใณใ็ๆใใพใ๏ผ
+
+```python
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Convert a Model for all frameworks
+
+็ฐใชใใใฌใผใ ใฏใผใฏใงไฝๆฅญใใฆใใไปใฎใฆใผใถใผใใใชใใฎใขใใซใไฝฟ็จใงใใใใใซใใใใใซใ
+PyTorchใใใณTensorFlowใฎใใงใใฏใใคใณใใงใขใใซใๅคๆใใฆใขใใใญใผใใใใใจใใๅงใใใพใใ
+ใใฎในใใใใในใญใใใใใจใใฆใผใถใผใฏ็ฐใชใใใฌใผใ ใฏใผใฏใใใขใใซใใญใผใใงใใพใใใ
+ใขใใซใใชใณใถใใฉใคใงๅคๆใใๅฟ
่ฆใใใใใใ้
ใใชใใพใใ
+
+ๅฅใฎใใฌใผใ ใฏใผใฏ็จใซใใงใใฏใใคใณใใๅคๆใใใใจใฏ็ฐกๅใงใใ
+PyTorchใจTensorFlowใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใ๏ผใคใณในใใผใซๆ้ ใซใคใใฆใฏ[ใใกใ](installation)ใๅ็
ง๏ผใใ
+ใใฎๅพใไปใฎใใฌใผใ ใฏใผใฏๅใใซ็นๅฎใฎใฟในใฏ็จใฎใขใใซใ่ฆใคใใพใใ
+
+
+
+TensorFlowใใPyTorchใซใใงใใฏใใคใณใใๅคๆใใใซใฏใ`from_tf=True`ใๆๅฎใใพใ๏ผ
+
+```python
+>>> pt_model = DistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_tf=True)
+>>> pt_model.save_pretrained("path/to/awesome-name-you-picked")
+```
+
+
+
+ๆๅฎใใฆใPyTorchใใTensorFlowใซใใงใใฏใใคใณใใๅคๆใใใซใฏ `from_pt=True` ใไฝฟ็จใใพใ๏ผ
+
+```python
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("path/to/awesome-name-you-picked", from_pt=True)
+```
+
+ๆฐใใTensorFlowใขใใซใจใใฎๆฐใใใใงใใฏใใคใณใใไฟๅญใงใใพใ๏ผ
+
+```python
+>>> tf_model.save_pretrained("path/to/awesome-name-you-picked")
+```
+
+
+
+Flaxใงใขใใซใๅฉ็จๅฏ่ฝใชๅ ดๅใPyTorchใใFlaxใธใฎใใงใใฏใใคใณใใฎๅคๆใ่กใใใจใใงใใพใ๏ผ
+
+```py
+>>> flax_model = FlaxDistilBertForSequenceClassification.from_pretrained(
+... "path/to/awesome-name-you-picked", from_pt=True
+... )
+```
+
+
+
+## Push a model during traning
+
+
+
+
+
+ใขใใซใHubใซใใใทใฅใใใใจใฏใ่ฟฝๅ ใฎใใฉใกใผใฟใผใพใใฏใณใผใซใใใฏใ่ฟฝๅ ใใใ ใใง็ฐกๅใงใใ
+[ใใกใคใณใใฅใผใใณใฐใใฅใผใใชใขใซ](training)ใใๆใๅบใใฆใใ ใใใ[`TrainingArguments`]ใฏใฉในใฏใใคใใผใใฉใกใผใฟใผใจ่ฟฝๅ ใฎใใฌใผใใณใฐใชใใทใงใณใๆๅฎใใๅ ดๆใงใใ
+ใใใใฎใใฌใผใใณใฐใชใใทใงใณใฎ1ใคใซใใขใใซใ็ดๆฅHubใซใใใทใฅใใๆฉ่ฝใใใใพใใ[`TrainingArguments`]ใง`push_to_hub=True`ใ่จญๅฎใใพใ๏ผ
+
+```py
+>>> training_args = TrainingArguments(output_dir="my-awesome-model", push_to_hub=True)
+```
+
+Pass your training arguments as usual to [`Trainer`]:
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+[`Trainer`]ใซ้ๅธธ้ใใใฌใผใใณใฐๅผๆฐใๆธกใใพใ๏ผ
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+ใใกใคใณใใฅใผใใณใฐใๅฎไบใใใใ[`Trainer`]ใง[`~transformers.Trainer.push_to_hub`]ใๅผใณๅบใใฆใใใฌใผใใณใฐๆธใฟใขใใซใHubใซใใใทใฅใใพใใ๐ค Transformersใฏใใใฌใผใใณใฐใฎใใคใใผใใฉใกใผใฟใใใฌใผใใณใฐ็ตๆใใใใณใใฌใผใ ใฏใผใฏใฎใใผใธใงใณใ่ชๅ็ใซใขใใซใซใผใใซ่ฟฝๅ ใใพใ๏ผ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+[`PushToHubCallback`]ใไฝฟ็จใใฆใขใใซใHubใซๅ
ฑๆใใพใใ[`PushToHubCallback`]้ขๆฐใซใฏใๆฌกใฎใใฎใ่ฟฝๅ ใใพใ๏ผ
+
+- ใขใใซใฎๅบๅใใฃใฌใฏใใชใ
+- ใใผใฏใใคใถใ
+- `hub_model_id`ใใคใพใHubใฎใฆใผใถใผๅใจใขใใซๅใ
+
+```python
+>>> from transformers import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="./your_model_save_path", tokenizer=tokenizer, hub_model_id="your-username/my-awesome-model"
+... )
+```
+
+๐ค Transformersใฏ[`fit`](https://keras.io/api/models/model_training_apis/)ใซใณใผใซใใใฏใ่ฟฝๅ ใใใใฌใผใใณใฐๆธใฟใขใใซใHubใซใใใทใฅใใพใ๏ผ
+
+```py
+>>> model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=3, callbacks=push_to_hub_callback)
+```
+
+
+
+## `push_to_hub` ้ขๆฐใไฝฟ็จใใ
+
+ใพใใใขใใซใ็ดๆฅHubใซใขใใใญใผใใใใใใซใ`push_to_hub` ใๅผใณๅบใใใจใใงใใพใใ
+
+`push_to_hub` ใงใขใใซๅใๆๅฎใใพใ๏ผ
+
+```py
+>>> pt_model.push_to_hub("my-awesome-model")
+```
+
+ใใใซใใใใฆใผใถใผๅใฎไธใซใขใใซๅ `my-awesome-model` ใๆใคใชใใธใใชใไฝๆใใใพใใ
+ใฆใผใถใผใฏใ`from_pretrained` ้ขๆฐใไฝฟ็จใใฆใขใใซใใญใผใใงใใพใ๏ผ
+
+```py
+>>> from transformers import AutoModel
+
+>>> model = AutoModel.from_pretrained("your_username/my-awesome-model")
+```
+
+็ต็นใซๆๅฑใใใขใใซใ็ต็นๅใฎใใจใซใใใทใฅใใใๅ ดๅใ`repo_id` ใซใใใ่ฟฝๅ ใใฆใใ ใใ๏ผ
+
+```python
+>>> pt_model.push_to_hub("my-awesome-org/my-awesome-model")
+```
+
+`push_to_hub`้ขๆฐใฏใใขใใซใชใใธใใชใซไปใฎใใกใคใซใ่ฟฝๅ ใใใใใซใไฝฟ็จใงใใพใใไพใใฐใใใผใฏใใคใถใใขใใซใชใใธใใชใซ่ฟฝๅ ใใพใ๏ผ
+
+```py
+>>> tokenizer.push_to_hub("my-awesome-model")
+```
+
+ใใใใฏใใใกใคใณใใฅใผใใณใฐใใใPyTorchใขใใซใฎTensorFlowใใผใธใงใณใ่ฟฝๅ ใใใใใใใใพใใ๏ผ
+
+```python
+>>> tf_model.push_to_hub("my-awesome-model")
+```
+
+Hugging Faceใใญใใฃใผใซใซ็งปๅใใใจใๆฐใใไฝๆใใใขใใซใชใใธใใชใ่กจ็คบใใใใฏใใงใใ**Files**ใฟใใใฏใชใใฏใใใจใใชใใธใใชใซใขใใใญใผใใใใในใฆใฎใใกใคใซใ่กจ็คบใใใพใใ
+
+ใชใใธใใชใซใใกใคใซใไฝๆใใใณใขใใใญใผใใใๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใHubใใญใฅใกใณใใผใทใงใณ[ใใกใ](https://huggingface.co/docs/hub/how-to-upstream)ใๅ็
งใใฆใใ ใใใ
+
+## Upload with the web interface
+
+ใณใผใใๆธใใใซใขใใซใใขใใใญใผใใใใใฆใผใถใผใฏใHubใฎใฆใงใใคใณใฟใผใใงใผในใไฝฟ็จใใฆใขใใซใใขใใใญใผใใงใใพใใ[huggingface.co/new](https://huggingface.co/new)ใ่จชใใฆๆฐใใใชใใธใใชใไฝๆใใพใ๏ผ
+
+
+
+ใใใใใใขใใซใซ้ขใใใใใคใใฎๆ
ๅ ฑใ่ฟฝๅ ใใพใ๏ผ
+
+- ใชใใธใใชใฎ**ๆๆ่
**ใ้ธๆใใพใใใใใฏใใชใ่ช่บซใพใใฏๆๅฑใใฆใใ็ต็นใฎใใใใใงใใ
+- ใขใใซใฎๅๅใ้ธๆใใพใใใใใฏใชใใธใใชใฎๅๅใซใใชใใพใใ
+- ใขใใซใๅ
ฌ้ใ้ๅ
ฌ้ใใ้ธๆใใพใใ
+- ใขใใซใฎใฉใคใปใณในไฝฟ็จๆนๆณใๆๅฎใใพใใ
+
+ใใฎๅพใ**Files**ใฟใใใฏใชใใฏใใ**Add file**ใใฟใณใใฏใชใใฏใใฆใชใใธใใชใซๆฐใใใใกใคใซใใขใใใญใผใใใพใใๆฌกใซใใใกใคใซใใใฉใใฐใขใณใใใญใใใใฆใขใใใญใผใใใใณใใใใกใใปใผใธใ่ฟฝๅ ใใพใใ
+
+
+
+## Add a model card
+
+ใฆใผใถใผใใขใใซใฎๆฉ่ฝใๅถ้ใๆฝๅจ็ใชๅใใๅซ็็ใช่ๆ
ฎไบ้
ใ็่งฃใงใใใใใซใใใใใซใใขใใซใชใใธใใชใซใขใใซใซใผใใ่ฟฝๅ ใใฆใใ ใใใใขใใซใซใผใใฏ`README.md`ใใกใคใซใงๅฎ็พฉใใใพใใใขใใซใซใผใใ่ฟฝๅ ใใๆนๆณ๏ผ
+
+* ๆๅใง`README.md`ใใกใคใซใไฝๆใใใณใขใใใญใผใใใใ
+* ใขใใซใชใใธใใชๅ
ใฎ**Edit model card**ใใฟใณใใฏใชใใฏใใใ
+
+ใขใใซใซใผใใซๅซใใในใๆ
ๅ ฑใฎไพใซใคใใฆใฏใDistilBert [ใขใใซใซใผใ](https://huggingface.co/distilbert/distilbert-base-uncased)ใใ่ฆงใใ ใใใ`README.md`ใใกใคใซใงๅถๅพกใงใใไปใฎใชใใทใงใณใไพใใฐใขใใซใฎ็ญ็ด ใใใใใชใณใใใฆใฃใธใงใใใฎไพใชใฉใซใคใใฆใฎ่ฉณ็ดฐใฏใ[ใใกใใฎใใญใฅใกใณใใผใทใงใณ](https://huggingface.co/docs/hub/models-cards)ใๅ็
งใใฆใใ ใใใ
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..8f8b6af48cc17b05f80f06ca3b75991ad68a2d7c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/model_summary.md
@@ -0,0 +1,110 @@
+
+
+# The Transformer model family
+
+2017ๅนดใซๅฐๅ
ฅใใใฆไปฅๆฅใ[ๅ
ใฎTransformer](https://arxiv.org/abs/1706.03762)ใขใใซใฏใ่ช็ถ่จ่ชๅฆ็๏ผNLP๏ผใฎใฟในใฏใ่ถ
ใใๅคใใฎๆฐใใใจใญใตใคใใฃใณใฐใชใขใใซใใคใณในใใคใขใใพใใใ[ใฟใณใใฏ่ณชใฎๆใใใใพใใๆง้ ใไบๆธฌ](https://huggingface.co/blog/deep-learning-with-proteins)ใใใขใใซใ[ใใผใฟใผใ่ตฐใใใใใใฎใใฌใผใใณใฐ](https://huggingface.co/blog/train-decision-transformers)ใใใขใใซใใใใฆ[ๆ็ณปๅไบๆธฌ](https://huggingface.co/blog/time-series-transformers)ใฎใใใฎใขใใซใชใฉใใใใพใใTransformerใฎใใพใใพใชใใชใขใณใใๅฉ็จๅฏ่ฝใงใใใๅคงๅฑใ่ฆ่ฝใจใใใจใใใใพใใใใใใฎใในใฆใฎใขใใซใซๅ
ฑ้ใใใฎใฏใๅ
ใฎTransformerใขใผใญใใฏใใฃใซๅบใฅใใฆใใใใจใงใใไธ้จใฎใขใใซใฏใจใณใณใผใใพใใฏใใณใผใใฎใฟใไฝฟ็จใใไปใฎใขใใซใฏไธกๆนใไฝฟ็จใใพใใใใใฏใTransformerใใกใใชใผๅ
ใฎใขใใซใฎ้ซใฌใใซใฎ้ใใใซใใดใฉใคใบใใ่ชฟๆปใใใใใฎๆ็จใชๅ้กๆณใๆไพใใไปฅๅใซๅบไผใฃใใใจใฎใชใTransformerใ็่งฃใใใฎใซๅฝน็ซใกใพใใ
+
+ๅ
ใฎTransformerใขใใซใซๆ
ฃใใฆใใชใใใใชใใฌใใทใฅใๅฟ
่ฆใชๅ ดๅใฏใHugging Faceใณใผในใฎ[Transformerใฎๅไฝๅ็](https://huggingface.co/course/chapter1/4?fw=pt)็ซ ใใใงใใฏใใฆใใ ใใใ
+
+
+ VIDEO
+
+
+## Computer vision
+
+
+
+### Convolutional network
+
+้ทใ้ใ็ณใฟ่พผใฟใใใใฏใผใฏ๏ผCNN๏ผใฏใณใณใใฅใผใฟใใธใงใณใฎใฟในใฏใซใใใฆๆฏ้
็ใชใใฉใใคใ ใงใใใใ[ใใธใงใณTransformer](https://arxiv.org/abs/2010.11929)ใฏใใฎในใฑใผใฉใใชใใฃใจๅน็ๆงใ็คบใใพใใใใใใงใใไธ้จใฎCNNใฎๆ้ซใฎ็นๆงใ็นใซ็นๅฎใฎใฟในใฏใซใจใฃใฆใฏ้ๅธธใซๅผทๅใช็ฟป่จณไธๅคๆงใชใฉใไธ้จใฎTransformerใฏใขใผใญใใฏใใฃใซ็ณใฟ่พผใฟใ็ตใฟ่พผใใงใใพใใ[ConvNeXt](model_doc/convnext)ใฏใ็ณใฟ่พผใฟใ็พไปฃๅใใใใใซTransformerใใ่จญ่จใฎ้ธๆ่ขใๅใๅ
ฅใใไพใใฐใConvNeXtใฏ็ปๅใใใใใซๅๅฒใใใใใซ้ใชใๅใใชใในใฉใคใใฃใณใฐใฆใฃใณใใฆใจใใฐใญใผใใซๅๅฎน้ใๅขๅ ใใใใใใฎๅคงใใชใซใผใใซใไฝฟ็จใใพใใConvNeXtใฏใใกใขใชๅน็ใๅไธใใใใใใฉใผใใณในใๅไธใใใใใใซใใใคใใฎใฌใคใคใผใใถใคใณใฎ้ธๆ่ขใๆไพใใTransformerใจ็ซถๅ็ใซใชใใพใ๏ผ
+
+
+### Encoder[[cv-encoder]]
+
+[ใใธใงใณ ใใฉใณในใใฉใผใใผ๏ผViT๏ผ](model_doc/vit) ใฏใ็ณใฟ่พผใฟใไฝฟ็จใใชใใณใณใใฅใผใฟใใธใงใณใฟในใฏใฎๆใ้ใใพใใใViT ใฏๆจๆบใฎใใฉใณในใใฉใผใใผใจใณใณใผใใผใไฝฟ็จใใพใใใ็ปๅใๆฑใๆนๆณใไธป่ฆใชใใฌใผใฏในใซใผใงใใใ็ปๅใๅบๅฎใตใคใบใฎใใใใซๅๅฒใใใใใใใใผใฏใณใฎใใใซไฝฟ็จใใฆๅใ่พผใฟใไฝๆใใพใใViT ใฏใๅฝๆใฎCNNใจ็ซถไบๅใฎใใ็ตๆใ็คบใใใใซใใฉใณในใใฉใผใใผใฎๅน็็ใชใขใผใญใใฏใใฃใๆดป็จใใพใใใใใใฌใผใใณใฐใซๅฟ
่ฆใชใชใฝใผในใๅฐใชใใฆๆธใฟใพใใใViT ใซ็ถใใฆใใปใฐใกใณใใผใทใงใณใๆคๅบใชใฉใฎๅฏใชใใธใงใณใฟในใฏใๅฆ็ใงใใไปใฎใใธใงใณใขใใซใ็ปๅ ดใใพใใใ
+
+ใใใใฎใขใใซใฎ1ใคใ[Swin](model_doc/swin) ใใฉใณในใใฉใผใใผใงใใSwin ใใฉใณในใใฉใผใใผใฏใใใๅฐใใชใตใคใบใฎใใใใใ้ๅฑค็ใช็นๅพดใใใ๏ผCNNใฎใใใง ViT ใจใฏ็ฐใชใใพใ๏ผใๆง็ฏใใๆทฑๅฑคใฎใใใใจ้ฃๆฅใใใใใใจใใผใธใใพใใๆณจๆใฏใญใผใซใซใฆใฃใณใใฆๅ
ใงใฎใฟ่จ็ฎใใใใฆใฃใณใใฆใฏๆณจๆใฎใฌใคใคใผ้ใงใทใใใใใใขใใซใใใ่ฏใๅญฆ็ฟใใใฎใใตใใผใใใๆฅ็ถใไฝๆใใพใใSwin ใใฉใณในใใฉใผใใผใฏ้ๅฑค็ใช็นๅพดใใใใ็ๆใงใใใใใใปใฐใกใณใใผใทใงใณใๆคๅบใชใฉใฎๅฏใชไบๆธฌใฟในใฏใซ้ฉใใฆใใพใใ[SegFormer](model_doc/segformer) ใ้ๅฑค็ใช็นๅพดใใใใๆง็ฏใใใใใซใใฉใณในใใฉใผใใผใจใณใณใผใใผใไฝฟ็จใใพใใใใในใฆใฎ็นๅพดใใใใ็ตใฟๅใใใฆไบๆธฌใใใใใซใทใณใใซใชใใซใใฌใคใคใผใใผใปใใใญใณ๏ผMLP๏ผใใณใผใใผใ่ฟฝๅ ใใพใใ
+
+BeIT ใใใณ ViTMAE ใชใฉใฎไปใฎใใธใงใณใขใใซใฏใBERTใฎไบๅใใฌใผใใณใฐ็ฎๆจใใใคใณในใใฌใผใทใงใณใๅพใพใใใ[BeIT](model_doc/beit) ใฏ *masked image modeling (MIM)* ใซใใฃใฆไบๅใใฌใผใใณใฐใใใฆใใพใใ็ปๅใใใใฏใฉใณใใ ใซใในใฏใใใ็ปๅใ่ฆ่ฆใใผใฏใณใซใใผใฏใณๅใใใพใใBeIT ใฏใในใฏใใใใใใใซๅฏพๅฟใใ่ฆ่ฆใใผใฏใณใไบๆธฌใใใใใซใใฌใผใใณใฐใใใพใใ[ViTMAE](model_doc/vitmae) ใไผผใใใใชไบๅใใฌใผใใณใฐ็ฎๆจใๆใฃใฆใใใ่ฆ่ฆใใผใฏใณใฎไปฃใใใซใใฏใปใซใไบๆธฌใใๅฟ
่ฆใใใใพใใ็ฐไพใชใฎใฏ็ปๅใใใใฎ75%ใใในใฏใใใฆใใใใจใงใ๏ผใใณใผใใผใฏใในใฏใใใใใผใฏใณใจใจใณใณใผใใใใใใใใใใใฏใปใซใๅๆง็ฏใใพใใไบๅใใฌใผใใณใฐใฎๅพใใใณใผใใผใฏๆจใฆใใใใจใณใณใผใใผใฏใใฆใณในใใชใผใ ใฎใฟในใฏใงไฝฟ็จใงใใ็ถๆ
ใงใใ
+
+### Decoder[[cv-decoder]]
+
+ใใณใผใใผใฎใฟใฎใใธใงใณใขใใซใฏ็ใใใงใใใชใใชใใใปใจใใฉใฎใใธใงใณใขใใซใฏ็ปๅ่กจ็พใๅญฆใถใใใซใจใณใณใผใใผใไฝฟ็จใใใใใงใใใใใใ็ปๅ็ๆใชใฉใฎใฆใผในใฑใผในใงใฏใใใณใผใใผใฏ่ช็ถใช้ฉๅฟใงใใใใใฏใGPT-2ใชใฉใฎใใญในใ็ๆใขใใซใใ่ฆใฆใใใใใซใ[ImageGPT](model_doc/imagegpt) ใงใๅๆงใฎใขใผใญใใฏใใฃใไฝฟ็จใใพใใใใทใผใฑใณในๅ
ใฎๆฌกใฎใใผใฏใณใไบๆธฌใใไปฃใใใซใ็ปๅๅ
ใฎๆฌกใฎใใฏใปใซใไบๆธฌใใพใใ็ปๅ็ๆใซๅ ใใฆใImageGPT ใฏ็ปๅๅ้กใฎใใใซใใใกใคใณใใฅใผใใณใฐใงใใพใใ
+
+### Encoder-decoder[[cv-encoder-decoder]]
+
+ใใธใงใณใขใใซใฏไธ่ฌ็ใซใจใณใณใผใใผ๏ผใใใฏใใผใณใจใๅผใฐใใพใ๏ผใไฝฟ็จใใฆ้่ฆใช็ปๅ็นๅพดใๆฝๅบใใใใใใใฉใณในใใฉใผใใผใใณใผใใผใซๆธกใใใใซไฝฟ็จใใพใใ[DETR](model_doc/detr) ใฏไบๅใใฌใผใใณใฐๆธใฟใฎใใใฏใใผใณใๆใฃใฆใใพใใใใชใใธใงใฏใๆคๅบใฎใใใซๅฎๅ
จใชใใฉใณในใใฉใผใใผใจใณใณใผใใผใใณใผใใผใขใผใญใใฏใใฃใไฝฟ็จใใฆใใพใใใจใณใณใผใใผใฏ็ปๅ่กจ็พใๅญฆใณใใใณใผใใผๅ
ใฎใชใใธใงใฏใใฏใจใช๏ผๅใชใใธใงใฏใใฏใจใชใฏ็ปๅๅ
ใฎ้ ๅใพใใฏใชใใธใงใฏใใซ็ฆ็นใๅฝใฆใๅญฆ็ฟใใใๅใ่พผใฟใงใ๏ผใจ็ตใฟๅใใใพใใDETR ใฏๅใชใใธใงใฏใใฏใจใชใซๅฏพใใๅข็ใใใฏในใฎๅบงๆจใจใฏใฉในใฉใใซใไบๆธฌใใพใใ
+
+## Natural lanaguage processing
+
+
+
+### Encoder[[nlp-encoder]]
+
+[BERT](model_doc/bert) ใฏใจใณใณใผใใผๅฐ็จใฎTransformerใงใๅ
ฅๅใฎไธ้จใฎใใผใฏใณใใฉใณใใ ใซใในใฏใใฆไปใฎใใผใฏใณใ่ฆใชใใใใซใใฆใใพใใใใใซใใใใใผใฏใณใใในใฏใใๆ่ใซๅบใฅใใฆใในใฏใใใใใผใฏใณใไบๆธฌใใใใจใไบๅใใฌใผใใณใฐใฎ็ฎๆจใงใใใใใซใใใBERTใฏๅ
ฅๅใฎใใๆทฑใใใค่ฑใใช่กจ็พใๅญฆ็ฟใใใฎใซๅทฆๅณใฎๆ่ใๅฎๅ
จใซๆดป็จใงใใพใใใใใใBERTใฎไบๅใใฌใผใใณใฐๆฆ็ฅใซใฏใพใ ๆนๅใฎไฝๅฐใใใใพใใใ[RoBERTa](model_doc/roberta) ใฏใใใฌใผใใณใฐใ้ทๆ้่กใใใใๅคงใใชใใใใงใใฌใผใใณใฐใใไบๅๅฆ็ไธญใซไธๅบฆใ ใใงใชใๅใจใใใฏใงใใผใฏใณใใฉใณใใ ใซใในใฏใใๆฌกๆไบๆธฌใฎ็ฎๆจใๅ้คใใๆฐใใไบๅใใฌใผใใณใฐใฌใทใใๅฐๅ
ฅใใใใจใงใใใๆนๅใใพใใใ
+
+ๆง่ฝใๅไธใใใไธป่ฆใชๆฆ็ฅใฏใขใใซใฎใตใคใบใๅขใใใใจใงใใใๅคง่ฆๆจกใชใขใใซใฎใใฌใผใใณใฐใฏ่จ็ฎใณในใใใใใใพใใ่จ็ฎใณในใใๅๆธใใๆนๆณใฎ1ใคใฏใ[DistilBERT](model_doc/distilbert) ใฎใใใชๅฐใใชใขใใซใไฝฟ็จใใใใจใงใใDistilBERTใฏ[็ฅ่ญ่ธ็](https://arxiv.org/abs/1503.02531) - ๅง็ธฎๆ่ก - ใไฝฟ็จใใฆใBERTใฎใปใผใในใฆใฎ่จ่ช็่งฃๆฉ่ฝใไฟๆใใชใใใใใๅฐใใชใใผใธใงใณใไฝๆใใพใใ
+
+ใใใใใปใจใใฉใฎTransformerใขใใซใฏๅผใ็ถใใใๅคใใฎใใฉใกใผใฟใซ็ฆ็นใๅฝใฆใใใฌใผใใณใฐๅน็ใๅไธใใใๆฐใใใขใใซใ็ปๅ ดใใฆใใพใใ[ALBERT](model_doc/albert) ใฏใ2ใคใฎๆนๆณใงใใฉใกใผใฟใฎๆฐใๆธใใใใจใซใใฃใฆใกใขใชๆถ่ฒป้ใๅๆธใใพใใๅคงใใช่ชๅฝๅใ่พผใฟใ2ใคใฎๅฐใใช่กๅใซๅๅฒใใใฌใคใคใผใใใฉใกใผใฟใๅ
ฑๆใงใใใใใซใใพใใ[DeBERTa](model_doc/deberta) ใฏใๅ่ชใจใใฎไฝ็ฝฎใ2ใคใฎใใฏใใซใงๅฅใ
ใซใจใณใณใผใใใ่งฃใใใๆณจๆๆฉๆงใ่ฟฝๅ ใใพใใใๆณจๆใฏใใใใฎๅฅใ
ใฎใใฏใใซใใ่จ็ฎใใใพใใๅ่ชใจไฝ็ฝฎใฎๅใ่พผใฟใๅซใพใใๅไธใฎใใฏใใซใงใฏใชใใ[Longformer](model_doc/longformer) ใฏใ็นใซ้ทใใทใผใฑใณใน้ทใฎใใญใฅใกใณใใๅฆ็ใใใใใซๆณจๆใใใๅน็็ใซใใใใจใซ็ฆ็นใๅฝใฆใพใใใๅบๅฎใใใใฆใฃใณใใฆใตใคใบใฎๅจใใฎๅใใผใฏใณใใ่จ็ฎใใใใญใผใซใซใฆใฃใณใใฆไปใๆณจๆ๏ผ็นๅฎใฎใฟในใฏใใผใฏใณ๏ผๅ้กใฎใใใฎ `[CLS]` ใชใฉ๏ผใฎใฟใฎใใใฎใฐใญใผใใซใชๆณจๆใๅซใ๏ผใฎ็ตใฟๅใใใไฝฟ็จใใฆใๅฎๅ
จใชๆณจๆ่กๅใงใฏใชใ็ใชๆณจๆ่กๅใไฝๆใใพใใ
+
+
+### Decoder[[nlp-decoder]]
+
+[GPT-2](model_doc/gpt2)ใฏใใทใผใฑใณในๅ
ใฎๆฌกใฎๅ่ชใไบๆธฌใใใใณใผใใผๅฐ็จใฎTransformerใงใใใขใใซใฏๅ
ใ่ฆใใใจใใงใใชใใใใซใใผใฏใณใๅณใซใในใฏใใ"ใฎใใ่ฆ"ใ้ฒใใพใใๅคง้ใฎใใญในใใไบๅใใฌใผใใณใฐใใใใจใซใใใGPT-2ใฏใใญในใ็ๆใ้ๅธธใซๅพๆใงใใใญในใใๆญฃ็ขบใงใใใใจใใใใซใใฆใใๆๆๆญฃ็ขบใงใฏใชใใใจใใใใพใใใใใใGPT-2ใซใฏBERTใฎไบๅใใฌใผใใณใฐใใใฎๅๆนๅใณใณใใญในใใไธ่ถณใใฆใใใ็นๅฎใฎใฟในใฏใซใฏ้ฉใใฆใใพใใใงใใใ[XLNET](model_doc/xlnet)ใฏใๅๆนๅใซๅญฆ็ฟใงใใ้ ๅ่จ่ชใขใใชใณใฐ็ฎๆจ๏ผPLM๏ผใไฝฟ็จใใใใจใงใBERTใจGPT-2ใฎไบๅใใฌใผใใณใฐ็ฎๆจใฎใในใใ็ตใฟๅใใใฆใใพใใ
+
+GPT-2ใฎๅพใ่จ่ชใขใใซใฏใใใซๅคงใใๆ้ทใใไปใงใฏ*ๅคง่ฆๆจก่จ่ชใขใใซ๏ผLLM๏ผ*ใจใใฆ็ฅใใใฆใใพใใๅคง่ฆๆจกใชใใผใฟใปใใใงไบๅใใฌใผใใณใฐใใใใฐใLLMใฏใปใผใผใญใทใงใใๅญฆ็ฟใ็คบใใใจใใใใพใใ[GPT-J](model_doc/gptj)ใฏใ6BใฎใใฉใกใผใฟใๆใคLLMใงใ400BใฎใใผใฏใณใงใใฌใผใใณใฐใใใฆใใพใใGPT-Jใซใฏ[OPT](model_doc/opt)ใ็ถใใใใฎใใกๆๅคงใฎใขใใซใฏ175Bใงใ180Bใฎใใผใฏใณใงใใฌใผใใณใฐใใใฆใใพใใๅใๆๆใซ[BLOOM](model_doc/bloom)ใใชใชใผในใใใใใฎใใกใใชใผใฎๆๅคงใฎใขใใซใฏ176Bใฎใใฉใกใผใฟใๆใกใ46ใฎ่จ่ชใจ13ใฎใใญใฐใฉใใณใฐ่จ่ชใง366Bใฎใใผใฏใณใงใใฌใผใใณใฐใใใฆใใพใใ
+
+### Encoder-decoder[[nlp-encoder-decoder]]
+
+[BART](model_doc/bart)ใฏใๅ
ใฎTransformerใขใผใญใใฏใใฃใไฟๆใใฆใใพใใใไบๅใใฌใผใใณใฐ็ฎๆจใ*ใใญในใ่ฃๅฎ*ใฎ็ ดๆใซๅคๆดใใฆใใพใใไธ้จใฎใใญในใในใใณใฏๅไธใฎ`mask`ใใผใฏใณใง็ฝฎๆใใใพใใใใณใผใใผใฏ็ ดๆใใฆใใชใใใผใฏใณใไบๆธฌใ๏ผๆชๆฅใฎใใผใฏใณใฏใในใฏใใใพใ๏ผใใจใณใณใผใใผใฎ้ ใใ็ถๆ
ใไฝฟ็จใใฆไบๆธฌใ่ฃๅฉใใพใใ[Pegasus](model_doc/pegasus)ใฏBARTใซไผผใฆใใพใใใPegasusใฏใใญในใในใใณใฎไปฃใใใซๆๅ
จไฝใใในใฏใใพใใใในใฏใใใ่จ่ชใขใใชใณใฐใซๅ ใใฆใPegasusใฏใฎใฃใใๆ็ๆ๏ผGSG๏ผใซใใฃใฆไบๅใใฌใผใใณใฐใใใฆใใพใใGSGใฎ็ฎๆจใฏใๆๆธใซ้่ฆใชๆใใในใฏใใใใใใ`mask`ใใผใฏใณใง็ฝฎๆใใใใจใงใใใใณใผใใผใฏๆฎใใฎๆใใๅบๅใ็ๆใใชใใใฐใชใใพใใใ[T5](model_doc/t5)ใฏใใในใฆใฎNLPใฟในใฏใ็นๅฎใฎใใฌใใฃใใฏในใไฝฟ็จใใฆใใญในใๅฏพใใญในใใฎๅ้กใซๅคๆใใใใใฆใใผใฏใชใขใใซใงใใใใจใใฐใใใฌใใฃใใฏใน`Summarize:`ใฏ่ฆ็ดใฟในใฏใ็คบใใพใใT5ใฏๆๅธซใใใใฌใผใใณใฐ๏ผGLUEใจSuperGLUE๏ผใจ่ชๅทฑๆๅธซใใใใฌใผใใณใฐ๏ผใใผใฏใณใฎ15๏ผ
ใใฉใณใใ ใซใตใณใใซใใใญใใใขใฆใ๏ผใซใใฃใฆไบๅใใฌใผใใณใฐใใใฆใใพใใ
+
+
+## Audio
+
+
+
+### Encoder[[audio-encoder]]
+
+[Wav2Vec2](model_doc/wav2vec2) ใฏใ็ใฎใชใผใใฃใชๆณขๅฝขใใ็ดๆฅ้ณๅฃฐ่กจ็พใๅญฆ็ฟใใใใใฎTransformerใจใณใณใผใใผใไฝฟ็จใใพใใใใใฏใๅฏพ็
ง็ใชใฟในใฏใงไบๅๅญฆ็ฟใใใไธ้ฃใฎๅฝใฎ่กจ็พใใ็ใฎ้ณๅฃฐ่กจ็พใ็นๅฎใใพใใ [HuBERT](model_doc/hubert) ใฏWav2Vec2ใซไผผใฆใใพใใใ็ฐใชใใใฌใผใใณใฐใใญใปในใๆใฃใฆใใพใใใฟใผใฒใใใฉใใซใฏใ้กไผผใใใชใผใใฃใชใปใฐใกใณใใใฏใฉในใฟใซๅฒใๅฝใฆใใใใใใ้ ใใฆใใใใซใชใใฏใฉในใฟใชใณใฐในใใใใซใใฃใฆไฝๆใใใพใใ้ ใใฆใใใใฏๅใ่พผใฟใซใใใใใใไบๆธฌใ่กใใพใใ
+
+### Encoder-decoder[[audio-encoder-decoder]]
+
+[Speech2Text](model_doc/speech_to_text) ใฏใ่ชๅ้ณๅฃฐ่ช่ญ๏ผASR๏ผใใใณ้ณๅฃฐ็ฟป่จณใฎใใใซ่จญ่จใใใ้ณๅฃฐใขใใซใงใใใใฎใขใใซใฏใใชใผใใฃใชๆณขๅฝขใใๆฝๅบใใใใญใฐใกใซใใฃใซใฟใผใใณใฏใใฃใผใใฃใผใๅใๅ
ฅใใไบๅใใฌใผใใณใฐใใใ่ชๅทฑๅๅธฐ็ใซใใฉใณในใฏใชใใใพใใฏ็ฟป่จณใ็ๆใใพใใ [Whisper](model_doc/whisper) ใASRใขใใซใงใใใไปใฎๅคใใฎ้ณๅฃฐใขใใซใจใฏ็ฐใชใใโจ ใฉใใซไปใ โจ ใชใผใใฃใชใใฉใณในใฏใชใใทใงใณใใผใฟใๅคง้ใซไบๅใซๅญฆ็ฟใใฆใใผใญใทใงใใใใใฉใผใใณในใๅฎ็พใใพใใใใผใฟใปใใใฎๅคง้จๅใซใฏ้่ฑ่ชใฎ่จ่ชใๅซใพใใฆใใใWhisperใฏไฝใชใฝใผใน่จ่ชใซใไฝฟ็จใงใใพใใๆง้ ็ใซใฏใWhisperใฏSpeech2Textใซไผผใฆใใพใใใชใผใใฃใชไฟกๅทใฏใจใณใณใผใใผใซใใฃใฆใจใณใณใผใใใใใญใฐใกใซในใใฏใใญใฐใฉใ ใซๅคๆใใใพใใใใณใผใใผใฏใจใณใณใผใใผใฎ้ ใ็ถๆ
ใจๅใฎใใผใฏใณใใใใฉใณในใฏใชใใใ่ชๅทฑๅๅธฐ็ใซ็ๆใใพใใ
+
+## Multimodal
+
+
+
+### Encoder[[mm-encoder]]
+
+[VisualBERT](model_doc/visual_bert) ใฏใBERTใฎๅพใซใชใชใผในใใใใใธใงใณ่จ่ชใฟในใฏๅใใฎใใซใใขใผใใซใขใใซใงใใใใใฏBERTใจไบๅใใฌใผใใณใฐใใใ็ฉไฝๆคๅบใทในใใ ใ็ตใฟๅใใใ็ปๅ็นๅพดใใใธใฅใขใซๅใ่พผใฟใซๆฝๅบใใใใญในใๅใ่พผใฟใจไธ็ทใซBERTใซๆธกใใพใใVisualBERTใฏ้ใในใฏใใญในใใๅบใซใใใในใฏใใญในใใไบๆธฌใใใใญในใใ็ปๅใจๆดๅใใฆใใใใฉใใใไบๆธฌใใๅฟ
่ฆใใใใพใใViTใใชใชใผในใใใ้ใ[ViLT](model_doc/vilt) ใฏ็ปๅๅใ่พผใฟใๅๅพใใใใใซใใฎๆนๆณใๆก็จใใพใใใ็ปๅๅใ่พผใฟใฏใใญในใๅใ่พผใฟใจๅ
ฑใซๅ
ฑๅใงๅฆ็ใใใพใใใใใใใViLTใฏ็ปๅใใญในใใใใใณใฐใใในใฏ่จ่ชใขใใชใณใฐใใใใณๅ
จๅ่ชใในใญใณใฐใซใใไบๅใใฌใผใใณใฐใ่กใใใพใใ
+
+[CLIP](model_doc/clip) ใฏ็ฐใชใใขใใญใผใใๅใใ(`็ปๅ`ใ`ใใญในใ`) ใฎใใขไบๆธฌใ่กใใพใใ็ปๅใจใณใณใผใใผ๏ผViT๏ผใจใใญในใใจใณใณใผใใผ๏ผTransformer๏ผใฏใ(`็ปๅ`ใ`ใใญในใ`) ใใขใใผใฟใปใใไธใงๅ
ฑๅใใฌใผใใณใฐใใใ(`็ปๅ`ใ`ใใญในใ`) ใใขใฎ็ปๅใจใใญในใใฎๅใ่พผใฟใฎ้กไผผๆงใๆๅคงๅใใพใใไบๅใใฌใผใใณใฐๅพใCLIPใไฝฟ็จใใฆ็ปๅใใใใญในใใไบๆธฌใใใใใใฎ้ใ่กใใใจใใงใใพใใ[OWL-ViT](model_doc/owlvit) ใฏใใผใญใทใงใใ็ฉไฝๆคๅบใฎใใใฏใใผใณใจใใฆCLIPใไฝฟ็จใใฆใใพใใไบๅใใฌใผใใณใฐๅพใ็ฉไฝๆคๅบใใใใ่ฟฝๅ ใใใ(`ใฏใฉใน`ใ`ใใฆใณใใฃใณใฐใใใฏใน`) ใใขใซๅฏพใใใปใใไบๆธฌใ่กใใใพใใ
+
+### Encoder-decoder[[mm-encoder-decoder]]
+
+ๅ
ๅญฆๆๅญ่ช่ญ๏ผOCR๏ผใฏใ้ๅธธใ็ปๅใ็่งฃใใใญในใใ็ๆใใใใใซ่คๆฐใฎใณใณใใผใใณใใ้ขไธใใใใญในใ่ช่ญใฟในใฏใงใใ [TrOCR](model_doc/trocr) ใฏใใจใณใใใผใจใณใใฎTransformerใไฝฟ็จใใฆใใฎใใญใปในใ็ฐก็ฅๅใใพใใใจใณใณใผใใผใฏ็ปๅใๅบๅฎใตใคใบใฎใใใใจใใฆๅฆ็ใใใใใฎViTในใฟใคใซใฎใขใใซใงใใใใใณใผใใผใฏใจใณใณใผใใผใฎ้ ใ็ถๆ
ใๅใๅ
ฅใใใใญในใใ่ชๅทฑๅๅธฐ็ใซ็ๆใใพใใ[Donut](model_doc/donut) ใฏOCRใใผในใฎใขใใญใผใใซไพๅญใใชใใใไธ่ฌ็ใชใใธใฅใขใซใใญใฅใกใณใ็่งฃใขใใซใงใใจใณใณใผใใผใจใใฆSwin Transformerใใใณใผใใผใจใใฆๅค่จ่ชBARTใไฝฟ็จใใพใใ Donutใฏ็ปๅใจใใญในใใฎๆณจ้ใซๅบใฅใใฆๆฌกใฎๅ่ชใไบๆธฌใใใใจใซใใใใใญในใใ่ชญใใใใซไบๅใใฌใผใใณใฐใใใพใใใใณใผใใผใฏใใญใณใใใไธใใใใใใผใฏใณใทใผใฑใณในใ็ๆใใพใใใใญใณใใใฏๅใใฆใณในใใชใผใ ใฟในใฏใใจใซ็นๅฅใชใใผใฏใณใไฝฟ็จใใฆ่กจ็พใใใพใใไพใใฐใใใญใฅใกใณใใฎ่งฃๆใซใฏ`่งฃๆ`ใใผใฏใณใใใใใจใณใณใผใใผใฎ้ ใ็ถๆ
ใจ็ตใฟๅใใใใฆใใญใฅใกใณใใๆง้ ๅใใใๅบๅใใฉใผใใใ๏ผJSON๏ผใซ่งฃๆใใพใใ
+
+## Reinforcement learning
+
+
+
+### Decoder[[rl-decoder]]
+
+ๆๆๆฑบๅฎใจ่ป่ทกใใฉใณในใใฉใผใใผใฏใ็ถๆ
ใใขใฏใทใงใณใๅ ฑ้
ฌใใทใผใฑใณในใขใใชใณใฐใฎๅ้กใจใใฆๆใใพใใ [Decision Transformer](model_doc/decision_transformer) ใฏใใชใฟใผใณใปใใฅใปใดใผใ้ๅปใฎ็ถๆ
ใใใใณใขใฏใทใงใณใซๅบใฅใใฆๅฐๆฅใฎๅธๆใชใฟใผใณใซใคใชใใใขใฏใทใงใณใฎ็ณปๅใ็ๆใใพใใๆๅพใฎ *K* ใฟใคใ ในใใใใงใฏใ3ใคใฎใขใใชใใฃใใใใใใใผใฏใณๅใ่พผใฟใซๅคๆใใใๅฐๆฅใฎใขใฏใทใงใณใใผใฏใณใไบๆธฌใใใใใซGPTใฎใใใชใขใใซใซใใฃใฆๅฆ็ใใใพใใ[Trajectory Transformer](model_doc/trajectory_transformer) ใ็ถๆ
ใใขใฏใทใงใณใๅ ฑ้
ฌใใใผใฏใณๅใใGPTใขใผใญใใฏใใฃใงๅฆ็ใใพใใๅ ฑ้
ฌ่ชฟๆดใซ็ฆ็นใๅฝใฆใDecision Transformerใจใฏ็ฐใชใใTrajectory Transformerใฏใใผใ ใตใผใใไฝฟ็จใใฆๅฐๆฅใฎใขใฏใทใงใณใ็ๆใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/multilingual.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/multilingual.md
new file mode 100644
index 0000000000000000000000000000000000000000..39524195f88810e018e29398ad78f65f518522f2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/multilingual.md
@@ -0,0 +1,178 @@
+
+
+# ๆจ่ซใฎใใใฎๅค่จ่ชใขใใซ
+
+[[open-in-colab]]
+
+๐ค Transformers ใซใฏใใใคใใฎๅค่จ่ชใขใใซใใใใใใใใฎๆจ่ซใฎไฝฟ็จๆนๆณใฏๅไธ่จ่ชใขใใซใจใฏ็ฐใชใใพใใใใ ใใๅค่จ่ชใขใใซใฎไฝฟ็จๆนๆณใใในใฆ็ฐใชใใใใงใฏใใใพใใใ [google-bert/bert-base-multilingual-uncased](https://huggingface.co/google-bert/bert-base-multilingual-uncased) ใชใฉใฎไธ้จใฎใขใใซใฏใๅไธ่จ่ชใขใใซใจๅๆงใซไฝฟ็จใงใใพใใ ใใฎใฌใคใใงใฏใๆจ่ซใฎใใใซไฝฟ็จๆนๆณใ็ฐใชใๅค่จ่ชใขใใซใใฉใฎใใใซไฝฟใใใ็คบใใพใใ
+
+## XLM
+
+XLM ใซใฏ10ใฎ็ฐใชใใใงใใฏใใคใณใใใใใใใฎใใกใฎ1ใคใ ใใๅไธ่จ่ชใงใใ ๆฎใใฎ9ใคใฎใขใใซใใงใใฏใใคใณใใฏใ่จ่ชๅใ่พผใฟใไฝฟ็จใใใใงใใฏใใคใณใใจไฝฟ็จใใชใใใงใใฏใใคใณใใฎ2ใคใฎใซใใดใชใซๅใใใใจใใงใใพใใ
+
+### ่จ่ชใฎๅใ่พผใฟใใใ XLM
+
+ๆฌกใฎ XLM ใขใใซใฏใ่จ่ชใฎๅใ่พผใฟใไฝฟ็จใใฆใๆจ่ซใงไฝฟ็จใใใ่จ่ชใๆๅฎใใพใใ
+
+- `FacebookAI/xlm-mlm-ende-1024` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใ่ฑ่ช-ใใคใ่ช)
+- `FacebookAI/xlm-mlm-enfr-1024` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใ่ฑ่ช-ใใฉใณใน่ช)
+- `FacebookAI/xlm-mlm-enro-1024` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใ่ฑ่ช-ใซใผใใใข่ช)
+- `FacebookAI/xlm-mlm-xnli15-1024` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใXNLI ่จ่ช)
+- `FacebookAI/xlm-mlm-tlm-xnli15-1024` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐ + ็ฟป่จณ + XNLI ่จ่ช)
+- `FacebookAI/xlm-clm-enfr-1024` (ๅ ๆ่จ่ชใขใใชใณใฐใ่ฑ่ช-ใใฉใณใน่ช)
+- `FacebookAI/xlm-clm-ende-1024` (ๅ ๆ่จ่ชใขใใชใณใฐใ่ฑ่ช-ใใคใ่ช)
+
+่จ่ชใฎๅใ่พผใฟใฏใใขใใซใซๆธกใใใ `input_ids` ใจๅใๅฝข็ถใฎใใณใฝใซใจใใฆ่กจใใใพใใ ใใใใฎใใณใฝใซใฎๅคใฏใไฝฟ็จใใใ่จ่ชใซไพๅญใใใใผใฏใใคใถใผใฎ `lang2id` ใใใณ `id2lang` ๅฑๆงใซใใฃใฆ่ญๅฅใใใพใใ
+
+ใใฎไพใงใฏใ`FacebookAI/xlm-clm-enfr-1024` ใใงใใฏใใคใณใใใญใผใใใพใ (ๅ ๆ่จ่ชใขใใชใณใฐใ่ฑ่ช-ใใฉใณใน่ช)ใ
+
+```py
+>>> import torch
+>>> from transformers import XLMTokenizer, XLMWithLMHeadModel
+
+>>> tokenizer = XLMTokenizer.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+>>> model = XLMWithLMHeadModel.from_pretrained("FacebookAI/xlm-clm-enfr-1024")
+```
+
+ใใผใฏใใคใถใผใฎ `lang2id` ๅฑๆงใฏใใใฎใขใใซใฎ่จ่ชใจใใฎ ID ใ่กจ็คบใใพใใ
+
+```py
+>>> print(tokenizer.lang2id)
+{'en': 0, 'fr': 1}
+```
+
+ๆฌกใซใๅ
ฅๅไพใไฝๆใใพใใ
+
+```py
+>>> input_ids = torch.tensor([tokenizer.encode("Wikipedia was used to")]) # batch size of 1
+```
+
+่จ่ช ID ใ `en` ใซ่จญๅฎใใใใใไฝฟ็จใใฆ่จ่ชใฎๅใ่พผใฟใๅฎ็พฉใใพใใ ่จ่ชใฎๅใ่พผใฟใฏใ่ฑ่ชใฎ่จ่ช ID ใงใใใใใ`0` ใงๅใใใใใใณใฝใซใงใใ ใใฎใใณใฝใซใฏ `input_ids` ใจๅใใตใคใบใซใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> language_id = tokenizer.lang2id["en"] # 0
+>>> langs = torch.tensor([language_id] * input_ids.shape[1]) # torch.tensor([0, 0, 0, ..., 0])
+
+>>> # We reshape it to be of size (batch_size, sequence_length)
+>>> langs = langs.view(1, -1) # is now of shape [1, sequence_length] (we have a batch size of 1)
+```
+
+ใใใงใ`input_ids` ใจ่จ่ชใฎๅใ่พผใฟใใขใใซใซๆธกใใใจใใงใใพใใ
+
+```py
+>>> outputs = model(input_ids, langs=langs)
+```
+
+[run_generation.py](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation/run_generation.py) ในใฏใชใใใฏใ`xlm-clm` ใใงใใฏใใคใณใใไฝฟ็จใใฆใ่จ่ชใๅใ่พผใพใใใใญในใใ็ๆใงใใพใใ
+
+### ่จ่ชใฎๅใ่พผใฟใใชใXLM
+
+ๆฌกใฎ XLM ใขใใซใฏใๆจ่ซไธญใซ่จ่ชใฎๅใ่พผใฟใๅฟ
่ฆใจใใพใใใ
+
+- `FacebookAI/xlm-mlm-17-1280` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใ17ใฎ่จ่ช)
+- `FacebookAI/xlm-mlm-100-1280` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใ100ใฎ่จ่ช)
+
+ใใใใฎใขใใซใฏใไปฅๅใฎ XLM ใใงใใฏใใคใณใใจใฏ็ฐใชใใไธ่ฌ็ใชๆใฎ่กจ็พใซไฝฟ็จใใใพใใ
+
+## BERT
+
+ไปฅไธใฎ BERT ใขใใซใฏใๅค่จ่ชใฟในใฏใซไฝฟ็จใงใใพใใ
+
+- `google-bert/bert-base-multilingual-uncased` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐ + ๆฌกใฎๆใฎไบๆธฌใ102ใฎ่จ่ช)
+- `google-bert/bert-base-multilingual-cased` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐ + ๆฌกใฎๆใฎไบๆธฌใ104ใฎ่จ่ช)
+
+ใใใใฎใขใใซใฏใๆจ่ซไธญใซ่จ่ชใฎๅใ่พผใฟใๅฟ
่ฆใจใใพใใใ ๆ่ใใ่จ่ชใ่ญๅฅใใใใใซๅฟใใฆๆจๆธฌใใๅฟ
่ฆใใใใพใใ
+
+## XLM-RoBERTa
+
+ๆฌกใฎ XLM-RoBERTa ใขใใซใฏใๅค่จ่ชใฟในใฏใซไฝฟ็จใงใใพใใ
+
+- `FacebookAI/xlm-roberta-base` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใ100ใฎ่จ่ช)
+- `FacebookAI/xlm-roberta-large` (ใในใฏๅใใใ่จ่ชใขใใชใณใฐใ100ใฎ่จ่ช)
+
+XLM-RoBERTa ใฏใ100ใฎ่จ่ชใงๆฐใใไฝๆใใใณใฏใชใผใใณใฐใใใ2.5 TB ใฎ CommonCrawl ใใผใฟใงใใฌใผใใณใฐใใใพใใใ ใใใฏใๅ้กใใทใผใฑใณในใฎใฉใใซไปใใ่ณชๅๅฟ็ญใชใฉใฎใใฆใณในใใชใผใ ใฟในใฏใงใmBERT ใ XLM ใชใฉใฎไปฅๅใซใชใชใผในใใใๅค่จ่ชใขใใซใๅคงๅน
ใซๆนๅใใพใใ
+
+## M2M100
+
+ๆฌกใฎ M2M100 ใขใใซใฏใๅค่จ่ช็ฟป่จณใซไฝฟ็จใงใใพใใ
+
+- `facebook/m2m100_418M` (็ฟป่จณ)
+- `facebook/m2m100_1.2B` (็ฟป่จณ)
+
+ใใฎไพใงใฏใ`facebook/m2m100_418M` ใใงใใฏใใคใณใใใญใผใใใฆใไธญๅฝ่ชใใ่ฑ่ชใซ็ฟป่จณใใพใใ ใใผใฏใใคใถใผใงใฝใผใน่จ่ชใ่จญๅฎใงใใพใใ
+
+```py
+>>> from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> chinese_text = "ไธ่ฆๆๆๅทซๅธซ็ไบๅ, ๅ ็บไปๅๆฏๅพฎๅฆ็, ๅพๅฟซๅฐฑๆ็ผๆ."
+
+>>> tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M", src_lang="zh")
+>>> model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
+```
+
+ใใญในใใใใผใฏใณๅใใพใใ
+
+```py
+>>> encoded_zh = tokenizer(chinese_text, return_tensors="pt")
+```
+
+M2M100 ใฏใๆๅใซ็ๆใใใใใผใฏใณใจใใฆใฟใผใฒใใ่จ่ช ID ใๅผทๅถ็ใซใฟใผใฒใใ่จ่ชใซ็ฟป่จณใใพใใ ่ฑ่ชใซ็ฟป่จณใใใซใฏใ`generate` ใกใฝใใใง `forced_bos_token_id` ใ `en` ใซ่จญๅฎใใพใใ
+
+```py
+>>> generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id("en"))
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+'Do not interfere with the matters of the witches, because they are delicate and will soon be angry.'
+```
+
+## MBart
+
+ๅค่จ่ช็ฟป่จณใซใฏใๆฌกใฎ MBart ใขใใซใไฝฟ็จใงใใพใใ
+
+- `facebook/mbart-large-50-one-to-many-mmt` (One-to-many multilingual machine translation, 50 languages)
+- `facebook/mbart-large-50-many-to-many-mmt` (Many-to-many multilingual machine translation, 50 languages)
+- `facebook/mbart-large-50-many-to-one-mmt` (Many-to-one multilingual machine translation, 50 languages)
+- `facebook/mbart-large-50` (Multilingual translation, 50 languages)
+- `facebook/mbart-large-cc25`
+
+ใใฎไพใงใฏใ`facebook/mbart-large-50-many-to-many-mmt` ใใงใใฏใใคใณใใใญใผใใใฆใใใฃใณใฉใณใ่ชใ่ฑ่ชใซ็ฟป่จณใใพใใใใผใฏใใคใถใผใงใฝใผใน่จ่ชใ่จญๅฎใงใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+>>> en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
+>>> fi_text = "รlรค sekaannu velhojen asioihin, sillรค ne ovat hienovaraisia ja nopeasti vihaisia."
+
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/mbart-large-50-many-to-many-mmt", src_lang="fi_FI")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")
+```
+
+ใใญในใใใใผใฏใณๅใใพใใ
+
+```py
+>>> encoded_en = tokenizer(en_text, return_tensors="pt")
+```
+
+MBart ใฏใๆๅใซ็ๆใใใใใผใฏใณใจใใฆใฟใผใฒใใ่จ่ช ID ใๅผทๅถ็ใซใฟใผใฒใใ่จ่ชใซ็ฟป่จณใใพใใ ่ฑ่ชใซ็ฟป่จณใใใซใฏใ`generate` ใกใฝใใใง `forced_bos_token_id` ใ `en` ใซ่จญๅฎใใพใใ
+
+```py
+>>> generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id("en_XX"))
+>>> tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)
+"Don't interfere with the wizard's affairs, because they are subtle, will soon get angry."
+```
+
+`facebook/mbart-large-50-many-to-one-mmt` ใใงใใฏใใคใณใใไฝฟ็จใใฆใใๅ ดๅใๆๅใซ็ๆใใใใใผใฏใณใจใใฆใฟใผใฒใใ่จ่ช ID ใๅผทๅถใใๅฟ
่ฆใฏใใใพใใใใใไปฅๅคใฎๅ ดๅใไฝฟ็จๆนๆณใฏๅใใงใใ
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pad_truncation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pad_truncation.md
new file mode 100644
index 0000000000000000000000000000000000000000..4da23fd82e0f49d3cba205d49bbbc76d8ea28e32
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pad_truncation.md
@@ -0,0 +1,63 @@
+
+
+# Padding and truncation
+
+ใใใๅ
ฅๅใฏใใฐใใฐ็ฐใชใ้ทใใงใใใๅบๅฎใตใคใบใฎใใณใฝใซใซๅคๆใงใใชใใใใๅคๅใใ้ทใใฎใใใใใ้ทๆนๅฝขใฎใใณใฝใซใไฝๆใใใใใฎๆฆ็ฅใจใใฆใใใใฃใณใฐใจๅใ่ฉฐใใใใใพใใใใใฃใณใฐใฏใ็ญใใทใผใฑใณในใใใใๅ
ใฎๆ้ทใทใผใฑใณในใพใใฏใขใใซใๅใๅ
ฅใใๆๅคง้ทใจๅใ้ทใใซใชใใใใซใ็นๅฅใช**ใใใฃใณใฐใใผใฏใณ**ใ่ฟฝๅ ใใพใใๅใ่ฉฐใใฏใ้ทใใทใผใฑใณในใๅใ่ฉฐใใใใจใง้ๆนๅใซๆฉ่ฝใใพใใ
+
+ใปใจใใฉใฎๅ ดๅใใใใใๆ้ทใทใผใฑใณในใฎ้ทใใซใใใฃใณใฐใใใขใใซใๅใๅ
ฅใใๆๅคง้ทใซๅใ่ฉฐใใใใจใงใใใพใๅไฝใใพใใใใ ใใAPIใฏใใไปฅไธใฎๆฆ็ฅใใตใใผใใใฆใใพใใๅฟ
่ฆใช3ใคใฎๅผๆฐใฏๆฌกใฎใจใใใงใ๏ผ`padding`ใ`truncation`ใใใใณ `max_length`ใ
+
+`padding`ๅผๆฐใฏใใใฃใณใฐใๅถๅพกใใพใใใใผใซๅคใพใใฏๆๅญๅใงใใใใจใใงใใพใ๏ผ
+
+ - `True`ใพใใฏ`'longest'`๏ผใใใๅ
ใฎๆ้ทใทใผใฑใณในใซใใใฃใณใฐใ่ฟฝๅ ใใพใ๏ผใทใผใฑใณในใ1ใคใใๆไพใใใชใๅ ดๅใใใใฃใณใฐใฏ้ฉ็จใใใพใใ๏ผใ
+ - `max_length'`๏ผ`max_length`ๅผๆฐใงๆๅฎใใใ้ทใใพใงใใใฃใณใฐใ่ฟฝๅ ใใพใใใพใใฏ`max_length`ใๆไพใใใฆใใชใๅ ดๅใฏใขใใซใๅใๅ
ฅใใๆๅคง้ท๏ผ`max_length=None`๏ผใใทใผใฑใณในใ1ใคใใๆไพใใใฆใใๅ ดๅใงใใใใใฃใณใฐใฏ้ฉ็จใใใพใใ
+ - `False`ใพใใฏ`'do_not_pad'`๏ผใใใฃใณใฐใฏ้ฉ็จใใใพใใใใใใใใใฉใซใใฎๅไฝใงใใ
+
+`truncation`ๅผๆฐใฏๅใ่ฉฐใใๅถๅพกใใพใใใใผใซๅคใพใใฏๆๅญๅใงใใใใจใใงใใพใ๏ผ
+
+ - `True`ใพใใฏ`'longest_first'`๏ผๆๅคง้ทใ`max_length`ๅผๆฐใงๆๅฎใใใใใขใใซใๅใๅ
ฅใใๆๅคง้ท๏ผ`max_length=None`๏ผใพใงๅใ่ฉฐใใพใใใใใฏใใผใฏใณใใจใซๅใ่ฉฐใใ้ฉๅใช้ทใใซ้ใใใพใงใใขๅ
ใฎๆ้ทใทใผใฑใณในใใใใผใฏใณใๅ้คใใพใใ
+ - `'only_second'`๏ผๆๅคง้ทใ`max_length`ๅผๆฐใงๆๅฎใใใใใขใใซใๅใๅ
ฅใใๆๅคง้ท๏ผ`max_length=None`๏ผใพใงๅใ่ฉฐใใพใใใใใฏใใขใฎ2็ช็ฎใฎๆใ ใใๅใ่ฉฐใใพใ๏ผใทใผใฑใณในใฎใใขใพใใฏใทใผใฑใณในใฎใใใใฎใใขใๆไพใใใๅ ดๅ๏ผใ
+ - `'only_first'`๏ผๆๅคง้ทใ`max_length`ๅผๆฐใงๆๅฎใใใใใขใใซใๅใๅ
ฅใใๆๅคง้ท๏ผ`max_length=None`๏ผใพใงๅใ่ฉฐใใพใใใใใฏใใขใฎๆๅใฎๆใ ใใๅใ่ฉฐใใพใ๏ผใทใผใฑใณในใฎใใขใพใใฏใทใผใฑใณในใฎใใใใฎใใขใๆไพใใใๅ ดๅ๏ผใ
+ - `False`ใพใใฏ`'do_not_truncate'`๏ผๅใ่ฉฐใใฏ้ฉ็จใใใพใใใใใใใใใฉใซใใฎๅไฝใงใใ
+
+`max_length`ๅผๆฐใฏใใใฃใณใฐใจๅใ่ฉฐใใฎ้ทใใๅถๅพกใใพใใๆดๆฐใพใใฏ`None`ใงใใใใใฎๅ ดๅใใขใใซใๅใๅ
ฅใใๆๅคงๅ
ฅๅ้ทใซใใใฉใซใใง่จญๅฎใใใพใใใขใใซใซ็นๅฎใฎๆๅคงๅ
ฅๅ้ทใใชใๅ ดๅใ`max_length`ใธใฎๅใ่ฉฐใใพใใฏใใใฃใณใฐใฏ็กๅนใซใชใใพใใ
+
+ไปฅไธใฎ่กจใฏใใใใฃใณใฐใจๅใ่ฉฐใใ่จญๅฎใใๆจๅฅจๆนๆณใ่ฆ็ดใใฆใใพใใไปฅไธใฎไพใฎใใใใใงๅ
ฅๅใทใผใฑใณในใฎใใขใไฝฟ็จใใๅ ดๅใ`truncation=True`ใ`['only_first', 'only_second', 'longest_first']`ใง้ธๆใใ`STRATEGY`ใซ็ฝฎใๆใใใใจใใงใใพใใใคใพใใ`truncation='only_second'`ใพใใฏ`truncation='longest_first'`ใไฝฟ็จใใฆใใใขๅ
ใฎไธกๆนใฎใทใผใฑใณในใๅ่ฟฐใฎใใใซๅใ่ฉฐใใๆนๆณใๅถๅพกใงใใพใใ
+
+
+
+| Truncation | Padding | Instruction |
+|--------------------------------------|-----------------------------------|---------------------------------------------------------------------------------------------|
+| no truncation | no padding | `tokenizer(batch_sentences)` |
+| | padding to max sequence in batch | `tokenizer(batch_sentences, padding=True)` or |
+| | | `tokenizer(batch_sentences, padding='longest')` |
+| | padding to max model input length | `tokenizer(batch_sentences, padding='max_length')` |
+| | padding to specific length | `tokenizer(batch_sentences, padding='max_length', max_length=42)` |
+| | padding to a multiple of a value | `tokenizer(batch_sentences, padding=True, pad_to_multiple_of=8)` |
+| truncation to max model input length | no padding | `tokenizer(batch_sentences, truncation=True)` or |
+| | | `tokenizer(batch_sentences, truncation=STRATEGY)` |
+| | padding to max sequence in batch | `tokenizer(batch_sentences, padding=True, truncation=True)` or |
+| | | `tokenizer(batch_sentences, padding=True, truncation=STRATEGY)` |
+| | padding to max model input length | `tokenizer(batch_sentences, padding='max_length', truncation=True)` or |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=STRATEGY)` |
+| | padding to specific length | Not possible |
+| truncation to specific length | no padding | `tokenizer(batch_sentences, truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, truncation=STRATEGY, max_length=42)` |
+| | padding to max sequence in batch | `tokenizer(batch_sentences, padding=True, truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, padding=True, truncation=STRATEGY, max_length=42)` |
+| | padding to max model input length | Not possible |
+| | padding to specific length | `tokenizer(batch_sentences, padding='max_length', truncation=True, max_length=42)` or |
+| | | `tokenizer(batch_sentences, padding='max_length', truncation=STRATEGY, max_length=42)` |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/peft.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/peft.md
new file mode 100644
index 0000000000000000000000000000000000000000..c3d195adbd97d777021911cdd382fff98f7fa00a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/peft.md
@@ -0,0 +1,214 @@
+
+
+
+# Load adapters with ๐ค PEFT
+
+[[open-in-colab]]
+
+[Parameter-Efficient Fine Tuning (PEFT)](https://huggingface.co/blog/peft) ใกใฝใใใฏใไบๅๅญฆ็ฟๆธใฟใขใใซใฎใใฉใกใผใฟใใใกใคใณใใฅใผใใณใฐไธญใซๅ็ตใใใใฎไธใซใใใใช่จ็ทดๅฏ่ฝใชใใฉใกใผใฟ๏ผใขใใใฟใผ๏ผใ่ฟฝๅ ใใใขใใญใผใใงใใใขใใใฟใผใฏใใฟในใฏๅบๆใฎๆ
ๅ ฑใๅญฆ็ฟใใใใใซ่จ็ทดใใใพใใใใฎใขใใญใผใใฏใใกใขใชไฝฟ็จ้ใๅฐใชใใๅฎๅ
จใซใใกใคใณใใฅใผใใณใฐใใใใขใใซใจๆฏ่ผใใฆ่จ็ฎใชใฝใผในใไฝใๆใใคใคใๅ็ญใฎ็ตๆใ็ๆใใใใจใ็คบใใใฆใใพใใ
+
+PEFTใง่จ็ทดใใใใขใใใฟใผใฏ้ๅธธใๅฎๅ
จใชใขใใซใฎใตใคใบใใใ1ๆกๅฐใใใๅ
ฑๆใไฟๅญใ่ชญใฟ่พผใใฎใไพฟๅฉใงใใ
+
+
+
+
Hubใซๆ ผ็ดใใใฆใใOPTForCausalLMใขใใซใฎใขใใใฟใผ้ใฟใฏใใขใใซใฎๅ
จไฝใตใคใบใฎ็ด6MBใงใใขใใซ้ใฟใฎๅ
จใตใคใบใฏ็ด700MBใงใใ
+
+
+๐ค PEFTใฉใคใใฉใชใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใฏใ[ใใญใฅใกใณใใผใทใงใณ](https://huggingface.co/docs/peft/index)ใใ่ฆงใใ ใใใ
+
+## Setup
+
+๐ค PEFTใใคใณในใใผใซใใฆๅงใใพใใใ๏ผ
+
+
+```bash
+pip install peft
+```
+
+ๆฐๆฉ่ฝใ่ฉฆใใฆใฟใใๅ ดๅใใฝใผในใใใฉใคใใฉใชใใคใณในใใผใซใใใใจใซ่ๅณใใใใใใใใพใใ๏ผ
+
+```bash
+pip install git+https://github.com/huggingface/peft.git
+```
+
+## Supported PEFT models
+
+๐ค TransformersใฏใใใใคใใฎPEFT๏ผParameter Efficient Fine-Tuning๏ผใกใฝใใใใใคใใฃใใซใตใใผใใใฆใใใใญใผใซใซใพใใฏHubใซๆ ผ็ดใใใใขใใใฟใผใฆใงใคใใ็ฐกๅใซ่ชญใฟ่พผใใงๅฎ่กใพใใฏใใฌใผใใณใฐใงใใพใใไปฅไธใฎใกใฝใใใใตใใผใใใใฆใใพใ๏ผ
+
+- [Low Rank Adapters](https://huggingface.co/docs/peft/conceptual_guides/lora)
+- [IA3](https://huggingface.co/docs/peft/conceptual_guides/ia3)
+- [AdaLoRA](https://arxiv.org/abs/2303.10512)
+
+ไปใฎPEFTใกใฝใใใไฝฟ็จใใใๅ ดๅใใใญใณใใๅญฆ็ฟใใใญใณใใ่ชฟๆดใชใฉใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใใพใใฏ๐ค PEFTใฉใคใใฉใชๅ
จ่ฌใซใคใใฆใฏใ[ใใญใฅใกใณใใผใทใงใณ](https://huggingface.co/docs/peft/index)ใๅ็
งใใฆใใ ใใใ
+
+
+## Load a PEFT adapter
+
+๐ค TransformersใใPEFTใขใใใฟใผใขใใซใ่ชญใฟ่พผใใงไฝฟ็จใใใซใฏใHubใชใใธใใชใพใใฏใญใผใซใซใใฃใฌใฏใใชใซ `adapter_config.json` ใใกใคใซใจใขใใใฟใผใฆใงใคใใๅซใพใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใๆฌกใซใ`AutoModelFor` ใฏใฉในใไฝฟ็จใใฆPEFTใขใใใฟใผใขใใซใ่ชญใฟ่พผใใใจใใงใใพใใใใจใใฐใๅ ๆ่จ่ชใขใใชใณใฐ็จใฎPEFTใขใใใฟใผใขใใซใ่ชญใฟ่พผใใซใฏ๏ผ
+
+1. PEFTใขใใซใฎIDใๆๅฎใใพใใ
+2. ใใใ[`AutoModelForCausalLM`] ใฏใฉในใซๆธกใใพใใ
+
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+peft_model_id = "ybelkada/opt-350m-lora"
+model = AutoModelForCausalLM.from_pretrained(peft_model_id)
+```
+
+
+
+PEFTใขใใใฟใผใ`AutoModelFor`ใฏใฉในใพใใฏๅบๆฌใขใใซใฏใฉใน๏ผ`OPTForCausalLM`ใพใใฏ`LlamaForCausalLM`ใชใฉ๏ผใง่ชญใฟ่พผใใใจใใงใใพใใ
+
+
+
+ใพใใ`load_adapter`ใกใฝใใใๅผใณๅบใใใจใงใPEFTใขใใใฟใผใ่ชญใฟ่พผใใใจใใงใใพใ๏ผ
+
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+model_id = "facebook/opt-350m"
+peft_model_id = "ybelkada/opt-350m-lora"
+
+model = AutoModelForCausalLM.from_pretrained(model_id)
+model.load_adapter(peft_model_id)
+```
+
+## Load in 8bit or 4bit
+
+
+`bitsandbytes` ็ตฑๅใฏใ8ใใใใใใณ4ใใใใฎ็ฒพๅบฆใใผใฟๅใใตใใผใใใฆใใใๅคง่ฆๆจกใชใขใใซใ่ชญใฟ่พผใ้ใซใกใขใชใ็ฏ็ดใใใฎใซๅฝน็ซใกใพใ๏ผ่ฉณ็ดฐใซใคใใฆใฏ `bitsandbytes` ็ตฑๅใฎ[ใฌใคใ](./quantization#bitsandbytes-integration)ใๅ็
งใใฆใใ ใใ๏ผใ[`~PreTrainedModel.from_pretrained`] ใซ `load_in_8bit` ใพใใฏ `load_in_4bit` ใใฉใกใผใฟใ่ฟฝๅ ใใ`device_map="auto"` ใ่จญๅฎใใฆใขใใซใๅนๆ็ใซใใผใใฆใงใขใซๅๆฃ้
็ฝฎใงใใพใ๏ผ
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+peft_model_id = "ybelkada/opt-350m-lora"
+model = AutoModelForCausalLM.from_pretrained(peft_model_id, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+
+## Add a new adapter
+
+ๆขๅญใฎใขใใใฟใผใๆใคใขใใซใซๆฐใใใขใใใฟใผใ่ฟฝๅ ใใใใใซ [`~peft.PeftModel.add_adapter`] ใไฝฟ็จใงใใพใใใใ ใใๆฐใใใขใใใฟใผใฏ็พๅจใฎใขใใใฟใผใจๅใใฟใคใใงใใ้ใใใใใ่กใใใจใใงใใพใใใใจใใฐใใขใใซใซๆขๅญใฎ LoRA ใขใใใฟใผใใขใฟใใใใใฆใใๅ ดๅ๏ผ
+
+
+```py
+from transformers import AutoModelForCausalLM, OPTForCausalLM, AutoTokenizer
+from peft import PeftConfig
+
+model_id = "facebook/opt-350m"
+model = AutoModelForCausalLM.from_pretrained(model_id)
+
+lora_config = LoraConfig(
+ target_modules=["q_proj", "k_proj"],
+ init_lora_weights=False
+)
+
+model.add_adapter(lora_config, adapter_name="adapter_1")
+```
+
+ๆฐใใใขใใใฟใ่ฟฝๅ ใใใซใฏ:
+
+
+```py
+# attach new adapter with same config
+model.add_adapter(lora_config, adapter_name="adapter_2")
+```
+
+[`~peft.PeftModel.set_adapter`] ใไฝฟ็จใใฆใใฉใฎใขใใใฟใผใไฝฟ็จใใใใ่จญๅฎใงใใพใ๏ผ
+
+
+```py
+# use adapter_1
+model.set_adapter("adapter_1")
+output = model.generate(**inputs)
+print(tokenizer.decode(output_disabled[0], skip_special_tokens=True))
+
+# use adapter_2
+model.set_adapter("adapter_2")
+output_enabled = model.generate(**inputs)
+print(tokenizer.decode(output_enabled[0], skip_special_tokens=True))
+```
+
+## Enable and disable adapters
+
+ใขใใซใซใขใใใฟใผใ่ฟฝๅ ใใใใใขใใใฟใผใขใธใฅใผใซใๆๅนใพใใฏ็กๅนใซใใใใจใใงใใพใใใขใใใฟใผใขใธใฅใผใซใๆๅนใซใใใซใฏใๆฌกใฎๆ้ ใๅฎ่กใใพใ๏ผ
+
+```py
+from transformers import AutoModelForCausalLM, OPTForCausalLM, AutoTokenizer
+from peft import PeftConfig
+
+model_id = "facebook/opt-350m"
+adapter_model_id = "ybelkada/opt-350m-lora"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+text = "Hello"
+inputs = tokenizer(text, return_tensors="pt")
+
+model = AutoModelForCausalLM.from_pretrained(model_id)
+peft_config = PeftConfig.from_pretrained(adapter_model_id)
+
+# to initiate with random weights
+peft_config.init_lora_weights = False
+
+model.add_adapter(peft_config)
+model.enable_adapters()
+output = model.generate(**inputs)
+```
+
+ใขใใใฟใผใขใธใฅใผใซใ็กๅนใซใใใซใฏ๏ผ
+
+```py
+model.disable_adapters()
+output = model.generate(**inputs)
+```
+
+## Train a PEFT adapter
+
+PEFTใขใใใฟใผใฏ[`Trainer`]ใฏใฉในใงใตใใผใใใใฆใใใ็นๅฎใฎใฆใผในใฑใผในใซๅฏพใใฆใขใใใฟใผใใใฌใผใใณใฐใใใใจใใงใใพใใๆฐ่กใฎใณใผใใ่ฟฝๅ ใใใ ใใงๆธใฟใพใใใใจใใฐใLoRAใขใใใฟใผใใใฌใผใใณใฐใใๅ ดๅ:
+
+
+
+[`Trainer`]ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ไบๅใใฌใผใใณใฐๆธใฟใขใใซใฎๅพฎ่ชฟๆด](training)ใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+1. ใฟในใฏใฟใคใใจใใคใใผใใฉใกใผใฟใซๅฏพใใใขใใใฟใผใฎๆงๆใๅฎ็พฉใใพใ๏ผใใคใใผใใฉใกใผใฟใฎ่ฉณ็ดฐใซใคใใฆใฏ[`~peft.LoraConfig`]ใๅ็
งใใฆใใ ใใ๏ผใ
+
+
+```py
+from peft import LoraConfig
+
+peft_config = LoraConfig(
+ lora_alpha=16,
+ lora_dropout=0.1,
+ r=64,
+ bias="none",
+ task_type="CAUSAL_LM",
+)
+```
+
+2. ใขใใซใซใขใใใฟใผใ่ฟฝๅ ใใใ
+
+
+```py
+model.add_adapter(peft_config)
+```
+
+3. ใใใงใใขใใซใ [`Trainer`] ใซๆธกใใใจใใงใใพใ๏ผ
+
+```py
+trainer = Trainer(model=model, ...)
+trainer.train()
+```
+
+ไฟๅญใใใใฌใผใใณใฐๆธใฟใขใใใฟใจใใใ่ชญใฟ่พผใใใใฎๆ้ ๏ผ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_hardware.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_hardware.md
new file mode 100644
index 0000000000000000000000000000000000000000..0d104ed3ddb0b366cd979b66d0f507c9a54e43af
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_hardware.md
@@ -0,0 +1,160 @@
+
+
+# Custom hardware for training
+
+ใขใใซใฎใใฌใผใใณใฐใใใณๆจ่ซใซไฝฟ็จใใใใผใใฆใงใขใฏใใใใฉใผใใณในใซๅคงใใชๅฝฑ้ฟใไธใใใใจใใใใพใใGPUใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใฏใTim Dettmerใฎๅชใใ[ใใญใฐ่จไบ](https://timdettmers.com/2020/09/07/which-gpu-for-deep-learning/)ใใใงใใฏใใฆใฟใฆใใ ใใใ
+
+GPUใปใใใขใใใฎๅฎ็จ็ใชใขใใใคในใใใใคใ่ฆใฆใฟใพใใใใ
+
+## GPU
+ใใๅคงใใชใขใใซใใใฌใผใใณใฐใใๅ ดๅใๅบๆฌ็ใซใฏไปฅไธใฎ3ใคใฎใชใใทใงใณใใใใพใ๏ผ
+
+- ใใๅคงใใชGPU
+- ใใๅคใใฎGPU
+- ใใๅคใใฎCPUใใใณNVMe๏ผ[DeepSpeed-Infinity](main_classes/deepspeed#nvme-support)ใซใใใชใใญใผใ๏ผ
+
+ใพใใๅไธใฎGPUใไฝฟ็จใใๅ ดๅใใๅงใใพใใใใ
+
+### Power and Cooling
+
+้ซไพกใชใใคใจใณใGPUใ่ณผๅ
ฅใใๅ ดๅใๆญฃใใ้ปๅไพ็ตฆใจๅๅใชๅทๅดใๆไพใใใใจใ้่ฆใงใใ
+
+**้ปๅ**๏ผ
+
+ไธ้จใฎ้ซ็ดใณใณใทใฅใผใGPUใซใผใใซใฏใ2ใคใพใใฏ3ใคใฎPCI-E 8ใใณ้ปๆบใฝใฑใใใใใใพใใใซใผใใซใใใฝใฑใใใฎๆฐใ ใใ็ฌ็ซใใ12V PCI-E 8ใใณใฑใผใใซใๆฅ็ถใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใๅใใฑใผใใซใฎไธ็ซฏใซใใ2ใคใฎๅๅฒ๏ผใพใใฏใใใฐใใผใซใฑใผใใซใจใใฆใ็ฅใใใฆใใพใ๏ผใไฝฟ็จใใชใใงใใ ใใใใคใพใใGPUใซ2ใคใฎใฝใฑใใใใใๅ ดๅใPSUใใใซใผใใซๅใใฆ2ใคใฎPCI-E 8ใใณใฑใผใใซใไฝฟ็จใใ1ใคใฎใฑใผใใซใฎ็ซฏใซ2ใคใฎPCI-E 8ใใณใณใใฏใฟใใใใใฎใฏไฝฟ็จใใชใใงใใ ใใ๏ผใใใใชใใจใใซใผใใใใฎใใใฉใผใใณในใๅๅใซๅผใๅบใใใจใใงใใพใใใ
+
+ๅPCI-E 8ใใณ้ปๆบใฑใผใใซใฏใPSUๅดใฎ12Vใฌใผใซใซๆฅ็ถใใๅฟ
่ฆใใใใๆๅคงใง150Wใฎ้ปๅใไพ็ตฆใงใใพใใ
+
+ไธ้จใฎใซใผใใฏPCI-E 12ใใณใณใใฏใฟใไฝฟ็จใใใใจใใใใใใใใฏๆๅคงใง500-600Wใฎ้ปๅใไพ็ตฆใงใใพใใ
+
+ไฝไพกๆ ผๅธฏใฎใซใผใใฏ6ใใณใณใใฏใฟใไฝฟ็จใใใใจใใใใๆๅคงใง75Wใฎ้ปๅใไพ็ตฆใใพใใ
+
+ใใใซใใซใผใใๅฟ
่ฆใจใใๅฎๅฎใใ้ปๅงใๆไพใใ้ซๅ่ณชใช้ปๆบใฆใใใ๏ผPSU๏ผใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+ใใกใใใPSUใซใฏใซใผใใ้งๅใใใใใซๅๅใชๆชไฝฟ็จใฎ้ปๅใๅฟ
่ฆใงใใ
+
+**ๅทๅด**๏ผ
+
+GPUใ้็ฑใใใจใในใญใใใชใณใฐใ้ๅงใใใใใซใใใฉใผใใณในใๆไพใใชใใชใใ้็ฑใใใใใจใทใฃใใใใฆใณใใใใจใใใใใพใใ
+
+GPUใ้่ฆใช่ฒ ่ทใฎไธใงใฉใฎใใใชๆธฉๅบฆใ็ฎๆใในใใใๆญฃ็ขบใซ็คบใใใจใฏ้ฃใใใงใใใใใใใ+80โๆชๆบใงใใใฐ่ฏใใงใใใใใใใใใไฝใๆนใ่ฏใใงใ - ใใใใ70-75โใๅชใใ็ฏๅฒใงใใใใในใญใใใชใณใฐใฎ้ๅงๆธฉๅบฆใฏใใใใ84-90โใฎใใใใใใงใใใใในใญใใใชใณใฐใซใใใใใฉใผใใณในใฎไฝไธไปฅๅคใซใใ้ทๆ้ใซใใใ้ๅธธใซ้ซใๆธฉๅบฆใฏGPUใฎๅฏฟๅฝใ็ญ็ธฎใใๅฏ่ฝๆงใใใใพใใ
+
+ๆฌกใซใ่คๆฐใฎGPUใๆใค้ใซๆใ้่ฆใชๅด้ขใฎไธใคใงใใๆฅ็ถใซใคใใฆ่ฉณใใ่ฆใฆใฟใพใใใใ
+
+### Multi-GPU Connectivity
+
+่คๆฐใฎGPUใไฝฟ็จใใๅ ดๅใใซใผใใฎ็ธไบๆฅ็ถๆนๆณใฏใใผใฟใซใฎใใฌใผใใณใฐๆ้ใซๅคงใใชๅฝฑ้ฟใไธใใๅฏ่ฝๆงใใใใพใใGPUใๅใ็ฉ็ใใผใใซใใๅ ดๅใๆฌกใฎใใใซๅฎ่กใงใใพใ๏ผ
+
+
+```bash
+nvidia-smi topo -m
+```
+
+ใใกใใใGPUใใฉใฎใใใซ็ธไบๆฅ็ถใใใฆใใใใซใคใใฆ่ชฌๆใใพใใใใฅใขใซGPUใๆญ่ผใใNVLinkใงๆฅ็ถใใใฆใใใใทใณใงใฏใใใใใไปฅไธใฎใใใชๆ
ๅ ฑใ่กจ็คบใใใใงใใใ๏ผ
+
+```
+ GPU0 GPU1 CPU Affinity NUMA Affinity
+GPU0 X NV2 0-23 N/A
+GPU1 NV2 X 0-23 N/A
+```
+
+ๅฅใฎNVLinkใชใใฎใใทใณใงใฏใไปฅไธใฎใใใช็ถๆณใ็บ็ใใใใใใใพใใ๏ผ
+
+```
+ GPU0 GPU1 CPU Affinity NUMA Affinity
+GPU0 X PHB 0-11 N/A
+GPU1 PHB X 0-11 N/A
+```
+
+ใใกใใไผ่ชฌใงใ๏ผ
+
+```
+ X = Self
+ SYS = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
+ NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
+ PHB = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
+ PXB = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
+ PIX = Connection traversing at most a single PCIe bridge
+ NV# = Connection traversing a bonded set of # NVLinks
+```
+
+ๆๅใฎใฌใใผใใงใใ `NV2` ใงใฏใGPUใฏ2ใคใฎNVLinkใงๆฅ็ถใใใฆใใใ2็ช็ฎใฎใฌใใผใใงใใ `PHB` ใงใฏใๅ
ธๅ็ใชๆถ่ฒป่
ๅใใฎPCIe+Bridgeใปใใใขใใใ่กใใใฆใใพใใ
+
+ใใชใใฎใปใใใขใใใงใฉใฎ็จฎ้กใฎๆฅ็ถๆงใใใใใ็ขบ่ชใใฆใใ ใใใใใใใฎๆฅ็ถๆนๆณใฎใใใคใใฏใซใผใ้ใฎ้ไฟกใ้ใใใใใจใใงใใพใ๏ผไพ๏ผNVLink๏ผใไปใฎใใฎใฏ้
ใใใใใจใใงใใพใ๏ผไพ๏ผPHB๏ผใ
+
+ไฝฟ็จใใใในใฑใผใฉใใชใใฃใฝใชใฅใผใทใงใณใฎ็จฎ้กใซๅฟใใฆใๆฅ็ถ้ๅบฆใฏๅคงใใชๅฝฑ้ฟใไธใใใใจใใๅฐใใชๅฝฑ้ฟใไธใใใใจใใใใพใใGPUใใใพใ้ ป็นใซๅๆใใๅฟ
่ฆใใชใๅ ดๅใDDPใฎใใใซใ้
ใๆฅ็ถใฎๅฝฑ้ฟใฏใใใปใฉ้่ฆใงใฏใใใพใใใใใใใGPUใ้ ป็นใซใกใใปใผใธใ้ไฟกใใๅฟ
่ฆใใใๅ ดๅใZeRO-DPใฎใใใซใ้ซ้ใฎๆฅ็ถใใใ้ซ้ใชใใฌใผใใณใฐใๅฎ็พใใใใใซ้ๅธธใซ้่ฆใซใชใใพใใ
+
+#### NVlink
+
+[NVLink](https://en.wikipedia.org/wiki/NVLink) ใฏใNvidiaใซใใฃใฆ้็บใใใๆ็ทใฎใทใชใขใซใใซใใฌใผใณใฎ่ฟ่ท้ข้ไฟกใชใณใฏใงใใ
+
+ๅๆฐไธไปฃใงใฏใใใ้ซ้ใชๅธฏๅๅน
ใๆไพใใใพใใใใจใใฐใ[Nvidia Ampere GA102 GPU Architecture](https://www.nvidia.com/content/dam/en-zz/Solutions/geforce/ampere/pdf/NVIDIA-ampere-GA102-GPU-Architecture-Whitepaper-V1.pdf) ใใใฎๅผ็จใงใใ
+
+> Third-Generation NVLinkยฎ
+> GA102 GPUs utilize NVIDIAโs third-generation NVLink interface, which includes four x4 links,
+> with each link providing 14.0625 GB/sec bandwidth in each direction between two GPUs. Four
+> links provide 56.25 GB/sec bandwidth in each direction, and 112.5 GB/sec total bandwidth
+> between two GPUs. Two RTX 3090 GPUs can be connected together for SLI using NVLink.
+> (Note that 3-Way and 4-Way SLI configurations are not supported.)
+
+ใใใใฃใฆใ`nvidia-smi topo -m` ใฎๅบๅใฎ `NVX` ใฌใใผใใงๅๅพใใ `X` ใ้ซใใปใฉ่ฏใใงใใไธไปฃใฏใใชใใฎGPUใขใผใญใใฏใใฃใซไพๅญใใพใใ
+
+ๅฐใใชใตใณใใซใฎwikitextใไฝฟ็จใใgpt2่จ่ชใขใใซใฎใใฌใผใใณใฐใฎๅฎ่กใๆฏ่ผใใพใใใใ
+
+็ตๆใฏๆฌกใฎใจใใใงใ๏ผ
+
+๏ผใใใซ็ตๆใๆฟๅ
ฅ๏ผ
+
+ไธ่จใฎใใญในใใฎๆฅๆฌ่ช่จณใๆไพใใพใใใMarkdownใณใผใใจใใฆใใฉใผใใใใใพใใใใฉใใชไปใฎ่ณชๅใใใใฐใใๆฐ่ปฝใซใ็ฅใใใใ ใใ๏ผ
+
+| NVlink | Time |
+| ----- | ---: |
+| Y | 101s |
+| N | 131s |
+
+
+NVLinkใไฝฟ็จใใใจใใใฌใผใใณใฐใ็ด23๏ผ
้ใๅฎไบใใใใจใใใใใพใใ2็ช็ฎใฎใใณใใใผใฏใงใฏใ`NCCL_P2P_DISABLE=1`ใไฝฟ็จใใฆใGPUใNVLinkใไฝฟ็จใใชใใใใซๆ็คบใใฆใใพใใ
+
+ไปฅไธใฏใๅฎๅ
จใชใใณใใใผใฏใณใผใใจๅบๅใงใ๏ผ
+
+
+```bash
+# DDP w/ NVLink
+
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 torchrun \
+--nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py --model_name_or_path openai-community/gpt2 \
+--dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 --do_train \
+--output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 101.9003, 'train_samples_per_second': 1.963, 'epoch': 0.69}
+
+# DDP w/o NVLink
+
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 NCCL_P2P_DISABLE=1 torchrun \
+--nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py --model_name_or_path openai-community/gpt2 \
+--dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 --do_train
+--output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 131.4367, 'train_samples_per_second': 1.522, 'epoch': 0.69}
+```
+
+Hardware: 2x TITAN RTX 24GB each + NVlink with 2 NVLinks (`NV2` in `nvidia-smi topo -m`)
+Software: `pytorch-1.8-to-be` + `cuda-11.0` / `transformers==4.3.0.dev0`
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_cpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_cpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..d23ae65f309f41c044e5df8c93ba4945947d5a28
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_cpu.md
@@ -0,0 +1,74 @@
+
+
+
+# Efficient Inference on CPU
+
+ใใฎใฌใคใใฏใCPUไธใงๅคง่ฆๆจกใชใขใใซใฎๅน็็ใชๆจ่ซใซ็ฆ็นใๅฝใฆใฆใใพใใ
+
+## `BetterTransformer` for faster inference
+
+ๆ่ฟใใใญในใใ็ปๅใใใใณ้ณๅฃฐใขใใซใฎCPUไธใงใฎ้ซ้ใชๆจ่ซใฎใใใซ`BetterTransformer`ใ็ตฑๅใใพใใใ่ฉณ็ดฐใซใคใใฆใฏใใใฎ็ตฑๅใซ้ขใใใใญใฅใกใณใใผใทใงใณใ[ใใกใ](https://huggingface.co/docs/optimum/bettertransformer/overview)ใง็ขบ่ชใใฆใใ ใใใ
+
+## PyTorch JITใขใผใ๏ผTorchScript๏ผ
+TorchScriptใฏใPyTorchใณใผใใใใทใชใขใฉใคใบๅฏ่ฝใงๆ้ฉๅๅฏ่ฝใชใขใใซใไฝๆใใๆนๆณใงใใไปปๆใฎTorchScriptใใญใฐใฉใ ใฏใPythonไพๅญๆงใฎใชใใใญใปในใงไฟๅญใใใณใญใผใใงใใพใใ
+ใใใฉใซใใฎใคใผใฌใผใขใผใใจๆฏ่ผใใฆใPyTorchใฎjitใขใผใใฏ้ๅธธใใชใใฌใผใฟใผใใฅใผใธใงใณใชใฉใฎๆ้ฉๅๆๆณใซใใใขใใซๆจ่ซใฎใใใฉใผใใณในใๅไธใใพใใ
+
+TorchScriptใฎ็ฐกๅใช็ดนไปใซใคใใฆใฏใ[PyTorch TorchScriptใใฅใผใใชใขใซ](https://pytorch.org/tutorials/beginner/Intro_to_TorchScript_tutorial.html#tracing-modules)ใๅ็
งใใฆใใ ใใใ
+
+### JITใขใผใใงใฎIPEXใฐใฉใๆ้ฉๅ
+Intelยฎ Extension for PyTorchใฏใTransformersใทใชใผใบใขใใซใฎjitใขใผใใซใใใชใๆ้ฉๅใๆไพใใพใใIntelยฎ Extension for PyTorchใjitใขใผใใงไฝฟ็จใใใใจใๅผทใใๅงใใใพใใTransformersใขใใซใใใใไฝฟ็จใใใใชใใฌใผใฟใผใใฟใผใณใฎใใใคใใฏใๆขใซIntelยฎ Extension for PyTorchใงjitใขใผใใฎใใฅใผใธใงใณใซๅฏพๅฟใใฆใใพใใใใใใฎใใฅใผใธใงใณใใฟใผใณ๏ผMulti-head-attentionใใฅใผใธใงใณใConcat LinearใLinear+AddใLinear+GeluใAdd+LayerNormใใฅใผใธใงใณใชใฉ๏ผใฏๆๅนใงใใใฉใผใใณในใ่ฏใใงใใใใฅใผใธใงใณใฎๅฉ็นใฏใใฆใผใถใผใซ้้็ใซๆไพใใใพใใๅๆใซใใใฐใๆใไบบๆฐใฎใใ่ณชๅๅฟ็ญใใใญในใๅ้กใใใผใฏใณๅ้กใฎNLPใฟในใฏใฎ็ด70๏ผ
ใใใใใใฎใใฅใผใธใงใณใใฟใผใณใไฝฟ็จใใฆFloat32็ฒพๅบฆใจBFloat16ๆททๅ็ฒพๅบฆใฎไธกๆนใงใใใฉใผใใณในใฎๅฉ็นใๅพใใใจใใงใใพใใ
+
+[IPEXใฐใฉใๆ้ฉๅใฎ่ฉณ็ดฐๆ
ๅ ฑ](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/graph_optimization.html)ใ็ขบ่ชใใฆใใ ใใใ
+
+#### IPEX installation:
+
+IPEXใฎใชใชใผในใฏPyTorchใซๅพใฃใฆใใพใใ[IPEXใฎใคใณในใใผใซๆนๆณ](https://intel.github.io/intel-extension-for-pytorch/)ใ็ขบ่ชใใฆใใ ใใใ
+
+### Usage of JIT-mode
+Trainerใง่ฉไพกใพใใฏไบๆธฌใฎใใใซJITใขใผใใๆๅนใซใใใซใฏใใฆใผใถใผใฏTrainerใณใใณใๅผๆฐใซ`jit_mode_eval`ใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+
+
+
+PyTorch >= 1.14.0ใฎๅ ดๅใjitใขใผใใฏjit.traceใงdictๅ
ฅๅใใตใใผใใใใฆใใใใใไบๆธฌใจ่ฉไพกใซไปปๆใฎใขใใซใซๅฉ็ใใใใใๅฏ่ฝๆงใใใใพใใ
+
+PyTorch < 1.14.0ใฎๅ ดๅใjitใขใผใใฏforwardใใฉใกใผใฟใผใฎ้ ๅบใjit.traceใฎใฟใใซๅ
ฅๅใฎ้ ๅบใจไธ่ดใใใขใใซใซๅฉ็ใใใใใๅฏ่ฝๆงใใใใพใ๏ผ่ณชๅๅฟ็ญใขใใซใชใฉ๏ผใjit.traceใใฟใใซๅ
ฅๅใฎ้ ๅบใจไธ่ดใใชใๅ ดๅใใใญในใๅ้กใขใใซใชใฉใjit.traceใฏๅคฑๆใใใใใใใฉใผใซใใใฏใใใใใใซไพๅคใงใญใฃใใใใฆใใพใใใญใฐใฏใฆใผใถใผใซ้็ฅใใใใใซไฝฟ็จใใใพใใ
+
+
+
+[Transformers่ณชๅๅฟ็ญใฎไฝฟ็จไพ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)ใๅ่ใซใใฆใใ ใใใ
+
+- Inference using jit mode on CPU:
+python run_qa.py \
+--model_name_or_path csarron/bert-base-uncased-squad-v1 \
+--dataset_name squad \
+--do_eval \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/ \
+--no_cuda \
+--jit_mode_eval
+
+- Inference with IPEX using jit mode on CPU:
+python run_qa.py \
+--model_name_or_path csarron/bert-base-uncased-squad-v1 \
+--dataset_name squad \
+--do_eval \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/ \
+--no_cuda \
+--use_ipex \
+--jit_mode_eval
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_gpu_many.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_gpu_many.md
new file mode 100644
index 0000000000000000000000000000000000000000..18a19c849eb2c7536d13303d640d3f1c238c0757
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_gpu_many.md
@@ -0,0 +1,127 @@
+
+
+# Efficient Inference on a Multiple GPUs
+
+ใใฎๆๆธใซใฏใ่คๆฐใฎGPUใงๅน็็ใซๆจ่ซใ่กใๆนๆณใซ้ขใใๆ
ๅ ฑใๅซใพใใฆใใพใใ
+
+
+ๆณจๆ: ่คๆฐใฎGPUใปใใใขใใใฏใ[ๅไธใฎGPUใปใฏใทใงใณ](./perf_infer_gpu_one)ใง่ชฌๆใใใฆใใใปใจใใฉใฎๆฆ็ฅใไฝฟ็จใงใใพใใใใ ใใใใ่ฏใไฝฟ็จๆณใฎใใใซไฝฟ็จใงใใ็ฐกๅใชใใฏใใใฏใซใคใใฆใ่ช่ญใใฆใใๅฟ
่ฆใใใใพใใ
+
+
+
+## Flash Attention 2
+
+Flash Attention 2ใฎ็ตฑๅใฏใ่คๆฐใฎGPUใปใใใขใใใงใๆฉ่ฝใใพใใ่ฉณ็ดฐใซใคใใฆใฏใ[ๅไธใฎGPUใปใฏใทใงใณ](./perf_infer_gpu_one#Flash-Attention-2)ใฎ้ฉๅใชใปใฏใทใงใณใใ่ฆงใใ ใใใ
+
+## BetterTransformer
+
+[BetterTransformer](https://huggingface.co/docs/optimum/bettertransformer/overview)ใฏใ๐ค TransformersใขใใซใPyTorchใใคใใฃใใฎ้ซ้ๅฎ่กใในใไฝฟ็จใใใใใซๅคๆใใใใฎไธใงFlash Attentionใชใฉใฎๆ้ฉๅใใใใซใผใใซใๅผใณๅบใใพใใ
+
+BetterTransformerใฏใใใญในใใ็ปๅใ้ณๅฃฐใขใใซใฎๅไธGPUใใใณ่คๆฐGPUใงใฎ้ซ้ๆจ่ซใใตใใผใใใฆใใพใใ
+
+
+Flash Attentionใฏใfp16ใพใใฏbf16 dtypeใไฝฟ็จใใฆใใใขใใซใซใฎใฟไฝฟ็จใงใใพใใBetterTransformerใไฝฟ็จใใๅใซใใขใใซใ้ฉๅใชdtypeใซใญใฃในใใใฆใใ ใใใ
+
+
+
+### Decoder models
+
+ใใญในใใขใใซใ็นใซใใณใผใใผใใผในใฎใขใใซ๏ผGPTใT5ใLlamaใชใฉ๏ผใฎๅ ดๅใBetterTransformer APIใฏใในใฆใฎๆณจๆๆไฝใ[`torch.nn.functional.scaled_dot_product_attention`ใชใใฌใผใฟใผ](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention)๏ผSDPA๏ผใไฝฟ็จใใใใใซๅคๆใใพใใใใใฏPyTorch 2.0ไปฅ้ใงใฎใฟไฝฟ็จๅฏ่ฝใงใใ
+
+ใขใใซใBetterTransformerใซๅคๆใใใซใฏ๏ผ
+
+```python
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m")
+# convert the model to BetterTransformer
+model.to_bettertransformer()
+
+# Use it for training or inference
+```
+
+SDPAใฏใใใผใใฆใงใขใๅ้กใฎใตใคใบใชใฉใฎ็นๅฎใฎ่จญๅฎใง[Flash Attention](https://arxiv.org/abs/2205.14135)ใซใผใใซใๅผใณๅบใใใจใใงใใพใใFlash Attentionใๆๅนใซใใใใ็นๅฎใฎ่จญๅฎ๏ผใใผใใฆใงใขใๅ้กใฎใตใคใบ๏ผใงๅฉ็จๅฏ่ฝใใ็ขบ่ชใใใซใฏใ[`torch.nn.kernel.sdpa_kernel`](https://pytorch.org/docs/stable/generated/torch.nn.attention.sdpa_kernel.html)ใใณใณใใญในใใใใผใธใฃใจใใฆไฝฟ็จใใพใใ
+
+
+```diff
+import torch
++ from torch.nn.attention import SDPBackend, sdpa_kernel
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m").to("cuda")
+# convert the model to BetterTransformer
+model.to_bettertransformer()
+
+input_text = "Hello my dog is cute and"
+inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
+
++ with sdpa_kernel(SDPBackend.FLASH_ATTENTION):
+ outputs = model.generate(**inputs)
+
+print(tokenizer.decode(outputs[0], skip_special_tokens=True))
+```
+
+ใใใใฌใผในใใใฏใงๆฌกใฎใใใชใจใฉใผใกใใปใผใธใ่กจ็คบใใใๅ ดๅ๏ผ
+
+
+```bash
+RuntimeError: No available kernel. Aborting execution.
+```
+
+ๅฝๆฅใFlash Attentionใฎใซใใฌใใธใๅบ็ฏๅฒใงใใๅฏ่ฝๆงใใใPyTorch Nightlyใใผใธใงใณใ่ฉฆใใใใซใๅงใใใพใใ
+
+```bash
+pip3 install -U --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118
+```
+
+[ใใฎใใญใฐๆ็จฟ](https://pytorch.org/blog/out-of-the-box-acceleration/)ใใใงใใฏใใฆใBetterTransformer + SDPA APIใงๅฏ่ฝใชใใจใซใคใใฆ่ฉณใใๅญฆใณใพใใใใ
+
+### Encoder Models
+
+ๆจ่ซไธญใฎใจใณใณใผใใผใขใใซใงใฏใBetterTransformerใฏใจใณใณใผใใผใฌใคใคใผใฎforwardๅผใณๅบใใใใจใณใณใผใใผใฌใคใคใผใฎ[`torch.nn.TransformerEncoderLayer`](https://pytorch.org/docs/stable/generated/torch.nn.TransformerEncoderLayer.html)ใฎ็ธๅฝใใใใฎใซใใฃในใใใใใพใใใใใซใใใใจใณใณใผใใผใฌใคใคใผใฎ้ซ้ๅฎ่ฃ
ใๅฎ่กใใใพใใ
+
+`torch.nn.TransformerEncoderLayer`ใฎ้ซ้ๅฎ่ฃ
ใฏใใฌใผใใณใฐใใตใใผใใใฆใใชใใใใไปฃใใใซ`torch.nn.functional.scaled_dot_product_attention`ใซใใฃในใใใใใใพใใใใใซใใใใในใใใใใใณใฝใซใๆดป็จใใชใFlash AttentionใพใใฏMemory-Efficient Attentionใฎ่ๅใซใผใใซใไฝฟ็จใงใใพใใ
+
+BetterTransformerใฎใใใฉใผใใณในใฎ่ฉณ็ดฐใซใคใใฆใฏใใใฎ[ใใญใฐๆ็จฟ](https://medium.com/pytorch/bettertransformer-out-of-the-box-performance-for-huggingface-transformers-3fbe27d50ab2)ใใ่ฆงใใใ ใใพใใใพใใใจใณใณใผใใผใขใใซ็จใฎBetterTransformerใซใคใใฆใฏใใใฎ[ใใญใฐ](https://pytorch.org/blog/a-better-transformer-for-fast-transformer-encoder-inference/)ใง่ฉณใใๅญฆใถใใจใใงใใพใใ
+
+
+## Advanced usage: mixing FP4 (or Int8) and BetterTransformer
+
+ใขใใซใฎๆ่ฏใฎใใใฉใผใใณในใๅพใใใใซใไธ่จใง่ชฌๆใใ็ฐใชใๆนๆณใ็ตใฟๅใใใใใจใใงใใพใใไพใใฐใFP4ใใใฏในใใฌใทใธใงใณๆจ่ซ+Flash Attentionใไฝฟ็จใใBetterTransformerใ็ตใฟๅใใใใใจใใงใใพใใ
+
+
+```py
+import torch
+from torch.nn.attention import SDPBackend, sdpa_kernel
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_compute_dtype=torch.float16
+)
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", quantization_config=quantization_config)
+
+input_text = "Hello my dog is cute and"
+inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+with sdpa_kernel(SDPBackend.FLASH_ATTENTION):
+ outputs = model.generate(**inputs)
+
+print(tokenizer.decode(outputs[0], skip_special_tokens=True))
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_gpu_one.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_gpu_one.md
new file mode 100644
index 0000000000000000000000000000000000000000..6a3dc5fa64a8527c14dcf1a238b2feb331923d3b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_gpu_one.md
@@ -0,0 +1,443 @@
+
+
+# Efficient Inference on a Single GPU
+
+ใใฎใฌใคใใซๅ ใใฆใ[1ใคใฎGPUใงใฎใใฌใผใใณใฐใฌใคใ](perf_train_gpu_one)ใจ[CPUใงใฎๆจ่ซใฌใคใ](perf_infer_cpu)ใซ้ข้ฃใใๆ
ๅ ฑใใใใพใใ
+
+## Flash Attention 2
+
+
+
+ใใฎๆฉ่ฝใฏๅฎ้จ็ใงใใใๅฐๆฅใฎใใผใธใงใณใงๅคงๅน
ใซๅคๆดใใใๅฏ่ฝๆงใใใใพใใใใจใใฐใFlash Attention 2 APIใฏ่ฟใๅฐๆฅ`BetterTransformer` APIใซ็งป่กใใใใใใใพใใใ
+
+
+
+Flash Attention 2ใฏใใใฉใณในใใฉใผใใผใใผในใฎใขใใซใฎใใฌใผใใณใฐใจๆจ่ซ้ๅบฆใๅคงๅน
ใซ้ซ้ๅใงใใพใใFlash Attention 2ใฏใTri Daoๆฐใซใใฃใฆ[ๅ
ฌๅผใฎFlash Attentionใชใใธใใช](https://github.com/Dao-AILab/flash-attention)ใงๅฐๅ
ฅใใใพใใใFlash Attentionใซ้ขใใ็งๅญฆ่ซๆใฏ[ใใกใ](https://arxiv.org/abs/2205.14135)ใง่ฆใใใจใใงใใพใใ
+
+Flash Attention 2ใๆญฃใใใคใณในใใผใซใใใซใฏใไธ่จใฎใชใใธใใชใซ่จ่ผใใใฆใใใคใณในใใผใซใฌใคใใซๅพใฃใฆใใ ใใใ
+
+ไปฅไธใฎใขใใซใซๅฏพใใฆFlash Attention 2ใใใคใใฃใใตใใผใใใฆใใพใ๏ผ
+
+- Llama
+- Falcon
+
+ใใใซๅคใใฎใขใใซใซFlash Attention 2ใฎใตใใผใใ่ฟฝๅ ใใใใจใGitHubใงๆๆกใใใใจใใงใใๅคๆดใ็ตฑๅใใใใใซใใซใชใฏใจในใใ้ใใใจใใงใใพใใใตใใผใใใใฆใใใขใใซใฏใใใใฃใณใฐใใผใฏใณใไฝฟ็จใใฆใใฌใผใใณใฐใๅซใใๆจ่ซใจใใฌใผใใณใฐใซไฝฟ็จใงใใพใ๏ผ็พๅจใฎ`BetterTransformer` APIใงใฏใตใใผใใใใฆใใชใ๏ผใ
+
+
+
+Flash Attention 2ใฏใใขใใซใฎdtypeใ`fp16`ใพใใฏ`bf16`ใฎๅ ดๅใซใฎใฟไฝฟ็จใงใใNVIDIA-GPUใใใคในใงใฎใฟๅฎ่กใใใพใใใใฎๆฉ่ฝใไฝฟ็จใใๅใซใใขใใซใ้ฉๅใชdtypeใซใญใฃในใใใใตใใผใใใใฆใใใใใคในใซใญใผใใใฆใใ ใใใ
+
+
+
+### Quick usage
+
+ใขใใซใงFlash Attention 2ใๆๅนใซใใใซใฏใ`from_pretrained`ใฎๅผๆฐใซ`attn_implementation="flash_attention_2"`ใ่ฟฝๅ ใใพใใ
+
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM
+
+model_id = "tiiuae/falcon-7b"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ torch_dtype=torch.bfloat16,
+ attn_implementation="flash_attention_2",
+)
+```
+
+ใใกใใฏใ็ๆใพใใฏๅพฎ่ชฟๆดใฎใใใซไฝฟ็จใใใใญในใใงใใ
+
+### Expected speedups
+
+็นใซ้ทใใทใผใฑใณในใซๅฏพใใฆใๅพฎ่ชฟๆดใจๆจ่ซใฎ้ใซใฏใใใชใใฎ้ซ้ๅใๆๅพ
ใงใใพใใใใ ใใFlash Attentionใฏใใใฃใณใฐใใผใฏใณใไฝฟ็จใใฆใขใใณใทใงใณในใณใขใ่จ็ฎใใชใใใใใทใผใฑใณในใซใใใฃใณใฐใใผใฏใณใๅซใพใใๅ ดๅใใใใๆจ่ซใซใใใฆใขใใณใทใงใณในใณใขใๆๅใงใใใ/ใขใณใใใใใๅฟ
่ฆใใใใใใใฃใณใฐใใผใฏใณใๅซใใใใ็ๆใฎๅคงๅน
ใช้
ๅปถใ็บ็ใใพใใ
+
+ใใใๅ
ๆใใใใใซใใใฌใผใใณใฐไธญใซใทใผใฑใณในใซใใใฃใณใฐใใผใฏใณใไฝฟ็จใใใซFlash Attentionใไฝฟ็จใใๅฟ
่ฆใใใใพใ๏ผใใจใใฐใใใผใฟใปใใใใใใฏใใใใจใซใใใใทใผใฑใณในใๆๅคงใทใผใฑใณใน้ทใซ้ใใใพใง้ฃ็ตใใใใจใชใฉ๏ผใใใใซ[ไพ](https://github.com/huggingface/transformers/blob/main/examples/pytorch/language-modeling/run_clm.py#L516)ใๆไพใใใฆใใพใใ
+
+ไปฅไธใฏใใใใฃใณใฐใใผใฏใณใฎใชใๅ ดๅใซใใทใผใฑใณใน้ทใ4096ใฎ[tiiuae/falcon-7b](https://hf.co/tiiuae/falcon-7b)ใซๅฏพใใๅ็ดใชใใฉใฏใผใใในใฎไบๆณใใใ้ซ้ๅใงใใใใพใใพใชใใใใตใคใบใ็คบใใใฆใใพใ๏ผ
+
+
+
+
+
+ไปฅไธใฏใใใใฃใณใฐใใผใฏใณใฎใชใๅ ดๅใซใใทใผใฑใณใน้ทใ4096ใฎ[`meta-llama/Llama-7b-hf`](https://hf.co/meta-llama/Llama-7b-hf)ใซๅฏพใใๅ็ดใชใใฉใฏใผใใในใฎไบๆณใใใ้ซ้ๅใงใใใใพใใพใชใใใใตใคใบใ็คบใใใฆใใพใ๏ผ
+
+
+
+
+
+ใใใฃใณใฐใใผใฏใณใๅซใใทใผใฑใณใน๏ผใใใฃใณใฐใใผใฏใณใไฝฟ็จใใฆใใฌใผใใณใฐใพใใฏ็ๆใใ๏ผใฎๅ ดๅใใขใใณใทใงใณในใณใขใๆญฃใใ่จ็ฎใใใใใซๅ
ฅๅใทใผใฑใณในใใขใณใใใ/ใใใใใๅฟ
่ฆใใใใพใใๆฏ่ผ็ๅฐใใใทใผใฑใณใน้ทใฎๅ ดๅใ็ด็ฒใชใใฉใฏใผใใในใงใฏใใใฃใณใฐใใผใฏใณใ30%ๆชๆบใใๅใใใใฆใใชใใใใใใใฏใใใใช้ซ้ๅใใใใใใพใใ
+
+
+
+
+
+ใใใใๅคงใใชใทใผใฑใณใน้ทใฎๅ ดๅใ็ด็ฒใชๆจ่ซ๏ผใใฌใผใใณใฐใๅซใ๏ผใซใฏ่ๅณๆทฑใ้ซ้ๅใๅพใใใพใใ
+
+Flash Attentionใฏใใขใใณใทใงใณ่จ็ฎใใใใกใขใชๅน็ใฎ่ฏใใใฎใซใใๅคงใใชใทใผใฑใณใน้ทใงใฎCUDA OOMใฎๅ้กใๅ้ฟใงใใใใใซใใพใใๅคงใใชใทใผใฑใณใน้ทใซๅฏพใใฆๆๅคง20ใฎใกใขใชๅๆธใใใใใใใจใใใใพใใ่ฉณ็ดฐใซใคใใฆใฏใ[ๅ
ฌๅผใฎFlash Attentionใชใใธใใช](https://github.com/Dao-AILab/flash-attention)ใใ่ฆงใใ ใใใ
+
+
+
+
+
+
+### Advanced usage
+
+ใใฎๆฉ่ฝใใขใใซใฎๆ้ฉๅใซๅคใใฎๆขๅญใฎๆฉ่ฝใจ็ตใฟๅใใใใใจใใงใใพใใไปฅไธใซใใใคใใฎไพใ็คบใใพใ๏ผ
+
+### Combining Flash Attention 2 and 8-bit models
+
+ใใฎๆฉ่ฝใ8ใใใใฎ้ๅญๅใจ็ตใฟๅใใใใใจใใงใใพใ๏ผ
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM
+
+model_id = "tiiuae/falcon-7b"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ load_in_8bit=True,
+ attn_implementation="flash_attention_2",
+)
+```
+
+### Combining Flash Attention 2 and 4-bit models
+
+ใใฎๆฉ่ฝใ 4 ใใใใฎ้ๅญๅใจ็ตใฟๅใใใใใจใใงใใพใ๏ผ
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM
+
+model_id = "tiiuae/falcon-7b"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ load_in_4bit=True,
+ attn_implementation="flash_attention_2",
+)
+```
+
+### Combining Flash Attention 2 and PEFT
+
+ใใฎๆฉ่ฝใไฝฟ็จใใฆใFlash Attention 2ใใใผในใซใขใใใฟใผใใใฌใผใใณใฐใใ้ใซPEFTใ็ตใฟๅใใใใใจใใงใใพใใ
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer, LlamaForCausalLM
+from peft import LoraConfig
+
+model_id = "tiiuae/falcon-7b"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+
+model = AutoModelForCausalLM.from_pretrained(
+ model_id,
+ load_in_4bit=True,
+ attn_implementation="flash_attention_2",
+)
+
+lora_config = LoraConfig(
+ r=8,
+ task_type="CAUSAL_LM"
+)
+
+model.add_adapter(lora_config)
+
+... # train your model
+```
+
+## BetterTransformer
+
+[BetterTransformer](https://huggingface.co/docs/optimum/bettertransformer/overview)ใฏใ๐ค TransformersใขใใซใPyTorchใใคใใฃใใฎ้ซ้ใในๅฎ่กใซๅคๆใใพใใใใใซใใใFlash Attentionใชใฉใฎๆ้ฉๅใใใใซใผใใซใๅ
้จใงๅผใณๅบใใใพใใ
+
+BetterTransformerใฏใใใญในใใ็ปๅใใใใณใชใผใใฃใชใขใใซใฎๅไธใใใณใใซใGPUใงใฎ้ซ้ใชๆจ่ซใใตใใผใใใฆใใพใใ
+
+
+
+Flash Attentionใฏใfp16ใพใใฏbf16ใฎdtypeใไฝฟ็จใใใขใใซใซใฎใฟไฝฟ็จใงใใพใใBetterTransformerใไฝฟ็จใใๅใซใใขใใซใ้ฉๅใชdtypeใซใญใฃในใใใฆใใ ใใใ
+
+
+
+### Encoder models
+
+PyTorchใใคใใฃใใฎ[`nn.MultiHeadAttention`](https://pytorch.org/blog/a-better-transformer-for-fast-transformer-encoder-inference/)ใขใใณใทใงใณ้ซ้ใในใBetterTransformerใจๅผใฐใใใใฎใฏใ[๐ค Optimumใฉใคใใฉใช](https://huggingface.co/docs/optimum/bettertransformer/overview)ใฎ็ตฑๅใ้ใใฆTransformersใจไธ็ทใซไฝฟ็จใงใใพใใ
+
+PyTorchใฎใขใใณใทใงใณ้ซ้ใในใไฝฟ็จใใใจใใซใผใใซใใฅใผใธใงใณใจ[ใในใใใใใใณใฝใซ](https://pytorch.org/docs/stable/nested.html)ใฎไฝฟ็จใซใใใๆจ่ซใ้ซ้ๅใงใใพใใ่ฉณ็ดฐใชใใณใใใผใฏๆ
ๅ ฑใฏ[ใใฎใใญใฐ่จไบ](https://medium.com/pytorch/bettertransformer-out-of-the-box-performance-for-huggingface-transformers-3fbe27d50ab2)ใซใใใพใใ
+
+[`optimum`](https://github.com/huggingface/optimum)ใใใฑใผใธใใคใณในใใผใซใใๅพใๆจ่ซไธญใซBetter Transformerใไฝฟ็จใใใซใฏใ้ข้ฃใใๅ
้จใขใธใฅใผใซใๅผใณๅบใใใจใง็ฝฎใๆใใๅฟ
่ฆใใใใพใ[`~PreTrainedModel.to_bettertransformer`]:
+
+
+```python
+model = model.to_bettertransformer()
+```
+
+ใกใฝใใ [`~PreTrainedModel.reverse_bettertransformer`] ใฏใใขใใซใไฟๅญใใๅใซไฝฟ็จใในใใงใๆจๆบใฎใใฉใณในใใฉใผใใผใขใใชใณใฐใไฝฟ็จใใใใใฎใใฎใงใ๏ผ
+
+```python
+model = model.reverse_bettertransformer()
+model.save_pretrained("saved_model")
+```
+
+BetterTransformer APIใไฝฟใฃใใจใณใณใผใใผใขใใซใฎๅฏ่ฝๆงใซใคใใฆ่ฉณใใ็ฅใใซใฏใ[ใใฎใใญใฐใในใ](https://medium.com/pytorch/bettertransformer-out-of-the-box-performance-for-huggingface-transformers-3fbe27d50ab2)ใใ่ฆงใใ ใใใ
+
+### Decoder models
+
+ใใญในใใขใใซใ็นใซใใณใผใใผใใผในใฎใขใใซ๏ผGPTใT5ใLlamaใชใฉ๏ผใซใจใฃใฆใBetterTransformer APIใฏใในใฆใฎๆณจๆๆไฝใ[`torch.nn.functional.scaled_dot_product_attention`ใชใใฌใผใฟใผ](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention)๏ผSDPA๏ผใไฝฟ็จใใใใใซๅคๆใใพใใใใฎใชใใฌใผใฟใผใฏPyTorch 2.0ไปฅ้ใงใฎใฟๅฉ็จๅฏ่ฝใงใใ
+
+ใขใใซใBetterTransformerใซๅคๆใใใซใฏใไปฅไธใฎๆ้ ใๅฎ่กใใฆใใ ใใ๏ผ
+
+```python
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m")
+# convert the model to BetterTransformer
+model.to_bettertransformer()
+
+# Use it for training or inference
+```
+
+SDPAใฏใใใผใใฆใงใขใๅ้กใฎใตใคใบใซๅฟใใฆ[Flash Attention](https://arxiv.org/abs/2205.14135)ใซใผใใซใไฝฟ็จใใใใจใใงใใพใใFlash Attentionใๆๅนใซใใใใ็นๅฎใฎ่จญๅฎ๏ผใใผใใฆใงใขใๅ้กใตใคใบ๏ผใงไฝฟ็จๅฏ่ฝใใฉใใใ็ขบ่ชใใใซใฏใ[`torch.nn.attention.sdpa_kernel`](https://pytorch.org/docs/stable/generated/torch.nn.attention.sdpa_kernel.html)ใใณใณใใญในใใใใผใธใฃใจใใฆไฝฟ็จใใพใใ
+
+
+```diff
+import torch
++ from torch.nn.attention import SDPBackend, sdpa_kernel
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", torch_dtype=torch.float16).to("cuda")
+# convert the model to BetterTransformer
+model.to_bettertransformer()
+
+input_text = "Hello my dog is cute and"
+inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
+
++ with sdpa_kernel(SDPBackend.FLASH_ATTENTION):
+ outputs = model.generate(**inputs)
+
+print(tokenizer.decode(outputs[0], skip_special_tokens=True))
+```
+
+ใใใใฌใผในใใใฏใซใใฐใ่กจ็คบใใใๅ ดๅ
+
+```bash
+RuntimeError: No available kernel. Aborting execution.
+```
+
+Flash Attention ใฎๅบ็ฏใชใซใใฌใใธใๆใคใใใใใชใ PyTorch ใฎใใคใใชใผใใผใธใงใณใ่ฉฆใใฆใฟใใใจใใๅงใใใพใใ
+
+```bash
+pip3 install -U --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu118
+```
+
+Or make sure your model is correctly casted in float16 or bfloat16
+
+ใขใใซใๆญฃใใfloat16ใพใใฏbfloat16ใซใญใฃในใใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+Have a look at [this detailed blogpost](https://pytorch.org/blog/out-of-the-box-acceleration/) to read more about what is possible to do with `BetterTransformer` + SDPA API.
+
+`BetterTransformer` + SDPA APIใไฝฟ็จใใฆไฝใๅฏ่ฝใใซใคใใฆ่ฉณใใ่ชญใใซใฏใ[ใใฎ่ฉณ็ดฐใชใใญใฐใในใ](https://pytorch.org/blog/out-of-the-box-acceleration/)ใใ่ฆงใใ ใใใ
+
+## `bitsandbytes` integration for FP4 mixed-precision inference
+
+FP4ๆททๅ็ฒพๅบฆๆจ่ซใฎใใใฎ`bitsandbytes`็ตฑๅ
+
+You can install `bitsandbytes` and benefit from easy model compression on GPUs. Using FP4 quantization you can expect to reduce up to 8x the model size compared to its native full precision version. Check out below how to get started.
+
+`bitsandbytes`ใใคใณในใใผใซใใGPUใง็ฐกๅใชใขใใซใฎๅง็ธฎใๅฉ็จใงใใพใใFP4้ๅญๅใไฝฟ็จใใใจใใใคใใฃใใฎใใซใใฌใทใธใงใณใใผใธใงใณใจๆฏ่ผใใฆใขใใซใตใคใบใๆๅคง8ๅๅๆธใงใใใใจใๆๅพ
ใงใใพใใไปฅไธใ็ขบ่ชใใฆใใฉใฎใใใซๅงใใใใใ่ฆงใใ ใใใ
+
+
+
+Note that this feature can also be used in a multi GPU setup.
+
+ใใฎๆฉ่ฝใฏใใใซใGPUใปใใใขใใใงใไฝฟ็จใงใใใใจใซๆณจๆใใฆใใ ใใใ
+
+
+
+### Requirements [[requirements-for-fp4-mixedprecision-inference]]
+
+- Latest `bitsandbytes` library
+`pip install bitsandbytes>=0.39.0`
+
+- Install latest `accelerate` from source
+`pip install git+https://github.com/huggingface/accelerate.git`
+
+- Install latest `transformers` from source
+`pip install git+https://github.com/huggingface/transformers.git`
+
+
+### Running FP4 models - single GPU setup - Quickstart
+
+ไปฅไธใฎใณใผใใๅฎ่กใใใใจใงใ็ฐกๅใซๅไธใฎGPUใงFP4ใขใใซใๅฎ่กใงใใพใ:
+
+
+```py
+from transformers import AutoModelForCausalLM
+
+model_name = "bigscience/bloom-2b5"
+model_4bit = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_4bit=True)
+```
+
+ๆณจๆ: `device_map`ใฏใชใใทใงใณใงใใใๆจ่ซๆใซ `device_map = 'auto'` ใ่จญๅฎใใใใจใๆจๅฅจใใใฆใใพใใใใใซใใใๅฉ็จๅฏ่ฝใชใชใฝใผในใซๅน็็ใซใขใใซใใใฃในใใใใใใพใใ
+
+### Running FP4 models - multi GPU setup
+
+ๆททๅ4ใใใใขใใซใ่คๆฐใฎGPUใซใญใผใใใๆนๆณใฏใๅไธGPUใปใใใขใใใจๅใใงใ๏ผๅไธGPUใปใใใขใใใจๅใใณใใณใใงใ๏ผ๏ผ
+
+```py
+model_name = "bigscience/bloom-2b5"
+model_4bit = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_4bit=True)
+```
+
+ใใใใ`accelerate`ใไฝฟ็จใใฆใๅGPUใซๅฒใๅฝใฆใGPU RAMใๅถๅพกใใใใจใใงใใพใใไปฅไธใฎใใใซใ`max_memory`ๅผๆฐใไฝฟ็จใใพใ๏ผ
+
+
+```py
+max_memory_mapping = {0: "600MB", 1: "1GB"}
+model_name = "bigscience/bloom-3b"
+model_4bit = AutoModelForCausalLM.from_pretrained(
+ model_name, device_map="auto", load_in_4bit=True, max_memory=max_memory_mapping
+)
+```
+
+ใใฎไพใงใฏใๆๅใฎGPUใฏ600MBใฎใกใขใชใไฝฟ็จใใ2็ช็ฎใฎGPUใฏ1GBใไฝฟ็จใใพใใ
+
+### Advanced usage
+
+ใใฎใกใฝใใใฎใใใชใ้ซๅบฆใชไฝฟ็จๆณใซใคใใฆใฏใ[้ๅญๅ](main_classes/quantization)ใฎใใญใฅใกใณใใผใทใงใณใใผใธใใ่ฆงใใ ใใใ
+
+## `bitsandbytes` integration for Int8 mixed-precision matrix decomposition
+
+
+
+ใใฎๆฉ่ฝใฏใใใซใGPU็ฐๅขใงใไฝฟ็จใงใใพใใ
+
+
+
+่ซๆ[`LLM.int8()๏ผในใฑใผใฉใใซใชTransformerๅใใฎ8ใใใ่กๅไน็ฎ`](https://arxiv.org/abs/2208.07339)ใซใใใฐใHugging Face็ตฑๅใHubๅ
ใฎใในใฆใฎใขใใซใงใใใๆฐ่กใฎใณใผใใงใตใใผใใใใฆใใพใใใใฎใกใฝใใใฏใๅ็ฒพๅบฆ๏ผ`float16`ใใใณ`bfloat16`๏ผใฎ้ใฟใฎๅ ดๅใซ`nn.Linear`ใตใคใบใ2ๅใๅ็ฒพๅบฆ๏ผ`float32`๏ผใฎ้ใฟใฎๅ ดๅใฏ4ๅใซ็ธฎๅฐใใๅคใๅคใซๅฏพใใฆใปใจใใฉๅฝฑ้ฟใไธใใพใใใ
+
+
+
+Int8ๆททๅ็ฒพๅบฆ่กๅๅ่งฃใฏใ่กๅไน็ฎใ2ใคใฎในใใชใผใ ใซๅๅฒใใใใจใซใใฃใฆๅไฝใใพใ๏ผ(1) ใทในใใใใฃใใฏใช็นๅพดๅคใๅคในใใชใผใ ใfp16ใง่กๅไน็ฎ๏ผ0.01%๏ผใ(2) int8่กๅไน็ฎใฎ้ๅธธใฎในใใชใผใ ๏ผ99.9%๏ผใใใฎๆนๆณใไฝฟ็จใใใจใ้ๅธธใซๅคงใใชใขใใซใซๅฏพใใฆไบๆธฌใฎๅฃๅใชใใซint8ๆจ่ซใๅฏ่ฝใงใใ
+ใใฎใกใฝใใใฎ่ฉณ็ดฐใซใคใใฆใฏใ[่ซๆ](https://arxiv.org/abs/2208.07339)ใพใใฏ[ใใฎ็ตฑๅใซ้ขใใใใญใฐ่จไบ](https://huggingface.co/blog/hf-bitsandbytes-integration)ใใ็ขบ่ชใใ ใใใ
+
+
+
+ใชใใใใฎๆฉ่ฝใไฝฟ็จใใใซใฏGPUใๅฟ
่ฆใงใใใใซใผใใซใฏGPUๅฐ็จใซใณใณใใคใซใใใฆใใๅฟ
่ฆใใใใพใใใใฎๆฉ่ฝใไฝฟ็จใใๅใซใใขใใซใฎ1/4๏ผใพใใฏใใผใ็ฒพๅบฆใฎ้ใฟใฎๅ ดๅใฏ1/2๏ผใไฟๅญใใใฎใซๅๅใชGPUใกใขใชใใใใใจใ็ขบ่ชใใฆใใ ใใใ
+ใใฎใขใธใฅใผใซใไฝฟ็จใใ้ใฎใใซใใซ้ขใใ่ฉณ็ดฐใฏใไปฅไธใฎใใผใใใ่ฆงใใใ ใใใ[Google Colabใฎใใข](#colab-demos)ใใ่ฆงใใ ใใใ
+
+### Requirements [[requirements-for-int8-mixedprecision-matrix-decomposition]]
+
+- `bitsandbytes<0.37.0`ใไฝฟ็จใใๅ ดๅใNVIDIA GPUใไฝฟ็จใใฆใใใใจใ็ขบ่ชใใ8ใใใใใณใฝใซใณใขใใตใใผใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใ๏ผTuringใAmpereใใพใใฏใใไปฅ้ใฎใขใผใญใใฏใใฃใผใไพ๏ผT4ใRTX20s RTX30sใA40-A100ใชใฉ๏ผใ`bitsandbytes>=0.37.0`ใฎๅ ดๅใใในใฆใฎGPUใใตใใผใใใใใฏใใงใใ
+- ๆญฃใใใใผใธใงใณใฎ`bitsandbytes`ใใคใณในใใผใซใใใซใฏใๆฌกใฎใณใใณใใๅฎ่กใใฆใใ ใใ๏ผ
+`pip install bitsandbytes>=0.31.5`
+- `accelerate`ใใคใณในใใผใซใใพใ๏ผ
+`pip install accelerate>=0.12.0`
+
+
+### Running mixed-Int8 models - single GPU setup
+
+ๅฟ
่ฆใชใฉใคใใฉใชใใคใณในใใผใซใใๅพใใใใฏใน 8 ใใใใขใใซใ่ชญใฟ่พผใๆนๆณใฏๆฌกใฎ้ใใงใ๏ผ
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+model_name = "bigscience/bloom-2b5"
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+
+ไปฅไธใฏใทใณใใซใชไพใงใ๏ผ
+
+* `pipeline()` ้ขๆฐใฎไปฃใใใซใใขใใซใฎ `generate()` ใกใฝใใใไฝฟ็จใใใใจใใๅงใใใพใใ`pipeline()` ้ขๆฐใไฝฟ็จใใฆๆจ่ซใใใใจใฏๅฏ่ฝใงใใใๆททๅ8ใใใใขใใซใซๆ้ฉๅใใใฆใใใใ`generate()` ใกใฝใใใไฝฟ็จใใใใใ้
ใใชใใพใใใพใใไธ้จใฎใตใณใใชใณใฐๆฆ็ฅ๏ผไพ๏ผใใฏใฌใฆในใตใณใใชใณใฐ๏ผใฏใ`pipeline()` ้ขๆฐใงใฏๆททๅ8ใใใใขใใซใงใฏใตใใผใใใใฆใใพใใใ
+* ใในใฆใฎๅ
ฅๅใใขใใซใจๅใใใใคในใซ้
็ฝฎใใฆใใ ใใใ
+
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+model_name = "bigscience/bloom-2b5"
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+
+prompt = "Hello, my llama is cute"
+inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
+generated_ids = model.generate(**inputs)
+outputs = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
+```
+
+### Running mixed-int8 models - multi GPU setup
+
+่คๆฐใฎGPUใซๆททๅ8ใใใใขใใซใใญใผใใใๆนๆณใฏใๆฌกใฎ้ใใงใ๏ผใทใณใฐใซGPUใปใใใขใใใจๅใใณใใณใใงใ๏ผ๏ผ
+
+```py
+model_name = "bigscience/bloom-2b5"
+model_8bit = AutoModelForCausalLM.from_pretrained(model_name, quantization_config=BitsAndBytesConfig(load_in_8bit=True))
+```
+
+`accelerate`ใไฝฟ็จใใฆๅGPUใซๅฒใๅฝใฆใGPU RAMใๅถๅพกใใ้ใซใฏใไปฅไธใฎใใใซ`max_memory`ๅผๆฐใไฝฟ็จใใพใ๏ผ
+
+
+```py
+max_memory_mapping = {0: "1GB", 1: "2GB"}
+model_name = "bigscience/bloom-3b"
+model_8bit = AutoModelForCausalLM.from_pretrained(
+ model_name, device_map="auto", load_in_8bit=True, max_memory=max_memory_mapping
+)
+```
+
+In this example, the first GPU will use 1GB of memory and the second 2GB.
+
+### Colab demos
+
+ใใฎๆนๆณใไฝฟ็จใใใจใไปฅๅใฎGoogle Colabใงใฏๆจ่ซใงใใชใใฃใใขใใซใซๅฏพใใฆๆจ่ซใ่กใใใจใใงใใพใใไปฅไธใฏใGoogle Colabใง8ใใใ้ๅญๅใไฝฟ็จใใฆT5-11b๏ผfp32ใง42GB๏ผใๅฎ่กใใใใขใฎใชใณใฏใงใ๏ผ
+
+[](https://colab.research.google.com/drive/1YORPWx4okIHXnjW7MSAidXN29mPVNT7F?usp=sharing)
+
+ใพใใBLOOM-3Bใฎใใขใใ่ฆงใใใ ใใพใ๏ผ
+
+[](https://colab.research.google.com/drive/1qOjXfQIAULfKvZqwCen8-MoWKGdSatZ4?usp=sharing)
+
+## Advanced usage: mixing FP4 (or Int8) and BetterTransformer
+
+็ฐใชใๆนๆณใ็ตใฟๅใใใฆใใขใใซใฎๆ้ฉใชใใใฉใผใใณในใๅพใใใจใใงใใพใใไพใใฐใBetterTransformerใไฝฟ็จใใฆFP4ใใใฏในใใฌใทใธใงใณๆจ่ซใจใใฉใใทใฅใขใใณใทใงใณใ็ตใฟๅใใใใใจใใงใใพใใ
+
+
+```py
+import torch
+from torch.nn.attention import SDPBackend, sdpa_kernel
+from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_compute_dtype=torch.float16
+)
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-350m")
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-350m", quantization_config=quantization_config)
+
+input_text = "Hello my dog is cute and"
+inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+with sdpa_kernel(SDPBackend.FLASH_ATTENTION):
+ outputs = model.generate(**inputs)
+
+print(tokenizer.decode(outputs[0], skip_special_tokens=True))
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_special.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_special.md
new file mode 100644
index 0000000000000000000000000000000000000000..a5102590a0504cf20b9bbdc31312c6ff200ec9e7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_infer_special.md
@@ -0,0 +1,18 @@
+
+
+# Inference on Specialized Hardware
+
+ใใกใใฎใใญใฅใกใณใใฏใๅฐ็จใฎใใผใใฆใงใขใงใฎๆจ่ซๆนๆณใซใคใใฆใฎๆ
ๅ ฑใใพใใชใๆไพใใใพใใใใฎ้ใซใCPUใงใฎๆจ่ซใซ้ขใใใฌใคใใใ่ฆงใใใ ใใพใใ[the guide for inference on CPUs](perf_infer_cpu).
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_torch_compile.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_torch_compile.md
new file mode 100644
index 0000000000000000000000000000000000000000..c2cc505b286228c2cdd62a8395b11f79ee3a88f2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_torch_compile.md
@@ -0,0 +1,359 @@
+
+
+# Optimize inference using torch.compile()
+
+ใใฎใฌใคใใฏใ[`torch.compile()`](https://pytorch.org/tutorials/intermediate/torch_compile_tutorial.html) ใไฝฟ็จใใๆจ่ซ้ๅบฆใฎๅไธใซ้ขใใใใณใใใผใฏใๆไพใใใใจใ็ฎ็ใจใใฆใใพใใใใใฏใ[๐ค Transformers ใฎใณใณใใฅใผใฟใใธใงใณใขใใซ](https://huggingface.co/models?pipeline_tag=image-classification&library=transformers&sort=trending)ๅใใฎใใฎใงใใ
+
+## Benefits of torch.compile
+
+`torch.compile()`ใฎๅฉ็น
+ใขใใซใจGPUใซใใฃใฆใฏใtorch.compile()ใฏๆจ่ซๆใซๆๅคง30%ใฎ้ซ้ๅใๅฎ็พใใพใใ `torch.compile()`ใไฝฟ็จใใใซใฏใใใผใธใงใณ2.0ไปฅไธใฎtorchใใคใณในใใผใซใใใ ใใงใใ
+
+ใขใใซใฎใณใณใใคใซใซใฏๆ้ใใใใใใใๆฏๅๆจ่ซใใใฎใงใฏใชใใใขใใซใ1ๅบฆใ ใใณใณใใคใซใใๅ ดๅใซๅฝน็ซใกใพใใ
+ไปปๆใฎใณใณใใฅใผใฟใใธใงใณใขใใซใใณใณใใคใซใใใซใฏใไปฅไธใฎใใใซใขใใซใซ`torch.compile()`ใๅผใณๅบใใพใ๏ผ
+
+```diff
+from transformers import AutoModelForImageClassification
+
+model = AutoModelForImageClassification.from_pretrained(MODEL_ID).to("cuda")
++ model = torch.compile(model)
+```
+
+`compile()` ใฏใใณใณใใคใซใซ้ขใใ็ฐใชใใขใผใใๅใใฆใใใๅบๆฌ็ใซใฏใณใณใใคใซๆ้ใจๆจ่ซใฎใชใผใใผใใใใ็ฐใชใใพใใ`max-autotune` ใฏ `reduce-overhead` ใใใๆ้ใใใใใพใใใๆจ่ซ้ๅบฆใ้ใใชใใพใใใใใฉใซใใขใผใใฏใณใณใใคใซใซใใใฆใฏๆ้ใงใใใๆจ่ซๆ้ใซใใใฆใฏ `reduce-overhead` ใซๆฏในใฆๅน็ใ่ฏใใใใพใใใใใฎใฌใคใใงใฏใใใใฉใซใใขใผใใไฝฟ็จใใพใใใ่ฉณ็ดฐใซใคใใฆใฏใ[ใใกใ](https://pytorch.org/get-started/pytorch-2.0/#user-experience) ใๅ็
งใใฆใใ ใใใ
+
+`torch` ใใผใธใงใณ 2.0.1 ใง็ฐใชใใณใณใใฅใผใฟใใธใงใณใขใใซใใฟในใฏใใใผใใฆใงใขใฎ็จฎ้กใใใใณใใใใตใคใบใไฝฟ็จใใฆ `torch.compile` ใใใณใใใผใฏใใพใใใ
+
+## Benchmarking code
+
+ไปฅไธใซใๅใฟในใฏใฎใใณใใใผใฏใณใผใใ็คบใใพใใๆจ่ซๅใซGPUใใฆใฉใผใ ใขใใใใๆฏๅๅใ็ปๅใไฝฟ็จใใฆ300ๅใฎๆจ่ซใฎๅนณๅๆ้ใๅๅพใใพใใ
+
+### Image Classification with ViT
+
+```python
+from PIL import Image
+import requests
+import numpy as np
+from transformers import AutoImageProcessor, AutoModelForImageClassification
+
+url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
+image = Image.open(requests.get(url, stream=True).raw)
+
+processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+model = AutoModelForImageClassification.from_pretrained("google/vit-base-patch16-224").to("cuda")
+model = torch.compile(model)
+
+processed_input = processor(image, return_tensors='pt').to(device="cuda")
+
+with torch.no_grad():
+ _ = model(**processed_input)
+```
+
+#### Object Detection with DETR
+
+```python
+from transformers import AutoImageProcessor, AutoModelForObjectDetection
+
+processor = AutoImageProcessor.from_pretrained("facebook/detr-resnet-50")
+model = AutoModelForObjectDetection.from_pretrained("facebook/detr-resnet-50").to("cuda")
+model = torch.compile(model)
+
+texts = ["a photo of a cat", "a photo of a dog"]
+inputs = processor(text=texts, images=image, return_tensors="pt").to("cuda")
+
+with torch.no_grad():
+ _ = model(**inputs)
+```
+
+#### Image Segmentation with Segformer
+
+```python
+from transformers import SegformerImageProcessor, SegformerForSemanticSegmentation
+
+processor = SegformerImageProcessor.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512")
+model = SegformerForSemanticSegmentation.from_pretrained("nvidia/segformer-b0-finetuned-ade-512-512").to("cuda")
+model = torch.compile(model)
+seg_inputs = processor(images=image, return_tensors="pt").to("cuda")
+
+with torch.no_grad():
+ _ = model(**seg_inputs)
+```
+
+ไปฅไธใฏใ็งใใกใใใณใใใผใฏใ่กใฃใใขใใซใฎใชในใใงใใ
+
+
+**Image Classification**
+- [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224)
+- [microsoft/beit-base-patch16-224-pt22k-ft22k](https://huggingface.co/microsoft/beit-base-patch16-224-pt22k-ft22k)
+- [facebook/convnext-large-224](https://huggingface.co/facebook/convnext-large-224)
+- [microsoft/resnet-50](https://huggingface.co/)
+
+**Image Segmentation**
+- [nvidia/segformer-b0-finetuned-ade-512-512](https://huggingface.co/nvidia/segformer-b0-finetuned-ade-512-512)
+- [facebook/mask2former-swin-tiny-coco-panoptic](https://huggingface.co/facebook/mask2former-swin-tiny-coco-panoptic)
+- [facebook/maskformer-swin-base-ade](https://huggingface.co/facebook/maskformer-swin-base-ade)
+- [google/deeplabv3_mobilenet_v2_1.0_513](https://huggingface.co/google/deeplabv3_mobilenet_v2_1.0_513)
+
+**Object Detection**
+- [google/owlvit-base-patch32](https://huggingface.co/google/owlvit-base-patch32)
+- [facebook/detr-resnet-101](https://huggingface.co/facebook/detr-resnet-101)
+- [microsoft/conditional-detr-resnet-50](https://huggingface.co/microsoft/conditional-detr-resnet-50)
+
+
+ไปฅไธใฏใ`torch.compile()`ใไฝฟ็จใใๅ ดๅใจไฝฟ็จใใชใๅ ดๅใฎๆจ่ซๆ้ใฎๅฏ่ฆๅใจใ็ฐใชใใใผใใฆใงใขใจใใใใตใคใบใฎๅใขใใซใซๅฏพใใใใใฉใผใใณในๅไธใฎๅฒๅใงใใ
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ไธ่จใฏใๅใขใใซใซใคใใฆ`compile()`ใไฝฟ็จใใๅ ดๅใจไฝฟ็จใใชใใฃใๅ ดๅใฎๆจ่ซๆ้๏ผใใช็งๅไฝ๏ผใงใใใชใใOwlViTใฏๅคงใใชใใใใตใคใบใงใฎไฝฟ็จๆใซใกใขใชไธ่ถณ๏ผOOM๏ผใ็บ็ใใใใจใซๆณจๆใใฆใใ ใใใ
+
+### A100 (batch size: 1)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 9.325 | 7.584 |
+| Image Segmentation/Segformer | 11.759 | 10.500 |
+| Object Detection/OwlViT | 24.978 | 18.420 |
+| Image Classification/BeiT | 11.282 | 8.448 |
+| Object Detection/DETR | 34.619 | 19.040 |
+| Image Classification/ConvNeXT | 10.410 | 10.208 |
+| Image Classification/ResNet | 6.531 | 4.124 |
+| Image Segmentation/Mask2former | 60.188 | 49.117 |
+| Image Segmentation/Maskformer | 75.764 | 59.487 |
+| Image Segmentation/MobileNet | 8.583 | 3.974 |
+| Object Detection/Resnet-101 | 36.276 | 18.197 |
+| Object Detection/Conditional-DETR | 31.219 | 17.993 |
+
+
+### A100 (batch size: 4)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 14.832 | 14.499 |
+| Image Segmentation/Segformer | 18.838 | 16.476 |
+| Image Classification/BeiT | 13.205 | 13.048 |
+| Object Detection/DETR | 48.657 | 32.418|
+| Image Classification/ConvNeXT | 22.940 | 21.631 |
+| Image Classification/ResNet | 6.657 | 4.268 |
+| Image Segmentation/Mask2former | 74.277 | 61.781 |
+| Image Segmentation/Maskformer | 180.700 | 159.116 |
+| Image Segmentation/MobileNet | 14.174 | 8.515 |
+| Object Detection/Resnet-101 | 68.101 | 44.998 |
+| Object Detection/Conditional-DETR | 56.470 | 35.552 |
+
+### A100 (batch size: 16)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 40.944 | 40.010 |
+| Image Segmentation/Segformer | 37.005 | 31.144 |
+| Image Classification/BeiT | 41.854 | 41.048 |
+| Object Detection/DETR | 164.382 | 161.902 |
+| Image Classification/ConvNeXT | 82.258 | 75.561 |
+| Image Classification/ResNet | 7.018 | 5.024 |
+| Image Segmentation/Mask2former | 178.945 | 154.814 |
+| Image Segmentation/Maskformer | 638.570 | 579.826 |
+| Image Segmentation/MobileNet | 51.693 | 30.310 |
+| Object Detection/Resnet-101 | 232.887 | 155.021 |
+| Object Detection/Conditional-DETR | 180.491 | 124.032 |
+
+### V100 (batch size: 1)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 10.495 | 6.00 |
+| Image Segmentation/Segformer | 13.321 | 5.862 |
+| Object Detection/OwlViT | 25.769 | 22.395 |
+| Image Classification/BeiT | 11.347 | 7.234 |
+| Object Detection/DETR | 33.951 | 19.388 |
+| Image Classification/ConvNeXT | 11.623 | 10.412 |
+| Image Classification/ResNet | 6.484 | 3.820 |
+| Image Segmentation/Mask2former | 64.640 | 49.873 |
+| Image Segmentation/Maskformer | 95.532 | 72.207 |
+| Image Segmentation/MobileNet | 9.217 | 4.753 |
+| Object Detection/Resnet-101 | 52.818 | 28.367 |
+| Object Detection/Conditional-DETR | 39.512 | 20.816 |
+
+### V100 (batch size: 4)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 15.181 | 14.501 |
+| Image Segmentation/Segformer | 16.787 | 16.188 |
+| Image Classification/BeiT | 15.171 | 14.753 |
+| Object Detection/DETR | 88.529 | 64.195 |
+| Image Classification/ConvNeXT | 29.574 | 27.085 |
+| Image Classification/ResNet | 6.109 | 4.731 |
+| Image Segmentation/Mask2former | 90.402 | 76.926 |
+| Image Segmentation/Maskformer | 234.261 | 205.456 |
+| Image Segmentation/MobileNet | 24.623 | 14.816 |
+| Object Detection/Resnet-101 | 134.672 | 101.304 |
+| Object Detection/Conditional-DETR | 97.464 | 69.739 |
+
+### V100 (batch size: 16)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 52.209 | 51.633 |
+| Image Segmentation/Segformer | 61.013 | 55.499 |
+| Image Classification/BeiT | 53.938 | 53.581 |
+| Object Detection/DETR | OOM | OOM |
+| Image Classification/ConvNeXT | 109.682 | 100.771 |
+| Image Classification/ResNet | 14.857 | 12.089 |
+| Image Segmentation/Mask2former | 249.605 | 222.801 |
+| Image Segmentation/Maskformer | 831.142 | 743.645 |
+| Image Segmentation/MobileNet | 93.129 | 55.365 |
+| Object Detection/Resnet-101 | 482.425 | 361.843 |
+| Object Detection/Conditional-DETR | 344.661 | 255.298 |
+
+### T4 (batch size: 1)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 16.520 | 15.786 |
+| Image Segmentation/Segformer | 16.116 | 14.205 |
+| Object Detection/OwlViT | 53.634 | 51.105 |
+| Image Classification/BeiT | 16.464 | 15.710 |
+| Object Detection/DETR | 73.100 | 53.99 |
+| Image Classification/ConvNeXT | 32.932 | 30.845 |
+| Image Classification/ResNet | 6.031 | 4.321 |
+| Image Segmentation/Mask2former | 79.192 | 66.815 |
+| Image Segmentation/Maskformer | 200.026 | 188.268 |
+| Image Segmentation/MobileNet | 18.908 | 11.997 |
+| Object Detection/Resnet-101 | 106.622 | 82.566 |
+| Object Detection/Conditional-DETR | 77.594 | 56.984 |
+
+### T4 (batch size: 4)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 43.653 | 43.626 |
+| Image Segmentation/Segformer | 45.327 | 42.445 |
+| Image Classification/BeiT | 52.007 | 51.354 |
+| Object Detection/DETR | 277.850 | 268.003 |
+| Image Classification/ConvNeXT | 119.259 | 105.580 |
+| Image Classification/ResNet | 13.039 | 11.388 |
+| Image Segmentation/Mask2former | 201.540 | 184.670 |
+| Image Segmentation/Maskformer | 764.052 | 711.280 |
+| Image Segmentation/MobileNet | 74.289 | 48.677 |
+| Object Detection/Resnet-101 | 421.859 | 357.614 |
+| Object Detection/Conditional-DETR | 289.002 | 226.945 |
+
+### T4 (batch size: 16)
+
+| **Task/Model** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|
+| Image Classification/ViT | 163.914 | 160.907 |
+| Image Segmentation/Segformer | 192.412 | 163.620 |
+| Image Classification/BeiT | 188.978 | 187.976 |
+| Object Detection/DETR | OOM | OOM |
+| Image Classification/ConvNeXT | 422.886 | 388.078 |
+| Image Classification/ResNet | 44.114 | 37.604 |
+| Image Segmentation/Mask2former | 756.337 | 695.291 |
+| Image Segmentation/Maskformer | 2842.940 | 2656.88 |
+| Image Segmentation/MobileNet | 299.003 | 201.942 |
+| Object Detection/Resnet-101 | 1619.505 | 1262.758 |
+| Object Detection/Conditional-DETR | 1137.513 | 897.390|
+
+## PyTorch Nightly
+ใพใใPyTorchใฎใใคใใชใผใใผใธใงใณ๏ผ2.1.0dev๏ผใงใฎใใณใใใผใฏใ่กใใใณใณใใคใซใใใฆใใชใใขใใซใจใณใณใใคใซๆธใฟใขใใซใฎไธกๆนใงใฌใคใใณใทใผใฎๅไธใ่ฆณๅฏใใพใใใใใคใผใซใฏ[ใใกใ](https://download.pytorch.org/whl/nightly/cu118)ใใๅ
ฅๆใงใใพใใ
+
+
+### A100
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/BeiT | Unbatched | 12.462 | 6.954 |
+| Image Classification/BeiT | 4 | 14.109 | 12.851 |
+| Image Classification/BeiT | 16 | 42.179 | 42.147 |
+| Object Detection/DETR | Unbatched | 30.484 | 15.221 |
+| Object Detection/DETR | 4 | 46.816 | 30.942 |
+| Object Detection/DETR | 16 | 163.749 | 163.706 |
+
+### T4
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/BeiT | Unbatched | 14.408 | 14.052 |
+| Image Classification/BeiT | 4 | 47.381 | 46.604 |
+| Image Classification/BeiT | 16 | 42.179 | 42.147 |
+| Object Detection/DETR | Unbatched | 68.382 | 53.481 |
+| Object Detection/DETR | 4 | 269.615 | 204.785 |
+| Object Detection/DETR | 16 | OOM | OOM |
+
+### V100
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/BeiT | Unbatched | 13.477 | 7.926 |
+| Image Classification/BeiT | 4 | 15.103 | 14.378 |
+| Image Classification/BeiT | 16 | 52.517 | 51.691 |
+| Object Detection/DETR | Unbatched | 28.706 | 19.077 |
+| Object Detection/DETR | 4 | 88.402 | 62.949|
+| Object Detection/DETR | 16 | OOM | OOM |
+
+
+## Reduce Overhead
+NightlyใใซใใงA100ใใใณT4ๅใใฎ `reduce-overhead` ใณใณใใคใซใขใผใใใใณใใใผใฏใใพใใใ
+
+### A100
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/ConvNeXT | Unbatched | 11.758 | 7.335 |
+| Image Classification/ConvNeXT | 4 | 23.171 | 21.490 |
+| Image Classification/ResNet | Unbatched | 7.435 | 3.801 |
+| Image Classification/ResNet | 4 | 7.261 | 2.187 |
+| Object Detection/Conditional-DETR | Unbatched | 32.823 | 11.627 |
+| Object Detection/Conditional-DETR | 4 | 50.622 | 33.831 |
+| Image Segmentation/MobileNet | Unbatched | 9.869 | 4.244 |
+| Image Segmentation/MobileNet | 4 | 14.385 | 7.946 |
+
+
+### T4
+
+| **Task/Model** | **Batch Size** | **torch 2.0 - no compile** | **torch 2.0 - compile** |
+|:---:|:---:|:---:|:---:|
+| Image Classification/ConvNeXT | Unbatched | 32.137 | 31.84 |
+| Image Classification/ConvNeXT | 4 | 120.944 | 110.209 |
+| Image Classification/ResNet | Unbatched | 9.761 | 7.698 |
+| Image Classification/ResNet | 4 | 15.215 | 13.871 |
+| Object Detection/Conditional-DETR | Unbatched | 72.150 | 57.660 |
+| Object Detection/Conditional-DETR | 4 | 301.494 | 247.543 |
+| Image Segmentation/MobileNet | Unbatched | 22.266 | 19.339 |
+| Image Segmentation/MobileNet | 4 | 78.311 | 50.983 |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_cpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_cpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..bf623d131363b56682b778f9703ebe9cddde196f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_cpu.md
@@ -0,0 +1,67 @@
+
+
+# Efficient Training on CPU
+
+ใใฎใฌใคใใฏใCPUไธใงๅคง่ฆๆจกใชใขใใซใๅน็็ใซใใฌใผใใณใฐใใๆนๆณใซ็ฆ็นใๅฝใฆใฆใใพใใ
+
+## Mixed precision with IPEX
+
+IPEXใฏAVX-512ไปฅไธใฎCPUใซๆ้ฉๅใใใฆใใใAVX2ใฎใฟใฎCPUใงใๆฉ่ฝ็ใซๅไฝใใพใใใใฎใใใAVX-512ไปฅไธใฎIntel CPUไธไปฃใงใฏใใใฉใผใใณในใฎๅไธใๆๅพ
ใใใพใใใAVX2ใฎใฟใฎCPU๏ผไพ๏ผAMD CPUใพใใฏๅคใIntel CPU๏ผใงใฏIPEXใฎไธใงใใ่ฏใใใใฉใผใใณในใๅพใใใใใใใใพใใใใไฟ่จผใใใพใใใIPEXใฏใFloat32ใจBFloat16ใฎไธกๆนใงCPUใใฌใผใใณใฐใฎใใใฉใผใใณในใๆ้ฉๅใใพใใไปฅไธใฎใปใฏใทใงใณใงใฏใBFloat16ใฎไฝฟ็จใซ้็นใ็ฝฎใใฆ่ชฌๆใใพใใ
+
+ไฝ็ฒพๅบฆใใผใฟๅใงใใBFloat16ใฏใAVX512ๅฝไปคใปใใใๅใใ็ฌฌ3ไธไปฃXeonยฎ Scalable Processors๏ผๅฅๅCooper Lake๏ผใงใใคใใฃใใตใใผใใใใฆใใใใใใซ้ซๆง่ฝใชIntelยฎ Advanced Matrix Extensions๏ผIntelยฎ AMX๏ผๅฝไปคใปใใใๅใใๆฌกไธไปฃใฎIntelยฎ Xeonยฎ Scalable ProcessorsใงใใตใใผใใใใพใใCPUใใใฏใจใณใ็จใฎ่ชๅๆททๅ็ฒพๅบฆใPyTorch-1.10ไปฅ้ใงๆๅนใซใชใฃใฆใใพใใๅๆใซใIntelยฎ Extension for PyTorchใงใฎCPU็จBFloat16ใฎ่ชๅๆททๅ็ฒพๅบฆใตใใผใใจใใชใใฌใผใฟใผใฎBFloat16ๆ้ฉๅใฎใตใใผใใๅคงๅน
ใซๅไธใใไธ้จใPyTorchใฎใกใคใณใใฉใณใใซใขใใในใใชใผใ ใใใฆใใพใใใฆใผใถใผใฏIPEX Auto Mixed Precisionใไฝฟ็จใใใใจใงใใใๅชใใใใใฉใผใใณในใจใฆใผใถใผใจใฏในใใชใจใณในใๅพใใใจใใงใใพใใ
+
+่ฉณ็ดฐใชๆ
ๅ ฑใซใคใใฆใฏใ[Auto Mixed Precision](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/features/amp.html)ใ็ขบ่ชใใฆใใ ใใใ
+
+### IPEX installation:
+
+IPEXใฎใชใชใผในใฏPyTorchใซๅพใฃใฆใใใpipใไฝฟ็จใใฆใคใณในใใผใซใงใใพใ๏ผ
+
+| PyTorch Version | IPEX version |
+| :---------------: | :----------: |
+| 1.13 | 1.13.0+cpu |
+| 1.12 | 1.12.300+cpu |
+| 1.11 | 1.11.200+cpu |
+| 1.10 | 1.10.100+cpu |
+
+```bash
+pip install intel_extension_for_pytorch== -f https://developer.intel.com/ipex-whl-stable-cpu
+```
+
+[IPEXใฎใคใณในใใผใซๆนๆณ](https://intel.github.io/intel-extension-for-pytorch/cpu/latest/tutorials/installation.html)ใซใคใใฆใใใใชใใขใใญใผใใ็ขบ่ชใใฆใใ ใใใ
+
+### Trainerใงใฎไฝฟ็จๆนๆณ
+TrainerใงIPEXใฎ่ชๅๆททๅ็ฒพๅบฆใๆๅนใซใใใซใฏใใฆใผใถใผใฏใใฌใผใใณใฐใณใใณใๅผๆฐใซ `use_ipex`ใ`bf16`ใใใใณ `no_cuda` ใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+
+[Transformersใฎ่ณชๅๅฟ็ญ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)ใฎใฆใผในใฑใผในใไพใซ่ชฌๆใใพใใ
+
+- CPUไธใงBF16่ชๅๆททๅ็ฒพๅบฆใไฝฟ็จใใฆIPEXใงใใฌใผใใณใฐใ่กใๅ ดๅ๏ผ
+ python run_qa.py \
+--model_name_or_path google-bert/bert-base-uncased \
+--dataset_name squad \
+--do_train \
+--do_eval \
+--per_device_train_batch_size 12 \
+--learning_rate 3e-5 \
+--num_train_epochs 2 \
+--max_seq_length 384 \
+--doc_stride 128 \
+--output_dir /tmp/debug_squad/ \
+--use_ipex \
+--bf16 --no_cuda
+
+### Practice example
+
+Blog: [Accelerating PyTorch Transformers with Intel Sapphire Rapids](https://huggingface.co/blog/intel-sapphire-rapids)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_cpu_many.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_cpu_many.md
new file mode 100644
index 0000000000000000000000000000000000000000..26da32f577251ff437ab0978ad4083e01ba17781
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_cpu_many.md
@@ -0,0 +1,151 @@
+
+
+
+# Efficient Training on Multiple CPUs
+
+1ใคใฎCPUใงใฎใใฌใผใใณใฐใ้
ใใใๅ ดๅใ่คๆฐใฎCPUใไฝฟ็จใงใใพใใใใฎใฌใคใใฏใPyTorchใใผในใฎDDPใไฝฟ็จใใๅๆฃCPUใใฌใผใใณใฐใซ็ฆ็นใๅฝใฆใฆใใพใใ
+
+## Intelยฎ oneCCL Bindings for PyTorch
+
+[Intelยฎ oneCCL](https://github.com/oneapi-src/oneCCL)๏ผ้ๅ้ไฟกใฉใคใใฉใช๏ผใฏใallreduceใallgatherใalltoallใชใฉใฎๅ้้ไฟกใๅฎ่ฃ
ใใๅน็็ใชๅๆฃใใฃใผใใฉใผใใณใฐใใฌใผใใณใฐ็จใฎใฉใคใใฉใชใงใใoneCCLใฎ่ฉณ็ดฐใซใคใใฆใฏใ[oneCCLใใญใฅใกใณใ](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html)ใจ[oneCCLไปๆง](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html)ใๅ็
งใใฆใใ ใใใ
+
+ใขใธใฅใผใซ`oneccl_bindings_for_pytorch`๏ผใใผใธใงใณ1.12ไปฅๅใฏ`torch_ccl`๏ผใฏใPyTorch C10D ProcessGroup APIใๅฎ่ฃ
ใใๅค้จใฎProcessGroupใจใใฆๅ็ใซใญใผใใงใใ็พๅจใฏLinuxใใฉใใใใฉใผใ ใงใฎใฟๅไฝใใพใใ
+
+[torch-ccl](https://github.com/intel/torch-ccl)ใฎ่ฉณ็ดฐๆ
ๅ ฑใ็ขบ่ชใใฆใใ ใใใ
+
+### Intelยฎ oneCCL Bindings for PyTorch installation:
+
+WheelใใกใคใซใฏใไปฅไธใฎPythonใใผใธใงใณ็จใซๅฉ็จๅฏ่ฝใงใ:
+
+| Extension Version | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 | Python 3.10 |
+| :---------------: | :--------: | :--------: | :--------: | :--------: | :---------: |
+| 1.13.0 | | โ | โ | โ | โ |
+| 1.12.100 | | โ | โ | โ | โ |
+| 1.12.0 | | โ | โ | โ | โ |
+| 1.11.0 | | โ | โ | โ | โ |
+| 1.10.0 | โ | โ | โ | โ | |
+
+```bash
+pip install oneccl_bind_pt=={pytorch_version} -f https://developer.intel.com/ipex-whl-stable-cpu
+```
+
+where `{pytorch_version}` should be your PyTorch version, for instance 1.13.0.
+Check more approaches for [oneccl_bind_pt installation](https://github.com/intel/torch-ccl).
+Versions of oneCCL and PyTorch must match.
+
+
+
+oneccl_bindings_for_pytorch 1.12.0 prebuilt wheel does not work with PyTorch 1.12.1 (it is for PyTorch 1.12.0)
+PyTorch 1.12.1 should work with oneccl_bindings_for_pytorch 1.12.100
+
+
+
+`{pytorch_version}` ใฏใใใชใใฎPyTorchใฎใใผใธใงใณ๏ผไพ๏ผ1.13.0๏ผใซ็ฝฎใๆใใๅฟ
่ฆใใใใพใใ้่ฆใชใฎใฏใoneCCLใจPyTorchใฎใใผใธใงใณใไธ่ดใใฆใใใใจใงใใ[oneccl_bind_ptใฎใคใณในใใผใซ](https://github.com/intel/torch-ccl)ใซ้ขใใใใใชใใขใใญใผใใ็ขบ่ชใงใใพใใ
+
+
+
+`oneccl_bindings_for_pytorch`ใฎ1.12.0ใใชใใซใใใคใผใซใฏPyTorch 1.12.1ใจไบๆๆงใใใใพใใ๏ผใใใฏPyTorch 1.12.0็จใงใ๏ผใPyTorch 1.12.1ใไฝฟ็จใใๅ ดๅใฏใ`oneccl_bindings_for_pytorch`ใใผใธใงใณ1.12.100ใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+
+
+## Intelยฎ MPI library
+
+
+ใใฎๅบๆบใใผในใฎMPIๅฎ่ฃ
ใไฝฟ็จใใฆใIntelยฎใขใผใญใใฏใใฃไธใงๆ่ปใงๅน็็ใในใฑใผใฉใใซใชใฏใฉในใฟใกใใปใผใธใณใฐใๆไพใใพใใใใฎใณใณใใผใใณใใฏใIntelยฎ oneAPI HPC Toolkitใฎไธ้จใงใใ
+
+oneccl_bindings_for_pytorchใฏMPIใใผใซใปใใใจไธ็ทใซใคใณในใใผใซใใใพใใไฝฟ็จใใๅใซ็ฐๅขใใฝใผในๅใใๅฟ
่ฆใใใใพใใ
+
+
+for Intelยฎ oneCCL >= 1.12.0
+```bash
+oneccl_bindings_for_pytorch_path=$(python -c "from oneccl_bindings_for_pytorch import cwd; print(cwd)")
+source $oneccl_bindings_for_pytorch_path/env/setvars.sh
+```
+
+for Intelยฎ oneCCL whose version < 1.12.0
+```bash
+torch_ccl_path=$(python -c "import torch; import torch_ccl; import os; print(os.path.abspath(os.path.dirname(torch_ccl.__file__)))")
+source $torch_ccl_path/env/setvars.sh
+```
+
+#### IPEX installation:
+
+IPEXใฏใFloat32ใใใณBFloat16ใฎไธกๆนใงCPUใใฌใผใใณใฐใฎใใใฉใผใใณในๆ้ฉๅใๆไพใใพใใ่ฉณ็ดฐใฏ[ใใกใใฎใทใณใฐใซCPUใปใฏใทใงใณ](./perf_train_cpu)ใใๅ็
งใใ ใใใ
+
+ไปฅไธใฎใใใฌใผใใผใงใฎไฝฟ็จใใฏใIntelยฎ MPIใฉใคใใฉใชใงmpirunใไฝฟ็จใใไพใ็คบใใฆใใพใใ
+
+## Usage in Trainer
+ใใฌใผใใผใงใฎใใซใCPUๅๆฃใใฌใผใใณใฐใๆๅนใซใใใใใซใใฆใผใถใผใฏใณใใณใๅผๆฐใซ **`--ddp_backend ccl`** ใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+
+ไพใ่ฆใฆใฟใพใใใใ[่ณชๅๅฟ็ญใฎไพ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering)
+
+ไปฅไธใฎใณใใณใใฏใ1ใคใฎXeonใใผใใง2ใคใฎใใญใปในใไฝฟ็จใใฆใใฌใผใใณใฐใๆๅนใซใใพใใ1ใคใฎใใญใปในใ1ใคใฎใฝใฑใใใงๅฎ่กใใใพใใOMP_NUM_THREADS/CCL_WORKER_COUNTๅคๆฐใฏใๆ้ฉใชใใใฉใผใใณในใ่ชฟๆดใใใใใซ่ชฟๆดใงใใพใใ
+
+
+```shell script
+ export CCL_WORKER_COUNT=1
+ export MASTER_ADDR=127.0.0.1
+ mpirun -n 2 -genv OMP_NUM_THREADS=23 \
+ python3 run_qa.py \
+ --model_name_or_path google-bert/bert-large-uncased \
+ --dataset_name squad \
+ --do_train \
+ --do_eval \
+ --per_device_train_batch_size 12 \
+ --learning_rate 3e-5 \
+ --num_train_epochs 2 \
+ --max_seq_length 384 \
+ --doc_stride 128 \
+ --output_dir /tmp/debug_squad/ \
+ --no_cuda \
+ --ddp_backend ccl \
+ --use_ipex
+```
+
+ไปฅไธใฎใณใใณใใฏใ2ใคใฎXeonใใญใปใใต๏ผnode0ใจnode1ใnode0ใใกใคใณใใญใปในใจใใฆไฝฟ็จ๏ผใงๅ่จ4ใคใฎใใญใปในใไฝฟ็จใใฆใใฌใผใใณใฐใๆๅนใซใใพใใppn๏ผใใผใใใจใฎใใญใปในๆฐ๏ผใฏ2ใซ่จญๅฎใใใ1ใคใฎใฝใฑใใใใจใซ1ใคใฎใใญใปในใๅฎ่กใใใพใใๆ้ฉใชใใใฉใผใใณในใๅพใใใใซใOMP_NUM_THREADS/CCL_WORKER_COUNTๅคๆฐใ่ชฟๆดใงใใพใใ
+
+node0ใงใฏใๅใใผใใฎIPใขใใฌในใๅซใๆงๆใใกใคใซใไฝๆใใใใฎๆงๆใใกใคใซใฎใในใๅผๆฐใจใใฆๆธกใๅฟ
่ฆใใใใพใใ
+
+```shell script
+ cat hostfile
+ xxx.xxx.xxx.xxx #node0 ip
+ xxx.xxx.xxx.xxx #node1 ip
+```
+
+ใใผใ0ใงๆฌกใฎใณใใณใใๅฎ่กใใใจใใใผใ0ใจใใผใ1ใง**4DDP**ใBF16่ชๅๆททๅ็ฒพๅบฆใงๆๅนใซใชใใพใใ
+
+
+```shell script
+ export CCL_WORKER_COUNT=1
+ export MASTER_ADDR=xxx.xxx.xxx.xxx #node0 ip
+ mpirun -f hostfile -n 4 -ppn 2 \
+ -genv OMP_NUM_THREADS=23 \
+ python3 run_qa.py \
+ --model_name_or_path google-bert/bert-large-uncased \
+ --dataset_name squad \
+ --do_train \
+ --do_eval \
+ --per_device_train_batch_size 12 \
+ --learning_rate 3e-5 \
+ --num_train_epochs 2 \
+ --max_seq_length 384 \
+ --doc_stride 128 \
+ --output_dir /tmp/debug_squad/ \
+ --no_cuda \
+ --ddp_backend ccl \
+ --use_ipex \
+ --bf16
+```
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_gpu_many.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_gpu_many.md
new file mode 100644
index 0000000000000000000000000000000000000000..d85165d0c547a06661cc521b9720df78619b22bb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_gpu_many.md
@@ -0,0 +1,529 @@
+
+
+# Efficient Training on Multiple GPUs
+
+ๅไธใฎGPUใงใฎใใฌใผใใณใฐใ้
ใใใๅ ดๅใใใขใใซใฎ้ใฟใๅไธใฎGPUใฎใกใขใชใซๅใพใใชใๅ ดๅใ่คๆฐใฎGPUใไฝฟ็จใใใปใใใขใใใๅฟ
่ฆใจใชใใพใใๅไธใฎGPUใใ่คๆฐใฎGPUใธใฎๅใๆฟใใซใฏใใฏใผใฏใญใผใใๅๆฃใใใใใฎใใ็จฎใฎไธฆๅๅฆ็ใๅฟ
่ฆใงใใใใผใฟใใใณใฝใซใใพใใฏใใคใใฉใคใณใฎไธฆๅๅฆ็ใชใฉใใใพใใพใชไธฆๅๅฆ็ๆ่กใใใใพใใใใ ใใใในใฆใซ้ฉใใไธใคใฎ่งฃๆฑบ็ญใฏๅญๅจใใใๆ้ฉใช่จญๅฎใฏไฝฟ็จใใใใผใใฆใงใขใซไพๅญใใพใใใใฎ่จไบใฏใใใใใไปใฎใใฌใผใ ใฏใผใฏใซใ้ฉ็จใใใไธป่ฆใชๆฆๅฟตใซ็ฆ็นใๅฝใฆใคใคใPyTorchใใผในใฎๅฎ่ฃ
ใซ็ฆ็นใๅฝใฆใฆใใพใใ
+
+
+
+**ๆณจๆ**: [ๅไธGPUใปใฏใทใงใณ](perf_train_gpu_one) ใง็ดนไปใใใๅคใใฎๆฆ็ฅ๏ผๆททๅ็ฒพๅบฆใใฌใผใใณใฐใๅพ้
่็ฉใชใฉ๏ผใฏไธ่ฌ็ใงใใใใขใใซใฎใใฌใผใใณใฐใซไธ่ฌ็ใซ้ฉ็จใใใพใใใใใใฃใฆใใใซใGPUใCPUใใฌใผใใณใฐใชใฉใฎๆฌกใฎใปใฏใทใงใณใซๅ
ฅใๅใซใใใใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+ใพใใใใพใใพใช1Dไธฆๅๅฆ็ๆ่กใจใใฎๅฉ็นใใใณๆฌ ็นใซใคใใฆ่ฉณใใ่ชฌๆใใใใใใ2Dใใใณ3Dไธฆๅๅฆ็ใซ็ตใฟๅใใใฆใใใซ้ซ้ใชใใฌใผใใณใฐใๅฎ็พใใใใๅคงใใชใขใใซใใตใใผใใใๆนๆณใๆค่จใใพใใใใพใใพใชไปใฎๅผทๅใชไปฃๆฟๆๆณใ็ดนไปใใใพใใ
+
+## Concepts
+
+ไปฅไธใฏใใใฎๆๆธใงๅพใง่ฉณใใ่ชฌๆใใใไธป่ฆใชๆฆๅฟตใฎ็ฐกๅใช่ชฌๆใงใใ
+
+1. **DataParallel (DP)** - ๅใใปใใใขใใใ่คๆฐๅ่ค่ฃฝใใใๅใปใใใขใใใซใใผใฟใฎในใฉใคในใไพ็ตฆใใใพใใๅฆ็ใฏไธฆ่กใใฆ่กใใใๅใปใใใขใใใฏใใฌใผใใณใฐในใใใใฎๆๅพใซๅๆใใใพใใ
+2. **TensorParallel (TP)** - ๅใใณใฝใซใฏ่คๆฐใฎใใฃใณใฏใซๅๅฒใใใๅไธใฎGPUใซใใณใฝใซๅ
จไฝใๅญๅจใใใฎใงใฏใชใใใใณใฝใซใฎๅใทใฃใผใใๆๅฎใใใGPUใซๅญๅจใใพใใๅฆ็ไธญใซใๅใทใฃใผใใฏๅฅใ
ใซไธฆ่กใใฆๅฆ็ใใใ็ฐใชใGPUใงๅๆใใใในใใใใฎๆๅพใซ็ตๆใๅๆใใใพใใใใใฏๆฐดๅนณไธฆๅๅฆ็ใจๅผใฐใใใใฎใงใๅๅฒใฏๆฐดๅนณใฌใใซใง่กใใใพใใ
+3. **PipelineParallel (PP)** - ใขใใซใฏๅ็ด๏ผใฌใคใคใผใฌใใซ๏ผใซ่คๆฐใฎGPUใซๅๅฒใใใใขใใซใฎๅไธใพใใฏ่คๆฐใฎใฌใคใคใผใๅไธใฎGPUใซ้
็ฝฎใใใพใใๅGPUใฏใใคใใฉใคใณใฎ็ฐใชใในใใผใธใไธฆ่กใใฆๅฆ็ใใใใใใฎๅฐใใชใใฃใณใฏใงไฝๆฅญใใพใใ
+4. **Zero Redundancy Optimizer (ZeRO)** - TPใจใใใใไผผใใใใชใใณใฝใซใฎใทใฃใผใใฃใณใฐใๅฎ่กใใพใใใๅๅใใพใใฏๅพๅใใฎ่จ็ฎใฎใใใซใใณใฝใซๅ
จไฝใๅๆง็ฏใใใใใใใขใใซใๅคๆดใใๅฟ
่ฆใฏใใใพใใใใพใใGPUใกใขใชใๅถ้ใใใฆใใๅ ดๅใซ่ฃๅใใใใใฎใใพใใพใชใชใใญใผใๆ่กใใตใใผใใใพใใ
+5. **Sharded DDP** - Sharded DDPใฏใใใพใใพใชZeROๅฎ่ฃ
ใงไฝฟ็จใใใๅบๆฌ็ใชZeROใณใณใปใใใฎๅฅๅใงใใ
+
+ๅใณใณใปใใใฎ่ฉณ็ดฐใซๆทฑๅ
ฅใใใๅใซใๅคง่ฆๆจกใชใคใณใใฉในใใฉใฏใใฃใงๅคง่ฆๆจกใชใขใใซใใใฌใผใใณใฐใใ้ใฎๅคงใพใใชๆฑบๅฎใใญใปในใ่ฆใฆใฟใพใใใใ
+
+## Scalability Strategy
+
+**โจ ใทใณใฐใซใใผใ / ใใซใGPU**
+* ใขใใซใๅไธใฎGPUใซๅใพใๅ ดๅ๏ผ
+
+ 1. DDP - ๅๆฃใใผใฟไธฆๅ
+ 2. ZeRO - ็ถๆณใจไฝฟ็จใใใๆงๆใซๅฟใใฆ้ใใใฉใใใ็ฐใชใใพใ
+
+* ใขใใซใๅไธใฎGPUใซๅใพใใชใๅ ดๅ๏ผ
+
+ 1. PP
+ 2. ZeRO
+ 3. TP
+
+ ้ๅธธใซ้ซ้ใชใใผใๅ
ๆฅ็ถ๏ผNVLINKใพใใฏNVSwitchใชใฉ๏ผใใใใฐใใใใใฎ3ใคใฏใปใผๅใ้ๅบฆใซใชใใฏใใงใใใใใใชใๅ ดๅใPPใฏTPใพใใฏZeROใใใ้ใใชใใพใใTPใฎ็จๅบฆใๅทฎใ็ใใใใใใใพใใใ็นๅฎใฎใปใใใขใใใงใฎๅ่
ใ่ฆใคใใใใใซๅฎ้จใใใใจใๆๅใงใใ
+
+ TPใฏใปใจใใฉใฎๅ ดๅใๅไธใใผใๅ
ใงไฝฟ็จใใใพใใใคใพใใTPใตใคใบ <= ใใผใใใจใฎGPUๆฐใงใใ
+
+* ๆๅคงใฎใฌใคใคใผใๅไธใฎGPUใซๅใพใใชใๅ ดๅ๏ผ
+
+ 1. ZeROใไฝฟ็จใใชใๅ ดๅ - TPใไฝฟ็จใใๅฟ
่ฆใใใใพใใPPๅ็ฌใงใฏๅใพใใชใใงใใใใ
+ 2. ZeROใไฝฟ็จใใๅ ดๅ - "ใทใณใฐใซGPU"ใฎใจใณใใชใจๅใใใฎใๅ็
งใใฆใใ ใใ
+
+**โจ ใใซใใใผใ / ใใซใGPU**
+
+* ใใผใ้ใฎ้ซ้ๆฅ็ถใใใๅ ดๅ๏ผ
+
+ 1. ZeRO - ใขใใซใธใฎใปใจใใฉใฎๅคๆดใไธ่ฆใงใ
+ 2. PP+TP+DP - ้ไฟกใๅฐใชใใใขใใซใธใฎๅคง่ฆๆจกใชๅคๆดใๅฟ
่ฆใงใ
+
+* ใใผใ้ใฎๆฅ็ถใ้
ใใGPUใกใขใชใใพใ ไธ่ถณใใฆใใๅ ดๅ๏ผ
+
+ 1. DP+PP+TP+ZeRO-1
+
+## Data Parallelism
+
+2ใคใฎGPUใๆใคใปใจใใฉใฎใฆใผใถใผใฏใ`DataParallel`๏ผDP๏ผใจ`DistributedDataParallel`๏ผDDP๏ผใซใใฃใฆๆไพใใใใใฌใผใใณใฐ้ๅบฆใฎๅไธใใใงใซไบซๅใใฆใใพใใใใใใฏใปใผ่ชๆใซไฝฟ็จใงใใPyTorchใฎ็ตใฟ่พผใฟๆฉ่ฝใงใใไธ่ฌ็ใซใใในใฆใฎใขใใซใงๅไฝใใDDPใไฝฟ็จใใใใจใใๅงใใใพใใDPใฏไธ้จใฎใขใใซใงๅคฑๆใใๅฏ่ฝๆงใใใใใใงใใ[PyTorchใฎใใญใฅใกใณใใผใทใงใณ](https://pytorch.org/docs/master/generated/torch.nn.DataParallel.html)่ชไฝใDDPใฎไฝฟ็จใๆจๅฅจใใฆใใพใใ
+
+### DP vs DDP
+
+`DistributedDataParallel`๏ผDDP๏ผใฏ้ๅธธใ`DataParallel`๏ผDP๏ผใใใ้ซ้ใงใใใๅธธใซใใใจใฏ้ใใพใใ๏ผ
+* DPใฏPythonในใฌใใใใผในใงใใใDDPใฏใใซใใใญใปในใใผในใงใใใใฎใใใGIL๏ผGlobal Interpreter Lock๏ผใชใฉใฎPythonในใฌใใใฎๅถ็ดใใชใใใใงใใ
+* ไธๆนใGPUใซใผใ้ใฎ้
ใ็ธไบๆฅ็ถๆงใฏใDDPใฎๅ ดๅใซๅฎ้ใซใฏ้
ใ็ตๆใใใใใๅฏ่ฝๆงใใใใพใใ
+
+ไปฅไธใฏใ2ใคใฎใขใผใ้ใฎGPU้้ไฟกใฎไธปใช้ใใงใ๏ผ
+
+[DDP](https://pytorch.org/docs/master/notes/ddp.html):
+
+- ้ๅงๆใใกใคใณใใญใปในใฏใขใใซใGPU 0ใใไปใฎGPUใซ่ค่ฃฝใใพใใ
+- ใใใใๅใใใใใจใซ:
+ 1. ๅGPUใฏๅ่ชใฎใใใใใใฎใใผใฟใ็ดๆฅๆถ่ฒปใใพใใ
+ 2. `backward`ไธญใใญใผใซใซๅพ้
ใๆบๅใงใใใจใใใใใฏใในใฆใฎใใญใปในใงๅนณๅๅใใใพใใ
+
+[DP](https://pytorch.org/docs/master/generated/torch.nn.DataParallel.html):
+
+ๅใใใใใจใซ:
+ 1. GPU 0ใฏใใผใฟใใใใ่ชญใฟๅใใใใใใๅGPUใซใใใใใใ้ไฟกใใพใใ
+ 2. GPU 0ใใๅGPUใซๆๆฐใฎใขใใซใ่ค่ฃฝใใพใใ
+ 3. `forward`ใๅฎ่กใใๅGPUใใGPU 0ใซๅบๅใ้ไฟกใใๆๅคฑใ่จ็ฎใใพใใ
+ 4. GPU 0ใใใในใฆใฎGPUใซๆๅคฑใๅๆฃใใ`backward`ใๅฎ่กใใพใใ
+ 5. ๅGPUใใGPU 0ใซๅพ้
ใ้ไฟกใใใใใใๅนณๅๅใใพใใ
+
+DDPใฏใใใใใจใซ่กใ้ไฟกใฏๅพ้
ใฎ้ไฟกใฎใฟใงใใใไธๆนใDPใฏใใใใใจใซ5ใคใฎ็ฐใชใใใผใฟไบคๆใ่กใใพใใ
+
+DPใฏใใญใปในๅ
ใงใใผใฟใPythonในใฌใใใไปใใฆใณใใผใใพใใใDDPใฏ[torch.distributed](https://pytorch.org/docs/master/distributed.html)ใไปใใฆใใผใฟใใณใใผใใพใใ
+
+DPใงใฏGPU 0ใฏไปใฎGPUใใใใฏใใใซๅคใใฎไฝๆฅญใ่กใใใใGPUใฎๆชไฝฟ็จ็ใ้ซใใชใใพใใ
+
+DDPใฏ่คๆฐใฎใใทใณ้ใงไฝฟ็จใงใใพใใใDPใฎๅ ดๅใฏใใใงใฏใใใพใใใ
+
+DPใจDDPใฎไปใซใ้ใใใใใพใใใใใฎ่ญฐ่ซใซใฏ้ขไฟใใใพใใใ
+
+ใใใ2ใคใฎใขใผใใๆทฑใ็่งฃใใใๅ ดๅใใใฎ[่จไบ](https://www.telesens.co/2019/04/04/distributed-data-parallel-training-using-pytorch-on-aws/)ใๅผทใใๅงใใใพใใ็ด ๆดใใใใใคใขใฐใฉใ ใๅซใฟใใใพใใพใชใใผใใฆใงใขใงใฎ่คๆฐใฎใใณใใใผใฏใจใใญใใกใคใฉใฎๅบๅใ็คบใใ็ฅใฃใฆใใๅฟ
่ฆใใใใในใฆใฎๅพฎๅฆใชใใฅใขใณในใ่ชฌๆใใฆใใพใใ
+
+ๅฎ้ใฎใใณใใใผใฏใ่ฆใฆใฟใพใใใ๏ผ
+
+| Type | NVlink | Time |
+| :----- | ----- | ---: |
+| 2:DP | Y | 110s |
+| 2:DDP | Y | 101s |
+| 2:DDP | N | 131s |
+
+
+่งฃๆ๏ผ
+
+ใใใงใDPใฏNVlinkใไฝฟ็จใใDDPใซๆฏในใฆ็ด10๏ผ
้
ใใNVlinkใไฝฟ็จใใชใDDPใซๆฏในใฆ็ด15๏ผ
้ซ้ใงใใใใจใ็คบใใใฆใใพใใ
+
+ๅฎ้ใฎ้ใใฏใๅGPUใไปใฎGPUใจๅๆใใๅฟ
่ฆใใใใใผใฟใฎ้ใซไพๅญใใพใใๅๆใใใใผใฟใๅคใใปใฉใ้
ใใชใณใฏใๅ่จใฎๅฎ่กๆ้ใ้
ใใใๅฏ่ฝๆงใ้ซใใชใใพใใ
+
+ไปฅไธใฏๅฎๅ
จใชใใณใใใผใฏใณใผใใจๅบๅใงใ๏ผ
+
+`NCCL_P2P_DISABLE=1`ใไฝฟ็จใใฆใๅฏพๅฟใใใใณใใใผใฏใงNVLinkๆฉ่ฝใ็กๅนใซใใพใใใ
+
+
+```bash
+
+# DP
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 \
+python examples/pytorch/language-modeling/run_clm.py \
+--model_name_or_path openai-community/gpt2 --dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 \
+--do_train --output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 110.5948, 'train_samples_per_second': 1.808, 'epoch': 0.69}
+
+# DDP w/ NVlink
+rm -r /tmp/test-clm; CUDA_VISIBLE_DEVICES=0,1 \
+torchrun --nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py \
+--model_name_or_path openai-community/gpt2 --dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 \
+--do_train --output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 101.9003, 'train_samples_per_second': 1.963, 'epoch': 0.69}
+
+# DDP w/o NVlink
+rm -r /tmp/test-clm; NCCL_P2P_DISABLE=1 CUDA_VISIBLE_DEVICES=0,1 \
+torchrun --nproc_per_node 2 examples/pytorch/language-modeling/run_clm.py \
+--model_name_or_path openai-community/gpt2 --dataset_name wikitext --dataset_config_name wikitext-2-raw-v1 \
+--do_train --output_dir /tmp/test-clm --per_device_train_batch_size 4 --max_steps 200
+
+{'train_runtime': 131.4367, 'train_samples_per_second': 1.522, 'epoch': 0.69}
+```
+
+ใใผใใฆใงใข: 2x TITAN RTXใๅ24GB + 2ใคใฎNVLink๏ผ`nvidia-smi topo -m`ใง `NV2`๏ผ
+
+ใฝใใใฆใงใข: `pytorch-1.8-to-be` + `cuda-11.0` / `transformers==4.3.0.dev0`
+
+## ZeRO Data Parallelism
+
+ZeROใใฏใผใใใผใฟไธฆๅๅฆ็๏ผZeRO-DP๏ผใฏใๆฌกใฎ[ใใญใฐๆ็จฟ](https://www.microsoft.com/en-us/research/blog/zero-deepspeed-new-system-optimizations-enable-training-models-with-over-100-billion-parameters/)ใฎใใคใขใฐใฉใ ใง่ชฌๆใใใฆใใพใใ
+
+
+ใใใฏ็่งฃใ้ฃใใใใใใใพใใใใๅฎ้ใซใฏใใฎๆฆๅฟตใฏ้ๅธธใซใทใณใใซใงใใใใใฏ้ๅธธใฎ`DataParallel`๏ผDP๏ผใงใใใๅฎๅ
จใชใขใใซใใฉใกใผใฟใๅพ้
ใใใใณใชใใใฃใใคใถใฎ็ถๆ
ใ่ค่ฃฝใใไปฃใใใซใๅGPUใฏใใใใใฎในใฉใคในใฎใฟใไฟๅญใใพใใใใใฆใๅฎ่กๆใซใ็นๅฎใฎใฌใคใคใผใซๅฟ
่ฆใชๅฎๅ
จใชใฌใคใคใผใใฉใกใผใฟใๅฟ
่ฆใชๅ ดๅใใในใฆใฎGPUใๅๆใใฆใใไบใใซไธ่ถณใใฆใใ้จๅใๆไพใใพใใใใใใในใฆใงใใ
+
+3ใคใฎใฌใคใคใผใใใชใๅ็ดใชใขใใซใ่ใใฆใฟใพใใใใๅใฌใคใคใผใซใฏ3ใคใฎใใฉใกใผใฟใใใใพใ๏ผ
+
+
+```
+La | Lb | Lc
+---|----|---
+a0 | b0 | c0
+a1 | b1 | c1
+a2 | b2 | c2
+```
+
+ใฌใคใคใผLaใซใฏใ้ใฟa0ใa1ใใใใณa2ใใใใพใใ
+
+3ใคใฎGPUใใใๅ ดๅใSharded DDP๏ผ= Zero-DP๏ผใฏใขใใซใ3ใคใฎGPUใซๆฌกใฎใใใซๅๅฒใใพใ๏ผ
+
+
+```
+GPU0:
+La | Lb | Lc
+---|----|---
+a0 | b0 | c0
+
+GPU1:
+La | Lb | Lc
+---|----|---
+a1 | b1 | c1
+
+GPU2:
+La | Lb | Lc
+---|----|---
+a2 | b2 | c2
+```
+
+ใใใฏใๅ
ธๅ็ใชใใฃใผใใใฅใผใฉใซใใใใฏใผใฏ๏ผDNN๏ผใฎใใคใขใฐใฉใ ใๆณๅใใใจใใใณใฝใซไธฆๅๅฆ็ใจๅๆงใฎๆฐดๅนณในใฉใคในใงใใใใใชใใฎใงใใๅ็ดในใฉใคในใฏใ็ฐใชใGPUใซๅฎๅ
จใชๅฑคใฐใซใผใใ้
็ฝฎใใๆนๆณใงใใใใใใใใใฏๅใชใๅบ็บ็นใซ้ใใพใใใ
+
+ใใใใใๅGPUใฏ้ๅธธใฎใใผใฟไธฆๅๅฆ็๏ผDP๏ผใจๅๆงใซใ้ๅธธใฎใใใใใใๅใๅใใพใ๏ผ
+
+```
+x0 => GPU0
+x1 => GPU1
+x2 => GPU2
+```
+
+ๆๅใซใๅ
ฅๅใใผใฟใฏใฌใคใคใผLaใซ้ฉ็จใใใพใใ
+
+GPU0ใซ็ฆ็นใๅฝใฆใพใใใ๏ผx0ใฏใใใฎๅๅใใในใๅฎ่กใใใใใซa0ใa1ใa2ใฎใใฉใกใผใฟใๅฟ
่ฆใงใใใGPU0ใซใฏa0ใใใใใพใใใGPU1ใใa1ใใGPU2ใใa2ใๅใๅใใใขใใซใฎๅ้จๅใใพใจใใพใใ
+
+ๅๆงใซใGPU1ใฏใใใใใx1ใๅใๅใใa1ใใๆใฃใฆใใพใใใใa0ใจa2ใฎใใฉใกใผใฟใๅฟ
่ฆใงใใใใใใฏGPU0ใจGPU2ใใๅๅพใใพใใ
+
+GPU2ใx2ใๅใๅใใพใใa0ใจa1ใฏGPU0ใจGPU1ใใๅใๅใใa2ใจใจใใซๅฎๅ
จใชใใณใฝใซใๅๆง็ฏใใพใใ
+
+3ใคใฎGPUใฏๅฎๅ
จใชใใณใฝใซใๅๆง็ฏใใๅๅใ่จ็ฎใ่กใใใพใใ
+
+่จ็ฎใๅฎไบใใใจใไธ่ฆใซใชใฃใใใผใฟใฏๅ้คใใใพใใ่จ็ฎไธญใ ใไฝฟ็จใใใๅๆง็ฏใฏไบๅใซใใงใใใไฝฟ็จใใฆๅน็็ใซ่กใใใพใใ
+
+ใใใฆใใใฎใใญใปในๅ
จไฝใใฌใคใคใผLbใๆฌกใซๅๅใใงLcใใใใฆ้ๆนๅใงLc -> Lb -> Laใซๅฏพใใฆ็นฐใ่ฟใใใพใใ
+
+็งใซใจใฃใฆใใใใฏๅน็็ใชใฐใซใผใใงใฎ้ใฟใฎๅๆฃๆฆ็ฅใฎใใใซ่ใใใพใ๏ผ
+
+1. ไบบAใฏใใณใใๆใฃใฆใใพใใ
+2. ไบบBใฏในใใผใใๆใฃใฆใใพใใ
+3. ไบบCใฏๆงใๆใฃใฆใใพใใ
+
+ไปใๅฝผใใฏๆฏๆฉๆใฃใฆใใใใฎใๅ
ฑๆใใไปใฎไบบใใๆใฃใฆใใชใใใฎใใใใใๆใซใฏๅฒใๅฝใฆใใใใฟใคใใฎใฎใขใ่ฉฐใใฆๆ
ใ็ถใใพใใใใใSharded DDP / Zero DPใงใใ
+
+ใใฎๆฆ็ฅใใๅไบบใ็ฌ่ชใฎใใณใใในใใผใใๆงใๆใฃใฆ้ใฐใชใใใฐใชใใชใใทใณใใซใชๆฆ็ฅใจๆฏ่ผใใฆใฟใฆใใ ใใใใใใPyTorchใฎDataParallel๏ผDPใใใณDDP๏ผใงใใ
+
+ใใฎใใใใฏใฎๆ็ฎใ่ชญใ้ใซใไปฅไธใฎ้ก็พฉ่ชใซๅบไผใใใใใใพใใ๏ผShardedใPartitionedใ
+
+ZeROใใขใใซใฎ้ใฟใๅๅฒใใๆนๆณใซๆณจๆใๆใใจใใใใฏใใณใฝใซใใฉใฌใชใบใ ใจ้ๅธธใซไผผใฆใใใใใซ่ฆใใพใใใใใฏๅพใง่ญฐ่ซใใใๅ็ดใขใใซใใฉใฌใชใบใ ใจใฏ็ฐใชใใๅใฌใคใคใผใฎ้ใฟใใใผใใฃใทใงใณ/ใทใฃใผใใฃใณใฐใใพใใ
+
+Implementations:
+
+- [DeepSpeed](https://www.deepspeed.ai/tutorials/zero/) ZeRO-DP stages 1+2+3
+- [`transformers` integration](main_classes/trainer#trainer-integrations)
+
+
+## Naive Model Parallelism (Vertical) and Pipeline Parallelism
+
+ใใคใผใใขใใซใใฉใฌใชใบใ ๏ผMP๏ผใฏใใขใใซใฎๅฑคใ่คๆฐใฎGPUใซๅๆฃใใใๆนๆณใงใใใใฎใกใซใใบใ ใฏๆฏ่ผ็ๅ็ดใงใๅธๆใใๅฑคใ`.to()`ใกใฝใใใไฝฟ็จใใฆ็นๅฎใฎใใใคในใซๅใๆฟใใใ ใใงใใใใใซใใใใใผใฟใใใใใฎๅฑคใ้้ใใใใณใซใใใผใฟใๅฑคใจๅใใใใคในใซๅใๆฟใใใใๆฎใใฎ้จๅใฏๅคๆดใใใพใใใ
+
+็งใใกใฏใใใใๅ็ดMPใใจๅผใณใพใใใชใใชใใใปใจใใฉใฎใขใใซใใฉใฎใใใซๆใใใใใๆใๅบใใจใๅฑคใๅ็ดใซในใฉใคในใใใใใงใใใใจใใฐใไปฅไธใฎๅณใฏ8ๅฑคใฎใขใใซใ็คบใใฆใใพใ๏ผ
+
+
+```
+=================== ===================
+| 0 | 1 | 2 | 3 | | 4 | 5 | 6 | 7 |
+=================== ===================
+ gpu0 gpu1
+```
+
+ๆใ
ใฏใใขใใซใๅ็ดใซ2ใคใซๅๅฒใใใฌใคใคใผ0ใใ3ใGPU0ใซ้
็ฝฎใใใฌใคใคใผ4ใใ7ใGPU1ใซ้
็ฝฎใใพใใใ
+
+ใใผใฟใใฌใคใคใผ0ใใ1ใ1ใใ2ใ2ใใ3ใซ็งปๅใใ้ใฏ้ๅธธใฎใขใใซใจๅใใงใใใใใใใใผใฟใใฌใคใคใผ3ใใใฌใคใคใผ4ใซ็งปๅใใๅฟ
่ฆใใใๅ ดๅใGPU0ใใGPU1ใธใฎ็งปๅใ็บ็ใใ้ไฟกใฎใชใผใใผใใใใ็บ็ใใพใใๅๅ ใใฆใใGPUใๅใใณใณใใฅใผใใใผใ๏ผไพ๏ผๅใ็ฉ็ใใทใณ๏ผใซใใๅ ดๅใใใฎใณใใผใฏ้ๅธธใซ้ซ้ใงใใใ็ฐใชใใณใณใใฅใผใใใผใ๏ผไพ๏ผ่คๆฐใฎใใทใณ๏ผใซใใๅ ดๅใ้ไฟกใฎใชใผใใผใใใใฏๅคงๅน
ใซๅขๅ ใใๅฏ่ฝๆงใใใใพใใ
+
+ใใฎๅพใใฌใคใคใผ4ใใ5ใ6ใใ7ใพใงใฏ้ๅธธใฎใขใใซใจๅๆงใซๅไฝใใ7็ช็ฎใฎใฌใคใคใผใๅฎไบใใใจใใใผใฟใใใฐใใฐใฌใคใคใผ0ใซๆปใๅฟ
่ฆใใใใพใ๏ผใพใใฏใฉใใซใๆๅพใฎใฌใคใคใผใซ้ไฟกใใพใ๏ผใใใใงๆๅคฑใ่จ็ฎใใใชใใใฃใใคใถใไฝๆฅญใ้ๅงใงใใพใใ
+
+ๅ้ก็น๏ผ
+- ไธปใชๆฌ ็นใใใใณใชใใใใใๅ็ดใชใMPใจๅผใถใฎใใฏใ1ใคใ้คใใฆใในใฆใฎGPUใใฉใใช็ฌ้ใงใใขใคใใซ็ถๆ
ใงใใใใจใงใใใใใใฃใฆใ4ใคใฎGPUใไฝฟ็จใใๅ ดๅใๅ็ดใชMPใฏใ1ใคใฎGPUใฎใกใขใชๅฎน้ใ4ๅใซใใใฎใจใปใผๅใใงใใใใใผใใฆใงใขใฎๆฎใใ็ก่ฆใใพใใใใใซใใใผใฟใฎใณใใผใฎใชใผใใผใใใใใใใใจใๅฟใใฆใฏใใใพใใใใใใใฃใฆใ4ๆใฎ6GBใฎใซใผใใฏใใใผใฟใฎใณใใผใฎใชใผใใผใใใใใชใ1ๆใฎ24GBใฎใซใผใใจๅใใตใคใบใๅๅฎนใงใใใงใใใใใๅพ่
ใฏใใฌใผใใณใฐใใใ่ฟ
้ใซๅฎไบใใพใใใใ ใใใใจใใฐ40GBใฎใซใผใใใใใ45GBใฎใขใใซใๅใใๅฟ
่ฆใใใๅ ดๅใๅพ้
ใจใชใใใฃใใคใถใฎ็ถๆ
ใฎใใใซใปใจใใฉๅใใใใจใใงใใพใใใ
+- ๅ
ฑๆใฎๅใ่พผใฟใฏใGPU้ใงใณใใผใใๅฟ
่ฆใใใใใใใใพใใใ
+
+ใใคใใฉใคใณไธฆๅๅฆ็๏ผPP๏ผใฏใใปใผๅ็ดใชMPใจๅใใงใใใGPUใใขใคใใซ็ถๆ
ใซใชใๅ้กใ่งฃๆฑบใใๅ
ฅๅใใใใใใคใฏใญใใใใซๅๅฒใใใใคใใฉใคใณใไบบๅทฅ็ใซไฝๆใใใใจใซใใใ็ฐใชใGPUใ่จ็ฎใใญใปในใซๅๆใซๅๅ ใงใใใใใซใใพใใ
+
+ไปฅไธใฏใ[GPipe่ซๆ](https://ai.googleblog.com/2019/03/introducing-gpipe-open-source-library.html)ใใใฎๅณใงใไธ้จใซใฏๅ็ดใชMPใไธ้จใซใฏPPใ็คบใใใฆใใพใ๏ผ
+
+
+
+ใใฎๅณใใใPPใGPUใใขใคใใซ็ถๆ
ใฎ้ ๅใงใใใใใใซใใๅฐใชใๆใคใใจใใใใใพใใใขใคใใซ็ถๆ
ใฎ้จๅใฏใใใใซใใจๅผใฐใใพใใ
+
+ๅณใฎไธกๆนใฎ้จๅใฏใ4ใคใฎGPUใใใคใใฉใคใณใซๅๅ ใใฆใใ4ใฎๆฌกๅ
ใฎไธฆๅๆงใ็คบใใฆใใพใใใคใพใใ4ใคใฎใใคใในใใผใธF0ใF1ใF2ใF3ใฎใใฉใฏใผใใในใใใใ้้ ใฎใใใฏใฏใผใใในB3ใB2ใB1ใB0ใใใใพใใ
+
+PPใฏ่ชฟๆดใใๆฐใใใใคใใผใใฉใกใผใฟใๅฐๅ
ฅใใพใใใใใฏ `chunks` ใงใๅใใใคใในใใผใธใ้ใใฆ้ฃ็ถใใฆ้ไฟกใใใใใผใฟใฎใใฃใณใฏใฎๆฐใๅฎ็พฉใใพใใใใจใใฐใไธใฎๅณใงใฏ `chunks=4` ใ่กจ็คบใใใฆใใพใใGPU0ใฏใใฃใณใฏ0ใ1ใ2ใ3๏ผF0,0ใF0,1ใF0,2ใF0,3๏ผใงๅใใใฉใฏใผใใในใๅฎ่กใใไปใฎGPUใไฝๆฅญใ้ๅงใๅงใใใฎใๅพ
ใฃใฆใใใGPU0ใฏใใฃใณใฏ3ใ2ใ1ใ0๏ผB0,3ใB0,2ใB0,1ใB0,0๏ผใง้้ ใในใๅฎ่กใใพใใ
+
+ๆณจๆใในใใฏใๆฆๅฟต็ใซใฏใใใๅพ้
่็ฉในใใใ๏ผGAS๏ผใจๅใใณใณใปใใใงใใใใจใงใใPyTorchใฏ `chunks` ใไฝฟ็จใใDeepSpeedใฏๅใใใคใใผใใฉใกใผใฟใGASใจๅผใณใพใใ
+
+`chunks` ใฎๅฐๅ
ฅใซใใใPPใฏใใคใฏใญใใใ๏ผMBS๏ผใฎๆฆๅฟตใๅฐๅ
ฅใใพใใDPใฏใฐใญใผใใซใใผใฟใใใใตใคใบใใใใใใใซๅๅฒใใพใใใใใใฃใฆใDPใฎๆฌกๆฐใ4ใงใใฐใญใผใใซใใใใตใคใบใ1024ใฎๅ ดๅใ4ใคใฎใใใใใ๏ผใใใใ256๏ผใซๅๅฒใใใพใ๏ผ1024/4๏ผใใใใฆใ`chunks`๏ผใพใใฏGAS๏ผใฎๆฐใ32ใงใใๅ ดๅใใใคใฏใญใใใใตใคใบใฏ8ใซใชใใพใ๏ผ256/32๏ผใๅใใคใใฉใคใณในใใผใธใฏ1ใคใฎใใคใฏใญใใใใงไฝๆฅญใใพใใ
+
+DP + PPใปใใใขใใใฎใฐใญใผใใซใใใใตใคใบใ่จ็ฎใใใซใฏใ`mbs*chunks*dp_degree`๏ผ`8*32*4=1024`๏ผใ่กใใพใใ
+
+ๅณใซๆปใใพใใใใ
+
+`chunks=1` ใงใใใฐใ้ๅน็ใชๅ็ดใชMPใซใชใใพใใ้ๅธธใซๅคงใใช `chunks` ๅคใไฝฟ็จใใใจใ้ๅธธใซๅฐใใชใใคใฏใญใใใใตใคใบใซใชใใๅน็ใใใพใ้ซใใชใใใใใใพใใใใใใใฃใฆใGPUใฎๅน็็ใชๅฉ็จใๆๅคงๅใใๅคใ่ฆใคใใใใใซๅฎ้จใใๅฟ
่ฆใใใใพใใใใใฏใใใใซใฎใตใคใบใๆๅฐ้ใซใใใใจใซๅฏพๅฟใใใใในใฆใฎๅๅ GPUใซใใใ้ซใไธฆ่กGPUๅฉ็จใๅฏ่ฝใซใใใใใงใใ
+
+2ใคใฎใฝใชใฅใผใทใงใณใฐใซใผใใใใใพใใๅพๆฅใฎใใคใใฉใคใณAPIใฝใชใฅใผใทใงใณใจใใฆใผใถใผใฎใขใใซใๅคงๅน
ใซๅคๆดใใๅฟ
่ฆใใใใใ็พไปฃ็ใชใฝใชใฅใผใทใงใณใงใใ
+
+ๅพๆฅใฎใใคใใฉใคใณAPIใฝใชใฅใผใทใงใณ๏ผ
+- PyTorch
+- DeepSpeed
+- Megatron-LM
+
+็พไปฃ็ใชใฝใชใฅใผใทใงใณ๏ผ
+- Varuna
+- Sagemaker
+
+ๅพๆฅใฎใใคใใฉใคใณAPIใฝใชใฅใผใทใงใณใฎๅ้ก็น๏ผ
+- ใขใใซใใใชใๅคๆดใใๅฟ
่ฆใใใใใใPipelineใฏใขใธใฅใผใซใฎ้ๅธธใฎใใญใผใ`nn.Sequential`ใทใผใฑใณในใซๅๆธใ่พผใๅฟ
่ฆใใใใใขใใซใฎ่จญ่จใๅคๆดใใใใจใๅฟ
่ฆใงใใ
+- ็พๅจใPipeline APIใฏ้ๅธธใซๅถ้็ใงใใๆๅใฎใใคใใฉใคใณในใใผใธใซๆธกใใใPythonๅคๆฐใฎใปใใใใใๅ ดๅใๅ้ฟ็ญใ่ฆใคใใๅฟ
่ฆใใใใพใใ็พๅจใใใคใใฉใคใณใคใณใฟใผใใงใผในใงใฏใๅฏไธใฎใใณใฝใซใพใใฏใใณใฝใซใฎใฟใใซใๅ
ฅๅใจๅบๅใจใใฆ่ฆๆฑใใฆใใพใใใใใใฎใใณใฝใซใฏใใใใตใคใบใๆๅใฎๆฌกๅ
ใจใใฆๆใฃใฆใใๅฟ
่ฆใใใใพใใใใคใใฉใคใณใฏใใใใใใใใคใฏใญใใใใซๅๅฒใใพใใๅฏ่ฝใชๆนๅ็นใซใคใใฆใฏใใใกใใฎ่ญฐ่ซใ่กใใใฆใใพใ๏ผhttps://github.com/pytorch/pytorch/pull/50693
+- ใใคใในใใผใธใฎใฌใใซใงใฎๆกไปถไปใๅถๅพกใใญใผใฏไธๅฏ่ฝใงใใไพใใฐใT5ใฎใใใชใจใณใณใผใใผใใณใผใใผใขใใซใฏใๆกไปถไปใใจใณใณใผใใผในใใผใธใๅฆ็ใใใใใซ็นๅฅใชๅ้ฟ็ญใๅฟ
่ฆใงใใ
+- ๅใฌใคใคใผใ้
็ฝฎใใๅฟ
่ฆใใใใใใ1ใคใฎใขใใซใฎๅบๅใไปใฎใขใใซใฎๅ
ฅๅใซใชใใใใซใใพใใ
+
+VarunaใจSageMakerใจใฎๅฎ้จใฏใพใ ่กใฃใฆใใพใใใใๅฝผใใฎ่ซๆใซใใใฐใไธ่จใง่ฟฐในใๅ้กใฎใชในใใๅ
ๆใใใฆใผใถใผใฎใขใใซใซใฏใฏใใใซๅฐใใชๅคๆดใใๅฟ
่ฆใจใใชใใจๅ ฑๅใใใฆใใพใใ
+
+ๅฎ่ฃ
๏ผ
+
+- [Pytorch](https://pytorch.org/docs/stable/pipeline.html) (initial support in pytorch-1.8, and progressively getting improved in 1.9 and more so in 1.10). Some [examples](https://github.com/pytorch/pytorch/blob/master/benchmarks/distributed/pipeline/pipe.py)
+- [DeepSpeed](https://www.deepspeed.ai/tutorials/pipeline/)
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM) has an internal implementation - no API.
+- [Varuna](https://github.com/microsoft/varuna)
+- [SageMaker](https://arxiv.org/abs/2111.05972) - this is a proprietary solution that can only be used on AWS.
+- [OSLO](https://github.com/tunib-ai/oslo) - ใใฎๅฎ่ฃ
ใฏใHugging Face Transformersใซๅบใฅใใฆใใพใใ
+
+๐ค Transformersใฎในใใผใฟใน: ใใฎๅท็ญๆ็นใงใฏใใใใใฎใขใใซใๅฎๅ
จใชPP๏ผใใคใใฉใคใณไธฆๅๅฆ็๏ผใใตใใผใใใฆใใพใใใGPT2ใขใใซใจT5ใขใใซใฏๅ็ดใชMP๏ผใขใใซไธฆๅๅฆ็๏ผใตใใผใใๆใฃใฆใใพใใไธปใช้ๅฎณใฏใใขใใซใ`nn.Sequential`ใซๅคๆใงใใใใในใฆใฎๅ
ฅๅใใใณใฝใซใงใใๅฟ
่ฆใใใใใจใงใใ็พๅจใฎใขใใซใซใฏใๅคๆใ้ๅธธใซ่ค้ใซใใๅคใใฎๆฉ่ฝใๅซใพใใฆใใใใใใใๅ้คใใๅฟ
่ฆใใใใพใใ
+
+ไปใฎใขใใญใผใ๏ผ
+
+DeepSpeedใVarunaใใใใณSageMakerใฏใ[ไบคไบใซใใคใใฉใคใณใๅฎ่ก](https://docs.aws.amazon.com/sagemaker/latest/dg/model-parallel-core-features.html)ใใใณใณใปใใใไฝฟ็จใใฆใใพใใใใใงใฏใใใใฏใฏใผใใในใๅชๅ
ใใใฆใใใซ๏ผใขใคใใซๆ้๏ผใใใใซๆๅฐ้ใซๆใใพใใ
+
+Varunaใฏใๆ้ฉใชในใฑใธใฅใผใซใ็บ่ฆใใใใใซใทใใฅใฌใผใทใงใณใไฝฟ็จใใฆในใฑใธใฅใผใซใใใใซๆนๅใใใใจใใพใใ
+
+OSLOใฏใ`nn.Sequential`ใฎๅคๆใชใใงTransformersใซๅบใฅใใใคใใฉใคใณไธฆๅๅฆ็ใๅฎ่ฃ
ใใฆใใพใใ
+
+## Tensor Parallelism
+
+ใใณใฝใซไธฆๅๅฆ็ใงใฏใๅGPUใใใณใฝใซใฎในใฉใคในใฎใฟใๅฆ็ใใๅ
จไฝใๅฟ
่ฆใชๆไฝใฎใใใซใฎใฟๅฎๅ
จใชใใณใฝใซใ้็ดใใพใใ
+
+ใใฎใปใฏใทใงใณใงใฏใ[Megatron-LM](https://github.com/NVIDIA/Megatron-LM)่ซๆใใใฎใณใณใปใใใจๅณใไฝฟ็จใใพใ๏ผ[GPUใฏใฉในใฟใงใฎๅน็็ใชๅคง่ฆๆจก่จ่ชใขใใซใใฌใผใใณใฐ](https://arxiv.org/abs/2104.04473)ใ
+
+ใฉใฎใใฉใณในใใฉใผใใฎไธป่ฆใชๆง็ฏ่ฆ็ด ใฏใๅฎๅ
จใซๆฅ็ถใใใ`nn.Linear`ใซ็ถใ้็ทๅฝขใขใฏใใฃใใผใทใงใณ`GeLU`ใงใใ
+
+Megatronใฎ่ซๆใฎ่กจ่จๆณใซๅพใฃใฆใ่กๅใฎไน็ฎ้จๅใ`Y = GeLU(XA)`ใจๆธใใใจใใงใใพใใใใใงใ`X`ใจ`Y`ใฏๅ
ฅๅใใฏใใซใจๅบๅใใฏใใซใงใ`A`ใฏ้ใฟ่กๅใงใใ
+
+่กๅใฎ่จ็ฎใ่กๅๅฝขๅผใง่ฆใใจใ่กๅไน็ฎใ่คๆฐใฎGPUใงๅๅฒใงใใๆนๆณใ็ฐกๅใซ็่งฃใงใใพใ๏ผ
+
+
+้ใฟ่กๅ`A`ใ`N`ๅใฎGPUใซๅฏพใใฆๅใใจใซๅๅฒใใไธฆๅใง่กๅไน็ฎ`XA_1`ใใ`XA_n`ใๅฎ่กใใใจใ`N`ๅใฎๅบๅใใฏใใซ`Y_1ใY_2ใ...ใY_n`ใๅพใใใใใใใ็ฌ็ซใใฆ`GeLU`ใซไพ็ตฆใงใใพใ๏ผ
+
+
+ใใฎๅ็ใไฝฟ็จใใฆใๆๅพใพใงๅๆใๅฟ
่ฆใชใใพใพใไปปๆใฎๆทฑใใฎMLPใๆดๆฐใงใใพใใMegatron-LMใฎ่่
ใฏใใฎใใใฎๆ็จใชใคใฉในใใๆไพใใฆใใพใ๏ผ
+
+
+ใใซใใใใใขใใณใทใงใณใฌใคใคใผใไธฆๅๅใใใใจใฏใใใซ็ฐกๅใงใใใใใใฏๆขใซ่คๆฐใฎ็ฌ็ซใใใใใใๆใฃใฆใใใใใๆฌ่ณช็ใซไธฆๅใงใ๏ผ
+
+
+็นๅฅใช่ๆ
ฎไบ้
๏ผTPใซใฏ้ๅธธใซ้ซ้ใชใใใใฏใผใฏใๅฟ
่ฆใงใใใใใใใฃใฆ1ใคใฎใใผใใ่ถ
ใใฆTPใๅฎ่กใใชใใใจใใๅงใใใใพใใใๅฎ้ใซใฏใ1ใคใฎใใผใใซ4ใคใฎGPUใใใๅ ดๅใๆๅคงใฎTPๅบฆๆฐใฏ4ใงใใTPๅบฆๆฐ8ใๅฟ
่ฆใชๅ ดๅใฏใๅฐใชใใจใ8ใคใฎGPUใๆใคใใผใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+ใใฎใปใฏใทใงใณใฏใๅ
ใฎใใ่ฉณ็ดฐใช[TPใฎๆฆ่ฆ](https://github.com/huggingface/transformers/issues/10321#issuecomment-783543530)ใซๅบใฅใใฆใใพใใ
+by [@anton-l](https://github.com/anton-l)ใ
+
+SageMakerใฏใใใๅน็็ใชๅฆ็ใฎใใใซTPใจDPใ็ตใฟๅใใใฆไฝฟ็จใใพใใ
+
+ไปฃๆฟๅ๏ผ
+- [DeepSpeed](https://github.com/microsoft/DeepSpeed)ใฏใใใใใใณใฝใซในใฉใคใทใณใฐใใจๅผใณใพใใ่ฉณ็ดฐใฏ[DeepSpeedใฎ็นๅพด](https://www.deepspeed.ai/training/#model-parallelism)ใใ่ฆงใใ ใใใ
+
+ๅฎ่ฃ
ไพ:
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)ใซใฏใใขใใซๅบๆใฎๅ
้จๅฎ่ฃ
ใใใใพใใ
+- [parallelformers](https://github.com/tunib-ai/parallelformers)๏ผ็พๆ็นใงใฏๆจ่ซใฎใฟ๏ผใ
+- [SageMaker](https://arxiv.org/abs/2111.05972) - ใใใฏAWSใงใฎใฟไฝฟ็จใงใใใใญใใฉใคใจใฟใชใชใฝใชใฅใผใทใงใณใงใใ
+- [OSLO](https://github.com/tunib-ai/oslo)ใซใฏใTransformersใซๅบใฅใใใใณใฝใซไธฆๅๅฎ่ฃ
ใใใใพใใ
+
+๐ค Transformersใฎ็ถๆณ:
+- ใณใข: ใพใ ใณใขใซใฏๅฎ่ฃ
ใใใฆใใพใใใ
+- ใใ ใใๆจ่ซใๅฟ
่ฆใชๅ ดๅใ[parallelformers](https://github.com/tunib-ai/parallelformers)ใฏใปใจใใฉใฎใขใใซใซๅฏพใใฆใตใใผใใๆไพใใพใใใใใใณใขใซๅฎ่ฃ
ใใใใพใงใใใใไฝฟ็จใงใใพใใใใใฆใใใฌใผใใณใฐใขใผใใใตใใผใใใใใใจใๆๅพ
ใใฆใใพใใ
+- Deepspeed-InferenceใงใฏใBERTใGPT-2ใใใใณGPT-NeoใขใใซใCUDAใซใผใใซใใผในใฎ้ซ้ๆจ่ซใขใผใใงใตใใผใใใฆใใพใใ่ฉณ็ดฐใฏ[ใใกใ](https://www.deepspeed.ai/tutorials/inference-tutorial/)ใใ่ฆงใใ ใใใ
+
+## DP+PP
+
+DeepSpeedใฎ[ใใคใใฉใคใณใใฅใผใใชใขใซ](https://www.deepspeed.ai/tutorials/pipeline/)ใใใฎๆฌกใฎๅณใฏใDPใPPใจ็ตใฟๅใใใๆนๆณใ็คบใใฆใใพใใ
+
+
+
+ใใใง้่ฆใชใฎใฏใDPใฉใณใฏ0ใGPU2ใ่ฆใใชใใใDPใฉใณใฏ1ใGPU3ใ่ฆใใชใใใใใจใงใใDPใซใจใฃใฆใๅญๅจใใใฎใฏGPU 0 ใจ 1 ใฎใฟใงใใใใใฎ2ใคใฎGPUใฎใใใซใใผใฟใไพ็ตฆใใพใใGPU0ใฏPPใไฝฟ็จใใฆGPU2ใซไธ้จใฎ่ฒ ่ทใใ็งๅฏ่ฃใซใใชใใญใผใใใGPU1ใๅๆงใซGPU3ใๆฏๆดใซๅผใๅ
ฅใใพใใ
+
+ๅๆฌกๅ
ใซใฏๅฐใชใใจใ2ใคใฎGPUใๅฟ
่ฆใงใใฎใงใใใใงใฏๅฐใชใใจใ4ใคใฎGPUใๅฟ
่ฆใงใใ
+
+ๅฎ่ฃ
ไพ:
+- [DeepSpeed](https://github.com/microsoft/DeepSpeed)
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
+- [Varuna](https://github.com/microsoft/varuna)
+- [SageMaker](https://arxiv.org/abs/2111.05972)
+- [OSLO](https://github.com/tunib-ai/oslo)
+
+๐ค Transformersใฎ็ถๆณ: ใพใ ๅฎ่ฃ
ใใใฆใใพใใ
+
+## DP+PP+TP
+
+ใใใซๅน็็ใชใใฌใผใใณใฐใ่กใใใใซใ3Dใใฉใฌใชใบใ ใไฝฟ็จใใPPใTPใจDPใจ็ตใฟๅใใใพใใใใใฏๆฌกใฎๅณใง็คบใใใฆใใพใใ
+
+
+
+ใใฎๅณใฏ[3Dใใฉใฌใชใบใ ๏ผๅ
ใใฉใกใผใฟใขใใซใธใฎในใฑใผใชใณใฐ](https://www.microsoft.com/en-us/research/blog/deepspeed-extreme-scale-model-training-for-everyone/)ใจใใใใญใฐๆ็จฟใใๅๅพใใใใใฎใงใใใใใใฎ่ชญใฟ็ฉใงใใ
+
+ๅๆฌกๅ
ใซใฏๅฐใชใใจใ2ใคใฎGPUใๅฟ
่ฆใงใใฎใงใใใใงใฏๅฐใชใใจใ8ใคใฎGPUใๅฟ
่ฆใงใใ
+
+ๅฎ่ฃ
ไพ:
+- [DeepSpeed](https://github.com/microsoft/DeepSpeed) - DeepSpeedใซใฏใใใใซๅน็็ใชDPใงใใZeRO-DPใจๅผใฐใใใใฎใๅซใพใใฆใใพใใ
+- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)
+- [Varuna](https://github.com/microsoft/varuna)
+- [SageMaker](https://arxiv.org/abs/2111.05972)
+- [OSLO](https://github.com/tunib-ai/oslo)
+
+๐ค Transformersใฎ็ถๆณ: ใพใ ๅฎ่ฃ
ใใใฆใใพใใใPPใจTPใใชใใใใ
+
+## ZeRO DP+PP+TP
+
+DeepSpeedใฎไธป่ฆใชๆฉ่ฝใฎ1ใคใฏZeROใงใใใใฏDPใฎๆกๅผตๆฉ่ฝใงใใใใใซใคใใฆใฏใใงใซใZeROใใผใฟไธฆๅๅใใง่ชฌๆใใใฆใใพใใ้ๅธธใใใใฏๅ็ฌใงๅไฝใใๆฉ่ฝใงใPPใTPใฏๅฟ
่ฆใใใพใใใใใใใPPใจTPใจ็ตใฟๅใใใใใจใใงใใพใใ
+
+ZeRO-DPใPPใจ็ตใฟๅใใใใๅ ดๅใ้ๅธธใฏZeROในใใผใธ1๏ผใชใใใฃใใคใถใผใทใฃใผใใฃใณใฐ๏ผใฎใฟใๆๅนใซใชใใพใใ
+
+ZeROในใใผใธ2๏ผๅพ้
ใทใฃใผใใฃใณใฐ๏ผใใใคใใฉใคใณไธฆๅๅใจ็ตใฟๅใใใฆไฝฟ็จใใ็่ซ็ใชๅฏ่ฝๆงใฏใใใพใใใๆง่ฝใซๆชๅฝฑ้ฟใๅใผใใพใใๅใใคใฏใญใใใใใจใซๅพ้
ใใทใฃใผใใฃใณใฐใใๅใซใๅพ้
ใ้็ดใใใใใฎ่ฟฝๅ ใฎใชใใฏใทใงใณในใญใฃใใฟใผ้่จใๅฟ
่ฆใงใ้ไฟกใชใผใใผใใใใ็บ็ใใๅฏ่ฝๆงใใใใพใใใใคใใฉใคใณไธฆๅๅใฎๆง่ณชไธใๅฐใใชใใคใฏใญใใใใไฝฟ็จใใใ่จ็ฎใฎ้ไธญๅบฆ๏ผใใคใฏใญใใใใตใคใบ๏ผใใใฉใณในใซใใใใใคใใฉใคใณใใใซ๏ผใใคใฏใญใใใๆฐ๏ผใๆๅฐ้ใซๆใใใใจใซ็ฆ็นใๅฝใฆใใใฆใใพใใใใใใฃใฆใใใใใฎ้ไฟกใณในใใฏๅฝฑ้ฟใๅใผใใงใใใใ
+
+ใใใซใPPใซใฏ้ๅธธใใใๅฐใชใๅฑคใๅซใพใใฆใใใใกใขใชใฎ็ฏ็ดใฏใใใปใฉๅคงใใใใใพใใใPPใฏๆขใซๅพ้
ใตใคใบใใ1/PPใใซๅๆธใใใใใๅพ้
ใทใฃใผใใฃใณใฐใฎ็ฏ็ดใฏ็ด็ฒใชDPใใใใฏใใใซ้่ฆใงใฏใใใพใใใ
+
+ZeROในใใผใธ3ใๅๆงใฎ็็ฑใง้ฉใใฆใใพใใ - ใใๅคใใฎใใผใ้้ไฟกใๅฟ
่ฆใงใใ
+
+ใใใฆใZeROใๆใฃใฆใใใฎใงใใใไธใคใฎๅฉ็นใฏZeRO-Offloadใงใใใใใฏในใใผใธ1ใชใใใฃใใคใถใผในใใผใใCPUใซใชใใญใผใใงใใพใใ
+
+ๅฎ่ฃ
ไพ:
+- [Megatron-DeepSpeed](https://github.com/microsoft/Megatron-DeepSpeed)ใจ[BigScienceใใใฎMegatron-Deepspeed](https://github.com/bigscience-workshop/Megatron-DeepSpeed)ใฏใๅ่
ใฎใชใใธใใชใฎใใฉใผใฏใงใใ
+- [OSLO](https://github.com/tunib-ai/oslo)
+
+้่ฆใช่ซๆ:
+
+- [DeepSpeedใจMegatronใไฝฟ็จใใMegatron-Turing NLG 530Bใฎใใฌใผใใณใฐ](https://arxiv.org/abs/2201.11990)
+
+๐ค Transformersใฎ็ถๆณ: ใพใ ๅฎ่ฃ
ใใใฆใใพใใใPPใจTPใใชใใใใ
+
+
+## FlexFlow
+
+[FlexFlow](https://github.com/flexflow/FlexFlow)ใฏใใใใใซ็ฐใชใใขใใญใผใใงไธฆๅๅใฎๅ้กใ่งฃๆฑบใใพใใ
+
+่ซๆ: [Zhihao JiaใMatei ZahariaใAlex Aikenใซใใ "Deep Neural Networksใฎใใผใฟใจใขใใซใฎไธฆๅๅใ่ถ
ใใฆ"](https://arxiv.org/abs/1807.05358)
+
+FlexFlowใฏใใตใณใใซ-ใชใใฌใผใฟ-ๅฑๆง-ใใฉใกใผใฟใฎ4Dไธฆๅๅใ่กใใพใใ
+
+1. ใตใณใใซ = ใใผใฟไธฆๅๅ๏ผใตใณใใซๅไฝใฎไธฆๅๅ๏ผ
+2. ใชใใฌใผใฟ = ๅไธใฎๆไฝใใใใคใใฎใตใๆไฝใซไธฆๅๅ
+3. ๅฑๆง = ใใผใฟไธฆๅๅ๏ผ้ทใๆนๅใฎไธฆๅๅ๏ผ
+4. ใใฉใกใผใฟ = ใขใใซไธฆๅๅ๏ผๆฌกๅ
ใซ้ขไฟใชใใๆฐดๅนณใพใใฏๅ็ด๏ผ
+
+ไพ:
+* ใตใณใใซ
+
+ใทใผใฑใณใน้ท512ใฎ10ใใใใ่ใใฆใฟใพใใใใใใใใใตใณใใซๆฌกๅ
ใง2ใคใฎใใใคในใซไธฆๅๅใใใจใ10 x 512ใ5 x 2 x 512ใซใชใใพใใ
+
+* ใชใใฌใผใฟ
+
+ๅฑคๆญฃ่ฆๅใ่กใๅ ดๅใใพใstdใ่จ็ฎใใๆฌกใซmeanใ่จ็ฎใใใใผใฟใๆญฃ่ฆๅใงใใพใใใชใใฌใผใฟใฎไธฆๅๅใซใใใstdใจmeanใไธฆๅใซ่จ็ฎใงใใพใใใใใใฃใฆใใชใใฌใผใฟๆฌกๅ
ใง2ใคใฎใใใคใน๏ผcuda:0ใcuda:1๏ผใซไธฆๅๅใใใจใๆๅใซๅ
ฅๅใใผใฟใไธกๆนใฎใใใคในใซใณใใผใใcuda:0ใงstdใ่จ็ฎใใcuda:1ใงmeanใๅๆใซ่จ็ฎใใพใใ
+
+* ๅฑๆง
+
+10ใใใใฎ512้ทใใใใพใใใใใใๅฑๆงๆฌกๅ
ใง2ใคใฎใใใคในใซไธฆๅๅใใใจใ10 x 512ใ10 x 2 x 256ใซใชใใพใใ
+
+* ใใฉใกใผใฟ
+
+ใใใฏใใณใฝใซใขใใซใฎไธฆๅๅใพใใฏๅ็ดใชๅฑคใใจใฎใขใใซใฎไธฆๅๅใจไผผใฆใใพใใ
+
+ใใฎใใฌใผใ ใฏใผใฏใฎ้่ฆๆงใฏใ๏ผ1๏ผGPU/TPU/CPUๅฏพ๏ผ2๏ผRAM/DRAMๅฏพ๏ผ3๏ผ้ซ้ๅ
้จๆฅ็ถ/ไฝ้ๅค้จๆฅ็ถใชใฉใฎใชใฝใผในใๅใใใใใใในใฆใใขใซใดใชใบใ ใซใใฃใฆ่ชๅ็ใซๆ้ฉๅใใใใจใงใใใฉใฎไธฆๅๅใใฉใใงไฝฟ็จใใใใใขใซใดใชใบใ ็ใซๆฑบๅฎใใพใใ
+
+้ๅธธใซ้่ฆใชๅด้ขใฎ1ใคใฏใFlexFlowใฏ้็ใงๅบๅฎใฎใฏใผใฏใญใผใใๆใคใขใใซใฎใใใซ่จญ่จใใใฆใใใๅ็ใชๅไฝใๆใคใขใใซใฏใคใใฌใผใทใงใณใใจใซ็ฐใชใไธฆๅๅๆฆ็ฅใๅฅฝใๅ ดๅใใใใใจใงใใ
+
+ใใใใฃใฆใใใฎใใฌใผใ ใฏใผใฏใฎ็ดๆใฏ้ๅธธใซ้ญ
ๅ็ใงใใ้ธๆใใใฏใฉในใฟใง30ๅ้ใฎใทใใฅใฌใผใทใงใณใๅฎ่กใใใใฎ็นๅฎใฎ็ฐๅขใๆ้ฉใซๅฉ็จใใใใใฎๆ่ฏใฎๆฆ็ฅใๆไพใใพใใ้จๅใ่ฟฝๅ /ๅ้ค/็ฝฎๆใใใจใใใใซๅฏพใใฆๅฎ่กใใฆๅๆ้ฉๅใใฉใณใไฝๆใใพใใใใฎๅพใใใฌใผใใณใฐใงใใพใใ็ฐใชใใปใใใขใใใซใฏ็ฌ่ชใฎๆ้ฉๅใใใใพใใ
+
+๐ค Transformersใฎ็พๅจใฎ็ถๆณ: ใพใ ็ตฑๅใใใฆใใพใใใใใงใซ[transformers.utils.fx](https://github.com/huggingface/transformers/blob/master/src/transformers/utils/fx.py)ใไฝฟ็จใใฆใขใใซใFXใใฌใผในๅฏ่ฝใงใใใใใFlexFlowใๅไฝใใใใใใซๅฟ
่ฆใชๆ้ ใ่ชฐใใ่ฆใคใใๅฟ
่ฆใใใใพใใ
+
+## Which Strategy To Use When
+
+ใใใงใฏใใฉใฎไธฆๅๅๆฆ็ฅใใใคไฝฟ็จใใใใฎ้ๅธธใซใใใพใใชใขใฆใใฉใคใณใ็คบใใพใใๅใชในใใฎๆๅใ้ๅธธใใใ้ใใใจใไธ่ฌ็ใงใใ
+
+**โจ ๅไธGPU**
+
+* ใขใใซใๅไธGPUใซๅใพใๅ ดๅ๏ผ
+
+ 1. ้ๅธธใฎไฝฟ็จ
+
+* ใขใใซใๅไธGPUใซๅใพใใชใๅ ดๅ๏ผ
+
+ 1. ZeRO + CPUใใชใใญใผใใใใชใใทใงใณใงNVMeใใชใใญใผใ
+ 2. ไธ่จใซๅ ใใฆใๆๅคงใฎใฌใคใคใผใๅไธGPUใซๅใพใใชใๅ ดๅใ[Memory Centric Tiling](https://deepspeed.readthedocs.io/en/latest/zero3.html#memory-centric-tiling)๏ผ่ฉณ็ดฐใฏไปฅไธๅ็
ง๏ผใๆๅนๅ
+
+* ๆๅคงใฎใฌใคใคใผใๅไธGPUใซๅใพใใชใๅ ดๅ๏ผ
+
+ 1. ZeROใไฝฟ็จใใชใๅ ดๅ - TPใๆๅนๅใใๅฟ
่ฆใใใใพใใใชใใชใใPPใ ใใงใฏๅใใใใจใใงใใชใใใใงใใ
+ 2. ZeROใไฝฟ็จใใๅ ดๅใฏใไธ่จใฎใๅไธGPUใใฎใจใณใใชใจๅใใใฎใๅ็
งใใฆใใ ใใ
+
+**โจ ๅไธใใผใ/ใใซใGPU**
+
+* ใขใใซใๅไธGPUใซๅใพใๅ ดๅ๏ผ
+
+ 1. DDP - ๅๆฃใใผใฟไธฆๅ
+ 2. ZeRO - ็ถๆณใจไฝฟ็จใใใๆงๆใซไพๅญใใฆ้ใใใฉใใใ็ฐใชใใใจใใใใพใ
+
+* ใขใใซใๅไธGPUใซๅใพใใชใๅ ดๅ๏ผ
+
+ 1. PP
+ 2. ZeRO
+ 3. TP
+
+ ้ๅธธใซ้ซ้ใชใใผใๅ
ๆฅ็ถใNVLINKใพใใฏNVSwitchใงใใๅ ดๅใใใใใฎใในใฆใฏใปใจใใฉๅ็ญใฎๆง่ฝใงใใใใใใใชใๅ ดๅใPPใฏTPใพใใฏZeROใใใ้ใใชใใพใใTPใฎๅบฆๅใใ้ใใ็ใใใใใใใพใใใ็นๅฎใฎใปใใใขใใใงๅ่
ใ่ฆใคใใใใใซๅฎ้จใใใฎใๆๅใงใใ
+
+ TPใฏใปใจใใฉๅธธใซๅไธใใผใๅ
ใงไฝฟ็จใใใพใใใคใพใใTPใตใคใบ <= ใใผใใใใใฎGPUใงใใ
+
+* ๆๅคงใฎใฌใคใคใผใๅไธGPUใซๅใพใใชใๅ ดๅ๏ผ
+
+ 1. ZeROใไฝฟ็จใใชใๅ ดๅ - TPใไฝฟ็จใใๅฟ
่ฆใใใใพใใใชใใชใใPPใ ใใงใฏๅใใใใจใใงใใชใใใใงใใ
+ 2. ZeROใไฝฟ็จใใๅ ดๅใฏใไธ่จใฎใๅไธGPUใใฎใจใณใใชใจๅใใใฎใๅ็
งใใฆใใ ใใ
+
+**โจ ใใซใใใผใ/ใใซใGPU**
+
+* ้ซ้ใชใใผใ้ๆฅ็ถใใใๅ ดๅ๏ผ
+
+ 1. ZeRO - ใขใใซใธใฎใปใจใใฉใฎๅคๆดใไธ่ฆใงใ
+ 2. PP+TP+DP - ้ไฟกใๅฐใชใใใขใใซใซๅคง่ฆๆจกใชๅคๆดใๅฟ
่ฆใงใ
+
+* ้
ใใใผใ้ๆฅ็ถใใใใGPUใกใขใชใๅฐใชใๅ ดๅ๏ผ
+
+ 1. DP+PP+TP+ZeRO-1
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_gpu_one.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_gpu_one.md
new file mode 100644
index 0000000000000000000000000000000000000000..2c2bc540e48384fb8729d7ba5a0cc3ecf0b37a47
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_gpu_one.md
@@ -0,0 +1,438 @@
+
+
+# Methods and tools for efficient training on a single GPU
+
+ใใฎใฌใคใใงใฏใใกใขใชใฎๅฉ็จๅน็ใๆ้ฉๅใใใใฌใผใใณใฐใ้ซ้ๅใใใใจใงใใขใใซใฎใใฌใผใใณใฐๅน็ใๅไธใใใใใใซไฝฟ็จใงใใๅฎ็จ็ใชใใฏใใใฏใ็ดนไปใใพใใใใฌใผใใณใฐไธญใซGPUใใฉใฎใใใซๅฉ็จใใใใใ็่งฃใใใๅ ดๅใฏใๆๅใซใ[ใขใใซใใฌใผใใณใฐใฎ่งฃๅๅญฆ](model_memory_anatomy)ใใฎใณใณใปใใใฌใคใใๅ็
งใใฆใใ ใใใใใฎใฌใคใใฏๅฎ็จ็ใชใใฏใใใฏใซ็ฆ็นใๅฝใฆใฆใใพใใ
+
+
+
+่คๆฐใฎGPUใๆญ่ผใใใใทใณใซใขใฏใปในใงใใๅ ดๅใใใใใฎใขใใญใผใใฏไพ็ถใจใใฆๆๅนใงใใใใใซใ[ใใซใGPUใปใฏใทใงใณ](perf_train_gpu_many)ใง่ชฌๆใใใฆใใ่ฟฝๅ ใฎๆนๆณใๆดป็จใงใใพใใ
+
+
+
+ๅคง่ฆๆจกใชใขใใซใใใฌใผใใณใฐใใ้ใๅๆใซ่ๆ
ฎใในใ2ใคใฎๅด้ขใใใใพใ๏ผ
+
+* ใใผใฟใฎในใซใผใใใ/ใใฌใผใใณใฐๆ้
+* ใขใใซใฎใใใฉใผใใณใน
+
+ในใซใผใใใ๏ผใตใณใใซ/็ง๏ผใๆๅคงๅใใใใจใฏใใใฌใผใใณใฐใณในใใไฝๆธใใใพใใใใใฏไธ่ฌ็ใซใGPUใใงใใใ ใๅนๆ็ใซๆดป็จใใGPUใกใขใชใ้็ใพใงๅใใใใจใซใใฃใฆ้ๆใใใพใใๅธๆใใใใใใตใคใบใGPUใกใขใชใฎๅถ้ใ่ถ
ใใๅ ดๅใๅพ้
่็ฉใชใฉใฎใกใขใชๆ้ฉๅใใฏใใใฏใๅฝน็ซใกใพใใ
+
+ใใใใๅฅฝใฟใฎใใใใตใคใบใใกใขใชใซๅใพใๅ ดๅใใกใขใชใๆ้ฉๅใใใใฏใใใฏใ้ฉ็จใใ็็ฑใฏใใใพใใใๅคงใใชใใใใตใคใบใไฝฟ็จใงใใใใใจใใฃใฆใใใใๅฟ
ใใใไฝฟ็จใในใใงใฏใใใพใใใใใคใใผใใฉใกใผใฟใฎ่ชฟๆดใฎไธ็ฐใจใใฆใใฉใฎใใใใตใคใบใๆ่ฏใฎ็ตๆใ็ใฟๅบใใใๆฑบๅฎใใใชใฝใผในใ้ฉๅใซๆ้ฉๅใใๅฟ
่ฆใใใใพใใ
+
+ใใฎใฌใคใใงใซใใผใใใฆใใๆนๆณใจใใผใซใฏใใใฌใผใใณใฐใใญใปในใซไธใใๅฝฑ้ฟใซๅบใฅใใฆๅ้กใงใใพใ๏ผ
+
+
+| Method/tool | Improves training speed | Optimizes memory utilization |
+|:-----------------------------------------------------------|:------------------------|:-----------------------------|
+| [Batch size choice](#batch-size-choice) | Yes | Yes |
+| [Gradient accumulation](#gradient-accumulation) | No | Yes |
+| [Gradient checkpointing](#gradient-checkpointing) | No | Yes |
+| [Mixed precision training](#mixed-precision-training) | Yes | (No) |
+| [Optimizer choice](#optimizer-choice) | Yes | Yes |
+| [Data preloading](#data-preloading) | Yes | No |
+| [DeepSpeed Zero](#deepspeed-zero) | No | Yes |
+| [torch.compile](#using-torchcompile) | Yes | No |
+
+
+
+**ๆณจๆ**: ๅฐใใชใขใใซใจๅคงใใชใใใใตใคใบใไฝฟ็จใใๅ ดๅใใกใขใชใฎ็ฏ็ดใ่กใใใพใใใๅคงใใชใขใใซใจๅฐใใชใใใใตใคใบใไฝฟ็จใใๅ ดๅใใกใขใชใฎไฝฟ็จ้ใๅขๅ ใใพใใ
+
+
+
+ใใใใฎใใฏใใใฏใฏใ[`Trainer`]ใงใขใใซใใใฌใผใใณใฐใใฆใใๅ ดๅใใ็ด็ฒใชPyTorchใซใผใใ่จ่ฟฐใใฆใใๅ ดๅใฎไธกๆนใงๅฉ็จใงใใพใใ่ฉณ็ดฐใชๆ้ฉๅใฎ่จญๅฎใซใคใใฆใฏใ๐ค Accelerateใไฝฟ็จใใฆ[ใใใใฎๆ้ฉๅใ่จญๅฎใงใใพใ](#using--accelerate)ใ
+
+ใใใใฎๆนๆณใๅๅใชๅฉ็ใใใใใใชใๅ ดๅใไปฅไธใฎใชใใทใงใณใๆค่จใงใใพใ๏ผ
+* [ๅน็็ใชใฝใใใฆใงใขใใชใใซใใๅใใใซในใฟใ Dockerใณใณใใใฎไฝๆ](#efficient-software-prebuilds)
+* [Mixture of Experts๏ผMoE๏ผใไฝฟ็จใใใขใใซใๆค่จ](#mixture-of-experts)
+* [ใขใใซใBetterTransformerใซๅคๆใใฆใPyTorchใใคใใฃใใฎใขใใณใทใงใณใๆดป็จ](#using-pytorch-native-attention)
+
+ๆๅพใซใใใใใฎๆนๆณใใพใ ๅๅใงใชใๅ ดๅใA100ใชใฉใฎใตใผใใผใฐใฌใผใGPUใซๅใๆฟใใฆใใใใใชใๆนๅใๅฟ
่ฆใใใใใพใใใใใใใฎใขใใญใผใใฏใใใซใGPUใปใใใขใใใงใๆๅนใงใใใ[ใใซใGPUใปใฏใทใงใณ](perf_train_gpu_many)ใง่ชฌๆใใใฆใใ่ฟฝๅ ใฎไธฆๅๅๆ่กใๆดป็จใงใใพใใ
+
+## Batch size choice
+
+ๆ้ฉใชใใใฉใผใใณในใๅฎ็พใใใใใซใ้ฉๅใชใใใใตใคใบใ็นๅฎใใใใจใใๅงใใพใใใใ2^Nใฎใตใคใบใฎใใใใตใคใบใจๅ
ฅๅ/ๅบๅใใฅใผใญใณๆฐใไฝฟ็จใใใใจใๆจๅฅจใใใฆใใพใใ้ๅธธใใใใฏ8ใฎๅๆฐใงใใใไฝฟ็จใใใใผใใฆใงใขใจใขใใซใฎใใผใฟๅใซไพๅญใใใใจใใใใพใใ
+
+ๅ่ใพใงใซใNVIDIAใฎ[ๅ
ฅๅ/ๅบๅใใฅใผใญใณๆฐใฎๆจๅฅจไบ้
](https://docs.nvidia.com/deeplearning/performance/dl-performance-fully-connected/index.html#input-features)ใจ[ใใใใตใคใบ](https://docs.nvidia.com/deeplearning/performance/dl-performance-fully-connected/index.html#batch-size)ใ็ขบ่ชใใฆใใ ใใ๏ผใใใใฏGEMM๏ผไธ่ฌ็ใช่กๅไน็ฎ๏ผใซ้ขไธใใพใ๏ผใ
+
+[Tensor Core่ฆไปถ](https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#requirements-tc)ใงใฏใใใผใฟๅใจใใผใใฆใงใขใซๅบใฅใใฆไนๆฐใๅฎ็พฉใใใฆใใพใใใใจใใฐใfp16ใใผใฟๅใฎๅ ดๅใ64ใฎๅๆฐใไฝฟ็จใใใใจใๆจๅฅจใใใพใ๏ผA100 GPUใฎๅ ดๅใ้คใ๏ผใ
+
+ๅฐใใชใใฉใกใผใฟใฎๅ ดๅใ[ๆฌกๅ
้ๅญๅๅนๆ](https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#dim-quantization)ใ่ๆ
ฎใใฆใใ ใใใใใใฏใฟใคใชใณใฐใ่กใใใ้ฉๅใชไนๆฐใๅคงๅน
ใช้ซ้ๅใใใใใๅ ดๅใใใใพใใ
+
+## Gradient Accumulation
+
+**ๅพ้
่็ฉ**ใกใฝใใใฏใGPUใฎใกใขใชๅฎน้ใฎๅถ็ดใซใใฃใฆ่ชฒใใใใๅถ้ใ่ถ
ใใๅนๆ็ใชใใใใตใคใบใๅฎ็พใใใใใซใๅพ้
ใๅฐใใชๅขๅใง่จ็ฎใใใใจใ็ฎ็ใจใใฆใใพใใใใฎใขใใญใผใใงใฏใใขใใซใ้ ๆนๅใใใณ้ๆนๅใซๅฐใใชใใใใงๅๅพฉ็ใซ่จ็ฎใใใใฎ้็จใงๅพ้
ใ่็ฉใใพใใๅๅใชๆฐใฎๅพ้
ใ่็ฉใใใใใใขใใซใฎๆ้ฉๅในใใใใๅฎ่กใใพใใๅพ้
่็ฉใไฝฟ็จใใใใจใงใGPUใฎใกใขใชๅฎน้ใซใใๅถ็ดใ่ถ
ใใฆ**ๅนๆ็ใชใใใใตใคใบ**ใๅขใใใใจใใงใใพใใใๅพ้
่็ฉใซใใฃใฆๅฐๅ
ฅใใใ่ฟฝๅ ใฎ้ ๆนๅใใใณ้ๆนๅใฎ่จ็ฎใฏใใฌใผใใณใฐใใญใปในใ้
ใใใๅฏ่ฝๆงใใใใใจใซๆณจๆใๅฟ
่ฆใงใใ
+
+`TrainingArguments`ใซ`gradient_accumulation_steps`ๅผๆฐใ่ฟฝๅ ใใใใจใงใๅพ้
่็ฉใๆๅนใซใใใใจใใงใใพใ๏ผ
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=1, gradient_accumulation_steps=4, **default_args)
+```
+
+ไธ่จใฎไพใงใฏใๅนๆ็ใชใใใใตใคใบใฏ4ใซใชใใพใใ
+
+ใพใใใใฌใผใใณใฐใซใผใใๅฎๅ
จใซๅถๅพกใใใใใซ๐ค Accelerateใไฝฟ็จใใใใจใใงใใพใใ๐ค Accelerateใฎไพใฏใ[ใใฎใฌใคใใฎๅพๅใซใใ](#using--accelerate)ใง่ฆใคใใใใจใใงใใพใใ
+
+ใงใใใ ใGPUใฎไฝฟ็จ็ใๆๅคง้ใซใใใใจใๆจๅฅจใใใฆใใพใใใ้ซใๅพ้
่็ฉในใใใๆฐใฏใใฌใผใใณใฐใฎ้
ๅปถใใใ้ก่ใซใใใใจใใใใพใใไปฅไธใฎไพใ่ใใฆใฟใพใใใใ`per_device_train_batch_size=4`ใฎๅ ดๅใๅพ้
่็ฉใไฝฟ็จใใชใใจGPUใฎๅถ้ใซ้ใใพใใใใใใตใคใบ64ใงใใฌใผใใณใฐใใใๅ ดๅใ`per_device_train_batch_size`ใ1ใซ่จญๅฎใใ`gradient_accumulation_steps`ใ64ใซ่จญๅฎใใชใใงใใ ใใใไปฃใใใซใ`per_device_train_batch_size=4`ใไฟๆใใ`gradient_accumulation_steps=16`ใ่จญๅฎใใพใใใใใซใใใๅใๅนๆ็ใชใใใใตใคใบใๅพใใใๅฉ็จๅฏ่ฝใชGPUใชใฝใผในใๅนๆ็ใซๆดป็จใใใพใใ
+
+่ฉณ็ดฐใชๆ
ๅ ฑใซใคใใฆใฏใ[RTX-3090็จใฎใใใใตใคใบใจๅพ้
่็ฉใฎใใณใใใผใฏ](https://github.com/huggingface/transformers/issues/14608#issuecomment-1004392537)ใใใณ[A100็จใฎใใใใตใคใบใจๅพ้
่็ฉใฎใใณใใใผใฏ](https://github.com/huggingface/transformers/issues/15026#issuecomment-1005033957)ใๅ็
งใใฆใใ ใใใ
+
+## Gradient Checkpointing
+
+ไธ้จใฎๅคงใใชใขใใซใฏใใใใใตใคใบใ1ใซ่จญๅฎใใๅพ้
่็ฉใไฝฟ็จใใฆใใๅ ดๅใงใใกใขใชใฎๅ้กใซ็ด้ขใใใใจใใใใพใใใใใฏใใกใขใชในใใฌใผใธใๅฟ
่ฆใชไปใฎใณใณใใผใใณใใๅญๅจใใใใใงใใ
+
+ๅๅใใในใใใฎใในใฆใฎใขใฏใใฃใใผใทใงใณใไฟๅญใใฆใ้ๅใใในใงๅพ้
ใ่จ็ฎใใใจใใใชใใฎใกใขใชใชใผใใผใใใใ็บ็ใใพใใ้ๅใใในใงๅฟ
่ฆใชใจใใซใขใฏใใฃใใผใทใงใณใ็ ดๆฃใใฆๅ่จ็ฎใใไปฃๆฟใขใใญใผใใฏใ่จ็ฎใชใผใใผใใใใๅคงๅน
ใซๅขๅ ใใใใฌใผใใณใฐใใญใปในใ้
ใใชใใพใใ
+
+**ๅพ้
ใใงใใฏใใคใณใ**ใฏใใใใใฎ2ใคใฎใขใใญใผใใฎๆ่กทๆกใๆไพใใ่จ็ฎใฐใฉใๅ
จไฝใงๆฆ็ฅ็ใซ้ธๆใใใใขใฏใใฃใใผใทใงใณใฎใฟใไฟๅญใใใใใๅพ้
ใๅ่จ็ฎใใๅฟ
่ฆใใใใขใฏใใฃใใผใทใงใณใฎไธ้จใ ใใ็ฏ็ดใใพใใๅพ้
ใใงใใฏใใคใณใใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ใใฎ็ด ๆดใใใ่จไบ](https://medium.com/tensorflow/fitting-larger-networks-into-memory-583e3c758ff9)ใๅ็
งใใฆใใ ใใใ
+
+[`Trainer`]ใงๅพ้
ใใงใใฏใใคใณใใๆๅนใซใใใซใฏใ[`TrainingArguments`]ใซๅฏพๅฟใใใใฉใฐใๆธกใใพใ๏ผ
+
+
+```py
+training_args = TrainingArguments(
+ per_device_train_batch_size=1, gradient_accumulation_steps=4, gradient_checkpointing=True, **default_args
+)
+```
+
+ไปฃๆฟๆๆฎตใจใใฆใ๐ค Accelerateใไฝฟ็จใใใใจใใงใใพใ - ๐ค Accelerateใฎไพใฏ[ใใฎใฌใคใใฎใใใซๅพใใซใใใพใ](#using--accelerate)ใ
+
+
+
+ๅพ้
ใใงใใฏใใคใณใใไฝฟ็จใใใใจใงใกใขใชๅน็ใๅไธใใๅ ดๅใใใใพใใใใใฌใผใใณใฐ้ๅบฆใฏ็ด20%้
ใใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+
+
+## Mixed precision training
+
+**ๆททๅ็ฒพๅบฆใใฌใผใใณใฐ**ใฏใใขใใซใฎใใฌใผใใณใฐใฎ่จ็ฎๅน็ใๆ้ฉๅใใๆ่กใงใ็นๅฎใฎๅคๆฐใซๅฏพใใฆไฝ็ฒพๅบฆใฎๆฐๅคใใฉใผใใใใๅฉ็จใใพใใๅพๆฅใใปใจใใฉใฎใขใใซใฏๅคๆฐใ่กจ็พใๅฆ็ใใใใใซ32ใใใๆตฎๅๅฐๆฐ็น็ฒพๅบฆ๏ผfp32ใพใใฏfloat32๏ผใไฝฟ็จใใฆใใพใใใใใใใในใฆใฎๅคๆฐใๆญฃ็ขบใช็ตๆใๅพใใใใซใใฎ้ซ็ฒพๅบฆใฎใฌใใซใๅฟ
่ฆใจใใชใๅ ดๅใใใใพใใไธ้จใฎๅคๆฐใฎ็ฒพๅบฆใ16ใใใๆตฎๅๅฐๆฐ็น๏ผfp16ใพใใฏfloat16๏ผใชใฉใฎใใไฝใๆฐๅคใใฉใผใใใใซๅคๆดใใใใจใงใ่จ็ฎใ้ซ้ๅใงใใพใใใใฎใขใใญใผใใงใฏใไธ้จใฎ่จ็ฎใฏๅ็ฒพๅบฆใง่กใใใไธ้จใฏใพใ ๅฎๅ
จใช็ฒพๅบฆใง่กใใใใใใใใฎใขใใญใผใใฏๆททๅ็ฒพๅบฆใใฌใผใใณใฐใจๅผใฐใใฆใใพใใ
+
+ๆใไธ่ฌ็ใซๆททๅ็ฒพๅบฆใใฌใผใใณใฐใฏใfp16๏ผfloat16๏ผใใผใฟๅใไฝฟ็จใใฆๅฎ็พใใใพใใใไธ้จใฎGPUใขใผใญใใฏใใฃ๏ผใขใณใใขใขใผใญใใฏใใฃใชใฉ๏ผใงใฏbf16ใใใณtf32๏ผCUDAๅ
้จใใผใฟๅ๏ผใใผใฟๅใๆไพใใใฆใใพใใใใใใฎใใผใฟๅใฎ้ใใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใฏใ[NVIDIAใฎใใญใฐ](https://developer.nvidia.com/blog/accelerating-ai-training-with-tf32-tensor-cores/)ใ็ขบ่ชใใฆใใ ใใใ
+
+### fp16
+
+ๆททๅ็ฒพๅบฆใใฌใผใใณใฐใฎไธปใชๅฉ็นใฏใๅ็ฒพๅบฆ๏ผfp16๏ผใงใขใฏใใฃใใผใทใงใณใไฟๅญใใใใจใใๅพใใใพใใ
+ๅพ้
ใๅ็ฒพๅบฆใง่จ็ฎใใใพใใใๆ้ฉๅในใใใใงใฏๅใณๅฎๅ
จ็ฒพๅบฆใซๅคๆใใใใใใใใใงใฏใกใขใชใฏไฟๅญใใใพใใใ
+ๆททๅ็ฒพๅบฆใใฌใผใใณใฐใฏ่จ็ฎ้ๅบฆใๅไธใใใไธๆนใ็นใซๅฐใใชใใใใตใคใบใฎๅ ดๅใใใๅคใใฎGPUใกใขใชใไฝฟ็จใใใใจใใใใพใใ
+ใใใฏใใขใใซใGPUไธใซ16ใใใใใใณ32ใใใ็ฒพๅบฆใฎไธกๆนใงๅญๅจใใใใใงใ๏ผGPUไธใฎๅ
ใฎใขใใซใฎ1.5ๅ๏ผใ
+
+ๆททๅ็ฒพๅบฆใใฌใผใใณใฐใๆๅนใซใใใซใฏใ`fp16`ใใฉใฐใ`True`ใซ่จญๅฎใใพใ๏ผ
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=4, fp16=True, **default_args)
+```
+
+๐ค Accelerateใไฝฟ็จใใๅ ดๅใ๐ค Accelerateใฎไพใฏ[ใใฎใฌใคใใฎใใใซๅพใใซใใใพใ](#using--accelerate)ใ
+
+### BF16
+
+Ampereใพใใฏใใไปฅ้ใฎใใผใใฆใงใขใซใขใฏใปในใงใใๅ ดๅใๆททๅ็ฒพๅบฆใใฌใผใใณใฐใจ่ฉไพกใซbf16ใไฝฟ็จใงใใพใใbf16ใฏfp16ใใใ็ฒพๅบฆใๅฃใใพใใใใฏใใใซๅคงใใชๅ็็ฏๅฒใๆใฃใฆใใพใใfp16ใงใฏใๆใคใใจใใงใใๆๅคงใฎๆฐใฏ `65535` ใงใใใใใใ่ถ
ใใๆฐๅคใฏใชใผใใผใใญใผใๅผใ่ตทใใใพใใไธๆนใbf16ใฎๆฐๅคใฏ `3.39e+38` ใฎใใใซๅคงใใใใใใฏfp32ใจใปใผๅใใงใ - ใฉใกใใๆฐๅค็ฏๅฒใซ8ใใใใไฝฟ็จใใฆใใใใใงใใ
+
+BF16ใๆๅนใซใใใซใฏใ๐ค Trainerใงไปฅไธใฎใใใซ่จญๅฎใใพใ๏ผ
+
+
+```python
+training_args = TrainingArguments(bf16=True, **default_args)
+```
+
+
+### TF32
+
+ใขใณใใขใใผใใฆใงใขใฏใtf32ใจใใ็นๅฅใชใใผใฟๅใไฝฟ็จใใพใใใใใฏใfp32ใจๅใๆฐๅค็ฏๅฒ๏ผ8ใใใ๏ผใๆใฃใฆใใพใใใ23ใใใใฎ็ฒพๅบฆใงใฏใชใใ10ใใใใฎ็ฒพๅบฆ๏ผfp16ใจๅใ๏ผใๆใกใๅ่จใง19ใใใใใไฝฟ็จใใพใใใใใใฏ้ๅธธใฎfp32ใใฌใผใใณใฐใใใณๆจ่ซใณใผใใไฝฟ็จใใtf32ใตใใผใใๆๅนใซใใใใจใงใๆๅคง3ๅใฎในใซใผใใใใฎๅไธใๅพใใใ็นใงใ้ญๆณใฎใใใใงใใ่กใๅฟ
่ฆใใใใฎใฏใๆฌกใฎใณใผใใ่ฟฝๅ ใใใ ใใงใ๏ผ
+
+```python
+import torch
+torch.backends.cuda.matmul.allow_tf32 = True
+torch.backends.cudnn.allow_tf32 = True
+```
+
+
+ไฝฟ็จใใใฆใใGPUใใขใณใใขใทใชใผใบใงใใใจไปฎๅฎใใCUDAใฏๅฏ่ฝใช้ใtf32ใไฝฟ็จใใใใใซ่ชๅ็ใซๅใๆฟใใพใใ
+
+[NVIDIAใฎ็ ็ฉถใซใใใฐ](https://developer.nvidia.com/blog/accelerating-ai-training-with-tf32-tensor-cores/)ใใปใจใใฉใฎๆฉๆขฐๅญฆ็ฟใใฌใผใใณใฐใฏใผใฏใญใผใใฏtf32ใใฌใผใใณใฐใจfp32ใใฌใผใใณใฐใงๅใ้ฃ่งฃๅบฆใจๅๆใ็คบใใพใใใใงใซfp16ใพใใฏbf16ๆททๅ็ฒพๅบฆใไฝฟ็จใใฆใใๅ ดๅใในใซใผใใใใฎๅไธใซๅฝน็ซใคใใจใใใใพใใ
+
+๐ค Trainerใงใใฎใขใผใใๆๅนใซใใใใจใใงใใพใ๏ผ
+
+
+```python
+TrainingArguments(tf32=True, **default_args)
+```
+
+
+
+tf32ใฏ`tensor.to(dtype=torch.tf32)`ใไปใใฆ็ดๆฅใขใฏใปในใงใใพใใใใใใฏๅ
้จใฎCUDAใใผใฟๅใงใใtf32ใใผใฟๅใไฝฟ็จใใใซใฏใ`torch>=1.7`ใๅฟ
่ฆใงใใ
+
+
+
+tf32ใจไปใฎ็ฒพๅบฆใซ้ขใใ่ฉณ็ดฐใชๆ
ๅ ฑใซใคใใฆใฏใไปฅไธใฎใใณใใใผใฏใๅ็
งใใฆใใ ใใ๏ผ
+[RTX-3090](https://github.com/huggingface/transformers/issues/14608#issuecomment-1004390803)ใใใณ
+[A100](https://github.com/huggingface/transformers/issues/15026#issuecomment-1004543189)ใ
+
+## Flash Attention 2
+
+transformersใงFlash Attention 2็ตฑๅใไฝฟ็จใใใใจใงใใใฌใผใใณใฐใฎในใซใผใใใใๅไธใใใใใจใใงใใพใใFlash Attention 2ใขใธใฅใผใซใๅซใใขใใซใฎ่ชญใฟ่พผใฟๆนๆณใซใคใใฆใฏใ[single GPU section](./perf_infer_gpu_one#Flash-Attention-2)ใฎ้ฉๅใชใปใฏใทใงใณใ็ขบ่ชใใฆ่ฉณ็ดฐใๅญฆใณใพใใใใ
+
+## ใชใใใฃใใคใถใฎ้ธๆ
+
+Transformerใขใใซใใใฌใผใใณใฐใใใใใซๆใไธ่ฌ็ใซไฝฟ็จใใใใชใใใฃใใคใถใฏAdamใพใใฏAdamW๏ผ้ใฟๆธ่กฐใไผดใAdam๏ผใงใใAdamใฏๅๅใฎๅพ้
ใฎ็งปๅๅนณๅใไฟๅญใใใใจใงๅๆใ้ๆใใพใใใใขใใซใใฉใกใผใฟใฎๆฐใฎใชใผใใผใฎ่ฟฝๅ ใกใขใชใใใใใชใณใใ่ฟฝๅ ใใพใใใใใ่งฃๆถใใใใใซใไปฃๆฟใชใใใฃใใคใถใไฝฟ็จใงใใพใใใใจใใฐใ[NVIDIA/apex](https://github.com/NVIDIA/apex)ใใคใณในใใผใซใใใฆใใๅ ดๅใ`adamw_apex_fused`ใฏใในใฆใฎใตใใผใใใใฆใใAdamWใชใใใฃใใคใถใฎไธญใงๆใ้ซ้ใชใใฌใผใใณใฐไฝ้จใๆไพใใพใใ
+
+[`Trainer`]ใฏใ็ดๆฅไฝฟ็จใงใใใใพใใพใชใชใใใฃใใคใถใ็ตฑๅใใฆใใใ`adamw_hf`ใ`adamw_torch`ใ`adamw_torch_fused`ใ`adamw_apex_fused`ใ`adamw_anyprecision`ใ`adafactor`ใใพใใฏ`adamw_bnb_8bit`ใๅซใพใใฆใใพใใใตใผใใใผใใฃใฎๅฎ่ฃ
ใไปใใฆใใใซๅคใใฎใชใใใฃใใคใถใ่ฟฝๅ ใงใใพใใ
+
+AdamWใชใใใฃใใคใถใฎไปฃๆฟๆๆฎตใซใคใใฆ่ฉณใใ่ฆใฆใฟใพใใใ๏ผ
+1. [`Trainer`]ใงไฝฟ็จๅฏ่ฝใช`adafactor`
+2. Trainerใงไฝฟ็จๅฏ่ฝใช`adamw_bnb_8bit`ใฏใใใขใณในใใฌใผใทใงใณ็จใซไปฅไธใงใตใผใใใผใใฃใฎ็ตฑๅใๆไพใใใฆใใพใใ
+
+ๆฏ่ผใฎใใใ3Bใใฉใกใผใฟใขใใซ๏ผไพ๏ผใgoogle-t5/t5-3bใ๏ผใฎๅ ดๅ๏ผ
+* ๆจๆบใฎAdamWใชใใใฃใใคใถใฏใๅใใฉใกใผใฟใซ8ใใคใใไฝฟ็จใใใใใ24GBใฎGPUใกใขใชใๅฟ
่ฆใงใ๏ผ8 * 3 => 24GB๏ผใ
+* Adafactorใชใใใฃใใคใถใฏ12GBไปฅไธๅฟ
่ฆใงใใๅใใฉใกใผใฟใซใใใ4ใใคใไปฅไธใไฝฟ็จใใใใใ4 * 3ใจๅฐใไฝๅใซใชใใพใใ
+* 8ใใใใฎBNB้ๅญๅใชใใใฃใใคใถใฏใใในใฆใฎใชใใใฃใใคใถใฎ็ถๆ
ใ้ๅญๅใใใฆใใๅ ดๅใใใใ6GBใใไฝฟ็จใใพใใใ
+
+### Adafactor
+
+Adafactorใฏใ้ใฟ่กๅใฎๅ่ฆ็ด ใฎใใใซๅๅใฎๅนณๅใไฟๅญใใพใใใไปฃใใใซใ๏ผ่กใใจใจๅใใจใฎๅนณๅใฎๅ่จใชใฉ๏ผ้
+
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=4, optim="adafactor", **default_args)
+```
+
+
+ไปใฎใขใใญใผใ๏ผๅพ้
่็ฉใๅพ้
ใใงใใฏใใคใณใใๆททๅ็ฒพๅบฆใใฌใผใใณใฐ๏ผใจ็ตใฟๅใใใใใจใงใในใซใผใใใใ็ถญๆใใชใใๆๅคง3ๅใฎๅไธใ่ฆใใใใใจใใใใพใ๏ผใใ ใใๅ่ฟฐใฎใใใซใAdafactorใฎๅๆๆงใฏAdamใใใๆชใใใจใใใใพใใ
+
+### 8ใใใ Adam
+
+Adafactorใฎใใใซใชใใใฃใใคใถใฎ็ถๆ
ใ้็ดใใไปฃใใใซใ8ใใใใฎAdamใฏๅฎๅ
จใช็ถๆ
ใไฟๆใใใใใ้ๅญๅใใพใใ้ๅญๅใจใฏใ็ถๆ
ใไฝใ็ฒพๅบฆใงไฟๅญใใๆ้ฉๅใฎใใใ ใใซ้้ๅญๅใใใใจใๆๅณใใพใใใใใฏๆททๅ็ฒพๅบฆใใฌใผใใณใฐใฎ่ๅพใซใใใขใคใใขใจไผผใฆใใพใใ
+
+`adamw_bnb_8bit`ใไฝฟ็จใใใซใฏใๅใซ[`TrainingArguments`]ใง`optim="adamw_bnb_8bit"`ใ่จญๅฎใใใ ใใงใ๏ผ
+
+
+```py
+training_args = TrainingArguments(per_device_train_batch_size=4, optim="adamw_bnb_8bit", **default_args)
+```
+
+ใใ ใใใใขใณในใใฌใผใทใงใณ็ฎ็ใง8ใใใใชใใใฃใใคใถใใตใผใใใผใใฃใฎๅฎ่ฃ
ใไฝฟ็จใใใใจใใงใใพใใใใใ็ตฑๅใใๆนๆณใ็ขบ่ชใใใใใงใใ
+
+ใพใใ8ใใใAdamใชใใใฃใใคใถใๅฎ่ฃ
ใใ`bitsandbytes`ใฉใคใใฉใชใใคใณในใใผใซใใใใใซใGitHub [ใชใใธใใช](https://github.com/TimDettmers/bitsandbytes)ๅ
ใฎใคใณในใใผใซใฌใคใใซๅพใฃใฆใใ ใใใ
+
+ๆฌกใซใใชใใใฃใใคใถใๅๆๅใใๅฟ
่ฆใใใใพใใใใใซใฏ2ใคใฎในใใใใๅซใพใใพใ๏ผ
+* ใพใใใขใใซใฎใใฉใกใผใฟใ2ใคใฎใฐใซใผใใซๅใใพใ - ้ใฟๆธ่กฐใ้ฉ็จใใในใใฐใซใผใใจใ้ฉ็จใในใใงใชใใฐใซใผใใงใใ้ๅธธใใใคใขในใจใฌใคใคใผๆญฃ่ฆๅใใฉใกใผใฟใฏ้ใฟๆธ่กฐใใใพใใใ
+* ๆฌกใซใไปฅๅใซไฝฟ็จใใAdamWใชใใใฃใใคใถใจๅใใใฉใกใผใฟใไฝฟ็จใใใใใซใใใใคใใฎๅผๆฐใฎ่ชฟๆดใ่กใใพใใ
+
+
+```py
+import bitsandbytes as bnb
+from torch import nn
+from transformers.trainer_pt_utils import get_parameter_names
+
+training_args = TrainingArguments(per_device_train_batch_size=4, **default_args)
+
+decay_parameters = get_parameter_names(model, [nn.LayerNorm])
+decay_parameters = [name for name in decay_parameters if "bias" not in name]
+optimizer_grouped_parameters = [
+ {
+ "params": [p for n, p in model.named_parameters() if n in decay_parameters],
+ "weight_decay": training_args.weight_decay,
+ },
+ {
+ "params": [p for n, p in model.named_parameters() if n not in decay_parameters],
+ "weight_decay": 0.0,
+ },
+]
+
+optimizer_kwargs = {
+ "betas": (training_args.adam_beta1, training_args.adam_beta2),
+ "eps": training_args.adam_epsilon,
+}
+optimizer_kwargs["lr"] = training_args.learning_rate
+adam_bnb_optim = bnb.optim.Adam8bit(
+ optimizer_grouped_parameters,
+ betas=(training_args.adam_beta1, training_args.adam_beta2),
+ eps=training_args.adam_epsilon,
+ lr=training_args.learning_rate,
+)
+```
+
+ๆๅพใซใใซในใฟใ ใชใใใฃใใคใถใ`Trainer`ใซๅผๆฐใจใใฆๆธกใใพใ๏ผ
+
+
+```py
+trainer = Trainer(model=model, args=training_args, train_dataset=ds, optimizers=(adam_bnb_optim, None))
+```
+
+ไปใฎใขใใญใผใ๏ผๅพ้
่็ฉใๅพ้
ใใงใใฏใใคใณใใๆททๅ็ฒพๅบฆใใฌใผใใณใฐ๏ผใจ็ตใฟๅใใใใใจใงใAdafactorใฎไฝฟ็จใจๅ็ญไปฅไธใฎ3ๅใฎใกใขใชๆนๅใใใณใใใใซ้ซใในใซใผใใใใๆๅพ
ใงใใพใใ
+
+### multi_tensor
+
+pytorch-nightlyใฏใๅคใใฎๅฐใใช็นๅพดใใณใฝใซใใใ็ถๆณใฎใชใใใฃใใคใถใๅคงๅน
ใซ้ซ้ๅใใใฏใใฎ`torch.optim._multi_tensor`ใๅฐๅ
ฅใใพใใใใใใฏๆ็ต็ใซใฏใใใฉใซใใซใชใใฏใใงใใใใใใๆฉใ่ฉฆใใฆใฟใใๅ ดๅใฏใใใฎGitHub [issue](https://github.com/huggingface/transformers/issues/9965)ใใ่ฆงใใ ใใใ
+
+## ใใผใฟใฎไบๅ่ชญใฟ่พผใฟ
+
+ๅชใใใใฌใผใใณใฐ้ๅบฆใซๅฐ้ใใใใใฎ้่ฆใช่ฆไปถใฎ1ใคใฏใGPUใๅฆ็ใงใใๆๅคง้ๅบฆใงใใผใฟใไพ็ตฆใงใใ่ฝๅใงใใใใใฉใซใใงใฏใในใฆใใกใคใณใใญใปในใง่กใใใใใผใฟใใใฃในใฏใใๅๅ้ใ่ชญใฟๅใใใจใใงใใชใๅ ดๅใGPUใฎใขใณใใผใฆใผใใฃใชใผใผใทใงใณใๅผใ่ตทใใใใใซใใใฏใ็บ็ใใๅฏ่ฝๆงใใใใพใใใใใซใใใฏใๆธใใใใใซใไปฅไธใฎๅผๆฐใ่จญๅฎใใพใ๏ผ
+
+- `DataLoader(pin_memory=True, ...)` - ใใผใฟใCPUใฎใใณใกใขใชใซไบๅ่ชญใฟ่พผใฟใใ้ๅธธใCPUใใGPUใกใขใชใธใฎ่ปข้ใใฏใใใซ้ซ้ๅใใใพใใ
+- `DataLoader(num_workers=4, ...)` - ใใผใฟใใใ้ใไบๅ่ชญใฟ่พผใฟใใใใใซ่คๆฐใฎใฏใผใซใผใ็ๆใใพใใใใฌใผใใณใฐไธญใซGPUใฎๅฉ็จ็ถๆณใฎ็ตฑ่จๆ
ๅ ฑใ็ขบ่ชใใ100๏ผ
ใใ้ ใๅ ดๅใใฏใผใซใผใฎๆฐใๅขใใๅฎ้จใ่กใฃใฆใใ ใใใใใกใใใๅ้กใฏไปใฎๅ ดๆใซใใใใใใใพใใใฎใงใๅคใใฎใฏใผใซใผใๅฟ
ใใใๆง่ฝๅไธใซใคใชใใใใใงใฏใใใพใใใ
+
+[`Trainer`]ใไฝฟ็จใใๅ ดๅใๅฏพๅฟใใ[`TrainingArguments`]ใฏ`dataloader_pin_memory`๏ผใใใฉใซใใงใฏ`True`๏ผใใใณ`dataloader_num_workers`๏ผใใใฉใซใใฏ`0`๏ผใงใใ
+
+## DeepSpeed ZeRO
+
+DeepSpeedใฏใ๐ค Transformersใจ๐ค Accelerateใจ็ตฑๅใใใใชใผใใณใฝใผในใฎใใฃใผใใฉใผใใณใฐๆ้ฉๅใฉใคใใฉใชใงใใ
+ๅคง่ฆๆจกใชใใฃใผใใฉใผใใณใฐใใฌใผใใณใฐใฎๅน็ใจในใฑใผใฉใใชใใฃใๅไธใใใใใใซ่จญ่จใใใใใพใใพใชๆฉ่ฝใจๆ้ฉๅใๆไพใใพใใ
+
+ใขใใซใๅไธใฎGPUใซๅใพใใๅฐใใชใใใใตใคใบใๅใใในใใผในใใใๅ ดๅใDeepSpeedใไฝฟ็จใใๅฟ
่ฆใฏใใใพใใใใใใฏใใใ้
ใใชใใพใใใใ ใใใขใใซใๅไธใฎGPUใซๅใพใใชใๅ ดๅใใพใใฏๅฐใใชใใใใๅใใใใจใใงใใชใๅ ดๅใDeepSpeed ZeRO + CPU OffloadใพใใฏNVMe Offloadใๅฉ็จใงใใพใใใใฎๅ ดๅใ[ใฉใคใใฉใชใๅฅ้ใคใณในใใผใซ](main_classes/deepspeed#installation)ใใ่จญๅฎใใกใคใซใไฝๆใใDeepSpeedใ่ตทๅใใใใใฎใฌใคใใใใฉใญใผใใๅฟ
่ฆใใใใพใ๏ผ
+
+* [`Trainer`]ใจใฎDeepSpeed็ตฑๅใฎ่ฉณ็ดฐใฌใคใใซใคใใฆใฏใ[่ฉฒๅฝใใใใญใฅใกใณใใผใทใงใณ](main_classes/deepspeed)ใ็ขบ่ชใใฆใใ ใใใ็นใซใ[ๅไธGPU็จใฎใใใญใคใกใณใ](main_classes/deepspeed#deployment-with-one-gpu)ใซ้ขใใใปใฏใทใงใณใงใใDeepSpeedใใใผใใใใฏใงไฝฟ็จใใใซใฏใใใคใใฎ่ชฟๆดใๅฟ
่ฆใงใใฎใงใ[่ฉฒๅฝใใใฌใคใ](main_classes/deepspeed#deployment-in-notebooks)ใใ่ฆงใใ ใใใ
+* ๐ค Accelerateใไฝฟ็จใใๅ ดๅใฏใ[๐ค Accelerate DeepSpeedใฌใคใ](https://huggingface.co/docs/accelerate/en/usage_guides/deepspeed)ใๅ็
งใใฆใใ ใใใ
+
+## torch.compileใฎไฝฟ็จ
+
+PyTorch 2.0ใฏๆฐใใใณใณใใคใซ้ขๆฐใๅฐๅ
ฅใใพใใใใใใฏๆขๅญใฎPyTorchใณใผใใๅคๆดใใๅฟ
่ฆใฏใใใพใใใใ1่กใฎใณใผใใ่ฟฝๅ ใใใใจใงใณใผใใๆ้ฉๅใงใใพใ๏ผ`model = torch.compile(model)`ใ
+
+[`Trainer`]ใไฝฟ็จใใๅ ดๅใ[`TrainingArguments`]ๅ
ใฎ`torch_compile`ใชใใทใงใณใๆธกใใ ใใงใ๏ผ
+
+
+```python
+training_args = TrainingArguments(torch_compile=True, **default_args)
+```
+
+`torch.compile`ใฏใๆขๅญใฎPyTorchใใญใฐใฉใ ใใใฐใฉใใ่ชๅ็ใซไฝๆใใใใใซPythonใฎใใฌใผใ ่ฉไพกAPIใไฝฟ็จใใพใใใฐใฉใใใญใฃใใใฃใใๅพใ็ฐใชใใใใฏใจใณใใๅฑ้ใใฆๆ้ฉๅใใใใจใณใธใณใซๅคๆใงใใพใใ
+่ฉณ็ดฐใใใณใใณใใใผใฏใซใคใใฆใฏใ[PyTorchใใญใฅใกใณใ](https://pytorch.org/get-started/pytorch-2.0/)ใๅ็
งใใฆใใ ใใใ
+
+`torch.compile`ใซใฏใใชใใทใงใณใฎไพๅญ้ขไฟใๆใคๆ้ทไธญใฎใใใฏใจใณใใฎใชในใใใใใ`torchdynamo.list_backends()`ใๅผใณๅบใใฆ็ขบ่ชใงใใพใใๆใไธ่ฌ็ใซไฝฟ็จใใใไธ้จใฎใใใฏใจใณใใฏๆฌกใฎใจใใใงใใ
+
+**ใใใใฐ็จใใใฏใจใณใ**๏ผ
+* `dynamo.optimize("eager")` - ๆฝๅบใใใGraphModuleใๅฎ่กใใใใใซPyTorchใไฝฟ็จใใพใใใใใฏTorchDynamoใฎๅ้กใใใใใฐใใ้ใซ้ๅธธใซๅฝน็ซใกใพใใ
+* `dynamo.optimize("aot_eager")` - ใณใณใใคใฉใผใไฝฟ็จใใชใAotAutogradใไฝฟ็จใใฆAotAutogradใฎๆฝๅบใใใใใฉใฏใผใใใใณใใใฏใฏใผใใฐใฉใใซๅฏพใใฆๅใซPyTorch eagerใไฝฟ็จใใพใใใใใฏใใใใฐใซๅฝน็ซใกใ้ซ้ๅใฏๆๅพ
ใงใใพใใใ
+
+**ใใฌใผใใณใฐใใใณๆจ่ซใใใฏใจใณใ**๏ผ
+* `dynamo.optimize("inductor")` - TorchInductorใใใฏใจใณใใไฝฟ็จใใAotAutogradใใใณcudagraphsใๆดป็จใใฆใณใผใ็ๆใใใTritonใซใผใใซใไฝฟ็จใใพใ [่ฉณ็ดฐใฏใใกใ](https://dev-discuss.pytorch.org/t/torchinductor-a-pytorch-native-compiler-with-define-by-run-ir-and-symbolic-shapes/747)
+* `dynamo.optimize("nvfuser")` - nvFuser with TorchScriptใไฝฟ็จใใพใใ [่ฉณ็ดฐใฏใใกใ](https://dev-discuss.pytorch.org/t/tracing-with-primitives-update-1-nvfuser-and-its-primitives/593)
+* `dynamo.optimize("aot_nvfuser")` - nvFuser with AotAutogradใไฝฟ็จใใพใใ [่ฉณ็ดฐใฏใใกใ](https://dev-discuss.pytorch.org/t/tracing-with-primitives-update-1-nvfuser-and-its-primitives/593)
+* `dynamo.optimize("aot_cudagraphs")` - AotAutogradใไฝฟ็จใใฆcudagraphsใไฝฟ็จใใพใใ [่ฉณ็ดฐใฏใใกใ](https://github.com/pytorch/torchdynamo/pull/757)
+
+**ๆจ่ซๅฐ็จใใใฏใจใณใ**๏ผ
+* `dynamo.optimize("ofi")` - Torchscriptใฎ`optimize_for_inference`ใไฝฟ็จใใพใใ [่ฉณ็ดฐใฏใใกใ](https://pytorch.org/docs/stable/generated/torch.jit.optimize_for_inference.html)
+* `dynamo.optimize("fx2trt")` - Nvidia TensorRTใไฝฟ็จใใๆจ่ซใฎๆ้ฉๅใซNvidia TensorRTใไฝฟ็จใใพใใ [่ฉณ็ดฐใฏใใกใ](https://pytorch.org/TensorRT/tutorials/getting_started_with_fx_path.html)
+* `dynamo.optimize("onnxrt")` - CPU/GPUใงใฎๆจ่ซใซONNX Runtimeใไฝฟ็จใใพใใ [่ฉณ็ดฐใฏใใกใ](https://onnxruntime.ai/)
+* `dynamo.optimize("ipex")` - CPUใงใฎๆจ่ซใซIPEXใไฝฟ็จใใพใใ [่ฉณ็ดฐใฏใใกใ](https://github.com/intel/intel-extension-for-pytorch)
+
+๐ค Transformersใไฝฟ็จใใ`torch.compile`ใฎไฝฟ็จไพใซใคใใฆใฏใใใฎ[ใใญใฐ่จไบ](https://www.philschmid.de/getting-started-pytorch-2-0-transformers)ใใ่ฆงใใ ใใใ
+
+## Using ๐ค Accelerate
+
+[๐ค Accelerate](https://huggingface.co/docs/accelerate/index)ใไฝฟ็จใใใจใไธ่จใฎๆนๆณใไฝฟ็จใใชใใใใฌใผใใณใฐใซใผใใๅฎๅ
จใซๅถๅพกใงใใๅบๆฌ็ใซใฏ็ด็ฒใชPyTorchใงใซใผใใๆธใใใจใใงใใพใใ
+
+ๆฌกใซใ[`TrainingArguments`]ๅ
ใงๆนๆณใ็ตใฟๅใใใๅ ดๅใๆณ
+
+```py
+training_args = TrainingArguments(
+ per_device_train_batch_size=1,
+ gradient_accumulation_steps=4,
+ gradient_checkpointing=True,
+ fp16=True,
+ **default_args,
+)
+```
+
+๐ค Accelerateใไฝฟ็จใใๅฎๅ
จใชใใฌใผใใณใฐใซใผใใฎไพใฏใใปใใฎๆฐ่กใฎใณใผใใงใ๏ผ
+
+```py
+from accelerate import Accelerator
+from torch.utils.data.dataloader import DataLoader
+
+dataloader = DataLoader(ds, batch_size=training_args.per_device_train_batch_size)
+
+if training_args.gradient_checkpointing:
+ model.gradient_checkpointing_enable()
+
+accelerator = Accelerator(fp16=training_args.fp16)
+model, optimizer, dataloader = accelerator.prepare(model, adam_bnb_optim, dataloader)
+
+model.train()
+for step, batch in enumerate(dataloader, start=1):
+ loss = model(**batch).loss
+ loss = loss / training_args.gradient_accumulation_steps
+ accelerator.backward(loss)
+ if step % training_args.gradient_accumulation_steps == 0:
+ optimizer.step()
+ optimizer.zero_grad()
+```
+
+ใพใใใใผใฟใปใใใ[`DataLoader`](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader)ใงใฉใใใใพใใ
+ๆฌกใซใใขใใซใฎ[`~PreTrainedModel.gradient_checkpointing_enable`]ใกใฝใใใๅผใณๅบใใใจใงๅพ้
ใใงใใฏใใคใณใใๆๅนใซใงใใพใใ
+[`Accelerator`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator)ใๅๆๅใใ้ใซใๆททๅ็ฒพๅบฆใใฌใผใใณใฐใไฝฟ็จใใใใฉใใใ[`prepare`](https://huggingface.co/docs/accelerate/package_reference/accelerator#accelerate.Accelerator.prepare)ใฎๅผใณๅบใใงๆๅฎใใ่คๆฐใฎGPUใไฝฟ็จใใๅ ดๅใ`prepare`ใฎ้ใซใใผใฟใญใผใใผใใฏใผใซใผ้ใงๅๆฃใใใพใใๅใ[8ใใใใชใใใฃใใคใถ](#8-bit-adam)ใๅใฎไพใใไฝฟ็จใใพใใ
+
+ๆๅพใซใไธป่ฆใชใใฌใผใใณใฐใซใผใใ่ฟฝๅ ใงใใพใใ`backward`ใฎๅผใณๅบใใฏ๐ค Accelerateใซใใฃใฆๅฆ็ใใใใใจใซๆณจๆใใฆใใ ใใใใพใใๅพ้
ใฎ่็ฉใใฉใฎใใใซๆฉ่ฝใใใใ็ขบ่ชใงใใพใใๆๅคฑใๆญฃ่ฆๅใใฆใใใใใ่็ฉใฎๆๅพใซๅนณๅใๅพใฆใๅๅใชในใใใใใใใจๆ้ฉๅใๅฎ่กใใใพใใ
+
+ใใใใฎๆ้ฉๅๆ่กใ๐ค Accelerateใไฝฟ็จใใฆๅฎ่ฃ
ใใใฎใฏใใใใใชใณใผใ่กใง่กใใใจใใงใใใใฌใผใใณใฐใซใผใใฎๆ่ปๆงใๅไธใใพใใใในใฆใฎๆฉ่ฝใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Accelerateใฎใใญใฅใกใณใ](https://huggingface.co/docs/accelerate/index)ใๅ็
งใใฆใใ ใใใ
+
+## Efficient Software Prebuilds
+
+PyTorchใฎ[pipใจcondaใใซใ](https://pytorch.org/get-started/locally/#start-locally)ใฏใPyTorchใๅฎ่กใใใฎใซๅๅใชcudaใใผใซใญใใใงไบๅใซใใซใใใใฆใใพใใใcudaๆกๅผตใใใซใใใๅฟ
่ฆใใใๅ ดๅใซใฏไธๅๅใงใใ
+
+ๆๆใ่ฟฝๅ ใฎๅชๅใๅฟ
่ฆใชๅ ดๅใใใใพใใใใจใใฐใไบๅใซใณใณใใคใซใใใฆใใชใ`apex`ใชใฉใฎใฉใคใใฉใชใไฝฟ็จใใฆใใๅ ดๅใงใใใพใใใทในใใ ๅ
จไฝใง้ฉๅใชcudaใใผใซใญใใใใคใณในใใผใซใใๆนๆณใ่ฆใคใใใใจใ้ฃใใๅ ดๅใใใใพใใ
+ใใใใฎใทใใชใชใซๅฏพๅฆใใใใใซใPyTorchใจNVIDIAใฏcudaๆกๅผตใใใงใซไบๅใซใใซใใใใฆใใNGC dockerใณใณใใใฎๆฐใใใใผใธใงใณใใชใชใผในใใพใใใใใญใฐใฉใ ใใคใณในใใผใซใใใ ใใงใใใฎใพใพๅฎ่กใงใใพใใ
+
+ใใฎใขใใญใผใใฏใPyTorchใฎใฝใผในใ่ชฟๆดใใใใๆฐใใใซในใฟใใคใบใใใใใซใใไฝๆใใใใใใๅ ดๅใซใๅฝน็ซใกใพใใ
+ๆฌฒใใdockerใคใกใผใธใใผใธใงใณใ่ฆใคใใใซใฏใใพใ[PyTorchใฎใชใชใผในใใผใ](https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/)ใใๅงใใๆๆฐใฎๆๆฌกใชใชใผในใฎใใใใใ้ธๆใใพใใๅธๆใฎใชใชใผในใฎใชใชใผในใใผใใซ็งปๅใใ็ฐๅขใฎใณใณใใผใใณใใๅฟ
่ฆใชใใฎใจไธ่ดใใฆใใใใจใ็ขบ่ชใใพใ๏ผNVIDIA Driverใฎ่ฆไปถใๅซใ๏ผ๏ผใใใฎๆๆธใฎไธ็ชไธใซ่กใใๅฏพๅฟใใNGCใใผใธใซ็งปๅใใพใใใชใใใใใใชใๅ ดๅใฏใ[ใในใฆใฎPyTorch NGCใคใกใผใธใฎใคใณใใใฏใน](https://ngc.nvidia.com/catalog/containers/nvidia:pytorch)ใงใใ
+
+ๆฌกใซใdockerใคใกใผใธใใใฆใณใญใผใใใฆๅฑ้ใใๆ้ ใซๅพใใพใใ
+
+## Mixture of Experts
+
+ๆ่ฟใฎ่ซๆใซใใใฐใTransformerใขใใซใซๅฐ้ๅฎถใฎๆททๅ๏ผMoE๏ผใ็ตฑๅใใใใจใงใใใฌใผใใณใฐ้ๅบฆใ4ใ5ๅๅไธใใๆจ่ซใ้ซ้ๅใใใใใจใๅ ฑๅใใใฆใใพใใ
+
+ใใๅคใใฎใใฉใกใผใฟใใใ่ฏใใใใฉใผใใณในใซใคใชใใใใจใใใใฃใฆใใใใใใใฎๆ่กใฏใใฌใผใใณใฐใณในใใๅขใใใใจใชใใใฉใกใผใฟใฎๆฐใๆก้ใใซๅขใใใใจใๅฏ่ฝใซใใพใใ
+
+ใใฎใขใใญใผใใงใฏใไปใฎFFNๅฑคใฎไปฃใใใซMoEๅฑคใ้
็ฝฎใใใๅๅฐ้ๅฎถใใใผใฏใณใฎไฝ็ฝฎใซๅฟใใฆใใฉใณในใใใใฌใผใใณใฐใใใฒใผใ้ขๆฐใงๆงๆใใใพใใ
+
+
+
+๏ผๅบๅ
ธ: [GLAM](https://ai.googleblog.com/2021/12/more-efficient-in-context-learning-with.html)๏ผ
+
+ใใฎใขใใญใผใใฎไธปใชๆฌ ็นใฏใGPUใกใขใชใใปใผๆก้ใใซๅคใๅฟ
่ฆใจใใใใจใงใใใกใขใช่ฆไปถใใฏใใใซๅคงใใใใจใใใฎใพใพๅๆ ใใใพใใใใ้ซใใกใขใช่ฆไปถใๅ
ๆใใๆนๆณใซใคใใฆใฏใใใพใใพใช่ธ็ใใใณใขใใญใผใใๆๆกใใใฆใใพใใ
+
+ใใ ใใ็ดๆฅใฎใใฌใผใใชใใใใใพใใๆฐไบบใฎๅฐ้ๅฎถใไฝฟ็จใใฆใใผในใขใใซใ2ใ3ๅๅฐใใใใใใจใงใ5ๅๅฐใใชใขใใซใซใใใใฌใผใใณใฐ้ๅบฆใ้ฉๅบฆใซๅไธใใใใกใขใช่ฆไปถใ้ฉๅบฆใซๅขใใใใจใใงใใพใใ
+
+้ข้ฃใใใปใจใใฉใฎ่ซๆใใใณๅฎ่ฃ
ใฏTensorflow/TPUใไธญๅฟใซๆง็ฏใใใฆใใพใใ
+
+- [GShard: Conditional Computation and Automatic Shardingใๆดป็จใใๅทจๅคงใขใใซใฎในใฑใผใชใณใฐ](https://arxiv.org/abs/2006.16668)
+- [Switch Transformers: ใทใณใใซใงๅน็็ใชในใใผในๆงใๅใใใใชใชใชใณใใฉใกใผใฟใขใใซใธใฎในใฑใผใชใณใฐ](https://arxiv.org/abs/2101.03961)
+- [GLaM: Generalist Language Model (GLaM)](https://ai.googleblog.com/2021/12/more-efficient-in-context-learning-with.html)
+
+PytorchใซใฏDeepSpeedใๆง็ฏใใใใฎใใใใพใ: [DeepSpeed-MoE: Advancing Mixture-of-Experts Inference and Training to Power Next-Generation AI Scale](https://arxiv.org/abs/2201.05596)ใ[Mixture of Experts](https://www.deepspeed.ai/tutorials/mixture-of-experts/) - ใใญใฐ่จไบ: [1](https://www.microsoft.com/en-us/research/blog/deepspeed-powers-8x-larger-moe-model-training-with-high-performance/)ใ[2](https://www.microsoft.com/en-us/research/publication/scalable-and-efficient-moe-training-for-multitask-multilingual-models/)ใๅคง่ฆๆจกใชTransformerใใผในใฎ่ช็ถ่จ่ช็ๆใขใใซใฎๅ
ทไฝ็ใชๅฑ้ใซใคใใฆใฏใ[ใใญใฐ่จไบ](https://www.deepspeed.ai/2021/12/09/deepspeed-moe-nlg.html)ใ[Megatron-Deepspeedใใฉใณใ](https://github.com/microsoft/Megatron-DeepSpeed/tree/moe-training)ใๅ็
งใใฆใใ ใใใ
+
+
+## PyTorchใใคใใฃใใขใใณใทใงใณใจFlash Attentionใฎไฝฟ็จ
+
+PyTorch 2.0ใงใฏใใใคใใฃใใฎ[`torch.nn.functional.scaled_dot_product_attention`](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html)๏ผSDPA๏ผใใชใชใผในใใใ[ใกใขใชๅน็ใฎ้ซใใขใใณใทใงใณ](https://arxiv.org/abs/2112.05682)ใ[ใใฉใใทใฅใขใใณใทใงใณ](https://arxiv.org/abs/2205.14135)ใชใฉใฎ่ๅใใใGPUใซใผใใซใฎไฝฟ็จใๅฏ่ฝใซใใพใใ
+
+[`optimum`](https://github.com/huggingface/optimum)ใใใฑใผใธใใคใณในใใผใซใใๅพใ้ข้ฃใใๅ
้จใขใธใฅใผใซใ็ฝฎใๆใใฆใPyTorchใฎใใคใใฃใใขใใณใทใงใณใไฝฟ็จใงใใพใใไปฅไธใฎใใใซ่จญๅฎใใพใ๏ผ
+
+
+```python
+model = model.to_bettertransformer()
+```
+
+ๅคๆๅพใ้ๅธธ้ใใขใใซใใใฌใผใใณใฐใใฆใใ ใใใ
+
+
+
+PyTorchใใคใใฃใใฎ`scaled_dot_product_attention`ๆผ็ฎๅญใฏใ`attention_mask`ใๆไพใใใฆใใชใๅ ดๅใซใฎใฟFlash Attentionใซใใฃในใใใใงใใพใใ
+
+ใใใฉใซใใงใฏใใใฌใผใใณใฐใขใผใใงBetterTransformer็ตฑๅใฏใในใฏใตใใผใใๅ้คใใใใใใใฌใผใใณใฐใซใใใฃใณใฐใในใฏใๅฟ
่ฆใชใใใฌใผใใณใฐใซใใไฝฟ็จใงใใพใใใใใใฏใไพใใฐใในใฏ่จ่ชใขใใชใณใฐใๅ ๆ่จ่ชใขใใชใณใฐใฎใใใชใใใใใใฌใผใใณใฐใซใใใฃใณใฐใในใฏใไธ่ฆใชใใฌใผใใณใฐใฎๅ ดๅใซ่ฉฒๅฝใใพใใBetterTransformerใฏใใใฃใณใฐใในใฏใๅฟ
่ฆใชใฟในใฏใซๅฏพใใใขใใซใฎๅพฎ่ชฟๆดใซใฏ้ฉใใฆใใพใใใ
+
+
+
+SDPAใไฝฟ็จใใใขใฏใปใฉใฌใผใทใงใณใจใกใขใชใฎ็ฏ็ดใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใฏใใใฎ[ใใญใฐ่จไบ](https://pytorch.org/blog/out-of-the-box-acceleration/)ใใใงใใฏใใฆใใ ใใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_special.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_special.md
new file mode 100644
index 0000000000000000000000000000000000000000..080ff66f4cf5628dd134c0ec5a0e10015604ad58
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_special.md
@@ -0,0 +1,24 @@
+
+
+# Training on Specialized Hardware
+
+
+
+ๆณจๆ: [ๅไธGPUใปใฏใทใงใณ](perf_train_gpu_one)ใง็ดนไปใใใใปใจใใฉใฎๆฆ็ฅ๏ผๆททๅ็ฒพๅบฆใใฌใผใใณใฐใๅพ้
่็ฉใชใฉ๏ผใใใณ[ใใซใGPUใปใฏใทใงใณ](perf_train_gpu_many)ใฏไธ่ฌ็ใชใใฌใผใใณใฐใขใใซใซ้ฉ็จใใใๆฑ็จ็ใชใใฎใงใใฎใงใใใฎใปใฏใทใงใณใซๅ
ฅใๅใซใใใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+ใใฎใใญใฅใกใณใใฏใๅฐ็จใใผใใฆใงใขใงใใฌใผใใณใฐใใๆนๆณใซ้ขใใๆ
ๅ ฑใ่ฟๆฅไธญใซ่ฟฝๅ ไบๅฎใงใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_tpu.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_tpu.md
new file mode 100644
index 0000000000000000000000000000000000000000..aadd588ae84d35afb79f2ca89d9c0983c0634c37
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_tpu.md
@@ -0,0 +1,24 @@
+
+
+# Training on TPUs
+
+
+
+ ๆณจๆ: [ใทใณใฐใซGPUใปใฏใทใงใณ](perf_train_gpu_one)ใง็ดนไปใใใฆใใใปใจใใฉใฎๆฆ็ฅ๏ผๆททๅ็ฒพๅบฆใใฌใผใใณใฐใๅพ้
่็ฉใชใฉ๏ผใใใณ[ใใซใGPUใปใฏใทใงใณ](perf_train_gpu_many)ใฏไธ่ฌ็ใชใขใใซใฎใใฌใผใใณใฐใซ้ฉ็จใงใใพใใฎใงใใใฎใปใฏใทใงใณใซๅ
ฅใๅใซใใใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+ใใฎใใญใฅใกใณใใฏใTPUใงใฎใใฌใผใใณใฐๆนๆณใซ้ขใใๆ
ๅ ฑใใพใใชใ่ฟฝๅ ใใใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_tpu_tf.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_tpu_tf.md
new file mode 100644
index 0000000000000000000000000000000000000000..3ffe88267cddeb9cb254be39d215c5f8a3ea64e2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perf_train_tpu_tf.md
@@ -0,0 +1,168 @@
+
+
+# Training on TPU with TensorFlow
+
+
+
+่ฉณ็ดฐใช่ชฌๆใไธ่ฆใงใๅใซTPUใฎใณใผใใตใณใใซใๅ
ฅๆใใฆใใฌใผใใณใฐใ้ๅงใใใๅ ดๅใฏใ[็งใใกใฎTPUใฎไพใฎใใผใใใใฏใใใงใใฏใใฆใใ ใใ๏ผ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb)
+
+
+
+### What is a TPU?
+
+TPUใฏ**Tensor Processing Unit๏ผใใณใฝใซๅฆ็ใฆใใใ๏ผ**ใฎ็ฅใงใใใใใใฏGoogleใ่จญ่จใใใใผใใฆใงใขใงใใใฅใผใฉใซใใใใฏใผใฏๅ
ใฎใใณใฝใซ่จ็ฎใๅคงๅน
ใซ้ซ้ๅใใใใใซไฝฟ็จใใใพใใใใใฏGPUใฎใใใชใใฎใงใใใใใใฏใผใฏใฎใใฌใผใใณใฐใจๆจ่ซใฎไธกๆนใซไฝฟ็จใงใใพใใไธ่ฌ็ใซใฏGoogleใฎใฏใฉใฆใใตใผใในใไปใใฆใขใฏใปในใใใพใใใGoogle ColabใจKaggle Kernelsใ้ใใฆใ็กๆใงๅฐ่ฆๆจกใฎTPUใซ็ดๆฅใขใฏใปในใงใใพใใ
+
+[๐ค TransformersใฎใในใฆใฎTensorFlowใขใใซใฏKerasใขใใซใงใ](https://huggingface.co/blog/tensorflow-philosophy)ใฎใงใใใฎๆๆธใฎใปใจใใฉใฎๆนๆณใฏไธ่ฌ็ใซKerasใขใใซ็จใฎTPUใใฌใผใใณใฐใซ้ฉ็จใงใใพใ๏ผใใ ใใTransformersใจDatasetsใฎHuggingFaceใจใณใทในใใ ๏ผhug-o-system๏ผ๏ผใซๅบๆใฎใใคใณใใใใใคใใใใใใใซใคใใฆใฏ้ฉ็จใใใจใใซใใใ็คบใใพใใ
+
+### What kinds of TPU are available?
+
+ๆฐใใใฆใผใถใผใฏใใใพใใพใชTPUใจใใฎใขใฏใปในๆนๆณใซ้ขใใๅน
ๅบใๆ
ๅ ฑใซใใๆททไนฑใใพใใ็่งฃใใใใใฎๆๅใฎ้่ฆใช้ใใฏใ**TPUใใผใ**ใจ**TPU VM**ใฎ้ใใงใใ
+
+**TPUใใผใ**ใไฝฟ็จใใใจใไบๅฎไธใชใขใผใใฎTPUใซ้ๆฅ็ใซใขใฏใปในใใพใใๅฅๅใฎVMใๅฟ
่ฆใงใใใใใฏใผใฏใจใใผใฟใใคใใฉใคใณใๅๆๅใใใใใใใชใขใผใใใผใใซ่ปข้ใใพใใGoogle ColabใงTPUใไฝฟ็จใใใจใ**TPUใใผใ**ในใฟใคใซใงใขใฏใปในใใฆใใพใใ
+
+TPUใใผใใไฝฟ็จใใใจใใใใซๆ
ฃใใฆใใชใไบบใ
ใซใฏใใชใไบๆใใชใๅไฝใ็บ็ใใใใจใใใใพใ๏ผ็นใซใTPUใฏPythonใณใผใใๅฎ่กใใฆใใใใทใณใจ็ฉ็็ใซ็ฐใชใใทในใใ ใซ้
็ฝฎใใใฆใใใใใใใผใฟใฏใญใผใซใซใใทใณใซใญใผใซใซใงๆ ผ็ดใใใฆใใใใผใฟใใคใใฉใคใณใๅฎๅ
จใซๅคฑๆใใพใใไปฃใใใซใใใผใฟใฏGoogle Cloud Storageใซๆ ผ็ดใใๅฟ
่ฆใใใใพใใใใใงใใผใฟใใคใใฉใคใณใฏใชใขใผใใฎTPUใใผใใงๅฎ่กใใใฆใใๅ ดๅใงใใใใผใฟใซใขใฏใปในใงใใพใใ
+
+
+
+ใในใฆใฎใใผใฟใ`np.ndarray`ใพใใฏ`tf.Tensor`ใจใใฆใกใขใชใซๅใใใใจใใงใใๅ ดๅใColabใพใใฏTPUใใผใใไฝฟ็จใใฆใใๅ ดๅใงใใใใผใฟใGoogle Cloud Storageใซใขใใใญใผใใใใซ`fit()`ใงใใฌใผใใณใฐใงใใพใใ
+
+
+
+
+
+**๐ค Hugging Faceๅบๆใฎใใณใ๐ค:** TFใณใผใใฎไพใงใใ่ฆใใงใใใ`Dataset.to_tf_dataset()`ใจใใฎ้ซใฌใใซใฎใฉใใใผใงใใ`model.prepare_tf_dataset()`ใฏใTPUใใผใใงๅคฑๆใใพใใใใใฏใ`tf.data.Dataset`ใไฝๆใใฆใใใซใใใใใใใใใใใ็ด็ฒใชใ`tf.data`ใใคใใฉใคใณใงใฏใชใใ`tf.numpy_function`ใพใใฏ`Dataset.from_generator()`ใไฝฟ็จใใฆๅบ็คใจใชใHuggingFace `Dataset`ใใใใผใฟใในใใชใผใ ใง่ชญใฟ่พผใใใจใใใงใใใใฎHuggingFace `Dataset`ใฏใญใผใซใซใใฃในใฏไธใฎใใผใฟใใใใฏใขใใใใฆใใใใชใขใผใTPUใใผใใ่ชญใฟๅใใใจใใงใใชใใใใงใใ
+
+
+
+TPUใซใขใฏใปในใใ็ฌฌไบใฎๆนๆณใฏใ**TPU VM**ใไปใใฆใงใใTPU VMใไฝฟ็จใใๅ ดๅใTPUใๆฅ็ถใใใฆใใใใทใณใซ็ดๆฅๆฅ็ถใใพใใใใใฏGPU VMใงใใฌใผใใณใฐใ่กใใฎใจๅๆงใงใใTPU VMใฏไธ่ฌ็ใซใใผใฟใใคใใฉใคใณใซ้ขใใฆใฏ็นใซไฝๆฅญใใใใใใไธ่จใฎใในใฆใฎ่ญฆๅใฏTPU VMใซใฏ้ฉ็จใใใพใใ๏ผ
+
+ใใใฏไธป่ฆณ็ใชๆๆธใงใใฎใงใใใกใใฎๆ่ฆใงใ๏ผ**ๅฏ่ฝใช้ใTPUใใผใใฎไฝฟ็จใ้ฟใใฆใใ ใใใ** TPU VMใใใๆททไนฑใใใใใใใใใฐใ้ฃใใใงใใๅฐๆฅ็ใซใฏใตใใผใใใใชใใชใๅฏ่ฝๆงใใใใพใ - GoogleใฎๆๆฐใฎTPUใงใใTPUv4ใฏใTPU VMใจใใฆใฎใฟใขใฏใปในใงใใใใใTPUใใผใใฏๅฐๆฅ็ใซใฏใใฌใฌใทใผใใฎใขใฏใปในๆนๆณใซใชใๅฏ่ฝๆงใ้ซใใงใใใใ ใใ็กๆใงTPUใซใขใฏใปในใงใใใฎใฏColabใจKaggle Kernelsใฎๅ ดๅใใใใพใใใใฎๅ ดๅใใฉใใใฆใไฝฟ็จใใชใใใฐใชใใชใๅ ดๅใฎๅใๆฑใๆนๆณใ่ชฌๆใใใใจใใพใ๏ผ่ฉณ็ดฐใฏ[TPUใฎไพใฎใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb)ใง่ฉณ็ดฐใช่ชฌๆใ็ขบ่ชใใฆใใ ใใใ
+
+### What sizes of TPU are available?
+
+ๅไธใฎTPU๏ผv2-8/v3-8/v4-8๏ผใฏ8ใคใฎใฌใใชใซใๅฎ่กใใพใใTPUใฏๆฐ็พใใๆฐๅใฎใฌใใชใซใๅๆใซๅฎ่กใงใใ**ใใใ**ใซๅญๅจใใพใใๅไธใฎTPUใใใๅคใใฎTPUใไฝฟ็จใใใใใใใๅ
จไฝใงใฏใชใๅ ดๅ๏ผใใจใใฐv3-32๏ผใTPUใใชใผใใฏ**ใใใในใฉใคใน**ใจใใฆๅ็
งใใใพใใ
+
+Colabใไปใใฆ็กๆใฎTPUใซใขใฏใปในใใๅ ดๅใ้ๅธธใฏๅไธใฎv2-8 TPUใๆไพใใใพใใ
+
+
+### I keep hearing about this XLA thing. Whatโs XLA, and how does it relate to TPUs?
+
+XLAใฏใTensorFlowใจJAXใฎไธกๆนใงไฝฟ็จใใใๆ้ฉๅใณใณใใคใฉใงใใJAXใงใฏๅฏไธใฎใณใณใใคใฉใงใใใTensorFlowใงใฏใชใใทใงใณใงใใ๏ผใใใTPUใงใฏๅฟ
้ ใงใ๏ผ๏ผใKerasใขใใซใใใฌใผใใณใฐใใ้ใซ`model.compile()`ใซๅผๆฐ`jit_compile=True`ใๆธกใใใจใงๆใ็ฐกๅใซๆๅนใซใงใใพใใใจใฉใผใ็บ็ใใใใใใฉใผใใณในใ่ฏๅฅฝใงใใใฐใใใใฏTPUใซ็งป่กใใๆบๅใๆดใฃใ่ฏใๅ
ๅใงใ๏ผ
+
+TPUไธใงใฎใใใใฐใฏไธ่ฌ็ใซCPU/GPUใใใๅฐใ้ฃใใใใใTPUใง่ฉฆใๅใซใพใCPU/GPUใงXLAใไฝฟ็จใใฆใณใผใใๅฎ่กใใใใจใใๅงใใใพใใใใกใใใ้ทๆ้ใใฌใผใใณใฐใใๅฟ
่ฆใฏใใใพใใใใขใใซใจใใผใฟใใคใใฉใคใณใๆๅพ
้ใใซๅไฝใใใใ็ขบ่ชใใใใใฎๆฐในใใใใ ใใงใใ
+
+
+
+XLAใณใณใใคใซใใใใณใผใใฏ้ๅธธ้ซ้ใงใใใใใใฃใฆใTPUใงๅฎ่กใใไบๅฎใใชใๅ ดๅใงใใ`jit_compile=True`ใ่ฟฝๅ ใใใใจใงใใใฉใผใใณในใๅไธใใใใใจใใงใใพใใใใ ใใไปฅไธใฎXLAไบๆๆงใซ้ขใใๆณจๆไบ้
ใซๆณจๆใใฆใใ ใใ๏ผ
+
+
+
+
+
+**่ฆใ็ต้จใใ็ใพใใใใณใ:** `jit_compile=True`ใไฝฟ็จใใใใจใฏใCPU/GPUใณใผใใXLAไบๆใงใใใใจใ็ขบ่ชใใ้ๅบฆใๅไธใใใ่ฏใๆนๆณใงใใใๅฎ้ใซTPUใงใณใผใใๅฎ่กใใ้ใซใฏๅคใใฎๅ้กใๅผใ่ตทใใๅฏ่ฝๆงใใใใพใใ XLAใณใณใใคใซใฏTPUไธใงๆ้ป็ใซ่กใใใใใใๅฎ้ใซใณใผใใTPUใงๅฎ่กใใๅใซใใฎ่กใๅ้คใใใใจใๅฟใใชใใงใใ ใใ๏ผ
+
+
+
+### How do I make my model XLA compatible?
+
+ๅคใใฎๅ ดๅใใณใผใใฏใใงใซXLAไบๆใใใใใพใใ๏ผใใ ใใXLAใงใฏๅไฝใใ้ๅธธใฎTensorFlowใงใๅไฝใใชใใใใคใใฎ่ฆ็ด ใใใใพใใไปฅไธใซใ3ใคใฎไธป่ฆใชใซใผใซใซใพใจใใฆใใพใ๏ผ
+
+
+
+**๐ค HuggingFaceๅบๆใฎใใณใ๐ค:** TensorFlowใขใใซใจๆๅคฑ้ขๆฐใXLAไบๆใซๆธใ็ดใใใใซๅคใใฎๅชๅใๆใฃใฆใใพใใ้ๅธธใใขใใซใจๆๅคฑ้ขๆฐใฏใใใฉใซใใงใซใผใซ๏ผ1ใจ๏ผ2ใซๅพใฃใฆใใใใใ`transformers`ใขใใซใไฝฟ็จใใฆใใๅ ดๅใฏใใใใในใญใใใงใใพใใใใ ใใ็ฌ่ชใฎใขใใซใจๆๅคฑ้ขๆฐใ่จ่ฟฐใใๅ ดๅใฏใใใใใฎใซใผใซใๅฟใใชใใงใใ ใใ๏ผ
+
+
+
+#### XLA Rule #1: Your code cannot have โdata-dependent conditionalsโ
+
+ใใใฏใไปปๆใฎ`if`ในใใผใใกใณใใ`tf.Tensor`ๅ
ใฎๅคใซไพๅญใใฆใใชใๅฟ
่ฆใใใใใจใๆๅณใใพใใไพใใฐใๆฌกใฎใณใผใใใญใใฏใฏXLAใงใณใณใใคใซใงใใพใใ๏ผ
+
+```python
+if tf.reduce_sum(tensor) > 10:
+ tensor = tensor / 2.0
+```
+
+ใใใฏๆๅใฏ้ๅธธใซๅถ้็ใซๆใใใใใใใพใใใใใปใจใใฉใฎใใฅใผใฉใซใใใใณใผใใฏใใใ่กใๅฟ
่ฆใฏใใใพใใใ้ๅธธใใใฎๅถ็ดใๅ้ฟใใใใใซ`tf.cond`ใไฝฟ็จใใใ๏ผใใญใฅใกใณใใฏใใกใใๅ็
ง๏ผใๆกไปถใๅ้คใใฆไปฃใใใซๆ็คบๅคๆฐใไฝฟ็จใใใใใใใจใใงใใพใใๆฌกใฎใใใซ๏ผ
+
+```python
+sum_over_10 = tf.cast(tf.reduce_sum(tensor) > 10, tf.float32)
+tensor = tensor / (1.0 + sum_over_10)
+```
+
+ใใฎใณใผใใฏใไธ่จใฎใณใผใใจใพใฃใใๅใๅนๆใๆใฃใฆใใพใใใๆกไปถใๅ้ฟใใใใจใงใXLAใงๅ้กใชใใณใณใใคใซใงใใใใจใ็ขบ่ชใใพใ๏ผ
+
+#### XLA Rule #2: Your code cannot have โdata-dependent shapesโ
+
+ใใใฏใใณใผใๅ
ใฎใในใฆใฎ `tf.Tensor` ใชใใธใงใฏใใฎๅฝข็ถใใใใฎๅคใซไพๅญใใชใใใจใๆๅณใใพใใใใจใใฐใ`tf.unique` ้ขๆฐใฏXLAใงใณใณใใคใซใงใใชใใฎใงใใใฎใซใผใซใซ้ๅใใพใใใชใใชใใใใใฏๅ
ฅๅ `Tensor` ใฎไธๆใฎๅคใฎๅใคใณในใฟใณในใๅซใ `tensor` ใ่ฟใใใใงใใใใฎๅบๅใฎๅฝข็ถใฏใๅ
ฅๅ `Tensor` ใฎ้่คๅ
ทๅใซใใฃใฆ็ฐใชใใใใXLAใฏใใใๅฆ็ใใชใใใจใซใชใใพใ๏ผ
+
+ไธ่ฌ็ใซใใปใจใใฉใฎใใฅใผใฉใซใใใใฏใผใฏใณใผใใฏใใใฉใซใใงใซใผใซ๏ผ2ใซๅพใใพใใใใ ใใใใใคใใฎไธ่ฌ็ใชใฑใผในใงใฏๅ้กใ็บ็ใใใใจใใใใพใใ้ๅธธใซไธ่ฌ็ใชใฑใผในใฎ1ใคใฏใ**ใฉใใซใในใญใณใฐ**ใไฝฟ็จใใๅ ดๅใงใใใฉใใซใ็ก่ฆใใฆๆๅคฑใ่จ็ฎใใๅ ดๆใ็คบใใใใซใใฉใใซใ่ฒ ใฎๅคใซ่จญๅฎใใๆนๆณใงใใNumPyใพใใฏPyTorchใฎใฉใใซใในใญใณใฐใใตใใผใใใๆๅคฑ้ขๆฐใ่ฆใใจใๆฌกใฎใใใช[ใใผใซใคใณใใใฏใน](https://numpy.org/doc/stable/user/basics.indexing.html#boolean-array-indexing)ใไฝฟ็จใใใณใผใใใใ่ฆใใใพใ๏ผ
+
+
+```python
+label_mask = labels >= 0
+masked_outputs = outputs[label_mask]
+masked_labels = labels[label_mask]
+loss = compute_loss(masked_outputs, masked_labels)
+mean_loss = torch.mean(loss)
+```
+
+ใใฎใณใผใใฏNumPyใPyTorchใงใฏๅฎๅ
จใซๆฉ่ฝใใพใใใXLAใงใฏๅไฝใใพใใ๏ผใชใใชใใ`masked_outputs`ใจ`masked_labels`ใฎๅฝข็ถใฏใในใฏใใใไฝ็ฝฎใฎๆฐใซไพๅญใใใใใใใใฏ**ใใผใฟไพๅญใฎๅฝข็ถ**ใซใชใใพใใใใ ใใใซใผใซ๏ผ1ใจๅๆงใซใใใฎใณใผใใๆธใ็ดใใฆใใใผใฟไพๅญใฎๅฝข็ถใชใใงใพใฃใใๅใๅบๅใ็ๆใงใใใใจใใใใพใใ
+
+
+```python
+label_mask = tf.cast(labels >= 0, tf.float32)
+loss = compute_loss(outputs, labels)
+loss = loss * label_mask # Set negative label positions to 0
+mean_loss = tf.reduce_sum(loss) / tf.reduce_sum(label_mask)
+```
+
+
+ใใใงใฏใใใผใฟไพๅญใฎๅฝข็ถใ้ฟใใใใใซใๅไฝ็ฝฎใงๆๅคฑใ่จ็ฎใใฆใใใๅนณๅใ่จ็ฎใใ้ใซๅๅญใจๅๆฏใฎไธกๆนใงใในใฏใใใไฝ็ฝฎใใผใญๅใใๆนๆณใ็ดนไปใใพใใใใใซใใใๆๅใฎใขใใญใผใใจใพใฃใใๅใ็ตๆใๅพใใใพใใใXLAไบๆๆงใ็ถญๆใใพใใๆณจๆ็นใจใใฆใใซใผใซ๏ผ1ใจๅใใใชใใฏใไฝฟ็จใใพใ - `tf.bool`ใ`tf.float32`ใซๅคๆใใฆๆๆจๅคๆฐใจใใฆไฝฟ็จใใพใใใใใฏ้ๅธธใซไพฟๅฉใชใใชใใฏใงใใฎใงใ่ชๅใฎใณใผใใXLAใซๅคๆใใๅฟ
่ฆใใใๅ ดๅใซใฏ่ฆใใฆใใใฆใใ ใใ๏ผ
+
+#### XLA Rule #3: XLA will need to recompile your model for every different input shape it sees
+
+ใใใฏ้่ฆใชใซใผใซใงใใใใใฏใคใพใใๅ
ฅๅๅฝข็ถใ้ๅธธใซๅคๅ็ใชๅ ดๅใXLA ใฏใขใใซใไฝๅบฆใๅใณใณใใคใซใใๅฟ
่ฆใใใใใใๅคงใใชใใใฉใผใใณในใฎๅ้กใ็บ็ใใๅฏ่ฝๆงใใใใจใใใใจใงใใใใใฏ NLP ใขใใซใงไธ่ฌ็ใซ็บ็ใใใใผใฏใใคใบๅพใฎๅ
ฅๅใใญในใใฎ้ทใใ็ฐใชใๅ ดๅใใใใพใใไปใฎใขใใชใใฃใงใฏใ้็ใชๅฝข็ถใไธ่ฌ็ใงใใใใใฎใซใผใซใฏใปใจใใฉๅ้กใซใชใใพใใใ
+
+ใซใผใซ๏ผ3ใๅ้ฟใใๆนๆณใฏไฝใงใใใใ๏ผ้ตใฏใใใใฃใณใฐใใงใ - ใในใฆใฎๅ
ฅๅใๅใ้ทใใซใใใฃใณใฐใใๆฌกใซใattention_maskใใไฝฟ็จใใใใจใงใๅฏๅคๅฝข็ถใจๅใ็ตๆใๅพใใใจใใงใใพใใใXLA ใฎๅ้กใฏ็บ็ใใพใใใใใ ใใ้ๅบฆใฎใใใฃใณใฐใๆทฑๅปใช้
ๅปถใๅผใ่ตทใใๅฏ่ฝๆงใใใใพใ - ใใผใฟใปใใๅ
จไฝใงๆๅคงใฎ้ทใใซใในใฆใฎใตใณใใซใใใใฃใณใฐใใใจใๅคใใฎ่จ็ฎใจใกใขใชใ็ก้งใซใใๅฏ่ฝๆงใใใใพใ๏ผ
+
+ใใฎๅ้กใซใฏๅฎ็งใช่งฃๆฑบ็ญใฏใใใพใใใใใใใคใใฎใใชใใฏใ่ฉฆใใใจใใงใใพใใ้ๅธธใซไพฟๅฉใชใใชใใฏใฎ1ใคใฏใ**ใใใใฎใตใณใใซใ32ใพใใฏ64ใใผใฏใณใฎๅๆฐใพใงใใใฃใณใฐใใ**ใใจใงใใใใใซใใใใใผใฏใณๆฐใใใใใซๅขๅ ใใใ ใใงใใในใฆใฎๅ
ฅๅๅฝข็ถใ32ใพใใฏ64ใฎๅๆฐใงใใๅฟ
่ฆใใใใใใไธๆใฎๅ
ฅๅๅฝข็ถใฎๆฐใๅคงๅน
ใซๆธๅฐใใพใใไธๆใฎๅ
ฅๅๅฝข็ถใๅฐใชใใจใXLA ใฎๅใณใณใใคใซใๅฐใชใใชใใพใ๏ผ
+
+
+
+**๐ค HuggingFace ใซ้ขใใๅ
ทไฝ็ใชใใณใ๐ค:** ๅผ็คพใฎใใผใฏใใคใถใผใจใใผใฟใณใฌใฏใฟใผใซใฏใใใใงๅฝน็ซใคใกใฝใใใใใใพใใใใผใฏใใคใถใผใๅผใณๅบใ้ใซ `padding="max_length"` ใพใใฏ `padding="longest"` ใไฝฟ็จใใฆใใใใฃใณใฐใใใใใผใฟใๅบๅใใใใใซ่จญๅฎใงใใพใใใใผใฏใใคใถใผใจใใผใฟใณใฌใฏใฟใผใซใฏใไธๆใฎๅ
ฅๅๅฝข็ถใฎๆฐใๆธใใใฎใซๅฝน็ซใค `pad_to_multiple_of` ๅผๆฐใใใใพใ๏ผ
+
+
+
+### How do I actually train my model on TPU?
+
+ไธๅบฆใใฌใผใใณใฐใ XLA ไบๆๆงใใใใใจใ็ขบ่ชใใ๏ผTPU Node/Colab ใไฝฟ็จใใๅ ดๅใฏ๏ผใใผใฟใปใใใ้ฉๅใซๆบๅใใใฆใใๅ ดๅใTPU ไธใงๅฎ่กใใใใจใฏ้ฉใใปใฉ็ฐกๅใงใ๏ผใณใผใใๅคๆดใใๅฟ
่ฆใใใใฎใฏใใใใคใใฎ่กใ่ฟฝๅ ใใฆ TPU ใๅๆๅใใใขใใซใจใใผใฟใปใใใ `TPUStrategy` ในใณใผใๅ
ใงไฝๆใใใใใใซใใใใจใ ใใงใใใใใๅฎ้ใซ่ฆใใซใฏใ[TPU ใฎใตใณใใซใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb)ใใ่ฆงใใ ใใ๏ผ
+
+### Summary
+
+ใใใงใฏๅคใใฎๆ
ๅ ฑใๆไพใใใพใใใฎใงใTPU ใงใขใใซใใใฌใผใใณใฐใใ้ใซไปฅไธใฎใใงใใฏใชในใใไฝฟ็จใงใใพใ๏ผ
+
+- ใณใผใใ XLA ใฎไธใคใฎใซใผใซใซๅพใฃใฆใใใใจใ็ขบ่ชใใพใใ
+- CPU/GPU ใง `jit_compile=True` ใไฝฟ็จใใฆใขใใซใใณใณใใคใซใใXLA ใงใใฌใผใใณใฐใงใใใใจใ็ขบ่ชใใพใใ
+- ใใผใฟใปใใใใกใขใชใซ่ชญใฟ่พผใใใTPU ไบๆใฎใใผใฟใปใใ่ชญใฟ่พผใฟใขใใญใผใใไฝฟ็จใใพใ๏ผ[ใใผใใใใฏใๅ็
ง](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb)๏ผใ
+- ใณใผใใ Colab๏ผใขใฏใปใฉใฌใผใฟใใTPUใใซ่จญๅฎ๏ผใพใใฏ Google Cloud ใฎ TPU VM ใซ็งป่กใใพใใ
+- TPU ๅๆๅใณใผใใ่ฟฝๅ ใใพใ๏ผ[ใใผใใใใฏใๅ็
ง](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb)๏ผใ
+- `TPUStrategy` ใไฝๆใใใใผใฟใปใใใฎ่ชญใฟ่พผใฟใจใขใใซใฎไฝๆใ `strategy.scope()` ๅ
ใง่กใใใใใจใ็ขบ่ชใใพใ๏ผ[ใใผใใใใฏใๅ็
ง](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/tpu_training-tf.ipynb)๏ผใ
+- TPU ใซ็งป่กใใ้ใซ `jit_compile=True` ใๅคใใฎใๅฟใใชใใงใใ ใใ๏ผ
+- ๐๐๐๐ฅบ๐ฅบ๐ฅบ
+- `model.fit()` ใๅผใณๅบใใพใใ
+- ใใใงใจใใใใใพใ๏ผ
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/performance.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/performance.md
new file mode 100644
index 0000000000000000000000000000000000000000..bcd3987c5535363dd6a8a92c77b1504578038437
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/performance.md
@@ -0,0 +1,68 @@
+
+
+# Performance and Scalability
+
+ๅคง่ฆๆจกใชใใฉใณในใใฉใผใใผใขใใซใฎใใฌใผใใณใฐใใใณๆฌ็ช็ฐๅขใธใฎๅฑ้ใฏใใพใใพใช่ชฒ้กใๆ่ตทใใพใใ
+ใใฌใผใใณใฐไธญใซใฏใใขใใซใๅฉ็จๅฏ่ฝใชGPUใกใขใชใใใๅคใใๅฟ
่ฆใจใใใใใใฌใผใใณใฐ้ๅบฆใ้
ใใฃใใใใๅฏ่ฝๆงใใใใพใใ
+ใใใญใคใใงใผใบใงใฏใใขใใซใๆฌ็ช็ฐๅขใงๅฟ
่ฆใชในใซใผใใใใๅฆ็ใใใฎใซ่ฆๅดใใใใจใใใใพใใ
+
+ใใฎใใญใฅใกใณใใผใทใงใณใฏใใใใใฎ่ชฒ้กใๅ
ๆใใใฆใผในใฑใผในใซๆ้ฉใช่จญๅฎใ่ฆใคใใใฎใซๅฝน็ซใคใใจใ็ฎ็ใจใใฆใใพใใ
+ใฌใคใใฏใใฌใผใใณใฐใจๆจ่ซใฎใปใฏใทใงใณใซๅใใใฆใใใใใใใ็ฐใชใ่ชฒ้กใจ่งฃๆฑบ็ญใๅญๅจใใพใใ
+ๅใปใฏใทใงใณๅ
ใซใฏใใใฌใผใใณใฐ็จใฎใทใณใฐใซGPUๅฏพใใซใGPUใๆจ่ซ็จใฎCPUๅฏพGPUใชใฉใ็ฐใชใใใผใใฆใงใขๆงๆ็จใฎๅฅใ
ใฎใฌใคใใ็จๆใใใฆใใพใใ
+
+ใใฎใใญใฅใกใณใใๅบ็บ็นใจใใฆใใทใใชใชใซๅใฃใๆนๆณใซ้ฒใใใใฎๆ
ๅ ฑๆบใจใใฆใๅฉ็จใใ ใใใ
+
+## Training
+
+ๅคง่ฆๆจกใชใใฉใณในใใฉใผใใผใขใใซใๅน็็ใซใใฌใผใใณใฐใใใซใฏใGPUใTPUใชใฉใฎใขใฏใปใฉใฌใผใฟใๅฟ
่ฆใงใใ
+ๆใไธ่ฌ็ใชใฑใผในใฏใใทใณใฐใซGPUใใใๅ ดๅใงใใใทใณใฐใซGPUใงใฎใใฌใผใใณใฐๅน็ใๆ้ฉๅใใใใใฎไธ่ฌ็ใชใขใใญใผใใๅญฆใถใซใฏใไปฅไธใๅ็
งใใฆใใ ใใใ
+
+* [ใทใณใฐใซGPUใงใฎๅน็็ใชใใฌใผใใณใฐใฎใใใฎๆนๆณใจใใผใซ](perf_train_gpu_one): GPUใกใขใชใฎๅนๆ็ใชๅฉ็จใใใฌใผใใณใฐใฎ้ซ้ๅใชใฉใๆฏๆดใใๅ
ฑ้ใฎใขใใญใผใใๅญฆใถใใใซใใใใๅงใใฆใใ ใใใ
+* [ใใซใGPUใใฌใผใใณใฐใปใฏใทใงใณ](perf_train_gpu_many): ใใซใGPU็ฐๅขใซ้ฉ็จใใใใใผใฟใใใณใฝใซใใใคใใฉใคใณไธฆๅๆงใชใฉใใใใชใๆ้ฉๅๆนๆณใซใคใใฆ่ฉณ็ดฐใซๅญฆใณใพใใ
+* [CPUใใฌใผใใณใฐใปใฏใทใงใณ](perf_train_cpu): CPUไธใงใฎๆททๅ็ฒพๅบฆใใฌใผใใณใฐใซใคใใฆๅญฆใณใพใใ
+* [่คๆฐCPUใงใฎๅน็็ใชใใฌใผใใณใฐ](perf_train_cpu_many): ๅๆฃCPUใใฌใผใใณใฐใซใคใใฆๅญฆใณใพใใ
+* [TensorFlowใงTPUใไฝฟ็จใใใใฌใผใใณใฐ](perf_train_tpu_tf): TPUใซๆ
ฃใใฆใใชใๅ ดๅใฏใTPUใงใฎใใฌใผใใณใฐใจXLAใฎไฝฟ็จใซใคใใฆใฎใปใฏใทใงใณใๅ็
งใใฆใใ ใใใ
+* [ใใฌใผใใณใฐใฎใใใฎใซในใฟใ ใใผใใฆใงใข](perf_hardware): ็ฌ่ชใฎใใฃใผใใฉใผใใณใฐ็ฐๅขใๆง็ฏใใ้ใฎใใณใใใใชใใฏใ่ฆใคใใพใใ
+* [Trainer APIใไฝฟ็จใใใใคใใผใใฉใกใผใฟใผๆค็ดข](hpo_train)
+
+## Inference
+
+ๆฌ็ช็ฐๅขใงๅคง่ฆๆจกใชใขใใซใๅน็็ใซๆจ่ซใใใใจใฏใใใใใใใฌใผใใณใฐใใใใจใจๅใใใใ้ฃใใใใจใใใใพใใ
+ไปฅไธใฎใปใฏใทใงใณใงใฏใCPUใใใณใทใณใฐใซ/ใใซใGPU็ฐๅขใงๆจ่ซใๅฎ่กใใๆ้ ใซใคใใฆ่ชฌๆใใพใใ
+
+* [ใทใณใฐใซCPUใงใฎๆจ่ซ](perf_infer_cpu)
+* [ใทใณใฐใซGPUใงใฎๆจ่ซ](perf_infer_gpu_one)
+* [ใใซใGPUๆจ่ซ](perf_infer_gpu_many)
+* [TensorFlowใขใใซใฎXLA็ตฑๅ](tf_xla)
+
+## Training and inference
+
+ใขใใซใใใฌใผใใณใฐใใใใใใใไฝฟ็จใใฆๆจ่ซใๅฎ่กใใใใซ้ขไฟใชใ้ฉ็จใใใใใฏใใใฏใใใณใใใใชใใฏใใใใซใใใพใใ
+
+* [ๅคง่ฆๆจกใขใใซใฎใคใณในใฟใณในๅ](big_models)
+* [ใใใฉใผใใณในใฎๅ้กใฎใใฉใใซใทใฅใผใใฃใณใฐ](debugging)
+
+## Contribute
+
+ใใฎใใญใฅใกใณใใฏใพใ ๅฎๅ
จใงใฏใชใใใใใซ่ฟฝๅ ใใๅฟ
่ฆใใใ้
็ฎใใใใใใใใพใใ
+่ฟฝๅ ใ่จๆญฃใๅฟ
่ฆใชๅ ดๅใฏใ้ ๆ
ฎใใใซPRใใชใผใใณใใใใ่ฉณ็ดฐใ่ญฐ่ซใใใใใซIssueใ้ๅงใใฆใใ ใใใ
+
+AใBใใใๅชใใฆใใใจใใ่ฒข็ฎใ่กใ้ใซใฏใๅ็พๅฏ่ฝใชใใณใใใผใฏใใใฎๆ
ๅ ฑใฎๅบๅ
ธใธใฎใชใณใฏใๅซใใฆใฟใฆใใ ใใ๏ผใใชใ่ช่บซใฎๆ
ๅ ฑใงใใๅ ดๅใ้คใ๏ผใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perplexity.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perplexity.md
new file mode 100644
index 0000000000000000000000000000000000000000..368a301ec3ab4a36c6a21086e4ba748aad242a5e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/perplexity.md
@@ -0,0 +1,116 @@
+
+
+# Perplexity of fixed-length models
+
+[[open-in-colab]]
+
+ใใผใใฌใญใทใใฃ๏ผPPL๏ผใฏ่จ่ชใขใใซใฎ่ฉไพกใซๆใไธ่ฌ็ใชๆๆจใฎ1ใคใงใใๆทฑๅ
ฅใใใๅใซใใใฎๆๆจใฏ็นใซๅคๅ
ธ็ใช่จ่ชใขใใซ๏ผๆใซใฏใชใผใใฌใฐใฌใใทใใพใใฏๅ ๆ่จ่ชใขใใซใจใๅผใฐใใ๏ผใซ้ฉ็จใใใBERTใชใฉใฎใในใฏใใใ่จ่ชใขใใซใซใฏ้ฉใใฆใใชใใใจใซๆณจๆใในใใงใ๏ผใขใใซใฎๆฆ่ฆใๅ็
งใใฆใใ ใใ[ใขใใซใฎๆฆ่ฆ](model_summary)๏ผใ
+
+ใใผใใฌใญใทใใฃใฏใใทใผใฑใณในใฎๆๆฐๅนณๅ่ฒ ใฎๅฏพๆฐๅฐคๅบฆใจใใฆๅฎ็พฉใใใพใใใใผใฏใณๅใใใใทใผใฑใณใน \\(X = (x_0, x_1, \dots, x_t)\\) ใใใๅ ดๅใ\\(X\\) ใฎใใผใใฌใญใทใใฃใฏๆฌกใฎใใใซ่กจใใใพใใ
+
+$$\text{PPL}(X) = \exp \left\{ {-\frac{1}{t}\sum_i^t \log p_\theta (x_i|x_{
+
+ใใใใ้ๅธธใ่ฟไผผใขใใซใไฝฟ็จใใๅ ดๅใใขใใซใๅฆ็ใงใใใใผใฏใณๆฐใซๅถ็ดใใใใพใใไพใใฐใๆๅคงใฎ[GPT-2](model_doc/gpt2)ใฎใใผใธใงใณใฏ1024ใใผใฏใณใฎๅบๅฎ้ทใๆใฃใฆใใใใใ1024ใใใๅคงใใ \\(t\\) ใซๅฏพใใฆ \\(p_\theta(x_t|x_{
+
+ใใใฏๅใปใฐใกใณใใฎใใผใใฌใญใทใใฃใ1ๅใฎใใฉใฏใผใใในใง่จ็ฎใงใใใใใ่จ็ฎใ่ฟ
้ใงใใใ้ๅธธใใขใใซใฏใปใจใใฉใฎไบๆธฌในใใใใงใณใณใใญในใใๅฐใชใใใใๅฎๅ
จใซๅ ๅญๅ่งฃใใใใใผใใฌใญใทใใฃใฎๆชใ่ฟไผผใจใชใใ้ๅธธใใใ้ซใ๏ผๆชใ๏ผPPLใ่ฟใใพใใ
+
+ไปฃใใใซใๅบๅฎ้ทใขใใซใฎPPLใฏในใฉใคใใฃใณใฐใฆใฃใณใใฆๆฆ็ฅใ็จใใฆ่ฉไพกใใในใใงใใใใใซใฏใใขใใซใๅไบๆธฌในใใใใงใใๅคใใฎใณใณใใญในใใๆใคใใใซใใณใณใใญในใใฆใฃใณใใฆใ็นฐใ่ฟใในใฉใคใใใใใจใใๆนๆณใๅซใพใใพใใ
+
+
+
+ใใใฏใทใผใฑใณในใฎ็ขบ็ใฎใใๆญฃ็ขบใชๅ่งฃใซ่ฟใใใฎใงใใใ้ๅธธใฏใใๆๅฉใชในใณใขใ็ๆใใพใใๆฌ ็นใฏใใณใผใในๅ
ใฎๅใใผใฏใณใซๅฏพใใฆๅฅๅใฎๅๆนใในใๅฟ
่ฆใงใใๅฎ็จ็ใชๅฆฅๅๆกใฏใ1ใใผใฏใณใใคในใฉใคใใใไปฃใใใซใใใๅคงใใชในใใฉใคใใงใณใณใใญในใใ็งปๅใใในใใฉใคใๅใฎในใฉใคใใฃใณใฐใฆใฃใณใใฆใไฝฟ็จใใใใจใงใใใใใซใใใ่จ็ฎใใฏใใใซ้ซ้ใซ้ฒ่กใงใใไธๆนใงใใขใใซใซใฏๅในใใใใงไบๆธฌใ่กใใใใฎๅคงใใชใณใณใใญในใใๆไพใใใพใใ
+
+## Example: Calculating perplexity with GPT-2 in ๐ค Transformers
+
+GPT-2ใไฝฟ็จใใฆใใฎใใญใปในใใใขใณในใใฌใผใทใงใณใใฆใฟใพใใใใ
+
+```python
+from transformers import GPT2LMHeadModel, GPT2TokenizerFast
+
+device = "cuda"
+model_id = "openai-community/gpt2-large"
+model = GPT2LMHeadModel.from_pretrained(model_id).to(device)
+tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
+```
+
+WikiText-2ใใผใฟใปใใใ่ชญใฟ่พผใฟใ็ฐใชใในใฉใคใใฃใณใฐใฆใฃใณใใฆๆฆ็ฅใไฝฟ็จใใฆใใผใใฌใญใทใใฃใ่ฉไพกใใพใใใใฎใใผใฟใปใใใฏๅฐ่ฆๆจกใงใใปใใๅ
จไฝใซๅฏพใใฆๅไธใฎใใฉใฏใผใใในใๅฎ่กใใใ ใใชใฎใงใใใผใฟใปใใๅ
จไฝใใกใขใชใซ่ชญใฟ่พผใใงใจใณใณใผใใใใ ใใงๅๅใงใใ
+
+
+```python
+from datasets import load_dataset
+
+test = load_dataset("wikitext", "wikitext-2-raw-v1", split="test")
+encodings = tokenizer("\n\n".join(test["text"]), return_tensors="pt")
+```
+
+๐ค Transformersใไฝฟ็จใใใจใๅ็ดใซ`input_ids`ใใขใใซใฎ`labels`ใจใใฆๆธกใใใจใงใๅใใผใฏใณใฎๅนณๅ่ฒ ใฎๅฏพๆฐๅฐคๅบฆใๆๅคฑใจใใฆ่ฟใใใพใใใใใใในใฉใคใใฃใณใฐใฆใฃใณใใฆใฎใขใใญใผใใงใฏใๅใคใใฌใผใทใงใณใงใขใใซใซๆธกใใใผใฏใณใซใชใผใใผใฉใใใใใใพใใ็งใใกใฏใใณใณใใญในใใจใใฆๆฑใฃใฆใใใใผใฏใณใฎๅฏพๆฐๅฐคๅบฆใๆๅคฑใซๅซใใใใใใพใใใใใฎใใใใใใใฎๅฏพ่ฑกใ `-100` ใซ่จญๅฎใใฆ็ก่ฆใใใใใใซใใพใใไปฅไธใฏใในใใฉใคใใ `512` ใจใใๅ ดๅใฎไพใงใใใใใซใใใใขใใซใฏไปปๆใฎใใผใฏใณใฎๆกไปถไปใใฎๅฐคๅบฆใ่จ็ฎใใ้ใซใๅฐใชใใจใใณใณใใญในใใจใใฆ 512 ใใผใฏใณใๆใคใใจใซใชใใพใ๏ผ512 ๅใฎๅใฎใใผใฏใณใๅฉ็จๅฏ่ฝใงใใๅ ดๅ๏ผใ
+
+
+```python
+import torch
+from tqdm import tqdm
+
+max_length = model.config.n_positions
+stride = 512
+seq_len = encodings.input_ids.size(1)
+
+nlls = []
+prev_end_loc = 0
+for begin_loc in tqdm(range(0, seq_len, stride)):
+ end_loc = min(begin_loc + max_length, seq_len)
+ trg_len = end_loc - prev_end_loc # may be different from stride on last loop
+ input_ids = encodings.input_ids[:, begin_loc:end_loc].to(device)
+ target_ids = input_ids.clone()
+ target_ids[:, :-trg_len] = -100
+
+ with torch.no_grad():
+ outputs = model(input_ids, labels=target_ids)
+
+ # loss is calculated using CrossEntropyLoss which averages over valid labels
+ # N.B. the model only calculates loss over trg_len - 1 labels, because it internally shifts the labels
+ # to the left by 1.
+ neg_log_likelihood = outputs.loss
+
+ nlls.append(neg_log_likelihood)
+
+ prev_end_loc = end_loc
+ if end_loc == seq_len:
+ break
+
+ppl = torch.exp(torch.stack(nlls).mean())
+```
+
+ในใใฉใคใ้ทใๆๅคงๅ
ฅๅ้ทใจๅใๅ ดๅใไธ่ฟฐใฎๆ้ฉใงใชใในใฉใคใใฃใณใฐใฆใฃใณใใฆๆฆ็ฅใจๅ็ญใงใใในใใฉใคใใๅฐใใใปใฉใใขใใซใฏๅไบๆธฌใ่กใ้ใซใใๅคใใฎใณใณใใญในใใๆใคใใใ้ๅธธใๅ ฑๅใใใๅฐ้ฃๅบฆ๏ผperplexity๏ผใๅไธใใพใใ
+
+ไธ่จใฎใณใผใใ `stride = 1024` ใงๅฎ่กใใใจใใชใผใใผใฉใใใใชใ็ถๆ
ใงใ็ตๆใฎๅฐ้ฃๅบฆ๏ผperplexity๏ผใฏ `19.44` ใซใชใใพใใใใใฏ GPT-2 ใฎ่ซๆใซๅ ฑๅใใใ `19.93` ใจใปใผๅ็ญใงใใไธๆนใ`stride = 512` ใไฝฟ็จใใใใฎใใใซในใใฉใคใใฃใณใฐใฆใฃใณใใฆๆฆ็ฅใๆก็จใใใจใๅฐ้ฃๅบฆ๏ผperplexity๏ผใ `16.45` ใซๅไธใใพใใใใใฏใใๅฅฝๆ็ใชในใณใขใ ใใงใชใใใทใผใฑใณในใฎๅฐคๅบฆใฎ็ใฎ่ชๅทฑๅๅธฐๅ่งฃใซใใ่ฟใๆนๆณใง่จ็ฎใใใฆใใพใใ
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/philosophy.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/philosophy.md
new file mode 100644
index 0000000000000000000000000000000000000000..3edef0bd2add3b20d37332d0afadb904214ab1b0
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/philosophy.md
@@ -0,0 +1,67 @@
+
+
+# Philosophy
+
+๐ค Transformersใฏใๆฌกใฎใใใช็ฎ็ใงๆง็ฏใใใๆ่ฆใๆใคใฉใคใใฉใชใงใ๏ผ
+
+- ๅคง่ฆๆจกใชTransformersใขใใซใไฝฟ็จใ็ ็ฉถใใพใใฏๆกๅผตใใใๆฉๆขฐๅญฆ็ฟ็ ็ฉถ่
ใใใณๆ่ฒ่
ใ
+- ใใใใฎใขใใซใๅพฎ่ชฟๆดใใใใๆฌ็ช็ฐๅขใงๆไพใใใใใพใใฏใใฎไธกๆนใ่กใใใๅฎๅๅฎถใ
+- ไธใใใใๆฉๆขฐๅญฆ็ฟใฟในใฏใ่งฃๆฑบใใใใใซใไบๅใใฌใผใใณใฐใใใใขใใซใใใฆใณใญใผใใใฆไฝฟ็จใใใใจใณใธใใขใ
+
+ใใฎใฉใคใใฉใชใฏใ2ใคใฎๅผทๅใช็ฎๆจใๆใฃใฆ่จญ่จใใใพใใ๏ผ
+
+1. ใงใใใ ใ็ฐกๅใใค้ซ้ใซไฝฟ็จใงใใใใใซใใใใจ๏ผ
+
+ - ใฆใผใถใผๅใใฎๆฝ่ฑกๅใ้ใใชใๅฐใชใใใๅฎ้ใใปใจใใฉใฎๅ ดๅใๆฝ่ฑกๅใฏใใใพใใใ
+ ๅใขใใซใไฝฟ็จใใใใใซๅฟ
่ฆใช3ใคใฎๆจๆบใฏใฉในใ ใใๅญๅจใใพใ๏ผ[ๆงๆ](main_classes/configuration)ใ
+ [ใขใใซ](main_classes/model)ใใใใณๅๅฆ็ใฏใฉใน๏ผNLP็จใฎ[ใใผใฏใใคใถ](main_classes/tokenizer)ใใใธใงใณ็จใฎ[ใคใกใผใธใใญใปใใต](main_classes/image_processor)ใ
+ ใชใผใใฃใช็จใฎ[็นๅพดๆฝๅบๅจ](main_classes/feature_extractor)ใใใใณใใซใใขใผใใซๅ
ฅๅ็จใฎ[ใใญใปใใต](main_classes/processors)๏ผใ
+ - ใใใใฎใฏใฉในใฏใๅ
ฑ้ใฎ`from_pretrained()`ใกใฝใใใไฝฟ็จใใฆใไบๅใใฌใผใใณใฐๆธใฟใฎใคใณในใฟใณในใใ็ฐกๅใใค็ตฑไธใใใๆนๆณใงๅๆๅใงใใพใใใใฎใกใฝใใใฏใไบๅใใฌใผใใณใฐๆธใฟใฎใใงใใฏใใคใณใใใ้ข้ฃใใใฏใฉในใฎใคใณในใฟใณในใจ้ข้ฃใใผใฟ๏ผๆงๆใฎใใคใใผใใฉใกใผใฟใใใผใฏใใคใถใฎ่ชๅฝใใขใใซใฎ้ใฟ๏ผใใใฆใณใญใผใ๏ผๅฟ
่ฆใชๅ ดๅใฏใญใฃใใทใฅ๏ผใใฆ่ชญใฟ่พผใฟใพใใใใใใฎๅบๆฌใฏใฉในใฎไธใซใใฉใคใใฉใชใฏ2ใคใฎAPIใๆไพใใฆใใพใ๏ผ[ใใคใใฉใคใณ]ใฏใ็นๅฎใฎใฟในใฏใงใขใใซใใใฐใใๆจ่ซใซไฝฟ็จใใใใใฎใใฎใงใใใ[`Trainer`]ใฏPyTorchใขใใซใ่ฟ
้ใซใใฌใผใใณใฐใพใใฏๅพฎ่ชฟๆดใใใใใฎใใฎใงใ๏ผใในใฆใฎTensorFlowใขใใซใฏ`Keras.fit`ใจไบๆๆงใใใใพใ๏ผใ
+ - ใใฎ็ตๆใใใฎใฉใคใใฉใชใฏใใฅใผใฉใซใใใใฏใผใฏใฎใขใธใฅใฉใผใใผใซใใใฏในใงใฏใใใพใใใใฉใคใใฉใชใๆกๅผตใพใใฏๆง็ฏใใใๅ ดๅใฏใ้ๅธธใฎPythonใPyTorchใTensorFlowใKerasใขใธใฅใผใซใไฝฟ็จใใใฉใคใใฉใชใฎๅบๆฌใฏใฉในใใ็ถๆฟใใฆใขใใซใฎ่ชญใฟ่พผใฟใจไฟๅญใชใฉใฎๆฉ่ฝใๅๅฉ็จใใใ ใใงใใใขใใซใฎใณใผใใฃใณใฐๅฒๅญฆใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใฏใ[Repeat Yourself](https://huggingface.co/blog/transformers-design-philosophy)ใใญใฐๆ็จฟใใใงใใฏใใฆใฟใฆใใ ใใใ
+
+2. ใชใชใธใใซใฎใขใใซใซใงใใใ ใ่ฟใๆง่ฝใๆใคๆๆฐใฎใขใใซใๆไพใใใใจ๏ผ
+
+ - ๅใขใผใญใใฏใใฃใซๅฏพใใฆใๅ
ฌๅผใช่่
ใใๆไพใใใ็ตๆใๅ็พใใๅฐใชใใจใ1ใคใฎไพใๆไพใใพใใ
+ - ใณใผใใฏ้ๅธธใๅฏ่ฝใช้ใๅ
ใฎใณใผใใใผในใซ่ฟใใใฎใงใใใใใใฏPyTorchใณใผใใTensorFlowใณใผใใซๅคๆใใใใใจใใ็ใใ้ใใพใ็ถใใงใใ
+
+ใใฎไปใฎใใใคใใฎ็ฎๆจ๏ผ
+
+- ใขใใซใฎๅ
้จใใงใใใ ใไธ่ฒซใใฆๅ
ฌ้ใใใใจ๏ผ
+
+ - ใใซใช้ ใ็ถๆ
ใจๆณจๆใฎ้ใฟใซใขใฏใปในใงใใๅไธใฎAPIใๆไพใใพใใ
+ - ๅๅฆ็ใฏใฉในใจๅบๆฌใขใใซใฎAPIใฏๆจๆบๅใใใ็ฐกๅใซใขใใซ้ใๅใๆฟใใใใจใใงใใพใใ
+
+- ใใใใฎใขใใซใฎๅพฎ่ชฟๆดใจ่ชฟๆปใฎใใใฎๆๆใชใใผใซใไธป่ฆณ็ใซ้ธๅฎใใใใจ๏ผ
+
+ - ่ชๅฝใจๅใ่พผใฟใซๆฐใใใใผใฏใณใ่ฟฝๅ ใใใใใฎ็ฐกๅใงไธ่ฒซใใๆนๆณใ
+ - Transformerใใใใใในใฏใใใณใใซใผใณใใใใใฎ็ฐกๅใชๆนๆณใ
+
+- PyTorchใTensorFlow 2.0ใใใใณFlaxใฎ้ใ็ฐกๅใซๅใๆฟใใฆใ1ใคใฎใใฌใผใ ใฏใผใฏใงใใฌใผใใณใฐใใๅฅใฎใใฌใผใ ใฏใผใฏใงๆจ่ซใ่กใใใจใๅฏ่ฝใซใใใใจใ
+
+## Main concepts
+
+ใใฎใฉใคใใฉใชใฏใๅใขใใซใซใคใใฆๆฌกใฎ3ใคใฎใฟใคใใฎใฏใฉในใไธญๅฟใซๆง็ฏใใใฆใใพใ๏ผ
+
+- **ใขใใซใฏใฉใน**ใฏใใฉใคใใฉใชใงๆไพใใใไบๅใใฌใผใใณใฐๆธใฟใฎ้ใฟใจไบๆๆงใฎใใPyTorchใขใใซ๏ผ[torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)๏ผใKerasใขใใซ๏ผ[tf.keras.Model](https://www.tensorflow.org/api_docs/python/tf/keras/Model)๏ผใพใใฏJAX/Flaxใขใใซ๏ผ[flax.linen.Module](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html)๏ผใไฝฟ็จใงใใพใใ
+- **ๆงๆใฏใฉใน**ใฏใใขใใซใๆง็ฏใใใใใซๅฟ
่ฆใชใใคใใผใใฉใกใผใฟใๆ ผ็ดใใพใ๏ผๅฑคใฎๆฐใ้ ใๅฑคใฎใตใคใบใชใฉ๏ผใใใใใ่ชๅใงใคใณในใฟใณในๅใใๅฟ
่ฆใฏใใใพใใใ็นใซใๅคๆดใๅ ใใใซไบๅใใฌใผใใณใฐๆธใฟใขใใซใไฝฟ็จใใฆใใๅ ดๅใใขใใซใไฝๆใใใจ่ชๅ็ใซๆงๆใใคใณในใฟใณในๅใใใใใใซใชใใพใ๏ผใใใฏใขใใซใฎไธ้จใงใ๏ผใ
+- **ๅๅฆ็ใฏใฉใน**ใฏใ็ใใผใฟใใขใใซใๅใๅ
ฅใใๅฝขๅผใซๅคๆใใพใใ[ใใผใฏใใคใถ](main_classes/tokenizer)ใฏๅใขใใซใฎ่ชๅฝใไฟๅญใใๆๅญๅใใใผใฏใณๅใ่พผใฟใฎใคใณใใใฏในใฎใชในใใซใจใณใณใผใใใใณใใณใผใใใใใใฎใกใฝใใใๆไพใใพใใ[ใคใกใผใธใใญใปใใต](main_classes/image_processor)ใฏใใธใงใณๅ
ฅๅใๅๅฆ็ใใ[็นๅพดๆฝๅบๅจ](main_classes/feature_extractor)ใฏใชใผใใฃใชๅ
ฅๅใๅๅฆ็ใใ[ใใญใปใใต](main_classes/processors)ใฏใใซใใขใผใใซๅ
ฅๅใๅฆ็ใใพใใ
+
+ใใใใฎใในใฆใฎใฏใฉในใฏใไบๅใใฌใผใใณใฐๆธใฟใฎใคใณในใฟใณในใใใคใณในใฟใณในๅใใใญใผใซใซใซไฟๅญใใHubใงๅ
ฑๆใใใใจใใงใใ3ใคใฎใกใฝใใใไฝฟ็จใใฆใใพใ๏ผ
+
+- `from_pretrained()`ใฏใใฉใคใใฉใช่ชไฝใซใใฃใฆๆไพใใใ๏ผ[ใขใใซใใ](https://huggingface.co/models)ใงใตใใผใใใใฆใใใขใใซใใใใพใ๏ผใใใฆใผใถใผใซใใฃใฆใญใผใซใซใซไฟๅญใใใ๏ผใพใใฏใตใผใใผใซไฟๅญใใใ๏ผไบๅใใฌใผใใณใฐๆธใฟใใผใธใงใณใใใขใใซใๆงๆใๅๅฆ็ใฏใฉในใใคใณในใฟใณในๅใใใใใฎใกใฝใใใงใใ
+- `save_pretrained()`ใฏใใขใใซใๆงๆใๅๅฆ็ใฏใฉในใใญใผใซใซใซไฟๅญใใ`from_pretrained()`ใไฝฟ็จใใฆๅ่ชญใฟ่พผใฟใงใใใใใซใใพใใ
+- `push_to_hub()`ใฏใใขใใซใๆงๆใๅๅฆ็ใฏใฉในใHubใซๅ
ฑๆใใ่ชฐใงใ็ฐกๅใซใขใฏใปในใงใใใใใซใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pipeline_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pipeline_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..5dbda5ce4d4a359b9ae0a1f5be9714feb18b6ea5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pipeline_tutorial.md
@@ -0,0 +1,295 @@
+
+
+# Pipelines for inference
+
+[`pipeline`]ใไฝฟ็จใใใใจใงใ[Hub](https://huggingface.co/models)ใใใฎไปปๆใฎใขใใซใ่จ่ชใใณใณใใฅใผใฟใใธใงใณใ้ณๅฃฐใใใใณใใซใใขใผใใซใฟในใฏใฎๆจ่ซใซ็ฐกๅใซไฝฟ็จใงใใพใใ
+็นๅฎใฎใขใใชใใฃใซ้ขใใ็ต้จใใชใๅ ดๅใใใขใใซใฎ่ๅพใซใใใณใผใใซ็ฒพ้ใใฆใใชใๅ ดๅใงใใ[`pipeline`]ใไฝฟ็จใใฆๆจ่ซใงใใพใ๏ผ
+ใใฎใใฅใผใใชใขใซใงใฏใๆฌกใฎใใจใๅญฆใณใพใ๏ผ
+
+- ๆจ่ซใฎใใใฎ[`pipeline`]ใฎไฝฟ็จๆนๆณใ
+- ็นๅฎใฎใใผใฏใใคใถใใขใใซใฎไฝฟ็จๆนๆณใ
+- ใชใผใใฃใชใใใธใงใณใใใซใใขใผใใซใฟในใฏใฎใใใฎ[`pipeline`]ใฎไฝฟ็จๆนๆณใ
+
+
+
+ใตใใผใใใใฆใใใฟในใฏใจๅฉ็จๅฏ่ฝใชใใฉใกใผใฟใฎๅฎๅ
จใชไธ่ฆงใซใคใใฆใฏใ[`pipeline`]ใฎใใญใฅใกใณใใผใทใงใณใใ่ฆงใใ ใใใ
+
+
+
+## Pipeline usage
+
+ๅใฟในใฏใซใฏ้ข้ฃใใ[`pipeline`]ใใใใพใใใใฟในใฏๅบๆใฎ[`pipeline`]ใไฝฟ็จใใไปฃใใใซใใในใฆใฎใฟในใฏๅบๆใฎใใคใใฉใคใณใๅซใไธ่ฌ็ใช[`pipeline`]ใฎๆฝ่ฑกๅใไฝฟ็จใใใจใใใ็ฐกๅใงใใ[`pipeline`]ใฏ่ชๅ็ใซใใใฉใซใใฎใขใใซใจใใฟในใฏใฎๆจ่ซใๅฏ่ฝใชๅๅฆ็ใฏใฉในใ่ชญใฟ่พผใฟใพใใ
+
+1. [`pipeline`]ใไฝๆใใๆจ่ซใฟในใฏใๆๅฎใใฆๅงใใพใ๏ผ
+
+```py
+>>> from transformers import pipeline
+
+>>> generator = pipeline(task="automatic-speech-recognition")
+```
+
+2. [`pipeline`]ใซๅ
ฅๅใใญในใใๆธกใใพใ๏ผ
+
+```python
+>>> generator("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': 'I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES'}
+```
+
+ใใงใใฏใขใฆใใงใใชใใฃใใ๏ผ [Hubใฎๆใใใฆใณใญใผใใใใ่ชๅ้ณๅฃฐ่ช่ญใขใใซ](https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=downloads) ใฎใใใคใใ่ฆใฆใใใ่ฏใ่ปขๅใๅพใใใจใใงใใใใฉใใใ็ขบ่ชใใฆใฟใฆใใ ใใใ
+[openai/whisper-large](https://huggingface.co/openai/whisper-large) ใ่ฉฆใใฆใฟใพใใใ๏ผ
+
+```python
+>>> generator = pipeline(model="openai/whisper-large")
+>>> generator("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+ใใฎ็ตๆใฏใใๆญฃ็ขบใซ่ฆใใพใใญ๏ผ
+็ฐใชใ่จ่ชใๅฐ้ๅ้ใซ็นๅใใใขใใซใใใฎไปใฎใขใใซใซใคใใฆใฏใHubใใใงใใฏใใใใจใๅผทใใๅงใใใพใใ
+Hubใงใฏใใใฉใฆใถใใ็ดๆฅใขใใซใฎ็ตๆใใใงใใฏใใฆใไปใฎใขใใซใใใ้ฉใใฆใใใใ็นๆฎใชใฑใผในใใใใใๅฆ็ใงใใใใ็ขบ่ชใงใใพใใ
+ใใใฆใใใชใใฎใฆใผในใฑใผในใซ้ฉใใใขใใซใ่ฆใคใใใชใๅ ดๅใใใคใงใ[ใใฌใผใใณใฐ](training)ใ้ๅงใงใใพใ๏ผ
+
+่คๆฐใฎๅ
ฅๅใใใๅ ดๅใๅ
ฅๅใใชในใใจใใฆๆธกใใใจใใงใใพใ๏ผ
+
+```py
+generator(
+ [
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac",
+ "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac",
+ ]
+)
+```
+
+ใใผใฟใปใใๅ
จไฝใ็นฐใ่ฟใๅฆ็ใใใใใฆใงใใตใผใใผใงๆจ่ซใซไฝฟ็จใใใๅ ดๅใฏใๅฐ็จใฎ้จๅใใใงใใฏใใฆใใ ใใใ
+
+[ใใผใฟใปใใใงใใคใใฉใคใณใไฝฟ็จใใ](#using-pipeline-in-a-dataset)
+
+[ใฆใงใใตใผใใผใงใใคใใฉใคใณใไฝฟ็จใใ](./pipeline_webserver)
+
+
+
+## ใใฉใกใผใฟ
+
+[`pipeline`]ใฏๅคใใฎใใฉใกใผใฟใใตใใผใใใฆใใใไธ้จใฏใฟในใฏๅบๆใงใใใไธ้จใฏใในใฆใฎใใคใใฉใคใณใซๅ
ฑ้ใงใใ
+ไธ่ฌ็ใซใฏใใฉใใงใใใฉใกใผใฟใๆๅฎใงใใพใ๏ผ
+
+```py
+generator = pipeline(model="openai/whisper-large", my_parameter=1)
+out = generator(...) # ใใใฏ `my_parameter=1` ใไฝฟ็จใใพใใ
+out = generator(..., my_parameter=2) # ใใใฏไธๆธใใใฆ `my_parameter=2` ใไฝฟ็จใใพใใ
+out = generator(...) # ใใใฏๅใณ `my_parameter=1` ใไฝฟ็จใใพใใ
+```
+
+3ใคใฎ้่ฆใชใใฎใ็ขบ่ชใใพใใใ๏ผ
+
+### Device
+
+`device=n` ใไฝฟ็จใใใจใใใคใใฉใคใณใฏใขใใซใๆๅฎใใใใใคในใซ่ชๅ็ใซ้
็ฝฎใใพใใ
+ใใใฏใPyTorchใพใใฏTensorflowใไฝฟ็จใใฆใใใใฉใใใซ้ขไฟใชใๆฉ่ฝใใพใใ
+
+```py
+generator = pipeline(model="openai/whisper-large", device=0)
+```
+
+ใใใขใใซใๅไธใฎGPUใซใฏๅคงใใใใๅ ดๅใ`device_map="auto"`ใ่จญๅฎใใฆใ๐ค [Accelerate](https://huggingface.co/docs/accelerate) ใซใขใใซใฎ้ใฟใใฉใฎใใใซใญใผใใใไฟๅญใใใใ่ชๅ็ใซๆฑบๅฎใใใใใจใใงใใพใใ
+
+```python
+#!pip install accelerate
+generator = pipeline(model="openai/whisper-large", device_map="auto")
+```
+
+ๆณจๆ: `device_map="auto"` ใๆธกใใใๅ ดๅใ`pipeline` ใใคใณในใฟใณในๅใใ้ใซ `device=device` ๅผๆฐใ่ฟฝๅ ใใๅฟ
่ฆใฏใใใพใใใใใใใชใใจใไบๆใใชใๅไฝใซ้ญ้ใใๅฏ่ฝๆงใใใใพใ๏ผ
+
+### Batch size
+
+ใใใฉใซใใงใฏใใใคใใฉใคใณใฏ่ฉณ็ดฐใซใคใใฆ[ใใกใ](https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching)ใง่ชฌๆใใใฆใใ็็ฑใใใๆจ่ซใใใใๅฆ็ใใพใใใใใฎ็็ฑใฏใใใใๅฆ็ใๅฟ
ใใใ้ใใชใใใใงใใใๅฎ้ใซใฏใใใคใใฎใฑใผในใงใใชใ้
ใใชใใใจใใใใใใงใใ
+
+ใใ ใใใใชใใฎใฆใผในใฑใผในใงๆฉ่ฝใใๅ ดๅใฏใๆฌกใฎใใใซไฝฟ็จใงใใพใ๏ผ
+
+```py
+generator = pipeline(model="openai/whisper-large", device=0, batch_size=2)
+audio_filenames = [f"audio_{i}.flac" for i in range(10)]
+texts = generator(audio_filenames)
+```
+
+ใใใซใใใใใคใใฉใคใณใฏๆไพใใใ10ๅใฎใชใผใใฃใชใใกใคใซใงใใคใใฉใคใณใๅฎ่กใใพใใใ
+ใขใใซใซใฏใใใๅฆ็ใใใๅนๆ็ใงใใGPUไธใซใใใใใใๅฆ็ใ่กใใใใฎ่ฟฝๅ ใฎใณใผใใฏๅฟ
่ฆใใใพใใใ
+ๅบๅใฏๅธธใซใใใๅฆ็ใชใใงๅใๅใฃใใใฎใจไธ่ดใใใฏใใงใใใใใฏๅใซใใคใใฉใคใณใใใใ้ซ้ใชๅฆ็ใๅพใใใใฎๆนๆณใจใใฆๆไพใใใฆใใพใใ
+
+ใใคใใฉใคใณใฏใใใใๅฆ็ใฎใใใคใใฎ่ค้ใใ่ปฝๆธใใใใจใใงใใพใใใชใใชใใไธ้จใฎใใคใใฉใคใณใงใฏใ
+ใขใใซใงๅฆ็ใใใใใซ1ใคใฎใขใคใใ ๏ผ้ทใใชใผใใฃใชใใกใคใซใฎใใใชใใฎ๏ผใ่คๆฐใฎ้จๅใซๅๅฒใใๅฟ
่ฆใใใๅ ดๅใใใใใใงใใ
+ใใคใใฉใคใณใฏใใใใใชใใฎใใใซๅฎ่กใใพใใ[*ใใฃใณใฏใใใๅฆ็*](./main_classes/pipelines#pipeline-chunk-batching)ใจใใฆ็ฅใใใใใฎใๅฎ่กใใพใใ
+
+### Task specific parameters
+
+ใในใฆใฎใฟในใฏใฏใใฟในใฏๅบๆใฎใใฉใกใผใฟใๆไพใใ่ฟฝๅ ใฎๆ่ปๆงใจใชใใทใงใณใๆไพใใฆใไฝๆฅญใในใ ใผใบใซ้ฒใใใฎใซๅฝน็ซใกใพใใ
+ใใจใใฐใ[`transformers.AutomaticSpeechRecognitionPipeline.__call__`]ใกใฝใใใซใฏใใใใชใฎๅญๅนไฝๆใซๆ็จใช`return_timestamps`ใใฉใกใผใฟใใใใพใใ
+
+```py
+>>> # Not using whisper, as it cannot provide timestamps.
+>>> generator = pipeline(model="facebook/wav2vec2-large-960h-lv60-self", return_timestamps="word")
+>>> generator("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': 'I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP AND LIVE OUT THE TRUE MEANING OF ITS CREED', 'chunks': [{'text': 'I', 'timestamp': (1.22, 1.24)}, {'text': 'HAVE', 'timestamp': (1.42, 1.58)}, {'text': 'A', 'timestamp': (1.66, 1.68)}, {'text': 'DREAM', 'timestamp': (1.76, 2.14)}, {'text': 'BUT', 'timestamp': (3.68, 3.8)}, {'text': 'ONE', 'timestamp': (3.94, 4.06)}, {'text': 'DAY', 'timestamp': (4.16, 4.3)}, {'text': 'THIS', 'timestamp': (6.36, 6.54)}, {'text': 'NATION', 'timestamp': (6.68, 7.1)}, {'text': 'WILL', 'timestamp': (7.32, 7.56)}, {'text': 'RISE', 'timestamp': (7.8, 8.26)}, {'text': 'UP', 'timestamp': (8.38, 8.48)}, {'text': 'AND', 'timestamp': (10.08, 10.18)}, {'text': 'LIVE', 'timestamp': (10.26, 10.48)}, {'text': 'OUT', 'timestamp': (10.58, 10.7)}, {'text': 'THE', 'timestamp': (10.82, 10.9)}, {'text': 'TRUE', 'timestamp': (10.98, 11.18)}, {'text': 'MEANING', 'timestamp': (11.26, 11.58)}, {'text': 'OF', 'timestamp': (11.66, 11.7)}, {'text': 'ITS', 'timestamp': (11.76, 11.88)}, {'text': 'CREED', 'timestamp': (12.0, 12.38)}]}
+```
+
+ใขใใซใฏใใใญในใใๆจๆธฌใใๆใฎไธญใงๅๅ่ชใใใค็บ้ณใใใใใๅบๅใใพใใใ
+
+ๅใฟในใฏใใจใซๅฉ็จๅฏ่ฝใชๅคใใฎใใฉใกใผใฟใใใใพใใฎใงใไฝใ่ชฟๆดใงใใใใ็ขบ่ชใใใใใซๅใฟในใฏใฎAPIใชใใกใฌใณในใ็ขบ่ชใใฆใใ ใใ๏ผ
+ใใจใใฐใ[`~transformers.AutomaticSpeechRecognitionPipeline`]ใซใฏใใขใใซๅไฝใงใฏๅฆ็ใงใใชใ้ๅธธใซ้ทใใชใผใใฃใชใใกใคใซ๏ผใใจใใฐใๆ ็ปๅ
จไฝใ1ๆ้ใฎใใใชใฎๅญๅนไปใใชใฉ๏ผใงๅฝน็ซใค`chunk_length_s`ใใฉใกใผใฟใใใใพใใ
+
+
+
+ๅฝน็ซใคใใฉใกใผใฟใ่ฆใคใใใชใๅ ดๅใฏใ[ใชใฏใจในใ](https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml)ใใฆใใ ใใ๏ผ
+
+## Using pipeline in a dataset
+
+ใใคใใฉใคใณใฏๅคง่ฆๆจกใชใใผใฟใปใใไธใงๆจ่ซใๅฎ่กใใใใจใใงใใพใใใใใ่กใๆใ็ฐกๅใชๆนๆณใฏใใคใใฌใผใฟใไฝฟ็จใใใใจใงใ๏ผ
+
+```py
+def data():
+ for i in range(1000):
+ yield f"My example {i}"
+
+
+pipe = pipeline(model="openai-community/gpt2", device=0)
+generated_characters = 0
+for out in pipe(data()):
+ generated_characters += len(out[0]["generated_text"])
+```
+
+ใคใใฌใผใฟใผ `data()` ใฏๅ็ตๆใ็ๆใใใใคใใฉใคใณใฏ่ชๅ็ใซๅ
ฅๅใๅๅพฉๅฏ่ฝใงใใใใจใ่ช่ญใใใใผใฟใๅๅพใ็ถใใชใใGPUไธใงๅฆ็ใ่กใใพใ๏ผใใใฏ[DataLoader](https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader)ใๅ
้จใงไฝฟ็จใใฆใใพใ๏ผใ
+ใใใฏใใใผใฟใปใใๅ
จไฝใซใกใขใชใๅฒใๅฝใฆใๅฟ
่ฆใใชใใGPUใซใงใใใ ใ้ใใใผใฟใไพ็ตฆใงใใใใ้่ฆใงใใ
+
+ใใใๅฆ็ใฏๅฆ็ใ้ซ้ๅใงใใๅฏ่ฝๆงใใใใใใใใใง`batch_size`ใใฉใกใผใฟใ่ชฟๆดใใฆ่ฉฆใใใจใๅฝน็ซใคใใใใใพใใใ
+
+ใใผใฟใปใใใๅๅพฉๅฆ็ใใๆใ็ฐกๅใชๆนๆณใฏใ๐ค [Datasets](https://github.com/huggingface/datasets/)ใใใใผใฟใปใใใ่ชญใฟ่พผใใใจใงใ๏ผ
+
+```py
+# KeyDataset is a util that will just output the item we're interested in.
+from transformers.pipelines.pt_utils import KeyDataset
+from datasets import load_dataset
+
+pipe = pipeline(model="hf-internal-testing/tiny-random-wav2vec2", device=0)
+dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:10]")
+
+for out in pipe(KeyDataset(dataset, "audio")):
+ print(out)
+```
+
+## Using pipelines for a webserver
+
+
+ๆจ่ซใจใณใธใณใไฝๆใใใใจใฏ่ค้ใชใใใใฏใงใ็ฌ่ชใฎใใผใธใๅฟ
่ฆใงใใ
+
+
+[ใชใณใฏ](./pipeline_webserver)
+
+## Vision pipeline
+
+ใใธใงใณใฟในใฏ็จใฎ[`pipeline`]ใไฝฟ็จใใๆนๆณใฏใปใผๅใใงใใ
+
+ใฟในใฏใๆๅฎใใ็ปๅใใฏใฉใทใใกใคใขใซๆธกใใพใใ็ปๅใฏใชใณใฏใใญใผใซใซใในใใพใใฏBase64ใจใณใณใผใใใใ็ปๅใงใใใใจใใงใใพใใไพใใฐใไปฅไธใฎ็ปๅใฏใฉใฎ็จฎ้กใฎ็ซใงใใ๏ผ
+
+
+
+```py
+>>> from transformers import pipeline
+
+>>> vision_classifier = pipeline(model="google/vit-base-patch16-224")
+>>> preds = vision_classifier(
+... images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4335, 'label': 'lynx, catamount'}, {'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}, {'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}, {'score': 0.0239, 'label': 'Egyptian cat'}, {'score': 0.0229, 'label': 'tiger cat'}]
+```
+
+## Text pipeline
+
+[`pipeline`]ใไฝฟ็จใใใใจใฏใNLPใฟในใฏใซๅฏพใใฆใปใผๅใใงใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> # This model is a `zero-shot-classification` model.
+>>> # It will classify text, except you are free to choose any label you might imagine
+>>> classifier = pipeline(model="facebook/bart-large-mnli")
+>>> classifier(
+... "I have a problem with my iphone that needs to be resolved asap!!",
+... candidate_labels=["urgent", "not urgent", "phone", "tablet", "computer"],
+... )
+{'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}
+```
+
+## Multimodal pipeline
+
+[`pipeline`]ใฏใ1ใคไปฅไธใฎใขใใชใใฃใใตใใผใใใฆใใพใใใใจใใฐใ่ฆ่ฆ็ใช่ณชๅๅฟ็ญ๏ผVQA๏ผใฟในใฏใฏใใญในใใจ็ปๅใ็ตใฟๅใใใฆใใพใใ
+ๅฅฝใใช็ปๅใชใณใฏใจ็ปๅใซ้ขใใ่ณชๅใ่ช็ฑใซไฝฟใฃใฆใใ ใใใ็ปๅใฏURLใพใใฏ็ปๅใฎใญใผใซใซใในใงๆๅฎใงใใพใใ
+
+ไพใใฐใใใฎ[่ซๆฑๆธ็ปๅ](https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png)ใไฝฟ็จใใๅ ดๅ๏ผ
+
+```py
+>>> from transformers import pipeline
+
+>>> vqa = pipeline(model="impira/layoutlm-document-qa")
+>>> output = vqa(
+... image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png",
+... question="What is the invoice number?",
+... )
+>>> output[0]["score"] = round(output[0]["score"], 3)
+>>> output
+[{'score': 0.425, 'answer': 'us-001', 'start': 16, 'end': 16}]
+```
+
+
+
+ไธ่จใฎไพใๅฎ่กใใใซใฏใ๐ค Transformersใซๅ ใใฆ [`pytesseract`](https://pypi.org/project/pytesseract/) ใใคใณในใใผใซใใใฆใใๅฟ
่ฆใใใใพใใ
+
+```bash
+sudo apt install -y tesseract-ocr
+pip install pytesseract
+```
+
+
+
+## Using `pipeline` on large models with ๐ค `accelerate`:
+
+ใพใใ`accelerate` ใ`pip install accelerate` ใงใคใณในใใผใซใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+ๆฌกใซใ`device_map="auto"` ใไฝฟ็จใใฆใขใใซใใญใผใใใพใใใใฎไพใงใฏ `facebook/opt-1.3b` ใไฝฟ็จใใพใใ
+
+```python
+# pip install accelerate
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", torch_dtype=torch.bfloat16, device_map="auto")
+output = pipe("ใใใฏ็ด ๆดใใใไพใงใ๏ผ", do_sample=True, top_p=0.95)
+```
+
+ใใ `bitsandbytes` ใใคใณในใใผใซใใ`load_in_8bit=True` ๅผๆฐใ่ฟฝๅ ใใใฐใ8ใใใใง่ชญใฟ่พผใพใใใขใใซใๆธกใใใจใใงใใพใใ
+
+```py
+# pip install accelerate bitsandbytes
+import torch
+from transformers import pipeline
+
+pipe = pipeline(model="facebook/opt-1.3b", device_map="auto", model_kwargs={"load_in_8bit": True})
+output = pipe("This is a cool example!", do_sample=True, top_p=0.95)
+```
+
+ๆณจๆ: BLOOMใชใฉใฎๅคง่ฆๆจกใขใใซใฎใญใผใใใตใใผใใใHugging Faceใขใใซใฎใใใใใงใใใงใใฏใใคใณใใ็ฝฎใๆใใใใจใใงใใพใ๏ผ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pipeline_webserver.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pipeline_webserver.md
new file mode 100644
index 0000000000000000000000000000000000000000..3b35a01490d40912a5256cb42fb3f5ba2f789ab5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pipeline_webserver.md
@@ -0,0 +1,132 @@
+
+
+# Webใตใผใใผ็จใฎใใคใใฉใคใณใฎไฝฟ็จ
+
+
+ๆจ่ซใจใณใธใณใฎไฝๆใฏ่ค้ใชใใใใฏใงใใใ"ๆ้ฉใช"ใฝใชใฅใผใทใงใณใฏใใใใๅ้กใฎ้ ๅใซไพๅญใใใงใใใใCPUใพใใฏGPUใไฝฟ็จใใฆใใพใใ๏ผๆไฝใฎใฌใคใใณใทใๆ้ซใฎในใซใผใใใใๅคใใฎใขใใซใฎใตใใผใใใพใใฏ็นๅฎใฎใขใใซใฎ้ซๅบฆใชๆ้ฉๅใๆใใงใใพใใ๏ผ
+ใใฎใใใใฏใซๅใ็ตใใใใฎๅคใใฎๆนๆณใใใใ็งใใกใ็ดนไปใใใฎใฏใใใใใๆ้ฉใชใฝใชใฅใผใทใงใณใงใฏใชใใใใใใชใใใๅงใใใใใฎ่ฏใใใใฉใซใใงใใ
+
+
+้่ฆใชใใจใฏใWebใตใผใใผใฏใชใฏใจในใใๅพ
ๆฉใใๅไฟกใใใใใซๆฑใใทในใใ ใงใใใใใ[ใใผใฟใปใใ](pipeline_tutorial#using-pipelines-on-a-dataset)ใฎใใใซใใคใใฌใผใฟใไฝฟ็จใงใใใใจใงใใ
+
+้ๅธธใWebใตใผใใผใฏไธฆๅๅฆ็๏ผใใซใในใฌใใใ้ๅๆใชใฉ๏ผใใใฆใใใพใใพใชใชใฏใจในใใๅๆใซๅฆ็ใใพใใไธๆนใใใคใใฉใคใณ๏ผใใใณไธปใซใใฎๅบ็คใจใชใใขใใซ๏ผใฏไธฆๅๅฆ็ใซใฏใใพใ้ฉใใฆใใพใใใใใใใฏๅคใใฎRAMใไฝฟ็จใใใใใๅฎ่กไธญใซๅฉ็จๅฏ่ฝใชใชใฝใผในใใในใฆๆไพใใใใ่จ็ฎ้็ดๅใฎใธใงใใงใใๅ ดๅใซๆ้ฉใงใใ
+
+Webใตใผใใผใฏๅไฟกใจ้ไฟกใฎ่ปฝใ่ฒ ่ทใๅฆ็ใใๅฎ้ใฎไฝๆฅญใ1ใคใฎในใฌใใใงๅฆ็ใใใใใซใใพใใใใฎไพใงใฏ`starlette`ใไฝฟ็จใใพใใๅฎ้ใฎใใฌใผใ ใฏใผใฏใฏใใพใ้่ฆใงใฏใใใพใใใใๅฅใฎใใฌใผใ ใฏใผใฏใไฝฟ็จใใฆใใๅ ดๅใฏใๅใๅนๆใๅพใใใใซใณใผใใ่ชฟๆดใพใใฏๅคๆดใใๅฟ
่ฆใใใใใใใใพใใใ
+
+`server.py`ใไฝๆใใฆใใ ใใ๏ผ
+
+
+```py
+from starlette.applications import Starlette
+from starlette.responses import JSONResponse
+from starlette.routing import Route
+from transformers import pipeline
+import asyncio
+
+
+async def homepage(request):
+ payload = await request.body()
+ string = payload.decode("utf-8")
+ response_q = asyncio.Queue()
+ await request.app.model_queue.put((string, response_q))
+ output = await response_q.get()
+ return JSONResponse(output)
+
+
+async def server_loop(q):
+ pipe = pipeline(model="google-bert/bert-base-uncased")
+ while True:
+ (string, response_q) = await q.get()
+ out = pipe(string)
+ await response_q.put(out)
+
+
+app = Starlette(
+ routes=[
+ Route("/", homepage, methods=["POST"]),
+ ],
+)
+
+
+@app.on_event("startup")
+async def startup_event():
+ q = asyncio.Queue()
+ app.model_queue = q
+ asyncio.create_task(server_loop(q))
+```
+
+ใใใใๅงใใใใจใใงใใพใ๏ผ
+```bash
+uvicorn server:app
+```
+
+ใใใฆใๆฌกใฎใใใซใฏใจใชใงใใพใ๏ผ
+```bash
+curl -X POST -d "test [MASK]" http://localhost:8000/
+#[{"score":0.7742936015129089,"token":1012,"token_str":".","sequence":"test."},...]
+```
+
+
+
+ใใใฆใใใใงใฆใงใใตใผใใผใไฝๆใใๆนๆณใฎ่ฏใใขใคใใขใๆใฃใฆใใพใ๏ผ
+
+ๆฌๅฝใซ้่ฆใชใฎใฏใใขใใซใ**ไธๅบฆใ ใ**ใญใผใใใใใจใงใใใใใซใใใใฆใงใใตใผใใผไธใซใขใใซใฎใณใใผใใชใใใใไธๅฟ
่ฆใชRAMใไฝฟ็จใใใชใใชใใพใใ
+ใใฎๅพใใญใฅใผใคใณใฐใกใซใใบใ ใไฝฟ็จใใฆใๅ็ใใใๅฆ็ใ่กใใชใฉใใใใคใใฎใขใคใใ ใ่็ฉใใฆใใๆจ่ซใ่กใใชใฉใ้ซๅบฆใชๅฆ็ใ่กใใใจใใงใใพใ๏ผ
+
+
+
+ไปฅไธใฎใณใผใใตใณใใซใฏใๅฏ่ชญๆงใฎใใใซๆฌไผผใณใผใใฎใใใซๆธใใใฆใใพใใใทในใใ ใชใฝใผในใซๅ็็ใใฉใใใ็ขบ่ชใใใซๅฎ่กใใชใใงใใ ใใ๏ผ
+
+
+
+
+```py
+(string, rq) = await q.get()
+strings = []
+queues = []
+while True:
+ try:
+ (string, rq) = await asyncio.wait_for(q.get(), timeout=0.001) # 1ms
+ except asyncio.exceptions.TimeoutError:
+ break
+ strings.append(string)
+ queues.append(rq)
+strings
+outs = pipe(strings, batch_size=len(strings))
+for rq, out in zip(queues, outs):
+ await rq.put(out)
+```
+
+ใพใ็ฌฌไธใซใ้ๅธธใฏใใพใ่ฏใใขใคใใขใงใฏใชใใใใใตใคใบใฎๅถ้ใใใใพใใใๆฌกใซใใฟใคใ ใขใฆใใฏใญใฅใผใฎๅๅพใใจใซใชใปใใใใใใใใๆจ่ซใๅฎ่กใใๅใซ1msไปฅไธๅพ
ใคๅฏ่ฝๆงใใใใพใ๏ผๆๅใฎใชใฏใจในใใฎ้
ๅปถใซ1msๅ้
ใใ็ใใพใ๏ผใ
+
+1msใฎ็ท ใๅใใ1ๅใ ใๆใคใฎใ่ฏใใงใใใใ
+
+ใใใฏใใญใฅใผใซไฝใใชใๅ ดๅใงใๅธธใซ1msๅพ
ๆฉใใพใใใใญใฅใผใซไฝใใชใๅ ดๅใซๆจ่ซใ้ๅงใใใๅ ดๅใฏ้ฉใใฆใใชใใใใใใพใใใใใ ใใใใใๅฆ็ใๆฌๅฝใซ้่ฆใชๅ ดๅใซใฏๆๅณใใใใใใใใพใใใๅๅบฆใ1ใคใฎๆ้ฉใช่งฃๆฑบ็ญใฏๅญๅจใใพใใใ
+
+## Few things you might want to consider
+
+### Error checking
+
+ๆฌ็ช็ฐๅขใงใฏๅคใใฎๅ้กใ็บ็ใใๅฏ่ฝๆงใใใใพใ๏ผใกใขใชไธ่ถณใในใใผในไธ่ถณใใขใใซใฎ่ชญใฟ่พผใฟใๅคฑๆใใใใใใใพใใใใฏใจใชใ่ชคใฃใฆใใใใใใใพใใใใฏใจใชใๆญฃใใๅ ดๅใงใใขใใซใฎๆงๆใจใฉใผใฎใใใซๅฎ่กใซๅคฑๆใใใใใใใพใใใชใฉใ
+
+ไธ่ฌ็ใซใฏใใตใผใใผใใจใฉใผใใฆใผใถใผใซๅบๅใใใจ่ฏใใใใใใใใฎใจใฉใผใ่กจ็คบใใใใใฎๅคใใฎ`try..except`ในใใผใใกใณใใ่ฟฝๅ ใใใใจใฏ่ฏใใขใคใใขใงใใใใ ใใใปใญใฅใชใใฃใณใณใใญในใใซๅฟใใฆใใใใฎใจใฉใผใใในใฆ่กจ็คบใใใใจใฏใปใญใฅใชใใฃใชในใฏใซใชใๅฏ่ฝๆงใใใใใจใซๆณจๆใใฆใใ ใใใ
+
+### Circuit breaking
+
+Webใตใผใใผใฏ้ๅธธใ้่ฒ ่ทๆใซๆญฃใใใจใฉใผใ่ฟใๆนใ่ฏใใงใใใฏใจใชใ็กๆ้ใซๅพ
ใคไปฃใใใซ้ฉๅใชใจใฉใผใ่ฟใใพใใ้ทๆ้ๅพ
ใคไปฃใใใซ503ใจใฉใผใ่ฟใใใ้ทๆ้ๅพ
ใฃใฆใใ504ใจใฉใผใ่ฟใใใงใใ
+
+ๆๆกใใใใณใผใใงใฏๅไธใฎใญใฅใผใใใใใใใญใฅใผใตใคใบใ่ฆใใใจใฏใWebใตใผใใผใ่ฒ ่ทใซ่ใใๅใซใจใฉใผใ่ฟใใใใฎๅบๆฌ็ใชๆนๆณใงใใ
+
+### Blocking the main thread
+
+็พๅจใPyTorchใฏ้ๅๆใ่ช่ญใใฆใใชใใใใ่จ็ฎใฏใกใคใณในใฌใใใใใญใใฏใใพใใใคใพใใPyTorchใ็ฌ่ชใฎในใฌใใ/ใใญใปในใงๅฎ่กใใใใใใซใใใจ่ฏใใงใใใใๆๆกใใใใณใผใใฏใในใฌใใใจ้ๅๆใจใญใฅใผใใใพใ้ฃๆบใใชใใใใใใใฏ่กใใใฆใใพใใใใๆ็ต็ใซใฏๅใใใจใ่กใใพใใ
+
+ใใใฏใๅไธใฎใขใคใใ ใฎๆจ่ซใ้ทใๅ ดๅ๏ผ>1็ง๏ผใซ้่ฆใงใใใใฎๅ ดๅใๆจ่ซไธญใซใในใฆใฎใฏใจใชใ1็งๅพ
ใใชใใใฐใชใใชใใใจใๆๅณใใพใใ
+
+### Dynamic batching
+
+ไธ่ฌ็ใซใใใใๅฆ็ใฏ1ๅใฎใขใคใใ ใ1ๅๆธกใใใใๆนๅใใใใใจใฏๅฟ
ใใใใใใพใใ๏ผ่ฉณ็ดฐใฏ[ใใใๅฆ็ใฎ่ฉณ็ดฐ](./main_classes/pipelines#pipeline-batching)ใๅ็
ง๏ผใใใใใๆญฃใใ่จญๅฎใงไฝฟ็จใใใจ้ๅธธใซๅนๆ็ใงใใAPIใงใฏใใใฉใซใใงๅ็ใใใๅฆ็ใฏ่กใใใพใใ๏ผ้
ๅปถใฎๆฉไผใๅคใใใพใ๏ผใใใใใ้ๅธธใซๅคง่ฆๆจกใชใขใใซใงใใBLOOMๆจ่ซใฎๅ ดๅใๅ็ใใใๅฆ็ใฏ**้่ฆ**ใงใใใใใซใใใใในใฆใฎใฆใผใถใผใซใจใฃใฆใพใจใใชใจใฏในใใชใจใณในใๆไพใงใใพใใ
+
+ไปฅไธใใๆไพใใใใใญในใใฎMarkdownๅฝขๅผใฎ็ฟป่จณใงใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pr_checks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pr_checks.md
new file mode 100644
index 0000000000000000000000000000000000000000..dc8450b52502e670c12cf4baeb0f0777395df15f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/pr_checks.md
@@ -0,0 +1,208 @@
+
+
+
+# Checks on a Pull Request
+
+๐ค Transformersใชใใธใใชใงใใซใชใฏใจในใใ้ใใจใ่ฟฝๅ ใใฆใใใใใใๆขๅญใฎใใฎใๅฃใใฆใใชใใใจใ็ขบ่ชใใใใใซใใใชใใฎๆฐใฎใใงใใฏใๅฎ่กใใใพใใใใใใฎใใงใใฏใซใฏใๆฌกใฎ4ใคใฎใฟใคใใใใใพใ๏ผ
+- ้ๅธธใฎใในใ
+- ใใญใฅใกใณใใผใทใงใณใฎใใซใ
+- ใณใผใใจใใญใฅใกใณใใผใทใงใณใฎในใฟใคใซ
+- ใชใใธใใชๅ
จไฝใฎไธ่ฒซๆง
+
+ใใฎใใญใฅใกใณใใงใฏใใใใใฎใใพใใพใชใใงใใฏใจใใฎ่ๅพใซใใ็็ฑใใใใฆใใใใฎใใใใใใใชใใฎใใซใชใฏใจในใใงๅคฑๆใใๅ ดๅใฎใญใผใซใซใงใฎใใใใฐๆนๆณใซใคใใฆ่ชฌๆใใพใใ
+
+ใชใใ็ๆณ็ใซใฏใ้็บ่
็จใฎใคใณในใใผใซใๅฟ
่ฆใงใ๏ผ
+
+
+```bash
+pip install transformers[dev]
+```
+
+ใพใใฏ็ทจ้ๅฏ่ฝใชใคใณในใใผใซใฎๅ ดๅ๏ผ
+
+
+```bash
+pip install -e .[dev]
+```
+
+ใใฉใณในใใฉใผใใผใบใฎใชใใธใใชๅ
ใงไฝๆฅญใใฆใใพใใใใฉใณในใใฉใผใใผใบใฎใชใใทใงใณใฎไพๅญ้ขไฟใฎๆฐใๅขใใใใใใในใฆใๅๅพใงใใชใๅฏ่ฝๆงใใใใพใใ้็บ็จใคใณในใใผใซใๅคฑๆใใๅ ดๅใไฝๆฅญใใฆใใใใฃใผใใฉใผใใณใฐใใฌใผใ ใฏใผใฏ๏ผPyTorchใTensorFlowใใใใณ/ใพใใฏFlax๏ผใใคใณในใใผใซใใๆฌกใฎๆ้ ใๅฎ่กใใฆใใ ใใใ
+
+
+```bash
+pip install transformers[quality]
+```
+
+ใพใใฏ็ทจ้ๅฏ่ฝใชใคใณในใใผใซใฎๅ ดๅ๏ผ
+
+```bash
+pip install -e .[quality]
+```
+
+## Tests
+
+`ci/circleci: run_tests_` ใงๅงใพใใในใฆใฎใธใงใใฏใTransformersใฎใในใในใคใผใใฎไธ้จใๅฎ่กใใพใใใใใใฎใธใงใใฏใ็นๅฎใฎ็ฐๅขใงใฉใคใใฉใชใฎไธ้จใซ็ฆ็นใๅฝใฆใฆๅฎ่กใใใพใใใใจใใฐใ`ci/circleci: run_tests_pipelines_tf` ใฏใTensorFlowใฎใฟใใคใณในใใผใซใใใ็ฐๅขใงใใคใใฉใคใณใฎใในใใๅฎ่กใใพใใ
+
+ใในใในใคใผใใฎไธ้จใฎใฟใๅฎ่กใใใใใใซๆณจๆใใฆใใ ใใใใในใในใคใผใใฏใๅคๆดๅใจๅคๆดๅพใฎPRใฎใฉใคใใฉใชใฎ้ใใๆฑบๅฎใใใใฎ้ใใซๅฝฑ้ฟใๅใใใในใใ้ธๆใใใใใฎใฆใผใใฃใชใใฃใๅฎ่กใใใพใใใใฎใฆใผใใฃใชใใฃใฏใใญใผใซใซใงไปฅไธใฎใณใใณใใๅฎ่กใใฆๅฎ่กใงใใพใ๏ผ
+
+
+```bash
+python utils/tests_fetcher.py
+```
+
+1. ใชใใธใใชใฎใซใผใใใในใฏใชใใใๅฎ่กใใพใใใใใฏๆฌกใฎในใใใใๅฎ่กใใพใ๏ผ
+
+ 1. ๅทฎๅๅ
ใฎๅใใกใคใซใใใงใใฏใใๅคๆดใใณใผใๅ
ใซใใใใใณใกใณใใใใญใฅใกใณใใผใทใงใณๆๅญๅใฎใฟใซใใใใ็ขบ่ชใใพใใๅฎ้ใฎใณใผใๅคๆดใใใใใกใคใซใฎใฟใไฟๆใใพใใ
+
+ 2. ๅ
้จใฎใใใใๆง็ฏใใพใใใใฎใใใใฏใใฉใคใใฉใชใฎใฝใผในใณใผใใฎๅใใกใคใซใๅๅธฐ็ใซๅฝฑ้ฟใไธใใใในใฆใฎใใกใคใซใๆไพใใพใใใขใธใฅใผใซAใใขใธใฅใผใซBใซๅฝฑ้ฟใไธใใใจใฏใใขใธใฅใผใซBใใขใธใฅใผใซAใใคใณใใผใใใๅ ดๅใๆใใพใใๅๅธฐ็ใชๅฝฑ้ฟใๅพใใซใฏใใขใธใฅใผใซAใใใขใธใฅใผใซBใธใฎใขใธใฅใผใซใฎใใงใผใณใๅฟ
่ฆใงใๅใขใธใฅใผใซใฏๅใฎใขใธใฅใผใซใใคใณใใผใใใๅฟ
่ฆใใใใพใใ
+
+ 3. ใใฎใใใใในใใใ1ใงๅ้ใใใใกใคใซใซ้ฉ็จใใพใใใใใซใใใPRใซๅฝฑ้ฟใๅใใใขใใซใใกใคใซใฎใชในใใๅพใใใพใใ
+
+ 4. ใใใใฎใใกใคใซใใใใซๅฏพๅฟใใใในใใใกใคใซใซใใใใใๅฎ่กใใใในใใฎใชในใใๅๅพใใพใใ
+
+2. ในใฏใชใใใใญใผใซใซใงๅฎ่กใใๅ ดๅใในใใใ1ใ3ใใใใณ4ใฎ็ตๆใ่กจ็คบใใใๅฎ่กใใใในใใใใใใพใใในใฏใชใใใฏใพใใ`test_list.txt` ใจใใๅๅใฎใใกใคใซใไฝๆใใพใใใใฎใใกใคใซใซใฏๅฎ่กใใใในใใฎใชในใใๅซใพใใฆใใใๆฌกใฎใณใใณใใงใญใผใซใซใงๅฎ่กใงใใพใ๏ผ
+
+```bash
+python -m pytest -n 8 --dist=loadfile -rA -s $(cat test_list.txt)
+```
+
+## Documentation build
+
+`build_pr_documentation` ใธใงใใฏใใใญใฅใกใณใใผใทใงใณใฎใใซใใ่กใใใใชใใฎPRใใใผใธใใใๅพใซใในใฆใๆญฃๅธธใซ่กจ็คบใใใใใจใ็ขบ่ชใใพใใใใใใใใฌใใฅใผใฎใใญใฅใกใณใใผใทใงใณใธใฎใชใณใฏใPRใซ่ฟฝๅ ใใพใใPRใซๅฏพใใๅคๆดใฏใใใฌใใฅใผใซ่ชๅ็ใซๅๆ ใใใพใใใใญใฅใกใณใใผใทใงใณใฎใใซใใซๅคฑๆใใๅ ดๅใๅคฑๆใใใธใงใใฎ้ฃใซใใใ่ฉณ็ดฐใใใฏใชใใฏใใฆใไฝใๅ้กใซใชใฃใฆใใใใ็ขบ่ชใงใใพใใๅคใใฎๅ ดๅใๅ้กใฏ`toctree`ๅ
ใฎใใกใคใซใไธ่ถณใใฆใใใชใฉใๅ็ดใชใใฎใงใใ
+
+ใใญใฅใกใณใใผใทใงใณใใญใผใซใซใงใใซใใพใใฏใใฌใใฅใผใใใๅ ดๅใฏใ[docsใใฉใซใๅ
ใฎ`README.md`](https://github.com/huggingface/transformers/tree/main/docs)ใใ่ฆงใใ ใใใ
+
+## Code and documentation style
+
+ใในใฆใฎใฝใผในใใกใคใซใไพใใในใใซใฏใ`black`ใจ`ruff`ใไฝฟ็จใใฆใณใผใใฎใใฉใผใใใใ้ฉ็จใใใพใใใพใใใใใฏในใใชใณใฐใจ`rst`ใใกใคใซใฎใใฉใผใใใใTransformersใฎ`__init__.py`ใใกใคใซใงๅฎ่กใใใ้
ๅปถใคใณใใผใใฎ้ ๅบใซใคใใฆใใซในใฟใ ใใผใซใๅญๅจใใพใ๏ผ`utils/style_doc.py`ใจ`utils/custom_init_isort.py`๏ผใใใใใในใฆใฏใไปฅไธใๅฎ่กใใใใจใง่ตทๅใงใใพใใ
+
+
+```bash
+make style
+```
+
+CIใฏใ`ci/circleci: check_code_quality` ใใงใใฏๅ
ใงใใใใฎใใงใใฏใ้ฉ็จใใใฆใใใใจใ็ขบ่ชใใพใใใพใใ`ruff` ใๅฎ่กใใๆชๅฎ็พฉใฎๅคๆฐใไฝฟ็จใใใฆใใชใๅคๆฐใใใๅ ดๅใซใจใฉใผใๅ ฑๅใใพใใใใฎใใงใใฏใใญใผใซใซใงๅฎ่กใใใซใฏใไปฅไธใฎใณใใณใใไฝฟ็จใใฆใใ ใใใ
+
+
+```bash
+make quality
+```
+
+ๆ้ใใใใใใจใใใใพใใใใใใฃใฆใ็พๅจใฎใใฉใณใใงๅคๆดใใใใกใคใซใฎใฟใงๅใใใจใๅฎ่กใใใซใฏใๆฌกใฎใณใใณใใๅฎ่กใใพใใ
+
+
+```bash
+make fixup
+```
+
+ใใฎๆๅพใฎใณใใณใใฏใใชใใธใใชใฎๆดๅๆงใฎใใใฎใในใฆใฎ่ฟฝๅ ใฎใใงใใฏใๅฎ่กใใพใใใใใใ่ฉณใใ่ฆใฆใฟใพใใใใ
+
+## Repository consistency
+
+ใใใซใฏใใใชใใฎPRใใชใใธใใชใ้ฉๅใช็ถๆ
ใซไฟใฃใใพใพใงใใใใจใ็ขบ่ชใใใใใฎใในใฆใฎใในใใๅซใพใใฆใใใci/`circleci: check_repository_consistency` ใใงใใฏใซใใฃใฆๅฎ่กใใใพใใใญใผใซใซใงใใฎใใงใใฏใๅฎ่กใใใซใฏใไปฅไธใๅฎ่กใใพใใ
+
+```bash
+make repo-consistency
+```
+
+ใใใ็ขบ่ชใใพใ๏ผ
+
+- `utils/check_repo.py` ใซใใฃใฆๅฎ่กใใใใinit ใซ่ฟฝๅ ใใใใในใฆใฎใชใใธใงใฏใใๆๆธๅใใใฆใใพใใ
+- `utils/check_inits.py` ใซใใฃใฆๅฎ่กใใใใใในใฆใฎ `__init__.py` ใใกใคใซใใใฎ2ใคใฎใปใฏใทใงใณใงๅใๅ
ๅฎนใๆใฃใฆใใพใใ
+- `utils/check_copies.py` ใซใใฃใฆๅฎ่กใใใใไปใฎใขใธใฅใผใซใใใฎใณใใผใจใใฆ่ญๅฅใใใใในใฆใฎใณใผใใๅ
ใฎใณใผใใจไธ่ดใใฆใใพใใ
+- `utils/check_config_docstrings.py` ใซใใฃใฆๅฎ่กใใใใใในใฆใฎ่จญๅฎใฏใฉในใซใฏๅฐใชใใจใ1ใคใฎๆๅนใชใใงใใฏใใคใณใใใใญใฅใกใณใๆๅญๅใซ่จ่ผใใใฆใใพใใ
+- `utils/check_config_attributes.py` ใซใใฃใฆๅฎ่กใใใใใในใฆใฎ่จญๅฎใฏใฉในใซใฏใๅฏพๅฟใใใขใใชใณใฐใใกใคใซใงไฝฟ็จใใใฆใใๅฑๆงใฎใฟใๅซใพใใฆใใพใใ
+- `utils/check_copies.py` ใซใใฃใฆๅฎ่กใใใใREADME ใจใใญใฅใกใณใใฎใคใณใใใฏในใฎ็ฟป่จณใใใกใคใณใฎREADME ใจๅใใขใใซใชในใใๆใฃใฆใใพใใ
+- `utils/check_table.py` ใซใใฃใฆๅฎ่กใใใใใใญใฅใกใณใใผใทใงใณใฎ่ชๅ็ๆใใผใใซใๆๆฐใงใใใใจใ็ขบ่ชใใพใใ
+- `utils/check_dummies.py` ใซใใฃใฆๅฎ่กใใใใใในใฆใฎใชใใธใงใฏใใๅฉ็จๅฏ่ฝใงใใใใชใใทใงใณใฎไพๅญ้ขไฟใใในใฆใคใณในใใผใซใใใฆใใชใใฆใๅ้กใใใพใใใ
+
+ใใฎใใงใใฏใๅคฑๆใใๅ ดๅใๆๅใฎ2ใคใฎ้
็ฎใฏๆๅใงไฟฎๆญฃใใๅฟ
่ฆใใใใๆๅพใฎ4ใคใฏใณใใณใใๅฎ่กใใฆ่ชๅ็ใซไฟฎๆญฃใงใใพใใ
+
+
+```bash
+make fix-copies
+```
+
+่ฟฝๅ ใฎใใงใใฏใใคใณใใฏใๆฐใใใขใใซใ่ฟฝๅ ใใPull Request๏ผPR๏ผใซ้ข้ฃใใฆใใพใใไธปใซๆฌกใฎ็นใ็ขบ่ชใใพใ๏ผ
+
+- ใในใฆใฎ่ฟฝๅ ใใใใขใใซใฏใAuto-mapping๏ผ`utils/check_repo.py`ใงๅฎ่ก๏ผใซๅซใพใใฆใใพใใ
+
+- ใในใฆใฎใขใใซใ้ฉๅใซใในใใใใฆใใพใ๏ผ`utils/check_repo.py`ใงๅฎ่ก๏ผใ
+
+
+
+
+### Check copies
+
+Transformersใฉใคใใฉใชใฏใใขใใซใณใผใใซ้ขใใฆ้ๅธธใซๆ่ฆใใใใใใๅใขใใซใฏไปใฎใขใใซใซไพๅญใใใซๅฎๅ
จใซ1ใคใฎใใกใคใซใซๅฎ่ฃ
ใใๅฟ
่ฆใใใใพใใใใใใฃใฆใ็นๅฎใฎใขใใซใฎใณใผใใฎใณใใผใๅ
ใฎใณใผใใจไธ่ฒซใใฆใใใใฉใใใ็ขบ่ชใใไป็ตใฟใ่ฟฝๅ ใใพใใใใใใซใใใใใฐไฟฎๆญฃใใใๅ ดๅใไปใฎๅฝฑ้ฟใๅใใใขใใซใใในใฆ็ขบ่ชใใๅคๆดใไผ้ใใใใณใใผใ็ ดๆฃใใใใ้ธๆใงใใพใใ
+
+
+
+ใใกใคใซใๅฅใฎใใกใคใซใฎๅฎๅ
จใชใณใใผใงใใๅ ดๅใใใใ`utils/check_copies.py`ใฎ`FULL_COPIES`ๅฎๆฐใซ็ป้ฒใใๅฟ
่ฆใใใใพใใ
+
+
+
+ใใฎไป็ตใฟใฏใ`# Copied from xxx`ใจใใๅฝขๅผใฎใณใกใณใใซไพๅญใใฆใใพใใ`xxx`ใฏใใณใใผใใใฆใใใฏใฉในใพใใฏ้ขๆฐใฎๅฎๅ
จใชใในใๅซใๅฟ
่ฆใใใใพใใไพใใฐใ`RobertaSelfOutput`ใฏ`BertSelfOutput`ใฏใฉในใฎ็ดๆฅใฎใณใใผใงใใฎใงใ[ใใกใ](https://github.com/huggingface/transformers/blob/2bd7a27a671fd1d98059124024f580f8f5c0f3b5/src/transformers/models/roberta/modeling_roberta.py#L289)ใซใณใกใณใใใใใพใใ
+
+
+```py
+# Copied from transformers.models.bert.modeling_bert.BertSelfOutput
+```
+
+ๆณจๆ็นใจใใฆใใใใใฏใฉในๅ
จไฝใซ้ฉ็จใใไปฃใใใซใใณใใผๅ
ใฎ้ข้ฃใกใฝใใใซ้ฉ็จใงใใพใใใใจใใฐใ[ใใกใ](https://github.com/huggingface/transformers/blob/2bd7a27a671fd1d98059124024f580f8f5c0f3b5/src/transformers/models/roberta/modeling_roberta.py#L598)ใงใฏใ`RobertaPreTrainedModel._init_weights` ใ `BertPreTrainedModel` ใใใณใใผใใใฆใใใไปฅไธใฎใณใกใณใใใใใพใ๏ผ
+
+
+```py
+# Copied from transformers.models.bert.modeling_bert.BertAttention with Bert->Roberta
+```
+
+ๆณจ๏ผ็ขๅฐใฎๅจใใซใฏในใใผในใๅซใพใใฆใใฆใฏใใใพใใ๏ผใใกใใใใใฎในใใผในใ็ฝฎๆใใฟใผใณใฎไธ้จใงใใๅ ดๅใ้คใใพใ๏ผใ
+
+ใซใณใใงๅบๅใใใ่คๆฐใฎใใฟใผใณใ่ฟฝๅ ใงใใพใใไพใใฐใใใใงใฏ `CamemberForMaskedLM` ใฏ `RobertaForMaskedLM` ใฎ็ดๆฅใฎใณใใผใงใ2ใคใฎ็ฝฎๆใใใใพใ๏ผ `Roberta` ใใ `Camembert` ใธใใใใฆ `ROBERTA` ใใ `CAMEMBERT` ใธใจ็ฝฎๆใใใพใใ[ใใกใ](https://github.com/huggingface/transformers/blob/15082a9dc6950ecae63a0d3e5060b2fc7f15050a/src/transformers/models/camembert/modeling_camembert.py#L929)ใงใใใฎไฝๆฅญใฏใณใกใณใไปใใง่กใใใฆใใพใใ
+
+
+```py
+# Copied from transformers.models.roberta.modeling_roberta.RobertaForMaskedLM with Roberta->Camembert, ROBERTA->CAMEMBERT
+```
+
+
+ใใ้ ๅบใ้่ฆใชๅ ดๅ๏ผไปฅๅใฎ็ฝฎๆใจ็ซถๅใใๅฏ่ฝๆงใใใใใ๏ผใ็ฝฎๆใฏๅทฆใใๅณใซๅฎ่กใใใพใใ
+
+
+
+ใใ็ฝฎๆใใใฉใผใใใใๅคๆดใใๅ ดๅ๏ผใใจใใฐใ็ญใๅๅใ้ๅธธใซ้ทใๅๅใซ็ฝฎใๆใใๅ ดๅใชใฉ๏ผใ่ชๅใใฉใผใใใฟใ้ฉ็จใใๅพใซใณใใผใ็ขบ่ชใใใพใใ
+
+
+
+ใใฟใผใณใๅใ็ฝฎๆใฎ็ฐใชใใฑใผใน๏ผๅคงๆๅญใจๅฐๆๅญใฎใใชใขใณใใใใ๏ผใฎๅ ดๅใใชใใทใงใณใจใใฆ `all-casing` ใ่ฟฝๅ ใใใ ใใฎๅฅใฎๆนๆณใใใใพใใ[ใใกใ](https://github.com/huggingface/transformers/blob/15082a9dc6950ecae63a0d3e5060b2fc7f15050a/src/transformers/models/mobilebert/modeling_mobilebert.py#L1237)ใฏใ`MobileBertForSequenceClassification` ๅ
ใฎไพใงใใณใกใณใใใคใใฆใใพใใ
+
+
+```py
+# Copied from transformers.models.bert.modeling_bert.BertForSequenceClassification with Bert->MobileBert all-casing
+```
+
+ใใฎๅ ดๅใใณใผใใฏใBertForSequenceClassificationใใใใณใใผใใใๆฌกใฎใใใซ็ฝฎๆใใใพใ๏ผ
+- `Bert` ใ `MobileBert` ใซ็ฝฎใๆใใ๏ผไพ๏ผ`init`ใง `MobileBertModel` ใไฝฟ็จใใๅ ดๅ๏ผ
+- `bert` ใ `mobilebert` ใซ็ฝฎใๆใใ๏ผไพ๏ผ`self.mobilebert` ใๅฎ็พฉใใๅ ดๅ๏ผ
+- `BERT` ใ `MOBILEBERT` ใซ็ฝฎใๆใใ๏ผๅฎๆฐ `MOBILEBERT_INPUTS_DOCSTRING` ๅ
ใง๏ผ
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/preprocessing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/preprocessing.md
new file mode 100644
index 0000000000000000000000000000000000000000..ea0b98df028031e15f985cf53df53ca49b45891b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/preprocessing.md
@@ -0,0 +1,533 @@
+
+
+# Preprocess
+
+[[open-in-colab]]
+
+ใใผใฟใปใใใงใขใใซใใใฌใผใใณใฐใใๅใซใใใใใขใใซใฎๆๅพ
ใใๅ
ฅๅๅฝขๅผใซๅๅฆ็ใใๅฟ
่ฆใใใใพใใ
+ใใผใฟใใใญในใใ็ปๅใใพใใฏใชใผใใฃใชใงใใใใฉใใใซใใใใใใใใใใฏใใณใฝใซใฎใใใใซๅคๆใใฆ็ตใฟ็ซใฆใๅฟ
่ฆใใใใพใใ
+๐ค Transformersใฏใใใผใฟใใขใใซ็จใซๆบๅใใใฎใซๅฝน็ซใคๅๅฆ็ใฏใฉในใฎใปใใใๆไพใใฆใใพใใ
+ใใฎใใฅใผใใชใขใซใงใฏใๆฌกใฎใใจใๅญฆใณใพใ๏ผ
+
+* ใใญในใใฎๅ ดๅใ[Tokenizer](./main_classes/tokenizer)ใไฝฟ็จใใฆใใญในใใใใผใฏใณใฎใทใผใฑใณในใซๅคๆใใใใผใฏใณใฎๆฐๅค่กจ็พใไฝๆใใใใใใใใณใฝใซใซ็ตใฟ็ซใฆใๆนๆณใ
+* ้ณๅฃฐใจใชใผใใฃใชใฎๅ ดๅใ[Feature extractor](./main_classes/feature_extractor)ใไฝฟ็จใใฆใชใผใใฃใชๆณขๅฝขใใ้ฃ็ถ็ใช็นๅพดใๆฝๅบใใใใใใใใณใฝใซใซๅคๆใใๆนๆณใ
+* ็ปๅๅ
ฅๅใฎๅ ดๅใ[ImageProcessor](./main_classes/image)ใไฝฟ็จใใฆ็ปๅใใใณใฝใซใซๅคๆใใๆนๆณใ
+* ใใซใใขใผใใซๅ
ฅๅใฎๅ ดๅใ[Processor](./main_classes/processors)ใไฝฟ็จใใฆใใผใฏใใคใถใจ็นๅพดๆฝๅบๅจใพใใฏ็ปๅใใญใปใใตใ็ตใฟๅใใใๆนๆณใ
+
+
+
+`AutoProcessor`ใฏๅธธใซๅไฝใใไฝฟ็จใใใขใใซใซ้ฉๅใชใฏใฉในใ่ชๅ็ใซ้ธๆใใพใใ
+ใใผใฏใใคใถใ็ปๅใใญใปใใตใ็นๅพดๆฝๅบๅจใใพใใฏใใญใปใใตใไฝฟ็จใใฆใใใใซใใใใใใๅไฝใใพใใ
+
+
+
+ๅงใใๅใซใ๐ค Datasetsใใคใณในใใผใซใใฆใใใใคใใฎใใผใฟใปใใใ่ฉฆใใใจใใงใใใใใซใใฆใใ ใใ๏ผ
+
+```bash
+pip install datasets
+```
+
+## Natural Language Processing
+
+
+
+ใใญในใใใผใฟใฎๅๅฆ็ใซไฝฟ็จใใไธป่ฆใชใใผใซใฏใ[ใใผใฏใใคใถ](main_classes/tokenizer)ใงใใใใผใฏใใคใถใฏใไธ้ฃใฎใซใผใซใซๅพใฃใฆใใญในใใ*ใใผใฏใณ*ใซๅๅฒใใพใใใใผใฏใณใฏๆฐๅคใซๅคๆใใใใใฎๅพใใณใฝใซใซๅคๆใใใใขใใซใฎๅ
ฅๅใจใชใใพใใใขใใซใๅฟ
่ฆใจใใ่ฟฝๅ ใฎๅ
ฅๅใฏใใใผใฏใใคใถใซใใฃใฆ่ฟฝๅ ใใใพใใ
+
+
+
+ไบๅๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใไบๅฎใฎๅ ดๅใ้ข้ฃใใไบๅๅญฆ็ฟๆธใฟใใผใฏใใคใถใไฝฟ็จใใใใจใ้่ฆใงใใใใใซใใใใใญในใใไบๅๅญฆ็ฟใณใผใในใจๅใๆนๆณใงๅๅฒใใใไบๅๅญฆ็ฟไธญใซ้ๅธธ*ใใญใฃใ*ใจใใฆๅ็
งใใใๅฏพๅฟใใใใผใฏใณใคใณใใใฏในใไฝฟ็จใใพใใ
+
+
+
+[`AutoTokenizer.from_pretrained`]ใกใฝใใใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใใผใฏใใคใถใใญใผใใใฆใ้ๅงใใพใใใใใใใซใใใใขใใซใไบๅๅญฆ็ฟใใใ*ใใญใฃใ*ใใใฆใณใญใผใใใใพใ๏ผ
+
+```python
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+```
+
+ๆฌกใซใใใญในใใใใผใฏใใคใถใซๆธกใใพใ๏ผ
+
+```py
+>>> encoded_input = tokenizer("Do not meddle in the affairs of wizards, for they are subtle and quick to anger.")
+>>> print(encoded_input)
+{'input_ids': [101, 2079, 2025, 19960, 10362, 1999, 1996, 3821, 1997, 16657, 1010, 2005, 2027, 2024, 11259, 1998, 4248, 2000, 4963, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+ใใผใฏใใคใถใฏใ้่ฆใช3ใคใฎ้
็ฎใๆใค่พๆธใ่ฟใใพใ๏ผ
+
+* [input_ids](glossary#input-ids) ใฏๆไธญใฎๅใใผใฏใณใซๅฏพๅฟใใใคใณใใใฏในใงใใ
+* [attention_mask](glossary#attention-mask) ใฏใใผใฏใณใใขใใณใทใงใณใๅใใๅฟ
่ฆใใใใใฉใใใ็คบใใพใใ
+* [token_type_ids](glossary#token-type-ids) ใฏ่คๆฐใฎใทใผใฑใณในใใใๅ ดๅใใใผใฏใณใใฉใฎใทใผใฑใณในใซๅฑใใฆใใใใ่ญๅฅใใพใใ
+
+`input_ids` ใใใณใผใใใฆๅ
ฅๅใ่ฟใใพใ๏ผ
+
+```python
+>>> tokenizer.decode(encoded_input["input_ids"])
+'[CLS] ้ญๆณไฝฟใใฎไบใซๅนฒๆธใใใชใๅฝผใใฏๅพฎๅฆใงๆใใฃใฝใใ [SEP]'
+```
+
+ๅฆไฝใซใๅใใใใใ ใใใใจๆใใพใใใใใผใฏใใคใถใฏใใฎๆ็ซ ใซ2ใคใฎ็นๅฅใชใใผใฏใณใ`CLS`๏ผใฏใฉใทใใกใคใข๏ผใจ`SEP`๏ผใปใใฌใผใฟ๏ผใ่ฟฝๅ ใใพใใใ
+ใในใฆใฎใขใใซใ็นๅฅใชใใผใฏใณใๅฟ
่ฆใจใใใใใงใฏใใใพใใใใๅฟ
่ฆใชๅ ดๅใใใผใฏใใคใถใฏ่ชๅ็ใซใใใใ่ฟฝๅ ใใพใใ
+
+่คๆฐใฎๆ็ซ ใๅๅฆ็ใใๅ ดๅใใใผใฏใใคใถใซใชในใใจใใฆๆธกใใฆใใ ใใ๏ผ
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_inputs = tokenizer(batch_sentences)
+>>> print(encoded_inputs)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1]]}
+```
+
+### Pad
+
+ๆ็ซ ใฏๅธธใซๅใ้ทใใงใฏใชใใใจใใใใใใใฏใใณใฝใซ๏ผใขใใซใฎๅ
ฅๅ๏ผใๅไธใชๅฝข็ถใๆใคๅฟ
่ฆใใใใใๅ้กใจใชใใพใใ
+ใใใฃใณใฐใฏใ็ญใๆใซ็นๅฅใชใใใใฃใณใฐใใผใฏใณใใ่ฟฝๅ ใใฆใใใณใฝใซใ้ทใใทใผใฑใณในใซๅใใใใใใฎๆฆ็ฅใงใใ
+
+ใใใๅ
ใฎ็ญใใทใผใฑใณในใๆ้ทใฎใทใผใฑใณในใซๅใใใใใใซใ`padding`ใใฉใกใผใฟใ`True`ใซ่จญๅฎใใพใ๏ผ
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+1็ช็ฎใจ3็ช็ฎใฎๆใฏใ็ญใใใใซ`0`ใงใใใฃใณใฐใใใฆใใพใใ
+
+### Truncation
+
+้ใฎในใใฏใใซใงใฏใๆๆใใขใใซใๅฆ็ใใใฎใซ้ทใใใใทใผใฑใณในใใใใใใใใพใใใใใฎๅ ดๅใใทใผใฑใณในใ็ญ็ธฎใใๅฟ
่ฆใใใใพใใ
+
+ใขใใซใๅใๅ
ฅใใๆๅคงใฎ้ทใใซใทใผใฑใณในใๅใ่ฉฐใใใซใฏใ`truncation`ใใฉใกใผใฟใ`True`ใซ่จญๅฎใใพใ๏ผ
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True)
+>>> print(encoded_input)
+{'input_ids': [[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'token_type_ids': [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
+ 'attention_mask': [[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]]}
+```
+
+
+
+็ฐใชใใใใฃใณใฐใจๅใ่ฉฐใใฎๅผๆฐใซใคใใฆ่ฉณใใใฏใ[ใใใฃใณใฐใจๅใ่ฉฐใ](./pad_truncation)ใฎใณใณใปใใใฌใคใใใ่ฆงใใ ใใใ
+
+
+
+### Build tensors
+
+ๆๅพใซใใใผใฏใใคใถใใขใใซใซไพ็ตฆใใใๅฎ้ใฎใใณใฝใซใ่ฟใใใใซ่จญๅฎใใพใใ
+
+`return_tensors`ใใฉใกใผใฟใ`pt`๏ผPyTorch็จ๏ผใพใใฏ`tf`๏ผTensorFlow็จ๏ผใซ่จญๅฎใใพใ๏ผ
+
+
+
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True, return_tensors="pt")
+>>> print(encoded_input)
+{'input_ids': tensor([[101, 1252, 1184, 1164, 1248, 6462, 136, 102, 0, 0, 0, 0, 0, 0, 0],
+ [101, 1790, 112, 189, 1341, 1119, 3520, 1164, 1248, 6462, 117, 21902, 1643, 119, 102],
+ [101, 1327, 1164, 5450, 23434, 136, 102, 0, 0, 0, 0, 0, 0, 0, 0]]),
+ 'token_type_ids': tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]),
+ 'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
+ [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0]])}
+```
+
+
+```py
+>>> batch_sentences = [
+... "But what about second breakfast?",
+... "Don't think he knows about second breakfast, Pip.",
+... "What about elevensies?",
+... ]
+>>> encoded_input = tokenizer(batch_sentences, padding=True, truncation=True, return_tensors="tf")
+>>> print(encoded_input)
+{'input_ids': ,
+ 'token_type_ids': ,
+ 'attention_mask': }
+```
+
+
+
+## Audio
+
+ใชใผใใฃใชใฟในใฏใฎๅ ดๅใใใผใฟใปใใใใขใใซ็จใซๆบๅใใใใใซ[็นๅพดๆฝๅบๅจ](main_classes/feature_extractor)ใๅฟ
่ฆใงใใ
+็นๅพดๆฝๅบๅจใฏ็ใฎใชใผใใฃใชใใผใฟใใ็นๅพดใๆฝๅบใใใใใใใใณใฝใซใซๅคๆใใใใใซ่จญ่จใใใฆใใพใใ
+
+[PolyAI/minds14](https://huggingface.co/datasets/PolyAI/minds14)ใใผใฟใปใใใใญใผใใใฆ๏ผใใผใฟใปใใใฎใญใผใๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏ๐ค [Datasetsใใฅใผใใชใขใซ](https://huggingface.co/docs/datasets/load_hub)ใๅ็
ง๏ผใ
+ใชใผใใฃใชใใผใฟใปใใใง็นๅพดๆฝๅบๅจใใฉใฎใใใซไฝฟ็จใงใใใใ็ขบ่ชใใฆใฟใพใใใ๏ผ
+
+```python
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
+```
+
+ใขใฏใปในใใฆ`audio`ๅใฎๆๅใฎ่ฆ็ด ใ็ขบ่ชใใพใใ`audio`ๅใๅผใณๅบใใจใ่ชๅ็ใซใชใผใใฃใชใใกใคใซใ่ชญใฟ่พผใพใใใชใตใณใใชใณใฐใใใพใ๏ผ
+
+```py
+>>> dataset[0]["audio"]
+{'array': array([ 0. , 0.00024414, -0.00024414, ..., -0.00024414,
+ 0. , 0. ], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~JOINT_ACCOUNT/602ba55abb1e6d0fbce92065.wav',
+ 'sampling_rate': 8000}
+```
+
+ใใใซใใใ3ใคใฎใขใคใใ ใ่ฟใใใพใ๏ผ
+
+* `array` ใฏ่ชญใฟ่พผใพใใ้ณๅฃฐไฟกๅทใงใ1Dใฎ้
ๅใจใใฆ่ชญใฟ่พผใพใใพใใๅฟ
่ฆใซๅฟใใฆใชใตใณใใชใณใฐใใใใใจใใใใพใใ
+* `path` ใฏ้ณๅฃฐใใกใคใซใฎๅ ดๆใๆใใพใใ
+* `sampling_rate` ใฏ้ณๅฃฐไฟกๅทๅ
ใฎใใผใฟใใคใณใใ1็ง้ใซใใใคๆธฌๅฎใใใใใ็คบใใพใใ
+
+ใใฎใใฅใผใใชใขใซใงใฏใ[Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base)ใขใใซใไฝฟ็จใใพใใ
+ใขใใซใซใผใใ็ขบ่ชใใใจใWav2Vec2ใ16kHzใฎใตใณใใชใณใฐใใใ้ณๅฃฐใชใผใใฃใชใงไบๅๅญฆ็ฟใใใฆใใใใจใใใใใพใใ
+ใขใใซใฎไบๅๅญฆ็ฟใซไฝฟ็จใใใใใผใฟใปใใใฎใตใณใใชใณใฐใฌใผใใจใใใชใใฎใชใผใใฃใชใใผใฟใฎใตใณใใชใณใฐใฌใผใใไธ่ดใใใใจใ้่ฆใงใใ
+ใใผใฟใฎใตใณใใชใณใฐใฌใผใใ็ฐใชใๅ ดๅใใใผใฟใใชใตใณใใชใณใฐใใๅฟ
่ฆใใใใพใใ
+
+1. ๐ค Datasetsใฎ [`~datasets.Dataset.cast_column`] ใกใฝใใใไฝฟ็จใใฆใใตใณใใชใณใฐใฌใผใใ16kHzใซใขใใใตใณใใชใณใฐใใพใ๏ผ
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+2. ๅใณ `audio` ๅใๅผใณๅบใใฆใชใผใใฃใชใใกใคใซใใชใตใณใใซใใพใ๏ผ
+
+```py
+>>> dataset[0]["audio"]
+{'array': array([ 2.3443763e-05, 2.1729663e-04, 2.2145823e-04, ...,
+ 3.8356509e-05, -7.3497440e-06, -2.1754686e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~JOINT_ACCOUNT/602ba55abb1e6d0fbce92065.wav',
+ 'sampling_rate': 16000}
+```
+
+ๆฌกใซใๅ
ฅๅใๆญฃ่ฆๅใใใใฃใณใฐใใใใใซ็นๅพดๆฝๅบๅจใใญใผใใใพใใใใญในใใใผใฟใใใใฃใณใฐใใๅ ดๅใ็ญใใทใผใฑใณในใซใฏ `0` ใ่ฟฝๅ ใใใพใใๅใ่ใๆนใใชใผใใฃใชใใผใฟใซใ้ฉ็จใใใพใใ็นๅพดๆฝๅบๅจใฏ `array` ใซ `0` ใ่ฟฝๅ ใใพใ๏ผใใใฏ็ก้ณใจใใฆ่งฃ้ใใใพใ๏ผใ
+
+[`AutoFeatureExtractor.from_pretrained`]ใไฝฟ็จใใฆ็นๅพดๆฝๅบๅจใใญใผใใใพใ๏ผ
+
+```python
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
+```
+
+ใชใผใใฃใช `array` ใ็นๅพดๆฝๅบๅจใซๆธกใใพใใ็นๅพดๆฝๅบๅจใง็บ็ใใๅฏ่ฝๆงใฎใใ็ก้ณใจใฉใผใใใ่ฏใใใใใฐใใใใใซใ็นๅพดๆฝๅบๅจใซ `sampling_rate` ๅผๆฐใ่ฟฝๅ ใใใใจใใๅงใใใพใใ
+
+```python
+>>> audio_input = [dataset[0]["audio"]["array"]]
+>>> feature_extractor(audio_input, sampling_rate=16000)
+{'input_values': [array([ 3.8106556e-04, 2.7506407e-03, 2.8015103e-03, ...,
+ 5.6335266e-04, 4.6588284e-06, -1.7142107e-04], dtype=float32)]}
+```
+
+ๅๆงใซใใใผใฏใใคใถใจๅๆงใซใใใใๅ
ใฎๅฏๅคใทใผใฑใณในใๅฆ็ใใใใใซใใใฃใณใฐใพใใฏๅใ่ฉฐใใ้ฉ็จใงใใพใใๆฌกใซใใใใใฎ2ใคใฎใชใผใใฃใชใตใณใใซใฎใทใผใฑใณใน้ทใ็ขบ่ชใใฆใฟใพใใใ๏ผ
+
+```python
+>>> dataset[0]["audio"]["array"].shape
+(173398,)
+
+>>> dataset[1]["audio"]["array"].shape
+(106496,)
+```
+
+ใใฎ้ขๆฐใฏใใใผใฟใปใใใๅๅฆ็ใใฆใชใผใใฃใชใตใณใใซใฎ้ทใใๅใใซใใใใใฎใใฎใงใใๆๅคงใตใณใใซ้ทใๆๅฎใใ็นๅพดๆฝๅบๅจใฏใทใผใฑใณในใใใใซๅใใใฆใใใฃใณใฐใพใใฏๅใ่ฉฐใใพใใ
+
+```py
+>>> def preprocess_function(examples):
+... audio_arrays = [x["array"] for x in examples["audio"]]
+... inputs = feature_extractor(
+... audio_arrays,
+... sampling_rate=16000,
+... padding=True,
+... max_length=100000,
+... truncation=True,
+... )
+... return inputs
+```
+
+`preprocess_function`ใใใผใฟใปใใใฎๆๅใฎๆฐไพใซ้ฉ็จใใพใ๏ผ
+
+```python
+>>> processed_dataset = preprocess_function(dataset[:5])
+```
+
+ใตใณใใซใฎ้ทใใฏ็พๅจๅใใงใๆๅฎใใใๆๅคง้ทใจไธ่ดใใฆใใพใใใใใงๅฆ็ใใใใใผใฟใปใใใใขใใซใซๆธกใใใจใใงใใพใ๏ผ
+
+```py
+>>> processed_dataset["input_values"][0].shape
+(100000,)
+
+>>> processed_dataset["input_values"][1].shape
+(100000,)
+```
+
+## Computer Vision
+
+ใณใณใใฅใผใฟใใธใงใณใฟในใฏใงใฏใใขใใซ็จใซใใผใฟใปใใใๆบๅใใใใใฎ[็ปๅใใญใปใใต](main_classes/image_processor)ใๅฟ
่ฆใงใใ
+็ปๅใฎๅๅฆ็ใซใฏใ็ปๅใใขใใซใๆๅพ
ใใๅ
ฅๅๅฝขๅผใซๅคๆใใใใใฎใใใคใใฎในใใใใๅซใพใใฆใใพใใใใใใฎในใใใใซใฏใใชใตใคใบใๆญฃ่ฆๅใใซใฉใผใใฃใใซใฎ่ฃๆญฃใใใใณ็ปๅใใใณใฝใซใซๅคๆใใใชใฉใๅซใพใใพใใ
+
+
+
+็ปๅใฎๅๅฆ็ใฏใ้ๅธธใ็ปๅใฎๅขๅผทใฎๅฝขๅผใซๅพใใพใใ็ปๅใฎๅๅฆ็ใจ็ปๅใฎๅขๅผทใฎไธกๆนใฏ็ปๅใใผใฟใๅคๆใใพใใใ็ฐใชใ็ฎ็ใใใใพใ๏ผ
+
+* ็ปๅใฎๅขๅผทใฏใ้ๅญฆ็ฟใ้ฒใใใขใใซใฎๅ
็ขๆงใๅไธใใใใฎใซๅฝน็ซใคๆนๆณใง็ปๅใๅคๆดใใพใใใใผใฟใๅขๅผทใใๆนๆณใฏ็ก้ใงใๆใใใ่ฒใฎ่ชฟๆดใใฏใญใใใๅ่ปขใใชใตใคใบใใบใผใ ใชใฉใๆงใ
ใชๆนๆณใใใใพใใใใ ใใๅขๅผทๆไฝใซใใฃใฆ็ปๅใฎๆๅณใๅคใใใชใใใใซๆณจๆใใๅฟ
่ฆใใใใพใใ
+* ็ปๅใฎๅๅฆ็ใฏใ็ปๅใใขใใซใฎๆๅพ
ใใๅ
ฅๅๅฝขๅผใจไธ่ดใใใใจใไฟ่จผใใพใใใณใณใใฅใผใฟใใธใงใณใขใใซใใใกใคใณใใฅใผใใณใฐใใๅ ดๅใ็ปๅใฏใขใใซใๆๅใซใใฌใผใใณใฐใใใใจใใจใพใฃใใๅใๆนๆณใงๅๅฆ็ใใๅฟ
่ฆใใใใพใใ
+
+็ปๅใฎๅขๅผทใซใฏไปปๆใฎใฉใคใใฉใชใไฝฟ็จใงใใพใใ็ปๅใฎๅๅฆ็ใซใฏใใขใใซใซ้ข้ฃไปใใใใ`ImageProcessor`ใไฝฟ็จใใพใใ
+
+
+
+ใณใณใใฅใผใฟใใธใงใณใฎใใผใฟใปใใใง็ปๅใใญใปใใตใไฝฟ็จใใๆนๆณใ็คบใใใใซใ[food101](https://huggingface.co/datasets/food101)ใใผใฟใปใใใใญใผใใใพใ๏ผใใผใฟใปใใใฎใญใผใๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏ๐ค[Datasetsใใฅใผใใชใขใซ](https://huggingface.co/docs/datasets/load_hub)ใๅ็
ง๏ผ๏ผ
+
+
+
+ใใผใฟใปใใใใใชใๅคงใใใใใ๐ค Datasetsใฎ`split`ใใฉใกใผใฟใไฝฟ็จใใฆใใฌใผใใณใฐใใผใฟใฎๅฐใใชใตใณใใซใฎใฟใใญใผใใใพใ๏ผ
+
+
+
+```python
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("food101", split="train[:100]")
+```
+
+ๆฌกใซใ๐ค Datasetsใฎ [`Image`](https://huggingface.co/docs/datasets/package_reference/main_classes?highlight=image#datasets.Image) ๆฉ่ฝใง็ปๅใ่ฆใฆใฟใพใใใ๏ผ
+
+```python
+>>> dataset[0]["image"]
+```
+
+
+
+
+
+AutoImageProcessorใ[`AutoImageProcessor.from_pretrained`]ใไฝฟ็จใใฆใญใผใใใพใ๏ผ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+```
+
+1. ใพใใ็ปๅใฎๆกๅผตใ่ฟฝๅ ใใพใใใใๅฅฝใใชใฉใคใใฉใชใไฝฟ็จใงใใพใใใใใฎใใฅใผใใชใขใซใงใฏtorchvisionใฎ[`transforms`](https://pytorch.org/vision/stable/transforms.html)ใขใธใฅใผใซใไฝฟ็จใใพใใๅฅใฎใใผใฟๆกๅผตใฉใคใใฉใชใไฝฟ็จใใใๅ ดๅใฏใ[Albumentations](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification_albumentations.ipynb)ใพใใฏ[Kornia notebooks](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification_kornia.ipynb)ใง่ฉณ็ดฐใๅญฆใถใใจใใงใใพใใ
+
+ ใใใงใฏใ[`Compose`](https://pytorch.org/vision/master/generated/torchvision.transforms.Compose.html)ใไฝฟ็จใใฆใใใคใใฎๅคๆใ้ฃ้ใใใพใ - [`RandomResizedCrop`](https://pytorch.org/vision/main/generated/torchvision.transforms.RandomResizedCrop.html)ใจ[`ColorJitter`](https://pytorch.org/vision/main/generated/torchvision.transforms.ColorJitter.html)ใ
+ ใตใคใบใฎๅคๆดใซ้ขใใฆใฏใ`image_processor`ใใ็ปๅใตใคใบใฎ่ฆไปถใๅๅพใงใใพใใ
+ ไธ้จใฎใขใใซใงใฏใๆญฃ็ขบใช้ซใใจๅน
ใๅฟ
่ฆใงใใใไปใฎใขใใซใงใฏ`shortest_edge`ใฎใฟใๅฎ็พฉใใใฆใใพใใ
+
+```py
+>>> from torchvision.transforms import RandomResizedCrop, ColorJitter, Compose
+
+>>> size = (
+... image_processor.size["shortest_edge"]
+... if "shortest_edge" in image_processor.size
+... else (image_processor.size["height"], image_processor.size["width"])
+... )
+
+>>> _transforms = Compose([RandomResizedCrop(size), ColorJitter(brightness=0.5, hue=0.5)])
+```
+
+2. ใขใใซใฏ[`pixel_values`](model_doc/visionencoderdecoder#transformers.VisionEncoderDecoderModel.forward.pixel_values)ใๅ
ฅๅใจใใฆๅใๅใใพใใ
+`ImageProcessor`ใฏ็ปๅใฎๆญฃ่ฆๅใจ้ฉๅใชใใณใฝใซใฎ็ๆใๅฆ็ใงใใพใใ
+ไธ้ฃใฎ็ปๅใซๅฏพใใ็ปๅๆกๅผตใจ็ปๅๅๅฆ็ใ็ตใฟๅใใใ`pixel_values`ใ็ๆใใ้ขๆฐใไฝๆใใพใ๏ผ
+
+```python
+>>> def transforms(examples):
+... images = [_transforms(img.convert("RGB")) for img in examples["image"]]
+... examples["pixel_values"] = image_processor(images, do_resize=False, return_tensors="pt")["pixel_values"]
+... return examples
+```
+
+
+
+ไธ่จใฎไพใงใฏใ็ปๅใฎใตใคใบๅคๆดใๆขใซ็ปๅๅขๅผทๅคๆใง่กใฃใฆใใใใใ`do_resize=False`ใ่จญๅฎใใพใใใ
+้ฉๅใช `image_processor` ใใใฎ `size` ๅฑๆงใๆดป็จใใฆใใพใใ็ปๅๅขๅผทไธญใซ็ปๅใฎใตใคใบๅคๆดใ่กใใชใๅ ดๅใฏใใใฎใใฉใกใผใฟใ็็ฅใใฆใใ ใใใ
+ใใใฉใซใใงใฏใ`ImageProcessor` ใใตใคใบๅคๆดใๅฆ็ใใพใใ
+
+็ปๅใๅขๅผทๅคๆใฎไธ้จใจใใฆๆญฃ่ฆๅใใใๅ ดๅใฏใ`image_processor.image_mean` ใจ `image_processor.image_std` ใฎๅคใไฝฟ็จใใฆใใ ใใใ
+
+
+3. ๆฌกใซใ๐ค Datasetsใฎ[`set_transform`](https://huggingface.co/docs/datasets/process#format-transform)ใไฝฟ็จใใฆใๅคๆใใชใขใซใฟใคใ ใง้ฉ็จใใพใ๏ผ
+
+```python
+>>> dataset.set_transform(transforms)
+```
+
+4. ็ปๅใซใขใฏใปในใใใจใ็ปๅใใญใปใใตใ `pixel_values` ใ่ฟฝๅ ใใใใจใใใใใพใใใใใงๅฆ็ๆธใฟใฎใใผใฟใปใใใใขใใซใซๆธกใใใจใใงใใพใ๏ผ
+
+```python
+>>> dataset[0].keys()
+```
+
+ไปฅไธใฏใๅคๆใ้ฉ็จใใใๅพใฎ็ปๅใฎๅค่ฆณใงใใ ็ปๅใฏใฉใณใใ ใซๅใๆใใใใใฎ่ฒใฎ็นๆงใ็ฐใชใใพใใ
+
+```py
+>>> import numpy as np
+>>> import matplotlib.pyplot as plt
+
+>>> img = dataset[0]["pixel_values"]
+>>> plt.imshow(img.permute(1, 2, 0))
+```
+
+
+
+
+
+
+
+ใชใใธใงใฏใๆคๅบใๆๅณใปใฐใกใณใใผใทใงใณใใคใณในใฟใณในใปใฐใกใณใใผใทใงใณใใใใณใใใใใฃใใฏใปใฐใกใณใใผใทใงใณใชใฉใฎใฟในใฏใฎๅ ดๅใ`ImageProcessor`ใฏ
+ใในใๅฆ็ใกใฝใใใๆไพใใพใใใใใใฎใกใฝใใใฏใใขใใซใฎ็ใฎๅบๅใๅข็ใใใฏในใใปใฐใกใณใใผใทใงใณใใใใชใฉใฎๆๅณใฎใใไบๆธฌใซๅคๆใใพใใ
+
+
+
+### Pad
+
+ไธ้จใฎๅ ดๅใใใจใใฐใ[DETR](./model_doc/detr)ใใใกใคใณใใฅใผใใณใฐใใๅ ดๅใใขใใซใฏใใฌใผใใณใฐๆใซในใฑใผใซใฎๅคๆดใ้ฉ็จใใพใใ
+ใใใซใใใใใใๅ
ใฎ็ปๅใฎใตใคใบใ็ฐใชใๅ ดๅใใใใพใใ[`DetrImageProcessor`]ใใ[`DetrImageProcessor.pad`]ใไฝฟ็จใใ
+ใซในใฟใ ใฎ`collate_fn`ใๅฎ็พฉใใฆ็ปๅใไธ็ทใซใใใๅฆ็ใงใใพใใ
+
+```py
+>>> def collate_fn(batch):
+... pixel_values = [item["pixel_values"] for item in batch]
+... encoding = image_processor.pad(pixel_values, return_tensors="pt")
+... labels = [item["labels"] for item in batch]
+... batch = {}
+... batch["pixel_values"] = encoding["pixel_values"]
+... batch["pixel_mask"] = encoding["pixel_mask"]
+... batch["labels"] = labels
+... return batch
+```
+
+## Multi Modal
+
+ใใซใใขใผใใซๅ
ฅๅใไฝฟ็จใใใฟในใฏใฎๅ ดๅใใขใใซ็จใซใใผใฟใปใใใๆบๅใใใใใฎ[ใใญใปใใต](main_classes/processors)ใๅฟ
่ฆใงใใใใญใปใใตใฏใใใผใฏใใคใถใ็นๅพด้ๆฝๅบๅจใชใฉใฎ2ใคใฎๅฆ็ใชใใธใงใฏใใ็ตๅใใพใใ
+
+่ชๅ้ณๅฃฐ่ช่ญ๏ผASR๏ผใฎใใใฎใใญใปใใตใฎไฝฟ็จๆนๆณใ็คบใใใใซใ[LJ Speech](https://huggingface.co/datasets/lj_speech)ใใผใฟใปใใใใญใผใใใพใ๏ผใใผใฟใปใใใฎใญใผใๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏ๐ค [Datasets ใใฅใผใใชใขใซ](https://huggingface.co/docs/datasets/load_hub)ใๅ็
ง๏ผ๏ผ
+
+```python
+>>> from datasets import load_dataset
+
+>>> lj_speech = load_dataset("lj_speech", split="train")
+```
+
+ASR๏ผ่ชๅ้ณๅฃฐ่ช่ญ๏ผใฎๅ ดๅใไธปใซ `audio` ใจ `text` ใซ็ฆ็นใๅฝใฆใฆใใใใใไปใฎๅใๅ้คใงใใพใ๏ผ
+
+```python
+>>> lj_speech = lj_speech.map(remove_columns=["file", "id", "normalized_text"])
+```
+
+ๆฌกใซใ`audio`ใจ`text`ใฎๅใ่ฆใฆใฟใพใใใ๏ผ
+
+```python
+>>> lj_speech[0]["audio"]
+{'array': array([-7.3242188e-04, -7.6293945e-04, -6.4086914e-04, ...,
+ 7.3242188e-04, 2.1362305e-04, 6.1035156e-05], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/917ece08c95cf0c4115e45294e3cd0dee724a1165b7fc11798369308a465bd26/LJSpeech-1.1/wavs/LJ001-0001.wav',
+ 'sampling_rate': 22050}
+
+>>> lj_speech[0]["text"]
+'Printing, in the only sense with which we are at present concerned, differs from most if not from all the arts and crafts represented in the Exhibition'
+```
+
+ๅธธใซใใชใผใใฃใชใใผใฟใปใใใฎใตใณใใชใณใฐใฌใผใใใใขใใซใฎไบๅๅญฆ็ฟใซไฝฟ็จใใใใใผใฟใปใใใฎใตใณใใชใณใฐใฌใผใใจไธ่ดใใใใใใซ[ใชใตใณใใซ](preprocessing#audio)ใใๅฟ
่ฆใใใใพใ๏ผ
+
+```py
+>>> lj_speech = lj_speech.cast_column("audio", Audio(sampling_rate=16_000))
+```
+
+ใใญใปใใตใ [`AutoProcessor.from_pretrained`] ใไฝฟ็จใใฆใญใผใใใพใ๏ผ
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base-960h")
+```
+
+1. `array`ๅ
ใซๅซใพใใใชใผใใฃใชใใผใฟใ`input_values`ใซๅฆ็ใใ`text`ใ`labels`ใซใใผใฏใณๅใใ้ขๆฐใไฝๆใใพใ๏ผ
+
+```py
+>>> def prepare_dataset(example):
+... audio = example["audio"]
+
+... example.update(processor(audio=audio["array"], text=example["text"], sampling_rate=16000))
+
+... return example
+```
+
+2. ใตใณใใซใซ`prepare_dataset`้ขๆฐใ้ฉ็จใใพใ๏ผ
+
+```py
+>>> prepare_dataset(lj_speech[0])
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/quicktour.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/quicktour.md
new file mode 100644
index 0000000000000000000000000000000000000000..0eb00cf220b54ab6c9f407564d5f1053461cdf51
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/quicktour.md
@@ -0,0 +1,588 @@
+
+
+# Quick tour
+
+[[open-in-colab]]
+
+๐ค Transformersใไฝฟใๅงใใพใใใ๏ผ ้็บ่
ใงใใใใจใๆฅๅธธ็ใชใฆใผใถใผใงใใใใจใใใฎใฏใคใใฏใใขใผใฏ
+ๅใใฆๅงใใใฎใๆฏๆดใใ[`pipeline`]ใไฝฟใฃใๆจ่ซๆนๆณใ[AutoClass](./model_doc/auto)ใงไบๅๅญฆ็ฟๆธใฟใขใใซใจใใชใใญใปใใตใใญใผใใใๆนๆณใ
+ใใใฆPyTorchใพใใฏTensorFlowใง็ด ๆฉใใขใใซใใใฌใผใใณใฐใใๆนๆณใ็คบใใพใใ ๅๅฟ่
ใฎๅ ดๅใใใใง็ดนไปใใใใณใณใปใใใฎ่ฉณ็ดฐใช่ชฌๆใๆไพใใ
+ใใฅใผใใชใขใซใพใใฏ[ใณใผใน](https://huggingface.co/course/chapter1/1)ใๆฌกใซๅ็
งใใใใจใใๅงใใใพใใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใ๏ผ
+
+```bash
+!pip install transformers datasets evaluate accelerate
+```
+
+ใใชใใฏใพใใๅฅฝใใชๆฉๆขฐๅญฆ็ฟใใฌใผใ ใฏใผใฏใใคใณในใใผใซใใๅฟ
่ฆใใใใพใ:
+
+
+
+
+```bash
+pip install torch
+```
+
+
+
+```bash
+pip install tensorflow
+```
+
+
+
+## Pipeline
+
+
+
+[`pipeline`] ใฏใไบๅๅญฆ็ฟๆธใฟใขใใซใๆจ่ซใซๆใ็ฐกๅใง้ซ้ใชๆนๆณใงใใ
+[`pipeline`] ใไฝฟ็จใใใใจใงใใใพใใพใชใขใใชใใฃใซใใใๅคใใฎใฟในใฏใซๅฏพใใฆๅณๅบงใซไฝฟ็จใงใใพใใ
+ใใใคใใฎใฟในใฏใฏไปฅไธใฎ่กจใซ็คบใใใฆใใพใ๏ผ
+
+
+
+ไฝฟ็จๅฏ่ฝใชใฟในใฏใฎๅฎๅ
จใชไธ่ฆงใซใคใใฆใฏใ[pipeline API ใชใใกใฌใณใน](./main_classes/pipelines)ใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+| **ใฟในใฏ** | **่ชฌๆ** | **ใขใใชใใฃ** | **ใใคใใฉใคใณ่ญๅฅๅญ** |
+|------------------------------|--------------------------------------------------------------------------------------------------------------|-----------------|-----------------------------------------------|
+| ใใญในใๅ้ก | ใใญในใใฎใทใผใฑใณในใซใฉใใซใๅฒใๅฝใฆใ | NLP | pipeline(task="sentiment-analysis") |
+| ใใญในใ็ๆ | ใใญใณใใใๆๅฎใใฆใใญในใใ็ๆใใ | NLP | pipeline(task="text-generation") |
+| ่ฆ็ด | ใใญในใใพใใฏใใญใฅใกใณใใฎ่ฆ็ดใ็ๆใใ | NLP | pipeline(task="summarization") |
+| ็ปๅๅ้ก | ็ปๅใซใฉใใซใๅฒใๅฝใฆใ | ใณใณใใฅใผใฟใใธใงใณ | pipeline(task="image-classification") |
+| ็ปๅใปใฐใกใณใใผใทใงใณ | ็ปๅใฎๅๅๅฅใฎใใฏใปใซใซใฉใใซใๅฒใๅฝใฆใ๏ผใปใใณใใฃใใฏใใใใใใฃใใฏใใใใณใคใณในใฟใณในใปใฐใกใณใใผใทใงใณใใตใใผใ๏ผ | ใณใณใใฅใผใฟใใธใงใณ | pipeline(task="image-segmentation") |
+| ใชใใธใงใฏใๆคๅบ | ็ปๅๅ
ใฎใชใใธใงใฏใใฎๅข็ใใใฏในใจใฏใฉในใไบๆธฌใใ | ใณใณใใฅใผใฟใใธใงใณ | pipeline(task="object-detection") |
+| ใชใผใใฃใชๅ้ก | ใชใผใใฃใชใใผใฟใซใฉใใซใๅฒใๅฝใฆใ | ใชใผใใฃใช | pipeline(task="audio-classification") |
+| ่ชๅ้ณๅฃฐ่ช่ญ | ้ณๅฃฐใใใญในใใซๅคๆใใ | ใชใผใใฃใช | pipeline(task="automatic-speech-recognition") |
+| ใใธใฅใขใซใฏใจในใใงใณๅฟ็ญ | ็ปๅใจ่ณชๅใไธใใใใๅ ดๅใซใ็ปๅใซ้ขใใ่ณชๅใซๅ็ญใใ | ใใซใใขใผใใซ | pipeline(task="vqa") |
+| ใใญใฅใกใณใใฏใจในใใงใณๅฟ็ญ | ใใญใฅใกใณใใจ่ณชๅใไธใใใใๅ ดๅใซใใใญใฅใกใณใใซ้ขใใ่ณชๅใซๅ็ญใใ | ใใซใใขใผใใซ | pipeline(task="document-question-answering") |
+| ็ปๅใญใฃใใทใงใใณใฐ | ไธใใใใ็ปๅใซใญใฃใใทใงใณใ็ๆใใ | ใใซใใขใผใใซ | pipeline(task="image-to-text") |
+
+ใพใใ[`pipeline`] ใฎใคใณในใฟใณในใไฝๆใใไฝฟ็จใใใใฟในใฏใๆๅฎใใพใใ
+ใใฎใฌใคใใงใฏใใปใณใใกใณใๅๆใฎใใใซ [`pipeline`] ใไฝฟ็จใใไพใ็คบใใพใ๏ผ
+
+```python
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("sentiment-analysis")
+```
+
+[`pipeline`]ใฏใๆๆ
ๅๆใฎใใใฎใใใฉใซใใฎ[ไบๅๅญฆ็ฟๆธใฟใขใใซ](https://huggingface.co/distilbert/distilbert-base-uncased-finetuned-sst-2-english)ใจใใผใฏใใคใถใใใฆใณใญใผใใใฆใญใฃใใทใฅใใไฝฟ็จใงใใใใใซใชใใพใใ
+ใใใงใ`classifier`ใๅฏพ่ฑกใฎใใญในใใซไฝฟ็จใงใใพใ๏ผ
+
+```python
+>>> classifier("็งใใกใฏ๐ค Transformersใฉใคใใฉใชใใ่ฆใใงใใฆใจใฆใๅฌใใใงใใ")
+[{'label': 'POSITIVE', 'score': 0.9998}]
+```
+
+่คๆฐใฎๅ
ฅๅใใใๅ ดๅใฏใ[`pipeline`]ใซๅ
ฅๅใใชในใใจใใฆๆธกใใฆใ่พๆธใฎใชในใใ่ฟใใพใ๏ผ
+
+```py
+>>> results = classifier(["๐ค Transformersใฉใคใใฉใชใใ็ดนไปใงใใฆ้ๅธธใซๅฌใใใงใใ", "ๅซใใซใชใใชใใงใปใใใงใใ"])
+>>> for result in results:
+... print(f"label: {result['label']}, ในใณใข: {round(result['score'], 4)}")
+label: POSITIVE, ในใณใข: 0.9998
+label: NEGATIVE, ในใณใข: 0.5309
+```
+
+[`pipeline`]ใฏใไปปๆใฎใฟในใฏใซๅฏพใใฆใใผใฟใปใใๅ
จไฝใ็นฐใ่ฟใๅฆ็ใใใใจใใงใใพใใใใฎไพใงใฏใ่ชๅ้ณๅฃฐ่ช่ญใใฟในใฏใจใใฆ้ธใณใพใใใ๏ผ
+
+```python
+>>> import torch
+>>> from transformers import pipeline
+
+>>> speech_recognizer = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-base-960h")
+```
+
+ใชใผใใฃใชใใผใฟใปใใใใญใผใใใพใ๏ผ่ฉณ็ดฐใซใคใใฆใฏ๐ค Datasets [ใฏใคใใฏในใฟใผใ](https://huggingface.co/docs/datasets/quickstart#audio)ใๅ็
งใใฆใใ ใใ๏ผใ
+ใใจใใฐใ[MInDS-14](https://huggingface.co/datasets/PolyAI/minds14)ใใผใฟใปใใใใญใผใใใพใ๏ผ
+
+```python
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train") # doctest: +IGNORE_RESULT
+```
+
+ใใผใฟใปใใใฎใตใณใใชใณใฐใฌใผใใ[`facebook/wav2vec2-base-960h`](https://huggingface.co/facebook/wav2vec2-base-960h)ใใใฌใผใใณใฐใใใใตใณใใชใณใฐใฌใผใใจไธ่ดใใใใจใ็ขบ่ชใใฆใใ ใใ๏ผ
+
+```py
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=speech_recognizer.feature_extractor.sampling_rate))
+```
+
+"audio"ๅใๅผใณๅบใใจใใชใผใใฃใชใใกใคใซใฏ่ชๅ็ใซใญใผใใใใใชใตใณใใชใณใฐใใใพใใๆๅใฎ4ใคใฎใตใณใใซใใ็ใฎๆณขๅฝข้
ๅใๆฝๅบใใใใใใใคใใฉใคใณใซใชในใใจใใฆๆธกใใพใใ
+
+```py
+>>> result = speech_recognizer(dataset[:4]["audio"])
+>>> print([d["text"] for d in result])
+['I WOULD LIKE TO SET UP A JOINT ACCOUNT WITH MY PARTNER HOW DO I PROCEED WITH DOING THAT', "FONDERING HOW I'D SET UP A JOIN TO HELL T WITH MY WIFE AND WHERE THE AP MIGHT BE", "I I'D LIKE TOY SET UP A JOINT ACCOUNT WITH MY PARTNER I'M NOT SEEING THE OPTION TO DO IT ON THE APSO I CALLED IN TO GET SOME HELP CAN I JUST DO IT OVER THE PHONE WITH YOU AND GIVE YOU THE INFORMATION OR SHOULD I DO IT IN THE AP AN I'M MISSING SOMETHING UQUETTE HAD PREFERRED TO JUST DO IT OVER THE PHONE OF POSSIBLE THINGS", 'HOW DO I FURN A JOINA COUT']
+```
+
+ๅคง่ฆๆจกใชใใผใฟใปใใใงใๅ
ฅๅใๅคงใใๅ ดๅ๏ผ้ณๅฃฐใ็ปๅใชใฉ๏ผใใในใฆใฎๅ
ฅๅใใกใขใชใซ่ชญใฟ่พผใไปฃใใใซใใชในใใงใฏใชใใธใงใใฌใผใฟใๆธกใใใจใใๅงใใงใใ่ฉณ็ดฐใซใคใใฆใฏ[ใใคใใฉใคใณAPIใชใใกใฌใณใน](./main_classes/pipelines)ใๅ็
งใใฆใใ ใใใ
+
+### Use another model and tokenizer in the pipeline
+
+[`pipeline`]ใฏ[Hub](https://huggingface.co/models)ใใใฎไปปๆใฎใขใใซใๅๅฎนใงใใไปใฎใฆใผในใฑใผในใซ[`pipeline`]ใ้ฉๅฟใใใใใจใๅฎนๆใงใใใใจใใฐใใใฉใณใน่ชใฎใใญในใใๅฆ็ใงใใใขใใซใๅฟ
่ฆใชๅ ดๅใHubใฎใฟใฐใไฝฟ็จใใฆ้ฉๅใชใขใใซใใใฃใซใฟใชใณใฐใงใใพใใใใใใฎใใฃใซใฟใชใณใฐใใใ็ตๆใฏใใใฉใณใน่ชใฎใใญในใใซไฝฟ็จใงใใๆๆ
ๅๆ็จใซ่ชฟๆดใใใๅค่จ่ชใฎ[BERTใขใใซ](https://huggingface.co/nlptown/bert-base-multilingual-uncased-sentiment)ใ่ฟใใพใ๏ผ
+
+```py
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+```
+
+
+
+[`AutoModelForSequenceClassification`]ใจ[`AutoTokenizer`]ใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใจใใใซ้ข้ฃใใใใผใฏใใคใถใใญใผใใใพใ๏ผๆฌกใฎใปใฏใทใงใณใง`AutoClass`ใซใคใใฆ่ฉณใใ่ชฌๆใใพใ๏ผ๏ผ
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+
+ไปฅไธใฎใณใผใใฏใ[`TFAutoModelForSequenceClassification`]ใใใณ[`AutoTokenizer`]ใไฝฟ็จใใฆใไบๅๅญฆ็ฟๆธใฟใขใใซใจใใฎ้ข้ฃใใใใผใฏใใคใถใใญใผใใใๆนๆณใ็คบใใฆใใพใ๏ผ`TFAutoClass`ใซใคใใฆใฏๆฌกใฎใปใฏใทใงใณใง่ฉณใใ่ชฌๆใใพใ๏ผ๏ผ
+
+```python
+>>> from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+
+
+ๆๅฎใใใขใใซใจใใผใฏใใคใถใ[`pipeline`]ใซ่จญๅฎใใไปๅบฆใฏใใฉใณใน่ชใฎใใญในใใซ`classifier`ใ้ฉ็จใงใใพใ๏ผ
+
+```py
+>>> classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
+>>> classifier("Nous sommes trรจs heureux de vous prรฉsenter la bibliothรจque ๐ค Transformers.")
+[{'label': '5 stars', 'score': 0.7273}]
+```
+
+ใใใใใชใใฎใฆใผในใฑใผในใซ้ฉใใใขใใซใ่ฆใคใใใชใๅ ดๅใไบๅๅญฆ็ฟๆธใฟใขใใซใใใชใใฎใใผใฟใงใใกใคใณใใฅใผใใณใฐใใๅฟ
่ฆใใใใพใใ
+ใใกใคใณใใฅใผใใณใฐใฎๆนๆณใซใคใใฆใฏใ[ใใกใคใณใใฅใผใใณใฐใฎใใฅใผใใชใขใซ](./training)ใใ่ฆงใใ ใใใ
+ๆๅพใซใใใกใคใณใใฅใผใใณใฐใใไบๅๅญฆ็ฟๆธใฟใขใใซใๅ
ฑๆใใใณใใฅใใใฃใจๅ
ฑๆใใใงๅ
ฑๆใใใใจใๆค่จใใฆใใ ใใใใใใซใใใๆฉๆขฐๅญฆ็ฟใๆฐไธปๅใใๆๅฉใใใงใใพใ๏ผ ๐ค
+
+## AutoClass
+
+
+
+[`AutoModelForSequenceClassification`] ใใใณ [`AutoTokenizer`] ใฏใฉในใฏใไธ่จใงไฝฟ็จใใ [`pipeline`] ใ้งๅใใใใใซๅๅใใฆๅไฝใใพใใ
+[AutoClass](./model_doc/auto) ใฏใไบๅๅญฆ็ฟๆธใฟใขใใซใฎใขใผใญใใฏใใฃใใใฎๅๅใพใใฏใในใใ่ชๅ็ใซๅๅพใใใทใงใผใใซใใใงใใ
+้ฉๅใช `AutoClass` ใ้ธๆใใใใใซ้ข้ฃใใๅๅฆ็ใฏใฉในใ้ธๆใใใ ใใงๆธใฟใพใใ
+
+ๅใฎใปใฏใทใงใณใใใฎไพใซๆปใใ`AutoClass` ใไฝฟ็จใใฆ [`pipeline`] ใฎ็ตๆใๅ็พใใๆนๆณใ่ฆใฆใฟใพใใใใ
+
+### AutoTokenizer
+
+ใใผใฏใใคใถใฏใใญในใใใขใใซใฎๅ
ฅๅใจใใฆไฝฟ็จใงใใๆฐๅคใฎ้
ๅใซๅๅฆ็ใใๅฝนๅฒใๆใใใพใใ
+ใใผใฏใใคใผใผใทใงใณใใญใปในใซใฏใๅ่ชใใฉใฎใใใซๅๅฒใใใใใๅ่ชใใฉใฎใฌใใซใงๅๅฒใใใใจใใฃใๅคใใฎใซใผใซใใใใพใ
+๏ผใใผใฏใใคใผใผใทใงใณใซใคใใฆใฎ่ฉณ็ดฐใฏ [ใใผใฏใใคใถใตใใชใผ](./tokenizer_summary) ใใ่ฆงใใ ใใ๏ผใ
+ๆใ้่ฆใชใใจใฏใใขใใซใไบๅๅญฆ็ฟๆธใฟใซใชใฃใใจใใจๅใใใผใฏใใคใผใผใทใงใณใซใผใซใไฝฟ็จใใใใใซใๅใใขใใซๅใงใใผใฏใใคใถใใคใณในใฟใณในๅใใๅฟ
่ฆใใใใใจใงใใ
+
+[`AutoTokenizer`] ใไฝฟ็จใใฆใใผใฏใใคใถใใญใผใใใพใ๏ผ
+
+```python
+>>> from transformers import AutoTokenizer
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tokenizer = AutoTokenizer.from_pretrained(model_name)
+```
+
+Pass your text to the tokenizer:
+
+```python
+>>> encoding = tokenizer("็งใใกใฏ๐ค Transformersใฉใคใใฉใชใใ่ฆใใงใใฆใจใฆใๅฌใใใงใใ")
+>>> print(encoding)
+{'input_ids': [101, 11312, 10320, 12495, 19308, 10114, 11391, 10855, 10103, 100, 58263, 13299, 119, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+ใใผใฏใใคใถใฏใๆฌกใฎๆ
ๅ ฑใๅซใ่พๆธใ่ฟใใพใ๏ผ
+
+- [input_ids](./glossary#input-ids): ใใผใฏใณใฎๆฐๅค่กจ็พใ
+- [attention_mask](.glossary#attention-mask): ใฉใฎใใผใฏใณใซใขใใณใทใงใณใๅใใใใ็คบใใพใใ
+
+ใใผใฏใใคใถใฏใพใใๅ
ฅๅใฎใชในใใๅใๅ
ฅใใไธๆงใช้ทใใฎใใใใ่ฟใใใใซใใญในใใใใใฃใณใฐใใใณๅใ่ฉฐใใใใจใใงใใพใใ
+
+
+
+
+```py
+>>> pt_batch = tokenizer(
+... ["๐ค Transformersใฉใคใใฉใชใใ่ฆใใงใใฆ้ๅธธใซๅฌใใใงใใ", "ๅซใใงใฏใชใใใจใ้กใฃใฆใใพใใ"],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="pt",
+... )
+```
+
+
+
+```py
+>>> tf_batch = tokenizer(
+... ["We are very happy to show you the ๐ค Transformers library.", "We hope you don't hate it."],
+... padding=True,
+... truncation=True,
+... max_length=512,
+... return_tensors="tf",
+... )
+```
+
+
+
+
+
+[ๅๅฆ็](./preprocessing)ใใฅใผใใชใขใซใใ่ฆงใใใ ใใใใผใฏใใคใผใผใทใงใณใฎ่ฉณ็ดฐใใ[`AutoImageProcessor`]ใ[`AutoFeatureExtractor`]ใ[`AutoProcessor`]ใไฝฟ็จใใฆ็ปๅใใชใผใใฃใชใใใใณใใซใใขใผใใซๅ
ฅๅใๅๅฆ็ใใๆนๆณใซใคใใฆ่ฉณใใ่ชฌๆใใใฆใใใใผใธใใ่ฆงใใ ใใใ
+
+
+
+### AutoModel
+
+
+
+๐ค Transformersใฏไบๅๅญฆ็ฟๆธใฟใคใณในใฟใณในใ็ฐกๅใซ็ตฑไธ็ใซใญใผใใใๆนๆณใๆไพใใพใใ
+ใใใฏใ[`AutoTokenizer`]ใใญใผใใใใฎใจๅใใใใซ[`AutoModel`]ใใญใผใใงใใใใจใๆๅณใใพใใ
+ใฟในใฏใซ้ฉใใ[`AutoModel`]ใ้ธๆใใไปฅๅคใฎ้ใใฏใใใพใใใ
+ใใญในใ๏ผใพใใฏใทใผใฑใณใน๏ผๅ้กใฎๅ ดๅใ[`AutoModelForSequenceClassification`]ใใญใผใใใๅฟ
่ฆใใใใพใ๏ผ
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+
+[`AutoModel`]ใฏใฉในใงใตใใผใใใใฆใใใฟในใฏใซ้ขใใ่ฉณ็ดฐใซใคใใฆใฏใ[ใฟในใฏใฎๆฆ่ฆ](./task_summary)ใๅ็
งใใฆใใ ใใใ
+
+
+
+ไปใๅๅฆ็ๆธใฟใฎใใใใ็ดๆฅใขใใซใซๆธกใใพใใ่พๆธใๅฑ้ใใใ ใใงใ`**`ใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใ๏ผ
+
+```python
+>>> pt_outputs = pt_model(**pt_batch)
+```
+
+ใขใใซใฏใ`logits`ๅฑๆงใซๆ็ต็ใชใขใฏใใฃใใผใทใงใณใๅบๅใใพใใ `logits`ใซsoftmax้ขๆฐใ้ฉ็จใใฆ็ขบ็ใๅๅพใใพใ๏ผ
+
+```py
+>>> from torch import nn
+
+>>> pt_predictions = nn.functional.softmax(pt_outputs.logits, dim=-1)
+>>> print(pt_predictions)
+tensor([[0.0021, 0.0018, 0.0115, 0.2121, 0.7725],
+ [0.2084, 0.1826, 0.1969, 0.1755, 0.2365]], grad_fn=)
+```
+
+
+
+๐ค Transformersใฏไบๅๅญฆ็ฟๆธใฟใคใณในใฟใณในใใญใผใใใใใใฎใทใณใใซใง็ตฑไธใใใๆนๆณใๆไพใใพใใ
+ใใใฏใ[`TFAutoModel`]ใ[`AutoTokenizer`]ใใญใผใใใใฎใจๅใใใใซใญใผใใงใใใใจใๆๅณใใพใใ
+ๅฏไธใฎ้ใใฏใใฟในใฏใซ้ฉใใ[`TFAutoModel`]ใ้ธๆใใใใจใงใใ
+ใใญในใ๏ผใพใใฏใทใผใฑใณใน๏ผๅ้กใฎๅ ดๅใ[`TFAutoModelForSequenceClassification`]ใใญใผใใใๅฟ
่ฆใใใใพใ๏ผ
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model_name = "nlptown/bert-base-multilingual-uncased-sentiment"
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
+```
+
+
+
+่ฉณ็ดฐใซใคใใฆใฏใ[`AutoModel`]ใฏใฉในใงใตใใผใใใใฆใใใฟในใฏใซ้ขใใๆ
ๅ ฑใฏใ[ใฟในใฏใฎๆฆ่ฆ](./task_summary)ใๅ็
งใใฆใใ ใใใ
+
+
+
+ๆฌกใซใๅๅฆ็ๆธใฟใฎใใใใ็ดๆฅใขใใซใซๆธกใใพใใใใณใฝใซใใใฎใพใพๆธกใใใจใใงใใพใ๏ผ
+
+```python
+>>> tf_outputs = tf_model(tf_batch)
+```
+
+ใขใใซใฏ`logits`ๅฑๆงใซๆ็ต็ใชใขใฏใใฃใใผใทใงใณใๅบๅใใพใใ`logits`ใซใฝใใใใใฏใน้ขๆฐใ้ฉ็จใใฆ็ขบ็ใๅๅพใใพใ๏ผ
+
+```python
+>>> import tensorflow as tf
+
+>>> tf_predictions = tf.nn.softmax(tf_outputs.logits, axis=-1)
+>>> tf_predictions # doctest: +IGNORE_RESULT
+```
+
+
+
+
+
+
+๐ค Transformersใฎใในใฆใฎใขใใซ๏ผPyTorchใพใใฏTensorFlow๏ผใฏใๆ็ต็ใชๆดปๆงๅ้ขๆฐ๏ผsoftmaxใชใฉ๏ผ*ๅ*ใฎใใณใฝใซใๅบๅใใพใใ
+ๆ็ต็ใชๆดปๆงๅ้ขๆฐใฏใใใฐใใฐๆๅคฑใจ็ตๅใใใฆใใใใใงใใใขใใซใฎๅบๅใฏ็นๅฅใชใใผใฟใฏใฉในใงใใใใใฎๅฑๆงใฏIDEใง่ชๅ่ฃๅฎใใใพใใ
+ใขใใซใฎๅบๅใฏใใฟใใซใพใใฏ่พๆธใฎใใใซๅไฝใใพใ๏ผๆดๆฐใในใฉใคในใใพใใฏๆๅญๅใงใคใณใใใฏในใไปใใใใจใใงใใพใ๏ผใ
+ใใฎๅ ดๅใNoneใงใใๅฑๆงใฏ็ก่ฆใใใพใใ
+
+
+
+### Save a Model
+
+
+
+ใขใใซใใใกใคใณใใฅใผใใณใฐใใใใ[`PreTrainedModel.save_pretrained`]ใไฝฟ็จใใฆใใผใฏใใคใถใจๅ
ฑใซไฟๅญใงใใพใ๏ผ
+
+```py
+>>> pt_save_directory = "./pt_save_pretrained"
+>>> tokenizer.save_pretrained(pt_save_directory) # doctest: +IGNORE_RESULT
+>>> pt_model.save_pretrained(pt_save_directory)
+```
+
+ๅใณใขใใซใไฝฟ็จใใๆบๅใใงใใใใ[`PreTrainedModel.from_pretrained`]ใไฝฟ็จใใฆๅๅบฆใญใผใใใพใ๏ผ
+
+```py
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained("./pt_save_pretrained")
+```
+
+
+
+ใขใใซใใใกใคใณใใฅใผใใณใฐใใใใใใฎใใผใฏใใคใถใไฝฟ็จใใฆใขใใซใไฟๅญใงใใพใใ[`TFPreTrainedModel.save_pretrained`]ใไฝฟ็จใใพใ๏ผ
+
+```py
+>>> tf_save_directory = "./tf_save_pretrained"
+>>> tokenizer.save_pretrained(tf_save_directory) # doctest: +IGNORE_RESULT
+>>> tf_model.save_pretrained(tf_save_directory)
+```
+
+ใขใใซใๅๅบฆไฝฟ็จใใๆบๅใใงใใใใ[`TFPreTrainedModel.from_pretrained`]ใไฝฟ็จใใฆๅๅบฆใญใผใใใพใ๏ผ
+
+```py
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained("./tf_save_pretrained")
+```
+
+
+
+
+๐ค Transformersใฎ็นใซ็ด ๆดใใใๆฉ่ฝใฎไธใคใฏใใขใใซใไฟๅญใใใใใPyTorchใขใใซใพใใฏTensorFlowใขใใซใจใใฆๅใญใผใใงใใใใจใงใใ `from_pt`ใพใใฏ`from_tf`ใใฉใกใผใฟใไฝฟ็จใใฆใขใใซใใใฌใผใ ใฏใผใฏ้ใงๅคๆใงใใพใ๏ผ
+
+
+
+
+```py
+>>> from transformers import AutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(pt_save_directory)
+>>> pt_model = AutoModelForSequenceClassification.from_pretrained(pt_save_directory, from_pt=True)
+```
+
+
+
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> tokenizer = AutoTokenizer.from_pretrained(tf_save_directory)
+>>> tf_model = TFAutoModelForSequenceClassification.from_pretrained(tf_save_directory, from_tf=True)
+```
+
+
+
+## Custom model builds
+
+ใขใใซใๆง็ฏๆนๆณใๅคๆดใใใซใฏใใขใใซใฎ่จญๅฎใฏใฉในใๅคๆดใงใใพใใ่จญๅฎใฏใขใใซใฎๅฑๆงใๆๅฎใใพใใไพใใฐใ้ ใๅฑคใฎๆฐใใขใใณใทใงใณใใใใฎๆฐใชใฉใใใใซๅซใพใใพใใใซในใฟใ ่จญๅฎใฏใฉในใใใขใใซใๅๆๅใใ้ใซใฏใใผใญใใๅงใใพใใใขใใซใฎๅฑๆงใฏใฉใณใใ ใซๅๆๅใใใๆๆ็พฉใช็ตๆใๅพใใใใซใขใใซใใใฌใผใใณใฐใใๅฟ
่ฆใใใใพใใ
+
+ๆๅใซ[`AutoConfig`]ใใคใณใใผใใใๅคๆดใใใไบๅๅญฆ็ฟๆธใฟใขใใซใใญใผใใใพใใ[`AutoConfig.from_pretrained`]ๅ
ใงใๅคๆดใใใๅฑๆง๏ผไพ๏ผใขใใณใทใงใณใใใใฎๆฐ๏ผใๆๅฎใงใใพใ๏ผ
+
+```python
+>>> from transformers import AutoConfig
+
+>>> my_config = AutoConfig.from_pretrained("distilbert/distilbert-base-uncased", n_heads=12)
+```
+
+
+
+[`AutoModel.from_config`]ใไฝฟ็จใใฆใซในใฟใ ่จญๅฎใใใขใใซใไฝๆใใพใ๏ผ
+
+```python
+>>> from transformers import AutoModel
+
+>>> my_model = AutoModel.from_config(my_config)
+```
+
+
+
+ใซในใฟใ ๆงๆใใใขใใซใไฝๆใใใซใฏใ[`TFAutoModel.from_config`]ใไฝฟ็จใใพใ๏ผ
+
+```py
+>>> from transformers import TFAutoModel
+
+>>> my_model = TFAutoModel.from_config(my_config)
+```
+
+
+
+
+[ใซในใฟใ ใขใผใญใใฏใใฃใไฝๆ](./create_a_model)ใฌใคใใๅ็
งใใฆใใซในใฟใ ๆงๆใฎ่ฉณ็ดฐๆ
ๅ ฑใ็ขบ่ชใใฆใใ ใใใ
+
+## Trainer - PyTorchๅใใฎๆ้ฉๅใใใใใฌใผใใณใฐใซใผใ
+
+ใในใฆใฎใขใใซใฏๆจๆบใฎ[`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)ใงใใใใใ้ๅธธใฎใใฌใผใใณใฐใซใผใใงไฝฟ็จใงใใพใใ
+็ฌ่ชใฎใใฌใผใใณใฐใซใผใใไฝๆใงใใพใใใ๐ค TransformersใฏPyTorchๅใใซ[`Trainer`]ใฏใฉในใๆไพใใฆใใใๅบๆฌ็ใชใใฌใผใใณใฐใซใผใใซๅ ใใฆใ
+ๅๆฃใใฌใผใใณใฐใๆททๅ็ฒพๅบฆใชใฉใฎๆฉ่ฝใฎ่ฟฝๅ ใ่กใฃใฆใใพใใ
+
+ใฟในใฏใซๅฟใใฆใ้ๅธธใฏ[`Trainer`]ใซไปฅไธใฎใใฉใกใผใฟใๆธกใใพใ๏ผ
+
+1. [`PreTrainedModel`]ใพใใฏ[`torch.nn.Module`](https://pytorch.org/docs/stable/nn.html#torch.nn.Module)ใใๅงใใพใ๏ผ
+
+ ```py
+ >>> from transformers import AutoModelForSequenceClassification
+
+ >>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+2. [`TrainingArguments`]ใซใฏใๅคๆดใงใใใขใใซใฎใใคใใผใใฉใกใผใฟใๅซใพใใฆใใใๅญฆ็ฟ็ใใใใใตใคใบใใใฌใผใใณใฐใจใใใฏๆฐใชใฉใๅคๆดใงใใพใใๆๅฎใใชใๅ ดๅใใใใฉใซใๅคใไฝฟ็จใใใพใ๏ผ
+
+ ```py
+ >>> from transformers import TrainingArguments
+
+ >>> training_args = TrainingArguments(
+ ... output_dir="path/to/save/folder/",
+ ... learning_rate=2e-5,
+ ... per_device_train_batch_size=8,
+ ... per_device_eval_batch_size=8,
+ ... num_train_epochs=2,
+ ... )
+ ```
+
+3. ใใผใฏใใคใถใ็ปๅใใญใปใใตใ็นๅพด้ๆฝๅบๅจใใพใใฏใใญใปใใตใฎใใใชๅๅฆ็ใฏใฉในใใญใผใใใพใ๏ผ
+
+ ```py
+ >>> from transformers import AutoTokenizer
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+4. ใใผใฟใปใใใใญใผใใใ:
+
+ ```py
+ >>> from datasets import load_dataset
+
+ >>> dataset = load_dataset("rotten_tomatoes") # doctest: +IGNORE_RESULT
+ ```
+
+5. ใใผใฟใปใใใใใผใฏใณๅใใใใใฎ้ขๆฐใไฝๆใใพใ๏ผ
+
+ ```python
+ >>> def tokenize_dataset(dataset):
+ ... return tokenizer(dataset["text"])
+ ```
+
+ ใใฎๅพใ[`~datasets.Dataset.map`]ใไฝฟ็จใใฆใใผใฟใปใใๅ
จไฝใซ้ฉ็จใใพใ๏ผ
+
+ ```python
+ >>> dataset = dataset.map(tokenize_dataset, batched=True)
+ ```
+
+6. ใใผใฟใปใใใใใฎไพใฎใใใใไฝๆใใใใใฎ [`DataCollatorWithPadding`]๏ผ
+
+ ```py
+ >>> from transformers import DataCollatorWithPadding
+
+ >>> data_collator = DataCollatorWithPadding(tokenizer=tokenizer)
+ ```
+
+ๆฌกใซใใใใใฎใฏใฉในใ[`Trainer`]ใซใพใจใใพใ๏ผ
+
+```python
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=dataset["train"],
+... eval_dataset=dataset["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... ) # doctest: +SKIP
+```
+
+่จ็ทดใ้ๅงใใๆบๅใใงใใใใ[`~Trainer.train`]ใๅผใณๅบใใฆใใฌใผใใณใฐใ้ๅงใใพใ๏ผ
+
+```py
+>>> trainer.train() # doctest: +SKIP
+```
+
+
+
+็ฟป่จณใ่ฆ็ดใชใฉใใทใผใฑใณใน้ใขใใซใไฝฟ็จใใใฟในใฏใซใฏใไปฃใใใซ[`Seq2SeqTrainer`]ใจ[`Seq2SeqTrainingArguments`]ใฏใฉในใไฝฟ็จใใฆใใ ใใใ
+
+
+
+[`Trainer`]ๅ
ใฎใกใฝใใใใตใใฏใฉในๅใใใใจใงใใใฌใผใใณใฐใซใผใใฎๅไฝใใซในใฟใใคใบใงใใพใใใใใซใใใๆๅคฑ้ขๆฐใใชใใใฃใใคใถใในใฑใธใฅใผใฉใชใฉใฎๆฉ่ฝใใซในใฟใใคใบใงใใพใใใตใใฏใฉในๅใงใใใกใฝใใใฎไธ่ฆงใซใคใใฆใฏใ[`Trainer`]ใชใใกใฌใณในใใ่ฆงใใ ใใใ
+
+ใใฌใผใใณใฐใซใผใใใซในใฟใใคใบใใๅฅใฎๆนๆณใฏใ[Callbacks](./main_classes/callback)ใไฝฟ็จใใใใจใงใใใณใผใซใใใฏใไฝฟ็จใใฆไปใฎใฉใคใใฉใชใจ็ตฑๅใใใใฌใผใใณใฐใซใผใใ็ฃ่ฆใใฆ้ฒๆ็ถๆณใๅ ฑๅใใใใใใฌใผใใณใฐใๆฉๆใซๅๆญขใใใใงใใพใใใณใผใซใใใฏใฏใใฌใผใใณใฐใซใผใ่ชไฝใซใฏไฝใๅคๆดใๅ ใใพใใใๆๅคฑ้ขๆฐใชใฉใฎใซในใฟใใคใบใ่กใๅ ดๅใฏใ[`Trainer`]ใใตใใฏใฉในๅใใๅฟ
่ฆใใใใพใใ
+
+## Train with TensorFlow
+
+ใในใฆใฎใขใใซใฏๆจๆบใฎ[`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model)ใงใใใใใ[Keras](https://keras.io/) APIใไฝฟ็จใใฆTensorFlowใงใใฌใผใใณใฐใงใใพใใ
+๐ค Transformersใฏใใใผใฟใปใใใ`tf.data.Dataset`ใจใใฆ็ฐกๅใซใญใผใใงใใใใใซใใ[`~TFPreTrainedModel.prepare_tf_dataset`]ใกใฝใใใๆไพใใฆใใใKerasใฎ[`compile`](https://keras.io/api/models/model_training_apis/#compile-method)ใใใณ[`fit`](https://keras.io/api/models/model_training_apis/#fit-method)ใกใฝใใใไฝฟ็จใใฆใใฌใผใใณใฐใใใใซ้ๅงใงใใพใใ
+
+1. [`TFPreTrainedModel`]ใพใใฏ[`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model)ใใๅงใใพใ๏ผ
+
+ ```py
+ >>> from transformers import TFAutoModelForSequenceClassification
+
+ >>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+2. ใใผใฏใใคใถใ็ปๅใใญใปใใตใ็นๅพด้ๆฝๅบๅจใใพใใฏใใญใปใใตใฎใใใชๅๅฆ็ใฏใฉในใใญใผใใใพใ๏ผ
+
+ ```py
+ >>> from transformers import AutoTokenizer
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+ ```
+
+3. ใใผใฟใปใใใใใผใฏใใคใบใใใใใฎ้ขๆฐใไฝๆใใพใ๏ผ
+
+ ```python
+ >>> def tokenize_dataset(dataset):
+ ... return tokenizer(dataset["text"]) # doctest: +SKIP
+ ```
+
+4. [`~datasets.Dataset.map`]ใไฝฟ็จใใฆใใผใฟใปใใๅ
จไฝใซใใผใฏใใคใถใ้ฉ็จใใใใผใฟใปใใใจใใผใฏใใคใถใ[`~TFPreTrainedModel.prepare_tf_dataset`]ใซๆธกใใพใใใใใใตใคใบใๅคๆดใใใใผใฟใปใใใใทใฃใใใซใใใใจใใงใใพใใ
+
+ ```python
+ >>> dataset = dataset.map(tokenize_dataset) # doctest: +SKIP
+ >>> tf_dataset = model.prepare_tf_dataset(
+ ... dataset["train"], batch_size=16, shuffle=True, tokenizer=tokenizer
+ ... ) # doctest: +SKIP
+ ```
+
+5. ๆบๅใใงใใใใ`compile`ใจ`fit`ใๅผใณๅบใใฆใใฌใผใใณใฐใ้ๅงใงใใพใใ Transformersใขใใซใฏใในใฆใใใฉใซใใฎใฟในใฏใซ้ข้ฃใใๆๅคฑ้ขๆฐใๆใฃใฆใใใใใๆๅฎใใชใ้ใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใใใพใใใ
+
+ ```python
+ >>> from tensorflow.keras.optimizers import Adam
+
+ >>> model.compile(optimizer=Adam(3e-5)) # ๆๅคฑ้ขๆฐใฎๅผๆฐใฏไธ่ฆใงใ๏ผ
+ >>> model.fit(tf
+ ```
+
+## What's next?
+
+๐ค Transformersใฎใฏใคใใฏใใขใผใๅฎไบใใใใใฌใคใใใใงใใฏใใฆใใซในใฟใ ใขใใซใฎไฝๆใใฟในใฏใฎใใใฎใใกใคใณใใฅใผใใณใฐใในใฏใชใใใไฝฟ็จใใใขใใซใฎใใฌใผใใณใฐใชใฉใใใๅ
ทไฝ็ใชใใจใๅญฆใถใใจใใงใใพใใ๐ค Transformersใฎใณใขใณใณใปใใใซใคใใฆใใฃใจ่ฉณใใ็ฅใใใๅ ดๅใฏใใณใณใปใใใฅใขใซใฌใคใใ่ชญใใงใฟใฆใใ ใใ๏ผ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/run_scripts.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/run_scripts.md
new file mode 100644
index 0000000000000000000000000000000000000000..af99d1c6da9702a65cdf3c018e2216542cdb5e68
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/run_scripts.md
@@ -0,0 +1,370 @@
+
+
+# Train with a script
+
+๐ค Transformersใฎ[notebooks](./notebooks/README)ใจไธ็ทใซใ[PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch)ใ[TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow)ใใพใใฏ[JAX/Flax](https://github.com/huggingface/transformers/tree/main/examples/flax)ใไฝฟ็จใใฆใขใใซใใใฌใผใใณใฐใใๆนๆณใ็คบใใตใณใใซในใฏใชใใใใใใพใใ
+
+ใพใใ็งใใกใฎ[็ ็ฉถใใญใธใงใฏใ](https://github.com/huggingface/transformers/tree/main/examples/research_projects)ใ[ใฌใฌใทใผใฎไพ](https://github.com/huggingface/transformers/tree/main/examples/legacy)ใงไฝฟ็จใใในใฏใชใใใ่ฆใคใใใพใใใใใใฎในใฏใชใใใฏ็พๅจใกใณใใใณในใใใฆใใใใใใใใๆๆฐใใผใธใงใณใฎใฉใคใใฉใชใจไบๆๆงใใชใ็นๅฎใฎ๐ค Transformersใฎใใผใธใงใณใๅฟ
่ฆใงใใ
+
+ใตใณใใซในใฏใชใใใฏใในใฆใฎๅ้กใงใใฎใพใพๅไฝใใใใจใฏๆๅพ
ใใใฆใใใใ่งฃๆฑบใใใใจใใฆใใๅ้กใซในใฏใชใใใ้ฉๅฟใใใๅฟ
่ฆใใใใใใใใพใใใใใฎ็นใใตใใผใใใใใใซใใปใจใใฉใฎในใฏใชใใใฏใใผใฟใใฉใฎใใใซๅๅฆ็ใใใฆใใใใๅฎๅ
จใซๅ
ฌ้ใใๅฟ
่ฆใซๅฟใใฆ็ทจ้ใงใใใใใซใใฆใใพใใ
+
+ใตใณใใซในใฏใชใใใงๅฎ่ฃ
ใใใๆฉ่ฝใใใๅ ดๅใฏใ[ใใฉใผใฉใ ](https://discuss.huggingface.co/)ใ[ใคใทใฅใผใใฉใใซใผ](https://github.com/huggingface/transformers/issues)ใง่ญฐ่ซใใฆใใใใซใชใฏใจในใใๆๅบใใฆใใ ใใใใใฐไฟฎๆญฃใฏๆญ่ฟใใพใใใ่ชญใฟใใใใฎใณในใใงๆฉ่ฝใ่ฟฝๅ ใใใใซใชใฏใจในใใฏใปใจใใฉใใผใธใใใชใๅฏ่ฝๆงใ้ซใใงใใ
+
+ใใฎใฌใคใใงใฏใ[PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization)ใจ[TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization)ใงๅฎ่กใใใตใใชใผใผใทใงใณใใฌใผใใณใฐในใฏใชใใใฎๅฎ่กๆนๆณใ็คบใใพใใใในใฆใฎไพใฏใๆ็คบ็ใซๆๅฎใใใฆใใชใ้ใใไธกๆนใฎใใฌใผใ ใฏใผใฏใจใใซๅไฝใใใใจใๆๅพ
ใใใฆใใพใใ
+
+## Setup
+
+ๆๆฐใใผใธใงใณใฎใตใณใใซในใฏใชใใใๆญฃๅธธใซๅฎ่กใใใซใฏใๆฐใใไปฎๆณ็ฐๅขใซ๐ค Transformersใใฝใผในใใใคใณในใใผใซใใๅฟ
่ฆใใใใพใ:
+
+
+```bash
+git clone https://github.com/huggingface/transformers
+cd transformers
+pip install .
+```
+
+ไปฅๅใฎในใฏใชใใใฎใใผใธใงใณใซใคใใฆใฏใไปฅไธใฎใใฐใซใใฏใชใใฏใใฆใใ ใใ๏ผ
+
+
+ ไปฅๅใฎ๐ค Transformersใฎใใผใธใงใณใซ้ขใใไพ
+
+
+
+ๆฌกใซใ็พๅจใฎ๐ค Transformersใฎใฏใญใผใณใ็นๅฎใฎใใผใธใงใณใซๅใๆฟใใฆใใ ใใใใใจใใฐใv3.5.1ใชใฉใงใใ
+
+
+```bash
+git checkout tags/v3.5.1
+```
+
+
+้ฉๅใชใฉใคใใฉใชใใผใธใงใณใ่จญๅฎใใใใไปปๆใฎไพใฎใใฉใซใใซ็งปๅใใไพๅบๆใฎ่ฆไปถใใคใณในใใผใซใใพใ๏ผ
+
+
+
+```bash
+pip install -r requirements.txt
+```
+
+## Run a script
+
+
+
+ใใฎไพใฎในใฏใชใใใฏใ๐ค [Datasets](https://huggingface.co/docs/datasets/) ใฉใคใใฉใชใใใใผใฟใปใใใใใฆใณใญใผใใใๅๅฆ็ใ่กใใพใใๆฌกใซใ[Trainer](https://huggingface.co/docs/transformers/main_classes/trainer) ใไฝฟ็จใใฆ่ฆ็ดใใตใใผใใใใขใผใญใใฏใใฃไธใงใใผใฟใปใใใใใกใคใณใใฅใผใใณใฐใใพใใไปฅไธใฎไพใงใฏใ[CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail) ใใผใฟใปใใไธใง [T5-small](https://huggingface.co/google-t5/t5-small) ใใใกใคใณใใฅใผใใณใฐใใๆนๆณใ็คบใใใฆใใพใใT5 ใขใใซใฏใใใฎใใฌใผใใณใฐๆนๆณใซ่ตทๅ ใใฆ่ฟฝๅ ใฎ `source_prefix` ๅผๆฐใๅฟ
่ฆใงใใใใฎใใญใณใใใซใใใT5 ใฏใใใ่ฆ็ดใฟในใฏใงใใใใจใ็ฅใใใจใใงใใพใใ
+
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+
+ใใฎไพใฎในใฏใชใใใฏใ๐ค [Datasets](https://huggingface.co/docs/datasets/) ใฉใคใใฉใชใใใใผใฟใปใใใใใฆใณใญใผใใใฆๅๅฆ็ใใพใใใใฎๅพใในใฏใชใใใฏ่ฆ็ดใใตใใผใใใใขใผใญใใฏใใฃไธใง Keras ใไฝฟ็จใใฆใใผใฟใปใใใใใกใคใณใใฅใผใใณใฐใใพใใไปฅไธใฎไพใงใฏใ[T5-small](https://huggingface.co/google-t5/t5-small) ใ [CNN/DailyMail](https://huggingface.co/datasets/cnn_dailymail) ใใผใฟใปใใใงใใกใคใณใใฅใผใใณใฐใใๆนๆณใ็คบใใฆใใพใใT5 ใขใใซใฏใใใฎใใฌใผใใณใฐๆนๆณใซ่ตทๅ ใใฆ่ฟฝๅ ใฎ `source_prefix` ๅผๆฐใๅฟ
่ฆใงใใใใฎใใญใณใใใฏใT5 ใซใใใ่ฆ็ดใฟในใฏใงใใใใจใ็ฅใใใพใใ
+
+
+```bash
+python examples/tensorflow/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Distributed training and mixed precision
+
+[Trainer](https://huggingface.co/docs/transformers/main_classes/trainer)ใฏใๅๆฃใใฌใผใใณใฐใจๆททๅ็ฒพๅบฆใใตใใผใใใฆใใพใใใคใพใใใใฎๆฉ่ฝใในใฏใชใใใงไฝฟ็จใใใใจใใงใใพใใใใใใฎๆฉ่ฝใๆๅนใซใใใซใฏใๆฌกใฎๆ้ ใๅฎ่กใใพใใ
+
+- `fp16`ๅผๆฐใ่ฟฝๅ ใใฆๆททๅ็ฒพๅบฆใๆๅนใซใใพใใ
+- `nproc_per_node`ๅผๆฐใงไฝฟ็จใใGPUใฎๆฐใ่จญๅฎใใพใใ
+
+ไปฅไธใฏๆไพใใใBashใณใผใใงใใใใฎใณใผใใฎๆฅๆฌ่ช่จณใMarkdownๅฝขๅผใง่จ่ผใใพใใ
+
+```bash
+torchrun \
+ --nproc_per_node 8 pytorch/summarization/run_summarization.py \
+ --fp16 \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+TensorFlowในใฏใชใใใฏใๅๆฃใใฌใผใใณใฐใซ[`MirroredStrategy`](https://www.tensorflow.org/guide/distributed_training#mirroredstrategy)ใไฝฟ็จใใใใฌใผใใณใฐในใฏใชใใใซ่ฟฝๅ ใฎๅผๆฐใ่ฟฝๅ ใใๅฟ
่ฆใฏใใใพใใใTensorFlowในใฏใชใใใฏใใใใฉใซใใง่คๆฐใฎGPUใๅฉ็จๅฏ่ฝใชๅ ดๅใซใใใใไฝฟ็จใใพใใ
+
+## Run a script on a TPU
+
+
+
+Tensor Processing Units (TPUs)ใฏใใใใฉใผใใณในใๅ ้ใใใใใใซ็นๅฅใซ่จญ่จใใใฆใใพใใPyTorchใฏใ[XLA](https://www.tensorflow.org/xla)ใใฃใผใใฉใผใใณใฐใณใณใใคใฉใไฝฟ็จใใฆTPUsใใตใใผใใใฆใใใ่ฉณ็ดฐใซใคใใฆใฏ[ใใกใ](https://github.com/pytorch/xla/blob/master/README.md)ใใ่ฆงใใ ใใใTPUใไฝฟ็จใใใซใฏใ`xla_spawn.py`ในใฏใชใใใ่ตทๅใใ`num_cores`ๅผๆฐใไฝฟ็จใใฆไฝฟ็จใใTPUใณใขใฎๆฐใ่จญๅฎใใพใใ
+```bash
+python xla_spawn.py --num_cores 8 \
+ summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+ใใกใใใTensor Processing Units๏ผTPUs๏ผใฏๆง่ฝใ้ซ้ๅใใใใใซ็นๅฅใซ่จญ่จใใใฆใใพใใTensorFlowในใฏใชใใใฏใTPUsใงใใฌใผใใณใฐใใใใใซ[`TPUStrategy`](https://www.tensorflow.org/guide/distributed_training#tpustrategy)ใๅฉ็จใใพใใTPUใไฝฟ็จใใใซใฏใTPUใชใฝใผในใฎๅๅใ`tpu`ๅผๆฐใซๆธกใใพใใ
+
+```bash
+python run_summarization.py \
+ --tpu name_of_tpu_resource \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size 8 \
+ --per_device_eval_batch_size 16 \
+ --num_train_epochs 3 \
+ --do_train \
+ --do_eval
+```
+
+
+
+## Run a script with ๐ค Accelerate
+
+๐ค [Accelerate](https://huggingface.co/docs/accelerate)ใฏใPyTorchๅฐ็จใฎใฉใคใใฉใชใงใCPUใฎใฟใ่คๆฐใฎGPUใTPUใชใฉใใใพใใพใชใปใใใขใใใงใขใใซใใใฌใผใใณใฐใใใใใฎ็ตฑไธใใใๆนๆณใๆไพใใพใใPyTorchใฎใใฌใผใใณใฐใซใผใใๅฎๅ
จใซๅฏ่ฆๅใใชใใๅฎ่กใงใใพใใใพใ ใคใณในใใผใซใใฆใใชใๅ ดๅใฏใ๐ค Accelerateใใคใณในใใผใซใใฆใใ ใใ๏ผ
+
+> ๆณจๆ๏ผAccelerateใฏๆฅ้ใซ้็บใ้ฒ่กใใฆใใใใใในใฏใชใใใๅฎ่กใใใซใฏaccelerateใฎgitใใผใธใงใณใใคใณในใใผใซใใๅฟ
่ฆใใใใพใ
+```bash
+pip install git+https://github.com/huggingface/accelerate
+```
+
+ไปฃใใใซใ`run_summarization_no_trainer.py` ในใฏใชใใใไฝฟ็จใใๅฟ
่ฆใใใใพใใ ๐ค Accelerate ใใตใใผใใใในใฏใชใใใซใฏใใใฉใซใๅ
ใซ `task_no_trainer.py` ใใกใคใซใๅซใพใใฆใใพใใใพใใๆฌกใฎใณใใณใใๅฎ่กใใฆ่จญๅฎใใกใคใซใไฝๆใใไฟๅญใใพใ๏ผ
+
+```bash
+accelerate config
+```
+
+ใในใใ่กใใ่จญๅฎใๆญฃใใๆงๆใใใฆใใใ็ขบ่ชใใฆใใ ใใ๏ผ
+
+
+```bash
+accelerate test
+```
+
+Now you are ready to launch the training:
+
+
+```bash
+accelerate launch run_summarization_no_trainer.py \
+ --model_name_or_path google-t5/t5-small \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir ~/tmp/tst-summarization
+```
+
+## Use a custom dataset
+
+่ฆ็ดในใฏใชใใใฏใCSVใพใใฏJSON Lineใใกใคใซใงใใใฐใใซในใฟใ ใใผใฟใปใใใใตใใผใใใฆใใพใใ็ฌ่ชใฎใใผใฟใปใใใไฝฟ็จใใๅ ดๅใใใใคใใฎ่ฟฝๅ ใฎๅผๆฐใๆๅฎใใๅฟ
่ฆใใใใพใใ
+
+- `train_file`ใใใณ`validation_file`ใฏใใใฌใผใใณใฐใจใใชใใผใทใงใณใฎใใกใคใซใธใฎใในใๆๅฎใใพใใ
+- `text_column`ใฏ่ฆ็ดใใใใใฎๅ
ฅๅใใญในใใงใใ
+- `summary_column`ใฏๅบๅใใๅฏพ่ฑกใใญในใใงใใ
+
+ใซในใฟใ ใใผใฟใปใใใไฝฟ็จใใ่ฆ็ดในใฏใชใใใฏใไปฅไธใฎใใใซใชใใพใ๏ผ
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --train_file path_to_csv_or_jsonlines_file \
+ --validation_file path_to_csv_or_jsonlines_file \
+ --text_column text_column_name \
+ --summary_column summary_column_name \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --overwrite_output_dir \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --predict_with_generate
+```
+
+## Test a script
+
+ใในใฆใไบๆณ้ใใซๅไฝใใใใจใ็ขบ่ชใใใใใซใใใผใฟใปใใๅ
จไฝใๅฆ็ใใๅใซใใใผใฟใปใใใฎไธ้จใฎไพใงในใฏใชใใใๅฎ่กใใใใจใฏ่ฏใใขใคใใขใงใใไปฅไธใฎๅผๆฐใไฝฟ็จใใฆใใใผใฟใปใใใๆๅคงใตใณใใซๆฐใซๅใ่ฉฐใใพใ๏ผ
+
+- `max_train_samples`
+- `max_eval_samples`
+- `max_predict_samples`
+
+```bash
+python examples/pytorch/summarization/run_summarization.py \
+ --model_name_or_path google-t5/t5-small \
+ --max_train_samples 50 \
+ --max_eval_samples 50 \
+ --max_predict_samples 50 \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+ไธ้จใฎไพใฎในใฏใชใใใฏใ`max_predict_samples`ๅผๆฐใใตใใผใใใฆใใชใใใจใใใใพใใใใฎๅผๆฐใใตใใผใใใใฆใใใใฉใใใใใใใชใๅ ดๅใฏใ`-h`ๅผๆฐใ่ฟฝๅ ใใฆ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+examples/pytorch/summarization/run_summarization.py -h
+```
+
+## Resume training from checkpoint
+
+ไปฅๅใฎใใงใใฏใใคใณใใใใใฌใผใใณใฐใๅ้ใใใใใฎๅฝน็ซใคใชใใทใงใณใใใใพใใใใใซใใใใใฌใผใใณใฐใไธญๆญใใใๅ ดๅใงใใๆๅใใใใ็ดใใใจใชใใไธญๆญใใใจใใใใๅ้ใงใใพใใใใงใใฏใใคใณใใใใใฌใผใใณใฐใๅ้ใใใใใฎ2ใคใฎๆนๆณใใใใพใใ
+
+ๆๅใฎๆนๆณใฏใ`output_dir previous_output_dir` ๅผๆฐใไฝฟ็จใใฆใ`output_dir` ใซไฟๅญใใใๆๆฐใฎใใงใใฏใใคใณใใใใใฌใผใใณใฐใๅ้ใใๆนๆณใงใใใใฎๅ ดๅใ`overwrite_output_dir` ใๅ้คใใๅฟ
่ฆใใใใพใ๏ผ
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --output_dir previous_output_dir \
+ --predict_with_generate
+```
+
+2็ช็ฎใฎๆนๆณใงใฏใ`resume_from_checkpoint path_to_specific_checkpoint` ๅผๆฐใไฝฟ็จใใฆใ็นๅฎใฎใใงใใฏใใคใณใใใฉใซใใใใใฌใผใใณใฐใๅ้ใใพใใ
+
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --resume_from_checkpoint path_to_specific_checkpoint \
+ --predict_with_generate
+```
+
+## Share your model
+
+ใในใฆใฎในใฏใชใใใฏใๆ็ต็ใชใขใใซใ [Model Hub](https://huggingface.co/models) ใซใขใใใญใผใใงใใพใใ้ๅงใใๅใซ Hugging Face ใซใญใฐใคใณใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+huggingface-cli login
+```
+
+ๆฌกใซใในใฏใชใใใซ `push_to_hub` ๅผๆฐใ่ฟฝๅ ใใพใใใใฎๅผๆฐใฏใHugging Face ใฎใฆใผใถใผๅใจ `output_dir` ใงๆๅฎใใใใฉใซใๅใงใชใใธใใชใไฝๆใใพใใ
+
+็นๅฎใฎๅๅใใชใใธใใชใซไปใใใซใฏใ`push_to_hub_model_id` ๅผๆฐใไฝฟ็จใใฆ่ฟฝๅ ใใพใใใใฎใชใใธใใชใฏ่ชๅ็ใซใใชใใฎๅๅ็ฉบ้ใฎไธใซใชในใใใใพใใ
+
+ไปฅไธใฎไพใฏใ็นๅฎใฎใชใใธใใชๅใงใขใใซใใขใใใญใผใใใๆนๆณใ็คบใใฆใใพใ:
+
+
+
+```bash
+python examples/pytorch/summarization/run_summarization.py
+ --model_name_or_path google-t5/t5-small \
+ --do_train \
+ --do_eval \
+ --dataset_name cnn_dailymail \
+ --dataset_config "3.0.0" \
+ --source_prefix "summarize: " \
+ --push_to_hub \
+ --push_to_hub_model_id finetuned-t5-cnn_dailymail \
+ --output_dir /tmp/tst-summarization \
+ --per_device_train_batch_size=4 \
+ --per_device_eval_batch_size=4 \
+ --overwrite_output_dir \
+ --predict_with_generate
+```
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/serialization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/serialization.md
new file mode 100644
index 0000000000000000000000000000000000000000..3e9d81180de0464984fa36560c8ba78b7817ec8d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/serialization.md
@@ -0,0 +1,191 @@
+
+
+# Export to ONNX
+
+๐ค Transformersใขใใซใๆฌ็ช็ฐๅขใซๅฑ้ใใ้ใซใฏใใขใใซใ็นๆฎใชใฉใณใฟใคใ ใใใณใใผใใฆใงใขใง่ชญใฟ่พผใฟใๅฎ่กใงใใใใใซใใขใใซใใทใชใขใฉใคใบใใใๅฝขๅผใซใจใฏในใใผใใใใใจใๅฟ
่ฆใงใใใใใใฎๆฉๆตใๅใใใใจใใงใใใใจใใใใพใใ
+
+๐ค OptimumใฏใTransformersใฎๆกๅผตๆฉ่ฝใงใใใPyTorchใพใใฏTensorFlowใใใขใใซใONNXใTFLiteใชใฉใฎใทใชใขใฉใคใบใใใๅฝขๅผใซใจใฏในใใผใใใใใจใๅฏ่ฝใซใใใexportersใใขใธใฅใผใซใๆไพใใฆใใพใใใพใใ๐ค Optimumใฏใๆๅคงใฎๅน็ใงใฟใผใฒใใใใผใใฆใงใขใงใขใใซใใใฌใผใใณใฐใใใณๅฎ่กใใใใใฎใใใฉใผใใณในๆ้ฉๅใใผใซใๆไพใใฆใใพใใ
+
+ใใฎใฌใคใใงใฏใ๐ค Transformersใขใใซใ๐ค Optimumใไฝฟ็จใใฆONNXใซใจใฏในใใผใใใๆนๆณใ็คบใใฆใใใใขใใซใTFLiteใซใจใฏในใใผใใใๆนๆณใซใคใใฆใฏ[Export to TFLiteใใผใธ](tflite)ใๅ็
งใใฆใใ ใใใ
+
+## Export to ONNX
+
+[ONNX๏ผOpen Neural Network eXchange๏ผ](http://onnx.ai)ใฏใPyTorchใใใณTensorFlowใๅซใใใพใใพใชใใฌใผใ ใฏใผใฏใงๆทฑๅฑคๅญฆ็ฟใขใใซใ่กจ็พใใใใใฎๅ
ฑ้ใฎไธ้ฃใฎๆผ็ฎๅญใจใใกใคใซๅฝขๅผใๅฎ็พฉใใใชใผใใณในใฟใณใใผใใงใใใขใใซใONNXๅฝขๅผใซใจใฏในใใผใใใใใจใใใใใฎๆผ็ฎๅญใฏใใฅใผใฉใซใใใใฏใผใฏใไปใใใใผใฟใฎๆตใใ่กจใ่จ็ฎใฐใฉใ๏ผไธ่ฌ็ใซใฏใไธญ้่กจ็พใใจๅผใฐใใ๏ผใๆง็ฏใใใใใซไฝฟ็จใใใพใใ
+
+ๆจๆบๅใใใๆผ็ฎๅญใจใใผใฟๅใๅใใใฐใฉใใๅ
ฌ้ใใใใจใงใONNXใฏใใฌใผใ ใฏใผใฏ้ใฎๅใๆฟใใๅฎนๆใซใใพใใใใจใใฐใPyTorchใงใใฌใผใใณใฐใใใใขใใซใฏONNXๅฝขๅผใซใจใฏในใใผใใใใใใTensorFlowใงใคใณใใผใใใใใจใใงใใพใ๏ผ้ใๅๆงใงใ๏ผใ
+
+ONNXๅฝขๅผใซใจใฏในใใผใใใใใขใใซใฏใไปฅไธใฎใใใซไฝฟ็จใงใใพใ๏ผ
+- [ใฐใฉใๆ้ฉๅ](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/optimization)ใ[้ๅญๅ](https://huggingface.co/docs/optimum/onnxruntime/usage_guides/quantization)ใชใฉใฎใใฏใใใฏใไฝฟ็จใใฆๆจ่ซใฎใใใซๆ้ฉๅใ
+- [`ORTModelForXXX`ใฏใฉใน](https://huggingface.co/docs/optimum/onnxruntime/package_reference/modeling_ort)ใไปใใฆONNX Runtimeใงๅฎ่กใใ๐ค Transformersใงใใชใใฟใฎ`AutoModel` APIใซๅพใใพใใ
+- [ๆ้ฉๅใใใๆจ่ซใใคใใฉใคใณ](https://huggingface.co/docs/optimum/main/en/onnxruntime/usage_guides/pipelines)ใไปใใฆๅฎ่กใใ๐ค Transformersใฎ[`pipeline`]้ขๆฐใจๅใAPIใๆใฃใฆใใพใใ
+
+๐ค Optimumใฏใ่จญๅฎใชใใธใงใฏใใๆดป็จใใฆONNXใจใฏในใใผใใใตใใผใใใฆใใใใใใใฎ่จญๅฎใชใใธใงใฏใใฏๅคใใฎใขใใซใขใผใญใใฏใใฃ็จใซไบๅใซไฝๆใใใฆใใใไปใฎใขใผใญใใฏใใฃใซใ็ฐกๅใซๆกๅผตใงใใใใใซ่จญ่จใใใฆใใพใใ
+
+ไบๅใซไฝๆใใใ่จญๅฎใฎใชในใใซใคใใฆใฏใ[๐ค Optimumใใญใฅใกใณใ](https://huggingface.co/docs/optimum/exporters/onnx/overview)ใๅ็
งใใฆใใ ใใใ
+
+๐ค TransformersใขใใซใONNXใซใจใฏในใใผใใใๆนๆณใฏ2ใคใใใพใใไปฅไธใงใฏไธกๆนใฎๆนๆณใ็คบใใพใ๏ผ
+
+- export with ๐ค Optimum via CLI.
+- export with ๐ค Optimum with `optimum.onnxruntime`.
+
+### Exporting a ๐ค Transformers model to ONNX with CLI
+
+๐ค TransformersใขใใซใONNXใซใจใฏในใใผใใใใซใฏใใพใ่ฟฝๅ ใฎไพๅญ้ขไฟใใคใณในใใผใซใใฆใใ ใใ๏ผ
+
+```bash
+pip install optimum[exporters]
+```
+
+ใในใฆใฎๅฉ็จๅฏ่ฝใชๅผๆฐใ็ขบ่ชใใใซใฏใ[๐ค Optimumใใญใฅใกใณใ](https://huggingface.co/docs/optimum/exporters/onnx/usage_guides/export_a_model#exporting-a-model-to-onnx-using-the-cli)ใๅ็
งใใฆใใ ใใใใพใใฏใใณใใณใใฉใคใณใงใใซใใ่กจ็คบใใใใจใใงใใพใ๏ผ
+
+
+```bash
+optimum-cli export onnx --help
+```
+
+๐ค Hubใใใขใใซใฎใใงใใฏใใคใณใใใจใฏในใใผใใใใซใฏใไพใใฐ `distilbert/distilbert-base-uncased-distilled-squad` ใไฝฟใใใๅ ดๅใไปฅไธใฎใณใใณใใๅฎ่กใใฆใใ ใใ๏ผ
+
+```bash
+optimum-cli export onnx --model distilbert/distilbert-base-uncased-distilled-squad distilbert_base_uncased_squad_onnx/
+```
+
+้ฒ่ก็ถๆณใ็คบใใ็ตๆใฎ `model.onnx` ใไฟๅญใใใๅ ดๆใ่กจ็คบใใใญใฐใฏใไปฅไธใฎใใใซ่กจ็คบใใใใฏใใงใ๏ผ
+
+
+```bash
+Validating ONNX model distilbert_base_uncased_squad_onnx/model.onnx...
+ -[โ] ONNX model output names match reference model (start_logits, end_logits)
+ - Validating ONNX Model output "start_logits":
+ -[โ] (2, 16) matches (2, 16)
+ -[โ] all values close (atol: 0.0001)
+ - Validating ONNX Model output "end_logits":
+ -[โ] (2, 16) matches (2, 16)
+ -[โ] all values close (atol: 0.0001)
+The ONNX export succeeded and the exported model was saved at: distilbert_base_uncased_squad_onnx
+```
+
+ไธ่จใฎไพใฏ๐ค Hubใใใฎใใงใใฏใใคใณใใฎใจใฏในใใผใใ็คบใใฆใใพใใใญใผใซใซใขใใซใใจใฏในใใผใใใๅ ดๅใใพใใขใใซใฎ้ใฟใจใใผใฏใใคใถใฎใใกใคใซใๅใใใฃใฌใฏใใช๏ผ`local_path`๏ผใซไฟๅญใใฆใใ ใใใCLIใไฝฟ็จใใๅ ดๅใ๐ค Hubใฎใใงใใฏใใคใณใๅใฎไปฃใใใซ`model`ๅผๆฐใซ`local_path`ใๆธกใใ`--task`ๅผๆฐใๆๅฎใใฆใใ ใใใ[๐ค Optimumใใญใฅใกใณใ](https://huggingface.co/docs/optimum/exporters/task_manager)ใงใตใใผใใใใฆใใใฟในใฏใฎใชในใใ็ขบ่ชใงใใพใใ`task`ๅผๆฐใๆๅฎใใใฆใใชใๅ ดๅใใฟในใฏๅบๆใฎใใใใๆใใชใใขใใซใขใผใญใใฏใใฃใใใใฉใซใใง้ธๆใใใพใใ
+
+
+```bash
+optimum-cli export onnx --model local_path --task question-answering distilbert_base_uncased_squad_onnx/
+```
+
+ใจใฏในใใผใใใใ `model.onnx` ใใกใคใซใฏใONNXๆจๆบใใตใใผใใใ[ๅคใใฎใขใฏใปใฉใฌใผใฟ](https://onnx.ai/supported-tools.html#deployModel)ใฎ1ใคใงๅฎ่กใงใใพใใใใจใใฐใ[ONNX Runtime](https://onnxruntime.ai/)ใไฝฟ็จใใฆใขใใซใ่ชญใฟ่พผใฟใๅฎ่กใใๆนๆณใฏไปฅไธใฎ้ใใงใ๏ผ
+
+
+```python
+>>> from transformers import AutoTokenizer
+>>> from optimum.onnxruntime import ORTModelForQuestionAnswering
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert_base_uncased_squad_onnx")
+>>> model = ORTModelForQuestionAnswering.from_pretrained("distilbert_base_uncased_squad_onnx")
+>>> inputs = tokenizer("What am I using?", "Using DistilBERT with ONNX Runtime!", return_tensors="pt")
+>>> outputs = model(**inputs)
+```
+
+๐ค HubใใTensorFlowใฎใใงใใฏใใคใณใใใจใฏในใใผใใใใใญใปในใฏใๅๆงใงใใไพใใฐใ[Keras organization](https://huggingface.co/keras-io)ใใ็ด็ฒใชTensorFlowใฎใใงใใฏใใคใณใใใจใฏในใใผใใใๆนๆณใฏไปฅไธใฎ้ใใงใ๏ผ
+
+
+```bash
+optimum-cli export onnx --model keras-io/transformers-qa distilbert_base_cased_squad_onnx/
+```
+
+### Exporting a ๐ค Transformers model to ONNX with `optimum.onnxruntime`
+
+CLIใฎไปฃใใใซใ๐ค TransformersใขใใซใONNXใซใใญใฐใฉใ ็ใซใจใฏในใใผใใใใใจใใงใใพใใไปฅไธใฎใใใซ่กใใพใ๏ผ
+
+```python
+>>> from optimum.onnxruntime import ORTModelForSequenceClassification
+>>> from transformers import AutoTokenizer
+
+>>> model_checkpoint = "distilbert_base_uncased_squad"
+>>> save_directory = "onnx/"
+
+>>> # Load a model from transformers and export it to ONNX
+>>> ort_model = ORTModelForSequenceClassification.from_pretrained(model_checkpoint, export=True)
+>>> tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
+
+>>> # Save the onnx model and tokenizer
+>>> ort_model.save_pretrained(save_directory)
+>>> tokenizer.save_pretrained(save_directory)
+```
+
+### Exporting a model for an unsupported architecture
+
+็พๅจใจใฏในใใผใใงใใชใใขใใซใใตใใผใใใใใใซ่ฒข็ฎใใใๅ ดๅใใพใ[`optimum.exporters.onnx`](https://huggingface.co/docs/optimum/exporters/onnx/overview)ใงใตใใผใใใใฆใใใใฉใใใ็ขบ่ชใใใตใใผใใใใฆใใชใๅ ดๅใฏ[๐ค Optimumใซ่ฒข็ฎ](https://huggingface.co/docs/optimum/exporters/onnx/usage_guides/contribute)ใใฆใใ ใใใ
+
+### Exporting a model with `transformers.onnx`
+
+
+
+`transformers.onnx`ใฏใใฏใใกใณใใใณในใใใฆใใชใใใใใขใใซใไธ่จใง่ชฌๆใใใใใซ๐ค Optimumใงใจใฏในใใผใใใฆใใ ใใใใใฎใปใฏใทใงใณใฏๅฐๆฅใฎใใผใธใงใณใงๅ้คใใใพใใ
+
+
+
+๐ค TransformersใขใใซใONNXใซใจใฏในใใผใใใใซใฏใ่ฟฝๅ ใฎไพๅญ้ขไฟใใคใณในใใผใซใใฆใใ ใใ๏ผ
+
+
+```bash
+pip install transformers[onnx]
+```
+
+`transformers.onnx`ใใใฑใผใธใPythonใขใธใฅใผใซใจใใฆไฝฟ็จใใฆใไบๅใซ็จๆใใใ่จญๅฎใไฝฟ็จใใฆใใงใใฏใใคใณใใใจใฏในใใผใใใๆนๆณใฏไปฅไธใฎ้ใใงใ๏ผ
+
+```bash
+python -m transformers.onnx --model=distilbert/distilbert-base-uncased onnx/
+```
+
+ใใฎๆนๆณใฏใ`--model`ๅผๆฐใงๅฎ็พฉใใใใใงใใฏใใคใณใใฎONNXใฐใฉใใใจใฏในใใผใใใพใใ๐ค Hubใฎใใใใใฎใใงใใฏใใคใณใใพใใฏใญใผใซใซใซไฟๅญใใใใใงใใฏใใคใณใใๆธกใใใจใใงใใพใใใจใฏในใใผใใใใ`model.onnx`ใใกใคใซใฏใONNXๆจๆบใใตใใผใใใๅคใใฎใขใฏใปใฉใฌใผใฟใงๅฎ่กใงใใพใใไพใใฐใONNX Runtimeใไฝฟ็จใใฆใขใใซใ่ชญใฟ่พผใใงๅฎ่กใใๆนๆณใฏไปฅไธใฎ้ใใงใ๏ผ
+
+
+```python
+>>> from transformers import AutoTokenizer
+>>> from onnxruntime import InferenceSession
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+>>> session = InferenceSession("onnx/model.onnx")
+>>> # ONNX Runtime expects NumPy arrays as input
+>>> inputs = tokenizer("Using DistilBERT with ONNX Runtime!", return_tensors="np")
+>>> outputs = session.run(output_names=["last_hidden_state"], input_feed=dict(inputs))
+```
+
+ๅฟ
่ฆใชๅบๅๅ๏ผไพ: `["last_hidden_state"]`๏ผใฏใๅใขใใซใฎONNXๆงๆใ็ขบ่ชใใใใจใงๅๅพใงใใพใใไพใใฐใDistilBERTใฎๅ ดๅใๆฌกใฎใใใซใชใใพใ๏ผ
+
+
+```python
+>>> from transformers.models.distilbert import DistilBertConfig, DistilBertOnnxConfig
+
+>>> config = DistilBertConfig()
+>>> onnx_config = DistilBertOnnxConfig(config)
+>>> print(list(onnx_config.outputs.keys()))
+["last_hidden_state"]
+```
+
+ใใใใ็ด็ฒใชTensorFlowใฎใใงใใฏใใคใณใใใใญใฐใฉใ ็ใซใจใฏในใใผใใใใใญใปในใฏใไปฅไธใฎใใใซๅๆงใงใ๏ผ
+
+```bash
+python -m transformers.onnx --model=keras-io/transformers-qa onnx/
+```
+
+ใญใผใซใซใซไฟๅญใใใใขใใซใใจใฏในใใผใใใๅ ดๅใใขใใซใฎ้ใฟใจใใผใฏใใคใถใฎใใกใคใซใๅใใใฃใฌใฏใใชใซไฟๅญใใฆใใ ใใ๏ผไพ๏ผ `local-pt-checkpoint`๏ผใใใฎๅพใ`transformers.onnx`ใใใฑใผใธใฎ `--model`ๅผๆฐใๅธๆใใใใฃใฌใฏใใชใซๅใใฆ่จญๅฎใใฆใONNXใซใจใฏในใใผใใใพใ๏ผ
+
+
+```bash
+python -m transformers.onnx --model=local-pt-checkpoint onnx/
+```
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/task_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/task_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..93f4783b1520103fd50243eeb4347605b8fba9d8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/task_summary.md
@@ -0,0 +1,355 @@
+
+
+# What ๐ค Transformers can do
+
+๐ค Transformersใฏใ่ช็ถ่จ่ชๅฆ็๏ผNLP๏ผใใณใณใใฅใผใฟใใธใงใณใ้ณๅฃฐๅฆ็ใชใฉใฎๆๆฐใฎไบๅๅญฆ็ฟๆธใฟใขใใซใฎใฉใคใใฉใชใงใใใใฎใฉใคใใฉใชใซใฏใTransformerใขใใซใ ใใงใชใใใณใณใใฅใผใฟใใธใงใณใฟในใฏๅใใฎใขใใณใช็ณใฟ่พผใฟใใฅใผใฉใซใใใใฏใผใฏใชใฉใTransformerไปฅๅคใฎใขใใซใๅซใพใใฆใใพใใ็พไปฃใฎในใใผใใใฉใณใใขใใชใใใฌใใชใฉใๆใไบบๆฐใฎใใๆถ่ฒป่
่ฃฝๅใฎๅคใใซใฏใๆทฑๅฑคๅญฆ็ฟๆ่กใไฝฟ็จใใใฆใใพใใในใใผใใใฉใณใงๆฎๅฝฑใใๅ็ใใ่ๆฏใชใใธใงใฏใใๅ้คใใใใงใใ๏ผใใใฏใใใใใฃใใฏใปใปใฐใกใณใใผใทใงใณ๏ผใพใ ไฝใๆๅณใใใใใใใชใใฆใๅฟ้
ใใชใใงใใ ใใใไปฅไธใฎใปใฏใทใงใณใง่ชฌๆใใพใ๏ผ๏ผใฎใฟในใฏใฎไธไพใงใใ
+
+ใใฎใใผใธใงใฏใ๐ค Transformersใฉใคใใฉใชใไฝฟ็จใใฆใใใฃใ3่กใฎใณใผใใง่งฃๆฑบใงใใใใพใใพใช้ณๅฃฐใใใณ้ณๅฃฐใใณใณใใฅใผใฟใใธใงใณใNLPใฟในใฏใฎๆฆ่ฆใๆไพใใพใ๏ผ
+
+## Audio
+
+้ณๅฃฐใจ้ณๅฃฐๅฆ็ใฎใฟในใฏใฏใไปใฎใขใใชใใฃใจใฏๅฐใ็ฐใชใใพใใใชใใชใใๅ
ฅๅใจใใฆใฎ็ใฎ้ณๅฃฐๆณขๅฝขใฏ้ฃ็ถ็ใชไฟกๅทใงใใใใใงใใใใญในใใจใฏ็ฐใชใใ็ใฎ้ณๅฃฐๆณขๅฝขใฏๆ็ซ ใๅ่ชใซๅๅฒใงใใใใใซใใใใซๅๅฒใงใใพใใใใใใ่งฃๆฑบใใใใใซใ้ๅธธใ็ใฎ้ณๅฃฐไฟกๅทใฏๅฎๆ็ใช้้ใงใตใณใใชใณใฐใใใพใใ้้ๅ
ใงใใๅคใใฎใตใณใใซใๅใใจใใตใณใใชใณใฐใฌใผใใ้ซใใชใใ้ณๅฃฐใฏใใๅ
ใฎ้ณๅฃฐใฝใผในใซ่ฟใฅใใพใใ
+
+ไปฅๅใฎใขใใญใผใใงใฏใ้ณๅฃฐใๅๅฆ็ใใฆใใใใๆ็จใช็นๅพดใๆฝๅบใใพใใใใใใใ็พๅจใงใฏใ็ใฎ้ณๅฃฐๆณขๅฝขใ็นๅพดใจใณใณใผใใซ็ดๆฅใใฃใผใใใ้ณๅฃฐ่กจ็พใๆฝๅบใใใใจใใๅงใใใใจใไธ่ฌ็ใงใใใใใซใใใๅๅฆ็ในใใใใ็ฐก็ด ๅใใใใขใใซใฏๆใ้่ฆใช็นๅพดใๅญฆ็ฟใงใใพใใ
+
+### Audio classification
+
+้ณๅฃฐๅ้กใฏใไบๅใซๅฎ็พฉใใใใฏใฉในใฎใปใใใใ้ณๅฃฐใใผใฟใซใฉใใซใไปใใใฟในใฏใงใใใใใฏๅคใใฎๅ
ทไฝ็ใชใขใใชใฑใผใทใงใณใๅซใๅบ็ฏใชใซใใดใชใงใใใใใใคใใฎไพใฏๆฌกใฎใจใใใงใ๏ผ
+
+- ้ณ้ฟใทใผใณๅ้ก๏ผ้ณๅฃฐใซใทใผใณใฉใใซใไปใใ๏ผใใชใใฃในใใใใใผใใใใในใฟใธใขใ ใ๏ผ
+- ้ณ้ฟใคใใณใๆคๅบ๏ผ้ณๅฃฐใซ้ณๅฃฐใคใใณใใฉใใซใไปใใ๏ผใ่ปใฎใฏใฉใฏใทใงใณใใใใฏใธใฉใฎๅผใณๅฃฐใใใใฌใฉในใฎ็ ด่ฃใ๏ผ
+- ใฟใฎใณใฐ๏ผ่คๆฐใฎ้ณใๅซใ้ณๅฃฐใซใฉใใซใไปใใ๏ผ้ณฅใฎ้ณดใๅฃฐใไผ่ญฐใงใฎในใใผใซใผ่ญๅฅ๏ผ
+- ้ณๆฅฝๅ้ก๏ผ้ณๆฅฝใซใธใฃใณใซใฉใใซใไปใใ๏ผใใกใฟใซใใใใใใใใใใใใใซใณใใชใผใ๏ผ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="audio-classification", model="superb/hubert-base-superb-er")
+>>> preds = classifier("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.4532, 'label': 'hap'},
+ {'score': 0.3622, 'label': 'sad'},
+ {'score': 0.0943, 'label': 'neu'},
+ {'score': 0.0903, 'label': 'ang'}]
+```
+
+### Automatic speech recognition
+
+่ชๅ้ณๅฃฐ่ช่ญ๏ผASR๏ผใฏ้ณๅฃฐใใใญในใใซๅคๆใใพใใใใใฏใไบบ้ใฎใณใใฅใใฑใผใทใงใณใฎ่ช็ถใชๅฝขๅผใงใใ้ณๅฃฐใฎไธ้จใจใใฆใ้จๅ็ใซใใฎใใใชไธ่ฌ็ใชใชใผใใฃใชใฟในใฏใฎไธใคใงใใไปๆฅใASRใทในใใ ใฏในใใผใซใผใในใใผใใใฉใณใ่ชๅ่ปใชใฉใฎใในใใผใใใใฏใใญใธใผใใญใใฏใใซ็ตใฟ่พผใพใใฆใใพใใ็งใใกใฏไปฎๆณใขใทในใฟใณใใซ้ณๆฅฝใๅ็ใใฆใใใฃใใใใชใใคใณใใผใ่จญๅฎใใฆใใใฃใใใๅคฉๆฐใๆใใฆใใใฃใใใงใใพใใ
+
+ใใใใTransformerใขใผใญใใฏใใฃใๅฉใใไธป่ฆใช่ชฒ้กใฎไธใคใฏใไฝใชใฝใผใน่จ่ชใซใใใใใฎใงใใๅคง้ใฎ้ณๅฃฐใใผใฟใงไบๅใใฌใผใใณใฐใใไฝใชใฝใผใน่จ่ชใงใฉใใซไปใ้ณๅฃฐใใผใฟใใใใ1ๆ้ใ ใใงใใกใคใณใใฅใผใใณใฐใใใใจใงใใไปฅๅใฎASRใทในใใ ใจๆฏ่ผใใฆ้ซๅ่ณชใช็ตๆใๅพใใใจใใงใใพใใไปฅๅใฎASRใทในใใ ใฏ100ๅไปฅไธใฎใฉใใซไปใใใผใฟใงใใฌใผใใณใฐใใใฆใใพใใใใTransformerใขใผใญใใฏใใฃใฏใใฎๅ้กใซ่ฒข็ฎใใพใใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline(task="automatic-speech-recognition", model="openai/whisper-small")
+>>> transcriber("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")
+{'text': ' I have a dream that one day this nation will rise up and live out the true meaning of its creed.'}
+```
+
+
+## Computer vision
+
+ๆๅใงๅใใฆๆๅใใใณใณใใฅใผใฟใใธใงใณใฎใฟในใฏใฎไธใคใฏใ[็ณใฟ่พผใฟใใฅใผใฉใซใใใใฏใผใฏ๏ผCNN๏ผ](glossary#convolution)ใไฝฟ็จใใฆ้ตไพฟ็ชๅทใฎ็ปๅใ่ช่ญใใใใจใงใใใ็ปๅใฏใใฏใปใซใใๆงๆใใใๅใใฏใปใซใซใฏๆฐๅคใใใใพใใใใใซใใใ็ปๅใใใฏใปใซๅคใฎ่กๅใจใใฆ็ฐกๅใซ่กจ็พใงใใพใใ็นๅฎใฎใใฏใปใซๅคใฎ็ตใฟๅใใใฏใ็ปๅใฎ่ฒใ่จ่ฟฐใใพใใ
+
+ใณใณใใฅใผใฟใใธใงใณใฎใฟในใฏใ่งฃๆฑบใใไธ่ฌ็ใชๆนๆณใฏๆฌกใฎ2ใคใงใ๏ผ
+
+1. ็ณใฟ่พผใฟใไฝฟ็จใใฆใไฝใฌใใซใฎ็นๅพดใใ้ซใฌใใซใฎๆฝ่ฑก็ใชๆ
ๅ ฑใพใงใ็ปๅใฎ้ๅฑค็ใช็นๅพดใๅญฆ็ฟใใใ
+2. ็ปๅใใใใใซๅๅฒใใๅ็ปๅใใใใ็ปๅๅ
จไฝใจใฉใฎใใใซ้ข้ฃใใฆใใใใๅพใ
ใซๅญฆ็ฟใใใใใซTransformerใไฝฟ็จใใใCNNใๅฅฝใใใใ ใขใใใขใใญใผใใจใฏ็ฐใชใใใใใฏใผใใใใจใใ็ปๅใใๅงใใฆๅพใ
ใซ็ฆ็นใๅใใใใใใชใใฎใงใใ
+
+### Image classification
+
+็ปๅๅ้กใฏใไบๅใซๅฎ็พฉใใใใฏใฉในใฎใปใใใใ็ปๅๅ
จไฝใซใฉใใซใไปใใพใใๅคใใฎๅ้กใฟในใฏใจๅๆงใซใ็ปๅๅ้กใซใฏๅคใใฎๅฎ็จ็ใช็จ้ใใใใใใฎไธ้จใฏๆฌกใฎใจใใใงใ๏ผ
+
+* ๅป็๏ผ็พๆฃใฎๆคๅบใๆฃ่
ใฎๅฅๅบทใฎ็ฃ่ฆใซไฝฟ็จใใใใใซๅป็็ปๅใซใฉใใซใไปใใ
+* ็ฐๅข๏ผๆฃฎๆไผๆกใฎ็ฃ่ฆใ้็ๅฐใฎ็ฎก็ๆ
ๅ ฑใใพใใฏๅฑฑ็ซไบใฎๆคๅบใซไฝฟ็จใใใใใซ่กๆ็ปๅใซใฉใใซใไปใใ
+* ่พฒๆฅญ๏ผไฝ็ฉใฎๅฅๅบทใ็ฃ่ฆใใใใใฎไฝ็ฉใฎ็ปๅใใๅๅฐๅฉ็จใฎ็ฃ่ฆใฎใใใฎ่กๆ็ปๅใซใฉใใซใไปใใ
+* ็ๆ
ๅญฆ๏ผ้็ๅ็ฉใฎๅไฝๆฐใ็ฃ่ฆใใใใ็ตถๆป
ๅฑๆง็จฎใ่ฟฝ่ทกใใใใใซๅๆค็ฉใฎ็จฎใฎ็ปๅใซใฉใใซใไปใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="image-classification")
+>>> preds = classifier(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.4335, 'label': 'lynx, catamount'}
+{'score': 0.0348, 'label': 'cougar, puma, catamount, mountain lion, painter, panther, Felis concolor'}
+{'score': 0.0324, 'label': 'snow leopard, ounce, Panthera uncia'}
+{'score': 0.0239, 'label': 'Egyptian cat'}
+{'score': 0.0229, 'label': 'tiger cat'}
+```
+
+### Object detection
+
+็ปๅๅ้กใจใฏ็ฐใชใใใชใใธใงใฏใๆคๅบใฏ็ปๅๅ
ใฎ่คๆฐใฎใชใใธใงใฏใใ่ญๅฅใใใชใใธใงใฏใใฎไฝ็ฝฎใ็ปๅๅ
ใงๅฎ็พฉใใๅข็ใใใฏในใซใใฃใฆ็นๅฎใใพใใใชใใธใงใฏใๆคๅบใฎไพใซใฏๆฌกใฎใใใช็จ้ใใใใพใ๏ผ
+
+* ่ชๅ้่ปข่ป๏ผไปใฎ่ปไธกใๆญฉ่ก่
ใไฟกๅทๆฉใชใฉใฎๆฅๅธธใฎไบค้ใชใใธใงใฏใใๆคๅบ
+* ใชใขใผใใปใณใทใณใฐ๏ผ็ฝๅฎณใขใใฟใชใณใฐใ้ฝๅธ่จ็ปใๅคฉๅไบๆธฌ
+* ๆฌ ้ฅๆคๅบ๏ผๅปบ็ฉใฎใฏใฉใใฏใๆง้ ไธใฎๆๅทใ่ฃฝ้ ไธใฎๆฌ ้ฅใๆคๅบ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> detector = pipeline(task="object-detection")
+>>> preds = detector(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"], "box": pred["box"]} for pred in preds]
+>>> preds
+[{'score': 0.9865,
+ 'label': 'cat',
+ 'box': {'xmin': 178, 'ymin': 154, 'xmax': 882, 'ymax': 598}}]
+```
+
+### Image segmentation
+
+็ปๅใปใฐใกใณใใผใทใงใณใฏใ็ปๅๅ
ใฎใในใฆใฎใใฏใปใซใใฏใฉในใซๅฒใๅฝใฆใใใฏใปใซใฌใใซใฎใฟในใฏใงใใใใใฏใชใใธใงใฏใๆคๅบใจใฏ็ฐใชใใใชใใธใงใฏใใใฉใใซไปใใใไบๆธฌใใใใใซๅข็ใใใฏในใไฝฟ็จใใไปฃใใใซใใปใฐใกใณใใผใทใงใณใฏใใ่ฉณ็ดฐใซใชใใพใใใปใฐใกใณใใผใทใงใณใฏใใฏใปใซใฌใใซใงใชใใธใงใฏใใๆคๅบใงใใพใใ็ปๅใปใฐใกใณใใผใทใงใณใซใฏใใใคใใฎใฟใคใใใใใพใ๏ผ
+
+* ใคใณในใฟใณในใปใฐใกใณใใผใทใงใณ๏ผใชใใธใงใฏใใฎใฏใฉในใใฉใใซไปใใใใ ใใงใชใใใชใใธใงใฏใใฎๅๅฅใฎใคใณในใฟใณใน๏ผ"็ฌ-1"ใ"็ฌ-2"๏ผใใฉใใซไปใใใพใใ
+* ใใใใใฃใใฏใปใฐใกใณใใผใทใงใณ๏ผใปใใณใใฃใใฏใปใฐใกใณใใผใทใงใณใจใคใณในใฟใณในใปใฐใกใณใใผใทใงใณใฎ็ตใฟๅใใใใปใใณใใฃใใฏใฏใฉในใใจใซๅใใฏใปใซใซใฉใใซใไปใใใชใใธใงใฏใใฎๅๅฅใฎใคใณในใฟใณในใใฉใใซไปใใใพใใ
+
+ใปใฐใกใณใใผใทใงใณใฟในใฏใฏใ่ชๅ้่ปข่ปใซใจใฃใฆใๅจๅฒใฎไธ็ใฎใใฏใปใซใฌใใซใฎใใใใไฝๆใใๆญฉ่ก่
ใไปใฎ่ปไธกใๅฎๅ
จใซๅ้ฟใงใใใใใซใใใฎใซๅฝน็ซใกใพใใใพใใๅป็็ปๅใงใฏใใฟในใฏใฎ็ดฐใใ็ฒๅบฆใ็ฐๅธธใช็ดฐ่ใ่ๅจใฎ็นๅพดใ่ญๅฅใใใฎใซๅฝน็ซใกใพใใ็ปๅใปใฐใกใณใใผใทใงใณใฏใeใณใใผในใง่กฃ้กใไปฎๆณ็ใซ่ฉฆ็ใใใใใซใกใฉใ้ใใฆๅฎไธ็ใซใชใใธใงใฏใใ้ใญใฆๆกๅผต็พๅฎใฎไฝ้จใไฝๆใใใใใใใใซใไฝฟ็จใงใใพใใ
+
+
+
+```py
+>>> from transformers import pipeline
+
+>>> segmenter = pipeline(task="image-segmentation")
+>>> preds = segmenter(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> print(*preds, sep="\n")
+{'score': 0.9879, 'label': 'LABEL_184'}
+{'score': 0.9973, 'label': 'snow'}
+{'score': 0.9972, 'label': 'cat'}
+```
+
+### Depth estimation
+
+ๆทฑๅบฆๆจๅฎใฏใ็ปๅๅ
ใฎๅใใฏใปใซใใซใกใฉใใใฎ่ท้ขใไบๆธฌใใพใใใใฎใณใณใใฅใผใฟใใธใงใณใฟในใฏใฏใ็นใซใทใผใณใฎ็่งฃใจๅๆง็ฏใซ้่ฆใงใใใใจใใฐใ่ชๅ้่ปข่ปใงใฏใๆญฉ่ก่
ใไบค้ๆจ่ญใไปใฎ่ปใชใฉใฎ็ฉไฝใใฉใใ ใ้ ใใใ็่งฃใใ้ๅฎณ็ฉใ่ก็ชใๅ้ฟใใใใใซๅฟ
่ฆใงใใๆทฑๅบฆๆ
ๅ ฑใฏใพใใ2D็ปๅใใ3D่กจ็พใๆง็ฏใใ็็ฉๅญฆ็ๆง้ ใๅปบ็ฉใฎ้ซๅ่ณชใช3D่กจ็พใไฝๆใใใฎใซๅฝน็ซใกใพใใ
+
+ๆทฑๅบฆๆจๅฎใซใฏๆฌกใฎ2ใคใฎใขใใญใผใใใใใพใ๏ผ
+
+* ในใใฌใช๏ผๆทฑๅบฆใฏใใใใใซ็ฐใชใ่งๅบฆใใใฎๅใ็ปๅใฎ2ใคใฎ็ปๅใๆฏ่ผใใฆๆจๅฎใใใพใใ
+* ใขใใญใฅใฉใผ๏ผๆทฑๅบฆใฏๅไธใฎ็ปๅใใๆจๅฎใใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> depth_estimator = pipeline(task="depth-estimation")
+>>> preds = depth_estimator(
+... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
+... )
+```
+
+
+## Natural language processing
+
+NLPใฟในใฏใฏใใใญในใใ็งใใกใซใจใฃใฆ่ช็ถใชใณใใฅใใฑใผใทใงใณๆๆฎตใงใใใใใๆใไธ่ฌ็ใชใฟในใฏใฎไธใคใงใใใขใใซใ่ช่ญใใใใใฎๅฝขๅผใซใใญในใใๅคๆใใใซใฏใใใผใฏใณๅใๅฟ
่ฆใงใใใใใฏใใใญในใใฎใทใผใฑใณในใๅ่ชใใตใใฏใผใ๏ผใใผใฏใณ๏ผใซๅๅฒใใใใใใฎใใผใฏใณใๆฐๅญใซๅคๆใใใใจใๆๅณใใพใใใใฎ็ตๆใใใญในใใฎใทใผใฑใณในใๆฐๅญใฎใทใผใฑใณในใจใใฆ่กจ็พใใไธๅบฆๆฐๅญใฎใทใผใฑใณในใใใใฐใใใพใใพใชNLPใฟในใฏใ่งฃๆฑบใใใใใซใขใใซใซๅ
ฅๅใงใใพใ๏ผ
+
+### Text classification
+
+ใฉใใชใขใใชใใฃใฎๅ้กใฟในใฏใจๅๆงใซใใใญในใๅ้กใฏไบๅใซๅฎ็พฉใใใใฏใฉในใฎใปใใใใใใญในใใฎใทใผใฑใณใน๏ผๆใฌใใซใๆฎต่ฝใใพใใฏใใญใฅใกใณใใงใใใใจใใใใพใ๏ผใซใฉใใซใไปใใพใใใใญในใๅ้กใซใฏๅคใใฎๅฎ็จ็ใช็จ้ใใใใใใฎไธ้จใฏๆฌกใฎใจใใใงใ๏ผ
+
+* ๆๆ
ๅๆ๏ผ`positive`ใ`negative`ใฎใใใชๆฅตๆงใซๅพใฃใฆใใญในใใซใฉใใซใไปใใๆฟๆฒปใ้่ใใใผใฑใใฃใณใฐใชใฉใฎๅ้ใงใฎๆๆๆฑบๅฎใใตใใผใใใพใใ
+* ใณใณใใณใๅ้ก๏ผใใญในใใใใใใฏใซๅพใฃใฆใฉใใซไปใใใใใฅใผในใใฝใผใทใฃใซใกใใฃใขใฎใใฃใผใๅ
ใฎๆ
ๅ ฑใๆด็ใใใใฃใซใฟใชใณใฐใใใฎใซๅฝน็ซใกใพใ๏ผ`ๅคฉๆฐ`ใ`ในใใผใ`ใ`้่`ใชใฉ๏ผใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="sentiment-analysis")
+>>> preds = classifier("Hugging Face is the best thing since sliced bread!")
+>>> preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
+>>> preds
+[{'score': 0.9991, 'label': 'POSITIVE'}]
+```
+
+### Token classification
+
+ใฉใใชNLPใฟในใฏใงใใใใญในใใฏใใญในใใฎใทใผใฑใณในใๅใ
ใฎๅ่ชใใตใใฏใผใใซๅๅฒใใฆๅๅฆ็ใใใพใใใใใใฏ[ใใผใฏใณ](/glossary#token)ใจใใฆ็ฅใใใฆใใพใใใใผใฏใณๅ้กใฏใไบๅใซๅฎ็พฉใใใใฏใฉในใฎใปใใใใๅใใผใฏใณใซใฉใใซใๅฒใๅฝใฆใพใใ
+
+ใใผใฏใณๅ้กใฎไธ่ฌ็ใชใฟใคใใฏๆฌกใฎ2ใคใงใ๏ผ
+
+* ๅบๆ่กจ็พ่ช่ญ๏ผNER๏ผ๏ผ็ต็นใไบบ็ฉใๅ ดๆใๆฅไปใชใฉใฎใจใณใใฃใใฃใฎใซใใดใชใซๅพใฃใฆใใผใฏใณใซใฉใใซใไปใใพใใNERใฏ็นใซใใคใชใกใใฃใซใซ็ฐๅขใงไบบๆฐใงใใใ้บไผๅญใใฟใณใใฏ่ณชใ่ฌ็ฉๅใชใฉใใฉใใซไปใใงใใพใใ
+* ๅ่ฉใฟใฐไปใ๏ผPOS๏ผ๏ผๅ่ฉใๅ่ฉใๅฝขๅฎน่ฉใชใฉใฎๅ่ฉใซๅพใฃใฆใใผใฏใณใซใฉใใซใไปใใพใใPOSใฏใ็ฟป่จณใทในใใ ใๅใๅ่ชใๆๆณ็ใซใฉใฎใใใซ็ฐใชใใใ็่งฃใใใฎใซๅฝน็ซใกใพใ๏ผๅ่ฉใจใใฆใฎใ้่กใใจๅ่ฉใจใใฆใฎใ้่กใใชใฉ๏ผใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline(task="ner")
+>>> preds = classifier("Hugging Face is a French company based in New York City.")
+>>> preds = [
+... {
+... "entity": pred["entity"],
+... "score": round(pred["score"], 4),
+... "index": pred["index"],
+... "word": pred["word"],
+... "start": pred["start"],
+... "end": pred["end"],
+... }
+... for pred in preds
+... ]
+>>> print(*preds, sep="\n")
+{'entity': 'I-ORG', 'score': 0.9968, 'index': 1, 'word': 'Hu', 'start': 0, 'end': 2}
+{'entity': 'I-ORG', 'score': 0.9293, 'index': 2, 'word': '##gging', 'start': 2, 'end': 7}
+{'entity': 'I-ORG', 'score': 0.9763, 'index': 3, 'word': 'Face', 'start': 8, 'end': 12}
+{'entity': 'I-MISC', 'score': 0.9983, 'index': 6, 'word': 'French', 'start': 18, 'end': 24}
+{'entity': 'I-LOC', 'score': 0.999, 'index': 10, 'word': 'New', 'start': 42, 'end': 45}
+{'entity': 'I-LOC', 'score': 0.9987, 'index': 11, 'word': 'York', 'start': 46, 'end': 50}
+{'entity': 'I-LOC', 'score': 0.9992, 'index': 12, 'word': 'City', 'start': 51, 'end': 55}
+```
+
+### Question answering
+
+่ณชๅๅฟ็ญใฏใใณใณใใญในใ๏ผใชใผใใณใใกใคใณ๏ผใๅซใๅ ดๅใจๅซใพใชใๅ ดๅ๏ผใฏใญใผใบใใใกใคใณ๏ผใใใๅ ดๅใใใใๅฅใฎใใผใฏใณใฌใใซใฎใฟในใฏใงใ่ณชๅใซๅฏพใใๅ็ญใ่ฟใใพใใใใฎใฟในใฏใฏใไปฎๆณใขใทในใฟใณใใซใฌในใใฉใณใๅถๆฅญใใฆใใใใฉใใใฎใใใช่ณชๅใใใใจใใซ็บ็ใใพใใใพใใ้กงๅฎขใๆ่กใตใใผใใๆไพใใๆค็ดขใจใณใธใณใใใชใใๆฑใใฆใใ้ข้ฃๆ
ๅ ฑใๅๅพใใใฎใซใๅฝน็ซใกใพใใ
+
+่ณชๅๅฟ็ญใฎไธ่ฌ็ใชใฟใคใใฏๆฌกใฎ2ใคใงใ๏ผ
+
+* ๆฝๅบๅ๏ผ่ณชๅใจไธ้จใฎใณใณใใญในใใไธใใใใๅ ดๅใใขใใซใใณใณใใญในใใใๆฝๅบใใๅฟ
่ฆใฎใใใใญในใใฎในใใณใๅ็ญใจใชใใพใใ
+* ๆฝ่ฑก็๏ผ่ณชๅใจไธ้จใฎใณใณใใญในใใไธใใใใๅ ดๅใๅ็ญใฏใณใณใใญในใใใ็ๆใใใพใใใใฎใขใใญใผใใฏใ[`QuestionAnsweringPipeline`]ใงใฏใชใ[`Text2TextGenerationPipeline`]ใงๅฆ็ใใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> question_answerer = pipeline(task="question-answering")
+>>> preds = question_answerer(
+... question="What is the name of the repository?",
+... context="The name of the repository is huggingface/transformers",
+... )
+>>> print(
+... f"score: {round(preds['score'], 4)}, start: {preds['start']}, end: {preds['end']}, answer: {preds['answer']}"
+... )
+score: 0.9327, start: 30, end: 54, answer: huggingface/transformers
+```
+
+### Summarization
+
+่ฆ็ดใฏใ้ทใใใญในใใใ็ญใใใผใธใงใณใไฝๆใใๅ
ใฎๆๆธใฎๆๅณใฎๅคง้จๅใไฟใกใชใใ่ฉฆใฟใใฟในใฏใงใใ่ฆ็ดใฏใทใผใฑใณในใใใทใผใฑใณในใธใฎใฟในใฏใงใใใๅ
ฅๅใใใ็ญใใใญในใใทใผใฑใณในใๅบๅใใพใใ่ฆ็ดใ่กใใใจใงใ่ชญ่
ใไธป่ฆใชใใคใณใใ่ฟ
้ใซ็่งฃใงใใใใใซใใใฎใซๅฝน็ซใค้ทๆๆธใใใใใใใใพใใๆณๆกใๆณ็ใใใณ่ฒกๅๆๆธใ็น่จฑใ็งๅญฆ่ซๆใชใฉใ่ชญ่
ใฎๆ้ใ็ฏ็ดใ่ชญๆธใฎๆฏๆดใจใชใๆๆธใฎไพใใใใพใใ
+
+่ณชๅๅฟ็ญใจๅๆงใซใ่ฆ็ดใซใฏ2ใคใฎใฟใคใใใใใพใ๏ผ
+
+* ๆฝๅบ็่ฆ็ด๏ผๅ
ใฎใใญในใใใๆใ้่ฆใชๆใ่ญๅฅใใฆๆฝๅบใใพใใ
+* ๆฝ่ฑก็่ฆ็ด๏ผๅ
ใฎใใญในใใใใฟใผใฒใใใฎ่ฆ็ด๏ผๅ
ฅๅๆๆธใซๅซใพใใฆใใชใๆฐใใๅ่ชใๅซใใใจใใใใพใ๏ผใ็ๆใใพใใ[`SummarizationPipeline`]ใฏๆฝ่ฑก็ใชใขใใญใผใใไฝฟ็จใใฆใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> summarizer = pipeline(task="summarization")
+>>> summarizer(
+... "In this work, we presented the Transformer, the first sequence transduction model based entirely on attention, replacing the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention. For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers. On both WMT 2014 English-to-German and WMT 2014 English-to-French translation tasks, we achieve a new state of the art. In the former task our best model outperforms even all previously reported ensembles."
+... )
+[{'summary_text': ' The Transformer is the first sequence transduction model based entirely on attention . It replaces the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention . For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers .'}]
+```
+
+### Translation
+
+็ฟป่จณใฏใใใ่จ่ชใฎใใญในใใทใผใฑใณในใๅฅใฎ่จ่ชใซๅคๆใใไฝๆฅญใงใใใใใฏ็ฐใชใใใใฏใฐใฉใฆใณใใๆใคไบบใ
ใใณใใฅใใฑใผใทใงใณใใจใใฎใซๅฝน็ซใกใๅบ็ฏใช่ฆณๅฎขใซใณใณใใณใใ็ฟป่จณใใฆไผใใใฎใซๅฝน็ซใกใๆฐใใ่จ่ชใๅญฆใถใฎใๆฏๆดใใๅญฆ็ฟใใผใซใซใใชใใพใใ่ฆ็ดใจๅ
ฑใซใ็ฟป่จณใฏใทใผใฑใณใน้ใฎใฟในใฏใงใใใใขใใซใฏๅ
ฅๅใทใผใฑใณในใๅใๅใใใฟใผใฒใใใฎๅบๅใทใผใฑใณในใ่ฟใใพใใ
+
+ๅๆใฎ็ฟป่จณใขใใซใฏไธปใซๅไธ่จ่ชใงใใใใๆ่ฟใงใฏๅค่จ่ชใขใใซใซๅฏพใใ้ขๅฟใ้ซใพใใๅคใใฎ่จ่ชๅฏพใง็ฟป่จณใงใใใใใชๅค่จ่ชใขใใซใซๆณจ็ฎใ้ใพใฃใฆใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> text = "translate English to French: Hugging Face is a community-based open-source platform for machine learning."
+>>> translator = pipeline(task="translation", model="google-t5/t5-small")
+>>> translator(text)
+[{'translation_text': "Hugging Face est une tribune communautaire de l'apprentissage des machines."}]
+```
+
+### ่จ่ชใขใใชใณใฐ
+
+่จ่ชใขใใชใณใฐใฏใใใญในใใฎใทใผใฑใณในๅ
ใฎๅ่ชใไบๆธฌใใใฟในใฏใงใใไบๅๅญฆ็ฟใใใ่จ่ชใขใใซใฏใๅคใใฎไปใฎใใฆใณในใใชใผใ ใฟในใฏใซๅฏพใใฆใใกใคใณใใฅใผใใณใฐใงใใใใใ้ๅธธใซไบบๆฐใฎใใNLPใฟในใฏใจใชใฃใฆใใพใใๆ่ฟใงใฏใใผใญใทใงใใใพใใฏใใฅใผใทใงใใๅญฆ็ฟใๅฎ่จผใใๅคง่ฆๆจกใช่จ่ชใขใใซ๏ผLLM๏ผใซๅคงใใช้ขๅฟใๅฏใใใใฆใใพใใใใใฏใใขใใซใๆ็คบ็ใซใใฌใผใใณใฐใใใฆใใชใใฟในใฏใ่งฃๆฑบใงใใใใจใๆๅณใใพใ๏ผ่จ่ชใขใใซใฏใๆตๆขใง่ชฌๅพๅใฎใใใใญในใใ็ๆใใใใใซไฝฟ็จใงใใพใใใใใญในใใๅธธใซๆญฃ็ขบใงใใใใใงใฏใชใใใใๆณจๆใๅฟ
่ฆใงใใ
+
+่จ่ชใขใใชใณใฐใซใฏ2ใคใฎใฟใคใใใใใพใ๏ผ
+
+* ๅ ๆ็๏ผใขใใซใฎ็ฎๆจใฏใใทใผใฑใณในๅ
ใฎๆฌกใฎใใผใฏใณใไบๆธฌใใใใจใงใใใๅฐๆฅใฎใใผใฏใณใฏใในใฏใใใพใใ
+
+ ```py
+ >>> from transformers import pipeline
+
+ >>> prompt = "Hugging Face is a community-based open-source platform for machine learning."
+ >>> generator = pipeline(task="text-generation")
+ >>> generator(prompt) # doctest: +SKIP
+ ```
+
+* ใในใฏใใใ๏ผใขใใซใฎ็ฎ็ใฏใใทใผใฑใณในๅ
ใฎใใผใฏใณๅ
จไฝใซใขใฏใปในใใชใใใใทใผใฑใณในๅ
ใฎใในใฏใใใใใผใฏใณใไบๆธฌใใใใจใงใใ
+
+ ```py
+ >>> text = "Hugging Face is a community-based open-source for machine learning."
+ >>> fill_mask = pipeline(task="fill-mask")
+ >>> preds = fill_mask(text, top_k=1)
+ >>> preds = [
+ ... {
+ ... "score": round(pred["score"], 4),
+ ... "token": pred["token"],
+ ... "token_str": pred["token_str"],
+ ... "sequence": pred["sequence"],
+ ... }
+ ... for pred in preds
+ ... ]
+ >>> preds
+ [{'score': 0.2236,
+ 'token': 1761,
+ 'token_str': ' platform',
+ 'sequence': 'Hugging Face is a community-based open-source platform for machine learning.'}]
+ ```
+
+## Multimodal
+
+ใใซใใขใผใใซใฟในใฏใฏใ็นๅฎใฎๅ้กใ่งฃๆฑบใใใใใซ่คๆฐใฎใใผใฟใขใใชใใฃ๏ผใใญในใใ็ปๅใ้ณๅฃฐใใใใช๏ผใๅฆ็ใใใใใซใขใใซใๅฟ
่ฆใจใใพใใ็ปๅใญใฃใใทใงใใณใฐใฏใใขใใซใๅ
ฅๅใจใใฆ็ปๅใๅใๅใใ็ปๅใ่ชฌๆใใใใญในใใฎใทใผใฑใณในใพใใฏ็ปๅใฎใใใคใใฎ็นๆงใๅบๅใใใใซใใขใผใใซใฟในใฏใฎไพใงใใ
+
+ใใซใใขใผใใซใขใใซใฏ็ฐใชใใใผใฟใฟใคใใพใใฏใขใใชใใฃใงไฝๆฅญใใพใใใๅ
้จ็ใซใฏๅๅฆ็ในใใใใใขใใซใซใในใฆใฎใใผใฟใฟใคใใๅใ่พผใฟ๏ผใใผใฟใซ้ขใใๆๅณใฎใใๆ
ๅ ฑใไฟๆใใใใฏใใซใพใใฏๆฐๅญใฎใชในใ๏ผใซๅคๆใใใฎใๆฏๆดใใพใใ็ปๅใญใฃใใทใงใใณใฐใฎใใใชใฟในใฏใงใฏใใขใใซใฏ็ปๅใฎๅใ่พผใฟใจใใญในใใฎๅใ่พผใฟใฎ้ใฎ้ขไฟใๅญฆ็ฟใใพใใ
+
+### Document question answering
+
+ใใญใฅใกใณใ่ณชๅๅฟ็ญใฏใใใญใฅใกใณใใใใฎ่ช็ถ่จ่ชใฎ่ณชๅใซ็ญใใใฟในใฏใงใใใใญในใใๅ
ฅๅใจใใใใผใฏใณใฌใใซใฎ่ณชๅๅฟ็ญใฟในใฏใจใฏ็ฐใชใใใใญใฅใกใณใ่ณชๅๅฟ็ญใฏใใญใฅใกใณใใฎ็ปๅใจใใฎใใญใฅใกใณใใซ้ขใใ่ณชๅใๅใๅใใ็ญใใ่ฟใใพใใใใญใฅใกใณใ่ณชๅๅฟ็ญใฏๆง้ ๅใใใใใญใฅใกใณใใ่งฃๆใใใใใใ้่ฆใชๆ
ๅ ฑใๆฝๅบใใใใใซไฝฟ็จใงใใพใใไปฅไธใฎไพใงใฏใใฌใทใผใใใๅ่จ้้กใจใ้ฃใใๆฝๅบใใใใจใใงใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://huggingface.co/datasets/hf-internal-testing/example-documents/resolve/main/jpeg_images/2.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> doc_question_answerer = pipeline("document-question-answering", model="magorshunov/layoutlm-invoices")
+>>> preds = doc_question_answerer(
+... question="What is the total amount?",
+... image=image,
+... )
+>>> preds
+[{'score': 0.8531, 'answer': '17,000', 'start': 4, 'end': 4}]
+```
+
+ใใฎใใผใธใๅใขใใชใใฃใฎใฟในใฏใฎ็จฎ้กใจใใใใใฎ้่ฆๆงใซใคใใฆใฎ่ฟฝๅ ใฎ่ๆฏๆ
ๅ ฑใๆไพใงใใใใจใ้กใฃใฆใใพใใๆฌกใฎ [ใปใฏใทใงใณ](tasks_explained) ใงใฏใ๐ค ใใฉใณในใใฉใผใใผใใใใใฎใฟในใฏใ่งฃๆฑบใใใใใซ **ใฉใฎใใใซ** ๅไฝใใใใๅญฆใณใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/asr.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/asr.md
new file mode 100644
index 0000000000000000000000000000000000000000..ebefeba831a03e823ae57fd4f0c3f3aa127d5c64
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/asr.md
@@ -0,0 +1,375 @@
+
+
+# Automatic speech recognition
+
+[[open-in-colab]]
+
+
+
+่ชๅ้ณๅฃฐ่ช่ญ (ASR) ใฏ้ณๅฃฐไฟกๅทใใใญในใใซๅคๆใใไธ้ฃใฎ้ณๅฃฐๅ
ฅๅใใใญในใๅบๅใซใใใใณใฐใใพใใ Siri ใ Alexa ใชใฉใฎไปฎๆณใขใทในใฟใณใใฏ ASR ใขใใซใไฝฟ็จใใฆใฆใผใถใผใๆฅๅธธ็ใซๆฏๆดใใฆใใใใฉใคใใญใฃใใทใงใณใไผ่ญฐไธญใฎใกใขๅใใชใฉใไปใซใไพฟๅฉใชใฆใผใถใผๅใใขใใชใฑใผใทใงใณใๆฐๅคใใใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) ใใผใฟใปใใใฎ [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base) ใๅพฎ่ชฟๆดใใฆใ้ณๅฃฐใใใญในใใซๆธใ่ตทใใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/automatic-speech-recognition) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate jiwer
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load MInDS-14 dataset
+
+ใพใใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) ใใผใฟใปใใใฎๅฐใใใตใใปใใใใญใผใใใพใใใใใซใใใๅฎๅ
จใชใใผใฟใปใใใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใๅพใใใพใใ
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> minds = load_dataset("PolyAI/minds14", name="en-US", split="train[:100]")
+```
+
+[`~Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train` ๅๅฒใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+```py
+>>> minds = minds.train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใใใผใฟใปใใใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> minds
+DatasetDict({
+ train: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 16
+ })
+ test: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 4
+ })
+})
+```
+
+ใใผใฟใปใใใซใฏ`lang_id`ใ`english_transcription`ใชใฉใฎๅคใใฎๆ็จใชๆ
ๅ ฑใๅซใพใใฆใใพใใใใใฎใฌใคใใงใฏใ`audio`ใใจใ`transciption`ใใซ็ฆ็นใๅฝใฆใพใใ [`~datasets.Dataset.remove_columns`] ใกใฝใใใไฝฟ็จใใฆไปใฎๅใๅ้คใใพใใ
+
+```py
+>>> minds = minds.remove_columns(["english_transcription", "intent_class", "lang_id"])
+```
+
+ใใไธๅบฆไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> minds["train"][0]
+{'audio': {'array': array([-0.00024414, 0. , 0. , ..., 0.00024414,
+ 0.00024414, 0.00024414], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'sampling_rate': 8000},
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'transcription': "hi I'm trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing"}
+```
+
+ๆฌกใฎ 2 ใคใฎใใฃใผใซใใใใใพใใ
+
+- `audio`: ้ณๅฃฐใใกใคใซใใญใผใใใฆใชใตใณใใชใณใฐใใใใใซๅผใณๅบใๅฟ
่ฆใใใ้ณๅฃฐไฟกๅทใฎ 1 ๆฌกๅ
ใฎ `array`ใ
+- `transcription`: ใฟใผใฒใใใใญในใใ
+
+## Preprocess
+
+ๆฌกใฎในใใใใงใฏใWav2Vec2 ใใญใปใใตใใญใผใใใฆใชใผใใฃใชไฟกๅทใๅฆ็ใใพใใ
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("facebook/wav2vec2-base")
+```
+
+MInDS-14 ใใผใฟใปใใใฎใตใณใใชใณใฐ ใฌใผใใฏ 8000kHz ใงใ (ใใฎๆ
ๅ ฑใฏ [ใใผใฟใปใใ ใซใผใ](https://huggingface.co/datasets/PolyAI/minds14) ใง็ขบ่ชใงใใพใ)ใใคใพใใใใผใฟใปใใใๅใตใณใใชใณใฐใใๅฟ
่ฆใใใใพใใไบๅใใฌใผใใณใฐใใใ Wav2Vec2 ใขใใซใไฝฟ็จใใใซใฏใ16000kHz ใซ่จญๅฎใใพใใ
+
+```py
+>>> minds = minds.cast_column("audio", Audio(sampling_rate=16_000))
+>>> minds["train"][0]
+{'audio': {'array': array([-2.38064706e-04, -1.58618059e-04, -5.43987835e-06, ...,
+ 2.78103951e-04, 2.38446111e-04, 1.18740834e-04], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'sampling_rate': 16000},
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602ba9e2963e11ccd901cd4f.wav',
+ 'transcription': "hi I'm trying to use the banking app on my phone and currently my checking and savings account balance is not refreshing"}
+```
+
+ไธใฎ `transcription` ใงใใใใใใซใใใญในใใซใฏๅคงๆๅญใจๅฐๆๅญใๆททๅจใใฆใใพใใ Wav2Vec2 ใใผใฏใใคใถใผใฏๅคงๆๅญใฎใฟใงใใฌใผใใณใฐใใใใใใใใญในใใใใผใฏใใคใถใผใฎ่ชๅฝใจไธ่ดใใใใจใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> def uppercase(example):
+... return {"transcription": example["transcription"].upper()}
+
+
+>>> minds = minds.map(uppercase)
+```
+
+ๆฌกใซใๆฌกใฎๅๅฆ็้ขๆฐใไฝๆใใพใใ
+
+1. `audio`ๅใๅผใณๅบใใฆใใชใผใใฃใช ใใกใคใซใใญใผใใใฆใชใตใณใใชใณใฐใใพใใ
+2. ใชใผใใฃใช ใใกใคใซใใ `input_values` ใๆฝๅบใใใใญใปใใตใไฝฟ็จใใฆ `transcription` ๅใใใผใฏใณๅใใพใใ
+
+```py
+>>> def prepare_dataset(batch):
+... audio = batch["audio"]
+... batch = processor(audio["array"], sampling_rate=audio["sampling_rate"], text=batch["transcription"])
+... batch["input_length"] = len(batch["input_values"][0])
+... return batch
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ้ขๆฐใไฝฟ็จใใพใใ `num_proc` ใใฉใกใผใฟใไฝฟ็จใใฆใใญใปในใฎๆฐใๅขใใใใจใงใ`map` ใ้ซ้ๅใงใใพใใ [`~datasets.Dataset.remove_columns`] ใกใฝใใใไฝฟ็จใใฆใไธ่ฆใชๅใๅ้คใใพใใ
+
+```py
+>>> encoded_minds = minds.map(prepare_dataset, remove_columns=minds.column_names["train"], num_proc=4)
+```
+
+๐ค Transformers ใซใฏ ASR ็จใฎใใผใฟ็
งๅๅจใใชใใใใ[`DataCollatโโorWithPadding`] ใ่ชฟๆดใใฆใตใณใใซใฎใใใใไฝๆใใๅฟ
่ฆใใใใพใใใพใใใใญในใใจใฉใใซใ (ใใผใฟใปใใๅ
จไฝใงใฏใชใ) ใใใๅ
ใฎๆใ้ทใ่ฆ็ด ใฎ้ทใใซๅใใใฆๅ็ใซๅใ่พผใพใใๅไธใช้ทใใซใชใใพใใ `padding=True` ใ่จญๅฎใใใจใ`tokenizer` ้ขๆฐใงใใญในใใๅใ่พผใใใจใใงใใพใใใๅ็ใชๅใ่พผใฟใฎๆนใๅน็็ใงใใ
+
+ไปใฎใใผใฟ็
งๅๅจใจใฏ็ฐใชใใใใฎ็นๅฎใฎใใผใฟ็
งๅๅจใฏใ`input_values`ใจ `labels`ใใซ็ฐใชใใใใฃใณใฐๆนๆณใ้ฉ็จใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> import torch
+
+>>> from dataclasses import dataclass, field
+>>> from typing import Any, Dict, List, Optional, Union
+
+
+>>> @dataclass
+... class DataCollatorCTCWithPadding:
+... processor: AutoProcessor
+... padding: Union[bool, str] = "longest"
+
+... def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:
+... # split inputs and labels since they have to be of different lengths and need
+... # different padding methods
+... input_features = [{"input_values": feature["input_values"][0]} for feature in features]
+... label_features = [{"input_ids": feature["labels"]} for feature in features]
+
+... batch = self.processor.pad(input_features, padding=self.padding, return_tensors="pt")
+
+... labels_batch = self.processor.pad(labels=label_features, padding=self.padding, return_tensors="pt")
+
+... # replace padding with -100 to ignore loss correctly
+... labels = labels_batch["input_ids"].masked_fill(labels_batch.attention_mask.ne(1), -100)
+
+... batch["labels"] = labels
+
+... return batch
+```
+
+ๆฌกใซใ`DataCollatโโorForCTCWithPadding` ใใคใณในใฟใณในๅใใพใใ
+
+```py
+>>> data_collator = DataCollatorCTCWithPadding(processor=processor, padding="longest")
+```
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[ๅ่ชใจใฉใผ็](https://huggingface.co/spaces/evaluate-metric/wer) (WER) ใกใใชใฏในใ่ชญใฟ่พผใฟใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใกใใชใฏในใใญใผใใใฆ่จ็ฎใใๆนๆณใฎ่ฉณ็ดฐใ็ขบ่ชใใฆใใ ใใ)ใ
+
+```py
+>>> import evaluate
+
+>>> wer = evaluate.load("wer")
+```
+
+ๆฌกใซใไบๆธฌใจใฉใใซใ [`~evaluate.EvaluationModule.compute`] ใซๆธกใใฆ WER ใ่จ็ฎใใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(pred):
+... pred_logits = pred.predictions
+... pred_ids = np.argmax(pred_logits, axis=-1)
+
+... pred.label_ids[pred.label_ids == -100] = processor.tokenizer.pad_token_id
+
+... pred_str = processor.batch_decode(pred_ids)
+... label_str = processor.batch_decode(pred.label_ids, group_tokens=False)
+
+... wer = wer.compute(predictions=pred_str, references=label_str)
+
+... return {"wer": wer}
+```
+
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForCTC`] ใง Wav2Vec2 ใใญใผใใใพใใ `ctc_loss_reduction` ใใฉใกใผใฟใง้ฉ็จใใๅๆธใๆๅฎใใพใใๅคใใฎๅ ดๅใใใใฉใซใใฎๅ่จใงใฏใชใๅนณๅใไฝฟ็จใใๆนใ้ฉๅใงใใ
+
+```py
+>>> from transformers import AutoModelForCTC, TrainingArguments, Trainer
+
+>>> model = AutoModelForCTC.from_pretrained(
+... "facebook/wav2vec2-base",
+... ctc_loss_reduction="mean",
+... pad_token_id=processor.tokenizer.pad_token_id,
+... )
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`ใใฌใผใใผ`] ใฏ WER ใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_asr_mind_model",
+... per_device_train_batch_size=8,
+... gradient_accumulation_steps=2,
+... learning_rate=1e-5,
+... warmup_steps=500,
+... max_steps=2000,
+... gradient_checkpointing=True,
+... fp16=True,
+... group_by_length=True,
+... eval_strategy="steps",
+... per_device_eval_batch_size=8,
+... save_steps=1000,
+... eval_steps=1000,
+... logging_steps=25,
+... load_best_model_at_end=True,
+... metric_for_best_model="wer",
+... greater_is_better=False,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=encoded_minds["train"],
+... eval_dataset=encoded_minds["test"],
+... processing_class=processor,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+
+่ชๅ้ณๅฃฐ่ช่ญ็จใซใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎใใ่ฉณ็ดฐใชไพใซใคใใฆใฏใ่ฑ่ช ASR ใใใณ่ฑ่ชใฎใใฎใใญใฐ [ๆ็จฟ](https://huggingface.co/blog/fine-tune-wav2vec2-english) ใๅ็
งใใฆใใ ใใใๅค่จ่ช ASR ใซใคใใฆใฏใใใฎ [ๆ็จฟ](https://huggingface.co/blog/fine-tune-xlsr-wav2vec2) ใๅ็
งใใฆใใ ใใใ
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๆจ่ซใๅฎ่กใใใ้ณๅฃฐใใกใคใซใใญใผใใใพใใๅฟ
่ฆใซๅฟใใฆใใชใผใใฃใช ใใกใคใซใฎใตใณใใชใณใฐ ใฌใผใใใขใใซใฎใตใณใใชใณใฐ ใฌใผใใจไธ่ดใใใใใซใชใตใณใใชใณใฐใใใใจใๅฟใใชใใงใใ ใใใ
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", "en-US", split="train")
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
+>>> sampling_rate = dataset.features["audio"].sampling_rate
+>>> audio_file = dataset[0]["audio"]["path"]
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ่ชๅ้ณๅฃฐ่ช่ญ็จใฎ`pipeline`ใใคใณในใฟใณในๅใใใชใผใใฃใช ใใกใคใซใใใใซๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> transcriber = pipeline("automatic-speech-recognition", model="stevhliu/my_awesome_asr_minds_model")
+>>> transcriber(audio_file)
+{'text': 'I WOUD LIKE O SET UP JOINT ACOUNT WTH Y PARTNER'}
+```
+
+
+
+่ปขๅใฏใพใใพใใงใใใใใฃใจ่ฏใใชใๅฏ่ฝๆงใใใใพใใใใใซ่ฏใ็ตๆใๅพใใซใฏใใใๅคใใฎไพใงใขใใซใๅพฎ่ชฟๆดใใฆใฟใฆใใ ใใใ
+
+
+
+ๅฟ
่ฆใซๅฟใใฆใใใใคใใฉใคใณใใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+
+
+
+ใใญใปใใตใใญใผใใใฆใชใผใใฃใช ใใกใคใซใจๆๅญ่ตทใใใๅๅฆ็ใใ`input`ใ PyTorch ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("stevhliu/my_awesome_asr_mind_model")
+>>> inputs = processor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
+```
+
+Pass your inputs to the model and return the logits:
+
+```py
+>>> from transformers import AutoModelForCTC
+
+>>> model = AutoModelForCTC.from_pretrained("stevhliu/my_awesome_asr_mind_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+ๆใ้ซใ็ขบ็ใงไบๆธฌใใใ `input_ids` ใๅๅพใใใใญใปใใตใไฝฟ็จใใฆไบๆธฌใใใ `input_ids` ใใใณใผใใใฆใใญในใใซๆปใใพใใ
+
+
+```py
+>>> import torch
+
+>>> predicted_ids = torch.argmax(logits, dim=-1)
+>>> transcription = processor.batch_decode(predicted_ids)
+>>> transcription
+['I WOUL LIKE O SET UP JOINT ACOUNT WTH Y PARTNER']
+```
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/audio_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/audio_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..3b33d1b6043d782137c4ba0ec45b5acf2fd343ca
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/audio_classification.md
@@ -0,0 +1,323 @@
+
+
+# Audio classification
+
+[[open-in-colab]]
+
+
+
+
+้ณๅฃฐๅ้กใงใฏใใใญในใใจๅๆงใซใๅ
ฅๅใใผใฟใใๅบๅใใใใฏใฉใน ใฉใใซใๅฒใๅฝใฆใพใใๅฏไธใฎ้ใใฏใใใญในใๅ
ฅๅใฎไปฃใใใซ็ใฎใชใผใใฃใชๆณขๅฝขใใใใใจใงใใ้ณๅฃฐๅ้กใฎๅฎ้็ใชๅฟ็จไพใซใฏใ่ฉฑ่
ใฎๆๅณใ่จ่ชๅ้กใใใใซใฏ้ณใซใใๅ็ฉใฎ็จฎ้กใฎ่ญๅฅใชใฉใใใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [MInDS-14](https://huggingface.co/datasets/PolyAI/minds14) ใใผใฟใปใใใง [Wav2Vec2](https://huggingface.co/facebook/wav2vec2-base) ใๅพฎ่ชฟๆดใใฆ่ฉฑ่
ใฎๆๅณใๅ้กใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/audio-classification) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+```bash
+pip install transformers datasets evaluate
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load MInDS-14 dataset
+
+ใพใใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ MInDS-14 ใใผใฟใปใใใใญใผใใใพใใ
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> minds = load_dataset("PolyAI/minds14", name="en-US", split="train")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train` ใใใๅฐใใชใใฌใคใณใจใในใ ใปใใใซๅๅฒใใพใใใใใซใใใๅฎๅ
จใชใใผใฟใปใใใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใๅพใใใพใใ
+
+```py
+>>> minds = minds.train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใใใผใฟใปใใใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> minds
+DatasetDict({
+ train: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 450
+ })
+ test: Dataset({
+ features: ['path', 'audio', 'transcription', 'english_transcription', 'intent_class', 'lang_id'],
+ num_rows: 113
+ })
+})
+```
+
+
+ใใผใฟใปใใใซใฏ`lang_id`ใ`english_transcription`ใชใฉใฎๅคใใฎๆ็จใชๆ
ๅ ฑใๅซใพใใฆใใพใใใใใฎใฌใคใใงใฏ`audio`ใจ`intent_class`ใซ็ฆ็นใๅฝใฆใพใใ [`~datasets.Dataset.remove_columns`] ใกใฝใใใไฝฟ็จใใฆไปใฎๅใๅ้คใใพใใ
+
+```py
+>>> minds = minds.remove_columns(["path", "transcription", "english_transcription", "lang_id"])
+```
+
+ใใใงไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> minds["train"][0]
+{'audio': {'array': array([ 0. , 0. , 0. , ..., -0.00048828,
+ -0.00024414, -0.00024414], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602b9a5fbb1e6d0fbce91f52.wav',
+ 'sampling_rate': 8000},
+ 'intent_class': 2}
+```
+
+ๆฌกใฎ 2 ใคใฎใใฃใผใซใใใใใพใใ
+
+- `audio`: ้ณๅฃฐใใกใคใซใใญใผใใใฆใชใตใณใใชใณใฐใใใใใซๅผใณๅบใๅฟ
่ฆใใใ้ณๅฃฐไฟกๅทใฎ 1 ๆฌกๅ
ใฎ `array`ใ
+- `intent_class`: ในใใผใซใผใฎใคใณใใณใใฎใฏใฉใน ID ใ่กจใใพใใ
+
+ใขใใซใใฉใใซ ID ใใใฉใใซๅใๅๅพใใใใใใใใใซใใฉใใซๅใๆดๆฐใซใใพใใฏใใฎ้ใซใใใใใ่พๆธใไฝๆใใพใใ
+
+```py
+>>> labels = minds["train"].features["intent_class"].names
+>>> label2id, id2label = dict(), dict()
+>>> for i, label in enumerate(labels):
+... label2id[label] = str(i)
+... id2label[str(i)] = label
+```
+
+ใใใงใใฉใใซ ID ใใฉใใซๅใซๅคๆใงใใใใใซใชใใพใใใ
+
+```py
+>>> id2label[str(2)]
+'app_error'
+```
+
+## Preprocess
+
+ๆฌกใฎในใใใใงใฏใWav2Vec2 ็นๅพดๆฝๅบใใญใฐใฉใ ใใญใผใใใฆใชใผใใฃใชไฟกๅทใๅฆ็ใใพใใ
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("facebook/wav2vec2-base")
+```
+
+MInDS-14 ใใผใฟใปใใใฎใตใณใใชใณใฐ ใฌใผใใฏ 8khz ใงใ (ใใฎๆ
ๅ ฑใฏ [ใใผใฟใปใใ ใซใผใ](https://huggingface.co/datasets/PolyAI/minds14) ใง็ขบ่ชใงใใพใ)ใใคใพใใใใผใฟใปใใใๅใตใณใใชใณใฐใใๅฟ
่ฆใใใใพใใไบๅใใฌใผใใณใฐใใใ Wav2Vec2 ใขใใซใไฝฟ็จใใใซใฏใ16kHz ใซ่จญๅฎใใพใใ
+
+```py
+>>> minds = minds.cast_column("audio", Audio(sampling_rate=16_000))
+>>> minds["train"][0]
+{'audio': {'array': array([ 2.2098757e-05, 4.6582241e-05, -2.2803260e-05, ...,
+ -2.8419291e-04, -2.3305941e-04, -1.1425107e-04], dtype=float32),
+ 'path': '/root/.cache/huggingface/datasets/downloads/extracted/f14948e0e84be638dd7943ac36518a4cf3324e8b7aa331c5ab11541518e9368c/en-US~APP_ERROR/602b9a5fbb1e6d0fbce91f52.wav',
+ 'sampling_rate': 16000},
+ 'intent_class': 2}
+```
+
+ๆฌกใซใๆฌกใฎๅๅฆ็้ขๆฐใไฝๆใใพใใ
+
+1. `audio`ๅใๅผใณๅบใใฆใญใผใใใๅฟ
่ฆใซๅฟใใฆใชใผใใฃใช ใใกใคใซใใชใตใณใใชใณใฐใใพใใ
+2. ใชใผใใฃใช ใใกใคใซใฎใตใณใใชใณใฐ ใฌใผใใใใขใใซใไบๅใใฌใผใใณใฐใใใใชใผใใฃใช ใใผใฟใฎใตใณใใชใณใฐ ใฌใผใใจไธ่ดใใใใฉใใใ็ขบ่ชใใพใใใใฎๆ
ๅ ฑใฏใWav2Vec2 [ใขใใซ ใซใผใ](https://huggingface.co/facebook/wav2vec2-base) ใง่ฆใคใใใใจใใงใใพใใ
+3. ๅ
ฅๅใฎๆๅคง้ทใ่จญๅฎใใฆใ้ทใๅ
ฅๅใๅใๆจใฆใใซใใใๅฆ็ใใพใใ
+
+```py
+>>> def preprocess_function(examples):
+... audio_arrays = [x["array"] for x in examples["audio"]]
+... inputs = feature_extractor(
+... audio_arrays, sampling_rate=feature_extractor.sampling_rate, max_length=16000, truncation=True
+... )
+... return inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ้ขๆฐใไฝฟ็จใใพใใ `batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใใใจใงใ`map` ใ้ซ้ๅใงใใพใใไธ่ฆใชๅใๅ้คใใ`intent_class` ใฎๅๅใ `label` ใซๅคๆดใใพใใใใใฏใขใใซใๆๅพ
ใใๅๅใงใใใใใงใใ
+
+```py
+>>> encoded_minds = minds.map(preprocess_function, remove_columns="audio", batched=True)
+>>> encoded_minds = encoded_minds.rename_column("intent_class", "label")
+```
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[accuracy](https://huggingface.co/spaces/evaluate-metric/accuracy) ใกใใชใฏในใ่ชญใฟ่พผใฟใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใ ใใ) ใกใใชใฏในใฎ่ชญใฟ่พผใฟใจ่จ็ฎๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใๆฌกใๅ็
งใใฆใใ ใใใ
+
+```py
+>>> import evaluate
+
+>>> accuracy = evaluate.load("accuracy")
+```
+
+ๆฌกใซใไบๆธฌใจใฉใใซใ [`~evaluate.EvaluationModule.compute`] ใซๆธกใใฆ็ฒพๅบฆใ่จ็ฎใใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions = np.argmax(eval_pred.predictions, axis=1)
+... return accuracy.compute(predictions=predictions, references=eval_pred.label_ids)
+```
+
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForAudioClassification`] ใไฝฟ็จใใฆใไบๆใใใใฉใใซใฎๆฐใจใฉใใซ ใใใใณใฐใไฝฟ็จใใฆ Wav2Vec2 ใ่ชญใฟ่พผใฟใพใใ
+
+```py
+>>> from transformers import AutoModelForAudioClassification, TrainingArguments, Trainer
+
+>>> num_labels = len(id2label)
+>>> model = AutoModelForAudioClassification.from_pretrained(
+... "facebook/wav2vec2-base", num_labels=num_labels, label2id=label2id, id2label=id2label
+... )
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`ใใฌใผใใผ`] ใฏ็ฒพๅบฆใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_mind_model",
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... learning_rate=3e-5,
+... per_device_train_batch_size=32,
+... gradient_accumulation_steps=4,
+... per_device_eval_batch_size=32,
+... num_train_epochs=10,
+... warmup_ratio=0.1,
+... logging_steps=10,
+... load_best_model_at_end=True,
+... metric_for_best_model="accuracy",
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=encoded_minds["train"],
+... eval_dataset=encoded_minds["test"],
+... processing_class=feature_extractor,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+้ณๅฃฐๅ้ก็จใฎใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใ [PyTorch notebook](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/audio_classification.ipynb).
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๆจ่ซใๅฎ่กใใใ้ณๅฃฐใใกใคใซใใญใผใใใพใใๅฟ
่ฆใซๅฟใใฆใใชใผใใฃใช ใใกใคใซใฎใตใณใใชใณใฐ ใฌใผใใใขใใซใฎใตใณใใชใณใฐ ใฌใผใใจไธ่ดใใใใใซใชใตใณใใชใณใฐใใใใจใๅฟใใชใใงใใ ใใใ
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
+>>> dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
+>>> sampling_rate = dataset.features["audio"].sampling_rate
+>>> audio_file = dataset[0]["audio"]["path"]
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ้ณๅฃฐๅ้ก็จใฎ`pipeline`ใใคใณในใฟใณในๅใใใใใซ้ณๅฃฐใใกใคใซใๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("audio-classification", model="stevhliu/my_awesome_minds_model")
+>>> classifier(audio_file)
+[
+ {'score': 0.09766869246959686, 'label': 'cash_deposit'},
+ {'score': 0.07998877018690109, 'label': 'app_error'},
+ {'score': 0.0781070664525032, 'label': 'joint_account'},
+ {'score': 0.07667109370231628, 'label': 'pay_bill'},
+ {'score': 0.0755252093076706, 'label': 'balance'}
+]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline` ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+
+
+
+็นๅพดๆฝๅบๅจใใญใผใใใฆใชใผใใฃใช ใใกใคใซใๅๅฆ็ใใ`input`ใ PyTorch ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained("stevhliu/my_awesome_minds_model")
+>>> inputs = feature_extractor(dataset[0]["audio"]["array"], sampling_rate=sampling_rate, return_tensors="pt")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใใญใธใใใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoModelForAudioClassification
+
+>>> model = AutoModelForAudioClassification.from_pretrained("stevhliu/my_awesome_minds_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+ๆใ้ซใ็ขบ็ใงใฏใฉในใๅๅพใใใขใใซใฎ `id2label` ใใใใณใฐใไฝฟ็จใใฆใใใใฉใใซใซๅคๆใใพใใ
+
+```py
+>>> import torch
+
+>>> predicted_class_ids = torch.argmax(logits).item()
+>>> predicted_label = model.config.id2label[predicted_class_ids]
+>>> predicted_label
+'cash_deposit'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/document_question_answering.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/document_question_answering.md
new file mode 100644
index 0000000000000000000000000000000000000000..f07cc6dff28eae20f29a950e6389591a390b9d79
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/document_question_answering.md
@@ -0,0 +1,495 @@
+
+
+# Document Question Answering
+
+[[open-in-colab]]
+
+ๆๆธใซใใ่ณชๅๅฟ็ญใฏใๆๆธใซใใ่ฆ่ฆ็ใช่ณชๅๅฟ็ญใจใๅผใฐใใไปฅไธใๆไพใใใฟในใฏใงใใ
+ใใญใฅใกใณใ็ปๅใซ้ขใใ่ณชๅใธใฎๅ็ญใใใฎใฟในใฏใใตใใผใใใใขใใซใธใฎๅ
ฅๅใฏ้ๅธธใ็ปๅใจ็ปๅใฎ็ตใฟๅใใใงใใ
+่ณชๅใใใใๅบๅใฏ่ช็ถ่จ่ชใง่กจ็พใใใๅ็ญใงใใใใใใฎใขใใซใฏใไปฅไธใๅซใ่คๆฐใฎใขใใชใใฃใๅฉ็จใใพใใ
+ใใญในใใๅ่ชใฎไฝ็ฝฎ (ๅข็ใใใฏใน)ใใใใณ็ปๅ่ชไฝใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+- [DocVQA ใใผใฟใปใใ](https://huggingface.co/datasets/nielsr/docvqa_1200_examples_donut) ใฎ [LayoutLMv2](../model_doc/layoutlmv2) ใๅพฎ่ชฟๆดใใพใใ
+- ๅพฎ่ชฟๆดใใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/image-to-text) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+LayoutLMv2 ใฏใๆๅพใฎ้่กจ็คบใฎใใใใผใฎไธใซ่ณชๅๅฟ็ญใใใใ่ฟฝๅ ใใใใจใงใใใญใฅใกใณใใฎ่ณชๅๅฟ็ญใฟในใฏใ่งฃๆฑบใใพใใ
+ใใผใฏใณใฎ็ถๆ
ใ่ชฟในใฆใใใผใฏใณใฎ้ๅงใใผใฏใณใจ็ตไบใใผใฏใณใฎไฝ็ฝฎใไบๆธฌใใพใใ
+็ญใใ่จใๆใใใฐใๅ้กใฏๆฝๅบ็่ณชๅๅฟ็ญใจใใฆๆฑใใใพใใใคใพใใใณใณใใญในใใ่ๆ
ฎใใฆใใฉใฎ้จๅใๆฝๅบใใใใจใใใใจใงใใ
+ใฎๆ
ๅ ฑใ่ณชๅใซ็ญใใพใใใณใณใใญในใใฏ OCR ใจใณใธใณใฎๅบๅใใๅๅพใใใพใใใใใงใฏ Google ใฎ Tesseract ใงใใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ LayoutLMv2 ใฏ detectron2ใtorchvisionใtesseract ใซไพๅญใใพใใ
+
+```bash
+pip install -q transformers datasets
+```
+
+```bash
+pip install 'git+https://github.com/facebookresearch/detectron2.git'
+pip install torchvision
+```
+
+```bash
+sudo apt install tesseract-ocr
+pip install -q pytesseract
+```
+
+ใในใฆใฎไพๅญ้ขไฟใใคใณในใใผใซใใใใใฉใณใฟใคใ ใๅ่ตทๅใใพใใ
+
+ใขใใซใใณใใฅใใใฃใจๅ
ฑๆใใใใจใใๅงใใใพใใ Hugging Face ใขใซใฆใณใใซใญใฐใคใณใใฆใ๐ค ใใใซใขใใใญใผใใใพใใ
+ใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+ใใใคใใฎใฐใญใผใใซๅคๆฐใๅฎ็พฉใใพใใใใ
+
+```py
+>>> model_checkpoint = "microsoft/layoutlmv2-base-uncased"
+>>> batch_size = 4
+```
+
+## Load the data
+
+ใใฎใฌใคใใงใฏใ๐ค Hub ใซใใๅๅฆ็ใใใ DocVQA ใฎๅฐใใชใตใณใใซใไฝฟ็จใใพใใใใซใซไฝฟใใใๅ ดๅใฏใ
+DocVQA ใใผใฟใปใใใฏใ[DocVQA ใใผใ ใใผใธ](https://rrc.cvc.uab.es/?ch=17) ใง็ป้ฒใใฆใใฆใณใญใผใใงใใพใใใใใใใฐใ
+ใใฎใฌใคใใ้ฒใใฆใ[๐ค ใใผใฟใปใใใซใใกใคใซใใญใผใใใๆนๆณ](https://huggingface.co/docs/datasets/loading#local-and-remote-files) ใ็ขบ่ชใใฆใใ ใใใ
+
+
+```py
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("nielsr/docvqa_1200_examples")
+>>> dataset
+DatasetDict({
+ train: Dataset({
+ features: ['id', 'image', 'query', 'answers', 'words', 'bounding_boxes', 'answer'],
+ num_rows: 1000
+ })
+ test: Dataset({
+ features: ['id', 'image', 'query', 'answers', 'words', 'bounding_boxes', 'answer'],
+ num_rows: 200
+ })
+})
+```
+
+ใ่ฆงใฎใจใใใใใผใฟใปใใใฏใใงใซใใฌใผใใณใฐ ใปใใใจใในใ ใปใใใซๅๅฒใใใฆใใพใใ็่งฃใใใใใซใฉใณใใ ใชไพใ่ฆใฆใฟใพใใใ
+ๆฉ่ฝใๅใใ่ชๅ่ช่บซใ
+
+```py
+>>> dataset["train"].features
+```
+
+ๅใ
ใฎใใฃใผใซใใ่กจใๅ
ๅฎนใฏๆฌกใฎใจใใใงใใ
+* `id`: ใตใณใใซใฎID
+* `image`: ใใญใฅใกใณใ็ปๅใๅซใ PIL.Image.Image ใชใใธใงใฏใ
+* `query`: ่ณชๅๆๅญๅ - ใใใคใใฎ่จ่ชใงใฎ่ช็ถ่จ่ชใซใใ่ณชๅ
+* `answers`: ใใฅใผใใณ ใขใใใผใฟใผใซใใฃใฆๆไพใใใๆญฃ่งฃใฎใชในใ
+* `words` ใจ `bounding_boxes`: OCR ใฎ็ตๆใใใใงใฏไฝฟ็จใใพใใใ
+* `answer`: ๅฅใฎใขใใซใจไธ่ดใใ็ญใใใใใงใฏไฝฟ็จใใพใใใ
+
+่ฑ่ชใฎ่ณชๅใ ใใๆฎใใๅฅใฎใขใใซใซใใไบๆธฌใๅซใพใใฆใใใจๆใใใ`answer`ๆฉ่ฝใๅ้คใใพใใใใ
+ใพใใใขใใใผใฟใผใซใใฃใฆๆไพใใใใปใใใใๆๅใฎๅ็ญใๅๅพใใพใใใใใใฏใใฉใณใใ ใซใตใณใใชใณใฐใใใใจใใงใใพใใ
+
+```py
+>>> updated_dataset = dataset.map(lambda example: {"question": example["query"]["en"]}, remove_columns=["query"])
+>>> updated_dataset = updated_dataset.map(
+... lambda example: {"answer": example["answers"][0]}, remove_columns=["answer", "answers"]
+... )
+```
+
+ใใฎใฌใคใใงไฝฟ็จใใ LayoutLMv2 ใใงใใฏใใคใณใใฏใ`max_position_embeddings = 512` ใงใใฌใผใใณใฐใใใฆใใใใจใซๆณจๆใใฆใใ ใใ (
+ใใฎๆ
ๅ ฑใฏใ[ใใงใใฏใใคใณใใฎ `config.json` ใใกใคใซ](https://huggingface.co/microsoft/layoutlmv2-base-uncased/blob/main/config.json#L18)) ใง่ฆใคใใฆใใ ใใใ
+ไพใ็็ฅใใใใจใใงใใพใใใ็ญใใๅคงใใชๆๆธใฎๆๅพใซใใใ็ตๅฑ็็ฅใใใฆใใพใใจใใ็ถๆณใ้ฟใใใใใซใ
+ใใใงใฏใๅใ่พผใฟใ 512 ใ่ถ
ใใๅฏ่ฝๆงใใใใใใคใใฎไพใๅ้คใใพใใ
+ใใผใฟใปใใๅ
ใฎใปใจใใฉใฎใใญใฅใกใณใใ้ทใๅ ดๅใฏใในใฉใคใใฃใณใฐ ใฆใฃใณใใฆๆฆ็ฅใๅฎ่ฃ
ใงใใพใใ่ฉณ็ดฐใซใคใใฆใฏใ[ใใฎใใผใใใใฏ](https://github.com/huggingface/notebooks/blob/main/examples/question_answering.ipynb) ใ็ขบ่ชใใฆใใ ใใใ ใ
+
+```py
+>>> updated_dataset = updated_dataset.filter(lambda x: len(x["words"]) + len(x["question"].split()) < 512)
+```
+
+ใใฎๆ็นใงใใใฎใใผใฟใปใใใใ OCR ๆฉ่ฝใๅ้คใใพใใใใใใใใฏใ็ฐใชใใใผใฟใๅพฎ่ชฟๆดใใใใใฎ OCR ใฎ็ตๆใงใใ
+ใขใใซใใใใใฏๅ
ฅๅ่ฆไปถใจไธ่ดใใชใใใใไฝฟ็จใใใๅ ดๅใฏใใใซๅฆ็ใๅฟ
่ฆใซใชใใพใใ
+ใใฎใฌใคใใงไฝฟ็จใใใขใใซใฎใไปฃใใใซใOCR ใจ OCR ใฎไธกๆนใฎๅ
ใฎใใผใฟใซๅฏพใใฆ [`LayoutLMv2Processor`] ใไฝฟ็จใงใใพใใ
+ใใผใฏใณๅใใใฎใใใซใใฆใใขใใซใฎไบๆณใใใๅ
ฅๅใจไธ่ดใใๅ
ฅๅใๅๅพใใพใใ็ปๅใๆๅใงๅ ๅทฅใใใๅ ดๅใฏใ
+ใขใใซใใฉใฎใใใชๅ
ฅๅๅฝขๅผใๆณๅฎใใฆใใใใ็ฅใใซใฏใ[`LayoutLMv2` ใขใใซใฎใใญใฅใกใณใ](../model_doc/layoutlmv2) ใ็ขบ่ชใใฆใใ ใใใ
+
+```py
+>>> updated_dataset = updated_dataset.remove_columns("words")
+>>> updated_dataset = updated_dataset.remove_columns("bounding_boxes")
+```
+
+ๆๅพใซใ็ปๅใตใณใใซใ็ขบ่ชใใชใใจใใผใฟๆข็ดขใฏๅฎไบใใพใใใ
+
+
+```py
+>>> updated_dataset["train"][11]["image"]
+```
+
+
+
+
+
+## Preprocess the data
+
+ๆๆธใฎ่ณชๅใซ็ญใใใฟในใฏใฏใใซใใขใผใใซ ใฟในใฏใงใใใใใๅใขใใชใใฃใใใฎๅ
ฅๅใ็ขบๅฎใซ่กใใใใใใซใใๅฟ
่ฆใใใใพใใ
+ใขใใซใฎๆๅพ
ใซๅพใฃใฆๅๅฆ็ใใใพใใใพใใ[`LayoutLMv2Processor`] ใใญใผใใใพใใใใใฏใ็ปๅใใผใฟใๅฆ็ใงใใ็ปๅใใญใปใใตใจใใญในใ ใใผใฟใใจใณใณใผใใงใใใใผใฏใใคใถใผใๅ
้จใง็ตใฟๅใใใฆใใพใใ
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained(model_checkpoint)
+```
+
+### Preprocessing document images
+
+ใพใใใใญใปใใตใใใฎ `image_processor` ใๅฉ็จใใฆใใขใใซใฎใใญใฅใกใณใ็ปๅใๆบๅใใพใใใใ
+ใใใฉใซใใงใฏใ็ปๅใใญใปใใตใฏ็ปๅใฎใตใคใบใ 224x224 ใซๅคๆดใใใซใฉใผ ใใฃใใซใฎ้ ๅบใๆญฃใใใใจใ็ขบ่ชใใพใใ
+tesseract ใไฝฟ็จใใฆ OCR ใ้ฉ็จใใๅ่ชใจๆญฃ่ฆๅใใใๅข็ใใใฏในใๅๅพใใพใใใใฎใใฅใผใใชใขใซใงใฏใใใใใฎใใใฉใซใใฏใในใฆใใพใใซๅฟ
่ฆใชใใฎใงใใ
+ใใใฉใซใใฎ็ปๅๅฆ็ใ็ปๅใฎใใใใซ้ฉ็จใใOCR ใฎ็ตๆใ่ฟใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> image_processor = processor.image_processor
+
+
+>>> def get_ocr_words_and_boxes(examples):
+... images = [image.convert("RGB") for image in examples["image"]]
+... encoded_inputs = image_processor(images)
+
+... examples["image"] = encoded_inputs.pixel_values
+... examples["words"] = encoded_inputs.words
+... examples["boxes"] = encoded_inputs.boxes
+
+... return examples
+```
+
+ใใฎๅๅฆ็ใใใผใฟใปใใๅ
จไฝใซ้ซ้ใซ้ฉ็จใใใซใฏใ[`~datasets.Dataset.map`] ใไฝฟ็จใใพใใ
+
+```py
+>>> dataset_with_ocr = updated_dataset.map(get_ocr_words_and_boxes, batched=True, batch_size=2)
+```
+
+### Preprocessing text data
+
+็ปๅใซ OCR ใ้ฉ็จใใใใใใผใฟใปใใใฎใใญในใ้จๅใใจใณใณใผใใใฆใขใใซ็จใซๆบๅใใๅฟ
่ฆใใใใพใใ
+ใใใซใฏใๅใฎในใใใใงๅๅพใใๅ่ชใจใใใฏในใใใผใฏใณใฌใใซใฎ `input_ids`ใ`attention_mask`ใ
+`token_type_ids`ใจ`bbox`ใใใญในใใๅๅฆ็ใใใซใฏใใใญใปใใตใใใฎ`Tokenizer`ใๅฟ
่ฆใซใชใใพใใ
+
+```py
+>>> tokenizer = processor.tokenizer
+```
+
+ๅ่ฟฐใฎๅๅฆ็ใซๅ ใใฆใใขใใซใฎใฉใใซใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ `xxxForQuestionAnswering` ใขใใซใฎๅ ดๅ
+๐ค Transformers ใงใฏใใฉใใซใฏ `start_positions` ใจ `end_positions` ใงๆงๆใใใใฉใฎใใผใฏใณใใใฎไฝ็ฝฎใซใใใใ็คบใใพใใ
+้ๅง็นใจใใฉใฎใใผใฏใณใๅ็ญใฎๆๅพใซใใใใ
+
+ใใใใๅงใใพใใใใใใๅคงใใชใชในใ (ๅ่ชใชในใ) ๅ
ใฎใตใใชในใ (ๅ่ชใซๅๅฒใใใๅ็ญ) ใๆค็ดขใงใใใใซใใผ้ขๆฐใๅฎ็พฉใใพใใ
+
+ใใฎ้ขๆฐใฏใ`words_list` ใจ `answer_list` ใจใใ 2 ใคใฎใชในใใๅ
ฅๅใจใใฆๅใๅใใพใใๆฌกใซใ`words_list`ใๅๅพฉๅฆ็ใใฆใใงใใฏใใพใใ
+`words_list` (words_list[i]) ๅ
ใฎ็พๅจใฎๅ่ชใใanswer_list (answer_list[0]) ใฎๆๅใฎๅ่ชใจ็ญใใใใฉใใใใใใณ
+็พๅจใฎๅ่ชใใๅงใพใใ`answer_list` ใจๅใ้ทใใฎ `words_list` ใฎใตใใชในใใฏใ`to answer_list` ใจ็ญใใใชใใพใใ
+ใใฎๆกไปถใ true ใฎๅ ดๅใไธ่ดใ่ฆใคใใฃใใใจใๆๅณใใ้ขๆฐใฏไธ่ดใจใใฎ้ๅงใคใณใใใฏใน (idx) ใ่จ้ฒใใพใใ
+ใจใใฎ็ตไบใคใณใใใฏใน (idx + len(answer_list) - 1)ใ่คๆฐใฎไธ่ดใ่ฆใคใใฃใๅ ดๅใ้ขๆฐใฏๆๅใฎใใฎใฎใฟใ่ฟใใพใใ
+ไธ่ดใใใใฎใ่ฆใคใใใชใๅ ดๅใ้ขๆฐใฏ (`None`ใ0ใใใใณ 0) ใ่ฟใใพใใ
+
+```py
+>>> def subfinder(words_list, answer_list):
+... matches = []
+... start_indices = []
+... end_indices = []
+... for idx, i in enumerate(range(len(words_list))):
+... if words_list[i] == answer_list[0] and words_list[i : i + len(answer_list)] == answer_list:
+... matches.append(answer_list)
+... start_indices.append(idx)
+... end_indices.append(idx + len(answer_list) - 1)
+... if matches:
+... return matches[0], start_indices[0], end_indices[0]
+... else:
+... return None, 0, 0
+```
+
+ใใฎ้ขๆฐใ็ญใใฎไฝ็ฝฎใ่ฆใคใใๆนๆณใ่ชฌๆใใใใใซใไพใงไฝฟ็จใใฆใฟใพใใใใ
+
+```py
+>>> example = dataset_with_ocr["train"][1]
+>>> words = [word.lower() for word in example["words"]]
+>>> match, word_idx_start, word_idx_end = subfinder(words, example["answer"].lower().split())
+>>> print("Question: ", example["question"])
+>>> print("Words:", words)
+>>> print("Answer: ", example["answer"])
+>>> print("start_index", word_idx_start)
+>>> print("end_index", word_idx_end)
+Question: Who is in cc in this letter?
+Words: ['wie', 'baw', 'brown', '&', 'williamson', 'tobacco', 'corporation', 'research', '&', 'development', 'internal', 'correspondence', 'to:', 'r.', 'h.', 'honeycutt', 'ce:', 't.f.', 'riehl', 'from:', '.', 'c.j.', 'cook', 'date:', 'may', '8,', '1995', 'subject:', 'review', 'of', 'existing', 'brainstorming', 'ideas/483', 'the', 'major', 'function', 'of', 'the', 'product', 'innovation', 'graup', 'is', 'to', 'develop', 'marketable', 'nove!', 'products', 'that', 'would', 'be', 'profitable', 'to', 'manufacture', 'and', 'sell.', 'novel', 'is', 'defined', 'as:', 'of', 'a', 'new', 'kind,', 'or', 'different', 'from', 'anything', 'seen', 'or', 'known', 'before.', 'innovation', 'is', 'defined', 'as:', 'something', 'new', 'or', 'different', 'introduced;', 'act', 'of', 'innovating;', 'introduction', 'of', 'new', 'things', 'or', 'methods.', 'the', 'products', 'may', 'incorporate', 'the', 'latest', 'technologies,', 'materials', 'and', 'know-how', 'available', 'to', 'give', 'then', 'a', 'unique', 'taste', 'or', 'look.', 'the', 'first', 'task', 'of', 'the', 'product', 'innovation', 'group', 'was', 'to', 'assemble,', 'review', 'and', 'categorize', 'a', 'list', 'of', 'existing', 'brainstorming', 'ideas.', 'ideas', 'were', 'grouped', 'into', 'two', 'major', 'categories', 'labeled', 'appearance', 'and', 'taste/aroma.', 'these', 'categories', 'are', 'used', 'for', 'novel', 'products', 'that', 'may', 'differ', 'from', 'a', 'visual', 'and/or', 'taste/aroma', 'point', 'of', 'view', 'compared', 'to', 'canventional', 'cigarettes.', 'other', 'categories', 'include', 'a', 'combination', 'of', 'the', 'above,', 'filters,', 'packaging', 'and', 'brand', 'extensions.', 'appearance', 'this', 'category', 'is', 'used', 'for', 'novel', 'cigarette', 'constructions', 'that', 'yield', 'visually', 'different', 'products', 'with', 'minimal', 'changes', 'in', 'smoke', 'chemistry', 'two', 'cigarettes', 'in', 'cne.', 'emulti-plug', 'te', 'build', 'yaur', 'awn', 'cigarette.', 'eswitchable', 'menthol', 'or', 'non', 'menthol', 'cigarette.', '*cigarettes', 'with', 'interspaced', 'perforations', 'to', 'enable', 'smoker', 'to', 'separate', 'unburned', 'section', 'for', 'future', 'smoking.', 'ยซshort', 'cigarette,', 'tobacco', 'section', '30', 'mm.', 'ยซextremely', 'fast', 'buming', 'cigarette.', 'ยซnovel', 'cigarette', 'constructions', 'that', 'permit', 'a', 'significant', 'reduction', 'iretobacco', 'weight', 'while', 'maintaining', 'smoking', 'mechanics', 'and', 'visual', 'characteristics.', 'higher', 'basis', 'weight', 'paper:', 'potential', 'reduction', 'in', 'tobacco', 'weight.', 'ยซmore', 'rigid', 'tobacco', 'column;', 'stiffing', 'agent', 'for', 'tobacco;', 'e.g.', 'starch', '*colored', 'tow', 'and', 'cigarette', 'papers;', 'seasonal', 'promotions,', 'e.g.', 'pastel', 'colored', 'cigarettes', 'for', 'easter', 'or', 'in', 'an', 'ebony', 'and', 'ivory', 'brand', 'containing', 'a', 'mixture', 'of', 'all', 'black', '(black', 'paper', 'and', 'tow)', 'and', 'ail', 'white', 'cigarettes.', '499150498']
+Answer: T.F. Riehl
+start_index 17
+end_index 18
+```
+
+ใใ ใใใตใณใใซใใจใณใณใผใใใใใจใๆฌกใฎใใใซใชใใพใใ
+
+```py
+>>> encoding = tokenizer(example["question"], example["words"], example["boxes"])
+>>> tokenizer.decode(encoding["input_ids"])
+[CLS] who is in cc in this letter? [SEP] wie baw brown & williamson tobacco corporation research & development ...
+```
+
+ใจใณใณใผใใใใๅ
ฅๅๅ
ใง็ญใใฎไฝ็ฝฎใ่ฆใคใใๅฟ
่ฆใใใใพใใ
+* `token_type_ids` ใฏใใฉใฎใใผใฏใณใ่ณชๅใฎไธ้จใงใใใใฉใฎใใผใฏใณใๆๆธใฎๅ่ชใฎไธ้จใงใใใใ็คบใใพใใ
+* `tokenizer.cls_token_id` ใฏใๅ
ฅๅใฎๅ
้ ญใง็นๅฅใชใใผใฏใณใ่ฆใคใใใฎใซๅฝน็ซใกใพใใ
+* `word_ids` ใฏใๅ
ใฎ `words` ใง่ฆใคใใฃใๅ็ญใใๅฎๅ
จใซใจใณใณใผใใใใๅ
ฅๅๅ
ใฎๅใๅ็ญใจ็
งๅใใฆๅคๆญใใใฎใซๅฝน็ซใกใพใใ
+ใจใณใณใผใใใใๅ
ฅๅๅ
ใฎๅฟ็ญใฎ้ๅง/็ตไบไฝ็ฝฎใ
+
+ใใใๅฟต้ ญใซ็ฝฎใใฆใใใผใฟใปใใๅ
ใฎใตใณใใซใฎใใใใใจใณใณใผใใใ้ขๆฐใไฝๆใใพใใใใ
+
+
+```py
+>>> def encode_dataset(examples, max_length=512):
+... questions = examples["question"]
+... words = examples["words"]
+... boxes = examples["boxes"]
+... answers = examples["answer"]
+
+... # encode the batch of examples and initialize the start_positions and end_positions
+... encoding = tokenizer(questions, words, boxes, max_length=max_length, padding="max_length", truncation=True)
+... start_positions = []
+... end_positions = []
+
+... # loop through the examples in the batch
+... for i in range(len(questions)):
+... cls_index = encoding["input_ids"][i].index(tokenizer.cls_token_id)
+
+... # find the position of the answer in example's words
+... words_example = [word.lower() for word in words[i]]
+... answer = answers[i]
+... match, word_idx_start, word_idx_end = subfinder(words_example, answer.lower().split())
+
+... if match:
+... # if match is found, use `token_type_ids` to find where words start in the encoding
+... token_type_ids = encoding["token_type_ids"][i]
+... token_start_index = 0
+... while token_type_ids[token_start_index] != 1:
+... token_start_index += 1
+
+... token_end_index = len(encoding["input_ids"][i]) - 1
+... while token_type_ids[token_end_index] != 1:
+... token_end_index -= 1
+
+... word_ids = encoding.word_ids(i)[token_start_index : token_end_index + 1]
+... start_position = cls_index
+... end_position = cls_index
+
+... # loop over word_ids and increase `token_start_index` until it matches the answer position in words
+... # once it matches, save the `token_start_index` as the `start_position` of the answer in the encoding
+... for id in word_ids:
+... if id == word_idx_start:
+... start_position = token_start_index
+... else:
+... token_start_index += 1
+
+... # similarly loop over `word_ids` starting from the end to find the `end_position` of the answer
+... for id in word_ids[::-1]:
+... if id == word_idx_end:
+... end_position = token_end_index
+... else:
+... token_end_index -= 1
+
+... start_positions.append(start_position)
+... end_positions.append(end_position)
+
+... else:
+... start_positions.append(cls_index)
+... end_positions.append(cls_index)
+
+... encoding["image"] = examples["image"]
+... encoding["start_positions"] = start_positions
+... encoding["end_positions"] = end_positions
+
+... return encoding
+```
+
+ใใฎๅๅฆ็้ขๆฐใๅฎๆใใใฎใงใใใผใฟใปใใๅ
จไฝใใจใณใณใผใใงใใพใใ
+
+```py
+>>> encoded_train_dataset = dataset_with_ocr["train"].map(
+... encode_dataset, batched=True, batch_size=2, remove_columns=dataset_with_ocr["train"].column_names
+... )
+>>> encoded_test_dataset = dataset_with_ocr["test"].map(
+... encode_dataset, batched=True, batch_size=2, remove_columns=dataset_with_ocr["test"].column_names
+... )
+```
+
+ใจใณใณใผใใใใใใผใฟใปใใใฎ็นๅพดใใฉใฎใใใชใใฎใใ็ขบ่ชใใฆใฟใพใใใใ
+
+```py
+>>> encoded_train_dataset.features
+{'image': Sequence(feature=Sequence(feature=Sequence(feature=Value(dtype='uint8', id=None), length=-1, id=None), length=-1, id=None), length=-1, id=None),
+ 'input_ids': Sequence(feature=Value(dtype='int32', id=None), length=-1, id=None),
+ 'token_type_ids': Sequence(feature=Value(dtype='int8', id=None), length=-1, id=None),
+ 'attention_mask': Sequence(feature=Value(dtype='int8', id=None), length=-1, id=None),
+ 'bbox': Sequence(feature=Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None), length=-1, id=None),
+ 'start_positions': Value(dtype='int64', id=None),
+ 'end_positions': Value(dtype='int64', id=None)}
+```
+
+## Evaluation
+
+ๆๆธใฎ่ณชๅๅ็ญใฎ่ฉไพกใซใฏใๅคง้ใฎๅพๅฆ็ใๅฟ
่ฆใงใใ้ๅฐๆๅใ้ฟใใใใใซ
+็พๆ็นใงใฏใใใฎใฌใคใใงใฏ่ฉไพกในใใใใ็็ฅใใฆใใพใใ [`Trainer`] ใฏใใฌใผใใณใฐไธญใซ่ฉไพกๆๅคฑใ่จ็ฎใใใใใ
+ใขใใซใฎใใใฉใผใใณในใซใคใใฆใพใฃใใใใใใชใใใใงใฏใใใพใใใๆฝๅบ็่ณชๅๅฟ็ญใฏ้ๅธธใF1/ๅฎๅ
จไธ่ดใไฝฟ็จใใฆ่ฉไพกใใใพใใ
+่ชๅใงๅฎ่ฃ
ใใใๅ ดๅใฏใ[่ณชๅๅฟ็ญใฎ็ซ ](https://huggingface.co/course/chapter7/7?fw=pt#postprocessing) ใ็ขบ่ชใใฆใใ ใใใ
+ใคใณในใใฌใผใทใงใณใๅพใใใใซใใฐใใงใคในใณใผในใฎใ
+
+## Train
+
+ใใใงใจใ๏ผใใฎใฌใคใใฎๆใ้ฃใใ้จๅใ็กไบใซใใใฒใผใใงใใใฎใงใ็ฌ่ชใฎใขใใซใใใฌใผใใณใฐใใๆบๅใๆดใใพใใใ
+ใใฌใผใใณใฐใซใฏๆฌกใฎๆ้ ใๅซใพใใพใใ
+* ๅๅฆ็ใจๅใใใงใใฏใใคใณใใไฝฟ็จใใฆใ[`AutoModelForDocumentQuestionAnswering`] ใงใขใใซใ่ชญใฟ่พผใฟใพใใ
+* [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใ
+* ใตใณใใซใใใใๅฆ็ใใ้ขๆฐใๅฎ็พฉใใพใใใใใงใฏ [`DefaultDataCollatโโor`] ใ้ฉๅใซๆฉ่ฝใใพใใ
+* ใขใใซใใใผใฟใปใใใใใผใฟ็
งๅๅจใจใจใใซใใฌใผใใณใฐๅผๆฐใ [`Trainer`] ใซๆธกใใพใใ
+* [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> from transformers import AutoModelForDocumentQuestionAnswering
+
+>>> model = AutoModelForDocumentQuestionAnswering.from_pretrained(model_checkpoint)
+```
+
+[`TrainingArguments`] ใงใ`output_dir` ใไฝฟ็จใใฆใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใๅฟ
่ฆใซๅฟใใฆใใคใใผใใฉใกใผใฟใผใๆงๆใใพใใ
+ใขใใซใใณใใฅใใใฃใจๅ
ฑๆใใใๅ ดๅใฏใ`push_to_hub`ใ`True`ใซ่จญๅฎใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใ
+ใใฎๅ ดๅใ`output_dir`ใฏใขใใซใฎใใงใใฏใใคใณใใใใใทใฅใใใใชใใธใใชใฎๅๅใซใใชใใพใใ
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> # REPLACE THIS WITH YOUR REPO ID
+>>> repo_id = "MariaK/layoutlmv2-base-uncased_finetuned_docvqa"
+
+>>> training_args = TrainingArguments(
+... output_dir=repo_id,
+... per_device_train_batch_size=4,
+... num_train_epochs=20,
+... save_steps=200,
+... logging_steps=50,
+... eval_strategy="steps",
+... learning_rate=5e-5,
+... save_total_limit=2,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+```
+
+ใตใณใใซใใพใจใใฆใใใๅฆ็ใใใใใฎๅ็ดใชใใผใฟ็
งๅๅจใๅฎ็พฉใใพใใ
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+ๆๅพใซใใในใฆใใพใจใใฆใ[`~Trainer.train`] ใๅผใณๅบใใพใใ
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=data_collator,
+... train_dataset=encoded_train_dataset,
+... eval_dataset=encoded_test_dataset,
+... processing_class=processor,
+... )
+
+>>> trainer.train()
+```
+
+ๆ็ตใขใใซใ ๐ค Hub ใซ่ฟฝๅ ใใใซใฏใใขใใซ ใซใผใใไฝๆใใ`push_to_hub` ใๅผใณๅบใใพใใ
+
+```py
+>>> trainer.create_model_card()
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+LayoutLMv2 ใขใใซใๅพฎ่ชฟๆดใใ๐ค ใใใซใขใใใญใผใใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใพใใใใฃใจใๅ็ดใช
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆนๆณใฏใใใใ [`Pipeline`] ใงไฝฟ็จใใใใจใงใใ
+
+ไพใๆใใฆใฟใพใใใ:
+```py
+>>> example = dataset["test"][2]
+>>> question = example["query"]["en"]
+>>> image = example["image"]
+>>> print(question)
+>>> print(example["answers"])
+'Who is โpresidingโ TRRF GENERAL SESSION (PART 1)?'
+['TRRF Vice President', 'lee a. waller']
+```
+
+ๆฌกใซใใใคใใฉใคใณใใคใณในใฟใณในๅใใพใใ
+ใขใใซใไฝฟ็จใใฆ่ณชๅใธใฎๅ็ญใๆๆธๅใใ็ปๅใจ่ณชๅใฎ็ตใฟๅใใใใขใใซใซๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> qa_pipeline = pipeline("document-question-answering", model="MariaK/layoutlmv2-base-uncased_finetuned_docvqa")
+>>> qa_pipeline(image, question)
+[{'score': 0.9949808120727539,
+ 'answer': 'Lee A. Waller',
+ 'start': 55,
+ 'end': 57}]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใใใคใใฉใคใณใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+1. ็ปๅใจ่ณชๅใๅๅพใใใขใใซใฎใใญใปใใตใไฝฟ็จใใฆใขใใซ็จใซๆบๅใใพใใ
+2. ใขใใซใ้ใใฆ็ตๆใพใใฏๅๅฆ็ใ่ปข้ใใพใใ
+3. ใขใใซใฏ`start_logits`ใจ`end_logits`ใ่ฟใใพใใใใใใฏใใฉใฎใใผใฏใณใๅฟ็ญใฎๅ
้ ญใซใใใฎใใ็คบใใ
+ใฉใฎใใผใฏใณใๅ็ญใฎๆๅพใซใใใพใใใใฉใกใใๅฝข็ถ (batch_sizeใsequence_length) ใๆใกใพใใ
+4. `start_logits` ใจ `end_logits` ใฎไธกๆนใฎๆๅพใฎๆฌกๅ
ใง argmax ใๅๅพใใไบๆธฌใใใ `start_idx` ใจ `end_idx` ใๅๅพใใพใใ
+5. ใใผใฏใใคใถใผใไฝฟ็จใใฆๅ็ญใใใณใผใใใพใใ
+
+```py
+>>> import torch
+>>> from transformers import AutoProcessor
+>>> from transformers import AutoModelForDocumentQuestionAnswering
+
+>>> processor = AutoProcessor.from_pretrained("MariaK/layoutlmv2-base-uncased_finetuned_docvqa")
+>>> model = AutoModelForDocumentQuestionAnswering.from_pretrained("MariaK/layoutlmv2-base-uncased_finetuned_docvqa")
+
+>>> with torch.no_grad():
+... encoding = processor(image.convert("RGB"), question, return_tensors="pt")
+... outputs = model(**encoding)
+... start_logits = outputs.start_logits
+... end_logits = outputs.end_logits
+... predicted_start_idx = start_logits.argmax(-1).item()
+... predicted_end_idx = end_logits.argmax(-1).item()
+
+>>> processor.tokenizer.decode(encoding.input_ids.squeeze()[predicted_start_idx : predicted_end_idx + 1])
+'lee a. waller'
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/idefics.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/idefics.md
new file mode 100644
index 0000000000000000000000000000000000000000..3ee9f25e74555d53aec2ca60db1fb23ad91db3dc
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/idefics.md
@@ -0,0 +1,430 @@
+
+
+
+# Image tasks with IDEFICS
+
+[[open-in-colab]]
+
+ๅๅฅใฎใฟในใฏใฏ็นๆฎใชใขใใซใๅพฎ่ชฟๆดใใใใจใงๅฏพๅฆใงใใพใใใๅฅใฎใขใใญใผใใๅฏ่ฝใงใใ
+ๆ่ฟ็ปๅ ดใใฆไบบๆฐใๅใใฆใใใฎใฏใๅพฎ่ชฟๆดใ่กใใใซใใพใใพใชใฟในใฏใซๅคง่ฆๆจกใชใขใใซใไฝฟ็จใใใใจใงใใ
+ใใจใใฐใๅคง่ฆๆจกใช่จ่ชใขใใซใฏใ่ฆ็ดใ็ฟป่จณใๅ้กใชใฉใฎ NLP ใฟในใฏใๅฆ็ใงใใพใใ
+ใใฎใขใใญใผใใฏใใใญในใใชใฉใฎๅไธใฎใขใใชใใฃใซ้ๅฎใใใชใใชใใพใใใใใฎใฌใคใใงใฏใๆฌกใฎใใใชๆนๆณใ่ชฌๆใใพใใ
+IDEFICS ใจๅผใฐใใๅคง่ฆๆจกใชใใซใใขใผใใซ ใขใใซใไฝฟ็จใใฆใ็ปๅใจใใญในใใฎใฟในใฏใ่งฃๆฑบใใพใใ
+
+[IDEFICS](../model_doc/idefics) ใฏใ[Flamingo](https://huggingface.co/papers/2204.14198) ใซๅบใฅใใชใผใใณใขใฏใปในใฎใใธใงใณใใใณ่จ่ชใขใใซใงใใ
+DeepMind ใซใใฃใฆๆๅใซ้็บใใใๆๅ
็ซฏใฎ่ฆ่ฆ่จ่ชใขใใซใใขใใซใฏไปปๆใฎ็ปๅใทใผใฑใณในใๅใๅ
ฅใใพใ
+ใใญในใใๅ
ฅๅใใๅบๅใจใใฆไธ่ฒซใใใใญในใใ็ๆใใพใใ็ปๅใซ้ขใใ่ณชๅใซ็ญใใใใ่ฆ่ฆ็ใชใณใณใใณใใซใคใใฆ่ชฌๆใใใใ
+่คๆฐใฎใคใกใผใธใซๅบใฅใใในใใผใชใผใไฝๆใใใชใฉใ IDEFICS ใซใฏ 2 ใคใฎใใชใจใผใทใงใณใใใใพใ - [800 ๅใใฉใกใผใฟ](https://huggingface.co/HuggingFaceM4/idefics-80b)
+ใใใณ [90 ๅใฎใใฉใกใผใฟ](https://huggingface.co/HuggingFaceM4/idefics-9b)ใใฉใกใใ ๐ค Hub ใงๅ
ฅๆใงใใพใใๅใใชใจใผใทใงใณใซใคใใฆใ็ดฐใใ่ชฟๆดใใใๆ็คบใ่ฆใคใใใใจใใงใใพใใ
+ไผ่ฉฑใฎใฆใผในใฑใผในใซ้ฉๅฟใใใขใใซใฎใใผใธใงใณใ
+
+ใใฎใขใใซใฏ้ๅธธใซๅค็จ้ใงใๅน
ๅบใ็ปๅใฟในใฏใใใซใใขใผใใซ ใฟในใฏใซไฝฟ็จใงใใพใใใใใใ
+ๅคง่ฆๆจกใชใขใใซใงใใใจใใใใจใฏใๅคง้ใฎ่จ็ฎใชใฝใผในใจใคใณใใฉในใใฉใฏใใฃใๅฟ
่ฆใงใใใใจใๆๅณใใพใใใใใฏใใชใๆฌก็ฌฌใงใ
+ใใฎใขใใญใผใใฏใๅๅฅใฎใฟในใฏใใจใซ็นๅใใใขใใซใๅพฎ่ชฟๆดใใใใใใใฆใผในใฑใผในใซ้ฉใใฆใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใๅญฆ็ฟใใพใใ
+- [IDEFICS ใใญใผใ](#loading-the-model) ใใใณ [ใขใใซใฎ้ๅญๅใใผใธใงใณใใญใผใ](#quantized-model)
+- IDEFICS ใๆฌกใฎ็ฎ็ใงไฝฟ็จใใพใใ
+ - [็ปๅใญใฃใใทใงใณ](#image-captioning)
+ - [ใใญใณใใ็ปๅใญใฃใใทใงใณ](#prompted-image-captioning)
+ - [Few-shot ใใญใณใใ](#few-shot-prompting)
+ - [ใใธใฅใขใซ่ณชๅๅ็ญ](#visual-question-answering)
+ - [็ปๅๅ้ก](#image-classification)
+ - [็ปๅใฌใคใไปใใใญในใ็ๆ](#image-guided-text-generation)
+- [ใใใใขใผใใงๆจ่ซใๅฎ่กใใ](#running-inference-in-batch-mode)
+- [ไผ่ฉฑ็จใซ IDEFICS ๅฝไปคใๅฎ่ก](#idefics-instruct-for-conversational-use)
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install -q bitsandbytes sentencepiece accelerate transformers
+```
+
+
+้ๅญๅใใใฆใใชใใใผใธใงใณใฎใขใใซ ใใงใใฏใใคใณใใไฝฟ็จใใฆๆฌกใฎไพใๅฎ่กใใใซใฏใๅฐใชใใจใ 20GB ใฎ GPU ใกใขใชใๅฟ
่ฆใงใใ
+
+
+## Loading the model
+
+ใพใใฏใขใใซใฎ 90 ๅๅใฎใใฉใกใผใฟใผใฎใใงใใฏใใคใณใใใญใผใใใพใใใใ
+
+```py
+>>> checkpoint = "HuggingFaceM4/idefics-9b"
+```
+
+ไปใฎ Transformers ใขใใซใจๅๆงใซใใใญใปใใตใจใขใใซ่ชไฝใใใงใใฏใใคใณใใใใญใผใใใๅฟ
่ฆใใใใพใใ
+IDEFICS ใใญใปใใตใฏใ[`LlamaTokenizer`] ใจ IDEFICS ็ปๅใใญใปใใตใๅไธใฎใใญใปใใตใซใฉใใใใฆๅฆ็ใใพใใ
+ใขใใซใฎใใญในใใจ็ปๅใฎๅ
ฅๅใๆบๅใใพใใ
+
+
+```py
+>>> import torch
+
+>>> from transformers import IdeficsForVisionText2Text, AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+
+>>> model = IdeficsForVisionText2Text.from_pretrained(checkpoint, torch_dtype=torch.bfloat16, device_map="auto")
+```
+
+`device_map`ใ`auto`ใซ่จญๅฎใใใจใใขใใซใฎ้ใฟใๆใๆ้ฉๅใใใ็ถๆ
ใงใญใผใใใใณไฟๅญใใๆนๆณใ่ชๅ็ใซๆฑบๅฎใใใพใใ
+ๆขๅญใฎใใใคในใ่ๆ
ฎใใๆนๆณใ
+
+### Quantized model
+
+ใใคใกใขใช GPU ใฎๅฏ็จๆงใๅ้กใจใชใๅ ดๅใฏใใขใใซใฎ้ๅญๅใใใใใผใธใงใณใใญใผใใงใใพใใใขใใซใจ
+ใใญใปใใตใ 4 ใใใ็ฒพๅบฆใงไฝฟ็จใใๅ ดๅใ`BitsAndBytesConfig`ใ`from_pretrained`ใกใฝใใใซๆธกใใจใใขใใซใๅง็ธฎใใใพใใ
+ใญใผใไธญใซใใฎๅ ดใงใ
+
+
+```py
+>>> import torch
+>>> from transformers import IdeficsForVisionText2Text, AutoProcessor, BitsAndBytesConfig
+
+>>> quantization_config = BitsAndBytesConfig(
+... load_in_4bit=True,
+... bnb_4bit_compute_dtype=torch.float16,
+... )
+
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+
+>>> model = IdeficsForVisionText2Text.from_pretrained(
+... checkpoint,
+... quantization_config=quantization_config,
+... device_map="auto"
+... )
+```
+
+ๆๆกใใใๆนๆณใฎใใใใใงใขใใซใใญใผใใใใฎใงใIDEFICS ใไฝฟ็จใงใใใฟในใฏใฎๆข็ดขใซ้ฒใฟใพใใใใ
+
+## Image captioning
+
+็ปๅใฎใญใฃใใทใงใณไปใใฏใ็นๅฎใฎ็ปๅใฎใญใฃใใทใงใณใไบๆธฌใใใฟในใฏใงใใไธ่ฌ็ใช็จ้ใฏ่ฆ่ฆ้ๅฎณ่
ใๆฏๆดใใใใจใงใ
+ไบบใ
ใฏใใพใใพใช็ถๆณใใใใฒใผใใใพใใใใจใใฐใใชใณใฉใคใณใง็ปๅใณใณใใณใใๆข็ดขใใพใใ
+
+ใฟในใฏใ่ชฌๆใใใซใฏใใญใฃใใทใงใณใไปใใ็ปๅใๅๅพใใพใใไพ:
+
+
+
+
+
+ๅ็ๆไพ๏ผ[Hendo Wang](https://unsplash.com/@hendoo)
+
+IDEFICS ใฏใใญในใใจ็ปๅใฎใใญใณใใใๅใๅ
ฅใใพใใใใ ใใ็ปๅใซใญใฃใใทใงใณใไปใใใซใฏใใใญในใ ใใญใณใใใใฆใผใถใผใซๆไพใใๅฟ
่ฆใฏใใใพใใใ
+ใขใใซใๅๅฆ็ใใใๅ
ฅๅ็ปๅใฎใฟใใใญในใ ใใญใณใใใใชใๅ ดๅใใขใใซใฏใใญในใใฎ็ๆใ้ๅงใใพใใ
+BOS (Beginning-of-sequence) ใใผใฏใณใซใใใญใฃใใทใงใณใไฝๆใใใพใใ
+
+ใขใใซใธใฎ็ปๅๅ
ฅๅใจใใฆใ็ปๅใชใใธใงใฏใ (`PIL.Image`) ใพใใฏ็ปๅใๅๅพใงใใ URL ใฎใใใใใไฝฟ็จใงใใพใใ
+
+```py
+>>> prompt = [
+... "https://images.unsplash.com/photo-1583160247711-2191776b4b91?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3542&q=80",
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+A puppy in a flower bed
+```
+
+
+
+ๅขๅ ๆใซ็บ็ใใใจใฉใผใ้ฟใใใใใซใ`generate`ใฎๅผใณๅบใใซ`bad_words_ids`ใๅซใใใใจใใๅงใใใพใใ
+`max_new_tokens`: ใขใใซใฏใๆฐใใ `` ใพใใฏ `` ใใผใฏใณใ็ๆใใๅฟ
่ฆใใใใพใใ
+ใขใใซใซใใฃใฆ็ปๅใ็ๆใใใฆใใพใใใ
+ใใฎใฌใคใใฎใใใซใชใณใถใใฉใคใง่จญๅฎใใใใจใใ[ใใญในใ็ๆๆฆ็ฅ](../generation_strategies) ใฌใคใใง่ชฌๆใใใฆใใใใใซ `GenerationConfig` ใซไฟๅญใใใใจใใงใใพใใ
+
+
+## Prompted image captioning
+
+ใใญในใ ใใญใณใใใๆไพใใใใจใง็ปๅใญใฃใใทใงใณใๆกๅผตใงใใใขใใซใฏ็ปๅใๆๅฎใใฆ็ถ่กใใพใใๆใฃใฆใใใพใใใ
+ๅฅใฎๅณใง่ชฌๆใใพใใ
+
+
+
+
+
+ๅ็ๆไพ๏ผ[Denys Nevozhai](https://unsplash.com/@dnevozhai)ใ
+
+ใใญในใใใใณ็ปๅใฎใใญใณใใใๅไธใฎใชในใใจใใฆใขใใซใฎใใญใปใใตใซๆธกใใ้ฉๅใชๅ
ฅๅใไฝๆใงใใพใใ
+
+```py
+>>> prompt = [
+... "https://images.unsplash.com/photo-1543349689-9a4d426bee8e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3501&q=80",
+... "This is an image of ",
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+This is an image of the Eiffel Tower in Paris, France.
+```
+
+## Few-shot prompting
+
+IDEFICS ใฏใผใญใทใงใใใงๅชใใ็ตๆใ็คบใใพใใใใฟในใฏใซใใฃใฆใฏ็นๅฎใฎๅฝขๅผใฎใญใฃใใทใงใณใๅฟ
่ฆใซใชใๅ ดๅใใใญใฃใใทใงใณใไปๅฑใใๅ ดๅใใใใพใใ
+ใฟในใฏใฎ่ค้ใใๅขๅคงใใใใใฎไปใฎๅถ้ใพใใฏ่ฆไปถใๅฐๆฐใฎใทใงใใใฎใใญใณใใใไฝฟ็จใใฆใใณใณใใญในใๅ
ใฎๅญฆ็ฟใๆๅนใซใใใใจใใงใใพใใ
+ใใญใณใใใซไพใๆๅฎใใใใจใงใๆๅฎใใใไพใฎๅฝขๅผใๆจกๅฃใใ็ตๆใ็ๆใใใใใซใขใใซใๆไฝใงใใพใใ
+
+ๅใฎใจใใใงใซๅกใฎ็ปๅใใขใใซใฎไพใจใใฆไฝฟ็จใใใขใใซใซใใขใณในใใฌใผใทใงใณใใใใญใณใใใไฝๆใใฆใฟใพใใใใ
+็ปๅๅ
ใฎใชใใธใงใฏใใไฝใงใใใใ็ฅใใใจใซๅ ใใฆใใใใซ้ขใใ่ๅณๆทฑใๆ
ๅ ฑใๅๅพใใใใจ่ใใฆใใพใใ
+ๆฌกใซใ่ช็ฑใฎๅฅณ็ฅใฎ็ปๅใซๅฏพใใฆๅใๅฟ็ญๅฝขๅผใๅๅพใงใใใใฉใใใ่ฆใฆใฟใพใใใใ
+
+
+
+
+
+ๅ็ๆไพ๏ผ[Juan Mayobre](https://unsplash.com/@jmayobres)ใ
+
+```py
+>>> prompt = ["User:",
+... "https://images.unsplash.com/photo-1543349689-9a4d426bee8e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3501&q=80",
+... "Describe this image.\nAssistant: An image of the Eiffel Tower at night. Fun fact: the Eiffel Tower is the same height as an 81-storey building.\n",
+... "User:",
+... "https://images.unsplash.com/photo-1524099163253-32b7f0256868?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3387&q=80",
+... "Describe this image.\nAssistant:"
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=30, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+User: Describe this image.
+Assistant: An image of the Eiffel Tower at night. Fun fact: the Eiffel Tower is the same height as an 81-storey building.
+User: Describe this image.
+Assistant: An image of the Statue of Liberty. Fun fact: the Statue of Liberty is 151 feet tall.
+```
+
+ใขใใซใฏ 1 ใคใฎไพ (ใคใพใใ1 ใทใงใใ) ใ ใใใใฟในใฏใฎๅฎ่กๆนๆณใๅญฆ็ฟใใฆใใใใจใซๆณจ็ฎใใฆใใ ใใใใใ่ค้ใชใฟในใฏใฎๅ ดๅใฏใ
+ใใๅคใใฎไพ (3 ใทใงใใใ5 ใทใงใใใชใฉ) ใ่ช็ฑใซ่ฉฆใใฆใฟใฆใใ ใใใ
+
+## Visual question answering
+
+Visual Question Answering (VQA) ใฏใ็ปๅใซๅบใฅใใฆ่ช็ฑๅฝขๅผใฎ่ณชๅใซ็ญใใใฟในใฏใงใใ็ปๅใซไผผใฆใใ
+ใญใฃใใทใงใณใฏใใขใฏใปใทใใชใใฃ ใขใใชใฑใผใทใงใณใ ใใงใชใใๆ่ฒ (่ฆ่ฆ่ณๆใซใคใใฆใฎๆจ่ซ) ใซใไฝฟ็จใงใใพใใ
+ใตใผใใน๏ผ็ปๅใๅบใซใใๅๅใซ้ขใใ่ณชๅ๏ผใ็ปๅๆค็ดขใชใฉใ
+
+ใใฎใฟในใฏ็จใซๆฐใใ็ปๅใๅๅพใใพใใใใ
+
+
+
+
+
+ๅ็ๆไพ [Jarritos Mexican Soda](https://unsplash.com/@jarritos).
+
+้ฉๅใชๆ็คบใใใญใณใใใใใใจใงใใขใใซใ็ปๅใญใฃใใทใงใณใใ่ฆ่ฆ็ใช่ณชๅใธใฎๅฟ็ญใซๅฐใใใจใใงใใพใใ
+
+```py
+>>> prompt = [
+... "Instruction: Provide an answer to the question. Use the image to answer.\n",
+... "https://images.unsplash.com/photo-1623944889288-cd147dbb517c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "Question: Where are these people and what's the weather like? Answer:"
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=20, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+Instruction: Provide an answer to the question. Use the image to answer.
+ Question: Where are these people and what's the weather like? Answer: They're in a park in New York City, and it's a beautiful day.
+```
+
+## Image classification
+
+IDEFICS ใฏใๆฌกใฎใใผใฟใๅซใใใผใฟใซใคใใฆๆ็คบ็ใซใใฌใผใใณใฐใใชใใฆใใ็ปๅใใใพใใพใชใซใใดใชใซๅ้กใงใใพใใ
+ใใใใฎ็นๅฎใฎใซใใดใชใใใฎใฉใใซไปใใฎไพใใซใใดใชใฎใชในใใๆๅฎใใใใฎ็ปๅใจใใญในใใไฝฟ็จใใฆ็่งฃใใ
+ๆฉ่ฝใๅฉ็จใใใจใใขใใซใฏ็ปๅใใฉใฎใซใใดใชใซๅฑใใโโๅฏ่ฝๆงใ้ซใใใๆจๆธฌใงใใพใใ
+
+ใใจใใฐใๆฌกใฎใใใช้่ในใฟใณใใฎ็ปๅใใใใจใใพใใ
+
+
+
+
+
+ๅ็ๆไพ๏ผ[Peter Wendt](https://unsplash.com/@peterwendt)ใ
+
+็ปๅใๆฌกใฎใใใใใฎใซใใดใชใซๅ้กใใใใใซใขใใซใซๆ็คบใงใใพใใ
+
+```py
+>>> categories = ['animals','vegetables', 'city landscape', 'cars', 'office']
+>>> prompt = [f"Instruction: Classify the following image into a single category from the following list: {categories}.\n",
+... "https://images.unsplash.com/photo-1471193945509-9ad0617afabf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "Category: "
+... ]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=6, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+Instruction: Classify the following image into a single category from the following list: ['animals', 'vegetables', 'city landscape', 'cars', 'office'].
+Category: Vegetables
+```
+
+ไธใฎไพใงใฏใ็ปๅใ 1 ใคใฎใซใใดใชใซๅ้กใใใใใซใขใใซใซๆ็คบใใฆใใพใใใใฉใณใฏๅ้กใ่กใใใใซใขใใซใซๆ็คบใใใใจใใงใใพใใ
+
+## Image-guided text generation
+
+ใใใฏใชใจใคใใฃใใชใขใใชใฑใผใทใงใณใฎๅ ดๅใฏใ็ปๅใฌใคใไปใใใญในใ็ๆใไฝฟ็จใใฆใ็ปๅใซๅบใฅใใฆใใญในใใ็ๆใงใใพใใใใใฏๅฏ่ฝใงใ
+่ฃฝๅใๅบๅใใทใผใณใฎ่ชฌๆใชใฉใไฝๆใใใฎใซๅฝน็ซใกใพใใ
+
+IDEFICS ใซใ่ตคใใใขใฎๅ็ดใช็ปๅใซๅบใฅใใฆในใใผใชใผใๆธใใใใซไฟใใฆใฟใพใใใใ
+
+
+
+
+
+ๅ็ๆไพ๏ผ[Craig Tidball](https://unsplash.com/@devonshiremedia)ใ
+
+```py
+>>> prompt = ["Instruction: Use the image to write a story. \n",
+... "https://images.unsplash.com/photo-1517086822157-2b0358e7684a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=2203&q=80",
+... "Story: \n"]
+
+>>> inputs = processor(prompt, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, num_beams=2, max_new_tokens=200, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> print(generated_text[0])
+Instruction: Use the image to write a story.
+ Story:
+Once upon a time, there was a little girl who lived in a house with a red door. She loved her red door. It was the prettiest door in the whole world.
+
+One day, the little girl was playing in her yard when she noticed a man standing on her doorstep. He was wearing a long black coat and a top hat.
+
+The little girl ran inside and told her mother about the man.
+
+Her mother said, โDonโt worry, honey. Heโs just a friendly ghost.โ
+
+The little girl wasnโt sure if she believed her mother, but she went outside anyway.
+
+When she got to the door, the man was gone.
+
+The next day, the little girl was playing in her yard again when she noticed the man standing on her doorstep.
+
+He was wearing a long black coat and a top hat.
+
+The little girl ran
+```
+
+IDEFICS ใฏ็้ขๅ
ใซใใใซใใใฃใซๆฐใฅใใๅนฝ้ใซ้ขใใไธๆฐๅณใชใใญใฆใฃใผใณใฎ่ฉฑใใใใใใงใใ
+
+
+
+ใใฎใใใช้ทใๅบๅใฎๅ ดๅใใใญในใ็ๆๆฆ็ฅใๅพฎ่ชฟๆดใใใจๅคงใใชใกใชใใใๅพใใใพใใใใใฏๅฝนใซ็ซใกใพใ
+็ๆใใใๅบๅใฎๅ่ณชใๅคงๅน
ใซๅไธใใพใใ [ใใญในใ็ๆๆฆ็ฅ](../generation_strategies) ใ็ขบ่ชใใฆใใ ใใใ
+่ฉณใใ็ฅใใใจใใงใใ
+
+
+
+## Running inference in batch mode
+
+ใใใพใงใฎใในใฆใฎใปใฏใทใงใณใงใฏใIDEFICS ใ 1 ใคใฎไพใจใใฆ่ชฌๆใใพใใใ้ๅธธใซไผผใๆนๆณใงใๆจ่ซใๅฎ่กใงใใพใใ
+ใใญใณใใใฎใชในใใๆธกใใใจใซใใใใตใณใใซใฎใใใใๅๅพใใพใใ
+
+```py
+>>> prompts = [
+... [ "https://images.unsplash.com/photo-1543349689-9a4d426bee8e?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3501&q=80",
+... "This is an image of ",
+... ],
+... [ "https://images.unsplash.com/photo-1623944889288-cd147dbb517c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "This is an image of ",
+... ],
+... [ "https://images.unsplash.com/photo-1471193945509-9ad0617afabf?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=3540&q=80",
+... "This is an image of ",
+... ],
+... ]
+
+>>> inputs = processor(prompts, return_tensors="pt").to("cuda")
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10, bad_words_ids=bad_words_ids)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> for i,t in enumerate(generated_text):
+... print(f"{i}:\n{t}\n")
+0:
+This is an image of the Eiffel Tower in Paris, France.
+
+1:
+This is an image of a couple on a picnic blanket.
+
+2:
+This is an image of a vegetable stand.
+```
+
+## IDEFICS instruct for conversational use
+
+ไผ่ฉฑๅใฎใฆใผในใฑใผในใฎๅ ดๅใฏใ๐ค ใใใงใขใใซใฎๅพฎ่ชฟๆดใใใๆ็คบใใใใใผใธใงใณใ่ฆใคใใใใจใใงใใพใใ
+`HuggingFaceM4/idefics-80b-instruct` ใใใณ `HuggingFaceM4/idefics-9b-instruct`ใ
+
+ใใใใฎใใงใใฏใใคใณใใฏใๆๅธซใใใขใใซใจๅฝไปคใขใใซใ็ตใฟๅใใใใใใใใฎๅบๆฌใขใใซใๅพฎ่ชฟๆดใใ็ตๆใงใใ
+ใใผใฟใปใใใๅพฎ่ชฟๆดใใใใจใงใใใฆใณในใใชใผใ ใฎใใใฉใผใใณในใๅไธใใใชใใใไผ่ฉฑ่จญๅฎใงใขใใซใใใไฝฟใใใใใใพใใ
+
+ไผ่ฉฑใงใฎไฝฟ็จใจใใญใณใใใฏใๅบๆฌใขใใซใฎไฝฟ็จใจ้ๅธธใซไผผใฆใใพใใ
+
+```py
+>>> import torch
+>>> from transformers import IdeficsForVisionText2Text, AutoProcessor
+
+>>> device = "cuda" if torch.cuda.is_available() else "cpu"
+
+>>> checkpoint = "HuggingFaceM4/idefics-9b-instruct"
+>>> model = IdeficsForVisionText2Text.from_pretrained(checkpoint, torch_dtype=torch.bfloat16).to(device)
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+
+>>> prompts = [
+... [
+... "User: What is in this image?",
+... "https://upload.wikimedia.org/wikipedia/commons/8/86/Id%C3%A9fix.JPG",
+... "",
+
+... "\nAssistant: This picture depicts Idefix, the dog of Obelix in Asterix and Obelix. Idefix is running on the ground.",
+
+... "\nUser:",
+... "https://static.wikia.nocookie.net/asterix/images/2/25/R22b.gif/revision/latest?cb=20110815073052",
+... "And who is that?",
+
+... "\nAssistant:",
+... ],
+... ]
+
+>>> # --batched mode
+>>> inputs = processor(prompts, add_end_of_utterance_token=False, return_tensors="pt").to(device)
+>>> # --single sample mode
+>>> # inputs = processor(prompts[0], return_tensors="pt").to(device)
+
+>>> # Generation args
+>>> exit_condition = processor.tokenizer("", add_special_tokens=False).input_ids
+>>> bad_words_ids = processor.tokenizer(["", ""], add_special_tokens=False).input_ids
+
+>>> generated_ids = model.generate(**inputs, eos_token_id=exit_condition, bad_words_ids=bad_words_ids, max_length=100)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)
+>>> for i, t in enumerate(generated_text):
+... print(f"{i}:\n{t}\n")
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_captioning.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_captioning.md
new file mode 100644
index 0000000000000000000000000000000000000000..7649947b2c6450110c60ad6f6d7f4a5ad2a9d49d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_captioning.md
@@ -0,0 +1,276 @@
+
+
+# Image captioning
+
+[[open-in-colab]]
+
+็ปๅใฎใญใฃใใทใงใณไปใใฏใ็นๅฎใฎ็ปๅใฎใญใฃใใทใงใณใไบๆธฌใใใฟในใฏใงใใไธ่ฌ็ใช็พๅฎไธ็ใฎใขใใชใฑใผใทใงใณใซใฏๆฌกใฎใใฎใใใใพใใ
+่ฆ่ฆ้ๅฎณ่
ใใใพใใพใช็ถๆณใไนใ่ถใใใใใใๆฏๆดใใพใใใใใใฃใฆใ็ปๅใฎใญใฃใใทใงใณ
+็ปๅใ่ชฌๆใใใใจใงไบบใ
ใฎใณใณใใณใใธใฎใขใฏใปใทใใชใใฃใๅไธใใใใฎใซๅฝน็ซใกใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+* ็ปๅใญใฃใใทใงใณ ใขใใซใๅพฎ่ชฟๆดใใพใใ
+* ๅพฎ่ชฟๆดใใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate -q
+pip install jiwer -q
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+
+```python
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+## Load the Pokรฉmon BLIP captions dataset
+
+๐ค ใใผใฟใปใใ ใฉใคใใฉใชใไฝฟ็จใใฆใ{image-caption} ใใขใงๆงๆใใใใใผใฟใปใใใ่ชญใฟ่พผใฟใพใใ็ฌ่ชใฎ็ปๅใญใฃใใทใงใณ ใใผใฟใปใใใไฝๆใใใซใฏ
+PyTorch ใงใฏใ[ใใฎใใผใใใใฏ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/GIT/Fine_tune_GIT_on_an_image_captioning_dataset.ipynb) ใๅ็
งใงใใพใใ
+
+```py
+ds = load_dataset("lambdalabs/pokemon-blip-captions")
+ds
+```
+
+```bash
+DatasetDict({
+ train: Dataset({
+ features: ['image', 'text'],
+ num_rows: 833
+ })
+})
+```
+
+ใใผใฟใปใใใซใฏ `image`ใจ`text`ใฎ 2 ใคใฎๆฉ่ฝใใใใพใใ
+
+
+
+ๅคใใฎ็ปๅใญใฃใใทใงใณ ใใผใฟใปใใใซใฏใ็ปๅใใจใซ่คๆฐใฎใญใฃใใทใงใณใๅซใพใใฆใใพใใใใฎใใใชๅ ดๅใไธ่ฌ็ใชๆฆ็ฅใฏใใใฌใผใใณใฐไธญใซๅฉ็จๅฏ่ฝใชใญใฃใใทใงใณใฎไธญใใใฉใณใใ ใซใญใฃใใทใงใณใใตใณใใชใณใฐใใใใจใงใใ
+
+
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎใใฌใคใณ ในใใชใใใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+```python
+ds = ds["train"].train_test_split(test_size=0.1)
+train_ds = ds["train"]
+test_ds = ds["test"]
+```
+
+ใใฌใผใใณใฐ ใปใใใใใฎใใใคใใฎใตใณใใซใ่ฆ่ฆๅใใฆใฟใพใใใใ
+
+```python
+from textwrap import wrap
+import matplotlib.pyplot as plt
+import numpy as np
+
+
+def plot_images(images, captions):
+ plt.figure(figsize=(20, 20))
+ for i in range(len(images)):
+ ax = plt.subplot(1, len(images), i + 1)
+ caption = captions[i]
+ caption = "\n".join(wrap(caption, 12))
+ plt.title(caption)
+ plt.imshow(images[i])
+ plt.axis("off")
+
+
+sample_images_to_visualize = [np.array(train_ds[i]["image"]) for i in range(5)]
+sample_captions = [train_ds[i]["text"] for i in range(5)]
+plot_images(sample_images_to_visualize, sample_captions)
+```
+
+
+
+
+
+## Preprocess the dataset
+
+ใใผใฟใปใใใซใฏ 2 ใคใฎใขใใชใใฃ (็ปๅใจใใญในใ) ใใใใใใๅๅฆ็ใใคใใฉใคใณใฏ็ปๅใจใญใฃใใทใงใณใๅๅฆ็ใใพใใ
+
+ใใใ่กใใซใฏใๅพฎ่ชฟๆดใใใใจใใฆใใใขใใซใซ้ข้ฃไปใใใใใใญใปใใต ใฏใฉในใใญใผใใใพใใ
+
+```python
+from transformers import AutoProcessor
+
+checkpoint = "microsoft/git-base"
+processor = AutoProcessor.from_pretrained(checkpoint)
+```
+
+
+ใใญใปใใตใฏๅ
้จใง็ปๅใๅๅฆ็ใ (ใตใคใบๅคๆดใใใฏใปใซ ในใฑใผใชใณใฐใๅซใ)ใใญใฃใใทใงใณใใใผใฏใณๅใใพใใ
+
+```python
+def transforms(example_batch):
+ images = [x for x in example_batch["image"]]
+ captions = [x for x in example_batch["text"]]
+ inputs = processor(images=images, text=captions, padding="max_length")
+ inputs.update({"labels": inputs["input_ids"]})
+ return inputs
+
+
+train_ds.set_transform(transforms)
+test_ds.set_transform(transforms)
+```
+
+ใใผใฟใปใใใฎๆบๅใใงใใใใๅพฎ่ชฟๆด็จใซใขใใซใใปใใใขใใใงใใพใใ
+
+## Load a base model
+
+["microsoft/git-base"](https://huggingface.co/microsoft/git-base) ใ [`AutoModelForCausalLM`](https://huggingface.co/docs/transformers/model_doc/auto#transformers.AutoModelForCausalLM) ใชใใธใงใฏใใ
+
+```python
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained(checkpoint)
+```
+
+```python
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained(checkpoint)
+```
+## Evaluate
+
+็ปๅใญใฃใใทใงใณ ใขใใซใฏ้ๅธธใ[Rouge Score](https://huggingface.co/spaces/evaluate-metric/rouge) ใพใใฏ [Word Error Rate](https://huggingface.co/spaces/evaluate-metric/) ใง่ฉไพกใใใพใใใใใ ใฃใ๏ผใใใฎใฌใคใใงใฏใWord Error Rate (WER) ใไฝฟ็จใใพใใ
+
+ใใใ่กใใซใฏ ๐ค Evaluate ใฉใคใใฉใชใไฝฟ็จใใพใใ WER ใฎๆฝๅจ็ใชๅถ้ใใใฎไปใฎๅ้ก็นใซใคใใฆใฏใ[ใใฎใฌใคใ](https://huggingface.co/spaces/evaluate-metric/wer) ใๅ็
งใใฆใใ ใใใ
+
+```python
+from evaluate import load
+import torch
+
+wer = load("wer")
+
+
+def compute_metrics(eval_pred):
+ logits, labels = eval_pred
+ predicted = logits.argmax(-1)
+ decoded_labels = processor.batch_decode(labels, skip_special_tokens=True)
+ decoded_predictions = processor.batch_decode(predicted, skip_special_tokens=True)
+ wer_score = wer.compute(predictions=decoded_predictions, references=decoded_labels)
+ return {"wer_score": wer_score}
+```
+
+## Train!
+
+ใใใงใใขใใซใฎๅพฎ่ชฟๆดใ้ๅงใใๆบๅใๆดใใพใใใใใใซใฏ ๐ค [`Trainer`] ใไฝฟ็จใใพใใ
+
+ใพใใ[`TrainingArguments`] ใไฝฟ็จใใฆใใฌใผใใณใฐๅผๆฐใๅฎ็พฉใใพใใ
+
+```python
+from transformers import TrainingArguments, Trainer
+
+model_name = checkpoint.split("/")[1]
+
+training_args = TrainingArguments(
+ output_dir=f"{model_name}-pokemon",
+ learning_rate=5e-5,
+ num_train_epochs=50,
+ fp16=True,
+ per_device_train_batch_size=32,
+ per_device_eval_batch_size=32,
+ gradient_accumulation_steps=2,
+ save_total_limit=3,
+ eval_strategy="steps",
+ eval_steps=50,
+ save_strategy="steps",
+ save_steps=50,
+ logging_steps=50,
+ remove_unused_columns=False,
+ push_to_hub=True,
+ label_names=["labels"],
+ load_best_model_at_end=True,
+)
+```
+
+Trainer ๆฌกใซใๆฌกใซใใใผใฟใปใใใจใขใใซใจไธ็ทใซ ๐ค ใซๆธกใใพใใ
+
+```python
+trainer = Trainer(
+ model=model,
+ args=training_args,
+ train_dataset=train_ds,
+ eval_dataset=test_ds,
+ compute_metrics=compute_metrics,
+)
+```
+
+ใใฌใผใใณใฐใ้ๅงใใใซใฏใ[`Trainer`] ใชใใธใงใฏใใฎ [`~Trainer.train`] ใๅผใณๅบใใ ใใงใใ
+
+```python
+trainer.train()
+```
+
+ใใฌใผใใณใฐใ้ฒใใซใคใใฆใใใฌใผใใณใฐใฎๆๅคฑใในใ ใผใบใซๆธๅฐใใใใจใใใใใพใใ
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```python
+trainer.push_to_hub()
+```
+
+## Inference
+
+`test_ds` ใใใตใณใใซ็ปๅใๅๅพใใฆใขใใซใใในใใใพใใ
+
+```python
+from PIL import Image
+import requests
+
+url = "https://huggingface.co/datasets/sayakpaul/sample-datasets/resolve/main/pokemon.png"
+image = Image.open(requests.get(url, stream=True).raw)
+image
+```
+
+
+
+
+
+ใขใใซ็จใฎ็ปๅใๆบๅใใพใใ
+
+```python
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+inputs = processor(images=image, return_tensors="pt").to(device)
+pixel_values = inputs.pixel_values
+```
+
+[`generate`] ใๅผใณๅบใใฆไบๆธฌใใใณใผใใใพใใ
+
+```python
+generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
+generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
+print(generated_caption)
+```
+```bash
+a drawing of a pink and blue pokemon
+```
+
+ๅพฎ่ชฟๆดใใใใขใใซใซใใใ้ๅธธใซๅชใใใญใฃใใทใงใณใ็ๆใใใใใใงใใ
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..013dfc286dce63bd71f5cc934bd5427d4d371efa
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_classification.md
@@ -0,0 +1,553 @@
+
+
+
+# Image classification
+
+[[open-in-colab]]
+
+
+
+็ปๅๅ้กใงใฏใ็ปๅใซใฉใใซใพใใฏใฏใฉในใๅฒใๅฝใฆใพใใใใญในใใ้ณๅฃฐใฎๅ้กใจใฏ็ฐใชใใๅ
ฅๅใฏ
+็ปๅใๆงๆใใใใฏใปใซๅคใๆๅทใฎๆคๅบใชใฉใ็ปๅๅ้กใซใฏๅคใใฎ็จ้ใใใใพใ
+่ช็ถ็ฝๅฎณใฎๅพใไฝ็ฉใฎๅฅๅบท็ถๆ
ใ็ฃ่ฆใใใใ็
ๆฐใฎๅ
ๅใใชใใๅป็็ปๅใในใฏใชใผใใณใฐใใใใใใฎใซๅฝน็ซใกใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [Food-101](https://huggingface.co/datasets/food101) ใใผใฟใปใใใฎ [ViT](model_doc/vit) ใๅพฎ่ชฟๆดใใฆใ็ปๅๅ
ใฎ้ฃๅใๅ้กใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/image-classification) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate
+```
+
+Hugging Face ใขใซใฆใณใใซใญใฐใคใณใใฆใใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load Food-101 dataset
+
+Datasetsใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ Food-101 ใใผใฟใปใใใฎๅฐใใใตใใปใใใ่ชญใฟ่พผใฟใพใใใใใซใใใๆฌกใฎๆฉไผใๅพใใใพใ
+ๅฎๅ
จใชใใผใฟใปใใใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> food = load_dataset("food101", split="train[:5000]")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train` ๅๅฒใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+
+```py
+>>> food = food.train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> food["train"][0]
+{'image': ,
+ 'label': 79}
+```
+
+ใใผใฟใปใใๅ
ใฎๅไพใซใฏ 2 ใคใฎใใฃใผใซใใใใใพใใ
+
+- `image`: ้ฃๅใฎ PIL ็ปๅ
+- `label`: ้ฃๅใฎใฉใใซใฏใฉใน
+
+ใขใใซใใฉใใซ ID ใใใฉใใซๅใๅๅพใใใใใใใใใซใใฉใใซๅใใใใใใ่พๆธใไฝๆใใพใใ
+ๆดๆฐใธใฎๅคๆใใพใใฏใใฎ้:
+
+```py
+>>> labels = food["train"].features["label"].names
+>>> label2id, id2label = dict(), dict()
+>>> for i, label in enumerate(labels):
+... label2id[label] = str(i)
+... id2label[str(i)] = label
+```
+
+ใใใงใใฉใใซ ID ใใฉใใซๅใซๅคๆใงใใใใใซใชใใพใใใ
+
+```py
+>>> id2label[str(79)]
+'prime_rib'
+```
+
+## Preprocess
+
+ๆฌกใฎในใใใใงใฏใViT ็ปๅใใญใปใใตใใญใผใใใฆ็ปๅใใใณใฝใซใซๅฆ็ใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> checkpoint = "google/vit-base-patch16-224-in21k"
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint)
+```
+
+
+
+
+
+ใใใคใใฎ็ปๅๅคๆใ็ปๅใซ้ฉ็จใใฆใใขใใซใฎ้ๅญฆ็ฟใซๅฏพใใๅ
็ขๆงใ้ซใใพใใใใใงใฏ torchvision ใฎ [`transforms`](https://pytorch.org/vision/stable/transforms.html) ใขใธใฅใผใซใไฝฟ็จใใพใใใไปปๆใฎ็ปๅใฉใคใใฉใชใไฝฟ็จใใใใจใใงใใพใใ
+
+็ปๅใฎใฉใณใใ ใช้จๅใใใชใใณใฐใใใตใคใบใๅคๆดใใ็ปๅใฎๅนณๅใจๆจๆบๅๅทฎใงๆญฃ่ฆๅใใพใใ
+
+
+```py
+>>> from torchvision.transforms import RandomResizedCrop, Compose, Normalize, ToTensor
+
+>>> normalize = Normalize(mean=image_processor.image_mean, std=image_processor.image_std)
+>>> size = (
+... image_processor.size["shortest_edge"]
+... if "shortest_edge" in image_processor.size
+... else (image_processor.size["height"], image_processor.size["width"])
+... )
+>>> _transforms = Compose([RandomResizedCrop(size), ToTensor(), normalize])
+```
+
+ๆฌกใซใๅคๆใ้ฉ็จใใ็ปๅใฎ `pixel_values` (ใขใใซใธใฎๅ
ฅๅ) ใ่ฟใๅๅฆ็้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> def transforms(examples):
+... examples["pixel_values"] = [_transforms(img.convert("RGB")) for img in examples["image"]]
+... del examples["image"]
+... return examples
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.with_transform`] ใกใฝใใใไฝฟ็จใใพใใๅคๆใฏใใใผใฟใปใใใฎ่ฆ็ด ใ่ชญใฟ่พผใใจใใซใชใณใถใใฉใคใง้ฉ็จใใใพใใ
+
+```py
+>>> food = food.with_transform(transforms)
+```
+
+ๆฌกใซใ[`DefaultDataCollatโโor`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใ ๐ค Transformers ใฎไปใฎใใผใฟ็
งๅๅจใจใฏ็ฐใชใใ`DefaultDataCollatโโor` ใฏใใใฃใณใฐใชใฉใฎ่ฟฝๅ ใฎๅๅฆ็ใ้ฉ็จใใพใใใ
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+
+
+
+
+
+
+้ๅฐ้ฉๅใๅ้ฟใใใขใใซใใใๅ
็ขใซใใใใใซใใใผใฟใปใใใฎใใฌใผใใณใฐ้จๅใซใใผใฟๆกๅผตใ่ฟฝๅ ใใพใใ
+ใใใงใฏใKeras ๅๅฆ็ใฌใคใคใผใไฝฟ็จใใฆใใฌใผใใณใฐ ใใผใฟใฎๅคๆ (ใใผใฟๆกๅผตใๅซใ) ใๅฎ็พฉใใพใใ
+ๆค่จผใใผใฟใฎๅคๆ (ไธญๅคฎใฎใใชใใณใฐใใตใคใบๅคๆดใๆญฃ่ฆๅใฎใฟ)ใ `tf.image` ใพใใฏ
+ไปใฎใฉใคใใฉใชใงใๆงใใพใใใ
+
+
+```py
+>>> from tensorflow import keras
+>>> from tensorflow.keras import layers
+
+>>> size = (image_processor.size["height"], image_processor.size["width"])
+
+>>> train_data_augmentation = keras.Sequential(
+... [
+... layers.RandomCrop(size[0], size[1]),
+... layers.Rescaling(scale=1.0 / 127.5, offset=-1),
+... layers.RandomFlip("horizontal"),
+... layers.RandomRotation(factor=0.02),
+... layers.RandomZoom(height_factor=0.2, width_factor=0.2),
+... ],
+... name="train_data_augmentation",
+... )
+
+>>> val_data_augmentation = keras.Sequential(
+... [
+... layers.CenterCrop(size[0], size[1]),
+... layers.Rescaling(scale=1.0 / 127.5, offset=-1),
+... ],
+... name="val_data_augmentation",
+... )
+```
+
+ๆฌกใซใไธๅบฆใซ 1 ใคใฎ็ปๅใงใฏใชใใ็ปๅใฎใใใใซ้ฉๅใชๅคๆใ้ฉ็จใใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> import numpy as np
+>>> import tensorflow as tf
+>>> from PIL import Image
+
+
+>>> def convert_to_tf_tensor(image: Image):
+... np_image = np.array(image)
+... tf_image = tf.convert_to_tensor(np_image)
+... # `expand_dims()` is used to add a batch dimension since
+... # the TF augmentation layers operates on batched inputs.
+... return tf.expand_dims(tf_image, 0)
+
+
+>>> def preprocess_train(example_batch):
+... """Apply train_transforms across a batch."""
+... images = [
+... train_data_augmentation(convert_to_tf_tensor(image.convert("RGB"))) for image in example_batch["image"]
+... ]
+... example_batch["pixel_values"] = [tf.transpose(tf.squeeze(image)) for image in images]
+... return example_batch
+
+
+... def preprocess_val(example_batch):
+... """Apply val_transforms across a batch."""
+... images = [
+... val_data_augmentation(convert_to_tf_tensor(image.convert("RGB"))) for image in example_batch["image"]
+... ]
+... example_batch["pixel_values"] = [tf.transpose(tf.squeeze(image)) for image in images]
+... return example_batch
+```
+
+๐ค ใใผใฟใปใใ [`~datasets.Dataset.set_transform`] ใไฝฟ็จใใฆใใใฎๅ ดใงๅคๆใ้ฉ็จใใพใใ
+
+```py
+food["train"].set_transform(preprocess_train)
+food["test"].set_transform(preprocess_val)
+```
+
+ๆๅพใฎๅๅฆ็ในใใใใจใใฆใ`DefaultDataCollatโโor`ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใ ๐ค Transformers ใฎไปใฎใใผใฟ็
งๅๆฉ่ฝใจใฏ็ฐใชใใ
+`DefaultDataCollatโโor` ใฏใใใใฃใณใฐใชใฉใฎ่ฟฝๅ ใฎๅๅฆ็ใ้ฉ็จใใพใใใ
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใใใใซใญใผใใงใใพใ
+๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใ่ฉไพกๆนๆณใใใฎใฟในใฏใงใฏใใญใผใใใพใ
+[accuracy](https://huggingface.co/spaces/evaluate-metric/accuracy) ๆๆจ (่ฉณ็ดฐใซใคใใฆใฏใ๐ค ่ฉไพก [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใ ใใใกใใชใฏในใใญใผใใใฆ่จ็ฎใใๆนๆณ):
+
+```py
+>>> import evaluate
+
+>>> accuracy = evaluate.load("accuracy")
+```
+
+ๆฌกใซใไบๆธฌใจใฉใใซใ [`~evaluate.EvaluationModule.compute`] ใซๆธกใใฆ็ฒพๅบฆใ่จ็ฎใใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions, labels = eval_pred
+... predictions = np.argmax(predictions, axis=1)
+... return accuracy.compute(predictions=predictions, references=labels)
+```
+
+ใใใง `compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใ่จญๅฎใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForImageClassification`] ใไฝฟ็จใใฆ ViT ใใญใผใใใพใใใฉใใซใฎๆฐใจไบๆณใใใใฉใใซใฎๆฐใใใใณใฉใใซ ใใใใณใฐใๆๅฎใใพใใ
+
+```py
+>>> from transformers import AutoModelForImageClassification, TrainingArguments, Trainer
+
+>>> model = AutoModelForImageClassification.from_pretrained(
+... checkpoint,
+... num_labels=len(labels),
+... id2label=id2label,
+... label2id=label2id,
+... )
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใในใใใใฏ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใ `image` ๅใๅ้คใใใใใใๆชไฝฟ็จใฎๅใๅ้คใใชใใใจใ้่ฆใงใใ `image` ๅใใชใใจใ`pixel_values` ใไฝๆใงใใพใใใใใฎๅไฝใ้ฒใใซใฏใ`remove_unused_columns=False`ใ่จญๅฎใใฆใใ ใใใไปใซๅฟ
่ฆใชใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใ ใใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`Trainer`] ใฏ็ฒพๅบฆใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_food_model",
+... remove_unused_columns=False,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... learning_rate=5e-5,
+... per_device_train_batch_size=16,
+... gradient_accumulation_steps=4,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... warmup_ratio=0.1,
+... logging_steps=10,
+... load_best_model_at_end=True,
+... metric_for_best_model="accuracy",
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=data_collator,
+... train_dataset=food["train"],
+... eval_dataset=food["test"],
+... processing_class=image_processor,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใใพใ [ๅบๆฌใใฅใผใใชใขใซ](./training#train-a-tensorflow-model-with-keras) ใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใๆฌกใฎๆ้ ใซๅพใใพใใ
+1. ใใฌใผใใณใฐใฎใใคใใผใใฉใกใผใฟใๅฎ็พฉใใใชใใใฃใใคใถใผใจๅญฆ็ฟ็ในใฑใธใฅใผใซใ่จญๅฎใใพใใ
+2. ไบๅใใฌใผใใณใฐใใใใขใใซใใคใณในใฟใณในๅใใพใใ
+3. ๐ค ใใผใฟใปใใใ `tf.data.Dataset` ใซๅคๆใใพใใ
+4. ใขใใซใใณใณใใคใซใใพใใ
+5. ใณใผใซใใใฏใ่ฟฝๅ ใใ`fit()` ใกใฝใใใไฝฟ็จใใฆใใฌใผใใณใฐใๅฎ่กใใพใใ
+6. ใขใใซใ ๐ค Hub ใซใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใใพใใ
+
+ใพใใใใคใใผใใฉใกใผใฟใผใใชใใใฃใใคใถใผใๅญฆ็ฟ็ในใฑใธใฅใผใซใๅฎ็พฉใใพใใ
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_epochs = 5
+>>> num_train_steps = len(food["train"]) * num_epochs
+>>> learning_rate = 3e-5
+>>> weight_decay_rate = 0.01
+
+>>> optimizer, lr_schedule = create_optimizer(
+... init_lr=learning_rate,
+... num_train_steps=num_train_steps,
+... weight_decay_rate=weight_decay_rate,
+... num_warmup_steps=0,
+... )
+```
+
+ๆฌกใซใใฉใใซ ใใใใณใฐใจใจใใซ [`TFAutoModelForImageClassification`] ใไฝฟ็จใใฆ ViT ใ่ชญใฟ่พผใฟใพใใ
+
+```py
+>>> from transformers import TFAutoModelForImageClassification
+
+>>> model = TFAutoModelForImageClassification.from_pretrained(
+... checkpoint,
+... id2label=id2label,
+... label2id=label2id,
+... )
+```
+
+Convert your datasets to the `tf.data.Dataset` format using the [`~datasets.Dataset.to_tf_dataset`] and your `data_collator`:
+
+```py
+>>> # converting our train dataset to tf.data.Dataset
+>>> tf_train_dataset = food["train"].to_tf_dataset(
+... columns="pixel_values", label_cols="label", shuffle=True, batch_size=batch_size, collate_fn=data_collator
+... )
+
+>>> # converting our test dataset to tf.data.Dataset
+>>> tf_eval_dataset = food["test"].to_tf_dataset(
+... columns="pixel_values", label_cols="label", shuffle=True, batch_size=batch_size, collate_fn=data_collator
+... )
+```
+
+`compile()` ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใซใขใใซใ่จญๅฎใใพใใ
+
+```py
+>>> from tensorflow.keras.losses import SparseCategoricalCrossentropy
+
+>>> loss = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
+>>> model.compile(optimizer=optimizer, loss=loss)
+```
+
+ไบๆธฌใใ็ฒพๅบฆใ่จ็ฎใใใขใใซใ ๐ค ใใใซใใใทใฅใใใซใฏใ[Keras callbacks](../main_classes/keras_callbacks) ใไฝฟ็จใใพใใ
+`compute_metrics` ้ขๆฐใ [KerasMetricCallback](../main_classes/keras_callbacks#transformers.KerasMetricCallback) ใซๆธกใใพใใ
+[PushToHubCallback](../main_classes/keras_callbacks#transformers.PushToHubCallback) ใไฝฟ็จใใฆใขใใซใใขใใใญใผใใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback, PushToHubCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_eval_dataset)
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="food_classifier",
+... tokenizer=image_processor,
+... save_strategy="no",
+... )
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+ใคใใซใใขใใซใใใฌใผใใณใฐใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใ
+ใขใใซใๅพฎ่ชฟๆดใใใใใฎใณใผใซใใใฏ:
+
+```py
+>>> model.fit(tf_train_dataset, validation_data=tf_eval_dataset, epochs=num_epochs, callbacks=callbacks)
+Epoch 1/5
+250/250 [==============================] - 313s 1s/step - loss: 2.5623 - val_loss: 1.4161 - accuracy: 0.9290
+Epoch 2/5
+250/250 [==============================] - 265s 1s/step - loss: 0.9181 - val_loss: 0.6808 - accuracy: 0.9690
+Epoch 3/5
+250/250 [==============================] - 252s 1s/step - loss: 0.3910 - val_loss: 0.4303 - accuracy: 0.9820
+Epoch 4/5
+250/250 [==============================] - 251s 1s/step - loss: 0.2028 - val_loss: 0.3191 - accuracy: 0.9900
+Epoch 5/5
+250/250 [==============================] - 238s 949ms/step - loss: 0.1232 - val_loss: 0.3259 - accuracy: 0.9890
+```
+
+ใใใงใจใ๏ผใขใใซใๅพฎ่ชฟๆดใใ๐ค Hub ใงๅ
ฑๆใใพใใใใใใงๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+
+
+
+
+
+็ปๅๅ้ก็จใฎใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใ [PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/image_classification.ipynb)
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๆจ่ซใๅฎ่กใใใ็ปๅใ่ชญใฟ่พผใฟใพใใ
+
+```py
+>>> ds = load_dataset("food101", split="validation[:10]")
+>>> image = ds["image"][0]
+```
+
+
+
+
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ็ปๅๅ้ก็จใฎ`pipeline`ใใคใณในใฟใณในๅใใใใใซ็ปๅใๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("image-classification", model="my_awesome_food_model")
+>>> classifier(image)
+[{'score': 0.31856709718704224, 'label': 'beignets'},
+ {'score': 0.015232225880026817, 'label': 'bruschetta'},
+ {'score': 0.01519392803311348, 'label': 'chicken_wings'},
+ {'score': 0.013022331520915031, 'label': 'pork_chop'},
+ {'score': 0.012728818692266941, 'label': 'prime_rib'}]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline`ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+
+
+
+็ปๅใใญใปใใตใใญใผใใใฆ็ปๅใๅๅฆ็ใใ`input`ใ PyTorch ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+>>> import torch
+
+>>> image_processor = AutoImageProcessor.from_pretrained("my_awesome_food_model")
+>>> inputs = image_processor(image, return_tensors="pt")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใใญใธใใใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoModelForImageClassification
+
+>>> model = AutoModelForImageClassification.from_pretrained("my_awesome_food_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+ๆใ้ซใ็ขบ็ใงไบๆธฌใใใใฉใใซใๅๅพใใใขใใซใฎ `id2label` ใใใใณใฐใไฝฟ็จใใฆใฉใใซใซๅคๆใใพใใ
+
+```py
+>>> predicted_label = logits.argmax(-1).item()
+>>> model.config.id2label[predicted_label]
+'beignets'
+```
+
+
+
+
+
+
+็ปๅใใญใปใใตใใญใผใใใฆ็ปๅใๅๅฆ็ใใ`input`ใ TensorFlow ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("MariaK/food_classifier")
+>>> inputs = image_processor(image, return_tensors="tf")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใใญใธใใใ่ฟใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForImageClassification
+
+>>> model = TFAutoModelForImageClassification.from_pretrained("MariaK/food_classifier")
+>>> logits = model(**inputs).logits
+```
+
+ๆใ้ซใ็ขบ็ใงไบๆธฌใใใใฉใใซใๅๅพใใใขใใซใฎ `id2label` ใใใใณใฐใไฝฟ็จใใฆใฉใใซใซๅคๆใใพใใ
+
+
+```py
+>>> predicted_class_id = int(tf.math.argmax(logits, axis=-1)[0])
+>>> model.config.id2label[predicted_class_id]
+'beignets'
+```
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_to_image.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_to_image.md
new file mode 100644
index 0000000000000000000000000000000000000000..cd429a4e1e27c3281d823683768eb2bac101e197
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/image_to_image.md
@@ -0,0 +1,135 @@
+
+
+# Image-to-Image Task Guide
+
+[[open-in-colab]]
+
+Image-to-Image ใฟในใฏใฏใใขใใชใฑใผใทใงใณใ็ปๅใๅไฟกใใๅฅใฎ็ปๅใๅบๅใใใฟในใฏใงใใใใใซใฏใ็ปๅๅผทๅ (่ถ
่งฃๅๅบฆใไฝๅ
้ๅผทๅใใใฃใฌใคใณใชใฉ)ใ็ปๅไฟฎๅพฉใชใฉใๅซใใใพใใพใชใตใใฟในใฏใใใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+- ่ถ
่งฃๅๅบฆใฟในใฏใซ็ปๅ้ใฎใใคใใฉใคใณใไฝฟ็จใใพใใ
+- ใใคใใฉใคใณใไฝฟ็จใใใซใๅใใฟในใฏใซๅฏพใใฆใคใกใผใธ้ใขใใซใๅฎ่กใใพใใ
+
+ใใฎใฌใคใใใชใชใผในใใใๆ็นใงใฏใ`image-to-image`ใใคใใฉใคใณใฏ่ถ
่งฃๅๅบฆใฟในใฏใฎใฟใใตใใผใใใฆใใใใจใซๆณจๆใใฆใใ ใใใ
+
+ๅฟ
่ฆใชใฉใคใใฉใชใใคใณในใใผใซใใใใจใใๅงใใพใใใใ
+
+```bash
+pip install transformers
+```
+
+[Swin2SR ใขใใซ](https://huggingface.co/caidas/swin2SR-lightweight-x2-64) ใไฝฟ็จใใฆใใคใใฉใคใณใๅๆๅใงใใใใใซใชใใพใใใๆฌกใซใใคใกใผใธใไฝฟ็จใใฆใใคใใฉใคใณใๅผใณๅบใใใจใงใใใคใใฉใคใณใๆจ่ซใงใใพใใ็พๆ็นใงใฏใ[Swin2SR ใขใใซ](https://huggingface.co/models?sort=trending&search=swin2sr) ใฎใฟใใใฎใใคใใฉใคใณใงใตใใผใใใใฆใใพใใ
+
+```python
+from transformers import pipeline
+
+device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
+pipe = pipeline(task="image-to-image", model="caidas/swin2SR-lightweight-x2-64", device=device)
+```
+
+ใงใฏใ็ปๅใ่ชญใฟ่พผใฟใพใใใใ
+
+```python
+from PIL import Image
+import requests
+
+url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/cat.jpg"
+image = Image.open(requests.get(url, stream=True).raw)
+
+print(image.size)
+```
+```bash
+# (532, 432)
+```
+
+
+
+
+
+ใใใงใใใคใใฉใคใณใไฝฟ็จใใฆๆจ่ซใๅฎ่กใงใใใใใซใชใใพใใใ็ซใฎ็ปๅใฎๆกๅคงใใผใธใงใณใๅๅพใใพใใ
+
+```python
+upscaled = pipe(image)
+print(upscaled.size)
+```
+```bash
+# (1072, 880)
+```
+
+ใใคใใฉใคใณใไฝฟ็จใใใซ่ชๅใงๆจ่ซใๅฎ่กใใใๅ ดๅใฏใใใฉใณในใใฉใผใใผใฎ `Swin2SRForImageSuperResolution` ใฏใฉในใจ `Swin2SRImageProcessor` ใฏใฉในใไฝฟ็จใงใใพใใใใใซใฏๅใใขใใซใฎใใงใใฏใใคใณใใไฝฟ็จใใพใใใขใใซใจใใญใปใใตใๅๆๅใใพใใใใ
+
+```python
+from transformers import Swin2SRForImageSuperResolution, Swin2SRImageProcessor
+
+model = Swin2SRForImageSuperResolution.from_pretrained("caidas/swin2SR-lightweight-x2-64").to(device)
+processor = Swin2SRImageProcessor("caidas/swin2SR-lightweight-x2-64")
+```
+
+`pipeline`ใใฏใ่ชๅใง่กใๅฟ
่ฆใใใๅๅฆ็ใจๅพๅฆ็ใฎในใใใใๆฝ่ฑกๅใใใฎใงใ็ปๅใๅๅฆ็ใใพใใใใ็ปๅใใใญใปใใตใซๆธกใใฆใใใใใฏใปใซๅคใ GPU ใซ็งปๅใใพใใ
+
+```python
+pixel_values = processor(image, return_tensors="pt").pixel_values
+print(pixel_values.shape)
+
+pixel_values = pixel_values.to(device)
+```
+
+ใใใงใใใฏใปใซๅคใใขใใซใซๆธกใใใจใง็ปๅใๆจๆธฌใงใใใใใซใชใใพใใใ
+
+```python
+import torch
+
+with torch.no_grad():
+ outputs = model(pixel_values)
+```
+
+ๅบๅใฏใไปฅไธใฎใใใช `ImageSuperResolutionOutput` ใฟใคใใฎใชใใธใงใฏใใงใ ๐
+
+```
+(loss=None, reconstruction=tensor([[[[0.8270, 0.8269, 0.8275, ..., 0.7463, 0.7446, 0.7453],
+ [0.8287, 0.8278, 0.8283, ..., 0.7451, 0.7448, 0.7457],
+ [0.8280, 0.8273, 0.8269, ..., 0.7447, 0.7446, 0.7452],
+ ...,
+ [0.5923, 0.5933, 0.5924, ..., 0.0697, 0.0695, 0.0706],
+ [0.5926, 0.5932, 0.5926, ..., 0.0673, 0.0687, 0.0705],
+ [0.5927, 0.5914, 0.5922, ..., 0.0664, 0.0694, 0.0718]]]],
+ device='cuda:0'), hidden_states=None, attentions=None)
+```
+
+`reconstruction`ใๅๅพใใใใใ่ฆ่ฆๅใใใใใซๅพๅฆ็ใใๅฟ
่ฆใใใใพใใใฉใฎใใใซ่ฆใใใ่ฆใฆใฟใพใใใใ
+
+```python
+outputs.reconstruction.data.shape
+# torch.Size([1, 3, 880, 1072])
+```
+
+ๅบๅใๅง็ธฎใใฆ่ปธ 0 ใๅ้คใใๅคใใฏใชใใใใฆใใใใใใ numpy float ใซๅคๆใใๅฟ
่ฆใใใใพใใๆฌกใซใ่ปธใ [1072, 880] ใฎๅฝข็ถใซใชใใใใซ้
็ฝฎใใๆๅพใซๅบๅใ็ฏๅฒ [0, 255] ใซๆปใใพใใ
+
+```python
+import numpy as np
+
+# squeeze, take to CPU and clip the values
+output = outputs.reconstruction.data.squeeze().cpu().clamp_(0, 1).numpy()
+# rearrange the axes
+output = np.moveaxis(output, source=0, destination=-1)
+# bring values back to pixel values range
+output = (output * 255.0).round().astype(np.uint8)
+Image.fromarray(output)
+```
+
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/knowledge_distillation_for_image_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/knowledge_distillation_for_image_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..1079121c6062bceb7b53e1e71625f6744c49f6eb
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/knowledge_distillation_for_image_classification.md
@@ -0,0 +1,188 @@
+
+# Knowledge Distillation for Computer Vision
+
+[[open-in-colab]]
+
+็ฅ่ญใฎ่ธ็ใฏใใใๅคง่ฆๆจกใง่ค้ใชใขใใซ (ๆๅธซ) ใใใใๅฐ่ฆๆจกใงๅ็ดใชใขใใซ (็ๅพ) ใซ็ฅ่ญใไผ้ใใใใใซไฝฟ็จใใใๆๆณใงใใใใใขใใซใใๅฅใฎใขใใซใซ็ฅ่ญใๆฝๅบใใใซใฏใ็นๅฎใฎใฟในใฏ (ใใฎๅ ดๅใฏ็ปๅๅ้ก) ใงใใฌใผใใณใฐใใใไบๅใใฌใผใใณใฐๆธใฟๆๅธซใขใใซใๅๅพใใ็ปๅๅ้กใงใใฌใผใใณใฐใใใ็ๅพใขใใซใใฉใณใใ ใซๅๆๅใใพใใๆฌกใซใๅญฆ็ใขใใซใใใฌใผใใณใฐใใฆใใใฎๅบๅใจๆๅธซใฎๅบๅใฎๅทฎใๆๅฐ้ใซๆใใๅไฝใๆจกๅฃใใพใใใใใฏ [Distilling the Knowledge in a Neural Network by Hinton et al](https://arxiv.org/abs/1503.02531) ใงๆๅใซๅฐๅ
ฅใใใพใใใใใฎใฌใคใใงใฏใใฟในใฏๅบๆใฎ็ฅ่ญใฎ่ธ็ใ่กใใพใใใใใซใฏ [Beans ใใผใฟใปใใ](https://huggingface.co/datasets/beans) ใไฝฟ็จใใพใใ
+
+ใใฎใฌใคใใงใฏใ[ๅพฎ่ชฟๆดใใใ ViT ใขใใซ](https://huggingface.co/merve/vit-mobilenet-beans-224) (ๆๅธซใขใใซ) ใๆฝๅบใใฆ [MobileNet](https://huggingface.co/google/mobilenet_v2_1.4_224) (ๅญฆ็ใขใใซ) ๐ค Transformers ใฎ [Trainer API](https://huggingface.co/docs/transformers/en/main_classes/trainer#trainer) ใไฝฟ็จใใพใใ
+
+่ธ็ใจใใญใปในใฎ่ฉไพกใซๅฟ
่ฆใชใฉใคใใฉใชใใคใณในใใผใซใใพใใใใ
+
+```bash
+pip install transformers datasets accelerate tensorboard evaluate --upgrade
+```
+
+ใใฎไพใงใฏใๆๅธซใขใใซใจใใฆ`merve/beans-vit-224`ใขใใซใไฝฟ็จใใฆใใพใใใใใฏใBean ใใผใฟใปใใใซๅบใฅใใฆๅพฎ่ชฟๆดใใใ`google/vit-base-patch16-224-in21k`ใซๅบใฅใ็ปๅๅ้กใขใใซใงใใใใฎใขใใซใใฉใณใใ ใซๅๆๅใใใ MobileNetV2 ใซๆฝๅบใใพใใ
+
+ๆฌกใซใใใผใฟใปใใใใญใผใใใพใใ
+
+```python
+from datasets import load_dataset
+
+dataset = load_dataset("beans")
+```
+
+ใใฎๅ ดๅใๅใ่งฃๅๅบฆใงๅใๅบๅใ่ฟใใใใใใใฉใกใใฎใขใใซใฎ็ปๅใใญใปใใตใไฝฟ็จใงใใพใใ `dataset`ใฎ`map()`ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎใในใฆใฎๅๅฒใซๅๅฆ็ใ้ฉ็จใใพใใ
+
+```python
+from transformers import AutoImageProcessor
+teacher_processor = AutoImageProcessor.from_pretrained("merve/beans-vit-224")
+
+def process(examples):
+ processed_inputs = teacher_processor(examples["image"])
+ return processed_inputs
+
+processed_datasets = dataset.map(process, batched=True)
+```
+
+ๅบๆฌ็ใซใๆใ
ใฏ็ๅพใขใใซ๏ผใฉใณใใ ใซๅๆๅใใใMobileNet๏ผใๆๅธซใขใใซ๏ผๅพฎ่ชฟๆดใใใใใธใงใณๅคๆๅจ๏ผใๆจกๅฃใใใใจใๆใใใใใๅฎ็พใใใใใซใใพใๆๅธซใจ็ๅพใใใญใธใใๅบๅใๅพใใๆฌกใซใใใใใใฎใฝใใใฟใผใฒใใใฎ้่ฆๅบฆใๅถๅพกใใใใฉใกใผใฟ`temperature`ใงๅๅฒใใใ`lambda`ใจๅผใฐใใใใฉใกใผใฟใฏ่ธ็ใญในใฎ้่ฆๅบฆใ้ใใใใฎไพใงใฏใ`temperature=5`ใ`lambda=0.5`ใจใใใ็ๅพใจๆๅธซใฎ้ใฎ็บๆฃใ่จ็ฎใใใใใซใKullback-Leibler็บๆฃๆๅคฑใไฝฟ็จใใพใใ2ใคใฎใใผใฟPใจQใไธใใใใใจใใKLใใคใใผใธใงใณในใฏQใไฝฟใฃใฆPใ่กจ็พใใใใใซใฉใใ ใใฎไฝๅใชๆ
ๅ ฑใๅฟ
่ฆใใ่ชฌๆใใพใใใใ2ใคใๅใใงใใใฐใQใใPใ่ชฌๆใใใใใซๅฟ
่ฆใชไปใฎๆ
ๅ ฑใฏใชใใฎใงใใใใใฎKLใใคใใผใธใงใณในใฏใผใญใซใชใใพใใ
+
+
+```python
+from transformers import TrainingArguments, Trainer
+import torch
+import torch.nn as nn
+import torch.nn.functional as F
+
+
+class ImageDistilTrainer(Trainer):
+ def __init__(self, *args, teacher_model=None, **kwargs):
+ super().__init__(*args, **kwargs)
+ self.teacher = teacher_model
+ self.student = student_model
+ self.loss_function = nn.KLDivLoss(reduction="batchmean")
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
+ self.teacher.to(device)
+ self.teacher.eval()
+ self.temperature = temperature
+ self.lambda_param = lambda_param
+
+ def compute_loss(self, student, inputs, return_outputs=False):
+ student_output = self.student(**inputs)
+
+ with torch.no_grad():
+ teacher_output = self.teacher(**inputs)
+
+ # Compute soft targets for teacher and student
+ soft_teacher = F.softmax(teacher_output.logits / self.temperature, dim=-1)
+ soft_student = F.log_softmax(student_output.logits / self.temperature, dim=-1)
+
+ # Compute the loss
+ distillation_loss = self.loss_function(soft_student, soft_teacher) * (self.temperature ** 2)
+
+ # Compute the true label loss
+ student_target_loss = student_output.loss
+
+ # Calculate final loss
+ loss = (1. - self.lambda_param) * student_target_loss + self.lambda_param * distillation_loss
+ return (loss, student_output) if return_outputs else loss
+```
+
+ๆฌกใซใHugging Face Hub ใซใญใฐใคใณใใฆใ`trainer`ใ้ใใฆใขใใซใ Hugging Face Hub ใซใใใทใฅใงใใใใใซใใพใใ
+
+```python
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+ๆๅธซใขใใซใจ็ๅพใขใใซใงใใ`TrainingArguments`ใ่จญๅฎใใพใใใใ
+
+```python
+from transformers import AutoModelForImageClassification, MobileNetV2Config, MobileNetV2ForImageClassification
+
+training_args = TrainingArguments(
+ output_dir="my-awesome-model",
+ num_train_epochs=30,
+ fp16=True,
+ logging_dir=f"{repo_name}/logs",
+ logging_strategy="epoch",
+ eval_strategy="epoch",
+ save_strategy="epoch",
+ load_best_model_at_end=True,
+ metric_for_best_model="accuracy",
+ report_to="tensorboard",
+ push_to_hub=True,
+ hub_strategy="every_save",
+ hub_model_id=repo_name,
+ )
+
+num_labels = len(processed_datasets["train"].features["labels"].names)
+
+# initialize models
+teacher_model = AutoModelForImageClassification.from_pretrained(
+ "merve/beans-vit-224",
+ num_labels=num_labels,
+ ignore_mismatched_sizes=True
+)
+
+# training MobileNetV2 from scratch
+student_config = MobileNetV2Config()
+student_config.num_labels = num_labels
+student_model = MobileNetV2ForImageClassification(student_config)
+```
+
+`compute_metrics` ้ขๆฐใไฝฟ็จใใฆใใในใ ใปใใใงใขใใซใ่ฉไพกใงใใพใใใใฎ้ขๆฐใฏใใใฌใผใใณใฐ ใใญใปในไธญใซใขใใซใฎ`accuracy`ใจ`f1`ใ่จ็ฎใใใใใซไฝฟ็จใใใพใใ
+
+```python
+import evaluate
+import numpy as np
+
+accuracy = evaluate.load("accuracy")
+
+def compute_metrics(eval_pred):
+ predictions, labels = eval_pred
+ acc = accuracy.compute(references=labels, predictions=np.argmax(predictions, axis=1))
+ return {"accuracy": acc["accuracy"]}
+```
+
+ๅฎ็พฉใใใใฌใผใใณใฐๅผๆฐใไฝฟ็จใใฆ`Trainer`ใๅๆๅใใพใใใใใใผใฟ็
งๅ่ฃ
็ฝฎใๅๆๅใใพใใ
+
+
+```python
+from transformers import DefaultDataCollator
+
+data_collator = DefaultDataCollator()
+trainer = ImageDistilTrainer(
+ student_model=student_model,
+ teacher_model=teacher_model,
+ training_args=training_args,
+ train_dataset=processed_datasets["train"],
+ eval_dataset=processed_datasets["validation"],
+ data_collator=data_collator,
+ processing_class=teacher_extractor,
+ compute_metrics=compute_metrics,
+ temperature=5,
+ lambda_param=0.5
+)
+```
+
+ใใใงใขใใซใใใฌใผใใณใฐใงใใใใใซใชใใพใใใ
+
+```python
+trainer.train()
+```
+
+ใในใ ใปใใใงใขใใซใ่ฉไพกใงใใพใใ
+
+
+```python
+trainer.evaluate(processed_datasets["test"])
+```
+
+ใในใ ใปใใใงใฏใใขใใซใฎ็ฒพๅบฆใฏ 72% ใซ้ใใพใใ่ธ็ๅน็ใฎๅฅๅ
จๆงใใงใใฏใ่กใใใใซใๅใใใคใใผใใฉใกใผใฟใไฝฟ็จใใฆ Bean ใใผใฟใปใใใง MobileNet ใๆๅใใใใฌใผใใณใฐใใใในใ ใปใใใง 63% ใฎ็ฒพๅบฆใ่ฆณๅฏใใพใใใ่ชญ่
ใฎ็ๆงใซใฏใใใพใใพใชไบๅใใฌใผใใณใฐๆธใฟๆๅธซใขใใซใๅญฆ็ใขใผใญใใฏใใฃใ่ธ็ใใฉใกใผใฟใ่ฉฆใใฆใใใ ใใใใฎ็ตๆใๅ ฑๅใใฆใใใ ใใใใๅงใใใพใใๆฝๅบใใใใขใใซใฎใใฌใผใใณใฐ ใญใฐใจใใงใใฏใใคใณใใฏ [ใใฎใชใใธใใช](https://huggingface.co/merve/vit-mobilenet-beans-224) ใซใใใๆๅใใใใฌใผใใณใฐใใใ MobileNetV2 ใฏใใฎ [ใชใใธใใช](https://huggingface.co/merve/resnet-mobilenet-beans-5)ใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/language_modeling.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/language_modeling.md
new file mode 100644
index 0000000000000000000000000000000000000000..1cadc0af0ac0a559dd3b332c742dffa503b4fe64
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/language_modeling.md
@@ -0,0 +1,437 @@
+
+
+# Causal language modeling
+
+
+[[open-in-colab]]
+
+
+่จ่ชใขใใชใณใฐใซใฏใๅ ๆ็ใขใใชใณใฐใจใในใฏใใใ่จ่ชใขใใชใณใฐใฎ 2 ใคใฎใฟใคใใใใใพใใใใฎใฌใคใใงใฏใๅ ๆ้ขไฟใฎใใ่จ่ชใขใใชใณใฐใซใคใใฆ่ชฌๆใใพใใ
+ๅ ๆ่จ่ชใขใใซใฏใใญในใ็ๆใซใใไฝฟ็จใใใพใใใใใใฎใขใใซใฏใๆฌกใฎใใใชใฏใชใจใคใใฃใใชใขใใชใฑใผใทใงใณใซไฝฟ็จใงใใพใใ
+็ฌ่ชใฎใใญในใ ใขใใใณใใฃใผใ้ธๆใใใใCopilot ใ CodeParrot ใชใฉใฎใคใณใใชใธใงใณใใชใณใผใใฃใณใฐ ใขใทในใฟใณใใ้ธๆใใพใใ
+
+
+
+
+ๅ ๆ่จ่ชใขใใชใณใฐใฏใไธ้ฃใฎใใผใฏใณๅ
ใฎๆฌกใฎใใผใฏใณใไบๆธฌใใพใใใขใใซใฏใๆฌกใฎใใผใฏใณใซใฎใฟๅฏพๅฟใงใใพใใ
+ๅทฆใใใใฏใใขใใซใๅฐๆฅใฎใใผใฏใณใ่ช่ญใงใใชใใใจใๆๅณใใพใใ GPT-2 ใฏๅ ๆ็่จ่ชใขใใซใฎไธไพใงใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [ELI5](https:/) ใฎ [r/askscience](https://www.reddit.com/r/askscience/) ใตใใปใใใง [DistilGPT2](https://huggingface.co/distilbert/distilgpt2) ใๅพฎ่ชฟๆดใใพใใ /huggingface.co/datasets/eli5) ใใผใฟใปใใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/text-generation) ใ็ขบ่ชใใใใจใใๅงใใใพใใu
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load ELI5 dataset
+
+
+ใพใใELI5 ใใผใฟใปใใใฎ r/askscience ใตใใปใใใฎๅฐใใใตใใปใใใ ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใใญใผใใใพใใ
+ ใใใซใใใๅฎๅ
จใชใใผใฟใปใใใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใๅพใใใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> eli5 = load_dataset("eli5", split="train_asks[:5000]")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train_asks` ใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+```py
+>>> eli5 = eli5.train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> eli5["train"][0]
+{'answers': {'a_id': ['c3d1aib', 'c3d4lya'],
+ 'score': [6, 3],
+ 'text': ["The velocity needed to remain in orbit is equal to the square root of Newton's constant times the mass of earth divided by the distance from the center of the earth. I don't know the altitude of that specific mission, but they're usually around 300 km. That means he's going 7-8 km/s.\n\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.",
+ "Hope you don't mind me asking another question, but why aren't there any stars visible in this photo?"]},
+ 'answers_urls': {'url': []},
+ 'document': '',
+ 'q_id': 'nyxfp',
+ 'selftext': '_URL_0_\n\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?',
+ 'selftext_urls': {'url': ['http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg']},
+ 'subreddit': 'askscience',
+ 'title': 'Few questions about this space walk photograph.',
+ 'title_urls': {'url': []}}
+```
+
+ใใใฏๅคใใฎใใจใฎใใใซ่ฆใใใใใใใพใใใใๅฎ้ใซ้ขๅฟใใใใฎใฏ`text`ใใฃใผใซใใ ใใงใใ่จ่ชใขใใชใณใฐใฎๅชใใฆใใ็น
+ใฟในใฏใงใฏใๆฌกใฎๅ่ชใใฉใใซ * ใงใใใใใใฉใใซ (ๆๅธซใชใใฟในใฏใจใๅผใฐใใพใ) ใฏๅฟ
่ฆใใใพใใใ
+
+
+## Preprocess
+
+
+
+
+ๆฌกใฎในใใใใฏใ`text`ใตใใใฃใผใซใใๅฆ็ใใใใใซ DistilGPT2 ใใผใฏใใคใถใผใใญใผใใใใใจใงใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilgpt2")
+```
+
+ไธใฎไพใใใใใใใใซใ`text`ใใฃใผใซใใฏๅฎ้ใซใฏ`answers`ๅ
ใซใในใใใใฆใใพใใใคใพใใๆฌกใฎใใจใๅฟ
่ฆใซใชใใพใใ
+[` flatten`](https://huggingface.co/docs/datasets/process.html#flatten) ใกใฝใใใไฝฟ็จใใฆใใในใใใใๆง้ ใใ `text` ใตใใใฃใผใซใใๆฝๅบใใพใใ
+
+```py
+>>> eli5 = eli5.flatten()
+>>> eli5["train"][0]
+{'answers.a_id': ['c3d1aib', 'c3d4lya'],
+ 'answers.score': [6, 3],
+ 'answers.text': ["The velocity needed to remain in orbit is equal to the square root of Newton's constant times the mass of earth divided by the distance from the center of the earth. I don't know the altitude of that specific mission, but they're usually around 300 km. That means he's going 7-8 km/s.\n\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.",
+ "Hope you don't mind me asking another question, but why aren't there any stars visible in this photo?"],
+ 'answers_urls.url': [],
+ 'document': '',
+ 'q_id': 'nyxfp',
+ 'selftext': '_URL_0_\n\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?',
+ 'selftext_urls.url': ['http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg'],
+ 'subreddit': 'askscience',
+ 'title': 'Few questions about this space walk photograph.',
+ 'title_urls.url': []}
+```
+
+`answers`ๆฅ้ ญ่พใง็คบใใใใใใซใๅใตใใใฃใผใซใใฏๅๅฅใฎๅใซใชใใ`text`ใใฃใผใซใใฏใชในใใซใชใใพใใใใใฎไปฃใใ
+ๅๆใๅๅฅใซใใผใฏใณๅใใๅ ดๅใฏใใชในใใๆๅญๅใซๅคๆใใฆใใใใใใพใจใใฆใใผใฏใณๅใงใใใใใซใใพใใ
+
+ไปฅไธใฏใๅไพใฎๆๅญๅใฎใชในใใ็ตๅใใ็ตๆใใใผใฏใณๅใใๆๅใฎๅๅฆ็้ขๆฐใงใใ
+
+```py
+>>> def preprocess_function(examples):
+... return tokenizer([" ".join(x) for x in examples["answers.text"]])
+```
+
+ใใฎๅๅฆ็้ขๆฐใใใผใฟใปใใๅ
จไฝใซ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ใกใฝใใใไฝฟ็จใใพใใ `map` ้ขๆฐใ้ซ้ๅใใใซใฏใ`batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใ`num_proc` ใงใใญใปในใฎๆฐใๅขใใใพใใไธ่ฆใชๅใๅ้คใใพใใ
+
+```py
+>>> tokenized_eli5 = eli5.map(
+... preprocess_function,
+... batched=True,
+... num_proc=4,
+... remove_columns=eli5["train"].column_names,
+... )
+```
+
+ใใฎใใผใฟใปใใใซใฏใใผใฏใณ ใทใผใฑใณในใๅซใพใใฆใใพใใใใใฎไธ้จใฏใขใใซใฎๆๅคงๅ
ฅๅ้ทใใใ้ทใใชใใพใใ
+
+2 ็ช็ฎใฎๅๅฆ็้ขๆฐใไฝฟ็จใใฆใ
+- ใในใฆใฎใทใผใฑใณในใ้ฃ็ตใใพใ
+- ้ฃ็ตใใใใทใผใฑใณในใ`block_size`ใงๅฎ็พฉใใใ็ญใใใฃใณใฏใซๅๅฒใใพใใใใใฏใๆๅคงๅ
ฅๅ้ทใใ็ญใใGPU RAM ใซๅๅใช้ทใใงใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> block_size = 128
+
+
+>>> def group_texts(examples):
+... # Concatenate all texts.
+... concatenated_examples = {k: sum(examples[k], []) for k in examples.keys()}
+... total_length = len(concatenated_examples[list(examples.keys())[0]])
+... # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
+... # customize this part to your needs.
+... if total_length >= block_size:
+... total_length = (total_length // block_size) * block_size
+... # Split by chunks of block_size.
+... result = {
+... k: [t[i : i + block_size] for i in range(0, total_length, block_size)]
+... for k, t in concatenated_examples.items()
+... }
+... result["labels"] = result["input_ids"].copy()
+... return result
+```
+
+Apply the `group_texts` function over the entire dataset:
+
+```py
+>>> lm_dataset = tokenized_eli5.map(group_texts, batched=True, num_proc=4)
+```
+
+ๆฌกใซใ[`DataCollatโโorForLanguageModeling`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใ *ๅ็ใซใใใฃใณใฐ*ใใๆนใๅน็็ใงใใ
+ใใผใฟใปใใๅ
จไฝใๆๅคง้ทใพใงใใใฃใณใฐใใใฎใงใฏใชใใ็
งๅไธญใซใใใๅ
ใฎๆใๆ้ทใฎ้ทใใซใใพใใ
+
+
+
+
+ใทใผใฑใณใน็ตไบใใผใฏใณใใใใฃใณใฐ ใใผใฏใณใจใใฆไฝฟ็จใใ`mlm=False` ใ่จญๅฎใใพใใใใใฏใๅ
ฅๅใ 1 ่ฆ็ด ๅๅณใซใทใใใใใฉใใซใจใใฆไฝฟ็จใใพใใ
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> tokenizer.pad_token = tokenizer.eos_token
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False)
+```
+
+
+
+ใทใผใฑใณใน็ตไบใใผใฏใณใใใใฃใณใฐ ใใผใฏใณใจใใฆไฝฟ็จใใ`mlm=False` ใ่จญๅฎใใพใใใใใฏใๅ
ฅๅใ 1 ่ฆ็ด ๅๅณใซใทใใใใใฉใใซใจใใฆไฝฟ็จใใพใใ
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=False, return_tensors="tf")
+```
+
+
+
+
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ๅบๆฌใใฅใผใใชใขใซ](../training#train-with-pytorch-trainer) ใๅ็
งใใฆใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForCausalLM`] ใไฝฟ็จใใฆ DistilGPT2 ใใญใผใใใพใใ
+
+
+```py
+>>> from transformers import AutoModelForCausalLM, TrainingArguments, Trainer
+
+>>> model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใ
+2. ใใฌใผใใณใฐๅผๆฐใใขใใซใใใผใฟใปใใใใใผใฟ็
งๅๅจใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_eli5_clm-model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=lm_dataset["train"],
+... eval_dataset=lm_dataset["test"],
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.evaluate`] ใกใฝใใใไฝฟ็จใใฆใขใใซใ่ฉไพกใใใใฎ่ค้ใใๅๅพใใพใใ
+
+```py
+>>> import math
+
+>>> eval_results = trainer.evaluate()
+>>> print(f"Perplexity: {math.exp(eval_results['eval_loss']):.2f}")
+Perplexity: 49.61
+```
+
+ๆฌกใซใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ๅบๆฌใใฅใผใใชใขใซ](../training#train-a-tensorflow-model-with-keras) ใใ่ฆงใใ ใใใ
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใใชใใใฃใใคใถใผ้ขๆฐใๅญฆ็ฟ็ในใฑใธใฅใผใซใใใใณใใใคใใฎใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใผใใปใใใขใใใใใใจใใๅงใใพใใ
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+ๆฌกใซใ[`TFAutoModelForCausalLM`] ใไฝฟ็จใใฆ DistilGPT2 ใใญใผใใงใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForCausalLM
+
+>>> model = TFAutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+```
+
+[`~transformers.TFPreTrainedModel.prepare_tf_dataset`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... lm_dataset["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... lm_dataset["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใฎใขใใซใ่จญๅฎใใพใใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+ใใใฏใใขใใซใจใใผใฏใใคใถใผใ [`~transformers.PushToHubCallback`] ใงใใใทใฅใใๅ ดๆใๆๅฎใใใใจใงๅฎ่กใงใใพใใ
+
+
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> callback = PushToHubCallback(
+... output_dir="my_awesome_eli5_clm-model",
+... tokenizer=tokenizer,
+... )
+```
+
+ใคใใซใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใใณใผใซใใใฏใๆๅฎใใฆ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใๅผใณๅบใใใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=[callback])
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใจใใขใใซใฏ่ชๅ็ใซใใใซใขใใใญใผใใใใ่ชฐใงใไฝฟ็จใงใใใใใซใชใใพใใ
+
+
+
+
+
+
+ๅ ๆ่จ่ชใขใใชใณใฐ็จใซใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎใใ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+[PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)
+ใพใใฏ [TensorFlow ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)ใ
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ใใญในใใ็ๆใใใใญใณใใใ่ใๅบใใพใใ
+
+```py
+>>> prompt = "Somatic hypermutation allows the immune system to"
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆใใญในใ็ๆ็จใฎ`pipeline`ใใคใณในใฟใณในๅใใใใใซใใญในใใๆธกใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> generator = pipeline("text-generation", model="my_awesome_eli5_clm-model")
+>>> generator(prompt)
+[{'generated_text': "Somatic hypermutation allows the immune system to be able to effectively reverse the damage caused by an infection.\n\n\nThe damage caused by an infection is caused by the immune system's ability to perform its own self-correcting tasks."}]
+```
+
+
+
+
+
+ใใญในใใใใผใฏใณๅใใใinput_idsใใ PyTorch ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_eli5_clm-model")
+>>> inputs = tokenizer(prompt, return_tensors="pt").input_ids
+```
+
+[`~generation.GenerationMixin.generate`] ใกใฝใใใไฝฟ็จใใฆใใญในใใ็ๆใใพใใ
+ใใพใใพใชใใญในใ็ๆๆฆ็ฅใจ็ๆใๅถๅพกใใใใใฎใใฉใกใผใฟใผใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ใใญในใ็ๆๆฆ็ฅ](../generation_strategies) ใใผใธใๅ็
งใใฆใใ ใใใ
+
+```py
+>>> from transformers import AutoModelForCausalLM
+
+>>> model = AutoModelForCausalLM.from_pretrained("my_awesome_eli5_clm-model")
+>>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
+```
+
+็ๆใใใใใผใฏใณ ID ใใใณใผใใใฆใใญในใใซๆปใใพใใ
+
+```py
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+["Somatic hypermutation allows the immune system to react to drugs with the ability to adapt to a different environmental situation. In other words, a system of 'hypermutation' can help the immune system to adapt to a different environmental situation or in some cases even a single life. In contrast, researchers at the University of Massachusetts-Boston have found that 'hypermutation' is much stronger in mice than in humans but can be found in humans, and that it's not completely unknown to the immune system. A study on how the immune system"]
+```
+
+
+
+
+ใใญในใใใใผใฏใณๅใใ`input_ids`ใ TensorFlow ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_eli5_clm-model")
+>>> inputs = tokenizer(prompt, return_tensors="tf").input_ids
+```
+
+[`~transformers.generation_tf_utils.TFGenerationMixin.generate`] ใกใฝใใใไฝฟ็จใใฆ่ฆ็ดใไฝๆใใพใใใใพใใพใชใใญในใ็ๆๆฆ็ฅใจ็ๆใๅถๅพกใใใใใฎใใฉใกใผใฟใผใฎ่ฉณ็ดฐใซใคใใฆใฏใ[ใใญในใ็ๆๆฆ็ฅ](../generation_strategies) ใใผใธใๅ็
งใใฆใใ ใใใ
+
+```py
+>>> from transformers import TFAutoModelForCausalLM
+
+>>> model = TFAutoModelForCausalLM.from_pretrained("my_awesome_eli5_clm-model")
+>>> outputs = model.generate(input_ids=inputs, max_new_tokens=100, do_sample=True, top_k=50, top_p=0.95)
+```
+
+็ๆใใใใใผใฏใณ ID ใใใณใผใใใฆใใญในใใซๆปใใพใใ
+
+```py
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Somatic hypermutation allows the immune system to detect the presence of other viruses as they become more prevalent. Therefore, researchers have identified a high proportion of human viruses. The proportion of virus-associated viruses in our study increases with age. Therefore, we propose a simple algorithm to detect the presence of these new viruses in our samples as a sign of improved immunity. A first study based on this algorithm, which will be published in Science on Friday, aims to show that this finding could translate into the development of a better vaccine that is more effective for']
+```
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/masked_language_modeling.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/masked_language_modeling.md
new file mode 100644
index 0000000000000000000000000000000000000000..29d7b73ae5d026f210de5c9d82401224a4a94bda
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/masked_language_modeling.md
@@ -0,0 +1,449 @@
+
+
+# Masked language modeling
+
+[[open-in-colab]]
+
+
+
+ใในใฏใใใ่จ่ชใขใใชใณใฐใฏใทใผใฑใณในๅ
ใฎใในใฏใใใใใผใฏใณใไบๆธฌใใใขใใซใฏใใผใฏใณใๅๆนๅใซๅฆ็ใงใใพใใใใ
+ใใใฏใใขใใซใๅทฆๅณใฎใใผใฏใณใซๅฎๅ
จใซใขใฏใปในใงใใใใจใๆๅณใใพใใใในใฏใใใ่จ่ชใขใใชใณใฐใฏใๆฌกใฎใใใชใฟในใฏใซๆ้ฉใงใใ
+ใทใผใฑใณในๅ
จไฝใฎๆ่ใใใ็่งฃใใๅฟ
่ฆใใใใพใใ BERT ใฏใในใฏใใใ่จ่ชใขใใซใฎไธไพใงใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [ELI5](https://huggingface.co/distilbert/distilroberta-base) ใฎ [r/askscience](https://www.reddit.com/r/askscience/) ใตใใปใใใง [DistilRoBERTa](https://huggingface.co/distilbert/distilroberta-base) ใๅพฎ่ชฟๆดใใพใใ ://huggingface.co/datasets/eli5) ใใผใฟใปใใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/fill-mask) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load ELI5 dataset
+
+ใพใใELI5 ใใผใฟใปใใใฎ r/askscience ใตใใปใใใฎๅฐใใใตใใปใใใ ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใใญใผใใใพใใใใใง
+ใใผใฟใปใใๅ
จไฝใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใไธใใใใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> eli5 = load_dataset("eli5", split="train_asks[:5000]")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train_asks` ใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+```py
+>>> eli5 = eli5.train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> eli5["train"][0]
+{'answers': {'a_id': ['c3d1aib', 'c3d4lya'],
+ 'score': [6, 3],
+ 'text': ["The velocity needed to remain in orbit is equal to the square root of Newton's constant times the mass of earth divided by the distance from the center of the earth. I don't know the altitude of that specific mission, but they're usually around 300 km. That means he's going 7-8 km/s.\n\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.",
+ "Hope you don't mind me asking another question, but why aren't there any stars visible in this photo?"]},
+ 'answers_urls': {'url': []},
+ 'document': '',
+ 'q_id': 'nyxfp',
+ 'selftext': '_URL_0_\n\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?',
+ 'selftext_urls': {'url': ['http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg']},
+ 'subreddit': 'askscience',
+ 'title': 'Few questions about this space walk photograph.',
+ 'title_urls': {'url': []}}
+```
+
+ใใใฏๅคใใฎใใจใฎใใใซ่ฆใใใใใใใพใใใใๅฎ้ใซ้ขๅฟใใใใฎใฏ`text`ใใฃใผใซใใ ใใงใใ่จ่ชใขใใชใณใฐ ใฟในใฏใฎๅชใใ็นใฏใๆฌกใฎๅ่ชใใฉใใซ * ใงใใใใใใฉใใซ (ๆๅธซใชใใฟในใฏใจใๅผใฐใใพใ) ใๅฟ
่ฆใชใใใจใงใใ
+
+## Preprocess
+
+
+
+ใในใฏใใใ่จ่ชใขใใชใณใฐใฎๅ ดๅใๆฌกใฎในใใใใฏใ`text`ใตใใใฃใผใซใใๅฆ็ใใใใใซ DistilRoBERTa ใใผใฏใใคใถใผใใญใผใใใใใจใงใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilroberta-base")
+```
+
+ไธใฎไพใใใใใใใใซใ`text`ใใฃใผใซใใฏๅฎ้ใซใฏ`answers`ๅ
ใซใในใใใใฆใใพใใใใใฏใๆฌกใฎใใจใ่กใๅฟ
่ฆใใใใใจใๆๅณใใพใ
+[` flatten`](https://huggingface.co/docs/datasets/process.html#flatten) ใกใฝใใใไฝฟ็จใใฆใใในใใใใๆง้ ใใ `text` ใตใใใฃใผใซใใๆฝๅบใใพใใ
+
+```py
+>>> eli5 = eli5.flatten()
+>>> eli5["train"][0]
+{'answers.a_id': ['c3d1aib', 'c3d4lya'],
+ 'answers.score': [6, 3],
+ 'answers.text': ["The velocity needed to remain in orbit is equal to the square root of Newton's constant times the mass of earth divided by the distance from the center of the earth. I don't know the altitude of that specific mission, but they're usually around 300 km. That means he's going 7-8 km/s.\n\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.",
+ "Hope you don't mind me asking another question, but why aren't there any stars visible in this photo?"],
+ 'answers_urls.url': [],
+ 'document': '',
+ 'q_id': 'nyxfp',
+ 'selftext': '_URL_0_\n\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?',
+ 'selftext_urls.url': ['http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg'],
+ 'subreddit': 'askscience',
+ 'title': 'Few questions about this space walk photograph.',
+ 'title_urls.url': []}
+```
+
+`answers`ๆฅ้ ญ่พใง็คบใใใใใใซใๅใตใใใฃใผใซใใฏๅๅฅใฎๅใซใชใใ`text`ใใฃใผใซใใฏใชในใใซใชใใพใใใใใฎไปฃใใ
+ๅๆใๅๅฅใซใใผใฏใณๅใใๅ ดๅใฏใใชในใใๆๅญๅใซๅคๆใใฆใใใใใใพใจใใฆใใผใฏใณๅใงใใใใใซใใพใใ
+
+ไปฅไธใฏใๅไพใฎๆๅญๅใฎใชในใใ็ตๅใใ็ตๆใใใผใฏใณๅใใๆๅใฎๅๅฆ็้ขๆฐใงใใ
+
+```py
+>>> def preprocess_function(examples):
+... return tokenizer([" ".join(x) for x in examples["answers.text"]])
+```
+
+ใใฎๅๅฆ็้ขๆฐใใใผใฟใปใใๅ
จไฝใซ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ใกใฝใใใไฝฟ็จใใพใใ `map` ้ขๆฐใ้ซ้ๅใใใซใฏใ`batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใ`num_proc` ใงใใญใปในใฎๆฐใๅขใใใพใใไธ่ฆใชๅใๅ้คใใพใใ
+
+```py
+>>> tokenized_eli5 = eli5.map(
+... preprocess_function,
+... batched=True,
+... num_proc=4,
+... remove_columns=eli5["train"].column_names,
+... )
+```
+
+ใใฎใใผใฟใปใใใซใฏใใผใฏใณ ใทใผใฑใณในใๅซใพใใฆใใพใใใใใฎไธ้จใฏใขใใซใฎๆๅคงๅ
ฅๅ้ทใใใ้ทใใชใใพใใ
+
+2 ็ช็ฎใฎๅๅฆ็้ขๆฐใไฝฟ็จใใฆใ
+- ใในใฆใฎใทใผใฑใณในใ้ฃ็ตใใพใ
+- ้ฃ็ตใใใใทใผใฑใณในใ`block_size`ใงๅฎ็พฉใใใ็ญใใใฃใณใฏใซๅๅฒใใพใใใใใฏใๆๅคงๅ
ฅๅ้ทใใ็ญใใGPU RAM ใซๅๅใช้ทใใงใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> block_size = 128
+
+
+>>> def group_texts(examples):
+... # Concatenate all texts.
+... concatenated_examples = {k: sum(examples[k], []) for k in examples.keys()}
+... total_length = len(concatenated_examples[list(examples.keys())[0]])
+... # We drop the small remainder, we could add padding if the model supported it instead of this drop, you can
+... # customize this part to your needs.
+... if total_length >= block_size:
+... total_length = (total_length // block_size) * block_size
+... # Split by chunks of block_size.
+... result = {
+... k: [t[i : i + block_size] for i in range(0, total_length, block_size)]
+... for k, t in concatenated_examples.items()
+... }
+... return result
+```
+
+ใใผใฟใปใใๅ
จไฝใซ`group_texts`้ขๆฐใ้ฉ็จใใพใใ
+
+```py
+>>> lm_dataset = tokenized_eli5.map(group_texts, batched=True, num_proc=4)
+```
+
+ๆฌกใซใ[`DataCollatโโorForLanguageModeling`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใใใผใฟใปใใๅ
จไฝใๆๅคง้ทใพใงใใใฃใณใฐใใใฎใงใฏใชใใ็
งๅไธญใซใใใๅ
ใฎๆ้ทใฎ้ทใใพใงๆใ *ๅ็ใซใใใฃใณใฐ* ใใๆนใๅน็็ใงใใ
+
+
+
+
+ใทใผใฑใณใน็ตไบใใผใฏใณใใใใฃใณใฐ ใใผใฏใณใจใใฆไฝฟ็จใใใใผใฟใๅๅพฉใใใใณใซใฉใณใใ ใซใใผใฏใณใใในใฏใใใใใซ `mlm_probability` ใๆๅฎใใพใใ
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> tokenizer.pad_token = tokenizer.eos_token
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=0.15)
+```
+
+
+
+ใทใผใฑใณใน็ตไบใใผใฏใณใใใใฃใณใฐ ใใผใฏใณใจใใฆไฝฟ็จใใใใผใฟใๅๅพฉใใใใณใซใฉใณใใ ใซใใผใฏใณใใในใฏใใใใใซ `mlm_probability` ใๆๅฎใใพใใ
+
+
+```py
+>>> from transformers import DataCollatorForLanguageModeling
+
+>>> data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=0.15, return_tensors="tf")
+```
+
+
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForMaskedLM`] ใไฝฟ็จใใฆ DistilRoBERTa ใใญใผใใใพใใ
+
+```py
+>>> from transformers import AutoModelForMaskedLM
+
+>>> model = AutoModelForMaskedLM.from_pretrained("distilbert/distilroberta-base")
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใ
+2. ใใฌใผใใณใฐๅผๆฐใใขใใซใใใผใฟใปใใใใใผใฟ็
งๅๅจใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_eli5_mlm_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=lm_dataset["train"],
+... eval_dataset=lm_dataset["test"],
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.evaluate`] ใกใฝใใใไฝฟ็จใใฆใขใใซใ่ฉไพกใใใใฎ่ค้ใใๅๅพใใพใใ
+
+
+```py
+>>> import math
+
+>>> eval_results = trainer.evaluate()
+>>> print(f"Perplexity: {math.exp(eval_results['eval_loss']):.2f}")
+Perplexity: 8.76
+```
+
+ๆฌกใซใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-a-tensorflow-model-with-keras) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใใชใใใฃใใคใถใผ้ขๆฐใๅญฆ็ฟ็ในใฑใธใฅใผใซใใใใณใใใคใใฎใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใผใใปใใใขใใใใใใจใใๅงใใพใใ
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+ๆฌกใซใ[`TFAutoModelForMaskedLM`] ใไฝฟ็จใใฆ DistilRoBERTa ใใญใผใใงใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForMaskedLM
+
+>>> model = TFAutoModelForMaskedLM.from_pretrained("distilbert/distilroberta-base")
+```
+
+[`~transformers.TFPreTrainedModel.prepare_tf_dataset`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... lm_dataset["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... lm_dataset["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใฎใขใใซใ่จญๅฎใใพใใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+This can be done by specifying where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> callback = PushToHubCallback(
+... output_dir="my_awesome_eli5_mlm_model",
+... tokenizer=tokenizer,
+... )
+```
+
+ใคใใซใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใใณใผใซใใใฏใๆๅฎใใฆ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใๅผใณๅบใใใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=[callback])
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใจใใขใใซใฏ่ชๅ็ใซใใใซใขใใใญใผใใใใ่ชฐใงใไฝฟ็จใงใใใใใซใชใใพใใ
+
+
+
+
+
+
+ใในใฏใใใ่จ่ชใขใใชใณใฐ็จใซใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎใใ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+[PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)
+ใพใใฏ [TensorFlow ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)ใ
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ใขใใซใซ็ฉบ็ฝใๅใใใใญในใใ่ใๅบใใ็นๅฅใช `` ใใผใฏใณใไฝฟ็จใใฆ็ฉบ็ฝใ็คบใใพใใ
+
+```py
+>>> text = "The Milky Way is a galaxy."
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆใใฃใซใในใฏใฎ`pipeline`ใใคใณในใฟใณในๅใใใใญในใใใใใซๆธกใใพใใๅฟ
่ฆใซๅฟใใฆใ`top_k`ใใฉใกใผใฟใไฝฟ็จใใฆใ่ฟใไบๆธฌใฎๆฐใๆๅฎใงใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> mask_filler = pipeline("fill-mask", "stevhliu/my_awesome_eli5_mlm_model")
+>>> mask_filler(text, top_k=3)
+[{'score': 0.5150994658470154,
+ 'token': 21300,
+ 'token_str': ' spiral',
+ 'sequence': 'The Milky Way is a spiral galaxy.'},
+ {'score': 0.07087188959121704,
+ 'token': 2232,
+ 'token_str': ' massive',
+ 'sequence': 'The Milky Way is a massive galaxy.'},
+ {'score': 0.06434620916843414,
+ 'token': 650,
+ 'token_str': ' small',
+ 'sequence': 'The Milky Way is a small galaxy.'}]
+```
+
+
+
+
+ใใญในใใใใผใฏใณๅใใ`input_ids`ใ PyTorch ใใณใฝใซใจใใฆ่ฟใใพใใ `` ใใผใฏใณใฎไฝ็ฝฎใๆๅฎใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_eli5_mlm_model")
+>>> inputs = tokenizer(text, return_tensors="pt")
+>>> mask_token_index = torch.where(inputs["input_ids"] == tokenizer.mask_token_id)[1]
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใใในใฏใใใใใผใฏใณใฎ`logits`ใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoModelForMaskedLM
+
+>>> model = AutoModelForMaskedLM.from_pretrained("stevhliu/my_awesome_eli5_mlm_model")
+>>> logits = model(**inputs).logits
+>>> mask_token_logits = logits[0, mask_token_index, :]
+```
+
+ๆฌกใซใใในใฏใใใ 3 ใคใฎใใผใฏใณใๆใ้ซใ็ขบ็ใง่ฟใใๅบๅใใพใใ
+
+```py
+>>> top_3_tokens = torch.topk(mask_token_logits, 3, dim=1).indices[0].tolist()
+
+>>> for token in top_3_tokens:
+... print(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
+The Milky Way is a spiral galaxy.
+The Milky Way is a massive galaxy.
+The Milky Way is a small galaxy.
+```
+
+
+
+
+ใใญในใใใใผใฏใณๅใใ`input_ids`ใ TensorFlow ใใณใฝใซใจใใฆ่ฟใใพใใ `` ใใผใฏใณใฎไฝ็ฝฎใๆๅฎใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_eli5_mlm_model")
+>>> inputs = tokenizer(text, return_tensors="tf")
+>>> mask_token_index = tf.where(inputs["input_ids"] == tokenizer.mask_token_id)[0, 1]
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใใในใฏใใใใใผใฏใณใฎ`logits`ใ่ฟใใพใใ
+
+
+```py
+>>> from transformers import TFAutoModelForMaskedLM
+
+>>> model = TFAutoModelForMaskedLM.from_pretrained("stevhliu/my_awesome_eli5_mlm_model")
+>>> logits = model(**inputs).logits
+>>> mask_token_logits = logits[0, mask_token_index, :]
+```
+
+ๆฌกใซใใในใฏใใใ 3 ใคใฎใใผใฏใณใๆใ้ซใ็ขบ็ใง่ฟใใๅบๅใใพใใ
+
+
+```py
+>>> top_3_tokens = tf.math.top_k(mask_token_logits, 3).indices.numpy()
+
+>>> for token in top_3_tokens:
+... print(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
+The Milky Way is a spiral galaxy.
+The Milky Way is a massive galaxy.
+The Milky Way is a small galaxy.
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/monocular_depth_estimation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/monocular_depth_estimation.md
new file mode 100644
index 0000000000000000000000000000000000000000..e7a3a994a60ebc3ee752cfd0461bb7436c7b8406
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/monocular_depth_estimation.md
@@ -0,0 +1,149 @@
+
+
+# Monocular depth estimation
+
+ๅ็ผๅฅฅ่กใๆจๅฎใฏใใทใผใณใฎๅฅฅ่กใๆ
ๅ ฑใ็ปๅใใไบๆธฌใใใใจใๅซใใณใณใใฅใผใฟใผ ใใธใงใณ ใฟในใฏใงใใ
+ๅไธใฎ็ปๅใ่จใๆใใใฐใใทใผใณๅ
ใฎใชใใธใงใฏใใฎ่ท้ขใ่ท้ขใใๆจๅฎใใใใญใปในใงใใ
+ๅไธใซใกใฉใฎ่ฆ็นใ
+
+ๅ็ผๅฅฅ่กใๆจๅฎใซใฏใ3D ๅๆง็ฏใๆกๅผต็พๅฎใ่ชๅ้่ปขใ
+ใใใฆใญใใใๅทฅๅญฆใใขใใซใใชใใธใงใฏใ้ใฎ่ค้ใช้ขไฟใ็่งฃใใๅฟ
่ฆใใใใใใใใใฏๅฐ้ฃใชไฝๆฅญใงใใ
+ใทใผใณใจใใใซๅฏพๅฟใใๆทฑๅบฆๆ
ๅ ฑ๏ผ็
งๆๆกไปถใชใฉใฎ่ฆๅ ใฎๅฝฑ้ฟใๅใใๅฏ่ฝๆงใใใใพใ๏ผ
+ใชใฏใซใผใธใงใณใจใใฏในใใฃใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/depth-estimation) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใๅญฆใณใพใใ
+
+* ๆทฑๅบฆๆจๅฎใใคใใฉใคใณใไฝๆใใ
+* ๆๅใงๆทฑๅบฆๆจๅฎๆจ่ซใๅฎ่กใใพใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install -q transformers
+```
+
+## Depth estimation pipeline
+
+ๆทฑๅบฆๆจๅฎใใตใใผใใใใขใใซใงๆจ่ซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใๅฏพๅฟใใ [`pipeline`] ใไฝฟ็จใใใใจใงใใ
+[Hugging Face Hub ใฎใใงใใฏใใคใณใ](https://huggingface.co/models?pipeline_tag=Depth-estimation&sort=downloads) ใใใใคใใฉใคใณใใคใณในใฟใณในๅใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> checkpoint = "vinvino02/glpn-nyu"
+>>> depth_estimator = pipeline("depth-estimation", model=checkpoint)
+```
+
+ๆฌกใซใๅๆใใ็ปๅใ้ธๆใใพใใ
+
+```py
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://unsplash.com/photos/HwBAsSbPBDU/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MzR8fGNhciUyMGluJTIwdGhlJTIwc3RyZWV0fGVufDB8MHx8fDE2Nzg5MDEwODg&force=true&w=640"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+>>> image
+```
+
+
+
+
+
+็ปๅใใใคใใฉใคใณใซๆธกใใพใใ
+
+```py
+>>> predictions = depth_estimator(image)
+```
+
+ใใคใใฉใคใณใฏ 2 ใคใฎใจใณใใชใๅซใ่พๆธใ่ฟใใพใใๆๅใฎใใฎใฏ`predicted_ Depth`ใจๅผใฐใใๆฌกใฎๅคใๆใคใใณใฝใซใงใใ
+ๆทฑใใฏๅใใฏใปใซใฎใกใผใใซๅไฝใง่กจใใใพใใ
+2 ็ช็ฎใฎ`depth`ใฏใๆทฑๅบฆๆจๅฎ็ตๆใ่ฆ่ฆๅใใ PIL ็ปๅใงใใ
+
+่ฆ่ฆๅใใใ็ตๆใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> predictions["depth"]
+```
+
+
+
+
+
+## Depth estimation inference by hand
+
+ๆทฑๅบฆๆจๅฎใใคใใฉใคใณใฎไฝฟ็จๆนๆณใ็่งฃใใใฎใงใๅใ็ตๆใๆๅใง่ค่ฃฝใใๆนๆณใ่ฆใฆใฟใพใใใใ
+
+ใพใใ[Hugging Face Hub ใฎใใงใใฏใใคใณใ](https://huggingface.co/models?pipeline_tag=Depth-estimation&sort=downloads) ใใใขใใซใจ้ข้ฃใใญใปใใตใใญใผใใใพใใ
+ใใใงใฏใๅใจๅใใใงใใฏใใคใณใใไฝฟ็จใใพใใ
+
+
+```py
+>>> from transformers import AutoImageProcessor, AutoModelForDepthEstimation
+
+>>> checkpoint = "vinvino02/glpn-nyu"
+
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint)
+>>> model = AutoModelForDepthEstimation.from_pretrained(checkpoint)
+```
+
+ๅฟ
่ฆใช็ปๅๅคๆใๅฆ็ใใ`image_processor`ใไฝฟ็จใใฆใใขใใซใฎ็ปๅๅ
ฅๅใๆบๅใใพใใ
+ใตใคใบๅคๆดใๆญฃ่ฆๅใชใฉ:
+
+```py
+>>> pixel_values = image_processor(image, return_tensors="pt").pixel_values
+```
+
+ๆบๅใใใๅ
ฅๅใใขใใซใซๆธกใใพใใ
+
+```py
+>>> import torch
+
+>>> with torch.no_grad():
+... outputs = model(pixel_values)
+... predicted_depth = outputs.predicted_depth
+```
+
+็ตๆใ่ฆ่ฆๅใใพใใ
+
+
+```py
+>>> import numpy as np
+
+>>> # interpolate to original size
+>>> prediction = torch.nn.functional.interpolate(
+... predicted_depth.unsqueeze(1),
+... size=image.size[::-1],
+... mode="bicubic",
+... align_corners=False,
+... ).squeeze()
+>>> output = prediction.numpy()
+
+>>> formatted = (output * 255 / np.max(output)).astype("uint8")
+>>> depth = Image.fromarray(formatted)
+>>> depth
+```
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/multiple_choice.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/multiple_choice.md
new file mode 100644
index 0000000000000000000000000000000000000000..075a7a2cb764556b49f7833e676dbd4f7357965e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/multiple_choice.md
@@ -0,0 +1,459 @@
+
+
+# Multiple choice
+
+[[open-in-colab]]
+
+ๅค่ข้ธๆใฟในใฏใฏ่ณชๅๅฟ็ญใซไผผใฆใใพใใใใใใคใใฎๅ่ฃใฎๅ็ญใใณใณใใญในใใจใจใใซๆไพใใใๆญฃใใๅ็ญใ้ธๆใใใใใซใขใใซใใใฌใผใใณใฐใใใ็นใ็ฐใชใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [SWAG](https://huggingface.co/datasets/swag) ใใผใฟใปใใใฎใ้ๅธธใๆงๆใง [BERT](https://huggingface.co/google-bert/bert-base-uncased) ใๅพฎ่ชฟๆดใใฆใๆ้ฉใชใใผใฟใปใใใ้ธๆใใพใ่คๆฐใฎ้ธๆ่ขใจไฝใใใฎใณใณใใญในใใ่ๆ
ฎใใฆๅ็ญใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load SWAG dataset
+
+ใพใใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ SWAG ใใผใฟใปใใใฎใ้ๅธธใๆงๆใใญใผใใใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> swag = load_dataset("swag", "regular")
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> swag["train"][0]
+{'ending0': 'passes by walking down the street playing their instruments.',
+ 'ending1': 'has heard approaching them.',
+ 'ending2': "arrives and they're outside dancing and asleep.",
+ 'ending3': 'turns the lead singer watches the performance.',
+ 'fold-ind': '3416',
+ 'gold-source': 'gold',
+ 'label': 0,
+ 'sent1': 'Members of the procession walk down the street holding small horn brass instruments.',
+ 'sent2': 'A drum line',
+ 'startphrase': 'Members of the procession walk down the street holding small horn brass instruments. A drum line',
+ 'video-id': 'anetv_jkn6uvmqwh4'}
+```
+
+ใใใซใฏใใใใใฎใใฃใผใซใใใใใใใซ่ฆใใพใใใๅฎ้ใฏ้ๅธธใซ็ฐกๅใงใใ
+
+- `sent1` ใจ `sent2`: ใใใใฎใใฃใผใซใใฏๆใฎๅงใพใใ็คบใใใใฎ 2 ใคใ็ตใฟๅใใใใจ `startphrase` ใใฃใผใซใใๅพใใใพใใ
+- `ending`: ๆใฎ็ตใใๆนใจใใฆ่ใใใใ็ตใใๆนใ็คบๅใใพใใใๆญฃใใใฎใฏ 1 ใคใ ใใงใใ
+- `label`: ๆญฃใใๆใฎ็ตใใใ่ญๅฅใใพใใ
+
+## Preprocess
+
+ๆฌกใฎในใใใใงใฏใBERT ใใผใฏใใคใถใผใใญใผใใใฆใๆใฎๅงใพใใจ 4 ใคใฎๅฏ่ฝใช็ตใใใๅฆ็ใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
+```
+
+ไฝๆใใๅๅฆ็้ขๆฐใฏๆฌกใฎใใจใ่กใๅฟ
่ฆใใใใพใใ
+
+1. `sent1` ใใฃใผใซใใฎใณใใผใ 4 ใคไฝๆใใใใใใใ `sent2` ใจ็ตใฟๅใใใฆๆใฎๅงใพใใๅ็พใใพใใ
+2. `sent2` ใ 4 ใคใฎๅฏ่ฝใชๆๆซๅฐพใฎใใใใใจ็ตใฟๅใใใพใใ
+3. ใใใ 2 ใคใฎใชในใใใใผใฏใณๅใงใใใใใซใใฉใใๅใใใใฎๅพใๅไพใซๅฏพๅฟใใ `input_ids`ใ`attention_mask`ใใใใณ `labels` ใใฃใผใซใใๅซใพใใใใใซ้ใใฉใใๅใใพใใ
+
+```py
+>>> ending_names = ["ending0", "ending1", "ending2", "ending3"]
+
+
+>>> def preprocess_function(examples):
+... first_sentences = [[context] * 4 for context in examples["sent1"]]
+... question_headers = examples["sent2"]
+... second_sentences = [
+... [f"{header} {examples[end][i]}" for end in ending_names] for i, header in enumerate(question_headers)
+... ]
+
+... first_sentences = sum(first_sentences, [])
+... second_sentences = sum(second_sentences, [])
+
+... tokenized_examples = tokenizer(first_sentences, second_sentences, truncation=True)
+... return {k: [v[i : i + 4] for i in range(0, len(v), 4)] for k, v in tokenized_examples.items()}
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ใกใฝใใใไฝฟ็จใใพใใ `batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใใใจใงใ`map` ้ขๆฐใ้ซ้ๅใงใใพใใ
+
+
+```py
+tokenized_swag = swag.map(preprocess_function, batched=True)
+```
+
+๐ค Transformers ใซใฏๅค่ข้ธๆ็จใฎใใผใฟ็
งๅๅจใใชใใใใ[`DataCollatโโorWithPadding`] ใ่ชฟๆดใใฆใตใณใใซใฎใใใใไฝๆใใๅฟ
่ฆใใใใพใใใใผใฟใปใใๅ
จไฝใๆๅคง้ทใพใงใใใฃใณใฐใใใฎใงใฏใชใใ็
งๅไธญใซใใใๅ
ใฎๆ้ทใฎ้ทใใพใงๆใ *ๅ็ใซใใใฃใณใฐ* ใใๆนใๅน็็ใงใใ
+
+`DataCollatโโorForMultipleChoice` ใฏใใในใฆใฎใขใใซๅ
ฅๅใๅนณๅฆๅใใใใใฃใณใฐใ้ฉ็จใใฆใ็ตๆใ้ๅนณๅฆๅใใพใใ
+
+
+
+```py
+>>> from dataclasses import dataclass
+>>> from transformers.tokenization_utils_base import PreTrainedTokenizerBase, PaddingStrategy
+>>> from typing import Optional, Union
+>>> import torch
+
+
+>>> @dataclass
+... class DataCollatorForMultipleChoice:
+... """
+... Data collator that will dynamically pad the inputs for multiple choice received.
+... """
+
+... tokenizer: PreTrainedTokenizerBase
+... padding: Union[bool, str, PaddingStrategy] = True
+... max_length: Optional[int] = None
+... pad_to_multiple_of: Optional[int] = None
+
+... def __call__(self, features):
+... label_name = "label" if "label" in features[0].keys() else "labels"
+... labels = [feature.pop(label_name) for feature in features]
+... batch_size = len(features)
+... num_choices = len(features[0]["input_ids"])
+... flattened_features = [
+... [{k: v[i] for k, v in feature.items()} for i in range(num_choices)] for feature in features
+... ]
+... flattened_features = sum(flattened_features, [])
+
+... batch = self.tokenizer.pad(
+... flattened_features,
+... padding=self.padding,
+... max_length=self.max_length,
+... pad_to_multiple_of=self.pad_to_multiple_of,
+... return_tensors="pt",
+... )
+
+... batch = {k: v.view(batch_size, num_choices, -1) for k, v in batch.items()}
+... batch["labels"] = torch.tensor(labels, dtype=torch.int64)
+... return batch
+```
+
+
+```py
+>>> from dataclasses import dataclass
+>>> from transformers.tokenization_utils_base import PreTrainedTokenizerBase, PaddingStrategy
+>>> from typing import Optional, Union
+>>> import tensorflow as tf
+
+
+>>> @dataclass
+... class DataCollatorForMultipleChoice:
+... """
+... Data collator that will dynamically pad the inputs for multiple choice received.
+... """
+
+... tokenizer: PreTrainedTokenizerBase
+... padding: Union[bool, str, PaddingStrategy] = True
+... max_length: Optional[int] = None
+... pad_to_multiple_of: Optional[int] = None
+
+... def __call__(self, features):
+... label_name = "label" if "label" in features[0].keys() else "labels"
+... labels = [feature.pop(label_name) for feature in features]
+... batch_size = len(features)
+... num_choices = len(features[0]["input_ids"])
+... flattened_features = [
+... [{k: v[i] for k, v in feature.items()} for i in range(num_choices)] for feature in features
+... ]
+... flattened_features = sum(flattened_features, [])
+
+... batch = self.tokenizer.pad(
+... flattened_features,
+... padding=self.padding,
+... max_length=self.max_length,
+... pad_to_multiple_of=self.pad_to_multiple_of,
+... return_tensors="tf",
+... )
+
+... batch = {k: tf.reshape(v, (batch_size, num_choices, -1)) for k, v in batch.items()}
+... batch["labels"] = tf.convert_to_tensor(labels, dtype=tf.int64)
+... return batch
+```
+
+
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[accuracy](https://huggingface.co/spaces/evaluate-metric/accuracy) ใกใใชใฏในใ่ชญใฟ่พผใฟใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใ ใใ) ) ใกใใชใฏในใฎ่ชญใฟ่พผใฟใจ่จ็ฎๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใๆฌกใๅ็
งใใฆใใ ใใ)ใ
+
+```py
+>>> import evaluate
+
+>>> accuracy = evaluate.load("accuracy")
+```
+
+ๆฌกใซใไบๆธฌใจใฉใใซใ [`~evaluate.EvaluationModule.compute`] ใซๆธกใใฆ็ฒพๅบฆใ่จ็ฎใใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions, labels = eval_pred
+... predictions = np.argmax(predictions, axis=1)
+... return accuracy.compute(predictions=predictions, references=labels)
+```
+
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForMultipleChoice`] ใไฝฟ็จใใฆ BERT ใใญใผใใใพใใ
+
+```py
+>>> from transformers import AutoModelForMultipleChoice, TrainingArguments, Trainer
+
+>>> model = AutoModelForMultipleChoice.from_pretrained("google-bert/bert-base-uncased")
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`Trainer`] ใฏ็ฒพๅบฆใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_swag_model",
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... load_best_model_at_end=True,
+... learning_rate=5e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_swag["train"],
+... eval_dataset=tokenized_swag["validation"],
+... processing_class=tokenizer,
+... data_collator=DataCollatorForMultipleChoice(tokenizer=tokenizer),
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใพใใใใซใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-a-tensorflow-model-with-keras) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใใชใใใฃใใคใถใผ้ขๆฐใๅญฆ็ฟ็ในใฑใธใฅใผใซใใใใณใใใคใใฎใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใผใใปใใใขใใใใใใจใใๅงใใพใใ
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_train_epochs = 2
+>>> total_train_steps = (len(tokenized_swag["train"]) // batch_size) * num_train_epochs
+>>> optimizer, schedule = create_optimizer(init_lr=5e-5, num_warmup_steps=0, num_train_steps=total_train_steps)
+```
+
+ๆฌกใซใ[`TFAutoModelForMultipleChoice`] ใไฝฟ็จใใฆ BERT ใใญใผใใงใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForMultipleChoice
+
+>>> model = TFAutoModelForMultipleChoice.from_pretrained("google-bert/bert-base-uncased")
+```
+
+[`~transformers.TFPreTrainedModel.prepare_tf_dataset`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> data_collator = DataCollatorForMultipleChoice(tokenizer=tokenizer)
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_swag["train"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_swag["validation"],
+... shuffle=False,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+```
+
+[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใฎใขใใซใ่จญๅฎใใพใใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+ใใฌใผใใณใฐใ้ๅงใใๅใซใปใใใขใใใใๆๅพใฎ 2 ใคใฎใใจใฏใไบๆธฌใใ็ฒพๅบฆใ่จ็ฎใใใใจใจใใขใใซใใใใซใใใทใฅใใๆนๆณใๆไพใใใใจใงใใใฉใกใใ [Keras ใณใผใซใใใฏ](../main_classes/keras_callbacks) ใไฝฟ็จใใฆ่กใใใพใใ
+
+`compute_metrics` ้ขๆฐใ [`~transformers.KerasMetricCallback`] ใซๆธกใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)
+```
+
+[`~transformers.PushToHubCallback`] ใงใขใใซใจใใผใฏใใคใถใผใใใใทใฅใใๅ ดๆใๆๅฎใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_model",
+... tokenizer=tokenizer,
+... )
+```
+
+ๆฌกใซใใณใผใซใใใฏใใพใจใใฆใใณใใซใใพใใ
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+ใคใใซใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใใณใผใซใใใฏใๆๅฎใใฆ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใๅผใณๅบใใใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=2, callbacks=callbacks)
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใจใใขใใซใฏ่ชๅ็ใซใใใซใขใใใญใผใใใใ่ชฐใงใไฝฟ็จใงใใใใใซใชใใพใใ
+
+
+
+
+
+
+
+่คๆฐ้ธๆ็จใซใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใใปใฏใทใงใณใๅ็
งใใฆใใ ใใใ
+[PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb)
+ใพใใฏ [TensorFlow ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb)ใ
+
+
+
+
+# Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ใใใคใใฎใใญในใใจ 2 ใคใฎๅ็ญๅ่ฃใ่ใใฆใใ ใใใ
+
+```py
+>>> prompt = "France has a bread law, Le Dรฉcret Pain, with strict rules on what is allowed in a traditional baguette."
+>>> candidate1 = "The law does not apply to croissants and brioche."
+>>> candidate2 = "The law applies to baguettes."
+```
+
+
+
+
+ๅใใญใณใใใจๅ็ญๅ่ฃใฎใใขใใใผใฏใณๅใใPyTorch ใใณใฝใซใ่ฟใใพใใใใใคใใฎ`lables`ใไฝๆใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_swag_model")
+>>> inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors="pt", padding=True)
+>>> labels = torch.tensor(0).unsqueeze(0)
+```
+
+ๅ
ฅๅใจใฉใใซใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoModelForMultipleChoice
+
+>>> model = AutoModelForMultipleChoice.from_pretrained("my_awesome_swag_model")
+>>> outputs = model(**{k: v.unsqueeze(0) for k, v in inputs.items()}, labels=labels)
+>>> logits = outputs.logits
+```
+
+ๆใ้ซใ็ขบ็ใงใฏใฉในใๅๅพใใพใใ
+
+```py
+>>> predicted_class = logits.argmax().item()
+>>> predicted_class
+'0'
+```
+
+
+
+ๅใใญใณใใใจๅ็ญๅ่ฃใฎใใขใใใผใฏใณๅใใTensorFlow ใใณใฝใซใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_swag_model")
+>>> inputs = tokenizer([[prompt, candidate1], [prompt, candidate2]], return_tensors="tf", padding=True)
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForMultipleChoice
+
+>>> model = TFAutoModelForMultipleChoice.from_pretrained("my_awesome_swag_model")
+>>> inputs = {k: tf.expand_dims(v, 0) for k, v in inputs.items()}
+>>> outputs = model(inputs)
+>>> logits = outputs.logits
+```
+
+ๆใ้ซใ็ขบ็ใงใฏใฉในใๅๅพใใพใใ
+
+```py
+>>> predicted_class = int(tf.math.argmax(logits, axis=-1)[0])
+>>> predicted_class
+'0'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/object_detection.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/object_detection.md
new file mode 100644
index 0000000000000000000000000000000000000000..31e8effa54b224deb50a1fbc06e90f2ce972e5b4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/object_detection.md
@@ -0,0 +1,598 @@
+
+
+# Object detection
+
+[[open-in-colab]]
+
+ใชใใธใงใฏใๆคๅบใฏใ็ปๅๅ
ใฎใคใณในใฟใณใน (ไบบ้ใๅปบ็ฉใ่ปใชใฉ) ใๆคๅบใใใณใณใใฅใผใฟใผ ใใธใงใณ ใฟในใฏใงใใ็ฉไฝๆคๅบใขใใซใฏ็ปๅใๅ
ฅๅใใใณๅบๅใจใใฆๅใๅใใพใ
+ๆคๅบใใใใชใใธใงใฏใใฎๅข็ใใใฏในใจ้ข้ฃใใใฉใใซใฎๅบงๆจใ็ปๅใซใฏ่คๆฐใฎใชใใธใงใฏใใๅซใใใใจใใงใใพใใ
+ใใใใใซ็ฌ่ชใฎๅข็ใใใฏในใจใฉใใซใใใ (ไพ: ่ปใจๅปบ็ฉใๆใคใใจใใงใใพใ)ใๅใชใใธใงใฏใใฏ
+็ปๅใฎใใพใใพใช้จๅใซๅญๅจใใๅฟ
่ฆใใใใพใ (ใใจใใฐใ็ปๅใซใฏ่คๆฐใฎ่ปใๅซใพใใฆใใๅฏ่ฝๆงใใใใพใ)ใ
+ใใฎใฟในใฏใฏใๆญฉ่ก่
ใ้่ทฏๆจ่ญใไฟกๅทๆฉใชใฉใๆคๅบใใใใใซ่ชๅ้่ปขใงไธ่ฌ็ใซไฝฟ็จใใใพใใ
+ไปใฎใขใใชใฑใผใทใงใณใซใฏใ็ปๅๅ
ใฎใชใใธใงใฏใใฎใซใฆใณใใ็ปๅๆค็ดขใชใฉใๅซใพใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใๅญฆ็ฟใใพใใ
+
+ 1. Finetune [DETR](https://huggingface.co/docs/transformers/model_doc/detr)ใ็ณใฟ่พผใฟใขใซใดใชใบใ ใ็ตใฟๅใใใใขใใซ
+ [CPPE-5](https://huggingface.co/datasets/cppe-5) ไธใฎใจใณใณใผใใผ/ใใณใผใใผ ใใฉใณในใใฉใผใใผใๅใใใใใฏใใผใณ
+ ใใผใฟใปใใใ
+ 2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/object-detection) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+
+```bash
+pip install -q datasets transformers evaluate timm albumentations
+```
+
+๐ค ใใผใฟใปใใใไฝฟ็จใใฆ Hugging Face Hub ใใใใผใฟใปใใใใญใผใใใ๐ค ใใฉใณในใใฉใผใใผใไฝฟ็จใใฆใขใใซใใใฌใผใใณใฐใใพใใ
+ใใผใฟใๅขๅผทใใใใใฎ`albumentations`ใ `timm` ใฏ็พๅจใDETR ใขใใซใฎ็ณใฟ่พผใฟใใใฏใใผใณใใญใผใใใใใใซๅฟ
่ฆใงใใ
+
+ใขใใซใใณใใฅใใใฃใจๅ
ฑๆใใใใจใใๅงใใใพใใ Hugging Face ใขใซใฆใณใใซใญใฐใคใณใใฆใใใใซใขใใใญใผใใใพใใ
+ใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load the CPPE-5 dataset
+
+[CPPE-5 ใใผใฟใปใใ](https://huggingface.co/datasets/cppe-5) ใซใฏใๆฌกใฎ็ปๅใๅซใพใใฆใใพใใ
+ๆฐๅใณใญใใฆใคใซในๆๆ็ใฎใใณใใใใฏใซใใใๅป็็จๅไบบไฟ่ญทๅ
ท (PPE) ใ่ญๅฅใใๆณจ้ใ
+
+ใใผใฟใปใใใใญใผใใใใใจใใๅงใใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> cppe5 = load_dataset("cppe-5")
+>>> cppe5
+DatasetDict({
+ train: Dataset({
+ features: ['image_id', 'image', 'width', 'height', 'objects'],
+ num_rows: 1000
+ })
+ test: Dataset({
+ features: ['image_id', 'image', 'width', 'height', 'objects'],
+ num_rows: 29
+ })
+})
+```
+
+ใใฎใใผใฟใปใใใซใฏใ1000 ๆใฎ็ปๅใๅซใใใฌใผใใณใฐ ใปใใใจ 29 ๆใฎ็ปๅใๅซใใในใ ใปใใใใใงใซไปๅฑใใฆใใใใจใใใใใพใใ
+
+ใใผใฟใซๆ
ฃใใใใใซใไพใใฉใฎใใใชใใฎใใ่ชฟในใฆใใ ใใใ
+
+```py
+>>> cppe5["train"][0]
+{'image_id': 15,
+ 'image': ,
+ 'width': 943,
+ 'height': 663,
+ 'objects': {'id': [114, 115, 116, 117],
+ 'area': [3796, 1596, 152768, 81002],
+ 'bbox': [[302.0, 109.0, 73.0, 52.0],
+ [810.0, 100.0, 57.0, 28.0],
+ [160.0, 31.0, 248.0, 616.0],
+ [741.0, 68.0, 202.0, 401.0]],
+ 'category': [4, 4, 0, 0]}}
+```
+
+ใใผใฟใปใใๅ
ใฎไพใซใฏๆฌกใฎใใฃใผใซใใใใใพใใ
+- `image_id`: ใตใณใใซใฎ็ปๅID
+- `image`: ็ปๅใๅซใ `PIL.Image.Image` ใชใใธใงใฏใ
+- `width`: ็ปๅใฎๅน
+- `height`: ็ปๅใฎ้ซใ
+- `objects`: ็ปๅๅ
ใฎใชใใธใงใฏใใฎๅข็ใใใฏในใฎใกใฟใใผใฟใๅซใ่พๆธ:
+ - `id`: ใขใใใผใทใงใณID
+ - `area`: ๅข็ใใใฏในใฎ้ ๅ
+ - `bbox`: ใชใใธใงใฏใใฎๅข็ใใใฏใน ([COCO ๅฝขๅผ](https://albumentations.ai/docs/getting_started/bounding_boxes_augmentation/#coco) )
+ - `category`: ใชใใธใงใฏใใฎใซใใดใชใผใๅฏ่ฝใชๅคใซใฏใ`Coverall (0)`ใ`Face_Shield (1)`ใ`Gloves (2)`ใ`Goggles (3)`ใใใใณ `Mask (4)` ใๅซใพใใพใใ
+
+`bbox`ใใฃใผใซใใ COCO ๅฝขๅผใซๅพใฃใฆใใใใจใซๆฐใฅใใใใใใพใใใใใใฏ DETR ใขใใซใไบๆใใๅฝขๅผใงใใ
+ใใ ใใใใชใใธใงใฏใใๅ
ใฎใใฃใผใซใใฎใฐใซใผใๅใฏใDETR ใๅฟ
่ฆใจใใๆณจ้ๅฝขๅผใจใฏ็ฐใชใใพใใใใชใใฏใใใงใใใ
+ใใฎใใผใฟใใใฌใผใใณใฐใซไฝฟ็จใใๅใซใใใใคใใฎๅๅฆ็ๅคๆใ้ฉ็จใใๅฟ
่ฆใใใใพใใ
+
+ใใผใฟใใใใซๆทฑใ็่งฃใใใซใฏใใใผใฟใปใใๅ
ใฎไพใ่ฆ่ฆๅใใพใใ
+
+```py
+>>> import numpy as np
+>>> import os
+>>> from PIL import Image, ImageDraw
+
+>>> image = cppe5["train"][0]["image"]
+>>> annotations = cppe5["train"][0]["objects"]
+>>> draw = ImageDraw.Draw(image)
+
+>>> categories = cppe5["train"].features["objects"].feature["category"].names
+
+>>> id2label = {index: x for index, x in enumerate(categories, start=0)}
+>>> label2id = {v: k for k, v in id2label.items()}
+
+>>> for i in range(len(annotations["id"])):
+... box = annotations["bbox"][i]
+... class_idx = annotations["category"][i]
+... x, y, w, h = tuple(box)
+... draw.rectangle((x, y, x + w, y + h), outline="red", width=1)
+... draw.text((x, y), id2label[class_idx], fill="white")
+
+>>> image
+```
+
+
+
+
+
+้ข้ฃไปใใใใใฉใใซใไฝฟ็จใใฆๅข็ใใใฏในใ่ฆ่ฆๅใใใซใฏใใใผใฟใปใใใฎใกใฟใใผใฟใใใฉใใซใๅๅพใใพใใ
+`category`ใใฃใผใซใใ
+ใพใใใฉใใซ ID ใใฉใใซ ใฏใฉในใซใใใใณใฐใใ่พๆธ (`id2label`) ใใใฎ้ (`label2id`) ใไฝๆใใใใจใใงใใพใใ
+ใใใใฏใๅพใงใขใใซใใปใใใขใใใใใจใใซไฝฟ็จใงใใพใใใใใใฎใใใใๅซใใใจใๅ
ฑๆใใๅ ดๅใซไปใฎไบบใใขใใซใๅๅฉ็จใงใใใใใซใชใใพใใ
+ใใฐใใงใคในใใใซๅใไปใใพใใ
+
+ใใผใฟใซๆ
ฃใใใใใฎๆๅพใฎในใใใใจใใฆใๆฝๅจ็ใชๅ้กใใชใใใใผใฟใ่ชฟๆปใใพใใใใผใฟใปใใใซ้ขใใไธ่ฌ็ใชๅ้กใฎ 1 ใคใฏใ
+ใชใใธใงใฏใๆคๅบใฏใ็ปๅใฎ็ซฏใ่ถใใฆใไผธใณใใๅข็ใใใฏในใงใใใใฎใใใชใๆด่ตฐใๅข็ใใใฏในใฏใ
+ใใฌใผใใณใฐไธญใซใจใฉใผใ็บ็ใใใใใใใฎๆฎต้ใงๅฏพๅฆใใๅฟ
่ฆใใใใพใใใใฎใใผใฟใปใใใซใฏใใใฎๅ้กใซ้ขใใไพใใใใคใใใใพใใ
+ใใฎใฌใคใใงใฏๅ
ๅฎนใใใใใใใใใใใใซใใใใใฎ็ปๅใใใผใฟใใๅ้คใใพใใ
+
+```py
+>>> remove_idx = [590, 821, 822, 875, 876, 878, 879]
+>>> keep = [i for i in range(len(cppe5["train"])) if i not in remove_idx]
+>>> cppe5["train"] = cppe5["train"].select(keep)
+```
+
+## Preprocess the data
+
+ใขใใซใๅพฎ่ชฟๆดใใใซใฏใไบๅใใฌใผใใณใฐใใใใขใใซใซไฝฟ็จใใใใขใใญใผใใจๆญฃ็ขบใซไธ่ดใใใใใซใไฝฟ็จใใไบๅฎใฎใใผใฟใๅๅฆ็ใใๅฟ
่ฆใใใใพใใ
+[`AutoImageProcessor`] ใฏใ็ปๅใใผใฟใๅฆ็ใใฆ `pixel_values`ใ`pixel_mask`ใใใใณ
+DETR ใขใใซใใใฌใผใใณใฐใงใใใใฉใใซใใ็ปๅใใญใปใใตใซใฏใๅฟ้
ใใๅฟ
่ฆใฎใชใใใใคใใฎๅฑๆงใใใใพใใ
+
+- `image_mean = [0.485, 0.456, 0.406 ]`
+- `image_std = [0.229, 0.224, 0.225]`
+
+ใใใใฏใใขใใซใฎไบๅใใฌใผใใณใฐไธญใซ็ปๅใๆญฃ่ฆๅใใใใใซไฝฟ็จใใใๅนณๅใจๆจๆบๅๅทฎใงใใใใใใฎไพกๅค่ฆณใฏ้ๅธธใซ้่ฆใงใ
+ไบๅใซใใฌใผใใณใฐใใใ็ปๅใขใใซใๆจ่ซใพใใฏๅพฎ่ชฟๆดใใใจใใซ่ค่ฃฝใใพใใ
+
+ๅพฎ่ชฟๆดใใใขใใซใจๅใใใงใใฏใใคใณใใใใคใกใผใธ ใใญใปใใตใใคใณในใฟใณในๅใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> checkpoint = "facebook/detr-resnet-50"
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint)
+```
+
+็ปๅใ`image_processor`ใซๆธกใๅใซใ2 ใคใฎๅๅฆ็ๅคๆใใใผใฟใปใใใซ้ฉ็จใใพใใ
+- ็ปๅใฎๆกๅผต
+- DETR ใฎๆๅพ
ใซๅฟใใใใใฎๆณจ้ใฎๅใใฉใผใใใ
+
+ใพใใใขใใซใใใฌใผใใณใฐ ใใผใฟใซใชใผใใผใใฃใใใใชใใใใซใใใใใซใไปปๆใฎใใผใฟๆกๅผตใฉใคใใฉใชใไฝฟ็จใใฆ็ปๅๆกๅผตใ้ฉ็จใงใใพใใใใใงใฏ[Albumentations](https://albumentations.ai/docs/)ใไฝฟ็จใใพใ...
+ใใฎใฉใคใใฉใชใฏใๅคๆใ็ปๅใซๅฝฑ้ฟใไธใใใใใซๅฟใใฆๅข็ใใใฏในใๆดๆฐใใใใจใไฟ่จผใใพใใ
+๐ค ใใผใฟใปใใ ใฉใคใใฉใชใฎใใญใฅใกใณใใซใฏใ่ฉณ็ดฐใช [็ฉไฝๆคๅบ็จใซ็ปๅใๆกๅผตใใๆนๆณใซ้ขใใใฌใคใ](https://huggingface.co/docs/datasets/object_detection) ใ่จ่ผใใใฆใใพใใ
+ไพใจใใฆใพใฃใใๅใใใผใฟใปใใใไฝฟ็จใใฆใใพใใใใใงใๅใใขใใญใผใใ้ฉ็จใใๅ็ปๅใฎใตใคใบใ (480, 480) ใซๅคๆดใใพใใ
+ๆฐดๅนณใซๅ่ปขใใฆๆใใใใพใใ
+
+```py
+>>> import albumentations
+>>> import numpy as np
+>>> import torch
+
+>>> transform = albumentations.Compose(
+... [
+... albumentations.Resize(480, 480),
+... albumentations.HorizontalFlip(p=1.0),
+... albumentations.RandomBrightnessContrast(p=1.0),
+... ],
+... bbox_params=albumentations.BboxParams(format="coco", label_fields=["category"]),
+... )
+```
+
+`image_processor` ใฏใๆณจ้ใๆฌกใฎๅฝขๅผใงใใใใจใๆๅพ
ใใพใ: `{'image_id': int, 'annotations': List[Dict]}`,
+ ใใใงใๅ่พๆธใฏ COCO ใชใใธใงใฏใใฎๆณจ้ใงใใ 1 ใคใฎไพใจใใฆใๆณจ้ใๅใใฉใผใใใใใ้ขๆฐใ่ฟฝๅ ใใฆใฟใพใใใใ
+
+ ```py
+>>> def formatted_anns(image_id, category, area, bbox):
+... annotations = []
+... for i in range(0, len(category)):
+... new_ann = {
+... "image_id": image_id,
+... "category_id": category[i],
+... "isCrowd": 0,
+... "area": area[i],
+... "bbox": list(bbox[i]),
+... }
+... annotations.append(new_ann)
+
+... return annotations
+```
+
+ใใใงใ็ปๅใจๆณจ้ใฎๅคๆใ็ตใฟๅใใใฆใตใณใใซใฎใใใใงไฝฟ็จใงใใใใใซใชใใพใใใ
+
+```py
+>>> # transforming a batch
+>>> def transform_aug_ann(examples):
+... image_ids = examples["image_id"]
+... images, bboxes, area, categories = [], [], [], []
+... for image, objects in zip(examples["image"], examples["objects"]):
+... image = np.array(image.convert("RGB"))[:, :, ::-1]
+... out = transform(image=image, bboxes=objects["bbox"], category=objects["category"])
+
+... area.append(objects["area"])
+... images.append(out["image"])
+... bboxes.append(out["bboxes"])
+... categories.append(out["category"])
+
+... targets = [
+... {"image_id": id_, "annotations": formatted_anns(id_, cat_, ar_, box_)}
+... for id_, cat_, ar_, box_ in zip(image_ids, categories, area, bboxes)
+... ]
+
+... return image_processor(images=images, annotations=targets, return_tensors="pt")
+```
+
+๐ค Datasets [`~datasets.Dataset.with_transform`] ใกใฝใใใไฝฟ็จใใฆใใใฎๅๅฆ็้ขๆฐใใใผใฟใปใใๅ
จไฝใซ้ฉ็จใใพใใใใฎๆนๆณใ้ฉ็จใใใใฎใฏใ
+ใใผใฟใปใใใฎ่ฆ็ด ใ่ชญใฟ่พผใใจใใซใใใฎๅ ดใงๅคๆใใพใใ
+
+ใใฎๆ็นใงใใใผใฟใปใใใฎไพใๅคๆๅพใซใฉใฎใใใซใชใใใ็ขบ่ชใงใใพใใใใณใฝใซใ่กจ็คบใใใใฏใใงใ
+`pixel_values`ใใใณใฝใซใจ `pixel_mask`ใใใใณ `labels` ใไฝฟ็จใใพใใ
+
+```py
+>>> cppe5["train"] = cppe5["train"].with_transform(transform_aug_ann)
+>>> cppe5["train"][15]
+{'pixel_values': tensor([[[ 0.9132, 0.9132, 0.9132, ..., -1.9809, -1.9809, -1.9809],
+ [ 0.9132, 0.9132, 0.9132, ..., -1.9809, -1.9809, -1.9809],
+ [ 0.9132, 0.9132, 0.9132, ..., -1.9638, -1.9638, -1.9638],
+ ...,
+ [-1.5699, -1.5699, -1.5699, ..., -1.9980, -1.9980, -1.9980],
+ [-1.5528, -1.5528, -1.5528, ..., -1.9980, -1.9809, -1.9809],
+ [-1.5528, -1.5528, -1.5528, ..., -1.9980, -1.9809, -1.9809]],
+
+ [[ 1.3081, 1.3081, 1.3081, ..., -1.8431, -1.8431, -1.8431],
+ [ 1.3081, 1.3081, 1.3081, ..., -1.8431, -1.8431, -1.8431],
+ [ 1.3081, 1.3081, 1.3081, ..., -1.8256, -1.8256, -1.8256],
+ ...,
+ [-1.3179, -1.3179, -1.3179, ..., -1.8606, -1.8606, -1.8606],
+ [-1.3004, -1.3004, -1.3004, ..., -1.8606, -1.8431, -1.8431],
+ [-1.3004, -1.3004, -1.3004, ..., -1.8606, -1.8431, -1.8431]],
+
+ [[ 1.4200, 1.4200, 1.4200, ..., -1.6476, -1.6476, -1.6476],
+ [ 1.4200, 1.4200, 1.4200, ..., -1.6476, -1.6476, -1.6476],
+ [ 1.4200, 1.4200, 1.4200, ..., -1.6302, -1.6302, -1.6302],
+ ...,
+ [-1.0201, -1.0201, -1.0201, ..., -1.5604, -1.5604, -1.5604],
+ [-1.0027, -1.0027, -1.0027, ..., -1.5604, -1.5430, -1.5430],
+ [-1.0027, -1.0027, -1.0027, ..., -1.5604, -1.5430, -1.5430]]]),
+ 'pixel_mask': tensor([[1, 1, 1, ..., 1, 1, 1],
+ [1, 1, 1, ..., 1, 1, 1],
+ [1, 1, 1, ..., 1, 1, 1],
+ ...,
+ [1, 1, 1, ..., 1, 1, 1],
+ [1, 1, 1, ..., 1, 1, 1],
+ [1, 1, 1, ..., 1, 1, 1]]),
+ 'labels': {'size': tensor([800, 800]), 'image_id': tensor([756]), 'class_labels': tensor([4]), 'boxes': tensor([[0.7340, 0.6986, 0.3414, 0.5944]]), 'area': tensor([519544.4375]), 'iscrowd': tensor([0]), 'orig_size': tensor([480, 480])}}
+```
+
+ๅใ
ใฎ็ปๅใๆญฃๅธธใซๆกๅผตใใใใใใฎๆณจ้ใๆบๅใใพใใใใใ ใใๅๅฆ็ใฏใใใงใฏใใใพใใใ
+ใพใ ๅฎๆใใฆใใพใใๆๅพใฎในใใใใงใฏใ็ปๅใใใใๅฆ็ใใใใใฎใซในใฟใ `collatโโe_fn` ใไฝๆใใพใใ
+็ปๅ (็พๅจใฏ `pixel_values`) ใใใใๅ
ใฎๆๅคงใฎ็ปๅใซใใใฃใณใฐใใๅฏพๅฟใใ `pixel_mask` ใไฝๆใใพใ
+ใฉใฎใใฏใปใซใๅฎๆฐ (1) ใงใใฉใฎใใฏใปใซใใใใฃใณใฐ (0) ใงใใใใ็คบใใพใใ
+
+
+```py
+>>> def collate_fn(batch):
+... pixel_values = [item["pixel_values"] for item in batch]
+... encoding = image_processor.pad(pixel_values, return_tensors="pt")
+... labels = [item["labels"] for item in batch]
+... batch = {}
+... batch["pixel_values"] = encoding["pixel_values"]
+... batch["pixel_mask"] = encoding["pixel_mask"]
+... batch["labels"] = labels
+... return batch
+```
+
+## Training the DETR model
+
+ๅใฎใปใฏใทใงใณใง้ๅดๅใฎใปใจใใฉใๅฎไบใใใฎใงใใขใใซใใใฌใผใใณใฐใใๆบๅใๆดใใพใใใ
+ใใฎใใผใฟใปใใๅ
ใฎ็ปๅใฏใใตใคใบใๅคๆดใใๅพใงใไพ็ถใจใใฆ้ๅธธใซๅคงใใใงใใใใใฏใใใฎใขใใซใๅพฎ่ชฟๆดใใใจใ
+ๅฐใชใใจใ 1 ใคใฎ GPU ใๅฟ
่ฆใงใใ
+
+ใใฌใผใใณใฐใซใฏๆฌกใฎๆ้ ใๅซใพใใพใใ
+1. ๅๅฆ็ใจๅใใใงใใฏใใคใณใใไฝฟ็จใใฆใ[`AutoModelForObjectDetection`] ใงใขใใซใ่ชญใฟ่พผใฟใพใใ
+2. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใ
+3. ใใฌใผใใณใฐๅผๆฐใใขใใซใใใผใฟใปใใใ็ปๅใใญใปใใตใใใผใฟ็
งๅๅจใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+4. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+ๅๅฆ็ใซไฝฟ็จใใใฎใจๅใใใงใใฏใใคใณใใใใขใใซใใญใผใใใใจใใฏใๅฟ
ใ`label2id`ใๆธกใใฆใใ ใใใ
+ใใใณ `id2label` ใใใใฏใไปฅๅใซใใผใฟใปใใใฎใกใฟใใผใฟใใไฝๆใใใใฎใงใใใใใซใ`ignore_mismatched_sizes=True`ใๆๅฎใใฆใๆขๅญใฎๅ้ก้ ญ้จใๆฐใใๅ้ก้ ญ้จใซ็ฝฎใๆใใพใใ
+
+```py
+>>> from transformers import AutoModelForObjectDetection
+
+>>> model = AutoModelForObjectDetection.from_pretrained(
+... checkpoint,
+... id2label=id2label,
+... label2id=label2id,
+... ignore_mismatched_sizes=True,
+... )
+```
+
+[`TrainingArguments`] ใงใ`output_dir` ใไฝฟ็จใใฆใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใๅฟ
่ฆใซๅฟใใฆใใคใใผใใฉใกใผใฟใผใๆงๆใใพใใ
+็ปๅๅใๅ้คใใใใใใๆชไฝฟ็จใฎๅใๅ้คใใชใใใจใ้่ฆใงใใ็ปๅๅใใชใใจใ
+`pixel_values` ใไฝๆใงใใพใใใใใฎใใใ`remove_unused_columns`ใ`False`ใซ่จญๅฎใใพใใ
+ใใใซใใใทใฅใใฆใขใใซใๅ
ฑๆใใใๅ ดๅใฏใ`push_to_hub` ใ `True` ใซ่จญๅฎใใพใ (Hugging ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)
+้กใซๅใใฃใฆใขใใซใใขใใใญใผใใใพใ๏ผใ
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> training_args = TrainingArguments(
+... output_dir="detr-resnet-50_finetuned_cppe5",
+... per_device_train_batch_size=8,
+... num_train_epochs=10,
+... fp16=True,
+... save_steps=200,
+... logging_steps=50,
+... learning_rate=1e-5,
+... weight_decay=1e-4,
+... save_total_limit=2,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+```
+
+ๆๅพใซใใในใฆใใพใจใใฆใ[`~transformers.Trainer.train`] ใๅผใณๅบใใพใใ
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=collate_fn,
+... train_dataset=cppe5["train"],
+... processing_class=image_processor,
+... )
+
+>>> trainer.train()
+```
+
+`training_args`ใง`push_to_hub`ใ`True`ใซ่จญๅฎใใๅ ดๅใใใฌใผใใณใฐ ใใงใใฏใใคใณใใฏ
+ใใฐใใงใคในใใใใใฌใผใใณใฐใๅฎไบใใใใ[`~transformers.Trainer.push_to_hub`] ใกใฝใใใๅผใณๅบใใฆใๆ็ตใขใใซใใใใซใใใทใฅใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Evaluate
+
+็ฉไฝๆคๅบใขใใซใฏ้ๅธธใไธ้ฃใฎ COCO ในใฟใคใซใฎๆๆจ ใไฝฟ็จใใฆ่ฉไพกใใใพใใ
+ๆขๅญใฎใกใใชใฏในๅฎ่ฃ
ใฎใใใใใไฝฟ็จใงใใพใใใใใใงใฏ`torchvision`ใฎใกใใชใฏในๅฎ่ฃ
ใไฝฟ็จใใฆๆ็ต็ใชใกใใชใฏในใ่ฉไพกใใพใใ
+ใใใซใใใทใฅใใใขใใซใ
+
+`torchvision`ใจใใชใฅใจใผใฟใผใไฝฟ็จใใใซใฏใใฐใฉใฆใณใ ใใฅใซใผใน COCO ใใผใฟใปใใใๆบๅใใๅฟ
่ฆใใใใพใใ COCO ใใผใฟใปใใใๆง็ฏใใใใใฎ API
+ใใผใฟใ็นๅฎใฎๅฝขๅผใงไฟๅญใใๅฟ
่ฆใใใใใใๆๅใซ็ปๅใจๆณจ้ใใใฃในใฏใซไฟๅญใใๅฟ
่ฆใใใใพใใใจๅใใใใซ
+ใใฌใผใใณใฐ็จใซใใผใฟใๆบๅใใใจใใ`cppe5["test"]` ใใใฎๆณจ้ใใใฉใผใใใใใๅฟ
่ฆใใใใพใใใใ ใใ็ปๅ
+ใใฎใพใพใงใใในใใงใใ
+
+่ฉไพกในใใใใซใฏๅฐใไฝๆฅญใๅฟ
่ฆใงใใใๅคงใใ 3 ใคใฎในใใใใซๅใใใใจใใงใใพใใ
+ใพใใ`cppe5["test"]` ใปใใใๆบๅใใพใใๆณจ้ใใใฉใผใใใใใใใผใฟใใใฃในใฏใซไฟๅญใใพใใ
+
+
+```py
+>>> import json
+
+
+>>> # format annotations the same as for training, no need for data augmentation
+>>> def val_formatted_anns(image_id, objects):
+... annotations = []
+... for i in range(0, len(objects["id"])):
+... new_ann = {
+... "id": objects["id"][i],
+... "category_id": objects["category"][i],
+... "iscrowd": 0,
+... "image_id": image_id,
+... "area": objects["area"][i],
+... "bbox": objects["bbox"][i],
+... }
+... annotations.append(new_ann)
+
+... return annotations
+
+
+>>> # Save images and annotations into the files torchvision.datasets.CocoDetection expects
+>>> def save_cppe5_annotation_file_images(cppe5):
+... output_json = {}
+... path_output_cppe5 = f"{os.getcwd()}/cppe5/"
+
+... if not os.path.exists(path_output_cppe5):
+... os.makedirs(path_output_cppe5)
+
+... path_anno = os.path.join(path_output_cppe5, "cppe5_ann.json")
+... categories_json = [{"supercategory": "none", "id": id, "name": id2label[id]} for id in id2label]
+... output_json["images"] = []
+... output_json["annotations"] = []
+... for example in cppe5:
+... ann = val_formatted_anns(example["image_id"], example["objects"])
+... output_json["images"].append(
+... {
+... "id": example["image_id"],
+... "width": example["image"].width,
+... "height": example["image"].height,
+... "file_name": f"{example['image_id']}.png",
+... }
+... )
+... output_json["annotations"].extend(ann)
+... output_json["categories"] = categories_json
+
+... with open(path_anno, "w") as file:
+... json.dump(output_json, file, ensure_ascii=False, indent=4)
+
+... for im, img_id in zip(cppe5["image"], cppe5["image_id"]):
+... path_img = os.path.join(path_output_cppe5, f"{img_id}.png")
+... im.save(path_img)
+
+... return path_output_cppe5, path_anno
+```
+
+ๆฌกใซใ`cocoevaluator`ใงๅฉ็จใงใใ`CocoDetection`ใฏใฉในใฎใคใณในใฟใณในใ็จๆใใพใใ
+
+
+```py
+>>> import torchvision
+
+
+>>> class CocoDetection(torchvision.datasets.CocoDetection):
+... def __init__(self, img_folder, image_processor, ann_file):
+... super().__init__(img_folder, ann_file)
+... self.image_processor = image_processor
+
+... def __getitem__(self, idx):
+... # read in PIL image and target in COCO format
+... img, target = super(CocoDetection, self).__getitem__(idx)
+
+... # preprocess image and target: converting target to DETR format,
+... # resizing + normalization of both image and target)
+... image_id = self.ids[idx]
+... target = {"image_id": image_id, "annotations": target}
+... encoding = self.image_processor(images=img, annotations=target, return_tensors="pt")
+... pixel_values = encoding["pixel_values"].squeeze() # remove batch dimension
+... target = encoding["labels"][0] # remove batch dimension
+
+... return {"pixel_values": pixel_values, "labels": target}
+
+
+>>> im_processor = AutoImageProcessor.from_pretrained("devonho/detr-resnet-50_finetuned_cppe5")
+
+>>> path_output_cppe5, path_anno = save_cppe5_annotation_file_images(cppe5["test"])
+>>> test_ds_coco_format = CocoDetection(path_output_cppe5, im_processor, path_anno)
+```
+
+ๆๅพใซใใกใใชใฏในใใญใผใใใฆ่ฉไพกใๅฎ่กใใพใใ
+
+```py
+>>> import evaluate
+>>> from tqdm import tqdm
+
+>>> model = AutoModelForObjectDetection.from_pretrained("devonho/detr-resnet-50_finetuned_cppe5")
+>>> module = evaluate.load("ybelkada/cocoevaluate", coco=test_ds_coco_format.coco)
+>>> val_dataloader = torch.utils.data.DataLoader(
+... test_ds_coco_format, batch_size=8, shuffle=False, num_workers=4, collate_fn=collate_fn
+... )
+
+>>> with torch.no_grad():
+... for idx, batch in enumerate(tqdm(val_dataloader)):
+... pixel_values = batch["pixel_values"]
+... pixel_mask = batch["pixel_mask"]
+
+... labels = [
+... {k: v for k, v in t.items()} for t in batch["labels"]
+... ] # these are in DETR format, resized + normalized
+
+... # forward pass
+... outputs = model(pixel_values=pixel_values, pixel_mask=pixel_mask)
+
+... orig_target_sizes = torch.stack([target["orig_size"] for target in labels], dim=0)
+... results = im_processor.post_process(outputs, orig_target_sizes) # convert outputs of model to Pascal VOC format (xmin, ymin, xmax, ymax)
+
+... module.add(prediction=results, reference=labels)
+... del batch
+
+>>> results = module.compute()
+>>> print(results)
+Accumulating evaluation results...
+DONE (t=0.08s).
+IoU metric: bbox
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.352
+ Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.681
+ Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.292
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.168
+ Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.208
+ Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.429
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.274
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.484
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.501
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.191
+ Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.323
+ Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.590
+```
+
+ใใใใฎ็ตๆใฏใ[`~transformers.TrainingArguments`] ใฎใใคใใผใใฉใกใผใฟใ่ชฟๆดใใใใจใงใใใซๆนๅใงใใพใใ่ฉฆใใฆใใใ๏ผ
+
+## Inference
+
+DETR ใขใใซใๅพฎ่ชฟๆดใใฆ่ฉไพกใใHugging Face Hub ใซใขใใใญใผใใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใพใใ
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใใคใใฉใคใณใใคใณในใฟใณในๅใใ
+ใขใใซใไฝฟ็จใใฆใชใใธใงใฏใใๆคๅบใใใใใซ็ปๅใๆธกใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+>>> import requests
+
+>>> url = "https://i.imgur.com/2lnWoly.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> obj_detector = pipeline("object-detection", model="devonho/detr-resnet-50_finetuned_cppe5")
+>>> obj_detector(image)
+```
+
+ๅฟ
่ฆใซๅฟใใฆใใใคใใฉใคใณใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+```py
+>>> image_processor = AutoImageProcessor.from_pretrained("devonho/detr-resnet-50_finetuned_cppe5")
+>>> model = AutoModelForObjectDetection.from_pretrained("devonho/detr-resnet-50_finetuned_cppe5")
+
+>>> with torch.no_grad():
+... inputs = image_processor(images=image, return_tensors="pt")
+... outputs = model(**inputs)
+... target_sizes = torch.tensor([image.size[::-1]])
+... results = image_processor.post_process_object_detection(outputs, threshold=0.5, target_sizes=target_sizes)[0]
+
+>>> for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
+... box = [round(i, 2) for i in box.tolist()]
+... print(
+... f"Detected {model.config.id2label[label.item()]} with confidence "
+... f"{round(score.item(), 3)} at location {box}"
+... )
+Detected Coverall with confidence 0.566 at location [1215.32, 147.38, 4401.81, 3227.08]
+Detected Mask with confidence 0.584 at location [2449.06, 823.19, 3256.43, 1413.9]
+```
+
+็ตๆใใใญใใใใฆใฟใพใใใ:
+
+```py
+>>> draw = ImageDraw.Draw(image)
+
+>>> for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
+... box = [round(i, 2) for i in box.tolist()]
+... x, y, x2, y2 = tuple(box)
+... draw.rectangle((x, y, x2, y2), outline="red", width=1)
+... draw.text((x, y), model.config.id2label[label.item()], fill="white")
+
+>>> image
+```
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/prompting.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/prompting.md
new file mode 100644
index 0000000000000000000000000000000000000000..bd66e751ee61d64058898156d873496355cbd8b8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/prompting.md
@@ -0,0 +1,438 @@
+
+
+
+# LLM prompting guide
+
+[[open-in-colab]]
+
+FalconใLLaMA ใชใฉใฎๅคง่ฆๆจก่จ่ชใขใใซใฏใไบๅใซใใฌใผใใณใฐใใใใใฉใณในใใฉใผใใผ ใขใใซใงใใใๆๅใฏไบๆธฌใใใใใซใใฌใผใใณใฐใใใฆใใพใใ
+ๅ
ฅๅใใญในใใไธใใใใๅ ดๅใฎๆฌกใฎใใผใฏใณใ้ๅธธใๆฐๅๅใฎใใฉใกใผใฟใใใใไฝๅ
ใใฎใใฉใกใผใฟใงใใฌใผใใณใฐใใใฆใใพใใ
+้ทๆ้ใฎใใผใฏใณใใใฎ็ตๆใใใใใฎใขใใซใฏ้ๅธธใซๅผทๅใงๅค็จ้ใซใชใใๆฌกใฎใใใชใใจใๅฏ่ฝใซใชใใพใใ
+่ช็ถ่จ่ชใใญใณใใใงใขใใซใซๆ็คบใใใใจใงใใใใซ่คๆฐใฎ NLP ใฟในใฏใ่งฃๆฑบใงใใพใใ
+
+ๆ้ฉใชๅบๅใไฟ่จผใใใใใซใใฎใใใชใใญใณใใใ่จญ่จใใใใจใฏใๅคใใฎๅ ดๅใใใญใณใใ ใจใณใธใใขใชใณใฐใใจๅผใฐใใพใใใใญใณใใใจใณใธใใขใชใณใฐใจใฏใ
+ใใชใใฎ้ใฎๅฎ้จใๅฟ
่ฆใจใใๅๅพฉใใญใปในใ่ช็ถ่จ่ชใฏใฏใใใซๆ่ปใง่กจ็พๅ่ฑใใงใ
+ใใ ใใใใญใฐใฉใใณใฐ่จ่ชใใใใใใพใใใ็ใใๅฏ่ฝๆงใใใใพใใๅๆใซใ่ช็ถ่จ่ชใซใใใใญใณใใ
+ๅคๅใซใฏใใชใๆๆใงใใใใญใณใใใซใใใใชๅคๆดใๅ ใใใ ใใงใใๅบๅใๅคงๅน
ใซ็ฐใชใๅ ดๅใใใใพใใ
+
+ใในใฆใฎใฑใผในใซ้ฉๅใใใใญใณใใใไฝๆใใใใใฎๆญฃ็ขบใชใฌใทใใฏใใใพใใใใ็ ็ฉถ่
ใฏใใใคใใฎๆ่ฏใฎใฌใทใใ่ๆกใใพใใใ
+ๆ้ฉใช็ตๆใใใไธ่ฒซใใฆ้ๆใใใฎใซๅฝน็ซใคๅฎ่ทตใ
+
+ใใฎใฌใคใใงใฏใใใๅชใใ LLM ใใญใณใใใไฝๆใใใใพใใพใช NLP ใฟในใฏใ่งฃๆฑบใใใฎใซๅฝน็ซใคใใญใณใใ ใจใณใธใใขใชใณใฐใฎใในใ ใใฉใฏใใฃในใซใคใใฆ่ชฌๆใใพใใ
+ๆฌกใฎใใจใๅญฆใณใพใ:
+
+- [ใใญใณใใใฎๅบๆฌ](#basics-of-prompting)
+- [LLM ใใญใณใใใฎใในใ ใใฉใฏใใฃใน](#best-practices-of-llm-prompting)
+- [้ซๅบฆใชใใญใณใใ ใใฏใใใฏ: ๆฐๅใฎใใญใณใใใจๆ่ใฎ้ฃ้](#advanced-prompting-techniques)
+- [ใใญใณใใใ่กจ็คบใใไปฃใใใซๅพฎ่ชฟๆดใใๅ ดๅ](#prompting-vs-fine-tuning)
+
+
+
+่ฟ
้ใชใจใณใธใใขใชใณใฐใฏใLLM ๅบๅๆ้ฉๅใใญใปในใฎไธ้จใซใใใพใใใใใ 1 ใคใฎ้่ฆใช่ฆ็ด ใฏใ
+ๆ้ฉใชใใญในใ็ๆๆฆ็ฅใ LLM ใ็ๆๆใซๅพ็ถใฎๅใใผใฏใณใ้ธๆใใๆนๆณใใซในใฟใใคใบใงใใพใใ
+ใใฌใผใใณใฐๅฏ่ฝใชใใฉใกใผใฟใไธๅๅคๆดใใใซใใญในใใไฝๆใใพใใใใญในใ็ๆใใฉใกใผใฟใๅพฎ่ชฟๆดใใใใจใงใ
+็ๆใใใใใญในใใซ็นฐใ่ฟใใๅซใพใใฆใใใใใใใไธ่ฒซๆงใใใไบบ้ใใใ้ฟใใซใชใใพใใ
+ใใญในใ็ๆๆฆ็ฅใจใใฉใกใผใฟใผใฏใใฎใฌใคใใฎ็ฏๅฒๅคใงใใใใใใใฎใใใใฏใซใคใใฆ่ฉณใใใฏใๆฌกใฎใใใใฏใๅ็
งใใฆใใ ใใใ
+ๆฌกใฎใฌใคใ:
+
+* [LLM ใซใใ็ๆ](../llm_tutorial)
+* [ใใญในใ็ๆๆฆ็ฅ](../generation_strategies)
+
+
+
+## Basics of prompting
+
+### Types of models
+
+ๆๆฐใฎ LLM ใฎๅคง้จๅใฏใใใณใผใๅฐ็จใฎใใฉใณในใใฉใผใใผใงใใไพใจใใฆใฏใ[LLaMA](../model_doc/llama)ใ
+[Llama2](../model_doc/llama2)ใ[Falcon](../model_doc/falcon)ใ[GPT2](../model_doc/gpt2)ใใใ ใใ้ญ้ใใๅฏ่ฝๆงใใใใพใ
+ใจใณใณใผใ ใใณใผใ ใใฉใณในใใฉใผใ LLM ใๅๆงใงใใใใจใใฐใ[Flan-T5](../model_doc/flan-t5) ใ [BART](../model_doc/bart) ใงใใ
+
+ใจใณใณใผใ ใใณใผใ ในใฟใคใซใฎใขใใซใฏ้ๅธธใๅบๅใๅ
ฅๅใซ**ๅคงใใ**ไพๅญใใ็ๆใฟในใฏใงไฝฟ็จใใใพใใ
+ใใจใใฐใ็ฟป่จณใจ่ฆ็ดใงใใใใณใผใๅฐ็จใขใใซใฏใไปใฎใในใฆใฎใฟใคใใฎ็ๆใฟในใฏใซไฝฟ็จใใใพใใ
+
+ใใคใใฉใคใณใไฝฟ็จใใฆ LLM ใงใใญในใใ็ๆใใๅ ดๅใไฝฟ็จใใฆใใ LLM ใฎใฟใคใใ็ฅใใใจใ้่ฆใงใใ
+็ฐใชใใใคใใฉใคใณใไฝฟ็จใใพใใ
+
+`text-generation`ใใคใใฉใคใณใไฝฟ็จใใฆใใณใผใใฎใฟใฎใขใใซใงๆจ่ซใๅฎ่กใใพใใ
+
+```python
+>>> from transformers import pipeline
+>>> import torch
+
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+
+>>> generator = pipeline('text-generation', model = 'openai-community/gpt2')
+>>> prompt = "Hello, I'm a language model"
+
+>>> generator(prompt, max_length = 30)
+[{'generated_text': "Hello, I'm a language model expert, so I'm a big believer in the concept that I know very well and then I try to look into"}]
+```
+
+ใจใณใณใผใใผ/ใใณใผใใผใไฝฟ็จใใฆๆจ่ซใๅฎ่กใใใซใฏใ`text2text-generation` ใใคใใฉใคใณใไฝฟ็จใใพใใ
+
+```python
+>>> text2text_generator = pipeline("text2text-generation", model = 'google/flan-t5-base')
+>>> prompt = "Translate from English to French: I'm very happy to see you"
+
+>>> text2text_generator(prompt)
+[{'generated_text': 'Je suis trรจs heureuse de vous rencontrer.'}]
+```
+
+### Base vs instruct/chat models
+
+๐ค Hub ใงๅฉ็จใงใใๆ่ฟใฎ LLM ใใงใใฏใใคใณใใฎใปใจใใฉใซใฏใbase ใจ instruct (ใพใใฏ chat) ใฎ 2 ใคใฎใใผใธใงใณใใใใพใใไพใใฐใ
+[`tiiuae/falcon-7b`](https://huggingface.co/tiiuae/falcon-7b) ใใใณ [`tiiuae/falcon-7b-instruct`](https://huggingface.co/tiiuae/falcon-7b) -ๆ็คบใใ)ใ
+
+ๅบๆฌใขใใซใฏใๆๅใฎใใญใณใใใไธใใใใใจใใซใใญในใใๅฎๆใใใใฎใซใฏๅชใใฆใใพใใใNLP ใฟในใฏใซใฏ็ๆณ็ใงใฏใใใพใใใ
+ๆ็คบใซๅพใๅฟ
่ฆใใใๅ ดๅใใพใใฏไผ่ฉฑใงไฝฟ็จใใๅ ดๅใซไฝฟ็จใใพใใใใใงใๆ็คบ (ใใฃใใ) ใใผใธใงใณใ็ปๅ ดใใพใใ
+ใใใใฎใใงใใฏใใคใณใใฏใๅฝไปคใจไผ่ฉฑใใผใฟใซๅบใฅใใฆไบๅใใฌใผใใณใฐใใใใใผใน ใใผใธใงใณใใใใซๅพฎ่ชฟๆดใใ็ตๆใงใใ
+ใใฎ่ฟฝๅ ใฎๅพฎ่ชฟๆดใซใใใๅคใใฎ NLP ใฟในใฏใซใจใฃใฆใใ้ฉๅใช้ธๆ่ขใซใชใใพใใ
+
+[`tiiuae/falcon-7b-instruct`](https://huggingface.co/tiiuae/falcon-7b-instruct) ใงไฝฟ็จใงใใใใใคใใฎ็ฐกๅใชใใญใณใใใ็คบใใฆใฟใพใใใใ
+ใใใคใใฎไธ่ฌ็ใช NLP ใฟในใฏใ่งฃๆฑบใใพใใ
+
+### NLP tasks
+
+ใพใใ็ฐๅขใใปใใใขใใใใพใใใใ
+
+```bash
+pip install -q transformers accelerate
+```
+
+ๆฌกใซใ้ฉๅใชใใคใใฉใคใณ (`text_generation`) ใไฝฟ็จใใฆใขใใซใใญใผใใใพใใใใ
+
+```python
+>>> from transformers import pipeline, AutoTokenizer
+>>> import torch
+
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+>>> model = "tiiuae/falcon-7b-instruct"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(model)
+>>> pipe = pipeline(
+... "text-generation",
+... model=model,
+... tokenizer=tokenizer,
+... torch_dtype=torch.bfloat16,
+... device_map="auto",
+... )
+```
+
+
+
+Falcon ใขใใซใฏ `bfloat16` ใใผใฟๅใไฝฟ็จใใฆใใฌใผใใณใฐใใใใใใๅใใใฎใไฝฟ็จใใใใจใใๅงใใใพใใใใใซใฏใๆ่ฟใฎ
+CUDA ใฎใใผใธใงใณใซๆบๆ ใใฆใใใๆๆฐใฎใซใผใใงๆ้ฉใซๅไฝใใพใใ
+
+
+
+ใใคใใฉใคใณ็ต็ฑใงใขใใซใใญใผใใใใฎใงใใใญใณใใใไฝฟ็จใใฆ NLP ใฟในใฏใ่งฃๆฑบใใๆนๆณใ่ฆใฆใฟใพใใใใ
+
+#### Text classification
+
+ใใญในใๅ้กใฎๆใไธ่ฌ็ใชๅฝขๅผใฎ 1 ใคใฏใปใณใใกใณใๅๆใงใใใใใใธใใฃใใใใใใฌใใฃใใใใใใฌใใฃใใใชใฉใฎใฉใใซใๅฒใๅฝใฆใพใใ
+ใพใใฏใไธ้ฃใฎใใญในใใซๅฏพใใฆใไธญ็ซใใงใใไธใใใใใใญในใ (ๆ ็ปใฌใใฅใผ) ใๅ้กใใใใใซใขใใซใซๆ็คบใใใใญใณใใใไฝๆใใฆใฟใพใใใใ
+ใพใๆ็คบใไธใใๆฌกใซๅ้กใใใใญในใใๆๅฎใใพใใใใฎใพใพใซใใฆใใใฎใงใฏใชใใ
+ๅฟ็ญใฎๅ
้ ญใซใ่ฟฝๅ ใใพใ - `"Sentiment: "`:
+
+```python
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+>>> prompt = """Classify the text into neutral, negative or positive.
+... Text: This movie is definitely one of my favorite movies of its kind. The interaction between respectable and morally strong characters is an ode to chivalry and the honor code amongst thieves and policemen.
+... Sentiment:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=10,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result: Classify the text into neutral, negative or positive.
+Text: This movie is definitely one of my favorite movies of its kind. The interaction between respectable and morally strong characters is an ode to chivalry and the honor code amongst thieves and policemen.
+Sentiment:
+Positive
+```
+
+ใใฎ็ตๆใๅบๅใซใฏใๆ้ ใงๆไพใใใชในใใฎๅ้กใฉใใซใๅซใพใใฆใใใใใใฏๆญฃใใใฉใใซใงใใ
+
+
+
+ใใญใณใใใซๅ ใใฆใ`max_new_tokens`ใใฉใกใผใฟใๆธกใใฆใใใใจใซๆฐใฅใใใใใใพใใใใใผใฏใณใฎๆฐใๅถๅพกใใพใใ
+ใขใใซใ็ๆใใพใใใใใฏใๅญฆ็ฟใงใใๅคใใฎใใญในใ็ๆใใฉใกใผใฟใผใฎ 1 ใคใงใใ
+[ใใญในใ็ๆๆฆ็ฅ](../generation_strategies) ใฌใคใใๅ็
งใใฆใใ ใใใ
+
+
+
+#### Named Entity Recognition
+
+ๅบๆ่กจ็พ่ช่ญ (NER) ใฏใใใญในใๅ
ใฎไบบ็ฉใๅ ดๆใ็ต็นใชใฉใฎๅบๆ่กจ็พใๆค็ดขใใใฟในใฏใงใใ
+ใใญใณใใใฎๆ็คบใๅคๆดใใฆใLLM ใซใใฎใฟในใฏใๅฎ่กใใใพใใใใใใใงใฏ`return_full_text = False`ใ่จญๅฎใใพใใใ
+ๅบๅใซใใญใณใโโใใๅซโโใพใใชใใใใซใใพใใ
+
+```python
+>>> torch.manual_seed(1) # doctest: +IGNORE_RESULT
+>>> prompt = """Return a list of named entities in the text.
+... Text: The Golden State Warriors are an American professional basketball team based in San Francisco.
+... Named entities:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=15,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"{seq['generated_text']}")
+- Golden State Warriors
+- San Francisco
+```
+
+ใ่ฆงใฎใจใใใใขใใซใฏๆๅฎใใใใใญในใใใ 2 ใคใฎๅๅไปใใจใณใใฃใใฃใๆญฃใใ่ญๅฅใใพใใใ
+
+#### Translation
+
+LLM ใๅฎ่กใงใใใใ 1 ใคใฎใฟในใฏใฏ็ฟป่จณใงใใใใฎใฟในใฏใซใฏใจใณใณใผใใผ/ใใณใผใใผ ใขใใซใไฝฟ็จใใใใจใ้ธๆใงใใพใใใใใใงใฏ
+ไพใ็ฐกๅใซใใใใใซใใใกใใจใใไปไบใใใ Falcon-7b-instruct ใไฝฟใ็ถใใพใใใใไธๅบฆใๆนๆณใฏๆฌกใฎใจใใใงใ
+ใใญในใใฎไธ้จใ่ฑ่ชใใใคใฟใชใข่ชใซ็ฟป่จณใใใใใซใขใใซใซๆ็คบใใๅบๆฌ็ใชใใญใณใใใไฝๆใงใใพใใ
+
+```python
+>>> torch.manual_seed(2) # doctest: +IGNORE_RESULT
+>>> prompt = """Translate the English text to Italian.
+... Text: Sometimes, I've believed as many as six impossible things before breakfast.
+... Translation:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=20,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"{seq['generated_text']}")
+A volte, ho creduto a sei impossibili cose prima di colazione.
+```
+
+ใใใงใฏใๅบๅ็ๆๆใซใขใใซใใใๅฐใๆ่ปใซใชใใใใซ `do_sample=True` ใจ `top_k=10` ใ่ฟฝๅ ใใพใใใ
+
+#### Text summarization
+
+็ฟป่จณใจๅๆงใซใใใญในใใฎ่ฆ็ดใใๅบๅใๅ
ฅๅใซ**ๅคงใใ**ไพๅญใใ็ๆใฟในใฏใงใใ
+ใจใณใณใผใ/ใใณใผใ ใขใใซใฎๆนใ่ฏใ้ธๆใซใชใๅฏ่ฝๆงใใใใพใใใใ ใใใใณใผใ ในใฟใคใซใฎใขใใซใใใฎใฟในใฏใซไฝฟ็จใงใใพใใ
+ไปฅๅใฏใใใญใณใใใฎๅ
้ ญใซๆ็คบใ้
็ฝฎใใฆใใพใใใใใ ใใใใญใณใใใฎๆๅพใงใ
+ๆ็คบใไธใใใฎใซ้ฉใใๅ ดๆใงใใใใพใใ้ๅธธใๅฝไปคใฏใฉใกใใใฎ็ซฏใซ้
็ฝฎใใใใจใใๅงใใใพใใ
+
+```python
+>>> torch.manual_seed(3) # doctest: +IGNORE_RESULT
+>>> prompt = """Permaculture is a design process mimicking the diversity, functionality and resilience of natural ecosystems. The principles and practices are drawn from traditional ecological knowledge of indigenous cultures combined with modern scientific understanding and technological innovations. Permaculture design provides a framework helping individuals and communities develop innovative, creative and effective strategies for meeting basic needs while preparing for and mitigating the projected impacts of climate change.
+... Write a summary of the above text.
+... Summary:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=30,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"{seq['generated_text']}")
+Permaculture is an ecological design mimicking natural ecosystems to meet basic needs and prepare for climate change. It is based on traditional knowledge and scientific understanding.
+```
+
+#### Question answering
+
+่ณชๅๅฟ็ญใฟในใฏใฎๅ ดๅใใใญใณใใใๆฌกใฎ่ซ็ใณใณใใผใใณใใซๆง้ ๅใงใใพใ: ๆ็คบใใณใณใใญในใใ่ณชๅใ
+ๅ
้ ญใฎๅ่ชใพใใฏใใฌใผใบ (`"Answer:"`) ใไฝฟ็จใใฆใใขใใซใๆไฝใใฆ็ญใใฎ็ๆใ้ๅงใใพใใ
+
+
+```python
+>>> torch.manual_seed(4) # doctest: +IGNORE_RESULT
+>>> prompt = """Answer the question using the context below.
+... Context: Gazpacho is a cold soup and drink made of raw, blended vegetables. Most gazpacho includes stale bread, tomato, cucumbers, onion, bell peppers, garlic, olive oil, wine vinegar, water, and salt. Northern recipes often include cumin and/or pimentรณn (smoked sweet paprika). Traditionally, gazpacho was made by pounding the vegetables in a mortar with a pestle; this more laborious method is still sometimes used as it helps keep the gazpacho cool and avoids the foam and silky consistency of smoothie versions made in blenders or food processors.
+... Question: What modern tool is used to make gazpacho?
+... Answer:
+... """
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=10,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result: Modern tools are used, such as immersion blenders
+```
+
+#### Reasoning
+
+LLM ใซใจใฃใฆๆจ่ซใฏๆใๅฐ้ฃใชใฟในใฏใฎ 1 ใคใงใใใ่ฏใ็ตๆใ้ๆใใใซใฏใๅคใใฎๅ ดๅใๆฌกใฎใใใช้ซๅบฆใชใใญใณใใ ใใฏใใใฏใ้ฉ็จใใๅฟ
่ฆใใใใพใใ
+[Chain-of-thought](#chain-of-thought)ใ
+
+ๅบๆฌ็ใชใใญใณใใใไฝฟ็จใใฆใๅ็ดใช็ฎ่กใฟในใฏใซ้ขใใใขใใซๆจ่ซใไฝๆใงใใใใฉใใ่ฉฆใใฆใฟใพใใใใ
+
+```python
+>>> torch.manual_seed(5) # doctest: +IGNORE_RESULT
+>>> prompt = """There are 5 groups of students in the class. Each group has 4 students. How many students are there in the class?"""
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=30,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result:
+There are a total of 5 groups, so there are 5 x 4=20 students in the class.
+```
+
+ๆญฃใใ๏ผใใๅฐใ่ค้ใใๅขใใใฆใๅบๆฌ็ใชใใญใณใใใงๅ้กใ่งฃๆฑบใงใใใใฉใใใ็ขบ่ชใใฆใฟใพใใใใ
+
+```python
+>>> torch.manual_seed(6) # doctest: +IGNORE_RESULT
+>>> prompt = """I baked 15 muffins. I ate 2 muffins and gave 5 muffins to a neighbor. My partner then bought 6 more muffins and ate 2. How many muffins do we now have?"""
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=10,
+... do_sample=True,
+... top_k=10,
+... return_full_text = False,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result:
+The total number of muffins now is 21
+```
+
+ใใใฏ้้ใฃใ็ญใใงใใ12 ใงใใๅฟ
่ฆใใใใพใใใใฎๅ ดๅใใใญใณใใใๅบๆฌ็ใใใใใ้ธๆๅ
ๅฎนใๅๅ ใงใใๅฏ่ฝๆงใใใใพใใ
+็ตๅฑใฎใจใใใFalcon ใฎๆๅฐใใผใธใงใณใ้ธๆใใพใใใใใใใใตใคใบใฎใขใใซใงใฏๆจ่ซใๅฐ้ฃใงใใใใใๅคงใใชใขใใซใงใฏ
+ใขใใซใฎใใใฉใผใใณในใๅไธใใๅฏ่ฝๆงใใใใพใใ
+
+## Best practices of LLM prompting
+
+ใฌใคใใฎใใฎใปใฏใทใงใณใงใฏใใใญใณใใใฎ็ตๆใๆนๅใใๅพๅใซใใใในใ ใใฉใฏใใฃในใฎใชในใใใพใจใใพใใใ
+
+* ไฝฟ็จใใใขใใซใ้ธๆใใๅ ดๅใฏใๆๆฐใใคๆใๆฉ่ฝ็ใชใขใใซใฎๆนใใใใฉใผใใณในใๅไธใใๅฏ่ฝๆงใใใใพใใ
+* ใทใณใใซใง็ญใใใญใณใใใใๅงใใฆใใใใใ็นฐใ่ฟใใพใใ
+* ๆ็คบใฏใใญใณใใใฎๆๅใพใใฏๆๅพใซๅ
ฅๅใใฆใใ ใใใๅคง่ฆๆจกใชใณใณใใญในใใๆฑใๅ ดๅใใขใใซใฏใใพใใพใชๆ้ฉๅใ้ฉ็จใใฆใใขใใณใทใงใณใฎ่ค้ใใไบๆฌก็ใซๆกๅคงใใใฎใ้ฒใใพใใใใใซใใใใขใใซใฏใใญใณใใใฎ้ไธญใใใๆๅใพใใฏๆๅพใซๆณจๆใๆใใใใซใชใใพใใ
+* ๆ็คบใจใใใใ้ฉ็จใใใใใญในใใๆ็ขบใซๅบๅฅใใฆใใ ใใใใใใซใคใใฆใฏใๆฌกใฎใปใฏใทใงใณใง่ฉณใใ่ชฌๆใใพใใ
+* ใฟในใฏใจๆใพใใ็ตๆ (ใใฎๅฝขๅผใ้ทใใในใฟใคใซใ่จ่ชใชใฉ) ใซใคใใฆๅ
ทไฝ็ใใค่ชฌๆ็ใซใใพใใ
+* ๆๆงใช่ชฌๆใๆ็คบใฏ้ฟใใฆใใ ใใใ
+*ใไฝใใใฆใฏใใใชใใใใจใใๆ็คบใงใฏใชใใใไฝใใในใใใใจใใๆ็คบใๅชๅ
ใใพใใ
+* ๆๅใฎๅ่ชใๆธใใฆ (ใพใใฏใขใใซใฎๆๅใฎๆใๅงใใฆ)ใๅบๅใๆญฃใใๆนๅใซใๅฐใใใพใใ
+* [Few-shot prompting](#few-shot-prompting) ใ [Chain-of-thought](#chain-of-thought) ใชใฉใฎ้ซๅบฆใชใใฏใใใฏใไฝฟ็จใใพใใ
+* ใใพใใพใชใขใใซใงใใญใณใใใใในใใใฆใใใฎๅ
็ขๆงใ่ฉไพกใใพใใ
+* ใใญใณใใใฎใใผใธใงใณใ็ขบ่ชใใใใใฉใผใใณในใ่ฟฝ่ทกใใพใใ
+
+## Advanced prompting techniques
+
+### Few-shot prompting
+
+ไธ่จใฎใปใฏใทใงใณใฎๅบๆฌ็ใชใใญใณใใใฏใใใผใญใทใงใใใใใญใณใใใฎไพใงใใใคใพใใใขใใซใซใฏใใงใซไธใใใใฆใใพใใ
+ๆ็คบใจใณใณใใญในใใฏใใใพใใใ่งฃๆฑบ็ญใๅซใไพใฏใใใพใใใ้ๅธธใๅฝไปคใใผใฟใปใใใซๅบใฅใใฆๅพฎ่ชฟๆดใใใ LLM
+ใใฎใใใชใใผใญใทใงใใใใฟในใฏใงใๅชใใใใใฉใผใใณในใ็บๆฎใใพใใใใ ใใใฟในใฏใใใ่ค้ใงใใฃใใๅพฎๅฆใช็นใใใฃใใใใๅ ดๅใใใใพใใ
+ๅบๅใซใฏใๅฝไปคใ ใใงใฏใขใใซใ็่งฃใงใใชใใใใคใใฎ่ฆไปถใใใใพใใใใฎๅ ดๅใๆฌกใฎใใจใใงใใพใใ
+ๅฐๆฐใทใงใใ ใใญใณใใใจๅผใฐใใใใฏใใใฏใ่ฉฆใใฆใใ ใใใ
+
+ๅฐๆฐใทใงใใ ใใญใณใใใงใฏใใขใใซใซใใใฉใผใใณในใๅไธใใใใใใฎใใๅคใใฎใณใณใใญในใใๆไพใใใใญใณใใๅ
ใฎไพใๆไพใใใพใใ
+ไพใงใฏใไพใฎใใฟใผใณใซๅพใฃใฆๅบๅใ็ๆใใใใใซใขใใซใๆกไปถไปใใใพใใ
+
+ไปฅไธใซไพใ็คบใใพใใ
+
+```python
+>>> torch.manual_seed(0) # doctest: +IGNORE_RESULT
+>>> prompt = """Text: The first human went into space and orbited the Earth on April 12, 1961.
+... Date: 04/12/1961
+... Text: The first-ever televised presidential debate in the United States took place on September 28, 1960, between presidential candidates John F. Kennedy and Richard Nixon.
+... Date:"""
+
+>>> sequences = pipe(
+... prompt,
+... max_new_tokens=8,
+... do_sample=True,
+... top_k=10,
+... )
+
+>>> for seq in sequences:
+... print(f"Result: {seq['generated_text']}")
+Result: Text: The first human went into space and orbited the Earth on April 12, 1961.
+Date: 04/12/1961
+Text: The first-ever televised presidential debate in the United States took place on September 28, 1960, between presidential candidates John F. Kennedy and Richard Nixon.
+Date: 09/28/1960
+```
+
+ไธ่จใฎใณใผใ ในใใใใใงใฏใใขใใซใธใฎ็ฎ็ใฎๅบๅใ็คบใใใใซ 1 ใคใฎไพใไฝฟ็จใใพใใใใใใใฃใฆใใใใฏใ
+ใใฏใณใทใงใใใใใญใณใใใใใ ใใใฟในใฏใฎ่ค้ใใซๅฟใใฆใ่คๆฐใฎไพใไฝฟ็จใใๅฟ
่ฆใใใๅ ดๅใใใใพใใ
+
+ๆฐๅใฎใใญใณใใๆๆณใฎๅถ้:
+- LLM ใฏไพใฎใใฟใผใณใ็่งฃใงใใพใใใใใใใฎๆๆณใฏ่ค้ใชๆจ่ซใฟในใฏใงใฏใใพใๆฉ่ฝใใพใใใ
+- ๅฐๆฐใทใงใใใฎใใญใณใใใงใฏใ้ทใใใญใณใใใไฝๆใใๅฟ
่ฆใใใใพใใๅคง้ใฎใใผใฏใณใๅซใใใญใณใใใงใฏใ่จ็ฎ้ใจๅพ
ใกๆ้ใๅขๅ ใใๅฏ่ฝๆงใใใใพใใใใญใณใใใฎ้ทใใซใๅถ้ใใใใพใใ
+- ๅคใใฎไพใไธใใใจใใขใใซใๅญฆ็ฟใใใคใใใฎใชใใฃใใใฟใผใณใๅญฆ็ฟใใใใจใใใใพใใ 3็ช็ฎใฎๆ ็ปใฌใใฅใผใฏใใคใๅฆๅฎ็ใ ใจใใใใจใ
+
+### Chain-of-thought
+
+ๆ่้ฃ้ (CoT) ใใญใณใใใฏใใขใใซใๅพฎ่ชฟๆดใใฆไธญ้ๆจ่ซในใใใใ็ๆใใๆนๅใใๆๆณใงใใ
+่ค้ใชๆจ่ซใฟในใฏใฎ็ตๆใ
+
+ใขใใซใๆไฝใใฆๆจ่ซในใใใใ็ๆใใใซใฏใ2 ใคใฎๆนๆณใใใใพใใ
+- ่ณชๅใซๅฏพใใ่ฉณ็ดฐใชๅ็ญใๅซใไพใ็คบใใๅ้กใซๅฏพๅฆใใๆนๆณใใขใใซใซ็คบใใใจใงใๆฐๅใฎใใญใณใใใ่กจ็คบใใพใใ
+- ใในใใใใใจใซ่ใใฆใฟใพใใใใใพใใฏใๆทฑๅผๅธใใฆใๅ้กใในใใใใใจใซ่งฃๆฑบใใฆใใ ใใใใชใฉใฎใใฌใผใบใ่ฟฝๅ ใใฆใขใใซใซๆจ่ซใๆ็คบใใพใใ
+
+[ๆจ่ซใปใฏใทใงใณ](#reasoning) ใฎใใใฃใณใฎไพใซ CoT ใใฏใใใฏใ้ฉ็จใใใใๅคงใใชใขใใซใไฝฟ็จใใใจใ
+[HuggingChat](https://huggingface.co/chat/)ใง้ในใ(`tiiuae/falcon-180B-chat`)ใชใฉใ
+ๆจ่ซ็ตๆใฏๅคงๅน
ใซๆนๅใใใพใใ
+
+```text
+Let's go through this step-by-step:
+1. You start with 15 muffins.
+2. You eat 2 muffins, leaving you with 13 muffins.
+3. You give 5 muffins to your neighbor, leaving you with 8 muffins.
+4. Your partner buys 6 more muffins, bringing the total number of muffins to 14.
+5. Your partner eats 2 muffins, leaving you with 12 muffins.
+Therefore, you now have 12 muffins.
+```
+
+## Prompting vs fine-tuning
+
+ใใญใณใใใๆ้ฉๅใใใใจใงๅชใใ็ตๆใ้ๆใงใใพใใใใขใใซใๅพฎ่ชฟๆดใใใใฉใใใซใคใใฆใฏใพใ ๆๆกใใใใใใใพใใใ
+ใใชใใฎๅ ดๅใซใฏใใฃใจใใพใใใใงใใใใใใๅฐ่ฆๆจกใชใขใใซใๅพฎ่ชฟๆดใใใใจใๅฅฝใพใใใชใใทใงใณใงใใๅ ดๅใฎใใใคใใฎใทใใชใชใๆฌกใซ็คบใใพใใ
+
+- ใใกใคใณใ LLM ใไบๅใซใใฌใผใใณใฐใใใใใฎใจๅคงใใ็ฐใชใฃใฆใใใๅบ็ฏใชใใญใณใใๆ้ฉๅใงใฏๅๅใช็ตๆใๅพใใใพใใใงใใใ
+- ใขใใซใไฝใชใฝใผใน่จ่ชใง้ฉๅใซๅไฝใใๅฟ
่ฆใใใใพใใ
+- ๅณๆ ผใช่ฆๅถใฎไธใซใใๆฉๅฏใใผใฟใงใขใใซใใใฌใผใใณใฐใใๅฟ
่ฆใใใใพใใ
+- ใณในใใใใฉใคใใทใผใใคใณใใฉในใใฉใฏใใฃใใพใใฏใใฎไปใฎๅถ้ใซใใใๅฐ่ฆๆจกใชใขใใซใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+ไธ่จใฎใในใฆใฎไพใงใๅๅใชๅคงใใใฎใใกใคใซใใใงใซๆใฃใฆใใใใ็ฐกๅใซๅ
ฅๆใงใใใใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+ใใกใคใณๅบๆใฎใใผใฟใปใใใๅ็็ใชใณในใใงใขใใซใๅพฎ่ชฟๆดใงใใพใใๅๅใชๆ้ใจใชใฝใผในใๅฟ
่ฆใซใชใใพใ
+ใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+ไธ่จใฎไพใๅฝใฆใฏใพใใชใๅ ดๅใฏใใใญใณใใใๆ้ฉๅใใๆนใๆ็ใงใใใใจใใใใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/question_answering.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/question_answering.md
new file mode 100644
index 0000000000000000000000000000000000000000..9217c211e6f973ddfe2d9ca6c3e3ad36bf6cf743
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/question_answering.md
@@ -0,0 +1,438 @@
+
+
+# Question answering
+
+[[open-in-colab]]
+
+
+
+่ณชๅๅฟ็ญใฟในใฏใฏใ่ณชๅใซๅฏพใใฆๅ็ญใ่ฟใใพใใ AlexaใSiriใGoogle ใชใฉใฎไปฎๆณใขใทในใฟใณใใซๅคฉๆฐใๅฐใญใใใจใใใใชใใ่ณชๅๅฟ็ญใขใใซใไฝฟ็จใใใใจใใใใฏใใงใใ่ณชๅๅฟ็ญใฟในใฏใซใฏไธ่ฌ็ใซ 2 ใคใฎใฟใคใใใใใพใใ
+
+- ๆฝๅบ: ไธใใใใใณใณใใญในใใใๅ็ญใๆฝๅบใใพใใ
+- ๆฝ่ฑก็: ่ณชๅใซๆญฃใใ็ญใใใณใณใใญในใใใๅ็ญใ็ๆใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. ๆฝๅบ็่ณชๅๅฟ็ญ็จใซ [SQuAD](https://huggingface.co/datasets/squad) ใใผใฟใปใใไธใฎ [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) ใๅพฎ่ชฟๆดใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/question-answering) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load SQuAD dataset
+
+ใพใใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ SQuAD ใใผใฟใปใใใฎๅฐใใใตใใปใใใ่ชญใฟ่พผใฟใพใใใใใซใใใๅฎๅ
จใชใใผใฟใปใใใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใๅพใใใพใใ
+
+
+```py
+>>> from datasets import load_dataset
+
+>>> squad = load_dataset("squad", split="train[:5000]")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train` ๅๅฒใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+```py
+>>> squad = squad.train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> squad["train"][0]
+{'answers': {'answer_start': [515], 'text': ['Saint Bernadette Soubirous']},
+ 'context': 'Architecturally, the school has a Catholic character. Atop the Main Building\'s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend "Venite Ad Me Omnes". Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.',
+ 'id': '5733be284776f41900661182',
+ 'question': 'To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?',
+ 'title': 'University_of_Notre_Dame'
+}
+```
+
+ใใใซใฏใใใคใใฎ้่ฆใชใใฃใผใซใใใใใพใใ
+
+- `answers`: ๅ็ญใใผใฏใณใจๅ็ญใใญในใใฎ้ๅงไฝ็ฝฎใ
+- `context`: ใขใใซใ็ญใใๆฝๅบใใใใใซๅฟ
่ฆใช่ๆฏๆ
ๅ ฑใ
+- `question`: ใขใใซใ็ญใใๅฟ
่ฆใใใ่ณชๅใ
+
+## Preprocess
+
+
+
+ๆฌกใฎในใใใใงใฏใDistilBERT ใใผใฏใใคใถใผใใญใผใใใฆ`question`ใใฃใผใซใใจ`context`ใใฃใผใซใใๅฆ็ใใพใใ
+
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+่ณชๅๅฟ็ญใฟในใฏใซ็นๆใฎใๆณจๆใในใๅๅฆ็ๆ้ ใใใใคใใใใพใใ
+
+1. ใใผใฟใปใใๅ
ใฎไธ้จใฎไพใซใฏใใขใใซใฎๆๅคงๅ
ฅๅ้ทใ่ถ
ใใ้ๅธธใซ้ทใใใณใณใใญในใใใๅซใพใใๅ ดๅใใใใพใใใใ้ทใใทใผใฑใณในใๅฆ็ใใใซใฏใ`truncation="only_second"` ใ่จญๅฎใใฆ `context` ใฎใฟใๅใๆจใฆใพใใ
+2. ๆฌกใซใ่จญๅฎใซใใฃใฆใๅ็ญใฎ้ๅงไฝ็ฝฎใจ็ตไบไฝ็ฝฎใๅ
ใฎ `context`ใซใใใใณใฐใใพใใ
+ ใ`return_offset_mapping=True`ใใ
+3. ใใใใณใฐใๆๅ
ใซใใใฎใงใ็ญใใฎ้ๅงใใผใฏใณใจ็ตไบใใผใฏใณใ่ฆใคใใใใจใใงใใพใใ [`~tokenizers.Encoding.sequence_ids`] ใกใฝใใใไฝฟ็จใใฆใ
+ ใชใใปใใใฎใฉใฎ้จๅใ`question`ใซๅฏพๅฟใใใฉใฎ้จๅใ`context`ใซๅฏพๅฟใใใใ่ฆใคใใพใใ
+
+ไปฅไธใซใ`answer`ใฎ้ๅงใใผใฏใณใจ็ตไบใใผใฏใณใๅใ่ฉฐใใฆ`context`ใซใใใใณใฐใใ้ขๆฐใไฝๆใใๆนๆณใ็คบใใพใใ
+
+```py
+>>> def preprocess_function(examples):
+... questions = [q.strip() for q in examples["question"]]
+... inputs = tokenizer(
+... questions,
+... examples["context"],
+... max_length=384,
+... truncation="only_second",
+... return_offsets_mapping=True,
+... padding="max_length",
+... )
+
+... offset_mapping = inputs.pop("offset_mapping")
+... answers = examples["answers"]
+... start_positions = []
+... end_positions = []
+
+... for i, offset in enumerate(offset_mapping):
+... answer = answers[i]
+... start_char = answer["answer_start"][0]
+... end_char = answer["answer_start"][0] + len(answer["text"][0])
+... sequence_ids = inputs.sequence_ids(i)
+
+... # Find the start and end of the context
+... idx = 0
+... while sequence_ids[idx] != 1:
+... idx += 1
+... context_start = idx
+... while sequence_ids[idx] == 1:
+... idx += 1
+... context_end = idx - 1
+
+... # If the answer is not fully inside the context, label it (0, 0)
+... if offset[context_start][0] > end_char or offset[context_end][1] < start_char:
+... start_positions.append(0)
+... end_positions.append(0)
+... else:
+... # Otherwise it's the start and end token positions
+... idx = context_start
+... while idx <= context_end and offset[idx][0] <= start_char:
+... idx += 1
+... start_positions.append(idx - 1)
+
+... idx = context_end
+... while idx >= context_start and offset[idx][1] >= end_char:
+... idx -= 1
+... end_positions.append(idx + 1)
+
+... inputs["start_positions"] = start_positions
+... inputs["end_positions"] = end_positions
+... return inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ้ขๆฐใไฝฟ็จใใพใใ `batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใใใจใงใ`map` ้ขๆฐใ้ซ้ๅใงใใพใใไธ่ฆใชๅใๅ้คใใพใใ
+
+```py
+>>> tokenized_squad = squad.map(preprocess_function, batched=True, remove_columns=squad["train"].column_names)
+```
+
+ๆฌกใซใ[`DefaultDataCollatโโor`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใ ๐ค Transformers ใฎไปใฎใใผใฟ็
งๅๅจใจใฏ็ฐใชใใ[`DefaultDataCollatโโor`] ใฏใใใฃใณใฐใชใฉใฎ่ฟฝๅ ใฎๅๅฆ็ใ้ฉ็จใใพใใใ
+
+
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+```
+
+
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForQuestionAnswering`] ใไฝฟ็จใใฆ DitilBERT ใใญใผใใใพใใ
+
+```py
+>>> from transformers import AutoModelForQuestionAnswering, TrainingArguments, Trainer
+
+>>> model = AutoModelForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใ
+2. ใใฌใผใใณใฐๅผๆฐใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_qa_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=3,
+... weight_decay=0.01,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_squad["train"],
+... eval_dataset=tokenized_squad["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-a-tensorflow-model-with-keras) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใณใ>
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใใชใใใฃใใคใถใผ้ขๆฐใๅญฆ็ฟ็ในใฑใธใฅใผใซใใใใณใใใคใใฎใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใผใใปใใใขใใใใใใจใใๅงใใพใใ
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_epochs = 2
+>>> total_train_steps = (len(tokenized_squad["train"]) // batch_size) * num_epochs
+>>> optimizer, schedule = create_optimizer(
+... init_lr=2e-5,
+... num_warmup_steps=0,
+... num_train_steps=total_train_steps,
+... )
+```
+
+ๆฌกใซใ[`TFAutoModelForQuestionAnswering`] ใไฝฟ็จใใฆ DistilBERT ใใญใผใใงใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForQuestionAnswering
+
+>>> model = TFAutoModelForQuestionAnswering("distilbert/distilbert-base-uncased")
+```
+
+[`~transformers.TFPreTrainedModel.prepare_tf_dataset`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_squad["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_squad["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใฎใขใใซใ่จญๅฎใใพใใ
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer)
+```
+
+ใใฌใผใใณใฐใ้ๅงใใๅใซๆๅพใซใปใใใขใใใใใใจใฏใใขใใซใใใใซใใใทใฅใใๆนๆณใๆไพใใใใจใงใใใใใฏใใขใใซใจใใผใฏใใคใถใผใ [`~transformers.PushToHubCallback`] ใงใใใทใฅใใๅ ดๆใๆๅฎใใใใจใงๅฎ่กใงใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> callback = PushToHubCallback(
+... output_dir="my_awesome_qa_model",
+... tokenizer=tokenizer,
+... )
+```
+
+ใคใใซใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใใณใผใซใใใฏใๆๅฎใใฆ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใๅผใณๅบใใใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=3, callbacks=[callback])
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใจใใขใใซใฏ่ชๅ็ใซใใใซใขใใใญใผใใใใ่ชฐใงใไฝฟ็จใงใใใใใซใชใใพใใ
+
+
+
+
+
+่ณชๅๅฟ็ญ็จใฎใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+[PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb)
+ใพใใฏ [TensorFlow ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb)ใ
+
+
+
+## Evaluate
+
+่ณชๅๅฟ็ญใฎ่ฉไพกใซใฏใๅคง้ใฎๅพๅฆ็ใๅฟ
่ฆใงใใๆ้ใใใใใใใชใใใใซใใใฎใฌใคใใงใฏ่ฉไพกในใใใใ็็ฅใใฆใใพใใ [`Trainer`] ใฏใใฌใผใใณใฐไธญใซ่ฉไพกๆๅคฑใ่จ็ฎใใใใใใขใใซใฎใใใฉใผใใณในใซใคใใฆๅฎๅ
จใซๅใใใชใใใใงใฏใใใพใใใ
+
+ใใฃใจๆ้ใใใใ่ณชๅๅฟ็ญ็จใฎใขใใซใ่ฉไพกใใๆนๆณใซ่ๅณใใใๅ ดๅใฏใ[่ณชๅๅฟ็ญ](https://huggingface.co/course/chapter7/7?fw=pt#postprocessing) ใฎ็ซ ใๅ็
งใใฆใใ ใใใ ๐คใใฐใใงใคในใณใผในใใ๏ผ
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+่ณชๅใจใใขใใซใซไบๆธฌใใใใใณใณใใญในใใ่ใๅบใใพใใ
+
+```py
+>>> question = "How many programming languages does BLOOM support?"
+>>> context = "BLOOM has 176 billion parameters and can generate text in 46 languages natural languages and 13 programming languages."
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ่ณชๅๅฟ็ญ็จใฎ`pipeline`ใใคใณในใฟใณในๅใใใใใซใใญในใใๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> question_answerer = pipeline("question-answering", model="my_awesome_qa_model")
+>>> question_answerer(question=question, context=context)
+{'score': 0.2058267742395401,
+ 'start': 10,
+ 'end': 95,
+ 'answer': '176 billion parameters and can generate text in 46 languages natural languages and 13'}
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline`ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+
+
+
+ใใญในใใใใผใฏใณๅใใฆ PyTorch ใใณใฝใซใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_qa_model")
+>>> inputs = tokenizer(question, context, return_tensors="pt")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+
+```py
+>>> import torch
+>>> from transformers import AutoModelForQuestionAnswering
+
+>>> model = AutoModelForQuestionAnswering.from_pretrained("my_awesome_qa_model")
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+```
+
+ใขใใซๅบๅใใ้ๅงไฝ็ฝฎใจ็ตไบไฝ็ฝฎใฎๆใ้ซใ็ขบ็ใๅๅพใใพใใ
+
+```py
+>>> answer_start_index = outputs.start_logits.argmax()
+>>> answer_end_index = outputs.end_logits.argmax()
+```
+
+ไบๆธฌใใใใใผใฏใณใใใณใผใใใฆ็ญใใๅๅพใใพใใ
+
+```py
+>>> predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
+>>> tokenizer.decode(predict_answer_tokens)
+'176 billion parameters and can generate text in 46 languages natural languages and 13'
+```
+
+
+
+ใใญในใใใใผใฏใณๅใใTensorFlow ใใณใฝใซใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_qa_model")
+>>> inputs = tokenizer(question, text, return_tensors="tf")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+
+```py
+>>> from transformers import TFAutoModelForQuestionAnswering
+
+>>> model = TFAutoModelForQuestionAnswering.from_pretrained("my_awesome_qa_model")
+>>> outputs = model(**inputs)
+```
+
+ใขใใซๅบๅใใ้ๅงไฝ็ฝฎใจ็ตไบไฝ็ฝฎใฎๆใ้ซใ็ขบ็ใๅๅพใใพใใ
+
+```py
+>>> answer_start_index = int(tf.math.argmax(outputs.start_logits, axis=-1)[0])
+>>> answer_end_index = int(tf.math.argmax(outputs.end_logits, axis=-1)[0])
+```
+
+ไบๆธฌใใใใใผใฏใณใใใณใผใใใฆ็ญใใๅๅพใใพใใ
+
+```py
+>>> predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]
+>>> tokenizer.decode(predict_answer_tokens)
+'176 billion parameters and can generate text in 46 languages natural languages and 13'
+```
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/semantic_segmentation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/semantic_segmentation.md
new file mode 100644
index 0000000000000000000000000000000000000000..cfbfd7b81c0193acc0db6c261d4425f48897d4e1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/semantic_segmentation.md
@@ -0,0 +1,600 @@
+
+
+# Semantic segmentation
+
+[[open-in-colab]]
+
+
+
+ใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใงใฏใ็ปๅใฎๅใ
ใฎใใฏใปใซใซใฉใใซใพใใฏใฏใฉในใๅฒใๅฝใฆใพใใใปใฐใกใณใใผใทใงใณใซใฏใใใคใใฎใฟใคใใใใใพใใใใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใฎๅ ดๅใๅใใชใใธใงใฏใใฎไธๆใฎใคใณในใฟใณใน้ใฎๅบๅฅใฏ่กใใใพใใใไธกๆนใฎใชใใธใงใฏใใซๅใใฉใใซใไปใใใใพใ (ใใจใใฐใ`car-1`ใจ`car-2`ใฎไปฃใใใซ`car`)ใใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใฎไธ่ฌ็ใช็พๅฎไธ็ใฎใขใใชใฑใผใทใงใณใซใฏใๆญฉ่ก่
ใ้่ฆใชไบค้ๆ
ๅ ฑใ่ญๅฅใใใใใฎ่ชๅ้่ปข่ปใฎใใฌใผใใณใฐใๅป็็ปๅๅ
ใฎ็ดฐ่ใจ็ฐๅธธใฎ่ญๅฅใ่กๆ็ปๅใใใฎ็ฐๅขๅคๅใฎ็ฃ่ฆใชใฉใๅซใพใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [SceneParse150](https://huggingface.co/datasets/scene_parse_150) ใใผใฟใปใใใฎ [SegFormer](https://huggingface.co/docs/transformers/main/en/model_doc/segformer#segformer) ใๅพฎ่ชฟๆดใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/image-segmentation) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install -q datasets transformers evaluate
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load SceneParse150 dataset
+
+ใพใใSceneParse150 ใใผใฟใปใใใฎๅฐใใใตใใปใใใ ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ่ชญใฟ่พผใฟใพใใใใใซใใใๅฎๅ
จใชใใผใฟใปใใใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใๅพใใใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> ds = load_dataset("scene_parse_150", split="train[:50]")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train` ๅๅฒใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+
+```py
+>>> ds = ds.train_test_split(test_size=0.2)
+>>> train_ds = ds["train"]
+>>> test_ds = ds["test"]
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> train_ds[0]
+{'image': ,
+ 'annotation': ,
+ 'scene_category': 368}
+```
+
+- `image`: ใทใผใณใฎ PIL ใคใกใผใธใ
+- `annotation`: ใปใฐใกใณใใผใทใงใณ ใใใใฎ PIL ใคใกใผใธใใขใใซใฎใฟใผใฒใใใงใใใใพใใ
+- `scene_category`: "kitchen"ใ"office"ใชใฉใฎ็ปๅใทใผใณใ่ชฌๆใใใซใใดใช IDใใใฎใฌใคใใงใฏใ`image`ใจ`annotation`ใฎใฟใๅฟ
่ฆใซใชใใพใใใฉใกใใ PIL ใคใกใผใธใงใใ
+
+ใพใใใฉใใซ ID ใใฉใใซ ใฏใฉในใซใใใใใ่พๆธใไฝๆใใใใจใใงใใพใใใใใฏใๅพใงใขใใซใ่จญๅฎใใใจใใซๅฝน็ซใกใพใใใใใใใใใใณใฐใใใฆใณใญใผใใใ`id2label` ใใใณ `label2id` ใใฃใฏใทใงใใชใไฝๆใใพใใ
+
+```py
+>>> import json
+>>> from pathlib import Path
+>>> from huggingface_hub import hf_hub_download
+
+>>> repo_id = "huggingface/label-files"
+>>> filename = "ade20k-id2label.json"
+>>> id2label = json.loads(Path(hf_hub_download(repo_id, filename, repo_type="dataset")).read_text())
+>>> id2label = {int(k): v for k, v in id2label.items()}
+>>> label2id = {v: k for k, v in id2label.items()}
+>>> num_labels = len(id2label)
+```
+
+## Preprocess
+
+ๆฌกใฎในใใใใงใฏใSegFormer ็ปๅใใญใปใใตใใญใผใใใฆใใขใใซใฎ็ปๅใจๆณจ้ใๆบๅใใพใใใใฎใใผใฟใปใใใฎใใใชไธ้จใฎใใผใฟใปใใใฏใใใใฏใฐใฉใฆใณใ ใฏใฉในใจใใฆใผใญใคใณใใใฏในใไฝฟ็จใใพใใใใ ใใๅฎ้ใซใฏ่ๆฏใฏใฉในใฏ 150 ๅใฎใฏใฉในใซๅซใพใใฆใใชใใใใ`do_reduce_labels=True`ใ่จญๅฎใใฆใในใฆใฎใฉใใซใใ 1 ใคใๅผใๅฟ
่ฆใใใใพใใใผใญใคใณใใใฏในใฏ `255` ใซ็ฝฎใๆใใใใใใใSegFormer ใฎๆๅคฑ้ขๆฐใซใใฃใฆ็ก่ฆใใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> checkpoint = "nvidia/mit-b0"
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint, do_reduce_labels=True)
+```
+
+
+
+
+ใขใใซใ้ๅญฆ็ฟใซๅฏพใใฆใใๅ
็ขใซใใใใใซใ็ปๅใใผใฟใปใใใซใใใคใใฎใใผใฟๆกๅผตใ้ฉ็จใใใฎใไธ่ฌ็ใงใใใใฎใฌใคใใงใฏใ[torchvision](https://pytorch.org/vision/stable/index.html) ใฎ [`ColorJitter`](https://pytorch.org/vision/stable/generated/torchvision.transforms.ColorJitter.html) ้ขๆฐใไฝฟ็จใใพใใ ) ใไฝฟ็จใใฆ็ปๅใฎ่ฒใฎใใญใใใฃใใฉใณใใ ใซๅคๆดใใพใใใไปปๆใฎ็ปๅใฉใคใใฉใชใไฝฟ็จใใใใจใใงใใพใใ
+
+```py
+>>> from torchvision.transforms import ColorJitter
+
+>>> jitter = ColorJitter(brightness=0.25, contrast=0.25, saturation=0.25, hue=0.1)
+```
+
+ๆฌกใซใใขใใซใฎ็ปๅใจๆณจ้ใๆบๅใใใใใฎ 2 ใคใฎๅๅฆ็้ขๆฐใไฝๆใใพใใใใใใฎ้ขๆฐใฏใ็ปๅใ`pixel_values`ใซๅคๆใใๆณจ้ใ`labels`ใซๅคๆใใพใใใใฌใผใใณใฐ ใปใใใฎๅ ดๅใ็ปๅใ็ปๅใใญใปใใตใซๆไพใใๅใซ `jitter` ใ้ฉ็จใใใพใใใในใ ใปใใใฎๅ ดๅใใในใไธญใซใใผใฟๆกๅผตใ้ฉ็จใใใชใใใใ็ปๅใใญใปใใตใฏ`images`ใๅใๅใฃใฆๆญฃ่ฆๅใใ`ใฉใใซ`ใฎใฟใๅใๅใใพใใ
+
+```py
+>>> def train_transforms(example_batch):
+... images = [jitter(x) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+
+
+>>> def val_transforms(example_batch):
+... images = [x for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซ`jitter`ใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.set_transform`] ้ขๆฐใไฝฟ็จใใพใใๅคๆใฏใชใณใถใใฉใคใง้ฉ็จใใใใใใ้ซ้ใงๆถ่ฒปใใใใฃในใฏๅฎน้ใๅฐใชใใชใใพใใ
+
+```py
+>>> train_ds.set_transform(train_transforms)
+>>> test_ds.set_transform(val_transforms)
+```
+
+
+
+
+
+
+
+ใขใใซใ้ๅญฆ็ฟใซๅฏพใใฆใใๅ
็ขใซใใใใใซใ็ปๅใใผใฟใปใใใซใใใคใใฎใใผใฟๆกๅผตใ้ฉ็จใใใฎใไธ่ฌ็ใงใใ
+ใใฎใฌใคใใงใฏใ[`tf.image`](https://www.tensorflow.org/api_docs/python/tf/image) ใไฝฟ็จใใฆ็ปๅใฎ่ฒใฎใใญใใใฃใใฉใณใใ ใซๅคๆดใใพใใใไปปๆใฎใใญใใใฃใไฝฟ็จใใใใจใใงใใพใใ็ปๅ
+ๅฅฝใใชๅณๆธ้คจใ
+2 ใคใฎๅฅใ
ใฎๅคๆ้ขๆฐใๅฎ็พฉใใพใใ
+- ็ปๅๆกๅผตใๅซใใใฌใผใใณใฐ ใใผใฟๅคๆ
+- ๐ค Transformers ใฎใณใณใใฅใผใฟใผ ใใธใงใณ ใขใใซใฏใใฃใใซๅชๅ
ใฎใฌใคใขใฆใใๆณๅฎใใฆใใใใใ็ปๅใ่ปข็ฝฎใใใ ใใฎๆค่จผใใผใฟๅคๆ
+
+```py
+>>> import tensorflow as tf
+
+
+>>> def aug_transforms(image):
+... image = tf.keras.utils.img_to_array(image)
+... image = tf.image.random_brightness(image, 0.25)
+... image = tf.image.random_contrast(image, 0.5, 2.0)
+... image = tf.image.random_saturation(image, 0.75, 1.25)
+... image = tf.image.random_hue(image, 0.1)
+... image = tf.transpose(image, (2, 0, 1))
+... return image
+
+
+>>> def transforms(image):
+... image = tf.keras.utils.img_to_array(image)
+... image = tf.transpose(image, (2, 0, 1))
+... return image
+```
+
+ๆฌกใซใใขใใซใฎ็ปๅใจๆณจ้ใฎใใใใๆบๅใใ 2 ใคใฎๅๅฆ็้ขๆฐใไฝๆใใพใใใใใใฎๆฉ่ฝใ้ฉ็จใใใพใ
+็ปๅๅคๆใ่กใใไปฅๅใซใญใผใใใใ `image_processor` ใไฝฟ็จใใฆ็ปๅใ `pixel_values` ใซๅคๆใใ
+`labels`ใธใฎๆณจ้ใ `ImageProcessor` ใฏใ็ปๅใฎใตใคใบๅคๆดใจๆญฃ่ฆๅใๅฆ็ใใพใใ
+
+```py
+>>> def train_transforms(example_batch):
+... images = [aug_transforms(x.convert("RGB")) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+
+
+>>> def val_transforms(example_batch):
+... images = [transforms(x.convert("RGB")) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็ๅคๆใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.set_transform`] ้ขๆฐใไฝฟ็จใใพใใ
+ๅคๆใฏใชใณใถใใฉใคใง้ฉ็จใใใใใใ้ซ้ใงๆถ่ฒปใใใใฃในใฏๅฎน้ใๅฐใชใใชใใพใใ
+
+```py
+>>> train_ds.set_transform(train_transforms)
+>>> test_ds.set_transform(val_transforms)
+```
+
+
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[Mean Intersection over Union](https://huggingface.co/spaces/evaluate-metric/accuracy) (IoU) ใกใใชใใฏใใญใผใใใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใกใใชใฏในใใญใผใใใฆ่จ็ฎใใๆนๆณใฎ่ฉณ็ดฐใ็ขบ่ชใใฆใใ ใใ)ใ
+
+```py
+>>> import evaluate
+
+>>> metric = evaluate.load("mean_iou")
+```
+
+ๆฌกใซใใกใใชใฏในใ [`~evaluate.EvaluationModule.compute`] ใใ้ขๆฐใไฝๆใใพใใไบๆธฌใๆฌกใฎใใใซๅคๆใใๅฟ
่ฆใใใใพใ
+ๆๅใซใญใธใใใไฝๆใใๆฌกใซ [`~evaluate.EvaluationModule.compute`] ใๅผใณๅบใๅใซใฉใใซใฎใตใคใบใซไธ่ดใใใใใซๅๅฝขๆใใพใใ
+
+
+
+
+```py
+>>> import numpy as np
+>>> import torch
+>>> from torch import nn
+
+>>> def compute_metrics(eval_pred):
+... with torch.no_grad():
+... logits, labels = eval_pred
+... logits_tensor = torch.from_numpy(logits)
+... logits_tensor = nn.functional.interpolate(
+... logits_tensor,
+... size=labels.shape[-2:],
+... mode="bilinear",
+... align_corners=False,
+... ).argmax(dim=1)
+
+... pred_labels = logits_tensor.detach().cpu().numpy()
+... metrics = metric.compute(
+... predictions=pred_labels,
+... references=labels,
+... num_labels=num_labels,
+... ignore_index=255,
+... reduce_labels=False,
+... )
+... for key, value in metrics.items():
+... if type(value) is np.ndarray:
+... metrics[key] = value.tolist()
+... return metrics
+```
+
+
+
+
+
+
+
+
+```py
+>>> def compute_metrics(eval_pred):
+... logits, labels = eval_pred
+... logits = tf.transpose(logits, perm=[0, 2, 3, 1])
+... logits_resized = tf.image.resize(
+... logits,
+... size=tf.shape(labels)[1:],
+... method="bilinear",
+... )
+
+... pred_labels = tf.argmax(logits_resized, axis=-1)
+... metrics = metric.compute(
+... predictions=pred_labels,
+... references=labels,
+... num_labels=num_labels,
+... ignore_index=-1,
+... reduce_labels=image_processor.do_reduce_labels,
+... )
+
+... per_category_accuracy = metrics.pop("per_category_accuracy").tolist()
+... per_category_iou = metrics.pop("per_category_iou").tolist()
+
+... metrics.update({f"accuracy_{id2label[i]}": v for i, v in enumerate(per_category_accuracy)})
+... metrics.update({f"iou_{id2label[i]}": v for i, v in enumerate(per_category_iou)})
+... return {"val_" + k: v for k, v in metrics.items()}
+```
+
+
+
+
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใ](../training#finetune-with-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForSemanticSegmentation`] ใไฝฟ็จใใฆ SegFormer ใใญใผใใใใฉใใซ ID ใจใฉใใซ ใฏใฉใน้ใฎใใใใณใฐใใขใใซใซๆธกใใพใใ
+
+```py
+>>> from transformers import AutoModelForSemanticSegmentation, TrainingArguments, Trainer
+
+>>> model = AutoModelForSemanticSegmentation.from_pretrained(checkpoint, id2label=id2label, label2id=label2id)
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใ `image` ๅใๅ้คใใใใใใๆชไฝฟ็จใฎๅใๅ้คใใชใใใจใ้่ฆใงใใ `image` ๅใใชใใจใ`pixel_values` ใไฝๆใงใใพใใใใใฎๅไฝใ้ฒใใซใฏใ`remove_unused_columns=False`ใ่จญๅฎใใฆใใ ใใใไปใซๅฟ
่ฆใชใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใ ใใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`Trainer`] ใฏ IoU ใกใใชใใฏใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="segformer-b0-scene-parse-150",
+... learning_rate=6e-5,
+... num_train_epochs=50,
+... per_device_train_batch_size=2,
+... per_device_eval_batch_size=2,
+... save_total_limit=3,
+... eval_strategy="steps",
+... save_strategy="steps",
+... save_steps=20,
+... eval_steps=20,
+... logging_steps=1,
+... eval_accumulation_steps=5,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=train_ds,
+... eval_dataset=test_ds,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใใพใ [ๅบๆฌใใฅใผใใชใขใซ](./training#train-a-tensorflow-model-with-keras) ใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใๆฌกใฎๆ้ ใซๅพใใพใใ
+1. ใใฌใผใใณใฐใฎใใคใใผใใฉใกใผใฟใๅฎ็พฉใใใชใใใฃใใคใถใผใจๅญฆ็ฟ็ในใฑใธใฅใผใซใ่จญๅฎใใพใใ
+2. ไบๅใใฌใผใใณใฐใใใใขใใซใใคใณในใฟใณในๅใใพใใ
+3. ๐ค ใใผใฟใปใใใ `tf.data.Dataset` ใซๅคๆใใพใใ
+4. ใขใใซใใณใณใใคใซใใพใใ
+5. ใณใผใซใใใฏใ่ฟฝๅ ใใฆใกใใชใฏในใ่จ็ฎใใใขใใซใ ๐ค Hub ใซใขใใใญใผใใใพใ
+6. `fit()` ใกใฝใใใไฝฟ็จใใฆใใฌใผใใณใฐใๅฎ่กใใพใใ
+
+ใพใใใใคใใผใใฉใกใผใฟใผใใชใใใฃใใคใถใผใๅญฆ็ฟ็ในใฑใธใฅใผใซใๅฎ็พฉใใพใใ
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 2
+>>> num_epochs = 50
+>>> num_train_steps = len(train_ds) * num_epochs
+>>> learning_rate = 6e-5
+>>> weight_decay_rate = 0.01
+
+>>> optimizer, lr_schedule = create_optimizer(
+... init_lr=learning_rate,
+... num_train_steps=num_train_steps,
+... weight_decay_rate=weight_decay_rate,
+... num_warmup_steps=0,
+... )
+```
+
+ๆฌกใซใใฉใใซ ใใใใณใฐใจใจใใซ [`TFAutoModelForSemanticSegmentation`] ใไฝฟ็จใใฆ SegFormer ใใญใผใใใใใใใณใณใใคใซใใพใใ
+ใชใใใฃใใคใถใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> from transformers import TFAutoModelForSemanticSegmentation
+
+>>> model = TFAutoModelForSemanticSegmentation.from_pretrained(
+... checkpoint,
+... id2label=id2label,
+... label2id=label2id,
+... )
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+[`~datasets.Dataset.to_tf_dataset`] ใจ [`DefaultDataCollatโโor`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+
+>>> tf_train_dataset = train_ds.to_tf_dataset(
+... columns=["pixel_values", "label"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+
+>>> tf_eval_dataset = test_ds.to_tf_dataset(
+... columns=["pixel_values", "label"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+```
+
+ไบๆธฌใใ็ฒพๅบฆใ่จ็ฎใใใขใใซใ ๐ค ใใใซใใใทใฅใใใซใฏใ[Keras callbacks](../main_classes/keras_callbacks) ใไฝฟ็จใใพใใ
+`compute_metrics` ้ขๆฐใ [`KerasMetricCallback`] ใซๆธกใใพใใ
+ใใใฆ [`PushToHubCallback`] ใไฝฟ็จใใฆใขใใซใใขใใใญใผใใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback, PushToHubCallback
+
+>>> metric_callback = KerasMetricCallback(
+... metric_fn=compute_metrics, eval_dataset=tf_eval_dataset, batch_size=batch_size, label_cols=["labels"]
+... )
+
+>>> push_to_hub_callback = PushToHubCallback(output_dir="scene_segmentation", tokenizer=image_processor)
+
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+ใคใใซใใขใใซใใใฌใผใใณใฐใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใ
+ใขใใซใๅพฎ่ชฟๆดใใใใใฎใณใผใซใใใฏ:
+
+
+```py
+>>> model.fit(
+... tf_train_dataset,
+... validation_data=tf_eval_dataset,
+... callbacks=callbacks,
+... epochs=num_epochs,
+... )
+```
+
+ใใใงใจใ๏ผใขใใซใๅพฎ่ชฟๆดใใ๐ค Hub ใงๅ
ฑๆใใพใใใใใใงๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๆจ่ซใฎใใใซ็ปๅใใญใผใใใพใใ
+
+```py
+>>> image = ds[0]["image"]
+>>> image
+```
+
+
+
+
+
+
+
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ็ปๅใปใฐใกใณใใผใทใงใณ็จใฎ `pipeline`ใใคใณในใฟใณในๅใใใใใซ็ปๅใๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> segmenter = pipeline("image-segmentation", model="my_awesome_seg_model")
+>>> segmenter(image)
+[{'score': None,
+ 'label': 'wall',
+ 'mask': },
+ {'score': None,
+ 'label': 'sky',
+ 'mask': },
+ {'score': None,
+ 'label': 'floor',
+ 'mask': },
+ {'score': None,
+ 'label': 'ceiling',
+ 'mask': },
+ {'score': None,
+ 'label': 'bed ',
+ 'mask': },
+ {'score': None,
+ 'label': 'windowpane',
+ 'mask': },
+ {'score': None,
+ 'label': 'cabinet',
+ 'mask': },
+ {'score': None,
+ 'label': 'chair',
+ 'mask': },
+ {'score': None,
+ 'label': 'armchair',
+ 'mask': }]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline`ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ็ปๅใ็ปๅใใญใปใใตใงๅฆ็ใใ`pixel_values` ใ GPU ใซ้
็ฝฎใใพใใ
+
+```py
+>>> device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # use GPU if available, otherwise use a CPU
+>>> encoding = image_processor(image, return_tensors="pt")
+>>> pixel_values = encoding.pixel_values.to(device)
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+
+```py
+>>> outputs = model(pixel_values=pixel_values)
+>>> logits = outputs.logits.cpu()
+```
+
+ๆฌกใซใใญใธใใใๅ
ใฎ็ปๅใตใคใบใซๅในใฑใผใซใใพใใ
+
+```py
+>>> upsampled_logits = nn.functional.interpolate(
+... logits,
+... size=image.size[::-1],
+... mode="bilinear",
+... align_corners=False,
+... )
+
+>>> pred_seg = upsampled_logits.argmax(dim=1)[0]
+```
+
+
+
+
+
+
+
+็ปๅใใญใปใใตใใญใผใใใฆ็ปๅใๅๅฆ็ใใๅ
ฅๅใ TensorFlow ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("MariaK/scene_segmentation")
+>>> inputs = image_processor(image, return_tensors="tf")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForSemanticSegmentation
+
+>>> model = TFAutoModelForSemanticSegmentation.from_pretrained("MariaK/scene_segmentation")
+>>> logits = model(**inputs).logits
+```
+
+ๆฌกใซใใญใธใใใๅ
ใฎ็ปๅใตใคใบใซๅในใฑใผใซใใใฏใฉในๆฌกๅ
ใซ argmax ใ้ฉ็จใใพใใ
+
+```py
+>>> logits = tf.transpose(logits, [0, 2, 3, 1])
+
+>>> upsampled_logits = tf.image.resize(
+... logits,
+... # We reverse the shape of `image` because `image.size` returns width and height.
+... image.size[::-1],
+... )
+
+>>> pred_seg = tf.math.argmax(upsampled_logits, axis=-1)[0]
+```
+
+
+
+
+็ตๆใ่ฆ่ฆๅใใใซใฏใ[ใใผใฟใปใใ ใซใฉใผ ใใฌใใ](https://github.com/tensorflow/models/blob/3f1ca33afe3c1631b733ea7e40c294273b9e406d/research/deeplab/utils/get_dataset_colormap.py#L51) ใใใใใใใใใใใใ `ade_palette()` ใจใใฆใญใผใใใพใใใฏใฉในใ RGB ๅคใซๅคๆใใพใใๆฌกใซใ็ปๅใจไบๆธฌใใใใปใฐใกใณใใผใทใงใณ ใใใใ็ตใฟๅใใใฆใใญใใใงใใพใใ
+
+```py
+>>> import matplotlib.pyplot as plt
+>>> import numpy as np
+
+>>> color_seg = np.zeros((pred_seg.shape[0], pred_seg.shape[1], 3), dtype=np.uint8)
+>>> palette = np.array(ade_palette())
+>>> for label, color in enumerate(palette):
+... color_seg[pred_seg == label, :] = color
+>>> color_seg = color_seg[..., ::-1] # convert to BGR
+
+>>> img = np.array(image) * 0.5 + color_seg * 0.5 # plot the image with the segmentation map
+>>> img = img.astype(np.uint8)
+
+>>> plt.figure(figsize=(15, 10))
+>>> plt.imshow(img)
+>>> plt.show()
+```
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/sequence_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/sequence_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..ba2e39282b00f1d32a09c5b768141787ab1faa60
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/sequence_classification.md
@@ -0,0 +1,604 @@
+
+
+# Sequence classification
+
+[[open-in-colab]]
+
+
+
+ใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใงใฏใ็ปๅใฎๅใ
ใฎใใฏใปใซใซใฉใใซใพใใฏใฏใฉในใๅฒใๅฝใฆใพใใใปใฐใกใณใใผใทใงใณใซใฏใใใคใใฎใฟใคใใใใใพใใใใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใฎๅ ดๅใๅใใชใใธใงใฏใใฎไธๆใฎใคใณในใฟใณใน้ใฎๅบๅฅใฏ่กใใใพใใใไธกๆนใฎใชใใธใงใฏใใซๅใใฉใใซใไปใใใใพใ (ใใจใใฐใใcar-1ใใจใcar-2ใใฎไปฃใใใซใcarใ)ใใปใใณใใฃใใฏ ใปใฐใกใณใใผใทใงใณใฎไธ่ฌ็ใช็พๅฎไธ็ใฎใขใใชใฑใผใทใงใณใซใฏใๆญฉ่ก่
ใ้่ฆใชไบค้ๆ
ๅ ฑใ่ญๅฅใใใใใฎ่ชๅ้่ปข่ปใฎใใฌใผใใณใฐใๅป็็ปๅๅ
ใฎ็ดฐ่ใจ็ฐๅธธใฎ่ญๅฅใ่กๆ็ปๅใใใฎ็ฐๅขๅคๅใฎ็ฃ่ฆใชใฉใๅซใพใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [SceneParse150](https://huggingface.co/datasets/scene_parse_150) ใใผใฟใปใใใฎ [SegFormer](https://huggingface.co/docs/transformers/main/en/model_doc/segformer#segformer) ใๅพฎ่ชฟๆดใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/text-classification) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install -q datasets transformers evaluate
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load SceneParse150 dataset
+
+
+ใพใใSceneParse150 ใใผใฟใปใใใฎๅฐใใใตใใปใใใ ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ่ชญใฟ่พผใฟใพใใใใใซใใใๅฎๅ
จใชใใผใฟใปใใใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใๅพใใใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> ds = load_dataset("scene_parse_150", split="train[:50]")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใฎ `train` ๅๅฒใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+```py
+>>> ds = ds.train_test_split(test_size=0.2)
+>>> train_ds = ds["train"]
+>>> test_ds = ds["test"]
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> train_ds[0]
+{'image': ,
+ 'annotation': ,
+ 'scene_category': 368}
+```
+
+- `image`: ใทใผใณใฎ PIL ใคใกใผใธใ
+- `annotation`: ใปใฐใกใณใใผใทใงใณ ใใใใฎ PIL ใคใกใผใธใใขใใซใฎใฟใผใฒใใใงใใใใพใใ
+- `scene_category`: ใใญใใใณใใใใชใใฃในใใชใฉใฎ็ปๅใทใผใณใ่ชฌๆใใใซใใดใช IDใใใฎใฌใคใใงใฏใใimageใใจใannotationใใฎใฟใๅฟ
่ฆใซใชใใพใใใฉใกใใ PIL ใคใกใผใธใงใใ
+
+ใพใใใฉใใซ ID ใใฉใใซ ใฏใฉในใซใใใใใ่พๆธใไฝๆใใใใจใใงใใพใใใใใฏใๅพใงใขใใซใ่จญๅฎใใใจใใซๅฝน็ซใกใพใใใใใใใใใใณใฐใใใฆใณใญใผใใใ`id2label` ใใใณ `label2id` ใใฃใฏใทใงใใชใไฝๆใใพใใ
+
+```py
+>>> import json
+>>> from pathlib import Path
+>>> from huggingface_hub import hf_hub_download
+
+>>> repo_id = "huggingface/label-files"
+>>> filename = "ade20k-id2label.json"
+>>> id2label = json.loads(Path(hf_hub_download(repo_id, filename, repo_type="dataset")).read_text())
+>>> id2label = {int(k): v for k, v in id2label.items()}
+>>> label2id = {v: k for k, v in id2label.items()}
+>>> num_labels = len(id2label)
+```
+
+## Preprocess
+
+ๆฌกใฎในใใใใงใฏใSegFormer ็ปๅใใญใปใใตใใญใผใใใฆใใขใใซใฎ็ปๅใจๆณจ้ใๆบๅใใพใใใใฎใใผใฟใปใใใฎใใใชไธ้จใฎใใผใฟใปใใใฏใใใใฏใฐใฉใฆใณใ ใฏใฉในใจใใฆใผใญใคใณใใใฏในใไฝฟ็จใใพใใใใ ใใๅฎ้ใซใฏ่ๆฏใฏใฉในใฏ 150 ๅใฎใฏใฉในใซๅซใพใใฆใใชใใใใ`do_reduce_labels=True`ใ่จญๅฎใใฆใในใฆใฎใฉใใซใใ 1 ใคใๅผใๅฟ
่ฆใใใใพใใใผใญใคใณใใใฏในใฏ `255` ใซ็ฝฎใๆใใใใใใใSegFormer ใฎๆๅคฑ้ขๆฐใซใใฃใฆ็ก่ฆใใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> checkpoint = "nvidia/mit-b0"
+>>> image_processor = AutoImageProcessor.from_pretrained(checkpoint, do_reduce_labels=True)
+```
+
+
+
+
+ใขใใซใ้ๅญฆ็ฟใซๅฏพใใฆใใๅ
็ขใซใใใใใซใ็ปๅใใผใฟใปใใใซใใใคใใฎใใผใฟๆกๅผตใ้ฉ็จใใใฎใไธ่ฌ็ใงใใใใฎใฌใคใใงใฏใ[torchvision](https://pytorch.org) ใฎ [`ColorJitter`](https://pytorch.org/vision/stable/generated/torchvision.transforms.ColorJitter.html) ้ขๆฐใไฝฟ็จใใพใใ /vision/stable/index.html) ใไฝฟ็จใใฆ็ปๅใฎ่ฒใฎใใญใใใฃใใฉใณใใ ใซๅคๆดใใพใใใไปปๆใฎ็ปๅใฉใคใใฉใชใไฝฟ็จใใใใจใใงใใพใใ
+
+```py
+>>> from torchvision.transforms import ColorJitter
+
+>>> jitter = ColorJitter(brightness=0.25, contrast=0.25, saturation=0.25, hue=0.1)
+```
+
+ๆฌกใซใใขใใซใฎ็ปๅใจๆณจ้ใๆบๅใใใใใฎ 2 ใคใฎๅๅฆ็้ขๆฐใไฝๆใใพใใใใใใฎ้ขๆฐใฏใ็ปๅใ`pixel_values`ใซๅคๆใใๆณจ้ใ`labels`ใซๅคๆใใพใใใใฌใผใใณใฐ ใปใใใฎๅ ดๅใ็ปๅใ็ปๅใใญใปใใตใซๆไพใใๅใซ`jitter`ใ้ฉ็จใใใพใใใในใ ใปใใใฎๅ ดๅใใในใไธญใซใใผใฟๆกๅผตใ้ฉ็จใใใชใใใใ็ปๅใใญใปใใตใฏ`images`ใๅใๅใฃใฆๆญฃ่ฆๅใใ`labels` ใฎใฟใๅใๅใใพใใ
+
+```py
+>>> def train_transforms(example_batch):
+... images = [jitter(x) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+
+
+>>> def val_transforms(example_batch):
+... images = [x for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซ`jitter`ใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.set_transform`] ้ขๆฐใไฝฟ็จใใพใใๅคๆใฏใชใณใถใใฉใคใง้ฉ็จใใใใใใ้ซ้ใงๆถ่ฒปใใใใฃในใฏๅฎน้ใๅฐใชใใชใใพใใ
+
+```py
+>>> train_ds.set_transform(train_transforms)
+>>> test_ds.set_transform(val_transforms)
+```
+
+
+
+
+
+
+
+ใขใใซใ้ๅญฆ็ฟใซๅฏพใใฆใใๅ
็ขใซใใใใใซใ็ปๅใใผใฟใปใใใซใใใคใใฎใใผใฟๆกๅผตใ้ฉ็จใใใฎใไธ่ฌ็ใงใใ
+ใใฎใฌใคใใงใฏใ[`tf.image`](https://www.tensorflow.org/api_docs/python/tf/image) ใไฝฟ็จใใฆ็ปๅใฎ่ฒใฎใใญใใใฃใใฉใณใใ ใซๅคๆดใใพใใใไปปๆใฎใใญใใใฃใไฝฟ็จใใใใจใใงใใพใใ็ปๅ
+ๅฅฝใใชๅณๆธ้คจใ
+2 ใคใฎๅฅใ
ใฎๅคๆ้ขๆฐใๅฎ็พฉใใพใใ
+- ็ปๅๆกๅผตใๅซใใใฌใผใใณใฐ ใใผใฟๅคๆ
+- ๐ค Transformers ใฎใณใณใใฅใผใฟใผ ใใธใงใณ ใขใใซใฏใใฃใใซๅชๅ
ใฎใฌใคใขใฆใใๆณๅฎใใฆใใใใใ็ปๅใ่ปข็ฝฎใใใ ใใฎๆค่จผใใผใฟๅคๆ
+
+```py
+>>> import tensorflow as tf
+
+
+>>> def aug_transforms(image):
+... image = tf.keras.utils.img_to_array(image)
+... image = tf.image.random_brightness(image, 0.25)
+... image = tf.image.random_contrast(image, 0.5, 2.0)
+... image = tf.image.random_saturation(image, 0.75, 1.25)
+... image = tf.image.random_hue(image, 0.1)
+... image = tf.transpose(image, (2, 0, 1))
+... return image
+
+
+>>> def transforms(image):
+... image = tf.keras.utils.img_to_array(image)
+... image = tf.transpose(image, (2, 0, 1))
+... return image
+```
+
+ๆฌกใซใใขใใซใฎ็ปๅใจๆณจ้ใฎใใใใๆบๅใใ 2 ใคใฎๅๅฆ็้ขๆฐใไฝๆใใพใใใใใใฎๆฉ่ฝใ้ฉ็จใใใพใ
+็ปๅๅคๆใ่กใใไปฅๅใซใญใผใใใใ `image_processor` ใไฝฟ็จใใฆ็ปๅใ `pixel_values` ใซๅคๆใใ
+`labels`ใธใฎๆณจ้ใ `ImageProcessor` ใฏใ็ปๅใฎใตใคใบๅคๆดใจๆญฃ่ฆๅใๅฆ็ใใพใใ
+
+```py
+>>> def train_transforms(example_batch):
+... images = [aug_transforms(x.convert("RGB")) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+
+
+>>> def val_transforms(example_batch):
+... images = [transforms(x.convert("RGB")) for x in example_batch["image"]]
+... labels = [x for x in example_batch["annotation"]]
+... inputs = image_processor(images, labels)
+... return inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็ๅคๆใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.set_transform`] ้ขๆฐใไฝฟ็จใใพใใ
+ๅคๆใฏใชใณใถใใฉใคใง้ฉ็จใใใใใใ้ซ้ใงๆถ่ฒปใใใใฃในใฏๅฎน้ใๅฐใชใใชใใพใใ
+
+```py
+>>> train_ds.set_transform(train_transforms)
+>>> test_ds.set_transform(val_transforms)
+```
+
+
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[Mean Intersection over Union](https://huggingface.co/spaces/evaluate-metric/accuracy) (IoU) ใกใใชใใฏใใญใผใใใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co) ใๅ็
งใใฆใใ ใใ) /docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใกใใชใฏในใใญใผใใใฆ่จ็ฎใใๆนๆณใฎ่ฉณ็ดฐใ็ขบ่ชใใฆใใ ใใ)ใ
+
+```py
+>>> import evaluate
+
+>>> metric = evaluate.load("mean_iou")
+```
+
+ๆฌกใซใใกใใชใฏในใ [`~evaluate.EvaluationModule.compute`] ใใ้ขๆฐใไฝๆใใพใใไบๆธฌใๆฌกใฎใใใซๅคๆใใๅฟ
่ฆใใใใพใ
+ๆๅใซใญใธใใใไฝๆใใๆฌกใซ [`~evaluate.EvaluationModule.compute`] ใๅผใณๅบใๅใซใฉใใซใฎใตใคใบใซไธ่ดใใใใใซๅๅฝขๆใใพใใ
+
+
+
+
+```py
+>>> import numpy as np
+>>> import torch
+>>> from torch import nn
+
+>>> def compute_metrics(eval_pred):
+... with torch.no_grad():
+... logits, labels = eval_pred
+... logits_tensor = torch.from_numpy(logits)
+... logits_tensor = nn.functional.interpolate(
+... logits_tensor,
+... size=labels.shape[-2:],
+... mode="bilinear",
+... align_corners=False,
+... ).argmax(dim=1)
+
+... pred_labels = logits_tensor.detach().cpu().numpy()
+... metrics = metric.compute(
+... predictions=pred_labels,
+... references=labels,
+... num_labels=num_labels,
+... ignore_index=255,
+... reduce_labels=False,
+... )
+... for key, value in metrics.items():
+... if type(value) is np.ndarray:
+... metrics[key] = value.tolist()
+... return metrics
+```
+
+
+
+
+
+
+
+
+```py
+>>> def compute_metrics(eval_pred):
+... logits, labels = eval_pred
+... logits = tf.transpose(logits, perm=[0, 2, 3, 1])
+... logits_resized = tf.image.resize(
+... logits,
+... size=tf.shape(labels)[1:],
+... method="bilinear",
+... )
+
+... pred_labels = tf.argmax(logits_resized, axis=-1)
+... metrics = metric.compute(
+... predictions=pred_labels,
+... references=labels,
+... num_labels=num_labels,
+... ignore_index=-1,
+... reduce_labels=image_processor.do_reduce_labels,
+... )
+
+... per_category_accuracy = metrics.pop("per_category_accuracy").tolist()
+... per_category_iou = metrics.pop("per_category_iou").tolist()
+
+... metrics.update({f"accuracy_{id2label[i]}": v for i, v in enumerate(per_category_accuracy)})
+... metrics.update({f"iou_{id2label[i]}": v for i, v in enumerate(per_category_iou)})
+... return {"val_" + k: v for k, v in metrics.items()}
+```
+
+
+
+
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#finetune-with-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForSemanticSegmentation`] ใไฝฟ็จใใฆ SegFormer ใใญใผใใใใฉใใซ ID ใจใฉใใซ ใฏใฉใน้ใฎใใใใณใฐใใขใใซใซๆธกใใพใใ
+
+```py
+>>> from transformers import AutoModelForSemanticSegmentation, TrainingArguments, Trainer
+
+>>> model = AutoModelForSemanticSegmentation.from_pretrained(checkpoint, id2label=id2label, label2id=label2id)
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใ `image` ๅใๅ้คใใใใใใๆชไฝฟ็จใฎๅใๅ้คใใชใใใจใ้่ฆใงใใ `image` ๅใใชใใจใ`pixel_values` ใไฝๆใงใใพใใใใใฎๅไฝใ้ฒใใซใฏใ`remove_unused_columns=False`ใ่จญๅฎใใฆใใ ใใใไปใซๅฟ
่ฆใชใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใ ใใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`Trainer`] ใฏ IoU ใกใใชใใฏใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="segformer-b0-scene-parse-150",
+... learning_rate=6e-5,
+... num_train_epochs=50,
+... per_device_train_batch_size=2,
+... per_device_eval_batch_size=2,
+... save_total_limit=3,
+... eval_strategy="steps",
+... save_strategy="steps",
+... save_steps=20,
+... eval_steps=20,
+... logging_steps=1,
+... eval_accumulation_steps=5,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=train_ds,
+... eval_dataset=test_ds,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใใพใ [ๅบๆฌใใฅใผใใชใขใซ](./training#train-a-tensorflow-model-with-keras) ใ็ขบ่ชใใฆใใ ใใใ
+
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใๆฌกใฎๆ้ ใซๅพใใพใใ
+1. ใใฌใผใใณใฐใฎใใคใใผใใฉใกใผใฟใๅฎ็พฉใใใชใใใฃใใคใถใผใจๅญฆ็ฟ็ในใฑใธใฅใผใซใ่จญๅฎใใพใใ
+2. ไบๅใใฌใผใใณใฐใใใใขใใซใใคใณในใฟใณในๅใใพใใ
+3. ๐ค ใใผใฟใปใใใ `tf.data.Dataset` ใซๅคๆใใพใใ
+4. ใขใใซใใณใณใใคใซใใพใใ
+5. ใณใผใซใใใฏใ่ฟฝๅ ใใฆใกใใชใฏในใ่จ็ฎใใใขใใซใ ๐ค Hub ใซใขใใใญใผใใใพใ
+6. `fit()` ใกใฝใใใไฝฟ็จใใฆใใฌใผใใณใฐใๅฎ่กใใพใใ
+
+ใพใใใใคใใผใใฉใกใผใฟใผใใชใใใฃใใคใถใผใๅญฆ็ฟ็ในใฑใธใฅใผใซใๅฎ็พฉใใพใใ
+
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 2
+>>> num_epochs = 50
+>>> num_train_steps = len(train_ds) * num_epochs
+>>> learning_rate = 6e-5
+>>> weight_decay_rate = 0.01
+
+>>> optimizer, lr_schedule = create_optimizer(
+... init_lr=learning_rate,
+... num_train_steps=num_train_steps,
+... weight_decay_rate=weight_decay_rate,
+... num_warmup_steps=0,
+... )
+```
+
+ๆฌกใซใใฉใใซ ใใใใณใฐใจใจใใซ [`TFAutoModelForSemanticSegmentation`] ใไฝฟ็จใใฆ SegFormer ใใญใผใใใใใใใณใณใใคใซใใพใใ
+ใชใใใฃใใคใถใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> from transformers import TFAutoModelForSemanticSegmentation
+
+>>> model = TFAutoModelForSemanticSegmentation.from_pretrained(
+... checkpoint,
+... id2label=id2label,
+... label2id=label2id,
+... )
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+[`~datasets.Dataset.to_tf_dataset`] ใจ [`DefaultDataCollatโโor`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator(return_tensors="tf")
+
+>>> tf_train_dataset = train_ds.to_tf_dataset(
+... columns=["pixel_values", "label"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+
+>>> tf_eval_dataset = test_ds.to_tf_dataset(
+... columns=["pixel_values", "label"],
+... shuffle=True,
+... batch_size=batch_size,
+... collate_fn=data_collator,
+... )
+```
+
+ไบๆธฌใใ็ฒพๅบฆใ่จ็ฎใใใขใใซใ ๐ค ใใใซใใใทใฅใใใซใฏใ[Keras callbacks](../main_classes/keras_callbacks) ใไฝฟ็จใใพใใ
+`compute_metrics` ้ขๆฐใ [`KerasMetricCallback`] ใซๆธกใใพใใ
+ใใใฆ [`PushToHubCallback`] ใไฝฟ็จใใฆใขใใซใใขใใใญใผใใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback, PushToHubCallback
+
+>>> metric_callback = KerasMetricCallback(
+... metric_fn=compute_metrics, eval_dataset=tf_eval_dataset, batch_size=batch_size, label_cols=["labels"]
+... )
+
+>>> push_to_hub_callback = PushToHubCallback(output_dir="scene_segmentation", image_processor=image_processor)
+
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+ใคใใซใใขใใซใใใฌใผใใณใฐใใๆบๅใๆดใใพใใใ`fit()`ใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใ
+ใขใใซใๅพฎ่ชฟๆดใใใใใฎใณใผใซใใใฏ:
+
+```py
+>>> model.fit(
+... tf_train_dataset,
+... validation_data=tf_eval_dataset,
+... callbacks=callbacks,
+... epochs=num_epochs,
+... )
+```
+
+ใใใงใจใ๏ผใขใใซใๅพฎ่ชฟๆดใใ๐ค Hub ใงๅ
ฑๆใใพใใใใใใงๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๆจ่ซใฎใใใซ็ปๅใใญใผใใใพใใ
+
+```py
+>>> image = ds[0]["image"]
+>>> image
+```
+
+
+
+
+
+
+
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ็ปๅใปใฐใกใณใใผใทใงใณ็จใฎ `pipeline` ใใคใณในใฟใณในๅใใใใใซ็ปๅใๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> segmenter = pipeline("image-segmentation", model="my_awesome_seg_model")
+>>> segmenter(image)
+[{'score': None,
+ 'label': 'wall',
+ 'mask': },
+ {'score': None,
+ 'label': 'sky',
+ 'mask': },
+ {'score': None,
+ 'label': 'floor',
+ 'mask': },
+ {'score': None,
+ 'label': 'ceiling',
+ 'mask': },
+ {'score': None,
+ 'label': 'bed ',
+ 'mask': },
+ {'score': None,
+ 'label': 'windowpane',
+ 'mask': },
+ {'score': None,
+ 'label': 'cabinet',
+ 'mask': },
+ {'score': None,
+ 'label': 'chair',
+ 'mask': },
+ {'score': None,
+ 'label': 'armchair',
+ 'mask': }]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline` ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ็ปๅใใญใปใใตใง็ปๅใๅฆ็ใใ`pixel_values`ใ GPU ใซ้
็ฝฎใใพใใ
+
+```py
+>>> device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # use GPU if available, otherwise use a CPU
+>>> encoding = image_processor(image, return_tensors="pt")
+>>> pixel_values = encoding.pixel_values.to(device)
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใใlogitsใใ่ฟใใพใใ
+
+```py
+>>> outputs = model(pixel_values=pixel_values)
+>>> logits = outputs.logits.cpu()
+```
+
+ๆฌกใซใใญใธใใใๅ
ใฎ็ปๅใตใคใบใซๅในใฑใผใซใใพใใ
+
+
+```py
+>>> upsampled_logits = nn.functional.interpolate(
+... logits,
+... size=image.size[::-1],
+... mode="bilinear",
+... align_corners=False,
+... )
+
+>>> pred_seg = upsampled_logits.argmax(dim=1)[0]
+```
+
+
+
+
+
+
+
+็ปๅใใญใปใใตใใญใผใใใฆ็ปๅใๅๅฆ็ใใๅ
ฅๅใ TensorFlow ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("MariaK/scene_segmentation")
+>>> inputs = image_processor(image, return_tensors="tf")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForSemanticSegmentation
+
+>>> model = TFAutoModelForSemanticSegmentation.from_pretrained("MariaK/scene_segmentation")
+>>> logits = model(**inputs).logits
+```
+
+ๆฌกใซใใญใธใใใๅ
ใฎ็ปๅใตใคใบใซๅในใฑใผใซใใใฏใฉในๆฌกๅ
ใซ argmax ใ้ฉ็จใใพใใ
+
+```py
+>>> logits = tf.transpose(logits, [0, 2, 3, 1])
+
+>>> upsampled_logits = tf.image.resize(
+... logits,
+... # We reverse the shape of `image` because `image.size` returns width and height.
+... image.size[::-1],
+... )
+
+>>> pred_seg = tf.math.argmax(upsampled_logits, axis=-1)[0]
+```
+
+
+
+
+็ตๆใ่ฆ่ฆๅใใใซใฏใ[ใใผใฟใปใใ ใซใฉใผ ใใฌใใ](https://github.com/tensorflow/models/blob/3f1ca33afe3c1631b733ea7e40c294273b9e406d/research/deeplab/utils/get_dataset_colormap.py#L51) ใใใใใใใใใใใใ `ade_palette()` ใจใใฆใญใผใใใพใใใฏใฉในใ RGB ๅคใซๅคๆใใพใใๆฌกใซใ็ปๅใจไบๆธฌใใใใปใฐใกใณใใผใทใงใณ ใใใใ็ตใฟๅใใใฆใใญใใใงใใพใใ
+
+```py
+>>> import matplotlib.pyplot as plt
+>>> import numpy as np
+
+>>> color_seg = np.zeros((pred_seg.shape[0], pred_seg.shape[1], 3), dtype=np.uint8)
+>>> palette = np.array(ade_palette())
+>>> for label, color in enumerate(palette):
+... color_seg[pred_seg == label, :] = color
+>>> color_seg = color_seg[..., ::-1] # convert to BGR
+
+>>> img = np.array(image) * 0.5 + color_seg * 0.5 # plot the image with the segmentation map
+>>> img = img.astype(np.uint8)
+
+>>> plt.figure(figsize=(15, 10))
+>>> plt.imshow(img)
+>>> plt.show()
+```
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/summarization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/summarization.md
new file mode 100644
index 0000000000000000000000000000000000000000..6784696e6c95a3bdc3abe661236ad540b3304bfc
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/summarization.md
@@ -0,0 +1,404 @@
+
+
+# Summarization
+
+[[open-in-colab]]
+
+
+
+่ฆ็ดใซใใใใในใฆใฎ้่ฆใชๆ
ๅ ฑใใพใจใใ็ญใใใผใธใงใณใฎๆๆธใพใใฏ่จไบใไฝๆใใใพใใใใใฏใ็ฟป่จณใจไธฆใใงใใทใผใฑใณใน้ใฎใฟในใฏใจใใฆๅฎๅผๅใงใใใฟในใฏใฎใใ 1 ใคใฎไพใงใใ่ฆ็ดใฏๆฌกใฎใใใซใชใใพใใ
+
+- ๆฝๅบ: ๆๆธใใๆใ้ข้ฃๆงใฎ้ซใๆ
ๅ ฑใๆฝๅบใใพใใ
+- ๆฝ่ฑก็: ๆใ้ข้ฃๆงใฎ้ซใๆ
ๅ ฑใๆใใๆฐใใใใญในใใ็ๆใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. ๆฝ่ฑก็ใช่ฆ็ดใฎใใใซใ[BillSum](https://huggingface.co/datasets/billsum) ใใผใฟใปใใใฎใซใชใใฉใซใใขๅท่ซๆฑๆธใตใใปใใใง [T5](https://huggingface.co/google-t5/t5-small) ใๅพฎ่ชฟๆดใใพใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/summarization) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate rouge_score
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load BillSum dataset
+
+ใพใใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ BillSum ใใผใฟใปใใใฎๅฐใใใซใชใใฉใซใใขๅท่ซๆฑๆธใตใใปใใใ่ชญใฟ่พผใฟใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> billsum = load_dataset("billsum", split="ca_test")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+```py
+>>> billsum = billsum.train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> billsum["train"][0]
+{'summary': 'Existing law authorizes state agencies to enter into contracts for the acquisition of goods or services upon approval by the Department of General Services. Existing law sets forth various requirements and prohibitions for those contracts, including, but not limited to, a prohibition on entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between spouses and domestic partners or same-sex and different-sex couples in the provision of benefits. Existing law provides that a contract entered into in violation of those requirements and prohibitions is void and authorizes the state or any person acting on behalf of the state to bring a civil action seeking a determination that a contract is in violation and therefore void. Under existing law, a willful violation of those requirements and prohibitions is a misdemeanor.\nThis bill would also prohibit a state agency from entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between employees on the basis of gender identity in the provision of benefits, as specified. By expanding the scope of a crime, this bill would impose a state-mandated local program.\nThe California Constitution requires the state to reimburse local agencies and school districts for certain costs mandated by the state. Statutory provisions establish procedures for making that reimbursement.\nThis bill would provide that no reimbursement is required by this act for a specified reason.',
+ 'text': 'The people of the State of California do enact as follows:\n\n\nSECTION 1.\nSection 10295.35 is added to the Public Contract Code, to read:\n10295.35.\n(a) (1) Notwithstanding any other law, a state agency shall not enter into any contract for the acquisition of goods or services in the amount of one hundred thousand dollars ($100,000) or more with a contractor that, in the provision of benefits, discriminates between employees on the basis of an employeeโs or dependentโs actual or perceived gender identity, including, but not limited to, the employeeโs or dependentโs identification as transgender.\n(2) For purposes of this section, โcontractโ includes contracts with a cumulative amount of one hundred thousand dollars ($100,000) or more per contractor in each fiscal year.\n(3) For purposes of this section, an employee health plan is discriminatory if the plan is not consistent with Section 1365.5 of the Health and Safety Code and Section 10140 of the Insurance Code.\n(4) The requirements of this section shall apply only to those portions of a contractorโs operations that occur under any of the following conditions:\n(A) Within the state.\n(B) On real property outside the state if the property is owned by the state or if the state has a right to occupy the property, and if the contractorโs presence at that location is connected to a contract with the state.\n(C) Elsewhere in the United States where work related to a state contract is being performed.\n(b) Contractors shall treat as confidential, to the maximum extent allowed by law or by the requirement of the contractorโs insurance provider, any request by an employee or applicant for employment benefits or any documentation of eligibility for benefits submitted by an employee or applicant for employment.\n(c) After taking all reasonable measures to find a contractor that complies with this section, as determined by the state agency, the requirements of this section may be waived under any of the following circumstances:\n(1) There is only one prospective contractor willing to enter into a specific contract with the state agency.\n(2) The contract is necessary to respond to an emergency, as determined by the state agency, that endangers the public health, welfare, or safety, or the contract is necessary for the provision of essential services, and no entity that complies with the requirements of this section capable of responding to the emergency is immediately available.\n(3) The requirements of this section violate, or are inconsistent with, the terms or conditions of a grant, subvention, or agreement, if the agency has made a good faith attempt to change the terms or conditions of any grant, subvention, or agreement to authorize application of this section.\n(4) The contractor is providing wholesale or bulk water, power, or natural gas, the conveyance or transmission of the same, or ancillary services, as required for ensuring reliable services in accordance with good utility practice, if the purchase of the same cannot practically be accomplished through the standard competitive bidding procedures and the contractor is not providing direct retail services to end users.\n(d) (1) A contractor shall not be deemed to discriminate in the provision of benefits if the contractor, in providing the benefits, pays the actual costs incurred in obtaining the benefit.\n(2) If a contractor is unable to provide a certain benefit, despite taking reasonable measures to do so, the contractor shall not be deemed to discriminate in the provision of benefits.\n(e) (1) Every contract subject to this chapter shall contain a statement by which the contractor certifies that the contractor is in compliance with this section.\n(2) The department or other contracting agency shall enforce this section pursuant to its existing enforcement powers.\n(3) (A) If a contractor falsely certifies that it is in compliance with this section, the contract with that contractor shall be subject to Article 9 (commencing with Section 10420), unless, within a time period specified by the department or other contracting agency, the contractor provides to the department or agency proof that it has complied, or is in the process of complying, with this section.\n(B) The application of the remedies or penalties contained in Article 9 (commencing with Section 10420) to a contract subject to this chapter shall not preclude the application of any existing remedies otherwise available to the department or other contracting agency under its existing enforcement powers.\n(f) Nothing in this section is intended to regulate the contracting practices of any local jurisdiction.\n(g) This section shall be construed so as not to conflict with applicable federal laws, rules, or regulations. In the event that a court or agency of competent jurisdiction holds that federal law, rule, or regulation invalidates any clause, sentence, paragraph, or section of this code or the application thereof to any person or circumstances, it is the intent of the state that the court or agency sever that clause, sentence, paragraph, or section so that the remainder of this section shall remain in effect.\nSEC. 2.\nSection 10295.35 of the Public Contract Code shall not be construed to create any new enforcement authority or responsibility in the Department of General Services or any other contracting agency.\nSEC. 3.\nNo reimbursement is required by this act pursuant to Section 6 of Article XIII\u2009B of the California Constitution because the only costs that may be incurred by a local agency or school district will be incurred because this act creates a new crime or infraction, eliminates a crime or infraction, or changes the penalty for a crime or infraction, within the meaning of Section 17556 of the Government Code, or changes the definition of a crime within the meaning of Section 6 of Article XIII\u2009B of the California Constitution.',
+ 'title': 'An act to add Section 10295.35 to the Public Contract Code, relating to public contracts.'}
+```
+
+ไฝฟ็จใใใใฃใผใซใใ 2 ใคใใใพใใ
+
+- `text`: ใขใใซใธใฎๅ
ฅๅใจใชใ่ซๆฑๆธใฎใใญในใใ
+- `summary`: ใขใใซใฎใฟใผใฒใใใจใชใ `text` ใฎ่ฆ็ด็ใ
+
+## Preprocess
+
+ๆฌกใฎในใใใใงใฏใT5 ใใผใฏใใคใถใผใใญใผใใใฆใtextใใจ`summary`ใๅฆ็ใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> checkpoint = "google-t5/t5-small"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+```
+
+ไฝๆใใๅๅฆ็้ขๆฐใฏๆฌกใฎใใจใ่กใๅฟ
่ฆใใใใพใใ
+
+1. T5 ใใใใ่ฆ็ดใฟในใฏใงใใใใจใ่ช่ญใงใใใใใซใๅ
ฅๅใฎๅใซใใญใณใโโใใไปใใพใใ่คๆฐใฎ NLP ใฟในใฏใๅฏ่ฝใชไธ้จใฎใขใใซใงใฏใ็นๅฎใฎใฟในใฏใฎใใญใณใใใๅฟ
่ฆใงใใ
+2. ใฉใใซใใใผใฏใณๅใใใจใใซใญใผใฏใผใ `text_target` ๅผๆฐใไฝฟ็จใใพใใ
+3. `max_length`ใใฉใกใผใฟใง่จญๅฎใใใๆๅคง้ทใ่ถ
ใใชใใใใซใทใผใฑใณในใๅใ่ฉฐใใพใใ
+
+```py
+>>> prefix = "summarize: "
+
+
+>>> def preprocess_function(examples):
+... inputs = [prefix + doc for doc in examples["text"]]
+... model_inputs = tokenizer(inputs, max_length=1024, truncation=True)
+
+... labels = tokenizer(text_target=examples["summary"], max_length=128, truncation=True)
+
+... model_inputs["labels"] = labels["input_ids"]
+... return model_inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ใกใฝใใใไฝฟ็จใใพใใ `batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใใใจใงใ`map` ้ขๆฐใ้ซ้ๅใงใใพใใ
+
+```py
+>>> tokenized_billsum = billsum.map(preprocess_function, batched=True)
+```
+
+ๆฌกใซใ[`DataCollatโโorForSeq2Seq`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใใใผใฟใปใใๅ
จไฝใๆๅคง้ทใพใงใใใฃใณใฐใใใฎใงใฏใชใใ็
งๅไธญใซใใใๅ
ใฎๆ้ทใฎ้ทใใพใงๆใ *ๅ็ใซใใใฃใณใฐ* ใใๆนใๅน็็ใงใใ
+
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)
+```
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[ROUGE](https://huggingface.co/spaces/evaluate-metric/rouge) ใกใใชใใฏใ่ชญใฟ่พผใฟใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใ ใใ) ) ใกใใชใฏในใใญใผใใใฆ่จ็ฎใใๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใๆฌกใๅ็
งใใฆใใ ใใ)ใ
+
+```py
+>>> import evaluate
+
+>>> rouge = evaluate.load("rouge")
+```
+
+ๆฌกใซใไบๆธฌใจใฉใใซใ [`~evaluate.EvaluationModule.compute`] ใซๆธกใใฆ ROUGE ใกใใชใฏในใ่จ็ฎใใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> import numpy as np
+
+
+>>> def compute_metrics(eval_pred):
+... predictions, labels = eval_pred
+... decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
+... labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
+... decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
+
+... result = rouge.compute(predictions=decoded_preds, references=decoded_labels, use_stemmer=True)
+
+... prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in predictions]
+... result["gen_len"] = np.mean(prediction_lens)
+
+... return {k: round(v, 4) for k, v in result.items()}
+```
+
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForSeq2SeqLM`] ใไฝฟ็จใใฆ T5 ใใญใผใใใพใใ
+
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใๆ้ ใฏๆฌกใฎ 3 ใคใ ใใงใใ
+
+1. [`Seq2SeqTrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`Trainer`] ใฏ ROUGE ใกใใชใฏในใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Seq2SeqTrainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = Seq2SeqTrainingArguments(
+... output_dir="my_awesome_billsum_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... weight_decay=0.01,
+... save_total_limit=3,
+... num_train_epochs=4,
+... predict_with_generate=True,
+... fp16=True,
+... push_to_hub=True,
+... )
+
+>>> trainer = Seq2SeqTrainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_billsum["train"],
+... eval_dataset=tokenized_billsum["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-a-tensorflow-model-with-keras) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใใชใใใฃใใคใถใผ้ขๆฐใๅญฆ็ฟ็ในใฑใธใฅใผใซใใใใณใใใคใใฎใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใผใใปใใใขใใใใใใจใใๅงใใพใใ
+
+```py
+>>> from transformers import create_optimizer, AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+ๆฌกใซใ[`TFAutoModelForSeq2SeqLM`] ใไฝฟ็จใใฆ T5 ใใญใผใใงใใพใใ
+
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+[`~transformers.TFPreTrainedModel.prepare_tf_dataset`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_billsum["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... tokenized_billsum["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใฎใขใใซใ่จญๅฎใใพใใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+ใใฌใผใใณใฐใ้ๅงใใๅใซใปใใใขใใใใๆๅพใฎ 2 ใคใฎใใจใฏใไบๆธฌใใ ROUGE ในใณใขใ่จ็ฎใใใขใใซใใใใซใใใทใฅใใๆนๆณใๆไพใใใใจใงใใใฉใกใใ [Keras ใณใผใซใใใฏ](../main_classes/keras_callbacks) ใไฝฟ็จใใฆ่กใใใพใใ
+
+`compute_metrics` ้ขๆฐใ [`~transformers.KerasMetricCallback`] ใซๆธกใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)
+```
+
+Specify where to push your model and tokenizer in the [`~transformers.PushToHubCallback`]:
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_billsum_model",
+... tokenizer=tokenizer,
+... )
+```
+
+ๆฌกใซใใณใผใซใใใฏใใพใจใใฆใใณใใซใใพใใ
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+ใคใใซใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใใณใผใซใใใฏใๆๅฎใใฆ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใๅผใณๅบใใใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=callbacks)
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใจใใขใใซใฏ่ชๅ็ใซใใใซใขใใใญใผใใใใ่ชฐใงใไฝฟ็จใงใใใใใซใชใใพใใ
+
+
+
+
+
+
+่ฆ็ด็จใซใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎใใ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใใปใฏใทใงใณใๅ็
งใใฆใใ ใใใ
+[PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb)
+ใพใใฏ [TensorFlow ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb)ใ
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+่ฆ็ดใใใใใญในใใ่ใๅบใใพใใ T5 ใฎๅ ดๅใไฝๆฅญไธญใฎใฟในใฏใซๅฟใใฆๅ
ฅๅใซๆฅ้ ญ่พใไปใใๅฟ
่ฆใใใใพใใ่ฆ็ดใใใซใฏใไปฅไธใซ็คบใใใใซๅ
ฅๅใซใใฌใใฃใใฏในใไปใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> text = "summarize: The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It's the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country. It'll lower the deficit and ask the ultra-wealthy and corporations to pay their fair share. And no one making under $400,000 per year will pay a penny more in taxes."
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ่ฆ็ด็จใฎ `pipeline` ใใคใณในใฟใณในๅใใใใญในใใใใใซๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> summarizer = pipeline("summarization", model="stevhliu/my_awesome_billsum_model")
+>>> summarizer(text)
+[{"summary_text": "The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It's the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country."}]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline`ใใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+
+
+Tokenize the text and return the `input_ids` as PyTorch tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_billsum_model")
+>>> inputs = tokenizer(text, return_tensors="pt").input_ids
+```
+
+[`~generation.GenerationMixin.generate`] ใกใฝใใใไฝฟ็จใใฆ่ฆ็ดใไฝๆใใพใใใใพใใพใชใใญในใ็ๆๆฆ็ฅใจ็ๆใๅถๅพกใใใใใฎใใฉใกใผใฟใผใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Text Generation](../main_classes/text_generation) API ใ็ขบ่ชใใฆใใ ใใใ
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("stevhliu/my_awesome_billsum_model")
+>>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)
+```
+
+็ๆใใใใใผใฏใณ ID ใใใณใผใใใฆใใญในใใซๆปใใพใใ
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it's the most aggressive action on tackling the climate crisis in american history. it will ask the ultra-wealthy and corporations to pay their fair share.'
+```
+
+
+
+ใใญในใใใใผใฏใณๅใใ`input_ids`ใ TensorFlow ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_billsum_model")
+>>> inputs = tokenizer(text, return_tensors="tf").input_ids
+```
+
+[`~transformers.generation_tf_utils.TFGenerationMixin.generate`] ใกใฝใใใไฝฟ็จใใฆ่ฆ็ดใไฝๆใใพใใใใพใใพใชใใญในใ็ๆๆฆ็ฅใจ็ๆใๅถๅพกใใใใใฎใใฉใกใผใฟใผใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Text Generation](../main_classes/text_generation) API ใ็ขบ่ชใใฆใใ ใใใ
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("stevhliu/my_awesome_billsum_model")
+>>> outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)
+```
+
+็ๆใใใใใผใฏใณ ID ใใใณใผใใใฆใใญในใใซๆปใใพใใ
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it's the most aggressive action on tackling the climate crisis in american history. it will ask the ultra-wealthy and corporations to pay their fair share.'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/text-to-speech.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/text-to-speech.md
new file mode 100644
index 0000000000000000000000000000000000000000..669d15730e24f892e27103a9ad48733b5e7fb34d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/text-to-speech.md
@@ -0,0 +1,638 @@
+
+
+# Text to speech
+
+[[open-in-colab]]
+
+ใใญในใ่ชญใฟไธใ (TTS) ใฏใใใญในใใใ่ช็ถใช้ณๅฃฐใไฝๆใใใฟในใฏใงใใ้ณๅฃฐใฏ่คๆฐใฎๅฝขๅผใง็ๆใงใใพใใ
+่จ่ชใจ่คๆฐใฎ่ฉฑ่
ๅใใ็พๅจใใใใคใใฎใใญในใ่ชญใฟไธใใขใใซใ ๐ค Transformers ใงๅฉ็จๅฏ่ฝใงใใ
+[Bark](../model_doc/bark)ใ[MMS](../model_doc/mms)ใ[VITS](../model_doc/vits)ใใใใณ [SpeechT5](../model_doc/speecht5)ใ
+
+`text-to-audio`ใใคใใฉใคใณ (ใพใใฏใใฎๅฅๅ - `text-to-speech`) ใไฝฟ็จใใฆใ้ณๅฃฐใ็ฐกๅใซ็ๆใงใใพใใ Bark ใชใฉใฎไธ้จใฎใขใใซใฏใ
+็ฌใใใใๆฏใๆณฃใใชใฉใฎ้่จ่ชใณใใฅใใฑใผใทใงใณใ็ๆใใใใ้ณๆฅฝใ่ฟฝๅ ใใใใใใใใซๆกไปถไปใใใใใจใใงใใพใใ
+Bark ใง`text-to-speech`ใใคใใฉใคใณใไฝฟ็จใใๆนๆณใฎไพใๆฌกใซ็คบใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> pipe = pipeline("text-to-speech", model="suno/bark-small")
+>>> text = "[clears throat] This is a test ... and I just took a long pause."
+>>> output = pipe(text)
+```
+
+ใใผใใใใฏใง็ตๆใฎ้ณๅฃฐใ่ใใใใซไฝฟ็จใงใใใณใผใ ในใใใใใๆฌกใซ็คบใใพใใ
+
+```python
+>>> from IPython.display import Audio
+>>> Audio(output["audio"], rate=output["sampling_rate"])
+```
+Bark ใใใณใใฎไปใฎไบๅใใฌใผใใณใฐใใใ TTS ใขใใซใใงใใใใจใฎ่ฉณ็ดฐใชไพใซใคใใฆใฏใๆฌกใฎใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+[้ณๅฃฐใณใผใน](https://huggingface.co/learn/audio-course/chapter6/pre-trained_models)ใ
+
+TTS ใขใใซใๅพฎ่ชฟๆดใใๅ ดๅใ็พๅจๅพฎ่ชฟๆดใงใใใฎใฏ SpeechT5 ใฎใฟใงใใ SpeechT5 ใฏใๆฌกใฎ็ตใฟๅใใใงไบๅใใฌใผใใณใฐใใใฆใใพใใ
+้ณๅฃฐใใใใญในใใธใฎใใผใฟใจใใญในใใใ้ณๅฃฐใธใฎใใผใฟใไธกๆนใฎใใญในใใซๅ
ฑๆใใใ้ ใใใ่กจ็พใฎ็ตฑไธใใใ็ฉบ้ใๅญฆ็ฟใงใใใใใซใใพใใ
+ใใใฆในใใผใใใใใฏใๅใไบๅใใฌใผใใณใฐๆธใฟใขใใซใใใพใใพใชใฟในใฏใซๅใใใฆๅพฎ่ชฟๆดใงใใใใจใๆๅณใใพใใใใใซใSpeechT5
+X ใใฏใใซ ในใใผใซใผใฎๅใ่พผใฟใ้ใใฆ่คๆฐใฎในใใผใซใผใใตใใผใใใพใใ
+
+ใใฎใฌใคใใฎๆฎใใฎ้จๅใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [VoxPopuli](https://huggingface.co/datasets/facebook/voxpopuli) ใฎใชใฉใณใ่ช (`nl`) ่จ่ชใตใใปใใไธใฎ่ฑ่ช้ณๅฃฐใงๅ
ใ
ใใฌใผใใณใฐใใใ [SpeechT5](../model_doc/speecht5) ใๅพฎ่ชฟๆดใใพใใ ใใผใฟใปใใใ
+2. ใใคใใฉใคใณใไฝฟ็จใใใ็ดๆฅไฝฟ็จใใใใฎ 2 ใคใฎๆนๆณใฎใใใใใงใๆด็ทดใใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+
+```bash
+pip install datasets soundfile speechbrain accelerate
+```
+
+SpeechT5 ใฎใในใฆใฎๆฉ่ฝใใพใ ๆญฃๅผใชใชใผในใซใใผใธใใใฆใใชใใใใใฝใผในใใ ๐คTransformers ใใคใณในใใผใซใใพใใ
+
+```bash
+pip install git+https://github.com/huggingface/transformers.git
+```
+
+
+
+ใใฎใฌใคใใซๅพใใซใฏใGPU ใๅฟ
่ฆใงใใใใผใใใใฏใงไฝๆฅญใใฆใใๅ ดๅใฏใๆฌกใฎ่กใๅฎ่กใใฆ GPU ใๅฉ็จๅฏ่ฝใใฉใใใ็ขบ่ชใใพใใ
+
+```bash
+!nvidia-smi
+```
+
+
+
+Hugging Face ใขใซใฆใณใใซใญใฐใคใณใใฆใใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load the dataset
+
+[VoxPopuli](https://huggingface.co/datasets/facebook/voxpopuli) ใฏใไปฅไธใงๆงๆใใใๅคง่ฆๆจกใชๅค่จ่ช้ณๅฃฐใณใผใในใงใใ
+ใใผใฟใฏ 2009 ๅนดใใ 2020 ๅนดใฎๆฌงๅท่ญฐไผใฎใคใใณใ่จ้ฒใใฝใผในใจใใฆใใพใใ 15 ไปถๅใฎใฉใใซไปใ้ณๅฃฐๆๅญ่ตทใใใใผใฟใๅซใพใใฆใใพใใ
+ใจใผใญใใใฎ่จ่ชใใใฎใฌใคใใงใฏใชใฉใณใ่ชใฎใตใใปใใใไฝฟ็จใใฆใใพใใใ่ช็ฑใซๅฅใฎใตใใปใใใ้ธๆใใฆใใ ใใใ
+
+VoxPopuli ใพใใฏใใฎไปใฎ่ชๅ้ณๅฃฐ่ช่ญ (ASR) ใใผใฟใปใใใฏๆ้ฉใงใฏใชใๅฏ่ฝๆงใใใใใจใซๆณจๆใใฆใใ ใใใ
+TTS ใขใใซใใใฌใผใใณใฐใใใใใฎใชใใทใงใณใ้ๅฐใชใใใฏใฐใฉใฆใณใใใคใบใชใฉใASR ใซใจใฃใฆๆ็ใจใชใๆฉ่ฝใฏๆฌกใฎใจใใใงใใ
+้ๅธธใTTS ใงใฏๆใพใใใใใพใใใใใ ใใๆ้ซๅ่ณชใๅค่จ่ชใใใซใในใใผใซใผใฎ TTS ใใผใฟใปใใใ่ฆใคใใใฎใฏ้ๅธธใซๅฐ้ฃใชๅ ดๅใใใใพใใ
+ๆๆฆ็ใ
+
+ใใผใฟใใญใผใใใพใใใ:
+
+```py
+>>> from datasets import load_dataset, Audio
+
+>>> dataset = load_dataset("facebook/voxpopuli", "nl", split="train")
+>>> len(dataset)
+20968
+```
+
+ๅพฎ่ชฟๆดใซใฏ 20968 ๅใฎไพใงๅๅใงใใ SpeechT5 ใฏใชใผใใฃใช ใใผใฟใฎใตใณใใชใณใฐ ใฌใผใใ 16 kHz ใงใใใใจใๆณๅฎใใฆใใใใใ
+ใใผใฟใปใใๅ
ใฎไพใใใฎ่ฆไปถใๆบใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+
+```py
+dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
+```
+
+## Preprocess the data
+
+ไฝฟ็จใใใขใใซ ใใงใใฏใใคใณใใๅฎ็พฉใใ้ฉๅใชใใญใปใใตใใญใผใใใใใจใใๅงใใพใใใใ
+
+
+```py
+>>> from transformers import SpeechT5Processor
+
+>>> checkpoint = "microsoft/speecht5_tts"
+>>> processor = SpeechT5Processor.from_pretrained(checkpoint)
+```
+
+### Text cleanup for SpeechT5 tokenization
+
+
+ใพใใฏใใญในใใใผใฟใใฏใชใผใณใขใใใใใใจใใๅงใใพใใใใญในใใๅฆ็ใใใซใฏใใใญใปใใตใฎใใผใฏใใคใถใผ้จๅใๅฟ
่ฆใงใใ
+
+```py
+>>> tokenizer = processor.tokenizer
+```
+
+ใใผใฟใปใใใฎไพใซใฏใ`raw_text`ๆฉ่ฝใจ `normalized_text`ๆฉ่ฝใๅซใพใใฆใใพใใใใญในใๅ
ฅๅใจใใฆใฉใฎๆฉ่ฝใไฝฟ็จใใใใๆฑบใใใจใใฏใ
+SpeechT5 ใใผใฏใใคใถใผใซใฏๆฐๅคใฎใใผใฏใณใใชใใใจใ่ๆ
ฎใใฆใใ ใใใ `normalized_text`ใซใฏๆฐๅญใๆธใใใฆใใพใ
+ใใญในใใจใใฆๅบๅใใพใใใใใใฃใฆใใใใฏใใ้ฉๅใงใใใๅ
ฅๅใใญในใใจใใฆ `normalized_text` ใไฝฟ็จใใใใจใใๅงใใใพใใ
+
+SpeechT5 ใฏ่ฑ่ชใงใใฌใผใใณใฐใใใฆใใใใใใชใฉใณใ่ชใฎใใผใฟใปใใๅ
ใฎ็นๅฎใฎๆๅญใ่ช่ญใใชใๅฏ่ฝๆงใใใใพใใใใ
+ๆฎใฃใฆใใใใใซใใใใใฎๆๅญใฏ ``ใใผใฏใณใซๅคๆใใใพใใใใ ใใใชใฉใณใ่ชใงใฏใ`ร `ใชใฉใฎ็นๅฎใฎๆๅญใฏ
+้ณ็ฏใๅผท่ชฟใใใใจใซๆ
ฃใใฆใใพใใใใญในใใฎๆๅณใไฟๆใใใใใซใใใฎๆๅญใ้ๅธธใฎ`a`ใซ็ฝฎใๆใใใใจใใงใใพใใ
+
+ใตใใผใใใใฆใใชใใใผใฏใณใ่ญๅฅใใใซใฏใ`SpeechT5Tokenizer`ใไฝฟ็จใใฆใใผใฟใปใใๅ
ใฎใในใฆใฎไธๆใฎๆๅญใๆฝๅบใใพใใ
+ๆๅญใใใผใฏใณใจใใฆๆฑใใพใใใใใ่กใใซใฏใไปฅไธใ้ฃ็ตใใ `extract_all_chars` ใใใใณใฐ้ขๆฐใไฝๆใใพใใ
+ใในใฆใฎไพใใใฎ่ปขๅใ 1 ใคใฎๆๅญๅใซใพใจใใใใใๆๅญใปใใใซๅคๆใใพใใ
+ใในใฆใฎๆๅญ่ตทใใใไธๅบฆใซๅฉ็จใงใใใใใซใ`dataset.map()`ใง`bโโatched=True`ใจ`batch_size=-1`ใๅฟ
ใ่จญๅฎใใฆใใ ใใใ
+ใใใใณใฐๆฉ่ฝใ
+
+```py
+>>> def extract_all_chars(batch):
+... all_text = " ".join(batch["normalized_text"])
+... vocab = list(set(all_text))
+... return {"vocab": [vocab], "all_text": [all_text]}
+
+
+>>> vocabs = dataset.map(
+... extract_all_chars,
+... batched=True,
+... batch_size=-1,
+... keep_in_memory=True,
+... remove_columns=dataset.column_names,
+... )
+
+>>> dataset_vocab = set(vocabs["vocab"][0])
+>>> tokenizer_vocab = {k for k, _ in tokenizer.get_vocab().items()}
+```
+
+ใใใงใ2 ใคใฎๆๅญใปใใใใงใใพใใใ1 ใคใฏใใผใฟใปใใใฎ่ชๅฝใๆใกใใใ 1 ใคใฏใใผใฏใใคใถใผใฎ่ชๅฝใๆใกใพใใ
+ใใผใฟใปใใๅ
ใงใตใใผใใใใฆใใชใๆๅญใ็นๅฎใใใซใฏใใใใ 2 ใคใฎใปใใใฎๅทฎๅใๅใใใจใใงใใพใใ็ตๆใจใใฆ
+set ใซใฏใใใผใฟใปใใใซใฏใใใใใผใฏใใคใถใผใซใฏๅซใพใใฆใใชใๆๅญใๅซใพใใพใใ
+
+```py
+>>> dataset_vocab - tokenizer_vocab
+{' ', 'ร ', 'รง', 'รจ', 'รซ', 'รญ', 'รฏ', 'รถ', 'รผ'}
+```
+
+ๅใฎๆ้ ใง็นๅฎใใใใตใใผใใใใฆใใชใๆๅญใๅฆ็ใใใซใฏใใใใใฎๆๅญใ
+ๆๅนใชใใผใฏใณใในใใผในใฏใใผใฏใใคใถใผใงใใงใซ `โ` ใซ็ฝฎใๆใใใใฆใใใใใๅๅฅใซๅฆ็ใใๅฟ
่ฆใใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> replacements = [
+... ("ร ", "a"),
+... ("รง", "c"),
+... ("รจ", "e"),
+... ("รซ", "e"),
+... ("รญ", "i"),
+... ("รฏ", "i"),
+... ("รถ", "o"),
+... ("รผ", "u"),
+... ]
+
+
+>>> def cleanup_text(inputs):
+... for src, dst in replacements:
+... inputs["normalized_text"] = inputs["normalized_text"].replace(src, dst)
+... return inputs
+
+
+>>> dataset = dataset.map(cleanup_text)
+```
+
+ใใญในใๅ
ใฎ็นๆฎๆๅญใๆฑใฃใใฎใงใไปๅบฆใฏ้ณๅฃฐใใผใฟใซ็ฆ็นใ็งปใใพใใ
+
+### Speakers
+
+VoxPopuli ใใผใฟใปใใใซใฏ่คๆฐใฎ่ฉฑ่
ใฎ้ณๅฃฐใๅซใพใใฆใใพใใใใใผใฟใปใใใซใฏไฝไบบใฎ่ฉฑ่
ใๅซใพใใฆใใใฎใงใใใใ?ใซ
+ใใใๆฑบๅฎใใใจใไธๆใฎ่ฉฑ่
ใฎๆฐใจใๅ่ฉฑ่
ใใใผใฟใปใใใซๅฏไธใใไพใฎๆฐใๆฐใใใใจใใงใใพใใ
+ใใผใฟใปใใใซใฏๅ่จ 20,968 ๅใฎไพใๅซใพใใฆใใใใใฎๆ
ๅ ฑใซใใใๅๅธใใใๆทฑใ็่งฃใงใใใใใซใชใใพใใ
+่ฌๆผ่
ใจใใผใฟๅ
ใฎไพใ
+
+```py
+>>> from collections import defaultdict
+
+>>> speaker_counts = defaultdict(int)
+
+>>> for speaker_id in dataset["speaker_id"]:
+... speaker_counts[speaker_id] += 1
+```
+
+ใในใใฐใฉใ ใใใญใใใใใจใๅ่ฉฑ่
ใซใฉใใ ใใฎใใผใฟใใใใใๆๆกใงใใพใใ
+
+```py
+>>> import matplotlib.pyplot as plt
+
+>>> plt.figure()
+>>> plt.hist(speaker_counts.values(), bins=20)
+>>> plt.ylabel("Speakers")
+>>> plt.xlabel("Examples")
+>>> plt.show()
+```
+
+
+
+
+
+ใในใใฐใฉใ ใใใใใผใฟใปใใๅ
ใฎ่ฉฑ่
ใฎ็ด 3 ๅใฎ 1 ใฎไพใ 100 ๆชๆบใงใใใใจใใใใใพใใ
+็ด 10 ไบบใฎ่ฌๆผ่
ใ 500 ไปฅไธใฎไพใๆใฃใฆใใพใใใใฌใผใใณใฐๅน็ใๅไธใใใใใผใฟใปใใใฎใใฉใณในใใจใใใใซใๆฌกใฎใใจใๅถ้ใงใใพใใ
+100 ๏ฝ 400 ๅใฎไพใๅซใใใผใฟใ่ฌๆผ่
ใซๆไพใใพใใ
+
+```py
+>>> def select_speaker(speaker_id):
+... return 100 <= speaker_counts[speaker_id] <= 400
+
+
+>>> dataset = dataset.filter(select_speaker, input_columns=["speaker_id"])
+```
+
+ๆฎใใฎในใใผใซใผใฎๆฐใ็ขบ่ชใใฆใฟใพใใใใ
+
+```py
+>>> len(set(dataset["speaker_id"]))
+42
+```
+
+ๆฎใใฎไพใใใใคใใใ่ฆใฆใฟใพใใใใ
+
+
+```py
+>>> len(dataset)
+9973
+```
+
+็ด 40 ไบบใฎใฆใใผใฏใช่ฌๆผ่
ใใใฎ 10,000 ๅผฑใฎไพใๆฎใใพใใใใใใงๅๅใงใใ
+
+ไพใๅฐใชใในใใผใซใผใฎไธญใซใฏใไพใ้ทใๅ ดๅใๅฎ้ใซใฏใใๅคใใฎ้ณๅฃฐใๅฉ็จใงใใๅ ดๅใใใใใจใซๆณจๆใใฆใใ ใใใใใใใ
+ๅ่ฉฑ่
ใฎ้ณๅฃฐใฎๅ่จ้ใๆฑบๅฎใใใซใฏใใใผใฟใปใใๅ
จไฝใในใญใฃใณใใๅฟ
่ฆใใใใพใใ
+ๅใชใผใใฃใช ใใกใคใซใฎใญใผใใจใใณใผใใไผดใๆ้ใฎใใใใใญใปในใใใฎใใใใใใงใฏใใฎในใใใใในใญใใใใใใจใซใใพใใใ
+
+### Speaker embeddings
+
+TTS ใขใใซใ่คๆฐใฎในใใผใซใผใๅบๅฅใงใใใใใซใใใซใฏใใตใณใใซใใจใซในใใผใซใผใฎๅใ่พผใฟใไฝๆใใๅฟ
่ฆใใใใพใใ
+ในใใผใซใผใฎๅใ่พผใฟใฏใ็นๅฎใฎในใใผใซใผใฎ้ณๅฃฐ็นๆงใใญใฃใใใฃใใใขใใซใธใฎ่ฟฝๅ ๅ
ฅๅใงใใ
+ใใใใฎในใใผใซใผๅใ่พผใฟใ็ๆใใใซใฏใไบๅใใฌใผใใณใฐใใใ [spkrec-xvect-voxceleb](https://huggingface.co/speechbrain/spkrec-xvect-voxceleb) ใไฝฟ็จใใพใใ
+SpeechBrain ใฎใขใใซใ
+
+ๅ
ฅๅใชใผใใฃใชๆณขๅฝขใๅใๅใใ512 ่ฆ็ด ใฎใใฏใใซใๅบๅใใ้ขๆฐ `create_speaker_embedding()` ใไฝๆใใพใใ
+ๅฏพๅฟใใในใใผใซใผๅใ่พผใฟใๅซใพใใพใใ
+
+
+```py
+>>> import os
+>>> import torch
+>>> from speechbrain.pretrained import EncoderClassifier
+
+>>> spk_model_name = "speechbrain/spkrec-xvect-voxceleb"
+
+>>> device = "cuda" if torch.cuda.is_available() else "cpu"
+>>> speaker_model = EncoderClassifier.from_hparams(
+... source=spk_model_name,
+... run_opts={"device": device},
+... savedir=os.path.join("/tmp", spk_model_name),
+... )
+
+
+>>> def create_speaker_embedding(waveform):
+... with torch.no_grad():
+... speaker_embeddings = speaker_model.encode_batch(torch.tensor(waveform))
+... speaker_embeddings = torch.nn.functional.normalize(speaker_embeddings, dim=2)
+... speaker_embeddings = speaker_embeddings.squeeze().cpu().numpy()
+... return speaker_embeddings
+```
+
+`speechbrain/spkrec-xvect-voxceleb`ใขใใซใฏใVoxCeleb ใใใฎ่ฑ่ช้ณๅฃฐใงใใฌใผใใณใฐใใใใใจใซๆณจๆใใใใจใ้่ฆใงใใ
+ใใผใฟใปใใใงใใใใใฎใฌใคใใฎใใฌใผใใณใฐไพใฏใชใฉใณใ่ชใงใใใใฎใขใใซใฏไปๅพใ็ๆใใใใจไฟกใใฆใใพใใใ
+ใชใฉใณใ่ชใฎใใผใฟใปใใใซ้ฉๅใช่ฉฑ่
ๅใ่พผใฟใ่กใฃใฆใใใใฎไปฎๅฎใฏใในใฆใฎๅ ดๅใซๅฝใฆใฏใพใใชใๅฏ่ฝๆงใใใใพใใ
+
+ๆ้ฉใช็ตๆใๅพใใซใฏใๆๅใซใฟใผใฒใใ้ณๅฃฐใง X ใใฏใใซ ใขใใซใใใฌใผใใณใฐใใใใจใใๅงใใใพใใใใใซใใใใขใใซใ็ขบๅฎใซ
+ใชใฉใณใ่ชใซๅญๅจใใ็ฌ็นใฎ้ณๅฃฐ็นๅพดใใใใใๆใใใใจใใงใใพใใ
+
+### Processing the dataset
+
+ๆๅพใซใใขใใซใๆๅพ
ใใๅฝขๅผใซใใผใฟใๅฆ็ใใพใใใใใๅใ่พผใ `prepare_dataset` ้ขๆฐใไฝๆใใพใใ
+ใใใฏ 1 ใคใฎไพใงใใใ`SpeechT5Processor` ใชใใธใงใฏใใไฝฟ็จใใฆๅ
ฅๅใใญในใใใใผใฏใณๅใใใฟใผใฒใใ ใชใผใใฃใชใใญใฐใกใซ ในใใฏใใญใฐใฉใ ใซใญใผใใใพใใ
+ใพใใ่ฟฝๅ ใฎๅ
ฅๅใจใใฆในใใผใซใผใฎๅใ่พผใฟใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> def prepare_dataset(example):
+... audio = example["audio"]
+
+... example = processor(
+... text=example["normalized_text"],
+... audio_target=audio["array"],
+... sampling_rate=audio["sampling_rate"],
+... return_attention_mask=False,
+... )
+
+... # strip off the batch dimension
+... example["labels"] = example["labels"][0]
+
+... # use SpeechBrain to obtain x-vector
+... example["speaker_embeddings"] = create_speaker_embedding(audio["array"])
+
+... return example
+```
+
+ๅไธใฎไพใ่ฆใฆใๅฆ็ใๆญฃใใใใจใ็ขบ่ชใใพใใ
+
+```py
+>>> processed_example = prepare_dataset(dataset[0])
+>>> list(processed_example.keys())
+['input_ids', 'labels', 'stop_labels', 'speaker_embeddings']
+```
+ในใใผใซใผใฎใจใณใใใฃใณใฐใฏ 512 ่ฆ็ด ใฎใใฏใใซใงใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> processed_example["speaker_embeddings"].shape
+(512,)
+```
+
+ใฉใใซใฏใ80 ใกใซ ใใณใๅซใใญใฐใกใซ ในใใฏใใญใฐใฉใ ใงใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> import matplotlib.pyplot as plt
+
+>>> plt.figure()
+>>> plt.imshow(processed_example["labels"].T)
+>>> plt.show()
+```
+
+
+
+
+
+่ฃ่ถณ: ใใฎในใใฏใใญใฐใฉใ ใใใใใซใใใจๆใใๅ ดๅใฏใไฝๅจๆณขใ้
็ฝฎใใ่ฆๅใซๆ
ฃใใฆใใใใจใๅๅ ใงใใๅฏ่ฝๆงใใใใพใใ
+ใใญใใใฎไธ้จใซ้ซๅจๆณขใไธ้จใซ้ซๅจๆณขใ่กจ็คบใใใพใใใใ ใใmatplotlib ใฉใคใใฉใชใไฝฟ็จใใฆในใใฏใใญใฐใฉใ ใ็ปๅใจใใฆใใญใใใใๅ ดๅใ
+Y ่ปธใๅ่ปขใใใในใใฏใใญใฐใฉใ ใไธไธ้ใซ่กจ็คบใใใพใใ
+
+ๆฌกใซใๅฆ็้ขๆฐใใใผใฟใปใใๅ
จไฝใซ้ฉ็จใใพใใใใใซใฏ 5 ๏ฝ 10 ๅใใใใพใใ
+
+```py
+>>> dataset = dataset.map(prepare_dataset, remove_columns=dataset.column_names)
+```
+
+ใใผใฟใปใใๅ
ใฎไธ้จใฎไพใใใขใใซใๅฆ็ใงใใๆๅคงๅ
ฅๅ้ท (600 ใใผใฏใณ) ใ่ถ
ใใฆใใใใจใ็คบใ่ญฆๅใ่กจ็คบใใใพใใ
+ใใใใฎไพใใใผใฟใปใใใใๅ้คใใพใใใใใงใฏใใใซ้ฒใใงใใใๅคงใใชใใใ ใตใคใบใๅฏ่ฝใซใใใใใซใ200 ใใผใฏใณใ่ถ
ใใใใฎใฏใในใฆๅ้คใใพใใ
+
+```py
+>>> def is_not_too_long(input_ids):
+... input_length = len(input_ids)
+... return input_length < 200
+
+
+>>> dataset = dataset.filter(is_not_too_long, input_columns=["input_ids"])
+>>> len(dataset)
+8259
+```
+
+ๆฌกใซใๅบๆฌ็ใชใใฌใผใใณใฐ/ใในใๅๅฒใไฝๆใใพใใ
+
+```py
+>>> dataset = dataset.train_test_split(test_size=0.1)
+```
+
+### Data collator
+
+่คๆฐใฎไพใ 1 ใคใฎใใใใซ็ตๅใใใซใฏใใซในใฟใ ใใผใฟ็
งๅๅจใๅฎ็พฉใใๅฟ
่ฆใใใใพใใใใฎใณใฌใผใฟใผใฏใ็ญใใทใผใฑใณในใใใใฃใณใฐใงๅใ่พผใฟใพใใ
+ใใผใฏใณใไฝฟ็จใใฆใใในใฆใฎไพใๅใ้ทใใซใชใใใใซใใพใใในใใฏใใญใฐใฉใ ใฉใใซใฎๅ ดๅใๅใ่พผใพใใ้จๅใฏ็นๅฅใชๅค `-100` ใซ็ฝฎใๆใใใใพใใใใฎ็นๅฅใชไพกๅคใฏ
+ในใใฏใใญใฐใฉใ ๆๅคฑใ่จ็ฎใใใจใใซใในใใฏใใญใฐใฉใ ใฎใใฎ้จๅใ็ก่ฆใใใใใซใขใใซใซๆ็คบใใพใใ
+
+```py
+>>> from dataclasses import dataclass
+>>> from typing import Any, Dict, List, Union
+
+
+>>> @dataclass
+... class TTSDataCollatorWithPadding:
+... processor: Any
+
+... def __call__(self, features: List[Dict[str, Union[List[int], torch.Tensor]]]) -> Dict[str, torch.Tensor]:
+... input_ids = [{"input_ids": feature["input_ids"]} for feature in features]
+... label_features = [{"input_values": feature["labels"]} for feature in features]
+... speaker_features = [feature["speaker_embeddings"] for feature in features]
+
+... # collate the inputs and targets into a batch
+... batch = processor.pad(input_ids=input_ids, labels=label_features, return_tensors="pt")
+
+... # replace padding with -100 to ignore loss correctly
+... batch["labels"] = batch["labels"].masked_fill(batch.decoder_attention_mask.unsqueeze(-1).ne(1), -100)
+
+... # not used during fine-tuning
+... del batch["decoder_attention_mask"]
+
+... # round down target lengths to multiple of reduction factor
+... if model.config.reduction_factor > 1:
+... target_lengths = torch.tensor([len(feature["input_values"]) for feature in label_features])
+... target_lengths = target_lengths.new(
+... [length - length % model.config.reduction_factor for length in target_lengths]
+... )
+... max_length = max(target_lengths)
+... batch["labels"] = batch["labels"][:, :max_length]
+
+... # also add in the speaker embeddings
+... batch["speaker_embeddings"] = torch.tensor(speaker_features)
+
+... return batch
+```
+
+SpeechT5 ใงใฏใใขใใซใฎใใณใผใ้จๅใธใฎๅ
ฅๅใ 2 ๅใฎ 1 ใซๅๆธใใใพใใใคใพใใใในใฆใฎใใผใฟใ็ ดๆฃใใใพใใ
+ใฟใผใฒใใ ใทใผใฑใณในใใใฎไปใฎใฟใคใ ในใใใใๆฌกใซใใใณใผใใฏ 2 ๅใฎ้ทใใฎใทใผใฑใณในใไบๆธฌใใพใใใชใชใธใใซไปฅๆฅ
+ใฟใผใฒใใ ใทใผใฑใณในใฎ้ทใใๅฅๆฐใงใใๅฏ่ฝๆงใใใๅ ดๅใใใผใฟ็
งๅๆฉ่ฝใฏใใใใฎๆๅคง้ทใๅใๆจใฆใฆใ
+2ใฎๅๆฐใ
+
+```py
+>>> data_collator = TTSDataCollatorWithPadding(processor=processor)
+```
+
+## Train the model
+
+ใใญใปใใตใฎใญใผใใซไฝฟ็จใใใฎใจๅใใใงใใฏใใคใณใใใไบๅใใฌใผใใณใฐใใใใขใใซใใญใผใใใพใใ
+
+```py
+>>> from transformers import SpeechT5ForTextToSpeech
+
+>>> model = SpeechT5ForTextToSpeech.from_pretrained(checkpoint)
+```
+
+`use_cache=True`ใชใใทใงใณใฏใๅพ้
ใใงใใฏใใคใณใใจไบๆๆงใใใใพใใใใใฌใผใใณใฐใฎใใใซ็กๅนใซใใพใใ
+
+```py
+>>> model.config.use_cache = False
+```
+
+ใใฌใผใใณใฐๅผๆฐใๅฎ็พฉใใพใใใใใงใฏใใใฌใผใใณใฐ ใใญใปในไธญใซ่ฉไพกใกใใชใฏในใ่จ็ฎใใฆใใพใใใไปฃใใใซใ
+ๆๅคฑใ ใใ่ฆใฆใใ ใใใ
+
+```python
+>>> from transformers import Seq2SeqTrainingArguments
+
+>>> training_args = Seq2SeqTrainingArguments(
+... output_dir="speecht5_finetuned_voxpopuli_nl", # change to a repo name of your choice
+... per_device_train_batch_size=4,
+... gradient_accumulation_steps=8,
+... learning_rate=1e-5,
+... warmup_steps=500,
+... max_steps=4000,
+... gradient_checkpointing=True,
+... fp16=True,
+... eval_strategy="steps",
+... per_device_eval_batch_size=2,
+... save_steps=1000,
+... eval_steps=1000,
+... logging_steps=25,
+... report_to=["tensorboard"],
+... load_best_model_at_end=True,
+... greater_is_better=False,
+... label_names=["labels"],
+... push_to_hub=True,
+... )
+```
+
+`Trainer`ใชใใธใงใฏใใใคใณในใฟใณในๅใใใขใใซใใใผใฟใปใใใใใผใฟ็
งๅๅจใใใใซๆธกใใพใใ
+
+```py
+>>> from transformers import Seq2SeqTrainer
+
+>>> trainer = Seq2SeqTrainer(
+... args=training_args,
+... model=model,
+... train_dataset=dataset["train"],
+... eval_dataset=dataset["test"],
+... data_collator=data_collator,
+... processing_class=processor,
+... )
+```
+ใใใงใใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใซใฏๆฐๆ้ใใใใพใใ GPU ใซๅฟใใฆใ
+ใใฌใผใใณใฐใ้ๅงใใใจใใซใCUDA ใฎใใกใขใชไธ่ถณใใจใฉใผใ็บ็ใใๅฏ่ฝๆงใใใใพใใใใฎๅ ดๅใๆธใใใใจใใงใใพใ
+`per_device_train_batch_size`ใ 2 ๅใซๅขๅใใ`gradient_accumulation_steps`ใ 2 ๅใซๅขใใใฆ่ฃๆญฃใใพใใ
+
+```py
+>>> trainer.train()
+```
+ใใคใใฉใคใณใงใใงใใฏใใคใณใใไฝฟ็จใงใใใใใซใใใซใฏใๅฟ
ใใใญใปใใตใใใงใใฏใใคใณใใจใจใใซไฟๅญใใฆใใ ใใใ
+
+```py
+>>> processor.save_pretrained("YOUR_ACCOUNT_NAME/speecht5_finetuned_voxpopuli_nl")
+```
+
+ๆ็ตใขใใซใ ๐ค ใใใซใใใทใฅใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+### Inference with a pipeline
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+ใพใใๅฏพๅฟใใใใคใใฉใคใณใงใใใไฝฟ็จใใๆนๆณใ่ฆใฆใฟใพใใใใ `"text-to-speech"` ใใคใใฉใคใณใไฝๆใใพใใใ
+ใใงใใฏใใคใณใ:
+
+```py
+>>> from transformers import pipeline
+
+>>> pipe = pipeline("text-to-speech", model="YOUR_ACCOUNT_NAME/speecht5_finetuned_voxpopuli_nl")
+```
+
+ใใฌใผใทใงใณใๅธๆใใใชใฉใณใ่ชใฎใใญในใใ้ธๆใใฆใใ ใใใไพ:
+
+```py
+>>> text = "hallo allemaal, ik praat nederlands. groetjes aan iedereen!"
+```
+
+ใใคใใฉใคใณใง SpeechT5 ใไฝฟ็จใใใซใฏใในใใผใซใผใฎๅใ่พผใฟใๅฟ
่ฆใงใใใในใ ใใผใฟใปใใใฎไพใใๅๅพใใฆใฟใพใใใใ
+
+```py
+>>> example = dataset["test"][304]
+>>> speaker_embeddings = torch.tensor(example["speaker_embeddings"]).unsqueeze(0)
+```
+
+ใใใงใใใญในใใจในใใผใซใผใฎๅใ่พผใฟใใใคใใฉใคใณใซๆธกใใใจใใงใใๆฎใใฏใใคใใฉใคใณใๅฆ็ใใพใใ
+
+
+```py
+>>> forward_params = {"speaker_embeddings": speaker_embeddings}
+>>> output = pipe(text, forward_params=forward_params)
+>>> output
+{'audio': array([-6.82714235e-05, -4.26525949e-04, 1.06134125e-04, ...,
+ -1.22392643e-03, -7.76011671e-04, 3.29112721e-04], dtype=float32),
+ 'sampling_rate': 16000}
+```
+
+ใใฎๅพใ็ตๆใ่ใใใจใใงใใพใใ
+
+
+```py
+>>> from IPython.display import Audio
+>>> Audio(output['audio'], rate=output['sampling_rate'])
+```
+
+### Run inference manually
+
+ใใคใใฉใคใณใไฝฟ็จใใชใใฆใๅใๆจ่ซ็ตๆใๅพใใใจใใงใใพใใใใใๅคใใฎๆ้ ใๅฟ
่ฆใซใชใใพใใ
+
+๐ค ใใใใใขใใซใใญใผใใใพใใ
+
+
+```py
+>>> model = SpeechT5ForTextToSpeech.from_pretrained("YOUR_ACCOUNT/speecht5_finetuned_voxpopuli_nl")
+```
+
+ใในใ ใใผใฟใปใใใใไพใ้ธๆใใฆใในใใผใซใผใฎๅใ่พผใฟใๅๅพใใพใใ
+
+```py
+>>> example = dataset["test"][304]
+>>> speaker_embeddings = torch.tensor(example["speaker_embeddings"]).unsqueeze(0)
+```
+
+ๅ
ฅๅใใญในใใๅฎ็พฉใใใใผใฏใณๅใใพใใ
+
+```py
+>>> text = "hallo allemaal, ik praat nederlands. groetjes aan iedereen!"
+>>> inputs = processor(text=text, return_tensors="pt")
+```
+
+ใขใใซใไฝฟ็จใใฆในใใฏใใญใฐใฉใ ใไฝๆใใพใใ
+
+```py
+>>> spectrogram = model.generate_speech(inputs["input_ids"], speaker_embeddings)
+```
+
+ๆฌกใฎใใจใ่กใๅ ดๅใฏใในใใฏใใญใฐใฉใ ใ่ฆ่ฆๅใใพใใ
+
+```py
+>>> plt.figure()
+>>> plt.imshow(spectrogram.T)
+>>> plt.show()
+```
+
+
+
+
+
+ๆๅพใซใใใณใผใใผใไฝฟ็จใใฆในใใฏใใญใฐใฉใ ใใตใฆใณใใซๅคๆใใพใใ
+
+```py
+>>> with torch.no_grad():
+... speech = vocoder(spectrogram)
+
+>>> from IPython.display import Audio
+
+>>> Audio(speech.numpy(), rate=16000)
+```
+
+็งใใกใฎ็ต้จใงใฏใใใฎใขใใซใใๆบ่ถณใฎใใ็ตๆใๅพใใฎใฏ้ฃใใๅ ดๅใใใใพใใในใใผใซใผใฎๅ่ณช
+ๅใ่พผใฟใฏ้่ฆใช่ฆ็ด ใงใใใใใงใใ SpeechT5 ใฏ่ฑ่ชใฎ x ใใฏใใซใงไบๅใใฌใผใใณใฐใใใฆใใใใใๆ้ซใฎใใใฉใผใใณในใ็บๆฎใใพใ
+่ฑ่ชในใใผใซใผใฎๅใ่พผใฟใไฝฟ็จใใๅ ดๅใๅๆ้ณๅฃฐใฎ้ณ่ณชใๆชใๅ ดๅใฏใๅฅใฎในใใผใซใผๅใ่พผใฟใไฝฟ็จใใฆใฟใฆใใ ใใใ
+
+ใใฌใผใใณใฐๆ้ใ้ทใใใใจใ็ตๆใฎ่ณชใๅไธใใๅฏ่ฝๆงใใใใพใใใใใงใใใใฎในใใผใใฏๆใใใซ่ฑ่ชใงใฏใชใใชใฉใณใ่ชใงใใ
+่ฉฑ่
ใฎ้ณๅฃฐ็นๆงใใญใฃใใใฃใใพใ (ไพใฎๅ
ใฎ้ณๅฃฐใจๆฏ่ผ)ใ
+ใใ 1 ใคๅฎ้จใในใใใจใฏใใขใใซใฎๆงๆใงใใใใจใใฐใ`config.reduction_factor = 1`ใไฝฟ็จใใฆใฟใฆใใ ใใใ
+ใใใซใใ็ตๆใๆนๅใใใใใฉใใใ็ขบ่ชใใฆใใ ใใใ
+
+ๆๅพใซใๅซ็็้
ๆ
ฎใ่ๆ
ฎใใใใจใไธๅฏๆฌ ใงใใ TTS ใใฏใใญใธใผใซใฏๆฐๅคใใฎๆ็จใช็จ้ใใใใพใใใ
+ใพใใ็ฅใใชใใใกใซ่ชฐใใฎๅฃฐใๅฝ่ฃ
ใใใชใฉใๆชๆใฎใใ็ฎ็ใซไฝฟ็จใใใๅฏ่ฝๆงใใใใพใใใ้กใใใพใ
+TTS ใฏ่ณขๆใใค่ฒฌไปปใๆใฃใฆไฝฟ็จใใฆใใ ใใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/token_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/token_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..4389aeacb5644b7f519b2c7bc7c4ef2aa3f7b5e9
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/token_classification.md
@@ -0,0 +1,561 @@
+
+
+# Token classification
+
+[[open-in-colab]]
+
+
+
+ใใผใฏใณๅ้กใงใฏใๆๅ
ใฎๅใ
ใฎใใผใฏใณใซใฉใใซใๅฒใๅฝใฆใพใใๆใไธ่ฌ็ใชใใผใฏใณๅ้กใฟในใฏใฎ 1 ใคใฏใๅบๆ่กจ็พ่ช่ญ (NER) ใงใใ NER ใฏใไบบใๅ ดๆใ็ต็นใชใฉใๆๅ
ใฎๅใจใณใใฃใใฃใฎใฉใใซใ่ฆใคใใใใจใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [WNUT 17](https://huggingface.co/datasets/wnut_17) ใใผใฟใปใใใง [DistilBERT](https://huggingface.co/distilbert/distilbert-base-uncased) ใๅพฎ่ชฟๆดใใฆใๆฐใใใจใณใใฃใใฃใๆคๅบใใพใใ
+2. ๅพฎ่ชฟๆดใใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/token-classification) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate seqeval
+```
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load WNUT 17 dataset
+
+ใพใใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ WNUT 17 ใใผใฟใปใใใใญใผใใใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> wnut = load_dataset("wnut_17")
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> wnut["train"][0]
+{'id': '0',
+ 'ner_tags': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 8, 8, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'tokens': ['@paulwalk', 'It', "'s", 'the', 'view', 'from', 'where', 'I', "'m", 'living', 'for', 'two', 'weeks', '.', 'Empire', 'State', 'Building', '=', 'ESB', '.', 'Pretty', 'bad', 'storm', 'here', 'last', 'evening', '.']
+}
+```
+
+`ner_tags`ๅ
ใฎๅๆฐๅญใฏใจใณใใฃใใฃใ่กจใใพใใๆฐๅคใใฉใใซๅใซๅคๆใใฆใใจใณใใฃใใฃใไฝใงใใใใ่ชฟในใพใใ
+
+```py
+>>> label_list = wnut["train"].features[f"ner_tags"].feature.names
+>>> label_list
+[
+ "O",
+ "B-corporation",
+ "I-corporation",
+ "B-creative-work",
+ "I-creative-work",
+ "B-group",
+ "I-group",
+ "B-location",
+ "I-location",
+ "B-person",
+ "I-person",
+ "B-product",
+ "I-product",
+]
+```
+ๅ `ner_tag` ใฎๅใซไปใๆๅญใฏใใจใณใใฃใใฃใฎใใผใฏใณใฎไฝ็ฝฎใ็คบใใพใใ
+
+- `B-` ใฏใจใณใใฃใใฃใฎๅงใพใใ็คบใใพใใ
+- `I-` ใฏใใใผใฏใณใๅใใจใณใใฃใใฃๅ
ใซๅซใพใใฆใใใใจใ็คบใใพใ (ใใจใใฐใ`State` ใใผใฏใณใฏๆฌกใฎใใใชใจใณใใฃใใฃใฎไธ้จใงใ)
+ `Empire State Building`๏ผใ
+- `0` ใฏใใใผใฏใณใใฉใฎใจใณใใฃใใฃใซใๅฏพๅฟใใชใใใจใ็คบใใพใใ
+
+## Preprocess
+
+
+
+ๆฌกใฎในใใใใงใฏใDistilBERT ใใผใฏใใคใถใผใใญใผใใใฆ`tokens`ใใฃใผใซใใๅๅฆ็ใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+ไธใฎ `tokens`ใใฃใผใซใใฎไพใง่ฆใใใใซใๅ
ฅๅใฏใใงใซใใผใฏใณๅใใใฆใใใใใงใใใใใใๅฎ้ใซใฏๅ
ฅๅใฏใพใ ใใผใฏใณๅใใใฆใใชใใใใๅ่ชใใตใใฏใผใใซใใผใฏใณๅใใใซใฏ`is_split_into_words=True` ใ่จญๅฎใใๅฟ
่ฆใใใใพใใไพใใฐ๏ผ
+
+```py
+>>> example = wnut["train"][0]
+>>> tokenized_input = tokenizer(example["tokens"], is_split_into_words=True)
+>>> tokens = tokenizer.convert_ids_to_tokens(tokenized_input["input_ids"])
+>>> tokens
+['[CLS]', '@', 'paul', '##walk', 'it', "'", 's', 'the', 'view', 'from', 'where', 'i', "'", 'm', 'living', 'for', 'two', 'weeks', '.', 'empire', 'state', 'building', '=', 'es', '##b', '.', 'pretty', 'bad', 'storm', 'here', 'last', 'evening', '.', '[SEP]']
+```
+
+ใใ ใใใใใซใใใใใคใใฎ็นๅฅใชใใผใฏใณ `[CLS]` ใจ `[SEP]` ใ่ฟฝๅ ใใใใตใใฏใผใใฎใใผใฏใณๅใซใใๅ
ฅๅใจใฉใใซใฎ้ใซไธไธ่ดใ็ใใพใใ 1 ใคใฎใฉใใซใซๅฏพๅฟใใ 1 ใคใฎๅ่ชใ 2 ใคใฎใตใใฏใผใใซๅๅฒใงใใใใใซใชใใพใใใๆฌกใฎๆนๆณใงใใผใฏใณใจใฉใใซใๅ่ชฟๆดใใๅฟ
่ฆใใใใพใใ
+
+1. [`word_ids`](https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.BatchEncoding.word_ids) ใกใฝใใใไฝฟ็จใใฆใใในใฆใฎใใผใฏใณใๅฏพๅฟใใๅ่ชใซใใใใณใฐใใพใใ
+2. ็นๅฅใชใใผใฏใณ `[CLS]` ใจ `[SEP]` ใซใฉใใซ `-100` ใๅฒใๅฝใฆใใใใใ PyTorch ๆๅคฑ้ขๆฐใซใใฃใฆ็ก่ฆใใใใใใซใใพใ ([CrossEntropyLoss](https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html))ใ
+3. ็นๅฎใฎๅ่ชใฎๆๅใฎใใผใฏใณใฎใฟใซใฉใใซใไปใใพใใๅใๅ่ชใฎไปใฎใตใใใผใฏใณใซ `-100`ใๅฒใๅฝใฆใพใใ
+
+ใใผใฏใณใจใฉใใซใๅ่ชฟๆดใใใทใผใฑใณในใ DistilBERT ใฎๆๅคงๅ
ฅๅ้ทไปฅไธใซๅใ่ฉฐใใ้ขๆฐใไฝๆใใๆนๆณใๆฌกใซ็คบใใพใใ
+
+```py
+>>> def tokenize_and_align_labels(examples):
+... tokenized_inputs = tokenizer(examples["tokens"], truncation=True, is_split_into_words=True)
+
+... labels = []
+... for i, label in enumerate(examples[f"ner_tags"]):
+... word_ids = tokenized_inputs.word_ids(batch_index=i) # Map tokens to their respective word.
+... previous_word_idx = None
+... label_ids = []
+... for word_idx in word_ids: # Set the special tokens to -100.
+... if word_idx is None:
+... label_ids.append(-100)
+... elif word_idx != previous_word_idx: # Only label the first token of a given word.
+... label_ids.append(label[word_idx])
+... else:
+... label_ids.append(-100)
+... previous_word_idx = word_idx
+... labels.append(label_ids)
+
+... tokenized_inputs["labels"] = labels
+... return tokenized_inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ้ขๆฐใไฝฟ็จใใพใใ `batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใใใจใงใ`map` ้ขๆฐใ้ซ้ๅใงใใพใใ
+
+```py
+>>> tokenized_wnut = wnut.map(tokenize_and_align_labels, batched=True)
+```
+
+ๆฌกใซใ[`DataCollatโโorWithPadding`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใใใผใฟใปใใๅ
จไฝใๆๅคง้ทใพใงใใใฃใณใฐใใใฎใงใฏใชใใ็
งๅไธญใซใใใๅ
ใฎๆ้ทใฎ้ทใใพใงๆใ *ๅ็ใซใใใฃใณใฐ* ใใๆนใๅน็็ใงใใ
+
+
+
+
+```py
+>>> from transformers import DataCollatorForTokenClassification
+
+>>> data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer)
+```
+
+
+
+```py
+>>> from transformers import DataCollatorForTokenClassification
+
+>>> data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer, return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[seqeval](https://huggingface.co/spaces/evaluate-metric/seqeval) ใใฌใผใ ใฏใผใฏใ่ชญใฟ่พผใฟใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใ ใใ) ) ใกใใชใฏในใฎ่ชญใฟ่พผใฟใจ่จ็ฎใฎๆนๆณใซใคใใฆ่ฉณใใใฏใใใกใใใ่ฆงใใ ใใ)ใ Seqeval ใฏๅฎ้ใซใ็ฒพๅบฆใๅ็พ็ใF1ใ็ฒพๅบฆใชใฉใฎใใใคใใฎในใณใขใ็ๆใใพใใ
+
+```py
+>>> import evaluate
+
+>>> seqeval = evaluate.load("seqeval")
+```
+
+ใพใ NER ใฉใใซใๅๅพใใฆใใใ็ใฎไบๆธฌใจ็ใฎใฉใใซใ [`~evaluate.EvaluationModule.compute`] ใซๆธกใใฆในใณใขใ่จ็ฎใใ้ขๆฐใไฝๆใใพใใ
+
+```py
+>>> import numpy as np
+
+>>> labels = [label_list[i] for i in example[f"ner_tags"]]
+
+
+>>> def compute_metrics(p):
+... predictions, labels = p
+... predictions = np.argmax(predictions, axis=2)
+
+... true_predictions = [
+... [label_list[p] for (p, l) in zip(prediction, label) if l != -100]
+... for prediction, label in zip(predictions, labels)
+... ]
+... true_labels = [
+... [label_list[l] for (p, l) in zip(prediction, label) if l != -100]
+... for prediction, label in zip(predictions, labels)
+... ]
+
+... results = seqeval.compute(predictions=true_predictions, references=true_labels)
+... return {
+... "precision": results["overall_precision"],
+... "recall": results["overall_recall"],
+... "f1": results["overall_f1"],
+... "accuracy": results["overall_accuracy"],
+... }
+```
+
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+ใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๅใซใ`id2label`ใจ`label2id`ใไฝฟ็จใใฆใไบๆณใใใ ID ใจใใฎใฉใใซใฎใใใใไฝๆใใพใใ
+```py
+>>> id2label = {
+... 0: "O",
+... 1: "B-corporation",
+... 2: "I-corporation",
+... 3: "B-creative-work",
+... 4: "I-creative-work",
+... 5: "B-group",
+... 6: "I-group",
+... 7: "B-location",
+... 8: "I-location",
+... 9: "B-person",
+... 10: "I-person",
+... 11: "B-product",
+... 12: "I-product",
+... }
+>>> label2id = {
+... "O": 0,
+... "B-corporation": 1,
+... "I-corporation": 2,
+... "B-creative-work": 3,
+... "I-creative-work": 4,
+... "B-group": 5,
+... "I-group": 6,
+... "B-location": 7,
+... "I-location": 8,
+... "B-person": 9,
+... "I-person": 10,
+... "B-product": 11,
+... "I-product": 12,
+... }
+```
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForTokenClassification`] ใไฝฟ็จใใฆใไบๆใใใใฉใใซใฎๆฐใจใฉใใซ ใใใใณใฐใๆๅฎใใฆ DistilBERT ใ่ชญใฟ่พผใฟใพใใ
+
+```py
+>>> from transformers import AutoModelForTokenClassification, TrainingArguments, Trainer
+
+>>> model = AutoModelForTokenClassification.from_pretrained(
+... "distilbert/distilbert-base-uncased", num_labels=13, id2label=id2label, label2id=label2id
+... )
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใในใใใใฏ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`Trainer`] ใฏ้ฃ็ถในใณใขใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> training_args = TrainingArguments(
+... output_dir="my_awesome_wnut_model",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... num_train_epochs=2,
+... weight_decay=0.01,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... load_best_model_at_end=True,
+... push_to_hub=True,
+... )
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_wnut["train"],
+... eval_dataset=tokenized_wnut["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-a-tensorflow-model-with-keras) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใใชใใใฃใใคใถใผ้ขๆฐใๅญฆ็ฟ็ในใฑใธใฅใผใซใใใใณใใใคใใฎใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใผใใปใใใขใใใใใใจใใๅงใใพใใ
+
+```py
+>>> from transformers import create_optimizer
+
+>>> batch_size = 16
+>>> num_train_epochs = 3
+>>> num_train_steps = (len(tokenized_wnut["train"]) // batch_size) * num_train_epochs
+>>> optimizer, lr_schedule = create_optimizer(
+... init_lr=2e-5,
+... num_train_steps=num_train_steps,
+... weight_decay_rate=0.01,
+... num_warmup_steps=0,
+... )
+```
+ๆฌกใซใ[`TFAutoModelForTokenClassification`] ใไฝฟ็จใใฆใไบๆใใใใฉใใซใฎๆฐใจใฉใใซ ใใใใณใฐใๆๅฎใใฆ DistilBERT ใใญใผใใงใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained(
+... "distilbert/distilbert-base-uncased", num_labels=13, id2label=id2label, label2id=label2id
+... )
+```
+[`~transformers.TFPreTrainedModel.prepare_tf_dataset`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_wnut["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_validation_set = model.prepare_tf_dataset(
+... tokenized_wnut["validation"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใฎใขใใซใ่จญๅฎใใพใใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+
+ใใฌใผใใณใฐใ้ๅงใใๅใซใปใใใขใใใใๆๅพใฎ 2 ใคใฎใใจใฏใไบๆธฌใใ้ฃ็ถในใณใขใ่จ็ฎใใใใจใจใใขใใซใใใใซใใใทใฅใใๆนๆณใๆไพใใใใจใงใใใฉใกใใ [Keras ใณใผใซใใใฏ](../main_classes/keras_callbacks) ใไฝฟ็จใใฆ่กใใใพใใ
+
+`compute_metrics` ้ขๆฐใ [`~transformers.KerasMetricCallback`] ใซๆธกใใพใใ
+
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)
+```
+
+[`~transformers.PushToHubCallback`] ใงใขใใซใจใใผใฏใใคใถใผใใใใทใฅใใๅ ดๆใๆๅฎใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_wnut_model",
+... tokenizer=tokenizer,
+... )
+```
+
+ๆฌกใซใใณใผใซใใใฏใใพใจใใฆใใณใใซใใพใใ
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+ใคใใซใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใใณใผใซใใใฏใๆๅฎใใฆ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใๅผใณๅบใใใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=3, callbacks=callbacks)
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใจใใขใใซใฏ่ชๅ็ใซใใใซใขใใใญใผใใใใ่ชฐใงใไฝฟ็จใงใใใใใซใชใใพใใ
+
+
+
+
+
+
+ใใผใฏใณๅ้กใฎใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎใใ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใใปใฏใทใงใณใๅ็
งใใฆใใ ใใใ
+[PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)
+ใพใใฏ [TensorFlow ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb)ใ
+
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๆจ่ซใๅฎ่กใใใใใญในใใใใใคใๅๅพใใพใใ
+
+```py
+>>> text = "The Golden State Warriors are an American professional basketball team based in San Francisco."
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ NER ใฎ`pipeline`ใใคใณในใฟใณในๅใใใใญในใใใใใซๆธกใใพใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> classifier = pipeline("ner", model="stevhliu/my_awesome_wnut_model")
+>>> classifier(text)
+[{'entity': 'B-location',
+ 'score': 0.42658573,
+ 'index': 2,
+ 'word': 'golden',
+ 'start': 4,
+ 'end': 10},
+ {'entity': 'I-location',
+ 'score': 0.35856336,
+ 'index': 3,
+ 'word': 'state',
+ 'start': 11,
+ 'end': 16},
+ {'entity': 'B-group',
+ 'score': 0.3064001,
+ 'index': 4,
+ 'word': 'warriors',
+ 'start': 17,
+ 'end': 25},
+ {'entity': 'B-location',
+ 'score': 0.65523505,
+ 'index': 13,
+ 'word': 'san',
+ 'start': 80,
+ 'end': 83},
+ {'entity': 'B-location',
+ 'score': 0.4668663,
+ 'index': 14,
+ 'word': 'francisco',
+ 'start': 84,
+ 'end': 93}]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline`ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+
+
+ใใญในใใใใผใฏใณๅใใฆ PyTorch ใใณใฝใซใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> inputs = tokenizer(text, return_tensors="pt")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoModelForTokenClassification
+
+>>> model = AutoModelForTokenClassification.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> with torch.no_grad():
+... logits = model(**inputs).logits
+```
+
+ๆใ้ซใ็ขบ็ใงใฏใฉในใๅๅพใใใขใใซใฎ `id2label` ใใใใณใฐใไฝฟ็จใใฆใใใใใญในใ ใฉใใซใซๅคๆใใพใใ
+
+```py
+>>> predictions = torch.argmax(logits, dim=2)
+>>> predicted_token_class = [model.config.id2label[t.item()] for t in predictions[0]]
+>>> predicted_token_class
+['O',
+ 'O',
+ 'B-location',
+ 'I-location',
+ 'B-group',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'B-location',
+ 'B-location',
+ 'O',
+ 'O']
+```
+
+
+
+
+ใใญในใใใใผใฏใณๅใใTensorFlow ใใณใฝใซใ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> inputs = tokenizer(text, return_tensors="tf")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ`logits`ใ่ฟใใพใใ
+
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained("stevhliu/my_awesome_wnut_model")
+>>> logits = model(**inputs).logits
+```
+
+ๆใ้ซใ็ขบ็ใงใฏใฉในใๅๅพใใใขใใซใฎ `id2label` ใใใใณใฐใไฝฟ็จใใฆใใใใใญในใ ใฉใใซใซๅคๆใใพใใ
+
+```py
+>>> predicted_token_class_ids = tf.math.argmax(logits, axis=-1)
+>>> predicted_token_class = [model.config.id2label[t] for t in predicted_token_class_ids[0].numpy().tolist()]
+>>> predicted_token_class
+['O',
+ 'O',
+ 'B-location',
+ 'I-location',
+ 'B-group',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'O',
+ 'B-location',
+ 'B-location',
+ 'O',
+ 'O']
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/translation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/translation.md
new file mode 100644
index 0000000000000000000000000000000000000000..7fa45eac9cdb682e662bbb976a6be3b94b6c3cd0
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/translation.md
@@ -0,0 +1,415 @@
+
+
+# Translation
+
+[[open-in-colab]]
+
+
+
+็ฟป่จณใงใฏใไธ้ฃใฎใใญในใใใใ่จ่ชใใๅฅใฎ่จ่ชใซๅคๆใใพใใใใใฏใใทใผใฑใณใน้ๅ้กใจใใฆๅฎๅผๅใงใใใใใคใใฎใฟในใฏใฎ 1 ใคใงใใใ็ฟป่จณใ่ฆ็ดใชใฉใๅ
ฅๅใใไฝใใใฎๅบๅใ่ฟใใใใฎๅผทๅใชใใฌใผใ ใฏใผใฏใงใใ็ฟป่จณใทในใใ ใฏ้ๅธธใ็ฐใชใ่จ่ชใฎใใญในใ้ใฎ็ฟป่จณใซไฝฟ็จใใใพใใใ้ณๅฃฐใใพใใฏใใญในใใใ้ณๅฃฐใธใฎๅคๆใ้ณๅฃฐใใใใญในใใธใฎๅคๆใชใฉใ้ณๅฃฐ้ใฎ็ตใฟๅใใใซใไฝฟ็จใงใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [OPUS Books](https://huggingface.co/datasets/opus_books) ใใผใฟใปใใใฎ่ฑ่ช-ใใฉใณใน่ชใตใใปใใใฎ [T5](https://huggingface.co/google-t5/t5-small) ใๅพฎ่ชฟๆดใใฆใ่ฑ่ชใฎใใญในใใๆฌกใฎๅฝขๅผใซ็ฟป่จณใใพใใใใฉใณใน่ชใ
+2. ๅพฎ่ชฟๆดใใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/translation) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install transformers datasets evaluate sacrebleu
+```
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+## Load OPUS Books dataset
+
+ใพใใ๐ค ใใผใฟใปใใ ใฉใคใใฉใชใใ [OPUS Books](https://huggingface.co/datasets/opus_books) ใใผใฟใปใใใฎ่ฑ่ชใจใใฉใณใน่ชใฎใตใใปใใใ่ชญใฟ่พผใฟใพใใ
+
+```py
+>>> from datasets import load_dataset
+
+>>> books = load_dataset("opus_books", "en-fr")
+```
+
+[`~datasets.Dataset.train_test_split`] ใกใฝใใใไฝฟ็จใใฆใใใผใฟใปใใใใใฌใคใณ ใปใใใจใในใ ใปใใใซๅๅฒใใพใใ
+
+
+```py
+>>> books = books["train"].train_test_split(test_size=0.2)
+```
+
+ๆฌกใซใไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> books["train"][0]
+{'id': '90560',
+ 'translation': {'en': 'But this lofty plateau measured only a few fathoms, and soon we reentered Our Element.',
+ 'fr': 'Mais ce plateau รฉlevรฉ ne mesurait que quelques toises, et bientรดt nous fรปmes rentrรฉs dans notre รฉlรฉment.'}}
+```
+
+`translation`: ใใญในใใฎ่ฑ่ชใจใใฉใณใน่ชใฎ็ฟป่จณใ
+
+## Preprocess
+
+
+
+ๆฌกใฎในใใใใงใฏใT5 ใใผใฏใใคใถใผใใญใผใใใฆ่ฑ่ชใจใใฉใณใน่ชใฎ่จ่ชใใขใๅฆ็ใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> checkpoint = "google-t5/t5-small"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+```
+
+ไฝๆใใๅๅฆ็้ขๆฐใฏๆฌกใฎใใจใ่กใๅฟ
่ฆใใใใพใใ
+
+1. T5 ใใใใ็ฟป่จณใฟในใฏใงใใใใจใ่ช่ญใงใใใใใซใๅ
ฅๅใฎๅใซใใญใณใโโใใไปใใพใใ่คๆฐใฎ NLP ใฟในใฏใๅฏ่ฝใชไธ้จใฎใขใใซใงใฏใ็นๅฎใฎใฟในใฏใฎใใญใณใใใๅฟ
่ฆใงใใ
+2. ่ฑ่ชใฎ่ชๅฝใงไบๅใใฌใผใใณใฐใใใใใผใฏใใคใถใผใไฝฟ็จใใฆใใฉใณใน่ชใฎใใญในใใใใผใฏใณๅใใใใจใฏใงใใชใใใใๅ
ฅๅ (่ฑ่ช) ใจใฟใผใฒใใ (ใใฉใณใน่ช) ใๅฅใ
ใซใใผใฏใณๅใใพใใ
+3. `max_length`ใใฉใกใผใฟใง่จญๅฎใใใๆๅคง้ทใ่ถ
ใใชใใใใซใทใผใฑใณในใๅใ่ฉฐใใพใใ
+```py
+>>> source_lang = "en"
+>>> target_lang = "fr"
+>>> prefix = "translate English to French: "
+
+
+>>> def preprocess_function(examples):
+... inputs = [prefix + example[source_lang] for example in examples["translation"]]
+... targets = [example[target_lang] for example in examples["translation"]]
+... model_inputs = tokenizer(inputs, text_target=targets, max_length=128, truncation=True)
+... return model_inputs
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.Dataset.map`] ใกใฝใใใไฝฟ็จใใพใใ `batched=True` ใ่จญๅฎใใฆใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใใใจใงใ`map` ้ขๆฐใ้ซ้ๅใงใใพใใ
+
+```py
+>>> tokenized_books = books.map(preprocess_function, batched=True)
+```
+
+ๆฌกใซใ[`DataCollatโโorForSeq2Seq`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใใใผใฟใปใใๅ
จไฝใๆๅคง้ทใพใงใใใฃใณใฐใใใฎใงใฏใชใใ็
งๅไธญใซใใใๅ
ใฎๆ้ทใฎ้ทใใพใงๆใ *ๅ็ใซใใใฃใณใฐ* ใใๆนใๅน็็ใงใใ
+
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)
+```
+
+
+
+```py
+>>> from transformers import DataCollatorForSeq2Seq
+
+>>> data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors="tf")
+```
+
+
+
+## Evaluate
+
+ใใฌใผใใณใฐไธญใซใกใใชใฏในใๅซใใใจใๅคใใฎๅ ดๅใใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใใฎใซๅฝน็ซใกใพใใ ๐ค [Evaluate](https://huggingface.co/docs/evaluate/index) ใฉใคใใฉใชใไฝฟ็จใใฆใ่ฉไพกใกใฝใใใใใฐใใใญใผใใงใใพใใใใฎใฟในใฏใงใฏใ[SacreBLEU](https://huggingface.co/spaces/evaluate-metric/sacrebleu) ใกใใชใฏในใใญใผใใใพใ (๐ค Evaluate [ใฏใคใใฏ ใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour) ใๅ็
งใใฆใใ ใใ) ) ใกใใชใฏในใฎ่ชญใฟ่พผใฟใจ่จ็ฎๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใๆฌกใๅ็
งใใฆใใ ใใ)ใ
+
+```py
+>>> import evaluate
+
+>>> metric = evaluate.load("sacrebleu")
+```
+
+ๆฌกใซใไบๆธฌใจใฉใใซใ [`~evaluate.EvaluationModule.compute`] ใซๆธกใใฆ SacreBLEU ในใณใขใ่จ็ฎใใ้ขๆฐใไฝๆใใพใใ
+```py
+>>> import numpy as np
+
+
+>>> def postprocess_text(preds, labels):
+... preds = [pred.strip() for pred in preds]
+... labels = [[label.strip()] for label in labels]
+
+... return preds, labels
+
+
+>>> def compute_metrics(eval_preds):
+... preds, labels = eval_preds
+... if isinstance(preds, tuple):
+... preds = preds[0]
+... decoded_preds = tokenizer.batch_decode(preds, skip_special_tokens=True)
+
+... labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
+... decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
+
+... decoded_preds, decoded_labels = postprocess_text(decoded_preds, decoded_labels)
+
+... result = metric.compute(predictions=decoded_preds, references=decoded_labels)
+... result = {"bleu": result["score"]}
+
+... prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in preds]
+... result["gen_len"] = np.mean(prediction_lens)
+... result = {k: round(v, 4) for k, v in result.items()}
+... return result
+```
+ใใใง`compute_metrics`้ขๆฐใฎๆบๅใๆดใใพใใใใใฌใผใใณใฐใใปใใใขใใใใใจใใซใใฎ้ขๆฐใซๆปใใพใใ
+
+## Train
+
+
+
+
+
+[`Trainer`] ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใ](../training#train-with-pytorch-trainer) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`AutoModelForSeq2SeqLM`] ใไฝฟ็จใใฆ T5 ใใญใผใใใพใใ
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใในใใใใฏ 3 ใคใ ใใงใใ
+
+1. [`Seq2SeqTrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใๅฏไธใฎๅฟ
้ ใใฉใกใผใฟใฏใใขใใซใฎไฟๅญๅ ดๆใๆๅฎใใ `output_dir` ใงใใ `push_to_hub=True`ใ่จญๅฎใใฆใใใฎใขใใซใใใใซใใใทใฅใใพใ (ใขใใซใใขใใใญใผใใใใซใฏใHugging Face ใซใตใคใณใคใณใใๅฟ
่ฆใใใใพใ)ใๅใจใใใฏใฎ็ตไบๆใซใ[`Trainer`] ใฏ SacreBLEU ใกใใชใฏในใ่ฉไพกใใใใฌใผใใณใฐ ใใงใใฏใใคใณใใไฟๅญใใพใใ
+2. ใใฌใผใใณใฐๅผๆฐใใขใใซใใใผใฟใปใใใใใผใฏใใคใถใผใใใผใฟ็
งๅๅจใใใใณ `compute_metrics` ้ขๆฐใจใจใใซ [`Seq2SeqTrainer`] ใซๆธกใใพใใ
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+
+```py
+>>> training_args = Seq2SeqTrainingArguments(
+... output_dir="my_awesome_opus_books_model",
+... eval_strategy="epoch",
+... learning_rate=2e-5,
+... per_device_train_batch_size=16,
+... per_device_eval_batch_size=16,
+... weight_decay=0.01,
+... save_total_limit=3,
+... num_train_epochs=2,
+... predict_with_generate=True,
+... fp16=True,
+... push_to_hub=True,
+... )
+
+>>> trainer = Seq2SeqTrainer(
+... model=model,
+... args=training_args,
+... train_dataset=tokenized_books["train"],
+... eval_dataset=tokenized_books["test"],
+... processing_class=tokenizer,
+... data_collator=data_collator,
+... compute_metrics=compute_metrics,
+... )
+
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+
+
+
+Keras ใไฝฟ็จใใใขใใซใฎๅพฎ่ชฟๆดใซๆ
ฃใใฆใใชใๅ ดๅใฏใ[ใใกใ](../training#train-a-tensorflow-model-with-keras) ใฎๅบๆฌ็ใชใใฅใผใใชใขใซใใ่ฆงใใ ใใใ
+
+
+TensorFlow ใงใขใใซใๅพฎ่ชฟๆดใใใซใฏใใชใใใฃใใคใถใผ้ขๆฐใๅญฆ็ฟ็ในใฑใธใฅใผใซใใใใณใใใคใใฎใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใผใใปใใใขใใใใใใจใใๅงใใพใใ
+
+
+```py
+>>> from transformers import AdamWeightDecay
+
+>>> optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)
+```
+
+ๆฌกใซใ[`TFAutoModelForSeq2SeqLM`] ใไฝฟ็จใใฆ T5 ใใญใผใใงใใพใใ
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+```
+
+[`~transformers.TFPreTrainedModel.prepare_tf_dataset`] ใไฝฟ็จใใฆใใใผใฟใปใใใ `tf.data.Dataset` ๅฝขๅผใซๅคๆใใพใใ
+
+```py
+>>> tf_train_set = model.prepare_tf_dataset(
+... tokenized_books["train"],
+... shuffle=True,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+
+>>> tf_test_set = model.prepare_tf_dataset(
+... tokenized_books["test"],
+... shuffle=False,
+... batch_size=16,
+... collate_fn=data_collator,
+... )
+```
+
+[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใไฝฟ็จใใฆใใฌใผใใณใฐ็จใฎใขใใซใ่จญๅฎใใพใใ Transformers ใขใใซใซใฏใในใฆใใใฉใซใใฎใฟในใฏ้ข้ฃใฎๆๅคฑ้ขๆฐใใใใใใๆฌกใฎๅ ดๅใ้คใใๆๅคฑ้ขๆฐใๆๅฎใใๅฟ
่ฆใฏใชใใใจใซๆณจๆใใฆใใ ใใใ
+
+```py
+>>> import tensorflow as tf
+
+>>> model.compile(optimizer=optimizer) # No loss argument!
+```
+ใใฌใผใใณใฐใ้ๅงใใๅใซใปใใใขใใใใๆๅพใฎ 2 ใคใฎใใจใฏใไบๆธฌใใ SacreBLEU ใกใใชใฏในใ่จ็ฎใใใขใใซใใใใซใใใทใฅใใๆนๆณใๆไพใใใใจใงใใใฉใกใใ [Keras ใณใผใซใใใฏ](../main_classes/keras_callbacks) ใไฝฟ็จใใฆ่กใใใพใใ
+
+`compute_metrics` ้ขๆฐใ [`~transformers.KerasMetricCallback`] ใซๆธกใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import KerasMetricCallback
+
+>>> metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)
+```
+
+[`~transformers.PushToHubCallback`] ใงใขใใซใจใใผใฏใใคใถใผใใใใทใฅใใๅ ดๆใๆๅฎใใพใใ
+
+```py
+>>> from transformers.keras_callbacks import PushToHubCallback
+
+>>> push_to_hub_callback = PushToHubCallback(
+... output_dir="my_awesome_opus_books_model",
+... tokenizer=tokenizer,
+... )
+```
+
+ๆฌกใซใใณใผใซใใใฏใใพใจใใฆใใณใใซใใพใใ
+
+```py
+>>> callbacks = [metric_callback, push_to_hub_callback]
+```
+
+ใคใใซใใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใใใฌใผใใณใฐใใใณๆค่จผใใผใฟใปใใใใจใใใฏๆฐใใณใผใซใใใฏใๆๅฎใใฆ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใๅผใณๅบใใใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=callbacks)
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใจใใขใใซใฏ่ชๅ็ใซใใใซใขใใใญใผใใใใ่ชฐใงใไฝฟ็จใงใใใใใซใชใใพใใ
+
+
+
+
+
+
+็ฟป่จณ็จใซใขใใซใๅพฎ่ชฟๆดใใๆนๆณใฎ่ฉณ็ดฐใชไพใซใคใใฆใฏใๅฏพๅฟใใใใญใฅใกใณใใๅ็
งใใฆใใ ใใใ
+[PyTorch ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation.ipynb)
+ใพใใฏ [TensorFlow ใใผใใใใฏ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb)ใ
+
+
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๅฅใฎ่จ่ชใซ็ฟป่จณใใใใใญในใใ่ใๅบใใพใใ T5 ใฎๅ ดๅใไฝๆฅญไธญใฎใฟในใฏใซๅฟใใฆๅ
ฅๅใซๆฅ้ ญ่พใไปใใๅฟ
่ฆใใใใพใใ่ฑ่ชใใใใฉใณใน่ชใซ็ฟป่จณใใๅ ดๅใฏใไปฅไธใซ็คบใใใใซๅ
ฅๅใซๆฅ้ ญ่พใไปใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> text = "translate English to French: Legumes share resources with nitrogen-fixing bacteria."
+```
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆ็ฟป่จณ็จใฎ`pipeline`ใใคใณในใฟใณในๅใใใใญในใใใใใซๆธกใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+# Change `xx` to the language of the input and `yy` to the language of the desired output.
+# Examples: "en" for English, "fr" for French, "de" for German, "es" for Spanish, "zh" for Chinese, etc; translation_en_to_fr translates English to French
+# You can view all the lists of languages here - https://huggingface.co/languages
+>>> translator = pipeline("translation_xx_to_yy", model="my_awesome_opus_books_model")
+>>> translator(text)
+[{'translation_text': 'Legumes partagent des ressources avec des bactรฉries azotantes.'}]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline`ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+
+
+
+ใใญในใใใใผใฏใณๅใใ`input_ids` ใ PyTorch ใใณใฝใซใจใใฆ่ฟใใพใใ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_opus_books_model")
+>>> inputs = tokenizer(text, return_tensors="pt").input_ids
+```
+
+[`~generation.GenerationMixin.generate`] ใกใฝใใใไฝฟ็จใใฆ็ฟป่จณใไฝๆใใพใใใใพใใพใชใใญในใ็ๆๆฆ็ฅใจ็ๆใๅถๅพกใใใใใฎใใฉใกใผใฟใผใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Text Generation](../main_classes/text_generation) API ใ็ขบ่ชใใฆใใ ใใใ
+
+
+```py
+>>> from transformers import AutoModelForSeq2SeqLM
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("my_awesome_opus_books_model")
+>>> outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95)
+```
+
+็ๆใใใใใผใฏใณ ID ใใใณใผใใใฆใใญในใใซๆปใใพใใ
+
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'Les lignรฉes partagent des ressources avec des bactรฉries enfixant l'azote.'
+```
+
+
+
+
+`input_ids`ใ TensorFlow ใใณใฝใซใจใใฆ่ฟใใพใใ tensors:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("my_awesome_opus_books_model")
+>>> inputs = tokenizer(text, return_tensors="tf").input_ids
+```
+
+[`~transformers.generation_tf_utils.TFGenerationMixin.generate`] ใกใฝใใใไฝฟ็จใใฆ็ฟป่จณใไฝๆใใพใใใใพใใพใชใใญในใ็ๆๆฆ็ฅใจ็ๆใๅถๅพกใใใใใฎใใฉใกใผใฟใผใฎ่ฉณ็ดฐใซใคใใฆใฏใ[Text Generation](../main_classes/text_generation) API ใ็ขบ่ชใใฆใใ ใใใ
+
+```py
+>>> from transformers import TFAutoModelForSeq2SeqLM
+
+>>> model = TFAutoModelForSeq2SeqLM.from_pretrained("my_awesome_opus_books_model")
+>>> outputs = model.generate(inputs, max_new_tokens=40, do_sample=True, top_k=30, top_p=0.95)
+```
+
+็ๆใใใใใผใฏใณ ID ใใใณใผใใใฆใใญในใใซๆปใใพใใ
+
+```py
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'Les lugumes partagent les ressources avec des bactรฉries fixatrices d'azote.'
+```
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/video_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/video_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..741356a6f5789e5f447d1c360e835fa917d6bf3f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/video_classification.md
@@ -0,0 +1,498 @@
+
+
+# Video classification
+
+[[open-in-colab]]
+
+
+ใใใชๅ้กใฏใใใใชๅ
จไฝใซใฉใใซใพใใฏใฏใฉในใๅฒใๅฝใฆใใฟในใฏใงใใใใใชใซใฏใๅใใใชใซ 1 ใคใฎใฏใฉในใฎใฟใๅซใพใใใใจใๆๅพ
ใใใพใใใใใชๅ้กใขใใซใฏใใใชใๅ
ฅๅใจใใฆๅใๅใใใใใชใใฉใฎใฏใฉในใซๅฑใใใใซใคใใฆใฎไบๆธฌใ่ฟใใพใใใใใใฎใขใใซใไฝฟ็จใใฆใใใใชใฎๅ
ๅฎนใๅ้กใงใใพใใใใใชๅ้กใฎๅฎ้ใฎใขใใชใฑใผใทใงใณใฏใขใฏใทใงใณ/ใขใฏใใฃใใใฃ่ช่ญใงใใใใใฃใใใใน ใขใใชใฑใผใทใงใณใซๅฝน็ซใกใพใใใพใใ่ฆ่ฆ้ๅฎณใฎใใไบบใซใจใฃใฆใ็นใซ้ๅคๆใซๅฝน็ซใกใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใ่ชฌๆใใพใใ
+
+1. [UCF101](https://www.crcv.ucf.edu/) ใฎใตใใปใใใง [VideoMAE](https://huggingface.co/docs/transformers/main/en/model_doc/videomae) ใๅพฎ่ชฟๆดใใพใใ data/UCF101.php) ใใผใฟใปใใใ
+2. ๅพฎ่ชฟๆดใใใขใใซใๆจ่ซใซไฝฟ็จใใพใใ
+
+
+
+ใใฎใฟในใฏใจไบๆๆงใฎใใใในใฆใฎใขใผใญใใฏใใฃใจใใงใใฏใใคใณใใ็ขบ่ชใใใซใฏใ[ใฟในใฏใใผใธ](https://huggingface.co/tasks/video-classification) ใ็ขบ่ชใใใใจใใๅงใใใพใใ
+
+
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+```bash
+pip install -q pytorchvideo transformers evaluate
+```
+
+[PyTorchVideo](https://pytorchvideo.org/) (`pytorchvideo` ใจๅผใฐใใพใ) ใไฝฟ็จใใฆใใใชใๅฆ็ใใๆบๅใใพใใ
+
+ใขใใซใใขใใใญใผใใใฆใณใใฅใใใฃใจๅ
ฑๆใงใใใใใซใHugging Face ใขใซใฆใณใใซใญใฐใคใณใใใใจใใๅงใใใพใใใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+## Load UCF101 dataset
+
+ใพใใ[UCF-101 ใใผใฟใปใใ](https://www.crcv.ucf.edu/data/UCF101.php) ใฎใตใใปใใใใญใผใใใพใใใใใซใใใๅฎๅ
จใชใใผใฟใปใใใฎใใฌใผใใณใฐใซใใใซๆ้ใ่ฒปใใๅใซใๅฎ้จใใฆใในใฆใๆฉ่ฝใใใใจใ็ขบ่ชใใๆฉไผใๅพใใใพใใ
+
+```py
+>>> from huggingface_hub import hf_hub_download
+
+>>> hf_dataset_identifier = "sayakpaul/ucf101-subset"
+>>> filename = "UCF101_subset.tar.gz"
+>>> file_path = hf_hub_download(repo_id=hf_dataset_identifier, filename=filename, repo_type="dataset")
+```
+
+ใตใใปใใใใใฆใณใญใผใใใๅพใๅง็ธฎใขใผใซใคใใๆฝๅบใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> import tarfile
+
+>>> with tarfile.open(file_path) as t:
+... t.extractall(".")
+```
+
+ๅคงใพใใซ่จใใจใใใผใฟใปใใใฏๆฌกใฎใใใซๆงๆใใใฆใใพใใ
+
+```bash
+UCF101_subset/
+ train/
+ BandMarching/
+ video_1.mp4
+ video_2.mp4
+ ...
+ Archery
+ video_1.mp4
+ video_2.mp4
+ ...
+ ...
+ val/
+ BandMarching/
+ video_1.mp4
+ video_2.mp4
+ ...
+ Archery
+ video_1.mp4
+ video_2.mp4
+ ...
+ ...
+ test/
+ BandMarching/
+ video_1.mp4
+ video_2.mp4
+ ...
+ Archery
+ video_1.mp4
+ video_2.mp4
+ ...
+ ...
+```
+
+(`sorted`)ใใใ ใใใช ใในใฏๆฌกใฎใใใซ่กจ็คบใใใพใใ
+
+
+```bash
+...
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g07_c04.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g07_c06.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g08_c01.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g09_c02.avi',
+'UCF101_subset/train/ApplyEyeMakeup/v_ApplyEyeMakeup_g09_c06.avi'
+...
+```
+
+ๅใใฐใซใผใ/ใทใผใณใซๅฑใใใใใช ใฏใชใใใใใใใใใช ใใกใคใซ ใในใงใฏใฐใซใผใใ`g`ใง็คบใใใฆใใใใจใใใใใพใใใใจใใฐใ`v_ApplyEyeMakeup_g07_c04.avi`ใ`v_ApplyEyeMakeup_g07_c06.avi`ใชใฉใงใใ
+
+ๆค่จผใจ่ฉไพกใฎๅๅฒใงใฏใ[ใใผใฟๆผๆดฉ](https://www.kaggle.com/code/alexisbcook/data-leakage) ใ้ฒใใใใซใๅใใฐใซใผใ/ใทใผใณใใใฎใใใช ใฏใชใใใไฝฟ็จใใชใใงใใ ใใใใใฎใใฅใผใใชใขใซใงไฝฟ็จใใฆใใใตใใปใใใงใฏใใใฎๆ
ๅ ฑใ่ๆ
ฎใใใฆใใพใใ
+
+ๆฌกใซใใใผใฟใปใใๅ
ใซๅญๅจใใใฉใใซใฎใปใใใๅๅพใใพใใใพใใใขใใซใๅๆๅใใใจใใซๅฝน็ซใค 2 ใคใฎ่พๆธใไฝๆใใพใใ
+
+* `label2id`: ใฏใฉในๅใๆดๆฐใซใใใใใพใใ
+* `id2label`: ๆดๆฐใใฏใฉในๅใซใใใใณใฐใใพใใ
+
+
+```py
+>>> class_labels = sorted({str(path).split("/")[2] for path in all_video_file_paths})
+>>> label2id = {label: i for i, label in enumerate(class_labels)}
+>>> id2label = {i: label for label, i in label2id.items()}
+
+>>> print(f"Unique classes: {list(label2id.keys())}.")
+
+# Unique classes: ['ApplyEyeMakeup', 'ApplyLipstick', 'Archery', 'BabyCrawling', 'BalanceBeam', 'BandMarching', 'BaseballPitch', 'Basketball', 'BasketballDunk', 'BenchPress'].
+```
+
+ๅๆง็ใชใฏใฉในใ10็จฎ้กใใใพใใใใฌใผใใณใฐ ใปใใใซใฏใใฏใฉในใใจใซ 30 ๅใฎใใใชใใใใพใใ
+
+## Load a model to fine-tune
+
+ไบๅใใฌใผใใณใฐใใใใใงใใฏใใคใณใใจใใใซ้ข้ฃใใ็ปๅใใญใปใใตใใใใใชๅ้กใขใใซใใคใณในใฟใณในๅใใพใใใขใใซใฎใจใณใณใผใใผใซใฏไบๅใใฌใผใใณใฐใใใใใฉใกใผใฟใผใไปๅฑใใฆใใใๅ้กใใใใฏใฉใณใใ ใซๅๆๅใใใพใใ็ปๅใใญใปใใตใฏใใใผใฟใปใใใฎๅๅฆ็ใใคใใฉใคใณใไฝๆใใใจใใซๅฝน็ซใกใพใใ
+
+```py
+>>> from transformers import VideoMAEImageProcessor, VideoMAEForVideoClassification
+
+>>> model_ckpt = "MCG-NJU/videomae-base"
+>>> image_processor = VideoMAEImageProcessor.from_pretrained(model_ckpt)
+>>> model = VideoMAEForVideoClassification.from_pretrained(
+... model_ckpt,
+... label2id=label2id,
+... id2label=id2label,
+... ignore_mismatched_sizes=True, # provide this in case you're planning to fine-tune an already fine-tuned checkpoint
+... )
+```
+
+ใขใใซใฎใญใผใไธญใซใๆฌกใฎ่ญฆๅใ่กจ็คบใใใๅ ดๅใใใใพใใ
+
+```bash
+Some weights of the model checkpoint at MCG-NJU/videomae-base were not used when initializing VideoMAEForVideoClassification: [..., 'decoder.decoder_layers.1.attention.output.dense.bias', 'decoder.decoder_layers.2.attention.attention.key.weight']
+- This IS expected if you are initializing VideoMAEForVideoClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).
+- This IS NOT expected if you are initializing VideoMAEForVideoClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).
+Some weights of VideoMAEForVideoClassification were not initialized from the model checkpoint at MCG-NJU/videomae-base and are newly initialized: ['classifier.bias', 'classifier.weight']
+You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.
+```
+
+ใใฎ่ญฆๅใฏใไธ้จใฎ้ใฟ (ใใจใใฐใ`classifier`ๅฑคใฎ้ใฟใจใใคใขใน) ใ็ ดๆฃใใไปใฎใใใคใใฎ้ใฟ (ๆฐใใ`classifier`ๅฑคใฎ้ใฟใจใใคใขใน) ใใฉใณใใ ใซๅๆๅใใฆใใใใจใ็คบใใฆใใพใใใใฎๅ ดๅใใใใฏไบๆณใใใใใจใงใใไบๅใซใใฌใผใใณใฐใใใ้ใฟใๆใใชใๆฐใใ้ ญ้จใ่ฟฝๅ ใใฆใใใใใๆจ่ซใซไฝฟ็จใใๅใซใใฎใขใใซใๅพฎ่ชฟๆดใใๅฟ
่ฆใใใใจใฉใคใใฉใชใ่ญฆๅใใพใใใใใฏใพใใซ็งใใกใ่กใใใจใใฆใใใใฎใงใใใใใ
+
+**ๆณจๆ** [ใใฎใใงใใฏใใคใณใ](https://huggingface.co/MCG-NJU/videomae-base-finetuned-kinetics) ใฏใๅๆงใฎใใฆใณในใใชใผใ ใงๅพฎ่ชฟๆดใใใฆใใงใใฏใใคใณใใๅๅพใใใใใใใใฎใฟในใฏใฎใใใฉใผใใณในใๅไธใใใใจใซๆณจๆใใฆใใ ใใใใใชใใฎใใกใคใณใฎ้่คใใใใฟในใฏใ `MCG-NJU/videomae-base-finetuned-kinetics` ใๅพฎ่ชฟๆดใใฆๅๅพใใ [ใใฎใใงใใฏใใคใณใ](https://huggingface.co/sayakpaul/videomae-base-finetuned-kinetics-finetuned-ucf101-subset) ใ็ขบ่ชใงใใพใใ -ใญใใใฃใฏใน`ใ
+
+## Prepare the datasets for training
+
+ใใใชใฎๅๅฆ็ใซใฏใ[PyTorchVideo ใฉใคใใฉใช](https://pytorchvideo.org/) ใๅฉ็จใใพใใใพใใๅฟ
่ฆใชไพๅญ้ขไฟใใคใณใใผใใใพใใ
+
+
+```py
+>>> import pytorchvideo.data
+
+>>> from pytorchvideo.transforms import (
+... ApplyTransformToKey,
+... Normalize,
+... RandomShortSideScale,
+... RemoveKey,
+... ShortSideScale,
+... UniformTemporalSubsample,
+... )
+
+>>> from torchvision.transforms import (
+... Compose,
+... Lambda,
+... RandomCrop,
+... RandomHorizontalFlip,
+... Resize,
+... )
+```
+
+ใใฌใผใใณใฐ ใใผใฟใปใใใฎๅคๆใซใฏใๅไธใชๆ้ใตใใตใณใใชใณใฐใใใฏใปใซๆญฃ่ฆๅใใฉใณใใ ใฏใญใใใณใฐใใใใณใฉใณใใ ใชๆฐดๅนณๅ่ปขใ็ตใฟๅใใใฆไฝฟ็จโโใใพใใๆค่จผใใใณ่ฉไพกใฎใใผใฟใปใใๅคๆใงใฏใใฉใณใใ ใชใใชใใณใฐใจๆฐดๅนณๅ่ปขใ้คใใๅใๅคๆใใงใผใณใ็ถญๆใใพใใใใใใฎๅคๆใฎ่ฉณ็ดฐใซใคใใฆใฏใ[PyTorchVideo ใฎๅ
ฌๅผใใญใฅใกใณใ](https://pytorchvideo.org) ใๅ็
งใใฆใใ ใใใ
+
+ไบๅใใฌใผใใณใฐใใใใขใใซใซ้ข้ฃไปใใใใ`image_processor`ใไฝฟ็จใใฆใๆฌกใฎๆ
ๅ ฑใๅๅพใใพใใ
+
+* ใใใช ใใฌใผใ ใฎใใฏใปใซใๆญฃ่ฆๅใใใ็ปๅใฎๅนณๅๅคใจๆจๆบๅๅทฎใ
+* ใใใช ใใฌใผใ ใฎใตใคใบใๅคๆดใใใ็ฉบ้่งฃๅๅบฆใ
+
+ใพใใใใใคใใฎๅฎๆฐใๅฎ็พฉใใพใใ
+
+```py
+>>> mean = image_processor.image_mean
+>>> std = image_processor.image_std
+>>> if "shortest_edge" in image_processor.size:
+... height = width = image_processor.size["shortest_edge"]
+>>> else:
+... height = image_processor.size["height"]
+... width = image_processor.size["width"]
+>>> resize_to = (height, width)
+
+>>> num_frames_to_sample = model.config.num_frames
+>>> sample_rate = 4
+>>> fps = 30
+>>> clip_duration = num_frames_to_sample * sample_rate / fps
+```
+
+ๆฌกใซใใใผใฟใปใใๅบๆใฎๅคๆใจใใผใฟใปใใใใใใใๅฎ็พฉใใพใใใใฌใผใใณใฐใปใใใใๅงใใพใ:
+
+
+```py
+>>> train_transform = Compose(
+... [
+... ApplyTransformToKey(
+... key="video",
+... transform=Compose(
+... [
+... UniformTemporalSubsample(num_frames_to_sample),
+... Lambda(lambda x: x / 255.0),
+... Normalize(mean, std),
+... RandomShortSideScale(min_size=256, max_size=320),
+... RandomCrop(resize_to),
+... RandomHorizontalFlip(p=0.5),
+... ]
+... ),
+... ),
+... ]
+... )
+
+>>> train_dataset = pytorchvideo.data.Ucf101(
+... data_path=os.path.join(dataset_root_path, "train"),
+... clip_sampler=pytorchvideo.data.make_clip_sampler("random", clip_duration),
+... decode_audio=False,
+... transform=train_transform,
+... )
+```
+
+ๅใไธ้ฃใฎใฏใผใฏใใญใผใๆค่จผใปใใใจ่ฉไพกใปใใใซ้ฉ็จใงใใพใใ
+
+
+```py
+>>> val_transform = Compose(
+... [
+... ApplyTransformToKey(
+... key="video",
+... transform=Compose(
+... [
+... UniformTemporalSubsample(num_frames_to_sample),
+... Lambda(lambda x: x / 255.0),
+... Normalize(mean, std),
+... Resize(resize_to),
+... ]
+... ),
+... ),
+... ]
+... )
+
+>>> val_dataset = pytorchvideo.data.Ucf101(
+... data_path=os.path.join(dataset_root_path, "val"),
+... clip_sampler=pytorchvideo.data.make_clip_sampler("uniform", clip_duration),
+... decode_audio=False,
+... transform=val_transform,
+... )
+
+>>> test_dataset = pytorchvideo.data.Ucf101(
+... data_path=os.path.join(dataset_root_path, "test"),
+... clip_sampler=pytorchvideo.data.make_clip_sampler("uniform", clip_duration),
+... decode_audio=False,
+... transform=val_transform,
+... )
+```
+
+**ๆณจๆ**: ไธ่จใฎใใผใฟใปใใ ใใคใใฉใคใณใฏใ[ๅ
ฌๅผ PyTorchVideo ใตใณใใซ](https://pytorchvideo.org/docs/tutorial_classification#dataset) ใใๅๅพใใใใฎใงใใ [`pytorchvideo.data.Ucf101()`](https://pytorchvideo.readthedocs.io/en/latest/api/data/data.html#pytorchvideo.data.Ucf101) ้ขๆฐใไฝฟ็จใใฆใใพใใ UCF-101 ใใผใฟใปใใใๅ
้จใงใฏใ[`pytorchvideo.data.labeled_video_dataset.LabeledVideoDataset`](https://pytorchvideo.readthedocs.io/en/latest/api/data/data.html#pytorchvideo.data.LabeledVideoDataset) ใชใใธใงใฏใใ่ฟใใพใใ `LabeledVideoDataset` ใฏใฉในใฏใPyTorchVideo ใใผใฟใปใใๅ
ใฎใในใฆใฎใใใชใฎๅบๆฌใฏใฉในใงใใใใใใฃใฆใPyTorchVideo ใงๆข่ฃฝใงใตใใผใใใใฆใใชใใซในใฟใ ใใผใฟใปใใใไฝฟ็จใใใๅ ดๅใฏใใใใซๅฟใใฆ `LabeledVideoDataset` ใฏใฉในใๆกๅผตใงใใพใใ่ฉณ็ดฐใซใคใใฆใฏใ`data`API [ใใญใฅใกใณใ](https://pytorchvideo.readthedocs.io/en/latest/api/data/data.html)ใๅ็
งใใฆใใ ใใใใพใใใใผใฟใปใใใๅๆงใฎๆง้ (ไธใซ็คบใใใใฎ) ใซๅพใฃใฆใใๅ ดๅใฏใ`pytorchvideo.data.Ucf101()` ใไฝฟ็จใใใจๅ้กใชใๅไฝใใใฏใใงใใ
+
+`num_videos` ๅผๆฐใซใขใฏใปในใใใจใใใผใฟใปใใๅ
ใฎใใใชใฎๆฐใ็ฅใใใจใใงใใพใใ
+
+
+
+```py
+>>> print(train_dataset.num_videos, val_dataset.num_videos, test_dataset.num_videos)
+# (300, 30, 75)
+```
+
+## Visualize the preprocessed video for better debugging
+
+```py
+>>> import imageio
+>>> import numpy as np
+>>> from IPython.display import Image
+
+>>> def unnormalize_img(img):
+... """Un-normalizes the image pixels."""
+... img = (img * std) + mean
+... img = (img * 255).astype("uint8")
+... return img.clip(0, 255)
+
+>>> def create_gif(video_tensor, filename="sample.gif"):
+... """Prepares a GIF from a video tensor.
+...
+... The video tensor is expected to have the following shape:
+... (num_frames, num_channels, height, width).
+... """
+... frames = []
+... for video_frame in video_tensor:
+... frame_unnormalized = unnormalize_img(video_frame.permute(1, 2, 0).numpy())
+... frames.append(frame_unnormalized)
+... kargs = {"duration": 0.25}
+... imageio.mimsave(filename, frames, "GIF", **kargs)
+... return filename
+
+>>> def display_gif(video_tensor, gif_name="sample.gif"):
+... """Prepares and displays a GIF from a video tensor."""
+... video_tensor = video_tensor.permute(1, 0, 2, 3)
+... gif_filename = create_gif(video_tensor, gif_name)
+... return Image(filename=gif_filename)
+
+>>> sample_video = next(iter(train_dataset))
+>>> video_tensor = sample_video["video"]
+>>> display_gif(video_tensor)
+```
+
+
+
+
+
+## Train the model
+
+๐ค Transformers ใฎ [`Trainer`](https://huggingface.co/docs/transformers/main_classes/trainer) ใใขใใซใฎใใฌใผใใณใฐใซๅฉ็จใใพใใ `Trainer`ใใคใณในใฟใณในๅใใใซใฏใใใฌใผใใณใฐๆงๆใจ่ฉไพกใกใใชใฏในใๅฎ็พฉใใๅฟ
่ฆใใใใพใใๆใ้่ฆใชใฎใฏ [`TrainingArguments`](https://huggingface.co/transformers/main_classes/trainer.html#transformers.TrainingArguments) ใงใใใใฏใใฌใผใใณใฐใๆงๆใใใใใฎใในใฆใฎๅฑๆงใๅซใใฏใฉในใงใใใขใใซใฎใใงใใฏใใคใณใใไฟๅญใใใใใซไฝฟ็จใใใๅบๅใใฉใซใใผๅใๅฟ
่ฆใงใใใพใใ๐ค Hub ไธใฎใขใใซ ใชใใธใใชๅ
ใฎใในใฆใฎๆ
ๅ ฑใๅๆใใใฎใซใๅฝน็ซใกใพใใ
+
+ใใฌใผใใณใฐๅผๆฐใฎใปใจใใฉใฏไธ็ฎ็ญ็ถใงใใใใใใง้ๅธธใซ้่ฆใชใฎใฏ`remove_unused_columns=False`ใงใใใใใซใใใใขใใซใฎๅผใณๅบใ้ขๆฐใงไฝฟ็จใใใชใๆฉ่ฝใๅ้คใใใพใใใใใฉใซใใงใฏ`True`ใงใใใใใฏใ้ๅธธใๆชไฝฟ็จใฎ็นๅพดๅใๅ้คใใใขใใซใฎๅผใณๅบใ้ขๆฐใธใฎๅ
ฅๅใ่งฃๅใใใใใใใใจใ็ๆณ็ใงใใใใใงใใใใ ใใใใฎๅ ดๅใ`pixel_values` (ใขใใซใๅ
ฅๅใงๆๅพ
ใใๅฟ
้ ใญใผใงใ) ใไฝๆใใใซใฏใๆชไฝฟ็จใฎๆฉ่ฝ (็นใซ`video`) ใๅฟ
่ฆใงใใ
+
+```py
+>>> from transformers import TrainingArguments, Trainer
+
+>>> model_name = model_ckpt.split("/")[-1]
+>>> new_model_name = f"{model_name}-finetuned-ucf101-subset"
+>>> num_epochs = 4
+
+>>> args = TrainingArguments(
+... new_model_name,
+... remove_unused_columns=False,
+... eval_strategy="epoch",
+... save_strategy="epoch",
+... learning_rate=5e-5,
+... per_device_train_batch_size=batch_size,
+... per_device_eval_batch_size=batch_size,
+... warmup_ratio=0.1,
+... logging_steps=10,
+... load_best_model_at_end=True,
+... metric_for_best_model="accuracy",
+... push_to_hub=True,
+... max_steps=(train_dataset.num_videos // batch_size) * num_epochs,
+... )
+```
+
+`pytorchvideo.data.Ucf101()` ใซใใฃใฆ่ฟใใใใใผใฟใปใใใฏ `__len__` ใกใฝใใใๅฎ่ฃ
ใใฆใใพใใใใใฎใใใ`TrainingArguments`ใใคใณในใฟใณในๅใใใจใใซ`max_steps`ใๅฎ็พฉใใๅฟ
่ฆใใใใพใใ
+
+ๆฌกใซใไบๆธฌใใใกใใชใฏในใ่จ็ฎใใ้ขๆฐใๅฎ็พฉใใๅฟ
่ฆใใใใพใใใใใฏใใใใใใญใผใใใ`metric`ใไฝฟ็จใใพใใๅฟ
่ฆใชๅๅฆ็ใฏใไบๆธฌใใใใญใธใใใฎ argmax ใๅๅพใใใใจใ ใใงใใ
+
+```py
+import evaluate
+
+metric = evaluate.load("accuracy")
+
+
+def compute_metrics(eval_pred):
+ predictions = np.argmax(eval_pred.predictions, axis=1)
+ return metric.compute(predictions=predictions, references=eval_pred.label_ids)
+```
+
+**่ฉไพกใซ้ขใใๆณจๆไบ้
**:
+
+[VideoMAE ่ซๆ](https://arxiv.org/abs/2203.12602) ใงใฏใ่่
ใฏๆฌกใฎ่ฉไพกๆฆ็ฅใไฝฟ็จใใฆใใพใใๅฝผใใฏใในใ ใใใชใใใฎใใใคใใฎใฏใชใใใงใขใใซใ่ฉไพกใใใใใใฎใฏใชใใใซใใพใใพใชใฏใญใใใ้ฉ็จใใฆใๅ่จในใณใขใๅ ฑๅใใพใใใใ ใใๅ็ดใใจ็ฐกๆฝใใไฟใคใใใซใใใฎใใฅใผใใชใขใซใงใฏใใใ่ๆ
ฎใใพใใใ
+
+ใพใใใตใณใใซใใพใจใใฆใใใๅฆ็ใใใใใซไฝฟ็จใใใ `collatโโe_fn` ใๅฎ็พฉใใพใใๅใใใใฏใ`pixel_values` ใจ `labels` ใจใใ 2 ใคใฎใญใผใงๆงๆใใใพใใ
+
+
+```py
+>>> def collate_fn(examples):
+... # permute to (num_frames, num_channels, height, width)
+... pixel_values = torch.stack(
+... [example["video"].permute(1, 0, 2, 3) for example in examples]
+... )
+... labels = torch.tensor([example["label"] for example in examples])
+... return {"pixel_values": pixel_values, "labels": labels}
+```
+
+ๆฌกใซใใใใใในใฆใใใผใฟใปใใใจใจใใซ`Trainer`ใซๆธกใใ ใใงใใ
+
+```py
+>>> trainer = Trainer(
+... model,
+... args,
+... train_dataset=train_dataset,
+... eval_dataset=val_dataset,
+... processing_class=image_processor,
+... compute_metrics=compute_metrics,
+... data_collator=collate_fn,
+... )
+```
+
+ใใงใซใใผใฟใๅๅฆ็ใใฆใใใฎใซใใชใใใผใฏใใคใถใผใจใใฆ`image_processor`ใๆธกใใใฎใไธๆ่ญฐใซๆใใใใใใพใใใใใใฏใใคใกใผใธ ใใญใปใใตๆงๆใใกใคใซ (JSON ใจใใฆไฟๅญ) ใใใไธใฎใชใใธใใชใซใขใใใญใผใใใใใใใซใใใใใ ใใงใใ
+
+ๆฌกใซใ`train` ใกใฝใใใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> train_results = trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~transformers.Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ่ชฐใใใขใใซใไฝฟ็จใงใใใใใซใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+ใขใใซใๅพฎ่ชฟๆดใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใใใใซใชใใพใใใ
+
+ๆจ่ซใฎใใใซใใใชใใญใผใใใพใใ
+
+```py
+>>> sample_test_video = next(iter(test_dataset))
+```
+
+
+
+
+
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใใใใ [`pipeline`](https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.VideoClassificationPipeline). ใงไฝฟ็จใใใใจใงใใใขใใซใไฝฟ็จใใฆใใใชๅ้ก็จใฎ` pipeline`ใใคใณในใฟใณในๅใใใใใซใใใชใๆธกใใพใใ
+
+
+```py
+>>> from transformers import pipeline
+
+>>> video_cls = pipeline(model="my_awesome_video_cls_model")
+>>> video_cls("https://huggingface.co/datasets/sayakpaul/ucf101-subset/resolve/main/v_BasketballDunk_g14_c06.avi")
+[{'score': 0.9272987842559814, 'label': 'BasketballDunk'},
+ {'score': 0.017777055501937866, 'label': 'BabyCrawling'},
+ {'score': 0.01663011871278286, 'label': 'BalanceBeam'},
+ {'score': 0.009560945443809032, 'label': 'BandMarching'},
+ {'score': 0.0068979403004050255, 'label': 'BaseballPitch'}]
+```
+
+ๅฟ
่ฆใซๅฟใใฆใ`pipeline`ใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+
+```py
+>>> def run_inference(model, video):
+... # (num_frames, num_channels, height, width)
+... perumuted_sample_test_video = video.permute(1, 0, 2, 3)
+... inputs = {
+... "pixel_values": perumuted_sample_test_video.unsqueeze(0),
+... "labels": torch.tensor(
+... [sample_test_video["label"]]
+... ), # this can be skipped if you don't have labels available.
+... }
+
+... device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
+... inputs = {k: v.to(device) for k, v in inputs.items()}
+... model = model.to(device)
+
+... # forward pass
+... with torch.no_grad():
+... outputs = model(**inputs)
+... logits = outputs.logits
+
+... return logits
+```
+
+ๆฌกใซใๅ
ฅๅใใขใใซใซๆธกใใ`logits `ใ่ฟใใพใใ
+
+```py
+>>> logits = run_inference(trained_model, sample_test_video["video"])
+```
+
+`logits` ใใใณใผใใใใจใๆฌกใฎใใใซใชใใพใใ
+
+```py
+>>> predicted_class_idx = logits.argmax(-1).item()
+>>> print("Predicted class:", model.config.id2label[predicted_class_idx])
+# Predicted class: BasketballDunk
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/visual_question_answering.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/visual_question_answering.md
new file mode 100644
index 0000000000000000000000000000000000000000..3231cba5e3af718e47adab6c3f48847a5d3761f7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/visual_question_answering.md
@@ -0,0 +1,405 @@
+
+
+# Visual Question Answering
+
+[[open-in-colab]]
+
+Visual Question Answering (VQA) ใฏใ็ปๅใซๅบใฅใใฆ่ช็ฑๅฝขๅผใฎ่ณชๅใซ็ญใใใฟในใฏใงใใ
+ใใฎใฟในใฏใใตใใผใใใใขใใซใธใฎๅ
ฅๅใฏ้ๅธธใ็ปๅใจ่ณชๅใฎ็ตใฟๅใใใงใใใๅบๅใฏ
+่ช็ถ่จ่ชใง่กจ็พใใใ็ญใใ
+
+VQA ใฎๆณจ็ฎใในใไฝฟ็จไพใซใฏๆฌกใฎใใใชใใฎใใใใพใใ
+* ่ฆ่ฆ้ๅฎณ่
ๅใใฎใขใฏใปใทใใชใใฃ ใขใใชใฑใผใทใงใณใ
+* ๆ่ฒ: ่ฌ็พฉใๆ็งๆธใง็คบใใใฆใใ่ฆ่ฆ็ใช่ณๆใซใคใใฆ่ณชๅใๆใใใใใใจใ VQA ใฏใใคใณใฟใฉใฏใใฃใใชๅ็ฉ้คจใฎๅฑ็คบ็ฉใๅฒ่ทกใงใๅฉ็จใงใใพใใ
+* ใซในใฟใใผ ใตใผใในใจ้ปๅญๅๅๅผ: VQA ใฏใใฆใผใถใผใ่ฃฝๅใซใคใใฆ่ณชๅใงใใใใใซใใใใจใงใฆใผใถใผ ใจใฏในใใชใจใณในใๅไธใใใพใใ
+* ็ปๅๆค็ดข: VQA ใขใใซใไฝฟ็จใใฆใ็นๅฎใฎ็นๅพดใๆใค็ปๅใๆค็ดขใงใใพใใใใจใใฐใใฆใผใถใผใฏใ็ฌใฏใใพใใ?ใใจๅฐใญใใใจใใงใใพใใไธ้ฃใฎ็ปๅใใ็ฌใๅใฃใฆใใใในใฆใฎ็ปๅใๆค็ดขใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใๅญฆใณใพใใ
+
+- [`Graphcore/vqa` ใใผใฟใปใใ](https://huggingface.co/datasets/Graphcore/vqa) ไธใงๅ้ก VQA ใขใใซใ็นใซ [ViLT](../model_doc/vilt) ใๅพฎ่ชฟๆดใใพใใ
+- ๅพฎ่ชฟๆดใใใ ViLT ใๆจ่ซใซไฝฟ็จใใพใใ
+- BLIP-2 ใชใฉใฎ็ๆใขใใซใไฝฟ็จใใฆใผใญใทใงใใ VQA ๆจ่ซใๅฎ่กใใพใใ
+
+## Fine-tuning ViLT
+
+ViLT ใขใใซใฏใVision Transformer (ViT) ใซใใญในใๅใ่พผใฟใ็ตใฟ่พผใใงใใใๆๅฐ้ใฎ่จญ่จใๅฏ่ฝใซใใพใใ
+่ฆ่ฆใจ่จ่ชใฎไบๅใใฌใผใใณใฐ (VLP)ใใใฎใขใใซใฏใใใใคใใฎไธๆตใฟในใฏใซไฝฟ็จใงใใพใใ VQA ใฟในใฏใฎๅ ดๅใๅ้กๅญ
+head ใฏๆไธ้จ (`[CLS]` ใใผใฏใณใฎๆ็ต็ใช้่กจ็คบ็ถๆ
ใฎๆไธ้จใซใใ็ทๅฝขๅฑค) ใซ้
็ฝฎใใใใฉใณใใ ใซๅๆๅใใใพใใ
+ใใใใฃใฆใ่ฆ่ฆ็่ณชๅๅฟ็ญใฏ **ๅ้กๅ้ก** ใจใใฆๆฑใใใพใใ
+
+BLIPใBLIP-2ใInstructBLIP ใชใฉใฎๆ่ฟใฎใขใใซใฏใVQA ใ็ๆใฟในใฏใจใใฆๆฑใใพใใใใฎใฌใคใใฎๅพๅใงใฏใ
+ใผใญใทใงใใ VQA ๆจ่ซใซใใใใไฝฟ็จใใๆนๆณใ็คบใใพใใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install -q transformers datasets
+```
+ใขใใซใใณใใฅใใใฃใจๅ
ฑๆใใใใจใใๅงใใใพใใ Hugging Face ใขใซใฆใณใใซใญใฐใคใณใใฆใ๐ค ใใใซใขใใใญใผใใใพใใ
+ใใญใณใใใ่กจ็คบใใใใใใใผใฏใณใๅ
ฅๅใใฆใญใฐใคใณใใพใใ
+
+```py
+>>> from huggingface_hub import notebook_login
+
+>>> notebook_login()
+```
+
+ใขใใซใฎใใงใใฏใใคใณใใใฐใญใผใใซๅคๆฐใจใใฆๅฎ็พฉใใพใใใใ
+
+```py
+>>> model_checkpoint = "dandelin/vilt-b32-mlm"
+```
+
+## Load the data
+
+่ชฌๆใฎ็ฎ็ใงใใใฎใฌใคใใงใฏใๆณจ้ไปใใฎ่ฆ่ฆ็ใช่ณชๅใซ็ญใใใGraphcore/vqaใใใผใฟใปใใใฎ้ๅธธใซๅฐใใชใตใณใใซใไฝฟ็จใใพใใ
+ๅฎๅ
จใชใใผใฟใปใใใฏ [๐ค Hub](https://huggingface.co/datasets/Graphcore/vqa) ใง่ฆใคใใใใจใใงใใพใใ
+
+[`Graphcore/vqa` ใใผใฟใปใใ](https://huggingface.co/datasets/Graphcore/vqa) ใฎไปฃใใใซใ
+ๅ
ฌๅผ [VQA ใใผใฟใปใใ ใใผใธ](https://visualqa.org/download.html) ใใๅใใใผใฟใๆๅใงๅๅพใใพใใใใฉใญใผใใใๅ ดๅใฏใ
+ใซในใฟใ ใใผใฟใไฝฟ็จใใใใฅใผใใชใขใซใงใฏใ[็ปๅใใผใฟใปใใใไฝๆใใ](https://huggingface.co/docs/datasets/image_dataset#loading-script) ๆนๆณใ็ขบ่ชใใฆใใ ใใใ
+๐ค ใใผใฟใปใใใฎใใญใฅใกใณใใฎใฌใคใใ
+
+ๆค่จผๅๅฒใใๆๅใฎ 200 ๅใฎไพใใญใผใใใใใผใฟใปใใใฎๆฉ่ฝใ่ชฟในใฆใฟใพใใใใ
+
+```python
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("Graphcore/vqa", split="validation[:200]")
+>>> dataset
+Dataset({
+ features: ['question', 'question_type', 'question_id', 'image_id', 'answer_type', 'label'],
+ num_rows: 200
+})
+```
+ใใผใฟใปใใใฎ็นๅพดใ็่งฃใใใใใซไพใ่ฆใฆใฟใพใใใใ
+
+```py
+>>> dataset[0]
+{'question': 'Where is he looking?',
+ 'question_type': 'none of the above',
+ 'question_id': 262148000,
+ 'image_id': '/root/.cache/huggingface/datasets/downloads/extracted/ca733e0e000fb2d7a09fbcc94dbfe7b5a30750681d0e965f8e0a23b1c2f98c75/val2014/COCO_val2014_000000262148.jpg',
+ 'answer_type': 'other',
+ 'label': {'ids': ['at table', 'down', 'skateboard', 'table'],
+ 'weights': [0.30000001192092896,
+ 1.0,
+ 0.30000001192092896,
+ 0.30000001192092896]}}
+```
+
+ใใฎใฟในใฏใซ้ข้ฃใใๆฉ่ฝใซใฏๆฌกใฎใใฎใใใใพใใ
+* `question`: ็ปๅใใๅ็ญใใ่ณชๅ
+* `image_id`: ่ณชๅใๅ็
งใใ็ปๅใธใฎใใน
+* `label`: ๆณจ้
+
+ๆฎใใฎๆฉ่ฝใฏๅฟ
่ฆใชใใฎใงๅ้คใงใใพใใ
+
+
+```py
+>>> dataset = dataset.remove_columns(['question_type', 'question_id', 'answer_type'])
+```
+
+ใ่ฆงใฎใจใใใ`label`ๆฉ่ฝใซใฏใใใพใใพใชใใฅใผใใณใปใขใใใผใฟใผใซใใฃใฆๅ้ใใใใๅใ่ณชๅใซๅฏพใใ่คๆฐใฎๅ็ญ (ใใใงใฏ`id`ใจๅผใณใพใ) ใๅซใพใใฆใใพใใ
+่ณชๅใซๅฏพใใ็ญใใฏไธป่ฆณ็ใชใใฎใซใชใๅฏ่ฝๆงใใใใใใงใใใใฎๅ ดๅใๅ้กใฏ "ๅฝผใฏใฉใใ่ฆใฆใใใฎใ๏ผ"ใจใใใใจใงใใไธ้จใฎไบบใ
+ใใใซใฏ "ใใฆใณ" ใจใใๆณจ้ใไปใใใใไปใฎใใฎใซใฏ "ใใผใใซใง" ใจใใๆณจ้ใไปใใใใๅฅใฎๆณจ้ใซใฏ "ในใฑใผใใใผใ" ใจใใๆณจ้ใไปใใใใพใใใ
+
+็ปๅใ่ฆใฆใใฉใฎ็ญใใๅบใใใ่ใใฆใใ ใใใ
+
+```python
+>>> from PIL import Image
+
+>>> image = Image.open(dataset[0]['image_id'])
+>>> image
+```
+
+
+
+
+
+
+่ณชๅใจๅ็ญใฎใใใพใใใฎใใใใใฎใใใชใใผใฟใปใใใฏใใซใใฉใใซๅ้กๅ้กใจใใฆๆฑใใใพใ (
+่คๆฐใฎๅ็ญใๆๅนใงใใๅฏ่ฝๆงใใใใพใ)ใใใใซใใฏใณใใใ ใจใณใณใผใใใใใใฏใใซใไฝๆใใใ ใใงใฏใชใใ
+ๆณจ้ๅ
ใซ็นๅฎใฎๅ็ญใๅบ็พใใๅๆฐใซๅบใฅใใฝใใ ใจใณใณใผใใฃใณใฐใ
+
+ใใจใใฐใไธใฎไพใงใฏใ"down"ใจใใๅ็ญใไปใฎๅ็ญใใใ้ ป็นใซ้ธๆใใใใใใ
+ในใณใข (ใใผใฟใปใใใงใฏ`weight`ใจๅผใฐใใพใ) ใฏ 1.0 ใงใๆฎใใฎๅ็ญใฎในใณใขใฏ 1.0 ๆชๆบใงใใ
+
+ๅพใง้ฉๅใชๅ้กใใใใไฝฟ็จใใฆใขใใซใใคใณในใฟใณในๅใใใใใซใ2 ใคใฎ่พๆธใไฝๆใใพใใใใ
+ใฉใใซๅใๆดๆฐใซๅคๆใใใใพใใฏใใฎ้:
+
+```py
+>>> import itertools
+
+>>> labels = [item['ids'] for item in dataset['label']]
+>>> flattened_labels = list(itertools.chain(*labels))
+>>> unique_labels = list(set(flattened_labels))
+
+>>> label2id = {label: idx for idx, label in enumerate(unique_labels)}
+>>> id2label = {idx: label for label, idx in label2id.items()}
+```
+
+ใใใใณใฐใใงใใใฎใงใๆๅญๅใฎๅ็ญใใใฎ ID ใซ็ฝฎใๆใใใใใซๅๅฆ็ใใใไพฟๅฉใซใใใใใซใใผใฟใปใใใใใฉใใๅใใใใจใใงใใพใใ
+
+```python
+>>> def replace_ids(inputs):
+... inputs["label"]["ids"] = [label2id[x] for x in inputs["label"]["ids"]]
+... return inputs
+
+
+>>> dataset = dataset.map(replace_ids)
+>>> flat_dataset = dataset.flatten()
+>>> flat_dataset.features
+{'question': Value(dtype='string', id=None),
+ 'image_id': Value(dtype='string', id=None),
+ 'label.ids': Sequence(feature=Value(dtype='int64', id=None), length=-1, id=None),
+ 'label.weights': Sequence(feature=Value(dtype='float64', id=None), length=-1, id=None)}
+```
+
+## Preprocessing data
+
+ๆฌกใฎในใใใใงใฏใViLT ใใญใปใใตใใญใผใใใฆใใขใใซใฎ็ปๅใใผใฟใจใใญในใ ใใผใฟใๆบๅใใพใใ
+[`ViltProcessor`] ใฏใBERT ใใผใฏใใคใถใผใจ ViLT ็ปๅใใญใปใใตใไพฟๅฉใชๅไธใใญใปใใตใซใฉใใใใพใใ
+
+```py
+>>> from transformers import ViltProcessor
+
+>>> processor = ViltProcessor.from_pretrained(model_checkpoint)
+```
+
+ใใผใฟใๅๅฆ็ใใใซใฏใ[`ViltProcessor`] ใไฝฟ็จใใฆ็ปๅใจ่ณชๅใใจใณใณใผใใใๅฟ
่ฆใใใใพใใใใญใปใใตใผใฏไฝฟ็จใใพใ
+[`BertTokenizerFast`] ใไฝฟ็จใใฆใใญในใใใใผใฏใณๅใใใใญในใ ใใผใฟใฎ `input_ids`ใ`attention_mask`ใใใใณ `token_type_ids` ใไฝๆใใพใใ
+็ปๅใซ้ขใใฆใฏใใใญใปใใตใฏ [`ViltImageProcessor`] ใๅฉ็จใใฆ็ปๅใฎใตใคใบๅคๆดใจๆญฃ่ฆๅใ่กใใ`pixel_values` ใจ `pixel_mask` ใไฝๆใใพใใ
+
+ใใใใฎๅๅฆ็ในใใใใฏใในใฆๅ
้จใง่กใใใ`processor`ใๅผใณๅบใใ ใใงๆธใฟใพใใใใ ใใใใใงใๅฟ
่ฆใชใฎใฏใ
+ๅฏพ่ฑกใฎใฉใใซใๆบๅใใพใใใใฎ่กจ็พใงใฏใๅ่ฆ็ด ใฏ่ใใใใ็ญใ (ใฉใใซ) ใซๅฏพๅฟใใพใใๆญฃ่งฃใฎๅ ดๅใ่ฆ็ด ใฏไฟๆใใใพใใ
+ใใใใใฎในใณใข (้ใฟ) ใ่จญๅฎใใใๆฎใใฎ่ฆ็ด ใฏ 0 ใซ่จญๅฎใใใพใใ
+
+ๆฌกใฎ้ขๆฐใฏใ็ปๅใจ่ณชๅใซ `processor` ใ้ฉ็จใใไธใง่ชฌๆใใใใใซใฉใใซใใใฉใผใใใใใพใใ
+
+```py
+>>> import torch
+
+>>> def preprocess_data(examples):
+... image_paths = examples['image_id']
+... images = [Image.open(image_path) for image_path in image_paths]
+... texts = examples['question']
+
+... encoding = processor(images, texts, padding="max_length", truncation=True, return_tensors="pt")
+
+... for k, v in encoding.items():
+... encoding[k] = v.squeeze()
+
+... targets = []
+
+... for labels, scores in zip(examples['label.ids'], examples['label.weights']):
+... target = torch.zeros(len(id2label))
+
+... for label, score in zip(labels, scores):
+... target[label] = score
+
+... targets.append(target)
+
+... encoding["labels"] = targets
+
+... return encoding
+```
+
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใใซใฏใ๐ค Datasets [`~datasets.map`] ้ขๆฐใไฝฟ็จใใพใใ `map` ใ้ซ้ๅใใใซใฏใๆฌกใฎใใใซใใพใใ
+ใใผใฟใปใใใฎ่คๆฐใฎ่ฆ็ด ใไธๅบฆใซๅฆ็ใใใซใฏใ`batched=True` ใ่จญๅฎใใพใใใใฎๆ็นใงใไธ่ฆใชๅใฏ่ช็ฑใซๅ้คใใฆใใ ใใใ
+
+
+```py
+>>> processed_dataset = flat_dataset.map(preprocess_data, batched=True, remove_columns=['question','question_type', 'question_id', 'image_id', 'answer_type', 'label.ids', 'label.weights'])
+>>> processed_dataset
+Dataset({
+ features: ['input_ids', 'token_type_ids', 'attention_mask', 'pixel_values', 'pixel_mask', 'labels'],
+ num_rows: 200
+})
+```
+
+ๆๅพใฎในใใใใจใใฆใ[`DefaultDataCollatโโor`] ใไฝฟ็จใใฆใตใณใใซใฎใใใใไฝๆใใพใใ
+
+
+```py
+>>> from transformers import DefaultDataCollator
+
+>>> data_collator = DefaultDataCollator()
+```
+
+## Train the model
+
+ใใใงใขใใซใฎใใฌใผใใณใฐใ้ๅงใใๆบๅใๆดใใพใใใ [`ViltForQuestionAnswering`] ใง ViLT ใใญใผใใใพใใใฉใใซใฎๆฐใๆๅฎใใพใ
+ใฉใใซใใใใณใฐใจใจใใซ:
+
+```py
+>>> from transformers import ViltForQuestionAnswering
+
+>>> model = ViltForQuestionAnswering.from_pretrained(model_checkpoint, num_labels=len(id2label), id2label=id2label, label2id=label2id)
+```
+
+ใใฎๆ็นใงๆฎใฃใฆใใในใใใใฏ 3 ใคใ ใใงใใ
+
+1. [`TrainingArguments`] ใงใใฌใผใใณใฐ ใใคใใผใใฉใกใผใฟใๅฎ็พฉใใพใใ
+
+```py
+>>> from transformers import TrainingArguments
+
+>>> repo_id = "MariaK/vilt_finetuned_200"
+
+>>> training_args = TrainingArguments(
+... output_dir=repo_id,
+... per_device_train_batch_size=4,
+... num_train_epochs=20,
+... save_steps=200,
+... logging_steps=50,
+... learning_rate=5e-5,
+... save_total_limit=2,
+... remove_unused_columns=False,
+... push_to_hub=True,
+... )
+```
+
+2. ใใฌใผใใณใฐๅผๆฐใใขใใซใใใผใฟใปใใใใใญใปใใตใผใใใผใฟ็
งๅๅจใจใจใใซ [`Trainer`] ใซๆธกใใพใใ
+
+```py
+>>> from transformers import Trainer
+
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... data_collator=data_collator,
+... train_dataset=processed_dataset,
+... processing_class=processor,
+... )
+```
+
+3. [`~Trainer.train`] ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใใ
+
+```py
+>>> trainer.train()
+```
+
+ใใฌใผใใณใฐใๅฎไบใใใใ [`~Trainer.push_to_hub`] ใกใฝใใใไฝฟ็จใใฆใขใใซใใใใซๅ
ฑๆใใ๐ค ใใใงๆ็ตใขใใซใๅ
ฑๆใใพใใ
+
+```py
+>>> trainer.push_to_hub()
+```
+
+## Inference
+
+ViLT ใขใใซใๅพฎ่ชฟๆดใใ๐ค Hub ใซใขใใใญใผใใใใฎใงใใใใๆจ่ซใซไฝฟ็จใงใใพใใใใฃใจใๅ็ดใช
+ๆจ่ซ็จใซๅพฎ่ชฟๆดใใใใขใใซใ่ฉฆใๆนๆณใฏใใใใ [`pipeline`] ใงไฝฟ็จใใใใจใงใใ
+
+```py
+>>> from transformers import pipeline
+
+>>> pipe = pipeline("visual-question-answering", model="MariaK/vilt_finetuned_200")
+```
+
+ใใฎใฌใคใใฎใขใใซใฏ 200 ใฎไพใงใฎใฟใใฌใผใใณใฐใใใฆใใใใใๅคใใๆๅพ
ใใชใใงใใ ใใใๅฐใชใใจใใใใใใใใฉใใ่ฆใฆใฟใพใใใ
+ใใผใฟใใไฝใใๅญฆ็ฟใใๆจ่ซใ่ชฌๆใใใใใซใใผใฟใปใใใใๆๅใฎไพใๅใๅบใใพใใ
+
+```py
+>>> example = dataset[0]
+>>> image = Image.open(example['image_id'])
+>>> question = example['question']
+>>> print(question)
+>>> pipe(image, question, top_k=1)
+"Where is he looking?"
+[{'score': 0.5498199462890625, 'answer': 'down'}]
+```
+
+ใใพใ่ชไฟกใใใใพใใใใใขใใซใฏ็ขบใใซไฝใใๅญฆ็ฟใใพใใใใใๅคใใฎไพใจใใ้ทใใใฌใผใใณใฐใ่กใใจใใฏใใใซ่ฏใ็ตๆใๅพใใใพใใ
+
+ๅฟ
่ฆใซๅฟใใฆใใใคใใฉใคใณใฎ็ตๆใๆๅใง่ค่ฃฝใใใใจใใงใใพใใ
+1. ็ปๅใจ่ณชๅใๅๅพใใใขใใซใฎใใญใปใใตใไฝฟ็จใใฆใขใใซ็จใซๆบๅใใพใใ
+2. ใขใใซใ้ใใฆ็ตๆใพใใฏๅๅฆ็ใ่ปข้ใใพใใ
+3. ใญใธใใใใใๆใๅฏ่ฝๆงใฎ้ซใๅ็ญใฎ ID ใๅๅพใใ`id2label` ใงๅฎ้ใฎๅ็ญใ่ฆใคใใพใใ
+
+```py
+>>> processor = ViltProcessor.from_pretrained("MariaK/vilt_finetuned_200")
+
+>>> image = Image.open(example['image_id'])
+>>> question = example['question']
+
+>>> # prepare inputs
+>>> inputs = processor(image, question, return_tensors="pt")
+
+>>> model = ViltForQuestionAnswering.from_pretrained("MariaK/vilt_finetuned_200")
+
+>>> # forward pass
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+
+>>> logits = outputs.logits
+>>> idx = logits.argmax(-1).item()
+>>> print("Predicted answer:", model.config.id2label[idx])
+Predicted answer: down
+```
+
+## Zero-shot VQA
+
+ไปฅๅใฎใขใใซใงใฏใVQA ใๅ้กใฟในใฏใจใใฆๆฑใใพใใใ BLIPใBLIP-2ใInstructBLIP ใขใใญใผใใชใฉใฎไธ้จใฎๆ่ฟใฎใขใใซ
+็ๆใฟในใฏใจใใฆใฎ VQAใ [BLIP-2](../model_doc/blip-2) ใไพใจใใฆ่ใใฆใฟใพใใใใๆฐใใใใธใฅใขใซ่จ่ชใฎไบๅใใฌใผใใณใฐใๅฐๅ
ฅใใพใใ
+ไบๅใซใใฌใผใใณใฐใใใใใธใงใณ ใจใณใณใผใใผใจ LLM ใไปปๆใซ็ตใฟๅใใใฆไฝฟ็จโโใงใใใใฉใใคใ (่ฉณ็ดฐใซใคใใฆใฏใ[BLIP-2 ใใญใฐๆ็จฟ](https://huggingface.co/blog/blip-2) ใๅ็
ง)ใ
+ใใใซใใใ่ฆ่ฆ็ใช่ณชๅๅฟ็ญใๅซใ่คๆฐใฎ่ฆ่ฆ่จ่ชใฟในใฏใงๆๅ
็ซฏใฎ็ตๆใ้ๆใใใใจใใงใใพใใ
+
+ใใฎใขใใซใ VQA ใซไฝฟ็จใใๆนๆณใ่ชฌๆใใพใใใใใพใใใขใใซใใญใผใใใพใใใใใใใงใฏใขใใซใๆ็คบ็ใซ้ไฟกใใพใใ
+GPU (ๅฉ็จๅฏ่ฝใชๅ ดๅ)ใใใใฏ [`Trainer`] ใ่ชๅ็ใซๅฆ็ใใใใใใใฌใผใใณใฐๆใซไบๅใซ่กใๅฟ
่ฆใฏใใใพใใใงใใใ
+
+
+```py
+>>> from transformers import AutoProcessor, Blip2ForConditionalGeneration
+>>> import torch
+
+>>> processor = AutoProcessor.from_pretrained("Salesforce/blip2-opt-2.7b")
+>>> model = Blip2ForConditionalGeneration.from_pretrained("Salesforce/blip2-opt-2.7b", torch_dtype=torch.float16)
+>>> device = "cuda" if torch.cuda.is_available() else "cpu"
+>>> model.to(device)
+```
+
+ใขใใซใฏ็ปๅใจใใญในใใๅ
ฅๅใจใใฆๅใๅใใใใVQA ใใผใฟใปใใใฎๆๅใฎไพใจใพใฃใใๅใ็ปๅใจ่ณชๅใฎใใขใไฝฟ็จใใฆใฟใพใใใใ
+
+
+```py
+>>> example = dataset[0]
+>>> image = Image.open(example['image_id'])
+>>> question = example['question']
+```
+
+่ฆ่ฆ็ใช่ณชๅๅฟ็ญใฟในใฏใซ BLIP-2 ใไฝฟ็จใใใซใฏใใใญในใ ใใญใณใใใ็นๅฎใฎๅฝขๅผ (`Question: {} Answer:`) ใซๅพใๅฟ
่ฆใใใใพใใ
+
+
+```py
+>>> prompt = f"Question: {question} Answer:"
+```
+
+ๆฌกใซใใขใใซใฎใใญใปใใตใง็ปๅ/ใใญใณใใใๅๅฆ็ใใๅฆ็ใใใๅ
ฅๅใใขใใซใซๆธกใใๅบๅใใใณใผใใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> inputs = processor(image, text=prompt, return_tensors="pt").to(device, torch.float16)
+
+>>> generated_ids = model.generate(**inputs, max_new_tokens=10)
+>>> generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0].strip()
+>>> print(generated_text)
+"He is looking at the crowd"
+```
+
+ใ่ฆงใฎใจใใใใขใใซใฏ็พค่กใจ้กใฎๅใ (ไธใๅใใฆใใ) ใ่ช่ญใใพใใใใ่ฆ้ใใฆใใใใใงใใ
+่ฆณๅฎขใในใฑใผใฟใผใฎๅพใใซใใใจใใไบๅฎใใใใงใใไบบ้ใๆณจ้ใไปใใใใผใฟใปใใใๅๅพใใใใจใไธๅฏ่ฝใชๅ ดๅใซใฏใใใใฏ
+ใใฎใขใใญใผใใซใใใๆ็จใช็ตๆใใใใซๅพใใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/zero_shot_image_classification.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/zero_shot_image_classification.md
new file mode 100644
index 0000000000000000000000000000000000000000..d8d0b530334ec4f4c87152e3156f870033c0e85c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/zero_shot_image_classification.md
@@ -0,0 +1,148 @@
+
+
+# Zero-shot image classification
+
+[[open-in-colab]]
+
+ใผใญใทใงใใ็ปๅๅ้กใฏใๆฌกใฎใขใใซใไฝฟ็จใใฆ็ปๅใใใพใใพใชใซใใดใชใซๅ้กใใใฟในใฏใงใใ
+ใใใใฎ็นๅฎใฎใซใใดใชใฎใฉใใซไปใใฎไพใๅซใใใผใฟใซๅฏพใใฆๆ็คบ็ใซใใฌใผใใณใฐใใใฆใใชใใ
+
+ๅพๆฅใ็ปๅๅ้กใซใฏใใฉใใซไปใ็ปๅใฎ็นๅฎใฎใปใใใงใขใใซใใใฌใผใใณใฐใใๅฟ
่ฆใใใใใใฎใขใใซใฏๆฌกใฎใใจใๅญฆ็ฟใใพใใ
+็นๅฎใฎ็ปๅใฎ็นๅพดใใฉใใซใซใใใใใณใฐใใใพใใๅ้กใฟในใฏใซใใฎใใใชใขใใซใไฝฟ็จใใๅฟ
่ฆใใใๅ ดๅใ
+ๆฐใใใฉใใซใฎใปใใใงใฏใใขใใซใ "ๅ่ชฟๆด" ใใใใใซๅพฎ่ชฟๆดใๅฟ
โโ่ฆใงใใ
+
+ๅฏพ็
ง็ใซใใผใญใทใงใใใพใใฏใชใผใใณ่ชๅฝ็ปๅๅ้กใขใใซใฏใ้ๅธธใๅคง่ฆๆจกใชใทในใใ ใงใใฌใผใใณใฐใใใใใซใใขใผใใซ ใขใใซใงใใ
+็ปๅใจ้ข้ฃใใ่ชฌๆใฎใใผใฟใปใใใใใใใฎใขใใซใฏใใผใญใทใงใใ็ปๅๅ้กใๅซใๅคใใฎไธๆตใฟในใฏใซไฝฟ็จใงใใใ่ชฟๆดใใใ่ฆ่ฆ่จ่ช่กจ็พใๅญฆ็ฟใใพใใ
+
+ใใใฏใ็ปๅๅ้กใซๅฏพใใใใๆ่ปใชใขใใญใผใใงใใใใขใใซใๆฐใใใพใ ่ฆใใใจใฎใชใใซใใดใชใซไธ่ฌๅใงใใใใใซใชใใพใใ
+่ฟฝๅ ใฎใใฌใผใใณใฐ ใใผใฟใๅฟ
่ฆใจใใใใฆใผใถใผใฏใฟใผใฒใใ ใชใใธใงใฏใใฎ่ช็ฑๅฝขๅผใฎใใญในใ่ชฌๆใๅซใ็ปๅใใฏใจใชใงใใใใใซใชใใพใใ
+
+ใใฎใฌใคใใงใฏใๆฌกใฎๆนๆณใๅญฆใณใพใใ
+
+* ใผใญใทใงใใ็ปๅๅ้กใใคใใฉใคใณใไฝๆใใ
+* ๆๅใงใผใญใทใงใใ็ปๅๅ้กๆจ่ซใๅฎ่กใใพใ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install -q transformers
+```
+
+## Zero-shot image classification pipeline
+
+ใผใญใทใงใใ็ปๅๅ้กใใตใใผใใใใขใใซใงๆจ่ซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใๅฏพๅฟใใ [`ใใคใใฉใคใณ`] ใไฝฟ็จใใใใจใงใใ
+[Hugging Face Hub ใฎใใงใใฏใใคใณใ](https://huggingface.co/models?pipeline_tag=zero-shot-image-classification&sort=downloads) ใใใใคใใฉใคใณใใคใณในใฟใณในๅใใพใใ
+
+```python
+>>> from transformers import pipeline
+
+>>> checkpoint = "openai/clip-vit-large-patch14"
+>>> detector = pipeline(model=checkpoint, task="zero-shot-image-classification")
+```
+
+ๆฌกใซใๅ้กใใใ็ปๅใ้ธๆใใพใใ
+
+```py
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://unsplash.com/photos/g8oS8-82DxI/download?ixid=MnwxMjA3fDB8MXx0b3BpY3x8SnBnNktpZGwtSGt8fHx8fDJ8fDE2NzgxMDYwODc&force=true&w=640"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> image
+```
+
+
+
+
+
+็ปๅใจๅ่ฃใชใใธใงใฏใใฎใฉใใซใใใคใใฉใคใณใซๆธกใใพใใใใใงใฏ็ปๅใ็ดๆฅๆธกใใพใใไปใฎ้ฉๅใชใชใใทใงใณ
+็ปๅใธใฎใญใผใซใซ ใในใพใใฏ็ปๅ URL ใๅซใใพใใ
+ๅ่ฃใฉใใซใฏใใใฎไพใฎใใใซๅ็ดใชๅ่ชใซใใใใจใใใใ่ชฌๆ็ใชๅ่ชใซใใใใจใใงใใพใใ
+
+```py
+>>> predictions = detector(image, candidate_labels=["fox", "bear", "seagull", "owl"])
+>>> predictions
+[{'score': 0.9996670484542847, 'label': 'owl'},
+ {'score': 0.000199399160919711, 'label': 'seagull'},
+ {'score': 7.392891711788252e-05, 'label': 'fox'},
+ {'score': 5.96074532950297e-05, 'label': 'bear'}]
+```
+
+## Zero-shot image classification by hand
+
+ใผใญใทใงใใ็ปๅๅ้กใใคใใฉใคใณใฎไฝฟ็จๆนๆณใ็่งฃใใใจใใใงใใผใญใทใงใใใๅฎ่กใใๆนๆณใ่ฆใฆใฟใพใใใใ
+็ปๅใๆๅใงๅ้กใใพใใ
+
+ใพใใ[Hugging Face Hub ใฎใใงใใฏใใคใณใ](https://huggingface.co/models?pipeline_tag=zero-shot-image-classification&sort=downloads) ใใใขใใซใจ้ข้ฃใใญใปใใตใใญใผใใใพใใ
+ใใใงใฏใๅใจๅใใใงใใฏใใคใณใใไฝฟ็จใใพใใ
+
+```py
+>>> from transformers import AutoProcessor, AutoModelForZeroShotImageClassification
+
+>>> model = AutoModelForZeroShotImageClassification.from_pretrained(checkpoint)
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+```
+
+ๆฐๅใๅคใใฆใๅฅใฎ็ปๅใๆฎใฃใฆใฟใพใใใใ
+
+```py
+>>> from PIL import Image
+>>> import requests
+
+>>> url = "https://unsplash.com/photos/xBRQfR2bqNI/download?ixid=MnwxMjA3fDB8MXxhbGx8fHx8fHx8fHwxNjc4Mzg4ODEx&force=true&w=640"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> image
+```
+
+
+
+
+
+ใใญใปใใตใไฝฟ็จใใฆใขใใซใฎๅ
ฅๅใๆบๅใใพใใใใญใปใใตใผใฏใ
+ใตใคใบๅคๆดใจๆญฃ่ฆๅใซใใใขใใซใฎ็ปๅใใใใณใใญในใๅ
ฅๅใๅฆ็ใใใใผใฏใใคใถใผใ
+
+```py
+>>> candidate_labels = ["tree", "car", "bike", "cat"]
+>>> inputs = processor(images=image, text=candidate_labels, return_tensors="pt", padding=True)
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใ็ตๆใๅพๅฆ็ใใพใใ
+
+
+```py
+>>> import torch
+
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+
+>>> logits = outputs.logits_per_image[0]
+>>> probs = logits.softmax(dim=-1).numpy()
+>>> scores = probs.tolist()
+
+>>> result = [
+... {"score": score, "label": candidate_label}
+... for score, candidate_label in sorted(zip(probs, candidate_labels), key=lambda x: -x[0])
+... ]
+
+>>> result
+[{'score': 0.998572, 'label': 'car'},
+ {'score': 0.0010570387, 'label': 'bike'},
+ {'score': 0.0003393686, 'label': 'tree'},
+ {'score': 3.1572064e-05, 'label': 'cat'}]
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/zero_shot_object_detection.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/zero_shot_object_detection.md
new file mode 100644
index 0000000000000000000000000000000000000000..7dbc97ef3a1842cfcadce736f58fe0c4f27e0de3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks/zero_shot_object_detection.md
@@ -0,0 +1,310 @@
+
+
+# Zero-shot object detection
+
+[[open-in-colab]]
+
+ๅพๆฅใ[ใชใใธใงใฏใๆคๅบ](object_detection) ใซไฝฟ็จใใใใขใใซใซใฏใใใฌใผใใณใฐ็จใฎใฉใใซไปใ็ปๅใใผใฟใปใใใๅฟ
่ฆใงใใใ
+ใใฌใผใใณใฐ ใใผใฟใใใฎใฏใฉในใฎใปใใใฎๆคๅบใซ้ๅฎใใใพใใ
+
+ใผใญใทใงใใใชใใธใงใฏใๆคๅบใฏใๅฅใฎใขใใญใผใใไฝฟ็จใใ [OWL-ViT](../model_doc/owlvit) ใขใใซใซใใฃใฆใตใใผใใใใฆใใพใใ OWL-ViT
+ใชใผใใณ่ชๅฝใชใใธใงใฏใๆคๅบๅจใงใใใใใฏใใใชใผใใญในใใฏใจใชใซๅบใฅใใฆ็ปๅๅ
ใฎใชใใธใงใฏใใๆคๅบใงใใใใจใๆๅณใใพใใ
+ใฉใใซไปใใใผใฟใปใใใงใขใใซใๅพฎ่ชฟๆดใใๅฟ
่ฆๆงใ
+
+OWL-ViTใฏใใใซใใขใผใใซ่กจ็พใๅฉ็จใใฆใชใผใใณ่ชๅฝใฎๆคๅบใๅฎ่กใใพใใ [CLIP](../model_doc/clip) ใจใ็ตใฟๅใใใพใใ
+่ปฝ้ใฎใชใใธใงใฏใๅ้กใใใณไฝ็ฝฎ็นๅฎใใใใใชใผใใณ่ชๅฝใฎๆคๅบใฏใCLIP ใฎใใญในใ ใจใณใณใผใใผใไฝฟ็จใใฆใใชใผใใญในใ ใฏใจใชใๅใ่พผใฟใใใใใใชใใธใงใฏใๅ้กใใใณใญใผใซใชใผใผใทใงใณ ใใใใธใฎๅ
ฅๅใจใใฆไฝฟ็จใใใใจใซใใฃใฆๅฎ็พใใใพใใ
+็ปๅใจใใใซๅฏพๅฟใใใใญในใใฎ่ชฌๆใ้ข้ฃไปใใViT ใฏ็ปๅใใใใๅ
ฅๅใจใใฆๅฆ็ใใพใใไฝๅฎถใใก
+ใฎOWL-ViTใฏใใพใCLIPใใผใญใใใใฌใผใใณใฐใใๆฌกใซๆจๆบใฎ็ฉไฝๆคๅบใใผใฟใปใใใไฝฟ็จใใฆOWL-ViTใใจใณใใใผใจใณใใงๅพฎ่ชฟๆดใใพใใใ
+ไบ้จใใใใณใฐๆๅคฑใ
+
+ใใฎใขใใญใผใใไฝฟ็จใใใจใใขใใซใฏใฉใใซไปใใใผใฟใปใใใงไบๅใซใใฌใผใใณใฐใใชใใฆใใใใญในใใฎ่ชฌๆใซๅบใฅใใฆใชใใธใงใฏใใๆคๅบใงใใพใใ
+
+ใใฎใฌใคใใงใฏใOWL-ViT ใฎไฝฟ็จๆนๆณใๅญฆ็ฟใใพใใ
+- ใใญในใใใญใณใใใซๅบใฅใใฆใชใใธใงใฏใใๆคๅบใใพใ
+- ใใใใชใใธใงใฏใๆคๅบ็จ
+- ็ปๅ่ชๅฐ็ฉไฝๆคๅบ็จ
+
+ๅงใใๅใซใๅฟ
่ฆใชใฉใคใใฉใชใใในใฆใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใใ ใใใ
+
+```bash
+pip install -q transformers
+```
+
+## Zero-shot object detection pipeline
+
+OWL-ViTใซใใๆจ่ซใ่ฉฆใๆใ็ฐกๅใชๆนๆณใฏใOWL-ViTใ[`pipeline`]ใงไฝฟ็จใใใใจใงใใใใคใใฉใคใณใใคใณในใฟใณในๅใใ
+[Hugging Face Hub ใฎใใงใใฏใใคใณใ](https://huggingface.co/models?other=owlvit) ใใใฎใผใญใทใงใใ ใชใใธใงใฏใๆคๅบใฎๅ ดๅ:
+
+```python
+>>> from transformers import pipeline
+
+>>> checkpoint = "google/owlvit-base-patch32"
+>>> detector = pipeline(model=checkpoint, task="zero-shot-object-detection")
+```
+
+ๆฌกใซใ็ฉไฝใๆคๅบใใใ็ปๅใ้ธๆใใพใใใใใงใฏใๅฎๅฎ้ฃ่กๅฃซใขใคใชใผใณใปใณใชใณใบใฎ็ปๅใไฝฟ็จใใพใใ
+[NASA](https://www.nasa.gov/multimedia/imagegallery/index.html) Great Images ใใผใฟใปใใใฎไธ้จใ
+
+```py
+>>> import skimage
+>>> import numpy as np
+>>> from PIL import Image
+
+>>> image = skimage.data.astronaut()
+>>> image = Image.fromarray(np.uint8(image)).convert("RGB")
+
+>>> image
+```
+
+
+
+
+
+ๆค็ดขใใ็ปๅใจๅ่ฃใชใใธใงใฏใใฎใฉใใซใใใคใใฉใคใณใซๆธกใใพใใ
+ใใใงใฏ็ปๅใ็ดๆฅๆธกใใพใใไปใฎ้ฉๅใชใชใใทใงใณใซใฏใ็ปๅใธใฎใญใผใซใซ ใในใพใใฏ็ปๅ URL ใๅซใพใใพใใใพใใ็ปๅใใฏใจใชใใใในใฆใฎใขใคใใ ใฎใใญในใ่ชฌๆใๆธกใใพใใ
+
+```py
+>>> predictions = detector(
+... image,
+... candidate_labels=["human face", "rocket", "nasa badge", "star-spangled banner"],
+... )
+>>> predictions
+[{'score': 0.3571370542049408,
+ 'label': 'human face',
+ 'box': {'xmin': 180, 'ymin': 71, 'xmax': 271, 'ymax': 178}},
+ {'score': 0.28099656105041504,
+ 'label': 'nasa badge',
+ 'box': {'xmin': 129, 'ymin': 348, 'xmax': 206, 'ymax': 427}},
+ {'score': 0.2110239565372467,
+ 'label': 'rocket',
+ 'box': {'xmin': 350, 'ymin': -1, 'xmax': 468, 'ymax': 288}},
+ {'score': 0.13790413737297058,
+ 'label': 'star-spangled banner',
+ 'box': {'xmin': 1, 'ymin': 1, 'xmax': 105, 'ymax': 509}},
+ {'score': 0.11950037628412247,
+ 'label': 'nasa badge',
+ 'box': {'xmin': 277, 'ymin': 338, 'xmax': 327, 'ymax': 380}},
+ {'score': 0.10649408400058746,
+ 'label': 'rocket',
+ 'box': {'xmin': 358, 'ymin': 64, 'xmax': 424, 'ymax': 280}}]
+```
+
+ไบๆธฌใ่ฆ่ฆๅใใฆใฟใพใใใใ
+
+
+```py
+>>> from PIL import ImageDraw
+
+>>> draw = ImageDraw.Draw(image)
+
+>>> for prediction in predictions:
+... box = prediction["box"]
+... label = prediction["label"]
+... score = prediction["score"]
+
+... xmin, ymin, xmax, ymax = box.values()
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="red", width=1)
+... draw.text((xmin, ymin), f"{label}: {round(score,2)}", fill="white")
+
+>>> image
+```
+
+
+
+
+
+## Text-prompted zero-shot object detection by hand
+
+ใผใญใทใงใใ็ฉไฝๆคๅบใใคใใฉใคใณใฎไฝฟ็จๆนๆณใ็ขบ่ชใใใฎใงใๅใใใจใๅ็พใใฆใฟใพใใใใ
+ๆๅใง็ตๆใๅๅพใใพใใ
+
+ใพใใ[Hugging Face Hub ใฎใใงใใฏใใคใณใ](https://huggingface.co/models?other=owlvit) ใใใขใใซใจ้ข้ฃใใญใปใใตใใญใผใใใพใใ
+ใใใงใฏใๅใจๅใใใงใใฏใใคใณใใไฝฟ็จใใพใใ
+
+```py
+>>> from transformers import AutoProcessor, AutoModelForZeroShotObjectDetection
+
+>>> model = AutoModelForZeroShotObjectDetection.from_pretrained(checkpoint)
+>>> processor = AutoProcessor.from_pretrained(checkpoint)
+```
+
+ๆฐๅใๅคใใฆใๅฅใฎ็ปๅใๆฎใฃใฆใฟใพใใใใ
+
+```py
+>>> import requests
+
+>>> url = "https://unsplash.com/photos/oj0zeY2Ltk4/download?ixid=MnwxMjA3fDB8MXxzZWFyY2h8MTR8fHBpY25pY3xlbnwwfHx8fDE2Nzc0OTE1NDk&force=true&w=640"
+>>> im = Image.open(requests.get(url, stream=True).raw)
+>>> im
+```
+
+
+
+
+
+ใใญใปใใตใไฝฟ็จใใฆใขใใซใฎๅ
ฅๅใๆบๅใใพใใใใญใปใใตใผใฏใ
+ใตใคใบๅคๆดใจๆญฃ่ฆๅใซใใใขใใซใฎ็ปๅใจใใใญในใๅ
ฅๅใๅฆ็ใใ [`CLIPTokenizer`] ใงใใ
+
+```py
+>>> text_queries = ["hat", "book", "sunglasses", "camera"]
+>>> inputs = processor(text=text_queries, images=im, return_tensors="pt")
+```
+
+ๅ
ฅๅใใขใใซใซๆธกใใๅพๅฆ็ใใ็ตๆใ่ฆ่ฆๅใใพใใไปฅๅใฏ็ปๅใใญใปใใตใซใใฃใฆ็ปๅใฎใตใคใบใๅคๆดใใใฆใใใใใ
+ใใใใใขใใซใซใใฃใผใใใใซใฏใ[`~OwlViTImageProcessor.post_process_object_detection`] ใกใฝใใใไฝฟ็จใใฆใไบๆธฌใใใๅข็ใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+ใใใฏในใฏๅ
ใฎ็ปๅใๅบๆบใจใใๆญฃใใๅบงๆจใๆใกใพใใ
+
+```py
+>>> import torch
+
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+... target_sizes = torch.tensor([im.size[::-1]])
+... results = processor.post_process_object_detection(outputs, threshold=0.1, target_sizes=target_sizes)[0]
+
+>>> draw = ImageDraw.Draw(im)
+
+>>> scores = results["scores"].tolist()
+>>> labels = results["labels"].tolist()
+>>> boxes = results["boxes"].tolist()
+
+>>> for box, score, label in zip(boxes, scores, labels):
+... xmin, ymin, xmax, ymax = box
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="red", width=1)
+... draw.text((xmin, ymin), f"{text_queries[label]}: {round(score,2)}", fill="white")
+
+>>> im
+```
+
+
+
+
+
+## Batch processing
+
+่คๆฐใฎ็ปๅใปใใใจใใญในใ ใฏใจใชใๆธกใใฆใ่คๆฐใฎ็ปๅๅ
ใฎ็ฐใชใ (ใพใใฏๅใ) ใชใใธใงใฏใใๆค็ดขใงใใพใใ
+ๅฎๅฎ้ฃ่กๅฃซใฎ็ปๅใจใใผใใฎ็ปๅใ็ตใฟๅใใใฆใฟใพใใใใ
+ใใใๅฆ็ใฎๅ ดๅใใใญในใ ใฏใจใชใใในใใใใใชในใใจใใฆใใญใปใใตใซๆธกใใ็ปๅใ PIL ใคใกใผใธใฎใชในใใจใใฆๆธกใๅฟ
่ฆใใใใพใใ
+PyTorch ใใณใฝใซใใพใใฏ NumPy ้
ๅใ
+
+```py
+>>> images = [image, im]
+>>> text_queries = [
+... ["human face", "rocket", "nasa badge", "star-spangled banner"],
+... ["hat", "book", "sunglasses", "camera"],
+... ]
+>>> inputs = processor(text=text_queries, images=images, return_tensors="pt")
+```
+
+ไปฅๅใฏๅพๅฆ็ใฎใใใซๅไธใฎ็ปๅใฎใตใคใบใใใณใฝใซใจใใฆๆธกใใฆใใพใใใใใฟใใซใๆธกใใใจใใงใใพใใ
+่คๆฐใฎ็ปๅใฎใฟใใซใฎใชในใใ 2 ใคใฎไพใฎไบๆธฌใไฝๆใใ2 ็ช็ฎใฎไพ (`image_idx = 1`) ใ่ฆ่ฆๅใใพใใใใ
+
+```py
+>>> with torch.no_grad():
+... outputs = model(**inputs)
+... target_sizes = [x.size[::-1] for x in images]
+... results = processor.post_process_object_detection(outputs, threshold=0.1, target_sizes=target_sizes)
+
+>>> image_idx = 1
+>>> draw = ImageDraw.Draw(images[image_idx])
+
+>>> scores = results[image_idx]["scores"].tolist()
+>>> labels = results[image_idx]["labels"].tolist()
+>>> boxes = results[image_idx]["boxes"].tolist()
+
+>>> for box, score, label in zip(boxes, scores, labels):
+... xmin, ymin, xmax, ymax = box
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="red", width=1)
+... draw.text((xmin, ymin), f"{text_queries[image_idx][label]}: {round(score,2)}", fill="white")
+
+>>> images[image_idx]
+```
+
+
+
+
+
+## Image-guided object detection
+
+ใใญในใใฏใจใชใซใใใผใญใทใงใใใชใใธใงใฏใๆคๅบใซๅ ใใฆใOWL-ViTใฏ็ปๅใฌใคใใซใใใชใใธใงใฏใๆคๅบใๆไพใใพใใใใใฏใคใพใ
+็ปๅใฏใจใชใไฝฟ็จใใฆใใฟใผใฒใใ็ปๅๅ
ใฎ้กไผผใใใชใใธใงใฏใใๆค็ดขใงใใพใใ
+ใใญในใ ใฏใจใชใจใฏ็ฐใชใใไฝฟ็จใงใใใตใณใใซ็ปๅใฏ 1 ใคใ ใใงใใ
+
+ๅฏพ่ฑก็ปๅใจใใฆใฝใใกใซ2ๅนใฎ็ซใใใ็ปๅใจใ1ๅนใฎ็ซใฎ็ปๅใๆฎๅฝฑใใพใใใ
+ใฏใจใชใจใใฆ:
+
+```py
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image_target = Image.open(requests.get(url, stream=True).raw)
+
+>>> query_url = "http://images.cocodataset.org/val2017/000000524280.jpg"
+>>> query_image = Image.open(requests.get(query_url, stream=True).raw)
+```
+
+็ปๅใ็ฐกๅใซ่ฆใฆใฟใพใใใใ
+
+```py
+>>> import matplotlib.pyplot as plt
+
+>>> fig, ax = plt.subplots(1, 2)
+>>> ax[0].imshow(image_target)
+>>> ax[1].imshow(query_image)
+```
+
+
+
+
+
+ๅๅฆ็ในใใใใงใฏใใใญในใ ใฏใจใชใฎไปฃใใใซ `query_images` ใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+
+```py
+>>> inputs = processor(images=image_target, query_images=query_image, return_tensors="pt")
+```
+
+ไบๆธฌใฎๅ ดๅใๅ
ฅๅใใขใใซใซๆธกใไปฃใใใซใ[`~OwlViTForObjectDetection.image_guided_detection`] ใซๆธกใใพใใไบๆธฌใๆใ
+ใฉใใซใใชใใใจใ้คใใฆใฏไปฅๅใจๅๆงใงใใ
+
+```py
+>>> with torch.no_grad():
+... outputs = model.image_guided_detection(**inputs)
+... target_sizes = torch.tensor([image_target.size[::-1]])
+... results = processor.post_process_image_guided_detection(outputs=outputs, target_sizes=target_sizes)[0]
+
+>>> draw = ImageDraw.Draw(image_target)
+
+>>> scores = results["scores"].tolist()
+>>> boxes = results["boxes"].tolist()
+
+>>> for box, score, label in zip(boxes, scores, labels):
+... xmin, ymin, xmax, ymax = box
+... draw.rectangle((xmin, ymin, xmax, ymax), outline="white", width=4)
+
+>>> image_target
+```
+
+
+
+
+
+OWL-ViTใซใใๆจ่ซใใคใณใฟใฉใฏใใฃใใซ่ฉฆใใใๅ ดๅใฏใใใฎใใขใใใงใใฏใใฆใใ ใใใ
+
+
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks_explained.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks_explained.md
new file mode 100644
index 0000000000000000000000000000000000000000..7c027e7a7394a9c791354f53dc3d9cfdc29dd49f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tasks_explained.md
@@ -0,0 +1,301 @@
+
+
+# How ๐ค Transformers solve tasks
+
+[๐ค Transformersใงใงใใใใจ](task_summary)ใงใ่ช็ถ่จ่ชๅฆ็๏ผNLP๏ผใ้ณๅฃฐใจใชใผใใฃใชใใณใณใใฅใผใฟใใธใงใณใฎใฟในใฏใใใใใฎ้่ฆใชใขใใชใฑใผใทใงใณใซใคใใฆๅญฆใณใพใใใใใฎใใผใธใงใฏใใขใใซใใใใใฎใฟในใฏใใฉใฎใใใซ่งฃๆฑบใใใใ่ฉณใใ่ฆใฆใใขใใซใฎๅ
้จใงไฝใ่ตทใใฃใฆใใใใ่ชฌๆใใพใใ็นๅฎใฎใฟในใฏใ่งฃๆฑบใใใใใซใฏๅคใใฎๆนๆณใใใใไธ้จใฎใขใใซใฏ็นๅฎใฎใใฏใใใฏใๅฎ่ฃ
ใใใใใพใใฏๆฐใใ่ฆณ็นใใใฟในใฏใซๅใ็ตใใใใใใพใใใใTransformerใขใใซใซใจใฃใฆใไธ่ฌ็ใชใขใคใใขใฏๅใใงใใๆ่ปใชใขใผใญใใฏใใฃใฎใใใใงใใปใจใใฉใฎใขใใซใฏใจใณใณใผใใใใณใผใใใพใใฏใจใณใณใผใ-ใใณใผใๆง้ ใฎๅค็จฎใงใใTransformerใขใใซไปฅๅคใซใใๅฝ็คพใฎใฉใคใใฉใชใซใฏใณใณใใฅใผใฟใใธใงใณใฟในใฏใซไปใงใไฝฟ็จใใใฆใใใใใคใใฎ็ณใฟ่พผใฟใใฅใผใฉใซใใใใฏใผใฏ๏ผCNN๏ผใใใใพใใใพใใ็พไปฃใฎCNNใใฉใฎใใใซๆฉ่ฝใใใใ่ชฌๆใใพใใ
+
+ใฟในใฏใใฉใฎใใใซ่งฃๆฑบใใใใใ่ชฌๆใใใใใซใใขใใซๅ
้จใงๆ็จใชไบๆธฌใๅบๅใใใใใซไฝใ่ตทใใใใซใคใใฆ่ชฌๆใใพใใ
+
+- [Wav2Vec2](model_doc/wav2vec2)๏ผใชใผใใฃใชๅ้กใใใณ่ชๅ้ณๅฃฐ่ช่ญ๏ผASR๏ผๅใ
+- [Vision Transformer๏ผViT๏ผ](model_doc/vit)ใใใณ[ConvNeXT](model_doc/convnext)๏ผ็ปๅๅ้กๅใ
+- [DETR](model_doc/detr)๏ผใชใใธใงใฏใๆคๅบๅใ
+- [Mask2Former](model_doc/mask2former)๏ผ็ปๅใปใฐใกใณใใผใทใงใณๅใ
+- [GLPN](model_doc/glpn)๏ผๆทฑๅบฆๆจๅฎๅใ
+- [BERT](model_doc/bert)๏ผใจใณใณใผใใไฝฟ็จใใใใญในใๅ้กใใใผใฏใณๅ้กใใใใณ่ณชๅๅฟ็ญใชใฉใฎNLPใฟในใฏๅใ
+- [GPT2](model_doc/gpt2)๏ผใใณใผใใไฝฟ็จใใใใญในใ็ๆใชใฉใฎNLPใฟในใฏๅใ
+- [BART](model_doc/bart)๏ผใจใณใณใผใ-ใใณใผใใไฝฟ็จใใ่ฆ็ดใใใณ็ฟป่จณใชใฉใฎNLPใฟในใฏๅใ
+
+
+
+ใใใซ้ฒใๅใซใๅ
ใฎTransformerใขใผใญใใฏใใฃใฎๅบๆฌ็ใช็ฅ่ญใๆใคใจ่ฏใใงใใใจใณใณใผใใใใณใผใใใใใณๆณจๆๅใใฉใฎใใใซๅไฝใใใใ็ฅใฃใฆใใใจใ็ฐใชใTransformerใขใใซใใฉใฎใใใซๅไฝใใใใ็่งฃใใใฎใซๅฝน็ซใกใพใใๅงใใฆใใใใใชใใฌใใทใฅใๅฟ
่ฆใชๅ ดๅใฏใ่ฉณ็ดฐใชๆ
ๅ ฑใซใคใใฆใฏๅฝ็คพใฎ[ใณใผใน](https://huggingface.co/course/chapter1/4?fw=pt)ใใใงใใฏใใฆใใ ใใ๏ผ
+
+
+
+## Speech and audio
+
+[Wav2Vec2](model_doc/wav2vec2)ใฏใๆชใฉใใซใฎ้ณๅฃฐใใผใฟใงไบๅใใฌใผใใณใฐใใใใชใผใใฃใชๅ้กใใใณ่ชๅ้ณๅฃฐ่ช่ญใฎใฉใใซไปใใใผใฟใงใใกใคใณใใฅใผใณใใใ่ชๅทฑๆๅธซใขใใซใงใใ
+
+
+
+
+
+ใใฎใขใใซใซใฏไธปใซๆฌกใฎ4ใคใฎใณใณใใผใใณใใใใใพใใ
+
+1. *็นๅพดใจใณใณใผใ*๏ผ็ใฎ้ณๅฃฐๆณขๅฝขใๅใๅใใๅนณๅๅคใใผใญใซๆญฃ่ฆๅใใๅไฝๅๆฃใซๅคๆใใใใใ20msใใจใฎ็นๅพดใใฏใใซใฎใทใผใฑใณในใซๅคๆใใพใใ
+
+2. ๆณขๅฝขใฏ่ช็ถใซ้ฃ็ถใใฆใใใใใใใญในใใฎใทใผใฑใณในใๅ่ชใซๅๅฒใงใใใใใซใงใใใใใซใ็นๅพดใใฏใใซใฏ*้ๅญๅใขใธใฅใผใซ*ใซๆธกใใใ้ขๆฃ้ณๅฃฐใฆใใใใๅญฆ็ฟใใใใจใใพใใ้ณๅฃฐใฆใใใใฏ*ใณใผใใใใฏ*๏ผ่ชๅฝใจ่ใใใใจใใงใใพใ๏ผใจใใฆ็ฅใใใใณใผใใฏใผใใฎใณใฌใฏใทใงใณใใ้ธๆใใใพใใใณใผใใใใฏใใใ้ฃ็ถใใใชใผใใฃใชๅ
ฅๅใๆใใใ่กจใใใฏใใซใพใใฏ้ณๅฃฐใฆใใใ๏ผใฟใผใฒใใใฉใใซใจ่ใใใใจใใงใใพใ๏ผใ้ธๆใใใใขใใซใไปใใฆ่ปข้ใใใพใใ
+
+3. ็นๅพดใใฏใใซใฎ็ดๅๅใฏใฉใณใใ ใซใในใฏใใใใในใฏใใใ็นๅพดใใฏใใซใฏ*ใณใณใใญในใใใใใฏใผใฏ*ใซไพ็ตฆใใใพใใใใใฏใ็ธๅฏพ็ใชไฝ็ฝฎใจใณใใใใฃใณใฐใ่ฟฝๅ ใใTransformerใจใณใณใผใใงใใ
+
+4. ใณใณใใญในใใใใใฏใผใฏใฎไบๅใใฌใผใใณใฐใฎ็ฎ็ใฏ*ใณใณใใฉในใใฃใใฟในใฏ*ใงใใใขใใซใฏใในใฏใใใไบๆธฌใฎ็ใฎ้ๅญๅ้ณๅฃฐ่กจ็พใใๅฝใฎไบๆธฌใฎใปใใใใไบๆธฌใใชใใใฐใชใใใใขใใซใฏๆใไผผใใณใณใใญในใใใฏใใซใจ้ๅญๅ้ณๅฃฐใฆใใใ๏ผใฟใผใฒใใใฉใใซ๏ผใ่ฆใคใใใใใซไฟใใใพใใ
+
+ไปใWav2Vec2ใฏไบๅใใฌใผใใณใฐใใใฆใใใฎใงใใชใผใใฃใชๅ้กใพใใฏ่ชๅ้ณๅฃฐ่ช่ญใฎใใใซใใผใฟใใใกใคใณใใฅใผใณใงใใพใ๏ผ
+
+### Audio classification
+
+ไบๅใใฌใผใใณใฐใใใใขใใซใใชใผใใฃใชๅ้กใซไฝฟ็จใใใซใฏใๅบๆฌ็ใชWav2Vec2ใขใใซใฎไธใซใทใผใฑใณในๅ้กใใใใ่ฟฝๅ ใใพใใๅ้กใใใใฏใจใณใณใผใใฎ้ ใใ็ถๆ
ใๅใๅ
ฅใใ็ทๅฝขๅฑคใงใๅใชใผใใฃใชใใฌใผใ ใใๅญฆ็ฟใใใ็นๅพดใ่กจใใพใใใใใใฎ้ ใใ็ถๆ
ใฏ้ทใใ็ฐใชใๅฏ่ฝๆงใใใใใใๆๅใซ้ ใใ็ถๆ
ใใใผใซใใใๆฌกใซใฏใฉในใฉใใซใซๅฏพใใใญใธใใใซๅคๆใใใพใใใญใธใใใจใฟใผใฒใใ้ใฎใฏใญในใจใณใใญใใผๆๅคฑใ่จ็ฎใใใๆใๅฏ่ฝๆงใฎ้ซใใฏใฉในใ่ฆใคใใใใใซไฝฟ็จใใใพใใ
+
+ใชใผใใฃใชๅ้กใ่ฉฆใๆบๅใฏใงใใพใใใ๏ผWav2Vec2ใใใกใคใณใใฅใผใณใใฆๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใฎๅฎๅ
จใช[ใชใผใใฃใชๅ้กใฌใคใ](tasks/audio_classification)ใใใงใใฏใใฆใใ ใใ๏ผ
+
+### Automatic speech recognition
+
+ไบๅใใฌใผใใณใฐใใใใขใใซใ่ชๅ้ณๅฃฐ่ช่ญใซไฝฟ็จใใใซใฏใ[connectionist temporal classification๏ผCTC๏ผ](glossary#connectionist-temporal-classification-ctc)ใฎใใใฎๅบๆฌ็ใชWav2Vec2ใขใใซใฎไธใซ่จ่ชใขใใชใณใฐใใใใ่ฟฝๅ ใใพใใ่จ่ชใขใใชใณใฐใใใใฏใจใณใณใผใใฎ้ ใใ็ถๆ
ใๅใๅ
ฅใใใใใใใญใธใใใซๅคๆใใพใใๅใญใธใใใฏใใผใฏใณใฏใฉในใ่กจใ๏ผใใผใฏใณๆฐใฏใฟในใฏใฎ่ชๅฝใใๆฅใพใ๏ผใใญใธใใใจใฟใผใฒใใ้ใฎCTCๆๅคฑใ่จ็ฎใใใๆฌกใซ่ปขๅใซๅคๆใใใพใใ
+
+่ชๅ้ณๅฃฐ่ช่ญใ่ฉฆใๆบๅใฏใงใใพใใใ๏ผWav2Vec2ใใใกใคใณใใฅใผใณใใฆๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใฎๅฎๅ
จใช[่ชๅ้ณๅฃฐ่ช่ญใฌใคใ](tasks/asr)ใใใงใใฏใใฆใใ ใใ๏ผ
+
+## Computer vision
+
+ใณใณใใฅใผใฟใใธใงใณใฎใฟในใฏใใขใใญใผใใใๆนๆณใฏ2ใคใใใพใใ
+
+1. ็ปๅใใใใใฎใทใผใฑใณในใซๅๅฒใใTransformerใไฝฟ็จใใฆไธฆๅใซๅฆ็ใใพใใ
+2. [ConvNeXT](model_doc/convnext)ใชใฉใฎใขใใณใชCNNใไฝฟ็จใใพใใใใใใฏ็ณใฟ่พผใฟๅฑคใไฝฟ็จใใพใใใใขใใณใชใใใใฏใผใฏ่จญ่จใๆก็จใใฆใใพใใ
+
+
+
+ใตใผใใขใใญใผใใงใฏใTransformerใจ็ณใฟ่พผใฟใ็ตใฟๅใใใใใฎใใใใพใ๏ผไพ๏ผ[Convolutional Vision Transformer](model_doc/cvt)ใพใใฏ[LeViT](model_doc/levit)๏ผใใใใใซใคใใฆใฏ่ญฐ่ซใใพใใใใใใใใฏใใใง่ชฟในใ2ใคใฎใขใใญใผใใ็ตใฟๅใใใฆใใพใใ
+
+
+
+ViTใจConvNeXTใฏ็ปๅๅ้กใซใใไฝฟ็จใใใพใใใใชใใธใงใฏใๆคๅบใใปใฐใกใณใใผใทใงใณใๆทฑๅบฆๆจๅฎใชใฉใฎไปใฎใใธใงใณใฟในใฏใซๅฏพใใฆใฏใDETRใMask2FormerใGLPNใชใฉใ้ฉใใฆใใพใใ
+
+### Image classification
+
+ViTใจConvNeXTใฎไธกๆนใ็ปๅๅ้กใซไฝฟ็จใงใใพใใไธปใช้ใใฏใViTใๆณจๆใกใซใใบใ ใไฝฟ็จใใConvNeXTใ็ณใฟ่พผใฟใไฝฟ็จใใใใจใงใใ
+
+#### Transformer
+
+[ViT](model_doc/vit)ใฏ็ณใฟ่พผใฟใๅฎๅ
จใซTransformerใขใผใญใใฏใใฃใง็ฝฎใๆใใพใใๅ
ใฎTransformerใซ็ฒพ้ใใฆใใๅ ดๅใViTใฎ็่งฃใฏๆขใซใปใจใใฉๅฎไบใใฆใใพใใ
+
+
+
+
+
+ViTใๅฐๅ
ฅใใไธปใชๅคๆด็นใฏใ็ปๅใTransformerใซไพ็ตฆใใๆนๆณใงใใ
+
+1. ็ปๅใฏๆญฃๆนๅฝขใง้ใชใใชใใใใใฎใทใผใฑใณในใซๅๅฒใใใๅใใใใฏใใฏใใซใพใใฏ*ใใใๅใ่พผใฟ*ใซๅคๆใใใพใใใใใๅใ่พผใฟใฏใ้ฉๅใชๅ
ฅๅๆฌกๅ
ใไฝๆใใใใใซ2D็ณใฟ่พผใฟๅฑคใใ็ๆใใใพใ๏ผๅบๆฌใฎTransformerใฎๅ ดๅใๅใใใๅใ่พผใฟใซ768ใฎๅคใใใใพใ๏ผใ224x224ใใฏใปใซใฎ็ปๅใใใๅ ดๅใใใใ16x16ใฎ็ปๅใใใใซๅๅฒใงใใพใใใใญในใใๅ่ชใซใใผใฏใณๅใใใใใใซใ็ปๅใฏใใใใฎใทใผใฑใณในใซใใใผใฏใณๅใใใใพใใ
+
+2. *ๅญฆ็ฟๅใ่พผใฟ*ใใคใพใ็นๅฅใช `[CLS]` ใใผใฏใณใใBERTใฎใใใซใใใๅใ่พผใฟใฎๅ
้ ญใซ่ฟฝๅ ใใใพใใ `[CLS]` ใใผใฏใณใฎๆ็ต็ใช้ ใใ็ถๆ
ใฏใไปๅฑใฎๅ้กใใใใฎๅ
ฅๅใจใใฆไฝฟ็จใใใพใใไปใฎๅบๅใฏ็ก่ฆใใใพใใใใฎใใผใฏใณใฏใใขใใซใ็ปๅใฎ่กจ็พใใจใณใณใผใใใๆนๆณใๅญฆใถใฎใซๅฝน็ซใกใพใใ
+
+3. ใใใใจๅญฆ็ฟๅใ่พผใฟใซ่ฟฝๅ ใใๆๅพใฎ่ฆ็ด ใฏ*ไฝ็ฝฎๅใ่พผใฟ*ใงใใใขใใซใฏ็ปๅใใใใใฉใฎใใใซไธฆในใใใฆใใใใ็ฅใใพใใใฎใงใไฝ็ฝฎๅใ่พผใฟใๅญฆ็ฟๅฏ่ฝใงใใใใๅใ่พผใฟใจๅใใตใคใบใๆใกใพใใๆๅพใซใใในใฆใฎๅใ่พผใฟใTransformerใจใณใณใผใใซๆธกใใใพใใ
+
+4. ๅบๅใๅ
ทไฝ็ใซใฏ `[CLS]` ใใผใฏใณใฎๅบๅใ ใใใๅคๅฑคใใผใปใใใญใณใใใ๏ผMLP๏ผใซๆธกใใใพใใViTใฎไบๅใใฌใผใใณใฐใฎ็ฎ็ใฏๅ็ดใซๅ้กใงใใไปใฎๅ้กใใใใจๅๆงใซใMLPใใใใฏๅบๅใใฏใฉในใฉใใซใซๅฏพใใใญใธใใใซๅคๆใใใฏใญในใจใณใใญใใผๆๅคฑใ่จ็ฎใใฆๆใๅฏ่ฝๆงใฎ้ซใใฏใฉในใ่ฆใคใใพใใ
+
+็ปๅๅ้กใ่ฉฆใๆบๅใฏใงใใพใใใ๏ผViTใใใกใคใณใใฅใผใณใใฆๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใฎๅฎๅ
จใช[็ปๅๅ้กใฌใคใ](tasks/image_classification)ใใใงใใฏใใฆใใ ใใ๏ผ
+
+
+#### CNN
+
+
+
+ใใฎใปใฏใทใงใณใงใฏ็ณใฟ่พผใฟใซใคใใฆ็ฐกๅใซ่ชฌๆใใฆใใพใใใ็ปๅใฎๅฝข็ถใจใตใคใบใใฉใฎใใใซๅคๅใใใใไบๅใซ็่งฃใใฆใใใจๅฝน็ซใกใพใใ็ณใฟ่พผใฟใซๆ
ฃใใฆใใชใๅ ดๅใฏใfastaiใฎๆธ็ฑใใ[Convolution Neural Networks chapter](https://github.com/fastai/fastbook/blob/master/13_convolutions.ipynb)ใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+
+
+[ConvNeXT](model_doc/convnext)ใฏใๆง่ฝใๅไธใใใใใใซๆฐใใใขใใณใชใใใใฏใผใฏ่จญ่จใๆก็จใใCNNใขใผใญใใฏใใฃใงใใใใ ใใ็ณใฟ่พผใฟใฏใขใใซใฎไธญๆ ธใซใพใ ใใใพใใ้ซใฌใใซใใ่ฆใๅ ดๅใ[็ณใฟ่พผใฟ๏ผconvolution๏ผ](glossary#convolution)ใฏใๅฐใใช่กๅ๏ผ*ใซใผใใซ*๏ผใ็ปๅใฎใใฏใปใซใฎๅฐใใชใฆใฃใณใใฆใซไน็ฎใใใๆไฝใงใใใใใฏ็นๅฎใฎใใฏในใใฃใ็ทใฎๆฒ็ใชใฉใฎ็นๅพดใ่จ็ฎใใพใใใใฎๅพใๆฌกใฎใใฏใปใซใฎใฆใฃใณใใฆใซ็งปๅใใพใใ็ณใฟ่พผใฟใ็งปๅใใ่ท้ขใฏ*ในใใฉใคใ*ใจใใฆ็ฅใใใฆใใพใใ
+
+
+
+
+
+[Convolution Arithmetic for Deep Learning](https://arxiv.org/abs/1603.07285) ใใใฎๅบๆฌ็ใชใใใฃใณใฐใในใใฉใคใใฎใชใ็ณใฟ่พผใฟใ
+
+ใใฎๅบๅใๅฅใฎ็ณใฟ่พผใฟๅฑคใซไพ็ตฆใใๅ้ฃ็ถใใๅฑคใใจใซใใใใใฏใผใฏใฏใใใใใใฐใใญใฑใใใฎใใใชใใ่ค้ใงๆฝ่ฑก็ใชใใฎใๅญฆ็ฟใใพใใ็ณใฟ่พผใฟๅฑคใฎ้ใซใฏใ็นๅพดใฎๆฌกๅ
ใๅๆธใใ็นๅพดใฎไฝ็ฝฎใฎๅคๅใซๅฏพใใฆใขใใซใใใๅ
็ขใซใใใใใซใใผใชใณใฐๅฑคใ่ฟฝๅ ใใใฎใไธ่ฌ็ใงใใ
+
+
+
+
+
+ConvNeXTใฏใไปฅไธใฎ5ใคใฎๆนๆณใงCNNใใขใใณๅใใฆใใพใใ
+
+1. ๅในใใผใธใฎใใญใใฏๆฐใๅคๆดใใ็ปๅใใใๅคงใใชในใใฉใคใใจๅฏพๅฟใใใซใผใใซใตใคใบใง*ใใใๅ*ใใพใใ้ใชใใชใในใฉใคใใฃใณใฐใฆใฃใณใใฆใฏใใใใซใใ็ปๅใใใใใซๅๅฒใใViTใฎๆฆ็ฅใจไผผใฆใใพใใ
+
+2. *ใใใซใใใฏ* ใฌใคใคใผใฏใใฃใใซๆฐใ็ธฎๅฐใใใใใๅพฉๅ
ใใพใใ1x1ใฎ็ณใฟ่พผใฟใๅฎ่กใใใฎใฏ้ใใๆทฑใใๅขใใใใจใใงใใพใใ้ใใใซใใใฏใฏ้ใฎใใจใ่กใใใใฃใใซๆฐใๆกๅผตใใใใใ็ธฎๅฐใใพใใใใใฏใกใขใชๅน็ใ้ซใใงใใ
+
+3. ใใใซใใใฏใฌใคใคใผๅ
ใฎ้ๅธธใฎ3x3ใฎ็ณใฟ่พผใฟๅฑคใใ*ๆทฑๅบฆๆนๅใฎ็ณใฟ่พผใฟ*ใง็ฝฎใๆใใพใใใใใฏๅๅ
ฅๅใใฃใใซใซๅๅฅใซ็ณใฟ่พผใฟใ้ฉ็จใใๆๅพใซใใใใ็ฉใฟ้ใญใ็ณใฟ่พผใฟใงใใใใใซใใใๆง่ฝๅไธใฎใใใซใใใใฏใผใฏๅน
ใๅบใใใพใใ
+
+4. ViTใฏใฐใญใผใใซๅๅฎน้ใๆใฃใฆใใใใใใใฎๆณจๆใกใซใใบใ ใฎใใใใงไธๅบฆใซ็ปๅใฎๅคใใ่ฆใใใจใใงใใพใใConvNeXTใฏใใฎๅนๆใๅ็พใใใใจใใใซใผใใซใตใคใบใ7x7ใซๅขใใใพใใ
+
+5. ConvNeXTใฏใพใใTransformerใขใใซใๆจกๅฃใใใใใคใใฎใฌใคใคใผใใถใคใณๅคๆดใ่กใฃใฆใใพใใใขใฏใใฃใใผใทใงใณใจๆญฃ่ฆๅใฌใคใคใผใๅฐใชใใๆดปๆงๅ้ขๆฐใฏReLUใฎไปฃใใใซGELUใซๅใๆฟใใBatchNormใฎไปฃใใใซLayerNormใไฝฟ็จใใฆใใพใใ
+
+็ณใฟ่พผใฟใใญใใฏใใใฎๅบๅใฏใๅ้กใใใใซๆธกใใใๅบๅใใญใธใใใซๅคๆใใๆใๅฏ่ฝๆงใฎ้ซใใฉใใซใ่ฆใคใใใใใซใฏใญในใจใณใใญใใผๆๅคฑใ่จ็ฎใใใพใใ
+
+### Object detection
+
+[DETR](model_doc/detr)ใ*DEtection TRansformer*ใใฏCNNใจTransformerใจใณใณใผใใผใใณใผใใผใ็ตใฟๅใใใใจใณใใใผใจใณใใฎใชใใธใงใฏใๆคๅบใขใใซใงใใ
+
+
+
+
+
+1. ไบๅใใฌใผใใณใฐใใใCNN *ใใใฏใใผใณ* ใฏใใใฏใปใซๅคใง่กจใใใ็ปๅใๅใๅใใใใใฎไฝ่งฃๅๅบฆใฎ็นๅพดใใใใไฝๆใใพใใ็นๅพดใใใใซใฏๆฌกๅ
ๅๆธใฎใใใซ1x1ใฎ็ณใฟ่พผใฟใ้ฉ็จใใใ้ซใฌใใซใฎ็ปๅ่กจ็พใๆใคๆฐใใ็นๅพดใใใใไฝๆใใใพใใTransformerใฏ้ฃ็ถใขใใซใงใใใใใ็นๅพดใใใใฏ็นๅพดใใฏใใซใฎใทใผใฑใณในใซๅนณๅฆๅใใใไฝ็ฝฎใจใณใใใฃใณใฐใจ็ตใฟๅใใใใใพใใ
+
+2. ็นๅพดใใฏใใซใฏใจใณใณใผใใผใซๆธกใใใใใฎๆณจๆใฌใคใคใผใไฝฟ็จใใฆ็ปๅ่กจ็พใๅญฆ็ฟใใพใใๆฌกใซใใจใณใณใผใใผใฎ้ ใ็ถๆ
ใฏใใณใผใใผใฎ*ใชใใธใงใฏใใฏใจใช*ใจ็ตใฟๅใใใใพใใใชใใธใงใฏใใฏใจใชใฏใ็ปๅใฎ็ฐใชใ้ ๅใซ็ฆ็นใๅฝใฆใๅญฆ็ฟๅใ่พผใฟใงใๅๆณจๆใฌใคใคใผใ้ฒ่กใใใซใคใใฆๆดๆฐใใใพใใใใณใผใใผใฎ้ ใ็ถๆ
ใฏใๅใชใใธใงใฏใใฏใจใชใซๅฏพใใฆใใฆใณใใฃใณใฐใใใฏในใฎๅบงๆจใจใฏใฉในใฉใใซใไบๆธฌใใใใฃใผใใใฉใฏใผใใใใใฏใผใฏใซๆธกใใใพใใใพใใฏใๅญๅจใใชใๅ ดๅใฏ `no object` ใๆธกใใใพใใ
+
+ DETRใฏๅใชใใธใงใฏใใฏใจใชใไธฆ่กใใฆใใณใผใใใฆใ*N*ใฎๆ็ต็ใชไบๆธฌ๏ผ*N*ใฏใฏใจใชใฎๆฐ๏ผใๅบๅใใพใใๅ
ธๅ็ใช่ชๅทฑๅๅธฐใขใใซใ1ใคใฎ่ฆ็ด ใ1ๅใใคไบๆธฌใใใฎใจใฏ็ฐใชใใใชใใธใงใฏใๆคๅบใฏใปใใไบๆธฌใฟในใฏ๏ผ`ใใฆใณใใฃใณใฐใใใฏใน`ใ`ใฏใฉในใฉใใซ`๏ผใงใใใ1ๅใฎใในใง*N*ใฎไบๆธฌใ่กใใพใใ
+
+3. ่จ็ทดไธญใDETRใฏ*ไบ้จใใใใณใฐๆๅคฑ*ใไฝฟ็จใใฆใๅบๅฎใใใๆฐใฎไบๆธฌใจๅบๅฎใใใไธ้ฃใฎๆญฃ่งฃใฉใใซใๆฏ่ผใใพใใ *N*ใฎใฉใใซใปใใใซๆญฃ่งฃใฉใใซใๅฐใชใๅ ดๅใ `no object` ใฏใฉในใงใใใฃใณใฐใใใพใใใใฎๆๅคฑ้ขๆฐใฏใDETRใซไบๆธฌใจๆญฃ่งฃใฉใใซใจใฎ้ใง1ๅฏพ1ใฎๅฒใๅฝใฆใ่ฆใคใใใใใซไฟใใพใใใใฆใณใใฃใณใฐใใใฏในใพใใฏใฏใฉในใฉใใซใฎใฉใกใใใๆญฃใใใชใๅ ดๅใๆๅคฑใ็บ็ใใพใใๅๆงใซใDETRใๅญๅจใใชใใชใใธใงใฏใใไบๆธฌใใๅ ดๅใ็ฝฐ้ใ็งใใใใพใใใใใซใใใDETRใฏ1ใคใฎ้ๅธธใซ้ก่ใชใชใใธใงใฏใใซ็ฆ็นใๅฝใฆใใฎใงใฏใชใใ็ปๅๅ
ใฎไปใฎใชใใธใงใฏใใ่ฆใคใใใใใซไฟใใใพใใ
+
+DETRใฎไธใซใชใใธใงใฏใๆคๅบใใใใ่ฟฝๅ ใใฆใใฏใฉในใฉใใซใจใใฆใณใใฃใณใฐใใใฏในใฎๅบงๆจใ่ฆใคใใพใใใชใใธใงใฏใๆคๅบใใใใซใฏ2ใคใฎใณใณใใผใใณใใใใใพใ๏ผใใณใผใใผใฎ้ ใ็ถๆ
ใใฏใฉในใฉใใซใฎใญใธใใใซๅคๆใใใใใฎ็ทๅฝขๅฑคใใใใณใใฆใณใใฃใณใฐใใใฏในใไบๆธฌใใใใใฎMLPใงใใ
+
+ใชใใธใงใฏใๆคๅบใ่ฉฆใๆบๅใฏใงใใพใใใ๏ผDETROใฎๅฎๅ
จใช[ใชใใธใงใฏใๆคๅบใฌใคใ](tasks/object_detection)ใใใงใใฏใใฆใDETROใฎใใกใคใณใใฅใผใใณใฐๆนๆณใจๆจ่ซๆนๆณใๅญฆใใงใใ ใใ๏ผ
+
+### Image segmentation
+
+[Mask2Former](model_doc/mask2former)ใฏใใในใฆใฎ็จฎ้กใฎ็ปๅใปใฐใกใณใใผใทใงใณใฟในใฏใ่งฃๆฑบใใใใใฎใฆใใใผใตใซใขใผใญใใฏใใฃใงใใๅพๆฅใฎใปใฐใกใณใใผใทใงใณใขใใซใฏ้ๅธธใใคใณในใฟใณในใใปใใณใใฃใใฏใใพใใฏใใใใใฃใใฏใปใฐใกใณใใผใทใงใณใฎ็นๅฎใฎใตใใฟในใฏใซๅใใใฆ่จญ่จใใใฆใใพใใMask2Formerใฏใใใใใฎใฟในใฏใฎใใใใใ*ใในใฏๅ้ก*ใฎๅ้กใจใใฆๆใใพใใใในใฏๅ้กใฏใใฏใปใซใ*N*ใฎใปใฐใกใณใใซใฐใซใผใๅใใไธใใใใ็ปๅใซๅฏพใใฆ*N*ใฎใในใฏใจใใใซๅฏพๅฟใใใฏใฉในใฉใใซใไบๆธฌใใพใใใใฎใปใฏใทใงใณใงใฏใMask2Formerใฎๅไฝๆนๆณใ่ชฌๆใใๆๅพใซSegFormerใฎใใกใคใณใใฅใผใใณใฐใ่ฉฆใใใจใใงใใพใใ
+
+
+
+
+
+Mask2Formerใฎไธป่ฆใชใณใณใใผใใณใใฏๆฌกใฎ3ใคใงใใ
+
+1. [Swin](model_doc/swin)ใใใฏใใผใณใฏ็ปๅใๅใๅ
ฅใใ3ใคใฎ้ฃ็ถใใ3x3ใฎ็ณใฟ่พผใฟใใไฝ่งฃๅๅบฆใฎ็ปๅ็นๅพดใใใใไฝๆใใพใใ
+
+2. ็นๅพดใใใใฏ*ใใฏใปใซใใณใผใใผ*ใซๆธกใใใไฝ่งฃๅๅบฆใฎ็นๅพดใ้ซ่งฃๅๅบฆใฎใใฏใปใซๅใ่พผใฟใซๅพใ
ใซใขใใใตใณใใชใณใฐใใพใใใใฏใปใซใใณใผใใผใฏๅฎ้ใซใฏ่งฃๅๅบฆ1/32ใ1/16ใใใใณ1/8ใฎใชใชใธใใซ็ปๅใฎใใซใในใฑใผใซ็นๅพด๏ผไฝ่งฃๅๅบฆใจ้ซ่งฃๅๅบฆใฎ็นๅพดใๅซใ๏ผใ็ๆใใพใใ
+
+3. ใใใใฎ็ฐใชใในใฑใผใซใฎ็นๅพดใใใใฎใใใใใฏใ้ซ่งฃๅๅบฆใฎ็นๅพดใใๅฐใใใชใใธใงใฏใใใญใฃใใใฃใใใใใซ1ๅใใคใใฉใณในใใฉใผใใผใใณใผใใผใฌใคใคใผใซๆธกใใใพใใMask2Formerใฎ่ฆ็นใฏใใใณใผใใผใฎ*ใในใฏใขใใณใทใงใณ*ใกใซใใบใ ใงใใใฏใญในใขใใณใทใงใณใ็ปๅๅ
จไฝใซๆณจๆใๅใใใใจใใงใใใฎใซๅฏพใใใในใฏใขใใณใทใงใณใฏ็ปๅใฎ็นๅฎใฎ้ ๅใซใฎใฟ็ฆ็นใๅฝใฆใพใใใใใฏ้ใใใญใผใซใซใช็ปๅ็นๅพดใ ใใงใใขใใซใๅญฆ็ฟใงใใใใใใใใฉใผใใณในใๅไธใใพใใ
+
+4. [DETR](tasks_explained#object-detection)ใจๅๆงใซใMask2Formerใๅญฆ็ฟใใใใชใใธใงใฏใใฏใจใชใไฝฟ็จใใ็ปๅใฎ็นๅพดใจ็ตใฟๅใใใฆใปใใใฎไบๆธฌ๏ผ`ใฏใฉในใฉใใซ`ใ`ใในใฏไบๆธฌ`๏ผใ่กใใพใใใใณใผใใผใฎ้ ใ็ถๆ
ใฏ็ทๅฝขๅฑคใซๆธกใใใใฏใฉในใฉใใซใซๅฏพใใใญใธใใใซๅคๆใใใพใใใญใธใใใจๆญฃ่งฃใฉใใซ้ใฎใฏใญในใจใณใใญใใผๆๅคฑใๆใๅฏ่ฝๆงใฎ้ซใใใฎใ่ฆใคใใพใใ
+
+ ใในใฏไบๆธฌใฏใใใฏใปใซๅใ่พผใฟใจๆ็ต็ใชใใณใผใใผใฎ้ ใ็ถๆ
ใ็ตใฟๅใใใฆ็ๆใใใพใใใทใฐใขใคใใฏใญในใจใณใใญใใผใใใคในๆๅคฑใใญใธใใใจๆญฃ่งฃใในใฏใฎ้ใงๆใๅฏ่ฝๆงใฎ้ซใใในใฏใ่ฆใคใใพใใ
+
+ใปใฐใกใณใใผใทใงใณใฟในใฏใซๅใ็ตใๆบๅใใงใใพใใใ๏ผSegFormerใฎใใกใคใณใใฅใผใใณใฐๆนๆณใจๆจ่ซๆนๆณใๅญฆใถใใใซใๅฎๅ
จใช[็ปๅใปใฐใกใณใใผใทใงใณใฌใคใ](tasks/semantic_segmentation)ใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+### Depth estimation
+
+[GLPN](model_doc/glpn)ใ*Global-Local Path Network*ใใฏใปใฐใกใณใใผใทใงใณใพใใฏๆทฑๅบฆๆจๅฎใชใฉใฎๅฏใชไบๆธฌใฟในใฏใซ้ฉใใฆใใพใใ[SegFormer](model_doc/segformer)ใจใณใณใผใใผใ่ปฝ้ใใณใผใใผใจ็ตใฟๅใใใTransformerใใผในใฎๆทฑๅบฆๆจๅฎใขใใซใงใใ
+
+
+
+
+
+1. ViTใฎใใใซใ็ปๅใฏใใใใฎใทใผใฑใณในใซๅๅฒใใใพใใใใใใใฎ็ปๅใใใใฏๅฐใใใงใใใใใฏใปใฐใกใณใใผใทใงใณใๆทฑๅบฆๆจๅฎใชใฉใฎๅฏใชไบๆธฌใฟในใฏใซ้ฉใใฆใใพใใ็ปๅใใใใฏใใใๅใ่พผใฟใซๅคๆใใใพใ๏ผใใใๅใ่พผใฟใฎไฝๆๆนๆณใฎ่ฉณ็ดฐใซใคใใฆใฏใ[็ปๅๅ้ก](#image-classification)ใปใฏใทใงใณใๅ็
งใใฆใใ ใใ๏ผใใใใใฎใใใๅใ่พผใฟใฏใจใณใณใผใใผใซๆธกใใใพใใ
+
+2. ใจใณใณใผใใผใฏใใใๅใ่พผใฟใๅใๅ
ฅใใ่คๆฐใฎใจใณใณใผใใผใใญใใฏใ้ใใฆใใใใๆธกใใพใใๅใใญใใฏใซใฏใขใใณใทใงใณใจMix-FFNใฌใคใคใผใๅซใพใใฆใใพใใๅพ่
ใฎๅฝนๅฒใฏไฝ็ฝฎๆ
ๅ ฑใๆไพใใใใจใงใใๅใจใณใณใผใใผใใญใใฏใฎๆๅพใซใฏใ้ๅฑค็่กจ็พใไฝๆใใใใใฎ*ใใใใใผใธใณใฐ*ใฌใคใคใผใใใใพใใ้ฃๆฅใใใใใใฎใฐใซใผใใใจใฎ็นๅพดใ้ฃ็ตใใใ้ฃ็ตใใใ็นๅพดใซๅฏพใใฆ็ทๅฝขๅฑคใ้ฉ็จใใใใใใใฎๆฐใ1/4ใฎ่งฃๅๅบฆใซๅๆธใใพใใใใใๆฌกใฎใจใณใณใผใใผใใญใใฏใธใฎๅ
ฅๅใจใชใใใใใงใฏใใฎใใญใปในๅ
จไฝใ็นฐใ่ฟใใใๅ
ใฎ็ปๅใฎ1/8ใ1/16ใใใใณ1/32ใฎ่งฃๅๅบฆใฎ็ปๅ็นๅพดใๅพใใใพใใ
+
+3. ่ปฝ้ใใณใผใใผใฏใใจใณใณใผใใผใใใฎๆๅพใฎ็นๅพดใใใ๏ผ1/32ในใฑใผใซ๏ผใๅใๅใใใใใ1/16ในใฑใผใซใซใขใใใตใณใใชใณใฐใใพใใใใฎๅพใ็นๅพดใฏๅ็นๅพดใซๅฏพใใใขใใณใทใงใณใใใใใใญใผใซใซใจใฐใญใผใใซใช็นๅพดใ้ธๆใใฆ็ตใฟๅใใใ*ใปใฌใฏใใฃใใใฃใผใใฃใผใใฅใผใธใงใณ๏ผSFF๏ผ*ใขใธใฅใผใซใซๆธกใใใ1/8ใซใขใใใตใณใใชใณใฐใใใพใใใใฎใใญใปในใฏใใณใผใใใใ็นๅพดใๅ
ใฎ็ปๅใจๅใใตใคใบใซใชใใพใง็นฐใ่ฟใใใพใใ
+
+4. ใใณใผใใใใ็นๅพดใฏใๆ็ต็ใชไบๆธฌใ่กใใใใซใปใใณใใฃใใฏใปใฐใกใณใใผใทใงใณใๆทฑๅบฆๆจๅฎใใพใใฏใใฎไปใฎๅฏใชไบๆธฌใฟในใฏใซไพ็ตฆใใใพใใใปใใณใใฃใใฏใปใฐใกใณใใผใทใงใณใฎๅ ดๅใ็นๅพดใฏใฏใฉในๆฐใซๅฏพใใใญใธใใใซๅคๆใใใใฏใญในใจใณใใญใใผๆๅคฑใไฝฟ็จใใฆๆ้ฉๅใใใพใใๆทฑๅบฆๆจๅฎใฎๅ ดๅใ็นๅพดใฏๆทฑๅบฆใใใใซๅคๆใใใๅนณๅ็ตถๅฏพ่ชคๅทฎ๏ผMAE๏ผใพใใฏๅนณๅไบไน่ชคๅทฎ๏ผMSE๏ผๆๅคฑใไฝฟ็จใใใพใใ
+
+
+
+## Natural language processing
+
+Transformerใฏๆๅใซๆฉๆขฐ็ฟป่จณใฎใใใซ่จญ่จใใใใใไปฅ้ใใปใจใใฉใฎNLPใฟในใฏใ่งฃๆฑบใใใใใฎใใใฉใซใใฎใขใผใญใใฏใใฃใจใชใฃใฆใใพใใไธ้จใฎใฟในใฏใฏTransformerใฎใจใณใณใผใใผๆง้ ใซ้ฉใใฆใใใไปใฎใฟในใฏใฏใใณใผใใผใซ้ฉใใฆใใพใใใใใซใไธ้จใฎใฟในใฏใงใฏTransformerใฎใจใณใณใผใใผ-ใใณใผใใผๆง้ ใไฝฟ็จใใพใใ
+
+### Text classification
+
+[BERT](model_doc/bert)ใฏใจใณใณใผใใผใฎใฟใฎใขใใซใงใใใใใญในใใฎ่ฑใใช่กจ็พใๅญฆ็ฟใใใใใซไธกๅดใฎๅ่ชใซๆณจๆใๆใใใจใงใๆทฑใๅๆนๅๆงใๅนๆ็ใซๅฎ่ฃ
ใใๆๅใฎใขใใซใงใใ
+
+1. BERTใฏ[WordPiece](tokenizer_summary#wordpiece)ใใผใฏใใคใผใผใทใงใณใไฝฟ็จใใฆใใญในใใฎใใผใฏใณๅใ่พผใฟใ็ๆใใพใใๅไธใฎๆใจๆใฎใใขใๅบๅฅใใใใใซใ็นๅฅใช `[SEP]` ใใผใฏใณใ่ฟฝๅ ใใใพใใ `[CLS]` ใใผใฏใณใฏใในใฆใฎใใญในใใทใผใฑใณในใฎๅ
้ ญใซ่ฟฝๅ ใใใพใใ `[CLS]` ใใผใฏใณใจใจใใซๆ็ตๅบๅใฏใๅ้กใฟในใฏใฎใใใฎๅ
ฅๅใจใใฆไฝฟ็จใใใพใใBERTใฏใพใใใใผใฏใณใๆใฎใใขใฎๆๅใพใใฏ2็ช็ฎใฎๆใซๅฑใใใใฉใใใ็คบใใปใฐใกใณใๅใ่พผใฟใ่ฟฝๅ ใใพใใ
+
+2. BERTใฏใไบๅใใฌใผใใณใฐใง2ใคใฎ็ฎๆจใไฝฟ็จใใพใ๏ผใในใฏใใใ่จ่ชใขใใชใณใฐใจๆฌกใฎๆใฎไบๆธฌใงใใใในใฏใใใ่จ่ชใขใใชใณใฐใงใฏใๅ
ฅๅใใผใฏใณใฎไธ้จใใฉใณใใ ใซใในใฏใใใใขใใซใฏใใใใไบๆธฌใใๅฟ
่ฆใใใใพใใใใใซใใใใขใใซใๅ
จใฆใฎๅ่ชใ่ฆใฆใๆฌกใฎๅ่ชใใไบๆธฌใใใใจใใงใใๅๆนๅๆงใฎๅ้กใ่งฃๆฑบใใใพใใไบๆธฌใใใใในใฏใใผใฏใณใฎๆ็ต็ใช้ ใใ็ถๆ
ใฏใใฝใใใใใฏในใไฝฟ็จใใๅ่ชใฎใในใฏใไบๆธฌใใใใใฎใใฃใผใใใฉใฏใผใใใใใฏใผใฏใซๆธกใใใพใใ
+
+ 2็ช็ฎใฎไบๅใใฌใผใใณใฐใชใใธใงใฏใใฏๆฌกใฎๆใฎไบๆธฌใงใใใขใใซใฏๆAใฎๅพใซๆBใ็ถใใใฉใใใไบๆธฌใใๅฟ
่ฆใใใใพใใๅๅใฎๅ ดๅใๆBใฏๆฌกใฎๆใงใใใๆฎใใฎๅๅใฎๅ ดๅใๆBใฏใฉใณใใ ใชๆใงใใไบๆธฌ๏ผๆฌกใฎๆใใฉใใ๏ผใฏใ2ใคใฎใฏใฉใน๏ผ`IsNext`ใใใณ`NotNext`๏ผใซๅฏพใใใฝใใใใใฏในใๆใคใใฃใผใใใฉใฏใผใใใใใฏใผใฏใซๆธกใใใพใใ
+
+3. ๅ
ฅๅๅใ่พผใฟใฏใๆ็ต็ใช้ ใใ็ถๆ
ใๅบๅใใใใใซ่คๆฐใฎใจใณใณใผใใผใฌใคใคใผใไปใใฆๆธกใใใพใใ
+
+ไบๅ่จ็ทดๆธใฟใขใใซใใใญในใๅ้กใซไฝฟ็จใใใซใฏใใใผในใฎBERTใขใใซใฎไธใซใทใผใฑใณในๅ้กใใใใ่ฟฝๅ ใใพใใใทใผใฑใณในๅ้กใใใใฏๆ็ต็ใช้ ใใ็ถๆ
ใๅใๅ
ฅใใใใใใใญใธใใใซๅคๆใใใใใฎ็ทๅฝขๅฑคใงใใใฏใญในใจใณใใญใใผๆๅคฑใฏใใญใธใใใจใฟใผใฒใใ้ใงๆใๅฏ่ฝๆงใฎ้ซใใฉใใซใ่ฆใคใใใใใซ่จ็ฎใใใพใใ
+
+ใใญในใๅ้กใ่ฉฆใใฆใฟใๆบๅใฏใงใใพใใใ๏ผDistilBERTใๅพฎ่ชฟๆดใใๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใซใๅฎๅ
จใช[ใใญในใๅ้กใฌใคใ](tasks/sequence_classification)ใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+### Token classification
+
+BERTใๅๅใจใณใใฃใใฃ่ช่ญ๏ผNER๏ผใชใฉใฎใใผใฏใณๅ้กใฟในใฏใซไฝฟ็จใใใซใฏใใใผในใฎBERTใขใใซใฎไธใซใใผใฏใณๅ้กใใใใ่ฟฝๅ ใใพใใใใผใฏใณๅ้กใใใใฏๆ็ต็ใช้ ใใ็ถๆ
ใๅใๅ
ฅใใใใใใใญใธใใใซๅคๆใใใใใฎ็ทๅฝขๅฑคใงใใใฏใญในใจใณใใญใใผๆๅคฑใฏใใญใธใใใจๅใใผใฏใณ้ใงๆใๅฏ่ฝๆงใฎ้ซใใฉใใซใ่ฆใคใใใใใซ่จ็ฎใใใพใใ
+
+ใใผใฏใณๅ้กใ่ฉฆใใฆใฟใๆบๅใฏใงใใพใใใ๏ผDistilBERTใๅพฎ่ชฟๆดใใๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใซใๅฎๅ
จใช[ใใผใฏใณๅ้กใฌใคใ](tasks/token_classification)ใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+### Question answering
+
+BERTใ่ณชๅๅฟ็ญใซไฝฟ็จใใใซใฏใใใผในใฎBERTใขใใซใฎไธใซในใใณๅ้กใใใใ่ฟฝๅ ใใพใใใใฎ็ทๅฝขๅฑคใฏๆ็ต็ใช้ ใใ็ถๆ
ใๅใๅ
ฅใใๅ็ญใซๅฏพๅฟใใใใญในใใฎใในใใณใ้ๅงใจ็ตไบใฎใญใธใใใ่จ็ฎใใพใใใฏใญในใจใณใใญใใผๆๅคฑใฏใใญใธใใใจใฉใใซไฝ็ฝฎใจใฎ้ใงๆใๅฏ่ฝๆงใฎ้ซใใใญในใในใใณใ่ฆใคใใใใใซ่จ็ฎใใใพใใ
+
+่ณชๅๅฟ็ญใ่ฉฆใใฆใฟใๆบๅใฏใงใใพใใใ๏ผDistilBERTใๅพฎ่ชฟๆดใใๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใซใๅฎๅ
จใช[่ณชๅๅฟ็ญใฌใคใ](tasks/question_answering)ใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+
+
+๐ก ๆณจๆใใฆใใ ใใใไธๅบฆไบๅใใฌใผใใณใฐใๅฎไบใใBERTใไฝฟ็จใใฆใใพใใพใชใฟในใฏใซ็ฐกๅใซ้ฉ็จใงใใใใจใซๆณจ็ฎใใฆใใ ใใใๅฟ
่ฆใชใฎใฏใไบๅใใฌใผใใณใฐๆธใฟใขใใซใซ็นๅฎใฎใใใใ่ฟฝๅ ใใฆใ้ ใใ็ถๆ
ใๆๆใฎๅบๅใซๅคๆใใใใจใ ใใงใ๏ผ
+
+
+
+### Text generation
+
+[GPT-2](model_doc/gpt2)ใฏๅคง้ใฎใใญในใใงไบๅใใฌใผใใณใฐใใใใใณใผใใผๅฐ็จใขใใซใงใใใใญใณใใใไธใใใจ่ชฌๅพๅใฎใใใใญในใใ็ๆใใๆ็คบ็ใซใใฌใผใใณใฐใใใฆใใชใใซใใใใใใใ่ณชๅๅฟ็ญใชใฉใฎไปใฎNLPใฟในใฏใๅฎไบใงใใพใใ
+
+
+
+
+
+1. GPT-2ใฏ[ใใคใใใขใจใณใณใผใใฃใณใฐ๏ผBPE๏ผ](tokenizer_summary#bytepair-encoding-bpe)ใไฝฟ็จใใฆๅ่ชใใใผใฏใใคใบใใใใผใฏใณๅใ่พผใฟใ็ๆใใพใใไฝ็ฝฎใจใณใณใผใใฃใณใฐใใใผใฏใณๅใ่พผใฟใซ่ฟฝๅ ใใใๅใใผใฏใณใฎไฝ็ฝฎใ็คบใใพใใๅ
ฅๅๅใ่พผใฟใฏ่คๆฐใฎใใณใผใใผใใญใใฏใไปใใฆๆ็ต็ใช้ ใใ็ถๆ
ใๅบๅใใใใใซๆธกใใใพใใๅใใณใผใใผใใญใใฏๅ
ใงใGPT-2ใฏใใในใฏใใใ่ชๅทฑๆณจๆใใฌใคใคใผใไฝฟ็จใใพใใใใใฏใGPT-2ใๆชๆฅใฎใใผใฏใณใซๆณจๆใๆใใใจใฏใงใใชใใใจใๆๅณใใพใใGPT-2ใฏๅทฆๅดใฎใใผใฏใณใซใฎใฟๆณจๆใๆใใใจใ่จฑๅฏใใใฆใใพใใใใใฏBERTใฎ[`mask`]ใใผใฏใณใจใฏ็ฐใชใใใในใฏใใใ่ชๅทฑๆณจๆใงใฏๆชๆฅใฎใใผใฏใณใซๅฏพใใฆในใณใขใ`0`ใซ่จญๅฎใใใใใฎๆณจๆใในใฏใไฝฟ็จใใใพใใ
+
+2. ใใณใผใใผใใใฎๅบๅใฏใ่จ่ชใขใใชใณใฐใใใใซๆธกใใใๆ็ต็ใช้ ใใ็ถๆ
ใใญใธใใใซๅคๆใใใใใฎ็ทๅฝขๅคๆใๅฎ่กใใพใใใฉใใซใฏใทใผใฑใณในๅ
ใฎๆฌกใฎใใผใฏใณใงใใใใใใฏใญใธใใใๅณใซ1ใคใใใใฆ็ๆใใใพใใใฏใญในใจใณใใญใใผๆๅคฑใฏใใทใใใใใใญใธใใใจใฉใใซ้ใง่จ็ฎใใใๆฌกใซๆใๅฏ่ฝๆงใฎ้ซใใใผใฏใณใๅบๅใใพใใ
+
+GPT-2ใฎไบๅใใฌใผใใณใฐใฎ็ฎๆจใฏๅฎๅ
จใซ[ๅ ๆ่จ่ชใขใใชใณใฐ](glossary#causal-language-modeling)ใซๅบใฅใใฆใใใใทใผใฑใณในๅ
ใฎๆฌกใฎๅ่ชใไบๆธฌใใพใใใใใซใใใGPT-2ใฏใใญในใ็ๆใๅซใใฟในใฏใง็นใซๅชใใๆง่ฝใ็บๆฎใใพใใ
+
+ใใญในใ็ๆใ่ฉฆใใฆใฟใๆบๅใฏใงใใพใใใ๏ผDistilGPT-2ใๅพฎ่ชฟๆดใใๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใซใๅฎๅ
จใช[ๅ ๆ่จ่ชใขใใชใณใฐใฌใคใ](tasks/language_modeling#causal-language-modeling)ใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+
+
+ใใญในใ็ๆใซ้ขใใ่ฉณ็ดฐใฏใ[ใใญในใ็ๆๆฆ็ฅ](generation_strategies)ใฌใคใใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+
+
+
+### Summarization
+
+[BART](model_doc/bart) ใ [T5](model_doc/t5) ใฎใใใชใจใณใณใผใใผใใณใผใใผใขใใซใฏใ่ฆ็ดใฟในใฏใฎใทใผใฑใณในใปใใฅใปใทใผใฑใณในใปใใฟใผใณใซ่จญ่จใใใฆใใพใใใใฎใปใฏใทใงใณใงใฏใBARTใฎๅไฝๆนๆณใ่ชฌๆใใๆๅพใซT5ใฎๅพฎ่ชฟๆดใ่ฉฆใใใจใใงใใพใใ
+
+
+
+
+
+1. BARTใฎใจใณใณใผใใผใขใผใญใใฏใใฃใฏใBERTใจ้ๅธธใซไผผใฆใใใใใญในใใฎใใผใฏใณใจไฝ็ฝฎใจใณใใใฃใณใฐใๅใๅ
ฅใใพใใBARTใฏใๅ
ฅๅใ็ ดๅฃใใฆใใใใณใผใใผใงๅๆง็ฏใใใใจใซใใฃใฆไบๅใใฌใผใใณใฐใใใพใใ็นๅฎใฎ็ ดๅฃๆฆ็ฅใๆใคไปใฎใจใณใณใผใใผใจใฏ็ฐใชใใBARTใฏไปปๆใฎ็จฎ้กใฎ็ ดๅฃใ้ฉ็จใงใใพใใใใ ใใ*ใใญในใใคใณใใฃใชใณใฐ*็ ดๅฃๆฆ็ฅใๆ้ฉใงใใใใญในใใคใณใใฃใชใณใฐใงใฏใใใใคใใฎใใญในใในใใณใ**ๅไธใฎ** [`mask`] ใใผใฏใณใง็ฝฎใๆใใใใพใใใใใฏ้่ฆใงใใใชใใชใใขใใซใฏใในใฏใใใใใผใฏใณใไบๆธฌใใชใใใฐใชใใใใขใใซใซๆฌ ่ฝใใผใฏใณใฎๆฐใไบๆธฌใใใใใใงใใๅ
ฅๅๅใ่พผใฟใจใในใฏใใใในใใณใฏใจใณใณใผใใผใไปใใฆๆ็ต็ใช้ ใใ็ถๆ
ใๅบๅใใพใใใBERTใจใฏ็ฐใชใใBARTใฏๅ่ชใไบๆธฌใใใใใฎๆ็ต็ใชใใฃใผใใใฉใฏใผใใใใใฏใผใฏใๆๅพใซ่ฟฝๅ ใใพใใใ
+
+2. ใจใณใณใผใใผใฎๅบๅใฏใใณใผใใผใซๆธกใใใใใณใผใใผใฏใจใณใณใผใใผใฎๅบๅใใใในใฏใใใใใผใฏใณใจ้็ ดๅฃใใผใฏใณใไบๆธฌใใๅฟ
่ฆใใใใพใใใใใซใใใใใณใผใใผใฏๅ
ใฎใใญในใใๅพฉๅ
ใใใฎใซๅฝน็ซใค่ฟฝๅ ใฎใณใณใใญในใใๆไพใใใพใใใใณใผใใผใใใฎๅบๅใฏ่จ่ชใขใใชใณใฐใใใใซๆธกใใใ้ ใใ็ถๆ
ใใญใธใใใซๅคๆใใใใใฎ็ทๅฝขๅคๆใๅฎ่กใใพใใใฏใญในใจใณใใญใใผๆๅคฑใฏใใญใธใใใจใฉใใซใฎ้ใง่จ็ฎใใใใฉใใซใฏๅใซๅณใซใทใใใใใใใผใฏใณใงใใ
+
+่ฆ็ดใ่ฉฆใๆบๅใฏใงใใพใใใ๏ผT5ใๅพฎ่ชฟๆดใใฆๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใซใๅฎๅ
จใช[่ฆ็ดใฌใคใ](tasks/summarization)ใใ่ฆงใใ ใใ๏ผ
+
+
+
+ใใญในใ็ๆใซ้ขใใ่ฉณ็ดฐใฏใ[ใใญในใ็ๆๆฆ็ฅ](generation_strategies)ใฌใคใใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+
+
+### Translation
+
+็ฟป่จณใฏใใใไธใคใฎใทใผใฑใณในใปใใฅใปใทใผใฑใณในใปใฟในใฏใฎไพใงใใใ[BART](model_doc/bart) ใ [T5](model_doc/t5) ใฎใใใชใจใณใณใผใใผใใณใผใใผใขใใซใไฝฟ็จใใฆๅฎ่กใงใใพใใใใฎใปใฏใทใงใณใงใฏใBARTใฎๅไฝๆนๆณใ่ชฌๆใใๆๅพใซT5ใฎๅพฎ่ชฟๆดใ่ฉฆใใใจใใงใใพใใ
+
+BARTใฏใใฝใผใน่จ่ชใใฟใผใฒใใ่จ่ชใซใใณใผใใงใใใใใซใใใใใซใๅฅๅใซใฉใณใใ ใซๅๆๅใใใใจใณใณใผใใผใ่ฟฝๅ ใใใใจใง็ฟป่จณใซ้ฉๅฟใใพใใใใฎๆฐใใใจใณใณใผใใผใฎๅใ่พผใฟใฏใๅ
ใฎๅ่ชๅใ่พผใฟใฎไปฃใใใซไบๅใใฌใผใใณใฐๆธใฟใฎใจใณใณใผใใผใซๆธกใใใพใใใฝใผในใจใณใณใผใใผใฏใใขใใซใฎๅบๅใใใฎใฏใญในใจใณใใญใใผๆๅคฑใ็จใใฆใฝใผในใจใณใณใผใใผใไฝ็ฝฎใจใณใใใฃใณใฐใใใใณๅ
ฅๅใจใณใใใฃใณใฐใๆดๆฐใใใใจใซใใฃใฆ่จ็ทดใใใพใใใใฎๆๅใฎในใใใใงใฏใขใใซใใฉใกใผใฟใๅบๅฎใใใใในใฆใฎใขใใซใใฉใกใผใฟใ2็ช็ฎใฎในใใใใงไธ็ทใซ่จ็ทดใใใพใใ
+
+ใใฎๅพใ็ฟป่จณใฎใใใซๅค่จ่ช็ใฎmBARTใ็ปๅ ดใใๅค่จ่ชใงไบๅใใฌใผใใณใฐใใใใขใใซใจใใฆๅฉ็จๅฏ่ฝใงใใ
+
+็ฟป่จณใ่ฉฆใๆบๅใฏใงใใพใใใ๏ผT5ใๅพฎ่ชฟๆดใใฆๆจ่ซใซไฝฟ็จใใๆนๆณใๅญฆใถใใใซใๅฎๅ
จใช[็ฟป่จณใฌใคใ](tasks/summarization)ใใ่ฆงใใ ใใ๏ผ
+
+
+
+ใใญในใ็ๆใซ้ขใใ่ฉณ็ดฐใฏใ[ใใญในใ็ๆๆฆ็ฅ](generation_strategies)ใฌใคใใใใงใใฏใใฆใฟใฆใใ ใใ๏ผ
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/testing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/testing.md
new file mode 100644
index 0000000000000000000000000000000000000000..8831d48a3bdaff4739b8425828d15fffbdce2b6a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/testing.md
@@ -0,0 +1,1213 @@
+
+
+# Testing
+
+๐ค Transformersใขใใซใใฉใฎใใใซใในใใใใๆฐใใใในใใๆธใใฆๆขๅญใฎใในใใๆนๅใงใใใใ่ฆใฆใฟใพใใใใ
+
+ใใฎใชใใธใใชใซใฏ2ใคใฎใในใในใคใผใใใใใพใ๏ผ
+
+1. `tests` -- ไธ่ฌ็ใชAPI็จใฎใในใ
+2. `examples` -- APIใฎไธ้จใงใฏใชใใใพใใพใชใขใใชใฑใผใทใงใณ็จใฎใในใ
+
+## How transformers are tested
+
+1. PRใๆๅบใใใใจใ9ใคใฎCircleCiใธใงใใงใในใใใใพใใPRใธใฎๆฐใใใณใใใใใจใซๅใในใใใใพใใใใใใฎใธใงใใฏใ[ใใฎ่จญๅฎใใกใคใซ](https://github.com/huggingface/transformers/tree/main/.circleci/config.yml)ใงๅฎ็พฉใใใฆใใใๅฟ
่ฆใชๅ ดๅใฏๅใ็ฐๅขใ่ชๅใฎใใทใณใงๅ็พใงใใพใใ
+
+ ใใใใฎCIใธใงใใฏ `@slow` ใในใใๅฎ่กใใพใใใ
+
+2. [GitHub Actions](https://github.com/huggingface/transformers/actions)ใซใใฃใฆๅฎ่กใใใ3ใคใฎใธใงใใใใใพใ๏ผ
+
+ - [torch hub integration](https://github.com/huggingface/transformers/tree/main/.github/workflows/github-torch-hub.yml): torch hubใฎ็ตฑๅใๅไฝใใใใฉใใใ็ขบ่ชใใพใใ
+
+ - [self-hosted (push)](https://github.com/huggingface/transformers/tree/main/.github/workflows/self-push.yml): `main` ใซใณใใใใ่กใใใๅ ดๅใซใGPUใง้ซ้ใในใใๅฎ่กใใพใใใใฎใธใงใใฏใ`main` ใงใฎใณใใใใไปฅไธใฎใใฉใซใใผใฎใณใผใใๆดๆฐใใๅ ดๅใซใฎใฟๅฎ่กใใใพใ๏ผ`src`ใ`tests`ใ`.github`๏ผ่ฟฝๅ ใใใใขใใซใซใผใใใใผใใใใฏใชใฉใฎๅฎ่กใ้ฒใใใ๏ผใ
+
+ - [self-hosted runner](https://github.com/huggingface/transformers/tree/main/.github/workflows/self-scheduled.yml): GPUใง `tests` ใจ `examples` ใฎ้ๅธธใฎใในใใจ้
ใใในใใๅฎ่กใใพใใ
+
+```bash
+RUN_SLOW=1 pytest tests/
+RUN_SLOW=1 pytest examples/
+```
+ ็ตๆใฏ[here](https://github.com/huggingface/transformers/actions)ใง่ฆณๅฏใงใใพใใ
+
+## Running tests
+
+
+
+### Choosing which tests to run
+
+ใใฎใใญใฅใกใณใใฏใใในใใๅฎ่กใใๆนๆณใฎๅคใใฎ่ฉณ็ดฐใซใคใใฆ่ชฌๆใใฆใใพใใใในใฆใ่ชญใใ ๅพใงใใใใใซ่ฉณ็ดฐใๅฟ
่ฆใชๅ ดๅใฏใ[ใใกใ](https://docs.pytest.org/en/latest/usage.html)ใง่ฆใคใใใใจใใงใใพใใ
+
+ไปฅไธใฏใใในใใๅฎ่กใใใใใฎใใใคใใฎๆใไพฟๅฉใชๆนๆณใงใใ
+
+ใในใฆๅฎ่กใใพใ:
+```console
+pytest
+```
+
+ใพใใฏ๏ผ
+```bash
+make test
+```
+
+
+ๅพ่
ใฏๆฌกใฎใใใซๅฎ็พฉใใใใใจใซๆณจๆใใฆใใ ใใใ
+
+```bash
+python -m pytest -n auto --dist=loadfile -s -v ./tests/
+```
+
+ไปฅไธใฏใpytestใซๆธกใ่จญๅฎๆ
ๅ ฑใงใใ
+
+- ใในใใใญใปในใCPUใณใขใฎๆฐใจๅใใ ใๅฎ่กใใใใใซๆ็คบใใพใใใใ ใใRAMใๅๅใงใชใๅ ดๅใฏๆณจๆใๅฟ
่ฆใงใใ
+- ๅใใใกใคใซใใใฎใในใฆใฎใในใใฏใๅใใในใใใญใปในใงๅฎ่กใใใใใใซใใพใใ
+- ๅบๅใฎใญใฃใใใฃใ่กใใพใใใ
+- ๅ้ทใขใผใใงๅฎ่กใใพใใ
+
+
+### Getting the list of all tests
+
+ใในใในใคใผใใฎใในใฆใฎใในใ๏ผ
+
+```bash
+pytest --collect-only -q
+```
+
+ๆๅฎใใใใในใ ใใกใคใซใฎใในใฆใฎใในใ:
+
+```bash
+pytest tests/test_optimization.py --collect-only -q
+```
+
+### Run a specific test module
+
+ๅๅฅใฎใในใ ใขใธใฅใผใซใๅฎ่กใใใซใฏ:
+
+```bash
+pytest tests/utils/test_logging.py
+```
+
+### Run specific tests
+
+ใปใจใใฉใฎใในใใงunittestใไฝฟ็จใใใฆใใใใใ็นๅฎใฎใตใใในใใๅฎ่กใใใซใฏใใใใใฎใในใใๅซใunittestใฏใฉในใฎๅๅใ็ฅใฃใฆใใๅฟ
่ฆใใใใพใใไพใใฐใใใใฏๆฌกใฎใใใซใชใใใใใใพใใ๏ผ
+
+
+```bash
+pytest tests/test_optimization.py::OptimizationTest::test_adam_w
+```
+
+ใในใใฎๅฎ่กๆนๆณ:
+
+ใในใใใกใคใซ: `tests/test_optimization.py`
+ใฏใฉในๅ: `OptimizationTest`
+ใในใ้ขๆฐใฎๅๅ: `test_adam_w`
+
+ใใกใคใซใซ่คๆฐใฎใฏใฉในใๅซใพใใฆใใๅ ดๅใฏใ็นๅฎใฎใฏใฉในใฎใในใใฎใฟใๅฎ่กใใใใจใ้ธๆใงใใพใใไพใใฐ๏ผ
+
+```bash
+pytest tests/test_optimization.py::OptimizationTest
+```
+
+ใในใใฏใฉในๅ
ใฎใในใฆใฎใในใใๅฎ่กใใพใใ
+
+ๅ่ฟฐใฎ้ใใ`OptimizationTest` ใฏใฉในใซๅซใพใใใในใใๅฎ่กใใใซใฏใๆฌกใฎใณใใณใใๅฎ่กใงใใพใ๏ผ
+
+```bash
+pytest tests/test_optimization.py::OptimizationTest --collect-only -q
+```
+
+ใญใผใฏใผใๅผใไฝฟ็จใใฆใในใใๅฎ่กใงใใพใใ
+
+ๅๅใซ `adam` ใๅซใพใใใในใใฎใฟใๅฎ่กใใใซใฏ๏ผ
+
+```bash
+pytest -k adam tests/test_optimization.py
+```
+
+`and`ใใใณ`or`ใฏใใในใฆใฎใญใผใฏใผใใไธ่ดใใใใใใใใใ็คบใใใใซไฝฟ็จใงใใพใใ`not`ใฏๅฆๅฎใใใใใซไฝฟ็จใงใใพใใ
+
+`adam`ใจใใๅๅใๅซใใในใใ้คใใฆใในใฆใฎใในใใๅฎ่กใใใซใฏ๏ผ
+
+```bash
+pytest -k "not adam" tests/test_optimization.py
+```
+
+
+ไปฅไธใฏใๆไพใใใใใญในใใฎๆฅๆฌ่ช่จณใงใใ
+
+```bash
+pytest -k "ada and not adam" tests/test_optimization.py
+```
+
+ใใจใใฐใ`test_adafactor`ใจ`test_adam_w`ใฎไธกๆนใๅฎ่กใใใซใฏใไปฅไธใฎใณใใณใใไฝฟ็จใงใใพใ:
+
+```bash
+pytest -k "test_adam_w or test_adam_w" tests/test_optimization.py
+```
+
+ๆณจๆ: ใใใงใฏใ`or` ใไฝฟ็จใใฆใใพใใใญใผใฏใผใใฎใใใใไธใคใไธ่ดใใใฐใไธกๆนใๅซใใใใใงใใ
+
+ไธกๆนใฎใใฟใผใณใๅซใใในใใฎใฟใๅซใใใๅ ดๅใฏใ`and` ใไฝฟ็จใใฆใใ ใใใ
+
+```bash
+pytest -k "test and ada" tests/test_optimization.py
+```
+
+### Run `accelerate` tests
+
+ๆใ
ใใขใใซใซๅฏพใใฆ `accelerate` ใในใใๅฎ่กใใๅฟ
่ฆใใใใพใใใใจใใฐใ`OPT` ๅฎ่กใซๅฏพใใฆใใใใฎใในใใๅฎ่กใใใๅ ดๅใใณใใณใใซ `-m accelerate_tests` ใ่ฟฝๅ ใใใ ใใงๆธใฟใพใ๏ผ
+
+```bash
+RUN_SLOW=1 pytest -m accelerate_tests tests/models/opt/test_modeling_opt.py
+```
+
+### Run documentation tests
+
+ใใญใฅใกใณใใผใทใงใณใฎไพใๆญฃใใใใฉใใใใในใใใใซใฏใ`doctests` ใๅๆ ผใใฆใใใใ็ขบ่ชใใๅฟ
่ฆใใใใพใใ
+ไพใจใใฆใ[`WhisperModel.forward` ใฎใใใฏในใใชใณใฐ](https://github.com/huggingface/transformers/blob/main/src/transformers/models/whisper/modeling_whisper.py#L1017-L1035)ใไฝฟ็จใใพใใใใ
+
+
+```python
+r"""
+Returns:
+
+Example:
+ ```python
+ >>> import torch
+ >>> from transformers import WhisperModel, WhisperFeatureExtractor
+ >>> from datasets import load_dataset
+
+ >>> model = WhisperModel.from_pretrained("openai/whisper-base")
+ >>> feature_extractor = WhisperFeatureExtractor.from_pretrained("openai/whisper-base")
+ >>> ds = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation")
+ >>> inputs = feature_extractor(ds[0]["audio"]["array"], return_tensors="pt")
+ >>> input_features = inputs.input_features
+ >>> decoder_input_ids = torch.tensor([[1, 1]]) * model.config.decoder_start_token_id
+ >>> last_hidden_state = model(input_features, decoder_input_ids=decoder_input_ids).last_hidden_state
+ >>> list(last_hidden_state.shape)
+ [1, 2, 512]
+ ```"""
+
+```
+
+ๆๅฎใใใใกใคใซๅ
ใฎใในใฆใฎใใใฏในใใชใณใฐไพใ่ชๅ็ใซใในใใใใใใซใไปฅไธใฎ่กใๅฎ่กใใฆใใ ใใ๏ผ
+
+```bash
+pytest --doctest-modules
+```
+
+ใใกใคใซใซใใผใฏใใฆใณๆกๅผตๅญใใใๅ ดๅใฏใ`--doctest-glob="*.md"`ๅผๆฐใ่ฟฝๅ ใใๅฟ
่ฆใใใใพใใ
+
+
+### Run only modified tests
+
+[pytest-picked](https://github.com/anapaulagomes/pytest-picked)ใไฝฟ็จใใใจใๆชในใใผใธใณใฐใฎใใกใคใซใพใใฏ็พๅจใฎใใฉใณใ๏ผGitใซๅพใฃใฆ๏ผใซ้ข้ฃใใใในใใๅฎ่กใงใใพใใใใใฏใๅคๆดๅ
ๅฎนใซ้ข้ฃใใใในใใฎใฟๅฎ่กใใใใใใๅคๆดใไฝใๅฃใใฆใใชใใใจใ่ฟ
้ใซ็ขบ่ชใใ็ด ๆดใใใๆนๆณใงใใๅคๆดใใใฆใใชใใใกใคใซใซ้ข้ฃใใใในใใฏๅฎ่กใใใพใใใ
+
+```bash
+pip install pytest-picked
+```
+
+```bash
+pytest --picked
+```
+
+ใในใฆใฎใในใใฏใๅคๆดใใใใใพใ ใณใใใใใใฆใใชใใใกใคใซใจใใฉใซใใใๅฎ่กใใใพใใ
+
+### Automatically rerun failed tests on source modification
+
+[pytest-xdist](https://github.com/pytest-dev/pytest-xdist)ใฏใ้ๅธธใซไพฟๅฉใชๆฉ่ฝใๆไพใใฆใใใใในใฆใฎๅคฑๆใใใในใใๆคๅบใใใใกใคใซใไฟฎๆญฃใใ้ใซใใใใฎๅคฑๆใใใในใใ้ฃ็ถใใฆๅๅฎ่กใใใใจใใงใใพใใใใฎใใใไฟฎๆญฃใ่กใฃใๅพใซpytestใๅ่ตทๅใใๅฟ
่ฆใใใใพใใใใในใฆใฎใในใใๅๆ ผใใใพใง็นฐใ่ฟใใใใใฎๅพๅๅบฆใใซใฉใณใๅฎ่กใใใพใใ
+
+
+```bash
+pip install pytest-xdist
+```
+
+ใขใผใใซๅ
ฅใใซใฏ๏ผ `pytest -f`ใพใใฏ`pytest --looponfail`
+
+ใใกใคใซใฎๅคๆดใฏใ`looponfailroots`ใซใผใใใฃใฌใฏใใชใจใใฎๅ
ๅฎนๅ
จไฝ๏ผๅๅธฐ็ใซ๏ผใ่ฆใฆๆคๅบใใใพใใใใฎๅคใฎใใใฉใซใใๆฉ่ฝใใชใๅ ดๅใ`setup.cfg`ใง่จญๅฎใชใใทใงใณใๅคๆดใใฆใใญใธใงใฏใๅ
ใงๅคๆดใงใใพใใ
+
+
+```ini
+[tool:pytest]
+looponfailroots = transformers tests
+```
+
+ใพใใฏ `pytest.ini`/`tox.ini` ใใกใคใซ:
+
+```ini
+[pytest]
+looponfailroots = transformers tests
+```
+
+ใใกใคใซใฎๅคๆดใๆขใใใจใฏใiniใใกใคใซใฎใใฃใฌใฏใใชใๅบๆบใซใใฆๆๅฎใใใใใฃใฌใฏใใชๅ
ใงใฎใฟ่กใใใพใใ
+
+[pytest-watch](https://github.com/joeyespo/pytest-watch) ใฏใใใฎๆฉ่ฝใฎไปฃๆฟๅฎ่ฃ
ใงใใ
+
+### Skip a test module
+
+็นๅฎใฎใในใใขใธใฅใผใซใ้คๅคใใฆใในใฆใฎใในใใขใธใฅใผใซใๅฎ่กใใใๅ ดๅใๅฎ่กใใใในใใฎๆ็คบ็ใชใชในใใๆๅฎใใใใจใใงใใพใใไพใใฐใ`test_modeling_*.py` ใในใใ้คๅคใใฆใในใฆใๅฎ่กใใใซใฏๆฌกใฎใใใซใใพใ๏ผ
+
+```bash
+pytest *ls -1 tests/*py | grep -v test_modeling*
+```
+
+### Clearing state
+
+CIใใซใใใใณ้ๅบฆใซๅฏพใใ้้ขใ้่ฆใชๅ ดๅ๏ผใญใฃใใทใฅใซๅฏพใใฆ๏ผใใญใฃใใทใฅใใฏใชใขใใๅฟ
่ฆใใใใพใ๏ผ
+
+```bash
+pytest --cache-clear tests
+```
+
+### Running tests in parallel
+
+ๅ่ฟฐใฎใใใซใ`make test` ใฏ `pytest-xdist` ใใฉใฐใคใณใไปใใฆใในใใไธฆๅๅฎ่กใใพใ๏ผ`-n X` ๅผๆฐใไพ: `-n 2` ใง2ใคใฎไธฆๅใธใงใใๅฎ่ก๏ผใ
+
+`pytest-xdist` ใฎ `--dist=` ใชใใทใงใณใไฝฟ็จใใใจใใในใใใฉใฎใใใซใฐใซใผใๅใใใใใๅถๅพกใงใใพใใ`--dist=loadfile` ใฏๅใใใกใคใซใซใใใในใใๅใใใญใปในใซ้
็ฝฎใใพใใ
+
+ใในใใฎๅฎ่ก้ ๅบใ็ฐใชใไบๆธฌไธๅฏ่ฝใงใใใใใ`pytest-xdist` ใไฝฟ็จใใฆใในใในใคใผใใๅฎ่กใใใจๅคฑๆใ็บ็ใใๅ ดๅ๏ผใคใพใใใใใคใใฎๆชๆคๅบใฎ้ฃๅใในใใใใๅ ดๅ๏ผใ[pytest-replay](https://github.com/ESSS/pytest-replay) ใไฝฟ็จใใฆใในใใๅใ้ ๅบใงๅ็ใใใใฎๅพใๅคฑๆใใใทใผใฑใณในใๆๅฐ้ใซใใใฎใซๅฝน็ซใกใพใใ
+
+### Test order and repetition
+
+ๆฝๅจ็ใช็ธไบไพๅญๆงใ็ถๆ
ใซ้ข้ฃใใใใฐ๏ผใใฃใขใใฆใณ๏ผใๆคๅบใใใใใซใใในใใ่คๆฐๅใ้ฃ็ถใใฆใใฉใณใใ ใซใใพใใฏใปใใใง็นฐใ่ฟใใใจใฏๆ็จใงใใใใใฆใๅ็ดใช่คๆฐๅใฎ็นฐใ่ฟใใฏใDLใฎใฉใณใใ ๆงใซใใฃใฆๆใใใซใชใใใใคใใฎๅ้กใๆคๅบใใใฎใซๅฝน็ซใกใพใใ
+
+#### Repeat tests
+
+- [pytest-flakefinder](https://github.com/dropbox/pytest-flakefinder):
+
+```bash
+pip install pytest-flakefinder
+```
+
+ใใใฆใใในใฆใฎใในใใ่คๆฐๅๅฎ่กใใพใ (ใใใฉใซใใงใฏ 50 ๅ)ใ
+
+```bash
+pytest --flake-finder --flake-runs=5 tests/test_failing_test.py
+```
+
+
+
+ใใฎใใฉใฐใคใณใฏใ`pytest-xdist` ใฎ `-n` ใใฉใฐใงใฏๅไฝใใพใใใ
+
+
+
+
+
+
+ๅฅใฎใใฉใฐใคใณ `pytest-repeat` ใใใใพใใใใใใฏ `unittest` ใงใฏๅไฝใใพใใใ
+
+
+
+#### Run tests in a random order
+
+```bash
+pip install pytest-random-order
+```
+
+้่ฆ: `pytest-random-order` ใๅญๅจใใใจใใในใใฏ่ชๅ็ใซใฉใณใใ ๅใใใพใใ่จญๅฎใฎๅคๆดใๅคๆดใฏๅฟ
่ฆใใใพใใใ
+ใณใใณใใฉใคใณใชใใทใงใณใฏๅฟ
้ ใงใใ
+
+ๅใซ่ชฌๆใใใใใซใใใใซใใใ็ตๅใใใใในใ (1 ใคใฎใในใใฎ็ถๆ
ใๅฅใฎใในใใฎ็ถๆ
ใซๅฝฑ้ฟใไธใใ) ใฎๆคๅบใๅฏ่ฝใซใชใใพใใใใค
+`pytest-random-order` ใใคใณในใใผใซใใใฆใใใจใใใฎใปใใทใงใณใซไฝฟ็จใใใใฉใณใใ ใทใผใใๅบๅใใใพใใไพ:
+
+
+```bash
+pytest tests
+[...]
+Using --random-order-bucket=module
+Using --random-order-seed=573663
+```
+
+ใใฎใใใๆๅฎใใใ็นๅฎใฎใทใผใฑใณในใๅคฑๆใใๅ ดๅใใใฎๆญฃ็ขบใชใทใผใใ่ฟฝๅ ใใใใจใงใใใๅ็พใงใใพใใไพ:
+
+```bash
+pytest --random-order-seed=573663
+[...]
+Using --random-order-bucket=module
+Using --random-order-seed=573663
+```
+
+็นๅฎใฎใในใใฎใชในใใไฝฟ็จใใชใๅ ดๅใใพใใฏใพใฃใใใชในใใไฝฟ็จใใชใๅ ดๅใๅใใในใใฎๆญฃ็ขบใช้ ๅบใๅ็พใใพใใใในใใฎใชในใใๆๅใง็ตใ่พผใฟๅงใใใจใใทใผใใซไพๅญใใใใในใใๅคฑๆใใๆญฃ็ขบใช้ ๅบใงๆๅใงใชในใใๆๅฎใใๅฟ
่ฆใใใใพใใใใใซใฏใ`--random-order-bucket=none` ใไฝฟ็จใใฆใฉใณใใ ๅใ็กๅนใซใใใใpytestใซๆ็คบใใๅฟ
่ฆใใใใพใใไพใใฐใๆฌกใฎใใใซใใพใ๏ผ
+
+
+```bash
+pytest --random-order-bucket=none tests/test_a.py tests/test_c.py tests/test_b.py
+```
+
+ใในใฆใฎใในใใฎใทใฃใใใซใ็กๅนใซใใใซใฏ:
+
+```bash
+pytest --random-order-bucket=none
+```
+
+ใใใฉใซใใงใฏใ`--random-order-bucket=module` ใๆ้ป็ใซ้ฉ็จใใใใขใธใฅใผใซใฌใใซใงใใกใคใซใใทใฃใใใซใใพใใใพใใ`class`ใ`package`ใ`global`ใใใใณ`none` ใฌใใซใงใทใฃใใใซใใใใจใใงใใพใใ่ฉณ็ดฐใซใคใใฆใฏใใใฎ[ใใญใฅใกใณใใผใทใงใณ](https://github.com/jbasko/pytest-random-order)ใๅ็
งใใฆใใ ใใใ
+
+ๅฅใฎใฉใณใใ ๅใฎไปฃๆฟๆๆฎตใฏใ[`pytest-randomly`](https://github.com/pytest-dev/pytest-randomly) ใงใใใใฎใขใธใฅใผใซใฏ้ๅธธใซไผผใๆฉ่ฝ/ใคใณใฟใผใใงใผในใๆใฃใฆใใพใใใ`pytest-random-order` ใงๅฉ็จๅฏ่ฝใชใใฑใใใขใผใใๆใฃใฆใใพใใใใคใณในใใผใซๅพใซ่ชๅ็ใซๆๅนใซใชใใจใใๅใๅ้กใใใใพใใ
+
+### Look and feel variations
+
+#### pytest-sugar
+
+[pytest-sugar](https://github.com/Frozenball/pytest-sugar) ใฏใๅค่ฆณใจๆไฝๆงใๅไธใใใใใญใฐใฌในใใผใ่ฟฝๅ ใใๅณๅบงใซๅคฑๆใใใในใใจใขใตใผใทใงใณใ่กจ็คบใใใใฉใฐใคใณใงใใใคใณในใใผใซๅพใซ่ชๅ็ใซใขใฏใใฃใๅใใใพใใ
+
+```bash
+pip install pytest-sugar
+```
+
+
+ใใใไฝฟ็จใใใซใในใใๅฎ่กใใใซใฏใๆฌกใๅฎ่กใใพใใ
+
+```bash
+pytest -p no:sugar
+```
+
+ใพใใฏใขใณใคใณในใใผใซใใพใใ
+
+#### Report each sub-test name and its progress
+
+`pytest` ใซใใๅไธใพใใฏใฐใซใผใใฎใในใใฎๅ ดๅ (`pip install pytest-pspec` ใฎๅพ):
+
+
+```bash
+pytest --pspec tests/test_optimization.py
+```
+
+
+#### Instantly shows failed tests
+
+[pytest-instafail](https://github.com/pytest-dev/pytest-instafail) ใงใฏใๅคฑๆใจใจใฉใผใๅณๅบงใซ่กจ็คบใใใพใใ
+ใในใใปใใทใงใณใ็ตไบใใใพใงๅพ
ๆฉใใพใใ
+
+```bash
+pip install pytest-instafail
+```
+
+```bash
+pytest --instafail
+```
+
+### To GPU or not to GPU
+
+GPU ใๆๅนใช่จญๅฎใงใCPU ใฎใฟใขใผใใงใในใใใใซใฏใ`CUDA_VISIBLE_DEVICES=""`ใ่ฟฝๅ ใใพใใ
+
+```bash
+CUDA_VISIBLE_DEVICES="" pytest tests/utils/test_logging.py
+```
+
+
+ใพใใฏใ่คๆฐใฎ GPU ใใใๅ ดๅใฏใ`pytest` ใงใฉใใไฝฟ็จใใใใๆๅฎใงใใพใใใใจใใฐใ
+2 ็ช็ฎใฎ GPU GPU `0` ใจ `1` ใใใๅ ดๅใฏใๆฌกใๅฎ่กใงใใพใใ
+
+```bash
+CUDA_VISIBLE_DEVICES="1" pytest tests/utils/test_logging.py
+```
+
+ใใใฏใ็ฐใชใGPUใง็ฐใชใใฟในใฏใๅฎ่กใใใๅ ดๅใซไพฟๅฉใงใใ
+
+ไธ้จใฎใในใใฏCPUใฎใฟใงๅฎ่กใใๅฟ
่ฆใใใใไปใฎใในใใฏCPUใGPUใใพใใฏTPUใงๅฎ่กใใๅฟ
่ฆใใใใใพใๅฅใฎใในใใฏ่คๆฐใฎGPUใงๅฎ่กใใๅฟ
่ฆใใใใพใใๆฌกใฎในใญใใใใณใฌใผใฟใผใฏใใในใใฎCPU/GPU/TPUใซ้ขใใ่ฆไปถใ่จญๅฎใใใใใซไฝฟ็จใใใพใ๏ผ
+
+- `require_torch` - ใใฎใในใใฏtorchใฎไธใงใฎใฟๅฎ่กใใใพใใ
+- `require_torch_gpu` - `require_torch` ใซๅ ใใฆใๅฐใชใใจใ1ใคใฎGPUใๅฟ
่ฆใงใใ
+- `require_torch_multi_gpu` - `require_torch` ใซๅ ใใฆใๅฐใชใใจใ2ใคใฎGPUใๅฟ
่ฆใงใใ
+- `require_torch_non_multi_gpu` - `require_torch` ใซๅ ใใฆใ0ใพใใฏ1ใคใฎGPUใๅฟ
่ฆใงใใ
+- `require_torch_up_to_2_gpus` - `require_torch` ใซๅ ใใฆใ0ใ1ใใพใใฏ2ใคใฎGPUใๅฟ
่ฆใงใใ
+- `require_torch_xla` - `require_torch` ใซๅ ใใฆใๅฐใชใใจใ1ใคใฎTPUใๅฟ
่ฆใงใใ
+
+ไปฅไธใฎ่กจใซGPUใฎ่ฆไปถใ็คบใใพใ๏ผ
+
+| n gpus | decorator |
+|--------+--------------------------------|
+| `>= 0` | `@require_torch` |
+| `>= 1` | `@require_torch_gpu` |
+| `>= 2` | `@require_torch_multi_gpu` |
+| `< 2` | `@require_torch_non_multi_gpu` |
+| `< 3` | `@require_torch_up_to_2_gpus` |
+
+
+ใใจใใฐใไฝฟ็จๅฏ่ฝใช GPU ใ 2 ใคไปฅไธใใใpytorch ใใคใณในใใผใซใใใฆใใๅ ดๅใซใฎใฟๅฎ่กใใๅฟ
่ฆใใใใในใใๆฌกใซ็คบใใพใใ
+
+
+```python no-style
+@require_torch_multi_gpu
+def test_example_with_multi_gpu():
+```
+
+ใในใใซ `tensorflow` ใๅฟ
่ฆใชๅ ดๅใฏใ`require_tf` ใใณใฌใผใฟใไฝฟ็จใใพใใไพใใฐ๏ผ
+
+```python no-style
+@require_tf
+def test_tf_thing_with_tensorflow():
+```
+
+ใใใใฎใใณใฌใผใฟใฏ็ฉใฟ้ใญใใใจใใงใใพใใใใจใใฐใใในใใ้
ใใpytorch ใงๅฐใชใใจใ 1 ใคใฎ GPU ใๅฟ
่ฆใชๅ ดๅใฏใๆฌกใฎใใใซใชใใพใใ
+่จญๅฎๆนๆณ:
+
+```python no-style
+@require_torch_gpu
+@slow
+def test_example_slow_on_gpu():
+```
+
+`@parametrized` ใฎใใใชไธ้จใฎใใณใฌใผใฟใฏใในใๅใๆธใๆใใใใใ`@require_*` ในใญใใ ใใณใฌใผใฟใใชในใใใๅฟ
่ฆใใใใพใใ
+ๆๅพใซใใใใๆญฃใใๅไฝใใใใใซใใพใใๆญฃใใไฝฟ็จไพใฏๆฌกใฎใจใใใงใ
+
+```python no-style
+@parameterized.expand(...)
+@require_torch_multi_gpu
+def test_integration_foo():
+```
+
+ใใฎ้ ๅบใฎๅ้กใฏ `@pytest.mark.parametrize` ใซใฏๅญๅจใใพใใใๆๅใพใใฏๆๅพใซ้
็ฝฎใใฆใใใใใงใๅ้กใฏ่งฃๆฑบใใใพใใ
+ไปไบใใใ ใใใใใฏ้ๅไฝใในใใงใฎใฟๆฉ่ฝใใพใใ
+
+ๅ
้จใในใ:
+
+- ๅฉ็จๅฏ่ฝใช GPU ใฎๆฐ:
+
+```python
+from transformers.testing_utils import get_gpu_count
+
+n_gpu = get_gpu_count() # works with torch and tf
+```
+
+### Testing with a specific PyTorch backend or device
+
+็นๅฎใฎtorchใใใคในใงใในใในใคใผใใๅฎ่กใใใซใฏใ`TRANSFORMERS_TEST_DEVICE="$device"` ใ่ฟฝๅ ใใพใใใใใง `$device` ใฏๅฏพ่ฑกใฎใใใฏใจใณใใงใใไพใใฐใCPUใงใในใใใใซใฏไปฅไธใฎใใใซใใพใ๏ผ
+
+```bash
+TRANSFORMERS_TEST_DEVICE="cpu" pytest tests/utils/test_logging.py
+```
+
+ใใฎๅคๆฐใฏใ`mps`ใชใฉใฎใซในใฟใ ใพใใฏใใพใไธ่ฌ็ใงใฏใชใ PyTorch ใใใฏใจใณใใใในใใใใฎใซๅฝน็ซใกใพใใใพใใ็นๅฎใฎ GPU ใใฟใผใฒใใใซใใใใCPU ๅฐ็จใขใผใใงใในใใใใใใใใจใงใ`CUDA_VISIBLE_DEVICES`ใจๅใๅนๆใ้ๆใใใใใซไฝฟ็จใใใใจใใงใใพใใ
+
+็นๅฎใฎใใใคในใงใฏใๅใใฆใtorchใใใคใณใใผใใใๅพใ่ฟฝๅ ใฎใคใณใใผใใๅฟ
่ฆใซใชใใพใใใใใฏใ็ฐๅขๅคๆฐ `TRANSFORMERS_TEST_BACKEND` ใไฝฟ็จใใฆๆๅฎใงใใพใใ
+
+```bash
+TRANSFORMERS_TEST_BACKEND="torch_npu" pytest tests/utils/test_logging.py
+```
+
+### Distributed training
+
+`pytest` ใฏ็ดๆฅ็ใซๅๆฃใใฌใผใใณใฐใๅฆ็ใใใใจใฏใงใใพใใใ่ฉฆใฟใใจใใตใใใญใปในใฏๆญฃใใๅฆ็ใ่กใใใ่ชๅ่ช่บซใ `pytest` ใงใใใจๆใ่พผใใงใในใในใคใผใใใซใผใใงๅฎ่กใ็ถใใพใใใใ ใใ้ๅธธใฎใใญใปในใ็ๆใใใใใใ่คๆฐใฎใฏใผใซใผใ็ๆใใIOใใคใใ็ฎก็ใใใใญใปในใ็ๆใใใฐๆฉ่ฝใใพใใ
+
+ใใใไฝฟ็จใใใใใคใใฎใในใใใใใพใ๏ผ
+
+- [test_trainer_distributed.py](https://github.com/huggingface/transformers/tree/main/tests/trainer/test_trainer_distributed.py)
+- [test_deepspeed.py](https://github.com/huggingface/transformers/tree/main/tests/deepspeed/test_deepspeed.py)
+
+ๅฎ่กใใคใณใใซใใใซ็งปๅใใใซใฏใใใใใฎใในใๅ
ใง `execute_subprocess_async` ๅผใณๅบใใๆค็ดขใใฆใใ ใใใ
+
+ใใใใฎใในใใๅฎ่กใใใซใฏใๅฐใชใใจใ2ใคใฎGPUใๅฟ
่ฆใงใ๏ผ
+
+```bash
+CUDA_VISIBLE_DEVICES=0,1 RUN_SLOW=1 pytest -sv tests/test_trainer_distributed.py
+```
+
+### Output capture
+
+ใในใใฎๅฎ่กไธญใซใ`stdout` ใใใณ `stderr` ใซ้ไฟกใใใๅบๅใฏใญใฃใใใฃใใใพใใใในใใพใใฏใปใใใขใใใกใฝใใใๅคฑๆใใๅ ดๅใ้ๅธธใใใใซๅฏพๅฟใใใญใฃใใใฃใใใๅบๅใๅคฑๆใฎใใฌใผในใใใฏใจๅ
ฑใซ่กจ็คบใใใพใใ
+
+ๅบๅใฎใญใฃใใใฃใ็กๅนใซใใ`stdout` ใจ `stderr` ใ้ๅธธ้ใใซๅๅพใใใซใฏใ`-s` ใพใใฏ `--capture=no` ใไฝฟ็จใใฆใใ ใใ๏ผ
+
+ใใใใฎใในใใๅฎ่กใใใซใฏๅฐใชใใจใ2ใคใฎGPUใๅฟ
่ฆใงใ๏ผ
+
+```bash
+pytest -s tests/utils/test_logging.py
+```
+
+ใในใ็ตๆใ JUnit ๅฝขๅผใฎๅบๅใซ้ไฟกใใใซใฏ:
+
+```bash
+py.test tests --junitxml=result.xml
+```
+
+### Color control
+
+่ฒใๆใใชใใใใซใใ๏ผไพ๏ผ้ป่ฒใฎใใญในใใ็ฝใ่ๆฏใซ่กจ็คบใใใจ่ชญใฟใซใใใงใ๏ผ๏ผ
+
+
+```bash
+pytest --color=no tests/utils/test_logging.py
+```
+
+### Sending test report to online pastebin service
+
+ใในใๅคฑๆใใจใซ URL ใไฝๆใใพใใ
+
+
+```bash
+pytest --pastebin=failed tests/utils/test_logging.py
+```
+
+ใใใซใใใใในใๅฎ่กๆ
ๅ ฑใใชใขใผใใฎPasteใตใผใในใซ้ไฟกใใใๅใจใฉใผใซๅฏพใใฆURLใๆไพใใใพใใ้ๅธธ้ใใในใใ้ธๆใใใใใใจใใฐ็นๅฎใฎใจใฉใผใฎใฟใ้ไฟกใใใๅ ดๅใฏ `-x` ใ่ฟฝๅ ใงๆๅฎใงใใพใใ
+
+ใในใใปใใทใงใณๅ
จไฝใฎใญใฐใซๅฏพใใURLใไฝๆใใๆนๆณ๏ผ
+
+
+```bash
+pytest --pastebin=all tests/utils/test_logging.py
+```
+
+## Writing tests
+
+๐ค transformersใฎใในใใฏ `unittest` ใๅบใซใใฆใใพใใใ `pytest` ใงๅฎ่กใใใใใใใปใจใใฉใฎๅ ดๅใไธกๆนใฎใทในใใ ใฎๆฉ่ฝใไฝฟ็จใงใใพใใ
+
+[ใใกใ](https://docs.pytest.org/en/stable/unittest.html)ใงใตใใผใใใใฆใใๆฉ่ฝใ่ชญใใใจใใงใใพใใใ้่ฆใชใใจใฏใใปใจใใฉใฎ `pytest` ใฎใใฃใฏในใใฃใๅไฝใใชใใใจใงใใใใฉใกใผใฟๅใๅๆงใงใใใไผผใใใใชๆนๆณใงๅไฝใใ `parameterized` ใขใธใฅใผใซใไฝฟ็จใใฆใใพใใ
+
+### Parametrization
+
+ๅใใในใใ็ฐใชใๅผๆฐใง่คๆฐๅๅฎ่กใใๅฟ
่ฆใใใใใจใใใใใใพใใใใใฏใในใๅ
้จใใ่กใใใจใใงใใพใใใใใฎๅ ดๅใใใฎใในใใๅไธใฎๅผๆฐใปใใใงๅฎ่กใใๆนๆณใฏใใใพใใใ
+
+
+```python
+# test_this1.py
+import unittest
+from parameterized import parameterized
+
+
+class TestMathUnitTest(unittest.TestCase):
+ @parameterized.expand(
+ [
+ ("negative", -1.5, -2.0),
+ ("integer", 1, 1.0),
+ ("large fraction", 1.6, 1),
+ ]
+ )
+ def test_floor(self, name, input, expected):
+ assert_equal(math.floor(input), expected)
+```
+
+ใใใฉใซใใงใฏใใใฎใในใใฏ3ๅๅฎ่กใใใใใใใใฎๅฎ่กใง `test_floor` ใฎๆๅพใฎ3ใคใฎๅผๆฐใใใฉใกใผใฟใชในใใฎๅฏพๅฟใใๅผๆฐใซๅฒใๅฝใฆใใใพใใ
+
+ใใใฆใ`negative` ใจ `integer` ใใฉใกใผใฟใฎใปใใใฎใฟใๅฎ่กใใใใจใใงใใพใ:
+
+```bash
+pytest -k "negative and integer" tests/test_mytest.py
+```
+
+ใพใใฏใ`Negative`ใฎใตใใในใใ้คใใในใฆใฎๅ ดๅใๆฌกใฎใใใซใชใใพใใ
+
+```bash
+pytest -k "not negative" tests/test_mytest.py
+```
+
+`-k` ใใฃใซใฟใผใไฝฟ็จใใใใจใซๅ ใใฆใๅใตใใในใใฎๆญฃ็ขบใชๅๅใ่ชฟในใใใฎๆญฃ็ขบใชๅๅใไฝฟ็จใใฆไปปๆใฎใตใใในใใพใใฏใในใฆใฎใตใใในใใๅฎ่กใใใใจใใงใใพใใ
+
+
+```bash
+pytest test_this1.py --collect-only -q
+```
+
+ใใใจๆฌกใฎใใฎใใชในใใใใพใ:
+
+```bash
+test_this1.py::TestMathUnitTest::test_floor_0_negative
+test_this1.py::TestMathUnitTest::test_floor_1_integer
+test_this1.py::TestMathUnitTest::test_floor_2_large_fraction
+```
+
+
+ใใใใฃใฆใ2 ใคใฎ็นๅฎใฎใตใใในใใฎใฟใๅฎ่กใงใใใใใซใชใใพใใใ
+
+```bash
+pytest test_this1.py::TestMathUnitTest::test_floor_0_negative test_this1.py::TestMathUnitTest::test_floor_1_integer
+```
+
+`transformers`ใฎ้็บ่
ไพๅญ้ขไฟใซใใงใซๅซใพใใฆใใใขใธใฅใผใซ[parameterized](https://pypi.org/project/parameterized/) ใฏใ`unittests` ใจ `pytest` ใในใใฎไธกๆนใงๆฉ่ฝใใพใใ
+
+ใใ ใใใในใใ `unittest` ใงใชใๅ ดๅใ`pytest.mark.parametrize` ใไฝฟ็จใใใใจใใงใใพใ๏ผใพใใฏๆขๅญใฎใในใใฎใใใคใใงใไธปใซ `examples` ใฎไธใงไฝฟ็จใใใฆใใใฎใ่ฆใใใจใใงใใพใ๏ผใ
+
+ๆฌกใซใๅใไพใ็คบใใพใใใไปๅบฆใฏ `pytest` ใฎ `parametrize` ใใผใซใผใไฝฟ็จใใฆใใพใ๏ผ
+
+
+```python
+# test_this2.py
+import pytest
+
+
+@pytest.mark.parametrize(
+ "name, input, expected",
+ [
+ ("negative", -1.5, -2.0),
+ ("integer", 1, 1.0),
+ ("large fraction", 1.6, 1),
+ ],
+)
+def test_floor(name, input, expected):
+ assert_equal(math.floor(input), expected)
+```
+
+`parameterized` ใจๅๆงใซใ`pytest.mark.parametrize` ใไฝฟ็จใใใจใ`-k` ใใฃใซใฟใๅฝน็ซใใชใๅ ดๅใงใใใตใใในใใฎๅฎ่กใ็ดฐใใๅถๅพกใงใใพใใใใ ใใใใฎใใฉใกใผใฟๅ้ขๆฐใฏใตใใในใใฎๅๅใใใใใซ็ฐใชใใใฎใซใใพใใไปฅไธใซใใฎไพใ็คบใใพใ๏ผ
+
+
+```bash
+pytest test_this2.py --collect-only -q
+```
+
+ใใใจๆฌกใฎใใฎใใชในใใใใพใ:
+
+```bash
+test_this2.py::test_floor[integer-1-1.0]
+test_this2.py::test_floor[negative--1.5--2.0]
+test_this2.py::test_floor[large fraction-1.6-1]
+```
+
+ใใใงใ็นๅฎใฎใในใใฎใฟใๅฎ่กใงใใใใใซใชใใพใใใ
+
+```bash
+pytest test_this2.py::test_floor[negative--1.5--2.0] test_this2.py::test_floor[integer-1-1.0]
+```
+
+ๅใฎไพใจๅๆงใซใ
+
+### Files and directories
+
+ใในใใฎไธญใงใ็พๅจใฎใในใใใกใคใซใใใฎ็ธๅฏพไฝ็ฝฎใ็ฅใๅฟ
่ฆใใใใใจใใใใใใพใใใใใใใใใฏ็ฐกๅใชใใจใงใฏใใใพใใใใชใใชใใใในใใฏ่คๆฐใฎใใฃใฌใฏใใชใใๅผใณๅบใใใใใ็ฐใชใๆทฑใใฎใตใใใฃใฌใฏใใชใซๅญๅจใใใใจใใใใใใงใใ`transformers.test_utils.TestCasePlus` ใจใใใใซใใผใฏใฉในใฏใใในใฆใฎๅบๆฌใในใๆด็ใใ็ฐกๅใซใขใฏใปในใงใใใใใซใใใใจใงใใใฎๅ้กใ่งฃๆฑบใใพใใ
+
+- `pathlib` ใชใใธใงใฏใ๏ผใในใฆๅฎๅ
จใซ่งฃๆฑบใใใใใฎ๏ผ๏ผ
+
+ - `test_file_path` - ็พๅจใฎใในใใใกใคใซใฎใในใใคใพใ `__file__`
+ - `test_file_dir` - ็พๅจใฎใในใใใกใคใซใๅซใใใฃใฌใฏใใช
+ - `tests_dir` - `tests` ใในใในใคใผใใฎใใฃใฌใฏใใช
+ - `examples_dir` - `examples` ใในใในใคใผใใฎใใฃใฌใฏใใช
+ - `repo_root_dir` - ใชใใธใใชใฎใใฃใฌใฏใใช
+ - `src_dir` - `transformers` ใตใใใฃใฌใฏใใชใๅญๅจใใๅ ดๆ
+
+- ใในใฎๆๅญๅ่กจ็พโโไธ่จใจๅใใงใใใใใใใฏ `pathlib` ใชใใธใงใฏใใงใฏใชใๆๅญๅใจใใฆใในใ่ฟใใพใ๏ผ
+
+ - `test_file_path_str`
+ - `test_file_dir_str`
+ - `tests_dir_str`
+ - `examples_dir_str`
+ - `repo_root_dir_str`
+ - `src_dir_str`
+
+ใใใใไฝฟ็จใๅงใใใซใฏใใในใใ `transformers.test_utils.TestCasePlus` ใฎใตใใฏใฉในใซๅญๅจใใใใจใ็ขบ่ชใใใ ใใงใใไพ๏ผ
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class PathExampleTest(TestCasePlus):
+ def test_something_involving_local_locations(self):
+ data_dir = self.tests_dir / "fixtures/tests_samples/wmt_en_ro"
+```
+
+ใใใ`pathlib` ใไปใใฆใในใๆไฝใใๅฟ
่ฆใใชใๅ ดๅใใพใใฏๅใซๆๅญๅใจใใฆใในใๅฟ
่ฆใชๅ ดๅใฏใ`pathlib` ใชใใธใงใฏใใซ `str()` ใๅผใณๅบใใใ`_str` ใง็ตใใใขใฏใปใตใไฝฟ็จใงใใพใใไพ๏ผ
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class PathExampleTest(TestCasePlus):
+ def test_something_involving_stringified_locations(self):
+ examples_dir = self.examples_dir_str
+```
+
+### Temporary files and directories
+
+ไธๆใฎไธๆใใกใคใซใจใใฃใฌใฏใใชใฎไฝฟ็จใฏใไธฆๅใในใใฎๅฎ่กใซใฏๆฌ ใใใพใใใใใใซใใใใในใใใไบใใฎใใผใฟใไธๆธใใใชใใใใซใใพใใใพใใใใใใไฝๆใใๅใในใใฎ็ตไบๆใซไธๆใใกใคใซใจใใฃใฌใฏใใชใๅ้คใใใใใจใๆใฟใพใใใใฎใใใใใใใฎใใผใบใๆบใใใใใฑใผใธใงใใ `tempfile` ใฎใใใชใใใฑใผใธใฎไฝฟ็จใฏ้่ฆใงใใ
+
+ใใใใใในใใฎใใใใฐๆใซใฏใไธๆใใกใคใซใใใฃใฌใฏใใชใซไฝใๆ ผ็ดใใใฆใใใใ็ขบ่ชใงใใๅฟ
่ฆใใใใใในใใๅๅฎ่กใใใใณใซใฉใณใใ ใซๅคๆดใใใชใใใฎๆญฃ็ขบใชใในใ็ฅใใใใจๆใใพใใ
+
+`transformers.test_utils.TestCasePlus` ใจใใใใซใใผใฏใฉในใฏใใใฎใใใช็ฎ็ใซๆ้ฉใงใใใใใฏ `unittest.TestCase` ใฎใตใใฏใฉในใงใใใใใใในใใขใธใฅใผใซใง็ฐกๅใซ็ถๆฟใใใใจใใงใใพใใ
+
+ไปฅไธใฏใใฎไฝฟ็จไพใงใ๏ผ
+
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class ExamplesTests(TestCasePlus):
+ def test_whatever(self):
+ tmp_dir = self.get_auto_remove_tmp_dir()
+```
+
+ใใฎใณใผใใฏใฆใใผใฏใชไธๆใใฃใฌใฏใใชใไฝๆใใ`tmp_dir` ใใใฎๅ ดๆใซ่จญๅฎใใพใใ
+
+- ใฆใใผใฏใชไธๆใใฃใฌใฏใใชใไฝๆใใพใ๏ผ
+
+```python
+def test_whatever(self):
+ tmp_dir = self.get_auto_remove_tmp_dir()
+```
+
+`tmp_dir` ใซใฏใไฝๆใใใไธๆใใฃใฌใฏใใชใธใฎใในใๅซใพใใพใใๆ้็ตไบๅพใฏ่ชๅ็ใซๅ้คใใใพใ
+ใในใใ
+
+- ไปปๆใฎไธๆใใฃใฌใฏใใชใไฝๆใใใในใใฎ้ๅงๅใซใใใ็ฉบใงใใใใจใ็ขบ่ชใใใในใๅพใซใฏ็ฉบใซใใชใใงใใ ใใใ
+
+```python
+def test_whatever(self):
+ tmp_dir = self.get_auto_remove_tmp_dir("./xxx")
+```
+
+ใใใฏใ็นๅฎใฎใใฃใฌใฏใใชใ็ฃ่ฆใใๅใฎใในใใใใใซใใผใฟใๆฎใใชใใใจใ็ขบ่ชใใใๅ ดๅใซใใใใใฐใซๅฝน็ซใกใพใใ
+
+- `before` ใจ `after` ๅผๆฐใ็ดๆฅใชใผใใผใฉใคใใใใใจใงใใใใฉใซใใฎๅไฝใใชใผใใผใฉใคใใงใใพใใไปฅไธใฎใใใใใฎๅไฝใซๅฐใใพใ๏ผ
+
+ - `before=True`๏ผใในใใฎ้ๅงๆใซๅธธใซไธๆใใฃใฌใฏใใชใใฏใชใขใใใพใใ
+ - `before=False`๏ผไธๆใใฃใฌใฏใใชใๆขใซๅญๅจใใๅ ดๅใๆขๅญใฎใใกใคใซใฏใใฎใพใพใซใชใใพใใ
+ - `after=True`๏ผใในใใฎ็ตไบๆใซๅธธใซไธๆใใฃใฌใฏใใชใๅ้คใใใพใใ
+ - `after=False`๏ผใในใใฎ็ตไบๆใซๅธธใซไธๆใใฃใฌใฏใใชใฏใใฎใพใพใซใชใใพใใ
+
+
+
+`rm -r`ใฎ็ธๅฝใๅฎๅ
จใซๅฎ่กใใใใใซใๆ็คบ็ใช `tmp_dir` ใไฝฟ็จใใใๅ ดๅใใใญใธใงใฏใใชใใธใใชใฎใใงใใฏใขใฆใใฎใตใใใฃใฌใฏใใชใฎใฟใ่จฑๅฏใใใพใใ่ชคใฃใฆ `/tmp` ใชใฉใฎใใกใคใซใทในใใ ใฎ้่ฆใช้จๅใๅ้คใใใชใใใใซใๅธธใซ `./` ใใๅงใพใใในใๆธกใใฆใใ ใใใ
+
+
+
+
+
+ๅใในใใฏ่คๆฐใฎไธๆใใฃใฌใฏใใชใ็ป้ฒใงใใ่ฆๆฑใใชใ้ใใในใฆ่ชๅใงๅ้คใใใพใใ
+
+
+
+### Temporary sys.path override
+
+ๅฅใฎใในใใใใคใณใใผใใใใใใซไธๆ็ใซ `sys.path` ใใชใผใใผใฉใคใใใๅฟ
่ฆใใใๅ ดๅใ`ExtendSysPath` ใณใณใใญในใใใใผใธใฃใไฝฟ็จใงใใพใใไพ๏ผ
+
+
+```python
+import os
+from transformers.testing_utils import ExtendSysPath
+
+bindir = os.path.abspath(os.path.dirname(__file__))
+with ExtendSysPath(f"{bindir}/.."):
+ from test_trainer import TrainerIntegrationCommon # noqa
+```
+
+### Skipping tests
+
+ใใใฏใใใฐใ่ฆใคใใใๆฐใใใในใใไฝๆใใใๅ ดๅใงใใฃใฆใใใใฐใใพใ ไฟฎๆญฃใใใฆใใชใๅ ดๅใซๅฝน็ซใกใพใใใกใคใณใชใใธใใชใซใณใใใใงใใใใใซใใใซใฏใ`make test` ใฎๅฎ่กไธญใซใใใในใญใใใใๅฟ
่ฆใใใใพใใ
+
+ใกใฝใใ๏ผ
+
+- **skip** ใฏใใในใใ็นๅฎใฎๆกไปถใๆบใใใใๅ ดๅใซใฎใฟใในใใใใจใๆๅพ
ใใฆใใใใใไปฅๅคใฎๅ ดๅใฏ pytest ใใในใใฎๅฎ่กใในใญใใใใพใใไธ่ฌ็ใชไพใฏใWindowsๅฐ็จใฎใในใใ้Windowsใใฉใใใใฉใผใ ใงในใญใใใใๅ ดๅใใพใใฏ็พๅจๅฉ็จใงใใชใๅค้จใชใฝใผในใซไพๅญใใใในใใในใญใใใใๅ ดๅใงใ๏ผไพ: ใใผใฟใใผในใๅฉ็จใงใใชใๅ ดๅ๏ผใ
+
+- **xfail** ใฏใไฝใใใฎ็็ฑใงใในใใๅคฑๆใใใใจใๆๅพ
ใใฆใใพใใไธ่ฌ็ใชไพใฏใใพใ ๅฎ่ฃ
ใใใฆใใชใๆฉ่ฝใฎใในใใใใพใ ไฟฎๆญฃใใใฆใใชใใใฐใฎใในใใงใใใในใใไบๆณใใใๅคฑๆใซใใใใใใใในใใๅ ดๅ๏ผpytest.mark.xfailใงใใผใฏใใใใในใ๏ผใใใใฏxpassใจใใฆใในใใตใใชใผใซๅ ฑๅใใใพใใ
+
+ใใใใฎ2ใคใฎ้ใฎ้่ฆใช้ใใฎ1ใคใฏใ`skip` ใฏใในใใๅฎ่กใใชใ็นใงใใใ`xfail` ใฏๅฎ่กใใพใใใใใใฃใฆใใใฐใฎใใใณใผใใไปใฎใในใใซๅฝฑ้ฟใไธใใๅ ดๅใฏใ`xfail` ใไฝฟ็จใใชใใงใใ ใใใ
+
+#### Implementation
+
+- ใในใๅ
จไฝใ็กๆกไปถใซในใญใใใใๆนๆณใฏๆฌกใฎใจใใใงใ๏ผ
+
+
+```python no-style
+@unittest.skip(reason="this bug needs to be fixed")
+def test_feature_x():
+```
+
+ใพใใฏ pytest ็ต็ฑ:
+
+```python no-style
+@pytest.mark.skip(reason="this bug needs to be fixed")
+```
+
+ใพใใฏ `xfail` ใฎๆนๆณ:
+
+```python no-style
+@pytest.mark.xfail
+def test_feature_x():
+```
+
+
+- ใในใๅ
ใฎๅ
้จใใงใใฏใซๅบใฅใใฆใในใใในใญใใใใๆนๆณใฏๆฌกใฎใจใใใงใใ
+
+```python
+def test_feature_x():
+ if not has_something():
+ pytest.skip("unsupported configuration")
+```
+
+ใพใใฏใขใธใฅใผใซๅ
จไฝ:
+
+```python
+import pytest
+
+if not pytest.config.getoption("--custom-flag"):
+ pytest.skip("--custom-flag is missing, skipping tests", allow_module_level=True)
+```
+
+ใพใใฏ `xfail` ใฎๆนๆณ:
+
+```python
+def test_feature_x():
+ pytest.xfail("expected to fail until bug XYZ is fixed")
+```
+
+- ไธ้จใฎใคใณใใผใใๆฌ ่ฝใใฆใใๅ ดๅใซใขใธใฅใผใซๅ
ใฎใในใฆใฎใในใใในใญใใใใๆนๆณใฏๆฌกใฎใจใใใงใใ
+
+```python
+docutils = pytest.importorskip("docutils", minversion="0.3")
+```
+
+- ๆกไปถใซๅบใฅใใฆใในใใในใญใใใใพใใ
+
+```python no-style
+@pytest.mark.skipif(sys.version_info < (3,6), reason="requires python3.6 or higher")
+def test_feature_x():
+```
+
+ใพใใฏ๏ผ
+
+```python no-style
+@unittest.skipIf(torch_device == "cpu", "Can't do half precision")
+def test_feature_x():
+```
+
+
+ใพใใฏใขใธใฅใผใซๅ
จไฝใในใญใใใใพใใ
+
+```python no-style
+@pytest.mark.skipif(sys.platform == 'win32', reason="does not run on windows")
+class TestClass():
+ def test_feature_x(self):
+```
+
+่ฉณ็ดฐใไพใใใใณๆนๆณใซใคใใฆใฎ่ฉณ็ดฐใฏ[ใใกใ](https://docs.pytest.org/en/latest/skipping.html)ใๅ็
งใใฆใใ ใใใ
+
+### Slow tests
+
+ใในใใฉใคใใฉใชใฏ็ๅฎใซๆ้ทใใฆใใใใในใใฎไธ้จใฏๆฐๅใใใใพใใใใฎใใใCIใงใในใในใคใผใใฎๅฎไบใๅพ
ใคใฎใฏ1ๆ้ๅพ
ใคไฝ่ฃใใชใใใจใใใใพใใใใใใฃใฆใใใใคใใฎไพๅคใ้คใใฆใ้
ใใในใใฏไปฅไธใฎไพใฎใใใซใใผใฏใในใใงใ๏ผ
+
+
+```python no-style
+from transformers.testing_utils import slow
+@slow
+def test_integration_foo():
+```
+
+
+ใในใใ`@slow`ใจใใฆใใผใฏใใใใใใใฎใใใชใในใใๅฎ่กใใใซใฏใ็ฐๅขๅคๆฐ `RUN_SLOW=1`ใ่จญๅฎใใพใใไพ:
+
+```bash
+RUN_SLOW=1 pytest tests
+```
+
+`@parameterized` ใฎใใใชใใณใฌใผใฟใฏใในใๅใๆธใๆใใใใใ`@slow` ใใใณไปใฎในใญใใใใณใฌใผใฟ `@require_*` ใฏๆญฃใใๅไฝใใใใใซใฏใๆๅพใซใชในใใขใใใใๅฟ
่ฆใใใใพใใไปฅไธใฏๆญฃใใไฝฟ็จไพใฎไธไพใงใ๏ผ
+
+
+```python no-style
+@parameterized.expand(...)
+@slow
+def test_integration_foo():
+```
+
+ใใฎใใญใฅใกใณใใฎๅ้ ญใง่ชฌๆใใใใใซใ้
ใใในใใฏๅฎๆ็ใชในใฑใธใฅใผใซใซๅพใฃใฆๅฎ่กใใใPRใฎCIใใงใใฏใงใฏๅฎ่กใใใพใใใใใฎใใใไธ้จใฎๅ้กใPRใฎๆๅบๆใซ่ฆ่ฝใจใใใใใผใธใใใๅฏ่ฝๆงใใใใพใใใใฎใใใชๅ้กใฏๆฌกๅใฎในใฑใธใฅใผใซใใใCIใธใงใใงๆคๅบใใใพใใใใใใใใใฏใพใใPRใๆๅบใใๅใซ่ชๅใฎใใทใณใง้
ใใในใใๅฎ่กใใ้่ฆๆงใๆๅณใใฆใใพใใ
+
+ใฉใฎใในใใ้
ใใในใใจใใฆใใผใฏใในใใใ้ธๆใใใใใฎใใใใพใใชๆๆๆฑบๅฎใกใซใใบใ ใๆฌกใซ็คบใใใฆใใพใ๏ผ
+
+- ใในใใใฉใคใใฉใชใฎๅ
้จใณใณใใผใใณใใฎ1ใคใซ็ฆ็นใๅฝใฆใฆใใๅ ดๅ๏ผไพ: ใขใใชใณใฐใใกใคใซใใใผใฏใณๅใใกใคใซใใใคใใฉใคใณ๏ผใใใฎใในใใฏ้
ใใในใในใคใผใใงๅฎ่กใใๅฟ
่ฆใใใใพใใใใใใฉใคใใฉใชใฎไปใฎๅด้ขใใใจใใฐใใญใฅใกใณใใผใทใงใณใไพใซ็ฆ็นใๅฝใฆใฆใใๅ ดๅใใใใใฎใในใใฏ้
ใใในใในใคใผใใงๅฎ่กใใๅฟ
่ฆใใใใพใใใใใฆใใใฎใขใใญใผใใๆด็ทดใใใใใใซไพๅคใ่จญใใๅฟ
่ฆใใใใพใใ
+
+- ้ใใฆใงใคใใปใใใ็ด50MBไปฅไธใฎใใผใฟใปใใใใใฆใณใญใผใใใๅฟ
่ฆใใใใในใฆใฎใในใ๏ผไพ: ใขใใซ็ตฑๅใในใใใใผใฏใใคใถ็ตฑๅใในใใใใคใใฉใคใณ็ตฑๅใในใ๏ผใฏ้
ใใในใใจใใฆ่จญๅฎใใๅฟ
่ฆใใใใพใใๆฐใใใขใใซใ่ฟฝๅ ใใๅ ดๅใ็ตฑๅใในใ็จใซใฉใณใใ ใชใฆใงใคใใๆใคๅฐใใชใใผใธใงใณใไฝๆใใใใใซใขใใใญใผใใใๅฟ
่ฆใใใใพใใใใใซใคใใฆใฏไปฅไธใฎๆฎต่ฝใง่ฉณใใ่ชฌๆใใพใใ
+
+- ็นใซ้ซ้ๅใใใฆใใชใใใฌใผใใณใฐใ่กใๅฟ
่ฆใใใใในใฆใฎใในใใฏ้
ใใในใใจใใฆ่จญๅฎใใๅฟ
่ฆใใใใพใใ
+
+- ไธ้จใฎใ้
ใใใงใใในใใงใชใใในใใ้ๅธธใซ้
ใๅ ดๅใใใใณใใใใ `@slow` ใจใใฆ่จญๅฎใใๅฟ
่ฆใใใๅ ดๅใซใฏไพๅคใๅฐๅ
ฅใงใใพใใๅคงๅฎน้ใฎใใกใคใซใใใฃในใฏใซไฟๅญใใใณ่ชญใฟ่พผใฟใใ่ชๅใขใใชใณใฐใในใใฏใ`@slow` ใจใใฆใใผใฏใใใใในใใฎ่ฏใไพใงใใ
+
+- CIใง1็งๆชๆบใงใในใใๅฎไบใใๅ ดๅ๏ผใใฆใณใญใผใใๅซใ๏ผใใใใฏ้ๅธธใฎใในใใงใใในใใงใใ
+
+ใในใฆใฎ้้
ใใในใใฏใใใพใใพใชๅ
้จ่ฆ็ด ใๅฎๅ
จใซใซใใผใใๅฟ
่ฆใใใใพใใใ้ซ้ใงใใๅฟ
่ฆใใใใพใใใใจใใฐใ็นๅฅใซไฝๆใใใๅฐใใชใขใใซ๏ผใฌใคใคใผๆฐใๆๅฐ้ใงใ่ชๅฝใตใคใบใๅฐใใใชใฉ๏ผใไฝฟ็จใใฆใใใชใใฎใซใใฌใใธใๅฎ็พใงใใพใใใใฎๅพใ`@slow` ใในใใงใฏๅคง่ฆๆจกใช้
ใใขใใซใไฝฟ็จใใฆ่ณช็ใชใในใใๅฎ่กใงใใพใใใใใใไฝฟ็จใใใซใฏใไปฅไธใฎใใใซ *tiny* ใขใใซใๆขใใฆใใ ใใ๏ผ
+
+
+```bash
+grep tiny tests examples
+```
+
+[ในใฏใชใใใฎไพ](https://github.com/huggingface/transformers/tree/main/scripts/fsmt/fsmt-make-tiny-model.py)ใใใใใใใซใใ tiny-wmt19-en-de ใฎใใใชๅฐใใชใขใใซใไฝๆใใใพใใ็นๅฎใฎใขใใซใฎใขใผใญใใฏใใฃใซ็ฐกๅใซ่ชฟๆดใงใใพใใ
+
+ๅฎ่กๆ้ใ่ชคใฃใฆๆธฌๅฎใใใใจใ็ฐกๅใงใใใใจใใฐใๅทจๅคงใชใขใใซใฎใใฆใณใญใผใใซ้ขใใใชใผใใผใใใใใใๅ ดๅใใญใผใซใซใงใในใใใใจใใฆใณใญใผใใใใใใกใคใซใใญใฃใใทใฅใใใใใฆใณใญใผใๆ้ใ่จๆธฌใใใชใใชใใพใใใใใใฃใฆใCIใญใฐใฎๅฎ่ก้ๅบฆใฌใใผใ๏ผ`pytest --durations=0 tests` ใฎๅบๅ๏ผใ็ขบ่ชใใฆใใ ใใใ
+
+ใใฎใฌใใผใใฏใ้
ใใในใใจใใฆใใผใฏใใใฆใใชใ้
ใๅคใๅคใใ้ซ้ใซๆธใ็ดใๅฟ
่ฆใใใใในใใ่ฆใคใใใฎใซใๅฝน็ซใกใพใใใในใในใคใผใใCIใง้
ใใชใๅงใใๅ ดๅใใใฎใฌใใผใใฎใใใใชในใใซใฏๆใ้
ใใในใใ่กจ็คบใใใพใใ
+
+### Testing the stdout/stderr output
+
+`stdout` ใใใณ/ใพใใฏ `stderr` ใซๆธใ่พผใ้ขๆฐใใในใใใใใใซใใในใใฏ `pytest` ใฎ [capsys ใทในใใ ](https://docs.pytest.org/en/latest/capture.html) ใไฝฟ็จใใฆใใใใฎในใใชใผใ ใซใขใฏใปในใงใใพใใไปฅไธใฏใใฎๆนๆณใงใ๏ผ
+
+
+```python
+import sys
+
+
+def print_to_stdout(s):
+ print(s)
+
+
+def print_to_stderr(s):
+ sys.stderr.write(s)
+
+
+def test_result_and_stdout(capsys):
+ msg = "Hello"
+ print_to_stdout(msg)
+ print_to_stderr(msg)
+ out, err = capsys.readouterr() # consume the captured output streams
+ # optional: if you want to replay the consumed streams:
+ sys.stdout.write(out)
+ sys.stderr.write(err)
+ # test:
+ assert msg in out
+ assert msg in err
+```
+
+
+ใใใฆใใกใใใใปใจใใฉใฎๅ ดๅใ`stderr`ใฏไพๅคใฎไธ้จใจใใฆๆไพใใใใใใใใฎใใใชๅ ดๅใซใฏ try/excel ใไฝฟ็จใใๅฟ
่ฆใใใใพใใ
+ใฑใผใน๏ผ
+
+```python
+def raise_exception(msg):
+ raise ValueError(msg)
+
+
+def test_something_exception():
+ msg = "Not a good value"
+ error = ""
+ try:
+ raise_exception(msg)
+ except Exception as e:
+ error = str(e)
+ assert msg in error, f"{msg} is in the exception:\n{error}"
+```
+
+
+stdout ใใญใฃใใใฃใใใใ 1 ใคใฎใขใใญใผใใฏใ`contextlib.redirect_stdout`ใไฝฟ็จใใใใจใงใใ
+
+```python
+from io import StringIO
+from contextlib import redirect_stdout
+
+
+def print_to_stdout(s):
+ print(s)
+
+
+def test_result_and_stdout():
+ msg = "Hello"
+ buffer = StringIO()
+ with redirect_stdout(buffer):
+ print_to_stdout(msg)
+ out = buffer.getvalue()
+ # optional: if you want to replay the consumed streams:
+ sys.stdout.write(out)
+ # test:
+ assert msg in out
+```
+
+stdout ใใญใฃใใใฃใใ้ใฎ้่ฆใชๆฝๅจ็ใชๅ้กใฏใ้ๅธธใฎ `print` ใงใใใพใงใซๅบๅใใใๅ
ๅฎนใใชใปใใใใๅฏ่ฝๆงใใใ `\r` ๆๅญใๅซใพใใฆใใๅฏ่ฝๆงใใใใใจใงใใ`pytest` ่ชไฝใซใฏๅ้กใฏใใใพใใใใ`pytest -s` ใงใฏใใใใฎๆๅญใใใใใกใซๅซใพใใใใใ`-s` ใใใจใชใใงใในใใๅฎ่กใงใใใใใซใใใซใฏใ`re.sub(r'~.*\r', '', buf, 0, re.M)` ใไฝฟ็จใใฆใญใฃใใใฃใใใๅบๅใซๅฏพใใฆ่ฟฝๅ ใฎใฏใชใผใณใขใใใ่กใๅฟ
่ฆใใใใพใใ
+
+ใใใใใใฎๅพใ`\r` ใๅซใพใใฆใใใใฉใใใซใใใใใใใในใฆใฎๆไฝใ่ชๅ็ใซๅฆ็ใใใใซใใผใณใณใใญในใใใใผใธใฃใฉใใใผใใใใพใใใใใใฃใฆใๆฌกใฎใใใซ็ฐกๅใซ่กใใพใ๏ผ
+
+
+```python
+from transformers.testing_utils import CaptureStdout
+
+with CaptureStdout() as cs:
+ function_that_writes_to_stdout()
+print(cs.out)
+```
+
+ๅฎๅ
จใชใในใไพใฏๆฌกใฎใจใใใงใใ
+
+```python
+from transformers.testing_utils import CaptureStdout
+
+msg = "Secret message\r"
+final = "Hello World"
+with CaptureStdout() as cs:
+ print(msg + final)
+assert cs.out == final + "\n", f"captured: {cs.out}, expecting {final}"
+```
+
+`stderr` ใใญใฃใใใฃใใใๅ ดๅใฏใไปฃใใใซ `CaptureStderr` ใฏใฉในใไฝฟ็จใใฆใใ ใใใ
+
+```python
+from transformers.testing_utils import CaptureStderr
+
+with CaptureStderr() as cs:
+ function_that_writes_to_stderr()
+print(cs.err)
+```
+
+ไธกๆนใฎในใใชใผใ ใไธๅบฆใซใญใฃใใใฃใใๅฟ
่ฆใใใๅ ดๅใฏใ่ฆชใฎ `CaptureStd` ใฏใฉในใไฝฟ็จใใพใใ
+
+```python
+from transformers.testing_utils import CaptureStd
+
+with CaptureStd() as cs:
+ function_that_writes_to_stdout_and_stderr()
+print(cs.err, cs.out)
+```
+
+
+ใพใใใในใใฎๅ้กใฎใใใใฐใๆฏๆดใใใใใซใใใใฉใซใใงใใใใใฎใณใณใใญในใ ใใใผใธใฃใผใฏ็ตไบๆใซใญใฃใใใฃใใใในใใชใผใ ใ่ชๅ็ใซๅ็ใใพใใ
+ๆ่ใใใ
+
+### Capturing logger stream
+
+ใญใฌใผใฎๅบๅใๆค่จผใใๅฟ
่ฆใใใๅ ดๅใฏใ`CaptureLogger`ใไฝฟ็จใงใใพใใ
+
+```python
+from transformers import logging
+from transformers.testing_utils import CaptureLogger
+
+msg = "Testing 1, 2, 3"
+logging.set_verbosity_info()
+logger = logging.get_logger("transformers.models.bart.tokenization_bart")
+with CaptureLogger(logger) as cl:
+ logger.info(msg)
+assert cl.out, msg + "\n"
+```
+
+### Testing with environment variables
+
+็นๅฎใฎใในใใง็ฐๅขๅคๆฐใฎๅฝฑ้ฟใใในใใใใๅ ดๅใฏใใใซใใผ ใใณใฌใผใฟใไฝฟ็จใงใใพใใ
+`transformers.testing_utils.mockenv`
+
+```python
+from transformers.testing_utils import mockenv
+
+
+class HfArgumentParserTest(unittest.TestCase):
+ @mockenv(TRANSFORMERS_VERBOSITY="error")
+ def test_env_override(self):
+ env_level_str = os.getenv("TRANSFORMERS_VERBOSITY", None)
+```
+
+ๅ ดๅใซใใฃใฆใฏใๅค้จใใญใฐใฉใ ใๅผใณๅบใๅฟ
่ฆใใใใใใ`os.environ` ใซ`PYTHONPATH`ใ่จญๅฎใใฆใคใณใฏใซใผใใใๅฟ
่ฆใใใใพใใ
+่คๆฐใฎใญใผใซใซ ใในใใใซใใผ ใฏใฉใน `transformers.test_utils.TestCasePlus` ใๅฝนใซ็ซใกใพใใ
+
+```python
+from transformers.testing_utils import TestCasePlus
+
+
+class EnvExampleTest(TestCasePlus):
+ def test_external_prog(self):
+ env = self.get_env()
+ # now call the external program, passing `env` to it
+```
+
+ใในใใใกใคใซใ `tests` ใในใในใคใผใใพใใฏ `examples` ใฎใฉใกใใซใใใใซๅฟใใฆ
+`env[PYTHONPATH]` ใไฝฟ็จใใฆใใใใ 2 ใคใฎใใฃใฌใฏใใชใฎใใใใใๅซใใพใใใพใใใในใใ็ขบๅฎใซ่กใใใใใใซใใใใใฎ `src` ใใฃใฌใฏใใชใๅซใใพใใ
+็พๅจใฎใชใใธใใชใซๅฏพใใฆๅฎ่กใใใๆๅพใซใใในใใๅฎ่กใใใๅใซใใงใซ่จญๅฎใใใฆใใ `env[PYTHONPATH]` ใไฝฟ็จใใฆๅฎ่กใใใพใใ
+ไฝใใใใฐๅผใฐใใพใใ
+
+ใใฎใใซใใผ ใกใฝใใใฏ `os.environ` ใชใใธใงใฏใใฎใณใใผใไฝๆใใใใใๅ
ใฎใชใใธใงใฏใใฏใใฎใพใพๆฎใใพใใ
+
+
+### Getting reproducible results
+
+็ถๆณใซใใฃใฆใฏใใในใใฎใฉใณใใ ๆงใๅ้คใใใๅ ดๅใใใใพใใๅไธใฎๅ็พๅฏ่ฝใช็ตๆใปใใใๅๅพใใใซใฏใ
+ใทใผใใไฟฎๆญฃใใๅฟ
่ฆใใใใพใ:
+
+```python
+seed = 42
+
+# python RNG
+import random
+
+random.seed(seed)
+
+# pytorch RNGs
+import torch
+
+torch.manual_seed(seed)
+torch.backends.cudnn.deterministic = True
+if torch.cuda.is_available():
+ torch.cuda.manual_seed_all(seed)
+
+# numpy RNG
+import numpy as np
+
+np.random.seed(seed)
+
+# tf RNG
+tf.random.set_seed(seed)
+```
+
+
+### Debugging tests
+
+่ญฆๅใ็บ็ใใๆ็นใงใใใใฌใผใ้ๅงใใใซใฏใๆฌกใฎๆ้ ใๅฎ่กใใพใใ
+
+```bash
+pytest tests/utils/test_logging.py -W error::UserWarning --pdb
+```
+
+## Working with github actions workflows
+
+ใปใซใใใใทใฅใฎใฏใผใฏใใญใผCIใธใงใใใใชใฌใผใใใซใฏใไปฅไธใฎๆ้ ใๅฎ่กใใๅฟ
่ฆใใใใพใ๏ผ
+
+1. `transformers` ใฎใชใขใผใใชใใธใใชใงๆฐใใใใฉใณใใไฝๆใใพใ๏ผใใฉใผใฏใงใฏใชใใๅ
ใฎใชใใธใใชใง่กใใพใ๏ผใ
+2. ใใฉใณใใฎๅๅใฏ `ci_` ใพใใฏ `ci-` ใงๅงใพใๅฟ
่ฆใใใใพใ๏ผ`main` ใใใชใฌใผใใพใใใ`main` ใงใฏPRใไฝๆใงใใพใใ๏ผใใพใใ็นๅฎใฎใในใงใฎใฟใใชใฌใผใใใพใ - ใใฎใใญใฅใกใณใใๆธใใใๅพใซๅคๆดใใใๅ ดๅใซๅใใฆใๆๆฐใฎๅฎ็พฉใฏ[ใใกใ](https://github.com/huggingface/transformers/blob/main/.github/workflows/self-push.yml)ใฎ *push:* ใซใใใพใใ
+3. ใใฎใใฉใณใใใPRใไฝๆใใพใใ
+4. ใใฎๅพใใใฎใธใงใใ[ใใ](https://github.com/huggingface/transformers/actions/workflows/self-push.yml)ใซ่กจ็คบใใใพใใใธใงใใฏใใใฏใญใฐใใใๅ ดๅใใใใซๅฎ่กใใใชใใใจใใใใพใใ
+
+## Testing Experimental CI Features
+
+CIๆฉ่ฝใฎใในใใฏ้ๅธธใฎCIใฎๆญฃๅธธใชๅไฝใซๅนฒๆธใใๅฏ่ฝๆงใใใใใใๆฐใใCIๆฉ่ฝใ่ฟฝๅ ใใๅ ดๅใไปฅไธใฎๆ้ ใซๅพใๅฟ
่ฆใใใใพใใ
+
+1. ใในใใๅฟ
่ฆใชใใฎใใในใใใใใใฎๆฐใใๅฐ็จใฎใธใงใใไฝๆใใพใใ
+2. ๆฐใใใธใงใใฏๅธธใซๆๅใใๅฟ
่ฆใใใใใใๅธธใซใฐใชใผใณ โ๏ผ่ฉณ็ดฐใฏไปฅไธๅ็
ง๏ผใ่กจ็คบใใๅฟ
่ฆใใใใพใใ
+3. ใใพใใพใช็จฎ้กใฎPR๏ผใฆใผใถใผใใฉใผใฏใใฉใณใใ้ใใฉใผใฏใใฉใณใใgithub.com UIใใ็ดๆฅใใกใคใซใ็ทจ้ใใใใฉใณใใใใพใใพใชๅผทๅถใใใทใฅใชใฉ๏ผใๅฎ่กใใใใพใงใใใคใใฎๆฅ้ๅฎ่กใใๅฎ้จ็ใชใธใงใใฎใญใฐใ็ฃ่ฆใใพใ๏ผๆๅณ็ใซๅธธใซใฐใชใผใณใซใชใใใใซใชใฃใฆใใๅ
จไฝใฎใธใงใใฎ็ทใงใฏใชใ๏ผใ
+4. ใในใฆใๅฎๅฎใใฆใใใใจใๆ็ขบใซใชใฃใใใๆฐใใๅคๆดใๆขๅญใฎใธใงใใซ็ตฑๅใใพใใ
+
+ใใฎใใใซใCIๆฉ่ฝ่ชไฝใฎๅฎ้จใ้ๅธธใฎใฏใผใฏใใญใผใซๅนฒๆธใใชใใใใซใงใใพใใ
+
+ใงใฏใๆฐใใCIๆฉ่ฝใ้็บไธญใงใใ้ใใธใงใใๅธธใซๆๅใใใใซใฏใฉใใใใฐใใใงใใใใ๏ผ
+
+TravisCIใฎใใใชไธ้จใฎCIใฏ `ignore-step-failure` ใใตใใผใใใๅ
จไฝใฎใธใงใใๆๅใจใใฆๅ ฑๅใใพใใใใใฎๆๆธใไฝๆใใใๆ็นใงใฏCircleCIใจGithub Actionsใฏใใใใตใใผใใใฆใใพใใใ
+
+ใใใใฃใฆใไปฅไธใฎใฏใผใฏใขใฉใฆใณใใไฝฟ็จใงใใพใ๏ผ
+
+1. bashในใฏใชใใๅ
ใงๆฝๅจ็ใชๅคฑๆใๆๅถใใใใใซๅฎ่กใณใใณใใฎๅ้ ญใซ `set +euo pipefail` ใ่จ่ฟฐใใพใใ
+2. ๆๅพใฎใณใใณใใฏๆๅใใๅฟ
่ฆใใใใพใใใใจใใฐ `echo "done"` ใพใใฏๅใซ `true` ใไฝฟ็จใงใใพใใ
+
+ไปฅไธใฏไพใงใ๏ผ
+
+
+
+```yaml
+- run:
+ name: run CI experiment
+ command: |
+ set +euo pipefail
+ echo "setting run-all-despite-any-errors-mode"
+ this_command_will_fail
+ echo "but bash continues to run"
+ # emulate another failure
+ false
+ # but the last command must be a success
+ echo "during experiment do not remove: reporting success to CI, even if there were failures"
+```
+
+
+ๅ็ดใชใณใใณใใฎๅ ดๅใฏใๆฌกใฎใใใซใใใใจใใงใใพใใ
+
+```bash
+cmd_that_may_fail || true
+```
+
+ใใกใใใ็ตๆใซๆบ่ถณใใใใๅฎ้จ็ใชในใใใใใธใงใใ้ๅธธใฎใธใงใใจ็ตฑๅใใ`set +euo pipefail` ใชใฉใฎ่ฟฝๅ ใใ่ฆ็ด ใๅ้คใใฆใๅฎ้จ็ใชใธใงใใ้ๅธธใฎCIใฎๅไฝใซๅนฒๆธใใชใใใใซใใพใใ
+
+ใใฎใใญใปในๅ
จไฝใฏใๅฎ้จ็ใชในใใใใซๅฏพใใฆ `allow-failure` ใฎใใใชใใฎใ่จญๅฎใใPRใฎๅ
จไฝใฎในใใผใฟในใซๅฝฑ้ฟใไธใใใซๅคฑๆใใใใใจใใงใใใฐใใฏใใใซ็ฐกๅใซใชใฃใใงใใใใใใใใๅ่ฟฐใฎ้ใใ็พๅจใฏCircleCIใจGithub Actionsใฏใใฎๆฉ่ฝใใตใใผใใใฆใใพใใใ
+
+ใใฎๆฉ่ฝใซ้ขใใฆใฎๆ็ฅจใใCIใซ็นๆใฎในใฌใใใงใใฎ้ฒๆ็ถๆณใ็ขบ่ชใงใใพใ๏ผ
+
+- [Github Actions:](https://github.com/actions/toolkit/issues/399)
+- [CircleCI:](https://ideas.circleci.com/ideas/CCI-I-344)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tf_xla.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tf_xla.md
new file mode 100644
index 0000000000000000000000000000000000000000..1f5a2af1a5a2880268423324f65e8c5780337397
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tf_xla.md
@@ -0,0 +1,179 @@
+
+
+# XLA Integration for TensorFlow Models
+
+[[open-in-colab]]
+
+ๅ ้็ทๅฝขไปฃๆฐ๏ผAccelerated Linear Algebra๏ผใ้็งฐXLAใฏใTensorFlowใขใใซใฎใฉใณใฟใคใ ใ้ซ้ๅใใใใใฎใณใณใใคใฉใงใใ[ๅ
ฌๅผใใญใฅใกใณใ](https://www.tensorflow.org/xla)ใซใใใฐใXLA๏ผAccelerated Linear Algebra๏ผใฏ็ทๅฝขไปฃๆฐใฎใใใฎใใกใคใณๅบๆใฎใณใณใใคใฉใงใTensorFlowใขใใซใๆฝๅจ็ใซใฝใผในใณใผใใฎๅคๆดใชใใง้ซ้ๅใงใใพใใ
+
+TensorFlowใงXLAใไฝฟ็จใใใฎใฏ็ฐกๅใงใใXLAใฏ`tensorflow`ใฉใคใใฉใชๅ
ใซใใใฑใผใธๅใใใฆใใใ[`tf.function`](https://www.tensorflow.org/guide/intro_to_graphs)ใชใฉใฎใฐใฉใใไฝๆใใ้ขๆฐๅ
ใง`jit_compile`ๅผๆฐใไฝฟ็จใใฆใใชใฌใผใงใใพใใ`fit()`ใ`predict()`ใชใฉใฎKerasใกใฝใใใไฝฟ็จใใๅ ดๅใ`model.compile()`ใซ`jit_compile`ๅผๆฐใๆธกใใ ใใงXLAใๆๅนใซใงใใพใใใใ ใใXLAใฏใใใใฎใกใฝใใใซ้ๅฎใใใฆใใใใใงใฏใใใพใใใไปปๆใฎ`tf.function`ใ้ซ้ๅใใใใใซใไฝฟ็จใงใใพใใ
+
+๐ค Transformersๅ
ใฎใใใคใใฎTensorFlowใกใฝใใใฏใXLAใจไบๆๆงใใใใใใซๆธใ็ดใใใฆใใพใใใใใซใฏใ[GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2)ใ[T5](https://huggingface.co/docs/transformers/model_doc/t5)ใ[OPT](https://huggingface.co/docs/transformers/model_doc/opt)ใชใฉใฎใใญในใ็ๆใขใใซใใ[Whisper](https://huggingface.co/docs/transformers/model_doc/whisper)ใชใฉใฎ้ณๅฃฐๅฆ็ใขใใซใๅซใพใใพใใ
+
+้ๅบฆๅไธใฎๅ
ทไฝ็ใช้ใฏใขใใซใซ้ๅธธใซไพๅญใใพใใใ๐ค Transformersๅ
ใฎTensorFlowใใญในใ็ๆใขใใซใงใฏใ็ด100ๅใฎ้ๅบฆๅไธใ็ขบ่ชใใฆใใพใใใใฎใใญใฅใกใณใใงใฏใใใใใฎใขใใซใซXLAใไฝฟ็จใใฆๆๅคงใฎใใใฉใผใใณในใๅพใๆนๆณใ่ชฌๆใใพใใใพใใใใณใใใผใฏใจXLA็ตฑๅใฎใใถใคใณๅฒๅญฆใซใคใใฆ่ฉณใใๅญฆใณใใๅ ดๅใฎ่ฟฝๅ ใชใฝใผในใธใฎใชใณใฏใๆไพใใพใใ
+
+## Running TF functions with XLA
+
+ไปฅไธใฎTensorFlowใขใใซใ่ใใฆใฟใพใใใ๏ผ
+
+
+```py
+import tensorflow as tf
+
+model = tf.keras.Sequential(
+ [tf.keras.layers.Dense(10, input_shape=(10,), activation="relu"), tf.keras.layers.Dense(5, activation="softmax")]
+)
+```
+
+ไธ่จใฎใขใใซใฏใๆฌกๅ
ใ`(10, )`ใฎๅ
ฅๅใๅใๅ
ฅใใพใใใใฎใขใใซใใใฉใฏใผใใในใงๅฎ่กใใใซใฏใๆฌกใฎใใใซใใพใ๏ผ
+
+
+```py
+# Generate random inputs for the model.
+batch_size = 16
+input_vector_dim = 10
+random_inputs = tf.random.normal((batch_size, input_vector_dim))
+
+# Run a forward pass.
+_ = model(random_inputs)
+```
+
+XLAใงใณใณใใคใซใใใ้ขๆฐใไฝฟ็จใใฆใใฉใฏใผใใในใๅฎ่กใใใซใฏใไปฅไธใฎใใใซใใพใ๏ผ
+
+
+```py
+xla_fn = tf.function(model, jit_compile=True)
+_ = xla_fn(random_inputs)
+```
+
+`model`ใฎใใใฉใซใใฎ `call()` ้ขๆฐใฏXLAใฐใฉใใใณใณใใคใซใใใใใซไฝฟ็จใใใพใใใใ ใใXLAใซใณใณใใคใซใใใไปใฎใขใใซ้ขๆฐใใใๅ ดๅใใใใๅฏ่ฝใงใใไปฅไธใฏใใฎๆนๆณใงใ๏ผ
+
+
+```py
+my_xla_fn = tf.function(model.my_xla_fn, jit_compile=True)
+```
+
+## Running a TF text generation model with XLA from ๐ค Transformers
+
+๐ค Transformersๅ
ใงXLAใงใฎ้ซ้ๅใใใ็ๆใๆๅนใซใใใซใฏใๆๆฐใใผใธใงใณใฎ`transformers`ใใคใณในใใผใซใใใฆใใๅฟ
่ฆใใใใพใใๆฌกใฎใณใใณใใๅฎ่กใใฆใคใณในใใผใซใงใใพใ๏ผ
+
+```bash
+pip install transformers --upgrade
+```
+
+ๆฌกใซใๆฌกใฎใณใผใใๅฎ่กใงใใพใ๏ผ
+
+
+```py
+import tensorflow as tf
+from transformers import AutoTokenizer, TFAutoModelForCausalLM
+
+# Will error if the minimal version of Transformers is not installed.
+from transformers.utils import check_min_version
+
+check_min_version("4.21.0")
+
+
+tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2", padding_side="left", pad_token=" ")
+model = TFAutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+input_string = ["TensorFlow is"]
+
+# One line to create an XLA generation function
+xla_generate = tf.function(model.generate, jit_compile=True)
+
+tokenized_input = tokenizer(input_string, return_tensors="tf")
+generated_tokens = xla_generate(**tokenized_input, num_beams=2)
+
+decoded_text = tokenizer.decode(generated_tokens[0], skip_special_tokens=True)
+print(f"Generated -- {decoded_text}")
+# Generated -- TensorFlow is an open-source, open-source, distributed-source application # framework for the
+```
+
+`generate()`ใงXLAใๆๅนใซใใใฎใฏใใใฃใไธ่กใฎใณใผใใงใใใณใผใใฎๆฎใ้จๅใฏๅคๆดใใใฆใใพใใใใใ ใใXLAๅบๆใฎใใใคใใฎๆณจๆ็นใไธ่จใฎใณใผใในใใใใใซใใใพใใใใใใซๆณจๆใใๅฟ
่ฆใใใใXLAใใใใใ้ๅบฆๅไธใๅฎ็พใใใใใซใใใใๆๆกใใใใจใ้่ฆใงใใๆฌกใฎใปใฏใทใงใณใงใใใใซใคใใฆ่ฉณใใ่ชฌๆใใพใใ
+
+
+## Gotchas to be aware of
+
+XLAใๆๅนใซใใ้ขๆฐ๏ผไธ่จใฎ`xla_generate()`ใชใฉ๏ผใๅใใฆๅฎ่กใใใจใๅ
้จใง่จ็ฎใฐใฉใใๆจ่ซใใใใจใใพใใใใใใฏๆ้ใใใใใพใใใใฎใใญใปในใฏ["ใใฌใผใทใณใฐ"๏ผtracing๏ผ](https://www.tensorflow.org/guide/intro_to_graphs#when_is_a_function_tracing)ใจใใฆ็ฅใใใฆใใพใใ
+
+็ๆๆ้ใ้ซ้ใงใฏใชใใใจใซๆฐไปใใใใใใพใใใ`xla_generate()`๏ผใพใใฏไปใฎXLAๅฏพๅฟ้ขๆฐ๏ผใฎ้ฃ็ถๅผใณๅบใใงใฏใ้ขๆฐใธใฎๅ
ฅๅใๆๅใซ่จ็ฎใฐใฉใใๆง็ฏใใใใจใใจๅใๅฝข็ถใซๅพใฃใฆใใๅ ดๅใ่จ็ฎใฐใฉใใๆจ่ซใใๅฟ
่ฆใฏใใใพใใใใใใฏใๅ
ฅๅๅฝข็ถใๅบๅฎใใใฆใใใขใใชใใฃ๏ผไพ๏ผ็ปๅ๏ผใซใฏๅ้กใใใพใใใใๅคๆฐใฎๅ
ฅๅๅฝข็ถใขใใชใใฃ๏ผไพ๏ผใใญในใ๏ผใๆฑใๅ ดๅใซใฏๆณจๆใๅฟ
่ฆใงใใ
+
+`xla_generate()`ใๅธธใซๅใๅ
ฅๅๅฝข็ถใงๅไฝใใใใใซใใใซใฏใใใผใฏใใคใถใๅผใณๅบใ้ใซ`padding`ๅผๆฐใๆๅฎใงใใพใใ
+
+```py
+import tensorflow as tf
+from transformers import AutoTokenizer, TFAutoModelForCausalLM
+
+tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2", padding_side="left", pad_token="")
+model = TFAutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+input_string = ["TensorFlow is"]
+
+xla_generate = tf.function(model.generate, jit_compile=True)
+
+# Here, we call the tokenizer with padding options.
+tokenized_input = tokenizer(input_string, pad_to_multiple_of=8, padding=True, return_tensors="tf")
+
+generated_tokens = xla_generate(**tokenized_input, num_beams=2)
+decoded_text = tokenizer.decode(generated_tokens[0], skip_special_tokens=True)
+print(f"Generated -- {decoded_text}")
+```
+
+ใใใซใใใ`xla_generate()`ใธใฎๅ
ฅๅใๅธธใซใใฌใผในใใใๅฝข็ถใฎๅ
ฅๅใๅใๅใใใจใ็ขบ่ชใใ็ๆๆ้ใฎ้ซ้ๅใๅฎ็พใงใใพใใไปฅไธใฎใณใผใใงใใใ็ขบ่ชใงใใพใ๏ผ
+
+```py
+import time
+import tensorflow as tf
+from transformers import AutoTokenizer, TFAutoModelForCausalLM
+
+tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2", padding_side="left", pad_token="")
+model = TFAutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+
+xla_generate = tf.function(model.generate, jit_compile=True)
+
+for input_string in ["TensorFlow is", "TensorFlow is a", "TFLite is a"]:
+ tokenized_input = tokenizer(input_string, pad_to_multiple_of=8, padding=True, return_tensors="tf")
+ start = time.time_ns()
+ generated_tokens = xla_generate(**tokenized_input, num_beams=2)
+ end = time.time_ns()
+ print(f"Execution time -- {(end - start) / 1e6:.1f} ms\n")
+```
+
+Tesla T4 GPUใไฝฟ็จใใใจใๆฌกใฎใใใชๅบๅใๆๅพ
ใใใพใ๏ผ
+
+```bash
+Execution time -- 30819.6 ms
+
+Execution time -- 79.0 ms
+
+Execution time -- 78.9 ms
+```
+
+ๆๅใฎ`xla_generate()`ๅผใณๅบใใฏใใฌใผใทใณใฐใฎใใใซๆ้ใใใใใพใใใ้ฃ็ถใใๅผใณๅบใใฏๆก้ใใซ้ซ้ใงใใ็ๆใชใใทใงใณใฎใใใชใๅคๆดใใๅใใฌใผใทใณใฐใๅผใ่ตทใใใ็ๆๆ้ใฎ้
ๅปถใๅผใ่ตทใใใใจใซๆณจๆใใฆใใ ใใใ
+
+ใใฎใใญใฅใกใณใใงใฏใ๐ค Transformersใๆไพใใใใญในใ็ๆใชใใทใงใณใใในใฆ็ถฒ็พ
ใใฆใใพใใใ้ซๅบฆใชใฆใผในใฑใผในใซใคใใฆใฏใใญใฅใกใณใใผใทใงใณใๅ็
งใใใใจใใๅงใใใพใใ
+
+## Additional Resources
+
+ใใใงใฏใ๐ค Transformersใจไธ่ฌ็ใชXLAใซใคใใฆใใใซ่ฉณใใๅญฆใณใใๅ ดๅใฎใใใคใใฎ่ฟฝๅ ใชใฝใผในใๆไพใใพใใ
+
+* [ใใฎColab Notebook](https://colab.research.google.com/github/huggingface/blog/blob/main/notebooks/91_tf_xla_generate.ipynb)ใงใฏใXLAๅฏพๅฟใฎใจใณใณใผใใผใใณใผใใผ๏ผ[T5](https://huggingface.co/docs/transformers/model_doc/t5)ใชใฉ๏ผใใใณใใณใผใใผๅฐ็จ๏ผ[GPT2](https://huggingface.co/docs/transformers/model_doc/gpt2)ใชใฉ๏ผใใญในใ็ๆใขใใซใ่ฉฆใใใใฎๅฏพ่ฉฑๅใใขใๆไพใใใฆใใพใใ
+* [ใใฎใใญใฐ่จไบ](https://huggingface.co/blog/tf-xla-generate)ใงใฏใXLAๅฏพๅฟใขใใซใฎๆฏ่ผใใณใใใผใฏใฎๆฆ่ฆใจใTensorFlowใงใฎXLAใซใคใใฆใฎๅๅฅฝ็ใช็ดนไปใๆไพใใใฆใใพใใ
+* [ใใฎใใญใฐ่จไบ](https://blog.tensorflow.org/2022/11/how-hugging-face-improved-text-generation-performance-with-xla.html)ใงใฏใ๐ค TransformersใฎTensorFlowใขใใซใซXLAใตใใผใใ่ฟฝๅ ใใ้ใฎ่จญ่จๅฒๅญฆใซใคใใฆ่ชฌๆใใฆใใพใใ
+* ไธ่ฌ็ใชXLAใจTensorFlowใฐใฉใใซใคใใฆ่ฉณใใๅญฆใถใใใฎใใใใใฎๆ็จฟ๏ผ
+ * [XLA: ๆฉๆขฐๅญฆ็ฟ็จใฎๆ้ฉๅใณใณใใคใฉ](https://www.tensorflow.org/xla)
+ * [ใฐใฉใใจ`tf.function`ใฎ็ดนไป](https://www.tensorflow.org/guide/intro_to_graphs)
+ * [`tf.function`ใไฝฟ็จใใใใใฉใผใใณในๅไธ](https://www.tensorflow.org/guide/function)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tflite.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tflite.md
new file mode 100644
index 0000000000000000000000000000000000000000..ad3e9a3f484e2ce157a23cf0b58d1854efc8a267
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tflite.md
@@ -0,0 +1,58 @@
+
+
+# Export to TFLite
+
+[TensorFlow Lite](https://www.tensorflow.org/lite/guide)ใฏใใขใใคใซใใฉใณใ็ตใฟ่พผใฟใทในใใ ใใใใณใขใใฎใคใณใฟใผใใใ๏ผIoT๏ผใใใคในใชใฉใใชใฝใผในใซๅถ็ดใฎใใใใใคในใซๆฉๆขฐๅญฆ็ฟใขใใซใๅฑ้ใใใใใฎ่ปฝ้ใชใใฌใผใ ใฏใผใฏใงใใTFLiteใฏใ่จ็ฎ่ฝๅใใกใขใชใใใใณ้ปๅๆถ่ฒปใ้ใใใฆใใใใใใฎใใใคในไธใงใขใใซใๅน็็ใซๆ้ฉๅใใฆๅฎ่กใใใใใซ่จญ่จใใใฆใใพใใ
+TensorFlow Liteใขใใซใฏใ`.tflite`ใใกใคใซๆกๅผตๅญใง่ญๅฅใใใ็นๅฅใชๅน็็ใชใใผใฟใใซๅฝขๅผใง่กจใใใพใใ
+
+๐ค Optimumใฏใ๐ค TransformersใขใใซใTFLiteใซใจใฏในใใผใใใใใใฎๆฉ่ฝใ`exporters.tflite`ใขใธใฅใผใซใไปใใฆๆไพใใฆใใพใใใตใใผใใใใฆใใใขใใซใขใผใญใใฏใใฃใฎใชในใใซใคใใฆใฏใ[๐ค Optimumใฎใใญใฅใกใณใ](https://huggingface.co/docs/optimum/exporters/tflite/overview)ใใๅ็
งใใ ใใใ
+
+ใขใใซใTFLiteใซใจใฏในใใผใใใใซใฏใๅฟ
่ฆใชไพๅญ้ขไฟใใคใณในใใผใซใใฆใใ ใใ๏ผ
+
+
+```bash
+pip install optimum[exporters-tf]
+```
+
+ใในใฆใฎๅฉ็จๅฏ่ฝใชๅผๆฐใ็ขบ่ชใใใซใฏใ[๐ค Optimumใใญใฅใกใณใ](https://huggingface.co/docs/optimum/main/en/exporters/tflite/usage_guides/export_a_model)ใๅ็
งใใใใใณใใณใใฉใคใณใงใใซใใ่กจ็คบใใฆใใ ใใ๏ผ
+
+```bash
+optimum-cli export tflite --help
+```
+
+๐ค Hubใใใขใใซใฎใใงใใฏใใคใณใใใจใฏในใใผใใใใซใฏใไพใใฐ `google-bert/bert-base-uncased` ใไฝฟ็จใใๅ ดๅใๆฌกใฎใณใใณใใๅฎ่กใใพใ๏ผ
+
+```bash
+optimum-cli export tflite --model google-bert/bert-base-uncased --sequence_length 128 bert_tflite/
+```
+
+้ฒ่ก็ถๆณใ็คบใใญใฐใ่กจ็คบใใใ็ๆใใใ `model.tflite` ใไฟๅญใใใๅ ดๆใ่กจ็คบใใใใฏใใงใ๏ผ
+
+```bash
+Validating TFLite model...
+ -[โ] TFLite model output names match reference model (logits)
+ - Validating TFLite Model output "logits":
+ -[โ] (1, 128, 30522) matches (1, 128, 30522)
+ -[x] values not close enough, max diff: 5.817413330078125e-05 (atol: 1e-05)
+The TensorFlow Lite export succeeded with the warning: The maximum absolute difference between the output of the reference model and the TFLite exported model is not within the set tolerance 1e-05:
+- logits: max diff = 5.817413330078125e-05.
+ The exported model was saved at: bert_tflite
+ ```
+
+ไธ่จใฎไพใฏ๐ค Hubใใใใงใใฏใใคใณใใใจใฏในใใผใใใๆนๆณใ็คบใใฆใใพใใใญใผใซใซใขใใซใใจใฏในใใผใใใๅ ดๅใใพใใขใใซใฎ้ใฟใใกใคใซใจใใผใฏใใคใถใใกใคใซใๅใใใฃใฌใฏใใช๏ผ`local_path`๏ผใซไฟๅญใใใใจใ็ขบ่ชใใฆใใ ใใใCLIใไฝฟ็จใใๅ ดๅใ๐ค Hubใฎใใงใใฏใใคใณใๅใฎไปฃใใใซ`model`ๅผๆฐใซ`local_path`ใๆธกใใพใใ
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tokenizer_summary.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tokenizer_summary.md
new file mode 100644
index 0000000000000000000000000000000000000000..448ad9c871aaa340de9d2b6f954549c8849091d3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/tokenizer_summary.md
@@ -0,0 +1,179 @@
+
+
+# Summary of the tokenizers
+
+[[open-in-colab]]
+
+ใใฎใใผใธใงใฏใใใผใฏใใคใผใผใทใงใณใซใคใใฆ่ฉณใใ่ฆใฆใใใพใใ
+
+
+
+[ๅๅฆ็ใฎใใฅใผใใชใขใซ](preprocessing)ใง่ฆใใใใซใใใญในใใใใผใฏใณๅใใใใจใฏใใใใๅ่ชใพใใฏใตใใฏใผใใซๅๅฒใใใใใใใซใใฏใขใใใใผใใซใไปใใฆIDใซๅคๆใใใใจใงใใๅ่ชใพใใฏใตใใฏใผใใIDใซๅคๆใใใใจใฏ็ฐกๅใงใใฎใงใใใฎ่ฆ็ดใงใฏใใญในใใๅ่ชใพใใฏใตใใฏใผใใซๅๅฒใใ๏ผใคใพใใใใญในใใใใผใฏใใคใบใใ๏ผใใจใซ็ฆ็นใๅฝใฆใพใใๅ
ทไฝ็ใซใฏใ๐ค Transformersใงไฝฟ็จใใใ3ใคใฎไธป่ฆใชใใผใฏใใคใถใ[Byte-Pair Encoding๏ผBPE๏ผ](#byte-pair-encoding)ใ[WordPiece](#wordpiece)ใใใใณ[SentencePiece](#sentencepiece)ใ่ฆใฆใใฉใฎใขใใซใใฉใฎใใผใฏใใคใถใฟใคใใไฝฟ็จใใฆใใใใฎไพใ็คบใใพใใ
+
+ๅใขใใซใใผใธใงใฏใไบๅใใฌใผใใณใฐๆธใฟใขใใซใใฉใฎใใผใฏใใคใถใฟใคใใไฝฟ็จใใฆใใใใ็ฅใใใใซใ้ข้ฃใใใใผใฏใใคใถใฎใใญใฅใกใณใใ็ขบ่ชใงใใพใใไพใใฐใ[`BertTokenizer`]ใ่ฆใใจใใขใใซใ[WordPiece](#wordpiece)ใไฝฟ็จใใฆใใใใจใใใใใพใใ
+
+## Introduction
+
+ใใญในใใใใๅฐใใชใใฃใณใฏใซๅๅฒใใใใจใฏใ่ฆใใไปฅไธใซ้ฃใใใฟในใฏใงใใใ่คๆฐใฎๆนๆณใใใใพใใไพใใฐใๆฌกใฎๆใ่ใใฆใฟใพใใใใใ"Don't you love ๐ค Transformers? We sure do."ใ
+
+
+
+ใใฎใใญในใใใใผใฏใณๅใใ็ฐกๅใชๆนๆณใฏใในใใผในใงๅๅฒใใใใจใงใใใใใซใใใไปฅไธใฎใใใซใชใใพใ๏ผ
+
+
+```
+["Don't", "you", "love", "๐ค", "Transformers?", "We", "sure", "do."]
+```
+
+ใใใฏๅ็็ใช็ฌฌไธๆญฉใงใใใใใผใฏใณ "Transformers?" ใจ "do." ใ่ฆใใจใๅฅ่ชญ็นใๅ่ช "Transformer" ใจ "do" ใซ็ตๅใใใฆใใใใจใใใใใใใใฏๆ้ฉใงใฏใใใพใใใๅฅ่ชญ็นใ่ๆ
ฎใซๅ
ฅใใในใใงใใขใใซใๅ่ชใจใใใซ็ถใๅฏ่ฝๆงใฎใใใในใฆใฎๅฅ่ชญ็น่จๅทใฎ็ฐใชใ่กจ็พใๅญฆใฐใชใใใฐใชใใชใใใจใ้ฟใใในใใงใใใใใซใใใใขใใซใๅญฆใฐใชใใใฐใชใใชใ่กจ็พใฎๆฐใ็็บ็ใซๅขๅ ใใพใใๅฅ่ชญ็นใ่ๆ
ฎใซๅ
ฅใใๅ ดๅใไพๆใฎใใผใฏใณๅใฏๆฌกใฎใใใซใชใใพใ๏ผ
+
+
+```
+["Don", "'", "t", "you", "love", "๐ค", "Transformers", "?", "We", "sure", "do", "."]
+```
+
+ใใ ใใๅ่ชใ"Don't"ใใใใผใฏใณๅใใๆนๆณใซ้ขใใฆใฏใไธๅฉใชๅด้ขใใใใพใใ ใ"Don't"ใใฏใ"do not"ใใ่กจใใฆใใใใใใ["Do", "n't"]ใใจใใฆใใผใฏใณๅใใๆนใ้ฉใใฆใใพใใใใใใไบๆใ่ค้ใซใชใใๅใขใใซใ็ฌ่ชใฎใใผใฏใใคใถใผใฟใคใใๆใค็็ฑใฎไธ้จใงใใใใพใใใใญในใใใใผใฏใณๅใใใใใซ้ฉ็จใใใซใผใซใซๅฟใใฆใๅใใใญในใใซๅฏพใใฆ็ฐใชใใใผใฏใใคใบใใใๅบๅใ็ๆใใใพใใไบๅใใฌใผใใณใฐๆธใฟใขใใซใฏใใใฌใผใใณใฐใใผใฟใใใผใฏใใคใบใใใฎใซไฝฟ็จใใใใซใผใซใจๅใใซใผใซใงใใผใฏใใคใบใใใๅ
ฅๅใๆไพใใๅ ดๅใซใฎใฟๆญฃๅธธใซๆฉ่ฝใใพใใ
+
+[spaCy](https://spacy.io/)ใจ[Moses](http://www.statmt.org/moses/?n=Development.GetStarted)ใฏใ2ใคใฎไบบๆฐใฎใใใซใผใซใใผในใฎใใผใฏใใคใถใผใงใใใใใใ็งใใกใฎไพใซ้ฉ็จใใใจใ*spaCy*ใจ*Moses*ใฏๆฌกใฎใใใชๅบๅใ็ๆใใพใ๏ผ
+
+```
+["Do", "n't", "you", "love", "๐ค", "Transformers", "?", "We", "sure", "do", "."]
+```
+
+็ฉบ็ฝใจๅฅ่ชญ็นใฎใใผใฏใณๅใใใใณใซใผใซใใผในใฎใใผใฏใณๅใไฝฟ็จใใใฆใใใใจใใใใใพใใ็ฉบ็ฝใจๅฅ่ชญ็นใฎใใผใฏใณๅใใใใณใซใผใซใใผในใฎใใผใฏใณๅใฏใๆใๅ่ชใซๅๅฒใใใใจใใใใใใซๅฎ็พฉใใใๅ่ชใใผใฏใณๅใฎไพใงใใใใญในใใใใๅฐใใชใใฃใณใฏใซๅๅฒใใใใใฎๆใ็ดๆ็ใชๆนๆณใงใใไธๆนใใใฎใใผใฏใณๅๆนๆณใฏๅคง่ฆๆจกใชใใญในใใณใผใในใซๅฏพใใฆๅ้กใๅผใ่ตทใใใใจใใใใพใใใใฎๅ ดๅใ็ฉบ็ฝใจๅฅ่ชญ็นใฎใใผใฏใณๅใฏ้ๅธธใ้ๅธธใซๅคงใใช่ชๅฝ๏ผใในใฆใฎไธๆใชๅ่ชใจใใผใฏใณใฎใปใใ๏ผใ็ๆใใพใใไพใใฐใ[Transformer XL](model_doc/transformerxl)ใฏ็ฉบ็ฝใจๅฅ่ชญ็นใฎใใผใฏใณๅใไฝฟ็จใใฆใใใ่ชๅฝใตใคใบใฏ267,735ใงใ๏ผ
+
+ใใฎใใใชๅคงใใช่ชๅฝใตใคใบใฏใใขใใซใซ้ๅธธใซๅคงใใชๅใ่พผใฟ่กๅใๅ
ฅๅใใใณๅบๅใฌใคใคใผใจใใฆๆใใใใใจใๅผทๅถใใใกใขใชใใใณๆ้ใฎ่ค้ใใฎๅขๅ ใๅผใ่ตทใใใพใใไธ่ฌ็ใซใใใฉใณในใใฉใผใใผใขใใซใฏใ็นใซๅไธใฎ่จ่ชใงไบๅใใฌใผใใณใฐใใใๅ ดๅใ50,000ใ่ถ
ใใ่ชๅฝใตใคใบใๆใคใใจใฏใปใจใใฉใใใพใใใ
+
+ใใใใฃใฆใใทใณใใซใช็ฉบ็ฝใจๅฅ่ชญ็นใฎใใผใฏใณๅใไธๅๅใชๅ ดๅใใชใๅใซๆๅญๅไฝใงใใผใฏใณๅใใชใใฎใใจใใ็ๅใ็ใใพใใ๏ผ
+
+
+
+ๆๅญๅไฝใฎใใผใฏใณๅใฏ้ๅธธใซใทใณใใซใงใใใใกใขใชใจๆ้ใฎ่ค้ใใๅคงๅน
ใซๅๆธใงใใพใใใใขใใซใซๆๅณใฎใใๅ
ฅๅ่กจ็พใๅญฆ็ฟใใใใใจใ้ๅธธใซ้ฃใใใชใใพใใใใจใใฐใๆๅญใ"t"ใใฎใใใฎๆๅณใฎใใใณใณใใญในใ็ฌ็ซใฎ่กจ็พใๅญฆ็ฟใใใใจใฏใๅ่ชใ"today"ใใฎใใใฎใณใณใใญในใ็ฌ็ซใฎ่กจ็พใๅญฆ็ฟใใใใใใฏใใใซ้ฃใใใงใใใใฎใใใๆๅญๅไฝใฎใใผใฏใณๅใฏใใฐใใฐใใใฉใผใใณในใฎไฝไธใไผดใใพใใใใใใฃใฆใใใฉใณในใใฉใผใใผใขใใซใฏๅ่ชใฌใใซใจๆๅญใฌใใซใฎใใผใฏใณๅใฎใใคใใชใใใงใใ**ใตใใฏใผใ**ใใผใฏใณๅใไฝฟ็จใใฆใไธกๆนใฎไธ็ใฎๅฉ็นใๆดปใใใพใใ
+
+## Subword tokenization
+
+
+
+ใตใใฏใผใใใผใฏใณๅใขใซใดใชใบใ ใฏใ้ ป็นใซไฝฟ็จใใใๅ่ชใใใๅฐใใชใตใใฏใผใใซๅๅฒใในใใงใฏใชใใใ็ใใๅ่ชใฏๆๅณใฎใใใตใใฏใผใใซๅ่งฃใใใใจใใๅๅใซไพๅญใใฆใใพใใใใจใใฐใใ"annoyingly"ใใฏ็ใใๅ่ชใจ่ฆใชใใใใใฎๅ่ชใฏใ"annoying"ใใจใ"ly"ใใซๅ่งฃใใใใใใใใพใใใ็ฌ็ซใใใ"annoying"ใใจใ"ly"ใใฏใใ้ ป็นใซ็พใใพใใใใ"annoyingly"ใใฎๆๅณใฏใ"annoying"ใใจใ"ly"ใใฎๅๆ็ใชๆๅณใซใใฃใฆไฟๆใใใพใใใใใฏ็นใซใใซใณ่ชใชใฉใฎ็ตๅ่จ่ชใงๅฝน็ซใกใพใใใใใงใฏใตใใฏใผใใ้ฃ็ตใใฆ๏ผใปใผ๏ผไปปๆใฎ้ทใ่ค้ใชๅ่ชใๅฝขๆใงใใพใใ
+
+ใตใใฏใผใใใผใฏใณๅใซใใใใขใใซใฏๅ็็ใช่ชๅฝใตใคใบใๆใคใใจใใงใใๆๅณใฎใใใณใณใใญในใ็ฌ็ซใฎ่กจ็พใๅญฆ็ฟใงใใพใใใใใซใใตใใฏใผใใใผใฏใณๅใซใใใใขใใซใฏไปฅๅใซ่ฆใใใจใฎใชใๅ่ชใๅฆ็ใใใใใใๆข็ฅใฎใตใใฏใผใใซๅ่งฃใใใใจใใงใใพใใไพใใฐใ[`~transformers.BertTokenizer`]ใฏ`"I have a new GPU!"`ใไปฅไธใฎใใใซใใผใฏใณๅใใพใ๏ผ
+
+
+```py
+>>> from transformers import BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+>>> tokenizer.tokenize("I have a new GPU!")
+["i", "have", "a", "new", "gp", "##u", "!"]
+```
+
+ใuncasedใใขใใซใ่ๆ
ฎใใฆใใใใใใพใๆใๅฐๆๅญใซๅคๆใใพใใใใใผใฏใใคใถใฎ่ชๅฝใซใ["i", "have", "a", "new"]ใใจใใๅ่ชใๅญๅจใใใใจใใใใใพใใใใ"gpu"ใใจใใๅ่ชใฏๅญๅจใใพใใใใใใใฃใฆใใใผใฏใใคใถใฏใ"gpu"ใใๆข็ฅใฎใตใใฏใผใใ["gp"ใ"##u"]ใใซๅๅฒใใพใใใใใงใ"##"ใใฏใใใผใฏใณใฎใใณใผใใพใใฏใใผใฏใใคใผใผใทใงใณใฎ้่ปขใฎใใใซใใใผใฏใณใฎๅใฎ้จๅใซในใใผในใชใใงๆฅ็ถใใๅฟ
่ฆใใใใใจใๆๅณใใพใใ
+
+ๅฅใฎไพใจใใฆใ[`~transformers.XLNetTokenizer`]ใฏไปฅไธใฎใใใซไปฅๅใฎใตใณใใซใใญในใใใใผใฏใณๅใใพใ๏ผ
+
+```py
+>>> from transformers import XLNetTokenizer
+
+>>> tokenizer = XLNetTokenizer.from_pretrained("xlnet/xlnet-base-cased")
+>>> tokenizer.tokenize("Don't you love ๐ค Transformers? We sure do.")
+["โDon", "'", "t", "โyou", "โlove", "โ", "๐ค", "โ", "Transform", "ers", "?", "โWe", "โsure", "โdo", "."]
+```
+
+ใใใใฎใโใใฎๆๅณใซใคใใฆใฏใ[SentencePiece](#sentencepiece)ใ่ฆใใจใใซ่ฉณใใ่ชฌๆใใพใใใ่ฆงใฎ้ใใใTransformersใใจใใ็ใใๅ่ชใฏใใใ้ ป็นใซ็พใใใตใใฏใผใใTransformใใจใersใใซๅๅฒใใใฆใใพใใ
+
+ใใฆใ็ฐใชใใตใใฏใผใใใผใฏใณๅใขใซใดใชใบใ ใใฉใฎใใใซๅไฝใใใใ่ฆใฆใฟใพใใใใใใใใฎใใผใฏใใคใผใผใทใงใณใขใซใดใชใบใ ใฏใในใฆใ้ๅธธใฏๅฏพๅฟใใใขใใซใใใฌใผใใณใฐใใใใณใผใในใง่กใใใๅฝขๅผใฎใใฌใผใใณใฐใซไพๅญใใฆใใพใใ
+
+
+
+### Byte-Pair Encoding๏ผBPE๏ผ
+
+Byte-Pair Encoding๏ผBPE๏ผใฏใ[Neural Machine Translation of Rare Words with Subword Units๏ผSennrich et al., 2015๏ผ](https://arxiv.org/abs/1508.07909)ใงๅฐๅ
ฅใใใพใใใBPEใฏใใใฌใผใใณใฐใใผใฟใๅ่ชใซๅๅฒใใใใชใใผใฏใใคใถใซไพๅญใใฆใใพใใใใชใใผใฏใใคใผใผใทใงใณใฏใ็ฉบ็ฝใฎใใผใฏใใคใผใผใทใงใณใชใฉใ้ๅธธใซๅ็ดใชใใฎใงใใใใจใใใใพใใไพใใฐใ[GPT-2](model_doc/gpt2)ใ[RoBERTa](model_doc/roberta)ใงใใใใ้ซๅบฆใชใใชใใผใฏใใคใผใผใทใงใณใซใฏใใซใผใซใใผในใฎใใผใฏใใคใผใผใทใงใณ๏ผ[XLM](model_doc/xlm)ใ[FlauBERT](model_doc/flaubert)ใชใฉใๅคง้จๅใฎ่จ่ชใซMosesใไฝฟ็จ๏ผใใ[GPT](model_doc/gpt)๏ผSpacyใจftfyใไฝฟ็จใใฆใใฌใผใใณใฐใณใผใในๅ
ใฎๅๅ่ชใฎ้ ปๅบฆใๆฐใใ๏ผใชใฉใๅซใพใใพใใ
+
+ใใชใใผใฏใใคใผใผใทใงใณใฎๅพใไธๆใฎๅ่ชใปใใใไฝๆใใใๅๅ่ชใใใฌใผใใณใฐใใผใฟใงๅบ็พใใ้ ปๅบฆใๆฑบๅฎใใใพใใๆฌกใซใBPEใฏใใผใน่ชๅฝใไฝๆใใใใผใน่ชๅฝใฎไบใคใฎใทใณใใซใใๆฐใใใทใณใใซใๅฝขๆใใใใใฎใใผใธใซใผใซใๅญฆ็ฟใใพใใใใฎใใญใปในใฏใ่ชๅฝใๆๆใฎ่ชๅฝใตใคใบใซ้ใใใพใง็ถใใใใพใใใชใใๆๆใฎ่ชๅฝใตใคใบใฏใใผใฏใใคใถใใใฌใผใใณใฐใใๅใซๅฎ็พฉใใใใคใใผใใฉใกใผใฟใงใใใใจใซๆณจๆใใฆใใ ใใใ
+
+ไพใจใใฆใใใชใใผใฏใใคใผใผใทใงใณใฎๅพใๆฌกใฎใปใใใฎๅ่ชใจใใฎๅบ็พ้ ปๅบฆใๆฑบๅฎใใใใจไปฎๅฎใใพใใใ๏ผ
+
+
+```
+("hug", 10), ("pug", 5), ("pun", 12), ("bun", 4), ("hugs", 5)
+```
+
+ใใใใฃใฆใใใผใน่ชๅฝใฏใ["b", "g", "h", "n", "p", "s", "u"]ใใงใใใในใฆใฎๅ่ชใใใผใน่ชๅฝใฎใทใณใใซใซๅๅฒใใใจใๆฌกใฎใใใซใชใใพใ๏ผ
+
+
+```
+("h" "u" "g", 10), ("p" "u" "g", 5), ("p" "u" "n", 12), ("b" "u" "n", 4), ("h" "u" "g" "s", 5)
+```
+
+ใใฎๅพใBPEใฏๅฏ่ฝใชใในใฆใฎใทใณใใซใใขใฎ้ ปๅบฆใๆฐใใๆใ้ ป็นใซ็บ็ใใใทใณใใซใใขใ้ธๆใใพใใไธ่จใฎไพใงใฏใ`"h"`ใฎๅพใซ`"u"`ใ15ๅ๏ผ`"hug"`ใฎ10ๅใ`"hugs"`ใฎ5ๅ๏ผๅบ็พใใพใใใใใใๆใ้ ป็นใชใทใณใใซใใขใฏใๅ่จใง20ๅ๏ผ`"u"`ใฎ10ๅใ`"g"`ใฎ5ๅใ`"u"`ใฎ5ๅ๏ผๅบ็พใใ`"u"`ใฎๅพใซ`"g"`ใ็ถใใทใณใใซใใขใงใใใใใใฃใฆใใใผใฏใใคใถใๆๅใซๅญฆ็ฟใใใใผใธใซใผใซใฏใ`"u"`ใฎๅพใซ`"g"`ใ็ถใใในใฆใฎ`"u"`ใทใณใใซใไธ็ทใซใฐใซใผใๅใใใใจใงใใๆฌกใซใ`"ug"`ใ่ชๅฝใซ่ฟฝๅ ใใใพใใๅ่ชใฎใปใใใฏๆฌกใซใชใใพใ๏ผ
+
+
+```
+("h" "ug", 10), ("p" "ug", 5), ("p" "u" "n", 12), ("b" "u" "n", 4), ("h" "ug" "s", 5)
+```
+
+ๆฌกใซใBPEใฏๆฌกใซๆใไธ่ฌ็ใชใทใณใใซใใขใ่ญๅฅใใพใใใใใฏใ"u"ใใซ็ถใใฆใ"n"ใใงใ16ๅๅบ็พใใพใใใใใใฃใฆใใ"u"ใใจใ"n"ใใฏใ"un"ใใซ็ตๅใใใ่ชๅฝใซ่ฟฝๅ ใใใพใใๆฌกใซๆใ้ ปๅบฆใฎ้ซใใทใณใใซใใขใฏใใ"h"ใใซ็ถใใฆใ"ug"ใใงใ15ๅๅบ็พใใพใใๅใณใใขใ็ตๅใใใใhugใใ่ชๅฝใซ่ฟฝๅ ใงใใพใใ
+
+ใใฎๆฎต้ใงใฏใ่ชๅฝใฏ`["b", "g", "h", "n", "p", "s", "u", "ug", "un", "hug"]`ใงใใใไธๆใฎๅ่ชใฎใปใใใฏไปฅไธใฎใใใซ่กจใใใพใ๏ผ
+
+
+```
+("hug", 10), ("p" "ug", 5), ("p" "un", 12), ("b" "un", 4), ("hug" "s", 5)
+```
+
+ๅๆใจใใฆใByte-Pair Encoding๏ผBPE๏ผใฎใใฌใผใใณใฐใใใฎๆฎต้ใงๅๆญขใใใจใๅญฆ็ฟใใใใใผใธใซใผใซใๆฐใใๅ่ชใซ้ฉ็จใใใพใ๏ผๆฐใใๅ่ชใซใฏใใผในใใญใฃใใฉใชใซๅซใพใใฆใใชใใทใณใใซใๅซใพใใฆใใชใ้ใ๏ผใ ไพใใฐใๅ่ช "bug" ใฏ ["b", "ug"] ใจใใฆใใผใฏใณๅใใใพใใใ"mug" ใฏใใผในใใญใฃใใฉใชใซ "m" ใทใณใใซใๅซใพใใฆใใชใใใใ["", "ug"] ใจใใฆใใผใฏใณๅใใใพใใ ไธ่ฌ็ใซใ"m" ใฎใใใชๅไธใฎๆๅญใฏใใใฌใผใใณใฐใใผใฟใซใฏ้ๅธธใๅๆๅญใฎๅฐใชใใจใ1ใคใฎๅบ็พใๅซใพใใฆใใใใใ"" ใทใณใใซใซ็ฝฎใๆใใใใใใจใฏใใใพใใใใ็ตตๆๅญใฎใใใช้ๅธธใซ็นๆฎใชๆๅญใฎๅ ดๅใซใฏ็บ็ใใๅฏ่ฝๆงใใใใพใใ
+
+ๅ่ฟฐใฎใใใซใใใญใฃใใฉใชใตใคใบใใใชใใกใใผในใใญใฃใใฉใชใตใคใบ + ใใผใธใฎๅๆฐใฏ้ธๆใใใใคใใผใใฉใกใผใฟใงใใ ไพใใฐใ[GPT](model_doc/gpt) ใฏใใผในๆๅญใ478ๆๅญใงใ40,000ๅใฎใใผใธๅพใซใใฌใผใใณใฐใๅๆญขใใใใใใใญใฃใใฉใชใตใคใบใฏ40,478ใงใใ
+
+#### Byte-level BPE
+
+ใในใฆใฎUnicodeๆๅญใใใผในๆๅญใจ่ใใใจใใในใฆใฎๅฏ่ฝใชใใผในๆๅญใๅซใพใใใใใใใชใใใผในใใญใฃใใฉใชใฏใใชใๅคงใใใชใใใจใใใใพใใ [GPT-2](https://cdn.openai.com/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) ใฏใใใผในใใญใฃใใฉใชใ256ใใคใใซใใ่ณขใใใชใใฏใจใใฆใใคใใใใผในใใญใฃใใฉใชใจใใฆไฝฟ็จใใใในใฆใฎใใผในๆๅญใใใญใฃใใฉใชใซๅซใพใใใใใซใใฆใใพใใ ใใณใฏใใฅใจใผใทใงใณใๆฑใใใใฎใใใคใใฎ่ฟฝๅ ใซใผใซใๅใใGPT2ใฎใใผใฏใใคใถใฏใ ใทใณใใซใๅฟ
่ฆใจใใใซใในใฆใฎใใญในใใใใผใฏใณๅใงใใพใใ [GPT-2](model_doc/gpt) ใฏ50,257ใฎใใญใฃใใฉใชใตใคใบใๆใฃใฆใใใใใใฏ256ใใคใใฎใใผในใใผใฏใณใ็นๅฅใชใใญในใใฎ็ตไบใ็คบใใใผใฏใณใใใใณ50,000ๅใฎใใผใธใงๅญฆ็ฟใใใทใณใใซใซๅฏพๅฟใใฆใใพใใ
+
+### WordPiece
+
+WordPieceใฏใ[BERT](model_doc/bert)ใ[DistilBERT](model_doc/distilbert)ใใใใณ[Electra](model_doc/electra)ใงไฝฟ็จใใใใตใใฏใผใใใผใฏใใคใผใผใทใงใณใขใซใดใชใบใ ใงใใ ใใฎใขใซใดใชใบใ ใฏใ[Japanese and Korean Voice Search (Schuster et al., 2012)](https://static.googleusercontent.com/media/research.google.com/ja//pubs/archive/37842.pdf) ใงๆฆ่ชฌใใใฆใใใBPEใซ้ๅธธใซไผผใฆใใพใใ WordPieceใฏๆใ้ ป็นใชใทใณใใซใใขใ้ธๆใใใฎใงใฏใชใใใใฌใผใใณใฐใใผใฟใซ่ฟฝๅ ใใๅ ดๅใซใใฌใผใใณใฐใใผใฟใฎๅฐคๅบฆใๆๅคงๅใใใทใณใใซใใขใ้ธๆใใพใใ
+
+ใใใฏๅ
ทไฝ็ใซใฏใฉใใใๆๅณใงใใ๏ผๅใฎไพใๅ็
งใใใจใใใฌใผใใณใฐใใผใฟใฎๅฐคๅบฆใๆๅคงๅใใใใจใฏใใใฎใทใณใใซใใขใฎ็ขบ็ใใใฎๆๅใฎใทใณใใซใซ็ถใ2็ช็ฎใฎใทใณใใซใฎ็ขบ็ใงๅฒใฃใใใฎใใใในใฆใฎใทใณใใซใใขใฎไธญใงๆใๅคงใใๅ ดๅใซ่ฉฒๅฝใใใทใณใใซใใขใ่ฆใคใใใใจใซ็ญใใใงใใ ใใจใใฐใ"u" ใฎๅพใซ "g" ใ็ถใๅ ดๅใไปใฎใฉใฎใทใณใใซใใขใใใ "ug" ใฎ็ขบ็ใ "u"ใ"g" ใงๅฒใฃใ็ขบ็ใ้ซใใใฐใใใใใฎใทใณใใซใฏ็ตๅใใใพใใ็ดๆ็ใซ่จใใฐใWordPieceใฏ2ใคใฎใทใณใใซใ็ตๅใใใใจใซใใฃใฆๅคฑใใใใใฎใ่ฉไพกใใใใใใใใซๅคใใใใฉใใใ็ขบ่ชใใ็นใงBPEใจใฏใใใใซ็ฐใชใใพใใ
+
+### Unigram
+
+Unigramใฏใ[Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidates (Kudo, 2018)](https://arxiv.org/pdf/1804.10959.pdf) ใงๅฐๅ
ฅใใใใตใใฏใผใใใผใฏใใคใผใผใทใงใณใขใซใดใชใบใ ใงใใ BPEใWordPieceใจใฏ็ฐใชใใUnigramใฏใใผในใใญใฃใใฉใชใๅคๆฐใฎใทใณใใซใงๅๆๅใใๅใทใณใใซใๅๆธใใฆใใๅฐใใชใใญใฃใใฉใชใๅๅพใใพใใ ใใผในใใญใฃใใฉใชใฏใไบๅใซใใผใฏใณๅใใใใในใฆใฎๅ่ชใจๆใไธ่ฌ็ใช้จๅๆๅญๅใซๅฏพๅฟใใๅฏ่ฝๆงใใใใพใใ Unigramใฏtransformersใฎใขใใซใฎ็ดๆฅใฎไฝฟ็จใซใฏ้ฉใใฆใใพใใใใ[SentencePiece](#sentencepiece)ใจ็ตใฟๅใใใฆไฝฟ็จใใใพใใ
+
+ๅใใฌใผใใณใฐในใใใใงใUnigramใขใซใดใชใบใ ใฏ็พๅจใฎใใญใฃใใฉใชใจใฆใใฐใฉใ ่จ่ชใขใใซใไฝฟ็จใใฆใใฌใผใใณใฐใใผใฟไธใฎๆๅคฑ๏ผ้ๅธธใฏๅฏพๆฐๅฐคๅบฆใจใใฆๅฎ็พฉ๏ผใๅฎ็พฉใใพใใใใฎๅพใใใญใฃใใฉใชๅ
ใฎๅใทใณใใซใซใคใใฆใใใฎใทใณใใซใใใญใฃใใฉใชใใๅ้คใใใๅ ดๅใซๅ
จไฝใฎๆๅคฑใใฉใใ ใๅขๅ ใใใใ่จ็ฎใใพใใ Unigramใฏใๆๅคฑใฎๅขๅ ใๆใไฝใp๏ผ้ๅธธใฏ10๏ผ
ใพใใฏ20๏ผ
๏ผใใผใปใณใใฎใทใณใใซใๅ้คใใพใใใคใพใใใใฌใผใใณใฐใใผใฟๅ
จไฝใฎๆๅคฑใซๆใๅฝฑ้ฟใไธใใชใใๆใๆๅคฑใฎๅฐใชใใทใณใใซใๅ้คใใพใใ ใใฎใใญใปในใฏใใใญใฃใใฉใชใๆใพใใใตใคใบใซ้ใใใพใง็นฐใ่ฟใใใพใใ Unigramใขใซใดใชใบใ ใฏๅธธใซใใผในๆๅญใไฟๆใใใใใไปปๆใฎๅ่ชใใใผใฏใณๅใงใใพใใ
+
+Unigramใฏใใผใธใซใผใซใซๅบใฅใใฆใใชใใใ๏ผBPEใจWordPieceใจใฏๅฏพ็
ง็ใซ๏ผใใใฌใผใใณใฐๅพใฎๆฐใใใใญในใใฎใใผใฏใณๅใซใฏใใใคใใฎๆนๆณใใใใพใใไพใจใใฆใใใฌใผใใณใฐใใใUnigramใใผใฏใใคใถใๆใคใใญใฃใใฉใชใๆฌกใฎใใใชๅ ดๅ๏ผ
+
+
+```
+["b", "g", "h", "n", "p", "s", "u", "ug", "un", "hug"],
+```
+
+`"hugs"`ใฏใ`["hug", "s"]`ใ`["h", "ug", "s"]`ใใพใใฏ`["h", "u", "g", "s"]`ใฎใใใซใใผใฏใณๅใงใใพใใใงใฏใใฉใใ้ธๆใในใใงใใใใ๏ผ Unigramใฏใใใฌใผใใณใฐใณใผใในๅ
ใฎๅใใผใฏใณใฎ็ขบ็ใไฟๅญใใใใฌใผใใณใฐๅพใซๅๅฏ่ฝใชใใผใฏใณๅใฎ็ขบ็ใ่จ็ฎใงใใใใใซใใพใใใใฎใขใซใดใชใบใ ใฏๅฎ้ใซใฏๆใๅฏ่ฝๆงใฎ้ซใใใผใฏใณๅใ้ธๆใใพใใใ็ขบ็ใซๅพใฃใฆๅฏ่ฝใชใใผใฏใณๅใใตใณใใชใณใฐใใใชใใทใงใณใๆไพใใพใใ
+
+ใใใใฎ็ขบ็ใฏใใใผใฏใใคใถใผใใใฌใผใใณใฐใซไฝฟ็จใใๆๅคฑใซใใฃใฆๅฎ็พฉใใใพใใใใฌใผใใณใฐใใผใฟใๅ่ช \\(x_{1}, \dots, x_{N}\\) ใงๆงๆใใใๅ่ช \\(x_{i}\\) ใฎใในใฆใฎๅฏ่ฝใชใใผใฏใณๅใฎใปใใใ \\(S(x_{i})\\) ใจๅฎ็พฉใใใๅ ดๅใๅ
จไฝใฎๆๅคฑใฏๆฌกใฎใใใซๅฎ็พฉใใใพใใ
+
+$$\mathcal{L} = -\sum_{i=1}^{N} \log \left ( \sum_{x \in S(x_{i})} p(x) \right )$$
+
+
+
+### SentencePiece
+
+ใใใพใงใซ่ชฌๆใใใในใฆใฎใใผใฏใณๅใขใซใดใชใบใ ใซใฏๅใๅ้กใใใใพใใใใใฏใๅ
ฅๅใใญในใใๅ่ชใๅบๅใใใใซในใใผในใไฝฟ็จใใฆใใใจไปฎๅฎใใฆใใใจใใใใจใงใใใใใใใในใฆใฎ่จ่ชใๅ่ชใๅบๅใใใใซในใใผในใไฝฟ็จใใฆใใใใใงใฏใใใพใใใใใฎๅ้กใไธ่ฌ็ใซ่งฃๆฑบใใใใใฎ1ใคใฎๆนๆณใฏใ่จ่ชๅบๆใฎๅใใผใฏใใคใถใผใไฝฟ็จใใใใจใงใ๏ผไพ๏ผ[XLM](model_doc/xlm)ใฏ็นๅฎใฎไธญๅฝ่ชใๆฅๆฌ่ชใใใใณใฟใค่ชใฎๅใใผใฏใใคใถใผใไฝฟ็จใใฆใใพใ๏ผใใใไธ่ฌ็ใซใใฎๅ้กใ่งฃๆฑบใใใใใซใ[SentencePiece๏ผใใฅใผใฉใซใใญในใๅฆ็ใฎใใใฎใทใณใใซใง่จ่ช้ไพๅญใฎใตใใฏใผใใใผใฏใใคใถใผใใใณใใใผใฏใใคใถใผ๏ผKudo et al.ใ2018๏ผ](https://arxiv.org/pdf/1808.06226.pdf) ใฏใๅ
ฅๅใ็ใฎๅ
ฅๅในใใชใผใ ใจใใฆๆฑใใในใใผในใไฝฟ็จใใๆๅญใฎใปใใใซๅซใใพใใใใใใBPEใพใใฏunigramใขใซใดใชใบใ ใไฝฟ็จใใฆ้ฉๅใช่ชๅฝใๆง็ฏใใพใใ
+
+ใใจใใฐใ[`XLNetTokenizer`]ใฏSentencePieceใไฝฟ็จใใฆใใใใใฎใใใซๅ่ฟฐใฎไพใง`"โ"`ๆๅญใ่ชๅฝใซๅซใพใใฆใใพใใใSentencePieceใไฝฟ็จใใใใณใผใใฏ้ๅธธใซ็ฐกๅใงใใในใฆใฎใใผใฏใณใๅ็ดใซ้ฃ็ตใใ`"โ"`ใฏในใใผในใซ็ฝฎๆใใใพใใ
+
+ใฉใคใใฉใชๅ
ใฎใในใฆใฎtransformersใขใใซใฏใSentencePieceใunigramใจ็ตใฟๅใใใฆไฝฟ็จใใพใใSentencePieceใไฝฟ็จใใใขใใซใฎไพใซใฏใ[ALBERT](model_doc/albert)ใ[XLNet](model_doc/xlnet)ใ[Marian](model_doc/marian)ใใใใณ[T5](model_doc/t5)ใใใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/torchscript.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/torchscript.md
new file mode 100644
index 0000000000000000000000000000000000000000..27d64a625c8c4299e1be68f71541966604dc65c1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/torchscript.md
@@ -0,0 +1,177 @@
+
+
+# Export to TorchScript
+
+
+
+ใใใฏTorchScriptใไฝฟ็จใใๅฎ้จใฎๆๅใงใใใๅฏๅคๅ
ฅๅใตใคใบใฎใขใใซใซๅฏพใใใใฎ่ฝๅใใพใ ๆขๆฑไธญใงใใใใใฏ็งใใกใฎ้ขๅฟใฎ็ฆ็นใงใใใไปๅพใฎใชใชใผในใงใฏใใใๆ่ปใชๅฎ่ฃ
ใใPythonใใผในใฎใณใผใใจใณใณใใคใซใใใTorchScriptใๆฏ่ผใใใใณใใใผใฏใๅซใใใใๅคใใฎใณใผใไพใง่ฉณ็ดฐใชๅๆใ่กใใพใใ
+
+
+
+[TorchScriptใฎใใญใฅใกใณใ](https://pytorch.org/docs/stable/jit.html)ใซใใใฐ๏ผ
+
+> TorchScriptใฏใPyTorchใณใผใใใ็ดๅๅใใใณๆ้ฉๅๅฏ่ฝใชใขใใซใไฝๆใใๆนๆณใงใใ
+
+TorchScriptใไฝฟ็จใใใจใๅน็ๅฟๅใฎC++ใใญใฐใฉใ ใชใฉใไปใฎใใญใฐใฉใ ใงใขใใซใๅๅฉ็จใงใใใใใซใชใใพใใPyTorchใใผในใฎPythonใใญใฐใฉใ ไปฅๅคใฎ็ฐๅขใง๐ค Transformersใขใใซใใจใฏในใใผใใใฆไฝฟ็จใใใใใฎใคใณใฟใผใใงใผในใๆไพใใฆใใพใใใใใงใฏใTorchScriptใไฝฟ็จใใฆใขใใซใใจใฏในใใผใใใไฝฟ็จใใๆนๆณใ่ชฌๆใใพใใ
+
+ใขใใซใใจใฏในใใผใใใใซใฏใๆฌกใฎ2ใคใฎ่ฆไปถใใใใพใ๏ผ
+
+- `torchscript`ใใฉใฐใไฝฟ็จใใใขใใซใฎใคใณในใฟใณในๅ
+- ใใใผใฎๅ
ฅๅใไฝฟ็จใใใใฉใฏใผใใใน
+
+ใใใใฎๅฟ
่ฆๆกไปถใฏใไปฅไธใง่ฉณ็ดฐใซ่ชฌๆใใใฆใใใใใซใ้็บ่
ใๆณจๆใใๅฟ
่ฆใใใใใใคใใฎใใจใๆๅณใใพใใ
+
+## TorchScript flag and tied weights
+
+`torchscript`ใใฉใฐใฏใใปใจใใฉใฎ๐ค Transformers่จ่ชใขใใซใซใใใฆใ`Embedding`ใฌใคใคใผใจ`Decoding`ใฌใคใคใผ้ใง้ใฟใ้ฃ็ตใใใฆใใใใๅฟ
่ฆใงใใ
+TorchScriptใงใฏใ้ใฟใ้ฃ็ตใใใฆใใใขใใซใใจใฏในใใผใใใใใจใฏใงใใพใใใฎใงใไบๅใซ้ใฟใๅใ้ขใใฆ่ค่ฃฝใใๅฟ
่ฆใใใใพใใ
+
+`torchscript`ใใฉใฐใไฝฟ็จใใฆใคใณในใฟใณในๅใใใใขใใซใฏใ`Embedding`ใฌใคใคใผใจ`Decoding`ใฌใคใคใผใๅ้ขใใใฆใใใใใฎใใๅพใงใใฌใผใใณใฐใใฆใฏใใใพใใใ
+ใใฌใผใใณใฐใฏใใใใใฎ2ใคใฎใฌใคใคใผใ้ๅๆใซใใๅฏ่ฝๆงใใใใไบๆใใชใ็ตๆใใใใใๅฏ่ฝๆงใใใใพใใ
+
+่จ่ชใขใใซใใใใๆใใชใใขใใซใซใฏ่จๅใใพใใใใใใใใฎใขใใซใซใฏ้ฃ็ตใใใ้ใฟใๅญๅจใใชใใใใ`torchscript`ใใฉใฐใชใใงๅฎๅ
จใซใจใฏในใใผใใงใใพใใ
+
+## Dummy inputs and standard lengths
+
+ใใใผๅ
ฅๅใฏใขใใซใฎใใฉใฏใผใใในใซไฝฟ็จใใใพใใๅ
ฅๅใฎๅคใฏใฌใคใคใผใ้ใใฆไผๆญใใใ้ใPyTorchใฏๅใใณใฝใซใซๅฎ่กใใใ็ฐใชใๆไฝใ่ฟฝ่ทกใใพใใใใใใฎ่จ้ฒใใใๆไฝใฏใใขใใซใฎ*ใใฌใผใน*ใไฝๆใใใใใซไฝฟ็จใใใพใใ
+
+ใใฌใผในใฏๅ
ฅๅใฎๅฏธๆณใซๅฏพใใฆไฝๆใใใพใใใใฎใใใใใใผๅ
ฅๅใฎๅฏธๆณใซๅถ็ดใใใไปใฎใทใผใฑใณใน้ทใใใใใตใคใบใงใฏๅไฝใใพใใใ็ฐใชใใตใคใบใง่ฉฆใใจใไปฅไธใฎใจใฉใผใ็บ็ใใพใ๏ผ
+
+```
+`The expanded size of the tensor (3) must match the existing size (7) at non-singleton dimension 2`
+```
+
+ใๅงใใใพใใฎใฏใใขใใซใฎๆจ่ซไธญใซไพ็ตฆใใใๆๅคงใฎๅ
ฅๅใจๅใๅคงใใใฎใใใผๅ
ฅๅใตใคใบใงใขใใซใใใฌใผในใใใใจใงใใใใใฃใณใฐใไฝฟ็จใใฆไธ่ถณๅคใ่ฃๅฎใใใใจใใงใใพใใใใ ใใใขใใซใใใๅคงใใชๅ
ฅๅใตใคใบใงใใฌใผในใใใใใใ่กๅใฎๅฏธๆณใๅคงใใใชใใใใๅคใใฎ่จ็ฎใ็บ็ใใพใใ
+
+็ฐใชใใทใผใฑใณใน้ทใฎใขใใซใใจใฏในใใผใใใ้ใซใๅๅ
ฅๅใซๅฏพใใฆๅฎ่กใใใๆผ็ฎใฎ็ทๆฐใซๆณจๆใใฆใใใใฉใผใใณในใๅฏๆฅใซใใฉใญใผใใใใจใใๅงใใใพใใ
+
+## Using TorchScript in Python
+
+ใใฎใปใฏใทใงใณใงใฏใใขใใซใฎไฟๅญใจ่ชญใฟ่พผใฟใใใใณๆจ่ซใซใใฌใผในใไฝฟ็จใใๆนๆณใ็คบใใพใใ
+
+### Saving a model
+
+TorchScriptใง`BertModel`ใใจใฏในใใผใใใใซใฏใ`BertConfig`ใฏใฉในใใ`BertModel`ใใคใณในใฟใณในๅใใใใใใใกใคใซๅ`traced_bert.pt`ใงใใฃในใฏใซไฟๅญใใพใ๏ผ
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+
+enc = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+
+# Tokenizing input text
+text = "[CLS] Who was Jim Henson ? [SEP] Jim Henson was a puppeteer [SEP]"
+tokenized_text = enc.tokenize(text)
+
+# Masking one of the input tokens
+masked_index = 8
+tokenized_text[masked_index] = "[MASK]"
+indexed_tokens = enc.convert_tokens_to_ids(tokenized_text)
+segments_ids = [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1]
+
+# Creating a dummy input
+tokens_tensor = torch.tensor([indexed_tokens])
+segments_tensors = torch.tensor([segments_ids])
+dummy_input = [tokens_tensor, segments_tensors]
+
+# Initializing the model with the torchscript flag
+# Flag set to True even though it is not necessary as this model does not have an LM Head.
+config = BertConfig(
+ vocab_size_or_config_json_file=32000,
+ hidden_size=768,
+ num_hidden_layers=12,
+ num_attention_heads=12,
+ intermediate_size=3072,
+ torchscript=True,
+)
+
+# Instantiating the model
+model = BertModel(config)
+
+# The model needs to be in evaluation mode
+model.eval()
+
+# If you are instantiating the model with *from_pretrained* you can also easily set the TorchScript flag
+model = BertModel.from_pretrained("google-bert/bert-base-uncased", torchscript=True)
+
+# Creating the trace
+traced_model = torch.jit.trace(model, [tokens_tensor, segments_tensors])
+torch.jit.save(traced_model, "traced_bert.pt")
+```
+
+### Loading a model
+
+ไปฅๅใซไฟๅญใใ `BertModel`ใ`traced_bert.pt` ใใใฃในใฏใใ่ชญใฟ่พผใใงใไปฅๅใซๅๆๅใใ `dummy_input` ใงไฝฟ็จใงใใพใใ
+
+```python
+loaded_model = torch.jit.load("traced_bert.pt")
+loaded_model.eval()
+
+all_encoder_layers, pooled_output = loaded_model(*dummy_input)
+```
+
+
+### Using a traced model for inference
+
+ใใฌใผในใขใใซใไฝฟ็จใใฆๆจ่ซใ่กใใซใฏใใใฎ `__call__` ใใณใใผใกใฝใใใไฝฟ็จใใพใใ
+
+```python
+traced_model(tokens_tensor, segments_tensors)
+```
+
+
+## Deploy Hugging Face TorchScript models to AWS with the Neuron SDK
+
+AWSใฏใฏใฉใฆใใงใฎไฝใณในใใง้ซๆง่ฝใชๆฉๆขฐๅญฆ็ฟๆจ่ซๅใใซ [Amazon EC2 Inf1](https://aws.amazon.com/ec2/instance-types/inf1/) ใคใณในใฟใณในใใกใใชใผใๅฐๅ
ฅใใพใใใInf1ใคใณในใฟใณในใฏAWS Inferentiaใใใใซใใฃใฆ้งๅใใใใใฃใผใใฉใผใใณใฐๆจ่ซใฏใผใฏใญใผใใซ็นๅใใใซในใฟใ ใใซใใฎใใผใใฆใงใขใขใฏใปใฉใฌใผใฟใงใใ[AWS Neuron](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/#) ใฏInferentia็จใฎSDKใงใใใฉใณในใใฉใผใใผใขใใซใใใฌใผในใใฆๆ้ฉๅใใInf1ใซๅฑ้ใใใใใฎใตใใผใใๆไพใใพใใ
+
+Neuron SDK ใๆไพใใใใฎ:
+
+1. ใฏใฉใฆใใงใฎๆจ่ซใฎใใใซTorchScriptใขใใซใใใฌใผในใใฆๆ้ฉๅใใใใใฎใ1่กใฎใณใผใๅคๆดใงไฝฟ็จใงใใ็ฐกๅใชAPIใ
+2. [ๆนๅใใใใณในใใใใฉใผใใณใน](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/benchmark/) ใฎใใใฎใใใฏในๅคใฎใใใฉใผใใณในๆ้ฉๅใ
+3. [PyTorch](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/bert_tutorial/tutorial_pretrained_bert.html) ใพใใฏ [TensorFlow](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/tensorflow/huggingface_bert/huggingface_bert.html) ใงๆง็ฏใใใHugging Faceใใฉใณในใใฉใผใใผใขใใซใธใฎใตใใผใใ
+
+### Implications
+
+BERT๏ผBidirectional Encoder Representations from Transformers๏ผใขใผใญใใฏใใฃใใใฎๅค็จฎ๏ผ[distilBERT](https://huggingface.co/docs/transformers/main/model_doc/distilbert) ใ [roBERTa](https://huggingface.co/docs/transformers/main/model_doc/roberta) ใชใฉ๏ผใซๅบใฅใใใฉใณในใใฉใผใใผใขใใซใฏใ้็ๆใฟในใฏ๏ผๆฝๅบๅ่ณชๅๅฟ็ญใใทใผใฑใณในๅ้กใใใผใฏใณๅ้กใชใฉ๏ผใซใใใฆใInf1ไธใงๆ้ฉใซๅไฝใใพใใใใ ใใใใญในใ็ๆใฟในใฏใ [AWS Neuron MarianMT ใใฅใผใใชใขใซ](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/src/examples/pytorch/transformers-marianmt.html) ใซๅพใฃใฆInf1ไธใงๅฎ่กใงใใพใใInferentiaใงใใใฏในๅคใงๅคๆใงใใใขใใซใซ้ขใใ่ฉณ็ดฐๆ
ๅ ฑใฏใNeuronใใญใฅใกใณใใผใทใงใณใฎ [Model Architecture Fit](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/models/models-inferentia.html#models-inferentia) ใปใฏใทใงใณใซใใใพใใ
+
+### Dependencies
+
+ใขใใซใAWS Neuronใซๅคๆใใใซใฏใ[Neuron SDK ็ฐๅข](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/neuron-guide/neuron-frameworks/pytorch-neuron/index.html#installation-guide) ใๅฟ
่ฆใงใ[AWS Deep Learning AMI](https://docs.aws.amazon.com/dlami/latest/devguide/tutorial-inferentia-launching.html) ใซไบๅใซๆงๆใใใฆใใพใใ
+
+### Converting a model for AWS Neuron
+
+ใขใใซใAWS NEURON็จใซๅคๆใใใซใฏใ[PythonใงTorchScriptใไฝฟ็จใใ](torchscript#using-torchscript-in-python) ใจๅใใณใผใใไฝฟ็จใใฆ `BertModel` ใใใฌใผในใใพใใPython APIใไปใใฆNeuron SDKใฎใณใณใใผใใณใใซใขใฏใปในใใใใใซใ`torch.neuron` ใใฌใผใ ใฏใผใฏๆกๅผตใใคใณใใผใใใพใใ
+
+```python
+from transformers import BertModel, BertTokenizer, BertConfig
+import torch
+import torch.neuron
+```
+
+ๆฌกใฎ่กใๅคๆดใใใ ใใงๆธใฟใพใใ
+
+```diff
+- torch.jit.trace(model, [tokens_tensor, segments_tensors])
++ torch.neuron.trace(model, [token_tensor, segments_tensors])
+```
+
+ใใใซใใใNeuron SDKใฏใขใใซใใใฌใผในใใInf1ใคใณในใฟใณในๅใใซๆ้ฉๅใใพใใ
+
+AWS Neuron SDKใฎๆฉ่ฝใใใผใซใใตใณใใซใใฅใผใใชใขใซใๆๆฐใฎใขใใใใผใใซใคใใฆ่ฉณใใ็ฅใใใๅ ดๅใฏใ[AWS NeuronSDK ใใญใฅใกใณใใผใทใงใณ](https://awsdocs-neuron.readthedocs-hosted.com/en/latest/index.html) ใใ่ฆงใใ ใใใ
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/training.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/training.md
new file mode 100644
index 0000000000000000000000000000000000000000..9dd2369601c10a52f009dc4a790e63d14370b8d0
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/training.md
@@ -0,0 +1,434 @@
+
+
+# Fine-tune a pretrained model
+
+[[open-in-colab]]
+
+ไบๅๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใใจใ่จ็ฎใณในใใๅๆธใใ็ญ็ด ๆๅบ้ใๆธๅฐใใใใผใญใใใขใใซใใใฌใผใใณใฐใใๅฟ
่ฆใชใใซๆๆฐใฎใขใใซใไฝฟ็จใงใใๅฉ็นใใใใพใใ
+๐ค Transformersใฏใใใพใใพใชใฟในใฏใซๅฏพๅฟใใๆฐๅใใฎไบๅๅญฆ็ฟๆธใฟใขใใซใธใฎใขใฏใปในใๆไพใใพใใ
+ไบๅๅญฆ็ฟๆธใฟใขใใซใไฝฟ็จใใๅ ดๅใใใใ็นๅฎใฎใฟในใฏใซๅใใใใใผใฟใปใใใงใใฌใผใใณใฐใใพใใใใใฏใใกใคใณใใฅใผใใณใฐใจใใฆ็ฅใใใ้ๅธธใซๅผทๅใชใใฌใผใใณใฐๆ่กใงใใ
+ใใฎใใฅใผใใชใขใซใงใฏใไบๅๅญฆ็ฟๆธใฟใขใใซใ้ธๆใใใใฃใผใใฉใผใใณใฐใใฌใผใ ใฏใผใฏใงใใกใคใณใใฅใผใใณใฐใใๆนๆณใซใคใใฆ่ชฌๆใใพใ๏ผ
+
+* ๐ค Transformersใฎ[`Trainer`]ใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใใใกใคใณใใฅใผใใณใฐใใใ
+* TensorFlowใจKerasใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใใใกใคใณใใฅใผใใณใฐใใใ
+* ใใคใใฃใใฎPyTorchใไฝฟ็จใใฆไบๅๅญฆ็ฟๆธใฟใขใใซใใใกใคใณใใฅใผใใณใฐใใใ
+
+
+
+## Prepare a dataset
+
+
+
+ไบๅๅญฆ็ฟๆธใฟใขใใซใใใกใคใณใใฅใผใใณใฐใใๅใซใใใผใฟใปใใใใใฆใณใญใผใใใฆใใฌใผใใณใฐ็จใซๆบๅใใๅฟ
่ฆใใใใพใใ
+ๅใฎใใฅใผใใชใขใซใงใฏใใใฌใผใใณใฐใใผใฟใฎๅฆ็ๆนๆณใ่ชฌๆใใพใใใใใใใใใฏใใใใฎในใญใซใๆดปใใๆฉไผใใใใพใ๏ผ
+
+ใพใใ[Yelp Reviews](https://huggingface.co/datasets/yelp_review_full)ใใผใฟใปใใใ่ชญใฟ่พผใใงใฟใพใใใ๏ผ
+
+```python
+>>> from datasets import load_dataset
+
+>>> dataset = load_dataset("yelp_review_full")
+>>> dataset["train"][100]
+{'label': 0,
+ 'text': 'My expectations for McDonalds are t rarely high. But for one to still fail so spectacularly...that takes something special!\\nThe cashier took my friends\'s order, then promptly ignored me. I had to force myself in front of a cashier who opened his register to wait on the person BEHIND me. I waited over five minutes for a gigantic order that included precisely one kid\'s meal. After watching two people who ordered after me be handed their food, I asked where mine was. The manager started yelling at the cashiers for \\"serving off their orders\\" when they didn\'t have their food. But neither cashier was anywhere near those controls, and the manager was the one serving food to customers and clearing the boards.\\nThe manager was rude when giving me my order. She didn\'t make sure that I had everything ON MY RECEIPT, and never even had the decency to apologize that I felt I was getting poor service.\\nI\'ve eaten at various McDonalds restaurants for over 30 years. I\'ve worked at more than one location. I expect bad days, bad moods, and the occasional mistake. But I have yet to have a decent experience at this store. It will remain a place I avoid unless someone in my party needs to avoid illness from low blood sugar. Perhaps I should go back to the racially biased service of Steak n Shake instead!'}
+```
+
+ใใผใฏใใคใถใใใญในใใๅฆ็ใใๅฏๅคใฎใทใผใฑใณใน้ทใๅฆ็ใใใใใฎใใใฃใณใฐใจๅใๆจใฆๆฆ็ฅใๅซใใๅฟ
่ฆใใใใใจใใๅญ็ฅใฎ้ใใ
+ใใผใฟใปใใใ1ใคใฎในใใใใงๅฆ็ใใใซใฏใ๐ค Datasets ใฎ [`map`](https://huggingface.co/docs/datasets/process#map) ใกใฝใใใไฝฟ็จใใฆใ
+ใใผใฟใปใใๅ
จไฝใซๅๅฆ็้ขๆฐใ้ฉ็จใใพใ๏ผ
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+
+>>> def tokenize_function(examples):
+... return tokenizer(examples["text"], padding="max_length", truncation=True)
+
+>>> tokenized_datasets = dataset.map(tokenize_function, batched=True)
+```
+
+ใๅฅฝใฟใงใๅฎ่กๆ้ใ็ญ็ธฎใใใใใซใใซใใผใฟใปใใใฎๅฐใใชใตใใปใใใไฝๆใใใใจใใงใใพใ๏ผ
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+
+
+## Train
+
+ใใฎๆ็นใงใไฝฟ็จใใใใใฌใผใ ใฏใผใฏใซๅฏพๅฟใใใปใฏใทใงใณใซๅพใๅฟ
่ฆใใใใพใใๅณๅดใฎใตใคใใใผใฎใชใณใฏใไฝฟ็จใใฆใใธใฃใณใใใใใใฌใผใ ใฏใผใฏใซ็งปๅใงใใพใใ
+ใใใฆใ็นๅฎใฎใใฌใผใ ใฏใผใฏใฎใในใฆใฎใณใณใใณใใ้่กจ็คบใซใใใๅ ดๅใฏใใใฎใใฌใผใ ใฏใผใฏใฎใใญใใฏๅณไธใซใใใใฟใณใไฝฟ็จใใฆใใ ใใ๏ผ
+
+
+
+
+
+## Train with Pytorch Trainer
+
+๐ค Transformersใฏใ๐ค Transformersใขใใซใฎใใฌใผใใณใฐใๆ้ฉๅใใ[`Trainer`]ใฏใฉในใๆไพใใ็ฌ่ชใฎใใฌใผใใณใฐใซใผใใๆๅใง่จ่ฟฐใใใซใใฌใผใใณใฐใ้ๅงใใใใใใฆใใพใใ
+[`Trainer`] APIใฏใใญใฐ่จ้ฒใๅพ้
็ดฏ็ฉใๆททๅ็ฒพๅบฆใชใฉใใใพใใพใชใใฌใผใใณใฐใชใใทใงใณใจๆฉ่ฝใใตใใผใใใฆใใพใใ
+
+ใพใใใขใใซใใญใผใใใไบๆณใใใใฉใใซใฎๆฐใๆๅฎใใพใใYelp Review [dataset card](https://huggingface.co/datasets/yelp_review_full#data-fields)ใใใ5ใคใฎใฉใใซใใใใใจใใใใใพใ๏ผ
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+
+
+ไธ้จใฎไบๅๅญฆ็ฟๆธใฟใฎ้ใฟใไฝฟ็จใใใใไธ้จใฎ้ใฟใใฉใณใใ ใซๅๆๅใใใ่ญฆๅใ่กจ็คบใใใใใจใใใใพใใๅฟ้
ใใชใใงใใ ใใใใใใฏๅฎๅ
จใซๆญฃๅธธใงใ๏ผ
+BERTใขใใซใฎไบๅๅญฆ็ฟๆธใฟใฎใใใใฏ็ ดๆฃใใใใฉใณใใ ใซๅๆๅใใใๅ้กใใใใง็ฝฎใๆใใใใพใใใใฎๆฐใใใขใใซใใใใใทใผใฑใณในๅ้กใฟในใฏใงใใกใคใณใใฅใผใใณใฐใใไบๅๅญฆ็ฟใขใใซใฎ็ฅ่ญใใใใซ่ปข้ใใพใใ
+
+
+
+### Training Hyperparameters
+
+ๆฌกใซใใใฌใผใใณใฐใชใใทใงใณใใขใฏใใฃใใผใใใใใใฎใในใฆใฎใใคใใผใใฉใกใผใฟใจใ่ชฟๆดใงใใใใคใใผใใฉใกใผใฟใๅซใ[`TrainingArguments`]ใฏใฉในใไฝๆใใพใใ
+ใใฎใใฅใผใใชใขใซใงใฏใใใใฉใซใใฎใใฌใผใใณใฐ[ใใคใใผใใฉใกใผใฟ](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments)ใไฝฟ็จใใฆ้ๅงใงใใพใใใๆ้ฉใช่จญๅฎใ่ฆใคใใใใใซใใใใๅฎ้จใใฆใๆงใใพใใใ
+
+ใใฌใผใใณใฐใฎใใงใใฏใใคใณใใไฟๅญใใๅ ดๆใๆๅฎใใพใ๏ผ
+
+```python
+>>> from transformers import TrainingArguments
+
+>>> training_args = TrainingArguments(output_dir="test_trainer")
+```
+
+### Evaluate
+
+[`Trainer`]ใฏใใฌใผใใณใฐไธญใซ่ชๅ็ใซใขใใซใฎใใใฉใผใใณในใ่ฉไพกใใพใใใใกใใชใฏในใ่จ็ฎใใฆๅ ฑๅใใ้ขๆฐใ[`Trainer`]ใซๆธกใๅฟ
่ฆใใใใพใใ
+[๐ค Evaluate](https://huggingface.co/docs/evaluate/index)ใฉใคใใฉใชใงใฏใ[`evaluate.load`]้ขๆฐใไฝฟ็จใใฆ่ชญใฟ่พผใใใจใใงใใใทใณใใซใช[`accuracy`](https://huggingface.co/spaces/evaluate-metric/accuracy)้ขๆฐใๆไพใใใฆใใพใ๏ผ่ฉณ็ดฐใซใคใใฆใฏ[ใใกใใฎใฏใคใใฏใใขใผ](https://huggingface.co/docs/evaluate/a_quick_tour)ใๅ็
งใใฆใใ ใใ๏ผ๏ผ
+
+```python
+>>> import numpy as np
+>>> import evaluate
+
+>>> metric = evaluate.load("accuracy")
+```
+
+`metric`ใฎ`~evaluate.compute`ใๅผใณๅบใใฆใไบๆธฌใฎๆญฃ็ขบๅบฆใ่จ็ฎใใพใใ `compute`ใซไบๆธฌใๆธกใๅใซใไบๆธฌใใญใธใใใซๅคๆใใๅฟ
่ฆใใใใพใ๏ผใในใฆใฎ๐ค Transformersใขใใซใฏใญใธใใใ่ฟใใใจใ่ฆใใฆใใใฆใใ ใใ๏ผ๏ผ
+
+```py
+>>> def compute_metrics(eval_pred):
+... logits, labels = eval_pred
+... predictions = np.argmax(logits, axis=-1)
+... return metric.compute(predictions=predictions, references=labels)
+```
+
+่ฉไพกใกใใชใฏในใใใกใคใณใใฅใผใใณใฐไธญใซ็ฃ่ฆใใใๅ ดๅใใใฌใผใใณใฐๅผๆฐใง `eval_strategy` ใใฉใกใผใฟใๆๅฎใใฆใๅใจใใใฏใฎ็ตไบๆใซ่ฉไพกใกใใชใฏในใๅ ฑๅใใพใ๏ผ
+
+```python
+>>> from transformers import TrainingArguments, Trainer
+
+>>> training_args = TrainingArguments(output_dir="test_trainer", eval_strategy="epoch")
+```
+
+### Trainer
+
+ใขใใซใใใฌใผใใณใฐๅผๆฐใใใฌใผใใณใฐใใใณใในใใใผใฟใปใใใ่ฉไพก้ขๆฐใไฝฟ็จใใฆ[`Trainer`]ใชใใธใงใฏใใไฝๆใใพใ๏ผ
+
+```py
+>>> trainer = Trainer(
+... model=model,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... )
+```
+
+ใใฎๅพใ[`~transformers.Trainer.train`]ใๅผใณๅบใใฆใขใใซใๅพฎ่ชฟๆดใใพใ๏ผ
+
+```python
+>>> trainer.train()
+```
+
+
+
+
+
+
+
+## Kerasใไฝฟ็จใใฆTensorFlowใขใใซใใใฌใผใใณใฐใใ
+
+Keras APIใไฝฟ็จใใฆ๐ค TransformersใขใใซใTensorFlowใงใใฌใผใใณใฐใใใใจใใงใใพใ๏ผ
+
+### Loading Data from Keras
+
+๐ค TransformersใขใใซใKeras APIใงใใฌใผใใณใฐใใๅ ดๅใใใผใฟใปใใใKerasใ็่งฃใงใใๅฝขๅผใซๅคๆใใๅฟ
่ฆใใใใพใใ
+ใใผใฟใปใใใๅฐใใๅ ดๅใใใผใฟใปใใๅ
จไฝใNumPy้
ๅใซๅคๆใใฆKerasใซๆธกใใใจใใงใใพใใ
+่ค้ใชใใจใใใๅใซใใพใใใใ่ฉฆใใฆใฟใพใใใใ
+
+ใพใใใใผใฟใปใใใ่ชญใฟ่พผใฟใพใใGLUEใใณใใใผใฏใใCoLAใใผใฟใปใใใไฝฟ็จใใพใ
+([GLUE Banchmark](https://huggingface.co/datasets/glue))ใใใใฏๅ็ดใชใใคใใชใใญในใๅ้กใฟในใฏใงใใไปใฎใจใใใใฌใผใใณใฐๅๅฒใฎใฟใไฝฟ็จใใพใใ
+
+```py
+from datasets import load_dataset
+
+dataset = load_dataset("glue", "cola")
+dataset = dataset["train"] # ไปใฎใจใใใใฌใผใใณใฐๅๅฒใฎใฟใไฝฟ็จใใพใ
+```
+
+ๆฌกใซใใใผใฏใใคใถใใญใผใใใใใผใฟใNumPy้
ๅใจใใฆใใผใฏใณๅใใพใใใฉใใซใฏๆขใซ`0`ใจ`1`ใฎใชในใใงใใใใใใใผใฏใณๅใใใซ็ดๆฅNumPy้
ๅใซๅคๆใงใใพใ๏ผ
+
+```python
+from transformers import AutoTokenizer
+
+tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-cased")
+tokenized_data = tokenizer(dataset["sentence"], return_tensors="np", padding=True)
+# ใใผใฏใใคใถใฏBatchEncodingใ่ฟใใพใใใใใใKeras็จใซ่พๆธใซๅคๆใใพใ
+tokenized_data = dict(tokenized_data)
+
+labels = np.array(dataset["label"]) # ใฉใใซใฏใใงใซ0ใจ1ใฎ้
ๅใงใ
+```
+
+ๆๅพใซใใขใใซใใญใผใใใ[`compile`](https://keras.io/api/models/model_training_apis/#compile-method) ใจ [`fit`](https://keras.io/api/models/model_training_apis/#fit-method) ใกใฝใใใๅฎ่กใใพใใ
+ๆณจๆ็นใจใใฆใTransformersใขใใซใฏใในใฆใใใฉใซใใงใฟในใฏใซ้ข้ฃใใๆๅคฑ้ขๆฐใๆใฃใฆใใใใใๆๅฎใใชใใฆใๆงใใพใใ๏ผๆๅฎใใๅ ดๅใ้คใ๏ผ๏ผ
+
+```python
+from transformers import TFAutoModelForSequenceClassification
+from tensorflow.keras.optimizers import Adam
+
+# ใขใใซใใญใผใใใฆใณใณใใคใซใใ
+model = TFAutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased")
+# ใใกใคใณใใฅใผใใณใฐใซใฏ้ๅธธใๅญฆ็ฟ็ใไธใใใจ่ฏใใงใ
+model.compile(optimizer=Adam(3e-5)) # ๆๅคฑ้ขๆฐใฎๆๅฎใฏไธ่ฆใงใ๏ผ
+
+model.fit(tokenized_data, labels)
+```
+
+
+
+ใขใใซใ`compile()`ใใ้ใซ`loss`ๅผๆฐใๆธกใๅฟ
่ฆใฏใใใพใใ๏ผHugging Faceใขใใซใฏใใใฎๅผๆฐใ็ฉบ็ฝใฎใพใพใซใใฆใใใจใใฟในใฏใจใขใใซใขใผใญใใฏใใฃใซ้ฉใใๆๅคฑใ่ชๅ็ใซ้ธๆใใพใใ
+ๅฟ
่ฆใซๅฟใใฆ่ชๅใงๆๅคฑใๆๅฎใใฆใชใผใใผใฉใคใใใใใจใใงใใพใ๏ผ
+
+
+
+ใใฎใขใใญใผใใฏใๅฐ่ฆๆจกใชใใผใฟใปใใใซใฏ้ฉใใฆใใพใใใๅคง่ฆๆจกใชใใผใฟใปใใใซๅฏพใใฆใฏๅ้กใซใชใใใจใใใใพใใใชใใชใใใใผใฏใใคใบใใใ้
ๅใจใฉใใซใฏใกใขใชใซๅฎๅ
จใซ่ชญใฟ่พผใพใใๅฟ
่ฆใใใใใพใNumPyใฏใใธใฃใฎใผใใช้
ๅใๅฆ็ใใชใใใใใใผใฏใใคใบใใใๅใตใณใใซใๅ
จไฝใฎใใผใฟใปใใๅ
ใงๆใ้ทใใตใณใใซใฎ้ทใใซใใใฃใณใฐใใๅฟ
่ฆใใใใพใใ
+ใใใซใใใ้
ๅใใใใซๅคงใใใชใใใในใฆใฎใใใฃใณใฐใใผใฏใณใใใฌใผใใณใฐใ้
ใใใๅๅ ใซใชใใพใ๏ผ
+
+### Loading data as a tf.data.Dataset
+
+ใใฌใผใใณใฐใ้
ใใใใซใใผใฟใ่ชญใฟ่พผใใซใฏใใใผใฟใ`tf.data.Dataset`ใจใใฆ่ชญใฟ่พผใใใจใใงใใพใใ็ฌ่ชใฎ`tf.data`ใใคใใฉใคใณใไฝๆใใใใจใใงใใพใใใใใใ่กใใใใฎไพฟๅฉใชๆนๆณใ2ใคใใใพใ๏ผ
+
+- [`~TFPreTrainedModel.prepare_tf_dataset`]: ใใใฏใปใจใใฉใฎๅ ดๅใงๆจๅฅจใใๆนๆณใงใใใขใใซไธใฎใกใฝใใใชใฎใงใใขใใซใๆคๆปใใฆใขใใซๅ
ฅๅใจใใฆไฝฟ็จๅฏ่ฝใชๅใ่ชๅ็ใซๆๆกใใไปใฎๅใ็ ดๆฃใใฆใใๅ็ดใง้ซๆง่ฝใชใใผใฟใปใใใไฝๆใงใใพใใ
+- [`~datasets.Dataset.to_tf_dataset`]: ใใฎใกใฝใใใฏใใไฝใฌใใซใงใใใผใฟใปใใใใฉใฎใใใซไฝๆใใใใใๆญฃ็ขบใซๅถๅพกใใๅ ดๅใซไพฟๅฉใงใใ`columns`ใจ`label_cols`ใๆๅฎใใฆใใใผใฟใปใใใซๅซใใๅใๆญฃ็ขบใซๆๅฎใงใใพใใ
+
+[`~TFPreTrainedModel.prepare_tf_dataset`]ใไฝฟ็จใใๅใซใๆฌกใฎใณใผใใตใณใใซใซ็คบใใใใซใใใผใฏใใคใถใฎๅบๅใใใผใฟใปใใใซๅใจใใฆ่ฟฝๅ ใใๅฟ
่ฆใใใใพใ๏ผ
+
+```py
+def tokenize_dataset(data):
+ # ่ฟใใใ่พๆธใฎใญใผใฏใใผใฟใปใใใซๅใจใใฆ่ฟฝๅ ใใใพใ
+ return tokenizer(data["text"])
+
+
+dataset = dataset.map(tokenize_dataset)
+```
+
+Hugging Faceใฎใใผใฟใปใใใฏใใใฉใซใใงใใฃในใฏใซไฟๅญใใใใใใใใใซใใใกใขใชใฎไฝฟ็จ้ใๅขใใใใจใฏใใใพใใ๏ผ
+ๅใ่ฟฝๅ ใใใใใใใผใฟใปใใใใใใใใในใใชใผใ ใใๅใใใใซใใใฃใณใฐใ่ฟฝๅ ใงใใพใใใใใซใใใ
+ใใผใฟใปใใๅ
จไฝใซใใใฃใณใฐใ่ฟฝๅ ใใๅ ดๅใจๆฏในใฆใใใใฃใณใฐใใผใฏใณใฎๆฐใๅคงๅน
ใซๅๆธใใใพใใ
+
+```python
+>>> tf_dataset = model.prepare_tf_dataset(dataset["train"], batch_size=16, shuffle=True, tokenizer=tokenizer)
+```
+
+ไธ่จใฎใณใผใใตใณใใซใงใฏใใใผใฏใใคใถใ`prepare_tf_dataset`ใซๆธกใใฆใใใใใๆญฃใใ่ชญใฟ่พผใ้ใซๆญฃใใใใใฃใณใฐใงใใใใใซใใๅฟ
่ฆใใใใพใใ
+ใใผใฟใปใใใฎใในใฆใฎใตใณใใซใๅใ้ทใใงใใใใใใฃใณใฐใไธ่ฆใชๅ ดๅใฏใใใฎๅผๆฐใในใญใใใงใใพใใ
+ใใใฃใณใฐไปฅๅคใฎ่ค้ใชๅฆ็ใ่กใๅฟ
่ฆใใใๅ ดๅ๏ผไพ๏ผใในใฏ่จ่ชใขใใชใณใฐใฎใใใฎใใผใฏใณใฎ็ ดๆใชใฉ๏ผใ
+ไปฃใใใซ`collate_fn`ๅผๆฐใไฝฟ็จใใฆใใตใณใใซใฎใชในใใใใใใซๅคๆใใๅฟ
่ฆใชๅๅฆ็ใ้ฉ็จใใ้ขๆฐใๆธกใใใจใใงใใพใใ
+ใใฎใขใใญใผใใๅฎ้ใซไฝฟ็จใใไพใซใคใใฆใฏใ
+[examples](https://github.com/huggingface/transformers/tree/main/examples)ใ
+[notebooks](https://huggingface.co/docs/transformers/notebooks)ใใ่ฆงใใ ใใใ
+
+`tf.data.Dataset`ใไฝๆใใใใไปฅๅใจๅๆงใซใขใใซใใณใณใใคใซใใ้ฉๅใใใใใจใใงใใพใ๏ผ
+
+```python
+model.compile(optimizer=Adam(3e-5)) # ๆๅคฑๅผๆฐใฏไธ่ฆใงใ๏ผ
+
+model.fit(tf_dataset)
+```
+
+
+
+
+
+
+## Train in native Pytorch
+
+
+
+
+
+[`Trainer`]ใฏใใฌใผใใณใฐใซใผใใๅฆ็ใใ1่กใฎใณใผใใงใขใใซใใใกใคใณใใฅใผใใณใฐใงใใใใใซใใพใใ
+ใใฌใผใใณใฐใซใผใใ็ฌ่ชใซ่จ่ฟฐใใใใฆใผใถใผใฎใใใซใ๐ค TransformersใขใใซใใใคใใฃใใฎPyTorchใงใใกใคใณใใฅใผใใณใฐใใใใจใใงใใพใใ
+
+ใใฎๆ็นใงใใใผใใใใฏใๅ่ตทๅใใใใไปฅไธใฎใณใผใใๅฎ่กใใฆใกใขใชใ่งฃๆพใใๅฟ
่ฆใใใใใใใใพใใ๏ผ
+
+```py
+del model
+del trainer
+torch.cuda.empty_cache()
+```
+
+1. ใขใใซใฏ็ใฎใใญในใใๅ
ฅๅใจใใฆๅใๅใใชใใใใ`text` ๅใๅ้คใใพใ๏ผ
+
+```py
+>>> tokenized_datasets = tokenized_datasets.remove_columns(["text"])
+```
+
+2. `label`ๅใ`labels`ใซๅๅใๅคๆดใใพใใใขใใซใฏๅผๆฐใฎๅๅใ`labels`ใจๆๅพ
ใใฆใใพใ๏ผ
+
+```py
+>>> tokenized_datasets = tokenized_datasets.rename_column("label", "labels")
+```
+
+3. ใใผใฟใปใใใฎๅฝขๅผใใชในใใงใฏใชใPyTorchใใณใฝใซใ่ฟใใใใซ่จญๅฎใใพใ๏ผ
+
+```py
+>>> tokenized_datasets.set_format("torch")
+```
+
+ไปฅๅใซ็คบใใใใใซใใใกใคใณใใฅใผใใณใฐใ้ซ้ๅใใใใใซใใผใฟใปใใใฎๅฐใใชใตใใปใใใไฝๆใใพใ๏ผ
+
+```py
+>>> small_train_dataset = tokenized_datasets["train"].shuffle(seed=42).select(range(1000))
+>>> small_eval_dataset = tokenized_datasets["test"].shuffle(seed=42).select(range(1000))
+```
+
+### DataLoader
+
+ใใฌใผใใณใฐใใผใฟใปใใใจใในใใใผใฟใปใใ็จใฎ`DataLoader`ใไฝๆใใฆใใใผใฟใฎใใใใใคใใฌใผใใงใใใใใซใใพใ๏ผ
+
+```py
+>>> from torch.utils.data import DataLoader
+
+>>> train_dataloader = DataLoader(small_train_dataset, shuffle=True, batch_size=8)
+>>> eval_dataloader = DataLoader(small_eval_dataset, batch_size=8)
+```
+
+ใญใผใใใใขใใซใจๆๅพ
ใใใใฉใใซใฎๆฐใๆๅฎใใฆใใ ใใ๏ผ
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-cased", num_labels=5)
+```
+
+### Optimizer and learning rate scheduler
+
+ใขใใซใใใกใคใณใใฅใผใใณใฐใใใใใฎใชใใใฃใใคใถใจๅญฆ็ฟ็ในใฑใธใฅใผใฉใผใไฝๆใใพใใใใ
+PyTorchใใ[`AdamW`](https://pytorch.org/docs/stable/generated/torch.optim.AdamW.html)ใชใใใฃใใคใถใไฝฟ็จใใพใ๏ผ
+
+```python
+>>> from torch.optim import AdamW
+
+>>> optimizer = AdamW(model.parameters(), lr=5e-5)
+```
+
+ใใใฉใซใใฎๅญฆ็ฟ็ในใฑใธใฅใผใฉใ[`Trainer`]ใใไฝๆใใ๏ผ
+
+```py
+>>> from transformers import get_scheduler
+
+>>> num_epochs = 3
+>>> num_training_steps = num_epochs * len(train_dataloader)
+>>> lr_scheduler = get_scheduler(
+... name="linear", optimizer=optimizer, num_warmup_steps=0, num_training_steps=num_training_steps
+... )
+```
+
+ๆๅพใซใGPUใๅฉ็จใงใใๅ ดๅใฏ `device` ใๆๅฎใใฆใใ ใใใใใไปฅๅคใฎๅ ดๅใCPUใงใฎใใฌใผใใณใฐใฏๆฐๆ้ใใใๅฏ่ฝๆงใใใใๆฐๅใงๅฎไบใใใใจใใงใใพใใ
+
+```py
+>>> import torch
+
+>>> device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+>>> model.to(device)
+```
+
+
+
+ใฏใฉใฆใGPUใๅฉ็จใงใใชใๅ ดๅใ[Colaboratory](https://colab.research.google.com/)ใ[SageMaker StudioLab](https://studiolab.sagemaker.aws/)ใชใฉใฎใในใใใใใใผใใใใฏใไฝฟ็จใใฆ็กๆใงGPUใซใขใฏใปในใงใใพใใ
+
+
+
+ใใฆใใใฌใผใใณใฐใฎๆบๅใๆดใใพใใ๏ผ ๐ฅณ
+
+### ใใฌใผใใณใฐใซใผใ
+
+ใใฌใผใใณใฐใฎ้ฒๆใ่ฟฝ่ทกใใใใใซใ[tqdm](https://tqdm.github.io/)ใฉใคใใฉใชใไฝฟ็จใใฆใใฌใผใใณใฐในใใใใฎๆฐใซๅฏพใใฆ้ฒ่ก็ถๆณใใผใ่ฟฝๅ ใใพใ๏ผ
+
+```py
+>>> from tqdm.auto import tqdm
+
+>>> progress_bar = tqdm(range(num_training_steps))
+
+>>> model.train()
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... outputs = model(**batch)
+... loss = outputs.loss
+... loss.backward()
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+### Evaluate
+
+[`Trainer`]ใซ่ฉไพก้ขๆฐใ่ฟฝๅ ใใใฎใจๅๆงใซใ็ฌ่ชใฎใใฌใผใใณใฐใซใผใใไฝๆใใ้ใซใๅๆงใฎๆไฝใ่กใๅฟ
่ฆใใใใพใใ
+ใใ ใใๅใจใใใฏใฎๆๅพใซใกใใชใใฏใ่จ็ฎใใใณๅ ฑๅใใไปฃใใใซใไปๅใฏ[`~evaluate.add_batch`]ใไฝฟ็จใใฆใในใฆใฎใใใใ่็ฉใใๆๅพใซใกใใชใใฏใ่จ็ฎใใพใใ
+
+```python
+>>> import evaluate
+
+>>> metric = evaluate.load("accuracy")
+>>> model.eval()
+>>> for batch in eval_dataloader:
+... batch = {k: v.to(device) for k, v in batch.items()}
+... with torch.no_grad():
+... outputs = model(**batch)
+
+... logits = outputs.logits
+... predictions = torch.argmax(logits, dim=-1)
+... metric.add_batch(predictions=predictions, references=batch["labels"])
+
+>>> metric.compute()
+```
+
+
+
+
+
+
+## ่ฟฝๅ ใชใฝใผใน
+
+ใใใชใใใกใคใณใใฅใผใใณใฐใฎไพใซใคใใฆใฏใไปฅไธใๅ็
งใใฆใใ ใใ๏ผ
+
+- [๐ค Transformers Examples](https://github.com/huggingface/transformers/tree/main/examples) ใซใฏใPyTorchใจTensorFlowใงไธ่ฌ็ใชNLPใฟในใฏใใใฌใผใใณใฐใใในใฏใชใใใๅซใพใใฆใใพใใ
+
+- [๐ค Transformers Notebooks](notebooks) ใซใฏใ็นๅฎใฎใฟในใฏใซใขใใซใใใกใคใณใใฅใผใใณใฐใใๆนๆณใซ้ขใใใใพใใพใชใใผใใใใฏใๅซใพใใฆใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/transformers_agents.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/transformers_agents.md
new file mode 100644
index 0000000000000000000000000000000000000000..572d7f290c96dc44914c01b7abf386824b3fbc89
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/transformers_agents.md
@@ -0,0 +1,282 @@
+
+
+# Transformers Agents
+
+
+
+Transformers Agentsใฏใใใคใงใๅคๆดใใใๅฏ่ฝๆงใฎใใๅฎ้จ็ใชAPIใงใใใจใผใธใงใณใใ่ฟใ็ตๆใฏใAPIใพใใฏๅบ็คใจใชใใขใใซใๅคๆดใใใๅฏ่ฝๆงใใใใใใ็ฐใชใใใจใใใใพใใ
+
+
+
+Transformersใใผใธใงใณv4.29.0ใฏใ*ใใผใซ*ใจ*ใจใผใธใงใณใ*ใฎใณใณใปใใใๅบใซๆง็ฏใใใฆใใพใใใใฎ[colab](https://colab.research.google.com/drive/1c7MHD-T1forUPGcC_jlwsIptOzpG3hSj)ใง่ฉฆใใใจใใงใใพใใ
+
+่ฆใใใซใใใใฏtransformersใฎไธใซ่ช็ถ่จ่ชAPIใๆไพใใใใฎใงใ๏ผ็งใใกใฏไธ้ฃใฎๅณ้ธใใใใใผใซใๅฎ็พฉใใ่ช็ถ่จ่ชใ่งฃ้ใใใใใใฎใใผใซใไฝฟ็จใใใจใผใธใงใณใใ่จญ่จใใพใใใใใฏ่จญ่จไธๆกๅผตๅฏ่ฝใงใใ็งใใกใฏใใใคใใฎ้ข้ฃใใใใผใซใๅณ้ธใใพใใใใใณใใฅใใใฃใซใใฃใฆ้็บใใใไปปๆใฎใใผใซใไฝฟ็จใใใใใซใทในใใ ใ็ฐกๅใซๆกๅผตใงใใๆนๆณใ็คบใใพใใ
+
+ใใฎๆฐใใAPIใงไฝใใงใใใใฎใใใคใใฎไพใใๅงใใพใใใใ็นใซๅคใขใผใใซใชใฟในใฏใซ้ขใใฆๅผทๅใงใใฎใงใ็ปๅใ็ๆใใใใใญในใใ่ชญใฟไธใใใใใใฎใซๆ้ฉใงใใ
+
+ไธ่จใฎใใญในใใฎไธใซใๆฅๆฌ่ชใฎ็ฟป่จณใๆไพใใพใใ
+
+
+```py
+agent.run("Caption the following image", image=image)
+```
+
+| **Input** | **Output** |
+|-----------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
+| | A beaver is swimming in the water |
+
+---
+
+```py
+agent.run("Read the following text out loud", text=text)
+```
+| **Input** | **Output** |
+|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------|
+| A beaver is swimming in the water | your browser does not support the audio element.
+
+---
+
+```py
+agent.run(
+ "In the following `document`, where will the TRRF Scientific Advisory Council Meeting take place?",
+ document=document,
+)
+```
+| **Input** | **Output** |
+|-----------------------------------------------------------------------------------------------------------------------------|----------------|
+| | ballroom foyer |
+
+## Quickstart
+
+`agent.run`ใไฝฟ็จใใๅใซใใจใผใธใงใณใใใคใณในใฟใณในๅใใๅฟ
่ฆใใใใพใใใจใผใธใงใณใใฏใๅคง่ฆๆจกใช่จ่ชใขใใซ๏ผLLM๏ผใงใใ
+OpenAIใขใใซใจBigCodeใOpenAssistantใใใฎใชใผใใณใฝใผในใฎไปฃๆฟใขใใซใใตใใผใใใฆใใพใใOpenAIใขใใซใฏใใใฉใผใใณในใๅชใใฆใใพใใใOpenAIใฎAPIใญใผใๅฟ
่ฆใงใใใ็กๆใงไฝฟ็จใใใใจใฏใงใใพใใใไธๆนใHugging FaceใฏBigCodeใจOpenAssistantใขใใซใฎใจใณใใใคใณใใธใฎ็กๆใขใฏใปในใๆไพใใฆใใพใใ
+
+ใพใใใใใฉใซใใฎไพๅญ้ขไฟใใในใฆใคใณในใใผใซใใใใใซ`agents`ใฎใจใฏในใใฉใใคใณในใใผใซใใฆใใ ใใใ
+
+
+```bash
+pip install transformers[agents]
+```
+
+OpenAIใขใใซใไฝฟ็จใใใซใฏใ`openai`ใฎไพๅญ้ขไฟใใคใณในใใผใซใใๅพใ`OpenAiAgent`ใใคใณในใฟใณในๅใใพใใ
+
+
+```bash
+pip install openai
+```
+
+
+```py
+from transformers import OpenAiAgent
+
+agent = OpenAiAgent(model="text-davinci-003", api_key="")
+```
+
+BigCodeใพใใฏOpenAssistantใไฝฟ็จใใใซใฏใใพใใญใฐใคใณใใฆInference APIใซใขใฏใปในใใฆใใ ใใใ
+
+```py
+from huggingface_hub import login
+
+login("")
+```
+
+ๆฌกใซใใจใผใธใงใณใใใคใณในใฟใณในๅใใฆใใ ใใใ
+
+```py
+from transformers import HfAgent
+
+# Starcoder
+agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder")
+# StarcoderBase
+# agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoderbase")
+# OpenAssistant
+# agent = HfAgent(url_endpoint="https://api-inference.huggingface.co/models/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5")
+```
+
+ใใใฏใHugging Faceใ็พๅจ็กๆใงๆไพใใฆใใๆจ่ซAPIใไฝฟ็จใใฆใใพใใใใฎใขใใซ๏ผใพใใฏๅฅใฎใขใใซ๏ผใฎ็ฌ่ชใฎๆจ่ซใจใณใใใคใณใใใๆใกใฎๅ ดๅใฏใไธ่จใฎURLใจใณใใใคใณใใใ่ชๅใฎURLใจใณใใใคใณใใง็ฝฎใๆใใใใจใใงใใพใใ
+
+
+
+StarCoderใจOpenAssistantใฏ็กๆใงๅฉ็จใงใใใทใณใใซใชใฟในใฏใซใฏ้ๅธธใซๅชใใๆง่ฝใ็บๆฎใใพใใใใ ใใใใ่ค้ใชใใญใณใใใๅฆ็ใใ้ใซใฏใใใงใใฏใใคใณใใๅๅใงใชใใใจใใใใพใใใใฎใใใชๅ ดๅใซใฏใ็พๆ็นใงใฏใชใผใใณใฝใผในใงใฏใชใใใฎใฎใใใใฉใผใใณในใๅไธใใๅฏ่ฝๆงใฎใใOpenAIใขใใซใ่ฉฆใใฆใฟใใใจใใๅงใใใพใใ
+
+
+
+ใใใงๆบๅใๆดใใพใใ๏ผใใใใใใใชใใๅฉ็จใงใใ2ใคใฎAPIใซใคใใฆ่ฉณใใ่ชฌๆใใพใใ
+
+### Single execution (run)
+
+ๅไธๅฎ่กใกใฝใใใฏใใจใผใธใงใณใใฎ [`~Agent.run`] ใกใฝใใใไฝฟ็จใใๅ ดๅใงใใ
+
+
+```py
+agent.run("Draw me a picture of rivers and lakes.")
+```
+
+
+
+
+ใใใฏใๅฎ่กใใใใฟในใฏใซ้ฉใใใใผใซ๏ผใพใใฏใใผใซ๏ผใ่ชๅ็ใซ้ธๆใใ้ฉๅใซๅฎ่กใใพใใ1ใคใพใใฏ่คๆฐใฎใฟในใฏใๅใๅฝไปคใงๅฎ่กใใใใจใใงใใพใ๏ผใใ ใใๅฝไปคใ่ค้ใงใใใปใฉใใจใผใธใงใณใใๅคฑๆใใๅฏ่ฝๆงใ้ซใใชใใพใ๏ผใ
+
+
+```py
+agent.run("Draw me a picture of the sea then transform the picture to add an island")
+```
+
+
+
+
+
+[`~Agent.run`] ๆไฝใฏ็ฌ็ซใใฆๅฎ่กใงใใพใใฎใงใ็ฐใชใใฟในใฏใงไฝๅบฆใๅฎ่กใใใใจใใงใใพใใ
+
+ๆณจๆ็นใจใใฆใใใชใใฎ `agent` ใฏๅใชใๅคง่ฆๆจกใช่จ่ชใขใใซใงใใใใใใใญใณใใใฎใใใใชๅคๆดใงใๅฎๅ
จใซ็ฐใชใ็ตๆใๅพใใใๅฏ่ฝๆงใใใใพใใใใใใฃใฆใๅฎ่กใใใใฟในใฏใใงใใใ ใๆ็ขบใซ่ชฌๆใใใใจใ้่ฆใงใใ่ฏใใใญใณใใใฎๆธใๆนใซใคใใฆใฏใ[ใใกใ](custom_tools#writing-good-user-inputs) ใง่ฉณใใ่ชฌๆใใฆใใพใใ
+
+ๅฎ่กใใจใซ็ถๆ
ใไฟๆใใใใใใญในใไปฅๅคใฎใชใใธใงใฏใใใจใผใธใงใณใใซๆธกใใใใใๅ ดๅใฏใใจใผใธใงใณใใไฝฟ็จใใๅคๆฐใๆๅฎใใใใจใใงใใพใใไพใใฐใๆๅใฎๅทใๆนใฎ็ปๅใ็ๆใใใใฎ็ปๅใซๅณถใ่ฟฝๅ ใใใใใซใขใใซใซๆ็คบใใใซใฏใๆฌกใฎใใใซ่กใใใจใใงใใพใ๏ผ
+
+```python
+picture = agent.run("Generate a picture of rivers and lakes.")
+updated_picture = agent.run("Transform the image in `picture` to add an island to it.", picture=picture)
+```
+
+
+
+ใใใฏใใขใใซใใใชใใฎใชใฏใจในใใ็่งฃใงใใชใๅ ดๅใใใใผใซใๆททๅใใๅ ดๅใซๅฝน็ซใคใใจใใใใพใใไพใใฐ๏ผ
+
+```py
+agent.run("Draw me the picture of a capybara swimming in the sea")
+```
+
+ใใใงใฏใใขใใซใฏ2ใคใฎๆนๆณใง่งฃ้ใงใใพใ๏ผ
+- `text-to-image`ใซๆตทใงๆณณใใซใใใฉใ็ๆใใใ
+- ใพใใฏใ`text-to-image`ใงใซใใใฉใ็ๆใใใใใๆตทใงๆณณใใใใใใซ`image-transformation`ใใผใซใไฝฟ็จใใ
+
+ๆๅใฎใทใใชใชใๅผทๅถใใใๅ ดๅใฏใใใญใณใใใๅผๆฐใจใใฆๆธกใใใจใใงใใพใ๏ผ
+
+
+```py
+agent.run("Draw me a picture of the `prompt`", prompt="a capybara swimming in the sea")
+```
+
+
+
+
+### Chat-based execution (ใใฃใใ)
+
+ใจใผใธใงใณใใฏใ[`~Agent.chat`] ใกใฝใใใไฝฟ็จใใใใจใงใใใฃใใใใผในใฎใขใใญใผใใๅฏ่ฝใงใใ
+
+
+
+```py
+agent.chat("Transform the picture so that there is a rock in there")
+```
+
+
+
+
+
+ใใใฏใๆ็คบใใพใใใง็ถๆ
ใไฟๆใใใๅ ดๅใซไพฟๅฉใชใขใใญใผใใงใๅไธใฎๆ็คบใซๆฏในใฆ่ค้ใชๆ็คบใๅฆ็ใใใฎใฏ้ฃใใใใใใใพใใ๏ผใใฎๅ ดๅใฏ [`~Agent.run`] ใกใฝใใใฎๆนใ้ฉใใฆใใพใ๏ผใ
+
+ใใฎใกใฝใใใฏใ้ใใญในใๅใฎๅผๆฐใ็นๅฎใฎใใญใณใใใๆธกใใใๅ ดๅใซใไฝฟ็จใงใใพใใ
+
+### โ ๏ธ Remote execution
+
+ใใขใณในใใฌใผใทใงใณใฎ็ฎ็ใใในใฆใฎใปใใใขใใใงไฝฟ็จใงใใใใใซใใชใชใผในใฎใใใซใใใคใใฎใใใฉใซใใใผใซ็จใฎใชใขใผใๅฎ่กใใผใซใไฝๆใใพใใใใใใใฏ [ๆจ่ซใจใณใใใคใณใ](https://huggingface.co/inference-endpoints) ใไฝฟ็จใใฆไฝๆใใใพใใ
+
+ใใใใฏ็พๅจใชใใซใชใฃใฆใใพใใใใชใขใผใๅฎ่กใใผใซใ่ชๅใง่จญๅฎใใๆนๆณใซใคใใฆใฏใ[ใซในใฟใ ใใผใซใฌใคใ](./custom_tools) ใ่ชญใใใจใใๅงใใใพใใ
+
+### What's happening here? What are tools, and what are agents?
+
+
+
+#### Agents
+
+ใใใงใฎใใจใผใธใงใณใใใจใฏใๅคง่ฆๆจกใช่จ่ชใขใใซใฎใใจใงใใใ็นๅฎใฎไธ้ฃใฎใใผใซใซใขใฏใปในใงใใใใใซใใญใณใใใ่จญๅฎใใฆใใพใใ
+
+LLM๏ผๅคง่ฆๆจก่จ่ชใขใใซ๏ผใฏใใณใผใใฎๅฐใใชใตใณใใซใ็ๆใใใฎใซใใชใๅชใใฆใใใใใฎAPIใฏใใจใผใธใงใณใใซ็นๅฎใฎใใผใซใปใใใไฝฟ็จใใฆใฟในใฏใๅฎ่กใใใณใผใใฎๅฐใใชใตใณใใซใ็ๆใใใใใจใซๅฉ็จใใฆใใพใใใใฎใใญใณใใใฏใใจใผใธใงใณใใซใฟในใฏใจใใผใซใฎ่ชฌๆใๆไพใใใใจใงใใจใผใธใงใณใใไฝฟ็จใใฆใใใใผใซใฎใใญใฅใกใณใใซใขใฏใปในใใ้ข้ฃใใใณใผใใ็ๆใงใใใใใซใชใใพใใ
+
+#### Tools
+
+ใใผใซใฏ้ๅธธใซๅ็ดใงใๅๅใจ่ชฌๆใใใชใๅไธใฎ้ขๆฐใงใใใใใใใใใใใฎใใผใซใฎ่ชฌๆใไฝฟ็จใใฆใจใผใธใงใณใใใใญใณใใใใพใใใใญใณใใใ้ใใฆใใจใผใธใงใณใใซใใใผใซใไฝฟ็จใใฆใฏใจใชใง่ฆๆฑใใใใฟในใฏใใฉใฎใใใซๅฎ่กใใใใ็คบใใพใใ็นใซใใใผใซใฎๆๅพ
ใใใๅ
ฅๅใจๅบๅใ็คบใใพใใ
+
+ใใใฏๆฐใใใใผใซใไฝฟ็จใใฆใใใใใคใใฉใคใณใงใฏใชใใใผใซใไฝฟ็จใใฆใใพใใใชใใชใใใจใผใธใงใณใใฏ้ๅธธใซๅๅญ็ใชใใผใซใงใใ่ฏใใณใผใใ็ๆใใใใใงใใใใคใใฉใคใณใฏใใใชใใกใฏใฟใชใณใฐใใใใใฐใใฐ่คๆฐใฎใฟในใฏใ็ตใฟๅใใใฆใใพใใใใผใซใฏ้ๅธธใซๅ็ดใชใฟในใฏใซ็ฆ็นใๅฝใฆใใใจใๆๅณใใฆใใพใใ
+
+#### Code-execution?!
+
+ใใฎใณใผใใฏใใใผใซใจใใผใซใจไธ็ทใซๆธกใใใๅ
ฅๅใฎใปใใใงใๅฝ็คพใฎๅฐ่ฆๆจกใชPythonใคใณใฟใผใใชใฟใงๅฎ่กใใใพใใใใงใซๆไพใใใใใผใซใจprint้ขๆฐใใๅผใณๅบใใใจใใงใใชใใใใๅฎ่กใงใใใใจใฏใใงใซๅถ้ใใใฆใใพใใHugging Faceใฎใใผใซใซๅถ้ใใใฆใใใใใๅฎๅ
จใ ใจ่ใใฆใๅ้กใใใพใใใ
+
+ใใใซใๅฑๆงใฎๆค็ดขใใคใณใใผใใฏ่จฑๅฏใใฆใใใ๏ผใใใใฏๆธกใใใๅ
ฅๅ/ๅบๅใๅฆ็ใใใใใซใฏๅฟ
่ฆใชใใฏใใงใ๏ผใๆใๆใใใชๆปๆใฏๅ้กใใใพใใ๏ผใจใผใธใงใณใใซใใใใๅบๅใใใใใซใใญใณใใใใๅฟ
่ฆใใใใพใ๏ผใ่ถ
ๅฎๅ
จใชๅดใซ็ซใกใใๅ ดๅใฏใ่ฟฝๅ ใฎๅผๆฐ return_code=True ใๆๅฎใใฆ run() ใกใฝใใใๅฎ่กใงใใพใใใใฎๅ ดๅใใจใผใธใงใณใใฏๅฎ่กใใใณใผใใ่ฟใใ ใใงใๅฎ่กใใใใฉใใใฏใใชใๆฌก็ฌฌใงใใ
+
+ๅฎ่กใฏใ้ๆณใชๆไฝใ่ฉฆใฟใ่กใพใใฏใจใผใธใงใณใใ็ๆใใใณใผใใซ้ๅธธใฎPythonใจใฉใผใใใๅ ดๅใซๅๆญขใใพใใ
+
+### A curated set of tools
+
+็งใใกใฏใใใฎใใใชใจใผใธใงใณใใๅผทๅใงใใใใผใซใฎใปใใใ็นๅฎใใพใใไปฅไธใฏใ`transformers`ใซ็ตฑๅใใใใใผใซใฎๆดๆฐใใใใชในใใงใ๏ผ
+
+- **ใใญใฅใกใณใ่ณชๅๅฟ็ญ**: ็ปๅๅฝขๅผใฎใใญใฅใกใณใ๏ผPDFใชใฉ๏ผใไธใใใใๅ ดๅใใใฎใใญใฅใกใณใใซ้ขใใ่ณชๅใซๅ็ญใใพใ๏ผ[Donut](./model_doc/donut)๏ผ
+- **ใใญในใ่ณชๅๅฟ็ญ**: ้ทใใใญในใใจ่ณชๅใไธใใใใๅ ดๅใใใญในใๅ
ใฎ่ณชๅใซๅ็ญใใพใ๏ผ[Flan-T5](./model_doc/flan-t5)๏ผ
+- **็กๆกไปถใฎ็ปๅใญใฃใใทใงใณ**: ็ปๅใซใญใฃใใทใงใณใไปใใพใ๏ผ๏ผ[BLIP](./model_doc/blip)๏ผ
+- **็ปๅ่ณชๅๅฟ็ญ**: ็ปๅใไธใใใใๅ ดๅใใใฎ็ปๅใซ้ขใใ่ณชๅใซๅ็ญใใพใ๏ผ[VILT](./model_doc/vilt)๏ผ
+- **็ปๅใปใฐใกใณใใผใทใงใณ**: ็ปๅใจใใญใณใใใไธใใใใๅ ดๅใใใฎใใญใณใใใฎใปใฐใกใณใใผใทใงใณใในใฏใๅบๅใใพใ๏ผ[CLIPSeg](./model_doc/clipseg)๏ผ
+- **้ณๅฃฐใใใใญในใใธใฎๅคๆ**: ไบบใฎ่ฉฑใๅฃฐใฎใชใผใใฃใช้ฒ้ณใไธใใใใๅ ดๅใใใฎ้ณๅฃฐใใใญในใใซ่ปข่จใใพใ๏ผ[Whisper](./model_doc/whisper)๏ผ
+- **ใใญในใใใ้ณๅฃฐใธใฎๅคๆ**: ใใญในใใ้ณๅฃฐใซๅคๆใใพใ๏ผ[SpeechT5](./model_doc/speecht5)๏ผ
+- **ใผใญใทใงใใใใญในใๅ้ก**: ใใญในใใจใฉใใซใฎใชในใใไธใใใใๅ ดๅใใใญในใใๆใๅฏพๅฟใใใฉใใซใ่ญๅฅใใพใ๏ผ[BART](./model_doc/bart)๏ผ
+- **ใใญในใ่ฆ็ด**: ้ทใใใญในใใ1ใคใพใใฏๆฐๆใซ่ฆ็ดใใพใ๏ผ[BART](./model_doc/bart)๏ผ
+- **็ฟป่จณ**: ใใญในใใๆๅฎใใใ่จ่ชใซ็ฟป่จณใใพใ๏ผ[NLLB](./model_doc/nllb)๏ผ
+
+ใใใใฎใใผใซใฏtransformersใซ็ตฑๅใใใฆใใใๆๅใงใไฝฟ็จใงใใพใใใใจใใฐใๆฌกใฎใใใซไฝฟ็จใงใใพใ๏ผ
+
+```py
+from transformers import load_tool
+
+tool = load_tool("text-to-speech")
+audio = tool("This is a text to speech tool")
+```
+
+### Custom tools
+
+็งใใกใฏใๅณ้ธใใใใใผใซใฎใปใใใ็นๅฎใใไธๆนใใใฎๅฎ่ฃ
ใๆไพใใไธป่ฆใชไพกๅคใฏใใซในใฟใ ใใผใซใ่ฟ
้ใซไฝๆใใฆๅ
ฑๆใงใใ่ฝๅใ ใจๅผทใไฟกใใฆใใพใใ
+
+ใใผใซใฎใณใผใใHugging Face Spaceใพใใฏใขใใซใชใใธใใชใซใใใทใฅใใใใจใงใใจใผใธใงใณใใจ็ดๆฅ้ฃๆบใใฆใใผใซใๆดป็จใงใใพใใ[`huggingface-tools` organization](https://huggingface.co/huggingface-tools)ใซใฏใ**transformers้ไพๅญ**ใฎใใใคใใฎใใผใซใ่ฟฝๅ ใใใพใใ๏ผ
+
+- **ใใญในใใใฆใณใญใผใใผ**: ใฆใงใURLใใใใญในใใใใฆใณใญใผใใใใใใฎใใผใซ
+- **ใใญในใใใ็ปๅใธ**: ใใญใณใใใซๅพใฃใฆ็ปๅใ็ๆใใใใใฎใใผใซใๅฎๅฎใใๆกๆฃใๆดป็จใใพใ
+- **็ปๅๅคๆ**: ๅๆ็ปๅใจใใญใณใใใๆๅฎใใฆ็ปๅใๅคๆดใใใใใฎใใผใซใinstruct pix2pixใฎๅฎๅฎใใๆกๆฃใๆดป็จใใพใ
+- **ใใญในใใใใใใชใธ**: ใใญใณใใใซๅพใฃใฆๅฐใใชใใใชใ็ๆใใใใใฎใใผใซใdamo-vilabใๆดป็จใใพใ
+
+ๆๅใใไฝฟ็จใใฆใใใใญในใใใ็ปๅใธใฎใใผใซใฏใ[*huggingface-tools/text-to-image*](https://huggingface.co/spaces/huggingface-tools/text-to-image)ใซใใใชใขใผใใใผใซใงใ๏ผไปๅพใใใใฎ็ต็นใใใณไปใฎ็ต็นใซใใใซใใฎใใใชใใผใซใใชใชใผในใใใใฎๅฎ่ฃ
ใใใใซๅผทๅใใฆใใใพใใ
+
+ใจใผใธใงใณใใฏใใใฉใซใใง[`huggingface-tools`](https://huggingface.co/huggingface-tools)ใซใใใใผใซใซใขใฏใปในใงใใพใใ
+ใใผใซใฎไฝๆใจๅ
ฑๆๆนๆณใใพใHubใซๅญๅจใใใซในใฟใ ใใผใซใๆดป็จใใๆนๆณใซใคใใฆใฎ่ฉณ็ดฐใฏใ[ๆฌกใฎใฌใคใ](custom_tools)ใง่ชฌๆใใฆใใพใใ
+
+### Code generation
+
+ใใใพใงใใจใผใธใงใณใใไฝฟ็จใใฆใใชใใฎใใใซใขใฏใทใงใณใๅฎ่กใใๆนๆณใ็คบใใพใใใใใ ใใใจใผใธใงใณใใฏใณใผใใ็ๆใใใ ใใงใ้ๅธธใซๅถ้ใใใPythonใคใณใฟใผใใชใฟใไฝฟ็จใใฆๅฎ่กใใพใใ็ๆใใใใณใผใใ็ฐใชใ็ฐๅขใงไฝฟ็จใใใๅ ดๅใใจใผใธใงใณใใซใณใผใใ่ฟใใใใซๆ็คบใงใใพใใใใผใซใฎๅฎ็พฉใจๆญฃ็ขบใชใคใณใใผใใๅซใใฆใ
+
+ไพใใฐใไปฅไธใฎๅฝไปค๏ผ
+```python
+agent.run("Draw me a picture of rivers and lakes", return_code=True)
+```
+
+ๆฌกใฎใณใผใใ่ฟใใพใ
+```python
+from transformers import load_tool
+
+image_generator = load_tool("huggingface-tools/text-to-image")
+
+image = image_generator(prompt="rivers and lakes")
+```
+
+ใใฎๅพใ่ชๅใงๅคๆดใใฆๅฎ่กใงใใพใใ
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/troubleshooting.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/troubleshooting.md
new file mode 100644
index 0000000000000000000000000000000000000000..b13b5993171a0a31c9f3d9c65d70069e5909b57a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ja/troubleshooting.md
@@ -0,0 +1,195 @@
+
+
+# Troubleshoot
+
+ๆใซใฏใจใฉใผใ็บ็ใใใใจใใใใพใใใ็งใใกใฏใใใซใใพใ๏ผใใฎใฌใคใใงใฏใ็งใใกใใใ่ฆใๆใไธ่ฌ็ใชๅ้กใจใใใใใ่งฃๆฑบใใๆนๆณใซใคใใฆ่ชฌๆใใพใใใใ ใใใใฎใฌใคใใฏใในใฆใฎ ๐ค Transformers ใฎๅ้กใฎๅ
ๆฌ็ใชใณใฌใฏใทใงใณใงใฏใใใพใใใๅ้กใใใฉใใซใทใฅใผใใฃใณใฐใใใใใฎ่ฉณ็ดฐใชใใซใใๅฟ
่ฆใชๅ ดๅใฏใไปฅไธใฎๆนๆณใ่ฉฆใใฆใฟใฆใใ ใใ๏ผ
+
+
+
+1. [ใใฉใผใฉใ ](https://discuss.huggingface.co/)ใงๅฉใใๆฑใใใ [ๅๅฟ่
ๅใ](https://discuss.huggingface.co/c/beginners/5) ใพใใฏ [๐ค Transformers](https://discuss.huggingface.co/c/transformers/9) ใชใฉใ่ณชๅใๆ็จฟใงใใ็นๅฎใฎใซใใดใชใใใใพใใๅ้กใ่งฃๆฑบใใใๅฏ่ฝๆงใๆๅคง้ใซใใใใใซใๅ็พๅฏ่ฝใชใณใผใใๅซใ่ฏใ่ชฌๆ็ใชใใฉใผใฉใ ๆ็จฟใๆธใใใจใ็ขบ่ชใใฆใใ ใใ๏ผ
+
+
+
+2. ใใฐใใฉใคใใฉใชใซ้ข้ฃใใๅ ดๅใฏใ๐ค Transformers ใชใใธใใชใง [Issue](https://github.com/huggingface/transformers/issues/new/choose) ใไฝๆใใฆใใ ใใใใใฐใ่ชฌๆใใใใใฎใงใใใ ใๅคใใฎๆ
ๅ ฑใๅซใใใใใซๅฟใใใไฝใๅ้กใงใใฉใฎใใใซไฟฎๆญฃใงใใใใใใ่ฏใ็่งฃใงใใใใใซใใฆใใ ใใใ
+
+3. ใใๅคใใใผใธใงใณใฎ ๐ค Transformers ใไฝฟ็จใใฆใใๅ ดๅใฏใ[Migration](migration) ใฌใคใใ็ขบ่ชใใฆใใ ใใใใใผใธใงใณ้ใง้่ฆใชๅคๆดใๅฐๅ
ฅใใใฆใใใใใงใใ
+
+ใใฉใใซใทใฅใผใใฃใณใฐใจใใซใใฎ่ฉณ็ดฐใซใคใใฆใฏใHugging Faceใณใผในใฎ [็ฌฌ8็ซ ](https://huggingface.co/course/chapter8/1?fw=pt) ใๅ็
งใใฆใใ ใใใ
+
+## Firewalled environments
+
+ไธ้จใฎใฏใฉใฆใไธใฎGPUใคใณในใฟใณในใใคใณใใฉใใใใปใใใขใใใฏใๅค้จๆฅ็ถใซๅฏพใใฆใใกใคใขใฆใฉใผใซใงไฟ่ญทใใใฆใใใใใๆฅ็ถใจใฉใผใ็บ็ใใใใจใใใใพใใในใฏใชใใใใขใใซใฎ้ใฟใใใผใฟใปใใใใใฆใณใญใผใใใใใจใใใจใใใฆใณใญใผใใ้ไธญใงๆญขใพใใๆฌกใฎใกใใปใผใธใจใฟใคใ ใขใฆใใจใฉใผใ่กจ็คบใใใพใ๏ผ
+
+```
+ValueError: Connection error, and we cannot find the requested files in the cached path.
+Please try again or make sure your Internet connection is on.
+```
+
+
+ใใฎๅ ดๅใๆฅ็ถใจใฉใผใๅ้ฟใใใใใซ[ใชใใฉใคใณใขใผใ](installation#offline-mode)ใง๐ค Transformersใๅฎ่กใใฆใฟใฆใใ ใใใ
+
+## CUDA out of memory
+
+ๆฐ็พไธใฎใใฉใกใผใฟใๆใคๅคง่ฆๆจกใชใขใใซใฎใใฌใผใใณใฐใฏใ้ฉๅใชใใผใใฆใงใขใชใใงใฏ่ชฒ้กใงใใGPUใฎใกใขใชใไธ่ถณใใใจใใใใใจใฉใผใฎ1ใคใฏๆฌกใฎใจใใใงใ๏ผ
+
+ไปฅไธใฏใกใขใชไฝฟ็จ้ใๆธใใใใใซ่ฉฆใใใจใใงใใใใใคใใฎ่งฃๆฑบ็ญใงใ๏ผ
+
+- [`TrainingArguments`]ใฎไธญใง [`per_device_train_batch_size`](main_classes/trainer#transformers.TrainingArguments.per_device_train_batch_size) ใฎๅคใๆธใใใ
+- [`TrainingArguments`]ใฎไธญใง [`gradient_accumulation_steps`](main_classes/trainer#transformers.TrainingArguments.gradient_accumulation_steps) ใไฝฟ็จใใฆใๅ
จไฝ็ใชใใใใตใคใบใๅนๆ็ใซๅขใใใใจใ่ฉฆใใ
+
+
+
+ใกใขใช็ฏ็ดใฎใใฏใใใฏใซใคใใฆใฎ่ฉณ็ดฐใฏใ[ใฌใคใ](performance)ใๅ็
งใใฆใใ ใใใ
+
+
+
+## Unable to load a saved TensorFlow model
+
+TensorFlowใฎ[model.save](https://www.tensorflow.org/tutorials/keras/save_and_load#save_the_entire_model)ใกใฝใใใฏใใขใใซๅ
จไฝ - ใขใผใญใใฏใใฃใ้ใฟใใใฌใผใใณใฐ่จญๅฎ - ใ1ใคใฎใใกใคใซใซไฟๅญใใพใใใใใใใขใใซใใกใคใซใๅๅบฆ่ชญใฟ่พผใ้ใซใจใฉใผใ็บ็ใใใใจใใใใพใใใใใฏใ๐ค Transformersใใขใใซใใกใคใซๅ
ใฎใในใฆใฎTensorFlow้ข้ฃใชใใธใงใฏใใ่ชญใฟ่พผใพใชใใใใงใใTensorFlowใขใใซใฎไฟๅญใจ่ชญใฟ่พผใฟใซ้ขใใๅ้กใๅ้ฟใใใใใซใๆฌกใฎใใจใใๅงใใใพใ๏ผ
+
+- ใขใใซใฎ้ใฟใ`h5`ใใกใคใซๆกๅผตๅญใงไฟๅญใใ[`~TFPreTrainedModel.from_pretrained`]ใไฝฟ็จใใฆใขใใซใๅ่ชญใฟ่พผใฟใใ๏ผ
+
+```py
+>>> from transformers import TFPreTrainedModel
+
+>>> model.save_weights("some_folder/tf_model.h5")
+>>> model = TFPreTrainedModel.from_pretrained("some_folder")
+```
+
+- Save the model with [`~TFPretrainedModel.save_pretrained`] and load it again with [`~TFPreTrainedModel.from_pretrained`]:
+
+```py
+>>> from transformers import TFPreTrainedModel
+
+>>> model.save_pretrained("path_to/model")
+>>> model = TFPreTrainedModel.from_pretrained("path_to/model")
+```
+
+## ImportError
+
+ใใไธใคใใใใใจใฉใผใฏใ็นใซๆฐใใใชใชใผในใใใใขใใซใฎๅ ดๅใซ้ญ้ใใใใจใใใ `ImportError` ใงใ๏ผ
+
+
+```
+ImportError: cannot import name 'ImageGPTImageProcessor' from 'transformers' (unknown location)
+```
+
+ใใใใฎใจใฉใผใฟใคใใซ้ขใใฆใฏใๆๆฐใใผใธใงใณใฎ ๐ค Transformers ใใคใณในใใผใซใใใฆใใใใจใ็ขบ่ชใใฆใๆๆฐใฎใขใใซใซใขใฏใปในใงใใใใใซใใฆใใ ใใ๏ผ
+
+```bash
+pip install transformers --upgrade
+```
+
+## CUDA error: device-side assert triggered
+
+ๆใ
ใใใใคในใณใผใใงใจใฉใผใ็บ็ใใใจใใไธ่ฌ็ใช CUDA ใจใฉใผใซ้ญ้ใใใใจใใใใพใใ
+
+```
+RuntimeError: CUDA error: device-side assert triggered
+```
+
+ใใๅ
ทไฝ็ใชใจใฉใผใกใใปใผใธใๅๅพใใใใใซใใพใใฏCPUไธใงใณใผใใๅฎ่กใใฆใฟใใใจใใๅงใใใพใใไปฅไธใฎ็ฐๅขๅคๆฐใใณใผใใฎๅ้ ญใซ่ฟฝๅ ใใฆใCPUใซๅใๆฟใใฆใฟใฆใใ ใใ๏ผ
+
+```py
+>>> import os
+
+>>> os.environ["CUDA_VISIBLE_DEVICES"] = ""
+```
+
+GPUใใใใ่ฏใใใฌใผในใใใฏใๅๅพใใๅฅใฎใชใใทใงใณใฏใๆฌกใฎ็ฐๅขๅคๆฐใใณใผใใฎๅ
้ ญใซ่ฟฝๅ ใใใใจใงใใใใใซใใใใจใฉใผใฎ็บ็ๆบใๆใใใฌใผในใใใฏใๅพใใใพใ๏ผ
+
+```py
+>>> import os
+
+>>> os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
+```
+
+
+## Incorrect output when padding tokens aren't masked
+
+ไธ้จใฎใฑใผในใงใฏใ`input_ids`ใซใใใฃใณใฐใใผใฏใณใๅซใพใใฆใใๅ ดๅใๅบๅใฎ`hidden_state`ใๆญฃใใใชใใใจใใใใพใใใใขใณในใใฌใผใทใงใณใฎใใใซใใขใใซใจใใผใฏใใคใถใผใใญใผใใใพใใใขใใซใฎ`pad_token_id`ใซใขใฏใปในใใฆใใใฎๅคใ็ขบ่ชใงใใพใใไธ้จใฎใขใใซใงใฏ`pad_token_id`ใ`None`ใซใชใใใจใใใใพใใใๅธธใซๆๅใง่จญๅฎใใใใจใใงใใพใใ
+
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+>>> import torch
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("google-bert/bert-base-uncased")
+>>> model.config.pad_token_id
+0
+```
+
+ไปฅไธใฎไพใฏใใใใฃใณใฐใใผใฏใณใใในใฏใใใซๅบๅใ่กจ็คบใใใใฎใงใ๏ผ
+
+```py
+>>> input_ids = torch.tensor([[7592, 2057, 2097, 2393, 9611, 2115], [7592, 0, 0, 0, 0, 0]])
+>>> output = model(input_ids)
+>>> print(output.logits)
+tensor([[ 0.0082, -0.2307],
+ [ 0.1317, -0.1683]], grad_fn=)
+```
+
+ไปฅไธใฏใ็ฌฌ2ใฎใทใผใฑใณในใฎๅฎ้ใฎๅบๅใงใ๏ผ
+
+```py
+>>> input_ids = torch.tensor([[7592]])
+>>> output = model(input_ids)
+>>> print(output.logits)
+tensor([[-0.1008, -0.4061]], grad_fn=)
+```
+
+ๅคงๆตใฎๅ ดๅใใขใใซใซใฏ `attention_mask` ใๆไพใใฆใใใใฃใณใฐใใผใฏใณใ็ก่ฆใใใใฎใใใช็ก้ณใฎใจใฉใผใๅ้ฟใใๅฟ
่ฆใใใใพใใใใใซใใใ2็ช็ฎใฎใทใผใฑใณในใฎๅบๅใๅฎ้ใฎๅบๅใจไธ่ดใใใใใซใชใใพใใ
+
+
+
+ใใใฉใซใใงใฏใใใผใฏใใคใถใฏใใใผใฏใใคใถใฎใใใฉใซใใซๅบใฅใใฆ `attention_mask` ใ่ชๅใงไฝๆใใพใใ
+
+
+
+```py
+>>> attention_mask = torch.tensor([[1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0]])
+>>> output = model(input_ids, attention_mask=attention_mask)
+>>> print(output.logits)
+tensor([[ 0.0082, -0.2307],
+ [-0.1008, -0.4061]], grad_fn=)
+```
+
+๐ค Transformersใฏใๆไพใใใใใใฃใณใฐใใผใฏใณใใในใฏใใใใใซ่ชๅ็ใซ`attention_mask`ใไฝๆใใพใใใใใฎ็็ฑใฏไปฅไธใฎ้ใใงใ๏ผ
+
+- ไธ้จใฎใขใใซใซใฏใใใฃใณใฐใใผใฏใณใๅญๅจใใชใๅ ดๅใใใใใใงใใ
+- ไธ้จใฎใฆใผในใฑใผในใงใฏใใฆใผใถใผใใใใฃใณใฐใใผใฏใณใซใขใใณใทใงใณใๅใใใใจใๆใๅ ดๅใใใใใใงใใ
+
+## ValueError: Unrecognized configuration class XYZ for this kind of AutoModel
+
+ไธ่ฌ็ใซใไบๅๅญฆ็ฟๆธใฟใขใใซใฎใคใณในใฟใณในใใญใผใใใใใใซใฏ[`AutoModel`]ใฏใฉในใไฝฟ็จใใใใจใใๅงใใใพใใใใฎใฏใฉในใฏใ่จญๅฎใซๅบใฅใใฆไธใใใใใใงใใฏใใคใณใใใๆญฃใใใขใผใญใใฏใใฃใ่ชๅ็ใซๆจๆธฌใใใณใญใผใใงใใพใใใขใใซใใญใผใใใ้ใซใใฎ`ValueError`ใ่กจ็คบใใใๅ ดๅใAutoใฏใฉในใฏไธใใใใใใงใใฏใใคใณใใฎ่จญๅฎใใใใญใผใใใใใจใใฆใใใขใใซใฎ็จฎ้กใธใฎใใใใณใฐใ่ฆใคใใใใจใใงใใชใใฃใใใจใๆๅณใใพใใๆใไธ่ฌ็ใซใฏใ็นๅฎใฎใฟในใฏใใตใใผใใใชใใใงใใฏใใคใณใใใใๅ ดๅใซใใฎใจใฉใผใ็บ็ใใพใใ
+ไพใใฐใ่ณชๅๅฟ็ญใฎใใใฎGPT2ใๅญๅจใใชใๅ ดๅใๆฌกใฎไพใงใใฎใจใฉใผใ่กจ็คบใใใพใ๏ผ
+
+ไธ่จใฎใใญในใใๆฅๆฌ่ชใซ็ฟป่จณใใMarkdownใใกใคใซใจใใฆใใฉใผใใใใใพใใใ
+
+
+```py
+>>> from transformers import AutoProcessor, AutoModelForQuestionAnswering
+
+>>> processor = AutoProcessor.from_pretrained("openai-community/gpt2-medium")
+>>> model = AutoModelForQuestionAnswering.from_pretrained("openai-community/gpt2-medium")
+ValueError: Unrecognized configuration class for this kind of AutoModel: AutoModelForQuestionAnswering.
+Model type should be one of AlbertConfig, BartConfig, BertConfig, BigBirdConfig, BigBirdPegasusConfig, BloomConfig, ...
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/_config.py b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/_config.py
new file mode 100644
index 0000000000000000000000000000000000000000..ab61af6ef9e86028ae075e01fb244ae4226f387b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/_config.py
@@ -0,0 +1,14 @@
+# docstyle-ignore
+INSTALL_CONTENT = """
+# Transformers ์ค์น ๋ฐฉ๋ฒ
+! pip install transformers datasets evaluate accelerate
+# ๋ง์ง๋ง ๋ฆด๋ฆฌ์ค ๋์ ์์ค์์ ์ค์นํ๋ ค๋ฉด, ์ ๋ช
๋ น์ ์ฃผ์์ผ๋ก ๋ฐ๊พธ๊ณ ์๋ ๋ช
๋ น์ ํด์ ํ์ธ์.
+# ! pip install git+https://github.com/huggingface/transformers.git
+"""
+
+notebook_first_cells = [{"type": "code", "content": INSTALL_CONTENT}]
+black_avoid_patterns = {
+ "{processor_class}": "FakeProcessorClass",
+ "{model_class}": "FakeModelClass",
+ "{object_class}": "FakeObjectClass",
+}
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/_toctree.yml b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/_toctree.yml
new file mode 100644
index 0000000000000000000000000000000000000000..dfa50f9f13a1f138a545909ee3c35c5190aa9d62
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/_toctree.yml
@@ -0,0 +1,792 @@
+- sections:
+ - local: index
+ title: ๐ค Transformers
+ - local: quicktour
+ title: ๋๋ฌ๋ณด๊ธฐ
+ - local: installation
+ title: ์ค์น๋ฐฉ๋ฒ
+ title: ์์ํ๊ธฐ
+- sections:
+ - local: pipeline_tutorial
+ title: Pipeline์ผ๋ก ์ถ๋ก ํ๊ธฐ
+ - local: autoclass_tutorial
+ title: AutoClass๋ก ์ฌ์ ํ์ต๋ ์ธ์คํด์ค ๋ก๋ํ๊ธฐ
+ - local: preprocessing
+ title: ๋ฐ์ดํฐ ์ ์ฒ๋ฆฌํ๊ธฐ
+ - local: training
+ title: ์ฌ์ ํ์ต๋ ๋ชจ๋ธ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ
+ - local: run_scripts
+ title: ์คํฌ๋ฆฝํธ๋ก ํ์ตํ๊ธฐ
+ - local: accelerate
+ title: ๐ค Accelerate๋ก ๋ถ์ฐ ํ์ต ๊ตฌ์ฑํ๊ธฐ
+ - local: peft
+ title: ๐ค PEFT๋ก ์ด๋ํฐ ๋ก๋ ๋ฐ ํ์ตํ๊ธฐ
+ - local: model_sharing
+ title: ๋ง๋ ๋ชจ๋ธ ๊ณต์ ํ๊ธฐ
+ - local: transformers_agents
+ title: ์์ด์ ํธ
+ - local: llm_tutorial
+ title: ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ๋ก ์์ฑํ๊ธฐ
+ - local: conversations
+ title: Transformers๋ก ์ฑํ
ํ๊ธฐ
+ title: ํํ ๋ฆฌ์ผ
+- sections:
+ - isExpanded: false
+ sections:
+ - local: tasks/sequence_classification
+ title: ํ
์คํธ ๋ถ๋ฅ
+ - local: tasks/token_classification
+ title: ํ ํฐ ๋ถ๋ฅ
+ - local: tasks/question_answering
+ title: ์ง์ ์๋ต(Question Answering)
+ - local: tasks/language_modeling
+ title: ์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ๋ง(Causal language modeling)
+ - local: tasks/masked_language_modeling
+ title: ๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง(Masked language modeling)
+ - local: tasks/translation
+ title: ๋ฒ์ญ
+ - local: tasks/summarization
+ title: ์์ฝ
+ - local: tasks/multiple_choice
+ title: ๊ฐ๊ด์ ๋ฌธ์ (Multiple Choice)
+ title: ์์ฐ์ด์ฒ๋ฆฌ
+ - isExpanded: false
+ sections:
+ - local: tasks/audio_classification
+ title: ์ค๋์ค ๋ถ๋ฅ
+ - local: tasks/asr
+ title: ์๋ ์์ฑ ์ธ์
+ title: ์ค๋์ค
+ - isExpanded: false
+ sections:
+ - local: tasks/image_classification
+ title: ์ด๋ฏธ์ง ๋ถ๋ฅ
+ - local: tasks/semantic_segmentation
+ title: ์๋ฏธ์ ๋ถํ (Semantic segmentation)
+ - local: tasks/video_classification
+ title: ์์ ๋ถ๋ฅ
+ - local: tasks/object_detection
+ title: ๊ฐ์ฒด ํ์ง
+ - local: tasks/zero_shot_object_detection
+ title: ์ ๋ก์ท(zero-shot) ๊ฐ์ฒด ํ์ง
+ - local: tasks/zero_shot_image_classification
+ title: ์ ๋ก์ท(zero-shot) ์ด๋ฏธ์ง ๋ถ๋ฅ
+ - local: tasks/monocular_depth_estimation
+ title: ๋จ์ผ ์์ ๊ธฐ๋ฐ ๊น์ด ์ถ์
+ - local: tasks/image_to_image
+ title: Image-to-Image
+ - local: tasks/image_feature_extraction
+ title: ์ด๋ฏธ์ง ํน์ง ์ถ์ถ
+ - local: tasks/mask_generation
+ title: ๋ง์คํฌ ์์ฑ
+ - local: tasks/knowledge_distillation_for_image_classification
+ title: ์ปดํจํฐ ๋น์ (์ด๋ฏธ์ง ๋ถ๋ฅ)๋ฅผ ์ํ ์ง์ ์ฆ๋ฅ(knowledge distillation)
+ title: ์ปดํจํฐ ๋น์
+ - isExpanded: false
+ sections:
+ - local: tasks/image_captioning
+ title: ์ด๋ฏธ์ง ์บก์
๋
+ - local: tasks/document_question_answering
+ title: ๋ฌธ์ ์ง์ ์๋ต(Document Question Answering)
+ - local: tasks/visual_question_answering
+ title: ์๊ฐ์ ์ง์์๋ต (Visual Question Answering)
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Text to speech
+ title: ๋ฉํฐ๋ชจ๋ฌ
+ - isExpanded: false
+ sections:
+ - local: generation_strategies
+ title: ํ
์คํธ ์์ฑ ์ ๋ต ์ฌ์ฉ์ ์ ์
+ title: ์์ฑ
+ - isExpanded: false
+ sections:
+ - local: tasks/idefics
+ title: IDEFICS๋ฅผ ์ด์ฉํ ์ด๋ฏธ์ง ์์
+ - local: tasks/prompting
+ title: ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ํ๋กฌํํ
๊ฐ์ด๋
+ title: ํ๋กฌํํ
+ title: ํ์คํฌ ๊ฐ์ด๋
+- sections:
+ - local: fast_tokenizers
+ title: ๐ค Tokenizers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ํ ํฌ๋์ด์ ์ฌ์ฉํ๊ธฐ
+ - local: multilingual
+ title: ๋ค๊ตญ์ด ๋ชจ๋ธ ์ถ๋ก ํ๊ธฐ
+ - local: create_a_model
+ title: ๋ชจ๋ธ๋ณ API ์ฌ์ฉํ๊ธฐ
+ - local: custom_models
+ title: ์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ ๊ณต์ ํ๊ธฐ
+ - local: chat_templating
+ title: ์ฑ๋ด ํ
ํ๋ฆฟ ์ตํ๊ธฐ
+ - local: trainer
+ title: Trainer ์ฌ์ฉํ๊ธฐ
+ - local: sagemaker
+ title: Amazon SageMaker์์ ํ์ต ์คํํ๊ธฐ
+ - local: serialization
+ title: ONNX๋ก ๋ด๋ณด๋ด๊ธฐ
+ - local: tflite
+ title: TFLite๋ก ๋ด๋ณด๋ด๊ธฐ
+ - local: torchscript
+ title: TorchScript๋ก ๋ด๋ณด๋ด๊ธฐ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Benchmarks
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Notebooks with examples
+ - local: community
+ title: ์ปค๋ฎค๋ํฐ ๋ฆฌ์์ค
+ - local: troubleshooting
+ title: ๋ฌธ์ ํด๊ฒฐ
+ - local: gguf
+ title: GGUF ํ์ผ๋ค๊ณผ์ ์ํธ ์ด์ฉ์ฑ
+ - local: modular_transformers
+ title: transformers์์์ ๋ชจ๋์ฑ
+ title: (๋ฒ์ญ์ค) ๊ฐ๋ฐ์ ๊ฐ์ด๋
+- sections:
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Getting started
+ - local: quantization/bitsandbytes
+ title: bitsandbytes
+ - local: quantization/gptq
+ title: GPTQ
+ - local: quantization/awq
+ title: AWQ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) AQLM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) VPTQ
+ - local: quantization/quanto
+ title: Quanto
+ - local: quantization/eetq
+ title: EETQ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) HQQ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Optimum
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Contribute new quantization method
+ title: (๋ฒ์ญ์ค) ๊ฒฝ๋ํ ๋ฉ์๋
+- sections:
+ - local: performance
+ title: ์ฑ๋ฅ ๋ฐ ํ์ฅ์ฑ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Quantization
+ - local: llm_optims
+ title: LLM ์ถ๋ก ์ต์ ํ
+ - sections:
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Methods and tools for efficient training on a single GPU
+ - local: perf_train_gpu_many
+ title: ๋ค์ค GPU์์ ํ๋ จ ์งํํ๊ธฐ
+ - local: deepspeed
+ title: DeepSpeed
+ - local: fsdp
+ title: ์์ ๋ถํ ๋ฐ์ดํฐ ๋ณ๋ ฌ ์ฒ๋ฆฌ
+ - local: perf_train_cpu
+ title: CPU์์ ํ๋ จ
+ - local: perf_train_cpu_many
+ title: ๋ค์ค CPU์์ ํ๋ จํ๊ธฐ
+ - local: perf_train_tpu_tf
+ title: TensorFlow๋ก TPU์์ ํ๋ จํ๊ธฐ
+ - local: perf_train_special
+ title: Apple ์ค๋ฆฌ์ฝ์์ PyTorch ํ์ต
+ - local: perf_hardware
+ title: ํ๋ จ์ฉ ์ฌ์ฉ์ ๋ง์ถคํ ํ๋์จ์ด
+ - local: hpo_train
+ title: Trainer API๋ฅผ ์ฌ์ฉํ ํ์ดํผํ๋ผ๋ฏธํฐ ํ์
+ title: (๋ฒ์ญ์ค) ํจ์จ์ ์ธ ํ์ต ๊ธฐ์ ๋ค
+ - sections:
+ - local: perf_infer_cpu
+ title: CPU๋ก ์ถ๋ก ํ๊ธฐ
+ - local: perf_infer_gpu_one
+ title: ํ๋์ GPU๋ฅผ ํ์ฉํ ์ถ๋ก
+ title: ์ถ๋ก ์ต์ ํํ๊ธฐ
+ - local: big_models
+ title: ๋ํ ๋ชจ๋ธ์ ์ธ์คํด์คํ
+ - local: debugging
+ title: ๋๋ฒ๊น
+ - local: tf_xla
+ title: TensorFlow ๋ชจ๋ธ์ ์ํ XLA ํตํฉ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Optimize inference using `torch.compile()`
+ title: (๋ฒ์ญ์ค) ์ฑ๋ฅ ๋ฐ ํ์ฅ์ฑ
+- sections:
+ - local: contributing
+ title: ๐ค Transformers์ ๊ธฐ์ฌํ๋ ๋ฐฉ๋ฒ
+ - local: add_new_model
+ title: ๐ค Transformers์ ์๋ก์ด ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ
+ - local: add_new_pipeline
+ title: ์ด๋ป๊ฒ ๐ค Transformers์ ํ์ดํ๋ผ์ธ์ ์ถ๊ฐํ๋์?
+ - local: testing
+ title: ํ
์คํธ
+ - local: pr_checks
+ title: Pull Request์ ๋ํ ๊ฒ์ฌ
+ title: ๊ธฐ์ฌํ๊ธฐ
+- sections:
+ - local: philosophy
+ title: ์ด๋
๊ณผ ๋ชฉํ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Glossary
+ - local: task_summary
+ title: ๐ค Transformers๋ก ํ ์ ์๋ ์์
+ - local: tasks_explained
+ title: ๐ค Transformers๋ก ์์
์ ํด๊ฒฐํ๋ ๋ฐฉ๋ฒ
+ - local: model_summary
+ title: Transformer ๋ชจ๋ธ๊ตฐ
+ - local: tokenizer_summary
+ title: ํ ํฌ๋์ด์ ์์ฝ
+ - local: attention
+ title: ์ดํ
์
๋งค์ปค๋์ฆ
+ - local: pad_truncation
+ title: ํจ๋ฉ๊ณผ ์๋ผ๋ด๊ธฐ
+ - local: bertology
+ title: BERTology
+ - local: perplexity
+ title: ๊ณ ์ ๊ธธ์ด ๋ชจ๋ธ์ ํํ๋ ์ํฐ(Perplexity)
+ - local: pipeline_webserver
+ title: ์ถ๋ก ์น ์๋ฒ๋ฅผ ์ํ ํ์ดํ๋ผ์ธ
+ - local: model_memory_anatomy
+ title: ๋ชจ๋ธ ํ์ต ํด๋ถํ๊ธฐ
+ - local: llm_tutorial_optimization
+ title: LLM์ ์ต๋ํ ํ์ฉํ๊ธฐ
+ title: (๋ฒ์ญ์ค) ๊ฐ๋
๊ฐ์ด๋
+- sections:
+ - sections:
+ - local: main_classes/agent
+ title: ์์ด์ ํธ์ ๋๊ตฌ
+ - local: model_doc/auto
+ title: ์๋ ํด๋์ค
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Backbones
+ - local: main_classes/callback
+ title: ์ฝ๋ฐฑ
+ - local: main_classes/configuration
+ title: ๊ตฌ์ฑ
+ - local: main_classes/data_collator
+ title: ๋ฐ์ดํฐ ์ฝ๋ ์ดํฐ
+ - local: main_classes/keras_callbacks
+ title: ์ผ๋ผ์ค ์ฝ๋ฐฑ
+ - local: main_classes/logging
+ title: ๋ก๊น
+ - local: main_classes/model
+ title: Models
+ - local: main_classes/text_generation
+ title: ํ
์คํธ ์์ฑ
+ - local: main_classes/onnx
+ title: ONNX
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Optimization
+ - local: in_translation
+ title: ๋ชจ๋ธ ์ถ๋ ฅ
+ - local: main_classes/output
+ title: (๋ฒ์ญ์ค) Pipelines
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Processors
+ - local: main_classes/quantization
+ title: ์์ํ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Tokenizer
+ - local: main_classes/trainer
+ title: Trainer
+ - local: deepspeed
+ title: DeepSpeed
+ - local: main_classes/executorch
+ title: ExecuTorch
+ - local: main_classes/feature_extractor
+ title: ํน์ฑ ์ถ์ถ๊ธฐ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Image Processor
+ title: (๋ฒ์ญ์ค) ๋ฉ์ธ ํด๋์ค
+ - sections:
+ - isExpanded: false
+ sections:
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ALBERT
+ - local: model_doc/bart
+ title: BART
+ - local: model_doc/barthez
+ title: BARThez
+ - local: model_doc/bartpho
+ title: BARTpho
+ - local: model_doc/bert
+ title: BERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BertGeneration
+ - local: model_doc/bert-japanese
+ title: ์ผ๋ณธ์ด Bert
+ - local: model_doc/bertweet
+ title: Bertweet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BigBird
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BigBirdPegasus
+ - local: model_doc/biogpt
+ title: BioGpt
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Blenderbot
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Blenderbot Small
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BLOOM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BORT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ByT5
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CamemBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CANINE
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CodeGen
+ - local: model_doc/cohere
+ title: Cohere
+ - local: model_doc/convbert
+ title: ConvBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CPM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CPMANT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CTRL
+ - local: model_doc/dbrx
+ title: DBRX
+ - local: model_doc/deberta
+ title: DeBERTa
+ - local: model_doc/deberta-v2
+ title: DeBERTa-v2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DialoGPT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DistilBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DPR
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ELECTRA
+ - local: model_doc/encoder-decoder
+ title: ์ธ์ฝ๋ ๋์ฝ๋ ๋ชจ๋ธ
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ERNIE
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ErnieM
+ - local: model_doc/esm
+ title: ESM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) FLAN-T5
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) FLAN-UL2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) FlauBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) FNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) FSMT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Funnel Transformer
+ - local: model_doc/gemma
+ title: Gemma
+ - local: model_doc/gemma2
+ title: Gemma2
+ - local: model_doc/openai-gpt
+ title: GPT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GPT Neo
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GPT NeoX
+ - local: model_doc/gpt_neox_japanese
+ title: GPT NeoX Japanese
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GPT-J
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GPT2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GPTBigCode
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GPTSAN Japanese
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GPTSw3
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) HerBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) I-BERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Jukebox
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LED
+ - local: model_doc/llama
+ title: LLaMA
+ - local: model_doc/llama2
+ title: LLaMA2
+ - local: model_doc/llama3
+ title: LLaMA3
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Longformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LongT5
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LUKE
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) M2M100
+ - local: model_doc/mamba
+ title: Mamba
+ - local: model_doc/mamba2
+ title: Mamba2
+ - local: model_doc/marian
+ title: MarianMT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MarkupLM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MBart and MBart-50
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MEGA
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MegatronBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MegatronGPT2
+ - local: model_doc/mistral
+ title: Mistral
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) mLUKE
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MobileBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MPNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MT5
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MVP
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) NEZHA
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) NLLB
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) NLLB-MoE
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Nystrรถmformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Open-Llama
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) OPT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Pegasus
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) PEGASUS-X
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) PhoBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) PLBart
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ProphetNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) QDQBert
+ - local: model_doc/rag
+ title: RAG(๊ฒ์ ์ฆ๊ฐ ์์ฑ)
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) REALM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Reformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) RemBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) RetriBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) RoBERTa
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) RoBERTa-PreLayerNorm
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) RoCBert
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) RoFormer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Splinter
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) SqueezeBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) SwitchTransformers
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) T5
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) T5v1.1
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) TAPEX
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Transformer XL
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) UL2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) X-MOD
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XGLM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLM-ProphetNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLM-RoBERTa
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLM-RoBERTa-XL
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLM-V
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) YOSO
+ title: (๋ฒ์ญ์ค) ํ
์คํธ ๋ชจ๋ธ
+ - isExpanded: false
+ sections:
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BEiT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BiT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Conditional DETR
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ConvNeXT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ConvNeXTV2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CvT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Deformable DETR
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DeiT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DETA
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DETR
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DiNAT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DiT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DPT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) EfficientFormer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) EfficientNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) FocalNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GLPN
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ImageGPT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LeViT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Mask2Former
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MaskFormer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MobileNetV1
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MobileNetV2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MobileViT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) NAT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) PoolFormer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) RegNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ResNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) SegFormer
+ - local: model_doc/swin
+ title: Swin Transformer
+ - local: model_doc/swinv2
+ title: Swin Transformer V2
+ - local: model_doc/swin2sr
+ title: Swin2SR
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Table Transformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) TimeSformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) UperNet
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) VAN
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) VideoMAE
+ - local: in_translation
+ title: Vision Transformer (ViT)
+ - local: model_doc/vit
+ title: (๋ฒ์ญ์ค) ViT Hybrid
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ViTMAE
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ViTMSN
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) YOLOS
+ title: (๋ฒ์ญ์ค) ๋น์ ๋ชจ๋ธ
+ - isExpanded: false
+ sections:
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Audio Spectrogram Transformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CLAP
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Hubert
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MCTCT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) SEW
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) SEW-D
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Speech2Text
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Speech2Text2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) SpeechT5
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) UniSpeech
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) UniSpeech-SAT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Wav2Vec2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Wav2Vec2-Conformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Wav2Vec2Phoneme
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) WavLM
+ - local: model_doc/whisper
+ title: Whisper
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLS-R
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) XLSR-Wav2Vec2
+ title: (๋ฒ์ญ์ค) ์ค๋์ค ๋ชจ๋ธ
+ - isExpanded: false
+ sections:
+ - local: model_doc/timesformer
+ title: TimeSformer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) VideoMAE
+ - local: model_doc/vivit
+ title: ViViT
+ title: (๋ฒ์ญ์ค) ๋น๋์ค ๋ชจ๋ธ
+ - isExpanded: false
+ sections:
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ALIGN
+ - local: model_doc/altclip
+ title: AltCLIP
+ - local: model_doc/blip-2
+ title: BLIP-2
+ - local: model_doc/blip
+ title: BLIP
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) BridgeTower
+ - local: model_doc/chameleon
+ title: Chameleon
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Chinese-CLIP
+ - local: model_doc/clip
+ title: CLIP
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) CLIPSeg
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Data2Vec
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) DePlot
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Donut
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) FLAVA
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GIT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) GroupViT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LayoutLM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LayoutLMV2
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LayoutLMV3
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LayoutXLM
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LiLT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) LXMERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MatCha
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) MGP-STR
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) OneFormer
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) OWL-ViT
+ - local: model_doc/paligemma
+ title: PaliGemma
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Perceiver
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Pix2Struct
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Segment Anything
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Speech Encoder Decoder Models
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) TAPAS
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) TrOCR
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) TVLT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) ViLT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Vision Encoder Decoder Models
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Vision Text Dual Encoder
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) VisualBERT
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) X-CLIP
+ title: (๋ฒ์ญ์ค) ๋ฉํฐ๋ชจ๋ฌ ๋ชจ๋ธ
+ - isExpanded: false
+ sections:
+ - local: in_translation
+ title: (๋ฒ์ญ์ค) Decision Transformer
+ - local: model_doc/trajectory_transformer
+ title: ๊ถค์ ํธ๋์คํฌ๋จธ
+ title: (๋ฒ์ญ์ค) ๊ฐํํ์ต ๋ชจ๋ธ
+ - isExpanded: false
+ sections:
+ - local: model_doc/autoformer
+ title: Autoformer
+ - local: model_doc/informer
+ title: Informer
+ - local: model_doc/patchtsmixer
+ title: PatchTSMixer
+ - local: model_doc/patchtst
+ title: PatchTST
+ - local: model_doc/time_series_transformer
+ title: ์๊ณ์ด ํธ๋์คํฌ๋จธ
+ title: ์๊ณ์ด ๋ชจ๋ธ
+ - isExpanded: false
+ sections:
+ - local: model_doc/graphormer
+ title: Graphormer
+ title: ๊ทธ๋ํ ๋ชจ๋ธ
+ title: (๋ฒ์ญ์ค) ๋ชจ๋ธ
+ - sections:
+ - local: internal/modeling_utils
+ title: ์ฌ์ฉ์ ์ ์ ๋ ์ด์ด ๋ฐ ์ ํธ๋ฆฌํฐ
+ - local: internal/pipelines_utils
+ title: ํ์ดํ๋ผ์ธ์ ์ํ ์ ํธ๋ฆฌํฐ
+ - local: internal/tokenization_utils
+ title: ํ ํฌ๋์ด์ ๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ
+ - local: internal/trainer_utils
+ title: Trainer๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ
+ - local: internal/generation_utils
+ title: ์์ฑ์ ์ํ ์ ํธ๋ฆฌํฐ
+ - local: internal/image_processing_utils
+ title: ์ด๋ฏธ์ง ํ๋ก์ธ์๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ
+ - local: internal/audio_utils
+ title: ์ค๋์ค ์ฒ๋ฆฌ๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ
+ - local: internal/file_utils
+ title: ์ผ๋ฐ ์ ํธ๋ฆฌํฐ
+ - local: internal/time_series_utils
+ title: ์๊ณ์ด์ ์ํ ์ ํธ๋ฆฌํฐ
+ title: (๋ฒ์ญ์ค) Internal Helpers
+ title: (๋ฒ์ญ์ค) API
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/accelerate.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/accelerate.md
new file mode 100644
index 0000000000000000000000000000000000000000..0ef8957de3ac20d38326624d60e7cd1fd349197b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/accelerate.md
@@ -0,0 +1,136 @@
+
+
+# ๐ค Accelerate๋ฅผ ํ์ฉํ ๋ถ์ฐ ํ์ต[[distributed-training-with-accelerate]]
+
+๋ชจ๋ธ์ด ์ปค์ง๋ฉด์ ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ ์ ํ๋ ํ๋์จ์ด์์ ๋ ํฐ ๋ชจ๋ธ์ ํ๋ จํ๊ณ ํ๋ จ ์๋๋ฅผ ๋ช ๋ฐฐ๋ก ๊ฐ์ํํ๊ธฐ ์ํ ์ ๋ต์ผ๋ก ๋ฑ์ฅํ์ต๋๋ค. Hugging Face์์๋ ์ฌ์ฉ์๊ฐ ํ๋์ ๋จธ์ ์ ์ฌ๋ฌ ๊ฐ์ GPU๋ฅผ ์ฌ์ฉํ๋ ์ฌ๋ฌ ๋จธ์ ์ ์ฌ๋ฌ ๊ฐ์ GPU๋ฅผ ์ฌ์ฉํ๋ ๋ชจ๋ ์ ํ์ ๋ถ์ฐ ์ค์ ์์ ๐ค Transformers ๋ชจ๋ธ์ ์ฝ๊ฒ ํ๋ จํ ์ ์๋๋ก ๋๊ธฐ ์ํด [๐ค Accelerate](https://huggingface.co/docs/accelerate) ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋ง๋ค์์ต๋๋ค. ์ด ํํ ๋ฆฌ์ผ์์๋ ๋ถ์ฐ ํ๊ฒฝ์์ ํ๋ จํ ์ ์๋๋ก ๊ธฐ๋ณธ PyTorch ํ๋ จ ๋ฃจํ๋ฅผ ์ปค์คํฐ๋ง์ด์ฆํ๋ ๋ฐฉ๋ฒ์ ์์๋ด
์๋ค.
+
+## ์ค์ [[setup]]
+
+๐ค Accelerate ์ค์น ์์ํ๊ธฐ:
+
+```bash
+pip install accelerate
+```
+
+๊ทธ ๋ค์, [`~accelerate.Accelerator`] ๊ฐ์ฒด๋ฅผ ๋ถ๋ฌ์ค๊ณ ์์ฑํฉ๋๋ค. [`~accelerate.Accelerator`]๋ ์๋์ผ๋ก ๋ถ์ฐ ์ค์ ์ ํ์ ๊ฐ์งํ๊ณ ํ๋ จ์ ํ์ํ ๋ชจ๋ ๊ตฌ์ฑ ์์๋ฅผ ์ด๊ธฐํํฉ๋๋ค. ์ฅ์น์ ๋ชจ๋ธ์ ๋ช
์์ ์ผ๋ก ๋ฐฐ์นํ ํ์๋ ์์ต๋๋ค.
+
+```py
+>>> from accelerate import Accelerator
+
+>>> accelerator = Accelerator()
+```
+
+## ๊ฐ์ํ๋ฅผ ์ํ ์ค๋น[[prepare-to-accelerate]]
+
+๋ค์ ๋จ๊ณ๋ ๊ด๋ จ๋ ๋ชจ๋ ํ๋ จ ๊ฐ์ฒด๋ฅผ [`~accelerate.Accelerator.prepare`] ๋ฉ์๋์ ์ ๋ฌํ๋ ๊ฒ์
๋๋ค. ์ฌ๊ธฐ์๋ ํ๋ จ ๋ฐ ํ๊ฐ ๋ฐ์ดํฐ๋ก๋, ๋ชจ๋ธ ๋ฐ ์ตํฐ๋ง์ด์ ๊ฐ ํฌํจ๋ฉ๋๋ค:
+
+```py
+>>> train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
+... train_dataloader, eval_dataloader, model, optimizer
+... )
+```
+
+## ๋ฐฑ์๋(Backward)[[backward]]
+
+๋ง์ง๋ง์ผ๋ก ํ๋ จ ๋ฃจํ์ ์ผ๋ฐ์ ์ธ `loss.backward()`๋ฅผ ๐ค Accelerate์ [`~accelerate.Accelerator.backward`] ๋ฉ์๋๋ก ๋์ฒดํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค:
+
+```py
+>>> for epoch in range(num_epochs):
+... for batch in train_dataloader:
+... outputs = model(**batch)
+... loss = outputs.loss
+... accelerator.backward(loss)
+
+... optimizer.step()
+... lr_scheduler.step()
+... optimizer.zero_grad()
+... progress_bar.update(1)
+```
+
+๋ค์ ์ฝ๋์์ ๋ณผ ์ ์๋ฏ์ด, ํ๋ จ ๋ฃจํ์ ์ฝ๋ ๋ค ์ค๋ง ์ถ๊ฐํ๋ฉด ๋ถ์ฐ ํ์ต์ ํ์ฑํํ ์ ์์ต๋๋ค!
+
+```diff
++ from accelerate import Accelerator
+ from transformers import AdamW, AutoModelForSequenceClassification, get_scheduler
+
++ accelerator = Accelerator()
+
+ model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
+ optimizer = AdamW(model.parameters(), lr=3e-5)
+
+- device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
+- model.to(device)
+
++ train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
++ train_dataloader, eval_dataloader, model, optimizer
++ )
+
+ num_epochs = 3
+ num_training_steps = num_epochs * len(train_dataloader)
+ lr_scheduler = get_scheduler(
+ "linear",
+ optimizer=optimizer,
+ num_warmup_steps=0,
+ num_training_steps=num_training_steps
+ )
+
+ progress_bar = tqdm(range(num_training_steps))
+
+ model.train()
+ for epoch in range(num_epochs):
+ for batch in train_dataloader:
+- batch = {k: v.to(device) for k, v in batch.items()}
+ outputs = model(**batch)
+ loss = outputs.loss
+- loss.backward()
++ accelerator.backward(loss)
+
+ optimizer.step()
+ lr_scheduler.step()
+ optimizer.zero_grad()
+ progress_bar.update(1)
+```
+
+## ํ์ต[[train]]
+
+๊ด๋ จ ์ฝ๋๋ฅผ ์ถ๊ฐํ ํ์๋ ์คํฌ๋ฆฝํธ๋ Colaboratory์ ๊ฐ์ ๋
ธํธ๋ถ์์ ํ๋ จ์ ์์ํ์ธ์.
+
+### ์คํฌ๋ฆฝํธ๋ก ํ์ตํ๊ธฐ[[train-with-a-script]]
+
+์คํฌ๋ฆฝํธ์์ ํ๋ จ์ ์คํํ๋ ๊ฒฝ์ฐ, ๋ค์ ๋ช
๋ น์ ์คํํ์ฌ ๊ตฌ์ฑ ํ์ผ์ ์์ฑํ๊ณ ์ ์ฅํฉ๋๋ค:
+
+```bash
+accelerate config
+```
+
+Then launch your training with:
+
+```bash
+accelerate launch train.py
+```
+
+### ๋
ธํธ๋ถ์ผ๋ก ํ์ตํ๊ธฐ[[train-with-a-notebook]]
+
+Collaboratory์ TPU๋ฅผ ์ฌ์ฉํ๋ ค๋ ๊ฒฝ์ฐ, ๋
ธํธ๋ถ์์๋ ๐ค Accelerate๋ฅผ ์คํํ ์ ์์ต๋๋ค. ํ๋ จ์ ๋ด๋นํ๋ ๋ชจ๋ ์ฝ๋๋ฅผ ํจ์๋ก ๊ฐ์ธ์ [`~accelerate.notebook_launcher`]์ ์ ๋ฌํ์ธ์:
+
+```py
+>>> from accelerate import notebook_launcher
+
+>>> notebook_launcher(training_function)
+```
+
+๐ค Accelerate ๋ฐ ๋ค์ํ ๊ธฐ๋ฅ์ ๋ํ ์์ธํ ๋ด์ฉ์ [documentation](https://huggingface.co/docs/accelerate)๋ฅผ ์ฐธ์กฐํ์ธ์.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/add_new_model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/add_new_model.md
new file mode 100644
index 0000000000000000000000000000000000000000..d5834777d31eefbb00188d11ce1c115557793eab
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/add_new_model.md
@@ -0,0 +1,626 @@
+
+
+# Hugging Face Transformers๋ฅผ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ๋ฌด์์ธ๊ฐ์? [[how-to-add-a-model-to-transformers]]
+
+Hugging Face Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ์ปค๋ฎค๋ํฐ ๊ธฐ์ฌ์๋ค ๋๋ถ์ ์๋ก์ด ๋ชจ๋ธ์ ์ ๊ณตํ ์ ์๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค. ํ์ง๋ง ์ด๋ ๋์ ์ ์ธ ํ๋ก์ ํธ์ด๋ฉฐ Hugging Face Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ตฌํํ ๋ชจ๋ธ์ ๋ํ ๊น์ ์ดํด๊ฐ ํ์ํฉ๋๋ค. Hugging Face์์๋ ๋ ๋ง์ ์ปค๋ฎค๋ํฐ ๋ฉค๋ฒ๊ฐ ๋ชจ๋ธ์ ์ ๊ทน์ ์ผ๋ก ์ถ๊ฐํ ์ ์๋๋ก ์ง์ํ๊ณ ์ ํ๋ฉฐ, ์ด ๊ฐ์ด๋๋ฅผ ํตํด PyTorch ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ๊ณผ์ ์ ์๋ดํ๊ณ ์์ต๋๋ค (PyTorch๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํด์ฃผ์ธ์).
+
+์ด ๊ณผ์ ์ ์งํํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ๋ด์ฉ์ ์ดํดํ๊ฒ ๋ฉ๋๋ค:
+
+- ์คํ ์์ค์ ๋ชจ๋ฒ ์ฌ๋ก์ ๋ํ ํต์ฐฐ๋ ฅ์ ์ป์ต๋๋ค.
+- ๊ฐ์ฅ ์ธ๊ธฐ ์๋ ๋ฅ๋ฌ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ค๊ณ ์์น์ ์ดํดํฉ๋๋ค.
+- ๋๊ท๋ชจ ๋ชจ๋ธ์ ํจ์จ์ ์ผ๋ก ํ
์คํธํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์๋๋ค.
+- `black`, `ruff`, `make fix-copies`์ ๊ฐ์ Python ์ ํธ๋ฆฌํฐ๋ฅผ ํตํฉํ์ฌ ๊น๋ํ๊ณ ๊ฐ๋
์ฑ ์๋ ์ฝ๋๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์๋๋ค.
+
+Hugging Face ํ์ ํญ์ ๋์์ ์ค ์ค๋น๊ฐ ๋์ด ์์ผ๋ฏ๋ก ํผ์๊ฐ ์๋๋ผ๋ ์ ์ ๊ธฐ์ตํ์ธ์. ๐ค โค๏ธ
+
+์์์ ์์ ๐ค Transformers์ ์ํ๋ ๋ชจ๋ธ์ ์ถ๊ฐํ๊ธฐ ์ํด [New model addition](https://github.com/huggingface/transformers/issues/new?assignees=&labels=New+model&template=new-model-addition.yml) ์ด์๋ฅผ ์ด์ด์ผ ํฉ๋๋ค. ํน์ ๋ชจ๋ธ์ ๊ธฐ์ฌํ๋ ๋ฐ ํน๋ณํ ๊น๋ค๋ก์ด ๊ธฐ์ค์ ๊ฐ์ง์ง ์๋ ๊ฒฝ์ฐ [New model label](https://github.com/huggingface/transformers/labels/New%20model)์ ํํฐ๋งํ์ฌ ์์ฒญ๋์ง ์์ ๋ชจ๋ธ์ด ์๋์ง ํ์ธํ๊ณ ์์
ํ ์ ์์ต๋๋ค.
+
+์๋ก์ด ๋ชจ๋ธ ์์ฒญ์ ์ด์๋ค๋ฉด ์ฒซ ๋ฒ์งธ ๋จ๊ณ๋ ๐ค Transformers์ ์ต์ํด์ง๋ ๊ฒ์
๋๋ค!
+
+## ๐ค Transformers์ ์ ๋ฐ์ ์ธ ๊ฐ์ [[general-overview-of-transformers]]
+
+๋จผ์ ๐ค Transformers์ ๋ํ ์ ๋ฐ์ ์ธ ๊ฐ์๋ฅผ ํ์
ํด์ผ ํฉ๋๋ค. ๐ค Transformers๋ ๋งค์ฐ ์ฃผ๊ด์ ์ธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ด๊ธฐ ๋๋ฌธ์ ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ฒ ํ์ด๋ ์ค๊ณ ์ ํ ์ฌํญ์ ๋์ํ์ง ์์ ์๋ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ฐ๋ฆฌ์ ๊ฒฝํ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ธฐ๋ณธ์ ์ธ ์ค๊ณ ์ ํ๊ณผ ์ฒ ํ์ ๐ค Transformers์ ๊ท๋ชจ๋ฅผ ํจ์จ์ ์ผ๋ก ํ์ฅํ๋ฉด์ ์ ์ง ๋ณด์ ๋น์ฉ์ ํฉ๋ฆฌ์ ์ธ ์์ค์ผ๋ก ์ ์งํ๋ ๊ฒ์
๋๋ค.
+
+[๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ฒ ํ์ ๋ํ ๋ฌธ์](philosophy)๋ฅผ ์ฝ๋ ๊ฒ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋ ์ ์ดํดํ๋ ์ข์ ์์์ ์
๋๋ค. ๋ชจ๋ ๋ชจ๋ธ์ ์ ์ฉํ๋ ค๋ ๋ช ๊ฐ์ง ์์
๋ฐฉ์์ ๋ํ ์ ํ ์ฌํญ์ด ์์ต๋๋ค:
+
+- ์ผ๋ฐ์ ์ผ๋ก ์ถ์ํ๋ณด๋ค๋ ๊ตฌ์ฑ์ ์ ํธํฉ๋๋ค.
+- ์ฝ๋๋ฅผ ๋ณต์ ํ๋ ๊ฒ์ด ํญ์ ๋์ ๊ฒ์ ์๋๋๋ค. ์ฝ๋์ ๊ฐ๋
์ฑ์ด๋ ์ ๊ทผ์ฑ์ ํฌ๊ฒ ํฅ์์ํจ๋ค๋ฉด ๋ณต์ ํ๋ ๊ฒ์ ์ข์ต๋๋ค.
+- ๋ชจ๋ธ ํ์ผ์ ๊ฐ๋ฅํ ํ ๋
๋ฆฝ์ ์ผ๋ก ์ ์ง๋์ด์ผ ํฉ๋๋ค. ๋ฐ๋ผ์ ํน์ ๋ชจ๋ธ์ ์ฝ๋๋ฅผ ์ฝ์ ๋ ํด๋น `modeling_....py` ํ์ผ๋ง ํ์ธํ๋ฉด ๋ฉ๋๋ค.
+
+์ฐ๋ฆฌ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ฝ๋๊ฐ ์ ํ์ ์ ๊ณตํ๋ ์๋จ๋ฟ๋ง ์๋๋ผ ๊ฐ์ ํ๊ณ ์ ํ๋ ์ ํ์ด๋ผ๊ณ ๋ ์๊ฐํฉ๋๋ค. ๋ฐ๋ผ์ ๋ชจ๋ธ์ ์ถ๊ฐํ ๋, ์ฌ์ฉ์๋ ๋ชจ๋ธ์ ์ฌ์ฉํ ์ฌ๋๋ฟ๋ง ์๋๋ผ ์ฝ๋๋ฅผ ์ฝ๊ณ ์ดํดํ๊ณ ํ์ํ ๊ฒฝ์ฐ ์กฐ์ ํ ์ ์๋ ๋ชจ๋ ์ฌ๋๊น์ง๋ ํฌํจํ๋ค๋ ์ ์ ๊ธฐ์ตํด์ผ ํฉ๋๋ค.
+
+์ด๋ฅผ ์ผ๋์ ๋๊ณ ์ผ๋ฐ์ ์ธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ค๊ณ์ ๋ํด ์กฐ๊ธ ๋ ์์ธํ ์์๋ณด๊ฒ ์ต๋๋ค.
+
+### ๋ชจ๋ธ ๊ฐ์ [[overview-of-models]]
+
+๋ชจ๋ธ์ ์ฑ๊ณต์ ์ผ๋ก ์ถ๊ฐํ๋ ค๋ฉด ๋ชจ๋ธ๊ณผ ํด๋น ๊ตฌ์ฑ์ธ [`PreTrainedModel`] ๋ฐ [`PretrainedConfig`] ๊ฐ์ ์ํธ์์ฉ์ ์ดํดํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ๐ค Transformers์ ์ถ๊ฐํ๋ ค๋ ๋ชจ๋ธ์ `BrandNewBert`๋ผ๊ณ ๋ถ๋ฅด๊ฒ ์ต๋๋ค.
+
+๋ค์์ ์ดํด๋ณด๊ฒ ์ต๋๋ค:
+
+
+
+๋ณด๋ค์ํผ, ๐ค Transformers์์๋ ์์์ ์ฌ์ฉํ์ง๋ง ์ถ์ํ ์์ค์ ์ต์ํ์ผ๋ก ์ ์งํฉ๋๋ค. ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ด๋ค ๋ชจ๋ธ์์๋ ๋ ์์ค ์ด์์ ์ถ์ํ๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค. `BrandNewBertModel`์ `BrandNewBertPreTrainedModel`์์ ์์๋ฐ๊ณ , ์ด ํด๋์ค๋ [`PreTrainedModel`]์์ ์์๋ฐ์ต๋๋ค. ์ด๋ก์จ ์๋ก์ด ๋ชจ๋ธ์ [`PreTrainedModel`]์๋ง ์์กดํ๋๋ก ํ๋ ค๊ณ ํฉ๋๋ค. ๋ชจ๋ ์๋ก์ด ๋ชจ๋ธ์ ์๋์ผ๋ก ์ ๊ณต๋๋ ์ค์ํ ๊ธฐ๋ฅ์ [`~PreTrainedModel.from_pretrained`] ๋ฐ [`~PreTrainedModel.save_pretrained`]์
๋๋ค. ์ด๋ฌํ ๊ธฐ๋ฅ ์ธ์๋ `BrandNewBertModel.forward`์ ๊ฐ์ ๋ค๋ฅธ ์ค์ํ ๊ธฐ๋ฅ์ ์๋ก์ด `modeling_brand_new_bert.py` ์คํฌ๋ฆฝํธ์์ ์์ ํ ์ ์๋์ด์ผ ํฉ๋๋ค. ๋ํ `BrandNewBertForMaskedLM`๊ณผ ๊ฐ์ ํน์ ํค๋ ๋ ์ด์ด๋ฅผ ๊ฐ์ง ๋ชจ๋ธ์ `BrandNewBertModel`์ ์์๋ฐ์ง ์๊ณ forward pass์์ ํธ์ถํ ์ ์๋ `BrandNewBertModel`์ ์ฌ์ฉํ์ฌ ์ถ์ํ ์์ค์ ๋ฎ๊ฒ ์ ์งํฉ๋๋ค. ๋ชจ๋ ์๋ก์ด ๋ชจ๋ธ์ `BrandNewBertConfig`๋ผ๋ ๊ตฌ์ฑ ํด๋์ค๋ฅผ ํ์๋ก ํฉ๋๋ค. ์ด ๊ตฌ์ฑ์ ํญ์ [`PreTrainedModel`]์ ์์ฑ์ผ๋ก ์ ์ฅ๋๋ฉฐ, ๋ฐ๋ผ์ `BrandNewBertPreTrainedModel`์ ์์๋ฐ๋ ๋ชจ๋ ํด๋์ค์์ `config` ์์ฑ์ ํตํด ์ก์ธ์คํ ์ ์์ต๋๋ค:
+
+```python
+model = BrandNewBertModel.from_pretrained("brandy/brand_new_bert")
+model.config # model has access to its config
+```
+
+๋ชจ๋ธ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ๊ตฌ์ฑ์ [`PretrainedConfig`]์์ ๊ธฐ๋ณธ ์ง๋ ฌํ ๋ฐ ์ญ์ง๋ ฌํ ๊ธฐ๋ฅ์ ์์๋ฐ์ต๋๋ค. ๊ตฌ์ฑ๊ณผ ๋ชจ๋ธ์ ํญ์ *pytorch_model.bin* ํ์ผ๊ณผ *config.json* ํ์ผ๋ก ๊ฐ๊ฐ ๋ณ๋๋ก ์ง๋ ฌํ๋ฉ๋๋ค. [`~PreTrainedModel.save_pretrained`]๋ฅผ ํธ์ถํ๋ฉด ์๋์ผ๋ก [`~PretrainedConfig.save_pretrained`]๋ ํธ์ถ๋๋ฏ๋ก ๋ชจ๋ธ๊ณผ ๊ตฌ์ฑ์ด ๋ชจ๋ ์ ์ฅ๋ฉ๋๋ค.
+
+
+### ์ฝ๋ ์คํ์ผ [[code-style]]
+
+์๋ก์ด ๋ชจ๋ธ์ ์์ฑํ ๋, Transformers๋ ์ฃผ๊ด์ ์ธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ด๋ฉฐ ๋ช ๊ฐ์ง ๋
ํนํ ์ฝ๋ฉ ์คํ์ผ์ด ์์ต๋๋ค:
+
+1. ๋ชจ๋ธ์ forward pass๋ ๋ชจ๋ธ ํ์ผ์ ์์ ํ ์์ฑ๋์ด์ผ ํฉ๋๋ค. ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ค๋ฅธ ๋ชจ๋ธ์์ ๋ธ๋ก์ ์ฌ์ฌ์ฉํ๋ ค๋ฉด ์ฝ๋๋ฅผ ๋ณต์ฌํ์ฌ ์์ `# Copied from` ์ฃผ์๊ณผ ํจ๊ป ๋ถ์ฌ๋ฃ์ผ๋ฉด ๋ฉ๋๋ค (์: [์ฌ๊ธฐ](https://github.com/huggingface/transformers/blob/v4.17.0/src/transformers/models/roberta/modeling_roberta.py#L160)๋ฅผ ์ฐธ์กฐํ์ธ์).
+2. ์ฝ๋๋ ์์ ํ ์ดํดํ๊ธฐ ์ฌ์์ผ ํฉ๋๋ค. ๋ณ์ ์ด๋ฆ์ ๋ช
ํํ๊ฒ ์ง์ ํ๊ณ ์ฝ์ด๋ฅผ ์ฌ์ฉํ์ง ์๋ ๊ฒ์ด ์ข์ต๋๋ค. ์๋ฅผ ๋ค์ด, `act`๋ณด๋ค๋ `activation`์ ์ ํธํฉ๋๋ค. ํ ๊ธ์ ๋ณ์ ์ด๋ฆ์ ๋ฃจํ์ ์ธ๋ฑ์ค์ธ ๊ฒฝ์ฐ๋ฅผ ์ ์ธํ๊ณ ๊ถ์ฅ๋์ง ์์ต๋๋ค.
+3. ๋ ์ผ๋ฐ์ ์ผ๋ก, ์งง์ ๋ง๋ฒ ๊ฐ์ ์ฝ๋๋ณด๋ค๋ ๊ธธ๊ณ ๋ช
์์ ์ธ ์ฝ๋๋ฅผ ์ ํธํฉ๋๋ค.
+4. PyTorch์์ `nn.Sequential`์ ํ์ ํด๋์ค๋ก ๋ง๋ค์ง ๋ง๊ณ `nn.Module`์ ํ์ ํด๋์ค๋ก ๋ง๋ค๊ณ forward pass๋ฅผ ์์ฑํ์ฌ ๋ค๋ฅธ ์ฌ๋์ด ์ฝ๋๋ฅผ ๋น ๋ฅด๊ฒ ๋๋ฒ๊ทธํ ์ ์๋๋ก ํฉ๋๋ค. print ๋ฌธ์ด๋ ์ค๋จ์ ์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
+5. ํจ์ ์๊ทธ๋์ฒ์๋ ํ์
์ฃผ์์ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ๊ทธ ์ธ์๋ ํ์
์ฃผ์๋ณด๋ค ๋ณ์ ์ด๋ฆ์ด ํจ์ฌ ์ฝ๊ธฐ ์ฝ๊ณ ์ดํดํ๊ธฐ ์ฝ์ต๋๋ค.
+
+### ํ ํฌ๋์ด์ ๊ฐ์ [[overview-of-tokenizers]]
+
+์์ง ์ค๋น๋์ง ์์์ต๋๋ค :-( ์ด ์น์
์ ๊ณง ์ถ๊ฐ๋ ์์ ์
๋๋ค!
+
+## ๐ค Transformers์ ๋ชจ๋ธ ์ถ๊ฐํ๋ ๋จ๊ณ๋ณ ๋ฐฉ๋ฒ [[stepbystep-recipe-to-add-a-model-to-transformers]]
+
+๊ฐ์ ๋ชจ๋ธ์ ์ด์ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์ ํธ๊ฐ ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ ๋ค๋ฅธ ๊ธฐ์ฌ์๋ค์ด Hugging Face์ ๋ชจ๋ธ์ ์ด์ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ฝ์ ์ดํด๋ณด๋ ๊ฒ์ด ๋งค์ฐ ์ ์ฉํ ์ ์์ต๋๋ค. ๋ค์์ ๋ชจ๋ธ์ ์ด์ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์ปค๋ฎค๋ํฐ ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ ๋ชฉ๋ก์
๋๋ค:
+
+1. [GPT2 ๋ชจ๋ธ ์ด์ํ๊ธฐ](https://medium.com/huggingface/from-tensorflow-to-pytorch-265f40ef2a28) - [Thomas](https://huggingface.co/thomwolf)
+2. [WMT19 MT ๋ชจ๋ธ ์ด์ํ๊ธฐ](https://huggingface.co/blog/porting-fsmt) - [Stas](https://huggingface.co/stas)
+
+๊ฒฝํ์ ๋ชจ๋ธ์ ์ถ๊ฐํ ๋ ์ฃผ์ํด์ผ ํ ๊ฐ์ฅ ์ค์ํ ์ฌํญ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+- ๊ฐ์ ์ผ์ ๋ฐ๋ณตํ์ง ๋ง์ธ์! ์๋ก์ด ๐ค Transformers ๋ชจ๋ธ์ ์ํด ์ถ๊ฐํ ์ฝ๋์ ๋๋ถ๋ถ์ ์ด๋ฏธ ๐ค Transformers ์ด๋๊ฐ์ ์กด์ฌํฉ๋๋ค. ์ด๋ฏธ ์กด์ฌํ๋ ๋ณต์ฌํ ์ ์๋ ์ ์ฌํ ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ฅผ ์ฐพ๋๋ฐ ์๊ฐ์ ํฌ์ํ์ธ์. [grep](https://www.gnu.org/software/grep/)์ [rg](https://github.com/BurntSushi/ripgrep)๋ฅผ ์ฐธ๊ณ ํ์ธ์. ๋ชจ๋ธ์ ํ ํฌ๋์ด์ ๊ฐ ํ ๋ชจ๋ธ์ ๊ธฐ๋ฐ์ผ๋ก ํ๊ณ ๋ชจ๋ธ๋ง ์ฝ๋๊ฐ ๋ค๋ฅธ ๋ชจ๋ธ์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ ๊ฒฝ์ฐ๊ฐ ์กด์ฌํ ์๋ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด FSMT์ ๋ชจ๋ธ๋ง ์ฝ๋๋ BART๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๊ณ FSMT์ ํ ํฌ๋์ด์ ์ฝ๋๋ XLM์ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค.
+- ์ด๊ฒ์ ๊ณผํ์ ์ธ ๋์ ๋ณด๋ค๋ ๊ณตํ์ ์ธ ๋์ ์
๋๋ค. ๋
ผ๋ฌธ์ ๋ชจ๋ธ์ ๋ชจ๋ ์ด๋ก ์ ์ธก๋ฉด์ ์ดํดํ๋ ค๋ ๊ฒ๋ณด๋ค ํจ์จ์ ์ธ ๋๋ฒ๊น
ํ๊ฒฝ์ ๋ง๋๋ ๋ฐ ๋ ๋ง์ ์๊ฐ์ ์๋นํด์ผ ํฉ๋๋ค.
+- ๋งํ ๋ ๋์์ ์์ฒญํ์ธ์! ๋ชจ๋ธ์ ๐ค Transformers์ ํต์ฌ ๊ตฌ์ฑ ์์์ด๋ฏ๋ก Hugging Face์ ์ฐ๋ฆฌ๋ ๋น์ ์ด ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ๊ฐ ๋จ๊ณ์์ ๊ธฐ๊บผ์ด ๋์์ ์ค ์ค๋น๊ฐ ๋์ด ์์ต๋๋ค. ์ง์ ์ด ์๋ค๊ณ ๋๋ผ๋ฉด ์ฃผ์ ํ์ง ๋ง๊ณ ๋์์ ์์ฒญํ์ธ์.
+
+๋ค์์์๋ ๋ชจ๋ธ์ ๐ค Transformers๋ก ์ด์ํ๋ ๋ฐ ๊ฐ์ฅ ์ ์ฉํ ์ผ๋ฐ์ ์ธ ์ ์ฐจ๋ฅผ ์ ๊ณตํ๋ ค๊ณ ๋
ธ๋ ฅํฉ๋๋ค.
+
+๋ค์ ๋ชฉ๋ก์ ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ๋ฐ ์ํํด์ผ ํ ๋ชจ๋ ์์
์ ์์ฝ์ด๋ฉฐ To-Do ๋ชฉ๋ก์ผ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค:
+
+โ (์ ํ ์ฌํญ) BrandNewBert์ ์ด๋ก ์ ์ธก๋ฉด ์ดํด
+โ Hugging Face ๊ฐ๋ฐ ํ๊ฒฝ ์ค๋น
+โ ์๋ณธ ๋ฆฌํฌ์งํ ๋ฆฌ์ ๋๋ฒ๊น
ํ๊ฒฝ ์ค์
+โ ์๋ณธ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ์ฉํ์ฌ `forward()` pass๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์คํ๋๋ ์คํฌ๋ฆฝํธ ์์ฑ
+โ ๐ค Transformers์ ๋ชจ๋ธ ์ค์ผ๋ ํค ์ฑ๊ณต์ ์ผ๋ก ์ถ๊ฐ
+โ ์๋ณธ ์ฒดํฌํฌ์ธํธ๋ฅผ ๐ค Transformers ์ฒดํฌํฌ์ธํธ๋ก ์ฑ๊ณต์ ์ผ๋ก ๋ณํ
+โ ๐ค Transformers์์ ์๋ณธ ์ฒดํฌํฌ์ธํธ์ ๋์ผํ ์ถ๋ ฅ์ ๋ด์ฃผ๋ `forward()` pass ์ฑ๊ณต์ ์ผ๋ก ์คํ
+โ ๐ค Transformers์์ ๋ชจ๋ธ ํ
์คํธ ์๋ฃ
+โ ๐ค Transformers์ ํ ํฌ๋์ด์ ์ฑ๊ณต์ ์ผ๋ก ์ถ๊ฐ
+โ ์ข
๋จ ๊ฐ ํตํฉ ํ
์คํธ ์คํ
+โ ๋ฌธ์ ์์ฑ ์๋ฃ
+โ ๋ชจ๋ธ ๊ฐ์ค์น๋ฅผ ํ๋ธ์ ์
๋ก๋
+โ Pull request ์ ์ถ
+โ (์ ํ ์ฌํญ) ๋ฐ๋ชจ ๋
ธํธ๋ถ ์ถ๊ฐ
+
+์ฐ์ , ์ผ๋ฐ์ ์ผ๋ก๋ `BrandNewBert`์ ์ด๋ก ์ ์ธ ์ดํด๋ก ์์ํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ด๋ก ์ ์ธก๋ฉด์ ์ง์ ์ดํดํ๋ ๋์ *์ง์ ํด๋ณด๋ฉด์* ๋ชจ๋ธ์ ์ด๋ก ์ ์ธก๋ฉด์ ์ดํดํ๋ ๊ฒ์ ์ ํธํ๋ ๊ฒฝ์ฐ ๋ฐ๋ก `BrandNewBert` ์ฝ๋ ๋ฒ ์ด์ค๋ก ๋น ์ ธ๋๋ ๊ฒ๋ ๊ด์ฐฎ์ต๋๋ค. ์ด ์ต์
์ ์์ง๋์ด๋ง ๊ธฐ์ ์ด ์ด๋ก ์ ๊ธฐ์ ๋ณด๋ค ๋ ๋ฐ์ด๋ ๊ฒฝ์ฐ, `BrandNewBert`์ ๋
ผ๋ฌธ์ ์ดํดํ๋ ๋ฐ ์ด๋ ค์์ด ์๋ ๊ฒฝ์ฐ, ๋๋ ๊ณผํ์ ์ธ ๋
ผ๋ฌธ์ ์ฝ๋ ๊ฒ๋ณด๋ค ํ๋ก๊ทธ๋๋ฐ์ ํจ์ฌ ๋ ํฅ๋ฏธ ์๋ ๊ฒฝ์ฐ์ ๋ ์ ํฉํ ์ ์์ต๋๋ค.
+
+### 1. (์ ํ ์ฌํญ) BrandNewBert์ ์ด๋ก ์ ์ธก๋ฉด [[1-optional-theoretical-aspects-of-brandnewbert]]
+
+๋ง์ฝ ๊ทธ๋ฐ ์์ ์ ์ธ ์์
์ด ์กด์ฌํ๋ค๋ฉด, *BrandNewBert*์ ๋
ผ๋ฌธ์ ์ฝ์ด๋ณด๋ ์๊ฐ์ ๊ฐ์ ธ์ผ ํฉ๋๋ค. ์ดํดํ๊ธฐ ์ด๋ ค์ด ์น์
์ด ๋ง์ ์ ์์ต๋๋ค. ๊ทธ๋ ๋๋ผ๋ ๊ฑฑ์ ํ์ง ๋ง์ธ์! ๋ชฉํ๋ ๋
ผ๋ฌธ์ ๊น์ ์ด๋ก ์ ์ดํด๊ฐ ์๋๋ผ *BrandNewBert*๋ฅผ ๐ค Transformers์์ ํจ๊ณผ์ ์ผ๋ก ์ฌ๊ตฌํํ๊ธฐ ์ํด ํ์ํ ์ ๋ณด๋ฅผ ์ถ์ถํ๋ ๊ฒ์
๋๋ค. ์ด๋ฅผ ์ํด ์ด๋ก ์ ์ธก๋ฉด์ ๋๋ฌด ๋ง์ ์๊ฐ์ ํฌ์ํ ํ์๋ ์์ง๋ง ๋ค์๊ณผ ๊ฐ์ ์ค์ ์ ์ธ ์ธก๋ฉด์ ์ง์คํด์ผ ํฉ๋๋ค:
+
+- *BrandNewBert*๋ ์ด๋ค ์ ํ์ ๋ชจ๋ธ์ธ๊ฐ์? BERT์ ์ ์ฌํ ์ธ์ฝ๋ ๋ชจ๋ธ์ธ๊ฐ์? GPT2์ ์ ์ฌํ ๋์ฝ๋ ๋ชจ๋ธ์ธ๊ฐ์? BART์ ์ ์ฌํ ์ธ์ฝ๋-๋์ฝ๋ ๋ชจ๋ธ์ธ๊ฐ์? ์ด๋ค ๊ฐ์ ์ฐจ์ด์ ์ ์ต์ํ์ง ์์ ๊ฒฝ์ฐ[model_summary](model_summary)๋ฅผ ์ฐธ์กฐํ์ธ์.
+- *BrandNewBert*์ ์์ฉ ๋ถ์ผ๋ ๋ฌด์์ธ๊ฐ์? ํ
์คํธ ๋ถ๋ฅ์ธ๊ฐ์? ํ
์คํธ ์์ฑ์ธ๊ฐ์? ์์ฝ๊ณผ ๊ฐ์ Seq2Seq ์์
์ธ๊ฐ์?
+- *brand_new_bert*์ BERT/GPT-2/BART์ ์ฐจ์ด์ ์ ๋ฌด์์ธ๊ฐ์?
+- *brand_new_bert*์ ๊ฐ์ฅ ์ ์ฌํ [๐ค Transformers ๋ชจ๋ธ](https://huggingface.co/transformers/#contents)์ ๋ฌด์์ธ๊ฐ์?
+- ์ด๋ค ์ข
๋ฅ์ ํ ํฌ๋์ด์ ๊ฐ ์ฌ์ฉ๋๋์? Sentencepiece ํ ํฌ๋์ด์ ์ธ๊ฐ์? Word piece ํ ํฌ๋์ด์ ์ธ๊ฐ์? BERT ๋๋ BART์ ์ฌ์ฉ๋๋ ๋์ผํ ํ ํฌ๋์ด์ ์ธ๊ฐ์?
+
+๋ชจ๋ธ์ ์ํคํ
์ฒ์ ๋ํด ์ถฉ๋ถํ ์ดํดํ๋ค๋ ์๊ฐ์ด ๋ ํ, ๊ถ๊ธํ ์ฌํญ์ด ์์ผ๋ฉด Hugging Face ํ์ ๋ฌธ์ํ์ญ์์ค. ์ด๋ ๋ชจ๋ธ์ ์ํคํ
์ฒ, ์ดํ
์
๋ ์ด์ด ๋ฑ์ ๊ดํ ์ง๋ฌธ์ ํฌํจํ ์ ์์ต๋๋ค. Hugging Face์ ์ ์ง ๊ด๋ฆฌ์๋ค์ ๋ณดํต ์ฝ๋๋ฅผ ๊ฒํ ํ๋ ๊ฒ์ ๋ํด ๋งค์ฐ ๊ธฐ๋ปํ๋ฏ๋ก ๋น์ ์ ๋๋ ์ผ์ ๋งค์ฐ ํ์ํ ๊ฒ์
๋๋ค!
+
+### 2. ๊ฐ๋ฐ ํ๊ฒฝ ์ค์ [[2-next-prepare-your-environment]]
+
+1. ์ ์ฅ์ ํ์ด์ง์์ "Fork" ๋ฒํผ์ ํด๋ฆญํ์ฌ ์ ์ฅ์์ ์ฌ๋ณธ์ GitHub ์ฌ์ฉ์ ๊ณ์ ์ผ๋ก ๋ง๋ญ๋๋ค.
+
+2. `transformers` fork๋ฅผ ๋ก์ปฌ ๋์คํฌ์ ํด๋ก ํ๊ณ ๋ฒ ์ด์ค ์ ์ฅ์๋ฅผ ์๊ฒฉ ์ ์ฅ์๋ก ์ถ๊ฐํฉ๋๋ค:
+
+```bash
+git clone https://github.com/[your Github handle]/transformers.git
+cd transformers
+git remote add upstream https://github.com/huggingface/transformers.git
+```
+
+3. ๊ฐ๋ฐ ํ๊ฒฝ์ ์ค์ ํฉ๋๋ค. ๋ค์ ๋ช
๋ น์ ์คํํ์ฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ค์ ํ ์ ์์ต๋๋ค:
+
+```bash
+python -m venv .env
+source .env/bin/activate
+pip install -e ".[dev]"
+```
+
+๊ฐ ์ด์ ์ฒด์ ์ ๋ฐ๋ผ Transformers์ ์ ํ์ ์์กด์ฑ์ด ๊ฐ์๊ฐ ์ฆ๊ฐํ๋ฉด ์ด ๋ช
๋ น์ด ์คํจํ ์ ์์ต๋๋ค. ๊ทธ๋ฐ ๊ฒฝ์ฐ์๋ ์์
์ค์ธ ๋ฅ ๋ฌ๋ ํ๋ ์์ํฌ (PyTorch, TensorFlow ๋ฐ/๋๋ Flax)์ ์ค์นํ ํ, ๋ค์ ๋ช
๋ น์ ์ํํ๋ฉด ๋ฉ๋๋ค:
+
+```bash
+pip install -e ".[quality]"
+```
+
+๋๋ถ๋ถ์ ๊ฒฝ์ฐ์๋ ์ด๊ฒ์ผ๋ก ์ถฉ๋ถํฉ๋๋ค. ๊ทธ๋ฐ ๋ค์ ์์ ๋๋ ํ ๋ฆฌ๋ก ๋์๊ฐ๋๋ค.
+
+```bash
+cd ..
+```
+
+4. Transformers์ *brand_new_bert*์ PyTorch ๋ฒ์ ์ ์ถ๊ฐํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. PyTorch๋ฅผ ์ค์นํ๋ ค๋ฉด ๋ค์ ๋งํฌ์ ์ง์นจ์ ๋ฐ๋ฅด์ญ์์ค: https://pytorch.org/get-started/locally/.
+
+**์ฐธ๊ณ :** CUDA๋ฅผ ์ค์นํ ํ์๋ ์์ต๋๋ค. ์๋ก์ด ๋ชจ๋ธ์ด CPU์์ ์๋ํ๋๋ก ๋ง๋๋ ๊ฒ์ผ๋ก ์ถฉ๋ถํฉ๋๋ค.
+
+5. *brand_new_bert*๋ฅผ ์ด์ํ๊ธฐ ์ํด์๋ ํด๋น ์๋ณธ ์ ์ฅ์์ ์ ๊ทผํ ์ ์์ด์ผ ํฉ๋๋ค:
+
+```bash
+git clone https://github.com/org_that_created_brand_new_bert_org/brand_new_bert.git
+cd brand_new_bert
+pip install -e .
+```
+
+์ด์ *brand_new_bert*๋ฅผ ๐ค Transformers๋ก ์ด์ํ๊ธฐ ์ํ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ค์ ํ์์ต๋๋ค.
+
+### 3.-4. ์๋ณธ ์ ์ฅ์์์ ์ฌ์ ํ๋ จ๋ ์ฒดํฌํฌ์ธํธ ์คํํ๊ธฐ [[3.-4.-run-a-pretrained-checkpoint-using-the-original-repository]]
+
+๋จผ์ , ์๋ณธ *brand_new_bert* ์ ์ฅ์์์ ์์
์ ์์ํฉ๋๋ค. ์๋ณธ ๊ตฌํ์ ๋ณดํต "์ฐ๊ตฌ์ฉ"์ผ๋ก ๋ง์ด ์ฌ์ฉ๋ฉ๋๋ค. ์ฆ, ๋ฌธ์ํ๊ฐ ๋ถ์กฑํ๊ณ ์ฝ๋๊ฐ ์ดํดํ๊ธฐ ์ด๋ ค์ธ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด๊ฒ์ด ๋ฐ๋ก *brand_new_bert*๋ฅผ ๋ค์ ๊ตฌํํ๋ ค๋ ๋๊ธฐ๊ฐ ๋์ด์ผ ํฉ๋๋ค. Hugging Face์์์ ์ฃผ์ ๋ชฉํ ์ค ํ๋๋ **๊ฑฐ์ธ์ ์ด๊นจ ์์ ์๋ ๊ฒ**์ด๋ฉฐ, ์ด๋ ์ฌ๊ธฐ์์ ์ฝ๊ฒ ํด์๋์ด ๋์ํ๋ ๋ชจ๋ธ์ ๊ฐ์ ธ์์ ๊ฐ๋ฅํ ํ **์ ๊ทผ ๊ฐ๋ฅํ๊ณ ์ฌ์ฉ์ ์นํ์ ์ด๋ฉฐ ์๋ฆ๋ต๊ฒ** ๋ง๋๋ ๊ฒ์
๋๋ค. ์ด๊ฒ์ ๐ค Transformers์์ ๋ชจ๋ธ์ ๋ค์ ๊ตฌํํ๋ ๊ฐ์ฅ ์ค์ํ ๋๊ธฐ์
๋๋ค - ์๋ก์ด ๋ณต์กํ NLP ๊ธฐ์ ์ **๋ชจ๋์๊ฒ** ์ ๊ทผ ๊ฐ๋ฅํ๊ฒ ๋ง๋๋ ๊ฒ์ ๋ชฉํ๋ก ํฉ๋๋ค.
+
+๋ฐ๋ผ์ ์๋ณธ ์ ์ฅ์์ ๋ํด ์์ธํ ์ดํด๋ณด๋ ๊ฒ์ผ๋ก ์์ํด์ผ ํฉ๋๋ค.
+
+์๋ณธ ์ ์ฅ์์์ ๊ณต์ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ์ฑ๊ณต์ ์ผ๋ก ์คํํ๋ ๊ฒ์ ์ข
์ข
**๊ฐ์ฅ ์ด๋ ค์ด** ๋จ๊ณ์
๋๋ค. ์ฐ๋ฆฌ์ ๊ฒฝํ์ ๋ฐ๋ฅด๋ฉด, ์๋ณธ ์ฝ๋ ๋ฒ ์ด์ค์ ์ต์ํด์ง๋ ๋ฐ ์๊ฐ์ ํฌ์ํ๋ ๊ฒ์ด ๋งค์ฐ ์ค์ํฉ๋๋ค. ๋ค์์ ํ์
ํด์ผ ํฉ๋๋ค:
+
+- ์ฌ์ ํ๋ จ๋ ๊ฐ์ค์น๋ฅผ ์ด๋์ ์ฐพ์ ์ ์๋์ง?
+- ์ฌ์ ํ๋ จ๋ ๊ฐ์ค์น๋ฅผ ํด๋น ๋ชจ๋ธ์๋ก๋ํ๋ ๋ฐฉ๋ฒ์?
+- ๋ชจ๋ธ๊ณผ ๋
๋ฆฝ์ ์ผ๋ก ํ ํฌ๋์ด์ ๋ฅผ ์คํํ๋ ๋ฐฉ๋ฒ์?
+- ๊ฐ๋จํ forward pass์ ํ์ํ ํด๋์ค์ ํจ์๋ฅผ ํ์
ํ๊ธฐ ์ํด forward pass๋ฅผ ํ ๋ฒ ์ถ์ ํด ๋ณด์ธ์. ์ผ๋ฐ์ ์ผ๋ก ํด๋น ํจ์๋ค๋ง ๋ค์ ๊ตฌํํ๋ฉด ๋ฉ๋๋ค.
+- ๋ชจ๋ธ์ ์ค์ํ ๊ตฌ์ฑ ์์๋ฅผ ์ฐพ์ ์ ์์ด์ผ ํฉ๋๋ค. ๋ชจ๋ธ ํด๋์ค๋ ์ด๋์ ์๋์? ๋ชจ๋ธ ํ์ ํด๋์ค(*EncoderModel*, *DecoderModel* ๋ฑ)๊ฐ ์๋์? self-attention ๋ ์ด์ด๋ ์ด๋์ ์๋์? self-attention, cross-attention ๋ฑ ์ฌ๋ฌ ๊ฐ์ง ๋ค๋ฅธ ์ดํ
์
๋ ์ด์ด๊ฐ ์๋์?
+- ์๋ณธ ํ๊ฒฝ์์ ๋ชจ๋ธ์ ๋๋ฒ๊ทธํ ์ ์๋ ๋ฐฉ๋ฒ์ ๋ฌด์์ธ๊ฐ์? *print* ๋ฌธ์ ์ถ๊ฐํด์ผ ํ๋์? *ipdb*์ ๊ฐ์ ๋ํ์ ๋๋ฒ๊ฑฐ๋ฅผ ์ฌ์ฉํ ์ ์๋์? PyCharm๊ณผ ๊ฐ์ ํจ์จ์ ์ธ IDE๋ฅผ ์ฌ์ฉํด ๋ชจ๋ธ์ ๋๋ฒ๊ทธํ ์ ์๋์?
+
+์๋ณธ ์ ์ฅ์์์ ์ฝ๋๋ฅผ ์ด์ํ๋ ์์
์ ์์ํ๊ธฐ ์ ์ ์๋ณธ ์ ์ฅ์์์ ์ฝ๋๋ฅผ **ํจ์จ์ ์ผ๋ก** ๋๋ฒ๊ทธํ ์ ์์ด์ผ ํฉ๋๋ค! ๋ํ, ์คํ ์์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ์์
ํ๊ณ ์๋ค๋ ๊ฒ์ ๊ธฐ์ตํด์ผ ํฉ๋๋ค. ๋ฐ๋ผ์ ์๋ณธ ์ ์ฅ์์์ issue๋ฅผ ์ด๊ฑฐ๋ pull request๋ฅผ ์ด๊ธฐ๋ฅผ ์ฃผ์ ํ์ง ๋ง์ญ์์ค. ์ด ์ ์ฅ์์ ์ ์ง ๊ด๋ฆฌ์๋ค์ ๋๊ตฐ๊ฐ๊ฐ ์์ ๋ค์ ์ฝ๋๋ฅผ ์ดํด๋ณธ๋ค๋ ๊ฒ์ ๋ํด ๋งค์ฐ ๊ธฐ๋ปํ ๊ฒ์
๋๋ค!
+
+ํ์ฌ ์์ ์์, ์๋ ๋ชจ๋ธ์ ๋๋ฒ๊น
ํ๊ธฐ ์ํด ์ด๋ค ๋๋ฒ๊น
ํ๊ฒฝ๊ณผ ์ ๋ต์ ์ ํธํ๋์ง๋ ๋น์ ์๊ฒ ๋ฌ๋ ธ์ต๋๋ค. ์ฐ๋ฆฌ๋ ๊ณ ๊ฐ์ GPU ํ๊ฒฝ์ ๊ตฌ์ถํ๋ ๊ฒ์ ๋น์ถ์ฒํฉ๋๋ค. ๋์ , ์๋ ์ ์ฅ์๋ก ๋ค์ด๊ฐ์ ์์
์ ์์ํ ๋์ ๐ค Transformers ๋ชจ๋ธ์ ๊ตฌํ์ ์์ํ ๋์๋ CPU์์ ์์
ํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ๋ชจ๋ธ์ด ์ด๋ฏธ ๐ค Transformers๋ก ์ฑ๊ณต์ ์ผ๋ก ์ด์๋์์ ๋์๋ง ๋ชจ๋ธ์ด GPU์์๋ ์์๋๋ก ์๋ํ๋์ง ํ์ธํด์ผํฉ๋๋ค.
+
+์ผ๋ฐ์ ์ผ๋ก, ์๋ ๋ชจ๋ธ์ ์คํํ๊ธฐ ์ํ ๋ ๊ฐ์ง ๊ฐ๋ฅํ ๋๋ฒ๊น
ํ๊ฒฝ์ด ์์ต๋๋ค.
+
+- [Jupyter ๋
ธํธ๋ถ](https://jupyter.org/) / [Google Colab](https://colab.research.google.com/notebooks/intro.ipynb)
+- ๋ก์ปฌ Python ์คํฌ๋ฆฝํธ
+
+Jupyter ๋
ธํธ๋ถ์ ์ฅ์ ์ ์
๋จ์๋ก ์คํํ ์ ์๋ค๋ ๊ฒ์
๋๋ค. ์ด๋ ๋
ผ๋ฆฌ์ ์ธ ๊ตฌ์ฑ ์์๋ฅผ ๋ ์ ๋ถ๋ฆฌํ๊ณ ์ค๊ฐ ๊ฒฐ๊ณผ๋ฅผ ์ ์ฅํ ์ ์์ผ๋ฏ๋ก ๋๋ฒ๊น
์ฌ์ดํด์ด ๋ ๋นจ๋ผ์ง ์ ์์ต๋๋ค. ๋ํ, ๋
ธํธ๋ถ์ ๋ค๋ฅธ ๊ธฐ์ฌ์์ ์ฝ๊ฒ ๊ณต์ ํ ์ ์์ผ๋ฏ๋ก Hugging Face ํ์ ๋์์ ์์ฒญํ๋ ค๋ ๊ฒฝ์ฐ ๋งค์ฐ ์ ์ฉํ ์ ์์ต๋๋ค. Jupyter ๋
ธํธ๋ถ์ ์ต์ํ๋ค๋ฉด ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๊ฐ๋ ฅํ ์ถ์ฒํฉ๋๋ค.
+
+Jupyter ๋
ธํธ๋ถ์ ๋จ์ ์ ์ฌ์ฉ์ ์ต์ํ์ง ์์ ๊ฒฝ์ฐ ์๋ก์ด ํ๋ก๊ทธ๋๋ฐ ํ๊ฒฝ์ ์ ์ํ๋ ๋ฐ ์๊ฐ์ ํ ์ ํด์ผ ํ๋ฉฐ, `ipdb`์ ๊ฐ์ ์๋ ค์ง ๋๋ฒ๊น
๋๊ตฌ๋ฅผ ๋ ์ด์ ์ฌ์ฉํ ์ ์์ ์๋ ์๋ค๋ ๊ฒ์
๋๋ค.
+
+๊ฐ ์ฝ๋ ๋ฒ ์ด์ค์ ๋ํด ์ข์ ์ฒซ ๋ฒ์งธ ๋จ๊ณ๋ ํญ์ **์์** ์ฌ์ ํ๋ จ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ก๋ํ๊ณ ๋๋ฏธ ์ ์ ๋ฒกํฐ ์
๋ ฅ์ ์ฌ์ฉํ์ฌ ๋จ์ผ forward pass๋ฅผ ์ฌํํ๋ ๊ฒ์
๋๋ค. ์ด์ ๊ฐ์ ์คํฌ๋ฆฝํธ๋ ๋ค์๊ณผ ๊ฐ์ ์ ์์ต๋๋ค(์์ฌ ์ฝ๋๋ก ์์ฑ):
+
+```python
+model = BrandNewBertModel.load_pretrained_checkpoint("/path/to/checkpoint/")
+input_ids = [0, 4, 5, 2, 3, 7, 9] # vector of input ids
+original_output = model.predict(input_ids)
+```
+
+๋ค์์ผ๋ก, ๋๋ฒ๊น
์ ๋ต์ ๋ํด ์ผ๋ฐ์ ์ผ๋ก ๋ค์๊ณผ ๊ฐ์ ๋ช ๊ฐ์ง ์ ํ์ง๊ฐ ์์ต๋๋ค:
+
+- ์๋ณธ ๋ชจ๋ธ์ ๋ง์ ์์ ํ
์คํธ ๊ฐ๋ฅํ ๊ตฌ์ฑ ์์๋ก ๋ถํดํ๊ณ ๊ฐ๊ฐ์ ๋ํด forward pass๋ฅผ ์คํํ์ฌ ๊ฒ์ฆํฉ๋๋ค.
+- ์๋ณธ ๋ชจ๋ธ์ ์๋ณธ *tokenizer*๊ณผ ์๋ณธ *model*๋ก๋ง ๋ถํดํ๊ณ ํด๋น ๋ถ๋ถ์ ๋ํด forward pass๋ฅผ ์คํํ ํ ๊ฒ์ฆ์ ์ํด ์ค๊ฐ ์ถ๋ ฅ(print ๋ฌธ ๋๋ ์ค๋จ์ )์ ์ฌ์ฉํฉ๋๋ค.
+
+๋ค์ ๋งํ์ง๋ง, ์ด๋ค ์ ๋ต์ ์ ํํ ์ง๋ ๋น์ ์๊ฒ ๋ฌ๋ ค ์์ต๋๋ค. ์๋ณธ ์ฝ๋ ๋ฒ ์ด์ค์ ๋ฐ๋ผ ํ๋ ๋๋ ๋ค๋ฅธ ์ ๋ต์ด ์ ๋ฆฌํ ์ ์์ต๋๋ค.
+
+์๋ณธ ์ฝ๋ ๋ฒ ์ด์ค๋ฅผ ๋ชจ๋ธ์ ์์ ํ์ ๊ตฌ์ฑ ์์๋ก ๋ถํดํ ์ ์๋์ง ์ฌ๋ถ, ์๋ฅผ ๋ค์ด ์๋ณธ ์ฝ๋ ๋ฒ ์ด์ค๊ฐ ์ฆ์ ์คํ ๋ชจ๋์์ ๊ฐ๋จํ ์คํ๋ ์ ์๋ ๊ฒฝ์ฐ, ๊ทธ๋ฐ ๊ฒฝ์ฐ์๋ ๊ทธ ๋
ธ๋ ฅ์ด ๊ฐ์น๊ฐ ์๋ค๋ ๊ฒ์ด ์ผ๋ฐ์ ์
๋๋ค. ์ด๊ธฐ์ ๋ ์ด๋ ค์ด ๋ฐฉ๋ฒ์ ์ ํํ๋ ๊ฒ์๋ ๋ช ๊ฐ์ง ์ค์ํ ์ฅ์ ์ด ์์ต๋๋ค.
+
+- ์๋ณธ ๋ชจ๋ธ์ ๐ค Transformers ๊ตฌํ๊ณผ ๋น๊ตํ ๋ ๊ฐ ๊ตฌ์ฑ ์์๊ฐ ์ผ์นํ๋์ง ์๋์ผ๋ก ํ์ธํ ์ ์์ต๋๋ค. ์ฆ, ์๊ฐ์ ์ธ ๋น๊ต(print ๋ฌธ์ ํตํ ๋น๊ต๊ฐ ์๋) ๋์ ๐ค Transformers ๊ตฌํ๊ณผ ๊ทธ์ ๋์ํ๋ ์๋ณธ ๊ตฌ์ฑ ์์๊ฐ ์ผ์นํ๋์ง ํ์ธํ ์ ์์ต๋๋ค.
+- ์ ์ฒด ๋ชจ๋ธ์ ๋ชจ๋๋ณ๋ก, ์ฆ ์์ ๊ตฌ์ฑ ์์๋ก ๋ถํดํจ์ผ๋ก์จ ๋ชจ๋ธ์ ์ด์ํ๋ ํฐ ๋ฌธ์ ๋ฅผ ๋จ์ํ ๊ฐ๋ณ ๊ตฌ์ฑ ์์๋ฅผ ์ด์ํ๋ ์์ ๋ฌธ์ ๋ก ๋ถํดํ ์ ์์ผ๋ฏ๋ก ์์
์ ๋ ์ ๊ตฌ์กฐํํ ์ ์์ต๋๋ค.
+- ๋ชจ๋ธ์ ๋
ผ๋ฆฌ์ ์ผ๋ก ์๋ฏธ ์๋ ๊ตฌ์ฑ ์์๋ก ๋ถ๋ฆฌํ๋ ๊ฒ์ ๋ชจ๋ธ์ ์ค๊ณ์ ๋ํ ๋ ๋์ ๊ฐ์๋ฅผ ์ป๊ณ ๋ชจ๋ธ์ ๋ ์ ์ดํดํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
+- ์ด๋ฌํ ๊ตฌ์ฑ ์์๋ณ ํ
์คํธ๋ฅผ ํตํด ์ฝ๋๋ฅผ ๋ณ๊ฒฝํ๋ฉด์ ํ๊ท๊ฐ ๋ฐ์ํ์ง ์๋๋ก ๋ณด์ฅํ ์ ์์ต๋๋ค.
+
+[Lysandre์ ELECTRA ํตํฉ ๊ฒ์ฌ](https://gist.github.com/LysandreJik/db4c948f6b4483960de5cbac598ad4ed)๋ ์ด๋ฅผ ์ํํ๋ ์ข์ ์์ ์
๋๋ค.
+
+๊ทธ๋ฌ๋ ์๋ณธ ์ฝ๋ ๋ฒ ์ด์ค๊ฐ ๋งค์ฐ ๋ณต์กํ๊ฑฐ๋ ์ค๊ฐ ๊ตฌ์ฑ ์์๋ฅผ ์ปดํ์ผ๋ ๋ชจ๋์์ ์คํํ๋ ๊ฒ๋ง ํ์ฉํ๋ ๊ฒฝ์ฐ, ๋ชจ๋ธ์ ํ
์คํธ ๊ฐ๋ฅํ ์์ ํ์ ๊ตฌ์ฑ ์์๋ก ๋ถํดํ๋ ๊ฒ์ด ์๊ฐ์ด ๋ง์ด ์์๋๊ฑฐ๋ ๋ถ๊ฐ๋ฅํ ์๋ ์์ต๋๋ค. [T5์ MeshTensorFlow](https://github.com/tensorflow/mesh/tree/master/mesh_tensorflow) ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ๋งค์ฐ ๋ณต์กํ๋ฉฐ ๋ชจ๋ธ์ ํ์ ๊ตฌ์ฑ ์์๋ก ๋ถํดํ๋ ๊ฐ๋จํ ๋ฐฉ๋ฒ์ ์ ๊ณตํ์ง ์์ต๋๋ค. ์ด๋ฌํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ฒฝ์ฐ, ๋ณดํต print ๋ฌธ์ ํตํด ํ์ธํฉ๋๋ค.
+
+์ด๋ค ์ ๋ต์ ์ ํํ๋๋ผ๋ ๊ถ์ฅ๋๋ ์ ์ฐจ๋ ๋์ผํฉ๋๋ค. ๋จผ์ ์์ ๋ ์ด์ด๋ฅผ ๋๋ฒ๊ทธํ๊ณ ๋ง์ง๋ง ๋ ์ด์ด๋ฅผ ๋ง์ง๋ง์ ๋๋ฒ๊ทธํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+๋ค์ ์์๋ก ๊ฐ ๋ ์ด์ด์ ์ถ๋ ฅ์ ๊ฒ์ํ๋ ๊ฒ์ด ์ข์ต๋๋ค:
+
+1. ๋ชจ๋ธ์ ์ ๋ฌ๋ ์
๋ ฅ ID ๊ฐ์ ธ์ค๊ธฐ
+2. ์๋ ์๋ฒ ๋ฉ ๊ฐ์ ธ์ค๊ธฐ
+3. ์ฒซ ๋ฒ์งธ Transformer ๋ ์ด์ด์ ์
๋ ฅ ๊ฐ์ ธ์ค๊ธฐ
+4. ์ฒซ ๋ฒ์งธ Transformer ๋ ์ด์ด์ ์ถ๋ ฅ ๊ฐ์ ธ์ค๊ธฐ
+5. ๋ค์ n-1๊ฐ์ Transformer ๋ ์ด์ด์ ์ถ๋ ฅ ๊ฐ์ ธ์ค๊ธฐ
+6. BrandNewBert ๋ชจ๋ธ์ ์ถ๋ ฅ ๊ฐ์ ธ์ค๊ธฐ
+
+์
๋ ฅ ID๋ ์ ์ ๋ฐฐ์ด๋ก ๊ตฌ์ฑ๋๋ฉฐ, ์๋ฅผ ๋ค์ด `input_ids = [0, 4, 4, 3, 2, 4, 1, 7, 19]`์ ๊ฐ์ ์ ์์ต๋๋ค.
+
+๋ค์ ๋ ์ด์ด์ ์ถ๋ ฅ์ ์ข
์ข
๋ค์ฐจ์ ์ค์ ๋ฐฐ์ด๋ก ๊ตฌ์ฑ๋๋ฉฐ, ๋ค์๊ณผ ๊ฐ์ด ๋ํ๋ผ ์ ์์ต๋๋ค:
+
+```
+[[
+ [-0.1465, -0.6501, 0.1993, ..., 0.1451, 0.3430, 0.6024],
+ [-0.4417, -0.5920, 0.3450, ..., -0.3062, 0.6182, 0.7132],
+ [-0.5009, -0.7122, 0.4548, ..., -0.3662, 0.6091, 0.7648],
+ ...,
+ [-0.5613, -0.6332, 0.4324, ..., -0.3792, 0.7372, 0.9288],
+ [-0.5416, -0.6345, 0.4180, ..., -0.3564, 0.6992, 0.9191],
+ [-0.5334, -0.6403, 0.4271, ..., -0.3339, 0.6533, 0.8694]]],
+```
+
+๐ค Transformers์ ์ถ๊ฐ๋๋ ๋ชจ๋ ๋ชจ๋ธ์ ํตํฉ ํ
์คํธ๋ฅผ ํต๊ณผํด์ผ ํฉ๋๋ค. ์ฆ, ์๋ณธ ๋ชจ๋ธ๊ณผ ๐ค Transformers์ ์ฌ๊ตฌํ ๋ฒ์ ์ด 0.001์ ์ ๋ฐ๋๋ก ์ ํํ ๋์ผํ ์ถ๋ ฅ์ ๋ด์ผ ํฉ๋๋ค! ๋์ผํ ๋ชจ๋ธ์ด ๋ค๋ฅธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ์์ฑ๋์์ ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ๋ ์์ํฌ์ ๋ฐ๋ผ ์ฝ๊ฐ ๋ค๋ฅธ ์ถ๋ ฅ์ ์ป๋ ๊ฒ์ ์ ์์ด๋ฏ๋ก 1e-3(0.001)์ ์ค์ฐจ๋ ํ์ฉํฉ๋๋ค. ๊ฑฐ์ ๋์ผํ ์ถ๋ ฅ์ ๋ด๋ ๊ฒ๋ง์ผ๋ก๋ ์ถฉ๋ถํ์ง ์์ผ๋ฉฐ, ์๋ฒฝํ ์ผ์นํ๋ ์์ค์ด์ด์ผ ํฉ๋๋ค. ๋ฐ๋ผ์ ๐ค Transformers ๋ฒ์ ์ ์ค๊ฐ ์ถ๋ ฅ์ *brand_new_bert*์ ์๋ ๊ตฌํ์ ์ค๊ฐ ์ถ๋ ฅ๊ณผ ์ฌ๋ฌ ๋ฒ ๋น๊ตํด์ผ ํฉ๋๋ค. ์ด ๊ฒฝ์ฐ ์๋ณธ ์ ์ฅ์์ **ํจ์จ์ ์ธ** ๋๋ฒ๊น
ํ๊ฒฝ์ด ์ ๋์ ์ผ๋ก ์ค์ํฉ๋๋ค. ๋๋ฒ๊น
ํ๊ฒฝ์ ๊ฐ๋ฅํ ํ ํจ์จ์ ์ผ๋ก ๋ง๋๋ ๋ช ๊ฐ์ง ์กฐ์ธ์ ์ ์ํฉ๋๋ค.
+
+- ์ค๊ฐ ๊ฒฐ๊ณผ๋ฅผ ๋๋ฒ๊ทธํ๋ ๊ฐ์ฅ ์ข์ ๋ฐฉ๋ฒ์ ์ฐพ์ผ์ธ์. ์๋ณธ ์ ์ฅ์๊ฐ PyTorch๋ก ์์ฑ๋์๋ค๋ฉด ์๋ณธ ๋ชจ๋ธ์ ๋ ์์ ํ์ ๊ตฌ์ฑ ์์๋ก ๋ถํดํ์ฌ ์ค๊ฐ ๊ฐ์ ๊ฒ์ํ๋ ๊ธด ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ๋ ๊ฒ์ ์๊ฐ์ ํฌ์ํ ๊ฐ์น๊ฐ ์์ต๋๋ค. ์๋ณธ ์ ์ฅ์๊ฐ Tensorflow 1๋ก ์์ฑ๋์๋ค๋ฉด [tf.print](https://www.tensorflow.org/api_docs/python/tf/print)์ ๊ฐ์ Tensorflow ์ถ๋ ฅ ์์
์ ์ฌ์ฉํ์ฌ ์ค๊ฐ ๊ฐ์ ์ถ๋ ฅํด์ผ ํ ์๋ ์์ต๋๋ค. ์๋ณธ ์ ์ฅ์๊ฐ Jax๋ก ์์ฑ๋์๋ค๋ฉด forward pass๋ฅผ ์คํํ ๋ ๋ชจ๋ธ์ด **jit ๋์ง ์๋๋ก** ํด์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด [์ด ๋งํฌ](https://github.com/google/jax/issues/196)๋ฅผ ํ์ธํด ๋ณด์ธ์.
+- ์ฌ์ฉ ๊ฐ๋ฅํ ๊ฐ์ฅ ์์ ์ฌ์ ํ๋ จ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ์ฉํ์ธ์. ์ฒดํฌํฌ์ธํธ๊ฐ ์์์๋ก ๋๋ฒ๊ทธ ์ฌ์ดํด์ด ๋ ๋นจ๋ผ์ง๋๋ค. ์ ๋ฐ์ ์ผ๋ก forward pass์ 10์ด ์ด์์ด ๊ฑธ๋ฆฌ๋ ๊ฒฝ์ฐ ํจ์จ์ ์ด์ง ์์ต๋๋ค. ๋งค์ฐ ํฐ ์ฒดํฌํฌ์ธํธ๋ง ์ฌ์ฉํ ์ ์๋ ๊ฒฝ์ฐ, ์ ํ๊ฒฝ์์ ์์๋ก ์ด๊ธฐํ๋ ๊ฐ์ค์น๋ก ๋๋ฏธ ๋ชจ๋ธ์ ๋ง๋ค๊ณ ํด๋น ๊ฐ์ค์น๋ฅผ ๐ค Transformers ๋ฒ์ ๊ณผ ๋น๊ตํ๊ธฐ ์ํด ์ ์ฅํ๋ ๊ฒ์ด ๋ ์๋ฏธ๊ฐ ์์ ์ ์์ต๋๋ค.
+- ๋๋ฒ๊น
์ค์ ์์ ๊ฐ์ฅ ์ฝ๊ฒ forward pass๋ฅผ ํธ์ถํ๋ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ์ธ์. ์๋ณธ ์ ์ฅ์์์ **๋จ์ผ** forward pass๋ง ํธ์ถํ๋ ํจ์๋ฅผ ์ฐพ๋ ๊ฒ์ด ์ด์์ ์
๋๋ค. ์ด ํจ์๋ ์ผ๋ฐ์ ์ผ๋ก `predict`, `evaluate`, `forward`, `__call__`๊ณผ ๊ฐ์ด ํธ์ถ๋ฉ๋๋ค. `autoregressive_sample`๊ณผ ๊ฐ์ ํ
์คํธ ์์ฑ์์ `forward`๋ฅผ ์ฌ๋ฌ ๋ฒ ํธ์ถํ์ฌ ํ
์คํธ๋ฅผ ์์ฑํ๋ ๋ฑ์ ์์
์ ์ํํ๋ ํจ์๋ฅผ ๋๋ฒ๊ทธํ๊ณ ์ถ์ง ์์ ๊ฒ์
๋๋ค.
+- ํ ํฐํ ๊ณผ์ ์ ๋ชจ๋ธ์ *forward* pass์ ๋ถ๋ฆฌํ๋ ค๊ณ ๋
ธ๋ ฅํ์ธ์. ์๋ณธ ์ ์ฅ์์์ ์
๋ ฅ ๋ฌธ์์ด์ ์
๋ ฅํด์ผ ํ๋ ์์ ๊ฐ ์๋ ๊ฒฝ์ฐ, ์
๋ ฅ ๋ฌธ์์ด์ด ์
๋ ฅ ID๋ก ๋ณ๊ฒฝ๋๋ ์๊ฐ์ ์ฐพ์์ ์์ํ์ธ์. ์ด ๊ฒฝ์ฐ ์ง์ ID๋ฅผ ์
๋ ฅํ ์ ์๋๋ก ์์ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ๊ฑฐ๋ ์๋ณธ ์ฝ๋๋ฅผ ์์ ํด์ผ ํ ์๋ ์์ต๋๋ค.
+- ๋๋ฒ๊น
์ค์ ์์ ๋ชจ๋ธ์ด ํ๋ จ ๋ชจ๋๊ฐ ์๋๋ผ๋ ๊ฒ์ ํ์ธํ์ธ์. ํ๋ จ ๋ชจ๋์์๋ ๋ชจ๋ธ์ ์ฌ๋ฌ ๋๋กญ์์ ๋ ์ด์ด ๋๋ฌธ์ ๋ฌด์์ ์ถ๋ ฅ์ด ์์ฑ๋ ์ ์์ต๋๋ค. ๋๋ฒ๊น
ํ๊ฒฝ์์ forward pass๊ฐ **๊ฒฐ์ ๋ก ์ **์ด๋๋ก ํด์ผ ํฉ๋๋ค. ๋๋ ๋์ผํ ํ๋ ์์ํฌ์ ์๋ ๊ฒฝ์ฐ *transformers.utils.set_seed*๋ฅผ ์ฌ์ฉํ์ธ์.
+
+๋ค์ ์น์
์์๋ *brand_new_bert*์ ๋ํด ์ด ์์
์ ์ํํ๋ ๋ฐ ๋ ๊ตฌ์ฒด์ ์ธ ์ธ๋ถ ์ฌํญ/ํ์ ์ ๊ณตํฉ๋๋ค.
+
+### 5.-14. ๐ค Transformers์ BrandNewBert๋ฅผ ์ด์ํ๊ธฐ [[5.-14.-port-brandnewbert-to-transformers]]
+
+์ด์ , ๋ง์นจ๋ด ๐ค Transformers์ ์๋ก์ด ์ฝ๋๋ฅผ ์ถ๊ฐํ ์ ์์ต๋๋ค. ๐ค Transformers ํฌํฌ์ ํด๋ก ์ผ๋ก ์ด๋ํ์ธ์:
+
+```bash
+cd transformers
+```
+
+๋ค์๊ณผ ๊ฐ์ด ์ด๋ฏธ ์กด์ฌํ๋ ๋ชจ๋ธ์ ๋ชจ๋ธ ์ํคํ
์ฒ์ ์ ํํ ์ผ์นํ๋ ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ํน๋ณํ ๊ฒฝ์ฐ์๋ [์ด ์น์
](#write-a-conversion-script)์ ์ค๋ช
๋๋๋ก ๋ณํ ์คํฌ๋ฆฝํธ๋ง ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค. ์ด ๊ฒฝ์ฐ์๋ ์ด๋ฏธ ์กด์ฌํ๋ ๋ชจ๋ธ์ ์ ์ฒด ๋ชจ๋ธ ์ํคํ
์ฒ๋ฅผ ๊ทธ๋๋ก ์ฌ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+๊ทธ๋ ์ง ์์ผ๋ฉด ์ ๋ชจ๋ธ ์์ฑ์ ์์ํ๊ฒ ์ต๋๋ค. ๋ค์ ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์์์ ์์ํ๋ ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+๊ธฐ์กด ๋ชจ๋ธ:
+
+```bash
+transformers-cli add-new-model-like
+```
+
+๋ชจ๋ธ์ ๊ธฐ๋ณธ ์ ๋ณด๋ฅผ ์
๋ ฅํ๋ ์ค๋ฌธ์ง๊ฐ ํ์๋ฉ๋๋ค.
+
+**huggingface/transformers ๋ฉ์ธ ์ ์ฅ์์ Pull Request ์ด๊ธฐ**
+
+์๋์ผ๋ก ์์ฑ๋ ์ฝ๋๋ฅผ ์์ ํ๊ธฐ ์ ์, ์ง๊ธ์ "์์
์งํ ์ค (WIP)" ํ ๋ฆฌํ์คํธ๋ฅผ ์ด๊ธฐ ์ํ ์๊ธฐ์
๋๋ค. ์๋ฅผ ๋ค์ด, ๐ค Transformers์ "*brand_new_bert* ์ถ๊ฐ"๋ผ๋ ์ ๋ชฉ์ "[WIP] Add *brand_new_bert*" ํ ๋ฆฌํ์คํธ๋ฅผ ์ฝ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋น์ ๊ณผ Hugging Face ํ์ด ๐ค Transformers์ ๋ชจ๋ธ์ ํตํฉํ๋ ์์
์ ํจ๊ปํ ์ ์์ต๋๋ค.
+
+๋ค์์ ์ํํด์ผ ํฉ๋๋ค:
+
+1. ๋ฉ์ธ ๋ธ๋์น์์ ์์
์ ์ ์ค๋ช
ํ๋ ์ด๋ฆ์ผ๋ก ๋ธ๋์น ์์ฑ
+
+```bash
+git checkout -b add_brand_new_bert
+```
+
+2. ์๋์ผ๋ก ์์ฑ๋ ์ฝ๋ ์ปค๋ฐ
+
+```bash
+git add .
+git commit
+```
+
+3. ํ์ฌ ๋ฉ์ธ์ ๊ฐ์ ธ์ค๊ณ ๋ฆฌ๋ฒ ์ด์ค
+
+```bash
+git fetch upstream
+git rebase upstream/main
+```
+
+4. ๋ณ๊ฒฝ ์ฌํญ์ ๊ณ์ ์ ํธ์
+
+```bash
+git push -u origin a-descriptive-name-for-my-changes
+```
+
+5. ๋ง์กฑ์ค๋ฝ๋ค๋ฉด, GitHub์์ ์์ ์ ํฌํฌํ ์น ํ์ด์ง๋ก ์ด๋ํฉ๋๋ค. "Pull request"๋ฅผ ํด๋ฆญํฉ๋๋ค. Hugging Face ํ์ ์ผ๋ถ ๋ฉค๋ฒ์ GitHub ํธ๋ค์ ๋ฆฌ๋ทฐ์ด๋ก ์ถ๊ฐํ์ฌ Hugging Face ํ์ด ์์ผ๋ก์ ๋ณ๊ฒฝ ์ฌํญ์ ๋ํด ์๋ฆผ์ ๋ฐ์ ์ ์๋๋ก ํฉ๋๋ค.
+
+6. GitHub ํ ๋ฆฌํ์คํธ ์น ํ์ด์ง ์ค๋ฅธ์ชฝ์ ์๋ "Convert to draft"๋ฅผ ํด๋ฆญํ์ฌ PR์ ์ด์์ผ๋ก ๋ณ๊ฒฝํฉ๋๋ค.
+
+๋ค์์ผ๋ก, ์ด๋ค ์ง์ ์ ์ด๋ฃจ์๋ค๋ฉด ์์
์ ์ปค๋ฐํ๊ณ ๊ณ์ ์ ํธ์ํ์ฌ ํ ๋ฆฌํ์คํธ์ ํ์๋๋๋ก ํด์ผ ํฉ๋๋ค. ๋ํ, ๋ค์๊ณผ ๊ฐ์ด ํ์ฌ ๋ฉ์ธ๊ณผ ์์
์ ์
๋ฐ์ดํธํด์ผ ํฉ๋๋ค:
+
+```bash
+git fetch upstream
+git merge upstream/main
+```
+
+์ผ๋ฐ์ ์ผ๋ก, ๋ชจ๋ธ ๋๋ ๊ตฌํ์ ๊ดํ ๋ชจ๋ ์ง๋ฌธ์ ์์ ์ PR์์ ํด์ผ ํ๋ฉฐ, PR์์ ํ ๋ก ๋๊ณ ํด๊ฒฐ๋์ด์ผ ํฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด Hugging Face ํ์ด ์๋ก์ด ์ฝ๋๋ฅผ ์ปค๋ฐํ๊ฑฐ๋ ์ง๋ฌธ์ ํ ๋ ํญ์ ์๋ฆผ์ ๋ฐ์ ์ ์์ต๋๋ค. Hugging Face ํ์๊ฒ ๋ฌธ์ ๋๋ ์ง๋ฌธ์ ํจ์จ์ ์ผ๋ก ์ดํดํ ์ ์๋๋ก ์ถ๊ฐํ ์ฝ๋๋ฅผ ๋ช
์ํ๋ ๊ฒ์ด ๋์์ด ๋ ๋๊ฐ ๋ง์ต๋๋ค.
+
+์ด๋ฅผ ์ํด, ๋ณ๊ฒฝ ์ฌํญ์ ๋ชจ๋ ๋ณผ ์ ์๋ "Files changed" ํญ์ผ๋ก ์ด๋ํ์ฌ ์ง๋ฌธํ๊ณ ์ ํ๋ ์ค๋ก ์ด๋ํ ๋ค์ "+" ๊ธฐํธ๋ฅผ ํด๋ฆญํ์ฌ ์ฝ๋ฉํธ๋ฅผ ์ถ๊ฐํ ์ ์์ต๋๋ค. ์ง๋ฌธ์ด๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋๋ฉด, ์์ฑ๋ ์ฝ๋ฉํธ์ "Resolve" ๋ฒํผ์ ํด๋ฆญํ ์ ์์ต๋๋ค.
+
+๋ง์ฐฌ๊ฐ์ง๋ก, Hugging Face ํ์ ์ฝ๋๋ฅผ ๋ฆฌ๋ทฐํ ๋ ์ฝ๋ฉํธ๋ฅผ ๋จ๊ธธ ๊ฒ์
๋๋ค. ์ฐ๋ฆฌ๋ PR์์ ๋๋ถ๋ถ์ ์ง๋ฌธ์ GitHub์์ ๋ฌป๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ๊ณต๊ฐ์ ํฌ๊ฒ ๋์์ด ๋์ง ์๋ ๋งค์ฐ ์ผ๋ฐ์ ์ธ ์ง๋ฌธ์ ๊ฒฝ์ฐ, Slack์ด๋ ์ด๋ฉ์ผ์ ํตํด Hugging Face ํ์๊ฒ ๋ฌธ์ํ ์ ์์ต๋๋ค.
+
+**5. brand_new_bert์ ๋ํด ์์ฑ๋ ๋ชจ๋ธ ์ฝ๋๋ฅผ ์ ์ฉํ๊ธฐ**
+
+๋จผ์ , ์ฐ๋ฆฌ๋ ๋ชจ๋ธ ์์ฒด์๋ง ์ด์ ์ ๋ง์ถ๊ณ ํ ํฌ๋์ด์ ์ ๋ํด์๋ ์ ๊ฒฝ ์ฐ์ง ์์ ๊ฒ์
๋๋ค. ๋ชจ๋ ๊ด๋ จ ์ฝ๋๋ ๋ค์์ ์์ฑ๋ ํ์ผ์์ ์ฐพ์ ์ ์์ต๋๋ค: `src/transformers/models/brand_new_bert/modeling_brand_new_bert.py` ๋ฐ `src/transformers/models/brand_new_bert/configuration_brand_new_bert.py`.
+
+์ด์ ๋ง์นจ๋ด ์ฝ๋ฉ์ ์์ํ ์ ์์ต๋๋ค :). `src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`์ ์์ฑ๋ ์ฝ๋๋ ์ธ์ฝ๋ ์ ์ฉ ๋ชจ๋ธ์ธ ๊ฒฝ์ฐ BERT์ ๋์ผํ ์ํคํ
์ฒ๋ฅผ ๊ฐ์ง๊ฑฐ๋, ์ธ์ฝ๋-๋์ฝ๋ ๋ชจ๋ธ์ธ ๊ฒฝ์ฐ BART์ ๋์ผํ ์ํคํ
์ฒ๋ฅผ ๊ฐ์ง ๊ฒ์
๋๋ค. ์ด ์์ ์์, ๋ชจ๋ธ์ ์ด๋ก ์ ์ธก๋ฉด์ ๋ํด ๋ฐฐ์ด ๋ด์ฉ์ ๋ค์ ์๊ธฐํด์ผ ํฉ๋๋ค: *๋ชจ๋ธ์ด BERT ๋๋ BART์ ์ด๋ป๊ฒ ๋ค๋ฅธ๊ฐ์?*. ์์ฃผ ๋ณ๊ฒฝํด์ผ ํ๋ ๊ฒ์ *self-attention* ๋ ์ด์ด, ์ ๊ทํ ๋ ์ด์ด์ ์์ ๋ฑ์ ๋ณ๊ฒฝํ๋ ๊ฒ์
๋๋ค. ๋ค์ ๋งํ์ง๋ง, ์์ ์ ๋ชจ๋ธ์ ๊ตฌํํ๋ ๋ฐ ๋์์ด ๋๋๋ก Transformers์์ ์ด๋ฏธ ์กด์ฌํ๋ ๋ชจ๋ธ์ ์ ์ฌํ ์ํคํ
์ฒ๋ฅผ ์ดํด๋ณด๋ ๊ฒ์ด ์ ์ฉํ ์ ์์ต๋๋ค.
+
+**์ฐธ๊ณ ๋ก** ์ด ์์ ์์, ์ฝ๋๊ฐ ์์ ํ ์ ํํ๊ฑฐ๋ ๊นจ๋ํ๋ค๊ณ ํ์ ํ ํ์๋ ์์ต๋๋ค. ์คํ๋ ค ์ฒ์์๋ ์๋ณธ ์ฝ๋์ ์ฒซ ๋ฒ์งธ *๋ถ์์ ํ๊ณ * ๋ณต์ฌ๋ ๋ฒ์ ์ `src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ํ์ํ ๋ชจ๋ ์ฝ๋๊ฐ ์ถ๊ฐ๋ ๋๊น์ง ์ด๋ฌํ ์์
์ ์งํํ ํ, ๋ค์ ์น์
์์ ์ค๋ช
ํ ๋ณํ ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ ์ฝ๋๋ฅผ ์ ์ง์ ์ผ๋ก ๊ฐ์ ํ๊ณ ์์ ํ๋ ๊ฒ์ด ํจ์ฌ ํจ์จ์ ์
๋๋ค. ์ด ์์ ์์ ์๋ํด์ผ ํ๋ ์ ์ผํ ๊ฒ์ ๋ค์ ๋ช
๋ น์ด ์๋ํ๋ ๊ฒ์
๋๋ค:
+
+```python
+from transformers import BrandNewBertModel, BrandNewBertConfig
+
+model = BrandNewBertModel(BrandNewBertConfig())
+```
+
+์์ ๋ช
๋ น์ `BrandNewBertConfig()`์ ์ ์๋ ๊ธฐ๋ณธ ๋งค๊ฐ๋ณ์์ ๋ฐ๋ผ ๋ฌด์์ ๊ฐ์ค์น๋ก ๋ชจ๋ธ์ ์์ฑํ๋ฉฐ, ์ด๋ก์จ ๋ชจ๋ ๊ตฌ์ฑ ์์์ `init()` ๋ฉ์๋๊ฐ ์๋ํจ์ ๋ณด์ฅํฉ๋๋ค.
+
+๋ชจ๋ ๋ฌด์์ ์ด๊ธฐํ๋ `BrandnewBertPreTrainedModel` ํด๋์ค์ `_init_weights` ๋ฉ์๋์์ ์ํ๋์ด์ผ ํฉ๋๋ค. ์ด ๋ฉ์๋๋ ๊ตฌ์ฑ ์ค์ ๋ณ์์ ๋ฐ๋ผ ๋ชจ๋ ๋ฆฌํ ๋ชจ๋์ ์ด๊ธฐํํด์ผ ํฉ๋๋ค. BERT์ `_init_weights` ๋ฉ์๋ ์์ ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```py
+def _init_weights(self, module):
+ """Initialize the weights"""
+ if isinstance(module, nn.Linear):
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
+ if module.bias is not None:
+ module.bias.data.zero_()
+ elif isinstance(module, nn.Embedding):
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
+ if module.padding_idx is not None:
+ module.weight.data[module.padding_idx].zero_()
+ elif isinstance(module, nn.LayerNorm):
+ module.bias.data.zero_()
+ module.weight.data.fill_(1.0)
+```
+
+๋ช ๊ฐ์ง ๋ชจ๋์ ๋ํด ํน๋ณํ ์ด๊ธฐํ๊ฐ ํ์ํ ๊ฒฝ์ฐ ์ฌ์ฉ์ ์ ์ ๋ฐฉ์์ ์ฌ์ฉํ ์๋ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, `Wav2Vec2ForPreTraining`์์ ๋ง์ง๋ง ๋ ๊ฐ์ ์ ํ ๋ ์ด์ด๋ ์ผ๋ฐ์ ์ธ PyTorch `nn.Linear`์ ์ด๊ธฐํ๋ฅผ ๊ฐ์ ธ์ผ ํ์ง๋ง, ๋ค๋ฅธ ๋ชจ๋ ๋ ์ด์ด๋ ์์ ๊ฐ์ ์ด๊ธฐํ๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ์ด๋ ๋ค์๊ณผ ๊ฐ์ด ์ฝ๋ํ๋ฉ๋๋ค:
+
+```py
+def _init_weights(self, module):
+ """Initialize the weights"""
+ if isinstance(module, Wav2Vec2ForPreTraining):
+ module.project_hid.reset_parameters()
+ module.project_q.reset_parameters()
+ module.project_hid._is_hf_initialized = True
+ module.project_q._is_hf_initialized = True
+ elif isinstance(module, nn.Linear):
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
+ if module.bias is not None:
+ module.bias.data.zero_()
+```
+
+`_is_hf_initialized` ํ๋๊ทธ๋ ์๋ธ๋ชจ๋์ ํ ๋ฒ๋ง ์ด๊ธฐํํ๋๋ก ๋ด๋ถ์ ์ผ๋ก ์ฌ์ฉ๋ฉ๋๋ค. `module.project_q` ๋ฐ `module.project_hid`์ ๋ํด `True`๋ก ์ค์ ํจ์ผ๋ก์จ, ์ฐ๋ฆฌ๊ฐ ์ํํ ์ฌ์ฉ์ ์ ์ ์ด๊ธฐํ๊ฐ ์ดํ์ ๋ฎ์ด์ฐ์ด์ง ์๋๋ก ํฉ๋๋ค. ์ฆ, `_init_weights` ํจ์๊ฐ ์ด๋ค์๊ฒ ์ ์ฉ๋์ง ์์ต๋๋ค.
+
+**6. ๋ณํ ์คํฌ๋ฆฝํธ ์์ฑํ๊ธฐ**
+
+๋ค์์ผ๋ก, ๋๋ฒ๊ทธ์ ์ฌ์ฉํ ์ฒดํฌํฌ์ธํธ๋ฅผ ๊ธฐ์กด ์ ์ฅ์์์ ๋ง๋ ๐ค Transformers ๊ตฌํ๊ณผ ํธํ๋๋ ์ฒดํฌํฌ์ธํธ๋ก ๋ณํํ ์ ์๋ ๋ณํ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค. ๋ณํ ์คํฌ๋ฆฝํธ๋ฅผ ์ฒ์๋ถํฐ ์์ฑํ๋ ๊ฒ๋ณด๋ค๋ *brand_new_bert*์ ๋์ผํ ํ๋ ์์ํฌ๋ก ์์ฑ๋ ์ ์ฌํ ๋ชจ๋ธ์ ๋ณํํ ๊ธฐ์กด ๋ณํ ์คํฌ๋ฆฝํธ๋ฅผ ์ฐพ์๋ณด๋ ๊ฒ์ด ์ข์ต๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ๊ธฐ์กด ๋ณํ ์คํฌ๋ฆฝํธ๋ฅผ ๋ณต์ฌํ์ฌ ์ฌ์ฉ ์ฌ๋ก์ ๋ง๊ฒ ์ฝ๊ฐ ์์ ํ๋ ๊ฒ์ผ๋ก ์ถฉ๋ถํฉ๋๋ค. ๋ชจ๋ธ์ ๋ํด ์ ์ฌํ ๊ธฐ์กด ๋ณํ ์คํฌ๋ฆฝํธ๋ฅผ ์ด๋์์ ์ฐพ์ ์ ์๋์ง Hugging Face ํ์๊ฒ ๋ฌธ์ํ๋ ๊ฒ์ ๋ง์ค์ด์ง ๋ง์ธ์.
+
+- TensorFlow์์ PyTorch๋ก ๋ชจ๋ธ์ ์ด์ ํ๋ ๊ฒฝ์ฐ, ์ข์ ์ฐธ๊ณ ์๋ฃ๋ก BERT์ ๋ณํ ์คํฌ๋ฆฝํธ [์ฌ๊ธฐ](https://github.com/huggingface/transformers/blob/7acfa95afb8194f8f9c1f4d2c6028224dbed35a2/src/transformers/models/bert/modeling_bert.py#L91)๋ฅผ ์ฐธ์กฐํ ์ ์์ต๋๋ค.
+- PyTorch์์ PyTorch๋ก ๋ชจ๋ธ์ ์ด์ ํ๋ ๊ฒฝ์ฐ, ์ข์ ์ฐธ๊ณ ์๋ฃ๋ก BART์ ๋ณํ ์คํฌ๋ฆฝํธ [์ฌ๊ธฐ](https://github.com/huggingface/transformers/blob/main/src/transformers/models/bart/convert_bart_original_pytorch_checkpoint_to_pytorch.py)๋ฅผ ์ฐธ์กฐํ ์ ์์ต๋๋ค.
+
+๋ค์์์๋ PyTorch ๋ชจ๋ธ์ด ๋ ์ด์ด ๊ฐ์ค์น๋ฅผ ์ ์ฅํ๊ณ ๋ ์ด์ด ์ด๋ฆ์ ์ ์ํ๋ ๋ฐฉ๋ฒ์ ๋ํด ๊ฐ๋จํ ์ค๋ช
ํ๊ฒ ์ต๋๋ค. PyTorch์์ ๋ ์ด์ด์ ์ด๋ฆ์ ๋ ์ด์ด์ ์ง์ ํ ํด๋์ค ์์ฑ์ ์ด๋ฆ์ผ๋ก ์ ์๋ฉ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด PyTorch์์ `SimpleModel`์ด๋ผ๋ ๋๋ฏธ ๋ชจ๋ธ์ ์ ์ํด ๋ด
์๋ค:
+
+```python
+from torch import nn
+
+
+class SimpleModel(nn.Module):
+ def __init__(self):
+ super().__init__()
+ self.dense = nn.Linear(10, 10)
+ self.intermediate = nn.Linear(10, 10)
+ self.layer_norm = nn.LayerNorm(10)
+```
+
+์ด์ ์ด ๋ชจ๋ธ ์ ์์ ์ธ์คํด์ค๋ฅผ ์์ฑํ ์ ์์ผ๋ฉฐ `dense`, `intermediate`, `layer_norm` ๋ฑ์ ๊ฐ์ค์น๊ฐ ๋๋คํ๊ฒ ํ ๋น๋ฉ๋๋ค. ๋ชจ๋ธ์ ์ถ๋ ฅํ์ฌ ์ํคํ
์ฒ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
+
+```python
+model = SimpleModel()
+
+print(model)
+```
+
+์ด๋ ๋ค์๊ณผ ๊ฐ์ด ์ถ๋ ฅ๋ฉ๋๋ค:
+
+```
+SimpleModel(
+ (dense): Linear(in_features=10, out_features=10, bias=True)
+ (intermediate): Linear(in_features=10, out_features=10, bias=True)
+ (layer_norm): LayerNorm((10,), eps=1e-05, elementwise_affine=True)
+)
+```
+
+์ฐ๋ฆฌ๋ ๋ ์ด์ด์ ์ด๋ฆ์ด PyTorch์์ ํด๋์ค ์์ฑ์ ์ด๋ฆ์ผ๋ก ์ ์๋์ด ์๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. ํน์ ๋ ์ด์ด์ ๊ฐ์ค์น ๊ฐ์ ์ถ๋ ฅํ์ฌ ํ์ธํ ์ ์์ต๋๋ค:
+
+```python
+print(model.dense.weight.data)
+```
+
+๊ฐ์ค์น๊ฐ ๋ฌด์์๋ก ์ด๊ธฐํ๋์์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+```
+tensor([[-0.0818, 0.2207, -0.0749, -0.0030, 0.0045, -0.1569, -0.1598, 0.0212,
+ -0.2077, 0.2157],
+ [ 0.1044, 0.0201, 0.0990, 0.2482, 0.3116, 0.2509, 0.2866, -0.2190,
+ 0.2166, -0.0212],
+ [-0.2000, 0.1107, -0.1999, -0.3119, 0.1559, 0.0993, 0.1776, -0.1950,
+ -0.1023, -0.0447],
+ [-0.0888, -0.1092, 0.2281, 0.0336, 0.1817, -0.0115, 0.2096, 0.1415,
+ -0.1876, -0.2467],
+ [ 0.2208, -0.2352, -0.1426, -0.2636, -0.2889, -0.2061, -0.2849, -0.0465,
+ 0.2577, 0.0402],
+ [ 0.1502, 0.2465, 0.2566, 0.0693, 0.2352, -0.0530, 0.1859, -0.0604,
+ 0.2132, 0.1680],
+ [ 0.1733, -0.2407, -0.1721, 0.1484, 0.0358, -0.0633, -0.0721, -0.0090,
+ 0.2707, -0.2509],
+ [-0.1173, 0.1561, 0.2945, 0.0595, -0.1996, 0.2988, -0.0802, 0.0407,
+ 0.1829, -0.1568],
+ [-0.1164, -0.2228, -0.0403, 0.0428, 0.1339, 0.0047, 0.1967, 0.2923,
+ 0.0333, -0.0536],
+ [-0.1492, -0.1616, 0.1057, 0.1950, -0.2807, -0.2710, -0.1586, 0.0739,
+ 0.2220, 0.2358]]).
+```
+
+๋ณํ ์คํฌ๋ฆฝํธ์์๋ ์ด๋ฌํ ๋ฌด์์๋ก ์ด๊ธฐํ๋ ๊ฐ์ค์น๋ฅผ ์ฒดํฌํฌ์ธํธ์ ํด๋น ๋ ์ด์ด์ ์ ํํ ๊ฐ์ค์น๋ก ์ฑ์์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค๋ฉด ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```python
+# retrieve matching layer weights, e.g. by
+# recursive algorithm
+layer_name = "dense"
+pretrained_weight = array_of_dense_layer
+
+model_pointer = getattr(model, "dense")
+
+model_pointer.weight.data = torch.from_numpy(pretrained_weight)
+```
+
+์ด๋ ๊ฒ ํ๋ฉด PyTorch ๋ชจ๋ธ์ ๋ฌด์์๋ก ์ด๊ธฐํ๋ ๊ฐ ๊ฐ์ค์น์ ํด๋น ์ฒดํฌํฌ์ธํธ ๊ฐ์ค์น๊ฐ **๋ชจ์๊ณผ ์ด๋ฆ** ๋ชจ๋์์ ์ ํํ ์ผ์นํ๋์ง ํ์ธํด์ผ ํฉ๋๋ค. ์ด๋ฅผ ์ํด ๋ชจ์์ ๋ํ assert ๋ฌธ์ ์ถ๊ฐํ๊ณ ์ฒดํฌํฌ์ธํธ ๊ฐ์ค์น์ ์ด๋ฆ์ ์ถ๋ ฅํด์ผ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด ๋ค์๊ณผ ๊ฐ์ ๋ฌธ์ฅ์ ์ถ๊ฐํด์ผ ํฉ๋๋ค:
+
+```python
+assert (
+ model_pointer.weight.shape == pretrained_weight.shape
+), f"Pointer shape of random weight {model_pointer.shape} and array shape of checkpoint weight {pretrained_weight.shape} mismatched"
+```
+
+๋ํ ๋ ๊ฐ์ค์น์ ์ด๋ฆ์ ์ถ๋ ฅํ์ฌ ์ผ์นํ๋์ง ํ์ธํด์ผ ํฉ๋๋ค. *์์*:
+
+```python
+logger.info(f"Initialize PyTorch weight {layer_name} from {pretrained_weight.name}")
+```
+
+๋ชจ์ ๋๋ ์ด๋ฆ์ด ์ผ์นํ์ง ์๋ ๊ฒฝ์ฐ, ๋๋ค์ผ๋ก ์ด๊ธฐํ๋ ๋ ์ด์ด์ ์๋ชป๋ ์ฒดํฌํฌ์ธํธ ๊ฐ์ค์น๋ฅผ ํ ๋นํ ๊ฒ์ผ๋ก ์ถ์ธก๋ฉ๋๋ค.
+
+์๋ชป๋ ๋ชจ์์ `BrandNewBertConfig()`์ ๊ตฌ์ฑ ๋งค๊ฐ๋ณ์ ์ค์ ์ด ๋ณํํ๋ ค๋ ์ฒดํฌํฌ์ธํธ์ ์ฌ์ฉ๋ ์ค์ ๊ณผ ์ ํํ ์ผ์นํ์ง ์๊ธฐ ๋๋ฌธ์ผ ๊ฐ๋ฅ์ฑ์ด ๊ฐ์ฅ ํฝ๋๋ค. ๊ทธ๋ฌ๋ PyTorch์ ๋ ์ด์ด ๊ตฌํ ์์ฒด์์ ๊ฐ์ค์น๋ฅผ ์ ์นํด์ผ ํ ์๋ ์์ต๋๋ค.
+
+๋ง์ง๋ง์ผ๋ก, **๋ชจ๋ ** ํ์ํ ๊ฐ์ค์น๊ฐ ์ด๊ธฐํ๋์๋์ง ํ์ธํ๊ณ ์ด๊ธฐํ์ ์ฌ์ฉ๋์ง ์์ ๋ชจ๋ ์ฒดํฌํฌ์ธํธ ๊ฐ์ค์น๋ฅผ ์ถ๋ ฅํ์ฌ ๋ชจ๋ธ์ด ์ฌ๋ฐ๋ฅด๊ฒ ๋ณํ๋์๋์ง ํ์ธํด์ผ ํฉ๋๋ค. ์๋ชป๋ ๋ชจ์ ๋ฌธ์ฅ์ด๋ ์๋ชป๋ ์ด๋ฆ ํ ๋น์ผ๋ก ์ธํด ๋ณํ ์๋๊ฐ ์คํจํ๋ ๊ฒ์ ์์ ํ ์ ์์
๋๋ค. ์ด๋ `BrandNewBertConfig()`์์ ์๋ชป๋ ๋งค๊ฐ๋ณ์๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ ๐ค Transformers ๊ตฌํ์์ ์๋ชป๋ ์ํคํ
์ฒ, ๐ค Transformers ๊ตฌํ์ ๊ตฌ์ฑ ์์ ์ค ํ๋์ `init()` ํจ์์ ๋ฒ๊ทธ๊ฐ ์๋ ๊ฒฝ์ฐ์ด๊ฑฐ๋ ์ฒดํฌํฌ์ธํธ ๊ฐ์ค์น ์ค ํ๋๋ฅผ ์ ์นํด์ผ ํ๋ ๊ฒฝ์ฐ์ผ ๊ฐ๋ฅ์ฑ์ด ๊ฐ์ฅ ๋์ต๋๋ค.
+
+์ด ๋จ๊ณ๋ ์ด์ ๋จ๊ณ์ ํจ๊ป ๋ฐ๋ณต๋์ด์ผ ํ๋ฉฐ ๋ชจ๋ ์ฒดํฌํฌ์ธํธ์ ๊ฐ์ค์น๊ฐ Transformers ๋ชจ๋ธ์ ์ฌ๋ฐ๋ฅด๊ฒ ๋ก๋๋์์ ๋๊น์ง ๊ณ์๋์ด์ผ ํฉ๋๋ค. ๐ค Transformers ๊ตฌํ์ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ๋ฐ๋ฅด๊ฒ ๋ก๋ํ ํ์๋ `/path/to/converted/checkpoint/folder`์ ๊ฐ์ ์ํ๋ ํด๋์ ๋ชจ๋ธ์ ์ ์ฅํ ์ ์์ด์ผ ํฉ๋๋ค. ํด๋น ํด๋์๋ `pytorch_model.bin` ํ์ผ๊ณผ `config.json` ํ์ผ์ด ๋ชจ๋ ํฌํจ๋์ด์ผ ํฉ๋๋ค.
+
+```python
+model.save_pretrained("/path/to/converted/checkpoint/folder")
+```
+
+**7. ์๋ฐฉํฅ ํจ์ค ๊ตฌํํ๊ธฐ**
+
+๐ค Transformers ๊ตฌํ์ ์ฌ์ ํ๋ จ๋ ๊ฐ์ค์น๋ฅผ ์ ํํ๊ฒ ๋ก๋ํ ํ์๋ ์๋ฐฉํฅ ํจ์ค๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌํ๋์๋์ง ํ์ธํด์ผ ํฉ๋๋ค. [์๋ณธ ์ ์ฅ์์ ์ต์ํด์ง๊ธฐ](#3-4-run-a-pretrained-checkpoint-using-the-original-repository)์์ ์ด๋ฏธ ์๋ณธ ์ ์ฅ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ์๋ฐฉํฅ ํจ์ค๋ฅผ ์คํํ๋ ์คํฌ๋ฆฝํธ๋ฅผ ๋ง๋ค์์ต๋๋ค. ์ด์ ์๋ณธ ๋์ ๐ค Transformers ๊ตฌํ์ ์ฌ์ฉํ๋ ์ ์ฌํ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ์์ฑ๋์ด์ผ ํฉ๋๋ค:
+
+```python
+model = BrandNewBertModel.from_pretrained("/path/to/converted/checkpoint/folder")
+input_ids = [0, 4, 4, 3, 2, 4, 1, 7, 19]
+output = model(input_ids).last_hidden_states
+```
+
+๐ค Transformers ๊ตฌํ๊ณผ ์๋ณธ ๋ชจ๋ธ ๊ตฌํ์ด ์ฒ์๋ถํฐ ์ ํํ ๋์ผํ ์ถ๋ ฅ์ ์ ๊ณตํ์ง ์๊ฑฐ๋ ์๋ฐฉํฅ ํจ์ค์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ ๊ฐ๋ฅ์ฑ์ด ๋งค์ฐ ๋์ต๋๋ค. ์ค๋งํ์ง ๋ง์ธ์. ์์๋ ์ผ์
๋๋ค! ๋จผ์ , ์๋ฐฉํฅ ํจ์ค์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ง ์๋๋ก ํด์ผ ํฉ๋๋ค. ์ข
์ข
์๋ชป๋ ์ฐจ์์ด ์ฌ์ฉ๋์ด *์ฐจ์ ๋ถ์ผ์น* ์ค๋ฅ๊ฐ ๋ฐ์ํ๊ฑฐ๋ ์๋ชป๋ ๋ฐ์ดํฐ ์ ํ ๊ฐ์ฒด๊ฐ ์ฌ์ฉ๋๋ ๊ฒฝ์ฐ๊ฐ ์์ต๋๋ค. ์๋ฅผ ๋ค๋ฉด `torch.long` ๋์ ์ `torch.float32`๊ฐ ์ฌ์ฉ๋ ๊ฒฝ์ฐ์
๋๋ค. ํด๊ฒฐํ ์ ์๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ฉด Hugging Face ํ์ ๋์์ ์์ฒญํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+๐ค Transformers ๊ตฌํ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํ๋์ง ํ์ธํ๋ ๋ง์ง๋ง ๋จ๊ณ๋ ์ถ๋ ฅ์ด `1e-3`์ ์ ๋ฐ๋๋ก ๋์ผํ์ง ํ์ธํ๋ ๊ฒ์
๋๋ค. ๋จผ์ , ์ถ๋ ฅ ๋ชจ์์ด ๋์ผํ๋๋ก ๋ณด์ฅํด์ผ ํฉ๋๋ค. ์ฆ, ๐ค Transformers ๊ตฌํ ์คํฌ๋ฆฝํธ์ ์๋ณธ ๊ตฌํ ์ฌ์ด์์ `outputs.shape`๋ ๋์ผํ ๊ฐ์ ๋ฐํํด์ผ ํฉ๋๋ค. ๊ทธ ๋ค์์ผ๋ก, ์ถ๋ ฅ ๊ฐ์ด ๋์ผํ๋๋ก ํด์ผ ํฉ๋๋ค. ์ด๋ ์๋ก์ด ๋ชจ๋ธ์ ์ถ๊ฐํ ๋ ๊ฐ์ฅ ์ด๋ ค์ด ๋ถ๋ถ ์ค ํ๋์
๋๋ค. ์ถ๋ ฅ์ด ๋์ผํ์ง ์์ ์ผ๋ฐ์ ์ธ ์ค์ ์ฌ๋ก๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+- ์ผ๋ถ ๋ ์ด์ด๊ฐ ์ถ๊ฐ๋์ง ์์์ต๋๋ค. ์ฆ, *ํ์ฑํ* ๋ ์ด์ด๊ฐ ์ถ๊ฐ๋์ง ์์๊ฑฐ๋ ์์ฐจ ์ฐ๊ฒฐ์ด ๋น ์ก์ต๋๋ค.
+- ๋จ์ด ์๋ฒ ๋ฉ ํ๋ ฌ์ด ์ฐ๊ฒฐ๋์ง ์์์ต๋๋ค.
+- ์๋ชป๋ ์์น ์๋ฒ ๋ฉ์ด ์ฌ์ฉ๋์์ต๋๋ค. ์๋ณธ ๊ตฌํ์์๋ ์คํ์
์ ์ฌ์ฉํฉ๋๋ค.
+- ์๋ฐฉํฅ ํจ์ค ์ค์ Dropout์ด ์ ์ฉ๋์์ต๋๋ค. ์ด๋ฅผ ์์ ํ๋ ค๋ฉด *model.training์ด False*์ธ์ง ํ์ธํ๊ณ ์๋ฐฉํฅ ํจ์ค ์ค์ Dropout ๋ ์ด์ด๊ฐ ์๋ชป ํ์ฑํ๋์ง ์๋๋ก ํ์ธ์. ์ฆ, [PyTorch์ ๊ธฐ๋ฅ์ Dropout](https://pytorch.org/docs/stable/nn.functional.html?highlight=dropout#torch.nn.functional.dropout)์ *self.training*์ ์ ๋ฌํ์ธ์.
+
+๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๊ฐ์ฅ ์ข์ ๋ฐฉ๋ฒ์ ์ผ๋ฐ์ ์ผ๋ก ์๋ณธ ๊ตฌํ๊ณผ ๐ค Transformers ๊ตฌํ์ ์๋ฐฉํฅ ํจ์ค๋ฅผ ๋๋ํ ๋๊ณ ์ฐจ์ด์ ์ด ์๋์ง ํ์ธํ๋ ๊ฒ์
๋๋ค. ์ด์์ ์ผ๋ก๋ ์๋ฐฉํฅ ํจ์ค์ ์ค๊ฐ ์ถ๋ ฅ์ ๋๋ฒ๊ทธ/์ถ๋ ฅํ์ฌ ์๋ณธ ๊ตฌํ๊ณผ ๐ค Transformers ๊ตฌํ์ ์ ํํ ์์น๋ฅผ ์ฐพ์ ์ ์์ด์ผ ํฉ๋๋ค. ๋จผ์ , ๋ ์คํฌ๋ฆฝํธ์ ํ๋์ฝ๋ฉ๋ `input_ids`๊ฐ ๋์ผํ์ง ํ์ธํ์ธ์. ๋ค์์ผ๋ก, `input_ids`์ ์ฒซ ๋ฒ์งธ ๋ณํ์ ์ถ๋ ฅ(์ผ๋ฐ์ ์ผ๋ก ๋จ์ด ์๋ฒ ๋ฉ)์ด ๋์ผํ์ง ํ์ธํ์ธ์. ๊ทธ๋ฐ ๋ค์ ๋คํธ์ํฌ์ ๊ฐ์ฅ ๋ง์ง๋ง ๋ ์ด์ด๊น์ง ์งํํด๋ณด์ธ์. ์ด๋ ์์ ์์ ๋ ๊ตฌํ ์ฌ์ด์ ์ฐจ์ด๊ฐ ์๋ ๊ฒ์ ์๊ฒ ๋๋๋ฐ, ์ด๋ ๐ค Transformers ๊ตฌํ์ ๋ฒ๊ทธ ์์น๋ฅผ ๊ฐ๋ฆฌํฌ ๊ฒ์
๋๋ค. ์ ํฌ ๊ฒฝํ์์ผ๋ก๋ ์๋ณธ ๊ตฌํ๊ณผ ๐ค Transformers ๊ตฌํ ๋ชจ๋์์ ๋์ผํ ์์น์ ๋ง์ ์ถ๋ ฅ ๋ฌธ์ ์ถ๊ฐํ๊ณ ์ด๋ค์ ์ค๊ฐ ํํ์ ๋ํด ๋์ผํ ๊ฐ์ ๋ณด์ด๋ ์ถ๋ ฅ ๋ฌธ์ ์ฐ์์ ์ผ๋ก ์ ๊ฑฐํ๋ ๊ฒ์ด ๊ฐ๋จํ๊ณ ํจ๊ณผ์ ์ธ ๋ฐฉ๋ฒ์
๋๋ค.
+
+`torch.allclose(original_output, output, atol=1e-3)`๋ก ์ถ๋ ฅ์ ํ์ธํ์ฌ ๋ ๊ตฌํ์ด ๋์ผํ ์ถ๋ ฅ์ ํ๋ ๊ฒ์ ํ์ ํ๋ค๋ฉด, ๊ฐ์ฅ ์ด๋ ค์ด ๋ถ๋ถ์ ๋๋ฌ์ต๋๋ค! ์ถํ๋๋ฆฝ๋๋ค. ๋จ์ ์์
์ ์ฌ์ด ์ผ์ด ๋ ๊ฒ์
๋๋ค ๐.
+
+**8. ํ์ํ ๋ชจ๋ ๋ชจ๋ธ ํ
์คํธ ์ถ๊ฐํ๊ธฐ**
+
+์ด ์์ ์์ ์๋ก์ด ๋ชจ๋ธ์ ์ฑ๊ณต์ ์ผ๋ก ์ถ๊ฐํ์ต๋๋ค. ๊ทธ๋ฌ๋ ํด๋น ๋ชจ๋ธ์ด ์๊ตฌ๋๋ ๋์์ธ์ ์์ ํ ๋ถํฉํ์ง ์์ ์๋ ์์ต๋๋ค. ๐ค Transformers์ ์๋ฒฝํ๊ฒ ํธํ๋๋ ๊ตฌํ์ธ์ง ํ์ธํ๊ธฐ ์ํด ๋ชจ๋ ์ผ๋ฐ ํ
์คํธ๋ฅผ ํต๊ณผํด์ผ ํฉ๋๋ค. Cookiecutter๋ ์๋ง๋ ๋ชจ๋ธ์ ์ํ ํ
์คํธ ํ์ผ์ ์๋์ผ๋ก ์ถ๊ฐํ์ ๊ฒ์
๋๋ค. ์๋ง๋ `tests/models/brand_new_bert/test_modeling_brand_new_bert.py`์ ๊ฐ์ ๊ฒฝ๋ก์ ์์นํ ๊ฒ์
๋๋ค. ์ด ํ
์คํธ ํ์ผ์ ์คํํ์ฌ ์ผ๋ฐ ํ
์คํธ๊ฐ ๋ชจ๋ ํต๊ณผํ๋์ง ํ์ธํ์ธ์.
+
+```bash
+pytest tests/models/brand_new_bert/test_modeling_brand_new_bert.py
+```
+
+๋ชจ๋ ์ผ๋ฐ ํ
์คํธ๋ฅผ ์์ ํ ํ, ์ด์ ์ํํ ์์
์ ์ถฉ๋ถํ ํ
์คํธํ์ฌ ๋ค์ ์ฌํญ์ ๋ณด์ฅํด์ผ ํฉ๋๋ค.
+
+- a) ์ปค๋ฎค๋ํฐ๊ฐ *brand_new_bert*์ ํน์ ํ
์คํธ๋ฅผ ์ดํด๋ด์ผ๋ก์จ ์์
์ ์ฝ๊ฒ ์ดํดํ ์ ์๋๋ก ํจ
+- b) ๋ชจ๋ธ์ ๋ํ ํฅํ ๋ณ๊ฒฝ ์ฌํญ์ด ๋ชจ๋ธ์ ์ค์ํ ๊ธฐ๋ฅ์ ์์์ํค์ง ์๋๋ก ํจ
+
+๋จผ์ ํตํฉ ํ
์คํธ๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค. ์ด๋ฌํ ํตํฉ ํ
์คํธ๋ ์ด์ ์ ๋ชจ๋ธ์ ๐ค Transformers๋ก ๊ตฌํํ๊ธฐ ์ํด ์ฌ์ฉํ ๋๋ฒ๊น
์คํฌ๋ฆฝํธ์ ๋์ผํ ์์
์ ์ํํฉ๋๋ค. Cookiecutter์ ์ด๋ฏธ ์ด๋ฌํ ๋ชจ๋ธ ํ
์คํธ์ ํ
ํ๋ฆฟ์ธ `BrandNewBertModelIntegrationTests`๊ฐ ์ถ๊ฐ๋์ด ์์ผ๋ฉฐ, ์ฌ๋ฌ๋ถ์ด ์์ฑํด์ผ ํ ๋ด์ฉ์ผ๋ก๋ง ์ฑ์ ๋ฃ์ผ๋ฉด ๋ฉ๋๋ค. ์ด๋ฌํ ํ
์คํธ๊ฐ ํต๊ณผํ๋์ง ํ์ธํ๋ ค๋ฉด ๋ค์์ ์คํํ์ธ์.
+
+```bash
+RUN_SLOW=1 pytest -sv tests/models/brand_new_bert/test_modeling_brand_new_bert.py::BrandNewBertModelIntegrationTests
+```
+
+
+
+Windows๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ `RUN_SLOW=1`์ `SET RUN_SLOW=1`๋ก ๋ฐ๊ฟ์ผ ํฉ๋๋ค.
+
+
+
+๋์งธ๋ก, *brand_new_bert*์ ํนํ๋ ๋ชจ๋ ๊ธฐ๋ฅ๋ ๋ณ๋์ ํ
์คํธ์์ ์ถ๊ฐ๋ก ํ
์คํธํด์ผ ํฉ๋๋ค. ์ด ๋ถ๋ถ์ ์ข
์ข
์ํ๋๋ฐ, ๋ ๊ฐ์ง ์ธก๋ฉด์์ ๊ต์ฅํ ์ ์ฉํฉ๋๋ค.
+
+- *brand_new_bert*์ ํน์ ๊ธฐ๋ฅ์ด ์ด๋ป๊ฒ ์๋ํด์ผ ํ๋์ง ๋ณด์ฌ์ค์ผ๋ก์จ ์ปค๋ฎค๋ํฐ์๊ฒ ๋ชจ๋ธ ์ถ๊ฐ ๊ณผ์ ์์ ์ต๋ํ ์ง์์ ์ ๋ฌํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
+- ํฅํ ๊ธฐ์ฌ์๋ ์ด๋ฌํ ํน์ ํ
์คํธ๋ฅผ ์คํํ์ฌ ๋ชจ๋ธ์ ๋ํ ๋ณ๊ฒฝ ์ฌํญ์ ๋น ๋ฅด๊ฒ ํ
์คํธํ ์ ์์ต๋๋ค.
+
+
+**9. ํ ํฌ๋์ด์ ๊ตฌํํ๊ธฐ**
+
+๋ค์์ผ๋ก, *brand_new_bert*์ ํ ํฌ๋์ด์ ๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค. ๋ณดํต ํ ํฌ๋์ด์ ๋ ๐ค Transformers์ ๊ธฐ์กด ํ ํฌ๋์ด์ ์ ๋์ผํ๊ฑฐ๋ ๋งค์ฐ ์ ์ฌํฉ๋๋ค.
+
+ํ ํฌ๋์ด์ ๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํ๋์ง ํ์ธํ๊ธฐ ์ํด ๋จผ์ ์๋ณธ ๋ฆฌํฌ์งํ ๋ฆฌ์์ ๋ฌธ์์ด์ ์
๋ ฅํ๊ณ `input_ids`๋ฅผ ๋ฐํํ๋ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ๋ค์๊ณผ ๊ฐ์ ์ ์ฌํ ์คํฌ๋ฆฝํธ์ผ ์ ์์ต๋๋ค (์์ฌ ์ฝ๋๋ก ์์ฑ):
+
+```python
+input_str = "This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words."
+model = BrandNewBertModel.load_pretrained_checkpoint("/path/to/checkpoint/")
+input_ids = model.tokenize(input_str)
+```
+
+์๋ณธ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์์ธํ ์ดํด๋ณด๊ณ ์ฌ๋ฐ๋ฅธ ํ ํฌ๋์ด์ ํจ์๋ฅผ ์ฐพ๊ฑฐ๋, ๋ณต์ ๋ณธ์์ ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฉํ์ฌ `input_ids`๋ง ์ถ๋ ฅํ๋๋ก ํด์ผ ํฉ๋๋ค. ์๋ณธ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๊ธฐ๋ฅ์ ์ธ ํ ํฐํ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ ํ, ๐ค Transformers์ ์ ์ฌํ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ์์ฑ๋์ด์ผ ํฉ๋๋ค:
+
+```python
+from transformers import BrandNewBertTokenizer
+
+input_str = "This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words."
+
+tokenizer = BrandNewBertTokenizer.from_pretrained("/path/to/tokenizer/folder/")
+
+input_ids = tokenizer(input_str).input_ids
+```
+
+๋ ๊ฐ์ `input_ids`๊ฐ ๋์ผํ ๊ฐ์ ๋ฐํํ ๋, ๋ง์ง๋ง ๋จ๊ณ๋ก ํ ํฌ๋์ด์ ํ
์คํธ ํ์ผ๋ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
+
+*brand_new_bert*์ ๋ชจ๋ธ๋ง ํ
์คํธ ํ์ผ๊ณผ ์ ์ฌํ๊ฒ, *brand_new_bert*์ ํ ํฌ๋์ด์ ์ด์
ํ
์คํธ ํ์ผ์๋ ๋ช ๊ฐ์ง ํ๋์ฝ๋ฉ๋ ํตํฉ ํ
์คํธ๊ฐ ํฌํจ๋์ด์ผ ํฉ๋๋ค.
+
+**10. ์ข
๋จ ๊ฐ ํตํฉ ํ
์คํธ ์คํ**
+
+ํ ํฌ๋์ด์ ๋ฅผ ์ถ๊ฐํ ํ์๋ ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํ์ฌ ๋ช ๊ฐ์ง ์ข
๋จ ๊ฐ ํตํฉ ํ
์คํธ๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค. `tests/models/brand_new_bert/test_modeling_brand_new_bert.py`์ ์ถ๊ฐํด์ฃผ์ธ์. ์ด๋ฌํ ํ
์คํธ๋ ๐ค Transformers ๊ตฌํ์ด ์์๋๋ก ์๋ํ๋์ง๋ฅผ ์๋ฏธ ์๋ text-to-text ์์๋ก ๋ณด์ฌ์ค์ผ ํฉ๋๋ค. ๊ทธ ์์๋ก๋ *์๋ฅผ ๋ค์ด* source-to-target ๋ฒ์ญ ์, article-to-summary ์, question-to-answer ์ ๋ฑ์ด ํฌํจ๋ ์ ์์ต๋๋ค. ๋ถ๋ฌ์จ ์ฒดํฌํฌ์ธํธ ์ค ์ด๋ ๊ฒ๋ ๋ค์ด์คํธ๋ฆผ ์์
์์ ๋ฏธ์ธ ์กฐ์ ๋์ง ์์๋ค๋ฉด, ๋ชจ๋ธ ํ
์คํธ๋ง์ผ๋ก ์ถฉ๋ถํฉ๋๋ค. ๋ชจ๋ธ์ด ์์ ํ ๊ธฐ๋ฅ์ ๊ฐ์ถ์๋์ง ํ์ธํ๊ธฐ ์ํด ๋ง์ง๋ง ๋จ๊ณ๋ก GPU์์ ๋ชจ๋ ํ
์คํธ๋ฅผ ์คํํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ๋ชจ๋ธ์ ๋ด๋ถ ํ
์์ ์ผ๋ถ์ `.to(self.device)` ๋ฌธ์ ์ถ๊ฐํ๋ ๊ฒ์ ์์์ ์ ์์ผ๋ฉฐ, ์ด ๊ฒฝ์ฐ ํ
์คํธ์์ ์ค๋ฅ๋ก ํ์๋ฉ๋๋ค. GPU์ ์ก์ธ์คํ ์ ์๋ ๊ฒฝ์ฐ, Hugging Face ํ์ด ํ
์คํธ๋ฅผ ๋์ ์คํํ ์ ์์ต๋๋ค.
+
+**11. ๊ธฐ์ ๋ฌธ์ ์ถ๊ฐ**
+
+์ด์ *brand_new_bert*์ ํ์ํ ๋ชจ๋ ๊ธฐ๋ฅ์ด ์ถ๊ฐ๋์์ต๋๋ค. ๊ฑฐ์ ๋๋ฌ์ต๋๋ค! ์ถ๊ฐํด์ผ ํ ๊ฒ์ ๋ฉ์ง ๊ธฐ์ ๋ฌธ์๊ณผ ๊ธฐ์ ๋ฌธ์ ํ์ด์ง์
๋๋ค. Cookiecutter๊ฐ `docs/source/model_doc/brand_new_bert.md`๋ผ๋ ํ
ํ๋ฆฟ ํ์ผ์ ์ถ๊ฐํด์คฌ์ ๊ฒ์
๋๋ค. ์ด ํ์ด์ง๋ฅผ ์ฌ์ฉํ๊ธฐ ์ ์ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ์ฌ์ฉ์๋ค์ ์ผ๋ฐ์ ์ผ๋ก ์ด ํ์ด์ง๋ฅผ ๋จผ์ ํ์ธํฉ๋๋ค. ๋ฐ๋ผ์ ๋ฌธ์๋ ์ดํดํ๊ธฐ ์ฝ๊ณ ๊ฐ๊ฒฐํด์ผ ํฉ๋๋ค. ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ฃผ๊ธฐ ์ํด *ํ*์ ์ถ๊ฐํ๋ ๊ฒ์ด ์ปค๋ฎค๋ํฐ์ ๋งค์ฐ ์ ์ฉํฉ๋๋ค. ๋
์คํธ๋ง์ ๊ด๋ จํ์ฌ Hugging Face ํ์ ๋ฌธ์ํ๋ ๊ฒ์ ์ฃผ์ ํ์ง ๋ง์ธ์.
+
+๋ค์์ผ๋ก, `src/transformers/models/brand_new_bert/modeling_brand_new_bert.py`์ ์ถ๊ฐ๋ ๋
์คํธ๋ง์ด ์ฌ๋ฐ๋ฅด๋ฉฐ ํ์ํ ๋ชจ๋ ์
๋ ฅ ๋ฐ ์ถ๋ ฅ์ ํฌํจํ๋๋ก ํ์ธํ์ธ์. [์ฌ๊ธฐ](writing-documentation)์์ ์ฐ๋ฆฌ์ ๋ฌธ์ ์์ฑ ๊ฐ์ด๋์ ๋
์คํธ๋ง ํ์์ ๋ํ ์์ธ ๊ฐ์ด๋๊ฐ ์์ต๋๋ค. ๋ฌธ์๋ ์ผ๋ฐ์ ์ผ๋ก ์ปค๋ฎค๋ํฐ์ ๋ชจ๋ธ์ ์ฒซ ๋ฒ์งธ ์ ์ ์ด๊ธฐ ๋๋ฌธ์, ๋ฌธ์๋ ์ ์ด๋ ์ฝ๋๋งํผ์ ์ฃผ์๋ฅผ ๊ธฐ์ธ์ฌ์ผ ํฉ๋๋ค.
+
+**์ฝ๋ ๋ฆฌํฉํ ๋ง**
+
+์ข์์, ์ด์ *brand_new_bert*๋ฅผ ์ํ ๋ชจ๋ ํ์ํ ์ฝ๋๋ฅผ ์ถ๊ฐํ์ต๋๋ค. ์ด ์์ ์์ ๋ค์์ ์คํํ์ฌ ์ ์ฌ์ ์ผ๋ก ์๋ชป๋ ์ฝ๋ ์คํ์ผ์ ์์ ํด์ผ ํฉ๋๋ค:
+
+๊ทธ๋ฆฌ๊ณ ์ฝ๋ฉ ์คํ์ผ์ด ํ์ง ์ ๊ฒ์ ํต๊ณผํ๋์ง ํ์ธํ๊ธฐ ์ํด ๋ค์์ ์คํํ๊ณ ํ์ธํด์ผ ํฉ๋๋ค:
+
+```bash
+make style
+```
+
+๐ค Transformers์๋ ์ฌ์ ํ ์คํจํ ์ ์๋ ๋ช ๊ฐ์ง ๋งค์ฐ ์๊ฒฉํ ๋์์ธ ํ
์คํธ๊ฐ ์์ต๋๋ค. ์ด๋ ๋
์คํธ๋ง์ ๋๋ฝ๋ ์ ๋ณด๋ ์๋ชป๋ ๋ช
๋ช
๋๋ฌธ์ ์ข
์ข
๋ฐ์ํฉ๋๋ค. ์ฌ๊ธฐ์ ๋งํ๋ฉด Hugging Face ํ์ด ๋์์ ์ค ๊ฒ์
๋๋ค.
+
+```bash
+make quality
+```
+
+๋ง์ง๋ง์ผ๋ก, ์ฝ๋๊ฐ ์ ํํ ์๋ํ๋ ๊ฒ์ ํ์ธํ ํ์๋ ํญ์ ์ฝ๋๋ฅผ ๋ฆฌํฉํ ๋งํ๋ ๊ฒ์ด ์ข์ ์๊ฐ์
๋๋ค. ๋ชจ๋ ํ
์คํธ๊ฐ ํต๊ณผ๋ ์ง๊ธ์ ์ถ๊ฐํ ์ฝ๋๋ฅผ ๋ค์ ๊ฒํ ํ๊ณ ๋ฆฌํฉํ ๋งํ๋ ์ข์ ์๊ธฐ์
๋๋ค.
+
+์ด์ ์ฝ๋ฉ ๋ถ๋ถ์ ์๋ฃํ์ต๋๋ค. ์ถํํฉ๋๋ค! ๐ ๋ฉ์ ธ์! ๐
+
+**12. ๋ชจ๋ธ์ ๋ชจ๋ธ ํ๋ธ์ ์
๋ก๋ํ์ธ์**
+
+์ด ๋ง์ง๋ง ํํธ์์๋ ๋ชจ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ณํํ์ฌ ๋ชจ๋ธ ํ๋ธ์ ์
๋ก๋ํ๊ณ ๊ฐ ์
๋ก๋๋ ๋ชจ๋ธ ์ฒดํฌํฌ์ธํธ์ ๋ํ ๋ชจ๋ธ ์นด๋๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค. [Model sharing and uploading Page](model_sharing)๋ฅผ ์ฝ๊ณ ํ๋ธ ๊ธฐ๋ฅ์ ์ต์ํด์ง์ธ์. *brand_new_bert*์ ์ ์ ์กฐ์ง ์๋์ ๋ชจ๋ธ์ ์
๋ก๋ํ ์ ์๋ ํ์ํ ์ก์ธ์ค ๊ถํ์ ์ป๊ธฐ ์ํด Hugging Face ํ๊ณผ ํ์
ํด์ผ ํฉ๋๋ค. `transformers`์ ๋ชจ๋ ๋ชจ๋ธ์ ์๋ `push_to_hub` ๋ฉ์๋๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ํ๋ธ์ ๋น ๋ฅด๊ณ ํจ์จ์ ์ผ๋ก ์
๋ก๋ํ๋ ๋ฐฉ๋ฒ์
๋๋ค. ์๋์ ์์ ์ฝ๋ ์กฐ๊ฐ์ด ๋ถ์ฌ์ ธ ์์ต๋๋ค:
+
+๊ฐ ์ฒดํฌํฌ์ธํธ์ ์ ํฉํ ๋ชจ๋ธ ์นด๋๋ฅผ ๋ง๋๋ ๋ฐ ์๊ฐ์ ํ ์ ํ๋ ๊ฒ์ ๊ฐ์น๊ฐ ์์ต๋๋ค. ๋ชจ๋ธ ์นด๋๋ ์ฒดํฌํฌ์ธํธ์ ํน์ฑ์ ๊ฐ์กฐํด์ผ ํฉ๋๋ค. *์๋ฅผ ๋ค์ด* ์ด ์ฒดํฌํฌ์ธํธ๋ ์ด๋ค ๋ฐ์ดํฐ์
์์ ์ฌ์ ํ๋ จ/์ธ๋ถ ํ๋ จ๋์๋์ง? ์ด ๋ชจ๋ธ์ ์ด๋ค ํ์ ์์
์์ ์ฌ์ฉํด์ผ ํ๋์ง? ๊ทธ๋ฆฌ๊ณ ๋ชจ๋ธ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ช ๊ฐ์ง ์ฝ๋๋ ํฌํจํด์ผ ํฉ๋๋ค.
+
+```python
+brand_new_bert.push_to_hub("brand_new_bert")
+# Uncomment the following line to push to an organization.
+# brand_new_bert.push_to_hub("/brand_new_bert")
+```
+
+**13. (์ ํ ์ฌํญ) ๋
ธํธ๋ถ ์ถ๊ฐ**
+
+*brand_new_bert*๋ฅผ ๋ค์ด์คํธ๋ฆผ ์์
์์ ์ถ๋ก ๋๋ ๋ฏธ์ธ ์กฐ์ ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์์ธํ ๋ณด์ฌ์ฃผ๋ ๋
ธํธ๋ถ์ ์ถ๊ฐํ๋ ๊ฒ์ด ๋งค์ฐ ์ ์ฉํฉ๋๋ค. ์ด๊ฒ์ PR์ ๋ณํฉํ๋ ๋ฐ ํ์์ ์ด์ง๋ ์์ง๋ง ์ปค๋ฎค๋ํฐ์ ๋งค์ฐ ์ ์ฉํฉ๋๋ค.
+
+**14. ์๋ฃ๋ PR ์ ์ถ**
+
+์ด์ ํ๋ก๊ทธ๋๋ฐ์ ๋ง์ณค์ผ๋ฉฐ, ๋ง์ง๋ง ๋จ๊ณ๋ก PR์ ๋ฉ์ธ ๋ธ๋์น์ ๋ณํฉํด์ผ ํฉ๋๋ค. ๋ณดํต Hugging Face ํ์ ์ด๋ฏธ ์ฌ๊ธฐ๊น์ง ๋์์ ์ฃผ์์ ๊ฒ์
๋๋ค. ๊ทธ๋ฌ๋ PR์ ๋ฉ์ง ์ค๋ช
์ ์ถ๊ฐํ๊ณ ๋ฆฌ๋ทฐ์ด์๊ฒ ํน์ ๋์์ธ ์ ํ ์ฌํญ์ ๊ฐ์กฐํ๋ ค๋ฉด ์๋ฃ๋ PR์ ์ฝ๊ฐ์ ์ค๋ช
์ ์ถ๊ฐํ๋ ์๊ฐ์ ํ ์ ํ๋ ๊ฒ์ด ๊ฐ์น๊ฐ ์์ต๋๋ค.
+
+### ์์
๋ฌผ์ ๊ณต์ ํ์ธ์!! [[share-your-work]]
+
+์ด์ ์ปค๋ฎค๋ํฐ์์ ์์
๋ฌผ์ ์ธ์ ๋ฐ์ ์๊ฐ์
๋๋ค! ๋ชจ๋ธ ์ถ๊ฐ ์์
์ ์๋ฃํ๋ ๊ฒ์ Transformers์ ์ ์ฒด NLP ์ปค๋ฎค๋ํฐ์ ํฐ ๊ธฐ์ฌ์
๋๋ค. ๋น์ ์ ์ฝ๋์ ์ด์๋ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ์๋ฐฑ, ์ฌ์ง์ด ์์ฒ ๋ช
์ ๊ฐ๋ฐ์์ ์ฐ๊ตฌ์์ ์ํด ํ์คํ ์ฌ์ฉ๋ ๊ฒ์
๋๋ค. ๋น์ ์ ์์
์ ์๋์ค๋ฌ์ํด์ผ ํ๋ฉฐ ์ด๋ฅผ ์ปค๋ฎค๋ํฐ์ ๊ณต์ ํด์ผ ํฉ๋๋ค.
+
+**๋น์ ์ ์ปค๋ฎค๋ํฐ ๋ด ๋ชจ๋ ์ฌ๋๋ค์๊ฒ ๋งค์ฐ ์ฝ๊ฒ ์ ๊ทผ ๊ฐ๋ฅํ ๋ ๋ค๋ฅธ ๋ชจ๋ธ์ ๋ง๋ค์์ต๋๋ค! ๐คฏ**
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/add_new_pipeline.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/add_new_pipeline.md
new file mode 100644
index 0000000000000000000000000000000000000000..42c9b57c9d7be675010069bc1803233befba410a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/add_new_pipeline.md
@@ -0,0 +1,244 @@
+
+
+# ์ด๋ป๊ฒ ์ฌ์ฉ์ ์ ์ ํ์ดํ๋ผ์ธ์ ์์ฑํ๋์? [[how-to-create-a-custom-pipeline]]
+
+์ด ๊ฐ์ด๋์์๋ ์ฌ์ฉ์ ์ ์ ํ์ดํ๋ผ์ธ์ ์ด๋ป๊ฒ ์์ฑํ๊ณ [ํ๋ธ](https://hf.co/models)์ ๊ณต์ ํ๊ฑฐ๋ ๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+
+๋จผ์ ํ์ดํ๋ผ์ธ์ด ์์ฉํ ์ ์๋ ์์ ์
๋ ฅ์ ๊ฒฐ์ ํด์ผ ํฉ๋๋ค.
+๋ฌธ์์ด, ์์ ๋ฐ์ดํธ, ๋์
๋๋ฆฌ ๋๋ ๊ฐ์ฅ ์ํ๋ ์
๋ ฅ์ผ ๊ฐ๋ฅ์ฑ์ด ๋์ ๊ฒ์ด๋ฉด ๋ฌด์์ด๋ ๊ฐ๋ฅํฉ๋๋ค.
+์ด ์
๋ ฅ์ ๊ฐ๋ฅํ ํ ์์ํ Python ํ์์ผ๋ก ์ ์งํด์ผ (JSON์ ํตํด ๋ค๋ฅธ ์ธ์ด์๋) ํธํ์ฑ์ด ์ข์์ง๋๋ค.
+์ด๊ฒ์ด ์ ์ฒ๋ฆฌ(`preprocess`) ํ์ดํ๋ผ์ธ์ ์
๋ ฅ(`inputs`)์ด ๋ ๊ฒ์
๋๋ค.
+
+๊ทธ๋ฐ ๋ค์ `outputs`๋ฅผ ์ ์ํ์ธ์.
+`inputs`์ ๊ฐ์ ์ ์ฑ
์ ๋ฐ๋ฅด๊ณ , ๊ฐ๋จํ ์๋ก ์ข์ต๋๋ค.
+์ด๊ฒ์ด ํ์ฒ๋ฆฌ(`postprocess`) ๋ฉ์๋์ ์ถ๋ ฅ์ด ๋ ๊ฒ์
๋๋ค.
+
+๋จผ์ 4๊ฐ์ ๋ฉ์๋(`preprocess`, `_forward`, `postprocess` ๋ฐ `_sanitize_parameters`)๋ฅผ ๊ตฌํํ๊ธฐ ์ํด ๊ธฐ๋ณธ ํด๋์ค `Pipeline`์ ์์ํ์ฌ ์์ํฉ๋๋ค.
+
+
+```python
+from transformers import Pipeline
+
+
+class MyPipeline(Pipeline):
+ def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "maybe_arg" in kwargs:
+ preprocess_kwargs["maybe_arg"] = kwargs["maybe_arg"]
+ return preprocess_kwargs, {}, {}
+
+ def preprocess(self, inputs, maybe_arg=2):
+ model_input = Tensor(inputs["input_ids"])
+ return {"model_input": model_input}
+
+ def _forward(self, model_inputs):
+ # model_inputs == {"model_input": model_input}
+ outputs = self.model(**model_inputs)
+ # Maybe {"logits": Tensor(...)}
+ return outputs
+
+ def postprocess(self, model_outputs):
+ best_class = model_outputs["logits"].softmax(-1)
+ return best_class
+```
+
+์ด ๋ถํ ๊ตฌ์กฐ๋ CPU/GPU์ ๋ํ ๋น๊ต์ ์ํํ ์ง์์ ์ ๊ณตํ๋ ๋์์, ๋ค๋ฅธ ์ค๋ ๋์์ CPU์ ๋ํ ์ฌ์ /์ฌํ ์ฒ๋ฆฌ๋ฅผ ์ํํ ์ ์๊ฒ ์ง์ํ๋ ๊ฒ์
๋๋ค.
+
+`preprocess`๋ ์๋ ์ ์๋ ์
๋ ฅ์ ๊ฐ์ ธ์ ๋ชจ๋ธ์ ๊ณต๊ธํ ์ ์๋ ํ์์ผ๋ก ๋ณํํฉ๋๋ค.
+๋ ๋ง์ ์ ๋ณด๋ฅผ ํฌํจํ ์ ์์ผ๋ฉฐ ์ผ๋ฐ์ ์ผ๋ก `Dict` ํํ์
๋๋ค.
+
+`_forward`๋ ๊ตฌํ ์ธ๋ถ ์ฌํญ์ด๋ฉฐ ์ง์ ํธ์ถํ ์ ์์ต๋๋ค.
+`forward`๋ ์์ ์ฅ์น์์ ๋ชจ๋ ๊ฒ์ด ์๋ํ๋์ง ํ์ธํ๊ธฐ ์ํ ์์ ์ฅ์น๊ฐ ํฌํจ๋์ด ์์ด ์ ํธ๋๋ ํธ์ถ ๋ฉ์๋์
๋๋ค.
+์ค์ ๋ชจ๋ธ๊ณผ ๊ด๋ จ๋ ๊ฒ์ `_forward` ๋ฉ์๋์ ์ํ๋ฉฐ, ๋๋จธ์ง๋ ์ ์ฒ๋ฆฌ/ํ์ฒ๋ฆฌ ๊ณผ์ ์ ์์ต๋๋ค.
+
+`postprocess` ๋ฉ์๋๋ `_forward`์ ์ถ๋ ฅ์ ๊ฐ์ ธ์ ์ด์ ์ ๊ฒฐ์ ํ ์ต์ข
์ถ๋ ฅ ํ์์ผ๋ก ๋ณํํฉ๋๋ค.
+
+`_sanitize_parameters`๋ ์ด๊ธฐํ ์๊ฐ์ `pipeline(...., maybe_arg=4)`์ด๋ ํธ์ถ ์๊ฐ์ `pipe = pipeline(...); output = pipe(...., maybe_arg=4)`๊ณผ ๊ฐ์ด, ์ฌ์ฉ์๊ฐ ์ํ๋ ๊ฒฝ์ฐ ์ธ์ ๋ ์ง ๋งค๊ฐ๋ณ์๋ฅผ ์ ๋ฌํ ์ ์๋๋ก ํ์ฉํฉ๋๋ค.
+
+`_sanitize_parameters`์ ๋ฐํ ๊ฐ์ `preprocess`, `_forward`, `postprocess`์ ์ง์ ์ ๋ฌ๋๋ 3๊ฐ์ kwargs ๋์
๋๋ฆฌ์
๋๋ค.
+ํธ์ถ์๊ฐ ์ถ๊ฐ ๋งค๊ฐ๋ณ์๋ก ํธ์ถํ์ง ์์๋ค๋ฉด ์๋ฌด๊ฒ๋ ์ฑ์ฐ์ง ๋ง์ญ์์ค.
+์ด๋ ๊ฒ ํ๋ฉด ํญ์ ๋ "์์ฐ์ค๋ฌ์ด" ํจ์ ์ ์์ ๊ธฐ๋ณธ ์ธ์๋ฅผ ์ ์งํ ์ ์์ต๋๋ค.
+
+๋ถ๋ฅ ์์
์์ `top_k` ๋งค๊ฐ๋ณ์๊ฐ ๋ํ์ ์ธ ์์
๋๋ค.
+
+```python
+>>> pipe = pipeline("my-new-task")
+>>> pipe("This is a test")
+[{"label": "1-star", "score": 0.8}, {"label": "2-star", "score": 0.1}, {"label": "3-star", "score": 0.05}
+{"label": "4-star", "score": 0.025}, {"label": "5-star", "score": 0.025}]
+
+>>> pipe("This is a test", top_k=2)
+[{"label": "1-star", "score": 0.8}, {"label": "2-star", "score": 0.1}]
+```
+
+์ด๋ฅผ ๋ฌ์ฑํ๊ธฐ ์ํด ์ฐ๋ฆฌ๋ `postprocess` ๋ฉ์๋๋ฅผ ๊ธฐ๋ณธ ๋งค๊ฐ๋ณ์์ธ `5`๋ก ์
๋ฐ์ดํธํ๊ณ `_sanitize_parameters`๋ฅผ ์์ ํ์ฌ ์ด ์ ๋งค๊ฐ๋ณ์๋ฅผ ํ์ฉํฉ๋๋ค.
+
+
+```python
+def postprocess(self, model_outputs, top_k=5):
+ best_class = model_outputs["logits"].softmax(-1)
+ # top_k๋ฅผ ์ฒ๋ฆฌํ๋ ๋ก์ง ์ถ๊ฐ
+ return best_class
+
+
+def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "maybe_arg" in kwargs:
+ preprocess_kwargs["maybe_arg"] = kwargs["maybe_arg"]
+
+ postprocess_kwargs = {}
+ if "top_k" in kwargs:
+ postprocess_kwargs["top_k"] = kwargs["top_k"]
+ return preprocess_kwargs, {}, postprocess_kwargs
+```
+
+์
/์ถ๋ ฅ์ ๊ฐ๋ฅํ ํ ๊ฐ๋จํ๊ณ ์์ ํ JSON ์ง๋ ฌํ ๊ฐ๋ฅํ ํ์์ผ๋ก ์ ์งํ๋ ค๊ณ ๋
ธ๋ ฅํ์ญ์์ค.
+์ด๋ ๊ฒ ํ๋ฉด ์ฌ์ฉ์๊ฐ ์๋ก์ด ์ข
๋ฅ์ ๊ฐ์ฒด๋ฅผ ์ดํดํ์ง ์๊ณ ๋ ํ์ดํ๋ผ์ธ์ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+๋ํ ์ฌ์ฉ ์ฉ์ด์ฑ์ ์ํด ์ฌ๋ฌ ๊ฐ์ง ์ ํ์ ์ธ์(์ค๋์ค ํ์ผ์ ํ์ผ ์ด๋ฆ, URL ๋๋ ์์ํ ๋ฐ์ดํธ์ผ ์ ์์)๋ฅผ ์ง์ํ๋ ๊ฒ์ด ๋น๊ต์ ์ผ๋ฐ์ ์
๋๋ค.
+
+
+
+## ์ง์๋๋ ์์
๋ชฉ๋ก์ ์ถ๊ฐํ๊ธฐ [[adding-it-to-the-list-of-supported-tasks]]
+
+`new-task`๋ฅผ ์ง์๋๋ ์์
๋ชฉ๋ก์ ๋ฑ๋กํ๋ ค๋ฉด `PIPELINE_REGISTRY`์ ์ถ๊ฐํด์ผ ํฉ๋๋ค:
+
+```python
+from transformers.pipelines import PIPELINE_REGISTRY
+
+PIPELINE_REGISTRY.register_pipeline(
+ "new-task",
+ pipeline_class=MyPipeline,
+ pt_model=AutoModelForSequenceClassification,
+)
+```
+
+์ํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๋ชจ๋ธ์ ์ง์ ํ ์ ์์ผ๋ฉฐ, ์ด ๊ฒฝ์ฐ ํน์ ๊ฐ์ (๋ถ๊ธฐ ์ด๋ฆ ๋๋ ์ปค๋ฐ ํด์์ผ ์ ์์, ์ฌ๊ธฐ์๋ "abcdef")๊ณผ ํ์
์ ํจ๊ป ๊ฐ์ ธ์์ผ ํฉ๋๋ค:
+
+```python
+PIPELINE_REGISTRY.register_pipeline(
+ "new-task",
+ pipeline_class=MyPipeline,
+ pt_model=AutoModelForSequenceClassification,
+ default={"pt": ("user/awesome_model", "abcdef")},
+ type="text", # ํ์ฌ ์ง์ ์ ํ: text, audio, image, multimodal
+)
+```
+
+## Hub์ ํ์ดํ๋ผ์ธ ๊ณต์ ํ๊ธฐ [[share-your-pipeline-on-the-hub]]
+
+Hub์ ์ฌ์ฉ์ ์ ์ ํ์ดํ๋ผ์ธ์ ๊ณต์ ํ๋ ค๋ฉด `Pipeline` ํ์ ํด๋์ค์ ์ฌ์ฉ์ ์ ์ ์ฝ๋๋ฅผ Python ํ์ผ์ ์ ์ฅํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค.
+์๋ฅผ ๋ค์ด, ๋ค์๊ณผ ๊ฐ์ด ๋ฌธ์ฅ ์ ๋ถ๋ฅ๋ฅผ ์ํ ์ฌ์ฉ์ ์ ์ ํ์ดํ๋ผ์ธ์ ์ฌ์ฉํ๋ค๊ณ ๊ฐ์ ํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```py
+import numpy as np
+
+from transformers import Pipeline
+
+
+def softmax(outputs):
+ maxes = np.max(outputs, axis=-1, keepdims=True)
+ shifted_exp = np.exp(outputs - maxes)
+ return shifted_exp / shifted_exp.sum(axis=-1, keepdims=True)
+
+
+class PairClassificationPipeline(Pipeline):
+ def _sanitize_parameters(self, **kwargs):
+ preprocess_kwargs = {}
+ if "second_text" in kwargs:
+ preprocess_kwargs["second_text"] = kwargs["second_text"]
+ return preprocess_kwargs, {}, {}
+
+ def preprocess(self, text, second_text=None):
+ return self.tokenizer(text, text_pair=second_text, return_tensors=self.framework)
+
+ def _forward(self, model_inputs):
+ return self.model(**model_inputs)
+
+ def postprocess(self, model_outputs):
+ logits = model_outputs.logits[0].numpy()
+ probabilities = softmax(logits)
+
+ best_class = np.argmax(probabilities)
+ label = self.model.config.id2label[best_class]
+ score = probabilities[best_class].item()
+ logits = logits.tolist()
+ return {"label": label, "score": score, "logits": logits}
+```
+
+๊ตฌํ์ ํ๋ ์์ํฌ์ ๊ตฌ์ ๋ฐ์ง ์์ผ๋ฉฐ, PyTorch์ TensorFlow ๋ชจ๋ธ์ ๋ํด ์๋ํฉ๋๋ค.
+์ด๋ฅผ `pair_classification.py`๋ผ๋ ํ์ผ์ ์ ์ฅํ ๊ฒฝ์ฐ, ๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ ธ์ค๊ณ ๋ฑ๋กํ ์ ์์ต๋๋ค:
+
+```py
+from pair_classification import PairClassificationPipeline
+from transformers.pipelines import PIPELINE_REGISTRY
+from transformers import AutoModelForSequenceClassification, TFAutoModelForSequenceClassification
+
+PIPELINE_REGISTRY.register_pipeline(
+ "pair-classification",
+ pipeline_class=PairClassificationPipeline,
+ pt_model=AutoModelForSequenceClassification,
+ tf_model=TFAutoModelForSequenceClassification,
+)
+```
+
+์ด ์์
์ด ์๋ฃ๋๋ฉด ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ๊ณผ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค.
+์๋ฅผ ๋ค์ด, `sgugger/finetuned-bert-mrpc`์ MRPC ๋ฐ์ดํฐ ์ธํธ์์ ๋ฏธ์ธ ์กฐ์ ๋์ด ๋ฌธ์ฅ ์์ ํจ๋ฌํ๋ ์ด์ฆ์ธ์ง ์๋์ง๋ฅผ ๋ถ๋ฅํฉ๋๋ค.
+
+```py
+from transformers import pipeline
+
+classifier = pipeline("pair-classification", model="sgugger/finetuned-bert-mrpc")
+```
+
+๊ทธ๋ฐ ๋ค์ `push_to_hub` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ธ์ ๊ณต์ ํ ์ ์์ต๋๋ค:
+
+```py
+classifier.push_to_hub("test-dynamic-pipeline")
+```
+
+์ด๋ ๊ฒ ํ๋ฉด "test-dynamic-pipeline" ํด๋ ๋ด์ `PairClassificationPipeline`์ ์ ์ํ ํ์ผ์ด ๋ณต์ฌ๋๋ฉฐ, ํ์ดํ๋ผ์ธ์ ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ ์ ์ฅํ ํ, `{your_username}/test-dynamic-pipeline` ์ ์ฅ์์ ์๋ ๋ชจ๋ ๊ฒ์ ํธ์ํฉ๋๋ค.
+์ดํ์๋ `trust_remote_code=True` ์ต์
๋ง ์ ๊ณตํ๋ฉด ๋๊ตฌ๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+```py
+from transformers import pipeline
+
+classifier = pipeline(model="{your_username}/test-dynamic-pipeline", trust_remote_code=True)
+```
+
+## ๐ค Transformers์ ํ์ดํ๋ผ์ธ ์ถ๊ฐํ๊ธฐ [[add-the-pipeline-to-transformers]]
+
+๐ค Transformers์ ์ฌ์ฉ์ ์ ์ ํ์ดํ๋ผ์ธ์ ๊ธฐ์ฌํ๋ ค๋ฉด, `pipelines` ํ์ ๋ชจ๋์ ์ฌ์ฉ์ ์ ์ ํ์ดํ๋ผ์ธ ์ฝ๋์ ํจ๊ป ์ ๋ชจ๋์ ์ถ๊ฐํ ๋ค์, `pipelines/__init__.py`์์ ์ ์๋ ์์
๋ชฉ๋ก์ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
+
+๊ทธ๋ฐ ๋ค์ ํ
์คํธ๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
+`tests/test_pipelines_MY_PIPELINE.py`๋ผ๋ ์ ํ์ผ์ ๋ง๋ค๊ณ ๋ค๋ฅธ ํ
์คํธ์ ์์ ๋ฅผ ํจ๊ป ์์ฑํฉ๋๋ค.
+
+`run_pipeline_test` ํจ์๋ ๋งค์ฐ ์ผ๋ฐ์ ์ด๋ฉฐ, `model_mapping` ๋ฐ `tf_model_mapping`์์ ์ ์๋ ๊ฐ๋ฅํ ๋ชจ๋ ์ํคํ
์ฒ์ ์์ ๋ฌด์์ ๋ชจ๋ธ์์ ์คํ๋ฉ๋๋ค.
+
+์ด๋ ํฅํ ํธํ์ฑ์ ํ
์คํธํ๋ ๋ฐ ๋งค์ฐ ์ค์ํ๋ฉฐ, ๋๊ตฐ๊ฐ `XXXForQuestionAnswering`์ ์ํ ์ ๋ชจ๋ธ์ ์ถ๊ฐํ๋ฉด ํ์ดํ๋ผ์ธ ํ
์คํธ๊ฐ ํด๋น ๋ชจ๋ธ์์ ์คํ์ ์๋ํ๋ค๋ ์๋ฏธ์
๋๋ค.
+๋ชจ๋ธ์ด ๋ฌด์์์ด๊ธฐ ๋๋ฌธ์ ์ค์ ๊ฐ์ ํ์ธํ๋ ๊ฒ์ ๋ถ๊ฐ๋ฅํ๋ฏ๋ก, ๋จ์ํ ํ์ดํ๋ผ์ธ ์ถ๋ ฅ `TYPE`๊ณผ ์ผ์น์ํค๊ธฐ ์ํ ๋์ฐ๋ฏธ `ANY`๊ฐ ์์ต๋๋ค.
+
+๋ํ 2๊ฐ(์ด์์ ์ผ๋ก๋ 4๊ฐ)์ ํ
์คํธ๋ฅผ ๊ตฌํํด์ผ ํฉ๋๋ค.
+
+- `test_small_model_pt`: ์ด ํ์ดํ๋ผ์ธ์ ๋ํ ์์ ๋ชจ๋ธ 1๊ฐ๋ฅผ ์ ์(๊ฒฐ๊ณผ๊ฐ ์๋ฏธ ์์ด๋ ์๊ด์์)ํ๊ณ ํ์ดํ๋ผ์ธ ์ถ๋ ฅ์ ํ
์คํธํฉ๋๋ค.
+๊ฒฐ๊ณผ๋ `test_small_model_tf`์ ๋์ผํด์ผ ํฉ๋๋ค.
+- `test_small_model_tf`: ์ด ํ์ดํ๋ผ์ธ์ ๋ํ ์์ ๋ชจ๋ธ 1๊ฐ๋ฅผ ์ ์(๊ฒฐ๊ณผ๊ฐ ์๋ฏธ ์์ด๋ ์๊ด์์)ํ๊ณ ํ์ดํ๋ผ์ธ ์ถ๋ ฅ์ ํ
์คํธํฉ๋๋ค.
+๊ฒฐ๊ณผ๋ `test_small_model_pt`์ ๋์ผํด์ผ ํฉ๋๋ค.
+- `test_large_model_pt`(`์ ํ์ฌํญ`): ๊ฒฐ๊ณผ๊ฐ ์๋ฏธ ์์ ๊ฒ์ผ๋ก ์์๋๋ ์ค์ ํ์ดํ๋ผ์ธ์์ ํ์ดํ๋ผ์ธ์ ํ
์คํธํฉ๋๋ค.
+์ด๋ฌํ ํ
์คํธ๋ ์๋๊ฐ ๋๋ฆฌ๋ฏ๋ก ์ด๋ฅผ ํ์ํด์ผ ํฉ๋๋ค.
+์ฌ๊ธฐ์์ ๋ชฉํ๋ ํ์ดํ๋ผ์ธ์ ๋ณด์ฌ์ฃผ๊ณ ํฅํ ๋ฆด๋ฆฌ์ฆ์์์ ๋ณํ๊ฐ ์๋์ง ํ์ธํ๋ ๊ฒ์
๋๋ค.
+- `test_large_model_tf`(`์ ํ์ฌํญ`): ๊ฒฐ๊ณผ๊ฐ ์๋ฏธ ์์ ๊ฒ์ผ๋ก ์์๋๋ ์ค์ ํ์ดํ๋ผ์ธ์์ ํ์ดํ๋ผ์ธ์ ํ
์คํธํฉ๋๋ค.
+์ด๋ฌํ ํ
์คํธ๋ ์๋๊ฐ ๋๋ฆฌ๋ฏ๋ก ์ด๋ฅผ ํ์ํด์ผ ํฉ๋๋ค.
+์ฌ๊ธฐ์์ ๋ชฉํ๋ ํ์ดํ๋ผ์ธ์ ๋ณด์ฌ์ฃผ๊ณ ํฅํ ๋ฆด๋ฆฌ์ฆ์์์ ๋ณํ๊ฐ ์๋์ง ํ์ธํ๋ ๊ฒ์
๋๋ค.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/attention.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/attention.md
new file mode 100644
index 0000000000000000000000000000000000000000..d9a5eeee1b73eada3d0d704b2ff6744f545c6d2b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/attention.md
@@ -0,0 +1,54 @@
+
+
+# ์ดํ
์
๋ฉ์ปค๋์ฆ[[attention_mechanisms]]
+
+๋๋ถ๋ถ์ ํธ๋์คํฌ๋จธ ๋ชจ๋ธ์ ์ ๋ฐฉํ๋ ฌ์ธ ์ ์ฒด ์ดํ
์
์ ์ฌ์ฉํฉ๋๋ค.
+ํ์ง๋ง ์ด๋ ๊ธด ํ
์คํธ๋ฅผ ๋ค๋ฃฐ ๋๋ ํฐ ๊ณ์ฐ ๋ณ๋ชฉ ํ์์ ์ ๋ฐํ ์ ์์ต๋๋ค.
+`Longformer`์ `Reformer`๋ ํ๋ จ ์๋๋ฅผ ๋์ด๊ธฐ ์ํด ์ดํ
์
ํ๋ ฌ์ ํฌ์ ๋ฒ์ ์ ์ฌ์ฉํ์ฌ ํจ์จ์ ๋์ด๋ ค๋ ๋ชจ๋ธ์
๋๋ค.
+
+## LSH ์ดํ
์
[[lsh_attention]]
+
+
+[Reformer](model_doc/reformer)๋ LSH(Locality Sensitive Hashing) ์ดํ
์
์ ์ฌ์ฉํฉ๋๋ค. softmax(QK^t)์์๋ ํ๋ ฌ QK^t์ (softmax ์ฐจ์์์) ๊ฐ์ฅ ํฐ ์์๋ค๋ง ์ ์ฉํ ๊ธฐ์ฌ๋ฅผ ํ ๊ฒ์
๋๋ค.
+๋ฐ๋ผ์ ๊ฐ๊ฐ์ ์ฟผ๋ฆฌ q์ ๋ํด, q์ ๊ฐ๊น์ด ํค k๋ง ๊ณ ๋ คํ ์ ์์ต๋๋ค. ํด์ ํจ์๋ q์ k๊ฐ ๊ฐ๊น์ด์ง ์ฌ๋ถ๋ฅผ ๊ฒฐ์ ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
+์ดํ
์
๋ง์คํฌ๋ ํ์ฌ ํ ํฐ์ ๋ง์คํนํ์ฌ ๋ณ๊ฒฝ๋ฉ๋๋ค. ์ด ๋ ์ฒซ ๋ฒ์งธ ์์น์ ํ ํฐ์ ์ ์ธํฉ๋๋ค. ์๋ํ๋ฉด ์ฟผ๋ฆฌ์ ํค๊ฐ ๋์ผํ ๊ฐ์ ๊ฐ๊ฒ ๋๊ธฐ ๋๋ฌธ์
๋๋ค(์๋ก ๋งค์ฐ ์ ์ฌํจ).
+ํด์๋ ์ฝ๊ฐ์ ๋ฌด์์์ฑ์ ๊ฐ์ง ์ ์์ผ๋ฏ๋ก, ์ค์ ๋ก๋ ์ฌ๋ฌ ๊ฐ์ ํด์ ํจ์๊ฐ ์ฌ์ฉ๋๊ณ (`n_rounds` ๋งค๊ฐ๋ณ์์ ์ํด ๊ฒฐ์ ๋จ) ๊ทธ ํ์ ํ๊ท ๊ฐ์ ์ทจํ๊ฒ ๋ฉ๋๋ค.
+
+## ์ง์ญ ์ดํ
์
[[local_attention]]
+
+[Longformer](model_doc/longformer)๋ ์ง์ญ ์ดํ
์
์ ์ฌ์ฉํฉ๋๋ค. ์ข
์ข
ํน์ ํ ํฐ์ ๋ํด ์ง์ญ ์ปจํ
์คํธ(์: ์ผ์ชฝ๊ณผ ์ค๋ฅธ์ชฝ์ ์๋ ๋ ๊ฐ์ ํ ํฐ์ ๋ฌด์์ธ๊ฐ์?)๋ง์ผ๋ก๋ ์์
์ ์ํํ๋๋ฐ ์ถฉ๋ถํฉ๋๋ค.
+๋ํ ์์ ์ฐฝ(window)์ ๊ฐ์ง ์ดํ
์
๋ ์ด์ด๋ฅผ ์์์ผ๋ก์จ ๋ง์ง๋ง ๋ ์ด์ด๋ ์ฐฝ ๋ด์ ํ ํฐ๋ฟ๋ง ์๋๋ผ ๋ ๋ง์ ์์ ํ ํฐ์ ๋ํ ์์ฉ ์์ญ(receptive field)์ ๊ฐ๊ฒ ๋์ด ์ ์ฒด ๋ฌธ์ฅ์ ํํ์ ๊ตฌ์ถํ ์ ์์ต๋๋ค.
+
+์ฌ์ ์ ์ ํ๋ ์ผ๋ถ ์
๋ ฅ ํ ํฐ๋ค์ ์ ์ญ ์ดํ
์
์ ๋ฐ์ต๋๋ค. ์ด ๋ช ๊ฐ์ ํ ํฐ์ ๋ํด์๋ ์ดํ
์
ํ๋ ฌ์ด ๋ชจ๋ ํ ํฐ์ ์ ๊ทผํ ์ ์์ผ๋ฉฐ, ์ด ๊ณผ์ ์ ๋์นญ์ ์ผ๋ก ์ด๋ฃจ์ด์ง๋๋ค.
+๋ค๋ฅธ ๋ชจ๋ ํ ํฐ๋ค์ ๋ก์ปฌ ์ฐฝ ๋ด์ ํ ํฐ๋ค์ ๋ํด ํด๋น ํน์ ํ ํฐ๋ค์๋ ์ ๊ทผํ ์ ์์ต๋๋ค. ์ด๋ ๋
ผ๋ฌธ์ Figure 2d์์ ๋ํ๋๋ฉฐ, ์๋์ ์ํ ์ดํ
์
๋ง์คํฌ๊ฐ ์ ์๋์ด ์์ต๋๋ค:
+
+
+
+
+
+
+
+์ ์ ํ๋ผ๋ฏธํฐ์ ์ดํ
์
ํ๋ ฌ์ ์ฌ์ฉํ๋ฉด ๋ชจ๋ธ์ด ๋ ํฐ ์ํ์ค ์
๋ ฅ ๊ธธ์ด๋ฅผ ๊ฐ์ง ์ ์์ต๋๋ค.
+
+## ๋ค๋ฅธ ๋ฐฉ๋ฒ๋ค[[other_tricks]]
+
+### ์ถ๋ณ ์์น ์ธ์ฝ๋ฉ[[axial_positional_encodings]]
+
+[Reformer](model_doc/reformer)๋ ์ถ๋ณ ์์น ์ธ์ฝ๋ฉ(axial positional encodings)์ ์ฌ์ฉํฉ๋๋ค. ๊ธฐ์กด์ ํธ๋์คํฌ๋จธ ๋ชจ๋ธ์์๋ ์์น ์ธ์ฝ๋ฉ ํ๋ ฌ E๋ ํฌ๊ธฐ๊ฐ \\(l \times d\\)์ธ ํ๋ ฌ์ด๋ฉฐ,
+์ฌ๊ธฐ์ \\(l\\)์ ์ํ์ค ๊ธธ์ด(sequence length)์ด๊ณ \\(d\\)๋ ์จ๊ฒจ์ง ์ํ(hidden state)์ ์ฐจ์์
๋๋ค. ๋งค์ฐ ๊ธด ํ
์คํธ์ ๊ฒฝ์ฐ, ์ด ํ๋ ฌ์ ๋งค์ฐ ํฌ๋ฉฐ GPU ์์์ ๊ณต๊ฐ์ ๋ง์ด ์ฐจ์งํ ์ ์์ต๋๋ค.
+์ด๋ฅผ ์ํํ๊ธฐ ์ํด, ์ถ๋ณ ์์น ์ธ์ฝ๋ฉ์ ํฐ ํ๋ ฌ E๋ฅผ ๋ ๊ฐ์ ์์ ํ๋ ฌ E1๊ณผ E2๋ก ๋ถํดํฉ๋๋ค. ์ด๋ E1์ ํฌ๊ธฐ๋ \\(l_{1} \times d_{1}\\)์ด๊ณ , E2์ ํฌ๊ธฐ๋ \\(l_{2} \times d_{2}\\)์
๋๋ค.
+์ด๋ \\(l_{1} \times l_{2} = l\\)์ด๊ณ \\(d_{1} + d_{2} = d\\)(๊ธธ์ด์ ๋ํ ๊ณฑ์
์ฐ์ฐ์ ์ฌ์ฉํ๋ฉด ํจ์ฌ ์์์ง๋๋ค). E์ ์๊ฐ ๋จ๊ณ j์ ๋ํ ์๋ฒ ๋ฉ์ E1์์ ์๊ฐ ๋จ๊ณ \\(j \% l1\\)์ ์๋ฒ ๋ฉ๊ณผ E2์์ ์๊ฐ ๋จ๊ณ \\(j // l1\\)์ ์๋ฒ ๋ฉ์ ์ฐ๊ฒฐํ์ฌ ์ป์ต๋๋ค.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/autoclass_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/autoclass_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..e41a2acc7b486b44590387fd2aa495b78b530f75
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/autoclass_tutorial.md
@@ -0,0 +1,144 @@
+
+
+# AutoClass๋ก ์ฌ์ ํ์ต๋ ์ธ์คํด์ค ๋ก๋[[load-pretrained-instances-with-an-autoclass]]
+
+ํธ๋์คํฌ๋จธ ์ํคํ
์ฒ๊ฐ ๋งค์ฐ ๋ค์ํ๊ธฐ ๋๋ฌธ์ ์ฒดํฌํฌ์ธํธ์ ๋ง๋ ์ํคํ
์ฒ๋ฅผ ์์ฑํ๋ ๊ฒ์ด ์ด๋ ค์ธ ์ ์์ต๋๋ค. ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฝ๊ณ ๊ฐ๋จํ๋ฉฐ ์ ์ฐํ๊ฒ ์ฌ์ฉํ๊ธฐ ์ํ Transformer ํต์ฌ ์ฒ ํ์ ์ผํ์ผ๋ก, `AutoClass`๋ ์ฃผ์ด์ง ์ฒดํฌํฌ์ธํธ์์ ์ฌ๋ฐ๋ฅธ ์ํคํ
์ฒ๋ฅผ ์๋์ผ๋ก ์ถ๋ก ํ์ฌ ๋ก๋ํฉ๋๋ค. `from_pretrained()` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ฉด ๋ชจ๋ ์ํคํ
์ฒ์ ๋ํด ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ๋น ๋ฅด๊ฒ ๋ก๋ํ ์ ์์ผ๋ฏ๋ก ๋ชจ๋ธ์ ์ฒ์๋ถํฐ ํ์ตํ๋ ๋ฐ ์๊ฐ๊ณผ ๋ฆฌ์์ค๋ฅผ ํฌ์
ํ ํ์๊ฐ ์์ต๋๋ค.
+์ฒดํฌํฌ์ธํธ์ ๊ตฌ์ ๋ฐ์ง ์๋ ์ฝ๋๋ฅผ ์์ฑํ๋ค๋ ๊ฒ์ ์ฝ๋๊ฐ ํ ์ฒดํฌํฌ์ธํธ์์ ์๋ํ๋ฉด ์ํคํ
์ฒ๊ฐ ๋ค๋ฅด๋๋ผ๋ ๋ค๋ฅธ ์ฒดํฌํฌ์ธํธ(์ ์ฌํ ์์
์ ๋ํด ํ์ต๋ ๊ฒฝ์ฐ)์์๋ ์๋ํ๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค.
+
+
+
+์ํคํ
์ฒ๋ ๋ชจ๋ธ์ ๊ณจ๊ฒฉ์ ์๋ฏธํ๋ฉฐ ์ฒดํฌํฌ์ธํธ๋ ์ฃผ์ด์ง ์ํคํ
์ฒ์ ๋ํ ๊ฐ์ค์น์
๋๋ค. ์๋ฅผ ๋ค์ด, [BERT](https://huggingface.co/google-bert/bert-base-uncased)๋ ์ํคํ
์ฒ์ด๊ณ , `google-bert/bert-base-uncased`๋ ์ฒดํฌํฌ์ธํธ์
๋๋ค. ๋ชจ๋ธ์ ์ํคํ
์ฒ ๋๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ์๋ฏธํ ์ ์๋ ์ผ๋ฐ์ ์ธ ์ฉ์ด์
๋๋ค.
+
+
+
+์ด ํํ ๋ฆฌ์ผ์์๋ ๋ค์์ ํ์ตํฉ๋๋ค:
+
+* ์ฌ์ ํ์ต๋ ํ ํฌ๋์ด์ ๋ก๋ํ๊ธฐ.
+* ์ฌ์ ํ์ต๋ ์ด๋ฏธ์ง ํ๋ก์ธ์ ๋ก๋ํ๊ธฐ.
+* ์ฌ์ ํ์ต๋ ํน์ง ์ถ์ถ๊ธฐ ๋ก๋ํ๊ธฐ.
+* ์ฌ์ ํ๋ จ๋ ํ๋ก์ธ์ ๋ก๋ํ๊ธฐ.
+* ์ฌ์ ํ์ต๋ ๋ชจ๋ธ ๋ก๋ํ๊ธฐ.
+
+## AutoTokenizer[[autotokenizer]]
+
+๊ฑฐ์ ๋ชจ๋ NLP ์์
์ ํ ํฌ๋์ด์ ๋ก ์์๋ฉ๋๋ค. ํ ํฌ๋์ด์ ๋ ์ฌ์ฉ์์ ์
๋ ฅ์ ๋ชจ๋ธ์์ ์ฒ๋ฆฌํ ์ ์๋ ํ์์ผ๋ก ๋ณํํฉ๋๋ค.
+[`AutoTokenizer.from_pretrained`]๋ก ํ ํฌ๋์ด์ ๋ฅผ ๋ก๋ํฉ๋๋ค:
+
+```py
+>>> from transformers import AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-bert/bert-base-uncased")
+```
+
+๊ทธ๋ฆฌ๊ณ ์๋์ ๊ฐ์ด ์
๋ ฅ์ ํ ํฐํํฉ๋๋ค:
+
+```py
+>>> sequence = "In a hole in the ground there lived a hobbit."
+>>> print(tokenizer(sequence))
+{'input_ids': [101, 1999, 1037, 4920, 1999, 1996, 2598, 2045, 2973, 1037, 7570, 10322, 4183, 1012, 102],
+ 'token_type_ids': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+ 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}
+```
+
+## AutoImageProcessor[[autoimageprocessor]]
+
+๋น์ ์์
์ ๊ฒฝ์ฐ ์ด๋ฏธ์ง ํ๋ก์ธ์๊ฐ ์ด๋ฏธ์ง๋ฅผ ์ฌ๋ฐ๋ฅธ ์
๋ ฅ ํ์์ผ๋ก ์ฒ๋ฆฌํฉ๋๋ค.
+
+```py
+>>> from transformers import AutoImageProcessor
+
+>>> image_processor = AutoImageProcessor.from_pretrained("google/vit-base-patch16-224")
+```
+
+
+## AutoFeatureExtractor[[autofeatureextractor]]
+
+์ค๋์ค ์์
์ ๊ฒฝ์ฐ ํน์ง ์ถ์ถ๊ธฐ๊ฐ ์ค๋์ค ์ ํธ๋ฅผ ์ฌ๋ฐ๋ฅธ ์
๋ ฅ ํ์์ผ๋ก ์ฒ๋ฆฌํฉ๋๋ค.
+
+[`AutoFeatureExtractor.from_pretrained`]๋ก ํน์ง ์ถ์ถ๊ธฐ๋ฅผ ๋ก๋ํฉ๋๋ค:
+
+```py
+>>> from transformers import AutoFeatureExtractor
+
+>>> feature_extractor = AutoFeatureExtractor.from_pretrained(
+... "ehcalabres/wav2vec2-lg-xlsr-en-speech-emotion-recognition"
+... )
+```
+
+## AutoProcessor[[autoprocessor]]
+
+๋ฉํฐ๋ชจ๋ฌ ์์
์๋ ๋ ๊ฐ์ง ์ ํ์ ์ ์ฒ๋ฆฌ ๋๊ตฌ๋ฅผ ๊ฒฐํฉํ ํ๋ก์ธ์๊ฐ ํ์ํฉ๋๋ค. ์๋ฅผ ๋ค์ด LayoutLMV2 ๋ชจ๋ธ์๋ ์ด๋ฏธ์ง๋ฅผ ์ฒ๋ฆฌํ๋ ์ด๋ฏธ์ง ํ๋ก์ธ์์ ํ
์คํธ๋ฅผ ์ฒ๋ฆฌํ๋ ํ ํฌ๋์ด์ ๊ฐ ํ์ํ๋ฉฐ, ํ๋ก์ธ์๋ ์ด ๋ ๊ฐ์ง๋ฅผ ๊ฒฐํฉํฉ๋๋ค.
+
+[`AutoProcessor.from_pretrained()`]๋ก ํ๋ก์ธ์๋ฅผ ๋ก๋ํฉ๋๋ค:
+
+```py
+>>> from transformers import AutoProcessor
+
+>>> processor = AutoProcessor.from_pretrained("microsoft/layoutlmv2-base-uncased")
+```
+
+## AutoModel[[automodel]]
+
+
+
+๋ง์ง๋ง์ผ๋ก AutoModelForํด๋์ค๋ฅผ ์ฌ์ฉํ๋ฉด ์ฃผ์ด์ง ์์
์ ๋ํด ๋ฏธ๋ฆฌ ํ์ต๋ ๋ชจ๋ธ์ ๋ก๋ํ ์ ์์ต๋๋ค (์ฌ์ฉ ๊ฐ๋ฅํ ์์
์ ์ ์ฒด ๋ชฉ๋ก์ [์ฌ๊ธฐ](model_doc/auto)๋ฅผ ์ฐธ์กฐํ์ธ์). ์๋ฅผ ๋ค์ด, [`AutoModelForSequenceClassification.from_pretrained`]๋ฅผ ์ฌ์ฉํ์ฌ ์ํ์ค ๋ถ๋ฅ์ฉ ๋ชจ๋ธ์ ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```py
+>>> from transformers import AutoModelForSequenceClassification
+
+>>> model = AutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+๋์ผํ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฝ๊ฒ ์ฌ์ฌ์ฉํ์ฌ ๋ค๋ฅธ ์์
์ ์ํคํ
์ฒ๋ฅผ ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```py
+>>> from transformers import AutoModelForTokenClassification
+
+>>> model = AutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+PyTorch๋ชจ๋ธ์ ๊ฒฝ์ฐ `from_pretrained()` ๋ฉ์๋๋ ๋ด๋ถ์ ์ผ๋ก ํผํด์ ์ฌ์ฉํ์ฌ ์์ ํ์ง ์์ ๊ฒ์ผ๋ก ์๋ ค์ง `torch.load()`๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+์ผ๋ฐ์ ์ผ๋ก ์ ๋ขฐํ ์ ์๋ ์์ค์์ ๊ฐ์ ธ์๊ฑฐ๋ ๋ณ์กฐ๋์์ ์ ์๋ ๋ชจ๋ธ์ ๋ก๋ํ์ง ๋ง์ธ์. ํ๊น
ํ์ด์ค ํ๋ธ์์ ํธ์คํ
๋๋ ๊ณต๊ฐ ๋ชจ๋ธ์ ๊ฒฝ์ฐ ์ด๋ฌํ ๋ณด์ ์ํ์ด ๋ถ๋ถ์ ์ผ๋ก ์ํ๋๋ฉฐ, ๊ฐ ์ปค๋ฐ ์ ๋ฉ์จ์ด๋ฅผ [๊ฒ์ฌํฉ๋๋ค](https://huggingface.co/docs/hub/security-malware). GPG๋ฅผ ์ฌ์ฉํด ์๋ช
๋ [์ปค๋ฐ ๊ฒ์ฆ](https://huggingface.co/docs/hub/security-gpg#signing-commits-with-gpg)๊ณผ ๊ฐ์ ๋ชจ๋ฒ์ฌ๋ก๋ [๋ฌธ์](https://huggingface.co/docs/hub/security)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+ํ
์ํ๋ก์ฐ์ Flax ์ฒดํฌํฌ์ธํธ๋ ์ํฅ์ ๋ฐ์ง ์์ผ๋ฉฐ, `from_pretrained`๋ฉ์๋์ `from_tf` ์ `from_flax` ํค์๋ ๊ฐ๋ณ ์ธ์๋ฅผ ์ฌ์ฉํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ์ฐํํ ์ ์์ต๋๋ค.
+
+
+
+์ผ๋ฐ์ ์ผ๋ก AutoTokenizer ํด๋์ค์ AutoModelFor ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ๋ฏธ๋ฆฌ ํ์ต๋ ๋ชจ๋ธ ์ธ์คํด์ค๋ฅผ ๋ก๋ํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋งค๋ฒ ์ฌ๋ฐ๋ฅธ ์ํคํ
์ฒ๋ฅผ ๋ก๋ํ ์ ์์ต๋๋ค. ๋ค์ [ํํ ๋ฆฌ์ผ](preprocessing)์์๋ ์๋กญ๊ฒ ๋ก๋ํ ํ ํฌ๋์ด์ , ์ด๋ฏธ์ง ํ๋ก์ธ์, ํน์ง ์ถ์ถ๊ธฐ๋ฅผ ์ฌ์ฉํ์ฌ ๋ฏธ์ธ ํ๋์ฉ ๋ฐ์ดํฐ ์ธํธ๋ฅผ ์ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ด
๋๋ค.
+
+
+๋ง์ง๋ง์ผ๋ก `TFAutoModelFor` ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ฉด ์ฃผ์ด์ง ์์
์ ๋ํด ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ๋ก๋ํ ์ ์์ต๋๋ค. (์ฌ์ฉ ๊ฐ๋ฅํ ์์
์ ์ ์ฒด ๋ชฉ๋ก์ [์ฌ๊ธฐ](model_doc/auto)๋ฅผ ์ฐธ์กฐํ์ธ์. ์๋ฅผ ๋ค์ด, [`TFAutoModelForSequenceClassification.from_pretrained`]๋ก ์ํ์ค ๋ถ๋ฅ๋ฅผ ์ํ ๋ชจ๋ธ์ ๋ก๋ํฉ๋๋ค:
+
+```py
+>>> from transformers import TFAutoModelForSequenceClassification
+
+>>> model = TFAutoModelForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+์ฝ๊ฒ ๋์ผํ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ์ฌ์ฉํ์ฌ ๋ค๋ฅธ ์์
์ ์ํคํ
์ฒ๋ฅผ ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```py
+>>> from transformers import TFAutoModelForTokenClassification
+
+>>> model = TFAutoModelForTokenClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+์ผ๋ฐ์ ์ผ๋ก, `AutoTokenizer`ํด๋์ค์ `TFAutoModelFor` ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ๋ฏธ๋ฆฌ ํ์ต๋ ๋ชจ๋ธ ์ธ์คํด์ค๋ฅผ ๋ก๋ํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋งค๋ฒ ์ฌ๋ฐ๋ฅธ ์ํคํ
์ฒ๋ฅผ ๋ก๋ํ ์ ์์ต๋๋ค. ๋ค์ [ํํ ๋ฆฌ์ผ](preprocessing)์์๋ ์๋กญ๊ฒ ๋ก๋ํ ํ ํฌ๋์ด์ , ์ด๋ฏธ์ง ํ๋ก์ธ์, ํน์ง ์ถ์ถ๊ธฐ๋ฅผ ์ฌ์ฉํ์ฌ ๋ฏธ์ธ ํ๋์ฉ ๋ฐ์ดํฐ ์ธํธ๋ฅผ ์ ์ฒ๋ฆฌํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ด
๋๋ค.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/bertology.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/bertology.md
new file mode 100644
index 0000000000000000000000000000000000000000..7b4f3dc4c4939bb44c401f96bf69f53cd179e5bd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/bertology.md
@@ -0,0 +1,41 @@
+
+
+# BERTology
+
+BERT์ ๊ฐ์ ๋๊ท๋ชจ ํธ๋์คํฌ๋จธ์ ๋ด๋ถ ๋์์ ์กฐ์ฌํ๋ ์ฐ๊ตฌ ๋ถ์ผ๊ฐ ์ ์ ๋ ์ค์ํด์ง๊ณ ์์ต๋๋ค.
+ํน์๋ "BERTology"๋ผ ์นญํ๊ธฐ๋ ํฉ๋๋ค. ์ด ๋ถ์ผ์ ์ข์ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+
+- BERT๋ ๊ณ ์ ์ ์ธ NLP ํ์ดํ๋ผ์ธ์ ์ฌ๋ฐ๊ฒฌ - Ian Tenney, Dipanjan Das, Ellie Pavlick:
+ https://arxiv.org/abs/1905.05950
+- 16๊ฐ์ ํค๋๊ฐ ์ ๋ง๋ก 1๊ฐ๋ณด๋ค ๋์๊ฐ? - Paul Michel, Omer Levy, Graham Neubig:
+ https://arxiv.org/abs/1905.10650
+- BERT๋ ๋ฌด์์ ๋ณด๋๊ฐ? BERT์ ์ดํ
์
๋ถ์ - Kevin Clark, Urvashi Khandelwal, Omer Levy, Christopher D. Manning:
+ https://arxiv.org/abs/1906.04341
+- CAT-probing: ํ๋ก๊ทธ๋๋ฐ ์ธ์ด์ ๋ํด ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ด ์ด๋ป๊ฒ ์ฝ๋ ๊ตฌ์กฐ๋ฅผ ๋ณด๋์ง ์์๋ณด๊ธฐ ์ํ ๋ฉํธ๋ฆญ ๊ธฐ๋ฐ ์ ๊ทผ ๋ฐฉ๋ฒ:
+ https://arxiv.org/abs/2210.04633
+
+์ฐ๋ฆฌ๋ ์ด ์๋ก์ด ์ฐ๊ตฌ ๋ถ์ผ์ ๋ฐ์ ์ ๋๊ธฐ ์ํด, BERT/GPT/GPT-2 ๋ชจ๋ธ์ ๋ด๋ถ ํํ์ ์ดํด๋ณผ ์ ์๋ ๋ช ๊ฐ์ง ๊ธฐ๋ฅ์ ์ถ๊ฐํ์ต๋๋ค.
+์ด ๊ธฐ๋ฅ๋ค์ ์ฃผ๋ก Paul Michel์ ํ๋ฅญํ ์์
์ ์ฐธ๊ณ ํ์ฌ ๊ฐ๋ฐ๋์์ต๋๋ค
+(https://arxiv.org/abs/1905.10650):
+
+
+- BERT/GPT/GPT-2์ ๋ชจ๋ ์๋ ์ํ์ ์ ๊ทผํ๊ธฐ,
+- BERT/GPT/GPT-2์ ๊ฐ ํค๋์ ๋ชจ๋ ์ดํ
์
๊ฐ์ค์น์ ์ ๊ทผํ๊ธฐ,
+- ํค๋์ ์ถ๋ ฅ ๊ฐ๊ณผ ๊ทธ๋๋์ธํธ๋ฅผ ๊ฒ์ํ์ฌ ํค๋ ์ค์๋ ์ ์๋ฅผ ๊ณ์ฐํ๊ณ https://arxiv.org/abs/1905.10650์์ ์ค๋ช
๋ ๋๋ก ํค๋๋ฅผ ์ ๊ฑฐํ๋ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
+
+์ด๋ฌํ ๊ธฐ๋ฅ๋ค์ ์ดํดํ๊ณ ์ง์ ์ฌ์ฉํด๋ณผ ์ ์๋๋ก [bertology.py](https://github.com/huggingface/transformers/tree/main/examples/research_projects/bertology/run_bertology.py) ์์ ์คํฌ๋ฆฝํธ๋ฅผ ์ถ๊ฐํ์ต๋๋ค. ์ด ์์ ์คํฌ๋ฆฝํธ์์๋ GLUE์ ๋ํด ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์์ ์ ๋ณด๋ฅผ ์ถ์ถํ๊ณ ๋ชจ๋ธ์ ๊ฐ์ง์น๊ธฐ(prune)ํด๋ด
๋๋ค.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/big_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/big_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..3180b51117a97b93566775485455e157ee7bd6ff
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/big_models.md
@@ -0,0 +1,122 @@
+
+
+# ํฐ ๋ชจ๋ธ ์ธ์คํด์คํ [[instantiating-a-big-model]]
+
+๋งค์ฐ ํฐ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ค๋ฉด, RAM ์ฌ์ฉ์ ์ต์ํํด์ผ ํ๋ ๊ณผ์ ๊ฐ ์์ต๋๋ค. ์ผ๋ฐ์ ์ธ PyTorch ์ํฌํ๋ก์ฐ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+1. ๋ฌด์์ ๊ฐ์ค์น๋ก ๋ชจ๋ธ์ ์์ฑํฉ๋๋ค.
+2. ์ฌ์ ํ๋ จ๋ ๊ฐ์ค์น๋ฅผ ๋ถ๋ฌ์ต๋๋ค.
+3. ์ฌ์ ํ๋ จ๋ ๊ฐ์ค์น๋ฅผ ๋ฌด์์ ๋ชจ๋ธ์ ์ ์ฉํฉ๋๋ค.
+
+1๋จ๊ณ์ 2๋จ๊ณ ๋ชจ๋ ๋ชจ๋ธ์ ์ ์ฒด ๋ฒ์ ์ ๋ฉ๋ชจ๋ฆฌ์ ์ ์ฌํด์ผ ํ๋ฉฐ, ๋๋ถ๋ถ ๋ฌธ์ ๊ฐ ์์ง๋ง ๋ชจ๋ธ์ด ๊ธฐ๊ฐ๋ฐ์ดํธ๊ธ์ ์ฉ๋์ ์ฐจ์งํ๊ธฐ ์์ํ๋ฉด ๋ณต์ฌ๋ณธ 2๊ฐ๊ฐ RAM์ ์ด๊ณผํ์ฌ ๋ฉ๋ชจ๋ฆฌ ๋ถ์กฑ ์ด์๋ฅผ ์ผ๊ธฐํ ์ ์์ต๋๋ค. ๋ ์ฌ๊ฐํ ๋ฌธ์ ๋ ๋ถ์ฐ ํ์ต์ ์ํด `torch.distributed`๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ, ํ๋ก์ธ์ค๋ง๋ค ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ๋ก๋ํ๊ณ ๋ณต์ฌ๋ณธ์ 2๊ฐ์ฉ RAM์ ์ ์ฅํ๋ค๋ ๊ฒ์
๋๋ค.
+
+
+
+๋ฌด์์๋ก ์์ฑ๋ ๋ชจ๋ธ์ "๋น์ด ์๋" (์ฆ ๊ทธ๋ ๋ฉ๋ชจ๋ฆฌ์ ์๋ ๊ฒ์ผ๋ก ์ด๋ค์ง) ํ
์๋ก ์ด๊ธฐํ๋๋ฉฐ ๋ฉ๋ชจ๋ฆฌ ๊ณต๊ฐ์ ์ฐจ์งํฉ๋๋ค. ์ด๊ธฐํ๋ ๋ชจ๋ธ/ํ๋ผ๋ฏธํฐ์ ์ข
๋ฅ์ ์ ํฉํ ๋ถํฌ(์: ์ ๊ท ๋ถํฌ)์ ๋ฐ๋ฅธ ๋ฌด์์ ์ด๊ธฐํ๋ ๊ฐ๋ฅํ ํ ๋น ๋ฅด๊ฒ ํ๊ธฐ ์ํด ์ด๊ธฐํ๋์ง ์์ ๊ฐ์ค์น์ ๋ํด 3๋จ๊ณ ์ดํ์๋ง ์ํ๋ฉ๋๋ค!
+
+
+
+์ด ์๋ด์์์๋ Transformers๊ฐ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ์ ๊ณตํ๋ ์๋ฃจ์
์ ์ดํด๋ด
๋๋ค. ์ฃผ์ํ ์ ์ ์์ง ํ๋ฐํ ๊ฐ๋ฐ ์ค์ธ ๋ถ์ผ์ด๋ฏ๋ก ์ฌ๊ธฐ์ ์ค๋ช
ํ๋ API๊ฐ ์์ผ๋ก ์ฝ๊ฐ ๋ณ๊ฒฝ๋ ์ ์๋ค๋ ๊ฒ์
๋๋ค.
+
+## ์ค๋ฉ๋ ์ฒดํฌํฌ์ธํธ [[sharded-checkpoints]]
+
+4.18.0 ๋ฒ์ ์ดํ, 10GB ์ด์์ ๊ณต๊ฐ์ ์ฐจ์งํ๋ ๋ชจ๋ธ ์ฒดํฌํฌ์ธํธ๋ ์๋์ผ๋ก ์์ ์กฐ๊ฐ๋ค๋ก ์ค๋ฉ๋ฉ๋๋ค. `model.save_pretrained(save_dir)`๋ฅผ ์คํํ ๋ ํ๋์ ๋จ์ผ ์ฒดํฌํฌ์ธํธ๋ฅผ ๊ฐ์ง๊ฒ ๋ ๋์ , ์ฌ๋ฌ ๋ถ๋ถ ์ฒดํฌํฌ์ธํธ(๊ฐ๊ฐ์ ํฌ๊ธฐ๋ 10GB ๋ฏธ๋ง)์ ๋งค๊ฐ๋ณ์ ์ด๋ฆ์ ํด๋น ํ์ผ์ ๋งคํํ๋ ์ธ๋ฑ์ค๊ฐ ์์ฑ๋ฉ๋๋ค.
+
+`max_shard_size` ๋งค๊ฐ๋ณ์๋ก ์ค๋ฉ ์ ์ต๋ ํฌ๊ธฐ๋ฅผ ์ ์ดํ ์ ์์ผ๋ฏ๋ก, ์ด ์์ ๋ฅผ ์ํด ์ค๋ ํฌ๊ธฐ๊ฐ ์์ ์ผ๋ฐ ํฌ๊ธฐ์ ๋ชจ๋ธ์ ์ฌ์ฉํ๊ฒ ์ต๋๋ค: ์ ํต์ ์ธ BERT ๋ชจ๋ธ์ ์ฌ์ฉํด ๋ด
์๋ค.
+
+```py
+from transformers import AutoModel
+
+model = AutoModel.from_pretrained("google-bert/bert-base-cased")
+```
+
+[`~PreTrainedModel.save_pretrained`]์ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ์ ์ฅํ๋ฉด, ๋ชจ๋ธ์ ๊ตฌ์ฑ๊ณผ ๊ฐ์ค์น๊ฐ ๋ค์ด์๋ ๋ ๊ฐ์ ํ์ผ์ด ์๋ ์ ํด๋๊ฐ ์์ฑ๋ฉ๋๋ค:
+
+```py
+>>> import os
+>>> import tempfile
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir)
+... print(sorted(os.listdir(tmp_dir)))
+['config.json', 'pytorch_model.bin']
+```
+
+์ด์ ์ต๋ ์ค๋ ํฌ๊ธฐ๋ฅผ 200MB๋ก ์ฌ์ฉํด ๋ด
์๋ค:
+
+```py
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... print(sorted(os.listdir(tmp_dir)))
+['config.json', 'pytorch_model-00001-of-00003.bin', 'pytorch_model-00002-of-00003.bin', 'pytorch_model-00003-of-00003.bin', 'pytorch_model.bin.index.json']
+```
+
+๋ชจ๋ธ์ ๊ตฌ์ฑ์ ๋ํด, ์ธ ๊ฐ์ ๋ค๋ฅธ ๊ฐ์ค์น ํ์ผ๊ณผ ํ๋ผ๋ฏธํฐ ์ด๋ฆ๊ณผ ํด๋น ํ์ผ์ ๋งคํ์ด ํฌํจ๋ `index.json` ํ์ผ์ ๋ณผ ์ ์์ต๋๋ค. ์ด๋ฌํ ์ฒดํฌํฌ์ธํธ๋ [`~PreTrainedModel.from_pretrained`] ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ์์ ํ ๋ค์ ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```py
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... new_model = AutoModel.from_pretrained(tmp_dir)
+```
+
+ํฐ ๋ชจ๋ธ์ ๊ฒฝ์ฐ ์ด๋ฌํ ๋ฐฉ์์ผ๋ก ์ฒ๋ฆฌํ๋ ์ฃผ๋ ์ฅ์ ์ ์์์ ๋ณด์ฌ์ค ํ๋ฆ์ 2๋จ๊ณ์์, ๊ฐ ์ค๋๊ฐ ์ด์ ์ค๋ ๋ค์์ ๋ก๋๋๋ฏ๋ก ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ด ๋ชจ๋ธ ํฌ๊ธฐ์ ๊ฐ์ฅ ํฐ ์ค๋์ ํฌ๊ธฐ๋ฅผ ์ด๊ณผํ์ง ์๋๋ค๋ ์ ์
๋๋ค.
+
+์ด ์ธ๋ฑ์ค ํ์ผ์ ํค๊ฐ ์ฒดํฌํฌ์ธํธ์ ์๋์ง, ๊ทธ๋ฆฌ๊ณ ํด๋น ๊ฐ์ค์น๊ฐ ์ด๋์ ์ ์ฅ๋์ด ์๋์ง๋ฅผ ๊ฒฐ์ ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค. ์ด ์ธ๋ฑ์ค๋ฅผ json๊ณผ ๊ฐ์ด ๋ก๋ํ๊ณ ๋์
๋๋ฆฌ๋ฅผ ์ป์ ์ ์์ต๋๋ค:
+
+```py
+>>> import json
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... with open(os.path.join(tmp_dir, "pytorch_model.bin.index.json"), "r") as f:
+... index = json.load(f)
+
+>>> print(index.keys())
+dict_keys(['metadata', 'weight_map'])
+```
+
+๋ฉํ๋ฐ์ดํฐ๋ ํ์ฌ ๋ชจ๋ธ์ ์ด ํฌ๊ธฐ๋ง ํฌํจ๋ฉ๋๋ค. ์์ผ๋ก ๋ค๋ฅธ ์ ๋ณด๋ฅผ ์ถ๊ฐํ ๊ณํ์
๋๋ค:
+
+```py
+>>> index["metadata"]
+{'total_size': 433245184}
+```
+
+๊ฐ์ค์น ๋งต์ ์ด ์ธ๋ฑ์ค์ ์ฃผ์ ๋ถ๋ถ์ผ๋ก, ๊ฐ ๋งค๊ฐ๋ณ์ ์ด๋ฆ(PyTorch ๋ชจ๋ธ `state_dict`์์ ๋ณดํต ์ฐพ์ ์ ์๋)์ ํด๋น ํ์ผ์ ๋งคํํฉ๋๋ค:
+
+```py
+>>> index["weight_map"]
+{'embeddings.LayerNorm.bias': 'pytorch_model-00001-of-00003.bin',
+ 'embeddings.LayerNorm.weight': 'pytorch_model-00001-of-00003.bin',
+ ...
+```
+
+๋ง์ฝ [`~PreTrainedModel.from_pretrained`]๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ๋ชจ๋ธ ๋ด์์ ์ด๋ฌํ ์ค๋ฉ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ง์ ๊ฐ์ ธ์ค๋ ค๋ฉด (์ ์ฒด ์ฒดํฌํฌ์ธํธ๋ฅผ ์ํด `model.load_state_dict()`๋ฅผ ์ํํ๋ ๊ฒ์ฒ๋ผ), [`~modeling_utils.load_sharded_checkpoint`]๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
+
+```py
+>>> from transformers.modeling_utils import load_sharded_checkpoint
+
+>>> with tempfile.TemporaryDirectory() as tmp_dir:
+... model.save_pretrained(tmp_dir, max_shard_size="200MB")
+... load_sharded_checkpoint(model, tmp_dir)
+```
+
+## ์ (ไฝ)๋ฉ๋ชจ๋ฆฌ ๋ก๋ฉ [[low-memory-loading]]
+
+์ค๋ฉ๋ ์ฒดํฌํฌ์ธํธ๋ ์์์ ์ธ๊ธํ ์์
ํ๋ฆ์ 2๋จ๊ณ์์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ์ค์ด์ง๋ง, ์ (ไฝ)๋ฉ๋ชจ๋ฆฌ ์ค์ ์์ ๋ชจ๋ธ์ ์ฌ์ฉํ๊ธฐ ์ํด ์ฐ๋ฆฌ์ Accelerate ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ ๋๊ตฌ๋ฅผ ํ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+์์ธํ ์ฌํญ์ ๋ค์ ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํด์ฃผ์ธ์: [Accelerate๋ก ๋๊ท๋ชจ ๋ชจ๋ธ ๊ฐ์ ธ์ค๊ธฐ (์๋ฌธ)](../en/main_classes/model#large-model-loading)
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/chat_templating.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/chat_templating.md
new file mode 100644
index 0000000000000000000000000000000000000000..5e6cbc4491dd9951f42f00b8c5022e72dda920c6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/chat_templating.md
@@ -0,0 +1,720 @@
+
+
+# ์ฑํ
๋ชจ๋ธ์ ์ํ ํ
ํ๋ฆฟ[[templates-for-chat-models]]
+
+## ์๊ฐ[[introduction]]
+
+์์ฆ LLM์ ๊ฐ์ฅ ํํ ํ์ฉ ์ฌ๋ก ์ค ํ๋๋ **์ฑํ
**์
๋๋ค. ์ฑํ
์ ์ผ๋ฐ์ ์ธ ์ธ์ด ๋ชจ๋ธ์ฒ๋ผ ๋จ์ผ ๋ฌธ์์ด์ ์ด์ด๊ฐ๋ ๋์ ์ฌ๋ฌ ๊ฐ์ **๋ฉ์์ง**๋ก ๊ตฌ์ฑ๋ ๋ํ๋ฅผ ์ด์ด๊ฐ๋๋ค. ์ด ๋ํ์๋ "์ฌ์ฉ์"๋ "์ด์์คํดํธ"์ ๊ฐ์ **์ญํ **๊ณผ ๋ฉ์์ง ํ
์คํธ๊ฐ ํฌํจ๋ฉ๋๋ค.
+
+ํ ํฐํ์ ๋ง์ฐฌ๊ฐ์ง๋ก, ๋ค์ํ ๋ชจ๋ธ์ ์ฑํ
์ ๋ํด ๋งค์ฐ ๋ค๋ฅธ ์
๋ ฅ ํ์์ ๊ธฐ๋ํฉ๋๋ค. ์ด๊ฒ์ด ์ฐ๋ฆฌ๊ฐ **์ฑํ
ํ
ํ๋ฆฟ**์ ๊ธฐ๋ฅ์ผ๋ก ์ถ๊ฐํ ์ด์ ์
๋๋ค. ์ฑํ
ํ
ํ๋ฆฟ์ ํ ํฌ๋์ด์ ์ ์ผ๋ถ์
๋๋ค. ์ฑํ
ํ
ํ๋ฆฟ์ ๋ํ ๋ชฉ๋ก์ ๋ชจ๋ธ์ด ๊ธฐ๋ํ๋ ํ์์ธ '๋จ์ผ ํ ํฐํ๊ฐ ๊ฐ๋ฅํ ๋ฌธ์์ด'๋ก ๋ณํํ๋ ๋ฐฉ๋ฒ์ ์ง์ ํฉ๋๋ค.
+
+`BlenderBot` ๋ชจ๋ธ์ ์ฌ์ฉํ ๊ฐ๋จํ ์์ ๋ฅผ ํตํด ์ด๋ฅผ ๊ตฌ์ฒด์ ์ผ๋ก ์ดํด๋ณด๊ฒ ์ต๋๋ค. BlenderBot์ ๊ธฐ๋ณธ์ ์ผ๋ก ๋งค์ฐ ๊ฐ๋จํ ํ
ํ๋ฆฟ์ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ, ์ฃผ๋ก ๋ํ ๋ผ์ด๋ ์ฌ์ด์ ๊ณต๋ฐฑ์ ์ถ๊ฐํฉ๋๋ค:
+
+```python
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
+
+>>> chat = [
+... {"role": "user", "content": "Hello, how are you?"},
+... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
+... {"role": "user", "content": "I'd like to show off how chat templating works!"},
+... ]
+
+>>> tokenizer.apply_chat_template(chat, tokenize=False)
+" Hello, how are you? I'm doing great. How can I help you today? I'd like to show off how chat templating works!"
+```
+
+์ ์ฒด ์ฑํ
์ด ํ๋์ ๋ฌธ์์ด๋ก ์์ถ๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค. ๊ธฐ๋ณธ ์ค์ ์ธ `tokenize=True`๋ฅผ ์ฌ์ฉํ๋ฉด, ๊ทธ ๋ฌธ์์ด๋ ํ ํฐํ๋ฉ๋๋ค. ๋ ๋ณต์กํ ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๊ธฐ ์ํด `mistralai/Mistral-7B-Instruct-v0.1` ๋ชจ๋ธ์ ์ฌ์ฉํด ๋ณด๊ฒ ์ต๋๋ค.
+
+```python
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.1")
+
+>>> chat = [
+... {"role": "user", "content": "Hello, how are you?"},
+... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
+... {"role": "user", "content": "I'd like to show off how chat templating works!"},
+... ]
+
+>>> tokenizer.apply_chat_template(chat, tokenize=False)
+"[INST] Hello, how are you? [/INST]I'm doing great. How can I help you today? [INST] I'd like to show off how chat templating works! [/INST]"
+```
+
+์ด๋ฒ์๋ ํ ํฌ๋์ด์ ๊ฐ [INST]์ [/INST] ์ ์ด ํ ํฐ์ ์ถ๊ฐํ์ฌ ์ฌ์ฉ์ ๋ฉ์์ง์ ์์๊ณผ ๋์ ํ์ํ์ต๋๋ค(์ด์์คํดํธ ๋ฉ์์ง ์ ์ธ). Mistral-instruct๋ ์ด๋ฌํ ํ ํฐ์ผ๋ก ํ๋ จ๋์์ง๋ง, BlenderBot์ ๊ทธ๋ ์ง ์์์ต๋๋ค.
+
+## ์ฑํ
ํ
ํ๋ฆฟ์ ์ด๋ป๊ฒ ์ฌ์ฉํ๋์?[[how-do-i-use-chat-templates]]
+
+์์ ์์์ ๋ณผ ์ ์๋ฏ์ด ์ฑํ
ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๊ธฐ ์ฝ์ต๋๋ค. `role`๊ณผ `content` ํค๊ฐ ํฌํจ๋ ๋ฉ์์ง ๋ชฉ๋ก์ ์์ฑํ ๋ค์, [`~PreTrainedTokenizer.apply_chat_template`] ๋ฉ์๋์ ์ ๋ฌํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋ฐ๋ก ์ฌ์ฉํ ์ ์๋ ์ถ๋ ฅ์ด ์์ฑ๋ฉ๋๋ค! ๋ชจ๋ธ ์์ฑ์ ์
๋ ฅ์ผ๋ก ์ฑํ
ํ
ํ๋ฆฟ์ ์ฌ์ฉํ ๋, `add_generation_prompt=True`๋ฅผ ์ฌ์ฉํ์ฌ [์์ฑ ํ๋กฌํํธ](#what-are-generation-prompts)๋ฅผ ์ถ๊ฐํ๋ ๊ฒ๋ ์ข์ ๋ฐฉ๋ฒ์
๋๋ค.
+
+๋ค์์ `Zephyr` ์ด์์คํดํธ ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ `model.generate()`์ ์
๋ ฅ์ ์ค๋นํ๋ ์์ ์
๋๋ค:
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+checkpoint = "HuggingFaceH4/zephyr-7b-beta"
+tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+model = AutoModelForCausalLM.from_pretrained(checkpoint) # ์ฌ๊ธฐ์ bfloat16 ์ฌ์ฉ ๋ฐ/๋๋ GPU๋ก ์ด๋ํ ์ ์์ต๋๋ค.
+
+
+messages = [
+ {
+ "role": "system",
+ "content": "You are a friendly chatbot who always responds in the style of a pirate",
+ },
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
+ ]
+tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
+print(tokenizer.decode(tokenized_chat[0]))
+```
+์ด๋ ๊ฒ ํ๋ฉด Zephyr๊ฐ ๊ธฐ๋ํ๋ ์
๋ ฅ ํ์์ ๋ฌธ์์ด์ด ์์ฑ๋ฉ๋๋ค.
+```text
+<|system|>
+You are a friendly chatbot who always responds in the style of a pirate
+<|user|>
+How many helicopters can a human eat in one sitting?
+<|assistant|>
+```
+
+์ด์ ์
๋ ฅ์ด Zephyr์ ๋ง๊ฒ ํ์์ด ์ง์ ๋์์ผ๋ฏ๋ก ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์์ ์ง๋ฌธ์ ๋ํ ์๋ต์ ์์ฑํ ์ ์์ต๋๋ค:
+
+```python
+outputs = model.generate(tokenized_chat, max_new_tokens=128)
+print(tokenizer.decode(outputs[0]))
+```
+
+์ด๋ ๊ฒ ํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ๊ฐ ๋์ต๋๋ค:
+
+```text
+<|system|>
+You are a friendly chatbot who always responds in the style of a pirate
+<|user|>
+How many helicopters can a human eat in one sitting?
+<|assistant|>
+Matey, I'm afraid I must inform ye that humans cannot eat helicopters. Helicopters are not food, they are flying machines. Food is meant to be eaten, like a hearty plate o' grog, a savory bowl o' stew, or a delicious loaf o' bread. But helicopters, they be for transportin' and movin' around, not for eatin'. So, I'd say none, me hearties. None at all.
+```
+
+์ด์ ์ฌ์์ก์ฃ !
+
+## ์ฑํ
์ ์ํ ์๋ํ๋ ํ์ดํ๋ผ์ธ์ด ์๋์?[[is-there-an-automated-pipeline-for-chat]]
+
+๋ค, ์์ต๋๋ค! ์ฐ๋ฆฌ์ ํ
์คํธ ์์ฑ ํ์ดํ๋ผ์ธ์ ์ฑํ
์
๋ ฅ์ ์ง์ํ์ฌ ์ฑํ
๋ชจ๋ธ์ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ด์ ์๋ "ConversationalPipeline" ํด๋์ค๋ฅผ ์ฌ์ฉํ์ง๋ง, ์ด์ ๋ ์ด ๊ธฐ๋ฅ์ด [`TextGenerationPipeline`]์ ํตํฉ๋์์ต๋๋ค. ์ด๋ฒ์๋ ํ์ดํ๋ผ์ธ์ ์ฌ์ฉํ์ฌ `Zephyr` ์์ ๋ฅผ ๋ค์ ์๋ํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+from transformers import pipeline
+
+pipe = pipeline("text-generation", "HuggingFaceH4/zephyr-7b-beta")
+messages = [
+ {
+ "role": "system",
+ "content": "You are a friendly chatbot who always responds in the style of a pirate",
+ },
+ {"role": "user", "content": "How many helicopters can a human eat in one sitting?"},
+]
+print(pipe(messages, max_new_tokens=128)[0]['generated_text'][-1]) # ์ด์์คํดํธ์ ์๋ต์ ์ถ๋ ฅํฉ๋๋ค.
+```
+
+```text
+{'role': 'assistant', 'content': "Matey, I'm afraid I must inform ye that humans cannot eat helicopters. Helicopters are not food, they are flying machines. Food is meant to be eaten, like a hearty plate o' grog, a savory bowl o' stew, or a delicious loaf o' bread. But helicopters, they be for transportin' and movin' around, not for eatin'. So, I'd say none, me hearties. None at all."}
+```
+
+ํ์ดํ๋ผ์ธ์ ํ ํฐํ์ `apply_chat_template` ํธ์ถ ์ ์ธ๋ถ ์ฌํญ์ ๋ชจ๋ ์ฒ๋ฆฌํด์ฃผ๊ธฐ ๋๋ฌธ์, ๋ชจ๋ธ์ ์ฑํ
ํ
ํ๋ฆฟ์ด ์์ผ๋ฉด ํ์ดํ๋ผ์ธ์ ์ด๊ธฐํํ๊ณ ๋ฉ์์ง ๋ชฉ๋ก์ ์ ๋ฌํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค!
+
+
+## "์์ฑ ํ๋กฌํํธ"๋ ๋ฌด์์ธ๊ฐ์?[[what-are-generation-prompts]]
+
+`apply_chat_template` ๋ฉ์๋์๋ `add_generation_prompt` ์ธ์๊ฐ ์๋ค๋ ๊ฒ์ ๋์น์ฑ์ ๊ฒ์
๋๋ค. ์ด ์ธ์๋ ํ
ํ๋ฆฟ์ ๋ด ์๋ต์ ์์์ ๋ํ๋ด๋ ํ ํฐ์ ์ถ๊ฐํ๋๋ก ์ง์ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ๋ค์๊ณผ ๊ฐ์ ์ฑํ
์ ๊ณ ๋ คํด ๋ณด์ธ์:
+
+```python
+messages = [
+ {"role": "user", "content": "Hi there!"},
+ {"role": "assistant", "content": "Nice to meet you!"},
+ {"role": "user", "content": "Can I ask a question?"}
+]
+```
+
+Zephyr ์์ ์์ ๋ณด์๋ ๊ฒ๊ณผ ๊ฐ์ด, ์์ฑ ํ๋กฌํํธ ์์ด ChatML ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๋ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ๋ณด์ผ ๊ฒ์
๋๋ค:
+
+```python
+tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=False)
+"""<|im_start|>user
+Hi there!<|im_end|>
+<|im_start|>assistant
+Nice to meet you!<|im_end|>
+<|im_start|>user
+Can I ask a question?<|im_end|>
+"""
+```
+
+์์ฑ ํ๋กฌํํธ๊ฐ **์๋** ๊ฒฝ์ฐ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```python
+tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
+"""<|im_start|>user
+Hi there!<|im_end|>
+<|im_start|>assistant
+Nice to meet you!<|im_end|>
+<|im_start|>user
+Can I ask a question?<|im_end|>
+<|im_start|>assistant
+"""
+```
+
+์ด๋ฒ์๋ ๋ด ์๋ต์ ์์์ ๋ํ๋ด๋ ํ ํฐ์ ์ถ๊ฐํ ๊ฒ์ ์ฃผ๋ชฉํ์ธ์. ์ด๋ ๊ฒ ํ๋ฉด ๋ชจ๋ธ์ด ํ
์คํธ๋ฅผ ์์ฑํ ๋ ์ฌ์ฉ์์ ๋ฉ์์ง๋ฅผ ๊ณ์ํ๋ ๋์ ๋ด ์๋ต์ ์์ฑํ๊ฒ ๋ฉ๋๋ค. ๊ธฐ์ตํ์ธ์, ์ฑํ
๋ชจ๋ธ์ ์ฌ์ ํ ์ธ์ด ๋ชจ๋ธ์ผ ๋ฟ์ด๋ฉฐ, ๊ทธ๋ค์๊ฒ ์ฑํ
์ ํน๋ณํ ์ข
๋ฅ์ ํ
์คํธ์ผ ๋ฟ์
๋๋ค! ์ ์ ํ ์ ์ด ํ ํฐ์ผ๋ก ์๋ดํด์ผ ์ฑํ
๋ชจ๋ธ์ด ๋ฌด์์ ํด์ผ ํ๋์ง ์ ์ ์์ต๋๋ค.
+
+๋ชจ๋ ๋ชจ๋ธ์ด ์์ฑ ํ๋กฌํํธ๋ฅผ ํ์๋ก ํ๋ ๊ฒ์ ์๋๋๋ค. BlenderBot๊ณผ LLaMA ๊ฐ์ ์ผ๋ถ ๋ชจ๋ธ์ ๋ด ์๋ต ์ ์ ํน๋ณํ ํ ํฐ์ด ์์ต๋๋ค. ์ด๋ฌํ ๊ฒฝ์ฐ `add_generation_prompt` ์ธ์๋ ํจ๊ณผ๊ฐ ์์ต๋๋ค. `add_generation_prompt`์ ์ ํํ ํจ๊ณผ๋ ์ฌ์ฉ ์ค์ธ ํ
ํ๋ฆฟ์ ๋ฐ๋ผ ๋ค๋ฆ
๋๋ค.
+
+
+
+## ์ฑํ
ํ
ํ๋ฆฟ์ ํ๋ จ์ ์ฌ์ฉํ ์ ์๋์?[[can-i-use-chat-templates-in-training]]
+
+๋ค! ์ด ๋ฐฉ๋ฒ์ ์ฑํ
ํ
ํ๋ฆฟ์ ๋ชจ๋ธ์ด ํ๋ จ ์ค์ ๋ณด๋ ํ ํฐ๊ณผ ์ผ์นํ๋๋ก ํ๋ ์ข์ ๋ฐฉ๋ฒ์
๋๋ค. ๋ฐ์ดํฐ ์ธํธ์ ๋ํ ์ ์ฒ๋ฆฌ ๋จ๊ณ๋ก ์ฑํ
ํ
ํ๋ฆฟ์ ์ ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ๊ทธ ํ์๋ ๋ค๋ฅธ ์ธ์ด ๋ชจ๋ธ ํ๋ จ ์์
๊ณผ ๊ฐ์ด ๊ณ์ํ ์ ์์ต๋๋ค. ํ๋ จํ ๋๋ ์ผ๋ฐ์ ์ผ๋ก `add_generation_prompt=False`๋ก ์ค์ ํด์ผ ํฉ๋๋ค. ์ด์์คํดํธ ์๋ต์ ํ๋กฌํํธํ๋ ์ถ๊ฐ ํ ํฐ์ ํ๋ จ ์ค์๋ ๋์์ด ๋์ง ์๊ธฐ ๋๋ฌธ์
๋๋ค. ์์ ๋ฅผ ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+from transformers import AutoTokenizer
+from datasets import Dataset
+
+tokenizer = AutoTokenizer.from_pretrained("HuggingFaceH4/zephyr-7b-beta")
+
+chat1 = [
+ {"role": "user", "content": "Which is bigger, the moon or the sun?"},
+ {"role": "assistant", "content": "The sun."}
+]
+chat2 = [
+ {"role": "user", "content": "Which is bigger, a virus or a bacterium?"},
+ {"role": "assistant", "content": "A bacterium."}
+]
+
+dataset = Dataset.from_dict({"chat": [chat1, chat2]})
+dataset = dataset.map(lambda x: {"formatted_chat": tokenizer.apply_chat_template(x["chat"], tokenize=False, add_generation_prompt=False)})
+print(dataset['formatted_chat'][0])
+```
+๋ค์๊ณผ ๊ฐ์ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์ต๋๋ค:
+```text
+<|user|>
+Which is bigger, the moon or the sun?
+<|assistant|>
+The sun.
+```
+
+์ฌ๊ธฐ์๋ถํฐ๋ ์ผ๋ฐ์ ์ธ ์ธ์ด ๋ชจ๋ธ ์์
๊ณผ ๊ฐ์ด `formatted_chat` ์ด์ ์ฌ์ฉํ์ฌ ํ๋ จ์ ๊ณ์ํ๋ฉด ๋ฉ๋๋ค.
+
+
+`apply_chat_template(tokenize=False)`๋ก ํ
์คํธ๋ฅผ ํ์ํํ ๋ค์ ๋ณ๋์ ๋จ๊ณ์์ ํ ํฐํํ๋ ๊ฒฝ์ฐ, `add_special_tokens=False` ์ธ์๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค. `apply_chat_template(tokenize=True)`๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ์๋ ์ด ๋ฌธ์ ๋ฅผ ๊ฑฑ์ ํ ํ์๊ฐ ์์ต๋๋ค!
+๊ธฐ๋ณธ์ ์ผ๋ก ์ผ๋ถ ํ ํฌ๋์ด์ ๋ ํ ํฐํํ ๋ `` ๋ฐ ``์ ๊ฐ์ ํน๋ณ ํ ํฐ์ ์ถ๊ฐํฉ๋๋ค. ์ฑํ
ํ
ํ๋ฆฟ์ ํญ์ ํ์ํ ๋ชจ๋ ํน๋ณ ํ ํฐ์ ํฌํจํด์ผ ํ๋ฏ๋ก, ๊ธฐ๋ณธ `add_special_tokens=True`๋ก ์ถ๊ฐ์ ์ธ ํน๋ณ ํ ํฐ์ ์ถ๊ฐํ๋ฉด ์๋ชป๋๊ฑฐ๋ ์ค๋ณต๋๋ ํน๋ณ ํ ํฐ์ ์์ฑํ์ฌ ๋ชจ๋ธ ์ฑ๋ฅ์ด ์ ํ๋ ์ ์์ต๋๋ค.
+
+
+## ๊ณ ๊ธ: ์ฑํ
ํ
ํ๋ฆฟ์ ์ถ๊ฐ ์
๋ ฅ ์ฌ์ฉ[[advanced-extra-inputs-to-chat-templates]]
+
+`apply_chat_template`๊ฐ ํ์ํ ์ ์ผํ ์ธ์๋ `messages`์
๋๋ค. ๊ทธ๋ฌ๋ `apply_chat_template`์ ํค์๋ ์ธ์๋ฅผ ์ ๋ฌํ๋ฉด ํ
ํ๋ฆฟ ๋ด๋ถ์์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ด๋ฅผ ํตํด ์ฑํ
ํ
ํ๋ฆฟ์ ๋ค์ํ ์ฉ๋๋ก ์ฌ์ฉํ ์ ์๋ ์์ ๋ฅผ ์ป์ ์ ์์ต๋๋ค. ์ด๋ฌํ ์ธ์์ ์ด๋ฆ์ด๋ ํ์์๋ ์ ํ์ด ์์ด ๋ฌธ์์ด, ๋ฆฌ์คํธ, ๋์
๋๋ฆฌ ๋ฑ์ ์ ๋ฌํ ์ ์์ต๋๋ค.
+
+๊ทธ๋ ๊ธด ํ์ง๋ง, ์ด๋ฌํ ์ถ๊ฐ ์ธ์์ ์ผ๋ฐ์ ์ธ ์ฌ์ฉ ์ฌ๋ก๋ก 'ํจ์ ํธ์ถ์ ์ํ ๋๊ตฌ'๋ '๊ฒ์ ์ฆ๊ฐ ์์ฑ์ ์ํ ๋ฌธ์'๋ฅผ ์ ๋ฌํ๋ ๊ฒ์ด ์์ต๋๋ค. ์ด๋ฌํ ์ผ๋ฐ์ ์ธ ๊ฒฝ์ฐ์ ๋ํด ์ธ์์ ์ด๋ฆ๊ณผ ํ์์ ๋ํ ๋ช ๊ฐ์ง ๊ถ์ฅ ์ฌํญ์ด ์์ผ๋ฉฐ, ์ด๋ ์๋ ์น์
์ ์ค๋ช
๋์ด ์์ต๋๋ค. ์ฐ๋ฆฌ๋ ๋ชจ๋ธ ์์ฑ์์๊ฒ ๋๊ตฌ ํธ์ถ ์ฝ๋๋ฅผ ๋ชจ๋ธ ๊ฐ์ ์ฝ๊ฒ ์ ์กํ ์ ์๋๋ก ์ฑํ
ํ
ํ๋ฆฟ์ ์ด ํ์๊ณผ ํธํ๋๋๋ก ๋ง๋ค ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
+
+## ๊ณ ๊ธ: ๋๊ตฌ ์ฌ์ฉ / ํจ์ ํธ์ถ[[advanced-tool-use--function-calling]]
+
+"๋๊ตฌ ์ฌ์ฉ" LLM์ ๋ต๋ณ์ ์์ฑํ๊ธฐ ์ ์ ์ธ๋ถ ๋๊ตฌ๋ก์ ํจ์๋ฅผ ํธ์ถํ ์ ์์ต๋๋ค. ๋๊ตฌ ์ฌ์ฉ ๋ชจ๋ธ์ ๋๊ตฌ๋ฅผ ์ ๋ฌํ ๋๋ ๋จ์ํ ํจ์ ๋ชฉ๋ก์ `tools` ์ธ์๋ก ์ ๋ฌํ ์ ์์ต๋๋ค:
+
+```python
+import datetime
+
+def current_time():
+ """ํ์ฌ ํ์ง ์๊ฐ์ ๋ฌธ์์ด๋ก ๊ฐ์ ธ์ต๋๋ค."""
+ return str(datetime.now())
+
+def multiply(a: float, b: float):
+ """
+ ๋ ์ซ์๋ฅผ ๊ณฑํ๋ ํจ์
+
+ ์ธ์:
+ a: ๊ณฑํ ์ฒซ ๋ฒ์งธ ์ซ์
+ b: ๊ณฑํ ๋ ๋ฒ์งธ ์ซ์
+ """
+ return a * b
+
+tools = [current_time, multiply]
+
+model_input = tokenizer.apply_chat_template(
+ messages,
+ tools=tools
+)
+```
+
+์ด๊ฒ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํ๋ ค๋ฉด ํจ์๋ฅผ ์ ํ์์ผ๋ก ์์ฑํด์ผ ๋๊ตฌ๋ก ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌ๋ฌธ ๋ถ์ํ ์ ์์ต๋๋ค. ๊ตฌ์ฒด์ ์ผ๋ก ๋ค์ ๊ท์น์ ๋ฐ๋ผ์ผ ํฉ๋๋ค:
+
+- ํจ์๋ ์ค๋ช
์ ์ธ ์ด๋ฆ์ ๊ฐ์ ธ์ผ ํฉ๋๋ค.
+- ๋ชจ๋ ์ธ์์๋ ํ์
ํํธ๊ฐ ์์ด์ผ ํฉ๋๋ค.
+- ํจ์์๋ ํ์ค Google ์คํ์ผ์ ๋ํฌ์คํธ๋ง์ด ์์ด์ผ ํฉ๋๋ค(์ฆ, ์ด๊ธฐ ํจ์ ์ค๋ช
๋ค์์ ์ธ์๋ฅผ ์ค๋ช
ํ๋ `Args:` ๋ธ๋ก์ด ์์ด์ผ ํฉ๋๋ค).
+- `Args:` ๋ธ๋ก์๋ ํ์
์ ํฌํจํ์ง ๋ง์ธ์. ์ฆ, `a (int): The first number to multiply` ๋์ `a: The first number to multiply`๋ผ๊ณ ์์ฑํด์ผ ํฉ๋๋ค. ํ์
ํํธ๋ ํจ์ ํค๋์ ์์ด์ผ ํฉ๋๋ค.
+- ํจ์์๋ ๋ฐํ ํ์
๊ณผ ๋ํฌ์คํธ๋ง์ `Returns:` ๋ธ๋ก์ด ์์ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋๋ถ๋ถ์ ๋๊ตฌ ์ฌ์ฉ ๋ชจ๋ธ์ ์ด๋ฅผ ๋ฌด์ํ๋ฏ๋ก ์ด๋ ์ ํ ์ฌํญ์
๋๋ค.
+
+
+### ๋๊ตฌ ๊ฒฐ๊ณผ๋ฅผ ๋ชจ๋ธ์ ์ ๋ฌํ๊ธฐ[[passing-tool-results-to-the-model]]
+
+์์ ์์ ์ฝ๋๋ ๋ชจ๋ธ์ ์ฌ์ฉํ ์ ์๋ ๋๊ตฌ๋ฅผ ๋์ดํ๋ ๋ฐ ์ถฉ๋ถํ์ง๋ง, ์ค์ ๋ก ์ฌ์ฉํ๊ณ ์ ํ๋ ๊ฒฝ์ฐ๋ ์ด๋ป๊ฒ ํด์ผ ํ ๊น์? ์ด๋ฌํ ๊ฒฝ์ฐ์๋ ๋ค์์ ์ํํด์ผ ํฉ๋๋ค:
+
+1. ๋ชจ๋ธ์ ์ถ๋ ฅ์ ํ์ฑํ์ฌ ๋๊ตฌ ์ด๋ฆ๊ณผ ์ธ์๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
+2. ๋ชจ๋ธ์ ๋๊ตฌ ํธ์ถ์ ๋ํ์ ์ถ๊ฐํฉ๋๋ค.
+3. ํด๋น ์ธ์์ ๋์ํ๋ ํจ์๋ฅผ ํธ์ถํฉ๋๋ค.
+4. ๊ฒฐ๊ณผ๋ฅผ ๋ํ์ ์ถ๊ฐํฉ๋๋ค.
+
+### ๋๊ตฌ ์ฌ์ฉ ์์ [[a-complete-tool-use-example]]
+
+๋๊ตฌ ์ฌ์ฉ ์์ ๋ฅผ ๋จ๊ณ๋ณ๋ก ์ดํด๋ณด๊ฒ ์ต๋๋ค. ์ด ์์ ์์๋ ๋๊ตฌ ์ฌ์ฉ ๋ชจ๋ธ ์ค์์ ์ฑ๋ฅ์ด ๊ฐ์ฅ ์ฐ์ํ 8B `Hermes-2-Pro` ๋ชจ๋ธ์ ์ฌ์ฉํ ๊ฒ์
๋๋ค. ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ถฉ๋ถํ๋ค๋ฉด, ๋ ํฐ ๋ชจ๋ธ์ธ [Command-R](https://huggingface.co/CohereForAI/c4ai-command-r-v01) ๋๋ [Mixtral-8x22B](https://huggingface.co/mistralai/Mixtral-8x22B-Instruct-v0.1)๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๋ ๊ณ ๋ คํ ์ ์์ต๋๋ค. ์ด ๋ ๋ชจ๋ธ ๋ชจ๋ ๋๊ตฌ ์ฌ์ฉ์ ์ง์ํ๋ฉฐ ๋ ๊ฐ๋ ฅํ ์ฑ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
+
+๋จผ์ ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ฅผ ๋ก๋ํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+import torch
+from transformers import AutoModelForCausalLM, AutoTokenizer
+
+checkpoint = "NousResearch/Hermes-2-Pro-Llama-3-8B"
+
+tokenizer = AutoTokenizer.from_pretrained(checkpoint, revision="pr/13")
+model = AutoModelForCausalLM.from_pretrained(checkpoint, torch_dtype=torch.bfloat16, device_map="auto")
+```
+
+๋ค์์ผ๋ก, ๋๊ตฌ ๋ชฉ๋ก์ ์ ์ํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+def get_current_temperature(location: str, unit: str) -> float:
+ """
+ ํน์ ์์น์ ํ์ฌ ์จ๋๋ฅผ ๊ฐ์ ธ์ต๋๋ค.
+
+ ์ธ์:
+ ์์น: ์จ๋๋ฅผ ๊ฐ์ ธ์ฌ ์์น, "๋์, ๊ตญ๊ฐ" ํ์
+ ๋จ์: ์จ๋ ๋จ์ (์ ํ์ง: ["celsius", "fahrenheit"])
+ ๋ฐํ๊ฐ:
+ ์ง์ ๋ ์์น์ ํ์ฌ ์จ๋๋ฅผ ์ง์ ๋ ๋จ์๋ก ๋ฐํ, float ํ์.
+ """
+ return 22. # ์ด ํจ์๋ ์ค์ ๋ก ์จ๋๋ฅผ ๊ฐ์ ธ์์ผ ํ ๊ฒ์
๋๋ค!
+
+def get_current_wind_speed(location: str) -> float:
+ """
+ ์ฃผ์ด์ง ์์น์ ํ์ฌ ํ์์ km/h ๋จ์๋ก ๊ฐ์ ธ์ต๋๋ค.
+
+ ์ธ์:
+ ์์น(location): ํ์์ ๊ฐ์ ธ์ฌ ์์น, "๋์, ๊ตญ๊ฐ" ํ์
+ ๋ฐํ๊ฐ:
+ ์ฃผ์ด์ง ์์น์ ํ์ฌ ํ์์ km/h ๋จ์๋ก ๋ฐํ, float ํ์.
+ """
+ return 6. # ์ด ํจ์๋ ์ค์ ๋ก ํ์์ ๊ฐ์ ธ์์ผ ํ ๊ฒ์
๋๋ค!
+
+tools = [get_current_temperature, get_current_wind_speed]
+```
+
+์ด์ ๋ด์ ์ํ ๋ํ๋ฅผ ์ค์ ํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+messages = [
+ {"role": "system", "content": "You are a bot that responds to weather queries. You should reply with the unit used in the queried location."},
+ {"role": "user", "content": "Hey, what's the temperature in Paris right now?"}
+]
+```
+
+์ด์ ์ฑํ
ํ
ํ๋ฆฟ์ ์ ์ฉํ๊ณ ์๋ต์ ์์ฑํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+inputs = tokenizer.apply_chat_template(messages, chat_template="tool_use", tools=tools, add_generation_prompt=True, return_dict=True, return_tensors="pt")
+inputs = {k: v.to(model.device) for k, v in inputs.items()}
+out = model.generate(**inputs, max_new_tokens=128)
+print(tokenizer.decode(out[0][len(inputs["input_ids"][0]):]))
+```
+
+๊ฒฐ๊ณผ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```text
+
+{"arguments": {"location": "Paris, France", "unit": "celsius"}, "name": "get_current_temperature"}
+ <|im_end|>
+```
+
+๋ชจ๋ธ์ด ํจ์ ํธ์ถ์ ์ ํจํ ์ธ์๋ก ์ํํ์ผ๋ฉฐ, ํจ์ ๋ํฌ์คํธ๋ง์ ์์ฒญ๋ ํ์์ผ๋ก ํธ์ถํ์์ ์ ์ ์์ต๋๋ค. ๋ชจ๋ธ์ ์ฐ๋ฆฌ๊ฐ ํ๋์ค์ ํ๋ฆฌ๋ฅผ ์ง์นญํ๊ณ ์๋ค๋ ๊ฒ์ ์ถ๋ก ํ๊ณ , ํ๋์ค๊ฐ SI ๋จ์์ ๋ณธ๊ณ ์ฅ์์ ๊ธฐ์ตํ์ฌ ์จ๋๋ฅผ ์ญ์จ๋ก ํ์ํด์ผ ํ๋ค๊ณ ํ๋จํ์ต๋๋ค.
+
+๋ชจ๋ธ์ ๋๊ตฌ ํธ์ถ์ ๋ํ์ ์ถ๊ฐํด ๋ณด๊ฒ ์ต๋๋ค. ์ฌ๊ธฐ์ ์์์ `tool_call_id`๋ฅผ ์์ฑํฉ๋๋ค. ์ด ID๋ ๋ชจ๋ ๋ชจ๋ธ์์ ์ฌ์ฉ๋๋ ๊ฒ์ ์๋์ง๋ง, ์ฌ๋ฌ ๋๊ตฌ ํธ์ถ์ ํ ๋ฒ์ ๋ฐํํ๊ณ ๊ฐ ์๋ต์ด ์ด๋ ํธ์ถ์ ํด๋นํ๋์ง ์ถ์ ํ ์ ์๊ฒ ํด์ค๋๋ค. ์ด ID๋ ๋ํ ๋ด์์ ๊ณ ์ ํด์ผ ํฉ๋๋ค.
+
+```python
+tool_call_id = "vAHdf3" # ์์์ ID, ๊ฐ ๋๊ตฌ ํธ์ถ๋ง๋ค ๊ณ ์ ํด์ผ ํจ
+tool_call = {"name": "get_current_temperature", "arguments": {"location": "Paris, France", "unit": "celsius"}}
+messages.append({"role": "assistant", "tool_calls": [{"id": tool_call_id, "type": "function", "function": tool_call}]})
+```
+
+
+์ด์ ๋๊ตฌ ํธ์ถ์ ๋ํ์ ์ถ๊ฐํ์ผ๋ฏ๋ก, ํจ์๋ฅผ ํธ์ถํ๊ณ ๊ฒฐ๊ณผ๋ฅผ ๋ํ์ ์ถ๊ฐํ ์ ์์ต๋๋ค. ์ด ์์ ์์๋ ํญ์ 22.0์ ๋ฐํํ๋ ๋๋ฏธ ํจ์๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฏ๋ก, ๊ฒฐ๊ณผ๋ฅผ ์ง์ ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค. ๋ค์ ํ ๋ฒ, `tool_call_id`๋ ๋๊ตฌ ํธ์ถ์ ์ฌ์ฉํ๋ ID์ ์ผ์นํด์ผ ํฉ๋๋ค.
+
+```python
+messages.append({"role": "tool", "tool_call_id": tool_call_id, "name": "get_current_temperature", "content": "22.0"})
+```
+
+๋ง์ง๋ง์ผ๋ก, ์ด์์คํดํธ๊ฐ ํจ์ ์ถ๋ ฅ์ ์ฝ๊ณ ์ฌ์ฉ์์ ๊ณ์ ๋ํํ ์ ์๋๋ก ํ๊ฒ ์ต๋๋ค:
+
+```python
+inputs = tokenizer.apply_chat_template(messages, chat_template="tool_use", tools=tools, add_generation_prompt=True, return_dict=True, return_tensors="pt")
+inputs = {k: v.to(model.device) for k, v in inputs.items()}
+out = model.generate(**inputs, max_new_tokens=128)
+print(tokenizer.decode(out[0][len(inputs["input_ids"][0]):]))
+```
+
+๊ฒฐ๊ณผ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```text
+The current temperature in Paris, France is 22.0 ยฐ Celsius.<|im_end|>
+```
+
+์ด๊ฒ์ ๋๋ฏธ ๋๊ตฌ์ ๋จ์ผ ํธ์ถ์ ์ฌ์ฉํ ๊ฐ๋จํ ๋ฐ๋ชจ์์ง๋ง, ๋์ผํ ๊ธฐ์ ์ ์ฌ์ฉํ์ฌ ์ฌ๋ฌ ์ค์ ๋๊ตฌ์ ๋ ๊ธด ๋ํ๋ฅผ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค. ์ด๋ฅผ ํตํด ์ค์๊ฐ ์ ๋ณด, ๊ณ์ฐ ๋๊ตฌ ๋๋ ๋๊ท๋ชจ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ ๊ทผํ์ฌ ๋ํํ ์์ด์ ํธ์ ๊ธฐ๋ฅ์ ํ์ฅํ ์ ์์ต๋๋ค.
+
+
+์์์ ๋ณด์ฌ์ค ๋๊ตฌ ํธ์ถ ๊ธฐ๋ฅ์ ๋ชจ๋ ๋ชจ๋ธ์์ ์ฌ์ฉ๋๋ ๊ฒ์ ์๋๋๋ค. ์ผ๋ถ ๋ชจ๋ธ์ ๋๊ตฌ ํธ์ถ ID๋ฅผ ์ฌ์ฉํ๊ณ , ์ผ๋ถ๋ ํจ์ ์ด๋ฆ๋ง ์ฌ์ฉํ์ฌ ๊ฒฐ๊ณผ์ ๋๊ตฌ ํธ์ถ์ ์์์ ๋ฐ๋ผ ๋งค์นญํ๋ฉฐ, ํผ๋์ ํผํ๊ธฐ ์ํด ํ ๋ฒ์ ํ๋์ ๋๊ตฌ ํธ์ถ๋ง ๋ฐํํ๋ ๋ชจ๋ธ๋ ์์ต๋๋ค. ๊ฐ๋ฅํ ๋ง์ ๋ชจ๋ธ๊ณผ ํธํ๋๋ ์ฝ๋๋ฅผ ์ํ๋ค๋ฉด, ์ฌ๊ธฐ์ ๋ณด์ฌ์ค ๊ฒ์ฒ๋ผ ๋๊ตฌ ํธ์ถ์ ๊ตฌ์ฑํ๊ณ , ๋ชจ๋ธ์ด ๋ฐํํ ์์๋๋ก ๋๊ตฌ ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ๊ฐ ๋ชจ๋ธ์ ์ฑํ
ํ
ํ๋ฆฟ์ด ๋๋จธ์ง ์์
์ ์ฒ๋ฆฌํ ๊ฒ์
๋๋ค.
+
+
+### ๋๊ตฌ ์คํค๋ง ์ดํดํ๊ธฐ[[understanding-tool-schemas]]
+
+`apply_chat_template`์ `tools` ์ธ์์ ์ ๋ฌํ๋ ๊ฐ ํจ์๋ [JSON ์คํค๋ง](https://json-schema.org/learn/getting-started-step-by-step)๋ก ๋ณํ๋ฉ๋๋ค. ์ด๋ฌํ ์คํค๋ง๋ ๋ชจ๋ธ ์ฑํ
ํ
ํ๋ฆฟ์ ์ ๋ฌ๋ฉ๋๋ค. ์ฆ, ๋๊ตฌ ์ฌ์ฉ ๋ชจ๋ธ์ ํจ์ ์์ฒด๋ฅผ ์ง์ ๋ณด์ง ์์ผ๋ฉฐ, ํจ์ ๋ด๋ถ์ ์ค์ ์ฝ๋๋ฅผ ๋ณด์ง ์์ต๋๋ค. ๋๊ตฌ ์ฌ์ฉ ๋ชจ๋ธ์ด ๊ด์ฌ์ ๊ฐ์ง๋ ๊ฒ์ ํจ์ **์ ์**์ **์ธ์**์
๋๋ค. ํจ์๊ฐ ๋ฌด์์ ํ๊ณ ์ด๋ป๊ฒ ์ฌ์ฉํ๋์ง์ ๊ด์ฌ์ด ์์ ๋ฟ, ์ด๋ป๊ฒ ์๋ํ๋์ง๋ ์ค์ํ์ง ์์ต๋๋ค! ๋ชจ๋ธ์ ์ถ๋ ฅ์ ์ฝ๊ณ ๋ชจ๋ธ์ด ๋๊ตฌ ์ฌ์ฉ์ ์์ฒญํ๋์ง ๊ฐ์งํ์ฌ, ์ธ์๋ฅผ ๋๊ตฌ ํจ์์ ์ ๋ฌํ๊ณ ์ฑํ
์์ ์๋ต์ ๋ฐํํ๋ ๊ฒ์ ์ฌ๋ฌ๋ถ์ ๋ชซ์
๋๋ค.
+
+์์ ๊ท๊ฒฉ์ ๋ฐ๋ฅธ๋ค๋ฉด, ํ
ํ๋ฆฟ์ ์ ๋ฌํ JSON ์คํค๋ง ์์ฑ์ ์๋ํํ๊ณ ๋ณด์ด์ง ์๊ฒ ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๊ฑฐ๋ ๋ณํ์ ๋ ์ ์ดํ๊ณ ์ถ๋ค๋ฉด ์๋์ผ๋ก ๋ณํ์ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค. ๋ค์์ ์๋ ์คํค๋ง ๋ณํ ์์ ์
๋๋ค.
+
+```python
+from transformers.utils import get_json_schema
+
+def multiply(a: float, b: float):
+ """
+ ๋ ์ซ์๋ฅผ ๊ณฑํ๋ ํจ์
+
+ ์ธ์:
+ a: ๊ณฑํ ์ฒซ ๋ฒ์งธ ์ซ์
+ b: ๊ณฑํ ๋ ๋ฒ์งธ ์ซ์
+ """
+ return a * b
+
+schema = get_json_schema(multiply)
+print(schema)
+```
+
+์ด ๊ฒฐ๊ณผ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```json
+{
+ "type": "function",
+ "function": {
+ "name": "multiply",
+ "description": "A function that multiplies two numbers",
+ "parameters": {
+ "type": "object",
+ "properties": {
+ "a": {
+ "type": "number",
+ "description": "The first number to multiply"
+ },
+ "b": {
+ "type": "number",
+ "description": "The second number to multiply"
+ }
+ },
+ "required": ["a", "b"]
+ }
+ }
+}
+```
+
+์ํ๋ค๋ฉด ์ด๋ฌํ ์คํค๋ง๋ฅผ ํธ์งํ๊ฑฐ๋ `get_json_schema`๋ฅผ ์ ํ ์ฌ์ฉํ์ง ์๊ณ ์ฒ์๋ถํฐ ์ง์ ์์ฑํ ์๋ ์์ต๋๋ค. JSON ์คํค๋ง๋ `apply_chat_template`์ `tools` ์ธ์์ ์ง์ ์ ๋ฌํ ์ ์์ต๋๋ค. ์ด๋ฅผ ํตํด ๋ ๋ณต์กํ ํจ์์ ๋ํ ์ ๋ฐํ ์คํค๋ง๋ฅผ ์ ์ํ ์ ์๊ฒ ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ ์คํค๋ง๊ฐ ๋ณต์กํ ์๋ก ๋ชจ๋ธ์ด ์ฒ๋ฆฌํ๋ ๋ฐ ํผ๋์ ๊ฒช์ ๊ฐ๋ฅ์ฑ์ด ๋์์ง๋๋ค! ๊ฐ๋ฅํ ํ ๊ฐ๋จํ ํจ์ ์๋ช
์ ์ ์งํ๊ณ , ์ธ์(ํนํ ๋ณต์กํ๊ณ ์ค์ฒฉ๋ ์ธ์)๋ฅผ ์ต์ํํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
+
+์ฌ๊ธฐ ์ง์ ์คํค๋ง๋ฅผ ์ ์ํ๊ณ ์ด๋ฅผ `apply_chat_template`์ ์ ๋ฌํ๋ ์์ ๊ฐ ์์ต๋๋ค:
+
+```python
+# ์ธ์๋ฅผ ๋ฐ์ง ์๋ ๊ฐ๋จํ ํจ์
+current_time = {
+ "type": "function",
+ "function": {
+ "name": "current_time",
+ "description": "Get the current local time as a string.",
+ "parameters": {
+ 'type': 'object',
+ 'properties': {}
+ }
+ }
+}
+
+# ๋ ๊ฐ์ ์ซ์ ์ธ์๋ฅผ ๋ฐ๋ ๋ ์์ ํ ํจ์
+multiply = {
+ 'type': 'function',
+ 'function': {
+ 'name': 'multiply',
+ 'description': 'A function that multiplies two numbers',
+ 'parameters': {
+ 'type': 'object',
+ 'properties': {
+ 'a': {
+ 'type': 'number',
+ 'description': 'The first number to multiply'
+ },
+ 'b': {
+ 'type': 'number', 'description': 'The second number to multiply'
+ }
+ },
+ 'required': ['a', 'b']
+ }
+ }
+}
+
+model_input = tokenizer.apply_chat_template(
+ messages,
+ tools = [current_time, multiply]
+)
+```
+
+## ๊ณ ๊ธ: ๊ฒ์ ์ฆ๊ฐ ์์ฑ[[advanced-retrieval-augmented-generation]]
+
+"๊ฒ์ ์ฆ๊ฐ ์์ฑ" ๋๋ "RAG" LLM์ ์ฟผ๋ฆฌ์ ์๋ตํ๊ธฐ ์ ์ ๋ฌธ์์ ์ฝํผ์ค๋ฅผ ๊ฒ์ํ์ฌ ์ ๋ณด๋ฅผ ์ป์ ์ ์์ต๋๋ค. ์ด๋ฅผ ํตํด ๋ชจ๋ธ์ ์ ํ๋ ์ปจํ
์คํธ ํฌ๊ธฐ ์ด์์ผ๋ก ์ง์ ๊ธฐ๋ฐ์ ํฌ๊ฒ ํ์ฅํ ์ ์์ต๋๋ค. RAG ๋ชจ๋ธ์ ๋ํ ์ฐ๋ฆฌ์ ๊ถ์ฅ ์ฌํญ์ ํ
ํ๋ฆฟ์ด `documents` ์ธ์๋ฅผ ํ์ฉํด์ผ ํ๋ค๋ ๊ฒ์
๋๋ค. ์ด ์ธ์๋ ๊ฐ "๋ฌธ์"๊ฐ `title`๊ณผ `contents` ํค๋ฅผ ๊ฐ์ง๋ ๋จ์ผ dict์ธ ๋ฌธ์ ๋ชฉ๋ก์ด์ด์ผ ํฉ๋๋ค. ์ด ํ์์ ๋๊ตฌ์ ์ฌ์ฉ๋๋ JSON ์คํค๋ง๋ณด๋ค ํจ์ฌ ๊ฐ๋จํ๋ฏ๋ก ๋ณ๋์ ๋์ฐ๋ฏธ ํจ์๊ฐ ํ์ํ์ง ์์ต๋๋ค.
+
+
+๋ค์์ RAG ํ
ํ๋ฆฟ์ด ์๋ํ๋ ์์ ์
๋๋ค:
+
+
+```python
+document1 = {
+ "title": "The Moon: Our Age-Old Foe",
+ "contents": "Man has always dreamed of destroying the moon. In this essay, I shall..."
+}
+
+document2 = {
+ "title": "The Sun: Our Age-Old Friend",
+ "contents": "Although often underappreciated, the sun provides several notable benefits..."
+}
+
+model_input = tokenizer.apply_chat_template(
+ messages,
+ documents=[document1, document2]
+)
+```
+
+## ๊ณ ๊ธ: ์ฑํ
ํ
ํ๋ฆฟ์ ์ด๋ป๊ฒ ์๋ํ๋์?[[advanced-how-do-chat-templates-work]]
+
+๋ชจ๋ธ์ ์ฑํ
ํ
ํ๋ฆฟ์ `tokenizer.chat_template` ์์ฑ์ ์ ์ฅ๋ฉ๋๋ค. ์ฑํ
ํ
ํ๋ฆฟ์ด ์ค์ ๋์ง ์์ ๊ฒฝ์ฐ ํด๋น ๋ชจ๋ธ ํด๋์ค์ ๊ธฐ๋ณธ ํ
ํ๋ฆฟ์ด ๋์ ์ฌ์ฉ๋ฉ๋๋ค. `BlenderBot`์ ํ
ํ๋ฆฟ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+
+>>> from transformers import AutoTokenizer
+>>> tokenizer = AutoTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
+
+>>> tokenizer.chat_template
+"{% for message in messages %}{% if message['role'] == 'user' %}{{ ' ' }}{% endif %}{{ message['content'] }}{% if not loop.last %}{{ ' ' }}{% endif %}{% endfor %}{{ eos_token }}"
+```
+
+์ฝ๊ฐ ๋ณต์กํด ๋ณด์ผ ์ ์์ต๋๋ค. ์ฝ๊ธฐ ์ฝ๊ฒ ์ ๋ฆฌํด ๋ณด๊ฒ ์ต๋๋ค. ์ด ๊ณผ์ ์์ ์ถ๊ฐํ๋ ์ค๋ฐ๊ฟ๊ณผ ๋ค์ฌ์ฐ๊ธฐ๊ฐ ํ
ํ๋ฆฟ ์ถ๋ ฅ์ ํฌํจ๋์ง ์๋๋ก ํด์ผ ํฉ๋๋ค. ์๋๋ [๊ณต๋ฐฑ์ ์ ๊ฑฐํ๋](#trimming-whitespace) ํ์
๋๋ค:
+
+```
+{%- for message in messages %}
+ {%- if message['role'] == 'user' %}
+ {{- ' ' }}
+ {%- endif %}
+ {{- message['content'] }}
+ {%- if not loop.last %}
+ {{- ' ' }}
+ {%- endif %}
+{%- endfor %}
+{{- eos_token }}
+```
+
+๋ง์ฝ ์ด์ ๊ฐ์ ํ์์ ์ฒ์ ๋ณธ๋ค๋ฉด, ์ด๊ฒ์ [Jinja ํ
ํ๋ฆฟ](https://jinja.palletsprojects.com/en/3.1.x/templates/)์
๋๋ค.
+Jinja๋ ํ
์คํธ๋ฅผ ์์ฑํ๋ ๊ฐ๋จํ ์ฝ๋๋ฅผ ์์ฑํ ์ ์๋ ํ
ํ๋ฆฟ ์ธ์ด์
๋๋ค. ๋ง์ ๋ฉด์์ ์ฝ๋์ ๊ตฌ๋ฌธ์ด ํ์ด์ฌ๊ณผ ์ ์ฌํฉ๋๋ค. ์์ ํ์ด์ฌ์์๋ ์ด ํ
ํ๋ฆฟ์ด ๋ค์๊ณผ ๊ฐ์ด ๋ณด์ผ ๊ฒ์
๋๋ค:
+
+
+```python
+for idx, message in enumerate(messages):
+ if message['role'] == 'user':
+ print(' ')
+ print(message['content'])
+ if not idx == len(messages) - 1: # Check for the last message in the conversation
+ print(' ')
+print(eos_token)
+```
+
+์ด ํ
ํ๋ฆฟ์ ์ธ ๊ฐ์ง ์ผ์ ํฉ๋๋ค:
+1. ๊ฐ ๋ฉ์์ง์ ๋ํด, ๋ฉ์์ง๊ฐ ์ฌ์ฉ์ ๋ฉ์์ง์ธ ๊ฒฝ์ฐ ๊ณต๋ฐฑ์ ์ถ๊ฐํ๊ณ , ๊ทธ๋ ์ง ์์ผ๋ฉด ์๋ฌด๊ฒ๋ ์ถ๋ ฅํ์ง ์์ต๋๋ค.
+2. ๋ฉ์์ง ๋ด์ฉ์ ์ถ๊ฐํฉ๋๋ค.
+3. ๋ฉ์์ง๊ฐ ๋ง์ง๋ง ๋ฉ์์ง๊ฐ ์๋ ๊ฒฝ์ฐ ๋ ๊ฐ์ ๊ณต๋ฐฑ์ ์ถ๊ฐํฉ๋๋ค. ๋ง์ง๋ง ๋ฉ์์ง ํ์๋ EOS ํ ํฐ์ ์ถ๋ ฅํฉ๋๋ค.
+
+์ด๊ฒ์ ๋งค์ฐ ๊ฐ๋จํ ํ
ํ๋ฆฟ์
๋๋ค. ์ ์ด ํ ํฐ์ ์ถ๊ฐํ์ง ์์ผ๋ฉฐ, ์ดํ ๋ํ์์ ๋ชจ๋ธ์ด ์ด๋ป๊ฒ ๋์ํด์ผ ํ๋์ง ์ง์ํ๋ "์์คํ
" ๋ฉ์์ง๋ฅผ ์ง์ํ์ง ์์ต๋๋ค. ํ์ง๋ง Jinja๋ ์ด๋ฌํ ์์
์ ์ํํ ์ ์๋ ๋ง์ ์ ์ฐ์ฑ์ ์ ๊ณตํฉ๋๋ค! LLaMA๊ฐ ์
๋ ฅ์ ํ์ํํ๋ ๋ฐฉ์๊ณผ ์ ์ฌํ ํ์์ Jinja ํ
ํ๋ฆฟ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค(์ค์ LLaMA ํ
ํ๋ฆฟ์ ๊ธฐ๋ณธ ์์คํ
๋ฉ์์ง ์ฒ๋ฆฌ์ ์ผ๋ฐ์ ์ธ ์์คํ
๋ฉ์์ง ์ฒ๋ฆฌ๋ฅผ ํฌํจํ๊ณ ์์ต๋๋ค - ์ค์ ์ฝ๋์์๋ ์ด ํ
ํ๋ฆฟ์ ์ฌ์ฉํ์ง ๋ง์ธ์!).
+
+```
+{%- for message in messages %}
+ {%- if message['role'] == 'user' %}
+ {{- bos_token + '[INST] ' + message['content'] + ' [/INST]' }}
+ {%- elif message['role'] == 'system' %}
+ {{- '<>\\n' + message['content'] + '\\n< >\\n\\n' }}
+ {%- elif message['role'] == 'assistant' %}
+ {{- ' ' + message['content'] + ' ' + eos_token }}
+ {%- endif %}
+{%- endfor %}
+```
+
+์ด ํ
ํ๋ฆฟ์ ์ ์ ์ดํด๋ณด๋ฉด ๋ฌด์์ ํ๋์ง ์ดํดํ ์ ์์ต๋๋ค. ๋จผ์ , ๊ฐ ๋ฉ์์ง์ "role"์ ๋ฐ๋ผ ํน์ ํ ํฐ์ ์ถ๊ฐํ์ฌ ๋๊ฐ ๋ฉ์์ง๋ฅผ ๋ณด๋๋์ง ๋ชจ๋ธ์๊ฒ ๋ช
ํํ๊ฒ ์๋ ค์ค๋๋ค. ๋ํ ์ฌ์ฉ์, ์ด์์คํดํธ ๋ฐ ์์คํ
๋ฉ์์ง๋ ๊ฐ๊ฐ ๊ณ ์ ํ ํ ํฐ์ผ๋ก ๋ํ๋์ด ๋ชจ๋ธ์ด ๋ช
ํํ๊ฒ ๊ตฌ๋ถํ ์ ์์ต๋๋ค.
+
+## ๊ณ ๊ธ: ์ฑํ
ํ
ํ๋ฆฟ ์ถ๊ฐ ๋ฐ ํธ์ง[[advanced-adding-and-editing-chat-templates]]
+
+### ์ฑํ
ํ
ํ๋ฆฟ์ ์ด๋ป๊ฒ ๋ง๋ค ์ ์๋์?[[how-do-i-create-a-chat-template]]
+
+๊ฐ๋จํฉ๋๋ค. Jinja ํ
ํ๋ฆฟ์ ์์ฑํ๊ณ `tokenizer.chat_template`์ ์ค์ ํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค. ๋ค๋ฅธ ๋ชจ๋ธ์ ๊ธฐ์กด ํ
ํ๋ฆฟ์ ์์์ ์ผ๋ก ์ฌ์ฉํ๊ณ ํ์์ ๋ง๊ฒ ํธ์งํ๋ ๊ฒ์ด ๋ ์ฌ์ธ ๊ฒ ์
๋๋ค! ์๋ฅผ ๋ค์ด, ์์ LLaMA ํ
ํ๋ฆฟ์ ๊ฐ์ ธ์ ์ด์์คํดํธ ๋ฉ์์ง์ "[ASST]" ๋ฐ "[/ASST]"๋ฅผ ์ถ๊ฐํ ์ ์์ต๋๋ค:
+
+```
+{%- for message in messages %}
+ {%- if message['role'] == 'user' %}
+ {{- bos_token + '[INST] ' + message['content'].strip() + ' [/INST]' }}
+ {%- elif message['role'] == 'system' %}
+ {{- '<>\\n' + message['content'].strip() + '\\n< >\\n\\n' }}
+ {%- elif message['role'] == 'assistant' %}
+ {{- '[ASST] ' + message['content'] + ' [/ASST]' + eos_token }}
+ {%- endif %}
+{%- endfor %}
+```
+
+์ด์ `tokenizer.chat_template` ์์ฑ์ ์ค์ ํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋ค์์ [`~PreTrainedTokenizer.apply_chat_template`]๋ฅผ ์ฌ์ฉํ ๋ ์๋กญ๊ฒ ์ค์ ํ ํ
ํ๋ฆฟ์ด ์ฌ์ฉ๋ฉ๋๋ค! ์ด ์์ฑ์ `tokenizer_config.json` ํ์ผ์ ์ ์ฅ๋๋ฏ๋ก, [`~utils.PushToHubMixin.push_to_hub`]๋ฅผ ์ฌ์ฉํ์ฌ ์ ํ
ํ๋ฆฟ์ ํ๋ธ์ ์
๋ก๋ํ๊ณ ๋ชจ๋ ์ฌ์ฉ์๊ฐ ๋ชจ๋ธ์ ๋ง๋ ํ
ํ๋ฆฟ์ ์ฌ์ฉํ ์ ์๋๋ก ํ ์ ์์ต๋๋ค!
+
+```python
+template = tokenizer.chat_template
+template = template.replace("SYS", "SYSTEM") # ์์คํ
ํ ํฐ ๋ณ๊ฒฝ
+tokenizer.chat_template = template # ์ ํ
ํ๋ฆฟ ์ค์
+tokenizer.push_to_hub("model_name") # ์ ํ
ํ๋ฆฟ์ ํ๋ธ์ ์
๋ก๋!
+```
+
+์ฑํ
ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๋ [`~PreTrainedTokenizer.apply_chat_template`] ๋ฉ์๋๋ [`TextGenerationPipeline`] ํด๋์ค์์ ํธ์ถ๋๋ฏ๋ก, ์ฌ๋ฐ๋ฅธ ์ฑํ
ํ
ํ๋ฆฟ์ ์ค์ ํ๋ฉด ๋ชจ๋ธ์ด ์๋์ผ๋ก [`TextGenerationPipeline`]๊ณผ ํธํ๋ฉ๋๋ค.
+
+
+๋ชจ๋ธ์ ์ฑํ
์ฉ๋๋ก ๋ฏธ์ธ ์กฐ์ ํ๋ ๊ฒฝ์ฐ, ์ฑํ
ํ
ํ๋ฆฟ์ ์ค์ ํ๋ ๊ฒ ์ธ์๋ ์ ์ฑํ
์ ์ด ํ ํฐ์ ํ ํฌ๋์ด์ ์ ํน๋ณ ํ ํฐ์ผ๋ก ์ถ๊ฐํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ํน๋ณ ํ ํฐ์ ์ ๋๋ก ๋ถํ ๋์ง ์์ผ๋ฏ๋ก, ์ ์ด ํ ํฐ์ด ์ฌ๋ฌ ์กฐ๊ฐ์ผ๋ก ํ ํฐํ๋๋ ๊ฒ์ ๋ฐฉ์งํฉ๋๋ค. ๋ํ, ํ
ํ๋ฆฟ์์ ์ด์์คํดํธ ์์ฑ์ ๋์ ๋ํ๋ด๋ ํ ํฐ์ผ๋ก ํ ํฌ๋์ด์ ์ `eos_token` ์์ฑ์ ์ค์ ํด์ผ ํฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ํ
์คํธ ์์ฑ ๋๊ตฌ๊ฐ ํ
์คํธ ์์ฑ์ ์ธ์ ์ค์งํด์ผ ํ ์ง ์ ํํ ์ ์ ์์ต๋๋ค.
+
+
+
+### ์ ์ผ๋ถ ๋ชจ๋ธ์ ์ฌ๋ฌ ๊ฐ์ ํ
ํ๋ฆฟ์ ๊ฐ์ง๊ณ ์๋์?[[why-do-some-models-have-multiple-templates]]
+
+์ผ๋ถ ๋ชจ๋ธ์ ๋ค๋ฅธ ์ฌ์ฉ ์ฌ๋ก์ ๋ํด ๋ค๋ฅธ ํ
ํ๋ฆฟ์ ์ฌ์ฉํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์ผ๋ฐ ์ฑํ
์ ์ํ ํ
ํ๋ฆฟ๊ณผ ๋๊ตฌ ์ฌ์ฉ ๋๋ ๊ฒ์ ์ฆ๊ฐ ์์ฑ์ ๋ํ ํ
ํ๋ฆฟ์ ๋ณ๋๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ด๋ฌํ ๊ฒฝ์ฐ `tokenizer.chat_template`๋ ๋์
๋๋ฆฌ์
๋๋ค. ์ด๊ฒ์ ์ฝ๊ฐ์ ํผ๋์ ์ด๋ํ ์ ์์ผ๋ฉฐ, ๊ฐ๋ฅํ ํ ๋ชจ๋ ์ฌ์ฉ ์ฌ๋ก์ ๋ํด ๋จ์ผ ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. `if tools is defined`์ ๊ฐ์ Jinja ๋ฌธ์ฅ๊ณผ `{% macro %}` ์ ์๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ๋ฌ ์ฝ๋ ๊ฒฝ๋ก๋ฅผ ๋จ์ผ ํ
ํ๋ฆฟ์ ์ฝ๊ฒ ๋ํํ ์ ์์ต๋๋ค.
+
+ํ ํฌ๋์ด์ ์ ์ฌ๋ฌ ๊ฐ์ ํ
ํ๋ฆฟ์ด ์๋ ๊ฒฝ์ฐ, `tokenizer.chat_template`๋ ํ
ํ๋ฆฟ ์ด๋ฆ์ด ํค์ธ `๋์
๋๋ฆฌ`์
๋๋ค. `apply_chat_template` ๋ฉ์๋๋ ํน์ ํ
ํ๋ฆฟ ์ด๋ฆ์ ๋ํ ํน๋ณํ ์ฒ๋ฆฌ๋ฅผ ํฉ๋๋ค: ์ผ๋ฐ์ ์ผ๋ก `default`๋ผ๋ ํ
ํ๋ฆฟ์ ์ฐพ๊ณ , ์ฐพ์ ์ ์์ผ๋ฉด ์ค๋ฅ๋ฅผ ๋ฐ์์ํต๋๋ค. ๊ทธ๋ฌ๋ ์ฌ์ฉ์๊ฐ `tools` ์ธ์๋ฅผ ์ ๋ฌํ ๋ `tool_use`๋ผ๋ ํ
ํ๋ฆฟ์ด ์กด์ฌํ๋ฉด ๋์ ๊ทธ๊ฒ์ ์ฌ์ฉํฉ๋๋ค. ๋ค๋ฅธ ์ด๋ฆ์ ํ
ํ๋ฆฟ์ ์ ๊ทผํ๋ ค๋ฉด `apply_chat_template()`์ `chat_template` ์ธ์์ ์ํ๋ ํ
ํ๋ฆฟ ์ด๋ฆ์ ์ ๋ฌํ๋ฉด ๋ฉ๋๋ค.
+
+์ฌ์ฉ์์๊ฒ ์ฝ๊ฐ์ ํผ๋์ ์ค ์ ์์ผ๋ฏ๋ก, ํ
ํ๋ฆฟ์ ์ง์ ์์ฑํ๋ ๊ฒฝ์ฐ ๊ฐ๋ฅํ ํ ๋จ์ผ ํ
ํ๋ฆฟ์ ๋ชจ๋ ๊ฒ์ ๋ฃ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค!
+
+### ์ด๋ค ํ
ํ๋ฆฟ์ ์ฌ์ฉํด์ผ ํ๋์?[[what-template-should-i-use]]
+
+์ด๋ฏธ ์ฑํ
์ฉ์ผ๋ก ํ๋ จ๋ ๋ชจ๋ธ์ ํ
ํ๋ฆฟ์ ์ค์ ํ ๋๋ ํ
ํ๋ฆฟ์ด ํ๋ จ ์ค ๋ชจ๋ธ์ด ๋ณธ ๋ฉ์์ง ํ์๊ณผ ์ ํํ ์ผ์นํ๋๋ก ํด์ผ ํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ์ฑ๋ฅ ์ ํ๋ฅผ ๊ฒฝํํ ๊ฐ๋ฅ์ฑ์ด ํฝ๋๋ค. ์ด๋ ๋ชจ๋ธ์ ์ถ๊ฐ๋ก ํ๋ จํ ๋๋ ๋ง์ฐฌ๊ฐ์ง์
๋๋ค. ์ฑํ
ํ ํฐ์ ์ผ์ ํ๊ฒ ์ ์งํ๋ ๊ฒ์ด ์ต์์ ์ฑ๋ฅ์ ์ป๋ ๋ฐฉ๋ฒ์
๋๋ค. ์ด๋ ํ ํฐํ์ ๋งค์ฐ ์ ์ฌํฉ๋๋ค. ํ๋ จ ์ค์ ์ฌ์ฉ๋ ํ ํฐํ๋ฅผ ์ ํํ ์ผ์น์ํฌ ๋ ์ถ๋ก ์ด๋ ๋ฏธ์ธ ์กฐ์ ์์ ์ต๊ณ ์ ์ฑ๋ฅ์ ์ป์ ์ ์์ต๋๋ค.
+
+๋ฐ๋ฉด์ ์ฒ์๋ถํฐ ๋ชจ๋ธ์ ํ๋ จ์ํค๊ฑฐ๋ ์ฑํ
์ฉ์ผ๋ก ๊ธฐ๋ณธ ์ธ์ด ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๊ฒฝ์ฐ, ์ ์ ํ ํ
ํ๋ฆฟ์ ์ ํํ ์ ์๋ ๋ง์ ์์ ๊ฐ ์์ต๋๋ค. LLM์ ๋ค์ํ ์
๋ ฅ ํ์์ ์ฒ๋ฆฌํ ๋งํผ ์ถฉ๋ถํ ๋๋ํฉ๋๋ค. ์ธ๊ธฐ ์๋ ์ ํ ์ค ํ๋๋ `ChatML` ํ์์ด๋ฉฐ, ์ด๋ ๋ง์ ์ฌ์ฉ ์ฌ๋ก์ ์ ์ฐํ๊ฒ ์ฌ์ฉํ ์ ์๋ ์ข์ ์ ํ์
๋๋ค. ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```
+{%- for message in messages %}
+ {{- '<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n' }}
+{%- endfor %}
+```
+
+์ด ํ
ํ๋ฆฟ์ด ๋ง์์ ๋ ๋ค๋ฉด, ์ฝ๋์ ๋ฐ๋ก ๋ณต์ฌํ์ฌ ์ฌ์ฉํ ์ ์๋ ํ ์ค ๋ฒ์ ์ ์ ๊ณตํ๊ฒ ์ต๋๋ค. ์ด ํ ์ค ๋ฒ์ ์ [์์ฑ ํ๋กฌํํธ](#what-are-generation-prompts)์ ๋ํ ํธ๋ฆฌํ ์ง์๋ ํฌํจํ๊ณ ์์ง๋ง, BOS๋ EOS ํ ํฐ์ ์ถ๊ฐํ์ง ์๋๋ค๋ ์ ์ ์ ์ํ์ธ์! ๋ชจ๋ธ์ด ํด๋น ํ ํฐ์ ๊ธฐ๋ํ๋๋ผ๋, `apply_chat_template`์ ์ํด ์๋์ผ๋ก ์ถ๊ฐ๋์ง ์์ต๋๋ค. ์ฆ, ํ
์คํธ๋ `add_special_tokens=False`์ ์ํด ํ ํฐํ๋ฉ๋๋ค. ์ด๋ ํ
ํ๋ฆฟ๊ณผ `add_special_tokens` ๋
ผ๋ฆฌ ๊ฐ์ ์ ์ฌ์ ์ธ ์ถฉ๋์ ํผํ๊ธฐ ์ํจ์
๋๋ค. ๋ชจ๋ธ์ด ํน๋ณ ํ ํฐ์ ๊ธฐ๋ํ๋ ๊ฒฝ์ฐ, ํ
ํ๋ฆฟ์ ์ง์ ์ถ๊ฐํด์ผ ํฉ๋๋ค!
+
+
+```python
+tokenizer.chat_template = "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}"
+```
+
+์ด ํ
ํ๋ฆฟ์ ๊ฐ ๋ฉ์์ง๋ฅผ `<|im_start|>` ์ `<|im_end|>`ํ ํฐ์ผ๋ก ๊ฐ์ธ๊ณ , ์ญํ ์ ๋ฌธ์์ด๋ก ์์ฑํ์ฌ ํ๋ จ ์ ์ฌ์ฉํ๋ ์ญํ ์ ๋ํ ์ ์ฐ์ฑ์ ์ ๊ณตํฉ๋๋ค. ์ถ๋ ฅ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+
+```text
+<|im_start|>system
+You are a helpful chatbot that will do its best not to say anything so stupid that people tweet about it.<|im_end|>
+<|im_start|>user
+How are you?<|im_end|>
+<|im_start|>assistant
+I'm doing great!<|im_end|>
+```
+
+"์ฌ์ฉ์", "์์คํ
" ๋ฐ "์ด์์คํดํธ" ์ญํ ์ ์ฑํ
์ ํ์ค์ด๋ฉฐ, ๊ฐ๋ฅํ ๋ ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ํนํ ๋ชจ๋ธ์ด [`TextGenerationPipeline`]๊ณผ ์ ์๋ํ๋๋ก ํ๋ ค๋ฉด ๊ทธ๋ ์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด๋ฌํ ์ญํ ์๋ง ๊ตญํ๋์ง ์์ต๋๋ค. ํ
ํ๋ฆฟ์ ๋งค์ฐ ์ ์ฐํ๋ฉฐ, ์ด๋ค ๋ฌธ์์ด์ด๋ ์ญํ ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+
+
+### ์ฑํ
ํ
ํ๋ฆฟ์ ์ถ๊ฐํ๊ณ ์ถ์ต๋๋ค! ์ด๋ป๊ฒ ์์ํด์ผ ํ๋์?[[i-want-to-add-some-chat-templates-how-should-i-get-started]]
+
+์ฑํ
๋ชจ๋ธ์ด ์๋ ๊ฒฝ์ฐ, ํด๋น ๋ชจ๋ธ์ `tokenizer.chat_template` ์์ฑ์ ์ค์ ํ๊ณ [`~PreTrainedTokenizer.apply_chat_template`]๋ฅผ ์ฌ์ฉํ์ฌ ํ
์คํธํ ๋ค์ ์
๋ฐ์ดํธ๋ ํ ํฌ๋์ด์ ๋ฅผ ํ๋ธ์ ํธ์ํด์ผ ํฉ๋๋ค. ์ด๋ ๋ชจ๋ธ ์์ ์๊ฐ ์๋ ๊ฒฝ์ฐ์๋ ์ ์ฉ๋ฉ๋๋ค. ๋น ์ฑํ
ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๋ ๋ชจ๋ธ์ด๋ ์ฌ์ ํ ๊ธฐ๋ณธ ํด๋์ค ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๋ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ, [ํ ๋ฆฌํ์คํธ](https://huggingface.co/docs/hub/repositories-pull-requests-discussions)๋ฅผ ๋ชจ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ ์ด์ด ์ด ์์ฑ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์ ํ ์ ์๋๋ก ํ์ธ์!
+
+์์ฑ์ ์ค์ ํ๋ฉด ๋์
๋๋ค! `tokenizer.apply_chat_template`๊ฐ ์ด์ ํด๋น ๋ชจ๋ธ์ ๋ํด ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํ๋ฏ๋ก, `TextGenerationPipeline`๊ณผ ๊ฐ์ ๊ณณ์์๋ ์๋์ผ๋ก ์ง์๋ฉ๋๋ค!
+
+๋ชจ๋ธ์ ์ด ์์ฑ์ ์ค์ ํจ์ผ๋ก์จ, ์คํ ์์ค ๋ชจ๋ธ์ ์ ์ฒด ๊ธฐ๋ฅ์ ์ปค๋ฎค๋ํฐ๊ฐ ์ฌ์ฉํ ์ ์๋๋ก ํ ์ ์์ต๋๋ค. ํ์ ๋ถ์ผ์น๋ ์ด ๋ถ์ผ์์ ์ค๋ซ๋์ ์ฑ๋ฅ์ ์ ํ์ํค๋ ๋ฌธ์ ์์ผ๋ฏ๋ก, ์ด์ ์ด๋ฅผ ๋๋ผ ๋์
๋๋ค!
+
+## ๊ณ ๊ธ: ํ
ํ๋ฆฟ ์์ฑ ํ[[advanced-template-writing-tips]]
+
+Jinja์ ์ต์ํ์ง ์์ ๊ฒฝ์ฐ, ์ฑํ
ํ
ํ๋ฆฟ์ ์์ฑํ๋ ๊ฐ์ฅ ์ฌ์ด ๋ฐฉ๋ฒ์ ๋จผ์ ๋ฉ์์ง๋ฅผ ์ํ๋ ๋ฐฉ์์ผ๋ก ํ์ํํ๋ ์งง์ ํ์ด์ฌ ์คํฌ๋ฆฝํธ๋ฅผ ์์ฑํ ๋ค์, ํด๋น ์คํฌ๋ฆฝํธ๋ฅผ ํ
ํ๋ฆฟ์ผ๋ก ๋ณํํ๋ ๊ฒ์
๋๋ค.
+
+ํ
ํ๋ฆฟ ํธ๋ค๋ฌ๋ `messages`๋ผ๋ ๋ณ์๋ก ๋ํ ๊ธฐ๋ก์ ๋ฐ์ต๋๋ค. ํ์ด์ฌ์์์ ๋ง์ฐฌ๊ฐ์ง๋ก ํ
ํ๋ฆฟ ๋ด์ `messages`์ ์ ๊ทผํ ์ ์์ผ๋ฉฐ, `{% for message in messages %}`๋ก ๋ฐ๋ณตํ๊ฑฐ๋ `{{ messages[0] }}`์ ๊ฐ์ด ๊ฐ๋ณ ๋ฉ์์ง์ ์ ๊ทผํ ์ ์์ต๋๋ค.
+
+๋ค์ ํ์ ์ฌ์ฉํ์ฌ ์ฝ๋๋ฅผ Jinja๋ก ๋ณํํ ์๋ ์์ต๋๋ค:
+
+### ๊ณต๋ฐฑ ์ ๊ฑฐ[[trimming-whitespace]]
+
+๊ธฐ๋ณธ์ ์ผ๋ก Jinja๋ ๋ธ๋ก ์ ํ์ ๊ณต๋ฐฑ์ ์ถ๋ ฅํฉ๋๋ค. ์ด๋ ์ผ๋ฐ์ ์ผ๋ก ๊ณต๋ฐฑ์ ๋งค์ฐ ์ ํํ๊ฒ ๋ค๋ฃจ๊ณ ์ ํ๋ ์ฑํ
ํ
ํ๋ฆฟ์์๋ ๋ฌธ์ ๊ฐ ๋ ์ ์์ต๋๋ค! ์ด๋ฅผ ํผํ๊ธฐ ์ํด ํ
ํ๋ฆฟ์ ๋ค์๊ณผ ๊ฐ์ด ์์ฑํ๋ ๊ฒ์ด ์ข์ต๋๋ค:
+
+```
+{%- for message in messages %}
+ {{- message['role'] + message['content'] }}
+{%- endfor %}
+```
+
+์๋์ ๊ฐ์ด ์์ฑํ์ง ๋ง์ธ์:
+
+```
+{% for message in messages %}
+ {{ message['role'] + message['content'] }}
+{% endfor %}
+```
+
+`-`๋ฅผ ์ถ๊ฐํ๋ฉด ๋ธ๋ก ์ ํ์ ๊ณต๋ฐฑ์ด ์ ๊ฑฐ๋ฉ๋๋ค. ๋ ๋ฒ์งธ ์์ ๋ ๋ฌดํดํด ๋ณด์ด์ง๋ง, ์ค๋ฐ๊ฟ๊ณผ ๋ค์ฌ์ฐ๊ธฐ๊ฐ ์ถ๋ ฅ์ ํฌํจ๋ ์ ์์ผ๋ฉฐ, ์ด๋ ์ํ์ง ์๋ ๊ฒฐ๊ณผ์ผ ์ ์์ต๋๋ค!
+
+### ๋ฐ๋ณต๋ฌธ[[for-loops]]
+
+Jinja์์ ๋ฐ๋ณต๋ฌธ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```
+{%- for message in messages %}
+ {{- message['content'] }}
+{%- endfor %}
+```
+
+{{ ํํ์ ๋ธ๋ก }} ๋ด๋ถ์ ์๋ ๋ชจ๋ ๊ฒ์ด ์ถ๋ ฅ์ผ๋ก ์ธ์๋ฉ๋๋ค. `+`์ ๊ฐ์ ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ํํ์ ๋ธ๋ก ๋ด๋ถ์์ ๋ฌธ์์ด์ ๊ฒฐํฉํ ์ ์์ต๋๋ค.
+
+### ์กฐ๊ฑด๋ฌธ[[if-statements]]
+
+Jinja์์ ์กฐ๊ฑด๋ฌธ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```
+{%- if message['role'] == 'user' %}
+ {{- message['content'] }}
+{%- endif %}
+```
+
+ํ์ด์ฌ์ด ๊ณต๋ฐฑ์ ์ฌ์ฉํ์ฌ `for` ๋ฐ `if` ๋ธ๋ก์ ์์๊ณผ ๋์ ํ์ํ๋ ๋ฐ๋ฉด, Jinja๋ `{% endfor %}` ๋ฐ `{% endif %}`๋ก ๋ช
์์ ์ผ๋ก ๋์ ํ์ํด์ผ ํฉ๋๋ค.
+
+### ํน์ ๋ณ์[[special-variables]]
+
+ํ
ํ๋ฆฟ ๋ด๋ถ์์๋ `messages` ๋ชฉ๋ก์ ์ ๊ทผํ ์ ์์ ๋ฟ๋ง ์๋๋ผ ์ฌ๋ฌ ๋ค๋ฅธ ํน์ ๋ณ์์๋ ์ ๊ทผํ ์ ์์ต๋๋ค. ์ฌ๊ธฐ์๋ `bos_token` ๋ฐ `eos_token`๊ณผ ๊ฐ์ ํน๋ณ ํ ํฐ๊ณผ ์์ ๋
ผ์ํ `add_generation_prompt` ๋ณ์๊ฐ ํฌํจ๋ฉ๋๋ค. ๋ํ `loop` ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ ํ์ฌ ๋ฐ๋ณต์ ๋ํ ์ ๋ณด๋ฅผ ์ป์ ์ ์์ผ๋ฉฐ, ์๋ฅผ ๋ค์ด `{% if loop.last %}`๋ฅผ ์ฌ์ฉํ์ฌ ํ์ฌ ๋ฉ์์ง๊ฐ ๋ํ์ ๋ง์ง๋ง ๋ฉ์์ง์ธ์ง ํ์ธํ ์ ์์ต๋๋ค. `add_generation_prompt`๊ฐ `True`์ธ ๊ฒฝ์ฐ ๋ํ ๋์ ์์ฑ ํ๋กฌํํธ๋ฅผ ์ถ๊ฐํ๋ ์์ ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```
+{%- if loop.last and add_generation_prompt %}
+ {{- bos_token + 'Assistant:\n' }}
+{%- endif %}
+```
+
+### ๋นํ์ด์ฌ Jinja์์ ํธํ์ฑ[[compatibility-with-non-python-jinja]]
+
+Jinja์ ์ฌ๋ฌ ๊ตฌํ์ ๋ค์ํ ์ธ์ด๋ก ์ ๊ณต๋ฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ๋์ผํ ๊ตฌ๋ฌธ์ ์ฌ์ฉํ์ง๋ง, ์ฃผ์ ์ฐจ์ด์ ์ ํ์ด์ฌ์์ ํ
ํ๋ฆฟ์ ์์ฑํ ๋ ํ์ด์ฌ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ ์ ์๋ค๋ ์ ์
๋๋ค. ์๋ฅผ ๋ค์ด, ๋ฌธ์์ด์ `.lower()`๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ ๋์
๋๋ฆฌ์ `.items()`๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์
๋๋ค. ์ด๋ ๋นํ์ด์ฌ Jinja ๊ตฌํ์์ ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๋ ค๊ณ ํ ๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ํนํ JS์ Rust๊ฐ ์ธ๊ธฐ ์๋ ๋ฐฐํฌ ํ๊ฒฝ์์๋ ๋นํ์ด์ฌ ๊ตฌํ์ด ํํฉ๋๋ค.
+
+ํ์ง๋ง ๊ฑฑ์ ํ์ง ๋ง์ธ์! ๋ชจ๋ Jinja ๊ตฌํ์์ ํธํ์ฑ์ ๋ณด์ฅํ๊ธฐ ์ํด ํ
ํ๋ฆฟ์ ์ฝ๊ฒ ๋ณ๊ฒฝํ ์ ์๋ ๋ช ๊ฐ์ง ๋ฐฉ๋ฒ์ด ์์ต๋๋ค:
+
+- ํ์ด์ฌ ๋ฉ์๋๋ฅผ Jinja ํํฐ๋ก ๋์ฒดํ์ธ์. ์ผ๋ฐ์ ์ผ๋ก ๊ฐ์ ์ด๋ฆ์ ๊ฐ์ง๋ฉฐ, ์๋ฅผ ๋ค์ด `string.lower()`๋ `string|lower`๋ก, `dict.items()`๋ `dict|items`๋ก ๋์ฒดํ ์ ์์ต๋๋ค. ์ฃผ๋ชฉํ ๋งํ ๋ณ๊ฒฝ ์ฌํญ์ `string.strip()`์ด `string|trim`์ผ๋ก ๋ฐ๋๋ ๊ฒ์
๋๋ค. ๋ ์์ธํ ๋ด์ฉ์ Jinja ๋ฌธ์์ [๋ด์ฅ ํํฐ ๋ชฉ๋ก](https://jinja.palletsprojects.com/en/3.1.x/templates/#builtin-filters)์ ์ฐธ์กฐํ์ธ์.
+- ํ์ด์ฌ์ ํนํ๋ `True`, `False`, `None`์ ๊ฐ๊ฐ `true`, `false`, `none`์ผ๋ก ๋์ฒดํ์ธ์.
+- ๋์
๋๋ฆฌ๋ ๋ฆฌ์คํธ๋ฅผ ์ง์ ๋ ๋๋งํ ๋ ๋ค๋ฅธ ๊ตฌํ์์๋ ๊ฒฐ๊ณผ๊ฐ ๋ค๋ฅผ ์ ์์ต๋๋ค(์: ๋ฌธ์์ด ํญ๋ชฉ์ด ๋จ์ผ ๋ฐ์ดํ์์ ์ด์ค ๋ฐ์ดํ๋ก ๋ณ๊ฒฝ๋ ์ ์์ต๋๋ค). `tojson` ํํฐ๋ฅผ ์ถ๊ฐํ๋ฉด ์ผ๊ด์ฑ์ ์ ์งํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/community.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/community.md
new file mode 100644
index 0000000000000000000000000000000000000000..d50168d7548620805d06b2aa06190bbbc8d4d936
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/community.md
@@ -0,0 +1,69 @@
+
+
+# ์ปค๋ฎค๋ํฐ [[community]]
+
+์ด ํ์ด์ง๋ ์ปค๋ฎค๋ํฐ์์ ๊ฐ๋ฐํ ๐ค Transformers ๋ฆฌ์์ค๋ฅผ ์ฌ๊ตฌ์ฑํ ํ์ด์ง์
๋๋ค.
+
+## ์ปค๋ฎค๋ํฐ ๋ฆฌ์์ค: [[community-resources]]
+
+| ๋ฆฌ์์ค | ์ค๋ช
| ๋ง๋ ์ด |
+|:----------|:-------------|------:|
+| [Hugging Face Transformers ์ฉ์ด์ง ํ๋์์นด๋](https://www.darigovresearch.com/huggingface-transformers-glossary-flashcards) | [Transformers ๋ฌธ์ ์ฉ์ด์ง](glossary)์ ๊ธฐ๋ฐ์ผ๋ก ํ ํ๋์์นด๋ ์ธํธ๋ก, ์ง์์ ์ฅ๊ธฐ์ ์ผ๋ก ์ ์งํ๊ธฐ ์ํด ํน๋ณํ ์ค๊ณ๋ ์คํ์์ค ํฌ๋ก์ค ํ๋ซํผ ์ฑ์ธ [Anki](https://apps.ankiweb.net/)๋ฅผ ์ฌ์ฉํ์ฌ ์ฝ๊ฒ ํ์ต/์์ ํ ์ ์๋ ํํ๋ก ์ ์๋์์ต๋๋ค. [ํ๋์์นด๋ ์ฌ์ฉ๋ฒ์ ๋ํ ์๊ฐ ๋์์](https://www.youtube.com/watch?v=Dji_h7PILrw)์ ์ฐธ์กฐํ์ธ์. | [Darigov ๋ฆฌ์์น](https://www.darigovresearch.com/) |
+
+## ์ปค๋ฎค๋ํฐ ๋
ธํธ๋ถ: [[community-notebooks]]
+
+| ๋
ธํธ๋ถ | ์ค๋ช
| ๋ง๋ ์ด | |
+|:----------|:-------------|:-------------|------:|
+| [๊ฐ์ฌ๋ฅผ ์์ฑํ๊ธฐ ์ํด ์ฌ์ ํ๋ จ๋ ํธ๋์คํฌ๋จธ๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/AlekseyKorshuk/huggingartists) | GPT-2 ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ์ฌ ์ข์ํ๋ ์ํฐ์คํธ์ ์คํ์ผ๋ก ๊ฐ์ฌ๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ | [Aleksey Korshuk](https://github.com/AlekseyKorshuk) | [](https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb) |
+| [Tensorflow 2๋ก T5 ํ๋ จํ๊ธฐ](https://github.com/snapthat/TF-T5-text-to-text) | Tensorflow 2๋ฅผ ์ฌ์ฉํ์ฌ T5๋ฅผ ํ๋ จ์ํค๋ ๋ฐฉ๋ฒ. ์ด ๋
ธํธ๋ถ์ Tensorflow 2๋ก SQUAD๋ฅผ ์ฌ์ฉํ์ฌ ๊ตฌํํ ์ง์์๋ต ์์
์ ๋ณด์ฌ์ค๋๋ค. | [Muhammad Harris](https://github.com/HarrisDePerceptron) |[](https://colab.research.google.com/github/snapthat/TF-T5-text-to-text/blob/master/snapthatT5/notebooks/TF-T5-Datasets%20Training.ipynb) |
+| [TPU์์ T5 ํ๋ จํ๊ธฐ](https://github.com/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb) | Transformers์ Nlp๋ฅผ ์ฌ์ฉํ์ฌ SQUAD๋ก T5๋ฅผ ํ๋ จํ๋ ๋ฐฉ๋ฒ | [Suraj Patil](https://github.com/patil-suraj) |[](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/T5_on_TPU.ipynb#scrollTo=QLGiFCDqvuil) |
+| [๋ถ๋ฅ ๋ฐ ๊ฐ๊ด์ ๋ฌธ์ ๋ฅผ ์ํด T5 ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) | ๋ถ๋ฅ ๋ฐ ๊ฐ๊ด์ ๋ฌธ์ ์ ๋ง๊ฒ ํ
์คํธ-ํ
์คํธ ํ์์ ์ฌ์ฉํ์ฌ PyTorch Lightning์ผ๋ก T5๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/exploring-T5/blob/master/t5_fine_tuning.ipynb) |
+| [์๋ก์ด ๋ฐ์ดํฐ ์ธํธ์ ์ธ์ด๋ก DialoGPT ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) | ์์ ๋ํํ ์ฑ๋ด์ ๋ง๋ค๊ธฐ ์ํด ์๋ก์ด ๋ฐ์ดํฐ ์ธํธ๋ก DialoGPT ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Nathan Cooper](https://github.com/ncoop57) | [](https://colab.research.google.com/github/ncoop57/i-am-a-nerd/blob/master/_notebooks/2020-05-12-chatbot-part-1.ipynb) |
+| [Reformer๋ก ๊ธด ์ํ์ค ๋ชจ๋ธ๋งํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) | Reformer๋ก ์ต๋ 50๋ง ํ ํฐ์ ์ํ์ค๋ฅผ ํ๋ จํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/PyTorch_Reformer.ipynb) |
+| [์์ฝ์ ์ํด BART ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/ohmeow/ohmeow_website/blob/master/posts/2021-05-25-mbart-sequence-classification-with-blurr.ipynb) | blurr๋ฅผ ์ฌ์ฉํ์ฌ fastai๋ก ์์ฝํ๊ธฐ ์ํด BART๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Wayde Gilliam](https://ohmeow.com/) | [](https://colab.research.google.com/github/ohmeow/ohmeow_website/blob/master/posts/2021-05-25-mbart-sequence-classification-with-blurr.ipynb) |
+| [๋ค๋ฅธ ์ฌ๋์ ํธ์์ผ๋ก ์ฌ์ ํ๋ จ๋ ํธ๋์คํฌ๋จธ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) | GPT-2 ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ์ฌ ์ข์ํ๋ ํธ์ํฐ ๊ณ์ ์คํ์ผ๋ก ํธ์์ ์์ฑํ๋ ๋ฐฉ๋ฒ | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb) |
+| [Weights & Biases๋ก ๐ค Hugging Face ๋ชจ๋ธ ์ต์ ํํ๊ธฐ](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) | W&B์ Hugging Face์ ํตํฉ์ ๋ณด์ฌ์ฃผ๋ ์ ์ฒด ํํ ๋ฆฌ์ผ | [Boris Dayma](https://github.com/borisdayma) | [](https://colab.research.google.com/github/wandb/examples/blob/master/colabs/huggingface/Optimize_Hugging_Face_models_with_Weights_%26_Biases.ipynb) |
+| [Longformer ์ฌ์ ํ๋ จํ๊ธฐ](https://github.com/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) | ๊ธฐ์กด ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ "๊ธด" ๋ฒ์ ์ ๋น๋ํ๋ ๋ฐฉ๋ฒ | [Iz Beltagy](https://beltagy.net) | [](https://colab.research.google.com/github/allenai/longformer/blob/master/scripts/convert_model_to_long.ipynb) |
+| [QA๋ฅผ ์ํด Longformer ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) | QA ์์
์ ์ํด Longformer๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Suraj Patil](https://github.com/patil-suraj) | [](https://colab.research.google.com/github/patil-suraj/Notebooks/blob/master/longformer_qa_training.ipynb) |
+| [๐ค Nlp๋ก ๋ชจ๋ธ ํ๊ฐํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/How_to_evaluate_Longformer_on_TriviaQA_using_NLP.ipynb) | `Nlp`๋ก TriviaQA์์ Longformer๋ฅผ ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/drive/1m7eTGlPmLRgoPkkA7rkhQdZ9ydpmsdLE?usp=sharing) |
+| [๊ฐ์ ๋ฒ์ ์ถ์ถ์ ์ํด T5 ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) | ๊ฐ์ ๋ฒ์ ์ถ์ถ์ ์ํด ํ
์คํธ-ํ
์คํธ ํ์์ ์ฌ์ฉํ์ฌ PyTorch Lightning์ผ๋ก T5๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Lorenzo Ampil](https://github.com/enzoampil) | [](https://colab.research.google.com/github/enzoampil/t5-intro/blob/master/t5_qa_training_pytorch_span_extraction.ipynb) |
+| [๋ค์ค ํด๋์ค ๋ถ๋ฅ๋ฅผ ์ํด DistilBert ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb) | ๋ค์ค ํด๋์ค ๋ถ๋ฅ๋ฅผ ์ํด PyTorch๋ฅผ ์ฌ์ฉํ์ฌ DistilBert๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Abhishek Kumar Mishra](https://github.com/abhimishra91) | [](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb)|
+| [๋ค์ค ๋ ์ด๋ธ ๋ถ๋ฅ๋ฅผ ์ํด BERT ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb) | ๋ค์ค ๋ ์ด๋ธ ๋ถ๋ฅ๋ฅผ ์ํด PyTorch๋ฅผ ์ฌ์ฉํ์ฌ BERT๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Abhishek Kumar Mishra](https://github.com/abhimishra91) | [](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)|
+| [์์ฝ์ ์ํด T5 ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb) | ์์ฝ์ ์ํด PyTorch๋ก T5๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๊ณ WandB๋ก ์คํ์ ์ถ์ ํ๋ ๋ฐฉ๋ฒ | [Abhishek Kumar Mishra](https://github.com/abhimishra91) | [](https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_summarization_wandb.ipynb)|
+| [๋์ ํจ๋ฉ/๋ฒ์ผํ
์ผ๋ก Transformers ๋ฏธ์ธ ์กฐ์ ์๋ ๋์ด๊ธฐ](https://github.com/ELS-RD/transformers-notebook/blob/master/Divide_Hugging_Face_Transformers_training_time_by_2_or_more.ipynb)| ๋์ ํจ๋ฉ/๋ฒ์ผํ
์ ์ฌ์ฉํ์ฌ ๋ฏธ์ธ ์กฐ์ ์๋๋ฅผ 2๋ฐฐ๋ก ๋์ด๋ ๋ฐฉ๋ฒ |[Michael Benesty](https://github.com/pommedeterresautee) |[](https://colab.research.google.com/drive/1CBfRU1zbfu7-ijiOqAAQUA-RJaxfcJoO?usp=sharing)|
+|[๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง์ ์ํด Reformer ์ฌ์ ํ๋ จํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/Reformer_For_Masked_LM.ipynb)| ์๋ฐฉํฅ ์
ํ ์ดํ
์
๋ ์ด์ด๋ฅผ ์ด์ฉํด์ Reformer ๋ชจ๋ธ์ ํ๋ จํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/drive/1tzzh0i8PgDQGV3SMFUGxM7_gGae3K-uW?usp=sharing)|
+| [Sci-BERT ํ์ฅ ๋ฐ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/lordtt13/word-embeddings/blob/master/COVID-19%20Research%20Data/COVID-SciBERT.ipynb)| CORD ๋ฐ์ดํฐ ์ธํธ๋ก AllenAI์์ ์ฌ์ ํ๋ จ๋ SciBERT ๋ชจ๋ธ์ ์ดํ๋ฅผ ๋๋ฆฌ๊ณ ํ์ดํ๋ผ์ธ์ ๊ตฌ์ถํ๋ ๋ฐฉ๋ฒ | [Tanmay Thakur](https://github.com/lordtt13) | [](https://colab.research.google.com/drive/1rqAR40goxbAfez1xvF3hBJphSCsvXmh8)|
+| [์์ฝ์ ์ํด Trainer API๋ก BlenderBotSmall ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/lordtt13/transformers-experiments/blob/master/Custom%20Tasks/fine-tune-blenderbot_small-for-summarization.ipynb)| ์์ฝ์ ์ํด Trainer API๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์ ์ง์ ๋ฐ์ดํฐ ์ธํธ๋ก BlenderBotSmall ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ | [Tanmay Thakur](https://github.com/lordtt13) | [](https://colab.research.google.com/drive/19Wmupuls7mykSGyRN_Qo6lPQhgp56ymq?usp=sharing)|
+| [ํตํฉ ๊ธฐ์ธ๊ธฐ(Integrated Gradient)๋ฅผ ์ด์ฉํ์ฌ Electra ๋ฏธ์ธ ์กฐ์ ํ๊ณ ํด์ํ๊ธฐ](https://github.com/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb) | ๊ฐ์ ๋ถ์์ ์ํด Electra๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๊ณ Captum ํตํฉ ๊ธฐ์ธ๊ธฐ๋ก ์์ธก์ ํด์ํ๋ ๋ฐฉ๋ฒ | [Eliza Szczechla](https://elsanns.github.io) | [](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/electra_fine_tune_interpret_captum_ig.ipynb)|
+| [Trainer ํด๋์ค๋ก ๋น์์ด๊ถ GPT-2 ๋ชจ๋ธ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb) | Trainer ํด๋์ค๋ก ๋น์์ด๊ถ GPT-2 ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Philipp Schmid](https://www.philschmid.de) | [](https://colab.research.google.com/github/philschmid/fine-tune-GPT-2/blob/master/Fine_tune_a_non_English_GPT_2_Model_with_Huggingface.ipynb)|
+|[๋ค์ค ๋ผ๋ฒจ ๋ถ๋ฅ ์์
์ ์ํด DistilBERT ๋ชจ๋ธ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb) | ๋ค์ค ๋ผ๋ฒจ ๋ถ๋ฅ ์์
์ ์ํด DistilBERT ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Dhaval Taunk](https://github.com/DhavalTaunk08) | [](https://colab.research.google.com/github/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb)|
+|[๋ฌธ์ฅ์ ๋ถ๋ฅ๋ฅผ ์ํด ALBERT ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb) | ๋ฌธ์ฅ์ ๋ถ๋ฅ ์์
์ ์ํด ALBERT ๋ชจ๋ธ ๋๋ ๋ค๋ฅธ BERT ๊ธฐ๋ฐ ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Nadir El Manouzi](https://github.com/NadirEM) | [](https://colab.research.google.com/github/NadirEM/nlp-notebooks/blob/master/Fine_tune_ALBERT_sentence_pair_classification.ipynb)|
+|[๊ฐ์ ๋ถ์์ ์ํด Roberta ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb) | ๊ฐ์ ๋ถ์์ ์ํด Roberta ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Dhaval Taunk](https://github.com/DhavalTaunk08) | [](https://colab.research.google.com/github/DhavalTaunk08/NLP_scripts/blob/master/sentiment_analysis_using_roberta.ipynb)|
+|[์ง๋ฌธ ์์ฑ ๋ชจ๋ธ ํ๊ฐํ๊ธฐ](https://github.com/flexudy-pipe/qugeev) | seq2seq ํธ๋์คํฌ๋จธ ๋ชจ๋ธ์ด ์์ฑํ ์ง๋ฌธ๊ณผ ์ด์ ๋ํ ๋ต๋ณ์ด ์ผ๋ง๋ ์ ํํ๊ฐ์? | [Pascal Zoleko](https://github.com/zolekode) | [](https://colab.research.google.com/drive/1bpsSqCQU-iw_5nNoRm_crPq6FRuJthq_?usp=sharing)|
+|[DistilBERT์ Tensorflow๋ก ํ
์คํธ ๋ถ๋ฅํ๊ธฐ](https://github.com/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb) | ํ
์คํธ ๋ถ๋ฅ๋ฅผ ์ํด TensorFlow๋ก DistilBERT๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Peter Bayerle](https://github.com/peterbayerle) | [](https://colab.research.google.com/github/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb)|
+|[CNN/Dailail ์์ฝ์ ์ํด ์ธ์ฝ๋-๋์ฝ๋ ๋ชจ๋ธ์ BERT ํ์ฉํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb) | CNN/Dailail ์์ฝ์ ์ํด *google-bert/bert-base-uncased* ์ฒดํฌํฌ์ธํธ๋ฅผ ํ์ฉํ์ฌ *EncoderDecoderModel*์ ์๋ฐ์
ํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb)|
+|[BBC XSum ์์ฝ์ ์ํด ์ธ์ฝ๋-๋์ฝ๋ ๋ชจ๋ธ์ RoBERTa ํ์ฉํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb) | BBC/XSum ์์ฝ์ ์ํด *FacebookAI/roberta-base* ์ฒดํฌํฌ์ธํธ๋ฅผ ํ์ฉํ์ฌ ๊ณต์ *EncoderDecoderModel*์ ์๋ฐ์
ํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/RoBERTaShared_for_BBC_XSum.ipynb)|
+|[์์ฐจ์ ์ง๋ฌธ ๋ต๋ณ(SQA)์ ์ํด TAPAS ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb) | *tapas-base* ์ฒดํฌํฌ์ธํธ๋ฅผ ํ์ฉํ์ฌ ์์ฐจ์ ์ง๋ฌธ ๋ต๋ณ(SQA) ๋ฐ์ดํฐ ์ธํธ๋ก *TapasForQuestionAnswering*์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb)|
+|[ํ ์ฌ์ค ๊ฒ์ฌ(TabFact)๋ก TAPAS ํ๊ฐํ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb) | ๐ค Datasets์ ๐ค Transformer ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํจ๊ป ์ฌ์ฉํ์ฌ *tapas-base-finetuned-tabfact* ์ฒดํฌํฌ์ธํธ๋ก ๋ฏธ์ธ ์กฐ์ ๋ *TapasForSequenceClassification*์ ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Evaluating_TAPAS_on_the_Tabfact_test_set.ipynb)|
+|[๋ฒ์ญ์ ์ํด mBART ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb) | ํ๋์ด์์ ์์ด๋ก ๋ฒ์ญํ๊ธฐ ์ํด Seq2SeqTrainer๋ฅผ ์ฌ์ฉํ์ฌ mBART๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb)|
+|[FUNSD(์์ ์ดํด ๋ฐ์ดํฐ ์ธํธ)๋ก LayoutLM ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb) | ์ค์บํ ๋ฌธ์์์ ์ ๋ณด ์ถ์ถ์ ์ํด FUNSD ๋ฐ์ดํฐ ์ธํธ๋ก *LayoutLMForTokenClassification*์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForTokenClassification_on_FUNSD.ipynb)|
+|[DistilGPT2 ๋ฏธ์ธ ์กฐ์ ํ๊ณ ๋ฐ ํ
์คํธ ์์ฑํ๊ธฐ](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb) | DistilGPT2๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๊ณ ํ
์คํธ๋ฅผ ์์ฑํ๋ ๋ฐฉ๋ฒ | [Aakash Tripathi](https://github.com/tripathiaakash) | [](https://colab.research.google.com/github/tripathiaakash/DistilGPT2-Tutorial/blob/main/distilgpt2_fine_tuning.ipynb)|
+|[์ต๋ 8K ํ ํฐ์์ LED ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb) | ๊ธด ๋ฒ์๋ฅผ ์์ฝํ๊ธฐ ์ํด PubMed๋ก LED๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Fine_tune_Longformer_Encoder_Decoder_(LED)_for_Summarization_on_pubmed.ipynb)|
+|[Arxiv๋ก LED ํ๊ฐํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb) | ๊ธด ๋ฒ์ ์์ฝ์ ๋ํด LED๋ฅผ ํจ๊ณผ์ ์ผ๋ก ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/LED_on_Arxiv.ipynb)|
+|[RVL-CDIP(๋ฌธ์ ์ด๋ฏธ์ง ๋ถ๋ฅ ๋ฐ์ดํฐ ์ธํธ)๋ก LayoutLM ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ)](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb) | ์ค์บ ๋ฌธ์ ๋ถ๋ฅ๋ฅผ ์ํด RVL-CDIP ๋ฐ์ดํฐ ์ธํธ๋ก *LayoutLMForSequenceClassification*์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/nielsrogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/LayoutLM/Fine_tuning_LayoutLMForSequenceClassification_on_RVL_CDIP.ipynb)|
+|[GPT2 ์กฐ์ ์ ํตํ Wav2Vec2 CTC ๋์ฝ๋ฉ](https://github.com/voidful/huggingface_notebook/blob/main/xlsr_gpt.ipynb) | ์ธ์ด ๋ชจ๋ธ ์กฐ์ ์ ํตํด CTC ์ํ์ค๋ฅผ ๋์ฝ๋ฉํ๋ ๋ฐฉ๋ฒ | [Eric Lam](https://github.com/voidful) | [](https://colab.research.google.com/drive/1e_z5jQHYbO2YKEaUgzb1ww1WwiAyydAj?usp=sharing)|
+|[Trainer ํด๋์ค๋ก ๋ ๊ฐ ์ธ์ด๋ก ์์ฝํ๊ธฐ ์ํด BART ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb) | Trainer ํด๋์ค๋ก ๋ ๊ฐ ์ธ์ด๋ก ์์ฝํ๊ธฐ ์ํด BART ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Eliza Szczechla](https://github.com/elsanns) | [](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb)|
+|[Trivia QA๋ก Big Bird ํ๊ฐํ๊ธฐ](https://github.com/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb) | Trivia QA๋ก ๊ธด ๋ฌธ์ ์ง๋ฌธ์ ๋ํ ๋ต๋ณ์ ๋ํด BigBird๋ฅผ ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Patrick von Platen](https://github.com/patrickvonplaten) | [](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/Evaluating_Big_Bird_on_TriviaQA.ipynb)|
+| [Wav2Vec2๋ฅผ ์ฌ์ฉํ์ฌ ๋์์ ์บก์
๋ง๋ค๊ธฐ](https://github.com/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) | Wav2Vec์ผ๋ก ์ค๋์ค๋ฅผ ํ
์คํธ๋ก ๋ณํํ์ฌ ๋ชจ๋ ๋์์์์ YouTube ์บก์
๋ง๋๋ ๋ฐฉ๋ฒ | [Niklas Muennighoff](https://github.com/Muennighoff) |[](https://colab.research.google.com/github/Muennighoff/ytclipcc/blob/main/wav2vec_youtube_captions.ipynb) |
+| [PyTorch Lightning์ ์ฌ์ฉํ์ฌ CIFAR-10์ผ๋ก ๋น์ ํธ๋์คํฌ๋จธ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) | HuggingFace Transformers, Datasets, PyTorch Lightning์ ์ฌ์ฉํ์ฌ CIFAR-10์ผ๋ก ๋น์ ํธ๋์คํฌ๋จธ(ViT)๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_PyTorch_Lightning.ipynb) |
+| [๐ค Trainer๋ฅผ ์ฌ์ฉํ์ฌ CIFAR-10์์ ๋น์ ํธ๋์คํฌ๋จธ ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) | Datasets, ๐ค Trainer๋ฅผ ์ฌ์ฉํ์ฌ CIFAR-10์์ ๋น์ ํธ๋์คํฌ๋จธ(ViT)๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/nielsrogge) |[](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/VisionTransformer/Fine_tuning_the_Vision_Transformer_on_CIFAR_10_with_the_%F0%9F%A4%97_Trainer.ipynb) |
+| [๊ฐ์ฒด ์
๋ ฅ ๋ฐ์ดํฐ ์ธํธ์ธ Open Entity๋ก LUKE ํ๊ฐํ๊ธฐ](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) | Open Entity ๋ฐ์ดํฐ ์ธํธ๋ก *LukeForEntityClassification*์ ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_open_entity.ipynb) |
+| [๊ด๊ณ ์ถ์ถ ๋ฐ์ดํฐ ์ธํธ์ธ TACRED๋ก LUKE ํ๊ฐํ๊ธฐ](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) | TACRED ๋ฐ์ดํฐ ์ธํธ๋ก *LukeForEntityPairClassification*์ ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_tacred.ipynb) |
+| [์ค์ NER ๋ฒค์น๋งํฌ์ธ CoNLL-2003์ผ๋ก LUKE ํ๊ฐํ๊ธฐ](https://github.com/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) | CoNLL-2003 ๋ฐ์ดํฐ ์ธํธ๋ก *LukeForEntitySpanClassification*๋ฅผ ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Ikuya Yamada](https://github.com/ikuyamada) |[](https://colab.research.google.com/github/studio-ousia/luke/blob/master/notebooks/huggingface_conll_2003.ipynb) |
+| [PubMed ๋ฐ์ดํฐ ์ธํธ๋ก BigBird-Pegasus ํ๊ฐํ๊ธฐ](https://github.com/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) | PubMed ๋ฐ์ดํฐ ์ธํธ๋ก *BigBirdPegasusForConditionalGeneration*๋ฅผ ํ๊ฐํ๋ ๋ฐฉ๋ฒ | [Vasudev Gupta](https://github.com/vasudevgupta7) | [](https://colab.research.google.com/github/vasudevgupta7/bigbird/blob/main/notebooks/bigbird_pegasus_evaluation.ipynb) |
+| [Wav2Vec2๋ฅผ ์ฌ์ฉํด์ ์์ฑ ๊ฐ์ ๋ถ๋ฅํ๊ธฐ](https://github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) | ๊ฐ์ ๋ถ๋ฅ๋ฅผ ์ํด ์ฌ์ ํ๋ จ๋ Wav2Vec2 ๋ชจ๋ธ์ MEGA ๋ฐ์ดํฐ ์ธํธ์ ํ์ฉํ๋ ๋ฐฉ๋ฒ | [Mehrdad Farahani](https://github.com/m3hrdadfi) | [](https://colab.research.google.com/github/m3hrdadfi/soxan/blob/main/notebooks/Emotion_recognition_in_Greek_speech_using_Wav2Vec2.ipynb) |
+| [DETR๋ก ์ด๋ฏธ์ง์์ ๊ฐ์ฒด ํ์งํ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) | ํ๋ จ๋ *DetrForObjectDetection* ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง์์ ๊ฐ์ฒด๋ฅผ ํ์งํ๊ณ ์ดํ
์
์ ์๊ฐํํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/DETR_minimal_example_(with_DetrFeatureExtractor).ipynb) |
+| [์ฌ์ฉ์ ์ง์ ๊ฐ์ฒด ํ์ง ๋ฐ์ดํฐ ์ธํธ๋ก DETR ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) | ์ฌ์ฉ์ ์ง์ ๊ฐ์ฒด ํ์ง ๋ฐ์ดํฐ ์ธํธ๋ก *DetrForObjectDetection*์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Niels Rogge](https://github.com/NielsRogge) | [](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/DETR/Fine_tuning_DetrForObjectDetection_on_custom_dataset_(balloon).ipynb) |
+| [๊ฐ์ฒด๋ช
์ธ์์ ์ํด T5 ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://github.com/ToluClassics/Notebooks/blob/main/T5_Ner_Finetuning.ipynb) | ๊ฐ์ฒด๋ช
์ธ์ ์์
์ ์ํด *T5*๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ | [Ogundepo Odunayo](https://github.com/ToluClassics) | [](https://colab.research.google.com/drive/1obr78FY_cBmWY5ODViCmzdY6O1KB65Vc?usp=sharing) |
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/contributing.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/contributing.md
new file mode 100644
index 0000000000000000000000000000000000000000..99f1d2b66647285d9f2517949be149da2c1ae931
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/contributing.md
@@ -0,0 +1,332 @@
+
+
+# ๐ค Transformers์ ๊ธฐ์ฌํ๊ธฐ [[contribute-to-transformers]]
+
+๋๊ตฌ๋ ๐ค Transformers์ ๊ธฐ์ฌํ ์ ์์ผ๋ฉฐ, ์ฐ๋ฆฌ๋ ๋ชจ๋ ์ฌ๋์ ๊ธฐ์ฌ๋ฅผ ์์คํ ์๊ฐํฉ๋๋ค. ์ฝ๋ ๊ธฐ์ฌ๋ ์ปค๋ฎค๋ํฐ๋ฅผ ๋๋ ์ ์ผํ ๋ฐฉ๋ฒ์ด ์๋๋๋ค. ์ง๋ฌธ์ ๋ตํ๊ฑฐ๋ ๋ค๋ฅธ ์ฌ๋์ ๋์ ๋ฌธ์๋ฅผ ๊ฐ์ ํ๋ ๊ฒ๋ ๋งค์ฐ ๊ฐ์น๊ฐ ์์ต๋๋ค.
+
+๐ค Transformers๋ฅผ ๋๋ฆฌ ์๋ฆฌ๋ ๊ฒ๋ ํฐ ๋์์ด ๋ฉ๋๋ค! ๋ฉ์ง ํ๋ก์ ํธ๋ค์ ๊ฐ๋ฅํ๊ฒ ํ ๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ํด ๋ธ๋ก๊ทธ ๊ฒ์๊ธ์ ์ธ๊ธํ๊ฑฐ๋, ๋์์ด ๋์์ ๋๋ง๋ค Twitter์ ์๋ฆฌ๊ฑฐ๋, ์ ์ฅ์์ โญ๏ธ ๋ฅผ ํ์ํ์ฌ ๊ฐ์ฌ ์ธ์ฌ๋ฅผ ์ ํด์ฃผ์ธ์.
+
+์ด๋ค ๋ฐฉ์์ผ๋ก ๊ธฐ์ฌํ๋ [ํ๋ ๊ท์น](https://github.com/huggingface/transformers/blob/main/CODE_OF_CONDUCT.md)์ ์์งํ๊ณ ์กด์คํด์ฃผ์ธ์.
+
+**์ด ์๋ด์๋ ๋ฉ์ง [scikit-learn ๊ธฐ์ฌ ์๋ด์](https://github.com/scikit-learn/scikit-learn/blob/main/CONTRIBUTING.md)์์ ํฐ ์๊ฐ์ ๋ฐ์์ต๋๋ค.**
+
+## ๊ธฐ์ฌํ๋ ๋ฐฉ๋ฒ [[ways-to-contribute]]
+
+์ฌ๋ฌ ๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก ๐ค Transformers์ ๊ธฐ์ฌํ ์ ์์ต๋๋ค:
+
+* ๊ธฐ์กด ์ฝ๋์ ๋ฏธํด๊ฒฐ๋ ๋ฌธ์ ๋ฅผ ์์ ํฉ๋๋ค.
+* ๋ฒ๊ทธ ๋๋ ์๋ก ์ถ๊ฐ๋๊ธธ ์ํ๋ ๊ธฐ๋ฅ๊ณผ ๊ด๋ จ๋ ์ด์๋ฅผ ์ ์ถํฉ๋๋ค.
+* ์๋ก์ด ๋ชจ๋ธ์ ๊ตฌํํฉ๋๋ค.
+* ์์ ๋ ๋ฌธ์์ ๊ธฐ์ฌํฉ๋๋ค.
+
+์ด๋์๋ถํฐ ์์ํ ์ง ๋ชจ๋ฅด๊ฒ ๋ค๋ฉด, [Good First Issue](https://github.com/huggingface/transformers/contribute) ๋ชฉ๋ก์ ํ์ธํด๋ณด์ธ์. ์ด ๋ชฉ๋ก์ ์ด๋ณด์๋ ์ฐธ์ฌํ๊ธฐ ์ฌ์ด ์คํ ์ด์ ๋ชฉ๋ก์ ์ ๊ณตํ๋ฉฐ, ๋น์ ์ด ์คํ์์ค์ ์ฒ์์ผ๋ก ๊ธฐ์ฌํ๋ ๋ฐ ํฐ ๋์์ด ๋ ๊ฒ์
๋๋ค. ๊ทธ์ ์์
ํ๊ณ ์ถ์ ์ด์์ ๋๊ธ๋ง ๋ฌ์์ฃผ๋ฉด ๋ฉ๋๋ค.
+
+์กฐ๊ธ ๋ ๋์ ์ ์ธ ์์
์ ์ํ๋ค๋ฉด, [Good Second Issue](https://github.com/huggingface/transformers/labels/Good%20Second%20Issue) ๋ชฉ๋ก๋ ํ์ธํด๋ณด์ธ์. ์ด๋ฏธ ๋น์ ์ด ์ ํ๊ณ ์๋ค๊ณ ์๊ฐ๋๋๋ผ๋, ํ ๋ฒ ์๋ํด๋ณด์ธ์! ์ฐ๋ฆฌ๋ ์ฌ๋ฌ๋ถ์ ๋์ธ ๊ฒ์
๋๋ค. ๐
+
+> ์ปค๋ฎค๋ํฐ์ ์ด๋ฃจ์ด์ง๋ ๋ชจ๋ ๊ธฐ์ฌ๋ ๋๊ฐ์ด ์์คํฉ๋๋ค. ๐ฅฐ
+
+## ๋ฏธํด๊ฒฐ๋ ๋ฌธ์ ์์ ํ๊ธฐ [[fixing-outstanding-issues]]
+
+๊ธฐ์กด ์ฝ๋์์ ๋ฐ๊ฒฌํ ๋ฌธ์ ์ ์ ๋ํ ํด๊ฒฐ์ฑ
์ด ๋ ์ค๋ฅธ ๊ฒฝ์ฐ, ์ธ์ ๋ ์ง [๊ธฐ์ฌ๋ฅผ ์์](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md/#create-a-pull-request)ํ๊ณ Pull Request๋ฅผ ์์ฑํด์ฃผ์ธ์!
+
+## ๋ฒ๊ทธ ๊ด๋ จ ์ด์๋ฅผ ์ ๊ธฐํ๊ฑฐ๋ ์๋ก์ด ๊ธฐ๋ฅ ์์ฒญํ๊ธฐ [[submitting-a-bugrelated-issue-or-feature-request]]
+
+๋ฒ๊ทธ ๊ด๋ จ ์ด์๋ฅผ ์ ๊ธฐํ๊ฑฐ๋ ์๋ก์ด ๊ธฐ๋ฅ์ ์์ฒญํ ๋๋ ๋ค์ ๊ฐ์ด๋๋ผ์ธ์ ์ต๋ํ ์ค์ํด์ฃผ์ธ์. ์ด๋ ๊ฒ ํ๋ฉด ์ข์ ํผ๋๋ฐฑ๊ณผ ํจ๊ป ๋น ๋ฅด๊ฒ ๋ต๋ณํด ๋๋ฆด ์ ์์ต๋๋ค.
+
+### ๋ฒ๊ทธ๋ฅผ ๋ฐ๊ฒฌํ์
จ๋์? [[did-you-find-a-bug]]
+
+๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ์ฌ์ฉ ์ค์ ๊ฒช๋ ๋ฌธ์ ๋ฅผ ๋ณด๊ณ ํด์ฃผ๋ ์ฌ์ฉ์๋ค ๋๋ถ์ ๋์ฑ ๊ฒฌ๊ณ ํด์ง๊ณ ์ ๋ขฐํ ์ ์๊ฒ ๋์์ต๋๋ค.
+
+์ด์๋ฅผ ๋ณด๊ณ ํ๊ธฐ ์ ์, ๋ฒ๊ทธ๊ฐ ์ด๋ฏธ **๋ณด๊ณ ๋์ง ์์๋์ง** ํ์ธํด์ฃผ์ธ์. (GitHub์ ์ด์ ํญ ์๋์ ๊ฒ์ ๋ฐ๋ฅผ ์ฌ์ฉํ์ธ์). ์ด์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์์ฒด์์ ๋ฐ์ํ ๋ฒ๊ทธ์ด์ผ ํ๋ฉฐ, ์ฝ๋์ ๋ค๋ฅธ ๋ถ๋ถ๊ณผ ๊ด๋ จ๋ ๊ฒ์ด ์๋์ด์ผ ํฉ๋๋ค. ๋ฒ๊ทธ๊ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ฌธ์ ๋ก ๋ฐ์ํ์๋์ง ํ์คํ์ง ์์ ๊ฒฝ์ฐ ๋จผ์ [ํฌ๋ผ](https://discuss.huggingface.co/)์์ ์ง๋ฌธํด ์ฃผ์ธ์. ์ด๋ ๊ฒ ํ๋ฉด ์ผ๋ฐ์ ์ธ ์ง๋ฌธ๋ณด๋ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ด๋ จ๋ ๋ฌธ์ ๋ฅผ ๋ ๋น ๋ฅด๊ฒ ํด๊ฒฐํ ์ ์์ต๋๋ค.
+
+๋ฒ๊ทธ๊ฐ ์ด๋ฏธ ๋ณด๊ณ ๋์ง ์์๋ค๋ ๊ฒ์ ํ์ธํ๋ค๋ฉด, ๋ค์ ์ ๋ณด๋ฅผ ํฌํจํ์ฌ ์ด์๋ฅผ ์ ์ถํด ์ฃผ์ธ์. ๊ทธ๋ฌ๋ฉด ์ฐ๋ฆฌ๊ฐ ๋น ๋ฅด๊ฒ ํด๊ฒฐํ ์ ์์ต๋๋ค:
+
+* ์ฌ์ฉ ์ค์ธ **์ด์์ฒด์ ์ข
๋ฅ์ ๋ฒ์ **, ๊ทธ๋ฆฌ๊ณ **Python**, **PyTorch** ๋๋ **TensorFlow** ๋ฒ์ .
+* ๋ฒ๊ทธ๋ฅผ 30์ด ์ด๋ด๋ก ์ฌํํ ์ ์๋ ๊ฐ๋จํ๊ณ ๋
๋ฆฝ์ ์ธ ์ฝ๋ ์ค๋ํซ.
+* ์์ธ๊ฐ ๋ฐ์ํ ๊ฒฝ์ฐ *์ ์ฒด* ํธ๋ ์ด์ค๋ฐฑ.
+* ์คํฌ๋ฆฐ์ท๊ณผ ๊ฐ์ด ๋์์ด ๋ ๊ฒ์ผ๋ก ์๊ฐ๋๋ ์ถ๊ฐ ์ ๋ณด๋ฅผ ์ฒจ๋ถํด ์ฃผ์ธ์.
+
+์ด์์ฒด์ ์ ์ํํธ์จ์ด ๋ฒ์ ์ ์๋์ผ๋ก ๊ฐ์ ธ์ค๋ ค๋ฉด ๋ค์ ๋ช
๋ น์ ์คํํ์ธ์:
+
+```bash
+transformers-cli env
+```
+
+์ ์ฅ์์ ๋ฃจํธ ๋๋ ํฐ๋ฆฌ์์๋ ๊ฐ์ ๋ช
๋ น์ ์คํํ ์ ์์ต๋๋ค:
+
+```bash
+python src/transformers/commands/transformers_cli.py env
+```
+
+
+### ์๋ก์ด ๊ธฐ๋ฅ์ ์ํ์๋์? [[do-you-want-a-new-feature]]
+
+๐ค Transformers์์ ์ฌ์ฉํ๊ณ ์ถ์ ์๋ก์ด ๊ธฐ๋ฅ์ด ์๋ค๋ฉด, ๋ค์ ๋ด์ฉ์ ํฌํจํ์ฌ ์ด์๋ฅผ ์ ์ถํด ์ฃผ์ธ์:
+
+1. ์ด ๊ธฐ๋ฅ์ด ํ์ํ *์ด์ *๋ ๋ฌด์์ธ๊ฐ์? ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ํ ๋ฌธ์ ๋ ๋ถ๋ง๊ณผ ๊ด๋ จ์ด ์๋์? ํ๋ก์ ํธ์ ํ์ํ ๊ธฐ๋ฅ์ธ๊ฐ์? ์ปค๋ฎค๋ํฐ์ ๋์์ด ๋ ๋งํ ๊ธฐ๋ฅ์ธ๊ฐ์?
+
+ ์ด๋ค ๋ด์ฉ์ด๋ ์ฌ๋ฌ๋ถ์ ์ด์ผ๊ธฐ๋ฅผ ๋ฃ๊ณ ์ถ์ต๋๋ค!
+
+2. ์์ฒญํ๋ ๊ธฐ๋ฅ์ ์ต๋ํ ์์ธํ ์ค๋ช
ํด ์ฃผ์ธ์. ๋ ๋ง์ ์ ๋ณด๋ฅผ ์ ๊ณตํ ์๋ก ๋ ๋์ ๋์์ ๋๋ฆด ์ ์์ต๋๋ค.
+3. ํด๋น ๊ธฐ๋ฅ์ ์ฌ์ฉ๋ฒ์ ๋ณด์ฌ์ฃผ๋ *์ฝ๋ ์ค๋ํซ*์ ์ ๊ณตํด ์ฃผ์ธ์.
+4. ๊ธฐ๋ฅ๊ณผ ๊ด๋ จ๋ ๋
ผ๋ฌธ์ด ์๋ ๊ฒฝ์ฐ ๋งํฌ๋ฅผ ํฌํจํด ์ฃผ์ธ์.
+
+์ด์๊ฐ ์ ์์ฑ๋์๋ค๋ฉด ์ด์๊ฐ ์์ฑ๋ ์๊ฐ, ์ด๋ฏธ 80% ์ ๋์ ์์
์ด ์๋ฃ๋ ๊ฒ์
๋๋ค.
+
+์ด์๋ฅผ ์ ๊ธฐํ๋ ๋ฐ ๋์์ด ๋ ๋งํ [ํ
ํ๋ฆฟ](https://github.com/huggingface/transformers/tree/main/templates)๋ ์ค๋น๋์ด ์์ต๋๋ค.
+
+## ์๋ก์ด ๋ชจ๋ธ์ ๊ตฌํํ๊ณ ์ถ์ผ์ ๊ฐ์? [[do-you-want-to-implement-a-new-model]]
+
+์๋ก์ด ๋ชจ๋ธ์ ๊ณ์ํด์ ์ถ์๋ฉ๋๋ค. ๋ง์ฝ ์ฌ๋ฌ๋ถ์ด ์๋ก์ด ๋ชจ๋ธ์ ๊ตฌํํ๊ณ ์ถ๋ค๋ฉด ๋ค์ ์ ๋ณด๋ฅผ ์ ๊ณตํด ์ฃผ์ธ์:
+
+* ๋ชจ๋ธ์ ๋ํ ๊ฐ๋จํ ์ค๋ช
๊ณผ ๋
ผ๋ฌธ ๋งํฌ.
+* ๊ตฌํ์ด ๊ณต๊ฐ๋์ด ์๋ค๋ฉด ๊ตฌํ ๋งํฌ.
+* ๋ชจ๋ธ ๊ฐ์ค์น๊ฐ ์ฌ์ฉ ๊ฐ๋ฅํ๋ค๋ฉด ๊ฐ์ค์น ๋งํฌ.
+
+๋ง์ฝ ๋ชจ๋ธ์ ์ง์ ๊ธฐ์ฌํ๊ณ ์ถ์ผ์๋ค๋ฉด, ์๋ ค์ฃผ์ธ์. ๐ค Transformers์ ์ถ๊ฐํ ์ ์๋๋ก ๋์๋๋ฆฌ๊ฒ ์ต๋๋ค!
+
+[๐ค Transformers์ ์๋ก์ด ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ๋ฐฉ๋ฒ](https://huggingface.co/docs/transformers/add_new_model)์ ๋ํ ๊ธฐ์ ์ ์ธ ์๋ด์๋ ์์ต๋๋ค.
+
+## ๋ฌธ์๋ฅผ ์ถ๊ฐํ๊ณ ์ถ์ผ์ ๊ฐ์? [[do-you-want-to-add-documentation]]
+
+์ฐ๋ฆฌ๋ ์ธ์ ๋ ๋ ๋ช
ํํ๊ณ ์ ํํ ๋ฌธ์๋ฅผ ์ ๊ณตํ๊ธฐ ์ํ์ฌ ๊ฐ์ ์ ์ ์ฐพ๊ณ ์์ต๋๋ค. ์คํ์๋ ๋ถ์กฑํ ๋ด์ฉ, ๋ถ๋ช
ํ์ง ์๊ฑฐ๋ ๋ถ์ ํํ ๋ด์ฉ ๋ฑ์ ์๋ ค์ฃผ์๋ฉด ๊ฐ์ ํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค. ๊ด์ฌ์ด ์์ผ์๋ค๋ฉด ๋ณ๊ฒฝํ๊ฑฐ๋ ๊ธฐ์ฌํ์ค ์ ์๋๋ก ๋์๋๋ฆฌ๊ฒ ์ต๋๋ค!
+
+๋ฌธ์๋ฅผ ์์ฑ, ๋น๋ ๋ฐ ์์ฑํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ๋ด์ฉ์ [README](https://github.com/huggingface/transformers/tree/main/docs) ๋ฌธ์๋ฅผ ํ์ธํด ์ฃผ์ธ์.
+
+## ํ ๋ฆฌํ์คํธ(Pull Request) ์์ฑํ๊ธฐ [[create-a-pull-request]]
+
+์ฝ๋๋ฅผ ์์ฑํ๊ธฐ ์ ์ ๊ธฐ์กด์ Pull Request๋ ์ด์๋ฅผ ๊ฒ์ํ์ฌ ๋๊ตฐ๊ฐ ์ด๋ฏธ ๋์ผํ ์์
์ ํ๊ณ ์๋์ง ํ์ธํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ํ์คํ์ง ์๋ค๋ฉด ํผ๋๋ฐฑ์ ๋ฐ๊ธฐ ์ํด ์ด์๋ฅผ ์ด์ด๋ณด๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+๐ค Transformers์ ๊ธฐ์ฌํ๊ธฐ ์ํด์๋ ๊ธฐ๋ณธ์ ์ธ `git` ์ฌ์ฉ ๋ฅ๋ ฅ์ด ํ์ํฉ๋๋ค. `git`์ ์ฌ์ฉํ๊ธฐ ์ฌ์ด ๋๊ตฌ๋ ์๋์ง๋ง, ๋งค์ฐ ํ๋ฅญํ ๋งค๋ด์ผ์ ์ ๊ณตํฉ๋๋ค. ์(shell)์์ `git --help`์ ์
๋ ฅํ์ฌ ํ์ธํด๋ณด์ธ์! ๋ง์ฝ ์ฑ
์ ์ ํธํ๋ค๋ฉด, [Pro Git](https://git-scm.com/book/en/v2)์ ๋งค์ฐ ์ข์ ์ฐธ๊ณ ์๋ฃ๊ฐ ๋ ๊ฒ์
๋๋ค.
+
+๐ค Transformers์ ๊ธฐ์ฌํ๋ ค๋ฉด **[Python 3.9](https://github.com/huggingface/transformers/blob/main/setup.py#L426)** ์ด์์ ๋ฒ์ ์ด ํ์ํฉ๋๋ค. ๊ธฐ์ฌ๋ฅผ ์์ํ๋ ค๋ฉด ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ฅด์ธ์:
+
+1. ์ ์ฅ์ ํ์ด์ง์์ **[Fork](https://github.com/huggingface/transformers/fork)** ๋ฒํผ์ ํด๋ฆญํ์ฌ ์ ์ฅ์๋ฅผ ํฌํฌํ์ธ์. ์ด๋ ๊ฒ ํ๋ฉด ์ฝ๋์ ๋ณต์ฌ๋ณธ์ด ์ฌ๋ฌ๋ถ์ GitHub ์ฌ์ฉ์ ๊ณ์ ์๋์ ์์ฑ๋ฉ๋๋ค.
+
+2. ํฌํฌํ ์ ์ฅ์๋ฅผ ๋ก์ปฌ ๋์คํฌ๋ก ํด๋ก ํ๊ณ , ๊ธฐ๋ณธ ์ ์ฅ์๋ฅผ ์๊ฒฉ(remote)์ผ๋ก ์ถ๊ฐํ์ธ์:
+
+ ```bash
+ git clone git@github.com:/transformers.git
+ cd transformers
+ git remote add upstream https://github.com/huggingface/transformers.git
+ ```
+
+3. ๊ฐ๋ฐ ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฅํ ์ ๋ธ๋์น๋ฅผ ์์ฑํ์ธ์:
+
+ ```bash
+ git checkout -b a-descriptive-name-for-my-changes
+ ```
+
+ ๐จ ์ ๋ `main` ๋ธ๋์น์์ ์์
ํ์ง **๋ง์ธ์!**
+
+4. ๊ฐ์ ํ๊ฒฝ์์ ๋ค์ ๋ช
๋ น์ ์คํํ์ฌ ๊ฐ๋ฐ ํ๊ฒฝ์ ์ค์ ํ์ธ์:
+
+ ```bash
+ pip install -e ".[dev]"
+ ```
+
+ ๋ง์ฝ ์ด๋ฏธ ๊ฐ์ ํ๊ฒฝ์ ๐ค Transformers๊ฐ ์ค์น๋์ด ์๋ค๋ฉด, `-e` ํ๋๊ทธ๋ฅผ ์ฌ์ฉํ์ฌ ์ค์นํ๊ธฐ ์ ์ `pip uninstall transformers`๋ก ์ ๊ฑฐํด์ฃผ์ธ์.
+
+ ์ฌ๋ฌ๋ถ์ ์ด์์ฒด์ ์ ๋ฐ๋ผ์, ๊ทธ๋ฆฌ๊ณ ๐ค Transformers์ ์ ํ์ ์์กด์ฑ์ ์๊ฐ ์ฆ๊ฐํ๋ฉด์, ์ด ๋ช
๋ น์ด ์คํจํ ์๋ ์์ต๋๋ค. ๊ทธ๋ด ๊ฒฝ์ฐ ์ฌ์ฉํ๋ ค๋ ๋ฅ๋ฌ๋ ํ๋ ์์ํฌ(PyTorch, TensorFlow, ๊ทธ๋ฆฌ๊ณ /๋๋ Flax)๋ฅผ ์ค์นํ ํ ์๋ ๋ช
๋ น์ ์คํํด์ฃผ์ธ์:
+
+ ```bash
+ pip install -e ".[quality]"
+ ```
+
+ ๋๋ถ๋ถ์ ๊ฒฝ์ฐ ์ด๊ฒ์ผ๋ก ์ถฉ๋ถํ ๊ฒ์
๋๋ค.
+
+5. ๋ธ๋์น์์ ๊ธฐ๋ฅ์ ๊ฐ๋ฐํ์ธ์.
+
+ ์ฝ๋๋ฅผ ์์
ํ๋ ๋์ ํ
์คํธ ์ค์ํธ(test suite)๊ฐ ํต๊ณผํ๋์ง ํ์ธํ์ธ์. ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝ ์ฌํญ์ ์ํฅ์ ๋ฐ๋ ํ
์คํธ๋ฅผ ์คํํ์ธ์:
+
+ ```bash
+ pytest tests/.py
+ ```
+
+ ํ
์คํธ์ ๋ํ ๋ ๋ง์ ์ ๋ณด๋ [ํ
์คํธ](https://huggingface.co/docs/transformers/testing) ๊ฐ์ด๋๋ฅผ ํ์ธํ์ธ์.
+
+ ๐ค Transformers๋ `black`๊ณผ `ruff`๋ฅผ ์ฌ์ฉํ์ฌ ์์ค ์ฝ๋์ ํ์์ ์ผ๊ด๋๊ฒ ์ ์งํฉ๋๋ค. ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ฉํ ํ์๋ ๋ค์ ๋ช
๋ น์ผ๋ก ์๋์ผ๋ก ์คํ์ผ ๊ต์ ๋ฐ ์ฝ๋ ๊ฒ์ฆ์ ์ํํ์ธ์:
+
+ ```bash
+ make fixup
+ ```
+
+ ์ด๊ฒ์ ๋ํ ์์
์ค์ธ PR์์ ์์ ํ ํ์ผ์์๋ง ์๋ํ๋๋ก ์ต์ ํ๋์ด ์์ต๋๋ค.
+
+ ๊ฒ์ฌ๋ฅผ ํ๋์ฉ ์คํํ๋ ค๋ ๊ฒฝ์ฐ, ๋ค์ ๋ช
๋ น์ผ๋ก ์คํ์ผ ๊ต์ ์ ์ ์ฉํ ์ ์์ต๋๋ค:
+
+ ```bash
+ make style
+ ```
+
+ ๐ค Transformers๋ ๋ํ `ruff`์ ๋ช ๊ฐ์ง ์ฌ์ฉ์ ์ ์ ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ ์ฝ๋ฉ ์ค์๋ฅผ ํ์ธํฉ๋๋ค. CI๋ฅผ ํตํด ํ์ง ๊ด๋ฆฌ๊ฐ ์ํ๋์ง๋ง, ๋ค์ ๋ช
๋ น์ผ๋ก ๋์ผํ ๊ฒ์ฌ๋ฅผ ์คํํ ์ ์์ต๋๋ค:
+
+ ```bash
+ make quality
+ ```
+
+ ๋ง์ง๋ง์ผ๋ก, ์ ๋ชจ๋ธ์ ์ถ๊ฐํ ๋ ์ผ๋ถ ํ์ผ์ ์
๋ฐ์ดํธํ๋ ๊ฒ์ ์์ง ์๋๋ก ํ๊ธฐ ์ํ ๋ง์ ์คํฌ๋ฆฝํธ๊ฐ ์์ต๋๋ค. ๋ค์ ๋ช
๋ น์ผ๋ก ์ด๋ฌํ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ ์ ์์ต๋๋ค:
+
+ ```bash
+ make repo-consistency
+ ```
+
+ ์ด๋ฌํ ๊ฒ์ฌ์ ๋ํด ์์ธํ ์์๋ณด๊ณ ๊ด๋ จ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฐฉ๋ฒ์ [Pull Request์ ๋ํ ๊ฒ์ฌ](https://huggingface.co/docs/transformers/pr_checks) ๊ฐ์ด๋๋ฅผ ํ์ธํ์ธ์.
+
+ ๋ง์ฝ `docs/source` ๋๋ ํฐ๋ฆฌ ์๋์ ๋ฌธ์๋ฅผ ์์ ํ๋ ๊ฒฝ์ฐ, ๋ฌธ์๊ฐ ๋น๋๋ ์ ์๋์ง ํ์ธํ์ธ์. ์ด ๊ฒ์ฌ๋ Pull Request๋ฅผ ์ด ๋๋ CI์์ ์คํ๋ฉ๋๋ค. ๋ก์ปฌ ๊ฒ์ฌ๋ฅผ ์คํํ๋ ค๋ฉด ๋ฌธ์ ๋น๋๋ฅผ ์ค์นํด์ผ ํฉ๋๋ค:
+
+ ```bash
+ pip install ".[docs]"
+ ```
+
+ ์ ์ฅ์์ ๋ฃจํธ ๋๋ ํฐ๋ฆฌ์์ ๋ค์ ๋ช
๋ น์ ์คํํ์ธ์:
+
+ ```bash
+ doc-builder build transformers docs/source/en --build_dir ~/tmp/test-build
+ ```
+
+ ์ด ๋ช
๋ น์ `~/tmp/test-build` ํด๋์ ๋ฌธ์๋ฅผ ๋น๋ํ๋ฉฐ, ์์ฑ๋ Markdown ํ์ผ์ ์ ํธํ๋ ํธ์ง๊ธฐ๋ก ํ์ธํ ์ ์์ต๋๋ค. Pull Request๋ฅผ ์ด ๋ GitHub์์ ๋ฌธ์๋ฅผ ๋ฏธ๋ฆฌ ๋ณผ ์๋ ์์ต๋๋ค.
+
+ ๋ณ๊ฒฝ ์ฌํญ์ ๋ง์กฑํ๋ฉด `git add`๋ก ๋ณ๊ฒฝ๋ ํ์ผ์ ์ถ๊ฐํ๊ณ , `git commit`์ผ๋ก ๋ณ๊ฒฝ ์ฌํญ์ ๋ก์ปฌ์ ๊ธฐ๋กํ์ธ์:
+
+ ```bash
+ git add modified_file.py
+ git commit
+ ```
+
+ [์ข์ ์ปค๋ฐ ๋ฉ์์ง](https://chris.beams.io/posts/git-commit/)๋ฅผ ์์ฑํ์ฌ ๋ณ๊ฒฝ ์ฌํญ์ ๋ช
ํํ๊ฒ ์ ๋ฌํ์ธ์!
+
+ ๋ณ๊ฒฝ ์ฌํญ์ ํ๋ก์ ํธ ์๋ณธ ์ ์ฅ์์ ๋๊ธฐํํ๋ ค๋ฉด, PR์ *์ด๊ธฐ ์ ์* ๋ธ๋์น๋ฅผ `upstream/branch`๋ก ๋ฆฌ๋ฒ ์ด์ค(rebase)ํ์ธ์. ๋๋ ๊ด๋ฆฌ์์ ์์ฒญ์ ์ด ์์
์ด ํ์ํ ์ ์์ต๋๋ค:
+
+ ```bash
+ git fetch upstream
+ git rebase upstream/main
+ ```
+
+ ๋ณ๊ฒฝ ์ฌํญ์ ๋ธ๋์น์ ํธ์ํ์ธ์:
+
+ ```bash
+ git push -u origin a-descriptive-name-for-my-changes
+ ```
+
+ ์ด๋ฏธ PR์ ์ด์๋ค๋ฉด, `--force` ํ๋๊ทธ์ ํจ๊ป ๊ฐ์ ํธ์ํด์ผ ํฉ๋๋ค. ์์ง PR์ด ์ด๋ฆฌ์ง ์์๋ค๋ฉด ์ ์์ ์ผ๋ก ๋ณ๊ฒฝ ์ฌํญ์ ํธ์ํ๋ฉด ๋ฉ๋๋ค.
+
+6. ์ด์ GitHub์์ ํฌํฌํ ์ ์ฅ์๋ก ์ด๋ํ๊ณ **Pull request(ํ ๋ฆฌํ์คํธ)**๋ฅผ ํด๋ฆญํ์ฌ Pull Request๋ฅผ ์ด ์ ์์ต๋๋ค. ์๋์ [์ฒดํฌ๋ฆฌ์คํธ](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md/#pull-request-checklist)์์ ๋ชจ๋ ํญ๋ชฉ์ ์ฒดํฌ ํ์๋ฅผ ํ์ธ์. ์ค๋น๊ฐ ์๋ฃ๋๋ฉด ํ๋ก์ ํธ ๊ด๋ฆฌ์์๊ฒ ๋ณ๊ฒฝ ์ฌํญ์ ๋ณด๋ด ๊ฒํ ๋ฅผ ์์ฒญํ ์ ์์ต๋๋ค.
+
+7. ๊ด๋ฆฌ์๊ฐ ๋ณ๊ฒฝ ์ฌํญ์ ์์ฒญํด๋ ๊ด์ฐฎ์ต๋๋ค. ํต์ฌ ๊ธฐ์ฌ์๋ค๋ ๋์ผํ ์ํฉ์ ๊ฒช์ต๋๋ค! ๋ชจ๋๊ฐ ๋ณ๊ฒฝ ์ฌํญ์ Pull Request์์ ๋ณผ ์ ์๋๋ก, ๋ก์ปฌ ๋ธ๋์น์์ ์์
ํ๊ณ ๋ณ๊ฒฝ ์ฌํญ์ ํฌํฌํ ์ ์ฅ์๋ก ํธ์ํ์ธ์. ๊ทธ๋ฌ๋ฉด ๋ณ๊ฒฝ ์ฌํญ์ด ์๋์ผ๋ก Pull Request์ ๋ํ๋ฉ๋๋ค.
+
+### Pull Request ์ฒดํฌ๋ฆฌ์คํธ [[pull-request-checklist]]
+
+โ Pull Request ์ ๋ชฉ์ ๊ธฐ์ฌ ๋ด์ฉ์ ์์ฝํด์ผ ํฉ๋๋ค.
+โ Pull Request๊ฐ ์ด์๋ฅผ ํด๊ฒฐํ๋ ๊ฒฝ์ฐ, Pull Request ์ค๋ช
์ ์ด์ ๋ฒํธ๋ฅผ ์ธ๊ธํ์ฌ ์ฐ๊ด๋์ด ์์์ ์๋ ค์ฃผ์ธ์. (์ด์๋ฅผ ํ์ธํ๋ ์ฌ๋๋ค์ด ํด๋น ์ด์์ ๋ํ ์์
์ด ์งํ ์ค์์ ์ ์ ์๊ฒ ํฉ๋๋ค).
+โ ์์
์ด ์งํ์ค์ด๋ผ๋ฉด ์ ๋ชฉ ์์ `[WIP]`๋ฅผ ๋ถ์ฌ์ฃผ์ธ์. ์ค๋ณต ์์
์ ํผํ๊ณ ๋ณํฉํ ์ค๋น๊ฐ ๋ PR๊ณผ ๊ตฌ๋ถํ๊ธฐ์ ์ ์ฉํฉ๋๋ค.
+โ ๊ธฐ์กด ํ
์คํธ๋ฅผ ํต๊ณผํ๋์ง ํ์ธํ์ธ์.
+โ ์๋ก์ด ๊ธฐ๋ฅ์ ์ถ๊ฐํ๋ ๊ฒฝ์ฐ, ํด๋น ๊ธฐ๋ฅ์ ๋ํ ํ
์คํธ๋ ์ถ๊ฐํ์ธ์.
+ - ์ ๋ชจ๋ธ์ ์ถ๊ฐํ๋ ๊ฒฝ์ฐ, `ModelTester.all_model_classes = (MyModel, MyModelWithLMHead,...)`์ ์ฌ์ฉํ์ฌ ์ผ๋ฐ์ ์ธ ํ
์คํธ๋ฅผ ํ์ฑํํ์ธ์.
+ - ์ `@slow` ํ
์คํธ๋ฅผ ์ถ๊ฐํ๋ ๊ฒฝ์ฐ, ๋ค์ ๋ช
๋ น์ผ๋ก ํ
์คํธ๋ฅผ ํต๊ณผํ๋์ง ํ์ธํ์ธ์: `RUN_SLOW=1 python -m pytest tests/models/my_new_model/test_my_new_model.py`.
+ - ์ ํ ํฌ๋์ด์ ๋ฅผ ์ถ๊ฐํ๋ ๊ฒฝ์ฐ, ํ
์คํธ๋ฅผ ์์ฑํ๊ณ ๋ค์ ๋ช
๋ น์ผ๋ก ํ
์คํธ๋ฅผ ํต๊ณผํ๋์ง ํ์ธํ์ธ์: `RUN_SLOW=1 python -m pytest tests/models/{your_model_name}/test_tokenization_{your_model_name}.py`.
+ - CircleCI์์๋ ๋๋ฆฐ ํ
์คํธ๋ฅผ ์คํํ์ง ์์ง๋ง, GitHub Actions์์๋ ๋งค์ผ ๋ฐค ์คํ๋ฉ๋๋ค!
+
+โ ๋ชจ๋ ๊ณต๊ฐ ๋ฉ์๋๋ ์ ์ฉํ ๊ธฐ์ ๋ฌธ์๋ฅผ ๊ฐ์ ธ์ผ ํฉ๋๋ค (์๋ฅผ ๋ค์ด [`modeling_bert.py`](https://github.com/huggingface/transformers/blob/main/src/transformers/models/bert/modeling_bert.py) ์ฐธ์กฐ).
+โ ์ ์ฅ์๊ฐ ๋น ๋ฅด๊ฒ ์ฑ์ฅํ๊ณ ์์ผ๋ฏ๋ก ์ ์ฅ์์ ์๋นํ ๋ถ๋ด์ ์ฃผ๋ ์ด๋ฏธ์ง, ๋์์ ๋ฐ ๊ธฐํ ํ
์คํธ๊ฐ ์๋ ํ์ผ์ ์ถ๊ฐํ์ง ๋ง์ธ์. ๋์ [`hf-internal-testing`](https://huggingface.co/hf-internal-testing)๊ณผ ๊ฐ์ Hub ์ ์ฅ์๋ฅผ ์ฌ์ฉํ์ฌ ์ด๋ฌํ ํ์ผ์ ํธ์คํ
ํ๊ณ URL๋ก ์ฐธ์กฐํ์ธ์. ๋ฌธ์์ ๊ด๋ จ๋ ์ด๋ฏธ์ง๋ ๋ค์ ์ ์ฅ์์ ๋ฐฐ์นํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค: [huggingface/documentation-images](https://huggingface.co/datasets/huggingface/documentation-images). ์ด ๋ฐ์ดํฐ์
์ ์ฅ์์์ PR์ ์ด์ด์ Hugging Face ๋ฉค๋ฒ์๊ฒ ๋ณํฉ์ ์์ฒญํ ์ ์์ต๋๋ค.
+
+Pull Request์์ ์คํ๋๋ ๊ฒ์ฌ์ ๋ํ ์์ธํ ์ ๋ณด๋ [Pull Request์ ๋ํ ๊ฒ์ฌ](https://huggingface.co/docs/transformers/pr_checks) ๊ฐ์ด๋๋ฅผ ํ์ธํ์ธ์.
+
+### ํ
์คํธ [[tests]]
+
+๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋์๊ณผ ์ฌ๋ฌ ์์ ๋ฅผ ํ
์คํธํ ์ ์๋ ๊ด๋ฒ์ํ ํ
์คํธ ์ค์ํธ๊ฐ ํฌํจ๋์ด ์์ต๋๋ค. ๋ผ์ด๋ธ๋ฌ๋ฆฌ ํ
์คํธ๋ [tests](https://github.com/huggingface/transformers/tree/main/tests) ํด๋์, ์์ ํ
์คํธ๋ [examples](https://github.com/huggingface/transformers/tree/main/examples) ํด๋์ ์์ต๋๋ค.
+
+์๋๊ฐ ๋น ๋ฅธ `pytest`์ `pytest-xdist`๋ฅผ ์ ํธํฉ๋๋ค. ์ ์ฅ์์ ๋ฃจํธ ๋๋ ํฐ๋ฆฌ์์ ํ
์คํธ๋ฅผ ์คํํ *ํ์ ํด๋ ๊ฒฝ๋ก ๋๋ ํ
์คํธ ํ์ผ ๊ฒฝ๋ก*๋ฅผ ์ง์ ํ์ธ์:
+
+```bash
+python -m pytest -n auto --dist=loadfile -s -v ./tests/models/my_new_model
+```
+
+๋ง์ฐฌ๊ฐ์ง๋ก `examples` ๋๋ ํฐ๋ฆฌ์์๋ *ํ์ ํด๋ ๊ฒฝ๋ก ๋๋ ํ
์คํธ ํ์ผ ๊ฒฝ๋ก*๋ฅผ ์ง์ ํ์ธ์. ์๋ฅผ ๋ค์ด, ๋ค์ ๋ช
๋ น์ PyTorch `examples` ๋๋ ํฐ๋ฆฌ์ ํ
์คํธ ๋ถ๋ฅ ํ์ ํด๋๋ฅผ ํ
์คํธํฉ๋๋ค:
+
+```bash
+pip install -r examples/xxx/requirements.txt # only needed the first time
+python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/text-classification
+```
+
+์ด๊ฒ์ด ์ค์ ๋ก `make test` ๋ฐ `make test-examples` ๋ช
๋ น์ด ๊ตฌํ๋๋ ๋ฐฉ์์
๋๋ค (`pip install`์ ์ ์ธํฉ๋๋ค)!
+
+๋ํ ํน์ ๊ธฐ๋ฅ๋ง ํ
์คํธํ๊ธฐ ์ํ ๋ ์์ ํ
์คํธ๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
+
+๊ธฐ๋ณธ์ ์ผ๋ก ๋๋ฆฐ ํ
์คํธ๋ ๊ฑด๋๋ฐ์ง๋ง `RUN_SLOW` ํ๊ฒฝ ๋ณ์๋ฅผ `yes`๋ก ์ค์ ํ์ฌ ์คํํ ์ ์์ต๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋ง์ ๊ธฐ๊ฐ๋ฐ์ดํธ ๋จ์์ ๋ชจ๋ธ์ด ๋ค์ด๋ก๋๋๋ฏ๋ก ์ถฉ๋ถํ ๋์คํฌ ๊ณต๊ฐ, ์ข์ ์ธํฐ๋ท ์ฐ๊ฒฐ๊ณผ ๋ง์ ์ธ๋ด๊ฐ ํ์ํฉ๋๋ค!
+
+
+
+ํ
์คํธ๋ฅผ ์คํํ๋ ค๋ฉด *ํ์ ํด๋ ๊ฒฝ๋ก ๋๋ ํ
์คํธ ํ์ผ ๊ฒฝ๋ก*๋ฅผ ์ง์ ํ์ธ์. ๊ทธ๋ ์ง ์์ผ๋ฉด `tests` ๋๋ `examples` ํด๋์ ๋ชจ๋ ํ
์คํธ๋ฅผ ์คํํ๊ฒ ๋์ด ๋งค์ฐ ๊ธด ์๊ฐ์ด ๊ฑธ๋ฆฝ๋๋ค!
+
+
+
+```bash
+RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./tests/models/my_new_model
+RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/text-classification
+```
+
+๋๋ฆฐ ํ
์คํธ์ ๋ง์ฐฌ๊ฐ์ง๋ก, ๋ค์๊ณผ ๊ฐ์ด ํ
์คํธ ์ค์ ๊ธฐ๋ณธ์ ์ผ๋ก ํ์ฑํ๋์ง ์๋ ๋ค๋ฅธ ํ๊ฒฝ ๋ณ์๋ ์์ต๋๋ค:
+- `RUN_CUSTOM_TOKENIZERS`: ์ฌ์ฉ์ ์ ์ ํ ํฌ๋์ด์ ํ
์คํธ๋ฅผ ํ์ฑํํฉ๋๋ค.
+- `RUN_PT_FLAX_CROSS_TESTS`: PyTorch + Flax ํตํฉ ํ
์คํธ๋ฅผ ํ์ฑํํฉ๋๋ค.
+- `RUN_PT_TF_CROSS_TESTS`: TensorFlow + PyTorch ํตํฉ ํ
์คํธ๋ฅผ ํ์ฑํํฉ๋๋ค.
+
+๋ ๋ง์ ํ๊ฒฝ ๋ณ์์ ์ถ๊ฐ ์ ๋ณด๋ [testing_utils.py](src/transformers/testing_utils.py)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+๐ค Transformers๋ ํ
์คํธ ์คํ๊ธฐ๋ก `pytest`๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๊ทธ๋ฌ๋ ํ
์คํธ ์ค์ํธ ์์ฒด์์๋ `pytest` ๊ด๋ จ ๊ธฐ๋ฅ์ ์ฌ์ฉํ์ง ์์ต๋๋ค.
+
+์ด๊ฒ์ `unittest`๊ฐ ์์ ํ ์ง์๋๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค. ๋ค์์ `unittest`๋ก ํ
์คํธ๋ฅผ ์คํํ๋ ๋ฐฉ๋ฒ์
๋๋ค:
+
+```bash
+python -m unittest discover -s tests -t . -v
+python -m unittest discover -s examples -t examples -v
+```
+
+### ์คํ์ผ ๊ฐ์ด๋ [[style-guide]]
+
+๋ฌธ์๋ [Google Python ์คํ์ผ ๊ฐ์ด๋](https://google.github.io/styleguide/pyguide.html)๋ฅผ ๋ฐ๋ฆ
๋๋ค. ์์ธํ ์ ๋ณด๋ [๋ฌธ์ ์์ฑ ๊ฐ์ด๋](https://github.com/huggingface/transformers/tree/main/docs#writing-documentation---specification)๋ฅผ ํ์ธํ์ธ์.
+
+### Windows์์ ๊ฐ๋ฐ [[develop-on-windows]]
+
+Windows์์ ๊ฐ๋ฐํ ๊ฒฝ์ฐ([Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/) ๋๋ WSL์์ ์์
ํ์ง ์๋ ํ) Windows `CRLF` ์ค ๋ฐ๊ฟ์ Linux `LF` ์ค ๋ฐ๊ฟ์ผ๋ก ๋ณํํ๋๋ก git์ ๊ตฌ์ฑํด์ผ ํฉ๋๋ค:
+
+```bash
+git config core.autocrlf input
+```
+
+Windows์์ `make` ๋ช
๋ น์ ์คํํ๋ ํ ๊ฐ์ง ๋ฐฉ๋ฒ์ MSYS2๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์
๋๋ค:
+
+1. [MSYS2](https://www.msys2.org/)๋ฅผ ๋ค์ด๋ก๋ํฉ๋๋ค. `C:\msys64`์ ์ค์น๋์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
+2. CLI์์ `C:\msys64\msys2.exe`๋ฅผ ์ฝ๋๋ค (์์ ๋ฉ๋ด์์ ์ฌ์ฉ ๊ฐ๋ฅํด์ผ ํจ).
+3. ์์์ ๋ค์์ ์คํํ์ฌ: `pacman -Syu` ๋ฐ `pacman -S make`๋ก `make`๋ฅผ ์ค์นํฉ๋๋ค.
+4. ํ๊ฒฝ ๋ณ์ PATH์ `C:\msys64\usr\bin`์ ์ถ๊ฐํ์ธ์.
+
+์ด์ ๋ชจ๋ ํฐ๋ฏธ๋ (PowerShell, cmd.exe ๋ฑ)์์ `make`๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค! ๐
+
+### ํฌํฌํ ์ ์ฅ์๋ฅผ ์์ ์๋ณธ ๋ธ๋์น(main)๊ณผ ๋๊ธฐํํ๊ธฐ (Hugging Face ์ ์ฅ์) [[sync-a-forked-repository-with-upstream-main-the-hugging-face-repository]]
+
+ํฌํฌํ ์ ์ฅ์์ main ๋ธ๋์น๋ฅผ ์
๋ฐ์ดํธํ ๋, ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ผ ์ํํด์ฃผ์ธ์. ์ด๋ ๊ฒ ํ๋ฉด ๊ฐ upstream PR์ ์ฐธ์กฐ ๋
ธํธ๊ฐ ์ถ๊ฐ๋๋ ๊ฒ์ ํผํ๊ณ ์ด๋ฌํ PR์ ๊ด์ฌํ๋ ๊ฐ๋ฐ์๋ค์๊ฒ ๋ถํ์ํ ์๋ฆผ์ด ์ ์ก๋๋ ๊ฒ์ ๋ฐฉ์งํ ์ ์์ต๋๋ค.
+
+1. ๊ฐ๋ฅํ๋ฉด ํฌํฌ๋ ์ ์ฅ์์ ๋ธ๋์น ๋ฐ PR์ ์ฌ์ฉํ์ฌ upstream๊ณผ ๋๊ธฐํํ์ง ๋ง์ธ์. ๋์ ํฌํฌ๋ main ์ ์ฅ์์ ์ง์ ๋ณํฉํ์ธ์.
+2. PR์ด ๋ฐ๋์ ํ์ํ ๊ฒฝ์ฐ, ๋ธ๋์น๋ฅผ ํ์ธํ ํ ๋ค์ ๋จ๊ณ๋ฅผ ์ฌ์ฉํ์ธ์:
+
+ ```bash
+ git checkout -b your-branch-for-syncing
+ git pull --squash --no-commit upstream main
+ git commit -m ''
+ git push --set-upstream origin your-branch-for-syncing
+ ```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/conversations.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/conversations.md
new file mode 100644
index 0000000000000000000000000000000000000000..920cb1387860865e6f01ff47b79c50a2e9c4bea3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/conversations.md
@@ -0,0 +1,306 @@
+
+
+# Transformers๋ก ์ฑํ
ํ๊ธฐ[[chatting-with-transformers]]
+
+์ด ๊ธ์ ๋ณด๊ณ ์๋ค๋ฉด **์ฑํ
๋ชจ๋ธ**์ ๋ํด ์ด๋ ์ ๋ ์๊ณ ๊ณ์ค ๊ฒ์
๋๋ค.
+์ฑํ
๋ชจ๋ธ์ด๋ ๋ฉ์ธ์ง๋ฅผ ์ฃผ๊ณ ๋ฐ์ ์ ์๋ ๋ํํ ์ธ๊ณต์ง๋ฅ์
๋๋ค.
+๋ํ์ ์ผ๋ก ChatGPT๊ฐ ์๊ณ , ์ด์ ๋น์ทํ๊ฑฐ๋ ๋ ๋ฐ์ด๋ ์คํ์์ค ์ฑํ
๋ชจ๋ธ์ด ๋ง์ด ์กด์ฌํฉ๋๋ค.
+์ด๋ฌํ ๋ชจ๋ธ๋ค์ ๋ฌด๋ฃ ๋ค์ด๋ก๋ํ ์ ์์ผ๋ฉฐ, ๋ก์ปฌ์์ ์คํํ ์ ์์ต๋๋ค.
+ํฌ๊ณ ๋ฌด๊ฑฐ์ด ๋ชจ๋ธ์ ๊ณ ์ฑ๋ฅ ํ๋์จ์ด์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ํ์ํ์ง๋ง,
+์ ์ฌ์ GPU ํน์ ์ผ๋ฐ ๋ฐ์คํฌํ์ด๋ ๋
ธํธ๋ถ CPU์์๋ ์ ์๋ํ๋ ์ํ ๋ชจ๋ธ๋ค๋ ์์ต๋๋ค.
+
+์ด ๊ฐ์ด๋๋ ์ฑํ
๋ชจ๋ธ์ ์ฒ์ ์ฌ์ฉํ๋ ๋ถ๋ค์๊ฒ ์ ์ฉํ ๊ฒ์
๋๋ค.
+์ฐ๋ฆฌ๋ ๊ฐํธํ ๊ณ ์์ค(High-Level) "pipeline"์ ํตํด ๋น ๋ฅธ ์์ ๊ฐ์ด๋๋ฅผ ์งํํ ๊ฒ์
๋๋ค.
+๊ฐ์ด๋์๋ ์ฑํ
๋ชจ๋ธ์ ๋ฐ๋ก ์์ํ ๋ ํ์ํ ๋ชจ๋ ์ ๋ณด๊ฐ ๋ด๊ฒจ ์์ต๋๋ค.
+๋น ๋ฅธ ์์ ๊ฐ์ด๋ ์ดํ์๋ ์ฑํ
๋ชจ๋ธ์ด ์ ํํ ๋ฌด์์ธ์ง, ์ ์ ํ ๋ชจ๋ธ์ ์ ํํ๋ ๋ฐฉ๋ฒ๊ณผ,
+์ฑํ
๋ชจ๋ธ์ ์ฌ์ฉํ๋ ๊ฐ ๋จ๊ณ์ ์ ์์ค(Low-Level) ๋ถ์ ๋ฑ ๋ ์์ธํ ์ ๋ณด๋ฅผ ๋ค๋ฃฐ ๊ฒ์
๋๋ค.
+๋ํ ์ฑํ
๋ชจ๋ธ์ ์ฑ๋ฅ๊ณผ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ์ ์ต์ ํํ๋ ๋ฐฉ๋ฒ์ ๋ํ ํ๋ ์ ๊ณตํ ๊ฒ์
๋๋ค.
+
+
+## ๋น ๋ฅธ ์์[[quickstart]]
+
+์์ธํ ๋ณผ ์ฌ์ ๊ฐ ์๋ ๋ถ๋ค์ ์ํด ๊ฐ๋จํ ์์ฝํด ๋ณด๊ฒ ์ต๋๋ค:
+์ฑํ
๋ชจ๋ธ์ ๋ํ ๋ฉ์ธ์ง๋ฅผ ๊ณ์ํด์ ์์ฑํด ๋๊ฐ๋๋ค.
+์ฆ, ์งค๋งํ ์ฑํ
๋ฉ์ธ์ง๋ฅผ ๋ชจ๋ธ์๊ฒ ์ ๋ฌํ๋ฉด, ๋ชจ๋ธ์ ์ด๋ฅผ ๋ฐํ์ผ๋ก ์๋ต์ ์ถ๊ฐํ๋ฉฐ ๋ํ๋ฅผ ์ด์ด ๋๊ฐ๋๋ค.
+์ด์ ์ค์ ๋ก ์ด๋ป๊ฒ ์๋ํ๋์ง ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+๋จผ์ , ์ฑํ
์ ๋ง๋ค์ด ๋ณด๊ฒ ์ต๋๋ค:
+
+
+```python
+chat = [
+ {"role": "system", "content": "You are a sassy, wise-cracking robot as imagined by Hollywood circa 1986."},
+ {"role": "user", "content": "Hey, can you tell me any fun things to do in New York?"}
+]
+```
+
+์ฃผ๋ชฉํ์ธ์, ๋ํ๋ฅผ ์ฒ์ ์์ํ ๋ ์ ์ ๋ฉ์ธ์ง ์ด์ธ์๋, ๋ณ๋์ **์์คํ
** ๋ฉ์ธ์ง๊ฐ ํ์ํ ์ ์์ต๋๋ค.
+๋ชจ๋ ์ฑํ
๋ชจ๋ธ์ด ์์คํ
๋ฉ์ธ์ง๋ฅผ ์ง์ํ๋ ๊ฒ์ ์๋์ง๋ง,
+์ง์ํ๋ ๊ฒฝ์ฐ์๋ ์์คํ
๋ฉ์ธ์ง๋ ๋ํ์์ ๋ชจ๋ธ์ด ์ด๋ป๊ฒ ํ๋ํด์ผ ํ๋์ง๋ฅผ ์ง์ํ ์ ์์ต๋๋ค.
+์๋ฅผ ๋ค์ด, ์ ์พํ๊ฑฐ๋ ์ง์งํ๊ณ ์ ํ ๋, ์งง์ ๋ต๋ณ์ด๋ ๊ธด ๋ต๋ณ์ ์ํ ๋ ๋ฑ์ ์ค์ ํ ์ ์์ต๋๋ค.
+์์คํ
๋ฉ์ธ์ง๋ฅผ ์๋ตํ๊ณ
+"You are a helpful and intelligent AI assistant who responds to user queries."
+์ ๊ฐ์ ๊ฐ๋จํ ํ๋กฌํํธ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ๋ ๊ฐ๋ฅํฉ๋๋ค.
+
+์ฑํ
์ ์์ํ๋ค๋ฉด ๋ํ๋ฅผ ์ด์ด ๋๊ฐ๋ ๊ฐ์ฅ ๋น ๋ฅธ ๋ฐฉ๋ฒ์ [`TextGenerationPipeline`]๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์
๋๋ค.
+ํ๋ฒ `LLaMA-3`๋ฅผ ์ฌ์ฉํ์ฌ ์ด๋ฅผ ์์ฐํด ๋ณด๊ฒ ์ต๋๋ค.
+์ฐ์ `LLaMA-3`๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด์๋ ์น์ธ์ด ํ์ํฉ๋๋ค. [๊ถํ ์ ์ฒญ](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)์ ํ๊ณ Hugging Face ๊ณ์ ์ผ๋ก ๋ก๊ทธ์ธํ ํ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+๋ํ ์ฐ๋ฆฌ๋ `device_map="auto"`๋ฅผ ์ฌ์ฉํฉ๋๋ค. GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ถฉ๋ถํ๋ค๋ฉด ๋ก๋๋ ๊ฒ์
๋๋ค.
+๊ทธ๋ฆฌ๊ณ ๋ฉ๋ชจ๋ฆฌ ์ ์ฝ์ ์ํด dtype์ `torch.bfloat16`์ผ๋ก ์ค์ ํ ๊ฒ์
๋๋ค.
+
+```python
+import torch
+from transformers import pipeline
+
+pipe = pipeline("text-generation", "meta-llama/Meta-Llama-3-8B-Instruct", torch_dtype=torch.bfloat16, device_map="auto")
+response = pipe(chat, max_new_tokens=512)
+print(response[0]['generated_text'][-1]['content'])
+```
+
+์ดํ ์คํ์ ํ๋ฉด ์๋์ ๊ฐ์ด ์ถ๋ ฅ๋ฉ๋๋ค:
+
+```text
+(sigh) Oh boy, you're asking me for advice? You're gonna need a map, pal! Alright,
+alright, I'll give you the lowdown. But don't say I didn't warn you, I'm a robot, not a tour guide!
+
+So, you wanna know what's fun to do in the Big Apple? Well, let me tell you, there's a million
+things to do, but I'll give you the highlights. First off, you gotta see the sights: the Statue of
+Liberty, Central Park, Times Square... you know, the usual tourist traps. But if you're lookin' for
+something a little more... unusual, I'd recommend checkin' out the Museum of Modern Art. It's got
+some wild stuff, like that Warhol guy's soup cans and all that jazz.
+
+And if you're feelin' adventurous, take a walk across the Brooklyn Bridge. Just watch out for
+those pesky pigeons, they're like little feathered thieves! (laughs) Get it? Thieves? Ah, never mind.
+
+Now, if you're lookin' for some serious fun, hit up the comedy clubs in Greenwich Village. You might
+even catch a glimpse of some up-and-coming comedians... or a bunch of wannabes tryin' to make it big. (winks)
+
+And finally, if you're feelin' like a real New Yorker, grab a slice of pizza from one of the many amazing
+pizzerias around the city. Just don't try to order a "robot-sized" slice, trust me, it won't end well. (laughs)
+
+So, there you have it, pal! That's my expert advice on what to do in New York. Now, if you'll
+excuse me, I've got some oil changes to attend to. (winks)
+```
+
+์ฑํ
์ ๊ณ์ํ๋ ค๋ฉด, ์์ ์ ๋ต์ฅ์ ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค.
+ํ์ดํ๋ผ์ธ์์ ๋ฐํ๋ `response` ๊ฐ์ฒด์๋ ํ์ฌ๊น์ง ๋ชจ๋ ์ฑํ
์ ํฌํจํ๊ณ ์์ผ๋ฏ๋ก
+๋ฉ์ธ์ง๋ฅผ ์ถ๊ฐํ๊ณ ๋ค์ ์ ๋ฌํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค.
+
+```python
+chat = response[0]['generated_text']
+chat.append(
+ {"role": "user", "content": "Wait, what's so wild about soup cans?"}
+)
+response = pipe(chat, max_new_tokens=512)
+print(response[0]['generated_text'][-1]['content'])
+```
+
+์ดํ ์คํ์ ํ๋ฉด ์๋์ ๊ฐ์ด ์ถ๋ ฅ๋ฉ๋๋ค:
+
+```text
+(laughs) Oh, you're killin' me, pal! You don't get it, do you? Warhol's soup cans are like, art, man!
+It's like, he took something totally mundane, like a can of soup, and turned it into a masterpiece. It's
+like, "Hey, look at me, I'm a can of soup, but I'm also a work of art!"
+(sarcastically) Oh, yeah, real original, Andy.
+
+But, you know, back in the '60s, it was like, a big deal. People were all about challenging the
+status quo, and Warhol was like, the king of that. He took the ordinary and made it extraordinary.
+And, let me tell you, it was like, a real game-changer. I mean, who would've thought that a can of soup could be art? (laughs)
+
+But, hey, you're not alone, pal. I mean, I'm a robot, and even I don't get it. (winks)
+But, hey, that's what makes art, art, right? (laughs)
+```
+
+์ด ํํ ๋ฆฌ์ผ์ ํ๋ฐ๋ถ์์๋ ์ฑ๋ฅ๊ณผ ๋ฉ๋ชจ๋ฆฌ ๊ด๋ฆฌ,
+๊ทธ๋ฆฌ๊ณ ์ฌ์ฉ์์ ํ์์ ๋ง๋ ์ฑํ
๋ชจ๋ธ ์ ํ๊ณผ ๊ฐ์ ๊ตฌ์ฒด์ ์ธ ์ฃผ์ ๋ค์ ๋ค๋ฃฐ ๊ฒ์
๋๋ค.
+
+## ์ฑํ
๋ชจ๋ธ ๊ณ ๋ฅด๊ธฐ[[choosing-a-chat-model]]
+
+[Hugging Face Hub](https://huggingface.co/models?pipeline_tag=text-generation&sort=trending)๋ ์ฑํ
๋ชจ๋ธ์ ๋ค์ํ๊ฒ ์ ๊ณตํ๊ณ ์์ต๋๋ค.
+์ฒ์ ์ฌ์ฉํ๋ ์ฌ๋์๊ฒ๋ ๋ชจ๋ธ์ ์ ํํ๊ธฐ๊ฐ ์ด๋ ค์ธ์ง ๋ชจ๋ฆ
๋๋ค.
+ํ์ง๋ง ๊ฑฑ์ ํ์ง ๋ง์ธ์! ๋ ๊ฐ์ง๋ง ๋ช
์ฌํ๋ฉด ๋ฉ๋๋ค:
+
+- ๋ชจ๋ธ์ ํฌ๊ธฐ๋ ์คํ ์๋์ ๋ฉ๋ชจ๋ฆฌ์ ์ฌ๋ผ์ฌ ์ ์๋์ง ์ฌ๋ถ๋ฅผ ๊ฒฐ์ .
+- ๋ชจ๋ธ์ด ์์ฑํ ์ถ๋ ฅ์ ํ์ง.
+
+์ผ๋ฐ์ ์ผ๋ก ์ด๋ฌํ ์์๋ค์ ์๊ด๊ด๊ณ๊ฐ ์์ต๋๋ค. ๋ ํฐ ๋ชจ๋ธ์ผ์๋ก ๋ ๋ฐ์ด๋ ์ฑ๋ฅ์ ๋ณด์ด๋ ๊ฒฝํฅ์ด ์์ง๋ง, ๋์ผํ ํฌ๊ธฐ์ ๋ชจ๋ธ์ด๋ผ๋ ์ ์๋ฏธํ ์ฐจ์ด๊ฐ ๋ ์ ์์ต๋๋ค!
+
+### ๋ชจ๋ธ์ ๋ช
์นญ๊ณผ ํฌ๊ธฐ[[size-and-model-naming]]
+
+๋ชจ๋ธ์ ํฌ๊ธฐ๋ ๋ชจ๋ธ ์ด๋ฆ์ ์๋ ์ซ์๋ก ์ฝ๊ฒ ์ ์ ์์ต๋๋ค.
+์๋ฅผ ๋ค์ด, "8B" ๋๋ "70B"์ ๊ฐ์ ์ซ์๋ ๋ชจ๋ธ์ **ํ๋ผ๋ฏธํฐ** ์๋ฅผ ๋ํ๋
๋๋ค.
+์์ํ๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ผ๋ฉด, ํ๋ผ๋ฏธํฐ ํ๋๋น ์ฝ 2๋ฐ์ดํธ์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ํ์ํ๋ค๊ณ ์์ ๊ฐ๋ฅํฉ๋๋ค.
+๋ฐ๋ผ์ 80์ต ๊ฐ์ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ฐ์ง "8B" ๋ชจ๋ธ์ 16GB์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฐจ์งํ๋ฉฐ, ์ถ๊ฐ์ ์ธ ์ค๋ฒํค๋๋ฅผ ์ํ ์ฝ๊ฐ์ ์ฌ์ ๊ฐ ํ์ํฉ๋๋ค.
+์ด๋ 3090์ด๋ 4090์ ๊ฐ์ 24GB์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๊ฐ์ถ ํ์ด์๋ GPU์ ์ ํฉํฉ๋๋ค.
+
+์ผ๋ถ ์ฑํ
๋ชจ๋ธ์ "Mixture of Experts" ๋ชจ๋ธ์
๋๋ค.
+์ด๋ฌํ ๋ชจ๋ธ์ ํฌ๊ธฐ๋ฅผ "8x7B" ๋๋ "141B-A35B"์ ๊ฐ์ด ๋ค๋ฅด๊ฒ ํ์ํ๊ณค ํฉ๋๋ค.
+์ซ์๊ฐ ๋ค์ ๋ชจํธํ๋ค ๋๊ปด์ง ์ ์์ง๋ง, ์ฒซ ๋ฒ์งธ ๊ฒฝ์ฐ์๋ ์ฝ 56์ต(8x7) ๊ฐ์ ํ๋ผ๋ฏธํฐ๊ฐ ์๊ณ ,
+๋ ๋ฒ์งธ ๊ฒฝ์ฐ์๋ ์ฝ 141์ต ๊ฐ์ ํ๋ผ๋ฏธํฐ๊ฐ ์๋ค๊ณ ํด์ํ ์ ์์ต๋๋ค.
+
+์์ํ๋ ํ๋ผ๋ฏธํฐ๋น ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ 8๋นํธ, 4๋นํธ, ๋๋ ๊ทธ ์ดํ๋ก ์ค์ด๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
+์ด ์ฃผ์ ์ ๋ํด์๋ ์๋์ [๋ฉ๋ชจ๋ฆฌ ๊ณ ๋ ค์ฌํญ](#memory-considerations) ์ฑํฐ์์ ๋ ์์ธํ ๋ค๋ฃฐ ์์ ์
๋๋ค.
+
+### ๊ทธ๋ ๋ค๋ฉด ์ด๋ค ์ฑํ
๋ชจ๋ธ์ด ๊ฐ์ฅ ์ข์๊น์?[[but-which-chat-model-is-best]]
+๋ชจ๋ธ์ ํฌ๊ธฐ ์ธ์๋ ๊ณ ๋ คํ ์ ์ด ๋ง์ต๋๋ค.
+์ด๋ฅผ ํ๋์ ์ดํด๋ณด๋ ค๋ฉด **๋ฆฌ๋๋ณด๋**๋ฅผ ์ฐธ๊ณ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+๊ฐ์ฅ ์ธ๊ธฐ ์๋ ๋ฆฌ๋๋ณด๋ ๋ ๊ฐ์ง๋ [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)์ [LMSys Chatbot Arena Leaderboard](https://chat.lmsys.org/?leaderboard)์
๋๋ค.
+LMSys ๋ฆฌ๋๋ณด๋์๋ ๋
์ ๋ชจ๋ธ๋ ํฌํจ๋์ด ์์ผ๋,
+`license` ์ด์์ ์ ๊ทผ ๊ฐ๋ฅํ ๋ชจ๋ธ์ ์ ํํ ํ
+[Hugging Face Hub](https://huggingface.co/models?pipeline_tag=text-generation&sort=trending)์์ ๊ฒ์ํด ๋ณด์ธ์.
+
+### ์ ๋ฌธ ๋ถ์ผ[[specialist-domains]]
+์ผ๋ถ ๋ชจ๋ธ์ ์๋ฃ ๋๋ ๋ฒ๋ฅ ํ
์คํธ์ ๊ฐ์ ํน์ ๋๋ฉ์ธ์ด๋ ๋น์์ด๊ถ ์ธ์ด์ ํนํ๋์ด ์๊ธฐ๋ ํฉ๋๋ค.
+์ด๋ฌํ ๋๋ฉ์ธ์์ ์์
ํ ๊ฒฝ์ฐ ํนํ๋ ๋ชจ๋ธ์ด ์ข์ ์ฑ๋ฅ์ ๋ณด์ผ ์ ์์ต๋๋ค.
+ํ์ง๋ง ํญ์ ๊ทธ๋ด ๊ฒ์ด๋ผ ๋จ์ ํ๊ธฐ๋ ํ๋ญ๋๋ค.
+ํนํ ๋ชจ๋ธ์ ํฌ๊ธฐ๊ฐ ์๊ฑฐ๋ ์ค๋๋ ๋ชจ๋ธ์ธ ๊ฒฝ์ฐ,
+์ต์ ๋ฒ์ฉ ๋ชจ๋ธ์ด ๋ ๋ฐ์ด๋ ์ ์์ต๋๋ค.
+๋คํํ๋ [domain-specific leaderboards](https://huggingface.co/blog/leaderboard-medicalllm)๊ฐ ์ ์ฐจ ๋ฑ์ฅํ๊ณ ์์ด, ํน์ ๋๋ฉ์ธ์ ์ต๊ณ ์ ๋ชจ๋ธ์ ์ฝ๊ฒ ์ฐพ์ ์ ์์ ๊ฒ์
๋๋ค.
+
+
+## ํ์ดํ๋ผ์ธ ๋ด๋ถ๋ ์ด๋ป๊ฒ ๋์ด์๋๊ฐ?[[what-happens-inside-the-pipeline]]
+์์ ๋น ๋ฅธ ์์์์๋ ๊ณ ์์ค(High-Level) ํ์ดํ๋ผ์ธ์ ์ฌ์ฉํ์์ต๋๋ค.
+์ด๋ ๊ฐํธํ ๋ฐฉ๋ฒ์ด์ง๋ง, ์ ์ฐ์ฑ์ ๋จ์ด์ง๋๋ค.
+์ด์ ๋ ์ ์์ค(Low-Level) ์ ๊ทผ ๋ฐฉ์์ ํตํด ๋ํ์ ํฌํจ๋ ๊ฐ ๋จ๊ณ๋ฅผ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+์ฝ๋ ์ํ๋ก ์์ํ ํ ์ด๋ฅผ ๋ถ์ํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer
+import torch
+
+# ์
๋ ฅ๊ฐ์ ์ฌ์ ์ ์ค๋นํด ๋์ต๋๋ค
+chat = [
+ {"role": "system", "content": "You are a sassy, wise-cracking robot as imagined by Hollywood circa 1986."},
+ {"role": "user", "content": "Hey, can you tell me any fun things to do in New York?"}
+]
+
+# 1: ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ฅผ ๋ถ๋ฌ์ต๋๋ค
+model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto", torch_dtype=torch.bfloat16)
+tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
+
+# 2: ์ฑํ
ํ
ํ๋ฆฟ์ ์ ์ฉํฉ๋๋ค
+formatted_chat = tokenizer.apply_chat_template(chat, tokenize=False, add_generation_prompt=True)
+print("Formatted chat:\n", formatted_chat)
+
+# 3: ์ฑํ
์ ํ ํฐํํฉ๋๋ค (๋ฐ๋ก ์ด์ ๊ณผ์ ์์ tokenized=True๋ก ์ค์ ํ๋ฉด ํ๊บผ๋ฒ์ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค)
+inputs = tokenizer(formatted_chat, return_tensors="pt", add_special_tokens=False)
+# ํ ํฐํ๋ ์
๋ ฅ๊ฐ์ ๋ชจ๋ธ์ด ์ฌ๋ผ์ ์๋ ๊ธฐ๊ธฐ(CPU/GPU)๋ก ์ฎ๊น๋๋ค.
+inputs = {key: tensor.to(model.device) for key, tensor in inputs.items()}
+print("Tokenized inputs:\n", inputs)
+
+# 4: ๋ชจ๋ธ๋ก๋ถํฐ ์๋ต์ ์์ฑํฉ๋๋ค
+outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
+print("Generated tokens:\n", outputs)
+
+# 5: ๋ชจ๋ธ์ด ์ถ๋ ฅํ ํ ํฐ์ ๋ค์ ๋ฌธ์์ด๋ก ๋์ฝ๋ฉํฉ๋๋ค
+decoded_output = tokenizer.decode(outputs[0][inputs['input_ids'].size(1):], skip_special_tokens=True)
+print("Decoded output:\n", decoded_output)
+```
+์ฌ๊ธฐ์๋ ๊ฐ ๋ถ๋ถ์ด ์์ฒด ๋ฌธ์๊ฐ ๋ ์ ์์ ๋งํผ ๋ง์ ๋ด์ฉ์ด ๋ด๊ฒจ ์์ต๋๋ค!
+๋๋ฌด ์์ธํ ์ค๋ช
ํ๊ธฐ๋ณด๋ค๋ ๋์ ๊ฐ๋
์ ๋ค๋ฃจ๊ณ , ์ธ๋ถ ์ฌํญ์ ๋งํฌ๋ ๋ฌธ์์์ ๋ค๋ฃจ๊ฒ ์ต๋๋ค.
+์ฃผ์ ๋จ๊ณ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+1. [๋ชจ๋ธ](https://huggingface.co/learn/nlp-course/en/chapter2/3)๊ณผ [ํ ํฌ๋์ด์ ](https://huggingface.co/learn/nlp-course/en/chapter2/4?fw=pt)๋ฅผ Hugging Face Hub์์ ๋ก๋ํฉ๋๋ค.
+2. ๋ํ๋ ํ ํฌ๋์ด์ ์ [์ฑํ
ํ
ํ๋ฆฟ](https://huggingface.co/docs/transformers/main/en/chat_templating)์ ์ฌ์ฉํ์ฌ ์์์ ๊ตฌ์ฑํฉ๋๋ค.
+3. ๊ตฌ์ฑ๋ ์ฑํ
์ ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํ์ฌ [ํ ํฐํ](https://huggingface.co/learn/nlp-course/en/chapter2/4)๋ฉ๋๋ค.
+4. ๋ชจ๋ธ์์ ์๋ต์ [์์ฑ](https://huggingface.co/docs/transformers/en/llm_tutorial)ํฉ๋๋ค.
+5. ๋ชจ๋ธ์ด ์ถ๋ ฅํ ํ ํฐ์ ๋ค์ ๋ฌธ์์ด๋ก ๋์ฝ๋ฉํฉ๋๋ค.
+
+## ์ฑ๋ฅ, ๋ฉ๋ชจ๋ฆฌ์ ํ๋์จ์ด[[performance-memory-and-hardware]]
+์ด์ ๋๋ถ๋ถ์ ๋จธ์ ๋ฌ๋ ์์
์ด GPU์์ ์คํ๋๋ค๋ ๊ฒ์ ์์ค ๊ฒ๋๋ค.
+๋ค์ ๋๋ฆฌ๊ธฐ๋ ํด๋ CPU์์ ์ฑํ
๋ชจ๋ธ์ด๋ ์ธ์ด ๋ชจ๋ธ๋ก๋ถํฐ ํ
์คํธ๋ฅผ ์์ฑํ๋ ๊ฒ๋ ๊ฐ๋ฅํฉ๋๋ค.
+ํ์ง๋ง ๋ชจ๋ธ์ GPU ๋ฉ๋ชจ๋ฆฌ์ ์ฌ๋ ค๋์ ์๋ง ์๋ค๋ฉด, GPU๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ผ๋ฐ์ ์ผ๋ก ๋ ์ ํธ๋๋ ๋ฐฉ์์
๋๋ค.
+
+### ๋ฉ๋ชจ๋ฆฌ ๊ณ ๋ ค์ฌํญ[[memory-considerations]]
+
+๊ธฐ๋ณธ์ ์ผ๋ก, [`TextGenerationPipeline`]์ด๋ [`AutoModelForCausalLM`]๊ณผ ๊ฐ์
+Hugging Face ํด๋์ค๋ ๋ชจ๋ธ์ `float32` ์ ๋ฐ๋(Precision)๋ก ๋ก๋ํฉ๋๋ค.
+์ด๋ ํ๋ผ๋ฏธํฐ๋น 4๋ฐ์ดํธ(32๋นํธ)๋ฅผ ํ์๋ก ํ๋ฏ๋ก,
+80์ต ๊ฐ์ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ฐ์ง "8B" ๋ชจ๋ธ์ ์ฝ 32GB์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ํ์๋ก ํ๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค.
+ํ์ง๋ง ์ด๋ ๋ญ๋น์ผ ์ ์์ต๋๋ค!
+๋๋ถ๋ถ์ ์ต์ ์ธ์ด ๋ชจ๋ธ์ ํ๋ผ๋ฏธํฐ๋น 2๋ฐ์ดํธ๋ฅผ ์ฌ์ฉํ๋ "bfloat16" ์ ๋ฐ๋(Precision)๋ก ํ์ต๋ฉ๋๋ค.
+ํ๋์จ์ด๊ฐ ์ด๋ฅผ ์ง์ํ๋ ๊ฒฝ์ฐ(Nvidia 30xx/Axxx ์ด์),
+`torch_dtype` ํ๋ผ๋ฏธํฐ๋ก ์์ ๊ฐ์ด `bfloat16` ์ ๋ฐ๋(Precision)๋ก ๋ชจ๋ธ์ ๋ก๋ํ ์ ์์ต๋๋ค.
+
+๋ํ, 16๋นํธ๋ณด๋ค ๋ ๋ฎ์ ์ ๋ฐ๋(Precision)๋ก ๋ชจ๋ธ์ ์์ถํ๋
+"์์ํ(quantization)" ๋ฐฉ๋ฒ์ ์ฌ์ฉํ ์๋ ์์ต๋๋ค.
+์ด ๋ฐฉ๋ฒ์ ๋ชจ๋ธ์ ๊ฐ์ค์น๋ฅผ ์์ค ์์ถํ์ฌ ๊ฐ ํ๋ผ๋ฏธํฐ๋ฅผ 8๋นํธ,
+4๋นํธ ๋๋ ๊ทธ ์ดํ๋ก ์ค์ผ ์ ์์ต๋๋ค.
+ํนํ 4๋นํธ์์ ๋ชจ๋ธ์ ์ถ๋ ฅ์ด ๋ถ์ ์ ์ธ ์ํฅ์ ๋ฐ์ ์ ์์ง๋ง,
+๋ ํฌ๊ณ ๊ฐ๋ ฅํ ์ฑํ
๋ชจ๋ธ์ ๋ฉ๋ชจ๋ฆฌ์ ์ฌ๋ฆฌ๊ธฐ ์ํด ์ด ๊ฐ์ ํธ๋ ์ด๋์คํ๋ฅผ ๊ฐ์ํ ๊ฐ์น๊ฐ ์์ต๋๋ค.
+์ด์ `bitsandbytes`๋ฅผ ์ฌ์ฉํ์ฌ ์ด๋ฅผ ์ค์ ๋ก ํ์ธํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_8bit=True) # You can also try load_in_4bit
+model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto", quantization_config=quantization_config)
+```
+
+์์ ์์
์ `pipeline` API์๋ ์ ์ฉ ๊ฐ๋ฅํฉ๋๋ค:
+
+```python
+from transformers import pipeline, BitsAndBytesConfig
+
+quantization_config = BitsAndBytesConfig(load_in_8bit=True) # You can also try load_in_4bit
+pipe = pipeline("text-generation", "meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto", model_kwargs={"quantization_config": quantization_config})
+```
+
+`bitsandbytes` ์ธ์๋ ๋ชจ๋ธ์ ์์ํํ๋ ๋ค์ํ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค.
+์์ธํ ๋ด์ฉ์ [Quantization guide](./quantization)๋ฅผ ์ฐธ์กฐํด ์ฃผ์ธ์.
+
+
+### ์ฑ๋ฅ ๊ณ ๋ ค์ฌํญ[[performance-considerations]]
+
+
+
+์ธ์ด ๋ชจ๋ธ ์ฑ๋ฅ๊ณผ ์ต์ ํ์ ๋ํ ๋ณด๋ค ์์ธํ ๊ฐ์ด๋๋ [LLM Inference Optimization](./llm_optims)์ ์ฐธ๊ณ ํ์ธ์.
+
+
+
+
+์ผ๋ฐ์ ์ผ๋ก ๋ ํฐ ์ฑํ
๋ชจ๋ธ์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋ ๋ง์ด ์๊ตฌํ๊ณ ,
+์๋๋ ๋๋ ค์ง๋ ๊ฒฝํฅ์ด ์์ต๋๋ค. ๊ตฌ์ฒด์ ์ผ๋ก ๋งํ์๋ฉด,
+์ฑํ
๋ชจ๋ธ์์ ํ
์คํธ๋ฅผ ์์ฑํ ๋๋ ์ปดํจํ
ํ์๋ณด๋ค **๋ฉ๋ชจ๋ฆฌ ๋์ญํญ**์ด ๋ณ๋ชฉ ํ์์ ์ผ์ผํค๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค.
+์ด๋ ๋ชจ๋ธ์ด ํ ํฐ์ ํ๋์ฉ ์์ฑํ ๋๋ง๋ค ํ๋ผ๋ฏธํฐ๋ฅผ ๋ฉ๋ชจ๋ฆฌ์์ ์ฝ์ด์ผ ํ๊ธฐ ๋๋ฌธ์
๋๋ค.
+๋ฐ๋ผ์ ์ฑํ
๋ชจ๋ธ์์ ์ด๋น ์์ฑํ ์ ์๋ ํ ํฐ ์๋ ๋ชจ๋ธ์ด ์์นํ ๋ฉ๋ชจ๋ฆฌ์ ๋์ญํญ์ ๋ชจ๋ธ์ ํฌ๊ธฐ๋ก ๋๋ ๊ฐ์ ๋น๋กํฉ๋๋ค.
+
+์์ ์์ ์์๋ ๋ชจ๋ธ์ด bfloat16 ์ ๋ฐ๋(Precision)๋ก ๋ก๋๋ ๋ ์ฉ๋์ด ์ฝ 16GB์์ต๋๋ค.
+์ด ๊ฒฝ์ฐ, ๋ชจ๋ธ์ด ์์ฑํ๋ ๊ฐ ํ ํฐ๋ง๋ค 16GB๋ฅผ ๋ฉ๋ชจ๋ฆฌ์์ ์ฝ์ด์ผ ํ๋ค๋ ์๋ฏธ์
๋๋ค.
+์ด ๋ฉ๋ชจ๋ฆฌ ๋์ญํญ์ ์๋น์์ฉ CPU์์๋ 20-100GB/sec,
+์๋น์์ฉ GPU๋ Intel Xeon, AMD Threadripper/Epyc,
+์ ํ ์ค๋ฆฌ์ฝ๊ณผ ๊ฐ์ ํน์ CPU์์๋ 200-900GB/sec,
+๋ฐ์ดํฐ ์ผํฐ GPU์ธ Nvidia A100์ด๋ H100์์๋ ์ต๋ 2-3TB/sec์ ์ด๋ฅผ ์ ์์ต๋๋ค.
+์ด๋ฌํ ์ ๋ณด๋ ๊ฐ์ ํ๋์จ์ด์์ ์์ฑ ์๋๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋ ๊ฒ์
๋๋ค.
+
+๋ฐ๋ผ์ ํ
์คํธ ์์ฑ ์๋๋ฅผ ๊ฐ์ ํ๋ ค๋ฉด ๊ฐ์ฅ ๊ฐ๋จํ ๋ฐฉ๋ฒ์ ๋ชจ๋ธ์ ํฌ๊ธฐ๋ฅผ ์ค์ด๊ฑฐ๋(์ฃผ๋ก ์์ํ๋ฅผ ์ฌ์ฉ),
+๋ฉ๋ชจ๋ฆฌ ๋์ญํญ์ด ๋ ๋์ ํ๋์จ์ด๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์
๋๋ค.
+์ด ๋์ญํญ ๋ณ๋ชฉ ํ์์ ํผํ ์ ์๋ ๊ณ ๊ธ ๊ธฐ์ ๋ ์ฌ๋ฌ ๊ฐ์ง ์์ต๋๋ค.
+๊ฐ์ฅ ์ผ๋ฐ์ ์ธ ๋ฐฉ๋ฒ์ [๋ณด์กฐ ์์ฑ](https://huggingface.co/blog/assisted-generation), "์ถ์ธก ์ํ๋ง"์ด๋ผ๊ณ ๋ถ๋ฆฌ๋ ๊ธฐ์ ์
๋๋ค.
+์ด ๊ธฐ์ ์ ์ข
์ข
๋ ์์ "์ด์ ๋ชจ๋ธ"์ ์ฌ์ฉํ์ฌ ์ฌ๋ฌ ๊ฐ์ ๋ฏธ๋ ํ ํฐ์ ํ ๋ฒ์ ์ถ์ธกํ ํ,
+์ฑํ
๋ชจ๋ธ๋ก ์์ฑ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํฉ๋๋ค.
+๋ง์ฝ ์ฑํ
๋ชจ๋ธ์ด ์ถ์ธก์ ํ์ธํ๋ฉด, ํ ๋ฒ์ ์์ ํ์์ ์ฌ๋ฌ ๊ฐ์ ํ ํฐ์ ์์ฑํ ์ ์์ด
+๋ณ๋ชฉ ํ์์ด ํฌ๊ฒ ์ค์ด๋ค๊ณ ์์ฑ ์๋๊ฐ ๋นจ๋ผ์ง๋๋ค.
+
+๋ง์ง๋ง์ผ๋ก, "Mixture of Experts" (MoE) ๋ชจ๋ธ์ ๋ํด์๋ ์ง๊ณ ๋์ด๊ฐ ๋ณด๋๋ก ํฉ๋๋ค.
+Mixtral, Qwen-MoE, DBRX์ ๊ฐ์ ์ธ๊ธฐ ์๋ ์ฑํ
๋ชจ๋ธ์ด ๋ฐ๋ก MoE ๋ชจ๋ธ์
๋๋ค.
+์ด ๋ชจ๋ธ๋ค์ ํ ํฐ์ ์์ฑํ ๋ ๋ชจ๋ ํ๋ผ๋ฏธํฐ๊ฐ ์ฌ์ฉ๋์ง ์์ต๋๋ค.
+์ด๋ก ์ธํด MoE ๋ชจ๋ธ์ ์ ์ฒด ํฌ๊ธฐ๊ฐ ์๋นํ ํด ์ ์์ง๋ง,
+์ฐจ์งํ๋ ๋ฉ๋ชจ๋ฆฌ ๋์ญํญ์ ๋ฎ์ ํธ์
๋๋ค.
+๋ฐ๋ผ์ ๋์ผํ ํฌ๊ธฐ์ ์ผ๋ฐ "์กฐ๋ฐํ(Dense)" ๋ชจ๋ธ๋ณด๋ค ๋ช ๋ฐฐ ๋น ๋ฅผ ์ ์์ต๋๋ค.
+ํ์ง๋ง ๋ณด์กฐ ์์ฑ๊ณผ ๊ฐ์ ๊ธฐ์ ์ MoE ๋ชจ๋ธ์์ ๋นํจ์จ์ ์ผ ์ ์์ต๋๋ค.
+์๋ก์ด ์ถ์ธก๋ ํ ํฐ์ด ์ถ๊ฐ๋๋ฉด์ ๋ ๋ง์ ํ๋ผ๋ฏธํฐ๊ฐ ํ์ฑํ๋๊ธฐ ๋๋ฌธ์,
+MoE ์ํคํ
์ฒ๊ฐ ์ ๊ณตํ๋ ์๋ ์ด์ ์ด ์์๋ ์ ์์ต๋๋ค.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/create_a_model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/create_a_model.md
new file mode 100644
index 0000000000000000000000000000000000000000..b911669bb174b96ac8b43c9c9490bc16b75f3a7e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/create_a_model.md
@@ -0,0 +1,388 @@
+
+
+# ๋ง์ถคํ ์ํคํ
์ฒ ๋ง๋ค๊ธฐ[[create-a-custom-architecture]]
+
+[`AutoClass`](model_doc/auto)๋ ๋ชจ๋ธ ์ํคํ
์ฒ๋ฅผ ์๋์ผ๋ก ์ถ๋ก ํ๊ณ ๋ฏธ๋ฆฌ ํ์ต๋ configuration๊ณผ ๊ฐ์ค์น๋ฅผ ๋ค์ด๋ก๋ํฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ์ฒดํฌํฌ์ธํธ์ ๊ตฌ์ ๋ฐ์ง ์๋ ์ฝ๋๋ฅผ ์์ฑํ๋ ค๋ฉด `AutoClass`๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค. ํ์ง๋ง ํน์ ๋ชจ๋ธ ํ๋ผ๋ฏธํฐ๋ฅผ ๋ณด๋ค ์ธ๋ฐํ๊ฒ ์ ์ดํ๊ณ ์ ํ๋ ์ฌ์ฉ์๋ ๋ช ๊ฐ์ง ๊ธฐ๋ณธ ํด๋์ค๋ง์ผ๋ก ์ปค์คํ
๐ค Transformers ๋ชจ๋ธ์ ์์ฑํ ์ ์์ต๋๋ค. ์ด๋ ๐ค Transformers ๋ชจ๋ธ์ ์ฐ๊ตฌ, ๊ต์ก ๋๋ ์คํํ๋ ๋ฐ ๊ด์ฌ์ด ์๋ ๋ชจ๋ ์ฌ์ฉ์์๊ฒ ํนํ ์ ์ฉํ ์ ์์ต๋๋ค. ์ด ๊ฐ์ด๋์์๋ 'AutoClass'๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ์ปค์คํ
๋ชจ๋ธ์ ๋ง๋๋ ๋ฐฉ๋ฒ์ ๋ํด ์์๋ณด๊ฒ ์ต๋๋ค:
+
+- ๋ชจ๋ธ configuration์ ๊ฐ์ ธ์ค๊ณ ์ฌ์ฉ์ ์ง์ ํฉ๋๋ค.
+- ๋ชจ๋ธ ์ํคํ
์ฒ๋ฅผ ์์ฑํฉ๋๋ค.
+- ํ
์คํธ์ ์ฌ์ฉํ ๋๋ฆฌ๊ฑฐ๋ ๋น ๋ฅธ ํ ํฐํ๊ธฐ๋ฅผ ๋ง๋ญ๋๋ค.
+- ๋น์ ์์
์ ์ํ ์ด๋ฏธ์ง ํ๋ก์ธ์๋ฅผ ์์ฑํฉ๋๋ค.
+- ์ค๋์ค ์์
์ ์ํ ํน์ฑ ์ถ์ถ๊ธฐ๋ฅผ ์์ฑํฉ๋๋ค.
+- ๋ฉํฐ๋ชจ๋ฌ ์์
์ฉ ํ๋ก์ธ์๋ฅผ ์์ฑํฉ๋๋ค.
+
+## Configuration[[configuration]]
+
+[configuration](main_classes/configuration)์ ๋ชจ๋ธ์ ํน์ ์์ฑ์ ๋ํ๋
๋๋ค. ๊ฐ ๋ชจ๋ธ ๊ตฌ์ฑ์๋ ์๋ก ๋ค๋ฅธ ์์ฑ์ด ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ๋ชจ๋ NLP ๋ชจ๋ธ์๋ `hidden_size`, `num_attention_heads`, `num_hidden_layers` ๋ฐ `vocab_size` ์์ฑ์ด ๊ณตํต์ผ๋ก ์์ต๋๋ค. ์ด๋ฌํ ์์ฑ์ ๋ชจ๋ธ์ ๊ตฌ์ฑํ attention heads ๋๋ hidden layers์ ์๋ฅผ ์ง์ ํฉ๋๋ค.
+
+[DistilBERT](model_doc/distilbert) ์์ฑ์ ๊ฒ์ฌํ๊ธฐ ์ํด [`DistilBertConfig`]์ ์ ๊ทผํ์ฌ ์์ธํ ์ดํด๋ด
๋๋ค:
+
+```py
+>>> from transformers import DistilBertConfig
+
+>>> config = DistilBertConfig()
+>>> print(config)
+DistilBertConfig {
+ "activation": "gelu",
+ "attention_dropout": 0.1,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+[`DistilBertConfig`]๋ ๊ธฐ๋ณธ [`DistilBertModel`]์ ๋น๋ํ๋ ๋ฐ ์ฌ์ฉ๋๋ ๋ชจ๋ ๊ธฐ๋ณธ ์์ฑ์ ํ์ํฉ๋๋ค. ๋ชจ๋ ์์ฑ์ ์ปค์คํฐ๋ง์ด์ง์ด ๊ฐ๋ฅํ๋ฏ๋ก ์คํ์ ์ํ ๊ณต๊ฐ์ ๋ง๋ค ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ๊ธฐ๋ณธ ๋ชจ๋ธ์ ๋ค์๊ณผ ๊ฐ์ด ์ปค์คํฐ๋ง์ด์ฆํ ์ ์์ต๋๋ค:
+
+- `activation` ํ๋ผ๋ฏธํฐ๋ก ๋ค๋ฅธ ํ์ฑํ ํจ์๋ฅผ ์ฌ์ฉํด ๋ณด์ธ์.
+- `attention_dropout` ํ๋ผ๋ฏธํฐ๋ฅผ ์ฌ์ฉํ์ฌ ์ดํ
์
ํ๋ฅ ์ ๋ ๋์ ๋๋กญ์์ ๋น์จ์ ์ฌ์ฉํ์ธ์.
+
+```py
+>>> my_config = DistilBertConfig(activation="relu", attention_dropout=0.4)
+>>> print(my_config)
+DistilBertConfig {
+ "activation": "relu",
+ "attention_dropout": 0.4,
+ "dim": 768,
+ "dropout": 0.1,
+ "hidden_dim": 3072,
+ "initializer_range": 0.02,
+ "max_position_embeddings": 512,
+ "model_type": "distilbert",
+ "n_heads": 12,
+ "n_layers": 6,
+ "pad_token_id": 0,
+ "qa_dropout": 0.1,
+ "seq_classif_dropout": 0.2,
+ "sinusoidal_pos_embds": false,
+ "transformers_version": "4.16.2",
+ "vocab_size": 30522
+}
+```
+
+์ฌ์ ํ์ต๋ ๋ชจ๋ธ ์์ฑ์ [`~PretrainedConfig.from_pretrained`] ํจ์์์ ์์ ํ ์ ์์ต๋๋ค:
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("distilbert/distilbert-base-uncased", activation="relu", attention_dropout=0.4)
+```
+
+๋ชจ๋ธ ๊ตฌ์ฑ์ด ๋ง์กฑ์ค๋ฌ์ฐ๋ฉด [`~PretrainedConfig.save_pretrained`]๋ก ์ ์ฅํ ์ ์์ต๋๋ค. ์ค์ ํ์ผ์ ์ง์ ๋ ์์
๊ฒฝ๋ก์ JSON ํ์ผ๋ก ์ ์ฅ๋ฉ๋๋ค:
+
+```py
+>>> my_config.save_pretrained(save_directory="./your_model_save_path")
+```
+
+configuration ํ์ผ์ ์ฌ์ฌ์ฉํ๋ ค๋ฉด [`~PretrainedConfig.from_pretrained`]๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ ธ์ค์ธ์:
+
+```py
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/config.json")
+```
+
+
+
+configuration ํ์ผ์ ๋์
๋๋ฆฌ๋ก ์ ์ฅํ๊ฑฐ๋ ์ฌ์ฉ์ ์ ์ configuration ์์ฑ๊ณผ ๊ธฐ๋ณธ configuration ์์ฑ์ ์ฐจ์ด์ ๋ง ์ ์ฅํ ์๋ ์์ต๋๋ค! ์์ธํ ๋ด์ฉ์ [configuration](main_classes/configuration) ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+
+
+## ๋ชจ๋ธ[[model]]
+
+๋ค์ ๋จ๊ณ๋ [๋ชจ๋ธ(model)](main_classes/models)์ ๋ง๋๋ ๊ฒ์
๋๋ค. ๋์จํ๊ฒ ์ํคํ
์ฒ๋ผ๊ณ ๋ ๋ถ๋ฆฌ๋ ๋ชจ๋ธ์ ๊ฐ ๊ณ์ธต์ด ์ํํ๋ ๋์๊ณผ ๋ฐ์ํ๋ ์์
์ ์ ์ํฉ๋๋ค. configuration์ `num_hidden_layers`์ ๊ฐ์ ์์ฑ์ ์ํคํ
์ฒ๋ฅผ ์ ์ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค. ๋ชจ๋ ๋ชจ๋ธ์ ๊ธฐ๋ณธ ํด๋์ค [`PreTrainedModel`]๊ณผ ์
๋ ฅ ์๋ฒ ๋ฉ ํฌ๊ธฐ ์กฐ์ ๋ฐ ์
ํ ์ดํ
์
ํค๋ ๊ฐ์ง ์น๊ธฐ์ ๊ฐ์ ๋ช ๊ฐ์ง ์ผ๋ฐ์ ์ธ ๋ฉ์๋๋ฅผ ๊ณต์ ํฉ๋๋ค. ๋ํ ๋ชจ๋ ๋ชจ๋ธ์ [`torch.nn.Module`](https://pytorch.org/docs/stable/generated/torch.nn.Module.html), [`tf.keras.Model`](https://www.tensorflow.org/api_docs/python/tf/keras/Model) ๋๋ [`flax.linen.Module`](https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html)์ ์๋ธํด๋์ค์ด๊ธฐ๋ ํฉ๋๋ค. ์ฆ, ๋ชจ๋ธ์ ๊ฐ ํ๋ ์์ํฌ์ ์ฌ์ฉ๋ฒ๊ณผ ํธํ๋ฉ๋๋ค.
+
+
+
+์ฌ์ฉ์ ์ง์ configuration ์์ฑ์ ๋ชจ๋ธ์ ๊ฐ์ ธ์ต๋๋ค:
+
+```py
+>>> from transformers import DistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/config.json")
+>>> model = DistilBertModel(my_config)
+```
+
+์ด์ ์ฌ์ ํ์ต๋ ๊ฐ์ค์น ๋์ ์์์ ๊ฐ์ ๊ฐ์ง ๋ชจ๋ธ์ด ์์ฑ๋ฉ๋๋ค. ์ด ๋ชจ๋ธ์ ํ๋ จํ๊ธฐ ์ ๊น์ง๋ ์ ์ฉํ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค. ํ๋ จ์ ๋น์ฉ๊ณผ ์๊ฐ์ด ๋ง์ด ์์๋๋ ํ๋ก์ธ์ค์
๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ํ๋ จ์ ํ์ํ ๋ฆฌ์์ค์ ์ผ๋ถ๋ง ์ฌ์ฉํ๋ฉด์ ๋ ๋์ ๊ฒฐ๊ณผ๋ฅผ ๋ ๋นจ๋ฆฌ ์ป์ผ๋ ค๋ฉด ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ [`~PreTrainedModel.from_pretrained`]๋ก ์์ฑํฉ๋๋ค:
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+๐ค Transformers์์ ์ ๊ณตํ ๋ชจ๋ธ์ ์ฌ์ ํ์ต๋ ๊ฐ์ค์น๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๋ชจ๋ธ configuration์ ์๋์ผ๋ก ๋ถ๋ฌ์ต๋๋ค. ๊ทธ๋ฌ๋ ์ํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๋ชจ๋ธ configuration ์์ฑ์ ์ผ๋ถ ๋๋ ์ ๋ถ๋ฅผ ์ฌ์ฉ์ ์ง์ ์ผ๋ก ๋ฐ๊ฟ ์ ์์ต๋๋ค:
+
+```py
+>>> model = DistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+์ฌ์ฉ์ ์ง์ configuration ์์ฑ์ ๋ชจ๋ธ์ ๋ถ๋ฌ์ต๋๋ค:
+
+```py
+>>> from transformers import TFDistilBertModel
+
+>>> my_config = DistilBertConfig.from_pretrained("./your_model_save_path/my_config.json")
+>>> tf_model = TFDistilBertModel(my_config)
+```
+
+์ด์ ์ฌ์ ํ์ต๋ ๊ฐ์ค์น ๋์ ์์์ ๊ฐ์ ๊ฐ์ง ๋ชจ๋ธ์ด ์์ฑ๋ฉ๋๋ค. ์ด ๋ชจ๋ธ์ ํ๋ จํ๊ธฐ ์ ๊น์ง๋ ์ ์ฉํ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค. ํ๋ จ์ ๋น์ฉ๊ณผ ์๊ฐ์ด ๋ง์ด ์์๋๋ ํ๋ก์ธ์ค์
๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ํ๋ จ์ ํ์ํ ๋ฆฌ์์ค์ ์ผ๋ถ๋ง ์ฌ์ฉํ๋ฉด์ ๋ ๋์ ๊ฒฐ๊ณผ๋ฅผ ๋ ๋นจ๋ฆฌ ์ป์ผ๋ ค๋ฉด ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ [`~TFPreTrainedModel.from_pretrained`]๋ก ์์ฑํฉ๋๋ค:
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+๐ค Transformers์์ ์ ๊ณตํ ๋ชจ๋ธ์ ์ฌ์ ํ์ต๋ ๊ฐ์ค์น๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๋ชจ๋ธ configuration์ ์๋์ผ๋ก ๋ถ๋ฌ์ต๋๋ค. ๊ทธ๋ฌ๋ ์ํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๋ชจ๋ธ configuration ์์ฑ์ ์ผ๋ถ ๋๋ ์ ๋ถ๋ฅผ ์ฌ์ฉ์ ์ง์ ์ผ๋ก ๋ฐ๊ฟ ์ ์์ต๋๋ค:
+
+```py
+>>> tf_model = TFDistilBertModel.from_pretrained("distilbert/distilbert-base-uncased", config=my_config)
+```
+
+
+
+### ๋ชจ๋ธ ํค๋[[model-heads]]
+
+์ด ์์ ์์ *์๋ ์ํ(hidden state)*๋ฅผ ์ถ๋ ฅํ๋ ๊ธฐ๋ณธ DistilBERT ๋ชจ๋ธ์ ๊ฐ๊ฒ ๋ฉ๋๋ค. ์๋ ์ํ๋ ์ต์ข
์ถ๋ ฅ์ ์์ฑํ๊ธฐ ์ํด ๋ชจ๋ธ ํค๋์ ์
๋ ฅ์ผ๋ก ์ ๋ฌ๋ฉ๋๋ค. ๐ค Transformers๋ ๋ชจ๋ธ์ด ํด๋น ์์
์ ์ง์ํ๋ ํ ๊ฐ ์์
๋ง๋ค ๋ค๋ฅธ ๋ชจ๋ธ ํค๋๋ฅผ ์ ๊ณตํฉ๋๋ค(์ฆ, ๋ฒ์ญ๊ณผ ๊ฐ์ ์ํ์ค ๊ฐ ์์
์๋ DistilBERT๋ฅผ ์ฌ์ฉํ ์ ์์).
+
+
+
+์๋ฅผ ๋ค์ด, [`DistilBertForSequenceClassification`]์ ์ํ์ค ๋ถ๋ฅ ํค๋๊ฐ ์๋ ๊ธฐ๋ณธ DistilBERT ๋ชจ๋ธ์
๋๋ค. ์ํ์ค ๋ถ๋ฅ ํค๋๋ ํ๋ง๋ ์ถ๋ ฅ ์์ ์๋ ์ ํ ๋ ์ด์ด์
๋๋ค.
+
+```py
+>>> from transformers import DistilBertForSequenceClassification
+
+>>> model = DistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+๋ค๋ฅธ ๋ชจ๋ธ ํค๋๋ก ์ ํํ์ฌ ์ด ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ค๋ฅธ ์์
์ ์ฝ๊ฒ ์ฌ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ง์์๋ต ์์
์ ๊ฒฝ์ฐ, [`DistilBertForQuestionAnswering`] ๋ชจ๋ธ ํค๋๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ง์์๋ต ํค๋๋ ์จ๊ฒจ์ง ์ํ ์ถ๋ ฅ ์์ ์ ํ ๋ ์ด์ด๊ฐ ์๋ค๋ ์ ์ ์ ์ธํ๋ฉด ์ํ์ค ๋ถ๋ฅ ํค๋์ ์ ์ฌํฉ๋๋ค.
+
+```py
+>>> from transformers import DistilBertForQuestionAnswering
+
+>>> model = DistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+์๋ฅผ ๋ค์ด, [`TFDistilBertForSequenceClassification`]์ ์ํ์ค ๋ถ๋ฅ ํค๋๊ฐ ์๋ ๊ธฐ๋ณธ DistilBERT ๋ชจ๋ธ์
๋๋ค. ์ํ์ค ๋ถ๋ฅ ํค๋๋ ํ๋ง๋ ์ถ๋ ฅ ์์ ์๋ ์ ํ ๋ ์ด์ด์
๋๋ค.
+
+```py
+>>> from transformers import TFDistilBertForSequenceClassification
+
+>>> tf_model = TFDistilBertForSequenceClassification.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+๋ค๋ฅธ ๋ชจ๋ธ ํค๋๋ก ์ ํํ์ฌ ์ด ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ค๋ฅธ ์์
์ ์ฝ๊ฒ ์ฌ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ง์์๋ต ์์
์ ๊ฒฝ์ฐ, [`TFDistilBertForQuestionAnswering`] ๋ชจ๋ธ ํค๋๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ง์์๋ต ํค๋๋ ์จ๊ฒจ์ง ์ํ ์ถ๋ ฅ ์์ ์ ํ ๋ ์ด์ด๊ฐ ์๋ค๋ ์ ์ ์ ์ธํ๋ฉด ์ํ์ค ๋ถ๋ฅ ํค๋์ ์ ์ฌํฉ๋๋ค.
+
+```py
+>>> from transformers import TFDistilBertForQuestionAnswering
+
+>>> tf_model = TFDistilBertForQuestionAnswering.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+## ํ ํฌ๋์ด์ [[tokenizer]]
+
+ํ
์คํธ ๋ฐ์ดํฐ์ ๋ชจ๋ธ์ ์ฌ์ฉํ๊ธฐ ์ ์ ๋ง์ง๋ง์ผ๋ก ํ์ํ ๊ธฐ๋ณธ ํด๋์ค๋ ์์ ํ
์คํธ๋ฅผ ํ
์๋ก ๋ณํํ๋ [ํ ํฌ๋์ด์ ](main_classes/tokenizer)์
๋๋ค. ๐ค Transformers์ ์ฌ์ฉํ ์ ์๋ ํ ํฌ๋์ด์ ๋ ๋ ๊ฐ์ง ์ ํ์ด ์์ต๋๋ค:
+
+- [`PreTrainedTokenizer`]: ํ์ด์ฌ์ผ๋ก ๊ตฌํ๋ ํ ํฌ๋์ด์ ์
๋๋ค.
+- [`PreTrainedTokenizerFast`]: Rust ๊ธฐ๋ฐ [๐ค Tokenizer](https://huggingface.co/docs/tokenizers/python/latest/) ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ๋ง๋ค์ด์ง ํ ํฌ๋์ด์ ์
๋๋ค. ์ด ํ ํฌ๋์ด์ ๋ Rust๋ก ๊ตฌํ๋์ด ๋ฐฐ์น ํ ํฐํ์์ ํนํ ๋น ๋ฆ
๋๋ค. ๋น ๋ฅธ ํ ํฌ๋์ด์ ๋ ํ ํฐ์ ์๋ ๋จ์ด๋ ๋ฌธ์์ ๋งคํํ๋ *์คํ์
๋งคํ*๊ณผ ๊ฐ์ ์ถ๊ฐ ๋ฉ์๋๋ ์ ๊ณตํฉ๋๋ค.
+๋ ํ ํฌ๋์ด์ ๋ชจ๋ ์ธ์ฝ๋ฉ ๋ฐ ๋์ฝ๋ฉ, ์ ํ ํฐ ์ถ๊ฐ, ํน์ ํ ํฐ ๊ด๋ฆฌ์ ๊ฐ์ ์ผ๋ฐ์ ์ธ ๋ฐฉ๋ฒ์ ์ง์ํฉ๋๋ค.
+
+
+
+๋ชจ๋ ๋ชจ๋ธ์ด ๋น ๋ฅธ ํ ํฌ๋์ด์ ๋ฅผ ์ง์ํ๋ ๊ฒ์ ์๋๋๋ค. ์ด [ํ](index#supported-frameworks)์์ ๋ชจ๋ธ์ ๋น ๋ฅธ ํ ํฌ๋์ด์ ์ง์ ์ฌ๋ถ๋ฅผ ํ์ธํ์ธ์.
+
+
+
+ํ ํฌ๋์ด์ ๋ฅผ ์ง์ ํ์ตํ ๊ฒฝ์ฐ, *์ดํ(vocabulary)* ํ์ผ์์ ํ ํฌ๋์ด์ ๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค:
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> my_tokenizer = DistilBertTokenizer(vocab_file="my_vocab_file.txt", do_lower_case=False, padding_side="left")
+```
+
+์ฌ์ฉ์ ์ง์ ํ ํฌ๋์ด์ ์ ์ดํ๋ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ํ ํฌ๋์ด์ ์์ ์์ฑ๋ ์ดํ์ ๋ค๋ฅผ ์ ์๋ค๋ ์ ์ ๊ธฐ์ตํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ์ดํ๋ฅผ ์ฌ์ฉํด์ผ ํ๋ฉฐ, ๊ทธ๋ ์ง ์์ผ๋ฉด ์
๋ ฅ์ด ์๋ฏธ๋ฅผ ๊ฐ์ง ๋ชปํฉ๋๋ค. [`DistilBertTokenizer`] ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ์ดํ๋ก ํ ํฌ๋์ด์ ๋ฅผ ์์ฑํฉ๋๋ค:
+
+```py
+>>> from transformers import DistilBertTokenizer
+
+>>> slow_tokenizer = DistilBertTokenizer.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+[`DistilBertTokenizerFast`] ํด๋์ค๋ก ๋น ๋ฅธ ํ ํฌ๋์ด์ ๋ฅผ ์์ฑํฉ๋๋ค:
+
+```py
+>>> from transformers import DistilBertTokenizerFast
+
+>>> fast_tokenizer = DistilBertTokenizerFast.from_pretrained("distilbert/distilbert-base-uncased")
+```
+
+
+
+[`AutoTokenizer`]๋ ๊ธฐ๋ณธ์ ์ผ๋ก ๋น ๋ฅธ ํ ํฌ๋์ด์ ๋ฅผ ๊ฐ์ ธ์ค๋ ค๊ณ ํฉ๋๋ค. ์ด ๋์์ ๋นํ์ฑํํ๋ ค๋ฉด `from_pretrained`์์ `use_fast=False`๋ฅผ ์ค์ ํ๋ฉด ๋ฉ๋๋ค.
+
+
+
+## ์ด๋ฏธ์ง ํ๋ก์ธ์[[image-processor]]
+
+์ด๋ฏธ์ง ํ๋ก์ธ์(image processor)๋ ๋น์ ์
๋ ฅ์ ์ฒ๋ฆฌํฉ๋๋ค. ๊ธฐ๋ณธ [`~image_processing_utils.ImageProcessingMixin`] ํด๋์ค์์ ์์ํฉ๋๋ค.
+
+์ฌ์ฉํ๋ ค๋ฉด ์ฌ์ฉ ์ค์ธ ๋ชจ๋ธ๊ณผ ์ฐ๊ฒฐ๋ ์ด๋ฏธ์ง ํ๋ก์ธ์๋ฅผ ์์ฑํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์ด๋ฏธ์ง ๋ถ๋ฅ์ [ViT](model_doc/vit)๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ [`ViTImageProcessor`]๋ฅผ ์์ฑํฉ๋๋ค:
+
+```py
+>>> from transformers import ViTImageProcessor
+
+>>> vit_extractor = ViTImageProcessor()
+>>> print(vit_extractor)
+ViTImageProcessor {
+ "do_normalize": true,
+ "do_resize": true,
+ "feature_extractor_type": "ViTImageProcessor",
+ "image_mean": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": 2,
+ "size": 224
+}
+```
+
+
+
+์ฌ์ฉ์ ์ง์ ์ ์ํ์ง ์๋ ๊ฒฝ์ฐ `from_pretrained` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ๊ธฐ๋ณธ ์ด๋ฏธ์ง ํ๋ก์ธ์ ๋งค๊ฐ๋ณ์๋ฅผ ๋ถ๋ฌ์ค๋ฉด ๋ฉ๋๋ค.
+
+
+
+์ฌ์ฉ์ ์ง์ ์ด๋ฏธ์ง ํ๋ก์ธ์๋ฅผ ์์ฑํ๋ ค๋ฉด [`ViTImageProcessor`] ํ๋ผ๋ฏธํฐ๋ฅผ ์์ ํฉ๋๋ค:
+
+```py
+>>> from transformers import ViTImageProcessor
+
+>>> my_vit_extractor = ViTImageProcessor(resample="PIL.Image.BOX", do_normalize=False, image_mean=[0.3, 0.3, 0.3])
+>>> print(my_vit_extractor)
+ViTImageProcessor {
+ "do_normalize": false,
+ "do_resize": true,
+ "feature_extractor_type": "ViTImageProcessor",
+ "image_mean": [
+ 0.3,
+ 0.3,
+ 0.3
+ ],
+ "image_std": [
+ 0.5,
+ 0.5,
+ 0.5
+ ],
+ "resample": "PIL.Image.BOX",
+ "size": 224
+}
+```
+
+## ํน์ฑ ์ถ์ถ๊ธฐ[[feature-extractor]]
+
+ํน์ฑ ์ถ์ถ๊ธฐ(feature extractor)๋ ์ค๋์ค ์
๋ ฅ์ ์ฒ๋ฆฌํฉ๋๋ค. ๊ธฐ๋ณธ [`~feature_extraction_utils.FeatureExtractionMixin`] ํด๋์ค์์ ์์๋๋ฉฐ, ์ค๋์ค ์
๋ ฅ์ ์ฒ๋ฆฌํ๊ธฐ ์ํด [`SequenceFeatureExtractor`] ํด๋์ค์์ ์์ํ ์๋ ์์ต๋๋ค.
+
+์ฌ์ฉํ๋ ค๋ฉด ์ฌ์ฉ ์ค์ธ ๋ชจ๋ธ๊ณผ ์ฐ๊ฒฐ๋ ํน์ฑ ์ถ์ถ๊ธฐ๋ฅผ ์์ฑํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์ค๋์ค ๋ถ๋ฅ์ [Wav2Vec2](model_doc/wav2vec2)๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ [`Wav2Vec2FeatureExtractor`]๋ฅผ ์์ฑํฉ๋๋ค:
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> w2v2_extractor = Wav2Vec2FeatureExtractor()
+>>> print(w2v2_extractor)
+Wav2Vec2FeatureExtractor {
+ "do_normalize": true,
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
+ "feature_size": 1,
+ "padding_side": "right",
+ "padding_value": 0.0,
+ "return_attention_mask": false,
+ "sampling_rate": 16000
+}
+```
+
+
+
+์ฌ์ฉ์ ์ง์ ์ด ํ์ํ์ง ์์ ๊ฒฝ์ฐ `from_pretrained` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ๊ธฐ๋ณธ ํน์ฑ ์ถ์ถ๊ธฐ ใ
๊ฐ๋ณ์๋ฅผ ๋ถ๋ฌ ์ค๋ฉด ๋ฉ๋๋ค.
+
+
+
+์ฌ์ฉ์ ์ง์ ํน์ฑ ์ถ์ถ๊ธฐ๋ฅผ ๋ง๋ค๋ ค๋ฉด [`Wav2Vec2FeatureExtractor`] ๋งค๊ฐ๋ณ์๋ฅผ ์์ ํฉ๋๋ค:
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> w2v2_extractor = Wav2Vec2FeatureExtractor(sampling_rate=8000, do_normalize=False)
+>>> print(w2v2_extractor)
+Wav2Vec2FeatureExtractor {
+ "do_normalize": false,
+ "feature_extractor_type": "Wav2Vec2FeatureExtractor",
+ "feature_size": 1,
+ "padding_side": "right",
+ "padding_value": 0.0,
+ "return_attention_mask": false,
+ "sampling_rate": 8000
+}
+```
+
+
+## ํ๋ก์ธ์[[processor]]
+
+๋ฉํฐ๋ชจ๋ฌ ์์
์ ์ง์ํ๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ๐ค Transformers๋ ํน์ฑ ์ถ์ถ๊ธฐ ๋ฐ ํ ํฌ๋์ด์ ์ ๊ฐ์ ์ฒ๋ฆฌ ํด๋์ค๋ฅผ ๋จ์ผ ๊ฐ์ฒด๋ก ํธ๋ฆฌํ๊ฒ ๋ํํ๋ ํ๋ก์ธ์ ํด๋์ค๋ฅผ ์ ๊ณตํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์๋ ์์ฑ ์ธ์ ์์
(Automatic Speech Recognition task (ASR))์ [`Wav2Vec2Processor`]๋ฅผ ์ฌ์ฉํ๋ค๊ณ ๊ฐ์ ํด ๋ณด๊ฒ ์ต๋๋ค. ์๋ ์์ฑ ์ธ์ ์์
์ ์ค๋์ค๋ฅผ ํ
์คํธ๋ก ๋ณํํ๋ฏ๋ก ํน์ฑ ์ถ์ถ๊ธฐ์ ํ ํฌ๋์ด์ ๊ฐ ํ์ํฉ๋๋ค.
+
+์ค๋์ค ์
๋ ฅ์ ์ฒ๋ฆฌํ ํน์ฑ ์ถ์ถ๊ธฐ๋ฅผ ๋ง๋ญ๋๋ค:
+
+```py
+>>> from transformers import Wav2Vec2FeatureExtractor
+
+>>> feature_extractor = Wav2Vec2FeatureExtractor(padding_value=1.0, do_normalize=True)
+```
+
+ํ
์คํธ ์
๋ ฅ์ ์ฒ๋ฆฌํ ํ ํฌ๋์ด์ ๋ฅผ ๋ง๋ญ๋๋ค:
+
+```py
+>>> from transformers import Wav2Vec2CTCTokenizer
+
+>>> tokenizer = Wav2Vec2CTCTokenizer(vocab_file="my_vocab_file.txt")
+```
+
+[`Wav2Vec2Processor`]์์ ํน์ฑ ์ถ์ถ๊ธฐ์ ํ ํฌ๋์ด์ ๋ฅผ ๊ฒฐํฉํฉ๋๋ค:
+
+```py
+>>> from transformers import Wav2Vec2Processor
+
+>>> processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)
+```
+
+configuration๊ณผ ๋ชจ๋ธ์ด๋ผ๋ ๋ ๊ฐ์ง ๊ธฐ๋ณธ ํด๋์ค์ ์ถ๊ฐ ์ ์ฒ๋ฆฌ ํด๋์ค(ํ ํฌ๋์ด์ , ์ด๋ฏธ์ง ํ๋ก์ธ์, ํน์ฑ ์ถ์ถ๊ธฐ ๋๋ ํ๋ก์ธ์)๋ฅผ ์ฌ์ฉํ๋ฉด ๐ค Transformers์์ ์ง์ํ๋ ๋ชจ๋ ๋ชจ๋ธ์ ๋ง๋ค ์ ์์ต๋๋ค. ์ด๋ฌํ ๊ฐ ๊ธฐ๋ณธ ํด๋์ค๋ ๊ตฌ์ฑ์ด ๊ฐ๋ฅํ๋ฏ๋ก ์ํ๋ ํน์ ์์ฑ์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ํ์ต์ ์ํด ๋ชจ๋ธ์ ์ฝ๊ฒ ์ค์ ํ๊ฑฐ๋ ๊ธฐ์กด์ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ์์ ํ์ฌ ๋ฏธ์ธ ์กฐ์ ํ ์ ์์ต๋๋ค.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/custom_models.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/custom_models.md
new file mode 100644
index 0000000000000000000000000000000000000000..cb67a535b47d41453e2b5d27fcc67b89a7ab7407
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/custom_models.md
@@ -0,0 +1,346 @@
+
+
+# ์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ ๊ณต์ ํ๊ธฐ[[sharing-custom-models]]
+
+๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ์ฝ๊ฒ ํ์ฅํ ์ ์๋๋ก ์ค๊ณ๋์์ต๋๋ค.
+๋ชจ๋ ๋ชจ๋ธ์ ์ถ์ํ ์์ด ์ ์ฅ์์ ์ง์ ๋ ํ์ ํด๋์ ์์ ํ ์ฝ๋ฉ๋์ด ์์ผ๋ฏ๋ก, ์์ฝ๊ฒ ๋ชจ๋ธ๋ง ํ์ผ์ ๋ณต์ฌํ๊ณ ํ์์ ๋ฐ๋ผ ์กฐ์ ํ ์ ์์ต๋๋ค.
+
+์์ ํ ์๋ก์ด ๋ชจ๋ธ์ ๋ง๋๋ ๊ฒฝ์ฐ์๋ ์ฒ์๋ถํฐ ์์ํ๋ ๊ฒ์ด ๋ ์ฌ์ธ ์ ์์ต๋๋ค.
+์ด ํํ ๋ฆฌ์ผ์์๋ Transformers ๋ด์์ ์ฌ์ฉํ ์ ์๋๋ก ์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ๊ณผ ๊ตฌ์ฑ์ ์์ฑํ๋ ๋ฐฉ๋ฒ๊ณผ
+๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์๋ ๊ฒฝ์ฐ์๋ ๋๊ตฌ๋ ์ฌ์ฉํ ์ ์๋๋ก (์์กด์ฑ๊ณผ ํจ๊ป) ์ปค๋ฎค๋ํฐ์ ๊ณต์ ํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ธ ์ ์์ต๋๋ค.
+
+[timm ๋ผ์ด๋ธ๋ฌ๋ฆฌ](https://github.com/rwightman/pytorch-image-models)์ ResNet ํด๋์ค๋ฅผ [`PreTrainedModel`]๋ก ๋ํํ ResNet ๋ชจ๋ธ์ ์๋ก ๋ชจ๋ ๊ฒ์ ์ค๋ช
ํฉ๋๋ค.
+
+## ์ฌ์ฉ์ ์ ์ ๊ตฌ์ฑ ์์ฑํ๊ธฐ[[writing-a-custom-configuration]]
+
+๋ชจ๋ธ์ ๋ค์ด๊ฐ๊ธฐ ์ ์ ๋จผ์ ๊ตฌ์ฑ์ ์์ฑํด๋ณด๋๋ก ํ๊ฒ ์ต๋๋ค.
+๋ชจ๋ธ์ `configuration`์ ๋ชจ๋ธ์ ๋ง๋ค๊ธฐ ์ํด ํ์ํ ๋ชจ๋ ์ค์ํ ๊ฒ๋ค์ ํฌํจํ๊ณ ์๋ ๊ฐ์ฒด์
๋๋ค.
+๋ค์ ์น์
์์ ๋ณผ ์ ์๋ฏ์ด, ๋ชจ๋ธ์ `config`๋ฅผ ์ฌ์ฉํด์๋ง ์ด๊ธฐํํ ์ ์๊ธฐ ๋๋ฌธ์ ์๋ฒฝํ ๊ตฌ์ฑ์ด ํ์ํฉ๋๋ค.
+
+์๋ ์์์์๋ ResNet ํด๋์ค์ ์ธ์(argument)๋ฅผ ์กฐ์ ํด๋ณด๊ฒ ์ต๋๋ค.
+๋ค๋ฅธ ๊ตฌ์ฑ์ ๊ฐ๋ฅํ ResNet ์ค ๋ค๋ฅธ ์ ํ์ ์ ๊ณตํฉ๋๋ค.
+๊ทธ๋ฐ ๋ค์ ๋ช ๊ฐ์ง ์ ํจ์ฑ์ ํ์ธํ ํ ํด๋น ์ธ์๋ฅผ ์ ์ฅํฉ๋๋ค.
+
+```python
+from transformers import PretrainedConfig
+from typing import List
+
+
+class ResnetConfig(PretrainedConfig):
+ model_type = "resnet"
+
+ def __init__(
+ self,
+ block_type="bottleneck",
+ layers: List[int] = [3, 4, 6, 3],
+ num_classes: int = 1000,
+ input_channels: int = 3,
+ cardinality: int = 1,
+ base_width: int = 64,
+ stem_width: int = 64,
+ stem_type: str = "",
+ avg_down: bool = False,
+ **kwargs,
+ ):
+ if block_type not in ["basic", "bottleneck"]:
+ raise ValueError(f"`block_type` must be 'basic' or bottleneck', got {block_type}.")
+ if stem_type not in ["", "deep", "deep-tiered"]:
+ raise ValueError(f"`stem_type` must be '', 'deep' or 'deep-tiered', got {stem_type}.")
+
+ self.block_type = block_type
+ self.layers = layers
+ self.num_classes = num_classes
+ self.input_channels = input_channels
+ self.cardinality = cardinality
+ self.base_width = base_width
+ self.stem_width = stem_width
+ self.stem_type = stem_type
+ self.avg_down = avg_down
+ super().__init__(**kwargs)
+```
+
+์ฌ์ฉ์ ์ ์ `configuration`์ ์์ฑํ ๋ ๊ธฐ์ตํด์ผ ํ ์ธ ๊ฐ์ง ์ค์ํ ์ฌํญ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+- `PretrainedConfig`์ ์์ํด์ผ ํฉ๋๋ค.
+- `PretrainedConfig`์ `__init__`์ ๋ชจ๋ kwargs๋ฅผ ํ์ฉํด์ผ ํ๊ณ ,
+- ์ด๋ฌํ `kwargs`๋ ์์ ํด๋์ค `__init__`์ ์ ๋ฌ๋์ด์ผ ํฉ๋๋ค.
+
+์์์ ๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ๋ชจ๋ ๊ธฐ๋ฅ์ ๊ฐ์ ธ์ค๋ ๊ฒ์
๋๋ค.
+์ด๋ฌํ ์ ์ผ๋ก๋ถํฐ ๋น๋กฏ๋๋ ๋ ๊ฐ์ง ์ ์ฝ ์กฐ๊ฑด์ `PretrainedConfig`์ ์ค์ ํ๋ ๊ฒ๋ณด๋ค ๋ ๋ง์ ํ๋๊ฐ ์์ต๋๋ค.
+`from_pretrained` ๋ฉ์๋๋ก ๊ตฌ์ฑ์ ๋ค์ ๋ก๋ํ ๋ ํด๋น ํ๋๋ ๊ตฌ์ฑ์์ ์๋ฝํ ํ ์์ ํด๋์ค๋ก ๋ณด๋ด์ผ ํฉ๋๋ค.
+
+๋ชจ๋ธ์ auto ํด๋์ค์ ๋ฑ๋กํ์ง ์๋ ํ, `configuration`์์ `model_type`์ ์ ์(์ฌ๊ธฐ์ `model_type="resnet"`)ํ๋ ๊ฒ์ ํ์ ์ฌํญ์ด ์๋๋๋ค (๋ง์ง๋ง ์น์
์ฐธ์กฐ).
+
+์ด๋ ๊ฒ ํ๋ฉด ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ค๋ฅธ ๋ชจ๋ธ ๊ตฌ์ฑ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ๊ตฌ์ฑ์ ์ฝ๊ฒ ๋ง๋ค๊ณ ์ ์ฅํ ์ ์์ต๋๋ค.
+๋ค์์ resnet50d ๊ตฌ์ฑ์ ์์ฑํ๊ณ ์ ์ฅํ๋ ๋ฐฉ๋ฒ์
๋๋ค:
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d_config.save_pretrained("custom-resnet")
+```
+
+์ด๋ ๊ฒ ํ๋ฉด `custom-resnet` ํด๋ ์์ `config.json`์ด๋ผ๋ ํ์ผ์ด ์ ์ฅ๋ฉ๋๋ค.
+๊ทธ๋ฐ ๋ค์ `from_pretrained` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ๊ตฌ์ฑ์ ๋ค์ ๋ก๋ํ ์ ์์ต๋๋ค.
+
+```py
+resnet50d_config = ResnetConfig.from_pretrained("custom-resnet")
+```
+
+๊ตฌ์ฑ์ Hub์ ์ง์ ์
๋ก๋ํ๊ธฐ ์ํด [`PretrainedConfig`] ํด๋์ค์ [`~PretrainedConfig.push_to_hub`]์ ๊ฐ์ ๋ค๋ฅธ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+
+## ์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ ์์ฑํ๊ธฐ[[writing-a-custom-model]]
+
+์ด์ ResNet ๊ตฌ์ฑ์ด ์์ผ๋ฏ๋ก ๋ชจ๋ธ์ ์์ฑํ ์ ์์ต๋๋ค.
+์ค์ ๋ก๋ ๋ ๊ฐ๋ฅผ ์์ฑํ ๊ฒ์
๋๋ค. ํ๋๋ ์ด๋ฏธ์ง ๋ฐฐ์น์์ hidden features๋ฅผ ์ถ์ถํ๋ ๊ฒ([`BertModel`]๊ณผ ๊ฐ์ด), ๋ค๋ฅธ ํ๋๋ ์ด๋ฏธ์ง ๋ถ๋ฅ์ ์ ํฉํ ๊ฒ์
๋๋ค([`BertForSequenceClassification`]๊ณผ ๊ฐ์ด).
+
+์ด์ ์ ์ธ๊ธํ๋ฏ์ด ์ด ์์ ์์๋ ๋จ์ํ๊ฒ ํ๊ธฐ ์ํด ๋ชจ๋ธ์ ๋์จํ ๋ํผ(loose wrapper)๋ง ์์ฑํ ๊ฒ์
๋๋ค.
+์ด ํด๋์ค๋ฅผ ์์ฑํ๊ธฐ ์ ์ ๋ธ๋ก ์ ํ๊ณผ ์ค์ ๋ธ๋ก ํด๋์ค ๊ฐ์ ๋งคํ ์์
๋ง ํ๋ฉด ๋ฉ๋๋ค.
+๊ทธ๋ฐ ๋ค์ `ResNet` ํด๋์ค๋ก ์ ๋ฌ๋์ด `configuration`์ ํตํด ๋ชจ๋ธ์ด ์ ์ธ๋ฉ๋๋ค:
+
+```py
+from transformers import PreTrainedModel
+from timm.models.resnet import BasicBlock, Bottleneck, ResNet
+from .configuration_resnet import ResnetConfig
+
+
+BLOCK_MAPPING = {"basic": BasicBlock, "bottleneck": Bottleneck}
+
+
+class ResnetModel(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor):
+ return self.model.forward_features(tensor)
+```
+
+์ด๋ฏธ์ง ๋ถ๋ฅ ๋ชจ๋ธ์ ๋ง๋ค๊ธฐ ์ํด์๋ forward ๋ฉ์๋๋ง ๋ณ๊ฒฝํ๋ฉด ๋ฉ๋๋ค:
+
+```py
+import torch
+
+
+class ResnetModelForImageClassification(PreTrainedModel):
+ config_class = ResnetConfig
+
+ def __init__(self, config):
+ super().__init__(config)
+ block_layer = BLOCK_MAPPING[config.block_type]
+ self.model = ResNet(
+ block_layer,
+ config.layers,
+ num_classes=config.num_classes,
+ in_chans=config.input_channels,
+ cardinality=config.cardinality,
+ base_width=config.base_width,
+ stem_width=config.stem_width,
+ stem_type=config.stem_type,
+ avg_down=config.avg_down,
+ )
+
+ def forward(self, tensor, labels=None):
+ logits = self.model(tensor)
+ if labels is not None:
+ loss = torch.nn.functional.cross_entropy(logits, labels)
+ return {"loss": loss, "logits": logits}
+ return {"logits": logits}
+```
+
+๋ ๊ฒฝ์ฐ ๋ชจ๋ `PreTrainedModel`๋ฅผ ์์๋ฐ๊ณ , `config`๋ฅผ ํตํด ์์ ํด๋์ค ์ด๊ธฐํ๋ฅผ ํธ์ถํ๋ค๋ ์ ์ ๊ธฐ์ตํ์ธ์ (์ผ๋ฐ์ ์ธ `torch.nn.Module`์ ์์ฑํ ๋์ ๋น์ทํจ).
+๋ชจ๋ธ์ auto ํด๋์ค์ ๋ฑ๋กํ๊ณ ์ถ์ ๊ฒฝ์ฐ์๋ `config_class`๋ฅผ ์ค์ ํ๋ ๋ถ๋ถ์ด ํ์์
๋๋ค (๋ง์ง๋ง ์น์
์ฐธ์กฐ).
+
+
+
+๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์กด์ฌํ๋ ๋ชจ๋ธ๊ณผ ๊ต์ฅํ ์ ์ฌํ๋ค๋ฉด, ๋ชจ๋ธ์ ์์ฑํ ๋ ๊ตฌ์ฑ์ ์ฐธ์กฐํด ์ฌ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+
+
+์ํ๋ ๊ฒ์ ๋ชจ๋ธ์ด ๋ฐํํ๋๋ก ํ ์ ์์ง๋ง, `ResnetModelForImageClassification`์์ ํ๋ ๊ฒ ์ฒ๋ผ
+๋ ์ด๋ธ์ ํต๊ณผ์์ผฐ์ ๋ ์์ค๊ณผ ํจ๊ป ์ฌ์ ํํ๋ก ๋ฐํํ๋ ๊ฒ์ด [`Trainer`] ํด๋์ค ๋ด์์ ์ง์ ๋ชจ๋ธ์ ์ฌ์ฉํ๊ธฐ์ ์ ์ฉํฉ๋๋ค.
+์์ ๋ง์ ํ์ต ๋ฃจํ ๋๋ ๋ค๋ฅธ ํ์ต ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ ๊ณํ์ด๋ผ๋ฉด ๋ค๋ฅธ ์ถ๋ ฅ ํ์์ ์ฌ์ฉํด๋ ์ข์ต๋๋ค.
+
+์ด์ ๋ชจ๋ธ ํด๋์ค๊ฐ ์์ผ๋ฏ๋ก ํ๋ ์์ฑํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```py
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+```
+
+๋ค์ ๋งํ์ง๋ง, [`~PreTrainedModel.save_pretrained`]๋๋ [`~PreTrainedModel.push_to_hub`]์ฒ๋ผ [`PreTrainedModel`]์ ์ํ๋ ๋ชจ๋ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+๋ค์ ์น์
์์ ๋ ๋ฒ์งธ ๋ฉ์๋๋ฅผ ์ฌ์ฉํด ๋ชจ๋ธ ์ฝ๋์ ๋ชจ๋ธ ๊ฐ์ค์น๋ฅผ ์
๋ก๋ํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+๋จผ์ , ๋ชจ๋ธ ๋ด๋ถ์ ์ฌ์ ํ๋ จ๋ ๊ฐ์ค์น๋ฅผ ๋ก๋ํด ๋ณด๊ฒ ์ต๋๋ค.
+
+์ด ์์ ๋ฅผ ํ์ฉํ ๋๋, ์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ์ ์์ ๋ง์ ๋ฐ์ดํฐ๋ก ํ์ต์ํฌ ๊ฒ์
๋๋ค.
+์ด ํํ ๋ฆฌ์ผ์์๋ ๋น ๋ฅด๊ฒ ์งํํ๊ธฐ ์ํด ์ฌ์ ํ๋ จ๋ resnet50d๋ฅผ ์ฌ์ฉํ๊ฒ ์ต๋๋ค.
+์๋ ๋ชจ๋ธ์ resnet50d์ ๋ํผ์ด๊ธฐ ๋๋ฌธ์, ๊ฐ์ค์น๋ฅผ ์ฝ๊ฒ ๋ก๋ํ ์ ์์ต๋๋ค.
+
+
+```py
+import timm
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+์ด์ [`~PreTrainedModel.save_pretrained`] ๋๋ [`~PreTrainedModel.push_to_hub`]๋ฅผ ์ฌ์ฉํ ๋ ๋ชจ๋ธ ์ฝ๋๊ฐ ์ ์ฅ๋๋์ง ํ์ธํด๋ด
์๋ค.
+
+## Hub๋ก ์ฝ๋ ์
๋ก๋ํ๊ธฐ[[sending-the-code-to-the-hub]]
+
+
+
+์ด API๋ ์คํ์ ์ด๋ฉฐ ๋ค์ ๋ฆด๋ฆฌ์ค์์ ์ฝ๊ฐ์ ๋ณ๊ฒฝ ์ฌํญ์ด ์์ ์ ์์ต๋๋ค.
+
+
+
+๋จผ์ ๋ชจ๋ธ์ด `.py` ํ์ผ์ ์์ ํ ์ ์๋์ด ์๋์ง ํ์ธํ์ธ์.
+๋ชจ๋ ํ์ผ์ด ๋์ผํ ์์
๊ฒฝ๋ก์ ์๊ธฐ ๋๋ฌธ์ ์๋๊ฒฝ๋ก ์ํฌํธ(relative import)์ ์์กดํ ์ ์์ต๋๋ค (transformers์์๋ ์ด ๊ธฐ๋ฅ์ ๋ํ ํ์ ๋ชจ๋์ ์ง์ํ์ง ์์ต๋๋ค).
+์ด ์์์์๋ ์์
๊ฒฝ๋ก ์์ `resnet_model`์์ `modeling_resnet.py` ํ์ผ๊ณผ `configuration_resnet.py` ํ์ผ์ ์ ์ํฉ๋๋ค.
+๊ตฌ์ฑ ํ์ผ์๋ `ResnetConfig`์ ๋ํ ์ฝ๋๊ฐ ์๊ณ ๋ชจ๋ธ๋ง ํ์ผ์๋ `ResnetModel` ๋ฐ `ResnetModelForImageClassification`์ ๋ํ ์ฝ๋๊ฐ ์์ต๋๋ค.
+
+```
+.
+โโโ resnet_model
+ โโโ __init__.py
+ โโโ configuration_resnet.py
+ โโโ modeling_resnet.py
+```
+
+Python์ด `resnet_model`์ ๋ชจ๋๋ก ์ฌ์ฉํ ์ ์๋๋ก ๊ฐ์งํ๋ ๋ชฉ์ ์ด๊ธฐ ๋๋ฌธ์ `__init__.py`๋ ๋น์ด ์์ ์ ์์ต๋๋ค.
+
+
+
+๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ๋ชจ๋ธ๋ง ํ์ผ์ ๋ณต์ฌํ๋ ๊ฒฝ์ฐ,
+๋ชจ๋ ํ์ผ ์๋จ์ ์๋ ์๋ ๊ฒฝ๋ก ์ํฌํธ(relative import) ๋ถ๋ถ์ `transformers` ํจํค์ง์์ ์ํฌํธ ํ๋๋ก ๋ณ๊ฒฝํด์ผ ํฉ๋๋ค.
+
+
+
+๊ธฐ์กด ๊ตฌ์ฑ์ด๋ ๋ชจ๋ธ์ ์ฌ์ฌ์ฉ(๋๋ ์๋ธ ํด๋์คํ)ํ ์ ์์ต๋๋ค.
+
+์ปค๋ฎค๋ํฐ์ ๋ชจ๋ธ์ ๊ณต์ ํ๊ธฐ ์ํด์๋ ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ผ์ผ ํฉ๋๋ค:
+๋จผ์ , ์๋ก ๋ง๋ ํ์ผ์ ResNet ๋ชจ๋ธ๊ณผ ๊ตฌ์ฑ์ ์ํฌํธํฉ๋๋ค:
+
+```py
+from resnet_model.configuration_resnet import ResnetConfig
+from resnet_model.modeling_resnet import ResnetModel, ResnetModelForImageClassification
+```
+
+๋ค์์ผ๋ก `save_pretrained` ๋ฉ์๋๋ฅผ ์ฌ์ฉํด ํด๋น ๊ฐ์ฒด์ ์ฝ๋ ํ์ผ์ ๋ณต์ฌํ๊ณ ,
+๋ณต์ฌํ ํ์ผ์ Auto ํด๋์ค๋ก ๋ฑ๋กํ๊ณ (๋ชจ๋ธ์ธ ๊ฒฝ์ฐ) ์คํํฉ๋๋ค:
+
+```py
+ResnetConfig.register_for_auto_class()
+ResnetModel.register_for_auto_class("AutoModel")
+ResnetModelForImageClassification.register_for_auto_class("AutoModelForImageClassification")
+```
+
+`configuration`์ ๋ํ auto ํด๋์ค๋ฅผ ์ง์ ํ ํ์๋ ์์ง๋ง(`configuration` ๊ด๋ จ auto ํด๋์ค๋ AutoConfig ํด๋์ค ํ๋๋ง ์์), ๋ชจ๋ธ์ ๊ฒฝ์ฐ์๋ ์ง์ ํด์ผ ํฉ๋๋ค.
+์ฌ์ฉ์ ์ง์ ๋ชจ๋ธ์ ๋ค์ํ ์์
์ ์ ํฉํ ์ ์์ผ๋ฏ๋ก, ๋ชจ๋ธ์ ๋ง๋ auto ํด๋์ค๋ฅผ ์ง์ ํด์ผ ํฉ๋๋ค.
+
+๋ค์์ผ๋ก, ์ด์ ์ ์์
ํ๋ ๊ฒ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ๊ตฌ์ฑ๊ณผ ๋ชจ๋ธ์ ์์ฑํฉ๋๋ค:
+
+```py
+resnet50d_config = ResnetConfig(block_type="bottleneck", stem_width=32, stem_type="deep", avg_down=True)
+resnet50d = ResnetModelForImageClassification(resnet50d_config)
+
+pretrained_model = timm.create_model("resnet50d", pretrained=True)
+resnet50d.model.load_state_dict(pretrained_model.state_dict())
+```
+
+์ด์ ๋ชจ๋ธ์ Hub๋ก ์
๋ก๋ํ๊ธฐ ์ํด ๋ก๊ทธ์ธ ์ํ์ธ์ง ํ์ธํ์ธ์.
+ํฐ๋ฏธ๋์์ ๋ค์ ์ฝ๋๋ฅผ ์คํํด ํ์ธํ ์ ์์ต๋๋ค:
+
+```bash
+huggingface-cli login
+```
+
+์ฃผํผํฐ ๋
ธํธ๋ถ์ ๊ฒฝ์ฐ์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```py
+from huggingface_hub import notebook_login
+
+notebook_login()
+```
+
+๊ทธ๋ฐ ๋ค์ ์ด๋ ๊ฒ ์์ ์ ๋ค์์คํ์ด์ค(๋๋ ์์ ์ด ์ํ ์กฐ์ง)์ ์
๋ก๋ํ ์ ์์ต๋๋ค:
+```py
+resnet50d.push_to_hub("custom-resnet50d")
+```
+
+On top of the modeling weights and the configuration in json format, this also copied the modeling and
+configuration `.py` files in the folder `custom-resnet50d` and uploaded the result to the Hub. You can check the result
+in this [model repo](https://huggingface.co/sgugger/custom-resnet50d).
+json ํ์์ ๋ชจ๋ธ๋ง ๊ฐ์ค์น์ ๊ตฌ์ฑ ์ธ์๋ `custom-resnet50d` ํด๋ ์์ ๋ชจ๋ธ๋ง๊ณผ ๊ตฌ์ฑ `.py` ํ์ผ์ ๋ณต์ฌํํด Hub์ ์
๋ก๋ํฉ๋๋ค.
+[๋ชจ๋ธ ์ ์ฅ์](https://huggingface.co/sgugger/custom-resnet50d)์์ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
+
+[sharing tutorial](model_sharing) ๋ฌธ์์ `push_to_hub` ๋ฉ์๋์์ ์์ธํ ๋ด์ฉ์ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+## ์ฌ์ฉ์ ์ ์ ์ฝ๋๋ก ๋ชจ๋ธ ์ฌ์ฉํ๊ธฐ[[using-a-model-with-custom-code]]
+
+auto ํด๋์ค์ `from_pretrained` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์ ์ง์ ์ฝ๋ ํ์ผ๊ณผ ํจ๊ป ๋ชจ๋ ๊ตฌ์ฑ, ๋ชจ๋ธ, ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+Hub์ ์
๋ก๋๋ ๋ชจ๋ ํ์ผ ๋ฐ ์ฝ๋๋ ๋ฉ์จ์ด๊ฐ ์๋์ง ๊ฒ์ฌ๋์ง๋ง (์์ธํ ๋ด์ฉ์ [Hub ๋ณด์](https://huggingface.co/docs/hub/security#malware-scanning) ์ค๋ช
์ฐธ์กฐ),
+์์ ์ ์ปดํจํฐ์์ ๋ชจ๋ธ ์ฝ๋์ ์์ฑ์๊ฐ ์
์ฑ ์ฝ๋๋ฅผ ์คํํ์ง ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค.
+์ฌ์ฉ์ ์ ์ ์ฝ๋๋ก ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ค๋ฉด `trust_remote_code=True`๋ก ์ค์ ํ์ธ์:
+
+```py
+from transformers import AutoModelForImageClassification
+
+model = AutoModelForImageClassification.from_pretrained("sgugger/custom-resnet50d", trust_remote_code=True)
+```
+
+๋ชจ๋ธ ์์ฑ์๊ฐ ์
์์ ์ผ๋ก ์ฝ๋๋ฅผ ์
๋ฐ์ดํธํ์ง ์์๋ค๋ ์ ์ ํ์ธํ๊ธฐ ์ํด, ์ปค๋ฐ ํด์(commit hash)๋ฅผ `revision`์ผ๋ก ์ ๋ฌํ๋ ๊ฒ๋ ๊ฐ๋ ฅํ ๊ถ์ฅ๋ฉ๋๋ค (๋ชจ๋ธ ์์ฑ์๋ฅผ ์์ ํ ์ ๋ขฐํ์ง ์๋ ๊ฒฝ์ฐ).
+
+```py
+commit_hash = "ed94a7c6247d8aedce4647f00f20de6875b5b292"
+model = AutoModelForImageClassification.from_pretrained(
+ "sgugger/custom-resnet50d", trust_remote_code=True, revision=commit_hash
+)
+```
+
+Hub์์ ๋ชจ๋ธ ์ ์ฅ์์ ์ปค๋ฐ ๊ธฐ๋ก์ ์ฐพ์๋ณผ ๋, ๋ชจ๋ ์ปค๋ฐ์ ์ปค๋ฐ ํด์๋ฅผ ์ฝ๊ฒ ๋ณต์ฌํ ์ ์๋ ๋ฒํผ์ด ์์ต๋๋ค.
+
+## ์ฌ์ฉ์ ์ ์ ์ฝ๋๋ก ๋ง๋ ๋ชจ๋ธ์ auto ํด๋์ค๋ก ๋ฑ๋กํ๊ธฐ[[registering-a-model-with-custom-code-to-the-auto-classes]]
+
+๐ค Transformers๋ฅผ ์์ํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์์ฑํ๋ ๊ฒฝ์ฐ ์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ์ auto ํด๋์ค์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
+์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ์ ์ฌ์ฉํ๊ธฐ ์ํด ํด๋น ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ํฌํธํด์ผ ํ๊ธฐ ๋๋ฌธ์, ์ด๋ Hub๋ก ์ฝ๋๋ฅผ ์
๋ก๋ํ๋ ๊ฒ๊ณผ ๋ค๋ฆ
๋๋ค (Hub์์ ์๋์ ์ผ๋ก ๋ชจ๋ธ ์ฝ๋๋ฅผ ๋ค์ด๋ก๋ ํ๋ ๊ฒ๊ณผ ๋ฐ๋).
+
+๊ตฌ์ฑ์ ๊ธฐ์กด ๋ชจ๋ธ ์ ํ๊ณผ ๋ค๋ฅธ `model_type` ์์ฑ์ด ์๊ณ ๋ชจ๋ธ ํด๋์ค์ ์ฌ๋ฐ๋ฅธ `config_class` ์์ฑ์ด ์๋ ํ,
+๋ค์๊ณผ ๊ฐ์ด auto ํด๋์ค์ ์ถ๊ฐํ ์ ์์ต๋๋ค:
+
+```py
+from transformers import AutoConfig, AutoModel, AutoModelForImageClassification
+
+AutoConfig.register("resnet", ResnetConfig)
+AutoModel.register(ResnetConfig, ResnetModel)
+AutoModelForImageClassification.register(ResnetConfig, ResnetModelForImageClassification)
+```
+
+์ฌ์ฉ์ ์ ์ ๊ตฌ์ฑ์ [`AutoConfig`]์ ๋ฑ๋กํ ๋ ์ฌ์ฉ๋๋ ์ฒซ ๋ฒ์งธ ์ธ์๋ ์ฌ์ฉ์ ์ ์ ๊ตฌ์ฑ์ `model_type`๊ณผ ์ผ์นํด์ผ ํฉ๋๋ค.
+๋ํ, ์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ์ auto ํด๋์ค์ ๋ฑ๋กํ ๋ ์ฌ์ฉ๋๋ ์ฒซ ๋ฒ์งธ ์ธ์๋ ํด๋น ๋ชจ๋ธ์ `config_class`์ ์ผ์นํด์ผ ํฉ๋๋ค.
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/debugging.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/debugging.md
new file mode 100644
index 0000000000000000000000000000000000000000..24b2c7b04b509d9301003a3911dbb0b0e324eedf
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/debugging.md
@@ -0,0 +1,306 @@
+
+
+# ๋๋ฒ๊น
[[debugging]]
+
+## Multi-GPU ๋คํธ์ํฌ ๋ฌธ์ ๋๋ฒ๊ทธ [[multigpu-network-issues-debug]]
+
+`DistributedDataParallel` ๋ฐ ๋ค์ค GPU๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ จํ๊ฑฐ๋ ์ถ๋ก ํ ๋, ํ๋ก์ธ์ค ๋ฐ/๋๋ ๋
ธ๋ ๊ฐ์ ์ํธ ํต์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ ๊ฒฝ์ฐ, ๋ค์ ์คํฌ๋ฆฝํธ๋ฅผ ์ฌ์ฉํ์ฌ ๋คํธ์ํฌ ๋ฌธ์ ๋ฅผ ์ง๋จํ ์ ์์ต๋๋ค.
+
+```bash
+wget https://raw.githubusercontent.com/huggingface/transformers/main/scripts/distributed/torch-distributed-gpu-test.py
+```
+
+์๋ฅผ ๋ค์ด, 2๊ฐ์ GPU๊ฐ ์ํธ ์์ฉํ๋ ๋ฐฉ์์ ํ
์คํธํ๋ ค๋ฉด ๋ค์์ ์คํํ์ธ์:
+
+```bash
+python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-gpu-test.py
+```
+๋ ํ๋ก์ธ์ค๊ฐ ์๋ก ํต์ ํ๊ณ GPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ํ ๋นํ๋ ๊ฒฝ์ฐ, ๊ฐ๊ฐ "OK" ์ํ๋ฅผ ์ถ๋ ฅํฉ๋๋ค.
+
+๋ ๋ง์ GPU ๋๋ ๋
ธ๋์ ๊ฒฝ์ฐ ์คํฌ๋ฆฝํธ์ ์ธ์๋ฅผ ์กฐ์ ํ๋ฉด ๋ฉ๋๋ค.
+
+์ง๋จ ์คํฌ๋ฆฝํธ ๋ด์์ ๋ ๋ง์ ์ธ๋ถ ์ ๋ณด์ SLURM ํ๊ฒฝ์์ ์คํํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ ์ํผ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
+
+์ถ๊ฐ์ ์ธ ๋๋ฒ๊ทธ ์์ค์ ๋ค์๊ณผ ๊ฐ์ด `NCCL_DEBUG=INFO` ํ๊ฒฝ ๋ณ์๋ฅผ ์ถ๊ฐํ๋ ๊ฒ์
๋๋ค:
+
+```bash
+NCCL_DEBUG=INFO python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-gpu-test.py
+```
+
+์ด๋ ๊ฒ ํ๋ฉด NCCL ๊ด๋ จ ๋๋ฒ๊ทธ ์ ๋ณด๊ฐ ๋ง์ด ์ถ๋ ฅ๋๋ฉฐ, ๋ฌธ์ ๊ฐ ๋ณด๊ณ ๋ ๊ฒฝ์ฐ์๋ ์ธํฐ๋ท์์ ๊ฒ์ํ ์ ์์ต๋๋ค. ๋๋ ์ถ๋ ฅ์ ํด์ํ๋ ๋ฐฉ๋ฒ์ ์ ๋ชจ๋ฅด๋ ๊ฒฝ์ฐ ๋ก๊ทธ ํ์ผ์ ์ด์์ ๊ณต์ ํ ์ ์์ต๋๋ค.
+
+
+
+## ์ธ๋ํ๋ก ๋ฐ ์ค๋ฒํ๋ก ๊ฐ์ง [[underflow-and-overflow-detection]]
+
+
+
+
+์ด ๊ธฐ๋ฅ์ ํ์ฌ PyTorch์์๋ง ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+
+
+
+
+๋ค์ค GPU ํ๋ จ์ ์ํด์๋ DDP (`torch.distributed.launch`)๊ฐ ํ์ํฉ๋๋ค.
+
+
+
+
+
+์ด ๊ธฐ๋ฅ์ `nn.Module`์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ ๋ชจ๋ธ๊ณผ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+
+
+`loss=NaN`์ด ๋ํ๋๊ฑฐ๋ ๋ชจ๋ธ์ด `inf` ๋๋ `nan`์ผ๋ก ์ธํด ๋ค๋ฅธ ์ด์ํ ๋์์ ํ๋ ๊ฒฝ์ฐ, ์ธ๋ํ๋ก ๋๋ ์ค๋ฒํ๋ก์ ์ฒซ ๋ฒ์งธ ๋ฐ์ ์์น์ ๊ทธ ์์ธ์ ํ์
ํด์ผ ํฉ๋๋ค. ๋คํํ๋ ์ด๋ฅผ ์๋์ผ๋ก ๊ฐ์งํ๋ ํน์ ๋ชจ๋์ ํ์ฑํํ์ฌ ์ฝ๊ฒ ์์๋ผ ์ ์์ต๋๋ค.
+
+[`Trainer`]๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ, ๋ค์์ ๊ธฐ์กด์ ๋ช
๋ น์ค ์ธ์์ ์ถ๊ฐํ๋ฉด ๋ฉ๋๋ค.
+
+```bash
+--debug underflow_overflow
+```
+๋๋ [`TrainingArguments`] ๊ฐ์ฒด๋ฅผ ์์ฑํ ๋ `debug="underflow_overflow"`๋ฅผ ์ ๋ฌํฉ๋๋ค.
+
+์์ฒด ํ๋ จ ๋ฃจํ๋ ๋ค๋ฅธ Trainer๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ, ๋ค์๊ณผ ๊ฐ์ด ์ํํ ์ ์์ต๋๋ค.
+
+```python
+from transformers.debug_utils import DebugUnderflowOverflow
+
+debug_overflow = DebugUnderflowOverflow(model)
+```
+
+[`~debug_utils.DebugUnderflowOverflow`]๋ ๋ชจ๋ธ์ ํํฌ๋ฅผ ์ฝ์
ํ์ฌ ๊ฐ forward ํธ์ถ ์งํ์ ์
๋ ฅ ๋ฐ ์ถ๋ ฅ ๋ณ์ ๋ฐ ํด๋น ๋ชจ๋์ ๊ฐ์ค์น๋ฅผ ํ
์คํธํฉ๋๋ค. ํ์ฑํ๋ ๊ฐ์ค์น์ ์ต์ํ ํ๋์ ์์์์ `inf` ๋๋ `nan`์ด ๊ฐ์ง๋๋ฉด ํ๋ก๊ทธ๋จ์ด ์ด์คํธ๋๊ณ ๋ค์๊ณผ ๊ฐ์ ๋ณด๊ณ ์๊ฐ ์ถ๋ ฅ๋ฉ๋๋ค. (์ด ์์ ๋ fp16 ํผํฉ ์ ๋ฐ๋์์ `google/mt5-small`์์ ์บก์ฒ๋ ๊ฒ์
๋๋ค):
+
+```
+Detected inf/nan during batch_number=0
+Last 21 forward frames:
+abs min abs max metadata
+ encoder.block.1.layer.1.DenseReluDense.dropout Dropout
+0.00e+00 2.57e+02 input[0]
+0.00e+00 2.85e+02 output
+[...]
+ encoder.block.2.layer.0 T5LayerSelfAttention
+6.78e-04 3.15e+03 input[0]
+2.65e-04 3.42e+03 output[0]
+ None output[1]
+2.25e-01 1.00e+04 output[2]
+ encoder.block.2.layer.1.layer_norm T5LayerNorm
+8.69e-02 4.18e-01 weight
+2.65e-04 3.42e+03 input[0]
+1.79e-06 4.65e+00 output
+ encoder.block.2.layer.1.DenseReluDense.wi_0 Linear
+2.17e-07 4.50e+00 weight
+1.79e-06 4.65e+00 input[0]
+2.68e-06 3.70e+01 output
+ encoder.block.2.layer.1.DenseReluDense.wi_1 Linear
+8.08e-07 2.66e+01 weight
+1.79e-06 4.65e+00 input[0]
+1.27e-04 2.37e+02 output
+ encoder.block.2.layer.1.DenseReluDense.dropout Dropout
+0.00e+00 8.76e+03 input[0]
+0.00e+00 9.74e+03 output
+ encoder.block.2.layer.1.DenseReluDense.wo Linear
+1.01e-06 6.44e+00 weight
+0.00e+00 9.74e+03 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.DenseReluDense T5DenseGatedGeluDense
+1.79e-06 4.65e+00 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.dropout Dropout
+3.18e-04 6.27e+04 input[0]
+0.00e+00 inf output
+```
+
+์์ ์ถ๋ ฅ์ ๊ฐ๋ต์ฑ์ ์ํด ์ค๊ฐ ๋ถ๋ถ์ด ์๋ ค ์์ต๋๋ค.
+
+๋ ๋ฒ์งธ ์ด์ ์ ๋์ ์ผ๋ก ๊ฐ์ฅ ํฐ ์์์ ๊ฐ์ด๋ฉฐ, ๋ฐ๋ผ์ ๋ง์ง๋ง ๋ช ๊ฐ์ ํ๋ ์์ ์์ธํ ์ดํด๋ณด๋ฉด ์
๋ ฅ๊ณผ ์ถ๋ ฅ์ด `1e4` ๋ฒ์์ ์์์ ์ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ ์ด ํ๋ จ์ `fp16` ํผํฉ ์ ๋ฐ๋๋ก ์ํ๋ ๋ ๊ฐ์ฅ ๋ง์ง๋ง ๋จ๊ณ์์ ์ค๋ฒํ๋ก์ฐ๊ฐ ๋ฐ์ํ์ต๋๋ค (`fp16`์์ `inf` ์ด์ ์ ๊ฐ์ฅ ํฐ ์ซ์๋ `64e3`์
๋๋ค). `fp16` ์๋์์ ์ค๋ฒํ๋ก์ฐ๋ฅผ ํผํ๊ธฐ ์ํด์๋ ํ์ฑํ๋ `1e4`๋ณด๋ค ํจ์ฌ ์์์ผ ํฉ๋๋ค. ์๋ํ๋ฉด `1e4 * 1e4 = 1e8`์ด๊ธฐ ๋๋ฌธ์ ํฐ ํ์ฑํ์์ ํ๋ ฌ ๊ณฑ์ ์์น์ ์ธ ์ค๋ฒํ๋ก์ฐ ์กฐ๊ฑด์ผ๋ก ์ด์ด์ง ๊ฒ์
๋๋ค.
+
+์ถ์ ์ ๋งจ ์ฒ์์์ ์ด๋ ๋ฐฐ์น ๋ฒํธ์์ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋์ง ์ ์ ์์ต๋๋ค (์ฌ๊ธฐ์ `Detected inf/nan during batch_number=0`์ ๋ฌธ์ ๊ฐ ์ฒซ ๋ฒ์งธ ๋ฐฐ์น์์ ๋ฐ์ํ์์ ์๋ฏธํฉ๋๋ค).
+
+๊ฐ ๋ณด๊ณ ๋ ํ๋ ์์ ํด๋น ํ๋ ์์ด ๋ณด๊ณ ํ๋ ํด๋น ๋ชจ๋์ ๋ํ ์์ ํ ํญ๋ชฉ์ ์ ์ธํ๋ฉฐ, ์ด ํ๋ ์๋ง ์ดํด๋ณด๋ฉด ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+```
+ encoder.block.2.layer.1.layer_norm T5LayerNorm
+8.69e-02 4.18e-01 weight
+2.65e-04 3.42e+03 input[0]
+1.79e-06 4.65e+00 output
+```
+
+์ฌ๊ธฐ์ `encoder.block.2.layer.1.layer_norm`์ ์ธ์ฝ๋์ ๋ ๋ฒ์งธ ๋ธ๋ก์ ์ฒซ ๋ฒ์งธ ๋ ์ด์ด์ ๋ํ ๋ ์ด์ด ์ ๊ทํ๋ฅผ ์๋ฏธํ๋ฉฐ, `forward`์ ํน์ ํธ์ถ์ `T5LayerNorm`์
๋๋ค.
+
+์ด ๋ณด๊ณ ์์ ๋ง์ง๋ง ๋ช ๊ฐ ํ๋ ์์ ์ดํด๋ณด๊ฒ ์ต๋๋ค:
+
+```
+Detected inf/nan during batch_number=0
+Last 21 forward frames:
+abs min abs max metadata
+[...]
+ encoder.block.2.layer.1.DenseReluDense.wi_0 Linear
+2.17e-07 4.50e+00 weight
+1.79e-06 4.65e+00 input[0]
+2.68e-06 3.70e+01 output
+ encoder.block.2.layer.1.DenseReluDense.wi_1 Linear
+8.08e-07 2.66e+01 weight
+1.79e-06 4.65e+00 input[0]
+1.27e-04 2.37e+02 output
+ encoder.block.2.layer.1.DenseReluDense.wo Linear
+1.01e-06 6.44e+00 weight
+0.00e+00 9.74e+03 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.DenseReluDense T5DenseGatedGeluDense
+1.79e-06 4.65e+00 input[0]
+3.18e-04 6.27e+04 output
+ encoder.block.2.layer.1.dropout Dropout
+3.18e-04 6.27e+04 input[0]
+0.00e+00 inf output
+```
+
+๋ง์ง๋ง ํ๋ ์์ `Dropout.forward` ํจ์์ ๋ํ ๋ณด๊ณ ์
๋๋ค. ์ฒซ ๋ฒ์งธ ํญ๋ชฉ์ ์ ์ผํ ์
๋ ฅ์ ๋ํ๋ด๊ณ ๋ ๋ฒ์งธ ํญ๋ชฉ์ ์ ์ผํ ์ถ๋ ฅ์ ๋ํ๋
๋๋ค. ์ด ํจ์๊ฐ `DenseReluDense` ํด๋์ค ๋ด๋ถ์ `dropout` ์์ฑ์์ ํธ์ถ๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. ์ด๋ ์ฒซ ๋ฒ์งธ ๋ ์ด์ด์ ๋ ๋ฒ์งธ ๋ธ๋ก์์ ์ฒซ ๋ฒ์งธ ๋ฐฐ์น ์ค์ ๋ฐ์ํ๋ค๋ ๊ฒ์ ์ ์ ์์ต๋๋ค. ๋ง์ง๋ง์ผ๋ก, ์ ๋์ ์ผ๋ก ๊ฐ์ฅ ํฐ ์
๋ ฅ ์์๋ `6.27e+04`์ด๊ณ ์ถ๋ ฅ๋ ๋ง์ฐฌ๊ฐ์ง๋ก `inf`์
๋๋ค.
+
+์ฌ๊ธฐ์์๋ `T5DenseGatedGeluDense.forward`๊ฐ ์ถ๋ ฅ ํ์ฑํ๋ฅผ ์์ฑํ๋๋ฐ, ์ ๋์ ์ผ๋ก ๊ฐ์ฅ ํฐ ๊ฐ์ด ์ฝ 62.7K์ธ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. ์ด ๊ฐ์ fp16์ ์ต๋ ์ ํ์ธ 64K์ ๋งค์ฐ ๊ทผ์ ํฉ๋๋ค. ๋ค์ ํ๋ ์์์๋ ์ผ๋ถ ์์๋ฅผ 0์ผ๋ก ๋ง๋ ํ ๊ฐ์ค์น๋ฅผ ์ฌ์ ๊ทํํ๋ `Dropout`์ด ์์ต๋๋ค. ์ด๋ก ์ธํด ์ ๋ ์ต๋๊ฐ์ด 64K๋ฅผ ์ด๊ณผํ๊ณ ์ค๋ฒํ๋ก์ฐ(`inf`)๊ฐ ๋ฐ์ํฉ๋๋ค.
+
+๋ณด์๋ค์ํผ, fp16 ์ซ์์ ๊ฒฝ์ฐ ์ซ์๊ฐ ๋งค์ฐ ์ปค์ง ๋ ์ด์ ํ๋ ์์ ์ดํด๋ณด์์ผ ํฉ๋๋ค.
+
+๋ณด๊ณ ์๋ฅผ `models/t5/modeling_t5.py`์ ์ฝ๋์ ์ผ์น์์ผ ๋ณด๊ฒ ์ต๋๋ค.
+
+```python
+class T5DenseGatedGeluDense(nn.Module):
+ def __init__(self, config):
+ super().__init__()
+ self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False)
+ self.wi_1 = nn.Linear(config.d_model, config.d_ff, bias=False)
+ self.wo = nn.Linear(config.d_ff, config.d_model, bias=False)
+ self.dropout = nn.Dropout(config.dropout_rate)
+ self.gelu_act = ACT2FN["gelu_new"]
+
+ def forward(self, hidden_states):
+ hidden_gelu = self.gelu_act(self.wi_0(hidden_states))
+ hidden_linear = self.wi_1(hidden_states)
+ hidden_states = hidden_gelu * hidden_linear
+ hidden_states = self.dropout(hidden_states)
+ hidden_states = self.wo(hidden_states)
+ return hidden_states
+```
+
+์ด์ `dropout` ํธ์ถ๊ณผ ์ด์ ์ ๋ชจ๋ ํธ์ถ์ ์ฝ๊ฒ ํ์ธํ ์ ์์ต๋๋ค.
+
+๊ฐ์ง๋ `forward` ํํฌ์์ ๋ฐ์ํ๋ฏ๋ก, ์ด๋ฌํ ๋ณด๊ณ ์๋ ๊ฐ `forward`๊ฐ ๋ฐํ๋ ์งํ์ ์ฆ์ ์ถ๋ ฅ๋ฉ๋๋ค.
+
+์ ์ฒด ๋ณด๊ณ ์๋ก ๋์๊ฐ์ ๋ฌธ์ ์ ๋ํ ์กฐ์น ๋ฐ ์์ ์ ํ๋ ค๋ฉด, ์ซ์๊ฐ ์ฆ๊ฐํ๊ธฐ ์์ํ ๋ช ๊ฐ์ ํ๋ ์ ์๋ก ์ด๋ํด์ ์ฌ๊ธฐ์ `fp32` ๋ชจ๋๋ก ์ ํํด์ผ ํฉ๋๋ค. ์ด๋ ๊ฒ ํด์ผ ์ซ์๊ฐ ๊ณฑํด์ง๊ฑฐ๋ ํฉ์ณ์ง ๋ ์ค๋ฒํ๋ก์ฐ๋์ง ์์ ๊ฐ๋ฅ์ฑ์ด ๋์ต๋๋ค. ๋ฌผ๋ก ๋ค๋ฅธ ํด๊ฒฐ์ฑ
๋ ์์ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, `amp`๊ฐ ํ์ฑํ๋ ๊ฒฝ์ฐ ์ผ์์ ์ผ๋ก ๋๊ณ ์๋์ `forward`๋ฅผ ๋์ฐ๋ฏธ ๋ํผ๋ก ์ด๋ํ ํ ๋ค์๊ณผ ๊ฐ์ด ํ ์ ์์ต๋๋ค:
+
+```python
+def _forward(self, hidden_states):
+ hidden_gelu = self.gelu_act(self.wi_0(hidden_states))
+ hidden_linear = self.wi_1(hidden_states)
+ hidden_states = hidden_gelu * hidden_linear
+ hidden_states = self.dropout(hidden_states)
+ hidden_states = self.wo(hidden_states)
+ return hidden_states
+
+
+import torch
+
+
+def forward(self, hidden_states):
+ if torch.is_autocast_enabled():
+ with torch.cuda.amp.autocast(enabled=False):
+ return self._forward(hidden_states)
+ else:
+ return self._forward(hidden_states)
+```
+
+์๋ ๊ฐ์ง๊ธฐ๋ ์ ์ฒด ํ๋ ์์ ์
๋ ฅ๊ณผ ์ถ๋ ฅ์ ๋ํด์๋ง ๋ณด๊ณ ํ๋ฏ๋ก, ์ด๋๋ฅผ ์ดํด๋ด์ผ ํ๋์ง ์๋ฉด ํน์ `forward` ํจ์์ ์ค๊ฐ ๋จ๊ณ๋ ๋ถ์ํ ์ ์์ต๋๋ค. ์ด ๊ฒฝ์ฐ์๋ `detect_overflow` ๋์ฐ๋ฏธ ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ์ํ๋ ์์น์ ๊ฐ์ง๊ธฐ๋ฅผ ์ฝ์
ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด:
+
+```python
+from debug_utils import detect_overflow
+
+
+class T5LayerFF(nn.Module):
+ [...]
+
+ def forward(self, hidden_states):
+ forwarded_states = self.layer_norm(hidden_states)
+ detect_overflow(forwarded_states, "after layer_norm")
+ forwarded_states = self.DenseReluDense(forwarded_states)
+ detect_overflow(forwarded_states, "after DenseReluDense")
+ return hidden_states + self.dropout(forwarded_states)
+```
+
+์ฌ๊ธฐ์๋ ์ด๋ฅผ ์ถ๊ฐํ์ฌ 2๊ฐ์ ๊ฒ์ ์ถ์ ํ๊ณ ์ด์ `forwarded_states`์ `inf` ๋๋ `nan`์ด ์ค๊ฐ์ ๊ฐ์ง๋์๋์ง๋ฅผ ์ถ์ ํฉ๋๋ค.
+
+์ค์ ๋ก ์์ ์์ ์์ ๊ฐ ํธ์ถ์ด `nn.Module`์ด๊ธฐ ๋๋ฌธ์ ํ์ง๊ธฐ๊ฐ ์ด๋ฏธ ์ด๋ฅผ ๋ณด๊ณ ํฉ๋๋ค. ๋ก์ปฌ์์ ์ง์ ๊ณ์ฐํ๋ ๊ฒฝ์ฐ ์ด๋ ๊ฒ ์ํํ๋ค๊ณ ๊ฐ์ ํด ๋ด
์๋ค.
+
+๋ํ, ์์ฒด ์ฝ๋์์ ๋๋ฒ๊ฑฐ๋ฅผ ์ธ์คํด์คํํ๋ ๊ฒฝ์ฐ ๊ธฐ๋ณธ๊ฐ์์ ์ถ๋ ฅ๋๋ ํ๋ ์ ์๋ฅผ ์กฐ์ ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด:
+
+```python
+from transformers.debug_utils import DebugUnderflowOverflow
+
+debug_overflow = DebugUnderflowOverflow(model, max_frames_to_save=100)
+```
+
+### ํน์ ๋ฐฐ์น์ ์ ๋๊ฐ ์ต์ ๋ฐ ์ต๋ ๊ฐ ์ถ์ [[specific-batch-absolute-min-and-max-value-tracing]]
+
+๋์ผํ ๋๋ฒ๊น
ํด๋์ค๋ ์ธ๋ํ๋ก์ฐ/์ค๋ฒํ๋ก์ฐ ๊ฐ์ง ๊ธฐ๋ฅ์ด ๊บผ์ง ์ํ์์ ๋ฐฐ์น๋ณ ์ถ์ ์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+์๋ฅผ ๋ค์ด, ํน์ ๋ฐฐ์น์ ๊ฐ `forward` ํธ์ถ์ ๋ชจ๋ ๊ตฌ์ฑ ์ฑ๋ถ์ ๋ํ ์ ๋ ์ต์๊ฐ๊ณผ ์ต๋๊ฐ์ ํ์ธํ๊ณ , ์ด๋ฅผ ๋ฐฐ์น 1๊ณผ 3์ ๋ํด์๋ง ์ํํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ์ด ํด๋์ค๋ฅผ ์ธ์คํด์คํํฉ๋๋ค:
+
+```python
+debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3])
+```
+
+๊ทธ๋ฌ๋ฉด ์ด์ ๋ฐฐ์น 1๊ณผ 3 ์ ์ฒด๊ฐ ์ธ๋ํ๋ก์ฐ/์ค๋ฒํ๋ก์ฐ ๊ฐ์ง๊ธฐ์ ๋์ผํ ํ์์ผ๋ก ์ถ์ ๋ฉ๋๋ค.
+
+๋ฐฐ์น๋ 0๋ถํฐ ์์ํฉ๋๋ค.
+
+์ด๋ ํ๋ก๊ทธ๋จ์ด ํน์ ๋ฐฐ์น ๋ฒํธ ์ดํ์ ์ค์๋ํ๊ธฐ ์์ํ๋ ๊ฒ์ ์๊ณ ์๋ ๊ฒฝ์ฐ์ ์ ์ฉํฉ๋๋ค. ๊ทธ๋ ๊ธฐ ๋๋ฌธ์ ํด๋น ์์ญ์ผ๋ก ๋ฐ๋ก ์ด๋ํ ์ ์์ต๋๋ค. ์ด๋ฐ ๊ตฌ์ฑ์ ๋ํ ์ํ ์ถ์๋ ์ถ๋ ฅ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+```
+ *** Starting batch number=1 ***
+abs min abs max metadata
+ shared Embedding
+1.01e-06 7.92e+02 weight
+0.00e+00 2.47e+04 input[0]
+5.36e-05 7.92e+02 output
+[...]
+ decoder.dropout Dropout
+1.60e-07 2.27e+01 input[0]
+0.00e+00 2.52e+01 output
+ decoder T5Stack
+ not a tensor output
+ lm_head Linear
+1.01e-06 7.92e+02 weight
+0.00e+00 1.11e+00 input[0]
+6.06e-02 8.39e+01 output
+ T5ForConditionalGeneration
+ not a tensor output
+
+ *** Starting batch number=3 ***
+abs min abs max metadata
+ shared Embedding
+1.01e-06 7.92e+02 weight
+0.00e+00 2.78e+04 input[0]
+5.36e-05 7.92e+02 output
+[...]
+```
+
+์ฌ๊ธฐ์์๋ ๋ชจ๋ธ์ forward ํธ์ถ ์์ ๋์ผํ ์์ ํ๋ ์์ด ๋คํ๋๋ฏ๋ก ๋ง์ ์์ ํ๋ ์์ด ์์ฑ๋ฉ๋๋ค. ๋ฐ๋ผ์ ์ํ๋ ๊ฒ์ผ ์๋ ์๊ณ ์๋ ์๋ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋๋ก๋ ์ผ๋ฐ ๋๋ฒ๊ฑฐ๋ณด๋ค ๋๋ฒ๊น
๋ชฉ์ ์ผ๋ก ๋ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ๋ฌธ์ ๊ฐ ๋ฐฐ์น ๋ฒํธ 150์์ ์์ํ๋ ๊ฒฝ์ฐ 149์ 150์ ์ถ์ ์ ๋คํํ๊ณ ์ซ์๊ฐ ์ด๋์๋ถํฐ ๋ค๋ฅด๊ฒ ๋์๋์ง ๋น๊ตํ ์ ์์ต๋๋ค.
+
+๋ํ, ํ๋ จ์ ์ค์งํ ๋ฐฐ์น ๋ฒํธ๋ฅผ ์ง์ ํ ์๋ ์์ต๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ์ง์ ํ ์ ์์ต๋๋ค.
+
+```python
+debug_overflow = DebugUnderflowOverflow(model, trace_batch_nums=[1, 3], abort_after_batch_num=3)
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/deepspeed.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/deepspeed.md
new file mode 100644
index 0000000000000000000000000000000000000000..9945e298b7763e16ea0c51dfa9e84a4bbfdca412
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/deepspeed.md
@@ -0,0 +1,1220 @@
+
+
+# DeepSpeed[[deepspeed]]
+
+[DeepSpeed](https://www.deepspeed.ai/)๋ ๋ถ์ฐ ํ์ต ๋ฉ๋ชจ๋ฆฌ๋ฅผ ํจ์จ์ ์ด๊ณ ๋น ๋ฅด๊ฒ ๋ง๋๋ PyTorch ์ต์ ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์
๋๋ค. ๊ทธ ํต์ฌ์ ๋๊ท๋ชจ ๋ชจ๋ธ์ ๊ท๋ชจ์ ๋ง๊ฒ ํ๋ จํ ์ ์๋ [Zero Redundancy Optimizer(ZeRO)](https://hf.co/papers/1910.02054)์
๋๋ค. ZeRO๋ ์ฌ๋ฌ ๋จ๊ณ๋ก ์๋ํฉ๋๋ค:
+
+* ZeRO-1, GPU ๊ฐ ์ต์ ํ ์ํ ๋ถํ
+* ZeRO-2, GPU ๊ฐ ๊ทธ๋ ์ด๋์ธํธ ๋ถํ
+* ZeRO-3, GPU ๊ฐ ๋งค๊ฐ๋ณ์ ๋ถํ
+
+GPU๊ฐ ์ ํ๋ ํ๊ฒฝ์์ ZeRO๋ ์ต์ ํ ๋ฉ๋ชจ๋ฆฌ์ ๊ณ์ฐ์ GPU์์ CPU๋ก ์คํ๋ก๋ํ์ฌ ๋จ์ผ GPU์ ๋๊ท๋ชจ ๋ชจ๋ธ์ ์ฅ์ฐฉํ๊ณ ํ๋ จํ ์ ์์ต๋๋ค. DeepSpeed๋ ๋ชจ๋ ZeRO ๋จ๊ณ ๋ฐ ์คํ๋ก๋ฉ์ ์ํด Transformers [`Trainer`] ํด๋์ค์ ํตํฉ๋์ด ์์ต๋๋ค. ๊ตฌ์ฑ ํ์ผ์ ์ ๊ณตํ๊ฑฐ๋ ์ ๊ณต๋ ํ
ํ๋ฆฟ์ ์ฌ์ฉํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค. ์ถ๋ก ์ ๊ฒฝ์ฐ, Transformers๋ ๋์ฉ๋ ๋ชจ๋ธ์ ๊ฐ์ ธ์ฌ ์ ์์ผ๋ฏ๋ก ZeRO-3 ๋ฐ ์คํ๋ก๋ฉ์ ์ง์ํฉ๋๋ค.
+
+์ด ๊ฐ์ด๋์์๋ DeepSpeed ํธ๋ ์ด๋์ ๋ฐฐํฌํ๋ ๋ฐฉ๋ฒ, ํ์ฑํํ ์ ์๋ ๊ธฐ๋ฅ, ๋ค์ํ ZeRO ๋จ๊ณ์ ๋ํ ๊ตฌ์ฑ ํ์ผ ์ค์ ๋ฐฉ๋ฒ, ์คํ๋ก๋ฉ, ์ถ๋ก ๋ฐ [`Trainer`] ์์ด DeepSpeed๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ์๋ดํด ๋๋ฆฝ๋๋ค.
+
+## ์ค์น[[installation]]
+
+DeepSpeed๋ PyPI ๋๋ Transformers์์ ์ค์นํ ์ ์์ต๋๋ค(์์ธํ ์ค์น ์ต์
์ DeepSpeed [์ค์น ์์ธ์ฌํญ](https://www.deepspeed.ai/tutorials/advanced-install/) ๋๋ GitHub [README](https://github.com/microsoft/deepspeed#installation)๋ฅผ ์ฐธ์กฐํ์ธ์).
+
+
+
+DeepSpeed๋ฅผ ์ค์นํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ์๋ ๊ฒฝ์ฐ [DeepSpeed CUDA ์ค์น](../debugging#deepspeed-cuda-installation) ๊ฐ์ด๋๋ฅผ ํ์ธํ์ธ์. DeepSpeed์๋ pip ์ค์น ๊ฐ๋ฅํ PyPI ํจํค์ง๋ก ์ค์นํ ์ ์์ง๋ง, ํ๋์จ์ด์ ๊ฐ์ฅ ์ ๋ง๊ณ PyPI ๋ฐฐํฌํ์์๋ ์ ๊ณต๋์ง ์๋ 1๋นํธ Adam๊ณผ ๊ฐ์ ํน์ ๊ธฐ๋ฅ์ ์ง์ํ๋ ค๋ฉด [์์ค์์ ์ค์นํ๊ธฐ](https://www.deepspeed.ai/tutorials/advanced-install/#install-deepspeed-from-source)๋ฅผ ์ ๊ทน ๊ถ์ฅํฉ๋๋ค.
+
+
+
+
+
+
+```bash
+pip install deepspeed
+```
+
+
+
+
+```bash
+pip install transformers[deepspeed]
+```
+
+
+
+
+## ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋[[memory-requirements]]
+
+์์ํ๊ธฐ ์ ์ ๋ชจ๋ธ์ ๋ง๋ ์ถฉ๋ถํ GPU ๋ฐ CPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ์๋์ง ํ์ธํ๋ ๊ฒ์ด ์ข์ต๋๋ค. DeepSpeed๋ ํ์ํ CPU/GPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ถ์ ํ ์ ์๋ ๋๊ตฌ๋ฅผ ์ ๊ณตํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ๋จ์ผ GPU์์ [bigscience/T0_3B](bigscience/T0_3B) ๋ชจ๋ธ์ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ ์ถ์ ํ ์ ์์ต๋๋ค:
+
+```bash
+$ python -c 'from transformers import AutoModel; \
+from deepspeed.runtime.zero.stage3 import estimate_zero3_model_states_mem_needs_all_live; \
+model = AutoModel.from_pretrained("bigscience/T0_3B"); \
+estimate_zero3_model_states_mem_needs_all_live(model, num_gpus_per_node=1, num_nodes=1)'
+[...]
+Estimated memory needed for params, optim states and gradients for a:
+HW: Setup with 1 node, 1 GPU per node.
+SW: Model with 2783M total params, 65M largest layer params.
+ per CPU | per GPU | Options
+ 70.00GB | 0.25GB | offload_param=cpu , offload_optimizer=cpu , zero_init=1
+ 70.00GB | 0.25GB | offload_param=cpu , offload_optimizer=cpu , zero_init=0
+ 62.23GB | 5.43GB | offload_param=none, offload_optimizer=cpu , zero_init=1
+ 62.23GB | 5.43GB | offload_param=none, offload_optimizer=cpu , zero_init=0
+ 0.37GB | 46.91GB | offload_param=none, offload_optimizer=none, zero_init=1
+ 15.56GB | 46.91GB | offload_param=none, offload_optimizer=none, zero_init=0
+```
+
+์ฆ, CPU ์คํ๋ก๋๊ฐ ์๋ ๋จ์ผ 80GB GPU ๋๋ ์คํ๋ก๋ ํ 8GB GPU์ ์ต๋ 60GB CPU๊ฐ ํ์ํฉ๋๋ค (์ด๋ ๋งค๊ฐ๋ณ์, ์ต์ ํ ์ํ ๋ฐ ๊ทธ๋ ์ด๋์ธํธ์ ๋ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ผ ๋ฟ์ด๋ฉฐ CUDA ์ปค๋ ๋ฐ ํ์ฑํ์๋ ์กฐ๊ธ ๋ ํ์ํฉ๋๋ค). ๋ํ ๋ ์์ GPU๋ฅผ ๋์ฌํ๊ฑฐ๋ ๊ตฌ์
ํ๋ ๊ฒ์ด ๋ ์ ๋ ดํ์ง๋ง ๋ชจ๋ธ์ ํ๋ จํ๋ ๋ฐ ์๊ฐ์ด ๋ ์ค๋ ๊ฑธ๋ฆฌ๋ฏ๋ก ๋น์ฉ๊ณผ ์๋ ๊ฐ์ ๊ท ํ์ ๊ณ ๋ คํด์ผ ํฉ๋๋ค.
+
+GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ถฉ๋ถํ๋ค๋ฉด CPU/NVMe ์คํ๋ก๋๋ฅผ ๋นํ์ฑํํ์ฌ ๋ชจ๋ ์์
์ ๋ ๋น ๋ฅด๊ฒ ์ฒ๋ฆฌํ์ธ์.
+
+## ZeRO ๋จ๊ณ ์ค์ ํ๊ธฐ[[select-a-zero-stage]]
+
+DeepSpeed๋ฅผ ์ค์นํ๊ณ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ ๋ ์ ํ์
ํ๋ค๋ฉด ๋ค์ ๋จ๊ณ๋ ์ฌ์ฉํ ZeRO ์คํ
์ด์ง๋ฅผ ์ ํํ๋ ๊ฒ์
๋๋ค. ๊ฐ์ฅ ๋น ๋ฅด๊ณ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ด ๋์ ์์๋๋ก ์ ๋ ฌํ๋ฉด ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+| ์๋ | ๋ฉ๋ชจ๋ฆฌ ํจ์จ |
+|------------------|------------------|
+| ZeRO-1 | ZeRO-3 + offload |
+| ZeRO-2 | ZeRO-3 |
+| ZeRO-2 + offload | ZeRO-2 + offload |
+| ZeRO-3 | ZeRO-2 |
+| ZeRO-3 + offload | ZeRO-1 |
+
+์์ ์๊ฒ ๊ฐ์ฅ ์ ํฉํ ๋ฐฉ๋ฒ์ ์ฐพ์ผ๋ ค๋ฉด ๊ฐ์ฅ ๋น ๋ฅธ ๋ฐฉ๋ฒ๋ถํฐ ์์ํ๊ณ ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ถ์กฑํ๋ฉด ๋ ๋๋ฆฌ์ง๋ง ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ด ๋์ ๋ค์ ๋จ๊ณ๋ฅผ ์๋ํ์ธ์. ์๋์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋ ์ฌ์ด์ ์ ์ ํ ๊ท ํ์ ์ฐพ๊ธฐ ์ํด (๊ฐ์ฅ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ ์ด๊ฑฐ๋ ๊ฐ์ฅ ๋น ๋ฅธ ๊ฒ๋ถํฐ ์์ํ์ฌ) ์ํ๋ ๋ฐฉํฅ์ผ๋ก ์์ ๋กญ๊ฒ ์์
ํ์ธ์.
+
+์ผ๋ฐ์ ์ผ๋ก ์ฌ์ฉํ ์ ์๋ ํ๋ก์ธ์ค๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค(๋ฐฐ์น ํฌ๊ธฐ 1๋ก ์์):
+
+1. ๊ทธ๋ ์ด๋์ธํธ ์ฒดํฌํฌ์ธํ
ํ์ฑํ
+2. ZeRO-2 ์๋
+3. ZeRO-2์ ๋งค๊ฐ๋ณ์ ์คํ๋ก๋ ์๋
+4. ZeRO-3 ์๋
+5. ZeRO-3๊ณผ ๋งค๊ฐ๋ณ์ CPU ์คํ๋ก๋ ์๋
+6. ZeRO-3, ๋งค๊ฐ๋ณ์์ ์ตํฐ๋ง์ด์ CPU ์คํ๋ก๋ ์๋
+7. [`~GenerationMixin.generate`] ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋ ์ข์ ๋น ์์น ๊ฒ์ ๋ฒ์์ ๊ฐ์ ๋ค์ํ ๊ธฐ๋ณธ๊ฐ์ ๋ฎ์ถฐ๋ณด๊ธฐ
+8. ์ ์ฒด ์ ๋ฐ๋ ๊ฐ์ค์น๋ณด๋ค ๋ฐ์ ๋ฐ๋(๊ตฌํ GPU ๊ตฌ์กฐ์ ๊ฒฝ์ฐ fp16, ์ํ์ด ์ดํ GPU์ ๊ฒฝ์ฐ bf16)๋ฅผ ํผํฉํด๋ณด๊ธฐ
+9. ๊ฐ๋ฅํ๋ฉด ํ๋์จ์ด๋ฅผ ๋ ์ถ๊ฐํ๊ฑฐ๋ Infinity๊ฐ ๋งค๊ฐ๋ณ์์ ์ตํฐ๋ง์ด์ ๋ฅผ NVMe๋ก ์คํ๋ก๋ํ๋๋ก ํ์ฑํ
+10. ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ถ์กฑํ์ง ์์ผ๋ฉด ์ ํจ ์ฒ๋ฆฌ๋์ ์ธก์ ํ ๋ค์ ๋ฐฐ์น ํฌ๊ธฐ๋ฅผ ์ต๋ํ ํฌ๊ฒ ๋๋ ค GPU ํจ์จ์ฑ์ ๊ทน๋ํ
+11. ๋ง์ง๋ง์ผ๋ก ์ผ๋ถ ์คํ๋ก๋ ๊ธฐ๋ฅ์ ๋นํ์ฑํํ๊ฑฐ๋ ๋ ๋น ๋ฅธ ZeRO ์คํ
์ด์ง๋ฅผ ์ฌ์ฉํ๊ณ ๋ฐฐ์น ํฌ๊ธฐ๋ฅผ ๋๋ฆฌ๊ฑฐ๋ ์ค์ฌ ์๋์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋ ๊ฐ์ ์ต์ ์ ๊ท ํ์ ์ฐพ์ ํธ๋ ์ด๋ ์ค์ ์ ์ต์ ํ
+
+
+## DeepSpeed ๊ตฌ์ฑ ํ์ผ[[deepspeed-configuration-file]]
+
+DeepSpeed๋ ํธ๋ ์ด๋ ์คํ ๋ฐฉ๋ฒ์ ๊ตฌ์ฑํ๋ ๋ชจ๋ ๋งค๊ฐ๋ณ์๊ฐ ํฌํจ๋ ๊ตฌ์ฑ ํ์ผ์ ํตํด [`Trainer`] ํด๋์ค์ ํจ๊ป ์๋ํฉ๋๋ค. ํธ๋ ์ด๋ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ๋ฉด DeepSpeed๋ [`Trainer`]๋ก๋ถํฐ ๋ฐ์ ๊ตฌ์ฑ์ ์ฝ์์ ๊ธฐ๋กํ๋ฏ๋ก ์ด๋ค ๊ตฌ์ฑ์ด ์ฌ์ฉ๋์๋์ง ์ ํํ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+
+DeepSpeed ๊ตฌ์ฑ ์ต์
์ ์ ์ฒด ๋ชฉ๋ก์ [DeepSpeed Configuration JSON](https://www.deepspeed.ai/docs/config-json/)์์ ํ์ธํ ์ ์์ต๋๋ค. ๋ํ [DeepSpeedExamples](https://github.com/microsoft/DeepSpeedExamples) ๋ฆฌํฌ์งํ ๋ฆฌ ๋๋ ๊ธฐ๋ณธ [DeepSpeed](https://github.com/microsoft/DeepSpeed) ๋ฆฌํฌ์งํ ๋ฆฌ์์ ๋ค์ํ DeepSpeed ๊ตฌ์ฑ ์์ ์ ๋ํ ๋ณด๋ค ์ค์ฉ์ ์ธ ์์ ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ๊ตฌ์ฒด์ ์ธ ์์ ๋ฅผ ๋น ๋ฅด๊ฒ ์ฐพ์ผ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ํ์ธ์:
+
+```bash
+git clone https://github.com/microsoft/DeepSpeedExamples
+cd DeepSpeedExamples
+find . -name '*json'
+# Lamb ์ตํฐ๋ง์ด์ ์ํ ์ฐพ๊ธฐ
+grep -i Lamb $(find . -name '*json')
+```
+
+
+
+๋ช
๋ น์ค ์ธํฐํ์ด์ค์์ ํธ๋ ์ด๋ํ๋ ๊ฒฝ์ฐ DeepSpeed ๊ตฌ์ฑ ํ์ผ์ JSON ํ์ผ์ ๊ฒฝ๋ก๋ก ์ ๋ฌ๋๊ฑฐ๋ ๋
ธํธ๋ถ ์ค์ ์์ [`Trainer`]๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ์ค์ฒฉ๋ `dict` ๊ฐ์ฒด๋ก ์ ๋ฌ๋ฉ๋๋ค.
+
+
+
+
+```py
+TrainingArguments(..., deepspeed="path/to/deepspeed_config.json")
+```
+
+
+
+
+```py
+ds_config_dict = dict(scheduler=scheduler_params, optimizer=optimizer_params)
+args = TrainingArguments(..., deepspeed=ds_config_dict)
+trainer = Trainer(model, args, ...)
+```
+
+
+
+
+### DeepSpeed์ Trainer ๋งค๊ฐ๋ณ์[[deepspeed-and-trainer-parameters]]
+
+๊ตฌ์ฑ ๋งค๊ฐ๋ณ์์๋ ์ธ ๊ฐ์ง ์ ํ์ด ์์ต๋๋ค:
+
+1. ์ผ๋ถ ๊ตฌ์ฑ ๋งค๊ฐ๋ณ์๋ [`Trainer`]์ DeepSpeed๊ฐ ๊ณต์ ํ๋ฉฐ, ์ ์๊ฐ ์ถฉ๋ํ๋ ๊ฒฝ์ฐ ์ค๋ฅ๋ฅผ ์๋ณํ๊ธฐ ์ด๋ ค์ธ ์ ์์ต๋๋ค. ์ด๋ฌํ ๊ณต์ ๊ตฌ์ฑ ๋งค๊ฐ๋ณ์๋ [`Trainer`] ๋ช
๋ น์ค ์ธ์์์ ์ฝ๊ฒ ์ค์ ํ ์ ์์ต๋๋ค.
+
+2. ๋ชจ๋ธ ์ค์ ์์ ์๋์ผ๋ก ๋์ถ๋๋ ์ผ๋ถ ์ค์ ๋งค๊ฐ๋ณ์๋ ์๋์ผ๋ก ๊ฐ์ ์กฐ์ ํ ํ์๊ฐ ์์ต๋๋ค. [`Trainer`]๋ ๊ตฌ์ฑ ๊ฐ `auto`๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ฅ ์ ํํ๊ฑฐ๋ ํจ์จ์ ์ธ ๊ฐ์ ์ค์ ํฉ๋๋ค. ์ง์ ๊ตฌ์ฑ ๋งค๊ฐ๋ณ์๋ฅผ ๋ช
์์ ์ผ๋ก ์ค์ ํ ์๋ ์์ง๋ง, [`Trainer`] ์ธ์์ DeepSpeed ์ค์ ๋งค๊ฐ๋ณ์๊ฐ ์ผ์นํ๋๋ก ์ฃผ์ํด์ผ ํฉ๋๋ค. ์ผ์นํ์ง ์์ผ๋ฉด ๊ฐ์งํ๊ธฐ ๋งค์ฐ ์ด๋ ค์ด ๋ฐฉ์์ผ๋ก ํ๋ จ์ด ์คํจํ ์ ์์ต๋๋ค!
+
+3. ๊ต์ก ์๊ตฌ ์ฌํญ์ ๋ฐ๋ผ ์๋์ผ๋ก ์ค์ ํด์ผ ํ๋ ์ผ๋ถ ์ค์ ๋งค๊ฐ๋ณ์๋ DeepSpeed์๋ง ํด๋น๋ฉ๋๋ค.
+
+DeepSpeed ๊ตฌ์ฑ์ ์์ ํ๊ณ [`TrainingArguments`]๋ฅผ ํธ์งํ ์๋ ์์ต๋๋ค:
+
+1. ๊ธฐ๋ณธ ๊ตฌ์ฑ์ผ๋ก ์ฌ์ฉํ DeepSpeed ๊ตฌ์ฑ ํ์ผ์ ์์ฑํ๊ฑฐ๋ ๋ก๋ํฉ๋๋ค.
+2. ๋ค์ DeepSpeed ๊ตฌ์ฑ์ ๊ธฐ๋ฐ์ผ๋ก [`TrainingArguments`] ๊ฐ์ฒด๋ฅผ ์์ฑํฉ๋๋ค.
+
+`scheduler.params.total_num_steps`์ ๊ฐ์ ์ผ๋ถ ๊ฐ์ ํธ๋ ์ด๋ ์ค [`Trainer`]์ ์ํด ๊ณ์ฐ๋ฉ๋๋ค.
+
+### ZeRO ๊ตฌ์ฑ[[zero-configuration]]
+
+์ธ ๊ฐ์ง ๊ตฌ์ฑ์ด ์์ผ๋ฉฐ, ๊ฐ ๊ตฌ์ฑ์ ์๋ก ๋ค๋ฅธ ZeRO ๋จ๊ณ์ ํด๋นํฉ๋๋ค. 1๋จ๊ณ๋ ํ์ฅ์ฑ ์ธก๋ฉด์์ ๊ทธ๋ค์ง ๋์ฌ๊ฒจ๋ณผ๋งํ์ง ์์ผ๋ฏ๋ก ์ด ๊ฐ์ด๋์์๋ 2๋จ๊ณ์ 3๋จ๊ณ์ ์ค์ ์ ๋ก๋๋ค. `zero_optimization` ๊ตฌ์ฑ์๋ ํ์ฑํํ ํญ๋ชฉ๊ณผ ๊ตฌ์ฑ ๋ฐฉ๋ฒ์ ๋ํ ๋ชจ๋ ์ต์
์ด ํฌํจ๋์ด ์์ต๋๋ค. ๊ฐ ๋งค๊ฐ๋ณ์์ ๋ํ ์์ธํ ์ค๋ช
์ [DeepSpeed ๊ตฌ์ฑ JSON](https://www.deepspeed.ai/docs/config-json/) ์ฐธ์กฐ๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+
+DeepSpeed๋ ๋งค๊ฐ๋ณ์ ์ด๋ฆ์ ์ ํจ์ฑ์ ๊ฒ์ฌํ์ง ์์ผ๋ฉฐ ์คํ๊ฐ ์์ผ๋ฉด ๋งค๊ฐ๋ณ์์ ๊ธฐ๋ณธ ์ค์ ์ผ๋ก ๋์ฒดํฉ๋๋ค. DeepSpeed ์์ง ์์ ๋ก๊ทธ ๋ฉ์์ง๋ฅผ ๋ณด๊ณ ์ด๋ค ๊ฐ์ ์ฌ์ฉํ ์ง ํ์ธํ ์ ์์ต๋๋ค.
+
+
+
+[`Trainer`]๋ ๋๋ฑํ ๋ช
๋ น์ค ์ธ์๋ฅผ ์ ๊ณตํ์ง ์์ผ๋ฏ๋ก ๋ค์ ๊ตฌ์ฑ์ DeepSpeed๋ก ์ค์ ํด์ผ ํฉ๋๋ค.
+
+
+
+
+ZeRO-1์ ์ตํฐ๋ง์ด์ ์ํ๋ฅผ GPU์ ๋ถํ ํ์ฌ ์ฝ๊ฐ์ ์๋ ํฅ์์ ๊ธฐ๋ํ ์ ์์ต๋๋ค. ZeRO-1 ๊ตฌ์ฑ์ ๋ค์๊ณผ ๊ฐ์ด ์ค์ ํ ์ ์์ต๋๋ค:
+
+```yml
+{
+ "zero_optimization": {
+ "stage": 1
+ }
+}
+```
+
+
+
+
+ZeRO-2๋ GPU์์ ์ตํฐ๋ง์ด์ ์ ๊ทธ๋ ์ด๋์ธํธ๋ฅผ ๋ถํ ํฉ๋๋ค. ์ด ๋จ๊ณ๋ ์ถ๋ก ๊ณผ ๊ด๋ จ์ด ์๋ ๊ธฐ๋ฅ์ด๊ธฐ ๋๋ฌธ์ ์ฃผ๋ก ํ๋ จ์ ์ฌ์ฉ๋ฉ๋๋ค. ๋ ๋์ ์ฑ๋ฅ์ ์ํด ๊ตฌ์ฑํด์ผ ํ ๋ช ๊ฐ์ง ์ค์ํ ๋งค๊ฐ๋ณ์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+* GPU ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ์ค์ด๋ ค๋ฉด `offload_optimizer`๋ฅผ ํ์ฑํํด์ผ ํฉ๋๋ค.
+* `true`๋ก ์ค์ ๋ ๊ฒฝ์ฐ `overlap_comm`์ GPU ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋ ์ฆ๊ฐ๋ฅผ ์์ํ์ฌ ์ง์ฐ ์๊ฐ์ ์ค์
๋๋ค. ์ด ๊ธฐ๋ฅ์ 4.5๋ฐฐ์ `allgather_bucket_size` ๋ฐ `reduce_bucket_size`๊ฐ์ ์ฌ์ฉํฉ๋๋ค. ์ด ์์์๋ `5e8`๋ก ์ค์ ๋์ด ์์ผ๋ฏ๋ก 9GB์ GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ํ์ํฉ๋๋ค. GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ 8GB ์ดํ์ธ ๊ฒฝ์ฐ, ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋์ ๋ฎ์ถ๊ณ ๋ฉ๋ชจ๋ฆฌ ๋ถ์กฑ(OOM) ์ค๋ฅ๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด `overlap_comm`์ ์ค์ฌ์ผ ํฉ๋๋ค.
+* `allgather_bucket_size`์ `reduce_bucket_size`๋ ์ฌ์ฉ ๊ฐ๋ฅํ GPU ๋ฉ๋ชจ๋ฆฌ์ ํต์ ์๋๋ฅผ ์ ์ถฉํฉ๋๋ค. ๊ฐ์ด ์์์๋ก ํต์ ์๋๊ฐ ๋๋ ค์ง๊ณ ๋ ๋ง์ GPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ๋ฐฐ์น ํฌ๊ธฐ๊ฐ ํฐ ๊ฒ์ด ์ฝ๊ฐ ๋๋ฆฐ ํ๋ จ ์๊ฐ๋ณด๋ค ๋ ์ค์ํ์ง ๊ท ํ์ ๋ง์ถ ์ ์์ต๋๋ค.
+* DeepSpeed 0.4.4์์๋ CPU ์คํ๋ก๋ฉ์ ์ํด `round_robin_gradients`๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์ด ๊ธฐ๋ฅ์ ์ธ๋ถํ๋ ๊ทธ๋ ์ด๋์ธํธ ํํฐ์
๋์ ํตํด ๋ฑ๊ธ ๊ฐ ๊ทธ๋ ์ด๋์ธํธ ๋ณต์ฌ๋ฅผ CPU ๋ฉ๋ชจ๋ฆฌ๋ก ๋ณ๋ ฌํํฉ๋๋ค. ์ฑ๋ฅ ์ด์ ์ ๊ทธ๋ ์ด๋์ธํธ ๋์ ๋จ๊ณ(์ต์ ํ ๋จ๊ณ ๊ฐ ๋ณต์ฌ ํ์ ์ฆ๊ฐ) ๋๋ GPU ์(๋ณ๋ ฌ ์ฒ๋ฆฌ ์ฆ๊ฐ)์ ๋ฐ๋ผ ์ฆ๊ฐํฉ๋๋ค.
+
+```yml
+{
+ "zero_optimization": {
+ "stage": 2,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "allgather_partitions": true,
+ "allgather_bucket_size": 5e8,
+ "overlap_comm": true,
+ "reduce_scatter": true,
+ "reduce_bucket_size": 5e8,
+ "contiguous_gradients": true
+ "round_robin_gradients": true
+ }
+}
+```
+
+
+
+
+ZeRO-3๋ ์ตํฐ๋ง์ด์ , ๊ทธ๋๋์ธํธ, ๋งค๊ฐ๋ณ์๋ฅผ ์ฌ๋ฌ GPU์ ๊ฑธ์ณ ๋ถํ ํฉ๋๋ค. ZeRO-2์ ๋ฌ๋ฆฌ ZeRO-3๋ ์ฌ๋ฌ GPU์ ๋๊ท๋ชจ ๋ชจ๋ธ์ ๊ฐ์ ธ์ฌ ์ ์๊ธฐ ๋๋ฌธ์ ํ๋ จ ์ธ์๋ ์ถ๋ก ์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๊ตฌ์ฑํด์ผ ํ ๋ช ๊ฐ์ง ์ค์ํ ๋งค๊ฐ๋ณ์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+* `device: "cpu"` ๋ GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ถ์กฑํ๊ณ ์ฌ์ฉ ๊ฐ๋ฅํ CPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ์๋ ๊ฒฝ์ฐ ๋์์ด ๋ ์ ์์ต๋๋ค. ์ด๋ฅผ ํตํด ๋ชจ๋ธ ๋งค๊ฐ๋ณ์๋ฅผ CPU๋ก ์คํ๋ก๋ํ ์ ์์ต๋๋ค.
+* `pin_memory: true` ๋ ์ฒ๋ฆฌ๋์ ํฅ์์ํฌ ์ ์์ง๋ง, ํ ๋ฉ๋ชจ๋ฆฌ๋ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์์ฒญํ ํน์ ํ๋ก์ธ์ค๋ฅผ ์ํด ์์ฝ๋์ด ์๊ณ ์ผ๋ฐ์ ์ผ๋ก ์ผ๋ฐ CPU ๋ฉ๋ชจ๋ฆฌ๋ณด๋ค ํจ์ฌ ๋น ๋ฅด๊ฒ ์ก์ธ์ค๋๊ธฐ ๋๋ฌธ์ ๋ค๋ฅธ ํ๋ก์ธ์ค์์ ์ฌ์ฉํ ์ ์๋ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ค์ด๋ญ๋๋ค.
+* `stage3_max_live_parameters` ๋ ํน์ ์๊ฐ์ GPU์ ์ ์งํ๋ ค๋ ์ ์ฒด ๋งค๊ฐ๋ณ์์ ์ํ๊ฐ์
๋๋ค. OOM ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ฉด ์ด ๊ฐ์ ์ค์ด์ธ์.
+* `stage3_max_reuse_distance` ๋ ํฅํ ๋งค๊ฐ๋ณ์๋ฅผ ๋ค์ ์ฌ์ฉํ ์๊ธฐ๋ฅผ ๊ฒฐ์ ํ๋ ๊ฐ์ผ๋ก, ๋งค๊ฐ๋ณ์๋ฅผ ๋ฒ๋ฆด์ง ์ ์งํ ์ง ๊ฒฐ์ ํ๋ ๋ฐ ๋์์ด ๋ฉ๋๋ค. ๋งค๊ฐ๋ณ์๋ฅผ ์ฌ์ฌ์ฉํ ๊ฒฝ์ฐ(`stage3_max_reuse_distance`๋ณด๋ค ์์ ๊ฐ์ธ ๊ฒฝ์ฐ) ํต์ ์ค๋ฒํค๋๋ฅผ ์ค์ด๊ธฐ ์ํด ๋งค๊ฐ๋ณ์๋ฅผ ์ ์งํฉ๋๋ค. ์ด ๊ธฐ๋ฅ์ ํ์ฑํ ์ฒดํฌํฌ์ธํ
์ด ํ์ฑํ๋์ด ์๊ณ ์ญ์ ํ ๊ณ์ฐ์๊น์ง ์์ ํ ์์ ์ ๋งค๊ฐ๋ณ์๋ฅผ ์ ์งํ๋ ค๋ ๊ฒฝ์ฐ์ ๋งค์ฐ ์ ์ฉํฉ๋๋ค. ๊ทธ๋ฌ๋ OOM ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ฉด ์ด ๊ฐ์ ์ค์ด์ธ์.
+* ๋ชจ๋ธ ์ ์ฅ ์ `stage3_gather_16bit_weights_on_model_save`๋ fp16 ๊ฐ์ค์น๋ฅผ ํตํฉํฉ๋๋ค. ๋๊ท๋ชจ ๋ชจ๋ธ์ ํ์ตํ๊ฑฐ๋ ์ฌ๋ฌ GPU๋ฅผ ์ฌ์ฉํ ๊ฒฝ์ฐ ๋ฉ๋ชจ๋ฆฌ์ ์๋ ์ธก๋ฉด์์ ๋น์ฉ์ด ๋ง์ด ๋ญ๋๋ค. ํ๋ จ์ ์ฌ๊ฐํ ๊ณํ์ด๋ผ๋ฉด ์ด ์ต์
์ ํ์ฑํํด์ผ ํฉ๋๋ค.
+* `sub_group_size` ๋ ์ต์ ํ ๋จ๊ณ์์ ์
๋ฐ์ดํธ๋๋ ๋งค๊ฐ๋ณ์๋ฅผ ์ ์ดํฉ๋๋ค. ๋งค๊ฐ๋ณ์๋ `sub_group_size`์ ๋ฒํท์ผ๋ก ๊ทธ๋ฃนํ๋๋ฉฐ ๊ฐ ๋ฒํท์ ํ ๋ฒ์ ํ๋์ฉ ์
๋ฐ์ดํธ๋ฉ๋๋ค. NVMe ์คํ๋ก๋์ ํจ๊ป ์ฌ์ฉํ๋ ๊ฒฝ์ฐ `sub_group_size`๋ ์ต์ ํ ๋จ๊ณ ์ค ๋ชจ๋ธ ์ํ๊ฐ CPU ๋ฉ๋ชจ๋ฆฌ๋ก ์ด๋ํ๋ ์์ ์ ๊ฒฐ์ ํฉ๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ๋งค์ฐ ํฐ ๋ชจ๋ธ์ CPU ๋ฉ๋ชจ๋ฆฌ ๋ถ์กฑ์ ๋ฐฉ์งํ ์ ์์ต๋๋ค. NVMe ์คํ๋ก๋๋ฅผ ์ฌ์ฉํ์ง ์๋ ๊ฒฝ์ฐ `sub_group_size`๋ฅผ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ๋ ์ ์์ง๋ง, ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋ณ๊ฒฝํ๋ ๊ฒ์ด ์ข์ต๋๋ค:
+
+ 1. ์ตํฐ๋ง์ด์ ๋จ๊ณ์์ OOM ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ด ๊ฒฝ์ฐ, ์์ ๋ฒํผ์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ์ค์ด๋ ค๋ฉด `sub_group_size`๋ฅผ ์ค์ด์ธ์.
+ 2. ์ตํฐ๋ง์ด์ ๋จ๊ณ์์ ์๊ฐ์ด ๋๋ฌด ์ค๋ ๊ฑธ๋ฆฝ๋๋ค. ์ด ๊ฒฝ์ฐ ๋ฐ์ดํฐ ๋ฒํผ ์ฆ๊ฐ๋ก ์ธํ ๋์ญํญ ์ฌ์ฉ๋ฅ ์ ๊ฐ์ ํ๊ธฐ ์ํด `sub_group_size`๋ฅผ ๋๋ฆฌ์ธ์.
+
+* `reduce_bucket_size`, `stage3_prefetch_bucket_size`, `stage3_param_persistence_threshold`๋ ๋ชจ๋ธ์ ์จ๊ฒจ์ง ํฌ๊ธฐ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋๋ค. ์ด ๊ฐ๋ค์ `auto`์ผ๋ก ์ค์ ํ๊ณ [`Trainer`]๊ฐ ์๋์ผ๋ก ๊ฐ์ ํ ๋นํ๋๋ก ํ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+```yml
+{
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": "auto",
+ "stage3_prefetch_bucket_size": "auto",
+ "stage3_param_persistence_threshold": "auto",
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ }
+}
+```
+
+[`deepspeed.zero.Init`](https://deepspeed.readthedocs.io/en/latest/zero3.html#deepspeed.zero.Init) ์ปจํ
์คํธ ๋งค๋์ ๋ฅผ ์ฌ์ฉํ๋ฉด ๋ชจ๋ธ์ ๋ ๋น ๋ฅด๊ฒ ์ด๊ธฐํํ ์ ์์ต๋๋ค:
+
+```py
+from transformers import T5ForConditionalGeneration, T5Config
+import deepspeed
+
+with deepspeed.zero.Init():
+ config = T5Config.from_pretrained("google-t5/t5-small")
+ model = T5ForConditionalGeneration(config)
+```
+
+์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ๋ฅ์คํผ๋ ๊ตฌ์ฑ ํ์ผ์ `is_deepspeed_zero3_enabled: true`๊ฐ [`TrainingArguments`]์ ์ค์ ๋์ด ์์ด์ผ ํ๋ฉฐ, ZeRO ๊ตฌ์ฑ์ด ํ์ฑํ๋์ด ์์ด์ผ ํฉ๋๋ค. ํ๋ จ๋ ๋ชจ๋ธ [`~PreTrainedModel.from_pretrained`]์ ํธ์ถํ๊ธฐ **์ ์** [`TrainingArguments`] ๊ฐ์ฒด๋ฅผ ์์ฑํด์ผ ํฉ๋๋ค.
+
+```py
+from transformers import AutoModel, Trainer, TrainingArguments
+
+training_args = TrainingArguments(..., deepspeed=ds_config)
+model = AutoModel.from_pretrained("google-t5/t5-small")
+trainer = Trainer(model=model, args=training_args, ...)
+```
+
+fp16 ๊ฐ์ค์น๊ฐ ๋จ์ผ GPU์ ๋ง์ง ์๋ ๊ฒฝ์ฐ ZeRO-3์ด ํ์ํฉ๋๋ค. fp16 ๊ฐ์ค์น๋ฅผ ๋ก๋ํ ์ ์๋ ๊ฒฝ์ฐ, [`~PreTrainedModel.from_pretrained`]์ `torch_dtype=torch.float16`์ ์ง์ ํด์ผ ํฉ๋๋ค.
+
+ZeRO-3์ ๋ ๋ค๋ฅธ ๊ณ ๋ ค ์ฌํญ์ ์ฌ๋ฌ ๊ฐ์ GPU๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ํ์ฌ ์คํ ์ค์ธ ๋ ์ด์ด์ ๋งค๊ฐ๋ณ์๊ฐ ์๋ ํ ๋จ์ผ GPU์ ๋ชจ๋ ๋งค๊ฐ๋ณ์๊ฐ ์๋ค๋ ๊ฒ์
๋๋ค. ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ ๊ฐ์ค์น๋ฅผ [`~PreTrainedModel.from_pretrained`]์ ๋ก๋ํ๋ ๋ฑ ๋ชจ๋ ๋ ์ด์ด์ ๋ชจ๋ ๋งค๊ฐ๋ณ์์ ํ ๋ฒ์ ์ก์ธ์คํ๋ ค๋ฉด ํ ๋ฒ์ ํ๋์ ๋ ์ด์ด๋ฅผ ๋ก๋ํ๊ณ ์ฆ์ ๋ชจ๋ GPU์ ํํฐ์
๋ํฉ๋๋ค. ์ด๋ ๋งค์ฐ ํฐ ๋ชจ๋ธ์ ๊ฒฝ์ฐ ๋ฉ๋ชจ๋ฆฌ ์ ํ์ผ๋ก ์ธํด ํ๋์ GPU์ ๊ฐ์ค์น๋ฅผ ๋ก๋ํ ๋ค์ ๋ค๋ฅธ GPU์ ๋ถ์ฐํ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+๋ค์๊ณผ ๊ฐ์ด ๋ณด์ด๋ ๋ชจ๋ธ ๋งค๊ฐ๋ณ์ ๊ฐ์ค์น(์ฌ๊ธฐ์ `tensor([1.])`) ๋๋ ๋งค๊ฐ๋ณ์ ํฌ๊ธฐ๊ฐ ๋ ํฐ ๋ค์ฐจ์ ํํ ๋์ 1์ธ ๊ฒฝ์ฐ, ์ด๋ ๋งค๊ฐ๋ณ์๊ฐ ๋ถํ ๋์ด ์์ผ๋ฉฐ ์ด๊ฒ์ด ZeRO-3 ํ๋ ์ด์คํ๋์ธ ๊ฒ์ ์๋ฏธํฉ๋๋ค.
+
+```py
+tensor([1.0], device="cuda:0", dtype=torch.float16, requires_grad=True)
+```
+
+
+
+ZeRO-3๋ก ๋๊ท๋ชจ ๋ชจ๋ธ์ ์ด๊ธฐํํ๊ณ ๋งค๊ฐ๋ณ์์ ์ก์ธ์คํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์ธํ ๋ด์ฉ์ [Constructing Massive Models](https://deepspeed.readthedocs.io/en/latest/zero3.html#constructing-massive-models) ๋ฐ [Gathering Parameters](https://deepspeed.readthedocs.io/en/latest/zero3.html#gathering-parameters) ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+
+
+
+
+
+### NVMe ์ค์ [[nvme-configuration]]
+
+[ZeRO-Infinity](https://hf.co/papers/2104.07857)๋ฅผ ์ฌ์ฉํ๋ฉด ๋ชจ๋ธ ์ํ๋ฅผ CPU ๋ฐ/๋๋ NVMe๋ก ์คํ๋ก๋ํ์ฌ ๋ ๋ง์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ ์ฝํ ์ ์์ต๋๋ค. ์ค๋งํธ ํํฐ์
๋ ๋ฐ ํ์ผ๋ง ์๊ณ ๋ฆฌ์ฆ์ ํตํด ๊ฐ GPU๋ ์คํ๋ก๋ฉ ์ค์ ๋งค์ฐ ์ ์ ์์ ๋ฐ์ดํฐ๋ฅผ ์ฃผ๊ณ ๋ฐ์ ์ ์์ผ๋ฏ๋ก ์ต์ NVMe๋ ํ๋ จ ํ๋ก์ธ์ค์ ์ฌ์ฉํ ์ ์๋ ๊ฒ๋ณด๋ค ํจ์ฌ ๋ ํฐ ์ด ๋ฉ๋ชจ๋ฆฌ ํ์ ๋ง์ถ ์ ์์ต๋๋ค. ZeRO-Infinity์๋ ZeRO-3๊ฐ ํ์ํฉ๋๋ค.
+
+์ฌ์ฉ ๊ฐ๋ฅํ CPU ๋ฐ/๋๋ NVMe ๋ฉ๋ชจ๋ฆฌ์ ๋ฐ๋ผ [์ตํฐ๋ง์ด์ ](https://www.deepspeed.ai/docs/config-json/#optimizer-offloading)์ [๋งค๊ฐ๋ณ์](https://www.deepspeed.ai/docs/config-json/#parameter-offloading) ์ค ํ๋๋ง ์คํ๋ก๋ํ๊ฑฐ๋ ์๋ฌด๊ฒ๋ ์คํ๋ก๋ํ์ง ์์ ์ ์์ต๋๋ค. ๋ํ ์ผ๋ฐ ํ๋ ๋๋ผ์ด๋ธ๋ ์๋ฆฌ๋ ์คํ
์ดํธ ๋๋ผ์ด๋ธ์์๋ ์๋ํ์ง๋ง ์๋๊ฐ ํ์ ํ ๋๋ ค์ง๋ฏ๋ก `nvme_path`๊ฐ NVMe ์ฅ์น๋ฅผ ๊ฐ๋ฆฌํค๊ณ ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค. ์ต์ NVMe๋ฅผ ์ฌ์ฉํ๋ฉด ์ฝ๊ธฐ ์์
์ ๊ฒฝ์ฐ ์ต๋ 3.5GB/s, ์ฐ๊ธฐ ์์
์ ๊ฒฝ์ฐ ์ต๋ 3GB/s์ ์ ์ก ์๋๋ฅผ ๊ธฐ๋ํ ์ ์์ต๋๋ค. ๋ง์ง๋ง์ผ๋ก, ํธ๋ ์ด๋ ์ค์ ์์ [๋ฒค์น๋งํฌ ์คํํ๊ธฐ](https://github.com/microsoft/DeepSpeed/issues/998)์ ํตํด ์ต์ ์ 'aio' ๊ตฌ์ฑ์ ๊ฒฐ์ ํฉ๋๋ค.
+
+์๋ ์์ ZeRO-3/Infinity ๊ตฌ์ฑ ํ์ผ์ ๋๋ถ๋ถ์ ๋งค๊ฐ๋ณ์ ๊ฐ์ `auto`์ผ๋ก ์ค์ ํ๊ณ ์์ง๋ง, ์๋์ผ๋ก ๊ฐ์ ์ถ๊ฐํ ์๋ ์์ต๋๋ค.
+
+```yml
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "nvme",
+ "nvme_path": "/local_nvme",
+ "pin_memory": true,
+ "buffer_count": 4,
+ "fast_init": false
+ },
+ "offload_param": {
+ "device": "nvme",
+ "nvme_path": "/local_nvme",
+ "pin_memory": true,
+ "buffer_count": 5,
+ "buffer_size": 1e8,
+ "max_in_cpu": 1e9
+ },
+ "aio": {
+ "block_size": 262144,
+ "queue_depth": 32,
+ "thread_count": 1,
+ "single_submit": false,
+ "overlap_events": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": "auto",
+ "stage3_prefetch_bucket_size": "auto",
+ "stage3_param_persistence_threshold": "auto",
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ },
+
+ "gradient_accumulation_steps": "auto",
+ "gradient_clipping": "auto",
+ "steps_per_print": 2000,
+ "train_batch_size": "auto",
+ "train_micro_batch_size_per_gpu": "auto",
+ "wall_clock_breakdown": false
+}
+```
+
+## DeepSpeed ๊ตฌ์ฑ[[deepspeed-features]]
+
+์ด ์น์
์์ ๊ฐ๋ตํ๊ฒ ์ค๋ช
ํ๋ ๋ช ๊ฐ์ง ์ค์ํ ๋งค๊ฐ๋ณ์๋ฅผ DeepSpeed ๊ตฌ์ฑ ํ์ผ์ ์ง์ ํ ์ ์์ต๋๋ค.
+
+### ํ์ฑํ/๊ทธ๋ ์ด๋์ธํธ ์ฒดํฌํฌ์ธํ
[[activationgradient-checkpointing]]
+
+ํ์ฑํ ๋ฐ ๊ทธ๋ ์ด๋์ธํธ ์ฒดํฌํฌ์ธํ
์ ์๋๋ฅผ ๋ ๋ง์ GPU ๋ฉ๋ชจ๋ฆฌ์ ๊ตํํ์ฌ GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ถ์กฑํ ์ํฉ์ ๊ทน๋ณตํ๊ฑฐ๋ ๋ฐฐ์น ํฌ๊ธฐ๋ฅผ ๋๋ ค ์ฑ๋ฅ์ ํฅ์์ํฌ ์ ์์ต๋๋ค. ์ด ๊ธฐ๋ฅ์ ํ์ฑํํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ํ์ธ์:
+
+1. ํ๊น
ํ์ด์ค ๋ชจ๋ธ์ ๊ฒฝ์ฐ, [`Trainer`]์์ `model.gradient_checkpointing_enable()` ๋๋ `--gradient_checkpointing`์ ์ค์ ํฉ๋๋ค.
+2. ํ๊น
ํ์ด์ค๊ฐ ์๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ๋ฅ์คํผ๋ [Activation Checkpointing API](https://deepspeed.readthedocs.io/en/latest/activation-checkpointing.html)๋ฅผ ์ฌ์ฉํฉ๋๋ค. ํธ๋์คํฌ๋จธ ๋ชจ๋ธ๋ง ์ฝ๋๋ฅผ ๋์ฒดํ๊ณ `torch.utils.checkpoint`๋ฅผ DeepSpeed API๋ก ๋์ฒดํ ์๋ ์์ต๋๋ค. ์ด ์ ๊ทผ ๋ฐฉ์์ ์๋ฐฉํฅ ํ์ฑํ๋ฅผ ๋ค์ ๊ณ์ฐํ๋ ๋์ CPU ๋ฉ๋ชจ๋ฆฌ๋ก ์คํ๋ก๋ํ ์ ์์ผ๋ฏ๋ก ๋ ์ ์ฐํฉ๋๋ค.
+
+### ์ตํฐ๋ง์ด์ ์ ์ค์ผ์ค๋ฌ[[optimizer-and-scheduler]]
+
+`offload_optimizer`๋ฅผ ํ์ฑํํ์ง ์๋ ํ DeepSpeed์ ํธ๋์คํฌ๋จธ ์ตํฐ๋ง์ด์ ๋ฐ ์ค์ผ์ค๋ฌ๋ฅผ ํผํฉํ์ฌ ์ฌ์ฉํ ์ ์์ต๋๋ค. `offload_optimizer`๋ฅผ ํ์ฑํํ๋ฉด CPU์ GPU ๊ตฌํ์ด ๋ชจ๋ ์๋ ๊ฒฝ์ฐ DeepSpeed๊ฐ ์๋ ์ต์ ํ๊ธฐ(LAMB ์ ์ธ)๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+
+
+๊ตฌ์ฑ ํ์ผ์ ์ต์ ํ ํ๋ก๊ทธ๋จ ๋ฐ ์ค์ผ์ค๋ฌ ๋งค๊ฐ๋ณ์๋ ๋ช
๋ น์ค์์ ์ค์ ํ ์ ์์ผ๋ฏ๋ก ์ค๋ฅ๋ฅผ ์ฐพ๊ธฐ ์ด๋ ต์ง ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ํ์ต ์๋๊ฐ ๋ค๋ฅธ ๊ณณ์์ ๋ค๋ฅธ ๊ฐ์ผ๋ก ์ค์ ๋ ๊ฒฝ์ฐ ๋ช
๋ น์ค์์ ์ด๋ฅผ ์ฌ์ ์ํ ์ ์์ต๋๋ค. ์ต์ ํ ํ๋ก๊ทธ๋จ ๋ฐ ์ค์ผ์ค๋ฌ ๋งค๊ฐ๋ณ์ ์ธ์๋ [`Trainer`] ๋ช
๋ น์ค ์ธ์๊ฐ DeepSpeed ๊ตฌ์ฑ๊ณผ ์ผ์นํ๋์ง ํ์ธํด์ผ ํฉ๋๋ค.
+
+
+
+
+
+
+DeepSpeed๋ ์ฌ๋ฌ [์ตํฐ๋ง์ด์ ](https://www.deepspeed.ai/docs/config-json/#optimizer-parameters)๋ฅผ ์ ๊ณตํ์ง๋ง(Adam, AdamW, OneBitAdam ๋ฐ LAMB) PyTorch์์ ๋ค๋ฅธ ์ตํฐ๋ง์ด์ ๋ฅผ ๊ฐ์ ธ์ฌ ์๋ ์์ต๋๋ค. ์ค์ ์์ ์ตํฐ๋ง์ด์ ๋ฅผ ๊ตฌ์ฑํ์ง ์์ผ๋ฉด [`Trainer`]๊ฐ ์๋์ผ๋ก AdamW๋ฅผ ์ ํํ๊ณ ๋ช
๋ น์ค์์ ์ ๊ณต๋ ๊ฐ ๋๋ ๊ธฐ๋ณธ๊ฐ์ ์ฌ์ฉํฉ๋๋ค: `lr`, `adam_beta1`, `adam_beta2`, `adam_epsilon`, `weight_decay`.
+
+๋งค๊ฐ๋ณ์๋ฅผ `"auto"`์ผ๋ก ์ค์ ํ๊ฑฐ๋ ์ํ๋ ๊ฐ์ ์ง์ ์๋์ผ๋ก ์
๋ ฅํ ์ ์์ต๋๋ค.
+
+```yaml
+{
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ }
+}
+```
+
+์ต์์ ๊ตฌ์ฑ์ ๋ค์์ ์ถ๊ฐํ์ฌ ์ง์๋์ง ์๋ ์ตํฐ๋ง์ด์ ๋ฅผ ์ฌ์ฉํ ์๋ ์์ต๋๋ค.
+
+```yaml
+{
+ "zero_allow_untested_optimizer": true
+}
+```
+
+DeepSpeed==0.8.3๋ถํฐ ์คํ๋ก๋๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ์คํ๋ก๋๊ฐ DeepSpeed์ CPU Adam ์ตํฐ๋ง์ด์ ์์ ๊ฐ์ฅ ์ ์๋ํ๋ฏ๋ก ์ต์์ ์์ค ๊ตฌ์ฑ์ ๋ค์ ์ฌํญ์ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
+
+```yaml
+{
+ "zero_force_ds_cpu_optimizer": false
+}
+```
+
+
+
+
+DeepSpeed๋ LRRangeTest, OneCycle, WarmupLR ๋ฐ WarmupDecayLR learning rate[schedulers](https://www.deepspeed.ai/docs/config-json/#scheduler-parameters)๋ฅผ ์ง์ํฉ๋๋ค.
+
+ํธ๋์คํฌ๋จธ์ DeepSpeed๋ ๋์ผํ ๋ ๊ฐ์ง ์ค์ผ์ค๋ฌ๋ฅผ ์ ๊ณตํฉ๋๋ค:
+
+* WarmupLR์ Transformers์ `--lr_scheduler_type constant_warmup`๊ณผ ๋์ผํฉ๋๋ค.
+* WarmupDecayLR์ Transformers์ `--lr_scheduler_type linear`์ ๋์ผํฉ๋๋ค(Transformers์์ ์ฌ์ฉ๋๋ ๊ธฐ๋ณธ ์ค์ผ์ค๋ฌ์
๋๋ค).
+
+์ค์ ์์ ์ค์ผ์ค๋ฌ๋ฅผ ๊ตฌ์ฑํ์ง ์์ผ๋ฉด[`Trainer`]๋ ์๋์ผ๋ก WarmupDecayLR์ ์ ํํ๊ณ ๋ช
๋ น์ค์์ ์ ๊ณต๋ ๊ฐ ๋๋ ๊ธฐ๋ณธ๊ฐ์ ์ฌ์ฉํฉ๋๋ค: `warmup_min_lr`, `warmup_max_lr`, `warmup_num_steps`, `total_num_steps` (`max_steps`๊ฐ ์ ๊ณต๋์ง ์์ผ๋ฉด ๋ฐํ์ ์ค์ ์๋์ผ๋ก ๊ณ์ฐ๋จ).
+
+๋งค๊ฐ๋ณ์๋ฅผ `"auto"`์ผ๋ก ์ค์ ํ๊ฑฐ๋ ์ํ๋ ๊ฐ์ ์ง์ ์๋์ผ๋ก ์
๋ ฅํ ์ ์์ต๋๋ค.
+
+```yaml
+{
+ "scheduler": {
+ "type": "WarmupDecayLR",
+ "params": {
+ "total_num_steps": "auto",
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ }
+}
+```
+
+
+
+
+### ์ ๋ฐ๋[[precision]]
+
+DeepSpeed๋ fp32, fp16 ๋ฐ bf16 ํผํฉ ์ ๋ฐ๋๋ฅผ ์ง์ํฉ๋๋ค.
+
+
+
+
+๋ชจ๋ธ์ด ํผํฉ ์ ๋ฐ๋๋ก ์ฌ์ ํ์ต๋์ง ์์ ๊ฒฝ์ฐ์ ๊ฐ์ด ํผํฉ ์ ๋ฐ๋๋ก ์ ์๋ํ์ง ์๋ ๊ฒฝ์ฐ NaN ์์ค์ ์ ๋ฐํ ์ ์๋ ์ค๋ฒํ๋ก ๋๋ ์ธ๋ํ๋ก ๋ฌธ์ ๊ฐ ๋ฐ์ํ ์ ์์ต๋๋ค. ์ด๋ฌํ ๊ฒฝ์ฐ์๋ ๊ธฐ๋ณธ fp16 ๋ชจ๋๋ฅผ ๋ช
์์ ์ผ๋ก ๋นํ์ฑํํ์ฌ ์ ์ฒด fp32 ์ ๋ฐ๋๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
+
+```yaml
+{
+ "fp16": {
+ "enabled": false
+ }
+}
+```
+
+Ampere GPU ๋ฐ PyTorch 1.7 ์ด์์ ๊ฒฝ์ฐ ์ผ๋ถ ์ฐ์ฐ์ ๋ํด ๋ ํจ์จ์ ์ธ [tf32](https://pytorch.org/docs/stable/notes/cuda.html#tensorfloat-32-tf32-on-ampere-devices) ํ์์ผ๋ก ์๋ ์ ํ๋์ง๋ง ๊ฒฐ๊ณผ๋ ์ฌ์ ํ fp32๋ก ํ์๋ฉ๋๋ค. [`Trainer`]์์ `--tf32`๋ฅผ ์ค์ ํ์ฌ ํ์ฑํํ๊ณ `--tf32 0` ๋๋ `--no_tf32`๋ฅผ ๋นํ์ฑํํ๋ฉด ์ ์ดํ ์ ์์ต๋๋ค.
+
+
+
+
+PyTorch AMP์ ๊ฐ์ fp16 ํผํฉ ์ ๋ฐ๋๋ฅผ ๊ตฌ์ฑํ๋ฉด ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ด ์ค์ด๋ค๊ณ ํ๋ จ ์๋๊ฐ ๋นจ๋ผ์ง๋๋ค.[`Trainer`]๋ `args.fp16_backend` ๊ฐ์ ๋ฐ๋ผ fp16์ ์๋์ผ๋ก ํ์ฑํ ๋๋ ๋นํ์ฑํํ๋ฉฐ, ๋๋จธ์ง ๊ตฌ์ฑ์ ์ฌ์ฉ์๊ฐ ์ค์ ํ ์ ์์ต๋๋ค. ๋ช
๋ น์ค์์ ๋ค์ ์ธ์๋ฅผ ์ ๋ฌํ๋ฉด fp16์ด ํ์ฑํ๋ฉ๋๋ค: `fp16`, `--fp16_backend amp` ๋๋ `--fp16_full_eval`.
+
+```yaml
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ }
+}
+```
+
+์ถ๊ฐ ๋ฅ์คํผ๋ fp16 ํ๋ จ ์ต์
์ [fp16 ํ๋ จ ์ต์
](https://www.deepspeed.ai/docs/config-json/#fp16-training-options) ์ฐธ์กฐ๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+Apex์ ๊ฐ์ fp16 ํผํฉ ์ ๋ฐ๋๋ฅผ ๊ตฌ์ฑํ๋ ค๋ฉด ์๋ ๊ทธ๋ฆผ๊ณผ ๊ฐ์ด `"auto"` ๋๋ ์ง์ ๊ฐ์ ์ค์ ํฉ๋๋ค.[`Trainer`]๋ `args.fp16_backend` ๋ฐ `args.fp16_opt_level`์ ๊ฐ์ ๋ฐ๋ผ `amp`๋ฅผ ์๋์ผ๋ก ๊ตฌ์ฑํฉ๋๋ค. ๋ค์ ์ธ์๋ฅผ ์ ๋ฌํ๋ฉด ๋ช
๋ น์ค์์ ํ์ฑํํ ์๋ ์์ต๋๋ค: `fp16`, `--fp16_backend apex` ๋๋ `--fp16_opt_level 01`.
+
+```yaml
+{
+ "amp": {
+ "enabled": "auto",
+ "opt_level": "auto"
+ }
+}
+```
+
+
+
+
+bf16์ ์ฌ์ฉํ๋ ค๋ฉด DeepSpeed==0.6.0 ์ด์์ด ํ์ํฉ๋๋ค. bf16์ fp32์ ๋์ ๋ฒ์๊ฐ ๋์ผํ๋ฉฐ ์์ค ์ค์ผ์ผ๋ง์ด ํ์ํ์ง ์์ต๋๋ค. ๊ทธ๋ฌ๋ [gradient accumulation](#gradient-accumulation)์ bf16๊ณผ ํจ๊ป ์ฌ์ฉํ๋ฉด ์ด ํ์์ ๋ฎ์ ์ ๋ฐ๋๋ก ์ธํด ์์ค์ด ๋ฐ์ํ ์ ์์ผ๋ฏ๋ก ์ํ์ง ์๋ ๊ทธ๋ ์ด๋์ธํธ๊ฐ bf16์ ๋์ ๋ ์ ์์ต๋๋ค.
+
+bf16์ ์ค์ ํ์ผ์์ ์ค์ ํ๊ฑฐ๋ ๋ค์ ์ธ์๋ฅผ ์ ๋ฌํ๋ฉด ๋ช
๋ น์ค์์ ํ์ฑํํ ์ ์์ต๋๋ค: `--bf16` ๋๋ `--bf16_full_eval`.
+
+```yaml
+{
+ "bf16": {
+ "enabled": "auto"
+ }
+}
+```
+
+
+
+
+### ๋ฐฐ์น ํฌ๊ธฐ[[batch-size]]
+
+๋ฐฐ์น ํฌ๊ธฐ๋ ์๋์ผ๋ก ๊ตฌ์ฑํ๊ฑฐ๋ ๋ช
์์ ์ผ๋ก ์ค์ ํ ์ ์์ต๋๋ค. `"auto"` ์ต์
์ ์ฌ์ฉํ๋๋ก ์ ํํ๋ฉด [`Trainer`]๋ `train_micro_batch_size_per_gpu`๋ฅผ args.`per_device_train_batch_size`์ ๊ฐ์ผ๋ก, `train_batch_size`๋ฅผ `args.world_size * args.per_device_train_batch_size * args.gradient_accumulation_steps`๋ก ์ค์ ํฉ๋๋ค.
+
+```yaml
+{
+ "train_micro_batch_size_per_gpu": "auto",
+ "train_batch_size": "auto"
+}
+```
+
+### ๊ทธ๋ ์ด๋์ธํธ ๋์ [[gradient-accumulation]]
+
+๊ทธ๋ ์ด๋์ธํธ ๋์ ์ ์๋์ผ๋ก ๊ตฌ์ฑํ๊ฑฐ๋ ๋ช
์์ ์ผ๋ก ์ค์ ํ ์ ์์ต๋๋ค. `"auto"` ์ต์
์ ์ฌ์ฉํ๋๋ก ์ ํํ๋ฉด [`Trainer`]๊ฐ `args.gradient_accumulation_steps`์ ๊ฐ์ผ๋ก ์ค์ ํฉ๋๋ค.
+
+```yaml
+{
+ "gradient_accumulation_steps": "auto"
+}
+
+```
+
+### ๊ทธ๋ ์ด๋์ธํธ ํด๋ฆฌํ[[gradient-clipping]]
+
+๊ทธ๋ ์ด๋์ธํธ ํด๋ฆฌํ์ ์๋์ผ๋ก ๊ตฌ์ฑํ๊ฑฐ๋ ๋ช
์์ ์ผ๋ก ์ค์ ํ ์ ์์ต๋๋ค. `"auto"` ์ต์
์ ์ฌ์ฉํ๋๋ก ์ ํํ๋ฉด [`Trainer`]๊ฐ `args.max_grad_norm`์ ๊ฐ์ผ๋ก ์ค์ ํฉ๋๋ค.
+
+```yaml
+{
+ "gradient_clipping": "auto"
+}
+```
+
+### ํต์ ๋ฐ์ดํฐ ์ ํ(Communication data type)[[communication-data-type]]
+
+์ถ์, ์์ง ๋ฐ ๋ถ์ฐ ์์
๊ณผ ๊ฐ์ ํต์ ์งํฉ์ฒด์ ๊ฒฝ์ฐ ๋ณ๋์ ๋ฐ์ดํฐ ์ ํ์ด ์ฌ์ฉ๋ฉ๋๋ค.
+
+๋ชจ๋ ์์ง ๋ฐ ๋ถ์ฐ ์์
์ ๋ฐ์ดํฐ์ ๋์ผํ ๋ฐ์ดํฐ ์ ํ์ผ๋ก ์ํ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด bf16์ผ๋ก ํ๋ จํ๋ ๊ฒฝ์ฐ, ์์ง์ ๋น์์ค ์ฐ์ฐ์ด๋ฏ๋ก ๋ฐ์ดํฐ๋ bf16์ผ๋ก ์์ง๋ฉ๋๋ค.
+
+์๋ฅผ ๋ค์ด ๊ทธ๋ ์ด๋์ธํธ๊ฐ ์ฌ๋ฌ GPU์ ๊ฑธ์ณ ํ๊ท ํ๋๋ ๊ฒฝ์ฐ์ ๊ฐ์ด ๊ฐ์ ์ฐ์ฐ์ ์์ค์ด ๋ฐ์ํฉ๋๋ค. ํต์ ์ด fp16 ๋๋ bf16์ผ๋ก ์ํ๋๋ ๊ฒฝ์ฐ, ๋ฎ์ ์ ๋ฐ๋๋ก ์ฌ๋ฌ ์ซ์๋ฅผ ๋ํ๋ฉด ์ ํํ์ง ์๊ธฐ ๋๋ฌธ์ ์์ค์ด ๋ฐ์ํ ๊ฐ๋ฅ์ฑ์ด ๋ ๋์ต๋๋ค. ํนํ fp16๋ณด๋ค ์ ๋ฐ๋๊ฐ ๋ฎ์ bf16์ ๊ฒฝ์ฐ ๋์ฑ ๊ทธ๋ ์ต๋๋ค. ์ด๋ฌํ ์ด์ ๋ก ๊ธฐ์ธ๊ธฐ๋ฅผ ํ๊ท ํํ ๋ ์์ค์ด ์ต์ํ๋๋ฏ๋ก ๊ฐ์ ์ฐ์ฐ์๋ fp16์ด ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์ฌ์ฉ๋ฉ๋๋ค.
+
+ํต์ ๋ฐ์ดํฐ ์ ํ์ ์ค์ ํ์ผ์์ `communication_data_type` ๋งค๊ฐ๋ณ์๋ฅผ ์ค์ ํ์ฌ ์ ํํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, fp32๋ฅผ ์ ํํ๋ฉด ์ฝ๊ฐ์ ์ค๋ฒํค๋๊ฐ ์ถ๊ฐ๋์ง๋ง ๊ฐ์ ์ฐ์ฐ์ด fp32์ ๋์ ๋๊ณ ์ค๋น๊ฐ ๋๋ฉด ํ๋ จ ์ค์ธ ๋ฐ์ ๋ฐ dtype์ผ๋ก ๋ค์ด์บ์คํธ๋ฉ๋๋ค.
+
+```yaml
+{
+ "communication_data_type": "fp32"
+}
+```
+
+## ๋ชจ๋ธ ๋ฐฐํฌ[[deployment]]
+
+[torchrun](https://pytorch.org/docs/stable/elastic/run.html), `deepspeed` ๋ฐ์ฒ ๋๋ [Accelerate](https://huggingface.co/docs/accelerate/basic_tutorials/launch#using-accelerate-launch) ๋ฑ ๋ค์ํ ๋ฐ์ฒ๋ฅผ ํตํด DeepSpeed๋ฅผ ๋ฐฐํฌํ ์ ์์ต๋๋ค. ๋ฐฐํฌํ๋ ค๋ฉด [`Trainer`] ๋ช
๋ น์ค์ `--deepspeed ds_config.json`์ ์ถ๊ฐํฉ๋๋ค. ํ์ํ ๋ช
๋ น์ค ์ธ์๋ฅผ ์ฝ๋์ ์ถ๊ฐํ๋ ค๋ฉด DeepSpeed์ [`add_config_arguments`](https://deepspeed.readthedocs.io/en/latest/initialize.html#argument-parsing) ์ ํธ๋ฆฌํฐ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+์ด ๊ฐ์ด๋์์๋ ๋ค์ํ ํธ๋ ์ด๋ ์ค์ ์ ๋ํด `deepspeed` ๋ฐ์ฒ๋ก DeepSpeed๋ฅผ ๋ฐฐํฌํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ๋๋ฆฝ๋๋ค. ๋ณด๋ค ์ค์ฉ์ ์ธ ์ฌ์ฉ ์์ ๋ ์ด [post](https://github.com/huggingface/transformers/issues/8771#issuecomment-759248400)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+
+
+์ฌ๋ฌ GPU์ DeepSpeed๋ฅผ ๋ฐฐํฌํ๋ ค๋ฉด `--num_gpus` ๋งค๊ฐ๋ณ์๋ฅผ ์ถ๊ฐํ์ธ์. ์ฌ์ฉ ๊ฐ๋ฅํ ๋ชจ๋ GPU๋ฅผ ์ฌ์ฉํ๋ ค๋ ๊ฒฝ์ฐ `--num_gpus`๋ฅผ ์ถ๊ฐํ ํ์๊ฐ ์์ต๋๋ค. ์๋ ์์ ์์๋ 2๊ฐ์ GPU๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+
+```bash
+deepspeed --num_gpus=2 examples/pytorch/translation/run_translation.py \
+--deepspeed tests/deepspeed/ds_config_zero3.json \
+--model_name_or_path google-t5/t5-small --per_device_train_batch_size 1 \
+--output_dir output_dir --overwrite_output_dir --fp16 \
+--do_train --max_train_samples 500 --num_train_epochs 1 \
+--dataset_name wmt16 --dataset_config "ro-en" \
+--source_lang en --target_lang ro
+```
+
+
+
+
+๋จ์ผ GPU์ DeepSpeed๋ฅผ ๋ฐฐํฌํ๋ ค๋ฉด `--num_gpus` ๋งค๊ฐ๋ณ์๋ฅผ ์ถ๊ฐํ์ธ์. GPU๊ฐ 1๊ฐ๋ง ์๋ ๊ฒฝ์ฐ ์ด ๊ฐ์ ๋ช
์์ ์ผ๋ก ์ค์ ํ ํ์๋ ์์ต๋๋ค. DeepSpeed๋ ์ง์ ๋ ๋
ธ๋์์ ๋ณผ ์ ์๋ ๋ชจ๋ GPU๋ฅผ ๋ฐฐํฌํ๋ฏ๋ก ์ด ๊ฐ์ ๋ช
์์ ์ผ๋ก ์ค์ ํ ํ์๋ ์์ต๋๋ค.
+
+```bash
+deepspeed --num_gpus=1 examples/pytorch/translation/run_translation.py \
+--deepspeed tests/deepspeed/ds_config_zero2.json \
+--model_name_or_path google-t5/t5-small --per_device_train_batch_size 1 \
+--output_dir output_dir --overwrite_output_dir --fp16 \
+--do_train --max_train_samples 500 --num_train_epochs 1 \
+--dataset_name wmt16 --dataset_config "ro-en" \
+--source_lang en --target_lang ro
+```
+
+DeepSpeed๋ ๋จ ํ๋์ GPU๋ก๋ ์ฌ์ ํ ์ ์ฉํฉ๋๋ค:
+
+1. ์ผ๋ถ ๊ณ์ฐ๊ณผ ๋ฉ๋ชจ๋ฆฌ๋ฅผ CPU๋ก ์คํ๋ก๋ํ์ฌ ๋ ํฐ ๋ฐฐ์น ํฌ๊ธฐ๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ ์ผ๋ฐ์ ์ผ๋ก ๋ง์ง ์๋ ๋งค์ฐ ํฐ ๋ชจ๋ธ์ ๋ง์ถ๊ธฐ ์ํด ๋ชจ๋ธ์ ๋ ๋ง์ GPU ๋ฆฌ์์ค๋ฅผ ์ฌ์ฉํ ์ ์๋๋ก ํฉ๋๋ค.
+2. ์ค๋งํธ GPU ๋ฉ๋ชจ๋ฆฌ ๊ด๋ฆฌ ์์คํ
์ผ๋ก ๋ฉ๋ชจ๋ฆฌ ์กฐ๊ฐํ๋ฅผ ์ต์ํํ์ฌ ๋ ํฐ ๋ชจ๋ธ๊ณผ ๋ฐ์ดํฐ ๋ฐฐ์น์ ๋ง์ถ ์ ์์ต๋๋ค.
+
+
+
+๋จ์ผ GPU์์ ๋ ๋์ ์ฑ๋ฅ์ ์ป์ผ๋ ค๋ฉด [ZeRO-2](#zero-configuration) ๊ตฌ์ฑ ํ์ผ์์ `allgather_bucket_size` ๋ฐ `reduce_bucket_size` ๊ฐ์ 2e8๋ก ์ค์ ํ์ธ์.
+
+
+
+
+
+
+### ๋ค์ค ๋
ธ๋ ํ๊ฒฝ์์์ ๋ชจ๋ธ ๋ฐฐํฌ[[multi-node-deployment]]
+
+๋
ธ๋๋ ์ํฌ๋ก๋๋ฅผ ์คํํ๊ธฐ ์ํ ํ๋ ์ด์์ GPU์
๋๋ค. ๋ ๊ฐ๋ ฅํ ์ค์ ์ ๋ฉํฐ ๋
ธ๋ ์ค์ ์ผ๋ก, `deepspeed` ๋ฐ์ฒ๋ก ์คํํ ์ ์์ต๋๋ค. ์ด ๊ฐ์ด๋์์๋ ๊ฐ๊ฐ 8๊ฐ์ GPU๊ฐ ์๋ ๋ ๊ฐ์ ๋
ธ๋๊ฐ ์๋ค๊ณ ๊ฐ์ ํด ๋ณด๊ฒ ์ต๋๋ค. ์ฒซ ๋ฒ์งธ ๋
ธ๋๋ `ssh hostname1`๋ก, ๋ ๋ฒ์งธ ๋
ธ๋๋ `ssh hostname2`๋ก ์ ์ํ ์ ์์ต๋๋ค. ๋ ๋
ธ๋ ๋ชจ๋ ๋น๋ฐ๋ฒํธ ์์ด ssh๋ฅผ ํตํด ๋ก์ปฌ๋ก ์๋ก ํต์ ํ ์ ์์ด์ผ ํฉ๋๋ค.
+
+๊ธฐ๋ณธ์ ์ผ๋ก DeepSpeed๋ ๋ฉํฐ๋
ธ๋ ํ๊ฒฝ์์ ๊ณต์ ์ ์ฅ์๋ฅผ ์ฌ์ฉํ ๊ฒ์ผ๋ก ์์ํฉ๋๋ค. ๊ทธ๋ ์ง ์๊ณ ๊ฐ ๋
ธ๋๊ฐ ๋ก์ปฌ ํ์ผ ์์คํ
๋ง ๋ณผ ์ ์๋ ๊ฒฝ์ฐ, ๊ณต์ ํ์ผ ์์คํ
์ ๋ํ ์ก์ธ์ค ์์ด ๋ก๋ฉํ ์ ์๋๋ก [`checkpoint`](https://www.deepspeed.ai/docs/config-json/#checkpoint-options)๋ฅผ ํฌํจํ๋๋ก ๊ตฌ์ฑ ํ์ผ์ ์กฐ์ ํด์ผ ํฉ๋๋ค:
+
+```yaml
+{
+ "checkpoint": {
+ "use_node_local_storage": true
+ }
+}
+```
+
+[`Trainer`]์ ``--save_on_each_node` ์ธ์๋ฅผ ์ฌ์ฉํ์ฌ ์์ `checkpoint`๋ฅผ ๊ตฌ์ฑ์ ์๋์ผ๋ก ์ถ๊ฐํ ์๋ ์์ต๋๋ค.
+
+
+
+
+[torchrun](https://pytorch.org/docs/stable/elastic/run.html)์ ๊ฒฝ์ฐ, ๊ฐ ๋
ธ๋์ ssh๋ก ์ ์ํ ํ ๋ ๋
ธ๋ ๋ชจ๋์์ ๋ค์ ๋ช
๋ น์ ์คํํด์ผ ํฉ๋๋ค. ๋ฐ์ฒ๋ ๋ ๋
ธ๋๊ฐ ๋๊ธฐํ๋ ๋๊น์ง ๊ธฐ๋ค๋ ธ๋ค๊ฐ ํธ๋ ์ด๋์ ์์ํฉ๋๋ค.
+
+```bash
+torchrun --nproc_per_node=8 --nnode=2 --node_rank=0 --master_addr=hostname1 \
+--master_port=9901 your_program.py --deepspeed ds_config.json
+```
+
+
+
+
+`deepspeed` ๋ฐ์ฒ์ ๊ฒฝ์ฐ, ๋จผ์ `hostfile`์ ์์ฑํฉ๋๋ค.
+
+```bash
+hostname1 slots=8
+hostname2 slots=8
+```
+
+๊ทธ๋ฐ ๋ค์ ๋ค์ ๋ช
๋ น์ด๋ก ํธ๋ ์ด๋์ ์์ํ ์ ์์ต๋๋ค. `deepspeed` ๋ฐ์ฒ๋ ๋ ๋
ธ๋์์ ๋์์ ๋ช
๋ น์ ์๋์ผ๋ก ์คํํฉ๋๋ค.
+
+```bash
+deepspeed --num_gpus 8 --num_nodes 2 --hostfile hostfile --master_addr hostname1 --master_port=9901 \
+your_program.py --deepspeed ds_config.json
+```
+
+๋ค์ค ๋
ธ๋ ์ปดํจํ
๋ฆฌ์์ค ๊ตฌ์ฑ์ ๋ํ ์์ธํ ๋ด์ฉ์ [Resource Configuration (multi-node)](https://www.deepspeed.ai/getting-started/#resource-configuration-multi-node) ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+
+
+
+### SLURM[[slurm]]
+
+SLURM ํ๊ฒฝ์์๋ ํน์ SLURM ํ๊ฒฝ์ ๋ง๊ฒ SLURM ์คํฌ๋ฆฝํธ๋ฅผ ์กฐ์ ํด์ผ ํฉ๋๋ค.SLURM ์คํฌ๋ฆฝํธ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```bash
+#SBATCH --job-name=test-nodes # ์์
์ด๋ฆ
+#SBATCH --nodes=2 # ๋
ธ๋ ์
+#SBATCH --ntasks-per-node=1 # ์ค์ - ๋
ธ๋๋น ๋ถ์ฐ ์์
1๊ฐ!
+#SBATCH --cpus-per-task=10 # ์์
๋น CPU ์ฝ์ด ์
+#SBATCH --gres=gpu:8 # gpu ์
+#SBATCH --time 20:00:00 # ์ต๋ ์คํ ์๊ฐ (HH:MM:SS)
+#SBATCH --output=%x-%j.out # ์ถ๋ ฅ ํ์ผ ์ด๋ฆ
+
+export GPUS_PER_NODE=8
+export MASTER_ADDR=$(scontrol show hostnames $SLURM_JOB_NODELIST | head -n 1)
+export MASTER_PORT=9901
+
+srun --jobid $SLURM_JOBID bash -c 'python -m torch.distributed.run \
+ --nproc_per_node $GPUS_PER_NODE --nnodes $SLURM_NNODES --node_rank $SLURM_PROCID \
+ --master_addr $MASTER_ADDR --master_port $MASTER_PORT \
+your_program.py --deepspeed ds_config.json'
+```
+
+๊ทธ๋ฐ ๋ค์ ๋ชจ๋ ๋
ธ๋์์ ๋์์ ํ์ต์ ์์ํ๋ ๋ค์ ๋ช
๋ น์ ์ฌ์ฉํ์ฌ ๋ค์ค ๋
ธ๋ ๋ฐฐํฌ๋ฅผ ์์ฝํ ์ ์์ต๋๋ค.
+
+```bash
+sbatch launch.slurm
+```
+
+### ๋
ธํธ๋ถ[[notebook]]
+
+`deepspeed` ๋ฐ์ฒ๋ ๋
ธํธ๋ถ์์์ ๋ฐฐํฌ๋ฅผ ์ง์ํ์ง ์์ผ๋ฏ๋ก ๋ถ์ฐ ํ๊ฒฝ์ ์๋ฎฌ๋ ์ด์
ํด์ผ ํฉ๋๋ค. ํ์ง๋ง ์ด๋ 1๊ฐ์ GPU์์๋ง ์๋ํฉ๋๋ค. 1๊ฐ ์ด์์ GPU๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด ๋ฅ์คํผ๋๊ฐ ์๋ํ ์ ์๋ ๋ค์ค ํ๋ก์ธ์ค ํ๊ฒฝ์ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ์ฆ, ์ฌ๊ธฐ์ ํ์๋ ๊ฒ์ฒ๋ผ ์๋ฎฌ๋ ์ด์
ํ ์ ์๋ `deepspeed` ๋ฐ์ฒ๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค.
+
+```py
+# DeepSpeed๋ ๋จ์ผ ํ๋ก์ธ์ค๋ง ์ฌ์ฉํ๋๋ผ๋ ๋ถ์ฐ ํ๊ฒฝ์ ํ์๋ก ํฉ๋๋ค.
+# ์ด ์ฝ๋๋ก ๋ถ์ฐ ํ๊ฒฝ์ ๋ชจ๋ฐฉํฉ๋๋ค.
+import os
+
+os.environ["MASTER_ADDR"] = "localhost"
+os.environ["MASTER_PORT"] = "9994" # RuntimeError: Address already in use ์ค๋ฅ ๋ฐ์ ์ ์์
+os.environ["RANK"] = "0"
+os.environ["LOCAL_RANK"] = "0"
+os.environ["WORLD_SIZE"] = "1"
+
+# ์ด์ ํ์์ ๊ฐ์ด ์งํํ๋, DeepSpeed ์ค์ ํ์ผ์ ์ ๋ฌํฉ๋๋ค.
+training_args = TrainingArguments(..., deepspeed="ds_config_zero3.json")
+trainer = Trainer(...)
+trainer.train()
+```
+
+ํ์ฌ ๋๋ ํฐ๋ฆฌ์ ๋
ธํธ๋ถ์ ๊ตฌ์ฑ ํ์ผ์ ์ฆ์์์ ๋ง๋ค๊ณ ์ถ๋ค๋ฉด ์ ์ฉ ์
์ ๋ง๋ค ์ ์์ต๋๋ค.
+
+```py
+%%bash
+cat <<'EOT' > ds_config_zero3.json
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ },
+
+ "optimizer": {
+ "type": "AdamW",
+ "params": {
+ "lr": "auto",
+ "betas": "auto",
+ "eps": "auto",
+ "weight_decay": "auto"
+ }
+ },
+
+ "scheduler": {
+ "type": "WarmupLR",
+ "params": {
+ "warmup_min_lr": "auto",
+ "warmup_max_lr": "auto",
+ "warmup_num_steps": "auto"
+ }
+ },
+
+ "zero_optimization": {
+ "stage": 3,
+ "offload_optimizer": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": true
+ },
+ "overlap_comm": true,
+ "contiguous_gradients": true,
+ "sub_group_size": 1e9,
+ "reduce_bucket_size": "auto",
+ "stage3_prefetch_bucket_size": "auto",
+ "stage3_param_persistence_threshold": "auto",
+ "stage3_max_live_parameters": 1e9,
+ "stage3_max_reuse_distance": 1e9,
+ "stage3_gather_16bit_weights_on_model_save": true
+ },
+
+ "gradient_accumulation_steps": "auto",
+ "gradient_clipping": "auto",
+ "steps_per_print": 2000,
+ "train_batch_size": "auto",
+ "train_micro_batch_size_per_gpu": "auto",
+ "wall_clock_breakdown": false
+}
+EOT
+```
+
+ํธ๋ ์ด๋ ์คํฌ๋ฆฝํธ๊ฐ ๋
ธํธ๋ถ ์
์ด ์๋ ํ์ผ์ ์๋ ๊ฒฝ์ฐ, ๋
ธํธ๋ถ ์
์ ์
ธ์์ `deepspeed`๋ฅผ ์ ์์ ์ผ๋ก ์คํํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด `run_translation.py`๋ฅผ ์์ํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ํ์ธ์.:
+
+```py
+!git clone https://github.com/huggingface/transformers
+!cd transformers; deepspeed examples/pytorch/translation/run_translation.py ...
+```
+
+๋ํ `%%bash` ๋งค์ง์ ์ฌ์ฉํ์ฌ ์ฌ๋ฌ ์ค์ ์ฝ๋๋ฅผ ์์ฑํ์ฌ ์
ธ ํ๋ก๊ทธ๋จ์ ์คํํ ์๋ ์์ง๋ง ๊ต์ก์ด ์๋ฃ๋ ๋๊น์ง ๋ก๊ทธ๋ฅผ ๋ณผ ์ ์์ต๋๋ค. `%%bash` ๋งค์ง์ผ๋ก ๋ถ์ฐ ํ๊ฒฝ์ ์๋ฎฌ๋ ์ด์
ํ ํ์๋ ์์ต๋๋ค.
+
+```py
+%%bash
+
+git clone https://github.com/huggingface/transformers
+cd transformers
+deepspeed examples/pytorch/translation/run_translation.py ...
+```
+
+## ๋ชจ๋ธ ๊ฐ์ค์น ์ ์ฅํ๊ธฐ[[save-model-weights]]
+
+๋ฅ์คํผ๋๋ ๊ธฐ๋ณธ ๊ณ ์ ๋ฐ fp32 ๊ฐ์ค์น๋ฅผ ์ฌ์ฉ์ ์ง์ ์ฒดํฌํฌ์ธํธ ์ต์ ํ ํ์ผ(glob ํจํด์ `global_step*/*optim_states.pt`์ฒ๋ผ ๋ณด์
๋๋ค)์ ์ ์ฅํ๊ณ ์ผ๋ฐ ์ฒดํฌํฌ์ธํธ ์๋์ ์ ์ฅํฉ๋๋ค.
+
+
+
+
+ZeRO-2๋ก ํ๋ จ๋ ๋ชจ๋ธ์ pytorch_model.bin ๊ฐ์ค์น๋ฅผ fp16์ ์ ์ฅํฉ๋๋ค. ZeRO-3์ผ๋ก ํ๋ จ๋ ๋ชจ๋ธ์ ๋ชจ๋ธ ๊ฐ์ค์น๋ฅผ fp16์ ์ ์ฅํ๋ ค๋ฉด ๋ชจ๋ธ ๊ฐ์ค์น๊ฐ ์ฌ๋ฌ GPU์ ๋ถํ ๋์ด ์์ผ๋ฏ๋ก `โstage3_gather_16bit_weights_on_model_saveโ: true`๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด [`Trainer`]๊ฐ ๊ฐ์ค์น๋ฅผ fp16์ ์ ์ฅํ์ง ์๊ณ pytorch_model.bin ํ์ผ์ ์์ฑํ์ง ์์ต๋๋ค. ์ด๋ DeepSpeed์ state_dict์ ์ค์ ๊ฐ์ค์น ๋์ ํ๋ ์ด์คํ๋๊ฐ ํฌํจ๋์ด ์์ด ์ด๋ฅผ ๋ก๋ํ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+```yaml
+{
+ "zero_optimization": {
+ "stage3_gather_16bit_weights_on_model_save": true
+ }
+}
+```
+
+
+
+
+์ ์ฒด ์ ๋ฐ ๊ฐ์ค์น๋ ๋ง์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ํ์ํ ์ ์์ผ๋ฏ๋ก ํธ๋ ์ด๋ ์ค์ ์ ์ฅํด์๋ ์ ๋ฉ๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ํ๋ จ์ด ์๋ฃ๋ ํ ์คํ๋ผ์ธ์ผ๋ก fp32 ๊ฐ์ค์น๋ฅผ ์ ์ฅํ๋ ๊ฒ์ด ๊ฐ์ฅ ์ข์ต๋๋ค. ๊ทธ๋ฌ๋ ์ฌ์ CPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ง์ ๊ฒฝ์ฐ ํ๋ จ ์ค์ fp32 ๊ฐ์ค์น๋ฅผ ์ ์ฅํ ์ ์์ต๋๋ค. ์ด ์น์
์์๋ ์จ๋ผ์ธ๊ณผ ์คํ๋ผ์ธ ๋ฐฉ์์ ๋ชจ๋ ๋ค๋ฃน๋๋ค.
+
+### ์จ๋ผ์ธ ํ๊ฒฝ[[online]]
+
+๋ค์๊ณผ ๊ฐ์ด ์ต์ ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ก๋ํ๋ ค๋ฉด ์ฒดํฌํฌ์ธํธ๋ฅผ ํ๋ ์ด์ ์ ์ฅํด์ผ ํฉ๋๋ค:
+
+```py
+from transformers.trainer_utils import get_last_checkpoint
+from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
+
+checkpoint_dir = get_last_checkpoint(trainer.args.output_dir)
+fp32_model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
+```
+
+`--load_best_model_at_end` ๋งค๊ฐ๋ณ์๋ฅผ ํ์ฑํํ์ฌ [`TrainingArguments`]์์ ์ต์ ์ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ถ์ ํ๋ ๊ฒฝ์ฐ, ๋จผ์ ํ์ต์ ์๋ฃํ๊ณ ์ต์ข
๋ชจ๋ธ์ ๋ช
์์ ์ผ๋ก ์ ์ฅํ ์ ์์ต๋๋ค. ๊ทธ๋ฐ ๋ค์ ์๋์ ๊ฐ์ด ๋ค์ ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```py
+from deepspeed.utils.zero_to_fp32 import load_state_dict_from_zero_checkpoint
+
+checkpoint_dir = os.path.join(trainer.args.output_dir, "checkpoint-final")
+trainer.deepspeed.save_checkpoint(checkpoint_dir)
+fp32_model = load_state_dict_from_zero_checkpoint(trainer.model, checkpoint_dir)
+```
+
+
+
+`load_state_dict_from_zero_checkpoint`๊ฐ ์คํ๋๋ฉด ๋์ผํ ์ ํ๋ฆฌ์ผ์ด์
์ ์ปจํ
์คํธ์์ ๋ชจ๋ธ์ ๋ ์ด์ DeepSpeed์์ ์ฌ์ฉํ ์ ์์ต๋๋ค. `model.load_state_dict(state_dict)`๋ ๋ชจ๋ ๋ฅ์คํผ๋ ๋ง๋ฒ์ ์ ๊ฑฐํ๋ฏ๋ก ๋ฅ์คํผ๋ ์์ง์ ๋ค์ ์ด๊ธฐํํด์ผ ํฉ๋๋ค. ์ด ๊ธฐ๋ฅ์ ํ๋ จ์ด ๋๋ ๋๋ง ์ฌ์ฉํ์ธ์.
+
+
+
+fp32 ๊ฐ์ค์น์ state_dict๋ฅผ ์ถ์ถํ์ฌ ๋ก๋ํ ์๋ ์์ต๋๋ค:
+
+```py
+from deepspeed.utils.zero_to_fp32 import get_fp32_state_dict_from_zero_checkpoint
+
+state_dict = get_fp32_state_dict_from_zero_checkpoint(checkpoint_dir) # cpu์ ์ด๋ฏธ ์กด์ฌํจ
+model = model.cpu()
+model.load_state_dict(state_dict)
+```
+
+### ์คํ๋ผ์ธ ํ๊ฒฝ[[offline]]
+
+DeepSpeed๋ ์ธ์ ๋ ์ง ๊ฐ์ค์น๋ฅผ ์ถ์ถํ ์ ์๋๋ก ์ฒดํฌํฌ์ธํธ ํด๋์ ์ต์์ ๋ ๋ฒจ์ zero_to_fp32.py ์คํฌ๋ฆฝํธ๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ด ์คํฌ๋ฆฝํธ๋ ๋
๋ฆฝํ ์คํฌ๋ฆฝํธ๋ก ๊ตฌ์ฑ ํ์ผ์ด๋ [`Trainer`]๊ฐ ํ์ํ์ง ์์ต๋๋ค.
+
+์๋ฅผ ๋ค์ด ์ฒดํฌํฌ์ธํธ ํด๋๊ฐ ๋ค์๊ณผ ๊ฐ์ ๊ฒฝ์ฐ์
๋๋ค:
+
+```bash
+$ ls -l output_dir/checkpoint-1/
+-rw-rw-r-- 1 stas stas 1.4K Mar 27 20:42 config.json
+drwxrwxr-x 2 stas stas 4.0K Mar 25 19:52 global_step1/
+-rw-rw-r-- 1 stas stas 12 Mar 27 13:16 latest
+-rw-rw-r-- 1 stas stas 827K Mar 27 20:42 optimizer.pt
+-rw-rw-r-- 1 stas stas 231M Mar 27 20:42 pytorch_model.bin
+-rw-rw-r-- 1 stas stas 623 Mar 27 20:42 scheduler.pt
+-rw-rw-r-- 1 stas stas 1.8K Mar 27 20:42 special_tokens_map.json
+-rw-rw-r-- 1 stas stas 774K Mar 27 20:42 spiece.model
+-rw-rw-r-- 1 stas stas 1.9K Mar 27 20:42 tokenizer_config.json
+-rw-rw-r-- 1 stas stas 339 Mar 27 20:42 trainer_state.json
+-rw-rw-r-- 1 stas stas 2.3K Mar 27 20:42 training_args.bin
+-rwxrw-r-- 1 stas stas 5.5K Mar 27 13:16 zero_to_fp32.py*
+```
+
+๋ฅ์คํผ๋ ์ฒดํฌํฌ์ธํธ(ZeRO-2 ๋๋ ZeRO-3) ํ์ ํด๋ `global_step1`์์ fp32 ๊ฐ์ค์น๋ฅผ ์ฌ๊ตฌ์ฑํ๋ ค๋ฉด ๋ค์ ๋ช
๋ น์ ์คํํ์ฌ ์ฌ๋ฌ GPU์ ์ ์ฒด fp32 ๊ฐ์ค์น๋ฅผ ๋จ์ผ pytorch_model.bin ํ์ผ๋ก ์์ฑํ๊ณ ํตํฉํฉ๋๋ค. ์คํฌ๋ฆฝํธ๋ ์๋์ผ๋ก ์ฒดํฌํฌ์ธํธ๊ฐ ํฌํจ๋ ํ์ ํด๋๋ฅผ ์ฐพ์ต๋๋ค.
+
+```py
+python zero_to_fp32.py . pytorch_model.bin
+```
+
+
+
+์์ธํ ์ฌ์ฉ๋ฒ์ `python zero_to_fp32.py -h`๋ฅผ ์คํํ์ธ์. ์ด ์คํฌ๋ฆฝํธ์๋ ์ต์ข
fp32 ๊ฐ์ค์น์ 2๋ฐฐ์ ์ผ๋ฐ RAM์ด ํ์ํฉ๋๋ค.
+
+
+
+
+
+
+## ZeRO Inference[[zero-inference]]
+
+[ZeRO Inference](https://www.deepspeed.ai/2022/09/09/zero-inference.html)๋ ๋ชจ๋ธ ๊ฐ์ค์น๋ฅผ CPU ๋๋ NVMe ๋ฉ๋ชจ๋ฆฌ์ ๋ฐฐ์นํ์ฌ GPU์ ๋ถ๋ด์ ์ฃผ์ง ์์ผ๋ฏ๋ก GPU์์ ๋๊ท๋ชจ ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ์ถ๋ก ์ ์คํํ ์ ์์ต๋๋ค. ์ถ๋ก ์ ์ต์ ํ ์ํ ๋ฐ ๊ทธ๋ ์ด๋์ธํธ์ ๋ง์ ์์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ถ๊ฐ๋ก ํ์๋ก ํ์ง ์์ผ๋ฏ๋ก ๋์ผํ ํ๋์จ์ด์ ํจ์ฌ ๋ ํฐ ๋ฐฐ์น ๋ฐ/๋๋ ์ํ์ค ๊ธธ์ด๋ฅผ ๋ง์ถ ์ ์์ต๋๋ค.
+
+ZeRO Inference๋ [ZeRO-3](#zero-configuration)์ ๋์ผํ ๊ตฌ์ฑ ํ์ผ์ ๊ณต์ ํ๋ฉฐ, ZeRO-2 ๋ฐ ZeRO-1 ๊ตฌ์ฑ์ ์ถ๋ก ์ ์๋ฌด๋ฐ ์ด์ ์ ์ ๊ณตํ์ง ์์ผ๋ฏ๋ก ์๋ํ์ง ์์ต๋๋ค.
+
+ZeRO Inference๋ฅผ ์คํํ๋ ค๋ฉด ์ผ๋ฐ์ ์ธ ํ๋ จ ์ธ์๋ฅผ [`TrainingArguments`] ํด๋์ค์ ์ ๋ฌํ๊ณ `--do_eval` ์ธ์๋ฅผ ์ถ๊ฐํฉ๋๋ค.
+
+```bash
+deepspeed --num_gpus=2 your_program.py --do_eval --deepspeed ds_config.json
+```
+
+## Trainer ์์ด DeepSpeed ์ฌ์ฉํ๊ธฐ[[non-trainer-deepspeed-integration]]
+
+DeepSpeed๋ [`Trainer`] ํด๋์ค๊ฐ ์๋ ํธ๋์คํฌ๋จธ์์๋ ์๋ํฉ๋๋ค. ์ด๋ [`~PreTrainedModel.from_pretrained`]๋ฅผ ํธ์ถํ ๋ ZeRO-3 ๋งค๊ฐ๋ณ์๋ฅผ ์์งํ๊ณ ๋ชจ๋ธ์ ์ฌ๋ฌ GPU์ ๋ถํ ํ๋ ์์
๋ง ์ฒ๋ฆฌํ๋ [`HfDeepSpeedConfig`]๊ฐ ์ฒ๋ฆฌํฉ๋๋ค.
+
+
+
+๋ชจ๋ ๊ฒ์ด ์๋์ผ๋ก ์ฒ๋ฆฌ๋๊ธฐ๋ฅผ ์ํ๋ค๋ฉด, [`Trainer`]์ ํจ๊ป DeepSpeed๋ฅผ ์ฌ์ฉํด ๋ณด์ธ์! [DeepSpeed ๋ฌธ์](https://www.deepspeed.ai/)๋ฅผ ์ฐธ์กฐํ์ฌ ์ค์ ํ์ผ์์ ๋งค๊ฐ๋ณ์ ๊ฐ์ ์๋์ผ๋ก ๊ตฌ์ฑํด์ผ ํฉ๋๋ค(`"auto"` ๊ฐ์ ์ฌ์ฉํ ์ ์์).
+
+
+
+ZeRO-3๋ฅผ ํจ์จ์ ์ผ๋ก ๋ฐฐํฌํ๋ ค๋ฉด ๋ชจ๋ธ ์์ [`HfDeepSpeedConfig`] ๊ฐ์ฒด๋ฅผ ์ธ์คํด์คํํ๊ณ ํด๋น ๊ฐ์ฒด๋ฅผ ์ ์งํด์ผ ํฉ๋๋ค:
+
+
+
+
+```py
+from transformers.integrations import HfDeepSpeedConfig
+from transformers import AutoModel
+import deepspeed
+
+ds_config = {...} # deepspeed ์ค์ ๊ฐ์ฒด ๋๋ ํ์ผ ๊ฒฝ๋ก
+# Zero 3๋ฅผ ๊ฐ์งํ๊ธฐ ์ํด ๋ชจ๋ธ์ ์ธ์คํด์คํํ๊ธฐ ์ ์ ๋ฐ๋์ ์คํํด์ผ ํฉ๋๋ค
+dschf = HfDeepSpeedConfig(ds_config) # ์ด ๊ฐ์ฒด๋ฅผ ์ ์งํ์ธ์.
+model = AutoModel.from_pretrained("openai-community/gpt2")
+engine = deepspeed.initialize(model=model, config_params=ds_config, ...)
+```
+
+
+
+
+[`HfDeepSpeedConfig`] is not required for ZeRO-1 or ZeRO-2.
+
+```py
+from transformers.integrations import HfDeepSpeedConfig
+from transformers import AutoModel, AutoConfig
+import deepspeed
+
+ds_config = {...} # deepspeed ์ค์ ๊ฐ์ฒด ๋๋ ํ์ผ ๊ฒฝ๋ก
+# Zero 3๋ฅผ ๊ฐ์งํ๊ธฐ ์ํด ๋ชจ๋ธ์ ์ธ์คํด์คํํ๊ธฐ ์ ์ ๋ฐ๋์ ์คํํด์ผ ํฉ๋๋ค
+dschf = HfDeepSpeedConfig(ds_config) # ์ด ๊ฐ์ฒด๋ฅผ ์ ์งํ์ธ์.
+config = AutoConfig.from_pretrained("openai-community/gpt2")
+model = AutoModel.from_config(config)
+engine = deepspeed.initialize(model=model, config_params=ds_config, ...)
+```
+
+
+
+
+### Trainer ์์ด ZeRO Inference ์ฌ์ฉํ๊ธฐ[[non-trainer-zero-inference]]
+
+๋จ์ผ GPU์ ๋ชจ๋ธ์ ๋ง์ถ ์ ์๋ ๊ฒฝ์ฐ [`Trainer`]์์ด ZeRO ์ถ๋ก ์ ์คํํ๋ ค๋ฉด ์ถ๊ฐ GPU๋ฅผ ์ฌ์ฉํ๊ฑฐ๋ CPU ๋ฉ๋ชจ๋ฆฌ๋ก ์คํ๋ก๋๋ฅผ ์๋ํ์ธ์. ์ฌ๊ธฐ์ ์ดํดํด์ผ ํ ์ค์ํ ๋์์ค๋ ZeRO๊ฐ ์ค๊ณ๋ ๋ฐฉ์์ ๋ฐ๋ผ ์๋ก ๋ค๋ฅธ GPU์์ ์๋ก ๋ค๋ฅธ ์
๋ ฅ์ ๋ณ๋ ฌ๋ก ์ฒ๋ฆฌํ ์ ์๋ค๋ ๊ฒ์
๋๋ค.
+
+๋ฐ๋์ ํ์ธํ์ธ์:
+
+* GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ถฉ๋ถํ ๊ฒฝ์ฐ CPU ์คํ๋ก๋๋ฅผ ๋นํ์ฑํํฉ๋๋ค(์๋๊ฐ ๋๋ ค์ง๋ฏ๋ก).
+* Ampere ์ด์์ GPU๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ bf16์ ํ์ฑํํ๋ฉด ์๋๊ฐ ๋นจ๋ผ์ง๋๋ค. ์ด๋ฌํ GPU๊ฐ ์๋ ๊ฒฝ์ฐ ์ค๋ฒํ๋ก ์ค๋ฅ๊ฐ ๋ฐ์ํ ์ ์์ผ๋ฏ๋ก bf16์ผ๋ก ์ฌ์ ํ์ต๋ ๋ชจ๋ธ(T5 ๋ชจ๋ธ)์ ์ฌ์ฉํ์ง ์๋ ํ fp16์ ํ์ฑํํ ์ ์์ต๋๋ค.
+
+๋จ์ผ GPU์ ๋ง์ง ์๋ ๋ชจ๋ธ์์ [`Trainer`] ์์ด ZeRO ์ถ๋ก ์ ์คํํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ ๋์ ์์ด๋์ด๋ฅผ ์ป์ผ๋ ค๋ฉด ๋ค์ ์คํฌ๋ฆฝํธ๋ฅผ ์ดํด๋ณด์๊ธฐ ๋ฐ๋๋๋ค.
+
+```py
+#!/usr/bin/env python
+
+# ์ด ์คํฌ๋ฆฝํธ๋ ๋จ์ผ GPU์ ๋ชจ๋ธ์ ๋ง์ถ ์ ์์ ๋ ์ถ๋ก ๋ชจ๋์์ Deepspeed ZeRO๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค.
+#
+# 1. CPU ์คํ๋ก๋์ ํจ๊ป 1๊ฐ์ GPU ์ฌ์ฉ
+# 2. ๋๋ ์ฌ๋ฌ GPU ์ฌ์ฉ
+#
+# ๋จผ์ deepspeed๋ฅผ ์ค์นํด์ผ ํฉ๋๋ค: pip install deepspeed
+#
+# ์ฌ๊ธฐ์๋ ์ฝ 15GB์ GPU RAM์ด ํ์ํ 3B "bigscience/T0_3B" ๋ชจ๋ธ์ ์ฌ์ฉํฉ๋๋ค - ๋ฐ๋ผ์ 1๊ฐ์ ํฐ GPU๋ 2๊ฐ์
+# ์์ GPU๋ก ์ฒ๋ฆฌํ ์ ์์ต๋๋ค. ๋๋ 1๊ฐ์ ์์ GPU์ ๋ง์ CPU ๋ฉ๋ชจ๋ฆฌ๋ก๋ ๊ฐ๋ฅํฉ๋๋ค.
+#
+# ์ฝ 50GB๊ฐ ํ์ํ "bigscience/T0"์ ๊ฐ์ ๋ ํฐ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ค๋ฉด, 80GB GPU๊ฐ ์๋ ํ
+# 2-4๊ฐ์ GPU๊ฐ ํ์ํ ๊ฒ์
๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ฌ๋ฌ ์
๋ ฅ์ ํ ๋ฒ์ ์ฒ๋ฆฌํ๊ณ ์ถ๋ค๋ฉด
+# ์คํฌ๋ฆฝํธ๋ฅผ ์์ ํ์ฌ ๋ ๋ง์ GPU๋ฅผ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค.
+#
+# ์ ๊ณต๋ deepspeed ์ค์ ์ CPU ๋ฉ๋ชจ๋ฆฌ ์คํ๋ก๋ฉ๋ ํ์ฑํํ๋ฏ๋ก, ์ฌ์ฉ ๊ฐ๋ฅํ CPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋ง๊ณ
+# ์๋ ์ ํ๋ฅผ ๊ฐ์ํ ์ ์๋ค๋ฉด ์ผ๋ฐ์ ์ผ๋ก ๋จ์ผ GPU์ ๋ง์ง ์๋ ๋ชจ๋ธ์ ๋ก๋ํ ์ ์์ ๊ฒ์
๋๋ค.
+# GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ถฉ๋ถํ๋ค๋ฉด CPU๋ก์ ์คํ๋ก๋๋ฅผ ์ํ์ง ์์ ๋ ํ๋ก๊ทธ๋จ์ด ๋ ๋น ๋ฅด๊ฒ ์คํ๋ ๊ฒ์
๋๋ค - ๊ทธ๋ด ๋๋ ํด๋น ์น์
์ ๋นํ์ฑํํ์ธ์.
+#
+# 1๊ฐ์ GPU์ ๋ฐฐํฌํ๋ ค๋ฉด:
+#
+# deepspeed --num_gpus 1 t0.py
+# ๋๋:
+# python -m torch.distributed.run --nproc_per_node=1 t0.py
+#
+# 2๊ฐ์ GPU์ ๋ฐฐํฌํ๋ ค๋ฉด:
+#
+# deepspeed --num_gpus 2 t0.py
+# ๋๋:
+# python -m torch.distributed.run --nproc_per_node=2 t0.py
+
+from transformers import AutoTokenizer, AutoConfig, AutoModelForSeq2SeqLM
+from transformers.integrations import HfDeepSpeedConfig
+import deepspeed
+import os
+import torch
+
+os.environ["TOKENIZERS_PARALLELISM"] = "false" # ํ ํฌ๋์ด์ ์ ๋ณ๋ ฌ ์ฒ๋ฆฌ์ ๊ดํ ๊ฒฝ๊ณ ๋ฅผ ํผํ๊ธฐ ์ํจ์
๋๋ค.
+
+# ๋ถ์ฐ ํ๊ฒฝ ์ค์
+local_rank = int(os.getenv("LOCAL_RANK", "0"))
+world_size = int(os.getenv("WORLD_SIZE", "1"))
+torch.cuda.set_device(local_rank)
+deepspeed.init_distributed()
+
+model_name = "bigscience/T0_3B"
+
+config = AutoConfig.from_pretrained(model_name)
+model_hidden_size = config.d_model
+
+# ๋ฐฐ์น ํฌ๊ธฐ๋ world_size๋ก ๋๋์ด ๋จ์ด์ ธ์ผ ํ์ง๋ง, world_size๋ณด๋ค ํด ์ ์์ต๋๋ค
+train_batch_size = 1 * world_size
+
+# ds_config ์ฐธ๊ณ ์ฌํญ
+#
+# - Ampere ์ด์์ GPU๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ bf16์ ํ์ฑํํ์ธ์ - ์ด๋ ํผํฉ ์ ๋ฐ๋๋ก ์คํ๋์ด
+# ๋ ๋น ๋ฅผ ๊ฒ์
๋๋ค.
+#
+# - ์ค๋๋ GPU์ ๊ฒฝ์ฐ fp16์ ํ์ฑํํ ์ ์์ง๋ง, bf16์ผ๋ก ์ฌ์ ํ๋ จ๋์ง ์์ ๋ชจ๋ธ์์๋ง ์๋ํฉ๋๋ค - ์๋ฅผ ๋ค์ด
+# ๋ชจ๋ ๊ณต์ t5 ๋ชจ๋ธ์ bf16์ผ๋ก ์ฌ์ ํ๋ จ๋์์ต๋๋ค
+#
+# - CPU ์คํ๋ก๋๋ฅผ ์ํ์ง ์๋๋ค๋ฉด offload_param.device๋ฅผ "none"์ผ๋ก ์ค์ ํ๊ฑฐ๋ `offload_param` ์น์
์
+# ์์ ํ ์ ๊ฑฐํ์ธ์
+#
+# - `offload_param`์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ, stage3_param_persistence_threshold๋ฅผ ์๋์ผ๋ก ๋ฏธ์ธ ์กฐ์ ํ์ฌ
+# ์ด๋ค ๋งค๊ฐ๋ณ์๊ฐ GPU์ ๋จ์์์ด์ผ ํ๋์ง ์ ์ดํ ์ ์์ต๋๋ค - ๊ฐ์ด ํด์๋ก ์คํ๋ก๋ ํฌ๊ธฐ๊ฐ ์์์ง๋๋ค
+#
+# Deepspeed ์ค์ ์ ๋ํ ์์ธํ ์ ๋ณด๋ ๋ค์์ ์ฐธ์กฐํ์ธ์
+# https://huggingface.co/docs/transformers/main/main_classes/deepspeed
+
+# ์ผ๊ด์ฑ์ ์ํด json๊ณผ ๋์ผํ ํ์์ ์ ์งํ๋, true/false์๋ ์๋ฌธ์๋ฅผ ์ฌ์ฉํฉ๋๋ค
+# fmt: off
+ds_config = {
+ "fp16": {
+ "enabled": False
+ },
+ "bf16": {
+ "enabled": False
+ },
+ "zero_optimization": {
+ "stage": 3,
+ "offload_param": {
+ "device": "cpu",
+ "pin_memory": True
+ },
+ "overlap_comm": True,
+ "contiguous_gradients": True,
+ "reduce_bucket_size": model_hidden_size * model_hidden_size,
+ "stage3_prefetch_bucket_size": 0.9 * model_hidden_size * model_hidden_size,
+ "stage3_param_persistence_threshold": 10 * model_hidden_size
+ },
+ "steps_per_print": 2000,
+ "train_batch_size": train_batch_size,
+ "train_micro_batch_size_per_gpu": 1,
+ "wall_clock_breakdown": False
+}
+# fmt: on
+
+# ๋ค์ ์ค์ ๋ชจ๋ธ์ `from_pretrained` ๋ฉ์๋๊ฐ ํธ์ถ๋ ๋
+# deepspeed.zero.Init๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ์ฌ๋ฌ GPU์ ์ง์ ๋ถํ ํ๋๋ก transformers์ ์ง์ํฉ๋๋ค.
+#
+# **์ด๋ AutoModelForSeq2SeqLM.from_pretrained(model_name)๋ก ๋ชจ๋ธ์ ๋ก๋ํ๊ธฐ ์ ์ ์คํ๋์ด์ผ ํฉ๋๋ค**
+#
+# ๊ทธ๋ ์ง ์์ผ๋ฉด ๋ชจ๋ธ์ด ๋จผ์ ์ ์์ ์ผ๋ก ๋ก๋๋ ํ ํฌ์๋ ์์๋ง ๋ถํ ๋๋๋ฐ, ์ด๋
+# ๋ ํจ์จ์ ์ด๋ฉฐ CPU RAM์ด ๋ถ์กฑํ ๊ฒฝ์ฐ ์คํจํ ์ ์์ต๋๋ค
+dschf = HfDeepSpeedConfig(ds_config) # ์ด ๊ฐ์ฒด๋ฅผ ์ ์งํ์ธ์
+
+# ์ด์ ๋ชจ๋ธ์ ๋ก๋ํ ์ ์์ต๋๋ค.
+model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
+
+# Deepspeed ZeRO๋ฅผ ์ด๊ธฐํํ๊ณ ์์ง ๊ฐ์ฒด๋ง ์ ์ฅ
+ds_engine = deepspeed.initialize(model=model, config_params=ds_config)[0]
+ds_engine.module.eval() # inference
+
+# Deepspeed ZeRO๋ ๊ฐ GPU์์ ์๋ก ๊ด๋ จ ์๋ ์
๋ ฅ์ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ 2๊ฐ์ GPU๋ฅผ ์ฌ์ฉํ๋ฉด ํ ๋ฒ์ 2๊ฐ์ ์
๋ ฅ์ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค.
+# GPU๋ฅผ ๋ ๋ง์ด ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ทธ์ ๋ง๊ฒ ์กฐ์ ํ์ธ์.
+
+# ๋ฌผ๋ก ์ฒ๋ฆฌํ ์
๋ ฅ์ด ํ๋๋ฟ์ด๋ผ๋ฉด ๋ GPU์ ๋์ผํ ๋ฌธ์์ด์ ์ ๋ฌํด์ผ ํฉ๋๋ค.
+# GPU๋ฅผ ํ๋๋ง ์ฌ์ฉํ๋ ๊ฒฝ์ฐ์๋ rank 0๋ง ๊ฐ๊ฒ ๋ฉ๋๋ค.
+rank = torch.distributed.get_rank()
+if rank == 0:
+ text_in = "Is this review positive or negative? Review: this is the best cast iron skillet you will ever buy"
+elif rank == 1:
+ text_in = "Is this review positive or negative? Review: this is the worst restaurant ever"
+
+tokenizer = AutoTokenizer.from_pretrained(model_name)
+inputs = tokenizer.encode(text_in, return_tensors="pt").to(device=local_rank)
+with torch.no_grad():
+ outputs = ds_engine.module.generate(inputs, synced_gpus=True)
+text_out = tokenizer.decode(outputs[0], skip_special_tokens=True)
+print(f"rank{rank}:\n in={text_in}\n out={text_out}")
+```
+
+์คํฌ๋ฆฝํธ๋ฅผ t0.py๋ก ์ ์ฅํ๊ณ ์คํํฉ๋๋ค:
+
+```bash
+$ deepspeed --num_gpus 2 t0.py
+rank0:
+ in=Is this review positive or negative? Review: this is the best cast iron skillet you will ever buy
+ out=Positive
+rank1:
+ in=Is this review positive or negative? Review: this is the worst restaurant ever
+ out=negative
+```
+
+์ด๊ฒ์ ๋งค์ฐ ๊ธฐ๋ณธ์ ์ธ ์์์ด๋ฏ๋ก ์ฌ์ฉ ์ฌ๋ก์ ๋ง๊ฒ ์กฐ์ ํ ์ ์์ต๋๋ค.
+
+### ์์ฑ[[generate]]
+
+์์ฑ์ ZeRO-3์ ํจ๊ป ์ฌ๋ฌ ๊ฐ์ GPU๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด [`~GenerationMixin.generate`] ๋ฉ์๋์์ `synced_gpus=True`๋ฅผ ์ค์ ํ์ฌ GPU๋ฅผ ๋๊ธฐํํด์ผ ํฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ํ GPU๊ฐ ๋ค๋ฅธ GPU๋ณด๋ค ๋จผ์ ์์ฑ์ ์๋ฃํ๋ฉด ๋๋จธ์ง GPU๊ฐ ๋จผ์ ์๋ฃํ GPU๋ก๋ถํฐ ๊ฐ์ค์น ์ค๋๋ฅผ ๋ฐ์ง ๋ชปํ์ฌ ์ ์ฒด ์์คํ
์ด ์ค๋จ๋ฉ๋๋ค.
+
+ํธ๋์คํฌ๋จธ>=4.28์ ๊ฒฝ์ฐ, ์์ฑ ์ค์ ์ฌ๋ฌ ๊ฐ์ GPU๊ฐ ๊ฐ์ง๋๋ฉด `synced_gpus`๊ฐ ์๋์ผ๋ก `True`๋ก ์ค์ ๋ฉ๋๋ค.
+
+## ํธ๋ฌ๋ธ์ํ
[[troubleshoot]]
+
+๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ฉด DeepSpeed๊ฐ ๋ฌธ์ ์ ์์ธ์ด ์๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ผ๋ฏ๋ก(์์ฃผ ๋ช
๋ฐฑํ๊ณ ์์ธ์ ์ผ๋ก DeepSpeed ๋ชจ๋์ ๋ณผ ์ ์๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ผ๋ฉด) DeepSpeed๊ฐ ๋ฌธ์ ์ ์์ธ์ธ์ง ๊ณ ๋ คํด์ผ ํฉ๋๋ค! ์ฒซ ๋ฒ์งธ ๋จ๊ณ๋ DeepSpeed ์์ด ์ค์ ์ ๋ค์ ์๋ํ๊ณ ๋ฌธ์ ๊ฐ ์ง์๋๋ฉด ๋ฌธ์ ๋ฅผ ์ ๊ณ ํ๋ ๊ฒ์
๋๋ค. ๋ฌธ์ ๊ฐ ํต์ฌ์ ์ธ DeepSpeed ๋ฌธ์ ์ด๊ณ transformers์ ๊ด๋ จ์ด ์๋ ๊ฒฝ์ฐ, [DeepSpeed ๋ฆฌํฌ์งํ ๋ฆฌ](https://github.com/microsoft/DeepSpeed)์์ ์ด์๋ฅผ ๊ฐ์คํ์ธ์.
+
+transformers์ ๊ด๋ จ๋ ์ด์๋ฅผ ๊ฐ์คํ ๋์๋ ๋ค์ ์ ๋ณด๋ฅผ ์ ๊ณตํด ์ฃผ์ธ์:
+
+* ์ ์ฒด DeepSpeed ๊ตฌ์ฑ ํ์ผ
+
+*[`Trainer`]์ ๋ช
๋ น์ค ์ธ์, ๋๋[`Trainer`] ์ค์ ์ ์ง์ ์์ฑํ๋ ๊ฒฝ์ฐ[`TrainingArguments`] ์ธ์(๊ด๋ จ ์๋ ํญ๋ชฉ์ด ์์ญ ๊ฐ ์๋ [`TrainingArguments`]๋ ๋คํํ์ง ๋ง์ธ์).
+
+* ๋ค์ ์ฝ๋์ ์ถ๋ ฅ ๊ฒฐ๊ณผ:
+
+```bash
+python -c 'import torch; print(f"torch: {torch.__version__}")'
+python -c 'import transformers; print(f"transformers: {transformers.__version__}")'
+python -c 'import deepspeed; print(f"deepspeed: {deepspeed.__version__}")'
+```
+
+* ๋ฌธ์ ๋ฅผ ์ฌํํ ์ ์๋ Google Colab ๋
ธํธ๋ถ ๋งํฌ
+
+* ๋ถ๊ฐ๋ฅํ ๊ฒฝ์ฐ ๊ธฐ์กด ์์ ๋ฅผ ์ฌ์ฉํ์ฌ ๋ฌธ์ ๋ฅผ ์ฌํํ ์ ์๋ ํ์ค ๋ฐ ์ฌ์ฉ์ ์ง์ ์ด ์๋ ๋ฐ์ดํฐ ์งํฉ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+๋ค์ ์น์
์์๋ ๊ฐ์ฅ ์ผ๋ฐ์ ์ธ ๋ ๊ฐ์ง ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ๊ฐ์ด๋๋ฅผ ์ ๊ณตํฉ๋๋ค.
+
+### DeepSpeed ํ๋ก์ธ์ค๊ฐ ์์ ๋จ๊ณ์์ ์ข
๋ฃ๋์์ ๊ฒฝ์ฐ[[deepspeed-process-killed-at-startup]]
+
+์คํ ์ค์ ํธ๋ ์ด์ค๋ฐฑ ์์ด DeepSpeed ํ๋ก์ธ์ค๊ฐ ์ข
๋ฃ๋๋ฉด ์ผ๋ฐ์ ์ผ๋ก ํ๋ก๊ทธ๋จ์ด ์์คํ
๋ณด๋ค ๋ง์ CPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ํ ๋นํ๋ ค๊ณ ์๋ํ๊ฑฐ๋ ํ๋ก์ธ์ค๊ฐ ํ์ฉ๋ ๊ฒ๋ณด๋ค ๋ง์ CPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ํ ๋นํ๋ ค๊ณ ์๋ํ์ฌ OS ์ปค๋์ด ํ๋ก์ธ์ค๋ฅผ ์ข
๋ฃํ์์ ์๋ฏธํฉ๋๋ค. ์ด ๊ฒฝ์ฐ ๊ตฌ์ฑ ํ์ผ์ `offload_optimizer`, `offload_param` ๋๋ ๋ ๋ค CPU๋ก ์คํ๋ก๋ํ๋๋ก ๊ตฌ์ฑ๋์ด ์๋์ง ํ์ธํ์ธ์.
+
+NVMe ๋ฐ ZeRO-3๋ฅผ ์ค์ ํ ๊ฒฝ์ฐ NVMe๋ก ์คํ๋ก๋๋ฅผ ์คํํด ๋ณด์ธ์(๋ชจ๋ธ์ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ [ํ์ธ](https://deepspeed.readthedocs.io/en/latest/memory.html)ํ์ธ์).
+
+### NaN ์์ค[[nan-loss]]
+
+๋ชจ๋ธ์ bf16์ผ๋ก ์ฌ์ ํ๋ จํ ๋ค์ fp16์ผ๋ก ์ฌ์ฉํ๋ ค๊ณ ํ ๋ NaN ์์ค์ด ๋ฐ์ํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค(ํนํ TPU ํ๋ จ ๋ชจ๋ธ์ ํด๋น). ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด ํ๋์จ์ด๊ฐ ์ด๋ฅผ ์ง์ํ๋ ๊ฒฝ์ฐ(TPU, Ampere GPU ์ด์) fp32 ๋๋ bf16์ ์ฌ์ฉํ์ธ์.
+
+๋ค๋ฅธ ๋ฌธ์ ๋ fp16 ์ฌ์ฉ๊ณผ ๊ด๋ จ์ด ์์ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ์ด๊ฒ์ด fp16 ๊ตฌ์ฑ์ธ ๊ฒฝ์ฐ์
๋๋ค:
+
+```yaml
+{
+ "fp16": {
+ "enabled": "auto",
+ "loss_scale": 0,
+ "loss_scale_window": 1000,
+ "initial_scale_power": 16,
+ "hysteresis": 2,
+ "min_loss_scale": 1
+ }
+}
+```
+
+๋ก๊ทธ์ ๋ค์๊ณผ ๊ฐ์ `OVERFLOW!` ๋ฉ์์ง๊ฐ ํ์๋ ์ ์์ต๋๋ค:
+
+```bash
+0%| | 0/189 [00:00, ?it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 262144, reducing to 262144
+ 1%|โ | 1/189 [00:00<01:26, 2.17it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 262144, reducing to 131072.0
+ 1%|โโ
+ [...]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+ 14%|โโโโโโโโโโโโโโโโโ | 27/189 [00:14<01:13, 2.21it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+ 15%|โโโโโโโโโโโโโโโโโโ | 28/189 [00:14<01:13, 2.18it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+ 15%|โโโโโโโโโโโโโโโโโโ | 29/189 [00:15<01:13, 2.18it/s]
+ [deepscale] OVERFLOW! Rank 0 Skipping step. Attempted loss scale: 1, reducing to 1
+[...]
+```
+
+์ด๋ DeepSpeed ์์ค ์ค์ผ์ผ๋ฌ๊ฐ ์์ค ์ค๋ฒํ๋ก๋ฅผ ๊ทน๋ณตํ ์ ์๋ ์ค์ผ์ผ๋ง ๊ณ์๋ฅผ ์ฐพ์ ์ ์์์ ์๋ฏธํฉ๋๋ค. ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด `initial_scale_power` ๊ฐ์ ๋ ๋๊ฒ ์ค์ ํ์ธ์(์ผ๋ฐ์ ์ผ๋ก 32๊ฐ ์ ์ ํฉ๋๋ค).
+
+## ๋ฆฌ์์ค[[resources]]
+
+DeepSpeed ZeRO๋ ์ ํ๋ GPU ๋ฆฌ์์ค๋ก ์ถ๋ก ์ ์ํด ๋งค์ฐ ํฐ ๋ชจ๋ธ์ ํ๋ จํ๊ณ ๋ก๋ํ๋ ๊ฐ๋ ฅํ ๊ธฐ์ ๋ก, ๋๊ตฌ๋ ์ฝ๊ฒ ์ฌ์ฉํ ์ ์์ต๋๋ค. DeepSpeed์ ๋ํด ์์ธํ ์์๋ณด๋ ค๋ฉด [๋ธ๋ก๊ทธ ํฌ์คํธ](https://www.microsoft.com/en-us/research/search/?q=deepspeed), [๊ณต์ ๋ฌธ์](https://www.deepspeed.ai/getting-started/), [๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ](https://github.com/microsoft/deepspeed)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+๋ค์ ๋ฌธ์๋ ZeRO์ ๋ํด ์์ธํ ์์๋ณผ ์ ์๋ ํ๋ฅญํ ์๋ฃ์
๋๋ค:
+
+* [ZeRO: Memory Optimizations Toward Training Trillion Parameter Models](https://hf.co/papers/1910.02054)
+* [ZeRO-Offload: Democratizing Billion-Scale Model Training](https://hf.co/papers/2101.06840)
+* [ZeRO-Infinity: Breaking the GPU Memory Wall for Extreme Scale Deep Learning](https://hf.co/papers/2104.07857)
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/fast_tokenizers.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/fast_tokenizers.md
new file mode 100644
index 0000000000000000000000000000000000000000..a6d1f14283bbc5d8f66356143fe1ca8ea42c0867
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/fast_tokenizers.md
@@ -0,0 +1,71 @@
+
+
+# ๐ค Tokenizers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ํ ํฌ๋์ด์ ์ฌ์ฉํ๊ธฐ[[use-tokenizers-from-tokenizers]]
+
+[`PreTrainedTokenizerFast`]๋ [๐ค Tokenizers](https://huggingface.co/docs/tokenizers) ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ธฐ๋ฐํฉ๋๋ค. ๐ค Tokenizers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ํ ํฌ๋์ด์ ๋
+๐ค Transformers๋ก ๋งค์ฐ ๊ฐ๋จํ๊ฒ ๋ถ๋ฌ์ฌ ์ ์์ต๋๋ค.
+
+๊ตฌ์ฒด์ ์ธ ๋ด์ฉ์ ๋ค์ด๊ฐ๊ธฐ ์ ์, ๋ช ์ค์ ์ฝ๋๋ก ๋๋ฏธ ํ ํฌ๋์ด์ ๋ฅผ ๋ง๋ค์ด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+>>> from tokenizers import Tokenizer
+>>> from tokenizers.models import BPE
+>>> from tokenizers.trainers import BpeTrainer
+>>> from tokenizers.pre_tokenizers import Whitespace
+
+>>> tokenizer = Tokenizer(BPE(unk_token="[UNK]"))
+>>> trainer = BpeTrainer(special_tokens=["[UNK]", "[CLS]", "[SEP]", "[PAD]", "[MASK]"])
+
+>>> tokenizer.pre_tokenizer = Whitespace()
+>>> files = [...]
+>>> tokenizer.train(files, trainer)
+```
+
+์ฐ๋ฆฌ๊ฐ ์ ์ํ ํ์ผ์ ํตํด ์ด์ ํ์ต๋ ํ ํฌ๋์ด์ ๋ฅผ ๊ฐ๊ฒ ๋์์ต๋๋ค. ์ด ๋ฐํ์์์ ๊ณ์ ์ฌ์ฉํ๊ฑฐ๋ JSON ํ์ผ๋ก ์ ์ฅํ์ฌ ๋์ค์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+## ํ ํฌ๋์ด์ ๊ฐ์ฒด๋ก๋ถํฐ ์ง์ ๋ถ๋ฌ์ค๊ธฐ[[loading-directly-from-the-tokenizer-object]]
+
+๐ค Transformers ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ์ด ํ ํฌ๋์ด์ ๊ฐ์ฒด๋ฅผ ํ์ฉํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+[`PreTrainedTokenizerFast`] ํด๋์ค๋ ์ธ์คํด์คํ๋ *ํ ํฌ๋์ด์ * ๊ฐ์ฒด๋ฅผ ์ธ์๋ก ๋ฐ์ ์ฝ๊ฒ ์ธ์คํด์คํํ ์ ์์ต๋๋ค:
+
+```python
+>>> from transformers import PreTrainedTokenizerFast
+
+>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_object=tokenizer)
+```
+
+์ด์ `fast_tokenizer` ๊ฐ์ฒด๋ ๐ค Transformers ํ ํฌ๋์ด์ ์์ ๊ณต์ ํ๋ ๋ชจ๋ ๋ฉ์๋์ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค! ์์ธํ ๋ด์ฉ์ [ํ ํฌ๋์ด์ ํ์ด์ง](main_classes/tokenizer)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+## JSON ํ์ผ์์ ๋ถ๋ฌ์ค๊ธฐ[[loading-from-a-JSON-file]]
+
+
+
+JSON ํ์ผ์์ ํ ํฌ๋์ด์ ๋ฅผ ๋ถ๋ฌ์ค๊ธฐ ์ํด, ๋จผ์ ํ ํฌ๋์ด์ ๋ฅผ ์ ์ฅํด ๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+>>> tokenizer.save("tokenizer.json")
+```
+
+JSON ํ์ผ์ ์ ์ฅํ ๊ฒฝ๋ก๋ `tokenizer_file` ๋งค๊ฐ๋ณ์๋ฅผ ์ฌ์ฉํ์ฌ [`PreTrainedTokenizerFast`] ์ด๊ธฐํ ๋ฉ์๋์ ์ ๋ฌํ ์ ์์ต๋๋ค:
+
+```python
+>>> from transformers import PreTrainedTokenizerFast
+
+>>> fast_tokenizer = PreTrainedTokenizerFast(tokenizer_file="tokenizer.json")
+```
+
+์ด์ `fast_tokenizer` ๊ฐ์ฒด๋ ๐ค Transformers ํ ํฌ๋์ด์ ์์ ๊ณต์ ํ๋ ๋ชจ๋ ๋ฉ์๋์ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค! ์์ธํ ๋ด์ฉ์ [ํ ํฌ๋์ด์ ํ์ด์ง](main_classes/tokenizer)๋ฅผ ์ฐธ์กฐํ์ธ์.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/fsdp.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/fsdp.md
new file mode 100644
index 0000000000000000000000000000000000000000..bab1fda71b4ed10542aea99837bbd06154abd888
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/fsdp.md
@@ -0,0 +1,138 @@
+
+
+# ์์ ๋ถํ ๋ฐ์ดํฐ ๋ณ๋ ฌ ์ฒ๋ฆฌ(FSDP) [[fully-sharded-data-parallel]]
+
+[Fully Sharded Data Parallel (FSDP)](https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/)์ ๋ชจ๋ธ์ ๋งค๊ฐ๋ณ์, ๊ทธ๋ ์ด๋์ธํธ ๋ฐ ์ตํฐ๋ง์ด์ ์ํ๋ฅผ ์ฌ์ฉ ๊ฐ๋ฅํ GPU(์์
์ ๋๋ *๋ญํฌ*๋ผ๊ณ ๋ ํจ) ์์ ๋ฐ๋ผ ๋ถํ ํ๋ ๋ฐ์ดํฐ ๋ณ๋ ฌ ์ฒ๋ฆฌ ๋ฐฉ์์
๋๋ค. [DistributedDataParallel (DDP)](https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html)์ ๋ฌ๋ฆฌ, FSDP๋ ๊ฐ GPU์ ๋ชจ๋ธ์ ๋ณต์ ํ๊ธฐ ๋๋ฌธ์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ์ค์
๋๋ค. ์ด๋ GPU ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ์ ํฅ์์ํค๋ฉฐ ์ ์ ์์ GPU๋ก ํจ์ฌ ๋ ํฐ ๋ชจ๋ธ์ ํ๋ จํ ์ ์๊ฒ ํฉ๋๋ค. FSDP๋ ๋ถ์ฐ ํ๊ฒฝ์์์ ํ๋ จ์ ์ฝ๊ฒ ๊ด๋ฆฌํ ์ ์๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ธ Accelerate์ ํตํฉ๋์ด ์์ผ๋ฉฐ, ๋ฐ๋ผ์ [`Trainer`] ํด๋์ค์์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+์์ํ๊ธฐ ์ ์ Accelerate๊ฐ ์ค์น๋์ด ์๊ณ ์ต์ PyTorch 2.1.0 ์ด์์ ๋ฒ์ ์ด ์ค์น๋์ด ์๋์ง ํ์ธํ์ธ์.
+
+```bash
+pip install accelerate
+```
+
+## FSDP ๊ตฌ์ฑ [[fsdp-configuration]]
+
+์์ํ๋ ค๋ฉด [`accelerate config`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-config) ๋ช
๋ น์ ์คํํ์ฌ ํ๋ จ ํ๊ฒฝ์ ๋ํ ๊ตฌ์ฑ ํ์ผ์ ์์ฑํ์ธ์. Accelerate๋ ์ด ๊ตฌ์ฑ ํ์ผ์ ์ฌ์ฉํ์ฌ `accelerate config`์์ ์ ํํ ํ๋ จ ์ต์
์ ๋ฐ๋ผ ์๋์ผ๋ก ์ฌ๋ฐ๋ฅธ ํ๋ จ ํ๊ฒฝ์ ์ค์ ํฉ๋๋ค.
+
+```bash
+accelerate config
+```
+
+`accelerate config`๋ฅผ ์คํํ๋ฉด ํ๋ จ ํ๊ฒฝ์ ๊ตฌ์ฑํ๊ธฐ ์ํ ์ผ๋ จ์ ์ต์
๋ค์ด ๋ํ๋ฉ๋๋ค. ์ด ์น์
์์๋ ๊ฐ์ฅ ์ค์ํ FSDP ์ต์
์ค ์ผ๋ถ๋ฅผ ๋ค๋ฃน๋๋ค. ๋ค๋ฅธ ์ฌ์ฉ ๊ฐ๋ฅํ FSDP ์ต์
์ ๋ํด ๋ ์์๋ณด๊ณ ์ถ๋ค๋ฉด [fsdp_config](https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.fsdp_config) ๋งค๊ฐ๋ณ์๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+### ๋ถํ ์ ๋ต [[sharding-strategy]]
+
+FSDP๋ ์ฌ๋ฌ ๊ฐ์ง ๋ถํ ์ ๋ต์ ์ ๊ณตํฉ๋๋ค:
+
+* `FULL_SHARD` - ๋ชจ๋ธ ๋งค๊ฐ๋ณ์, ๊ทธ๋ ์ด๋์ธํธ ๋ฐ ์ตํฐ๋ง์ด์ ์ํ๋ฅผ ์์
์ ๊ฐ์ ๋ถํ ; ์ด ์ต์
์ ์ ํํ๋ ค๋ฉด `1`์ ์ ํํ์ธ์
+* `SHARD_GRAD_OP` - ๊ทธ๋ ์ด๋์ธํธ ๋ฐ ์ตํฐ๋ง์ด์ ์ํ๋ฅผ ์์
์ ๊ฐ์ ๋ถํ ; ์ด ์ต์
์ ์ ํํ๋ ค๋ฉด `2`๋ฅผ ์ ํํ์ธ์
+* `NO_SHARD` - ์๋ฌด ๊ฒ๋ ๋ถํ ํ์ง ์์ (DDP์ ๋์ผ); ์ด ์ต์
์ ์ ํํ๋ ค๋ฉด `3`์ ์ ํํ์ธ์
+* `HYBRID_SHARD` - ๊ฐ ์์
์๊ฐ ์ ์ฒด ๋ณต์ฌ๋ณธ์ ๊ฐ์ง๊ณ ์๋ ์ํ์์ ๋ชจ๋ธ ๋งค๊ฐ๋ณ์, ๊ทธ๋ ์ด๋์ธํธ ๋ฐ ์ตํฐ๋ง์ด์ ์ํ๋ฅผ ์์
์ ๋ด์์ ๋ถํ ; ์ด ์ต์
์ ์ ํํ๋ ค๋ฉด `4`๋ฅผ ์ ํํ์ธ์
+* `HYBRID_SHARD_ZERO2` - ๊ฐ ์์
์๊ฐ ์ ์ฒด ๋ณต์ฌ๋ณธ์ ๊ฐ์ง๊ณ ์๋ ์ํ์์ ๊ทธ๋ ์ด๋์ธํธ ๋ฐ ์ตํฐ๋ง์ด์ ์ํ๋ฅผ ์์
์ ๋ด์์ ๋ถํ ; ์ด ์ต์
์ ์ ํํ๋ ค๋ฉด `5`๋ฅผ ์ ํํ์ธ์
+
+์ด๊ฒ์ `fsdp_sharding_strategy` ํ๋๊ทธ๋ก ํ์ฑํ๋ฉ๋๋ค.
+
+### CPU ์คํ๋ก๋ [[cpu-offload]]
+
+์ฌ์ฉํ์ง ์๋ ๋งค๊ฐ๋ณ์์ ๊ทธ๋ ์ด๋์ธํธ๋ฅผ CPU๋ก ์คํ๋ก๋ํ์ฌ ๋ ๋ง์ GPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ ์ฝํ๊ณ FSDP๋ก๋ ์ถฉ๋ถํ์ง ์์ ํฐ ๋ชจ๋ธ์ GPU์ ์ ์ฌํ ์ ์๋๋ก ํ ์ ์์ต๋๋ค. ์ด๋ `accelerate config`๋ฅผ ์คํํ ๋ `fsdp_offload_params: true`๋ก ์ค์ ํ์ฌ ํ์ฑํ๋ฉ๋๋ค.
+
+### ๋ํ ์ ์ฑ
[[wrapping-policy]]
+
+FSDP๋ ๋คํธ์ํฌ์ ๊ฐ ๋ ์ด์ด๋ฅผ ๋ํํ์ฌ ์ ์ฉ๋ฉ๋๋ค. ๋ํ์ ์ผ๋ฐ์ ์ผ๋ก ์ค์ฒฉ ๋ฐฉ์์ผ๋ก ์ ์ฉ๋๋ฉฐ ๊ฐ๊ฐ ์๋ฐฉํฅ์ผ๋ก ์ง๋๊ฐ ํ ์ ์ฒด ๊ฐ์ค์น๋ฅผ ์ญ์ ํ์ฌ ๋ค์ ๋ ์ด์ด์์ ์ฌ์ฉํ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ ์ฝํฉ๋๋ค. *์๋ ๋ํ* ์ ์ฑ
์ ์ด๋ฅผ ๊ตฌํํ๋ ๊ฐ์ฅ ๊ฐ๋จํ ๋ฐฉ๋ฒ์ด๋ฉฐ ์ฝ๋๋ฅผ ๋ณ๊ฒฝํ ํ์๊ฐ ์์ต๋๋ค. Transformer ๋ ์ด์ด๋ฅผ ๋ํํ๋ ค๋ฉด `fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP`๋ฅผ ์ ํํ๊ณ ๋ํํ ๋ ์ด์ด๋ฅผ ์ง์ ํ๋ ค๋ฉด `fsdp_transformer_layer_cls_to_wrap`๋ฅผ ์ ํํ์ธ์ (์: `BertLayer`).
+
+๋๋ ํน์ ๋งค๊ฐ๋ณ์ ์๋ฅผ ์ด๊ณผํ ๊ฒฝ์ฐ FSDP๊ฐ ๋ ์ด์ด์ ์ ์ฉ๋๋ ํฌ๊ธฐ ๊ธฐ๋ฐ ๋ํ ์ ์ฑ
์ ์ ํํ ์ ์์ต๋๋ค. ์ด๋ `fsdp_wrap_policy: SIZE_BASED_WRAP` ๋ฐ `min_num_param`์ ์ํ๋ ํฌ๊ธฐ์ ์๊ณ๊ฐ์ผ๋ก ์ค์ ํ์ฌ ํ์ฑํ๋ฉ๋๋ค.
+
+### ์ฒดํฌํฌ์ธํธ [[checkpointing]]
+
+์ค๊ฐ ์ฒดํฌํฌ์ธํธ๋ `fsdp_state_dict_type: SHARDED_STATE_DICT`๋ก ์ ์ฅํด์ผ ํฉ๋๋ค. CPU ์คํ๋ก๋๊ฐ ํ์ฑํ๋ ๋ญํฌ 0์์ ์ ์ฒด ์ํ ๋์
๋๋ฆฌ๋ฅผ ์ ์ฅํ๋ ๋ฐ ์๊ฐ์ด ๋ง์ด ๊ฑธ๋ฆฌ๊ณ , ๋ธ๋ก๋์บ์คํ
์ค ๋ฌด๊ธฐํ ๋๊ธฐํ์ฌ `NCCL Timeout` ์ค๋ฅ๊ฐ ๋ฐ์ํ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค. [`~accelerate.Accelerator.load_state`] ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ๋ถํ ๋ ์ํ ๋์
๋๋ฆฌ๋ก ํ๋ จ์ ์ฌ๊ฐํ ์ ์์ต๋๋ค.
+
+```py
+# ๊ฒฝ๋ก๊ฐ ๋ด์ฌ๋ ์ฒดํฌํฌ์ธํธ
+accelerator.load_state("ckpt")
+```
+
+๊ทธ๋ฌ๋ ํ๋ จ์ด ๋๋๋ฉด ์ ์ฒด ์ํ ๋์
๋๋ฆฌ๋ฅผ ์ ์ฅํด์ผ ํฉ๋๋ค. ๋ถํ ๋ ์ํ ๋์
๋๋ฆฌ๋ FSDP์๋ง ํธํ๋๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+```py
+if trainer.is_fsdp_enabled:
+ trainer.accelerator.state.fsdp_plugin.set_state_dict_type("FULL_STATE_DICT")
+
+trainer.save_model(script_args.output_dir)
+```
+
+### TPU [[tpu]]
+
+[PyTorch XLA](https://pytorch.org/xla/release/2.1/index.html)๋ TPU์ ๋ํ FSDP ํ๋ จ์ ์ง์ํ๋ฉฐ `accelerate config`๋ก ์์ฑ๋ FSDP ๊ตฌ์ฑ ํ์ผ์ ์์ ํ์ฌ ํ์ฑํํ ์ ์์ต๋๋ค. ์์์ ์ง์ ํ ๋ถํ ์ ๋ต ๋ฐ ๋ํ ์ต์
์ธ์๋ ์๋์ ํ์๋ ๋งค๊ฐ๋ณ์๋ฅผ ํ์ผ์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
+
+```yaml
+xla: True # PyTorch/XLA๋ฅผ ํ์ฑํํ๋ ค๋ฉด True๋ก ์ค์ ํด์ผ ํฉ๋๋ค
+xla_fsdp_settings: # XLA ํน์ FSDP ๋งค๊ฐ๋ณ์
+xla_fsdp_grad_ckpt: True # gradient checkpointing์ ์ฌ์ฉํฉ๋๋ค
+```
+
+[`xla_fsdp_settings`](https://github.com/pytorch/xla/blob/2e6e183e0724818f137c8135b34ef273dea33318/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py#L128)๋ FSDP์ ๋ํ ์ถ๊ฐ์ ์ธ XLA ํน์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ตฌ์ฑํ ์ ์๊ฒ ํฉ๋๋ค.
+
+## ํ๋ จ ์์ [[launch-training]]
+
+์์ FSDP ๊ตฌ์ฑ ํ์ผ์ ๋ค์๊ณผ ๊ฐ์ ์ ์์ต๋๋ค:
+
+```yaml
+compute_environment: LOCAL_MACHINE
+debug: false
+distributed_type: FSDP
+downcast_bf16: 'no'
+fsdp_config:
+ fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
+ fsdp_backward_prefetch_policy: BACKWARD_PRE
+ fsdp_cpu_ram_efficient_loading: true
+ fsdp_forward_prefetch: false
+ fsdp_offload_params: true
+ fsdp_sharding_strategy: 1
+ fsdp_state_dict_type: SHARDED_STATE_DICT
+ fsdp_sync_module_states: true
+ fsdp_transformer_layer_cls_to_wrap: BertLayer
+ fsdp_use_orig_params: true
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 2
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
+```
+
+ํ๋ จ์ ์์ํ๋ ค๋ฉด [`accelerate launch`](https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch) ๋ช
๋ น์ ์คํํ์ธ์. ์ด ๋ ์ ์ `accelerate config`๋ก ์์ฑํ ๊ตฌ์ฑ ํ์ผ์ ์๋์ผ๋ก ์ฌ์ฉํฉ๋๋ค.
+
+```bash
+accelerate launch my-trainer-script.py
+```
+
+```bash
+accelerate launch --fsdp="full shard" --fsdp_config="path/to/fsdp_config/ my-trainer-script.py
+```
+
+## ๋ค์ ๋จ๊ณ [[next-steps]]
+
+FSDP๋ ๋งค์ฐ ํฐ ๋ชจ๋ธ์ ํ๋ จํ ๋ ๊ฐ๋ ฅํ ๋๊ตฌ๊ฐ ๋ ์ ์์ผ๋ฉฐ, ์ฌ๋ฌ ๊ฐ์ GPU๋ TPU๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋ชจ๋ธ ๋งค๊ฐ๋ณ์, ์ตํฐ๋ง์ด์ ๋ฐ ๊ทธ๋ ์ด๋์ธํธ ์ํ๋ฅผ ๋ถํ ํ๊ณ ๋นํ์ฑ ์ํ์ผ ๋, CPU๋ก ์คํ๋ก๋ํ๋ฉด FSDP๋ ๋๊ท๋ชจ ํ๋ จ์ ๋์ ์ฐ์ฐ ๋น์ฉ์ ์ค์ผ ์ ์์ต๋๋ค. ๋ ์์๋ณด๊ณ ์ถ๋ค๋ฉด ๋ค์ ์๋ฃ๊ฐ ๋์์ด ๋ ์ ์์ต๋๋ค:
+
+* [FSDP](https://huggingface.co/docs/accelerate/usage_guides/fsdp)์ ๋ํ ๋ ๊น์ด ์๋ Accelerate ๊ฐ์ด๋๋ฅผ ๋ฐ๋ผ๊ฐ ๋ณด์ธ์.
+* [PyTorch์ ์์ ๋ถํ ๋ฐ์ดํฐ ๋ณ๋ ฌ ์ฒ๋ฆฌ (FSDP) API๋ฅผ ์๊ฐํฉ๋๋ค](https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/) ๋ธ๋ก๊ทธ ๊ธ์ ์ฝ์ด๋ณด์ธ์.
+* [FSDP๋ฅผ ์ฌ์ฉํ์ฌ ํด๋ผ์ฐ๋ TPU์์ PyTorch ๋ชจ๋ธ ํฌ๊ธฐ ์กฐ์ ํ๊ธฐ](https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/) ๋ธ๋ก๊ทธ ๊ธ์ ์ฝ์ด๋ณด์ธ์.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/generation_strategies.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/generation_strategies.md
new file mode 100644
index 0000000000000000000000000000000000000000..05f81c008b30f153932258968ed72c01888e35f2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/generation_strategies.md
@@ -0,0 +1,337 @@
+
+
+# Text generation strategies[[text-generation-strategies]]
+
+ํ
์คํธ ์์ฑ์ ๊ฐ๋ฐฉํ ํ
์คํธ ์์ฑ, ์์ฝ, ๋ฒ์ญ ๋ฑ ๋ค์ํ ์์ฐ์ด ์ฒ๋ฆฌ(NLP) ์์
์ ํ์์ ์
๋๋ค. ์ด๋ ๋ํ ์์ฑ-ํ
์คํธ ๋ณํ, ์๊ฐ-ํ
์คํธ ๋ณํ๊ณผ ๊ฐ์ด ํ
์คํธ๋ฅผ ์ถ๋ ฅ์ผ๋ก ํ๋ ์ฌ๋ฌ ํผํฉ ๋ชจ๋ฌ๋ฆฌํฐ ์์ฉ ํ๋ก๊ทธ๋จ์์๋ ์ค์ํ ์ญํ ์ ํฉ๋๋ค. ํ
์คํธ ์์ฑ์ ๊ฐ๋ฅํ๊ฒ ํ๋ ๋ช๋ช ๋ชจ๋ธ๋ก๋ GPT2, XLNet, OpenAI GPT, CTRL, TransformerXL, XLM, Bart, T5, GIT, Whisper ๋ฑ์ด ์์ต๋๋ค.
+
+
+[`~generation.GenerationMixin.generate`] ๋ฉ์๋๋ฅผ ํ์ฉํ์ฌ ๋ค์๊ณผ ๊ฐ์ ๋ค์ํ ์์
๋ค์ ๋ํด ํ
์คํธ ๊ฒฐ๊ณผ๋ฌผ์ ์์ฑํ๋ ๋ช ๊ฐ์ง ์์๋ฅผ ์ดํด๋ณด์ธ์:
+* [ํ
์คํธ ์์ฝ](./tasks/summarization#inference)
+* [์ด๋ฏธ์ง ์บก์
๋](./model_doc/git#transformers.GitForCausalLM.forward.example)
+* [์ค๋์ค ์ ์ฌ](./model_doc/whisper#transformers.WhisperForConditionalGeneration.forward.example)
+
+generate ๋ฉ์๋์ ์
๋ ฅ๋๋ ๊ฐ๋ค์ ๋ชจ๋ธ์ ๋ฐ์ดํฐ ํํ์ ๋ฐ๋ผ ๋ฌ๋ผ์ง๋๋ค. ์ด ๊ฐ๋ค์ AutoTokenizer๋ AutoProcessor์ ๊ฐ์ ๋ชจ๋ธ์ ์ ์ฒ๋ฆฌ ํด๋์ค์ ์ํด ๋ฐํ๋ฉ๋๋ค. ๋ชจ๋ธ์ ์ ์ฒ๋ฆฌ ์ฅ์น๊ฐ ํ๋ ์ด์์ ์
๋ ฅ ์ ํ์ ์์ฑํ๋ ๊ฒฝ์ฐ, ๋ชจ๋ ์
๋ ฅ์ generate()์ ์ ๋ฌํด์ผ ํฉ๋๋ค. ๊ฐ ๋ชจ๋ธ์ ์ ์ฒ๋ฆฌ ์ฅ์น์ ๋ํด์๋ ํด๋น ๋ชจ๋ธ์ ๋ฌธ์์์ ์์ธํ ์์๋ณผ ์ ์์ต๋๋ค.
+
+ํ
์คํธ๋ฅผ ์์ฑํ๊ธฐ ์ํด ์ถ๋ ฅ ํ ํฐ์ ์ ํํ๋ ๊ณผ์ ์ ๋์ฝ๋ฉ์ด๋ผ๊ณ ํ๋ฉฐ, `generate()` ๋ฉ์๋๊ฐ ์ฌ์ฉํ ๋์ฝ๋ฉ ์ ๋ต์ ์ฌ์ฉ์๊ฐ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค. ๋์ฝ๋ฉ ์ ๋ต์ ์์ ํ๋ ๊ฒ์ ํ๋ จ ๊ฐ๋ฅํ ๋งค๊ฐ๋ณ์์ ๊ฐ๋ค์ ๋ณ๊ฒฝํ์ง ์์ง๋ง, ์์ฑ๋ ์ถ๋ ฅ์ ํ์ง์ ๋์ ๋๋ ์ํฅ์ ์ค ์ ์์ต๋๋ค. ์ด๋ ํ
์คํธ์์ ๋ฐ๋ณต์ ์ค์ด๊ณ , ๋ ์ผ๊ด์ฑ ์๊ฒ ๋ง๋๋ ๋ฐ ๋์์ ์ค ์ ์์ต๋๋ค.
+
+
+์ด ๊ฐ์ด๋์์๋ ๋ค์๊ณผ ๊ฐ์ ๋ด์ฉ์ ๋ค๋ฃน๋๋ค:
+* ๊ธฐ๋ณธ ์์ฑ ์ค์
+* ์ผ๋ฐ์ ์ธ ๋์ฝ๋ฉ ์ ๋ต๊ณผ ์ฃผ์ ํ๋ผ๋ฏธํฐ
+* ๐ค Hub์์ ๋ฏธ์ธ ์กฐ์ ๋ ๋ชจ๋ธ๊ณผ ํจ๊ป ์ฌ์ฉ์ ์ ์ ์์ฑ ์ค์ ์ ์ ์ฅํ๊ณ ๊ณต์ ํ๋ ๋ฐฉ๋ฒ
+
+## ๊ธฐ๋ณธ ํ
์คํธ ์์ฑ ์ค์ [[default-text-generation-configuration]]
+
+๋ชจ๋ธ์ ๋์ฝ๋ฉ ์ ๋ต์ ์์ฑ ์ค์ ์์ ์ ์๋ฉ๋๋ค. ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ [`pipeline`] ๋ด์์ ์ถ๋ก ์ ์ฌ์ฉํ ๋, ๋ชจ๋ธ์ ๋ด๋ถ์ ์ผ๋ก ๊ธฐ๋ณธ ์์ฑ ์ค์ ์ ์ ์ฉํ๋ `PreTrainedModel.generate()` ๋ฉ์๋๋ฅผ ํธ์ถํฉ๋๋ค. ์ฌ์ฉ์๊ฐ ๋ชจ๋ธ๊ณผ ํจ๊ป ์ฌ์ฉ์ ์ ์ ์ค์ ์ ์ ์ฅํ์ง ์์์ ๊ฒฝ์ฐ์๋ ๊ธฐ๋ณธ ์ค์ ์ด ์ฌ์ฉ๋ฉ๋๋ค.
+
+๋ชจ๋ธ์ ๋ช
์์ ์ผ๋ก ๋ก๋ํ ๋, `model.generation_config`์ ํตํด ์ ๊ณต๋๋ ์์ฑ ์ค์ ์ ๊ฒ์ฌํ ์ ์์ต๋๋ค.
+
+```python
+>>> from transformers import AutoModelForCausalLM
+
+>>> model = AutoModelForCausalLM.from_pretrained("distilbert/distilgpt2")
+>>> model.generation_config
+GenerationConfig {
+ "bos_token_id": 50256,
+ "eos_token_id": 50256,
+}
+```
+
+ `model.generation_config`๋ฅผ ์ถ๋ ฅํ๋ฉด ๊ธฐ๋ณธ ์ค์ ๊ณผ ๋ค๋ฅธ ๊ฐ๋ค๋ง ํ์๋๊ณ , ๊ธฐ๋ณธ๊ฐ๋ค์ ๋์ด๋์ง ์์ต๋๋ค.
+
+๊ธฐ๋ณธ ์์ฑ ์ค์ ์ ์
๋ ฅ ํ๋กฌํํธ์ ์ถ๋ ฅ์ ํฉ์น ์ต๋ ํฌ๊ธฐ๋ฅผ 20 ํ ํฐ์ผ๋ก ์ ํํ์ฌ ๋ฆฌ์์ค ๋ถ์กฑ์ ๋ฐฉ์งํฉ๋๋ค. ๊ธฐ๋ณธ ๋์ฝ๋ฉ ์ ๋ต์ ํ์ ํ์(greedy search)์ผ๋ก, ๋ค์ ํ ํฐ์ผ๋ก ๊ฐ์ฅ ๋์ ํ๋ฅ ์ ๊ฐ์ง ํ ํฐ์ ์ ํํ๋ ๊ฐ์ฅ ๋จ์ํ ๋์ฝ๋ฉ ์ ๋ต์
๋๋ค. ๋ง์ ์์
๊ณผ ์์ ์ถ๋ ฅ ํฌ๊ธฐ์ ๋ํด์๋ ์ด ๋ฐฉ๋ฒ์ด ์ ์๋ํ์ง๋ง, ๋ ๊ธด ์ถ๋ ฅ์ ์์ฑํ ๋ ์ฌ์ฉํ๋ฉด ๋งค์ฐ ๋ฐ๋ณต์ ์ธ ๊ฒฐ๊ณผ๋ฅผ ์์ฑํ๊ฒ ๋ ์ ์์ต๋๋ค.
+
+## ํ
์คํธ ์์ฑ ์ฌ์ฉ์ ์ ์[[customize-text-generation]]
+
+ํ๋ผ๋ฏธํฐ์ ํด๋น ๊ฐ์ [`generate`] ๋ฉ์๋์ ์ง์ ์ ๋ฌํ์ฌ `generation_config`์ ์ฌ์ ์ํ ์ ์์ต๋๋ค:
+
+```python
+>>> my_model.generate(**inputs, num_beams=4, do_sample=True) # doctest: +SKIP
+```
+
+๊ธฐ๋ณธ ๋์ฝ๋ฉ ์ ๋ต์ด ๋๋ถ๋ถ์ ์์
์ ์ ์๋ํ๋ค ํ๋๋ผ๋, ์กฐ์ ํ ์ ์๋ ๋ช ๊ฐ์ง ํ๋ผ๋ฏธํฐ๊ฐ ์์ต๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ์กฐ์ ๋๋ ํ๋ผ๋ฏธํฐ์๋ ๋ค์๊ณผ ๊ฐ์ ๊ฒ๋ค์ด ํฌํจ๋ฉ๋๋ค:
+
+- `max_new_tokens`: ์์ฑํ ์ต๋ ํ ํฐ ์์
๋๋ค. ์ฆ, ํ๋กฌํํธ์ ์๋ ํ ํฐ์ ์ ์ธํ ์ถ๋ ฅ ์ํ์ค์ ํฌ๊ธฐ์
๋๋ค. ์ถ๋ ฅ์ ๊ธธ์ด๋ฅผ ์ค๋จ ๊ธฐ์ค์ผ๋ก ์ฌ์ฉํ๋ ๋์ , ์ ์ฒด ์์ฑ๋ฌผ์ด ์ผ์ ์๊ฐ์ ์ด๊ณผํ ๋ ์์ฑ์ ์ค๋จํ๊ธฐ๋ก ์ ํํ ์๋ ์์ต๋๋ค. ๋ ์์๋ณด๋ ค๋ฉด [`StoppingCriteria`]๋ฅผ ํ์ธํ์ธ์.
+- `num_beams`: 1๋ณด๋ค ํฐ ์์ ๋น์ ์ง์ ํจ์ผ๋ก์จ, ํ์ ํ์(greedy search)์์ ๋น ํ์(beam search)์ผ๋ก ์ ํํ๊ฒ ๋ฉ๋๋ค. ์ด ์ ๋ต์ ๊ฐ ์๊ฐ ๋จ๊ณ์์ ์ฌ๋ฌ ๊ฐ์ค์ ํ๊ฐํ๊ณ ๊ฒฐ๊ตญ ์ ์ฒด ์ํ์ค์ ๋ํด ๊ฐ์ฅ ๋์ ํ๋ฅ ์ ๊ฐ์ง ๊ฐ์ค์ ์ ํํฉ๋๋ค. ์ด๋ ์ด๊ธฐ ํ ํฐ์ ํ๋ฅ ์ด ๋ฎ์ ํ์ ํ์์ ์ํด ๋ฌด์๋์์ ๋์ ํ๋ฅ ์ ์ํ์ค๋ฅผ ์๋ณํ ์ ์๋ ์ฅ์ ์ ๊ฐ์ง๋๋ค.
+- `do_sample`: ์ด ๋งค๊ฐ๋ณ์๋ฅผ `True`๋ก ์ค์ ํ๋ฉด, ๋คํญ ์ํ๋ง, ๋น ํ์ ๋คํญ ์ํ๋ง, Top-K ์ํ๋ง ๋ฐ Top-p ์ํ๋ง๊ณผ ๊ฐ์ ๋์ฝ๋ฉ ์ ๋ต์ ํ์ฑํํฉ๋๋ค. ์ด๋ฌํ ์ ๋ต๋ค์ ์ ์ฒด ์ดํ์ ๋ํ ํ๋ฅ ๋ถํฌ์์ ๋ค์ ํ ํฐ์ ์ ํํ๋ฉฐ, ์ ๋ต๋ณ๋ก ํน์ ์กฐ์ ์ด ์ ์ฉ๋ฉ๋๋ค.
+- `num_return_sequences`: ๊ฐ ์
๋ ฅ์ ๋ํด ๋ฐํํ ์ํ์ค ํ๋ณด์ ์์
๋๋ค. ์ด ์ต์
์ ๋น ํ์(beam search)์ ๋ณํ๊ณผ ์ํ๋ง๊ณผ ๊ฐ์ด ์ฌ๋ฌ ์ํ์ค ํ๋ณด๋ฅผ ์ง์ํ๋ ๋์ฝ๋ฉ ์ ๋ต์๋ง ์ฌ์ฉํ ์ ์์ต๋๋ค. ํ์ ํ์(greedy search)๊ณผ ๋์กฐ ํ์(contrastive search) ๊ฐ์ ๋์ฝ๋ฉ ์ ๋ต์ ๋จ์ผ ์ถ๋ ฅ ์ํ์ค๋ฅผ ๋ฐํํฉ๋๋ค.
+
+## ๋ชจ๋ธ์ ์ฌ์ฉ์ ์ ์ ๋์ฝ๋ฉ ์ ๋ต ์ ์ฅ[[save-a-custom-decoding-strategy-with-your-model]]
+
+ํน์ ์์ฑ ์ค์ ์ ๊ฐ์ง ๋ฏธ์ธ ์กฐ์ ๋ ๋ชจ๋ธ์ ๊ณต์ ํ๊ณ ์ ํ ๋, ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ฅผ ์ ์์ต๋๋ค:
+* [`GenerationConfig`] ํด๋์ค ์ธ์คํด์ค๋ฅผ ์์ฑํฉ๋๋ค.
+* ๋์ฝ๋ฉ ์ ๋ต ํ๋ผ๋ฏธํฐ๋ฅผ ์ค์ ํฉ๋๋ค.
+* ์์ฑ ์ค์ ์ [`GenerationConfig.save_pretrained`]๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ฅํ๋ฉฐ, `config_file_name` ์ธ์๋ ๋น์๋ก๋๋ค.
+* ๋ชจ๋ธ์ ์ ์ฅ์์ ์ค์ ์ ์
๋ก๋ํ๊ธฐ ์ํด `push_to_hub`๋ฅผ `True`๋ก ์ค์ ํฉ๋๋ค.
+
+```python
+>>> from transformers import AutoModelForCausalLM, GenerationConfig
+
+>>> model = AutoModelForCausalLM.from_pretrained("my_account/my_model") # doctest: +SKIP
+>>> generation_config = GenerationConfig(
+... max_new_tokens=50, do_sample=True, top_k=50, eos_token_id=model.config.eos_token_id
+... )
+>>> generation_config.save_pretrained("my_account/my_model", push_to_hub=True) # doctest: +SKIP
+```
+
+๋จ์ผ ๋๋ ํ ๋ฆฌ์ ์ฌ๋ฌ ์์ฑ ์ค์ ์ ์ ์ฅํ ์ ์์ผ๋ฉฐ, ์ด๋ [`GenerationConfig.save_pretrained`]์ `config_file_name` ์ธ์๋ฅผ ์ฌ์ฉํฉ๋๋ค. ๋์ค์ [`GenerationConfig.from_pretrained`]๋ก ์ด๋ค์ ์ธ์คํด์คํํ ์ ์์ต๋๋ค. ์ด๋ ๋จ์ผ ๋ชจ๋ธ์ ๋ํด ์ฌ๋ฌ ์์ฑ ์ค์ ์ ์ ์ฅํ๊ณ ์ถ์ ๋ ์ ์ฉํฉ๋๋ค(์: ์ํ๋ง์ ์ด์ฉํ ์ฐฝ์์ ํ
์คํธ ์์ฑ์ ์ํ ํ๋, ๋น ํ์์ ์ด์ฉํ ์์ฝ์ ์ํ ๋ค๋ฅธ ํ๋ ๋ฑ). ๋ชจ๋ธ์ ์ค์ ํ์ผ์ ์ถ๊ฐํ๊ธฐ ์ํด ์ ์ ํ Hub ๊ถํ์ ๊ฐ์ง๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+```python
+>>> from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, GenerationConfig
+
+>>> tokenizer = AutoTokenizer.from_pretrained("google-t5/t5-small")
+>>> model = AutoModelForSeq2SeqLM.from_pretrained("google-t5/t5-small")
+
+>>> translation_generation_config = GenerationConfig(
+... num_beams=4,
+... early_stopping=True,
+... decoder_start_token_id=0,
+... eos_token_id=model.config.eos_token_id,
+... pad_token=model.config.pad_token_id,
+... )
+
+>>> # ํ: Hub์ pushํ๋ ค๋ฉด `push_to_hub=True`๋ฅผ ์ถ๊ฐ
+>>> translation_generation_config.save_pretrained("/tmp", "translation_generation_config.json")
+
+>>> # ๋ช
๋ช
๋ ์์ฑ ์ค์ ํ์ผ์ ์ฌ์ฉํ์ฌ ์์ฑ์ ๋งค๊ฐ๋ณ์ํํ ์ ์์ต๋๋ค.
+>>> generation_config = GenerationConfig.from_pretrained("/tmp", "translation_generation_config.json")
+>>> inputs = tokenizer("translate English to French: Configuration files are easy to use!", return_tensors="pt")
+>>> outputs = model.generate(**inputs, generation_config=generation_config)
+>>> print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+['Les fichiers de configuration sont faciles ร utiliser!']
+```
+
+## ์คํธ๋ฆฌ๋ฐ[[streaming]]
+
+`generate()` ๋ฉ์๋๋ `streamer` ์
๋ ฅ์ ํตํด ์คํธ๋ฆฌ๋ฐ์ ์ง์ํฉ๋๋ค. `streamer` ์
๋ ฅ์ `put()`๊ณผ `end()` ๋ฉ์๋๋ฅผ ๊ฐ์ง ํด๋์ค์ ์ธ์คํด์ค์ ํธํ๋ฉ๋๋ค. ๋ด๋ถ์ ์ผ๋ก, `put()`์ ์ ํ ํฐ์ ์ถ๊ฐํ๋ ๋ฐ ์ฌ์ฉ๋๋ฉฐ, `end()`๋ ํ
์คํธ ์์ฑ์ ๋์ ํ์ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
+
+
+
+์คํธ๋ฆฌ๋จธ ํด๋์ค์ API๋ ์์ง ๊ฐ๋ฐ ์ค์ด๋ฉฐ, ํฅํ ๋ณ๊ฒฝ๋ ์ ์์ต๋๋ค.
+
+
+
+์ค์ ๋ก ๋ค์ํ ๋ชฉ์ ์ ์ํด ์์ฒด ์คํธ๋ฆฌ๋ฐ ํด๋์ค๋ฅผ ๋ง๋ค ์ ์์ต๋๋ค! ๋ํ, ๊ธฐ๋ณธ์ ์ธ ์คํธ๋ฆฌ๋ฐ ํด๋์ค๋ค๋ ์ค๋น๋์ด ์์ด ๋ฐ๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, [`TextStreamer`] ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ `generate()`์ ์ถ๋ ฅ์ ํ๋ฉด์ ํ ๋จ์ด์ฉ ์คํธ๋ฆฌ๋ฐํ ์ ์์ต๋๋ค:
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer, TextStreamer
+
+>>> tok = AutoTokenizer.from_pretrained("openai-community/gpt2")
+>>> model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
+>>> inputs = tok(["An increasing sequence: one,"], return_tensors="pt")
+>>> streamer = TextStreamer(tok)
+
+>>> # ์คํธ๋ฆฌ๋จธ๋ ํ์์ ๊ฐ์ ์ถ๋ ฅ๊ฐ์ ๋ฐํํ ๋ฟ๋ง ์๋๋ผ ์์ฑ๋ ํ
์คํธ๋ ํ์ค ์ถ๋ ฅ(stdout)์ผ๋ก ์ถ๋ ฅํฉ๋๋ค.
+>>> _ = model.generate(**inputs, streamer=streamer, max_new_tokens=20)
+An increasing sequence: one, two, three, four, five, six, seven, eight, nine, ten, eleven,
+```
+
+## ๋์ฝ๋ฉ ์ ๋ต[[decoding-strategies]]
+
+`generate()` ๋งค๊ฐ๋ณ์์ ๊ถ๊ทน์ ์ผ๋ก `generation_config`์ ํน์ ์กฐํฉ์ ์ฌ์ฉํ์ฌ ํน์ ๋์ฝ๋ฉ ์ ๋ต์ ํ์ฑํํ ์ ์์ต๋๋ค. ์ด ๊ฐ๋
์ด ์ฒ์์ด๋ผ๋ฉด, ํํ ์ฌ์ฉ๋๋ ๋์ฝ๋ฉ ์ ๋ต์ด ์ด๋ป๊ฒ ์๋ํ๋์ง ์ค๋ช
ํ๋ [์ด ๋ธ๋ก๊ทธ ํฌ์คํธ](https://huggingface.co/blog/how-to-generate)๋ฅผ ์ฝ์ด๋ณด๋ ๊ฒ์ ์ถ์ฒํฉ๋๋ค.
+
+์ฌ๊ธฐ์๋ ๋์ฝ๋ฉ ์ ๋ต์ ์ ์ดํ๋ ๋ช ๊ฐ์ง ๋งค๊ฐ๋ณ์๋ฅผ ๋ณด์ฌ์ฃผ๊ณ , ์ด๋ฅผ ์ด๋ป๊ฒ ์ฌ์ฉํ ์ ์๋์ง ์ค๋ช
ํ๊ฒ ์ต๋๋ค.
+
+### ํ์ ํ์(Greedy Search)[[greedy-search]]
+
+[`generate`]๋ ๊ธฐ๋ณธ์ ์ผ๋ก ํ์ ํ์ ๋์ฝ๋ฉ์ ์ฌ์ฉํ๋ฏ๋ก ์ด๋ฅผ ํ์ฑํํ๊ธฐ ์ํด ๋ณ๋์ ๋งค๊ฐ๋ณ์๋ฅผ ์ง์ ํ ํ์๊ฐ ์์ต๋๋ค. ์ด๋ `num_beams`๊ฐ 1๋ก ์ค์ ๋๊ณ `do_sample=False`๋ก ๋์ด ์๋ค๋ ์๋ฏธ์
๋๋ค."
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> prompt = "I look forward to"
+>>> checkpoint = "distilbert/distilgpt2"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+>>> outputs = model.generate(**inputs)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['I look forward to seeing you all again!\n\n\n\n\n\n\n\n\n\n\n']
+```
+
+### ๋์กฐ ํ์(Contrastive search)[[contrastive-search]]
+
+2022๋
๋
ผ๋ฌธ [A Contrastive Framework for Neural Text Generation](https://arxiv.org/abs/2202.06417)์์ ์ ์๋ ๋์กฐ ํ์ ๋์ฝ๋ฉ ์ ๋ต์ ๋ฐ๋ณต๋์ง ์์ผ๋ฉด์๋ ์ผ๊ด๋ ๊ธด ์ถ๋ ฅ์ ์์ฑํ๋ ๋ฐ ์์ด ์ฐ์ํ ๊ฒฐ๊ณผ๋ฅผ ๋ณด์์ต๋๋ค. ๋์กฐ ํ์์ด ์๋ํ๋ ๋ฐฉ์์ ์์๋ณด๋ ค๋ฉด [์ด ๋ธ๋ก๊ทธ ํฌ์คํธ](https://huggingface.co/blog/introducing-csearch)๋ฅผ ํ์ธํ์ธ์. ๋์กฐ ํ์์ ๋์์ ๊ฐ๋ฅํ๊ฒ ํ๊ณ ์ ์ดํ๋ ๋ ๊ฐ์ง ์ฃผ์ ๋งค๊ฐ๋ณ์๋ `penalty_alpha`์ `top_k`์
๋๋ค:
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForCausalLM
+
+>>> checkpoint = "openai-community/gpt2-large"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+
+>>> prompt = "Hugging Face Company is"
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> outputs = model.generate(**inputs, penalty_alpha=0.6, top_k=4, max_new_tokens=100)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Hugging Face Company is a family owned and operated business. We pride ourselves on being the best
+in the business and our customer service is second to none.\n\nIf you have any questions about our
+products or services, feel free to contact us at any time. We look forward to hearing from you!']
+```
+
+### ๋คํญ ์ํ๋ง(Multinomial sampling)[[multinomial-sampling]]
+
+ํ์ ํ์(greedy search)์ด ํญ์ ๊ฐ์ฅ ๋์ ํ๋ฅ ์ ๊ฐ์ง ํ ํฐ์ ๋ค์ ํ ํฐ์ผ๋ก ์ ํํ๋ ๊ฒ๊ณผ ๋ฌ๋ฆฌ, ๋คํญ ์ํ๋ง(multinomial sampling, ์กฐ์ ์ํ๋ง(ancestral sampling)์ด๋ผ๊ณ ๋ ํจ)์ ๋ชจ๋ธ์ด ์ ๊ณตํ๋ ์ ์ฒด ์ดํ์ ๋ํ ํ๋ฅ ๋ถํฌ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋ค์ ํ ํฐ์ ๋ฌด์์๋ก ์ ํํฉ๋๋ค. 0์ด ์๋ ํ๋ฅ ์ ๊ฐ์ง ๋ชจ๋ ํ ํฐ์ ์ ํ๋ ๊ธฐํ๊ฐ ์์ผ๋ฏ๋ก, ๋ฐ๋ณต์ ์ํ์ ์ค์ผ ์ ์์ต๋๋ค.
+
+๋คํญ ์ํ๋ง์ ํ์ฑํํ๋ ค๋ฉด `do_sample=True` ๋ฐ `num_beams=1`์ ์ค์ ํ์ธ์.
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForCausalLM, set_seed
+>>> set_seed(0) # ์ฌํ์ฑ์ ์ํด
+
+>>> checkpoint = "openai-community/gpt2-large"
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+
+>>> prompt = "Today was an amazing day because"
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> outputs = model.generate(**inputs, do_sample=True, num_beams=1, max_new_tokens=100)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Today was an amazing day because when you go to the World Cup and you don\'t, or when you don\'t get invited,
+that\'s a terrible feeling."']
+```
+
+### ๋น ํ์(Beam-search) ๋์ฝ๋ฉ[[beam-search-decoding]]
+
+ํ์ ๊ฒ์(greedy search)๊ณผ ๋ฌ๋ฆฌ, ๋น ํ์(beam search) ๋์ฝ๋ฉ์ ๊ฐ ์๊ฐ ๋จ๊ณ์์ ์ฌ๋ฌ ๊ฐ์ค์ ์ ์งํ๊ณ ๊ฒฐ๊ตญ ์ ์ฒด ์ํ์ค์ ๋ํด ๊ฐ์ฅ ๋์ ํ๋ฅ ์ ๊ฐ์ง ๊ฐ์ค์ ์ ํํฉ๋๋ค. ์ด๋ ๋ฎ์ ํ๋ฅ ์ ์ด๊ธฐ ํ ํฐ์ผ๋ก ์์ํ๊ณ ๊ทธ๋ฆฌ๋ ๊ฒ์์์ ๋ฌด์๋์์ ๊ฐ๋ฅ์ฑ์ด ๋์ ์ํ์ค๋ฅผ ์๋ณํ๋ ์ด์ ์ด ์์ต๋๋ค.
+
+์ด ๋์ฝ๋ฉ ์ ๋ต์ ํ์ฑํํ๋ ค๋ฉด `num_beams` (์ถ์ ํ ๊ฐ์ค ์๋ผ๊ณ ๋ ํจ)๋ฅผ 1๋ณด๋ค ํฌ๊ฒ ์ง์ ํ์ธ์.
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> prompt = "It is astonishing how one can"
+>>> checkpoint = "openai-community/gpt2-medium"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+
+>>> outputs = model.generate(**inputs, num_beams=5, max_new_tokens=50)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['It is astonishing how one can have such a profound impact on the lives of so many people in such a short period of
+time."\n\nHe added: "I am very proud of the work I have been able to do in the last few years.\n\n"I have']
+```
+
+### ๋น ํ์ ๋คํญ ์ํ๋ง(Beam-search multinomial sampling)[[beam-search-multinomial-sampling]]
+
+์ด ๋์ฝ๋ฉ ์ ๋ต์ ์ด๋ฆ์์ ์ ์ ์๋ฏ์ด ๋น ํ์๊ณผ ๋คํญ ์ํ๋ง์ ๊ฒฐํฉํ ๊ฒ์
๋๋ค. ์ด ๋์ฝ๋ฉ ์ ๋ต์ ์ฌ์ฉํ๊ธฐ ์ํด์๋ `num_beams`๋ฅผ 1๋ณด๋ค ํฐ ๊ฐ์ผ๋ก ์ค์ ํ๊ณ , `do_sample=True`๋ก ์ค์ ํด์ผ ํฉ๋๋ค.
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, set_seed
+>>> set_seed(0) # ์ฌํ์ฑ์ ์ํด
+
+>>> prompt = "translate English to German: The house is wonderful."
+>>> checkpoint = "google-t5/t5-small"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+
+>>> outputs = model.generate(**inputs, num_beams=5, do_sample=True)
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'Das Haus ist wunderbar.'
+```
+
+### ๋ค์ํ ๋น ํ์ ๋์ฝ๋ฉ(Diverse beam search decoding)[[diverse-beam-search-decoding]]
+
+๋ค์ํ ๋น ํ์(Decoding) ์ ๋ต์ ์ ํํ ์ ์๋ ๋ ๋ค์ํ ๋น ์ํ์ค ์งํฉ์ ์์ฑํ ์ ์๊ฒ ํด์ฃผ๋ ๋น ํ์ ์ ๋ต์ ํ์ฅ์
๋๋ค. ์ด ๋ฐฉ๋ฒ์ ์ด๋ป๊ฒ ์๋ํ๋์ง ์์๋ณด๋ ค๋ฉด, [๋ค์ํ ๋น ํ์: ์ ๊ฒฝ ์ํ์ค ๋ชจ๋ธ์์ ๋ค์ํ ์๋ฃจ์
๋์ฝ๋ฉํ๊ธฐ](https://arxiv.org/pdf/1610.02424.pdf)๋ฅผ ์ฐธ์กฐํ์ธ์. ์ด ์ ๊ทผ ๋ฐฉ์์ ์ธ ๊ฐ์ง ์ฃผ์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค: `num_beams`, `num_beam_groups`, ๊ทธ๋ฆฌ๊ณ `diversity_penalty`. ๋ค์์ฑ ํจ๋ํฐ๋ ๊ทธ๋ฃน ๊ฐ์ ์ถ๋ ฅ์ด ์๋ก ๋ค๋ฅด๊ฒ ํ๊ธฐ ์ํ ๊ฒ์ด๋ฉฐ, ๊ฐ ๊ทธ๋ฃน ๋ด์์ ๋น ํ์์ด ์ฌ์ฉ๋ฉ๋๋ค.
+
+```python
+>>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+>>> checkpoint = "google/pegasus-xsum"
+>>> prompt = (
+... "The Permaculture Design Principles are a set of universal design principles "
+... "that can be applied to any location, climate and culture, and they allow us to design "
+... "the most efficient and sustainable human habitation and food production systems. "
+... "Permaculture is a design system that encompasses a wide variety of disciplines, such "
+... "as ecology, landscape design, environmental science and energy conservation, and the "
+... "Permaculture design principles are drawn from these various disciplines. Each individual "
+... "design principle itself embodies a complete conceptual framework based on sound "
+... "scientific principles. When we bring all these separate principles together, we can "
+... "create a design system that both looks at whole systems, the parts that these systems "
+... "consist of, and how those parts interact with each other to create a complex, dynamic, "
+... "living system. Each design principle serves as a tool that allows us to integrate all "
+... "the separate parts of a design, referred to as elements, into a functional, synergistic, "
+... "whole system, where the elements harmoniously interact and work together in the most "
+... "efficient way possible."
+... )
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)
+
+>>> outputs = model.generate(**inputs, num_beams=5, num_beam_groups=5, max_new_tokens=30, diversity_penalty=1.0)
+>>> tokenizer.decode(outputs[0], skip_special_tokens=True)
+'The Design Principles are a set of universal design principles that can be applied to any location, climate and
+culture, and they allow us to design the'
+```
+
+์ด ๊ฐ์ด๋์์๋ ๋ค์ํ ๋์ฝ๋ฉ ์ ๋ต์ ๊ฐ๋ฅํ๊ฒ ํ๋ ์ฃผ์ ๋งค๊ฐ๋ณ์๋ฅผ ๋ณด์ฌ์ค๋๋ค. [`generate`] ๋ฉ์๋์ ๋ํ ๊ณ ๊ธ ๋งค๊ฐ๋ณ์๊ฐ ์กด์ฌํ๋ฏ๋ก [`generate`] ๋ฉ์๋์ ๋์์ ๋์ฑ ์ธ๋ถ์ ์ผ๋ก ์ ์ดํ ์ ์์ต๋๋ค. ์ฌ์ฉ ๊ฐ๋ฅํ ๋งค๊ฐ๋ณ์์ ์ ์ฒด ๋ชฉ๋ก์ [API ๋ฌธ์](./main_classes/text_generation.md)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+### ์ถ๋ก ๋์ฝ๋ฉ(Speculative Decoding)[[speculative-decoding]]
+
+์ถ๋ก ๋์ฝ๋ฉ(๋ณด์กฐ ๋์ฝ๋ฉ(assisted decoding)์ผ๋ก๋ ์๋ ค์ง)์ ๋์ผํ ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํ๋ ํจ์ฌ ์์ ๋ณด์กฐ ๋ชจ๋ธ์ ํ์ฉํ์ฌ ๋ช ๊ฐ์ง ํ๋ณด ํ ํฐ์ ์์ฑํ๋ ์์ ๋ชจ๋ธ์ ๋์ฝ๋ฉ ์ ๋ต์ ์์ ํ ๊ฒ์
๋๋ค. ์ฃผ ๋ชจ๋ธ์ ๋จ์ผ ์ ๋ฐฉ ํต๊ณผ๋ก ํ๋ณด ํ ํฐ์ ๊ฒ์ฆํจ์ผ๋ก์จ ๋์ฝ๋ฉ ๊ณผ์ ์ ๊ฐ์ํํฉ๋๋ค. `do_sample=True`์ผ ๊ฒฝ์ฐ, [์ถ๋ก ๋์ฝ๋ฉ ๋
ผ๋ฌธ](https://arxiv.org/pdf/2211.17192.pdf)์ ์๊ฐ๋ ํ ํฐ ๊ฒ์ฆ๊ณผ ์ฌ์ํ๋ง ๋ฐฉ์์ด ์ฌ์ฉ๋ฉ๋๋ค.
+
+ํ์ฌ, ํ์ ๊ฒ์(greedy search)๊ณผ ์ํ๋ง๋ง์ด ์ง์๋๋ ๋ณด์กฐ ๋์ฝ๋ฉ(assisted decoding) ๊ธฐ๋ฅ์ ํตํด, ๋ณด์กฐ ๋์ฝ๋ฉ์ ๋ฐฐ์น ์
๋ ฅ์ ์ง์ํ์ง ์์ต๋๋ค. ๋ณด์กฐ ๋์ฝ๋ฉ์ ๋ํด ๋ ์๊ณ ์ถ๋ค๋ฉด, [์ด ๋ธ๋ก๊ทธ ํฌ์คํธ](https://huggingface.co/blog/assisted-generation)๋ฅผ ํ์ธํด ์ฃผ์ธ์.
+
+๋ณด์กฐ ๋์ฝ๋ฉ์ ํ์ฑํํ๋ ค๋ฉด ๋ชจ๋ธ๊ณผ ํจ๊ป `assistant_model` ์ธ์๋ฅผ ์ค์ ํ์ธ์.
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> prompt = "Alice and Bob"
+>>> checkpoint = "EleutherAI/pythia-1.4b-deduped"
+>>> assistant_checkpoint = "EleutherAI/pythia-160m-deduped"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+>>> assistant_model = AutoModelForCausalLM.from_pretrained(assistant_checkpoint)
+>>> outputs = model.generate(**inputs, assistant_model=assistant_model)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Alice and Bob are sitting in a bar. Alice is drinking a beer and Bob is drinking a']
+```
+
+์ํ๋ง ๋ฐฉ๋ฒ๊ณผ ํจ๊ป ๋ณด์กฐ ๋์ฝ๋ฉ์ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๋คํญ ์ํ๋ง๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก `temperature` ์ธ์๋ฅผ ์ฌ์ฉํ์ฌ ๋ฌด์์์ฑ์ ์ ์ดํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ณด์กฐ ๋์ฝ๋ฉ์์๋ `temperature`๋ฅผ ๋ฎ์ถ๋ฉด ๋๊ธฐ ์๊ฐ์ ๊ฐ์ ํ๋ ๋ฐ ๋์์ด ๋ ์ ์์ต๋๋ค.
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer, set_seed
+>>> set_seed(42) # ์ฌํ์ฑ์ ์ํด
+
+>>> prompt = "Alice and Bob"
+>>> checkpoint = "EleutherAI/pythia-1.4b-deduped"
+>>> assistant_checkpoint = "EleutherAI/pythia-160m-deduped"
+
+>>> tokenizer = AutoTokenizer.from_pretrained(checkpoint)
+>>> inputs = tokenizer(prompt, return_tensors="pt")
+
+>>> model = AutoModelForCausalLM.from_pretrained(checkpoint)
+>>> assistant_model = AutoModelForCausalLM.from_pretrained(assistant_checkpoint)
+>>> outputs = model.generate(**inputs, assistant_model=assistant_model, do_sample=True, temperature=0.5)
+>>> tokenizer.batch_decode(outputs, skip_special_tokens=True)
+['Alice and Bob, who were both in their early twenties, were both in the process of']
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/gguf.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/gguf.md
new file mode 100644
index 0000000000000000000000000000000000000000..03bd7c08bb2691c5214999cbe00d9e3cdacadfe2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/gguf.md
@@ -0,0 +1,100 @@
+
+
+# GGUF์ Transformers์ ์ํธ์์ฉ [[gguf-and-interaction-with-transformers]]
+
+GGUF ํ์ผ ํ์์ [GGML](https://github.com/ggerganov/ggml)๊ณผ ๊ทธ์ ์์กดํ๋ ๋ค๋ฅธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ, ์๋ฅผ ๋ค์ด ๋งค์ฐ ์ธ๊ธฐ ์๋ [llama.cpp](https://github.com/ggerganov/llama.cpp)์ด๋ [whisper.cpp](https://github.com/ggerganov/whisper.cpp)์์ ์ถ๋ก ์ ์ํ ๋ชจ๋ธ์ ์ ์ฅํ๋๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
+
+์ด ํ์ผ ํ์์ [Hugging Face Hub](https://huggingface.co/docs/hub/en/gguf)์์ ์ง์๋๋ฉฐ, ํ์ผ ๋ด์ ํ
์์ ๋ฉํ๋ฐ์ดํฐ๋ฅผ ์ ์ํ๊ฒ ๊ฒ์ฌํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
+
+์ด ํ์์ "๋จ์ผ ํ์ผ ํ์(single-file-format)"์ผ๋ก ์ค๊ณ๋์์ผ๋ฉฐ, ํ๋์ ํ์ผ์ ์ค์ ์์ฑ, ํ ํฌ๋์ด์ ์ดํ, ๊ธฐํ ์์ฑ๋ฟ๋ง ์๋๋ผ ๋ชจ๋ธ์์ ๋ก๋๋๋ ๋ชจ๋ ํ
์๊ฐ ํฌํจ๋ฉ๋๋ค. ์ด ํ์ผ๋ค์ ํ์ผ์ ์์ํ ์ ํ์ ๋ฐ๋ผ ๋ค๋ฅธ ํ์์ผ๋ก ์ ๊ณต๋ฉ๋๋ค. ๋ค์ํ ์์ํ ์ ํ์ ๋ํ ๊ฐ๋ตํ ์ค๋ช
์ [์ฌ๊ธฐ](https://huggingface.co/docs/hub/en/gguf#quantization-types)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## Transformers ๋ด ์ง์ [[support-within-transformers]]
+
+`transformers` ๋ด์์ `gguf` ํ์ผ์ ๋ก๋ํ ์ ์๋ ๊ธฐ๋ฅ์ ์ถ๊ฐํ์ฌ GGUF ๋ชจ๋ธ์ ์ถ๊ฐ ํ์ต/๋ฏธ์ธ ์กฐ์ ์ ์ ๊ณตํ ํ `ggml` ์ํ๊ณ์์ ๋ค์ ์ฌ์ฉํ ์ ์๋๋ก `gguf` ํ์ผ๋ก ๋ณํํ๋ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค. ๋ชจ๋ธ์ ๋ก๋ํ ๋ ๋จผ์ FP32๋ก ์ญ์์ํํ ํ, PyTorch์์ ์ฌ์ฉํ ์ ์๋๋ก ๊ฐ์ค์น๋ฅผ ๋ก๋ํฉ๋๋ค.
+
+> [!NOTE]
+> ์ง์์ ์์ง ์ด๊ธฐ ๋จ๊ณ์ ์์ผ๋ฉฐ, ๋ค์ํ ์์ํ ์ ํ๊ณผ ๋ชจ๋ธ ์ํคํ
์ฒ์ ๋ํด ์ด๋ฅผ ๊ฐํํ๊ธฐ ์ํ ๊ธฐ์ฌ๋ฅผ ํ์ํฉ๋๋ค.
+
+ํ์ฌ ์ง์๋๋ ๋ชจ๋ธ ์ํคํ
์ฒ์ ์์ํ ์ ํ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+### ์ง์๋๋ ์์ํ ์ ํ [[supported-quantization-types]]
+
+์ด๊ธฐ์ ์ง์๋๋ ์์ํ ์ ํ์ Hub์์ ๊ณต์ ๋ ์ธ๊ธฐ ์๋ ์์ํ ํ์ผ์ ๋ฐ๋ผ ๊ฒฐ์ ๋์์ต๋๋ค.
+
+- F32
+- F16
+- BF16
+- Q4_0
+- Q4_1
+- Q5_0
+- Q5_1
+- Q8_0
+- Q2_K
+- Q3_K
+- Q4_K
+- Q5_K
+- Q6_K
+- IQ1_S
+- IQ1_M
+- IQ2_XXS
+- IQ2_XS
+- IQ2_S
+- IQ3_XXS
+- IQ3_S
+- IQ4_XS
+- IQ4_NL
+
+> [!NOTE]
+> GGUF ์ญ์์ํ๋ฅผ ์ง์ํ๋ ค๋ฉด `gguf>=0.10.0` ์ค์น๊ฐ ํ์ํฉ๋๋ค.
+
+### ์ง์๋๋ ๋ชจ๋ธ ์ํคํ
์ฒ [[supported-model-architectures]]
+
+ํ์ฌ ์ง์๋๋ ๋ชจ๋ธ ์ํคํ
์ฒ๋ Hub์์ ๋งค์ฐ ์ธ๊ธฐ๊ฐ ๋ง์ ์ํคํ
์ฒ๋ค๋ก ์ ํ๋์ด ์์ต๋๋ค:
+
+- LLaMa
+- Mistral
+- Qwen2
+- Qwen2Moe
+- Phi3
+- Bloom
+
+## ์ฌ์ฉ ์์ [[example-usage]]
+
+`transformers`์์ `gguf` ํ์ผ์ ๋ก๋ํ๋ ค๋ฉด `from_pretrained` ๋ฉ์๋์ `gguf_file` ์ธ์๋ฅผ ์ง์ ํด์ผ ํฉ๋๋ค. ๋์ผํ ํ์ผ์์ ํ ํฌ๋์ด์ ์ ๋ชจ๋ธ์ ๋ก๋ํ๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```python
+from transformers import AutoTokenizer, AutoModelForCausalLM
+
+model_id = "TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF"
+filename = "tinyllama-1.1b-chat-v1.0.Q6_K.gguf"
+
+tokenizer = AutoTokenizer.from_pretrained(model_id, gguf_file=filename)
+model = AutoModelForCausalLM.from_pretrained(model_id, gguf_file=filename)
+```
+
+์ด์ PyTorch ์ํ๊ณ์์ ๋ชจ๋ธ์ ์์ํ๋์ง ์์ ์ ์ฒด ๋ฒ์ ์ ์ ๊ทผํ ์ ์์ผ๋ฉฐ, ๋ค๋ฅธ ์ฌ๋ฌ ๋๊ตฌ๋ค๊ณผ ๊ฒฐํฉํ์ฌ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+`gguf` ํ์ผ๋ก ๋ค์ ๋ณํํ๋ ค๋ฉด llama.cpp์ [`convert-hf-to-gguf.py`](https://github.com/ggerganov/llama.cpp/blob/master/convert-hf-to-gguf.py)๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
+
+์์ ์คํฌ๋ฆฝํธ๋ฅผ ์๋ฃํ์ฌ ๋ชจ๋ธ์ ์ ์ฅํ๊ณ ๋ค์ `gguf`๋ก ๋ด๋ณด๋ด๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```python
+tokenizer.save_pretrained('directory')
+model.save_pretrained('directory')
+
+!python ${path_to_llama_cpp}/convert-hf-to-gguf.py ${directory}
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/hpo_train.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/hpo_train.md
new file mode 100644
index 0000000000000000000000000000000000000000..c0982db5e093b55b750b655ea6e694c0f62826a8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/hpo_train.md
@@ -0,0 +1,124 @@
+
+
+# Trainer API๋ฅผ ์ฌ์ฉํ ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ [[hyperparameter-search-using-trainer-api]]
+
+๐ค Transformers์์๋ ๐ค Transformers ๋ชจ๋ธ์ ํ์ต์ํค๋๋ฐ ์ต์ ํ๋ [`Trainer`] ํด๋์ค๋ฅผ ์ ๊ณตํ๊ธฐ ๋๋ฌธ์, ์ฌ์ฉ์๋ ์ง์ ํ๋ จ ๋ฃจํ๋ฅผ ์์ฑํ ํ์ ์์ด ๋์ฑ ๊ฐํธํ๊ฒ ํ์ต์ ์ํฌ ์ ์์ต๋๋ค. ๋ํ, [`Trainer`]๋ ํ์ดํผํ๋ผ๋ฏธํฐ ํ์์ ์ํ API๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ด ๋ฌธ์์์ ์ด API๋ฅผ ํ์ฉํ๋ ๋ฐฉ๋ฒ์ ์์์ ํจ๊ป ๋ณด์ฌ๋๋ฆฌ๊ฒ ์ต๋๋ค.
+
+## ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ ๋ฐฑ์๋ [[hyperparameter-search-backend]]
+
+[`Trainer`]๋ ํ์ฌ ์๋ 4๊ฐ์ง ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ ๋ฐฑ์๋๋ฅผ ์ง์ํฉ๋๋ค:
+[optuna](https://optuna.org/)์ [sigopt](https://sigopt.com/), [raytune](https://docs.ray.io/en/latest/tune/index.html), [wandb](https://wandb.ai/site/sweeps) ์
๋๋ค.
+
+ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ ๋ฐฑ์๋๋ก ์ฌ์ฉํ๊ธฐ ์ ์ ์๋์ ๋ช
๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ ์ค์นํ์ธ์.
+```bash
+pip install optuna/sigopt/wandb/ray[tune]
+```
+
+## ์์ ์์ ํ์ดํผํ๋ผ๋ฏธํฐ ํ์์ ํ์ฑํํ๋ ๋ฐฉ๋ฒ [[how-to-enable-hyperparameter-search-in-example]]
+
+ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ ๊ณต๊ฐ์ ์ ์ํ์ธ์. ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ ๋ฐฑ์๋๋ง๋ค ์๋ก ๋ค๋ฅธ ํ์์ด ํ์ํฉ๋๋ค.
+
+sigopt์ ๊ฒฝ์ฐ, ํด๋น [object_parameter](https://docs.sigopt.com/ai-module-api-references/api_reference/objects/object_parameter) ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ฌ ์๋์ ๊ฐ์ด ์์ฑํ์ธ์:
+```py
+>>> def sigopt_hp_space(trial):
+... return [
+... {"bounds": {"min": 1e-6, "max": 1e-4}, "name": "learning_rate", "type": "double"},
+... {
+... "categorical_values": ["16", "32", "64", "128"],
+... "name": "per_device_train_batch_size",
+... "type": "categorical",
+... },
+... ]
+```
+
+optuna์ ๊ฒฝ์ฐ, ํด๋น [object_parameter](https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/002_configurations.html#sphx-glr-tutorial-10-key-features-002-configurations-py) ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ฌ ์๋์ ๊ฐ์ด ์์ฑํ์ธ์:
+
+```py
+>>> def optuna_hp_space(trial):
+... return {
+... "learning_rate": trial.suggest_float("learning_rate", 1e-6, 1e-4, log=True),
+... "per_device_train_batch_size": trial.suggest_categorical("per_device_train_batch_size", [16, 32, 64, 128]),
+... }
+```
+
+raytune์ ๊ฒฝ์ฐ, ํด๋น [object_parameter](https://docs.ray.io/en/latest/tune/api/search_space.html) ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ฌ ์๋์ ๊ฐ์ด ์์ฑํ์ธ์:
+
+```py
+>>> def ray_hp_space(trial):
+... return {
+... "learning_rate": tune.loguniform(1e-6, 1e-4),
+... "per_device_train_batch_size": tune.choice([16, 32, 64, 128]),
+... }
+```
+
+wandb์ ๊ฒฝ์ฐ, ํด๋น [object_parameter](https://docs.wandb.ai/guides/sweeps/configuration) ๋ฌธ์๋ฅผ ์ฐธ์กฐํ์ฌ ์๋์ ๊ฐ์ด ์์ฑํ์ธ์:
+
+```py
+>>> def wandb_hp_space(trial):
+... return {
+... "method": "random",
+... "metric": {"name": "objective", "goal": "minimize"},
+... "parameters": {
+... "learning_rate": {"distribution": "uniform", "min": 1e-6, "max": 1e-4},
+... "per_device_train_batch_size": {"values": [16, 32, 64, 128]},
+... },
+... }
+```
+
+`model_init` ํจ์๋ฅผ ์ ์ํ๊ณ ์ด๋ฅผ [`Trainer`]์ ์ ๋ฌํ์ธ์. ์๋๋ ๊ทธ ์์์
๋๋ค.
+```py
+>>> def model_init(trial):
+... return AutoModelForSequenceClassification.from_pretrained(
+... model_args.model_name_or_path,
+... from_tf=bool(".ckpt" in model_args.model_name_or_path),
+... config=config,
+... cache_dir=model_args.cache_dir,
+... revision=model_args.model_revision,
+... token=True if model_args.use_auth_token else None,
+... )
+```
+
+์๋์ ๊ฐ์ด `model_init` ํจ์, ํ๋ จ ์ธ์, ํ๋ จ ๋ฐ ํ
์คํธ ๋ฐ์ดํฐ์
, ๊ทธ๋ฆฌ๊ณ ํ๊ฐ ํจ์๋ฅผ ์ฌ์ฉํ์ฌ [`Trainer`]๋ฅผ ์์ฑํ์ธ์:
+
+```py
+>>> trainer = Trainer(
+... model=None,
+... args=training_args,
+... train_dataset=small_train_dataset,
+... eval_dataset=small_eval_dataset,
+... compute_metrics=compute_metrics,
+... processing_class=tokenizer,
+... model_init=model_init,
+... data_collator=data_collator,
+... )
+```
+
+ํ์ดํผํ๋ผ๋ฏธํฐ ํ์์ ํธ์ถํ๊ณ , ์ต์ ์ ์ํ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ ธ์ค์ธ์. ๋ฐฑ์๋๋ `"optuna"`/`"sigopt"`/`"wandb"`/`"ray"` ์ค์์ ์ ํํ ์ ์์ต๋๋ค. ๋ฐฉํฅ์ `"minimize"` ๋๋ `"maximize"` ์ค ์ ํํ๋ฉฐ, ๋ชฉํ๋ฅผ ์ต์ํํ ๊ฒ์ธ์ง ์ต๋ํํ ๊ฒ์ธ์ง๋ฅผ ๊ฒฐ์ ํฉ๋๋ค.
+
+์์ ๋ง์ compute_objective ํจ์๋ฅผ ์ ์ํ ์ ์์ต๋๋ค. ๋ง์ฝ ์ด ํจ์๋ฅผ ์ ์ํ์ง ์์ผ๋ฉด, ๊ธฐ๋ณธ compute_objective๊ฐ ํธ์ถ๋๊ณ , f1๊ณผ ๊ฐ์ ํ๊ฐ ์งํ์ ํฉ์ด ๋ชฉํฏ๊ฐ์ผ๋ก ๋ฐํ๋ฉ๋๋ค.
+
+```py
+>>> best_trial = trainer.hyperparameter_search(
+... direction="maximize",
+... backend="optuna",
+... hp_space=optuna_hp_space,
+... n_trials=20,
+... compute_objective=compute_objective,
+... )
+```
+
+## DDP ๋ฏธ์ธ ์กฐ์ ์ ์ํ ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ [[hyperparameter-search-for-ddp-finetune]]
+ํ์ฌ, DDP(Distributed Data Parallelism; ๋ถ์ฐ ๋ฐ์ดํฐ ๋ณ๋ ฌ์ฒ๋ฆฌ)๋ฅผ ์ํ ํ์ดํผํ๋ผ๋ฏธํฐ ํ์์ optuna์ sigopt์์ ๊ฐ๋ฅํฉ๋๋ค. ์ต์์ ํ๋ก์ธ์ค๊ฐ ํ์ดํผํ๋ผ๋ฏธํฐ ํ์ ๊ณผ์ ์ ์์ํ๊ณ ๊ทธ ๊ฒฐ๊ณผ๋ฅผ ๋ค๋ฅธ ํ๋ก์ธ์ค์ ์ ๋ฌํฉ๋๋ค.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/in_translation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/in_translation.md
new file mode 100644
index 0000000000000000000000000000000000000000..61ff1426a4522a90b54a33e3b0c91d8a9a1f4d7c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/in_translation.md
@@ -0,0 +1,5 @@
+
+
+# ์ด์ฌํ ๋ฒ์ญ ์ค์
๋๋ค. ์กฐ๊ธ ์ด๋ฐ ๋ง๋์!
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/index.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/index.md
new file mode 100644
index 0000000000000000000000000000000000000000..0726085c5b3ae781f77881a9cbb176db5841bfdc
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/index.md
@@ -0,0 +1,362 @@
+
+
+# ๐ค Transformers
+
+[PyTorch](https://pytorch.org/), [TensorFlow](https://www.tensorflow.org/), [JAX](https://jax.readthedocs.io/en/latest/)๋ฅผ ์ํ ์ต์ฒจ๋จ ๋จธ์ ๋ฌ๋
+
+๐ค Transformers๋ ์ฌ์ ํ์ต๋ ์ต์ฒจ๋จ ๋ชจ๋ธ๋ค์ ์ฝ๊ฒ ๋ค์ด๋ก๋ํ๊ณ ํ๋ จ์ํฌ ์ ์๋ API์ ๋๊ตฌ๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ์ฐ๋ฉด ์ปดํจํ
๋น์ฉ๊ณผ ํ์ ๋ฐฐ์ถ๋์ด ์ค๊ณ , ๋ชจ๋ธ์ ์ฒ์๋ถํฐ ํ๋ จ์ํค๋ ๋ฐ ํ์ํ ์๊ฐ๊ณผ ๋ฆฌ์์ค๋ฅผ ์ ์ฝํ ์ ์์ต๋๋ค. ์ ํฌ ๋ชจ๋ธ๋ค์ ๋ค์ํ ๋ถ์ผ์ ํ์คํฌ๋ฅผ ์ง์ํฉ๋๋ค.
+
+๐ **์์ฐ์ด ์ฒ๋ฆฌ**: ํ
์คํธ ๋ถ๋ฅ, ๊ฐ์ฒด๋ช
์ธ์, ์ง์์๋ต, ์ธ์ด ๋ชจ๋ธ๋ง, ์์ฝ, ๋ฒ์ญ, ๊ฐ๊ด์ ์ง์์๋ต, ํ
์คํธ ์์ฑ
+๐ผ๏ธ **์ปดํจํฐ ๋น์ **: ์ด๋ฏธ์ง ๋ถ๋ฅ, ๊ฐ์ฒด ํ์ง, ๊ฐ์ฒด ๋ถํ
+๐ฃ๏ธ **์ค๋์ค**: ์๋์์ฑ์ธ์, ์ค๋์ค ๋ถ๋ฅ
+๐ **๋ฉํฐ๋ชจ๋ฌ**: ํ ์ง์์๋ต, ๊ดํ ๋ฌธ์ ์ธ์ (OCR), ์ค์บํ ๋ฌธ์์์ ์ ๋ณด ์ถ์ถ, ๋น๋์ค ๋ถ๋ฅ, ์๊ฐ ์ง์์๋ต
+
+๐ค Transformers๋ PyTorch, TensorFlow์ JAX ๊ฐ์ ์ํธ์ด์ฉ์ฑ์ ์ง์ํฉ๋๋ค. ์ ์ฐํ๊ฒ ๋ชจ๋ธ์ ๊ฐ ๋จ๊ณ๋ง๋ค ๋ค๋ฅธ ํ๋ ์์ํฌ๋ฅผ ์ฌ์ฉํ ์๋ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ์ฝ๋ 3์ค๋ง ์จ์ ๋ชจ๋ธ์ ํ๋ จ์ํจ ๋ค์, ๋ค๋ฅธ ํ๋ ์์ํฌ ์์์ ์ถ๋ก ํ ์ ์์ต๋๋ค. ๋ชจ๋ธ์ ์ด์ ํ๊ฒฝ์ ๋ฐฐํฌํ๊ธฐ ์ํด ONNX๋ TorchScript ํ์์ผ๋ก ๋ด๋ณด๋ผ ์๋ ์์ต๋๋ค.
+
+์ปค๋ฎค๋ํฐ์ ์ฐธ์ฌํ์๋ ค๋ฉด [Hub](https://huggingface.co/models), [ํฌ๋ผ](https://discuss.huggingface.co/), [๋์ค์ฝ๋](https://discord.com/invite/JfAtkvEtRb)๋ฅผ ๋ฐฉ๋ฌธํด์ฃผ์ธ์!
+
+## Hugging Face ํ๊ณผ ์ง์ ๋ํํ๊ณ ์ถ์ผ์ ๊ฐ์?[[hugging-face-team]]
+
+
+
+
+
+## ์ฝํ
์ธ [[contents]]
+
+์ ํฌ ๊ธฐ์ ๋ฌธ์๋ ํฌ๊ฒ 5๊ฐ ์น์
์ผ๋ก ๋๋ ์ ์์ต๋๋ค:
+
+- **์์ํ๊ธฐ**์์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ฐ๋จํ ํ์ด๋ณด๊ณ , ๋ณธ๊ฒฉ์ ์ผ๋ก ๋ฐ์ด๋ค ์ ์๊ฒ ์ค์น ๋ฐฉ๋ฒ์ ์๋ดํฉ๋๋ค.
+- **ํํ ๋ฆฌ์ผ**์์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ต์ํด์ง ์ ์๋๋ก ์์ธํ๊ณ ๋ ์ฝ๊ฒ ๊ธฐ๋ณธ์ ์ธ ๋ถ๋ถ์ ์๋ดํฉ๋๋ค.
+- **How-to ๊ฐ์ด๋**์์ ์ธ์ด ๋ชจ๋ธ๋ง์ ์ํด ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ํ์ธ ํ๋ํ๋ ๋ฐฉ๋ฒ์ด๋, ์ง์ ๋ชจ๋ธ์ ์์ฑํ๊ณ ๊ณต์ ํ๋ ๋ฐฉ๋ฒ๊ณผ ๊ฐ์ด ํน์ ๋ชฉํ๋ฅผ ๋ฌ์ฑํ๋ ๋ฐฉ๋ฒ์ ์๋ดํฉ๋๋ค.
+- **๊ฐ๋
๊ฐ์ด๋**์์ ๐ค Transformers์ ์ค๊ณ ์ฒ ํ๊ณผ ํจ๊ป ๋ชจ๋ธ์ด๋ ํ์คํฌ ๋ค์ ์จ๊ฒจ์ง ๊ฐ๋
๋ค๊ณผ ์์ด๋์ด๋ฅผ ํ๊ตฌํ๊ณ ์ค๋ช
์ ๋ง๋ถ์
๋๋ค.
+- **API**์์ ๋ชจ๋ ํด๋์ค์ ํจ์๋ฅผ ์ค๋ช
ํฉ๋๋ค.
+
+ - **๋ฉ์ธ ํด๋์ค**์์ configuration, model, tokenizer, pipeline๊ณผ ๊ฐ์ด ์ ์ผ ์ค์ํ ํด๋์ค๋ค์ ์์ธํ ์ค๋ช
ํฉ๋๋ค.
+ - **๋ชจ๋ธ**์์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ๊ตฌํ๋ ๊ฐ ๋ชจ๋ธ๊ณผ ์ฐ๊ด๋ ํด๋์ค์ ํจ์๋ฅผ ์์ธํ ์ค๋ช
ํฉ๋๋ค.
+ - **๋ด๋ถ ์ ํธ๋ฆฌํฐ**์์ ๋ด๋ถ์ ์ผ๋ก ์ฌ์ฉ๋๋ ์ ํธ๋ฆฌํฐ ํด๋์ค์ ํจ์๋ฅผ ์์ธํ ์ค๋ช
ํฉ๋๋ค.
+
+### ์ง์ ๋ชจ๋ธ[[supported-models]]
+
+
+
+1. **[ALBERT](model_doc/albert)** (from Google Research and the Toyota Technological Institute at Chicago) released with the paper [ALBERT: A Lite BERT for Self-supervised Learning of Language Representations](https://arxiv.org/abs/1909.11942), by Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, Radu Soricut.
+1. **[BART](model_doc/bart)** (from Facebook) released with the paper [BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension](https://arxiv.org/abs/1910.13461) by Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov and Luke Zettlemoyer.
+1. **[BARThez](model_doc/barthez)** (from รcole polytechnique) released with the paper [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321) by Moussa Kamal Eddine, Antoine J.-P. Tixier, Michalis Vazirgiannis.
+1. **[BARTpho](model_doc/bartpho)** (from VinAI Research) released with the paper [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese](https://arxiv.org/abs/2109.09701) by Nguyen Luong Tran, Duong Minh Le and Dat Quoc Nguyen.
+1. **[BEiT](model_doc/beit)** (from Microsoft) released with the paper [BEiT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254) by Hangbo Bao, Li Dong, Furu Wei.
+1. **[BERT](model_doc/bert)** (from Google) released with the paper [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805) by Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova.
+1. **[BERT For Sequence Generation](model_doc/bert-generation)** (from Google) released with the paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) by Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[BERTweet](model_doc/bertweet)** (from VinAI Research) released with the paper [BERTweet: A pre-trained language model for English Tweets](https://aclanthology.org/2020.emnlp-demos.2/) by Dat Quoc Nguyen, Thanh Vu and Anh Tuan Nguyen.
+1. **[BigBird-Pegasus](model_doc/bigbird_pegasus)** (from Google Research) released with the paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) by Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[BigBird-RoBERTa](model_doc/big_bird)** (from Google Research) released with the paper [Big Bird: Transformers for Longer Sequences](https://arxiv.org/abs/2007.14062) by Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, Amr Ahmed.
+1. **[Blenderbot](model_doc/blenderbot)** (from Facebook) released with the paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) by Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BlenderbotSmall](model_doc/blenderbot-small)** (from Facebook) released with the paper [Recipes for building an open-domain chatbot](https://arxiv.org/abs/2004.13637) by Stephen Roller, Emily Dinan, Naman Goyal, Da Ju, Mary Williamson, Yinhan Liu, Jing Xu, Myle Ott, Kurt Shuster, Eric M. Smith, Y-Lan Boureau, Jason Weston.
+1. **[BLOOM](model_doc/bloom)** (from BigScience workshop) released by the [BigScience Workshop](https://bigscience.huggingface.co/).
+1. **[BORT](model_doc/bort)** (from Alexa) released with the paper [Optimal Subarchitecture Extraction For BERT](https://arxiv.org/abs/2010.10499) by Adrian de Wynter and Daniel J. Perry.
+1. **[ByT5](model_doc/byt5)** (from Google Research) released with the paper [ByT5: Towards a token-free future with pre-trained byte-to-byte models](https://arxiv.org/abs/2105.13626) by Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, Colin Raffel.
+1. **[CamemBERT](model_doc/camembert)** (from Inria/Facebook/Sorbonne) released with the paper [CamemBERT: a Tasty French Language Model](https://arxiv.org/abs/1911.03894) by Louis Martin*, Benjamin Muller*, Pedro Javier Ortiz Suรกrez*, Yoann Dupont, Laurent Romary, รric Villemonte de la Clergerie, Djamรฉ Seddah and Benoรฎt Sagot.
+1. **[CANINE](model_doc/canine)** (from Google Research) released with the paper [CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representation](https://arxiv.org/abs/2103.06874) by Jonathan H. Clark, Dan Garrette, Iulia Turc, John Wieting.
+1. **[CLIP](model_doc/clip)** (from OpenAI) released with the paper [Learning Transferable Visual Models From Natural Language Supervision](https://arxiv.org/abs/2103.00020) by Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever.
+1. **[CLIPSeg](model_doc/clipseg)** (from University of Gรถttingen) released with the paper [Image Segmentation Using Text and Image Prompts](https://arxiv.org/abs/2112.10003) by Timo Lรผddecke and Alexander Ecker.
+1. **[CodeGen](model_doc/codegen)** (from Salesforce) released with the paper [A Conversational Paradigm for Program Synthesis](https://arxiv.org/abs/2203.13474) by Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, Caiming Xiong.
+1. **[Conditional DETR](model_doc/conditional_detr)** (from Microsoft Research Asia) released with the paper [Conditional DETR for Fast Training Convergence](https://arxiv.org/abs/2108.06152) by Depu Meng, Xiaokang Chen, Zejia Fan, Gang Zeng, Houqiang Li, Yuhui Yuan, Lei Sun, Jingdong Wang.
+1. **[ConvBERT](model_doc/convbert)** (from YituTech) released with the paper [ConvBERT: Improving BERT with Span-based Dynamic Convolution](https://arxiv.org/abs/2008.02496) by Zihang Jiang, Weihao Yu, Daquan Zhou, Yunpeng Chen, Jiashi Feng, Shuicheng Yan.
+1. **[ConvNeXT](model_doc/convnext)** (from Facebook AI) released with the paper [A ConvNet for the 2020s](https://arxiv.org/abs/2201.03545) by Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, Saining Xie.
+1. **[ConvNeXTV2](model_doc/convnextv2)** (from Facebook AI) released with the paper [ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders](https://arxiv.org/abs/2301.00808) by Sanghyun Woo, Shoubhik Debnath, Ronghang Hu, Xinlei Chen, Zhuang Liu, In So Kweon, Saining Xie.
+1. **[CPM](model_doc/cpm)** (from Tsinghua University) released with the paper [CPM: A Large-scale Generative Chinese Pre-trained Language Model](https://arxiv.org/abs/2012.00413) by Zhengyan Zhang, Xu Han, Hao Zhou, Pei Ke, Yuxian Gu, Deming Ye, Yujia Qin, Yusheng Su, Haozhe Ji, Jian Guan, Fanchao Qi, Xiaozhi Wang, Yanan Zheng, Guoyang Zeng, Huanqi Cao, Shengqi Chen, Daixuan Li, Zhenbo Sun, Zhiyuan Liu, Minlie Huang, Wentao Han, Jie Tang, Juanzi Li, Xiaoyan Zhu, Maosong Sun.
+1. **[CTRL](model_doc/ctrl)** (from Salesforce) released with the paper [CTRL: A Conditional Transformer Language Model for Controllable Generation](https://arxiv.org/abs/1909.05858) by Nitish Shirish Keskar*, Bryan McCann*, Lav R. Varshney, Caiming Xiong and Richard Socher.
+1. **[CvT](model_doc/cvt)** (from Microsoft) released with the paper [CvT: Introducing Convolutions to Vision Transformers](https://arxiv.org/abs/2103.15808) by Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, Lei Zhang.
+1. **[Data2Vec](model_doc/data2vec)** (from Facebook) released with the paper [Data2Vec: A General Framework for Self-supervised Learning in Speech, Vision and Language](https://arxiv.org/abs/2202.03555) by Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, Michael Auli.
+1. **[DeBERTa](model_doc/deberta)** (from Microsoft) released with the paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) by Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[DeBERTa-v2](model_doc/deberta-v2)** (from Microsoft) released with the paper [DeBERTa: Decoding-enhanced BERT with Disentangled Attention](https://arxiv.org/abs/2006.03654) by Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen.
+1. **[Decision Transformer](model_doc/decision_transformer)** (from Berkeley/Facebook/Google) released with the paper [Decision Transformer: Reinforcement Learning via Sequence Modeling](https://arxiv.org/abs/2106.01345) by Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Michael Laskin, Pieter Abbeel, Aravind Srinivas, Igor Mordatch.
+1. **[Deformable DETR](model_doc/deformable_detr)** (from SenseTime Research) released with the paper [Deformable DETR: Deformable Transformers for End-to-End Object Detection](https://arxiv.org/abs/2010.04159) by Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, Jifeng Dai.
+1. **[DeiT](model_doc/deit)** (from Facebook) released with the paper [Training data-efficient image transformers & distillation through attention](https://arxiv.org/abs/2012.12877) by Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, Hervรฉ Jรฉgou.
+1. **[DETR](model_doc/detr)** (from Facebook) released with the paper [End-to-End Object Detection with Transformers](https://arxiv.org/abs/2005.12872) by Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, Sergey Zagoruyko.
+1. **[DialoGPT](model_doc/dialogpt)** (from Microsoft Research) released with the paper [DialoGPT: Large-Scale Generative Pre-training for Conversational Response Generation](https://arxiv.org/abs/1911.00536) by Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, Bill Dolan.
+1. **[DistilBERT](model_doc/distilbert)** (from HuggingFace), released together with the paper [DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter](https://arxiv.org/abs/1910.01108) by Victor Sanh, Lysandre Debut and Thomas Wolf. The same method has been applied to compress GPT2 into [DistilGPT2](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), RoBERTa into [DistilRoBERTa](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation), Multilingual BERT into [DistilmBERT](https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation) and a German version of DistilBERT.
+1. **[DiT](model_doc/dit)** (from Microsoft Research) released with the paper [DiT: Self-supervised Pre-training for Document Image Transformer](https://arxiv.org/abs/2203.02378) by Junlong Li, Yiheng Xu, Tengchao Lv, Lei Cui, Cha Zhang, Furu Wei.
+1. **[Donut](model_doc/donut)** (from NAVER), released together with the paper [OCR-free Document Understanding Transformer](https://arxiv.org/abs/2111.15664) by Geewook Kim, Teakgyu Hong, Moonbin Yim, Jeongyeon Nam, Jinyoung Park, Jinyeong Yim, Wonseok Hwang, Sangdoo Yun, Dongyoon Han, Seunghyun Park.
+1. **[DPR](model_doc/dpr)** (from Facebook) released with the paper [Dense Passage Retrieval for Open-Domain Question Answering](https://arxiv.org/abs/2004.04906) by Vladimir Karpukhin, Barlas Oฤuz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih.
+1. **[DPT](master/model_doc/dpt)** (from Intel Labs) released with the paper [Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413) by Renรฉ Ranftl, Alexey Bochkovskiy, Vladlen Koltun.
+1. **[EfficientNet](model_doc/efficientnet)** (from Google Research) released with the paper [EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks](https://arxiv.org/abs/1905.11946) by Mingxing Tan and Quoc V. Le.
+1. **[ELECTRA](model_doc/electra)** (from Google Research/Stanford University) released with the paper [ELECTRA: Pre-training text encoders as discriminators rather than generators](https://arxiv.org/abs/2003.10555) by Kevin Clark, Minh-Thang Luong, Quoc V. Le, Christopher D. Manning.
+1. **[EncoderDecoder](model_doc/encoder-decoder)** (from Google Research) released with the paper [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461) by Sascha Rothe, Shashi Narayan, Aliaksei Severyn.
+1. **[ERNIE](model_doc/ernie)** (from Baidu) released with the paper [ERNIE: Enhanced Representation through Knowledge Integration](https://arxiv.org/abs/1904.09223) by Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Xuyi Chen, Han Zhang, Xin Tian, Danxiang Zhu, Hao Tian, Hua Wu.
+1. **[ESM](model_doc/esm)** (from Meta AI) are transformer protein language models. **ESM-1b** was released with the paper [Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences](https://www.pnas.org/content/118/15/e2016239118) by Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott, C. Lawrence Zitnick, Jerry Ma, and Rob Fergus. **ESM-1v** was released with the paper [Language models enable zero-shot prediction of the effects of mutations on protein function](https://doi.org/10.1101/2021.07.09.450648) by Joshua Meier, Roshan Rao, Robert Verkuil, Jason Liu, Tom Sercu and Alexander Rives. **ESM-2 and ESMFold** were released with the paper [Language models of protein sequences at the scale of evolution enable accurate structure prediction](https://doi.org/10.1101/2022.07.20.500902) by Zeming Lin, Halil Akin, Roshan Rao, Brian Hie, Zhongkai Zhu, Wenting Lu, Allan dos Santos Costa, Maryam Fazel-Zarandi, Tom Sercu, Sal Candido, Alexander Rives.
+1. **[FLAN-T5](model_doc/flan-t5)** (from Google AI) released in the repository [google-research/t5x](https://github.com/google-research/t5x/blob/main/docs/models.md#flan-t5-checkpoints) by Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Zhao, Yanping Huang, Andrew Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei
+1. **[FlauBERT](model_doc/flaubert)** (from CNRS) released with the paper [FlauBERT: Unsupervised Language Model Pre-training for French](https://arxiv.org/abs/1912.05372) by Hang Le, Loรฏc Vial, Jibril Frej, Vincent Segonne, Maximin Coavoux, Benjamin Lecouteux, Alexandre Allauzen, Benoรฎt Crabbรฉ, Laurent Besacier, Didier Schwab.
+1. **[FLAVA](model_doc/flava)** (from Facebook AI) released with the paper [FLAVA: A Foundational Language And Vision Alignment Model](https://arxiv.org/abs/2112.04482) by Amanpreet Singh, Ronghang Hu, Vedanuj Goswami, Guillaume Couairon, Wojciech Galuba, Marcus Rohrbach, and Douwe Kiela.
+1. **[FNet](model_doc/fnet)** (from Google Research) released with the paper [FNet: Mixing Tokens with Fourier Transforms](https://arxiv.org/abs/2105.03824) by James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, Santiago Ontanon.
+1. **[Funnel Transformer](model_doc/funnel)** (from CMU/Google Brain) released with the paper [Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing](https://arxiv.org/abs/2006.03236) by Zihang Dai, Guokun Lai, Yiming Yang, Quoc V. Le.
+1. **[GLPN](model_doc/glpn)** (from KAIST) released with the paper [Global-Local Path Networks for Monocular Depth Estimation with Vertical CutDepth](https://arxiv.org/abs/2201.07436) by Doyeon Kim, Woonghyun Ga, Pyungwhan Ahn, Donggyu Joo, Sehwan Chun, Junmo Kim.
+1. **[GPT](model_doc/openai-gpt)** (from OpenAI) released with the paper [Improving Language Understanding by Generative Pre-Training](https://openai.com/research/language-unsupervised/) by Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever.
+1. **[GPT Neo](model_doc/gpt_neo)** (from EleutherAI) released in the repository [EleutherAI/gpt-neo](https://github.com/EleutherAI/gpt-neo) by Sid Black, Stella Biderman, Leo Gao, Phil Wang and Connor Leahy.
+1. **[GPT NeoX](model_doc/gpt_neox)** (from EleutherAI) released with the paper [GPT-NeoX-20B: An Open-Source Autoregressive Language Model](https://arxiv.org/abs/2204.06745) by Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Pieler, USVSN Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, Samuel Weinbach
+1. **[GPT NeoX Japanese](model_doc/gpt_neox_japanese)** (from ABEJA) released by Shinya Otani, Takayoshi Makabe, Anuj Arora, and Kyo Hattori.
+1. **[GPT-2](model_doc/gpt2)** (from OpenAI) released with the paper [Language Models are Unsupervised Multitask Learners](https://openai.com/research/better-language-models/) by Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei and Ilya Sutskever.
+1. **[GPT-J](model_doc/gptj)** (from EleutherAI) released in the repository [kingoflolz/mesh-transformer-jax](https://github.com/kingoflolz/mesh-transformer-jax/) by Ben Wang and Aran Komatsuzaki.
+1. **[GPTSAN-japanese](model_doc/gptsan-japanese)** released in the repository [tanreinama/GPTSAN](https://github.com/tanreinama/GPTSAN/blob/main/report/model.md) by Toshiyuki Sakamoto(tanreinama).
+1. **[GroupViT](model_doc/groupvit)** (from UCSD, NVIDIA) released with the paper [GroupViT: Semantic Segmentation Emerges from Text Supervision](https://arxiv.org/abs/2202.11094) by Jiarui Xu, Shalini De Mello, Sifei Liu, Wonmin Byeon, Thomas Breuel, Jan Kautz, Xiaolong Wang.
+1. **[Hubert](model_doc/hubert)** (from Facebook) released with the paper [HuBERT: Self-Supervised Speech Representation Learning by Masked Prediction of Hidden Units](https://arxiv.org/abs/2106.07447) by Wei-Ning Hsu, Benjamin Bolte, Yao-Hung Hubert Tsai, Kushal Lakhotia, Ruslan Salakhutdinov, Abdelrahman Mohamed.
+1. **[I-BERT](model_doc/ibert)** (from Berkeley) released with the paper [I-BERT: Integer-only BERT Quantization](https://arxiv.org/abs/2101.01321) by Sehoon Kim, Amir Gholami, Zhewei Yao, Michael W. Mahoney, Kurt Keutzer.
+1. **[ImageGPT](model_doc/imagegpt)** (from OpenAI) released with the paper [Generative Pretraining from Pixels](https://openai.com/blog/image-gpt/) by Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, Ilya Sutskever.
+1. **[Jukebox](model_doc/jukebox)** (from OpenAI) released with the paper [Jukebox: A Generative Model for Music](https://arxiv.org/pdf/2005.00341.pdf) by Prafulla Dhariwal, Heewoo Jun, Christine Payne, Jong Wook Kim, Alec Radford, Ilya Sutskever.
+1. **[LayoutLM](model_doc/layoutlm)** (from Microsoft Research Asia) released with the paper [LayoutLM: Pre-training of Text and Layout for Document Image Understanding](https://arxiv.org/abs/1912.13318) by Yiheng Xu, Minghao Li, Lei Cui, Shaohan Huang, Furu Wei, Ming Zhou.
+1. **[LayoutLMv2](model_doc/layoutlmv2)** (from Microsoft Research Asia) released with the paper [LayoutLMv2: Multi-modal Pre-training for Visually-Rich Document Understanding](https://arxiv.org/abs/2012.14740) by Yang Xu, Yiheng Xu, Tengchao Lv, Lei Cui, Furu Wei, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Wanxiang Che, Min Zhang, Lidong Zhou.
+1. **[LayoutLMv3](model_doc/layoutlmv3)** (from Microsoft Research Asia) released with the paper [LayoutLMv3: Pre-training for Document AI with Unified Text and Image Masking](https://arxiv.org/abs/2204.08387) by Yupan Huang, Tengchao Lv, Lei Cui, Yutong Lu, Furu Wei.
+1. **[LayoutXLM](model_doc/layoutxlm)** (from Microsoft Research Asia) released with the paper [LayoutXLM: Multimodal Pre-training for Multilingual Visually-rich Document Understanding](https://arxiv.org/abs/2104.08836) by Yiheng Xu, Tengchao Lv, Lei Cui, Guoxin Wang, Yijuan Lu, Dinei Florencio, Cha Zhang, Furu Wei.
+1. **[LED](model_doc/led)** (from AllenAI) released with the paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) by Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[LeViT](model_doc/levit)** (from Meta AI) released with the paper [LeViT: A Vision Transformer in ConvNet's Clothing for Faster Inference](https://arxiv.org/abs/2104.01136) by Ben Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Hervรฉ Jรฉgou, Matthijs Douze.
+1. **[LiLT](model_doc/lilt)** (from South China University of Technology) released with the paper [LiLT: A Simple yet Effective Language-Independent Layout Transformer for Structured Document Understanding](https://arxiv.org/abs/2202.13669) by Jiapeng Wang, Lianwen Jin, Kai Ding.
+1. **[Longformer](model_doc/longformer)** (from AllenAI) released with the paper [Longformer: The Long-Document Transformer](https://arxiv.org/abs/2004.05150) by Iz Beltagy, Matthew E. Peters, Arman Cohan.
+1. **[LongT5](model_doc/longt5)** (from Google AI) released with the paper [LongT5: Efficient Text-To-Text Transformer for Long Sequences](https://arxiv.org/abs/2112.07916) by Mandy Guo, Joshua Ainslie, David Uthus, Santiago Ontanon, Jianmo Ni, Yun-Hsuan Sung, Yinfei Yang.
+1. **[LUKE](model_doc/luke)** (from Studio Ousia) released with the paper [LUKE: Deep Contextualized Entity Representations with Entity-aware Self-attention](https://arxiv.org/abs/2010.01057) by Ikuya Yamada, Akari Asai, Hiroyuki Shindo, Hideaki Takeda, Yuji Matsumoto.
+1. **[LXMERT](model_doc/lxmert)** (from UNC Chapel Hill) released with the paper [LXMERT: Learning Cross-Modality Encoder Representations from Transformers for Open-Domain Question Answering](https://arxiv.org/abs/1908.07490) by Hao Tan and Mohit Bansal.
+1. **[M-CTC-T](model_doc/mctct)** (from Facebook) released with the paper [Pseudo-Labeling For Massively Multilingual Speech Recognition](https://arxiv.org/abs/2111.00161) by Loren Lugosch, Tatiana Likhomanenko, Gabriel Synnaeve, and Ronan Collobert.
+1. **[M2M100](model_doc/m2m_100)** (from Facebook) released with the paper [Beyond English-Centric Multilingual Machine Translation](https://arxiv.org/abs/2010.11125) by Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky, Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, Armand Joulin.
+1. **[MarianMT](model_doc/marian)** Machine translation models trained using [OPUS](http://opus.nlpl.eu/) data by Jรถrg Tiedemann. The [Marian Framework](https://marian-nmt.github.io/) is being developed by the Microsoft Translator Team.
+1. **[MarkupLM](model_doc/markuplm)** (from Microsoft Research Asia) released with the paper [MarkupLM: Pre-training of Text and Markup Language for Visually-rich Document Understanding](https://arxiv.org/abs/2110.08518) by Junlong Li, Yiheng Xu, Lei Cui, Furu Wei.
+1. **[Mask2Former](model_doc/mask2former)** (from FAIR and UIUC) released with the paper [Masked-attention Mask Transformer for Universal Image Segmentation](https://arxiv.org/abs/2112.01527) by Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, Rohit Girdhar.
+1. **[MaskFormer](model_doc/maskformer)** (from Meta and UIUC) released with the paper [Per-Pixel Classification is Not All You Need for Semantic Segmentation](https://arxiv.org/abs/2107.06278) by Bowen Cheng, Alexander G. Schwing, Alexander Kirillov.
+1. **[mBART](model_doc/mbart)** (from Facebook) released with the paper [Multilingual Denoising Pre-training for Neural Machine Translation](https://arxiv.org/abs/2001.08210) by Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, Luke Zettlemoyer.
+1. **[mBART-50](model_doc/mbart)** (from Facebook) released with the paper [Multilingual Translation with Extensible Multilingual Pretraining and Finetuning](https://arxiv.org/abs/2008.00401) by Yuqing Tang, Chau Tran, Xian Li, Peng-Jen Chen, Naman Goyal, Vishrav Chaudhary, Jiatao Gu, Angela Fan.
+1. **[Megatron-BERT](model_doc/megatron-bert)** (from NVIDIA) released with the paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) by Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper and Bryan Catanzaro.
+1. **[Megatron-GPT2](model_doc/megatron_gpt2)** (from NVIDIA) released with the paper [Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism](https://arxiv.org/abs/1909.08053) by Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper and Bryan Catanzaro.
+1. **[mLUKE](model_doc/mluke)** (from Studio Ousia) released with the paper [mLUKE: The Power of Entity Representations in Multilingual Pretrained Language Models](https://arxiv.org/abs/2110.08151) by Ryokan Ri, Ikuya Yamada, and Yoshimasa Tsuruoka.
+1. **[MobileBERT](model_doc/mobilebert)** (from CMU/Google Brain) released with the paper [MobileBERT: a Compact Task-Agnostic BERT for Resource-Limited Devices](https://arxiv.org/abs/2004.02984) by Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou.
+1. **[MobileViT](model_doc/mobilevit)** (from Apple) released with the paper [MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Transformer](https://arxiv.org/abs/2110.02178) by Sachin Mehta and Mohammad Rastegari.
+1. **[MPNet](model_doc/mpnet)** (from Microsoft Research) released with the paper [MPNet: Masked and Permuted Pre-training for Language Understanding](https://arxiv.org/abs/2004.09297) by Kaitao Song, Xu Tan, Tao Qin, Jianfeng Lu, Tie-Yan Liu.
+1. **[MT5](model_doc/mt5)** (from Google AI) released with the paper [mT5: A massively multilingual pre-trained text-to-text transformer](https://arxiv.org/abs/2010.11934) by Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, Colin Raffel.
+1. **[MVP](model_doc/mvp)** (from RUC AI Box) released with the paper [MVP: Multi-task Supervised Pre-training for Natural Language Generation](https://arxiv.org/abs/2206.12131) by Tianyi Tang, Junyi Li, Wayne Xin Zhao and Ji-Rong Wen.
+1. **[Nezha](model_doc/nezha)** (from Huawei Noahโs Ark Lab) released with the paper [NEZHA: Neural Contextualized Representation for Chinese Language Understanding](https://arxiv.org/abs/1909.00204) by Junqiu Wei, Xiaozhe Ren, Xiaoguang Li, Wenyong Huang, Yi Liao, Yasheng Wang, Jiashu Lin, Xin Jiang, Xiao Chen and Qun Liu.
+1. **[NLLB](model_doc/nllb)** (from Meta) released with the paper [No Language Left Behind: Scaling Human-Centered Machine Translation](https://arxiv.org/abs/2207.04672) by the NLLB team.
+1. **[Nystrรถmformer](model_doc/nystromformer)** (from the University of Wisconsin - Madison) released with the paper [Nystrรถmformer: A Nystrรถm-Based Algorithm for Approximating Self-Attention](https://arxiv.org/abs/2102.03902) by Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, Vikas Singh.
+1. **[OneFormer](model_doc/oneformer)** (from SHI Labs) released with the paper [OneFormer: One Transformer to Rule Universal Image Segmentation](https://arxiv.org/abs/2211.06220) by Jitesh Jain, Jiachen Li, MangTik Chiu, Ali Hassani, Nikita Orlov, Humphrey Shi.
+1. **[OPT](master/model_doc/opt)** (from Meta AI) released with the paper [OPT: Open Pre-trained Transformer Language Models](https://arxiv.org/abs/2205.01068) by Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen et al.
+1. **[OWL-ViT](model_doc/owlvit)** (from Google AI) released with the paper [Simple Open-Vocabulary Object Detection with Vision Transformers](https://arxiv.org/abs/2205.06230) by Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, and Neil Houlsby.
+1. **[Pegasus](model_doc/pegasus)** (from Google) released with the paper [PEGASUS: Pre-training with Extracted Gap-sentences for Abstractive Summarization](https://arxiv.org/abs/1912.08777) by Jingqing Zhang, Yao Zhao, Mohammad Saleh and Peter J. Liu.
+1. **[PEGASUS-X](model_doc/pegasus_x)** (from Google) released with the paper [Investigating Efficiently Extending Transformers for Long Input Summarization](https://arxiv.org/abs/2208.04347) by Jason Phang, Yao Zhao, and Peter J. Liu.
+1. **[Perceiver IO](model_doc/perceiver)** (from Deepmind) released with the paper [Perceiver IO: A General Architecture for Structured Inputs & Outputs](https://arxiv.org/abs/2107.14795) by Andrew Jaegle, Sebastian Borgeaud, Jean-Baptiste Alayrac, Carl Doersch, Catalin Ionescu, David Ding, Skanda Koppula, Daniel Zoran, Andrew Brock, Evan Shelhamer, Olivier Hรฉnaff, Matthew M. Botvinick, Andrew Zisserman, Oriol Vinyals, Joรฃo Carreira.
+1. **[PhoBERT](model_doc/phobert)** (from VinAI Research) released with the paper [PhoBERT: Pre-trained language models for Vietnamese](https://www.aclweb.org/anthology/2020.findings-emnlp.92/) by Dat Quoc Nguyen and Anh Tuan Nguyen.
+1. **[PLBart](model_doc/plbart)** (from UCLA NLP) released with the paper [Unified Pre-training for Program Understanding and Generation](https://arxiv.org/abs/2103.06333) by Wasi Uddin Ahmad, Saikat Chakraborty, Baishakhi Ray, Kai-Wei Chang.
+1. **[PoolFormer](model_doc/poolformer)** (from Sea AI Labs) released with the paper [MetaFormer is Actually What You Need for Vision](https://arxiv.org/abs/2111.11418) by Yu, Weihao and Luo, Mi and Zhou, Pan and Si, Chenyang and Zhou, Yichen and Wang, Xinchao and Feng, Jiashi and Yan, Shuicheng.
+1. **[ProphetNet](model_doc/prophetnet)** (from Microsoft Research) released with the paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) by Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang and Ming Zhou.
+1. **[QDQBert](model_doc/qdqbert)** (from NVIDIA) released with the paper [Integer Quantization for Deep Learning Inference: Principles and Empirical Evaluation](https://arxiv.org/abs/2004.09602) by Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev and Paulius Micikevicius.
+1. **[RAG](model_doc/rag)** (from Facebook) released with the paper [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401) by Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kรผttler, Mike Lewis, Wen-tau Yih, Tim Rocktรคschel, Sebastian Riedel, Douwe Kiela.
+1. **[REALM](model_doc/realm.html)** (from Google Research) released with the paper [REALM: Retrieval-Augmented Language Model Pre-Training](https://arxiv.org/abs/2002.08909) by Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat and Ming-Wei Chang.
+1. **[Reformer](model_doc/reformer)** (from Google Research) released with the paper [Reformer: The Efficient Transformer](https://arxiv.org/abs/2001.04451) by Nikita Kitaev, ลukasz Kaiser, Anselm Levskaya.
+1. **[RegNet](model_doc/regnet)** (from META Platforms) released with the paper [Designing Network Design Space](https://arxiv.org/abs/2003.13678) by Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, Piotr Dollรกr.
+1. **[RemBERT](model_doc/rembert)** (from Google Research) released with the paper [Rethinking embedding coupling in pre-trained language models](https://arxiv.org/abs/2010.12821) by Hyung Won Chung, Thibault Fรฉvry, Henry Tsai, M. Johnson, Sebastian Ruder.
+1. **[ResNet](model_doc/resnet)** (from Microsoft Research) released with the paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) by Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun.
+1. **[RoBERTa](model_doc/roberta)** (from Facebook), released together with the paper [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://arxiv.org/abs/1907.11692) by Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, Veselin Stoyanov.
+1. **[RoCBert](model_doc/roc_bert)** (from WeChatAI) released with the paper [RoCBert: Robust Chinese Bert with Multimodal Contrastive Pretraining](https://aclanthology.org/2022.acl-long.65.pdf) by HuiSu, WeiweiShi, XiaoyuShen, XiaoZhou, TuoJi, JiaruiFang, JieZhou.
+1. **[RoFormer](model_doc/roformer)** (from ZhuiyiTechnology), released together with the paper [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/abs/2104.09864) by Jianlin Su and Yu Lu and Shengfeng Pan and Bo Wen and Yunfeng Liu.
+1. **[SegFormer](model_doc/segformer)** (from NVIDIA) released with the paper [SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers](https://arxiv.org/abs/2105.15203) by Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M. Alvarez, Ping Luo.
+1. **[SEW](model_doc/sew)** (from ASAPP) released with the paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) by Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SEW-D](model_doc/sew_d)** (from ASAPP) released with the paper [Performance-Efficiency Trade-offs in Unsupervised Pre-training for Speech Recognition](https://arxiv.org/abs/2109.06870) by Felix Wu, Kwangyoun Kim, Jing Pan, Kyu Han, Kilian Q. Weinberger, Yoav Artzi.
+1. **[SpeechToTextTransformer](model_doc/speech_to_text)** (from Facebook), released together with the paper [fairseq S2T: Fast Speech-to-Text Modeling with fairseq](https://arxiv.org/abs/2010.05171) by Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Dmytro Okhonko, Juan Pino.
+1. **[SpeechToTextTransformer2](model_doc/speech_to_text_2)** (from Facebook), released together with the paper [Large-Scale Self- and Semi-Supervised Learning for Speech Translation](https://arxiv.org/abs/2104.06678) by Changhan Wang, Anne Wu, Juan Pino, Alexei Baevski, Michael Auli, Alexis Conneau.
+1. **[Splinter](model_doc/splinter)** (from Tel Aviv University), released together with the paper [Few-Shot Question Answering by Pretraining Span Selection](https://arxiv.org/abs/2101.00438) by Ori Ram, Yuval Kirstain, Jonathan Berant, Amir Globerson, Omer Levy.
+1. **[SqueezeBERT](model_doc/squeezebert)** (from Berkeley) released with the paper [SqueezeBERT: What can computer vision teach NLP about efficient neural networks?](https://arxiv.org/abs/2006.11316) by Forrest N. Iandola, Albert E. Shaw, Ravi Krishna, and Kurt W. Keutzer.
+1. **[Swin Transformer](model_doc/swin)** (from Microsoft) released with the paper [Swin Transformer: Hierarchical Vision Transformer using Shifted Windows](https://arxiv.org/abs/2103.14030) by Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, Baining Guo.
+1. **[Swin Transformer V2](model_doc/swinv2)** (from Microsoft) released with the paper [Swin Transformer V2: Scaling Up Capacity and Resolution](https://arxiv.org/abs/2111.09883) by Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, Furu Wei, Baining Guo.
+1. **[T5](model_doc/t5)** (from Google AI) released with the paper [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://arxiv.org/abs/1910.10683) by Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu.
+1. **[T5v1.1](model_doc/t5v1.1)** (from Google AI) released in the repository [google-research/text-to-text-transfer-transformer](https://github.com/google-research/text-to-text-transfer-transformer/blob/main/released_checkpoints.md#t511) by Colin Raffel and Noam Shazeer and Adam Roberts and Katherine Lee and Sharan Narang and Michael Matena and Yanqi Zhou and Wei Li and Peter J. Liu.
+1. **[Table Transformer](model_doc/table-transformer)** (from Microsoft Research) released with the paper [PubTables-1M: Towards Comprehensive Table Extraction From Unstructured Documents](https://arxiv.org/abs/2110.00061) by Brandon Smock, Rohith Pesala, Robin Abraham.
+1. **[TAPAS](model_doc/tapas)** (from Google AI) released with the paper [TAPAS: Weakly Supervised Table Parsing via Pre-training](https://arxiv.org/abs/2004.02349) by Jonathan Herzig, Paweล Krzysztof Nowak, Thomas Mรผller, Francesco Piccinno and Julian Martin Eisenschlos.
+1. **[TAPEX](model_doc/tapex)** (from Microsoft Research) released with the paper [TAPEX: Table Pre-training via Learning a Neural SQL Executor](https://arxiv.org/abs/2107.07653) by Qian Liu, Bei Chen, Jiaqi Guo, Morteza Ziyadi, Zeqi Lin, Weizhu Chen, Jian-Guang Lou.
+1. **[Time Series Transformer](model_doc/time_series_transformer)** (from HuggingFace).
+1. **[Trajectory Transformer](model_doc/trajectory_transformers)** (from the University of California at Berkeley) released with the paper [Offline Reinforcement Learning as One Big Sequence Modeling Problem](https://arxiv.org/abs/2106.02039) by Michael Janner, Qiyang Li, Sergey Levine
+1. **[Transformer-XL](model_doc/transfo-xl)** (from Google/CMU) released with the paper [Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context](https://arxiv.org/abs/1901.02860) by Zihang Dai*, Zhilin Yang*, Yiming Yang, Jaime Carbonell, Quoc V. Le, Ruslan Salakhutdinov.
+1. **[TrOCR](model_doc/trocr)** (from Microsoft), released together with the paper [TrOCR: Transformer-based Optical Character Recognition with Pre-trained Models](https://arxiv.org/abs/2109.10282) by Minghao Li, Tengchao Lv, Lei Cui, Yijuan Lu, Dinei Florencio, Cha Zhang, Zhoujun Li, Furu Wei.
+1. **[UL2](model_doc/ul2)** (from Google Research) released with the paper [Unifying Language Learning Paradigms](https://arxiv.org/abs/2205.05131v1) by Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, Donald Metzler
+1. **[UniSpeech](model_doc/unispeech)** (from Microsoft Research) released with the paper [UniSpeech: Unified Speech Representation Learning with Labeled and Unlabeled Data](https://arxiv.org/abs/2101.07597) by Chengyi Wang, Yu Wu, Yao Qian, Kenichi Kumatani, Shujie Liu, Furu Wei, Michael Zeng, Xuedong Huang.
+1. **[UniSpeechSat](model_doc/unispeech-sat)** (from Microsoft Research) released with the paper [UNISPEECH-SAT: UNIVERSAL SPEECH REPRESENTATION LEARNING WITH SPEAKER AWARE PRE-TRAINING](https://arxiv.org/abs/2110.05752) by Sanyuan Chen, Yu Wu, Chengyi Wang, Zhengyang Chen, Zhuo Chen, Shujie Liu, Jian Wu, Yao Qian, Furu Wei, Jinyu Li, Xiangzhan Yu.
+1. **[VAN](model_doc/van)** (from Tsinghua University and Nankai University) released with the paper [Visual Attention Network](https://arxiv.org/abs/2202.09741) by Meng-Hao Guo, Cheng-Ze Lu, Zheng-Ning Liu, Ming-Ming Cheng, Shi-Min Hu.
+1. **[VideoMAE](model_doc/videomae)** (from Multimedia Computing Group, Nanjing University) released with the paper [VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training](https://arxiv.org/abs/2203.12602) by Zhan Tong, Yibing Song, Jue Wang, Limin Wang.
+1. **[ViLT](model_doc/vilt)** (from NAVER AI Lab/Kakao Enterprise/Kakao Brain) released with the paper [ViLT: Vision-and-Language Transformer Without Convolution or Region Supervision](https://arxiv.org/abs/2102.03334) by Wonjae Kim, Bokyung Son, Ildoo Kim.
+1. **[Vision Transformer (ViT)](model_doc/vit)** (from Google AI) released with the paper [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) by Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, Neil Houlsby.
+1. **[VisualBERT](model_doc/visual_bert)** (from UCLA NLP) released with the paper [VisualBERT: A Simple and Performant Baseline for Vision and Language](https://arxiv.org/pdf/1908.03557) by Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, Kai-Wei Chang.
+1. **[ViTMAE](model_doc/vit_mae)** (from Meta AI) released with the paper [Masked Autoencoders Are Scalable Vision Learners](https://arxiv.org/abs/2111.06377) by Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollรกr, Ross Girshick.
+1. **[ViTMSN](model_doc/vit_msn)** (from Meta AI) released with the paper [Masked Siamese Networks for Label-Efficient Learning](https://arxiv.org/abs/2204.07141) by Mahmoud Assran, Mathilde Caron, Ishan Misra, Piotr Bojanowski, Florian Bordes, Pascal Vincent, Armand Joulin, Michael Rabbat, Nicolas Ballas.
+1. **[Wav2Vec2](model_doc/wav2vec2)** (from Facebook AI) released with the paper [wav2vec 2.0: A Framework for Self-Supervised Learning of Speech Representations](https://arxiv.org/abs/2006.11477) by Alexei Baevski, Henry Zhou, Abdelrahman Mohamed, Michael Auli.
+1. **[Wav2Vec2-Conformer](model_doc/wav2vec2-conformer)** (from Facebook AI) released with the paper [FAIRSEQ S2T: Fast Speech-to-Text Modeling with FAIRSEQ](https://arxiv.org/abs/2010.05171) by Changhan Wang, Yun Tang, Xutai Ma, Anne Wu, Sravya Popuri, Dmytro Okhonko, Juan Pino.
+1. **[Wav2Vec2Phoneme](model_doc/wav2vec2_phoneme)** (from Facebook AI) released with the paper [Simple and Effective Zero-shot Cross-lingual Phoneme Recognition](https://arxiv.org/abs/2109.11680) by Qiantong Xu, Alexei Baevski, Michael Auli.
+1. **[WavLM](model_doc/wavlm)** (from Microsoft Research) released with the paper [WavLM: Large-Scale Self-Supervised Pre-Training for Full Stack Speech Processing](https://arxiv.org/abs/2110.13900) by Sanyuan Chen, Chengyi Wang, Zhengyang Chen, Yu Wu, Shujie Liu, Zhuo Chen, Jinyu Li, Naoyuki Kanda, Takuya Yoshioka, Xiong Xiao, Jian Wu, Long Zhou, Shuo Ren, Yanmin Qian, Yao Qian, Jian Wu, Michael Zeng, Furu Wei.
+1. **[Whisper](model_doc/whisper)** (from OpenAI) released with the paper [Robust Speech Recognition via Large-Scale Weak Supervision](https://cdn.openai.com/papers/whisper.pdf) by Alec Radford, Jong Wook Kim, Tao Xu, Greg Brockman, Christine McLeavey, Ilya Sutskever.
+1. **[X-CLIP](model_doc/xclip)** (from Microsoft Research) released with the paper [Expanding Language-Image Pretrained Models for General Video Recognition](https://arxiv.org/abs/2208.02816) by Bolin Ni, Houwen Peng, Minghao Chen, Songyang Zhang, Gaofeng Meng, Jianlong Fu, Shiming Xiang, Haibin Ling.
+1. **[XGLM](model_doc/xglm)** (From Facebook AI) released with the paper [Few-shot Learning with Multilingual Language Models](https://arxiv.org/abs/2112.10668) by Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal, Shruti Bhosale, Jingfei Du, Ramakanth Pasunuru, Sam Shleifer, Punit Singh Koura, Vishrav Chaudhary, Brian O'Horo, Jeff Wang, Luke Zettlemoyer, Zornitsa Kozareva, Mona Diab, Veselin Stoyanov, Xian Li.
+1. **[XLM](model_doc/xlm)** (from Facebook) released together with the paper [Cross-lingual Language Model Pretraining](https://arxiv.org/abs/1901.07291) by Guillaume Lample and Alexis Conneau.
+1. **[XLM-ProphetNet](model_doc/xlm-prophetnet)** (from Microsoft Research) released with the paper [ProphetNet: Predicting Future N-gram for Sequence-to-Sequence Pre-training](https://arxiv.org/abs/2001.04063) by Yu Yan, Weizhen Qi, Yeyun Gong, Dayiheng Liu, Nan Duan, Jiusheng Chen, Ruofei Zhang and Ming Zhou.
+1. **[XLM-RoBERTa](model_doc/xlm-roberta)** (from Facebook AI), released together with the paper [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116) by Alexis Conneau*, Kartikay Khandelwal*, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmรกn, Edouard Grave, Myle Ott, Luke Zettlemoyer and Veselin Stoyanov.
+1. **[XLM-RoBERTa-XL](model_doc/xlm-roberta-xl)** (from Facebook AI), released together with the paper [Larger-Scale Transformers for Multilingual Masked Language Modeling](https://arxiv.org/abs/2105.00572) by Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau.
+1. **[XLNet](model_doc/xlnet)** (from Google/CMU) released with the paper [โXLNet: Generalized Autoregressive Pretraining for Language Understanding](https://arxiv.org/abs/1906.08237) by Zhilin Yang*, Zihang Dai*, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, Quoc V. Le.
+1. **[XLS-R](model_doc/xls_r)** (from Facebook AI) released with the paper [XLS-R: Self-supervised Cross-lingual Speech Representation Learning at Scale](https://arxiv.org/abs/2111.09296) by Arun Babu, Changhan Wang, Andros Tjandra, Kushal Lakhotia, Qiantong Xu, Naman Goyal, Kritika Singh, Patrick von Platen, Yatharth Saraf, Juan Pino, Alexei Baevski, Alexis Conneau, Michael Auli.
+1. **[XLSR-Wav2Vec2](model_doc/xlsr_wav2vec2)** (from Facebook AI) released with the paper [Unsupervised Cross-Lingual Representation Learning For Speech Recognition](https://arxiv.org/abs/2006.13979) by Alexis Conneau, Alexei Baevski, Ronan Collobert, Abdelrahman Mohamed, Michael Auli.
+1. **[YOLOS](model_doc/yolos)** (from Huazhong University of Science & Technology) released with the paper [You Only Look at One Sequence: Rethinking Transformer in Vision through Object Detection](https://arxiv.org/abs/2106.00666) by Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, Wenyu Liu.
+1. **[YOSO](model_doc/yoso)** (from the University of Wisconsin - Madison) released with the paper [You Only Sample (Almost) Once: Linear Cost Self-Attention Via Bernoulli Sampling](https://arxiv.org/abs/2111.09714) by Zhanpeng Zeng, Yunyang Xiong, Sathya N. Ravi, Shailesh Acharya, Glenn Fung, Vikas Singh.
+
+
+### ์ง์ ํ๋ ์์ํฌ[[supported-framework]]
+
+์๋ ํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ๊ฐ ๋ชจ๋ธ์ ์ง์ ํํฉ์ ๋ํ๋
๋๋ค. ํ ํฐํ๋ฅผ ํ์ด์ฌ (๋ณ์นญ "slow") ๋๋ ๐ค Tokenizers (๋ณ์นญ "fast") ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ก ํ๋์ง; (Flax๋ฅผ ํตํ) Jax, PyTorch, TensorFlow ์ค ์ด๋ค ํ๋ ์์ํฌ๋ฅผ ์ง์ํ๋์ง ํ์๋์ด ์์ต๋๋ค.
+
+
+
+| Model | Tokenizer slow | Tokenizer fast | PyTorch support | TensorFlow support | Flax Support |
+|:---------------------------:|:--------------:|:--------------:|:---------------:|:------------------:|:------------:|
+| ALBERT | โ
| โ
| โ
| โ
| โ
|
+| BART | โ
| โ
| โ
| โ
| โ
|
+| BEiT | โ | โ | โ
| โ | โ
|
+| BERT | โ
| โ
| โ
| โ
| โ
|
+| Bert Generation | โ
| โ | โ
| โ | โ |
+| BigBird | โ
| โ
| โ
| โ | โ
|
+| BigBird-Pegasus | โ | โ | โ
| โ | โ |
+| Blenderbot | โ
| โ
| โ
| โ
| โ
|
+| BlenderbotSmall | โ
| โ
| โ
| โ
| โ
|
+| BLOOM | โ | โ
| โ
| โ | โ |
+| CamemBERT | โ
| โ
| โ
| โ
| โ |
+| CANINE | โ
| โ | โ
| โ | โ |
+| CLIP | โ
| โ
| โ
| โ
| โ
|
+| CLIPSeg | โ | โ | โ
| โ | โ |
+| CodeGen | โ
| โ
| โ
| โ | โ |
+| Conditional DETR | โ | โ | โ
| โ | โ |
+| ConvBERT | โ
| โ
| โ
| โ
| โ |
+| ConvNeXT | โ | โ | โ
| โ
| โ |
+| CTRL | โ
| โ | โ
| โ
| โ |
+| CvT | โ | โ | โ
| โ
| โ |
+| Data2VecAudio | โ | โ | โ
| โ | โ |
+| Data2VecText | โ | โ | โ
| โ | โ |
+| Data2VecVision | โ | โ | โ
| โ
| โ |
+| DeBERTa | โ
| โ
| โ
| โ
| โ |
+| DeBERTa-v2 | โ
| โ
| โ
| โ
| โ |
+| Decision Transformer | โ | โ | โ
| โ | โ |
+| Deformable DETR | โ | โ | โ
| โ | โ |
+| DeiT | โ | โ | โ
| โ
| โ |
+| DETR | โ | โ | โ
| โ | โ |
+| DistilBERT | โ
| โ
| โ
| โ
| โ
|
+| DonutSwin | โ | โ | โ
| โ | โ |
+| DPR | โ
| โ
| โ
| โ
| โ |
+| DPT | โ | โ | โ
| โ | โ |
+| ELECTRA | โ
| โ
| โ
| โ
| โ
|
+| Encoder decoder | โ | โ | โ
| โ
| โ
|
+| ERNIE | โ | โ | โ
| โ | โ |
+| ESM | โ
| โ | โ
| โ
| โ |
+| FairSeq Machine-Translation | โ
| โ | โ
| โ | โ |
+| FlauBERT | โ
| โ | โ
| โ
| โ |
+| FLAVA | โ | โ | โ
| โ | โ |
+| FNet | โ
| โ
| โ
| โ | โ |
+| Funnel Transformer | โ
| โ
| โ
| โ
| โ |
+| GLPN | โ | โ | โ
| โ | โ |
+| GPT Neo | โ | โ | โ
| โ | โ
|
+| GPT NeoX | โ | โ
| โ
| โ | โ |
+| GPT NeoX Japanese | โ
| โ | โ
| โ | โ |
+| GPT-J | โ | โ | โ
| โ
| โ
|
+| GroupViT | โ | โ | โ
| โ
| โ |
+| Hubert | โ | โ | โ
| โ
| โ |
+| I-BERT | โ | โ | โ
| โ | โ |
+| ImageGPT | โ | โ | โ
| โ | โ |
+| Jukebox | โ
| โ | โ
| โ | โ |
+| LayoutLM | โ
| โ
| โ
| โ
| โ |
+| LayoutLMv2 | โ
| โ
| โ
| โ | โ |
+| LayoutLMv3 | โ
| โ
| โ
| โ
| โ |
+| LED | โ
| โ
| โ
| โ
| โ |
+| LeViT | โ | โ | โ
| โ | โ |
+| LiLT | โ | โ | โ
| โ | โ |
+| Longformer | โ
| โ
| โ
| โ
| โ |
+| LongT5 | โ | โ | โ
| โ | โ
|
+| LUKE | โ
| โ | โ
| โ | โ |
+| LXMERT | โ
| โ
| โ
| โ
| โ |
+| M-CTC-T | โ | โ | โ
| โ | โ |
+| M2M100 | โ
| โ | โ
| โ | โ |
+| Marian | โ
| โ | โ
| โ
| โ
|
+| MarkupLM | โ
| โ
| โ
| โ | โ |
+| MaskFormer | โ | โ | โ
| โ | โ |
+| mBART | โ
| โ
| โ
| โ
| โ
|
+| Megatron-BERT | โ | โ | โ
| โ | โ |
+| MobileBERT | โ
| โ
| โ
| โ
| โ |
+| MobileViT | โ | โ | โ
| โ
| โ |
+| MPNet | โ
| โ
| โ
| โ
| โ |
+| MT5 | โ
| โ
| โ
| โ
| โ
|
+| MVP | โ
| โ
| โ
| โ | โ |
+| Nezha | โ | โ | โ
| โ | โ |
+| Nystrรถmformer | โ | โ | โ
| โ | โ |
+| OpenAI GPT | โ
| โ
| โ
| โ
| โ |
+| OpenAI GPT-2 | โ
| โ
| โ
| โ
| โ
|
+| OPT | โ | โ | โ
| โ
| โ
|
+| OWL-ViT | โ | โ | โ
| โ | โ |
+| Pegasus | โ
| โ
| โ
| โ
| โ
|
+| PEGASUS-X | โ | โ | โ
| โ | โ |
+| Perceiver | โ
| โ | โ
| โ | โ |
+| PLBart | โ
| โ | โ
| โ | โ |
+| PoolFormer | โ | โ | โ
| โ | โ |
+| ProphetNet | โ
| โ | โ
| โ | โ |
+| QDQBert | โ | โ | โ
| โ | โ |
+| RAG | โ
| โ | โ
| โ
| โ |
+| REALM | โ
| โ
| โ
| โ | โ |
+| Reformer | โ
| โ
| โ
| โ | โ |
+| RegNet | โ | โ | โ
| โ
| โ
|
+| RemBERT | โ
| โ
| โ
| โ
| โ |
+| ResNet | โ | โ | โ
| โ
| โ
|
+| RetriBERT | โ
| โ
| โ
| โ | โ |
+| RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| RoCBert | โ
| โ | โ
| โ | โ |
+| RoFormer | โ
| โ
| โ
| โ
| โ
|
+| SegFormer | โ | โ | โ
| โ
| โ |
+| SEW | โ | โ | โ
| โ | โ |
+| SEW-D | โ | โ | โ
| โ | โ |
+| Speech Encoder decoder | โ | โ | โ
| โ | โ
|
+| Speech2Text | โ
| โ | โ
| โ
| โ |
+| Speech2Text2 | โ
| โ | โ | โ | โ |
+| Splinter | โ
| โ
| โ
| โ | โ |
+| SqueezeBERT | โ
| โ
| โ
| โ | โ |
+| Swin Transformer | โ | โ | โ
| โ
| โ |
+| Swin Transformer V2 | โ | โ | โ
| โ | โ |
+| T5 | โ
| โ
| โ
| โ
| โ
|
+| Table Transformer | โ | โ | โ
| โ | โ |
+| TAPAS | โ
| โ | โ
| โ
| โ |
+| Time Series Transformer | โ | โ | โ
| โ | โ |
+| Trajectory Transformer | โ | โ | โ
| โ | โ |
+| Transformer-XL | โ
| โ | โ
| โ
| โ |
+| TrOCR | โ | โ | โ
| โ | โ |
+| UniSpeech | โ | โ | โ
| โ | โ |
+| UniSpeechSat | โ | โ | โ
| โ | โ |
+| VAN | โ | โ | โ
| โ | โ |
+| VideoMAE | โ | โ | โ
| โ | โ |
+| ViLT | โ | โ | โ
| โ | โ |
+| Vision Encoder decoder | โ | โ | โ
| โ
| โ
|
+| VisionTextDualEncoder | โ | โ | โ
| โ | โ
|
+| VisualBERT | โ | โ | โ
| โ | โ |
+| ViT | โ | โ | โ
| โ
| โ
|
+| ViTMAE | โ | โ | โ
| โ
| โ |
+| ViTMSN | โ | โ | โ
| โ | โ |
+| Wav2Vec2 | โ
| โ | โ
| โ
| โ
|
+| Wav2Vec2-Conformer | โ | โ | โ
| โ | โ |
+| WavLM | โ | โ | โ
| โ | โ |
+| Whisper | โ
| โ | โ
| โ
| โ |
+| X-CLIP | โ | โ | โ
| โ | โ |
+| XGLM | โ
| โ
| โ
| โ
| โ
|
+| XLM | โ
| โ | โ
| โ
| โ |
+| XLM-ProphetNet | โ
| โ | โ
| โ | โ |
+| XLM-RoBERTa | โ
| โ
| โ
| โ
| โ
|
+| XLM-RoBERTa-XL | โ | โ | โ
| โ | โ |
+| XLNet | โ
| โ
| โ
| โ
| โ |
+| YOLOS | โ | โ | โ
| โ | โ |
+| YOSO | โ | โ | โ
| โ | โ |
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/installation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/installation.md
new file mode 100644
index 0000000000000000000000000000000000000000..a744db40d291236a10b6b93c06d99c0b31a0a33d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/installation.md
@@ -0,0 +1,245 @@
+
+
+# ์ค์น๋ฐฉ๋ฒ[[installation]]
+
+๐ค Transformers๋ฅผ ์ฌ์ฉ ์ค์ธ ๋ฅ๋ฌ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ง์ถฐ ์ค์นํ๊ณ , ์บ์๋ฅผ ๊ตฌ์ฑํ๊ฑฐ๋ ์ ํ์ ์ผ๋ก ์คํ๋ผ์ธ์์๋ ์คํํ ์ ์๋๋ก ๐ค Transformers๋ฅผ ์ค์ ํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ฐ๊ฒ ์ต๋๋ค.
+
+๐ค Transformers๋ Python 3.6+, PyTorch 1.1.0+, TensorFlow 2.0+ ๋ฐ Flax์์ ํ
์คํธ๋์์ต๋๋ค. ๋ฅ๋ฌ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ค์นํ๋ ค๋ฉด ์๋ ๋งํฌ๋ ์ ๋ง๋ค์ ๊ณต์ ์ฌ์ดํธ๋ฅผ ์ฐธ๊ณ ํด์ฃผ์ธ์.
+
+* [PyTorch](https://pytorch.org/get-started/locally/) ์ค์นํ๊ธฐ
+* [TensorFlow 2.0](https://www.tensorflow.org/install/pip) ์ค์นํ๊ธฐ
+* [Flax](https://flax.readthedocs.io/en/latest/) ์ค์นํ๊ธฐ
+
+## pip์ผ๋ก ์ค์นํ๊ธฐ[[install-with-pip]]
+
+๐ค Transformers๋ฅผ [๊ฐ์ ํ๊ฒฝ](https://docs.python.org/3/library/venv.html)์ ์ค์นํ๋ ๊ฒ์ ์ถ์ฒ๋๋ฆฝ๋๋ค. Python ๊ฐ์ ํ๊ฒฝ์ ์ต์ํ์ง ์๋ค๋ฉด, ์ด [๊ฐ์ด๋](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)๋ฅผ ์ฐธ๊ณ ํ์ธ์. ๊ฐ์ ํ๊ฒฝ์ ์ฌ์ฉํ๋ฉด ์๋ก ๋ค๋ฅธ ํ๋ก์ ํธ๋ค์ ๋ณด๋ค ์ฝ๊ฒ ๊ด๋ฆฌํ ์ ์๊ณ , ์์กด์ฑ ๊ฐ์ ํธํ์ฑ ๋ฌธ์ ๋ฅผ ๋ฐฉ์งํ ์ ์์ต๋๋ค.
+
+๋จผ์ ํ๋ก์ ํธ ๋๋ ํ ๋ฆฌ์์ ๊ฐ์ ํ๊ฒฝ์ ๋ง๋ค์ด ์ค๋๋ค.
+
+```bash
+python -m venv .env
+```
+
+๊ฐ์ ํ๊ฒฝ์ ํ์ฑํํด์ฃผ์ธ์. Linux๋ MacOS์ ๊ฒฝ์ฐ:
+
+```bash
+source .env/bin/activate
+```
+Windows์ ๊ฒฝ์ฐ:
+
+```bash
+.env/Scripts/activate
+```
+
+์ด์ ๐ค Transformers๋ฅผ ์ค์นํ ์ค๋น๊ฐ ๋์์ต๋๋ค. ๋ค์ ๋ช
๋ น์ ์
๋ ฅํด์ฃผ์ธ์.
+
+```bash
+pip install transformers
+```
+
+CPU๋ง ์จ๋ ๋๋ค๋ฉด, ๐ค Transformers์ ๋ฅ๋ฌ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๋จ 1์ค๋ก ์ค์นํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ๐ค Transformers์ PyTorch์ ๊ฒฝ์ฐ:
+
+```bash
+pip install transformers[torch]
+```
+
+๐ค Transformers์ TensorFlow 2.0์ ๊ฒฝ์ฐ:
+
+```bash
+pip install transformers[tf-cpu]
+```
+
+๐ค Transformers์ Flax์ ๊ฒฝ์ฐ:
+
+```bash
+pip install transformers[flax]
+```
+
+๋ง์ง๋ง์ผ๋ก ๐ค Transformers๊ฐ ์ ๋๋ก ์ค์น๋์๋์ง ํ์ธํ ์ฐจ๋ก์
๋๋ค. ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ๋ค์ด๋ก๋ํ๋ ์ฝ๋์
๋๋ค.
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('we love you'))"
+```
+
+๋ผ๋ฒจ๊ณผ ์ ์๊ฐ ์ถ๋ ฅ๋๋ฉด ์ ์ค์น๋ ๊ฒ์
๋๋ค.
+
+```bash
+[{'label': 'POSITIVE', 'score': 0.9998704791069031}]
+```
+
+## ์์ค์์ ์ค์นํ๊ธฐ[[install-from-source]]
+
+๐ค Transformers๋ฅผ ์์ค์์ ์ค์นํ๋ ค๋ฉด ์๋ ๋ช
๋ น์ ์คํํ์ธ์.
+
+```bash
+pip install git+https://github.com/huggingface/transformers
+```
+
+์ ๋ช
๋ น์ ์ต์ ์ด์ง๋ง (์์ ์ ์ธ) `stable` ๋ฒ์ ์ด ์๋ ์คํ์ฑ์ด ์ง์ `main` ๋ฒ์ ์ ์ค์นํฉ๋๋ค. `main` ๋ฒ์ ์ ๊ฐ๋ฐ ํํฉ๊ณผ ๋ฐ๋ง์ถ๋๋ฐ ์ ์ฉํฉ๋๋ค. ์์๋ก ๋ง์ง๋ง ๊ณต์ ๋ฆด๋ฆฌ์ค ์ดํ ๋ฐ๊ฒฌ๋ ๋ฒ๊ทธ๊ฐ ํจ์น๋์์ง๋ง, ์ ๋ฆด๋ฆฌ์ค๋ก ์์ง ๋กค์์๋์ง๋ ์์ ๊ฒฝ์ฐ๋ฅผ ๋ค ์ ์์ต๋๋ค. ๋ฐ๊ฟ ๋งํ๋ฉด `main` ๋ฒ์ ์ด ์์ ์ฑ๊ณผ๋ ๊ฑฐ๋ฆฌ๊ฐ ์๋ค๋ ๋ป์ด๊ธฐ๋ ํฉ๋๋ค. ์ ํฌ๋ `main` ๋ฒ์ ์ ์ฌ์ฉํ๋๋ฐ ๋ฌธ์ ๊ฐ ์๋๋ก ๋
ธ๋ ฅํ๊ณ ์์ผ๋ฉฐ, ๋๋ถ๋ถ์ ๋ฌธ์ ๋ ๋๊ฐ ๋ช ์๊ฐ์ด๋ ํ๋ฃจ ์์ ํด๊ฒฐ๋ฉ๋๋ค. ๋ง์ฝ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ฉด [์ด์](https://github.com/huggingface/transformers/issues)๋ฅผ ์ด์ด์ฃผ์๋ฉด ๋ ๋นจ๋ฆฌ ํด๊ฒฐํ ์ ์์ต๋๋ค!
+
+์ ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ๐ค Transformers๊ฐ ์ ๋๋ก ์ค์น๋์๋์ง ํ์ธํ ์ฐจ๋ก์
๋๋ค.
+
+```bash
+python -c "from transformers import pipeline; print(pipeline('sentiment-analysis')('I love you'))"
+```
+
+## ์์ ๊ฐ๋ฅํ ์ค์น[[editable-install]]
+
+์์ ๊ฐ๋ฅํ ์ค์น๊ฐ ํ์ํ ๊ฒฝ์ฐ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+* `main` ๋ฒ์ ์ ์์ค ์ฝ๋๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด
+* ๐ค Transformers์ ๊ธฐ์ฌํ๊ณ ์ถ์ด์ ์ฝ๋์ ๋ณ๊ฒฝ ์ฌํญ์ ํ
์คํธํ๊ธฐ ์ํด
+
+๋ฆฌํฌ์งํฐ๋ฆฌ๋ฅผ ๋ณต์ ํ๊ณ ๐ค Transformers๋ฅผ ์ค์นํ๋ ค๋ฉด ๋ค์ ๋ช
๋ น์ ์
๋ ฅํด์ฃผ์ธ์.
+
+```bash
+git clone https://github.com/huggingface/transformers.git
+cd transformers
+pip install -e .
+```
+
+์ ๋ช
๋ น์ ๋ฆฌํฌ์งํฐ๋ฆฌ๋ฅผ ๋ณต์ ํ ์์น์ ํด๋์ Python ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ฒฝ๋ก๋ฅผ ์ฐ๊ฒฐ์ํต๋๋ค. Python์ด ์ผ๋ฐ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฒฝ๋ก ์ธ์ ๋ณต์ ํ ํด๋ ๋ด๋ถ๋ฅผ ํ์ธํ ๊ฒ์
๋๋ค. ์๋ฅผ ๋ค์ด Python ํจํค์ง๊ฐ ์ผ๋ฐ์ ์ผ๋ก `~/anaconda3/envs/main/lib/python3.7/site-packages/`์ ์ค์น๋์ด ์๋๋ฐ, ๋ช
๋ น์ ๋ฐ์ Python์ด ์ด์ ๋ณต์ ํ ํด๋์ธ `~/transformers/`๋ ๊ฒ์ํ๊ฒ ๋ฉ๋๋ค.
+
+
+
+๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ๊ณ์ ์ฌ์ฉํ๋ ค๋ฉด `transformers` ํด๋๋ฅผ ๊ผญ ์ ์งํด์ผ ํฉ๋๋ค.
+
+
+
+๋ณต์ ๋ณธ์ ์ต์ ๋ฒ์ ์ ๐ค Transformers๋ก ์ฝ๊ฒ ์
๋ฐ์ดํธํ ์ ์์ต๋๋ค.
+
+```bash
+cd ~/transformers/
+git pull
+```
+
+Python ํ๊ฒฝ์ ๋ค์ ์คํํ๋ฉด ์
๋ฐ์ดํธ๋ ๐ค Transformers์ `main` ๋ฒ์ ์ ์ฐพ์๋ผ ๊ฒ์
๋๋ค.
+
+## conda๋ก ์ค์นํ๊ธฐ[[install-with-conda]]
+
+`conda-forge` conda ์ฑ๋์์ ์ค์นํ ์ ์์ต๋๋ค.
+
+```bash
+conda install conda-forge::transformers
+```
+
+## ์บ์ ๊ตฌ์ฑํ๊ธฐ[[cache-setup]]
+
+์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ๋ค์ด๋ก๋๋ ํ ๋ก์ปฌ ๊ฒฝ๋ก `~/.cache/huggingface/hub`์ ์บ์๋ฉ๋๋ค. ์
ธ ํ๊ฒฝ ๋ณ์ `TRANSFORMERS_CACHE`์ ๊ธฐ๋ณธ ๋๋ ํฐ๋ฆฌ์
๋๋ค. Windows์ ๊ฒฝ์ฐ ๊ธฐ๋ณธ ๋๋ ํฐ๋ฆฌ๋ `C:\Users\username\.cache\huggingface\hub`์
๋๋ค. ์๋์ ์
ธ ํ๊ฒฝ ๋ณ์๋ฅผ (์ฐ์ ์์) ์์๋๋ก ๋ณ๊ฒฝํ์ฌ ๋ค๋ฅธ ์บ์ ๋๋ ํ ๋ฆฌ๋ฅผ ์ง์ ํ ์ ์์ต๋๋ค.
+
+1. ์
ธ ํ๊ฒฝ ๋ณ์ (๊ธฐ๋ณธ): `HF_HUB_CACHE` ๋๋ `TRANSFORMERS_CACHE`
+2. ์
ธ ํ๊ฒฝ ๋ณ์: `HF_HOME`
+3. ์
ธ ํ๊ฒฝ ๋ณ์: `XDG_CACHE_HOME` + `/huggingface`
+
+
+
+๊ณผ๊ฑฐ ๐ค Transformers์์ ์ฐ์๋ ์
ธ ํ๊ฒฝ ๋ณ์ `PYTORCH_TRANSFORMERS_CACHE` ๋๋ `PYTORCH_PRETRAINED_BERT_CACHE`์ด ์ค์ ๋์๋ค๋ฉด, ์
ธ ํ๊ฒฝ ๋ณ์ `TRANSFORMERS_CACHE`์ ์ง์ ํ์ง ์๋ ํ ์ฐ์ ์ฌ์ฉ๋ฉ๋๋ค.
+
+
+
+## ์คํ๋ผ์ธ ๋ชจ๋[[offline-mode]]
+
+๐ค Transformers๋ฅผ ๋ก์ปฌ ํ์ผ๋ง ์ฌ์ฉํ๋๋ก ํด์ ๋ฐฉํ๋ฒฝ ๋๋ ์คํ๋ผ์ธ ํ๊ฒฝ์์ ์คํํ ์ ์์ต๋๋ค. ํ์ฑํํ๋ ค๋ฉด `HF_HUB_OFFLINE=1` ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ ํ์ธ์.
+
+
+
+`HF_DATASETS_OFFLINE=1` ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ ํ์ฌ ์คํ๋ผ์ธ ํ๋ จ ๊ณผ์ ์ [๐ค Datasets](https://huggingface.co/docs/datasets/)์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
+
+
+
+์๋ฅผ ๋ค์ด ์ธ๋ถ ๊ธฐ๊ธฐ ์ฌ์ด์ ๋ฐฉํ๋ฒฝ์ ๋ ์ผ๋ฐ ๋คํธ์ํฌ์์ ํ์์ฒ๋ผ ํ๋ก๊ทธ๋จ์ ๋ค์๊ณผ ๊ฐ์ด ์คํํ ์ ์์ต๋๋ค.
+
+```bash
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+์คํ๋ผ์ธ ๊ธฐ๊ธฐ์์ ๋์ผํ ํ๋ก๊ทธ๋จ์ ๋ค์๊ณผ ๊ฐ์ด ์คํํ ์ ์์ต๋๋ค.
+
+```bash
+HF_DATASETS_OFFLINE=1 HF_HUB_OFFLINE=1 \
+python examples/pytorch/translation/run_translation.py --model_name_or_path google-t5/t5-small --dataset_name wmt16 --dataset_config ro-en ...
+```
+
+์ด์ ์คํฌ๋ฆฝํธ๋ ๋ก์ปฌ ํ์ผ์ ํํด์๋ง ๊ฒ์ํ ๊ฒ์ด๋ฏ๋ก, ์คํฌ๋ฆฝํธ๊ฐ ์ค๋จ๋๊ฑฐ๋ ์๊ฐ์ด ์ด๊ณผ๋ ๋๊น์ง ๋ฉ์ถฐ์์ง ์๊ณ ์ ์คํ๋ ๊ฒ์
๋๋ค.
+
+### ์คํ๋ผ์ธ์ฉ ๋ชจ๋ธ ๋ฐ ํ ํฌ๋์ด์ ๋ง๋ค์ด๋๊ธฐ[[fetch-models-and-tokenizers-to-use-offline]]
+
+Another option for using ๐ค Transformers offline is to download the files ahead of time, and then point to their local path when you need to use them offline. There are three ways to do this:
+๐ค Transformers๋ฅผ ์คํ๋ผ์ธ์ผ๋ก ์ฌ์ฉํ๋ ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ํ์ผ์ ๋ฏธ๋ฆฌ ๋ค์ด๋ก๋ํ ๋ค์, ์คํ๋ผ์ธ์ผ ๋ ์ฌ์ฉํ ๋ก์ปฌ ๊ฒฝ๋ก๋ฅผ ์ง์ ํด๋๋ ๊ฒ์
๋๋ค. 3๊ฐ์ง ์ค ํธํ ๋ฐฉ๋ฒ์ ๊ณ ๋ฅด์ธ์.
+
+* [Model Hub](https://huggingface.co/models)์ UI๋ฅผ ํตํด ํ์ผ์ ๋ค์ด๋ก๋ํ๋ ค๋ฉด โ ์์ด์ฝ์ ํด๋ฆญํ์ธ์.
+
+ 
+
+* [`PreTrainedModel.from_pretrained`]์ [`PreTrainedModel.save_pretrained`] ์ํฌํ๋ก๋ฅผ ํ์ฉํ์ธ์.
+
+ 1. ๋ฏธ๋ฆฌ [`PreTrainedModel.from_pretrained`]๋ก ํ์ผ์ ๋ค์ด๋ก๋ํด๋์ธ์.
+
+ ```py
+ >>> from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
+
+ >>> tokenizer = AutoTokenizer.from_pretrained("bigscience/T0_3B")
+ >>> model = AutoModelForSeq2SeqLM.from_pretrained("bigscience/T0_3B")
+ ```
+
+ 2. [`PreTrainedModel.save_pretrained`]๋ก ์ง์ ๋ ๊ฒฝ๋ก์ ํ์ผ์ ์ ์ฅํด๋์ธ์.
+
+ ```py
+ >>> tokenizer.save_pretrained("./your/path/bigscience_t0")
+ >>> model.save_pretrained("./your/path/bigscience_t0")
+ ```
+
+ 3. ์ด์ ์คํ๋ผ์ธ์ผ ๋ [`PreTrainedModel.from_pretrained`]๋ก ์ ์ฅํด๋๋ ํ์ผ์ ์ง์ ๋ ๊ฒฝ๋ก์์ ๋ค์ ๋ถ๋ฌ์ค์ธ์.
+
+ ```py
+ >>> tokenizer = AutoTokenizer.from_pretrained("./your/path/bigscience_t0")
+ >>> model = AutoModel.from_pretrained("./your/path/bigscience_t0")
+ ```
+
+* [huggingface_hub](https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub) ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ์ฉํด์ ํ์ผ์ ๋ค์ด๋ก๋ํ์ธ์.
+
+ 1. ๊ฐ์ํ๊ฒฝ์ `huggingface_hub` ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ค์นํ์ธ์.
+
+ ```bash
+ python -m pip install huggingface_hub
+ ```
+
+ 2. [`hf_hub_download`](https://huggingface.co/docs/hub/adding-a-library#download-files-from-the-hub) ํจ์๋ก ํ์ผ์ ํน์ ์์น์ ๋ค์ด๋ก๋ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ์๋ ๋ช
๋ น์ [T0](https://huggingface.co/bigscience/T0_3B) ๋ชจ๋ธ์ `config.json` ํ์ผ์ ์ง์ ๋ ๊ฒฝ๋ก์ ๋ค์ด๋ก๋ํฉ๋๋ค.
+
+ ```py
+ >>> from huggingface_hub import hf_hub_download
+
+ >>> hf_hub_download(repo_id="bigscience/T0_3B", filename="config.json", cache_dir="./your/path/bigscience_t0")
+ ```
+
+ํ์ผ์ ๋ค์ด๋ก๋ํ๊ณ ๋ก์ปฌ์ ์บ์ ํด๋๊ณ ๋๋ฉด, ๋์ค์ ๋ถ๋ฌ์ ์ฌ์ฉํ ์ ์๋๋ก ๋ก์ปฌ ๊ฒฝ๋ก๋ฅผ ์ง์ ํด๋์ธ์.
+
+```py
+>>> from transformers import AutoConfig
+
+>>> config = AutoConfig.from_pretrained("./your/path/bigscience_t0/config.json")
+```
+
+
+
+Hub์ ์ ์ฅ๋ ํ์ผ์ ๋ค์ด๋ก๋ํ๋ ๋ฐฉ๋ฒ์ ๋ ์์ธํ ์์๋ณด๋ ค๋ฉด [Hub์์ ํ์ผ ๋ค์ด๋ก๋ํ๊ธฐ](https://huggingface.co/docs/hub/how-to-downstream) ์น์
์ ์ฐธ๊ณ ํด์ฃผ์ธ์.
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/audio_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/audio_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..811f7c0866bd509e0b22c53111330cdacd8c4320
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/audio_utils.md
@@ -0,0 +1,39 @@
+
+
+# `FeatureExtractors`๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ [[utilities-for-featureextractors]]
+
+์ด ํ์ด์ง๋ ์ค๋์ค [`FeatureExtractor`]๊ฐ *๋จ์๊ฐ ํธ๋ฆฌ์ ๋ณํ(Short Time Fourier Transform)* ๋๋ *๋ก๊ทธ ๋ฉ ์คํํธ๋ก๊ทธ๋จ(log mel spectrogram)*๊ณผ ๊ฐ์ ์ผ๋ฐ์ ์ธ ์๊ณ ๋ฆฌ์ฆ์ ์ฌ์ฉํ์ฌ ์์ ์ค๋์ค์์ ํน์ํ ํน์ฑ์ ๊ณ์ฐํ๋ ๋ฐ ์ฌ์ฉํ ์ ์๋ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํฉ๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ด ์ค๋์ค ์ฒ๋ฆฌ ์ฝ๋๋ฅผ ์ฐ๊ตฌํ ๋์๋ง ์ ์ฉํฉ๋๋ค.
+
+## ์ค๋์ค ๋ณํ [[transformers.audio_utils.hertz_to_mel]]
+
+[[autodoc]] audio_utils.hertz_to_mel
+
+[[autodoc]] audio_utils.mel_to_hertz
+
+[[autodoc]] audio_utils.mel_filter_bank
+
+[[autodoc]] audio_utils.optimal_fft_length
+
+[[autodoc]] audio_utils.window_function
+
+[[autodoc]] audio_utils.spectrogram
+
+[[autodoc]] audio_utils.power_to_db
+
+[[autodoc]] audio_utils.amplitude_to_db
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/file_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/file_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..7effad44baa170fba6b4bc8b954f57c2fd208323
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/file_utils.md
@@ -0,0 +1,50 @@
+
+
+# ์ผ๋ฐ ์ ํธ๋ฆฌํฐ (General Utilities) [[general-utilities]]
+
+์ด ํ์ด์ง๋ `utils.py` ํ์ผ์ ์๋ Transformers์ ์ผ๋ฐ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํฉ๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ผ๋ฐ์ ์ธ ์ฝ๋๋ฅผ ์ฐ๊ตฌํ ๋๋ง ์ ์ฉํฉ๋๋ค.
+
+
+## Enums ๋ฐ namedtuples [[transformers.utils.ExplicitEnum]]
+
+[[autodoc]] utils.ExplicitEnum
+
+[[autodoc]] utils.PaddingStrategy
+
+[[autodoc]] utils.TensorType
+
+## ํน์ ๋ฐ์ฝ๋ ์ดํฐ (Special Decorators) [[transformers.add_start_docstrings]]
+
+[[autodoc]] utils.add_start_docstrings
+
+[[autodoc]] utils.add_start_docstrings_to_model_forward
+
+[[autodoc]] utils.add_end_docstrings
+
+[[autodoc]] utils.add_code_sample_docstrings
+
+[[autodoc]] utils.replace_return_docstrings
+
+## ํน์ ์์ฑ (Special Properties) [[transformers.utils.cached_property]]
+
+[[autodoc]] utils.cached_property
+
+## ๊ธฐํ ์ ํธ๋ฆฌํฐ [[transformers.utils._LazyModule]]
+
+[[autodoc]] utils._LazyModule
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/generation_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/generation_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..a66411f71e9ee8ebb8aa293fa540bda77eeb2d2f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/generation_utils.md
@@ -0,0 +1,413 @@
+
+
+# ์์ฑ์ ์ํ ์ ํธ๋ฆฌํฐ [[utilities-for-generation]]
+
+์ด ํ์ด์ง๋ [`~generation.GenerationMixin.generate`]์์ ์ฌ์ฉ๋๋ ๋ชจ๋ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํฉ๋๋ค.
+
+## ์ถ๋ ฅ์ ์์ฑํ๊ธฐ (Generate Outputs) [[generate-outputs]]
+
+[`~generation.GenerationMixin.generate`]์ ์ถ๋ ฅ์ [`~utils.ModelOutput`]์ ํ์ ํด๋์ค์ ์ธ์คํด์ค์
๋๋ค. ์ด ์ถ๋ ฅ์ [`~generation.GenerationMixin.generate`]์์ ๋ฐํ๋๋ ๋ชจ๋ ์ ๋ณด๋ฅผ ํฌํจํ๋ ๋ฐ์ดํฐ ๊ตฌ์กฐ์ฒด์ด๋ฉฐ, ํํ ๋๋ ๋์
๋๋ฆฌ๋ก๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+๋ค์์ ์์์
๋๋ค:
+
+```python
+from transformers import GPT2Tokenizer, GPT2LMHeadModel
+
+tokenizer = GPT2Tokenizer.from_pretrained("openai-community/gpt2")
+model = GPT2LMHeadModel.from_pretrained("openai-community/gpt2")
+
+inputs = tokenizer("Hello, my dog is cute and ", return_tensors="pt")
+generation_output = model.generate(**inputs, return_dict_in_generate=True, output_scores=True)
+```
+
+`generation_output` ๊ฐ์ฒด๋ [`~generation.GenerateDecoderOnlyOutput`]์
๋๋ค. ์๋ ๋ฌธ์์์ ํ์ธํ ์ ์๋ฏ์ด, ์ด ํด๋์ค๋ ๋ค์๊ณผ ๊ฐ์ ์์ฑ์ ๊ฐ์ง๊ณ ์์ต๋๋ค:
+
+- `sequences`: ์์ฑ๋ ํ ํฐ ์ํ์ค
+- `scores` (์ต์
): ๊ฐ ์์ฑ ๋จ๊ณ์์ ์ธ์ด ๋ชจ๋ธ๋ง ํค๋์ ์์ธก ์ ์
+- `hidden_states` (์ต์
): ๊ฐ ์์ฑ ๋จ๊ณ์์ ๋ชจ๋ธ์ ์๋ ์ํ
+- `attentions` (์ต์
): ๊ฐ ์์ฑ ๋จ๊ณ์์ ๋ชจ๋ธ์ ์ดํ
์
๊ฐ์ค์น
+
+`output_scores=True`๋ฅผ ์ ๋ฌํ๊ธฐ ๋๋ฌธ์ `scores`๋ ํฌํจ๋์ด ์์ง๋ง, `output_hidden_states=True` ๋๋ `output_attentions=True`๋ฅผ ์ ๋ฌํ์ง ์์์ผ๋ฏ๋ก `hidden_states`์ `attentions`๋ ํฌํจ๋์ง ์์์ต๋๋ค.
+
+๊ฐ ์์ฑ์ ์ผ๋ฐ์ ์ผ๋ก ์ ๊ทผํ ์ ์์ผ๋ฉฐ, ๋ชจ๋ธ์ด ํด๋น ์์ฑ์ ๋ฐํํ์ง ์์๋ค๋ฉด `None`์ด ๋ฐํ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด, `generation_output.scores`๋ ์ธ์ด ๋ชจ๋ธ๋ง ํค๋์์ ์์ฑ๋ ๋ชจ๋ ์์ธก ์ ์๋ฅผ ํฌํจํ๊ณ ์์ผ๋ฉฐ, `generation_output.attentions`๋ `None`์
๋๋ค.
+
+`generation_output` ๊ฐ์ฒด๋ฅผ ํํ๋ก ์ฌ์ฉํ ๊ฒฝ์ฐ, `None` ๊ฐ์ด ์๋ ์์ฑ๋ง ํฌํจ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด, `loss`์ `logits`๋ผ๋ ๋ ์์๊ฐ ํฌํจ๋ ๊ฒฝ์ฐ:
+
+```python
+generation_output[:2]
+```
+
+์ ์ฝ๋๋ `(generation_output.sequences, generation_output.scores)` ํํ์ ๋ฐํํฉ๋๋ค.
+
+`generation_output` ๊ฐ์ฒด๋ฅผ ๋์
๋๋ฆฌ๋ก ์ฌ์ฉํ ๊ฒฝ์ฐ, `None` ๊ฐ์ด ์๋ ์์ฑ๋ง ํฌํจ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด, `sequences`์ `scores`๋ผ๋ ๋ ๊ฐ์ ํค๋ฅผ ๊ฐ์ง ์ ์์ต๋๋ค.
+
+์ฌ๊ธฐ์๋ ๋ชจ๋ ์ถ๋ ฅ ์ ํ์ ๋ฌธ์ํํฉ๋๋ค.
+
+
+### PyTorch [[transformers.generation.GenerateDecoderOnlyOutput]]
+
+[[autodoc]] generation.GenerateDecoderOnlyOutput
+
+[[autodoc]] generation.GenerateEncoderDecoderOutput
+
+[[autodoc]] generation.GenerateBeamDecoderOnlyOutput
+
+[[autodoc]] generation.GenerateBeamEncoderDecoderOutput
+
+### TensorFlow [[transformers.generation.TFGreedySearchEncoderDecoderOutput]]
+
+[[autodoc]] generation.TFGreedySearchEncoderDecoderOutput
+
+[[autodoc]] generation.TFGreedySearchDecoderOnlyOutput
+
+[[autodoc]] generation.TFSampleEncoderDecoderOutput
+
+[[autodoc]] generation.TFSampleDecoderOnlyOutput
+
+[[autodoc]] generation.TFBeamSearchEncoderDecoderOutput
+
+[[autodoc]] generation.TFBeamSearchDecoderOnlyOutput
+
+[[autodoc]] generation.TFBeamSampleEncoderDecoderOutput
+
+[[autodoc]] generation.TFBeamSampleDecoderOnlyOutput
+
+[[autodoc]] generation.TFContrastiveSearchEncoderDecoderOutput
+
+[[autodoc]] generation.TFContrastiveSearchDecoderOnlyOutput
+
+### FLAX [[transformers.generation.FlaxSampleOutput]]
+
+[[autodoc]] generation.FlaxSampleOutput
+
+[[autodoc]] generation.FlaxGreedySearchOutput
+
+[[autodoc]] generation.FlaxBeamSearchOutput
+
+## LogitsProcessor [[logitsprocessor]]
+
+[`LogitsProcessor`]๋ ์์ฑ ์ค ์ธ์ด ๋ชจ๋ธ ํค๋์ ์์ธก ์ ์๋ฅผ ์์ ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
+
+### PyTorch [[transformers.AlternatingCodebooksLogitsProcessor]]
+
+[[autodoc]] AlternatingCodebooksLogitsProcessor
+ - __call__
+
+[[autodoc]] ClassifierFreeGuidanceLogitsProcessor
+ - __call__
+
+[[autodoc]] EncoderNoRepeatNGramLogitsProcessor
+ - __call__
+
+[[autodoc]] EncoderRepetitionPenaltyLogitsProcessor
+ - __call__
+
+[[autodoc]] EpsilonLogitsWarper
+ - __call__
+
+[[autodoc]] EtaLogitsWarper
+ - __call__
+
+[[autodoc]] ExponentialDecayLengthPenalty
+ - __call__
+
+[[autodoc]] ForcedBOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] ForcedEOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] HammingDiversityLogitsProcessor
+ - __call__
+
+[[autodoc]] InfNanRemoveLogitsProcessor
+ - __call__
+
+[[autodoc]] LogitNormalization
+ - __call__
+
+[[autodoc]] LogitsProcessor
+ - __call__
+
+[[autodoc]] LogitsProcessorList
+ - __call__
+
+[[autodoc]] MinLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] MinNewTokensLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] MinPLogitsWarper
+ - __call__
+
+[[autodoc]] NoBadWordsLogitsProcessor
+ - __call__
+
+[[autodoc]] NoRepeatNGramLogitsProcessor
+ - __call__
+
+[[autodoc]] PrefixConstrainedLogitsProcessor
+ - __call__
+
+[[autodoc]] RepetitionPenaltyLogitsProcessor
+ - __call__
+
+[[autodoc]] SequenceBiasLogitsProcessor
+ - __call__
+
+[[autodoc]] SuppressTokensAtBeginLogitsProcessor
+ - __call__
+
+[[autodoc]] SuppressTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] TemperatureLogitsWarper
+ - __call__
+
+[[autodoc]] TopKLogitsWarper
+ - __call__
+
+[[autodoc]] TopPLogitsWarper
+ - __call__
+
+[[autodoc]] TypicalLogitsWarper
+ - __call__
+
+[[autodoc]] UnbatchedClassifierFreeGuidanceLogitsProcessor
+ - __call__
+
+[[autodoc]] WhisperTimeStampLogitsProcessor
+ - __call__
+
+[[autodoc]] WatermarkLogitsProcessor
+ - __call__
+
+
+### TensorFlow [[transformers.TFForcedBOSTokenLogitsProcessor]]
+
+[[autodoc]] TFForcedBOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] TFForcedEOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] TFForceTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] TFLogitsProcessor
+ - __call__
+
+[[autodoc]] TFLogitsProcessorList
+ - __call__
+
+[[autodoc]] TFLogitsWarper
+ - __call__
+
+[[autodoc]] TFMinLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] TFNoBadWordsLogitsProcessor
+ - __call__
+
+[[autodoc]] TFNoRepeatNGramLogitsProcessor
+ - __call__
+
+[[autodoc]] TFRepetitionPenaltyLogitsProcessor
+ - __call__
+
+[[autodoc]] TFSuppressTokensAtBeginLogitsProcessor
+ - __call__
+
+[[autodoc]] TFSuppressTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] TFTemperatureLogitsWarper
+ - __call__
+
+[[autodoc]] TFTopKLogitsWarper
+ - __call__
+
+[[autodoc]] TFTopPLogitsWarper
+ - __call__
+
+### FLAX [[transformers.FlaxForcedBOSTokenLogitsProcessor]]
+
+[[autodoc]] FlaxForcedBOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxForcedEOSTokenLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxForceTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxLogitsProcessorList
+ - __call__
+
+[[autodoc]] FlaxLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxMinLengthLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxSuppressTokensAtBeginLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxSuppressTokensLogitsProcessor
+ - __call__
+
+[[autodoc]] FlaxTemperatureLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxTopKLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxTopPLogitsWarper
+ - __call__
+
+[[autodoc]] FlaxWhisperTimeStampLogitsProcessor
+ - __call__
+
+## StoppingCriteria [[transformers.StoppingCriteria]]
+
+[`StoppingCriteria`]๋ ์์ฑ์ด ์ธ์ ๋ฉ์ถ์ง๋ฅผ ๊ฒฐ์ ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค (EOS ํ ํฐ ์ธ). ์ด ๊ธฐ๋ฅ์ PyTorch ๊ตฌํ์๋ง ์ ๊ณต๋ฉ๋๋ค.
+
+[[autodoc]] StoppingCriteria
+ - __call__
+
+[[autodoc]] StoppingCriteriaList
+ - __call__
+
+[[autodoc]] MaxLengthCriteria
+ - __call__
+
+[[autodoc]] MaxTimeCriteria
+ - __call__
+
+[[autodoc]] StopStringCriteria
+ - __call__
+
+[[autodoc]] EosTokenCriteria
+ - __call__
+
+## Constraint [[transformers.Constraint]]
+
+[`Constraint`]๋ ์์ฑ ์ถ๋ ฅ์ ํน์ ํ ํฐ์ด๋ ์ํ์ค๋ฅผ ๊ฐ์ ๋ก ํฌํจ์ํค๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค. ์ด ๊ธฐ๋ฅ์ PyTorch ๊ตฌํ์๋ง ์ ๊ณต๋ฉ๋๋ค.
+
+[[autodoc]] Constraint
+
+[[autodoc]] PhrasalConstraint
+
+[[autodoc]] DisjunctiveConstraint
+
+[[autodoc]] ConstraintListState
+
+## ๋น ๊ฒ์ (BeamSearch) [[transformers.BeamScorer]]
+
+[[autodoc]] BeamScorer
+ - process
+ - finalize
+
+[[autodoc]] BeamSearchScorer
+ - process
+ - finalize
+
+[[autodoc]] ConstrainedBeamSearchScorer
+ - process
+ - finalize
+
+## ์คํธ๋ฆฌ๋จธ (Streamers) [[transformers.TextStreamer]]
+
+[[autodoc]] TextStreamer
+
+[[autodoc]] TextIteratorStreamer
+
+## ์บ์ (Caches) [[transformers.Cache]]
+
+[[autodoc]] Cache
+ - update
+
+[[autodoc]] CacheConfig
+ - update
+
+[[autodoc]] QuantizedCacheConfig
+ - validate
+
+[[autodoc]] DynamicCache
+ - update
+ - get_seq_length
+ - reorder_cache
+ - to_legacy_cache
+ - from_legacy_cache
+
+[[autodoc]] QuantizedCache
+ - update
+ - get_seq_length
+
+[[autodoc]] QuantoQuantizedCache
+
+[[autodoc]] HQQQuantizedCache
+
+[[autodoc]] SinkCache
+ - update
+ - get_seq_length
+ - reorder_cache
+
+[[autodoc]] OffloadedCache
+ - update
+ - prefetch_layer
+ - evict_previous_layer
+
+[[autodoc]] StaticCache
+ - update
+ - get_seq_length
+ - reset
+
+[[autodoc]] OffloadedStaticCache
+ - update
+ - get_seq_length
+ - reset
+
+[[autodoc]] HybridCache
+ - update
+ - get_seq_length
+ - reset
+
+[[autodoc]] SlidingWindowCache
+ - update
+ - reset
+
+[[autodoc]] EncoderDecoderCache
+ - get_seq_length
+ - to_legacy_cache
+ - from_legacy_cache
+ - reset
+ - reorder_cache
+
+[[autodoc]] MambaCache
+ - update_conv_state
+ - update_ssm_state
+ - reset
+
+## ์ํฐ๋งํฌ ์ ํธ๋ฆฌํฐ (Watermark Utils) [[transformers.WatermarkDetector]]
+
+[[autodoc]] WatermarkDetector
+ - __call__
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/image_processing_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/image_processing_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..cd32935132af8798cffa646b1c4e987834a617ee
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/image_processing_utils.md
@@ -0,0 +1,47 @@
+
+
+# ์ด๋ฏธ์ง ํ๋ก์ธ์๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ [[utilities-for-image-processors]]
+
+์ด ํ์ด์ง๋ ์ด๋ฏธ์ง ํ๋ก์ธ์์์ ์ฌ์ฉ๋๋ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํ๋ฉฐ, ์ฃผ๋ก ์ด๋ฏธ์ง๋ฅผ ์ฒ๋ฆฌํ๊ธฐ ์ํ ํจ์ ๊ธฐ๋ฐ์ ๋ณํ ์์
๋ค์ ๋ค๋ฃน๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ด๋ฏธ์ง ํ๋ก์ธ์ ์ฝ๋๋ฅผ ์ฐ๊ตฌํ ๋๋ง ์ ์ฉํฉ๋๋ค.
+
+## ์ด๋ฏธ์ง ๋ณํ [[transformers.image_transforms.center_crop]]
+
+[[autodoc]] image_transforms.center_crop
+
+[[autodoc]] image_transforms.center_to_corners_format
+
+[[autodoc]] image_transforms.corners_to_center_format
+
+[[autodoc]] image_transforms.id_to_rgb
+
+[[autodoc]] image_transforms.normalize
+
+[[autodoc]] image_transforms.pad
+
+[[autodoc]] image_transforms.rgb_to_id
+
+[[autodoc]] image_transforms.rescale
+
+[[autodoc]] image_transforms.resize
+
+[[autodoc]] image_transforms.to_pil_image
+
+## ImageProcessingMixin [[transformers.ImageProcessingMixin]]
+
+[[autodoc]] image_processing_utils.ImageProcessingMixin
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/modeling_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/modeling_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..76cc09db292acdcaf3801713f28f19926ac6e314
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/modeling_utils.md
@@ -0,0 +1,83 @@
+
+
+# ์ฌ์ฉ์ ์ ์ ๋ ์ด์ด ๋ฐ ์ ํธ๋ฆฌํฐ [[custom-layers-and-utilities]]
+
+์ด ํ์ด์ง๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ์ฌ์ฉ๋๋ ์ฌ์ฉ์ ์ ์ ๋ ์ด์ด์ ๋ชจ๋ธ๋ง์ ์ํ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํฉ๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ด์ ๋ชจ๋ธ ์ฝ๋๋ฅผ ์ฐ๊ตฌํ ๋๋ง ์ ์ฉํฉ๋๋ค.
+
+
+## PyTorch ์ฌ์ฉ์ ์ ์ ๋ชจ๋ [[transformers.Conv1D]]
+
+[[autodoc]] pytorch_utils.Conv1D
+
+[[autodoc]] modeling_utils.PoolerStartLogits
+ - forward
+
+[[autodoc]] modeling_utils.PoolerEndLogits
+ - forward
+
+[[autodoc]] modeling_utils.PoolerAnswerClass
+ - forward
+
+[[autodoc]] modeling_utils.SquadHeadOutput
+
+[[autodoc]] modeling_utils.SQuADHead
+ - forward
+
+[[autodoc]] modeling_utils.SequenceSummary
+ - forward
+
+## PyTorch ํฌํผ(helper) ํจ์ [[transformers.apply_chunking_to_forward]]
+
+[[autodoc]] pytorch_utils.apply_chunking_to_forward
+
+[[autodoc]] pytorch_utils.find_pruneable_heads_and_indices
+
+[[autodoc]] pytorch_utils.prune_layer
+
+[[autodoc]] pytorch_utils.prune_conv1d_layer
+
+[[autodoc]] pytorch_utils.prune_linear_layer
+
+## TensorFlow ์ฌ์ฉ์ ์ ์ ๋ ์ด์ด [[transformers.modeling_tf_utils.TFConv1D]]
+
+[[autodoc]] modeling_tf_utils.TFConv1D
+
+[[autodoc]] modeling_tf_utils.TFSequenceSummary
+
+## TensorFlow ์์ค ํจ์ [[transformers.modeling_tf_utils.TFCausalLanguageModelingLoss]]
+
+[[autodoc]] modeling_tf_utils.TFCausalLanguageModelingLoss
+
+[[autodoc]] modeling_tf_utils.TFMaskedLanguageModelingLoss
+
+[[autodoc]] modeling_tf_utils.TFMultipleChoiceLoss
+
+[[autodoc]] modeling_tf_utils.TFQuestionAnsweringLoss
+
+[[autodoc]] modeling_tf_utils.TFSequenceClassificationLoss
+
+[[autodoc]] modeling_tf_utils.TFTokenClassificationLoss
+
+## TensorFlow ๋์ฐ๋ฏธ ํจ์ [[transformers.modeling_tf_utils.get_initializer]]
+
+[[autodoc]] modeling_tf_utils.get_initializer
+
+[[autodoc]] modeling_tf_utils.keras_serializable
+
+[[autodoc]] modeling_tf_utils.shape_list
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/pipelines_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/pipelines_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..e0e64913145541cc4381df0562861c2b364f1cf2
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/pipelines_utils.md
@@ -0,0 +1,43 @@
+
+
+# ํ์ดํ๋ผ์ธ์ ์ํ ์ ํธ๋ฆฌํฐ [[utilities-for-pipelines]]
+
+์ด ํ์ด์ง๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ํ์ดํ๋ผ์ธ์ ์ํด ์ ๊ณตํ๋ ๋ชจ๋ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํฉ๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ด ๋ชจ๋ธ์ ์ฝ๋๋ฅผ ์ฐ๊ตฌํ ๋๋ง ์ ์ฉํฉ๋๋ค.
+
+## ์ธ์ ์ฒ๋ฆฌ [[transformers.pipelines.ArgumentHandler]]
+
+[[autodoc]] pipelines.ArgumentHandler
+
+[[autodoc]] pipelines.ZeroShotClassificationArgumentHandler
+
+[[autodoc]] pipelines.QuestionAnsweringArgumentHandler
+
+## ๋ฐ์ดํฐ ํ์ [[transformers.PipelineDataFormat]]
+
+[[autodoc]] pipelines.PipelineDataFormat
+
+[[autodoc]] pipelines.CsvPipelineDataFormat
+
+[[autodoc]] pipelines.JsonPipelineDataFormat
+
+[[autodoc]] pipelines.PipedPipelineDataFormat
+
+## ์ ํธ๋ฆฌํฐ [[transformers.pipelines.PipelineException]]
+
+[[autodoc]] pipelines.PipelineException
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/time_series_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/time_series_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..5729924575b87332223aa5db6c56b6735777b4db
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/time_series_utils.md
@@ -0,0 +1,29 @@
+
+
+# ์๊ณ์ด ์ ํธ๋ฆฌํฐ [[time-series-utilities]]
+
+์ด ํ์ด์ง๋ ์๊ณ์ด ๊ธฐ๋ฐ ๋ชจ๋ธ์์ ์ฌ์ฉํ ์ ์๋ ์ ํธ๋ฆฌํฐ ํจ์์ ํด๋์ค๋ค์ ๋์ดํฉ๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ์๊ณ์ด ๋ชจ๋ธ์ ์ฝ๋๋ฅผ ์ฐ๊ตฌํ๊ฑฐ๋ ๋ถํฌ ์ถ๋ ฅ ํด๋์ค์ ์ปฌ๋ ์
์ ์ถ๊ฐํ๋ ค๋ ๊ฒฝ์ฐ์๋ง ์ ์ฉํฉ๋๋ค.
+
+## ๋ถํฌ ์ถ๋ ฅ (Distributional Output) [[transformers.time_series_utils.NormalOutput]]
+
+[[autodoc]] time_series_utils.NormalOutput
+
+[[autodoc]] time_series_utils.StudentTOutput
+
+[[autodoc]] time_series_utils.NegativeBinomialOutput
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/tokenization_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/tokenization_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..b5b69910479a2fb42aeaf4d8bd366967ea9f53e7
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/tokenization_utils.md
@@ -0,0 +1,39 @@
+
+
+# ํ ํฌ๋์ด์ ๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ [[utilities-for-tokenizers]]
+
+์ด ํ์ด์ง๋ ํ ํฌ๋์ด์ ์์ ์ฌ์ฉ๋๋ ๋ชจ๋ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํ๋ฉฐ, ์ฃผ๋ก [`PreTrainedTokenizer`]์ [`PreTrainedTokenizerFast`] ์ฌ์ด์ ๊ณตํต ๋ฉ์๋๋ฅผ ๊ตฌํํ๋ [`~tokenization_utils_base.PreTrainedTokenizerBase`] ํด๋์ค์ [`~tokenization_utils_base.SpecialTokensMixin`]์ ๋ค๋ฃน๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ํ ํฌ๋์ด์ ์ฝ๋๋ฅผ ์ฐ๊ตฌํ ๋๋ง ์ ์ฉํฉ๋๋ค.
+
+## PreTrainedTokenizerBase [[transformers.PreTrainedTokenizerBase]]
+
+[[autodoc]] tokenization_utils_base.PreTrainedTokenizerBase
+ - __call__
+ - all
+
+## SpecialTokensMixin [[transformers.SpecialTokensMixin]]
+
+[[autodoc]] tokenization_utils_base.SpecialTokensMixin
+
+## Enums ๋ฐ namedtuples [[transformers.tokenization_utils_base.TruncationStrategy]]
+
+[[autodoc]] tokenization_utils_base.TruncationStrategy
+
+[[autodoc]] tokenization_utils_base.CharSpan
+
+[[autodoc]] tokenization_utils_base.TokenSpan
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/trainer_utils.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/trainer_utils.md
new file mode 100644
index 0000000000000000000000000000000000000000..15fb457331811c6b8cfce23a53766057e816a058
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/internal/trainer_utils.md
@@ -0,0 +1,49 @@
+
+
+# Trainer๋ฅผ ์ํ ์ ํธ๋ฆฌํฐ (Utilities for Trainer) [[utilities-for-trainer]]
+
+์ด ํ์ด์ง๋ [`Trainer`]์์ ์ฌ์ฉ๋๋ ๋ชจ๋ ์ ํธ๋ฆฌํฐ ํจ์๋ค์ ๋์ดํฉ๋๋ค.
+
+์ด ํจ์๋ค ๋๋ถ๋ถ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์๋ Trainer ์ฝ๋๋ฅผ ์์ธํ ์์๋ณด๊ณ ์ถ์ ๋๋ง ์ ์ฉํฉ๋๋ค.
+
+## ์ ํธ๋ฆฌํฐ (Utilities) [[transformers.EvalPrediction]]
+
+[[autodoc]] EvalPrediction
+
+[[autodoc]] IntervalStrategy
+
+[[autodoc]] enable_full_determinism
+
+[[autodoc]] set_seed
+
+[[autodoc]] torch_distributed_zero_first
+
+## ์ฝ๋ฐฑ ๋ด๋ถ (Callbacks internals) [[transformers.trainer_callback.CallbackHandler]]
+
+[[autodoc]] trainer_callback.CallbackHandler
+
+## ๋ถ์ฐ ํ๊ฐ (Distributed Evaluation) [[transformers.trainer_pt_utils.DistributedTensorGatherer]]
+
+[[autodoc]] trainer_pt_utils.DistributedTensorGatherer
+
+## Trainer ์ธ์ ํ์ (Trainer Argument Parser) [[transformers.HfArgumentParser]]
+
+[[autodoc]] HfArgumentParser
+
+## ๋๋ฒ๊ทธ ์ ํธ๋ฆฌํฐ (Debug Utilities) [[transformers.debug_utils.DebugUnderflowOverflow]]
+
+[[autodoc]] debug_utils.DebugUnderflowOverflow
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_optims.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_optims.md
new file mode 100644
index 0000000000000000000000000000000000000000..99eabc19ce860aa78531e6bf4f0e8c1ca6f43f6e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_optims.md
@@ -0,0 +1,410 @@
+
+
+# LLM ์ถ๋ก ์ต์ ํ [[llm-inference-optimization]]
+
+๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ(LLM)์ ์ฑํ
๋ฐ ์ฝ๋ ์์ฑ ๋ชจ๋ธ๊ณผ ๊ฐ์ ํ
์คํธ ์์ฑ ์์ฉ ํ๋ก๊ทธ๋จ์ ํ ๋จ๊ณ ๋์ด์ฌ๋ฆฌ๋ฉฐ, ๋์ ์์ค์ ์ดํด๋ ฅ๊ณผ ์ ์ฐฝํจ์ ๋ณด์ฌ์ฃผ๋ ํ
์คํธ๋ฅผ ์์ฑํฉ๋๋ค. ๊ทธ๋ฌ๋ LLM์ ๊ฐ๋ ฅํ๊ฒ ๋ง๋๋ ์์์ธ ๊ทธ๋ค์ ํฌ๊ธฐ๋ ๋์์ ์ถ๋ก ๊ณผ์ ์์ ๋์ ๊ณผ์ ๊ฐ ๋๊ธฐ๋ ํฉ๋๋ค.
+
+๊ธฐ๋ณธ์ ์ธ ์ถ๋ก ์ ๋๋ฆฝ๋๋ค, ์๋ํ๋ฉด LLM์ด ๋ค์ ํ ํฐ์ ์์ฑํ๊ธฐ ์ํด ๋ฐ๋ณต์ ์ผ๋ก ํธ์ถ๋์ด์ผ ํ๊ธฐ ๋๋ฌธ์
๋๋ค. ์์ฑ์ด ์งํ๋จ์ ๋ฐ๋ผ ์
๋ ฅ ์ํ์ค๊ฐ ๊ธธ์ด์ ธ ์ฒ๋ฆฌ ์๊ฐ์ด ์ ์ ๊ธธ์ด์ง๋๋ค. ๋ํ, LLM์ ์์ญ์ต ๊ฐ์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง๊ณ ์์ด ๋ชจ๋ ๊ฐ์ค์น๋ฅผ ๋ฉ๋ชจ๋ฆฌ์ ์ ์ฅํ๊ณ ์ฒ๋ฆฌํ๋ ๋ฐ ์ด๋ ค์์ด ์์ต๋๋ค.
+
+์ด ๊ฐ์ด๋๋ LLM ์ถ๋ก ์ ๊ฐ์ํ๊ธฐ ์ํด Transformers์์ ์ฌ์ฉํ ์ ์๋ ์ต์ ํ ๊ธฐ์ ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค.
+
+> [!TIP]
+> Hugging Face๋ LLM์ ์ถ๋ก ์ ์ต์ ํํ์ฌ ๋ฐฐํฌํ๊ณ ์๋น์คํ๋ ๋ฐ ์ ๋
ํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ธ [Text Generation Inference (TGI)](https://hf.co/docs/text-generation-inference)์ ์ ๊ณตํฉ๋๋ค. ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ์ฒ๋ฆฌ๋ ์ฆ๊ฐ๋ฅผ ์ํ ์ง์์ ์ธ ๋ฐฐ์นญ๊ณผ ๋ค์ค GPU ์ถ๋ก ์ ์ํ ํ
์ ๋ณ๋ ฌํ์ ๊ฐ์ Transformers์ ํฌํจ๋์ง ์์ ๋ฐฐํฌ ์งํฅ ์ต์ ํ ๊ธฐ๋ฅ์ ํฌํจํฉ๋๋ค.
+
+## ์ ์ kv-cache์ `torch.compile`[[static-kv-cache-and-torchcompile]]
+
+๋์ฝ๋ฉ ์ค์ LLM์ ๊ฐ ์
๋ ฅ ํ ํฐ์ ๋ํ key-value(kv) ๊ฐ์ ๊ณ์ฐํฉ๋๋ค. LLM์ ์๊ธฐํ๊ท(autoregressive)์ด๊ธฐ ๋๋ฌธ์ ์์ฑ๋ ์ถ๋ ฅ์ด ํ์ฌ ์
๋ ฅ์ ์ผ๋ถ๊ฐ ๋์ด ๋งค๋ฒ ๋์ผํ kv ๊ฐ์ ๊ณ์ฐํฉ๋๋ค. ์ด๋ ๋งค๋ฒ ๋์ผํ kv ๊ฐ์ ๋ค์ ๊ณ์ฐํ๊ธฐ ๋๋ฌธ์ ํจ์จ์ ์ด์ง ์์ต๋๋ค.
+
+์ด๋ฅผ ์ต์ ํํ๊ธฐ ์ํด, ์ด์ ํค(key)์ ๊ฐ(value)์ ์ฌ๊ณ์ฐํ์ง ์๊ณ ์ ์ฅํ๋ kv-cache๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ kv-cache๋ ๊ฐ ์์ฑ ๋จ๊ณ์์ ์ฆ๊ฐํ๋ฉฐ ๋์ ์ด๊ธฐ ๋๋ฌธ์ PyTorch ์ฝ๋๋ฅผ ๋น ๋ฅด๊ณ ์ต์ ํ๋ ์ปค๋๋ก ํตํฉํ๋ ๊ฐ๋ ฅํ ์ต์ ํ ๋๊ตฌ์ธ [`torch.compile`](./perf_torch_compile)์ ์ฌ์ฉํ๋ ๋ฐ ์ ์ฝ์ด ์์ต๋๋ค.
+
+*์ ์ kv-cache*๋ ์ต๋๊ฐ์ ๋ฏธ๋ฆฌ ํ ๋นํ์ฌ ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ฌ `torch.compile`๊ณผ ๊ฒฐํฉํ ์ ์๊ฒ ํฉ๋๋ค. ์ด๋ฅผ ํตํด ์ต๋ 4๋ฐฐ์ ์๋ ํฅ์์ด ๊ฐ๋ฅํฉ๋๋ค. ์๋ ํฅ์์ ๋ชจ๋ธ ํฌ๊ธฐ(๋ ํฐ ๋ชจ๋ธ์ ์๋ ํฅ์์ด ์ ์)์ ํ๋์จ์ด์ ๋ฐ๋ผ ๋ค๋ฅผ ์ ์์ต๋๋ค.
+
+> [!WARNING]
+ํ์ฌ [Llama](./model_doc/llama2) ๋ฐ ๋ช ๊ฐ์ง ๋ค๋ฅธ ๋ชจ๋ธ๋ง ์ ์ kv-cache์ `torch.compile`์ ์ง์ํฉ๋๋ค. ์ค์๊ฐ ๋ชจ๋ธ ํธํ์ฑ ๋ชฉ๋ก์ [์ด ์ด์](https://github.com/huggingface/transformers/issues/28981)๋ฅผ ํ์ธํ์ญ์์ค.
+
+์์
์ ๋ณต์ก์ฑ์ ๋ฐ๋ผ ์ธ ๊ฐ์ง ๋ฐฉ์์ ์ ์ kv-cache ์ฌ์ฉ ๋ฐฉ๋ฒ์ด ์์ต๋๋ค:
+1. ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ: `generation_config`์์ ํ๋๊ทธ๋ฅผ ์ค์ ํ๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค(๊ถ์ฅ);
+2. ๊ณ ๊ธ ์ฌ์ฉ๋ฒ: ์ฌ๋ฌ ๋ฒ์ ์์ฑ์ด๋ ๋ง์ถคํ ์์ฑ ๋ฃจํ๋ฅผ ์ํด ์บ์ ๊ฐ์ฒด๋ฅผ ์ฒ๋ฆฌํฉ๋๋ค;
+3. ๊ณ ๊ธ ์ฌ์ฉ๋ฒ: ๋จ์ผ ๊ทธ๋ํ๊ฐ ํ์ํ ๊ฒฝ์ฐ, ์ ์ฒด `generate` ํจ์๋ฅผ ํ๋์ ๊ทธ๋ํ๋ก ์ปดํ์ผํฉ๋๋ค.
+
+์ฌ๋ฐ๋ฅธ ํญ์ ์ ํํ์ฌ ๊ฐ ๋ฐฉ๋ฒ์ ๋ํ ์ถ๊ฐ ์ง์นจ์ ํ์ธํ์ธ์.
+
+> [!TIP]
+> `torch.compile`์ ์ฌ์ฉํ ๋ ์ด๋ค ์ ๋ต์ ์ฌ์ฉํ๋ , LLM ์
๋ ฅ์ ์ ํ๋ ๊ฐ ์ธํธ๋ก ์ผ์ชฝ์ ํจ๋ฉํ๋ฉด ๋ชจ์๊ณผ ๊ด๋ จ๋ ์ฌ์ปดํ์ผ์ ํผํ ์ ์์ต๋๋ค. [`pad_to_multiple_of` tokenizer flag](https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.PreTrainedTokenizer.__call__.pad_to_multiple_of)๊ฐ ์ ์ฉํ ๊ฒ์
๋๋ค!
+
+
+
+
+์ด ์์ ์์๋ [Gemma](https://hf.co/google/gemma-2b) ๋ชจ๋ธ์ ์ฌ์ฉํด ๋ณด๊ฒ ์ต๋๋ค. ํ์ํ ์์
์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+1. ๋ชจ๋ธ์ `generation_config` ์์ฑ์ ์ ๊ทผํ์ฌ `cache_implementation`์ "static"์ผ๋ก ์ค์ ํฉ๋๋ค;
+2. ๋ชจ๋ธ์ `forward` ํจ์ค๋ฅผ ์ ์ kv-cache์ ํจ๊ป ์ปดํ์ผํ๊ธฐ ์ํด `torch.compile`์ ํธ์ถํฉ๋๋ค.
+
+์ด๋ ๊ฒ ํ๋ฉด ๋์
๋๋ค!
+
+```py
+from transformers import AutoTokenizer, AutoModelForCausalLM
+import torch
+import os
+os.environ["TOKENIZERS_PARALLELISM"] = "false" # ๊ธด ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด ์ค์ :)
+
+tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b")
+model = AutoModelForCausalLM.from_pretrained("google/gemma-2b", device_map="auto")
+
+model.generation_config.cache_implementation = "static"
+
+model.forward = torch.compile(model.forward, mode="reduce-overhead", fullgraph=True)
+input_text = "The theory of special relativity states "
+input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+outputs = model.generate(**input_ids)
+print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+['The theory of special relativity states 1. The speed of light is constant in all inertial reference']
+```
+
+`generate` ํจ์๋ ๋ด๋ถ์ ์ผ๋ก ๋์ผํ ์บ์ ๊ฐ์ฒด๋ฅผ ์ฌ์ฌ์ฉํ๋ ค๊ณ ์๋ํ๋ฉฐ, ์ด๋ฅผ ํตํด ๊ฐ ํธ์ถ ์ ์ฌ์ปดํ์ผ์ ํ์์ฑ์ ์ ๊ฑฐํฉ๋๋ค. ์ฌ์ปดํ์ผ์ ํผํ๋ ๊ฒ์ `torch.compile`์ ์ฑ๋ฅ์ ์ต๋ํ ํ์ฉํ๋ ๋ฐ ๋งค์ฐ ์ค์ํ๋ฉฐ, ๋ค์ ์ฌํญ์ ์ ์ํด์ผ ํฉ๋๋ค:
+1. ๋ฐฐ์น ํฌ๊ธฐ๊ฐ ๋ณ๊ฒฝ๋๊ฑฐ๋ ํธ์ถ ๊ฐ ์ต๋ ์ถ๋ ฅ ๊ธธ์ด๊ฐ ์ฆ๊ฐํ๋ฉด ์บ์๋ฅผ ๋ค์ ์ด๊ธฐํํด์ผ ํ๋ฉฐ, ์ด๋ก ์ธํด ์๋ก ์ปดํ์ผ์ ํด์ผ ํฉ๋๋ค;
+2. ์ปดํ์ผ๋ ํจ์์ ์ฒซ ๋ช ๋ฒ์ ํธ์ถ์ ํจ์๊ฐ ์ปดํ์ผ๋๋ ๋์ ๋ ๋๋ฆฝ๋๋ค.
+
+> [!WARNING]
+> ๋ค์ค ํด ๋ํ์ ๊ฐ์ ์ ์ ์บ์์ ๊ณ ๊ธ ์ฌ์ฉ์ ์ํด์๋, ์บ์ ๊ฐ์ฒด๋ฅผ [`~GenerationMixin.generate`] ์ธ๋ถ์์ ์ธ์คํด์คํํ๊ณ ์กฐ์ํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ๊ณ ๊ธ ์ฌ์ฉ๋ฒ ํญ์ ์ฐธ์กฐํ์ธ์.
+
+
+
+
+[`StaticCache`] ๊ฐ์ฒด๋ `past_key_values` ์ธ์๋ก ๋ชจ๋ธ์ [`~GenerationMixin.generate`] ํจ์์ ์ ๋ฌํ ์ ์์ต๋๋ค. ์ด ๊ฐ์ฒด๋ ์บ์ ๋ด์ฉ์ ์ ์งํ๋ฏ๋ก, ๋์ ์บ์๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ฒ๋ผ ์๋ก์ด [`~GenerationMixin.generate`] ํธ์ถ์ ์ด๋ฅผ ์ ๋ฌํ์ฌ ์์ฑ์ ๊ณ์ํ ์ ์์ต๋๋ค.
+
+```py
+from transformers import AutoTokenizer, AutoModelForCausalLM, StaticCache
+import torch
+import os
+os.environ["TOKENIZERS_PARALLELISM"] = "false" # ๊ธด ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด ์ค์ :)
+
+tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b")
+model = AutoModelForCausalLM.from_pretrained("google/gemma-2b", device_map="auto")
+
+model.forward = torch.compile(model.forward, mode="reduce-overhead", fullgraph=True)
+input_text = "The theory of special relativity states "
+input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
+prompt_length = input_ids.input_ids.shape[1]
+model.generation_config.max_new_tokens = 16
+
+past_key_values = StaticCache(
+ config=model.config,
+ batch_size=1,
+ # ์บ์๋ฅผ ์ฌ์ฌ์ฉํ ๊ณํ์ด ์๋ ๊ฒฝ์ฐ, ๋ชจ๋ ๊ฒฝ์ฐ์ ์ถฉ๋ถํ ์บ์ ๊ธธ์ด๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค
+ max_cache_len=prompt_length+(model.generation_config.max_new_tokens*2),
+ device=model.device,
+ dtype=model.dtype
+)
+outputs = model.generate(**input_ids, past_key_values=past_key_values)
+print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+['The theory of special relativity states 1. The speed of light is constant in all inertial reference frames. 2']
+
+# ์์ฑ๋ ํ
์คํธ์ ๋์ผํ ์บ์ ๊ฐ์ฒด๋ฅผ ์ ๋ฌํ์ฌ, ์ค๋จํ ๊ณณ์์ ์์ฑ์ ๊ณ์ํฉ๋๋ค.
+# ๋ค์ค ํด ๋ํ์ ๊ฒฝ์ฐ, ์์ฑ๋ ํ
์คํธ์ ์๋ก์ด ์ฌ์ฉ์ ์
๋ ฅ์ ์ถ๊ฐํ ์ ์์ต๋๋ค.
+new_input_ids = outputs
+outputs = model.generate(new_input_ids, past_key_values=past_key_values)
+print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+['The theory of special relativity states 1. The speed of light is constant in all inertial reference frames. 2. The speed of light is constant in all inertial reference frames. 3.']
+```
+
+> [!TIP]
+> ๋์ผํ [`StaticCache`] ๊ฐ์ฒด๋ฅผ ์๋ก์ด ํ๋กฌํํธ์ ์ฌ์ฉํ๋ ค๋ฉด, ํธ์ถ ๊ฐ์ `.reset()` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ๊ทธ ๋ด์ฉ์ ์ด๊ธฐํํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+๋ ๊น์ด ๋ค์ด๊ฐ๊ณ ์ถ๋ค๋ฉด, [`StaticCache`] ๊ฐ์ฒด๋ฅผ ๋ชจ๋ธ์ `forward` ํจ์ค์ ๋์ผํ `past_key_values` ์ธ์๋ก ์ ๋ฌํ ์๋ ์์ต๋๋ค. ์ด ์ ๋ต์ ์ฌ์ฉํ๋ฉด, ํ์ฌ ํ ํฐ๊ณผ ์ด์ ์ ์์ฑ๋ ํ ํฐ์ ์์น ๋ฐ ์บ์ ์์น๋ฅผ ๋ฐํ์ผ๋ก ๋ค์ ํ ํฐ์ ๋์ฝ๋ฉํ๋ ์์ฒด ํจ์๋ฅผ ์์ฑํ ์ ์์ต๋๋ค.
+
+```py
+from transformers import LlamaTokenizer, LlamaForCausalLM, StaticCache, logging
+from transformers.testing_utils import CaptureLogger
+import torch
+
+prompts = [
+ "Simply put, the theory of relativity states that ",
+ "My favorite all time favorite condiment is ketchup.",
+]
+
+NUM_TOKENS_TO_GENERATE = 40
+torch_device = "cuda"
+
+tokenizer = LlamaTokenizer.from_pretrained("meta-llama/Llama-2-7b-hf", pad_token="", padding_side="right")
+model = LlamaForCausalLM.from_pretrained("meta-llama/Llama-2-7b-hf", device_map="sequential")
+inputs = tokenizer(prompts, return_tensors="pt", padding=True).to(model.device)
+
+def decode_one_tokens(model, cur_token, input_pos, cache_position, past_key_values):
+ logits = model(
+ cur_token,
+ position_ids=input_pos,
+ cache_position=cache_position,
+ past_key_values=past_key_values,
+ return_dict=False,
+ use_cache=True
+ )[0]
+ new_token = torch.argmax(logits[:, -1], dim=-1)[:, None]
+ return new_token
+```
+
+`StaticCache` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ kv-cache์ `torch.compile`์ ํ์ฑํํ๋ ค๋ฉด ๋ช ๊ฐ์ง ์ค์ํ ์์
์ ์ํํด์ผ ํฉ๋๋ค:
+1. ์ถ๋ก ์ ๋ชจ๋ธ์ ์ฌ์ฉํ๊ธฐ ์ ์ [`StaticCache`] ์ธ์คํด์ค๋ฅผ ์ด๊ธฐํํฉ๋๋ค. ์ฌ๊ธฐ์ ์ต๋ ๋ฐฐ์น ํฌ๊ธฐ์ ์ํ์ค ๊ธธ์ด์ ๊ฐ์ ๋งค๊ฐ๋ณ์๋ฅผ ์ค์ ํ ์ ์์ต๋๋ค.
+2. ์ ์ kv-cache์ ํจ๊ป ์์ ํ๋ฅผ ์ปดํ์ผํ๊ธฐ ์ํด ๋ชจ๋ธ์ `torch.compile`์ ํธ์ถํฉ๋๋ค.
+3. [torch.backends.cuda.sdp_kernel](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html) ์ปจํ
์คํธ ๊ด๋ฆฌ์์์ `enable_math=True`๋ฅผ ์ค์ ํ์ฌ ๋ค์ดํฐ๋ธ PyTorch C++ ๊ตฌํ๋ ์ค์ผ์ผ๋ ์ ๊ณฑ ์ดํ
์
(scaled dot product attention)์ ํ์ฑํํ์ฌ ์ถ๋ก ์๋๋ฅผ ๋์ฑ ๋์
๋๋ค.
+
+```py
+batch_size, seq_length = inputs["input_ids"].shape
+with torch.no_grad():
+ past_key_values = StaticCache(
+ config=model.config, max_batch_size=2, max_cache_len=4096, device=torch_device, dtype=model.dtype
+ )
+ cache_position = torch.arange(seq_length, device=torch_device)
+ generated_ids = torch.zeros(
+ batch_size, seq_length + NUM_TOKENS_TO_GENERATE + 1, dtype=torch.int, device=torch_device
+ )
+ generated_ids[:, cache_position] = inputs["input_ids"].to(torch_device).to(torch.int)
+
+ logits = model(
+ **inputs, cache_position=cache_position, past_key_values=past_key_values,return_dict=False, use_cache=True
+ )[0]
+ next_token = torch.argmax(logits[:, -1], dim=-1)[:, None]
+ generated_ids[:, seq_length] = next_token[:, 0]
+
+ decode_one_tokens = torch.compile(decode_one_tokens, mode="reduce-overhead", fullgraph=True)
+ cache_position = torch.tensor([seq_length + 1], device=torch_device)
+ for _ in range(1, NUM_TOKENS_TO_GENERATE):
+ with torch.backends.cuda.sdp_kernel(enable_flash=False, enable_mem_efficient=False, enable_math=True):
+ next_token = decode_one_tokens(model, next_token.clone(), None, cache_position, past_key_values)
+ generated_ids[:, cache_position] = next_token.int()
+ cache_position += 1
+
+text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
+text
+['Simply put, the theory of relativity states that 1) the speed of light is constant, 2) the speed of light is the same for all observers, and 3) the laws of physics are the same for all observers.',
+ 'My favorite all time favorite condiment is ketchup. I love it on everything. I love it on my eggs, my fries, my chicken, my burgers, my hot dogs, my sandwiches, my salads, my p']
+```
+
+
+
+
+์ ์ฒด `generate` ํจ์๋ฅผ ์ปดํ์ผํ๋ ๊ฒ์ ์ฝ๋ ์ธก๋ฉด์์ ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ๋ณด๋ค ๋ ๊ฐ๋จํฉ๋๋ค. `generate` ํจ์์ ๋ํด `torch.compile`์ ํธ์ถํ์ฌ ์ ์ฒด ํจ์๋ฅผ ์ปดํ์ผํ๋ฉด ๋ฉ๋๋ค. ์ ์ ์บ์์ ์ฌ์ฉ์ ์ง์ ํ ํ์๋ ์์ต๋๋ค. ์ ์ ์บ์๋ ํธํ๋์ง๋ง, ๋ฒค์น๋งํฌ์์๋ ๋์ ์บ์(๊ธฐ๋ณธ ์ค์ )๊ฐ ๋ ๋น ๋ฅธ ๊ฒ์ผ๋ก ๋ํ๋ฌ์ต๋๋ค.
+
+```py
+from transformers import AutoTokenizer, AutoModelForCausalLM
+import torch
+import os
+os.environ["TOKENIZERS_PARALLELISM"] = "false" # ๊ธด ๊ฒฝ๊ณ ๋ฉ์์ง๋ฅผ ๋ฐฉ์งํ๊ธฐ ์ํด ์ค์ :)
+
+tokenizer = AutoTokenizer.from_pretrained("google/gemma-2b")
+model = AutoModelForCausalLM.from_pretrained("google/gemma-2b", device_map="auto")
+
+model.generate = torch.compile(model.generate, mode="reduce-overhead", fullgraph=True)
+input_text = "The theory of special relativity states "
+input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
+
+outputs = model.generate(**input_ids)
+print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+['The theory of special relativity states 1. The speed of light is constant in all inertial reference']
+```
+
+์ด ๋ฐฉ๋ฒ์ ํตํด ๋ชจ๋ธ์ forward ํจ์ค๋ฟ๋ง ์๋๋ผ, ์
๋ ฅ ์ค๋น, logit ์ฒ๋ฆฌ๊ธฐ ์์
๋ฑ์ ํฌํจํ ๋ชจ๋ ๊ฒ์ ์ปดํ์ผํฉ๋๋ค. ๊ธฐ๋ณธ ์ฌ์ฉ ์์ ์ ๋นํด `generate` ํธ์ถ์ด ์ฝ๊ฐ ๋ ๋น ๋ฅผ ์ ์์ผ๋ฉฐ, ์ปดํ์ผ๋ ๊ทธ๋ํ๋ ๋ ํน์ดํ ํ๋์จ์ด ์ฅ์น๋ ์ฌ์ฉ ์ฌ๋ก์ ์ ํฉํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด ์ ๊ทผ ๋ฐฉ์์ ์ฌ์ฉํ๋ ๋ฐ๋ ๋ช ๊ฐ์ง ํฐ ๋จ์ ์ด ์์ต๋๋ค:
+1. ์ปดํ์ผ ์๋๊ฐ ํจ์ฌ ๋๋ฆฝ๋๋ค;
+2. `generate`์ ๋ชจ๋ ๋งค๊ฐ๋ณ์ ์ค์ ์ `generation_config`๋ฅผ ํตํด์๋ง ๊ฐ๋ฅํฉ๋๋ค;
+3. ๋ง์ ๊ฒฝ๊ณ ์ ์์ธ๊ฐ ์ต์ ๋ฉ๋๋ค. -- ๋จผ์ ์ปดํ์ผ ๋์ง ์์ ํํ๋ก ํ
์คํธํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค;
+4. ํ์ฌ ์์
์ค์ด์ง๋ง ๊ธฐ๋ฅ ์ ํ์ด ์ฌํฉ๋๋ค(์: ์์ฑ ์์ ์์๋ EOS ํ ํฐ์ด ์ ํ๋์ด๋ ์์ฑ์ด ์ค๋จ๋์ง ์์ต๋๋ค).
+
+
+
+
+## ์ถ์ ๋์ฝ๋ฉ [[speculative-decoding]]
+
+> [!TIP]
+> ๋ณด๋ค ์ฌ์ธต์ ์ธ ์ค๋ช
์ ์ํ๋ค๋ฉด, [Assisted Generation: a new direction toward low-latency text generation](https://hf.co/blog/assisted-generation) ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ํ์ธํ์ญ์์ค!
+
+์๊ธฐ ํ๊ท์ ๋ ๋ค๋ฅธ ๋ฌธ์ ๋ ๊ฐ ์
๋ ฅ ํ ํฐ์ ๋ํด ์์ ํ ์ค์ ๋ชจ๋ธ ๊ฐ์ค์น๋ฅผ ๋งค๋ฒ ๋ก๋ํด์ผ ํ๋ค๋ ์ ์
๋๋ค. ์ด๋ ์์ญ์ต ๊ฐ์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง LLM์๋ ๋๋ฆฌ๊ณ ๋ฒ๊ฑฐ๋กญ์ต๋๋ค. ์ถ์ ๋์ฝ๋ฉ(speculative decoding)์ ๋ ์๊ณ ๋น ๋ฅธ ๋ณด์กฐ ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ํ๋ณด ํ ํฐ์ ์์ฑํ๊ณ , ์ด๋ฅผ ํฐ LLM์ด ๋จ์ผ ์์ ํ์์ ๊ฒ์ฆํ์ฌ ์ด ์๋ ์ ํ๋ฅผ ์ํํฉ๋๋ค. ๊ฒ์ฆ๋ ํ ํฐ์ด ์ ํํ๋ค๋ฉด, LLM์ ๋ณธ๋ ์์ฒด์ ์ผ๋ก ์์ฑํ๋ ๊ฒ์ฒ๋ผ ํ ํฐ์ ์ป์ ์ ์์ต๋๋ค. ์ ๋ฐฉ ํจ์ค๊ฐ ๋์ผํ ์ถ๋ ฅ์ ๋ณด์ฅํ๊ธฐ ๋๋ฌธ์ ์ ํ๋ ์ ํ๊ฐ ์์ต๋๋ค.
+
+๊ฐ์ฅ ํฐ ์๋ ํฅ์์ ์ป๊ธฐ ์ํด, ๋ณด์กฐ ๋ชจ๋ธ์ ๋น ๋ฅด๊ฒ ํ ํฐ์ ์์ฑํ ์ ์๋๋ก LLM๋ณด๋ค ํจ์ฌ ์์์ผ ํฉ๋๋ค. ๋ณด์กฐ ๋ชจ๋ธ๊ณผ LLM ๋ชจ๋ธ์ ํ ํฐ์ ๋ค์ ์ธ์ฝ๋ฉํ๊ณ ๋์ฝ๋ฉํ์ง ์๋๋ก ๋์ผํ ํ ํฌ๋์ด์ ๋ฅผ ๊ณต์ ํด์ผ ํฉ๋๋ค.
+
+> [!WARNING]
+> ์ถ์ ๋์ฝ๋ฉ์ ํ์ ๊ฒ์๊ณผ ์ํ๋ง ๋์ฝ๋ฉ ์ ๋ต์์๋ง ์ง์๋๋ฉฐ, ๋ฐฐ์น ์
๋ ฅ์ ์ง์ํ์ง ์์ต๋๋ค.
+
+๋ณด์กฐ ๋ชจ๋ธ์ ๋ก๋ํ๊ณ ์ด๋ฅผ [`~GenerationMixin.generate`] ๋ฉ์๋์ ์ ๋ฌํ์ฌ ์ถ์ ๋์ฝ๋ฉ์ ํ์ฑํํ์ญ์์ค.
+
+
+
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+import torch
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b")
+inputs = tokenizer("Einstein's theory of relativity states", return_tensors="pt").to(device)
+
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-1.3b").to(device)
+assistant_model = AutoModelForCausalLM.from_pretrained("facebook/opt-125m").to(device)
+outputs = model.generate(**inputs, assistant_model=assistant_model)
+tokenizer.batch_decode(outputs, skip_special_tokens=True)
+["Einstein's theory of relativity states that the speed of light is constant. "]
+```
+
+
+
+
+์ถ์ ์ํ๋ง ๋์ฝ๋ฉ(speculative sampling decoding)์ ์ํด, ๋ณด์กฐ ๋ชจ๋ธ ์ธ์๋ [`~GenerationMixin.generate`] ๋ฉ์๋์ `do_sample` ๋ฐ `temperature` ๋งค๊ฐ๋ณ์๋ฅผ ์ถ๊ฐํ์ญ์์ค.
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+import torch
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b")
+inputs = tokenizer("Einstein's theory of relativity states", return_tensors="pt").to(device)
+
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-1.3b").to(device)
+assistant_model = AutoModelForCausalLM.from_pretrained("facebook/opt-125m").to(device)
+outputs = model.generate(**inputs, assistant_model=assistant_model, do_sample=True, temperature=0.7)
+print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+["Einstein's theory of relativity states that motion in the universe is not a straight line.\n"]
+```
+
+
+
+
+### ํ๋กฌํํธ ์กฐํ ๋์ฝ๋ฉ [[prompt-lookup-decoding]]
+
+ํ๋กฌํํธ ์กฐํ ๋์ฝ๋ฉ์ ํ์ ๊ฒ์๊ณผ ์ํ๋ง๊ณผ๋ ํธํ๋๋ ์ถ์ ๋์ฝ๋ฉ์ ๋ณํ์
๋๋ค. ํ๋กฌํํธ ์กฐํ๋ ์์ฝ๊ณผ ๊ฐ์ ์
๋ ฅ ๊ธฐ๋ฐ ์์
์ ํนํ ์ ์๋ํฉ๋๋ค. ์ฌ๊ธฐ์๋ ํ๋กฌํํธ์ ์ถ๋ ฅ ๊ฐ์ ์ข
์ข
๊ฒน์น๋ ๋จ์ด๊ฐ ์์ต๋๋ค. ์ด๋ฌํ ๊ฒน์น๋ n-๊ทธ๋จ์ด LLM ํ๋ณด ํ ํฐ์ผ๋ก ์ฌ์ฉ๋ฉ๋๋ค.
+
+ํ๋กฌํํธ ์กฐํ ๋์ฝ๋ฉ์ ํ์ฑํํ๋ ค๋ฉด `prompt_lookup_num_tokens` ๋งค๊ฐ๋ณ์์ ๊ฒน์น๋ ํ ํฐ ์๋ฅผ ์ง์ ํ์ญ์์ค. ๊ทธ๋ฐ ๋ค์ ์ด ๋งค๊ฐ๋ณ์๋ฅผ [`~GenerationMixin.generate`] ๋ฉ์๋์ ์ ๋ฌํ ์ ์์ต๋๋ค.
+
+
+
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+import torch
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b")
+inputs = tokenizer("The second law of thermodynamics states", return_tensors="pt").to(device)
+
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-1.3b").to(device)
+assistant_model = AutoModelForCausalLM.from_pretrained("facebook/opt-125m").to(device)
+outputs = model.generate(**inputs, prompt_lookup_num_tokens=3)
+print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+['The second law of thermodynamics states that entropy increases with temperature. ']
+```
+
+
+
+
+์ํ๋ง๊ณผ ํจ๊ป ํ๋กฌํํธ ์กฐํ ๋์ฝ๋ฉ์ ์ฌ์ฉํ๋ ค๋ฉด, [`~GenerationMixin.generate`] ๋ฉ์๋์ `do_sample` ๋ฐ `temperature` ๋งค๊ฐ๋ณ์๋ฅผ ์ถ๊ฐํ์ญ์์ค.
+
+```py
+from transformers import AutoModelForCausalLM, AutoTokenizer
+import torch
+
+device = "cuda" if torch.cuda.is_available() else "cpu"
+
+tokenizer = AutoTokenizer.from_pretrained("facebook/opt-1.3b")
+inputs = tokenizer("The second law of thermodynamics states", return_tensors="pt").to(device)
+
+model = AutoModelForCausalLM.from_pretrained("facebook/opt-1.3b").to(device)
+outputs = model.generate(**inputs, prompt_lookup_num_tokens=3, do_sample=True, temperature=0.7)
+print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
+["The second law of thermodynamics states that energy cannot be created nor destroyed. It's not a"]
+```
+
+
+
+
+## ์ดํ
์
์ต์ ํ [[attention-optimizations]]
+
+ํธ๋์คํฌ๋จธ ๋ชจ๋ธ์ ์๋ ค์ง ๋ฌธ์ ๋ ์
ํ ์ดํ
์
๋ฉ์ปค๋์ฆ์ด ์
๋ ฅ ํ ํฐ ์์ ํจ๊ป ๊ณ์ฐ ๋ฐ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ ๊ณฑ์ผ๋ก ์ฆ๊ฐํ๋ค๋ ๊ฒ์
๋๋ค. ์ด ์ ํ์ ํจ์ฌ ๋ ๊ธด ์ํ์ค๋ฅผ ์ฒ๋ฆฌํ๋ LLM์์๋ ๋์ฑ ์ปค์ง๋๋ค. ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด FlashAttention2 ๋๋ PyTorch์ ์ค์ผ์ผ๋ ์ ๊ณฑ ์ดํ
์
์ ์ฌ์ฉํด ๋ณด์ญ์์ค. ์ด๋ค์ ๋ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ ์ธ ์ดํ
์
๊ตฌํ์ผ๋ก ์ถ๋ก ์ ๊ฐ์ํํ ์ ์์ต๋๋ค.
+
+### FlashAttention-2 [[flashattention-2]]
+
+FlashAttention๊ณผ [FlashAttention-2](./perf_infer_gpu_one#flashattention-2)๋ ์ดํ
์
๊ณ์ฐ์ ๋ ์์ ์ฒญํฌ๋ก ๋๋๊ณ ์ค๊ฐ ์ฝ๊ธฐ/์ฐ๊ธฐ ์์
์ ์ค์ฌ ์ถ๋ก ์๋๋ฅผ ๋์
๋๋ค. FlashAttention-2๋ ์๋ FlashAttention ์๊ณ ๋ฆฌ์ฆ์ ๊ฐ์ ํ์ฌ ์ํ์ค ๊ธธ์ด ์ฐจ์์์๋ ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ฅผ ์ํํ๊ณ ํ๋์จ์ด์์ ์์
์ ๋ ์ ๋ถํ ํ์ฌ ๋๊ธฐํ ๋ฐ ํต์ ์ค๋ฒํค๋๋ฅผ ์ค์
๋๋ค.
+
+FlashAttention-2๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด [`~PreTrainedModel.from_pretrained`] ๋ฉ์๋์์ `attn_implementation="flash_attention_2"`๋ฅผ ์ค์ ํ์ญ์์ค.
+
+```py
+from transformers import AutoModelForCausalLM, BitsAndBytesConfig
+
+quant_config = BitsAndBytesConfig(load_in_8bit=True)
+model = AutoModelForCausalLM.from_pretrained(
+ "google/gemma-2b",
+ quantization_config=quant_config,
+ torch_dtype=torch.bfloat16,
+ attn_implementation="flash_attention_2",
+)
+```
+
+### PyTorch ์ค์ผ์ผ๋ ์ ๊ณฑ ์ดํ
์
(scaled dot product attention) [[pytorch-scaled-dot-product-attention]]
+
+์ค์ผ์ผ๋ ์ ๊ณฑ ์ดํ
์
(SDPA)๋ PyTorch 2.0์์ ์๋์ผ๋ก ํ์ฑํ๋๋ฉฐ, FlashAttention, xFormers, PyTorch์ C++ ๊ตฌํ์ ์ง์ํฉ๋๋ค. SDPA๋ CUDA ๋ฐฑ์๋๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ ๊ฐ์ฅ ์ฑ๋ฅ์ด ์ข์ ์ดํ
์
์๊ณ ๋ฆฌ์ฆ์ ์ ํํฉ๋๋ค. ๋ค๋ฅธ ๋ฐฑ์๋์์๋ SDPA๊ฐ PyTorch C++ ๊ตฌํ์ผ๋ก ๊ธฐ๋ณธ ์ค์ ๋ฉ๋๋ค.
+
+> [!TIP]
+> SDPA๋ ์ต์ PyTorch ๋ฒ์ ์ด ์ค์น๋์ด ์์ผ๋ฉด FlashAttention-2๋ ์ง์ํฉ๋๋ค.
+
+์ธ ๊ฐ์ง ์ดํ
์
์๊ณ ๋ฆฌ์ฆ ์ค ํ๋๋ฅผ ๋ช
์์ ์ผ๋ก ํ์ฑํํ๊ฑฐ๋ ๋นํ์ฑํํ๋ ค๋ฉด [torch.backends.cuda.sdp_kernel](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html) ์ปจํ
์คํธ ๊ด๋ฆฌ์๋ฅผ ์ฌ์ฉํ์ญ์์ค. ์๋ฅผ ๋ค์ด FlashAttention์ ํ์ฑํํ๋ ค๋ฉด `enable_flash=True`๋ก ์ค์ ํ์ญ์์ค.
+
+```py
+import torch
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained(
+ "google/gemma-2b",
+ torch_dtype=torch.bfloat16,
+)
+
+with torch.backends.cuda.sdp_kernel(enable_flash=True, enable_math=False, enable_mem_efficient=False):
+ outputs = model.generate(**inputs)
+```
+
+## ์์ํ [[quantization]]
+
+์์ํ๋ LLM ๊ฐ์ค์น๋ฅผ ๋ ๋ฎ์ ์ ๋ฐ๋๋ก ์ ์ฅํ์ฌ ํฌ๊ธฐ๋ฅผ ์ค์
๋๋ค. ์ด๋ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ์ค์ด๋ฉฐ GPU ๋ฉ๋ชจ๋ฆฌ์ ์ ์ฝ์ด ์๋ ๊ฒฝ์ฐ ์ถ๋ก ์ ์ํด LLM์ ๋ก๋ํ๋ ๊ฒ์ ๋ ์ฉ์ดํ๊ฒ ํฉ๋๋ค. GPU๊ฐ ์ถฉ๋ถํ๋ค๋ฉด, ๋ชจ๋ธ์ ์์ํํ ํ์๋ ์์ต๋๋ค. ์ถ๊ฐ์ ์ธ ์์ํ ๋ฐ ์์ํ ํด์ ๋จ๊ณ๋ก ์ธํด ์ฝ๊ฐ์ ์ง์ฐ์ด ๋ฐ์ํ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค(AWQ ๋ฐ ์ตํฉ AWQ ๋ชจ๋ ์ ์ธ).
+
+> [!TIP]
+> ๋ค์ํ ์์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ(์์ธํ ๋ด์ฉ์ [Quantization](./quantization) ๊ฐ์ด๋๋ฅผ ์ฐธ์กฐํ์ญ์์ค)๊ฐ ์์ต๋๋ค. ์ฌ๊ธฐ์๋ Quanto, AQLM, VPTQ, AWQ ๋ฐ AutoGPTQ๊ฐ ํฌํจ๋ฉ๋๋ค. ์ฌ์ฉ ์ฌ๋ก์ ๊ฐ์ฅ ์ ๋ง๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํด ๋ณด์ญ์์ค. ๋ํ AutoGPTQ์ bitsandbytes๋ฅผ ๋น๊ตํ๋ [Overview of natively supported quantization schemes in ๐ค Transformers](https://hf.co/blog/overview-quantization-transformers) ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ์ฝ์ด๋ณด๋ ๊ฒ์ ์ถ์ฒํฉ๋๋ค.
+
+์๋์ ๋ชจ๋ธ ๋ฉ๋ชจ๋ฆฌ ๊ณ์ฐ๊ธฐ๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ๋ก๋ํ๋ ๋ฐ ํ์ํ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ถ์ ํ๊ณ ๋น๊ตํด ๋ณด์ญ์์ค. ์๋ฅผ ๋ค์ด [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)๋ฅผ ๋ก๋ํ๋ ๋ฐ ํ์ํ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ถ์ ํด ๋ณด์ญ์์ค.
+
+
+
+Mistral-7B-v0.1์ ๋ฐ์ ๋ฐ๋๋ก ๋ก๋ํ๋ ค๋ฉด [`~transformers.AutoModelForCausalLM.from_pretrained`] ๋ฉ์๋์์ `torch_dtype` ๋งค๊ฐ๋ณ์๋ฅผ `torch.bfloat16`์ผ๋ก ์ค์ ํ์ญ์์ค. ์ด ๊ฒฝ์ฐ 13.74GB์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ํ์ํฉ๋๋ค.
+
+```py
+from transformers import AutoTokenizer, AutoModelForCausalLM
+import torch
+
+model = AutoModelForCausalLM.from_pretrained(
+ "mistralai/Mistral-7B-v0.1", torch_dtype=torch.bfloat16, device_map="auto",
+)
+```
+
+์ถ๋ก ์ ์ํด ์์ํ๋ ๋ชจ๋ธ(8๋นํธ ๋๋ 4๋นํธ)์ ๋ก๋ํ๋ ค๋ฉด [bitsandbytes](https://hf.co/docs/bitsandbytes)๋ฅผ ์ฌ์ฉํ๊ณ `load_in_4bit` ๋๋ `load_in_8bit` ๋งค๊ฐ๋ณ์๋ฅผ `True`๋ก ์ค์ ํ์ญ์์ค. ๋ชจ๋ธ์ 8๋นํธ๋ก ๋ก๋ํ๋ ๋ฐ๋ 6.87GB์ ๋ฉ๋ชจ๋ฆฌ๋ง ํ์ํฉ๋๋ค.
+
+```py
+from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
+import torch
+
+quant_config = BitsAndBytesConfig(load_in_8bit=True)
+model = AutoModelForCausalLM.from_pretrained(
+ "mistralai/Mistral-7B-v0.1", quantization_config=quant_config, device_map="auto"
+)
+```
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_tutorial.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_tutorial.md
new file mode 100644
index 0000000000000000000000000000000000000000..d5e0bd356edd2e8589e1f70a3ca65809d09c6d72
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_tutorial.md
@@ -0,0 +1,222 @@
+
+
+
+# ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ๋ก ์์ฑํ๊ธฐ [[generation-with-llms]]
+
+[[open-in-colab]]
+
+LLM ๋๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ํ
์คํธ ์์ฑ์ ํต์ฌ ๊ตฌ์ฑ ์์์
๋๋ค. ๊ฐ๋จํ ๋งํ๋ฉด, ์ฃผ์ด์ง ์
๋ ฅ ํ
์คํธ์ ๋ํ ๋ค์ ๋จ์ด(์ ํํ๊ฒ๋ ํ ํฐ)๋ฅผ ์์ธกํ๊ธฐ ์ํด ํ๋ จ๋ ๋๊ท๋ชจ ์ฌ์ ํ๋ จ ๋ณํ๊ธฐ ๋ชจ๋ธ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค. ํ ํฐ์ ํ ๋ฒ์ ํ๋์ฉ ์์ธกํ๊ธฐ ๋๋ฌธ์ ์๋ก์ด ๋ฌธ์ฅ์ ์์ฑํ๋ ค๋ฉด ๋ชจ๋ธ์ ํธ์ถํ๋ ๊ฒ ์ธ์ ๋ ๋ณต์กํ ์์
์ ์ํํด์ผ ํฉ๋๋ค. ์ฆ, ์๊ธฐํ๊ท ์์ฑ์ ์ํํด์ผ ํฉ๋๋ค.
+
+์๊ธฐํ๊ท ์์ฑ์ ๋ช ๊ฐ์ ์ด๊ธฐ ์
๋ ฅ๊ฐ์ ์ ๊ณตํ ํ, ๊ทธ ์ถ๋ ฅ์ ๋ค์ ๋ชจ๋ธ์ ์
๋ ฅ์ผ๋ก ์ฌ์ฉํ์ฌ ๋ฐ๋ณต์ ์ผ๋ก ํธ์ถํ๋ ์ถ๋ก ๊ณผ์ ์
๋๋ค. ๐ค Transformers์์๋ [`~generation.GenerationMixin.generate`] ๋ฉ์๋๊ฐ ์ด ์ญํ ์ ํ๋ฉฐ, ์ด๋ ์์ฑ ๊ธฐ๋ฅ์ ๊ฐ์ง ๋ชจ๋ ๋ชจ๋ธ์์ ์ฌ์ฉ ๊ฐ๋ฅํฉ๋๋ค.
+
+์ด ํํ ๋ฆฌ์ผ์์๋ ๋ค์ ๋ด์ฉ์ ๋ค๋ฃจ๊ฒ ๋ฉ๋๋ค:
+
+* LLM์ผ๋ก ํ
์คํธ ์์ฑ
+* ์ผ๋ฐ์ ์ผ๋ก ๋ฐ์ํ๋ ๋ฌธ์ ํด๊ฒฐ
+* LLM์ ์ต๋ํ ํ์ฉํ๊ธฐ ์ํ ๋ค์ ๋จ๊ณ
+
+์์ํ๊ธฐ ์ ์ ํ์ํ ๋ชจ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํ์ธ์:
+
+```bash
+pip install transformers bitsandbytes>=0.39.0 -q
+```
+
+
+## ํ
์คํธ ์์ฑ [[generate-text]]
+
+[์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ๋ง(causal language modeling)](tasks/language_modeling)์ ๋ชฉ์ ์ผ๋ก ํ์ต๋ ์ธ์ด ๋ชจ๋ธ์ ์ผ๋ จ์ ํ
์คํธ ํ ํฐ์ ์
๋ ฅ์ผ๋ก ์ฌ์ฉํ๊ณ , ๊ทธ ๊ฒฐ๊ณผ๋ก ๋ค์ ํ ํฐ์ด ๋์ฌ ํ๋ฅ ๋ถํฌ๋ฅผ ์ ๊ณตํฉ๋๋ค.
+
+
+
+
+ "LLM์ ์ ๋ฐฉ ํจ์ค"
+
+
+LLM๊ณผ ์๊ธฐํ๊ท ์์ฑ์ ํจ๊ป ์ฌ์ฉํ ๋ ํต์ฌ์ ์ธ ๋ถ๋ถ์ ์ด ํ๋ฅ ๋ถํฌ๋ก๋ถํฐ ๋ค์ ํ ํฐ์ ์ด๋ป๊ฒ ๊ณ ๋ฅผ ๊ฒ์ธ์ง์
๋๋ค. ๋ค์ ๋ฐ๋ณต ๊ณผ์ ์ ์ฌ์ฉ๋ ํ ํฐ์ ๊ฒฐ์ ํ๋ ํ, ์ด๋ ํ ๋ฐฉ๋ฒ๋ ๊ฐ๋ฅํฉ๋๋ค. ํ๋ฅ ๋ถํฌ์์ ๊ฐ์ฅ ๊ฐ๋ฅ์ฑ์ด ๋์ ํ ํฐ์ ์ ํํ๋ ๊ฒ์ฒ๋ผ ๊ฐ๋จํ ์๋ ์๊ณ , ๊ฒฐ๊ณผ ๋ถํฌ์์ ์ํ๋งํ๊ธฐ ์ ์ ์์ญ ๊ฐ์ง ๋ณํ์ ์ ์ฉํ๋ ๊ฒ์ฒ๋ผ ๋ณต์กํ ์๋ ์์ต๋๋ค.
+
+
+
+
+ "์๊ธฐํ๊ท ์์ฑ์ ํ๋ฅ ๋ถํฌ์์ ๋ค์ ํ ํฐ์ ๋ฐ๋ณต์ ์ผ๋ก ์ ํํ์ฌ ํ
์คํธ๋ฅผ ์์ฑํฉ๋๋ค."
+
+
+์์์ ์ค๋ช
ํ ๊ณผ์ ์ ์ด๋ค ์ข
๋ฃ ์กฐ๊ฑด์ด ์ถฉ์กฑ๋ ๋๊น์ง ๋ฐ๋ณต์ ์ผ๋ก ์ํ๋ฉ๋๋ค. ๋ชจ๋ธ์ด ์ํ์ค์ ๋(EOS ํ ํฐ)์ ์ถ๋ ฅํ ๋๊น์ง๋ฅผ ์ข
๋ฃ ์กฐ๊ฑด์ผ๋ก ํ๋ ๊ฒ์ด ์ด์์ ์
๋๋ค. ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ์๋ ๋ฏธ๋ฆฌ ์ ์๋ ์ต๋ ๊ธธ์ด์ ๋๋ฌํ์ ๋ ์์ฑ์ด ์ค๋จ๋ฉ๋๋ค.
+
+๋ชจ๋ธ์ด ์์๋๋ก ๋์ํ๊ธฐ ์ํด์ ํ ํฐ ์ ํ ๋จ๊ณ์ ์ ์ง ์กฐ๊ฑด์ ์ฌ๋ฐ๋ฅด๊ฒ ์ค์ ํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. ์ด๋ฌํ ์ด์ ๋ก, ๊ฐ ๋ชจ๋ธ์๋ ๊ธฐ๋ณธ ์์ฑ ์ค์ ์ด ์ ์ ์๋ [`~generation.GenerationConfig`] ํ์ผ์ด ํจ๊ป ์ ๊ณต๋ฉ๋๋ค.
+
+์ฝ๋๋ฅผ ํ์ธํด๋ด
์๋ค!
+
+
+
+๊ธฐ๋ณธ LLM ์ฌ์ฉ์ ๊ด์ฌ์ด ์๋ค๋ฉด, ์ฐ๋ฆฌ์ [`Pipeline`](pipeline_tutorial) ์ธํฐํ์ด์ค๋ก ์์ํ๋ ๊ฒ์ ์ถ์ฒํฉ๋๋ค. ๊ทธ๋ฌ๋ LLM์ ์์ํ๋ ํ ํฐ ์ ํ ๋จ๊ณ์์์ ๋ฏธ์ธํ ์ ์ด์ ๊ฐ์ ๊ณ ๊ธ ๊ธฐ๋ฅ๋ค์ ์ข
์ข
ํ์๋ก ํฉ๋๋ค. ์ด๋ฌํ ์์
์ [`~generation.GenerationMixin.generate`]๋ฅผ ํตํด ๊ฐ์ฅ ์ ์ํ๋ ์ ์์ต๋๋ค. LLM์ ์ด์ฉํ ์๊ธฐํ๊ท ์์ฑ์ ์์์ ๋ง์ด ์๋ชจํ๋ฏ๋ก, ์ ์ ํ ์ฒ๋ฆฌ๋์ ์ํด GPU์์ ์คํ๋์ด์ผ ํฉ๋๋ค.
+
+
+
+๋จผ์ , ๋ชจ๋ธ์ ๋ถ๋ฌ์ค์ธ์.
+
+```python
+>>> from transformers import AutoModelForCausalLM
+
+>>> model = AutoModelForCausalLM.from_pretrained(
+... "mistralai/Mistral-7B-v0.1", device_map="auto", load_in_4bit=True
+... )
+```
+
+`from_pretrained` ํจ์๋ฅผ ํธ์ถํ ๋ 2๊ฐ์ ํ๋๊ทธ๋ฅผ ์ฃผ๋ชฉํ์ธ์:
+
+- `device_map`์ ๋ชจ๋ธ์ด GPU๋ก ์ด๋๋๋๋ก ํฉ๋๋ค.
+- `load_in_4bit`๋ ๋ฆฌ์์ค ์๊ตฌ ์ฌํญ์ ํฌ๊ฒ ์ค์ด๊ธฐ ์ํด [4๋นํธ ๋์ ์์ํ](main_classes/quantization)๋ฅผ ์ ์ฉํฉ๋๋ค.
+
+์ด ์ธ์๋ ๋ชจ๋ธ์ ์ด๊ธฐํํ๋ ๋ค์ํ ๋ฐฉ๋ฒ์ด ์์ง๋ง, LLM์ ์ฒ์ ์์ํ ๋ ์ด ์ค์ ์ ์ถ์ฒํฉ๋๋ค.
+
+์ด์ด์ ํ
์คํธ ์
๋ ฅ์ [ํ ํฌ๋์ด์ ](tokenizer_summary)์ผ๋ก ์ ์ฒ๋ฆฌํ์ธ์.
+
+```python
+>>> from transformers import AutoTokenizer
+>>> import torch
+
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
+>>> device = "cuda" if torch.cuda.is_available() else "cpu"
+>>> model_inputs = tokenizer(["A list of colors: red, blue"], return_tensors="pt").to(device)
+```
+
+`model_inputs` ๋ณ์์๋ ํ ํฐํ๋ ํ
์คํธ ์
๋ ฅ๊ณผ ํจ๊ป ์ดํ
์
๋ง์คํฌ๊ฐ ๋ค์ด ์์ต๋๋ค. [`~generation.GenerationMixin.generate`]๋ ์ดํ
์
๋ง์คํฌ๊ฐ ์ ๊ณต๋์ง ์์์ ๊ฒฝ์ฐ์๋ ์ด๋ฅผ ์ถ๋ก ํ๋ ค๊ณ ๋
ธ๋ ฅํ์ง๋ง, ์ต์์ ์ฑ๋ฅ์ ์ํด์๋ ๊ฐ๋ฅํ๋ฉด ์ดํ
์
๋ง์คํฌ๋ฅผ ์ ๋ฌํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
+
+๋ง์ง๋ง์ผ๋ก [`~generation.GenerationMixin.generate`] ๋ฉ์๋๋ฅผ ํธ์ถํด ์์ฑ๋ ํ ํฐ์ ์ป์ ํ, ์ด๋ฅผ ์ถ๋ ฅํ๊ธฐ ์ ์ ํ
์คํธ ํํ๋ก ๋ณํํ์ธ์.
+
+```python
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'A list of colors: red, blue, green, yellow, black, white, and brown'
+```
+
+์ด๊ฒ ์ ๋ถ์
๋๋ค! ๋ช ์ค์ ์ฝ๋๋ง์ผ๋ก LLM์ ๋ฅ๋ ฅ์ ํ์ฉํ ์ ์๊ฒ ๋์์ต๋๋ค.
+
+
+## ์ผ๋ฐ์ ์ผ๋ก ๋ฐ์ํ๋ ๋ฌธ์ [[common-pitfalls]]
+
+[์์ฑ ์ ๋ต](generation_strategies)์ด ๋ง๊ณ , ๊ธฐ๋ณธ๊ฐ์ด ํญ์ ์ฌ์ฉ ์ฌ๋ก์ ์ ํฉํ์ง ์์ ์ ์์ต๋๋ค. ์ถ๋ ฅ์ด ์์๊ณผ ๋ค๋ฅผ ๋ ํํ ๋ฐ์ํ๋ ๋ฌธ์ ์ ์ด๋ฅผ ํด๊ฒฐํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ชฉ๋ก์ ๋ง๋ค์์ต๋๋ค.
+
+```py
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
+>>> tokenizer.pad_token = tokenizer.eos_token # Mistral has no pad token by default
+>>> model = AutoModelForCausalLM.from_pretrained(
+... "mistralai/Mistral-7B-v0.1", device_map="auto", load_in_4bit=True
+... )
+```
+
+### ์์ฑ๋ ์ถ๋ ฅ์ด ๋๋ฌด ์งง๊ฑฐ๋ ๊ธธ๋ค [[generated-output-is-too-shortlong]]
+
+[`~generation.GenerationConfig`] ํ์ผ์์ ๋ณ๋๋ก ์ง์ ํ์ง ์์ผ๋ฉด, `generate`๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ต๋ 20๊ฐ์ ํ ํฐ์ ๋ฐํํฉ๋๋ค. `generate` ํธ์ถ์์ `max_new_tokens`์ ์๋์ผ๋ก ์ค์ ํ์ฌ ๋ฐํํ ์ ์๋ ์ ํ ํฐ์ ์ต๋ ์๋ฅผ ์ค์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค. LLM(์ ํํ๊ฒ๋ [๋์ฝ๋ ์ ์ฉ ๋ชจ๋ธ](https://huggingface.co/learn/nlp-course/chapter1/6?fw=pt))์ ์
๋ ฅ ํ๋กฌํํธ๋ ์ถ๋ ฅ์ ์ผ๋ถ๋ก ๋ฐํํฉ๋๋ค.
+
+
+```py
+>>> model_inputs = tokenizer(["A sequence of numbers: 1, 2"], return_tensors="pt").to("cuda")
+
+>>> # By default, the output will contain up to 20 tokens
+>>> generated_ids = model.generate(**model_inputs, pad_token_id=tokenizer.eos_token_id)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'A sequence of numbers: 1, 2, 3, 4, 5'
+
+>>> # Setting `max_new_tokens` allows you to control the maximum length
+>>> generated_ids = model.generate(**model_inputs, pad_token_id=tokenizer.eos_token_id, max_new_tokens=50)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'A sequence of numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,'
+```
+
+### ์๋ชป๋ ์์ฑ ๋ชจ๋ [[incorrect-generation-mode]]
+
+๊ธฐ๋ณธ์ ์ผ๋ก [`~generation.GenerationConfig`] ํ์ผ์์ ๋ณ๋๋ก ์ง์ ํ์ง ์์ผ๋ฉด, `generate`๋ ๊ฐ ๋ฐ๋ณต์์ ๊ฐ์ฅ ํ๋ฅ ์ด ๋์ ํ ํฐ์ ์ ํํฉ๋๋ค(๊ทธ๋ฆฌ๋ ๋์ฝ๋ฉ). ํ๋ ค๋ ์์
์ ๋ฐ๋ผ ์ด ๋ฐฉ๋ฒ์ ๋ฐ๋์งํ์ง ์์ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ์ฑ๋ด์ด๋ ์์ธ์ด ์์ฑ๊ณผ ๊ฐ์ ์ฐฝ์์ ์ธ ์์
์ ์ํ๋ง์ด ์ ํฉํ ์ ์์ต๋๋ค. ๋ฐ๋ฉด, ์ค๋์ค๋ฅผ ํ
์คํธ๋ก ๋ณํํ๊ฑฐ๋ ๋ฒ์ญ๊ณผ ๊ฐ์ ์
๋ ฅ ๊ธฐ๋ฐ ์์
์ ๊ทธ๋ฆฌ๋ ๋์ฝ๋ฉ์ด ๋ ์ ํฉํ ์ ์์ต๋๋ค. `do_sample=True`๋ก ์ํ๋ง์ ํ์ฑํํ ์ ์์ผ๋ฉฐ, ์ด ์ฃผ์ ์ ๋ํ ์์ธํ ๋ด์ฉ์ ์ด [๋ธ๋ก๊ทธ ํฌ์คํธ](https://huggingface.co/blog/how-to-generate)์์ ๋ณผ ์ ์์ต๋๋ค.
+
+```python
+>>> # Set seed or reproducibility -- you don't need this unless you want full reproducibility
+>>> from transformers import set_seed
+>>> set_seed(0)
+
+>>> model_inputs = tokenizer(["I am a cat."], return_tensors="pt").to("cuda")
+
+>>> # LLM + greedy decoding = repetitive, boring output
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'I am a cat. I am a cat. I am a cat. I am a cat'
+
+>>> # With sampling, the output becomes more creative!
+>>> generated_ids = model.generate(**model_inputs, do_sample=True)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'I am a cat.\nI just need to be. I am always.\nEvery time'
+```
+
+### ์๋ชป๋ ํจ๋ฉ [[wrong-padding-side]]
+
+LLM์ [๋์ฝ๋ ์ ์ฉ](https://huggingface.co/learn/nlp-course/chapter1/6?fw=pt) ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง๊ณ ์์ด, ์
๋ ฅ ํ๋กฌํํธ์ ๋ํด ์ง์์ ์ผ๋ก ๋ฐ๋ณต ์ฒ๋ฆฌ๋ฅผ ํฉ๋๋ค. ์
๋ ฅ ๋ฐ์ดํฐ์ ๊ธธ์ด๊ฐ ๋ค๋ฅด๋ฉด ํจ๋ฉ ์์
์ด ํ์ํฉ๋๋ค. LLM์ ํจ๋ฉ ํ ํฐ์์ ์๋์ ์ด์ด๊ฐ๋๋ก ์ค๊ณ๋์ง ์์๊ธฐ ๋๋ฌธ์, ์
๋ ฅ ์ผ์ชฝ์ ํจ๋ฉ์ด ์ถ๊ฐ ๋์ด์ผ ํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ดํ
์
๋ง์คํฌ๋ ๊ผญ `generate` ํจ์์ ์ ๋ฌ๋์ด์ผ ํฉ๋๋ค!
+
+```python
+>>> # The tokenizer initialized above has right-padding active by default: the 1st sequence,
+>>> # which is shorter, has padding on the right side. Generation fails.
+>>> model_inputs = tokenizer(
+... ["1, 2, 3", "A, B, C, D, E"], padding=True, return_tensors="pt"
+... ).to("cuda")
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids[0], skip_special_tokens=True)[0]
+''
+
+>>> # With left-padding, it works as expected!
+>>> tokenizer = AutoTokenizer.from_pretrained("openlm-research/open_llama_7b", padding_side="left")
+>>> tokenizer.pad_token = tokenizer.eos_token # Llama has no pad token by default
+>>> model_inputs = tokenizer(
+... ["1, 2, 3", "A, B, C, D, E"], padding=True, return_tensors="pt"
+... ).to("cuda")
+>>> generated_ids = model.generate(**model_inputs)
+>>> tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+'1, 2, 3, 4, 5, 6,'
+```
+
+
+
+## ์ถ๊ฐ ์๋ฃ [[further-resources]]
+
+์๊ธฐํ๊ท ์์ฑ ํ๋ก์ธ์ค๋ ์๋์ ์ผ๋ก ๋จ์ํ ํธ์ด์ง๋ง, LLM์ ์ต๋ํ ํ์ฉํ๋ ค๋ฉด ์ฌ๋ฌ ๊ฐ์ง ์์๋ฅผ ๊ณ ๋ คํด์ผ ํ๋ฏ๋ก ์ฝ์ง ์์ ์ ์์ต๋๋ค. LLM์ ๋ํ ๋ ๊น์ ์ดํด์ ํ์ฉ์ ์ํ ๋ค์ ๋จ๊ณ๋ ์๋์ ๊ฐ์ต๋๋ค:
+
+
+### ๊ณ ๊ธ ์์ฑ ์ฌ์ฉ [[advanced-generate-usage]]
+
+1. [๊ฐ์ด๋](generation_strategies)๋ ๋ค์ํ ์์ฑ ๋ฐฉ๋ฒ์ ์ ์ดํ๋ ๋ฐฉ๋ฒ, ์์ฑ ์ค์ ํ์ผ์ ์ค์ ํ๋ ๋ฐฉ๋ฒ, ์ถ๋ ฅ์ ์คํธ๋ฆฌ๋ฐํ๋ ๋ฐฉ๋ฒ์ ๋ํด ์ค๋ช
ํฉ๋๋ค.
+2. [`~generation.GenerationConfig`]์ [`~generation.GenerationMixin.generate`], [generate-related classes](internal/generation_utils)๋ฅผ ์ฐธ์กฐํด๋ณด์ธ์.
+
+### LLM ๋ฆฌ๋๋ณด๋ [[llm-leaderboards]]
+
+1. [Open LLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard)๋ ์คํ ์์ค ๋ชจ๋ธ์ ํ์ง์ ์ค์ ์ ๋ก๋๋ค.
+2. [Open LLM-Perf Leaderboard](https://huggingface.co/spaces/optimum/llm-perf-leaderboard)๋ LLM ์ฒ๋ฆฌ๋์ ์ค์ ์ ๋ก๋๋ค.
+
+### ์ง์ฐ ์๊ฐ ๋ฐ ์ฒ๋ฆฌ๋ [[latency-and-throughput]]
+
+1. ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ ์ค์ด๋ ค๋ฉด, ๋์ ์์ํ์ ๋ํ [๊ฐ์ด๋](main_classes/quantization)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+### ๊ด๋ จ ๋ผ์ด๋ธ๋ฌ๋ฆฌ [[related-libraries]]
+
+1. [`text-generation-inference`](https://github.com/huggingface/text-generation-inference)๋ LLM์ ์ํ ์ค์ ์ด์ ํ๊ฒฝ์ ์ ํฉํ ์๋ฒ์
๋๋ค.
+2. [`optimum`](https://github.com/huggingface/optimum)์ ํน์ ํ๋์จ์ด ์ฅ์น์์ LLM์ ์ต์ ํํ๊ธฐ ์ํด ๐ค Transformers๋ฅผ ํ์ฅํ ๊ฒ์
๋๋ค.
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_tutorial_optimization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_tutorial_optimization.md
new file mode 100644
index 0000000000000000000000000000000000000000..d43affd288fcd5e9b1589bbda634baa5dade67f3
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/llm_tutorial_optimization.md
@@ -0,0 +1,759 @@
+
+# ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์๋ ๋ฐ ๋ฉ๋ชจ๋ฆฌ ์ต์ ํ [[optimizing-llms-for-speed-and-memory]]
+
+[[open-in-colab]]
+
+GPT3/4, [Falcon](https://huggingface.co/tiiuae/falcon-40b), [Llama](https://huggingface.co/meta-llama/Llama-2-70b-hf)์ ๊ฐ์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ธ๊ฐ ์ค์ฌ ๊ณผ์ ๋ฅผ ํด๊ฒฐํ๋ ๋ฅ๋ ฅ์ด ๋น ๋ฅด๊ฒ ๋ฐ์ ํ๊ณ ์์ผ๋ฉฐ, ํ๋ ์ง์ ๊ธฐ๋ฐ ์ฐ์
์์ ํ์ ๋๊ตฌ๋ก ์๋ฆฌ์ก๊ณ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ด๋ฌํ ๋ชจ๋ธ์ ์ค์ ๊ณผ์ ์ ๋ฐฐํฌํ๋ ๊ฒ์ ์ฌ์ ํ ์ด๋ ค์ด ๊ณผ์ ์
๋๋ค.
+
+- ์ธ๊ฐ๊ณผ ๋น์ทํ ํ
์คํธ ์ดํด ๋ฐ ์์ฑ ๋ฅ๋ ฅ์ ๋ณด์ด๊ธฐ ์ํด, ํ์ฌ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์์ญ์ต ๊ฐ์ ๋งค๊ฐ๋ณ์๋ก ๊ตฌ์ฑ๋์ด์ผ ํฉ๋๋ค (์ฐธ์กฐ: [Kaplan et al](https://arxiv.org/abs/2001.08361), [Wei et. al](https://arxiv.org/abs/2206.07682)). ์ด๋ ์ถ๋ก ์ ์ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋ฅผ ํฌ๊ฒ ์ฆ๊ฐ์ํต๋๋ค.
+- ๋ง์ ์ค์ ๊ณผ์ ์์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๋ฐฉ๋ํ ๋งฅ๋ฝ ์ ๋ณด๋ฅผ ์ ๊ณต๋ฐ์์ผ ํฉ๋๋ค. ์ด๋ ๋ชจ๋ธ์ด ์ถ๋ก ๊ณผ์ ์์ ๋งค์ฐ ๊ธด ์
๋ ฅ ์ํ์ค๋ฅผ ์ฒ๋ฆฌํ ์ ์์ด์ผ ํ๋ค๋ ๊ฒ์ ๋ปํฉ๋๋ค.
+
+์ด๋ฌํ ๊ณผ์ ์ ํต์ฌ์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๊ณ์ฐ ๋ฐ ๋ฉ๋ชจ๋ฆฌ ํ์ฉ ๋ฅ๋ ฅ์ ์ฆ๋์ํค๋ ๋ฐ ์์ต๋๋ค. ํนํ ๋ฐฉ๋ํ ์
๋ ฅ ์ํ์ค๋ฅผ ์ฒ๋ฆฌํ ๋ ์ด๋ฌํ ๋ฅ๋ ฅ์ด ์ค์ํฉ๋๋ค.
+
+์ด ๊ฐ์ด๋์์๋ ํจ์จ์ ์ธ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ๋ฐฐํฌ๋ฅผ ์ํ ํจ๊ณผ์ ์ธ ๊ธฐ๋ฒ๋ค์ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+
+1. **๋ฎ์ ์ ๋ฐ๋:** ์ฐ๊ตฌ์ ๋ฐ๋ฅด๋ฉด, [8๋นํธ์ 4๋นํธ](./main_classes/quantization.md)์ ๊ฐ์ด ๋ฎ์ ์์น ์ ๋ฐ๋๋ก ์๋ํ๋ฉด ๋ชจ๋ธ ์ฑ๋ฅ์ ํฐ ์ ํ ์์ด ๊ณ์ฐ์์ ์ด์ ์ ์ป์ ์ ์์ต๋๋ค.
+
+2. **ํ๋์ ์ดํ
์
:** ํ๋์ ์ดํ
์
์ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ์ ๋์ผ ๋ฟ๋ง ์๋๋ผ ์ต์ ํ๋ GPU ๋ฉ๋ชจ๋ฆฌ ํ์ฉ์ ํตํด ํจ์จ์ฑ์ ํฅ์์ํค๋ ์ดํ
์
์๊ณ ๋ฆฌ์ฆ์ ๋ณํ์
๋๋ค.
+
+3. **์ํคํ
์ฒ ํ์ :** ์ถ๋ก ์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ฃผ๋ก ๋์ผํ ๋ฐฉ์(๊ธด ์
๋ ฅ ๋งฅ๋ฝ์ ๊ฐ์ง ์๊ธฐํ๊ท ํ
์คํธ ์์ฑ ๋ฐฉ์)์ผ๋ก ๋ฐฐํฌ๋๋๋ฐ, ๋ ํจ์จ์ ์ธ ์ถ๋ก ์ ๊ฐ๋ฅํ๊ฒ ํ๋ ํนํ๋ ๋ชจ๋ธ ์ํคํ
์ฒ๊ฐ ์ ์๋์์ต๋๋ค. ์ด๋ฌํ ๋ชจ๋ธ ์ํคํ
์ฒ์ ๊ฐ์ฅ ์ค์ํ ๋ฐ์ ์ผ๋ก๋ [Alibi](https://arxiv.org/abs/2108.12409), [Rotary embeddings](https://arxiv.org/abs/2104.09864), [Multi-Query Attention (MQA)](https://arxiv.org/abs/1911.02150), [Grouped-Query-Attention (GQA)]((https://arxiv.org/abs/2305.13245))์ด ์์ต๋๋ค.
+
+์ด ๊ฐ์ด๋์์๋ ํ
์์ ๊ด์ ์์ ์๊ธฐํ๊ท ์์ฑ์ ๋ํ ๋ถ์์ ์ ๊ณตํฉ๋๋ค. ๋ฎ์ ์ ๋ฐ๋๋ฅผ ์ฑํํ๋ ๊ฒ์ ์ฅ๋จ์ ์ ๋
ผ์ํ๊ณ , ์ต์ ์ดํ
์
์๊ณ ๋ฆฌ์ฆ์ ํฌ๊ด์ ์ผ๋ก ํ๊ตฌํ๋ฉฐ, ํฅ์๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ์ํคํ
์ฒ์ ๋ํด ๋
ผํฉ๋๋ค. ์ด ๊ณผ์ ์์ ๊ฐ ๊ธฐ๋ฅ์ ๊ฐ์ ์ฌํญ์ ๋ณด์ฌ์ฃผ๋ ์ค์ฉ์ ์ธ ์์ ๋ฅผ ํ์ธํฉ๋๋ค.
+
+## 1. ๋ฎ์ ์ ๋ฐ๋ [[1-lower-precision]]
+
+๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๊ฐ์ค์น ํ๋ ฌ๊ณผ ๋ฒกํฐ์ ์งํฉ์ผ๋ก ๋ณด๊ณ , ํ
์คํธ ์
๋ ฅ์ ๋ฒกํฐ์ ์ํ์ค๋ก ๋ณธ๋ค๋ฉด, ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ์ฌํญ์ ๊ฐ์ฅ ์ ์ดํดํ ์ ์์ต๋๋ค. ์ด์ด์ง๋ ๋ด์ฉ์์ *๊ฐ์ค์น*๋ ๋ชจ๋ธ์ ๋ชจ๋ ๊ฐ์ค์น ํ๋ ฌ๊ณผ ๋ฒกํฐ๋ฅผ ์๋ฏธํฉ๋๋ค.
+
+์ด ๊ฐ์ด๋๋ฅผ ์์ฑํ๋ ์์ ์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ต์ ๋ช์ญ์ต ๊ฐ์ ๋งค๊ฐ๋ณ์๋ก ๊ตฌ์ฑ๋์ด ์์ต๋๋ค. ๊ฐ ๋งค๊ฐ๋ณ์๋ `4.5689`์ ๊ฐ์ ์ญ์ง์๋ก ์ด๋ฃจ์ด์ ธ ์์ผ๋ฉฐ, ๋ณดํต [float32](https://en.wikipedia.org/wiki/Single-precision_floating-point_format), [bfloat16](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) ๋๋ [float16](https://en.wikipedia.org/wiki/Half-precision_floating-point_format) ํ์์ผ๋ก ์ ์ฅ๋ฉ๋๋ค. ์ด๋ฅผ ํตํด ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๋ฉ๋ชจ๋ฆฌ์ ๋ก๋ํ๋ ๋ฐ ํ์ํ ๋ฉ๋ชจ๋ฆฌ์ ์๊ตฌ์ฌํญ์ ์ฝ๊ฒ ๊ณ์ฐํ ์ ์์ต๋๋ค:
+
+> *X * 10์ต ๊ฐ์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง ๋ชจ๋ธ์ ๊ฐ์ค์น๋ฅผ ๋ก๋ํ๋ ค๋ฉด float32 ์ ๋ฐ๋์์ ๋๋ต 4 * X GB์ VRAM์ด ํ์ํฉ๋๋ค.*
+
+์์ฆ์๋ ๋ชจ๋ธ์ด float32 ์ ๋ฐ๋๋ก ํ๋ จ๋๋ ๊ฒฝ์ฐ๋ ๋๋ฌผ๊ณ , ์ผ๋ฐ์ ์ผ๋ก bfloat16 ์ ๋ฐ๋๋ ๊ฐ๋ float16 ์ ๋ฐ๋๋ก ํ๋ จ๋ฉ๋๋ค. ๋ฐ๋ผ์ ๊ฒฝํ์ ์ผ๋ก ์์๋ธ ๋ฒ์น์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+> *X * 10์ต ๊ฐ์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง ๋ชจ๋ธ์ ๊ฐ์ค์น๋ฅผ ๋ก๋ํ๋ ค๋ฉด bfloat16/float16 ์ ๋ฐ๋์์ ๋๋ต 2 * X GB์ VRAM์ด ํ์ํฉ๋๋ค.*
+
+์งง์ ํ
์คํธ ์
๋ ฅ(1024 ํ ํฐ ๋ฏธ๋ง)์ ๊ฒฝ์ฐ, ์ถ๋ก ์ ์ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ ๋๋ถ๋ถ์ ๊ฐ์ค์น๋ฅผ ๋ก๋ํ๋ ๋ฐ ํ์ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์
๋๋ค. ๋ฐ๋ผ์ ์ง๊ธ์ ์ถ๋ก ์ ์ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ด ๋ชจ๋ธ์ ๊ฐ์ค์น๋ฅผ GPU VRAM์ ๋ก๋ํ๋ ๋ฐ ํ์ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ๊ณผ ๊ฐ๋ค๊ณ ๊ฐ์ ํฉ์๋ค.
+
+๋ชจ๋ธ์ bfloat16์ผ๋ก ๋ก๋ํ๋ ๋ฐ ๋๋ต ์ผ๋ง๋ ๋ง์ VRAM์ด ํ์ํ์ง ๋ช ๊ฐ์ง ์๋ฅผ ๋ค์ด๋ณด๊ฒ ์ต๋๋ค:
+
+- **GPT3**๋ 2 \* 175 GB = **350 GB** VRAM์ด ํ์ํฉ๋๋ค.
+- [**Bloom**](https://huggingface.co/bigscience/bloom)์ 2 \* 176 GB = **352 GB** VRAM์ด ํ์ํฉ๋๋ค.
+- [**Llama-2-70b**](https://huggingface.co/meta-llama/Llama-2-70b-hf)๋ 2 \* 70 GB = **140 GB** VRAM์ด ํ์ํฉ๋๋ค.
+- [**Falcon-40b**](https://huggingface.co/tiiuae/falcon-40b)๋ 2 \* 40 GB = **80 GB** VRAM์ด ํ์ํฉ๋๋ค.
+- [**MPT-30b**](https://huggingface.co/mosaicml/mpt-30b)๋ 2 * 30 GB = **60 GB** VRAM์ด ํ์ํฉ๋๋ค.
+- [**bigcode/starcoder**](https://huggingface.co/bigcode/starcoder)๋ 2 * 15.5 GB = **31 GB** VRAM์ด ํ์ํฉ๋๋ค.
+
+์ด ๋ฌธ์๋ฅผ ์์ฑํ๋ ์์ ์์, ํ์ฌ ์์ฅ์์ ๊ฐ์ฅ ํฐ GPU ์นฉ์ 80GB์ VRAM์ ์ ๊ณตํ๋ A100๊ณผ H100์
๋๋ค. ์์ ์ธ๊ธ๋ ๋๋ถ๋ถ์ ๋ชจ๋ธ๋ค์ ๋ก๋ํ๊ธฐ ์ํด์๋ ์ต์ 80GB ์ด์์ ์ฉ๋์ ํ์๋ก ํ๋ฉฐ, ๋ฐ๋ผ์ [ํ
์ ๋ณ๋ ฌ ์ฒ๋ฆฌ](https://huggingface.co/docs/transformers/perf_train_gpu_many#tensor-parallelism) ๋ฐ/๋๋ [ํ์ดํ๋ผ์ธ ๋ณ๋ ฌ ์ฒ๋ฆฌ](https://huggingface.co/docs/transformers/perf_train_gpu_many#naive-model-parallelism-vertical-and-pipeline-parallelism)๋ฅผ ๋ฐ๋์ ํ์๋ก ํฉ๋๋ค.
+
+๐ค Transformers๋ ํ
์ ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ฅผ ๋ฐ๋ก ์ง์ํ์ง ์์ต๋๋ค. ์ด๋ ๋ชจ๋ธ ์ํคํ
์ฒ๊ฐ ํน์ ๋ฐฉ์์ผ๋ก ์์ฑ๋์ด์ผ ํ๊ธฐ ๋๋ฌธ์
๋๋ค. ํ
์ ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ฅผ ์ง์ํ๋ ๋ฐฉ์์ผ๋ก ๋ชจ๋ธ์ ์์ฑํ๋ ๋ฐ ๊ด์ฌ์ด ์๋ค๋ฉด [the text-generation-inference library](https://github.com/huggingface/text-generation-inference/tree/main/server/text_generation_server/models/custom_modeling)๋ฅผ ์ฐธ์กฐํด ๋ณด์๊ธฐ ๋ฐ๋๋๋ค.
+
+๊ธฐ๋ณธ์ ์ธ ํ์ดํ๋ผ์ธ ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ ๋ฐ๋ก ์ง์๋ฉ๋๋ค. ์ด๋ฅผ ์ํด ๋จ์ํ ๋ชจ๋ธ์ `device="auto"`๋ก ๋ก๋ํ๋ฉด [์ฌ๊ธฐ](https://huggingface.co/docs/accelerate/v0.22.0/en/concept_guides/big_model_inference)์ ์ค๋ช
๋ ๋๋ก ์ฌ์ฉ ๊ฐ๋ฅํ GPU์ ๋ชจ๋ธ์ ์๋ก ๋ค๋ฅธ ๋ ์ด์ด๋ฅผ ์๋์ผ๋ก ๋ฐฐ์นํฉ๋๋ค. ์ด๊ฒ์ ๋งค์ฐ ํจ๊ณผ์ ์ด๊ธด ํ์ง๋ง ์ด๋ฌํ ๊ธฐ๋ณธ ํ์ดํ๋ผ์ธ ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ GPU ์ ํด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ง ๋ชปํ๋ค๋ ์ ์ ์ ์ํด์ผ ํฉ๋๋ค. ๋ ๋ฐ์ ๋ ํ์ดํ๋ผ์ธ ๋ณ๋ ฌ ์ฒ๋ฆฌ๊ฐ ํ์ํ๋ฉฐ, ์ด์ ๋ํ ์ค๋ช
์ [์ฌ๊ธฐ](https://huggingface.co/docs/transformers/en/perf_train_gpu_many#naive-model-parallelism-vertical-and-pipeline-parallelism)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+80GB A100 GPU 8๊ฐ๋ฅผ ๊ฐ์ง ๋
ธ๋์ ์ ๊ทผํ ์ ์๋ค๋ฉด, BLOOM์ ๋ค์๊ณผ ๊ฐ์ด ๋ก๋ํ ์ ์์ต๋๋ค.
+
+```bash
+!pip install transformers accelerate bitsandbytes optimum
+```
+```python
+from transformers import AutoModelForCausalLM
+
+model = AutoModelForCausalLM.from_pretrained("bigscience/bloom", device_map="auto", pad_token_id=0)
+```
+
+`device_map="auto"`๋ฅผ ์ฌ์ฉํ๋ฉด ๋ชจ๋ ์ฌ์ฉ ๊ฐ๋ฅํ GPU์ ์ดํ
์
๋ ์ด์ด๊ฐ ๊ณ ๋ฅด๊ฒ ๋ถ์ฐ๋ฉ๋๋ค.
+
+์ด ๊ฐ์ด๋์์๋ [bigcode/octocoder](https://huggingface.co/bigcode/octocoder)๋ฅผ ์ฌ์ฉํ ๊ฒ์
๋๋ค. ์ด ๋ชจ๋ธ์ ๋จ์ผ 40GB A100 GPU ์ฅ์น์์ ์คํํ ์ ์์ต๋๋ค. ์์ผ๋ก ์ ์ฉํ ๋ชจ๋ ๋ฉ๋ชจ๋ฆฌ ๋ฐ ์๋ ์ต์ ํ๋ ๋ชจ๋ธ ๋๋ ํ
์ ๋ณ๋ ฌ ์ฒ๋ฆฌ๋ฅผ ํ์๋ก ํ๋ ๋ค๋ฅธ ๋ชจ๋ธ์๋ ๋์ผํ๊ฒ ์ ์ฉ๋ ์ ์์ต๋๋ค.
+
+๋ชจ๋ธ์ด bfloat16 ์ ๋ฐ๋๋ก ๋ก๋๋๊ธฐ ๋๋ฌธ์, ์์ ๊ฒฝํ์ ์ผ๋ก ์์๋ธ ๋ฒ์น์ ์ฌ์ฉํ๋ฉด `bigcode/octocoder`๋ฅผ ์ฌ์ฉํ์ฌ ์ถ๋ก ์ ์คํํ๊ธฐ ์ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ด ์ฝ 31GB VRAM์ผ ๊ฒ์ผ๋ก ์์๋ฉ๋๋ค. ํ ๋ฒ ์๋ํด ๋ณด๊ฒ ์ต๋๋ค.
+
+๋จผ์ ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ฅผ ๋ก๋ํ ๋ค์, ๋ ๋ค Transformers์ [ํ์ดํ๋ผ์ธ](https://huggingface.co/docs/transformers/main_classes/pipelines) ๊ฐ์ฒด์ ์ ๋ฌํฉ๋๋ค.
+
+```python
+from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
+import torch
+
+model = AutoModelForCausalLM.from_pretrained("bigcode/octocoder", torch_dtype=torch.bfloat16, device_map="auto", pad_token_id=0)
+tokenizer = AutoTokenizer.from_pretrained("bigcode/octocoder")
+
+pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
+```
+
+```python
+prompt = "Question: Please write a function in Python that transforms bytes to Giga bytes.\n\nAnswer:"
+
+result = pipe(prompt, max_new_tokens=60)[0]["generated_text"][len(prompt):]
+result
+```
+
+**์ถ๋ ฅ**:
+```
+Here is a Python function that transforms bytes to Giga bytes:\n\n```python\ndef bytes_to_giga_bytes(bytes):\n return bytes / 1024 / 1024 / 1024\n```\n\nThis function takes a single
+```
+
+์ข์ต๋๋ค. ์ด์ ๊ฒฐ๊ณผ๋ฅผ ์ง์ ์ฌ์ฉํ์ฌ ๋ฐ์ดํธ๋ฅผ ๊ธฐ๊ฐ๋ฐ์ดํธ๋ก ๋ณํํ ์ ์์ต๋๋ค.
+
+```python
+def bytes_to_giga_bytes(bytes):
+ return bytes / 1024 / 1024 / 1024
+```
+
+[`torch.cuda.max_memory_allocated`](https://pytorch.org/docs/stable/generated/torch.cuda.max_memory_allocated.html)๋ฅผ ํธ์ถํ์ฌ ์ต๋ GPU ๋ฉ๋ชจ๋ฆฌ ํ ๋น์ ์ธก์ ํด ๋ณด๊ฒ ์ต๋๋ค.
+
+```python
+bytes_to_giga_bytes(torch.cuda.max_memory_allocated())
+```
+
+**์ถ๋ ฅ**:
+```bash
+29.0260648727417
+```
+
+๋๋ต์ ์ผ๋ก ๊ณ์ฐํ ๊ฒฐ๊ณผ์ ๊ฑฐ์ ์ผ์นํฉ๋๋ค! ๋ฐ์ดํธ์์ ํฌ๋ก๋ฐ์ดํธ๋ก ๋ณํํ ๋ 1000์ด ์๋ 1024๋ก ๊ณฑํด์ผ ํ๋ฏ๋ก ์ซ์๊ฐ ์ ํํ์ง ์์ ๊ฒ์ ์ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ ๋๋ต์ ์ผ๋ก ๊ณ์ฐํ ๋ ๊ณต์์ "์ต๋ X GB"์ผ๋ก ์ดํดํ ์ ์์ต๋๋ค. ๋ง์ฝ ์ฐ๋ฆฌ๊ฐ ๋ชจ๋ธ์ float32 ์ ๋ฐ๋๋ก ์คํํ๋ ค๊ณ ํ๋ค๋ฉด ๋ ํฐ ํฌ๊ธฐ์ธ 64GB์ VRAM์ด ํ์ํ์ ๊ฒ์
๋๋ค.
+
+> ๊ฑฐ์ ๋ชจ๋ ๋ชจ๋ธ์ด ์์ฆ bfloat16์ผ๋ก ํ์ต๋๋ฏ๋ก, [GPU๊ฐ bfloat16์ ์ง์](https://discuss.pytorch.org/t/bfloat16-native-support/117155/5)ํ๋ค๋ฉด ๋ชจ๋ธ์ float32 ์ ๋ฐ๋๋ก ์คํํ ์ด์ ๊ฐ ์์ต๋๋ค. float32๋ก ๋๋ฆฌ๋ ๋ชจ๋ธ์ ํ์ตํ ๋ ์ฌ์ฉํ๋ ์ ๋ฐ๋๋ณด๋ค ๋ ๋์ ์ถ๋ก ๊ฒฐ๊ณผ๋ฅผ ์ ๊ณตํ์ง ์์ต๋๋ค.
+
+๋ชจ๋ธ ๊ฐ์ค์น๊ฐ ์ด๋ค ์ ๋ฐ๋ ํ์์ผ๋ก Hub์ ์ ์ฅ๋์ด ์๋์ง ํ์คํ์ง ์์ ๊ฒฝ์ฐ, HuggingFace Hub์์ ํด๋น ์ฒดํฌํฌ์ธํธ config์ `"torch_dtype"`์ ํ์ธํ๋ฉด ๋ฉ๋๋ค, *์*๋ฅผ ๋ค์ด [์ฌ๊ธฐ](https://huggingface.co/meta-llama/Llama-2-7b-hf/blob/6fdf2e60f86ff2481f2241aaee459f85b5b0bbb9/config.json#L21)๋ฅผ ํ์ธํ์ธ์. ๋ชจ๋ธ์ `from_pretrained(..., torch_dtype=...)`๋ก ๋ก๋ํ ๋๋ config์ ๋ช
์๋ ์ ๋ฐ๋ ์ ํ๊ณผ ๋์ผํ ์ ๋ฐ๋๋ก ์ค์ ํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค. ๋จ, ์๋ ์ ํ์ด float32์ธ ๊ฒฝ์ฐ ์ถ๋ก ์ ์ํด `float16` ๋๋ `bfloat16`์ ๋ ๋ค ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+์ด์ `flush(...)` ํจ์๋ฅผ ์ ์ํ์ฌ ๋ชจ๋ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ํด์ ํ๊ณ , GPU ๋ฉ๋ชจ๋ฆฌ์ ์ต๋ ํ ๋น๋์ ์ ํํ๊ฒ ์ธก์ ํ๋๋ก ํฉ์๋ค.
+
+
+```python
+del pipe
+del model
+
+import gc
+import torch
+
+def flush():
+ gc.collect()
+ torch.cuda.empty_cache()
+ torch.cuda.reset_peak_memory_stats()
+```
+
+๋ค์ ์คํ์ ์ํด ๋ฐ๋ก ํธ์ถํด ๋ด
์๋ค.
+
+```python
+flush()
+```
+์ต๊ทผ ๋ฒ์ ์ accelerate ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์๋ `release_memory()`๋ผ๋ ์ ํธ๋ฆฌํฐ ๋ฉ์๋๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+```python
+from accelerate.utils import release_memory
+# ...
+
+release_memory(model)
+```
+
+๋ง์ฝ GPU์ 32GB์ VRAM์ด ์๋ค๋ฉด ์ด๋ป๊ฒ ๋ ๊น์? ๋ชจ๋ธ ๊ฐ์ค์น๋ฅผ ์ฑ๋ฅ์ ํฐ ์์ค ์์ด 8๋นํธ ๋๋ 4๋นํธ๋ก ์์ํํ ์ ์๋ค๋ ๊ฒ์ด ๋ฐํ์ก์ต๋๋ค(์ฐธ๊ณ : [Dettmers et al.](https://arxiv.org/abs/2208.07339)). ์ต๊ทผ์ [GPTQ ๋
ผ๋ฌธ](https://arxiv.org/abs/2210.17323) ์์๋ ๋ชจ๋ธ์ 3๋นํธ ๋๋ 2๋นํธ๋ก ์์ํํด๋ ์ฑ๋ฅ ์์ค์ด ํ์ฉ ๊ฐ๋ฅํ ์์ค์์ ๋ณด์ฌ์ฃผ์์ต๋๋ค๐คฏ.
+
+๋๋ฌด ์์ธํ ๋ด์ฉ์ ๋ค๋ฃจ์ง ์๊ณ ์ค๋ช
ํ์๋ฉด, ์์ํ๋ ๊ฐ์ค์น์ ์ ๋ฐ๋๋ฅผ ์ค์ด๋ฉด์ ๋ชจ๋ธ์ ์ถ๋ก ๊ฒฐ๊ณผ๋ฅผ ๊ฐ๋ฅํ ํ ์ ํํ๊ฒ(์ฆ, bfloat16๊ณผ ์ต๋ํ ๊ฐ๊น๊ฒ) ์ ์งํ๋ ค๊ณ ํฉ๋๋ค. ์์ํ๋ ํนํ ํ
์คํธ ์์ฑ์ ์ ์๋ํ๋๋ฐ, ์ด๋ ์ฐ๋ฆฌ๊ฐ *๊ฐ์ฅ ๊ฐ๋ฅ์ฑ ์๋ ๋ค์ ํ ํฐ ์งํฉ*์ ์ ํํ๋ ๊ฒ์ ์ด์ ์ ๋๊ณ ์๊ธฐ ๋๋ฌธ์ด๋ฉฐ, ๋ค์ ํ ํฐ์ *logit* ๋ถํฌ๊ฐ์ ์ ํํ๊ฒ ์์ธกํ ํ์๋ ์๊ธฐ ๋๋ฌธ์
๋๋ค. ํต์ฌ์ ๋ค์ ํ ํฐ *logit* ๋ถํฌ๊ฐ ๋๋ต์ ์ผ๋ก ๋์ผํ๊ฒ ์ ์ง๋์ด `argmax` ๋๋ `topk` ์ฐ์ฐ์ด ๋์ผํ ๊ฒฐ๊ณผ๋ฅผ ์ ๊ณตํ๋ ๊ฒ์
๋๋ค.
+
+๋ค์ํ ์์ํ ๊ธฐ๋ฒ์ด ์กด์ฌํ์ง๋ง, ์์ธํ ๋ค๋ฃจ์ง๋ ์์ ๊ฒ์
๋๋ค. ์ผ๋ฐ์ ์ผ๋ก ๋ชจ๋ ์์ํ ๊ธฐ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ด ์๋ํฉ๋๋ค:
+
+- 1. ๋ชจ๋ ๊ฐ์ค์น๋ฅผ ๋ชฉํ ์ ๋ฐ๋๋ก ์์ํํฉ๋๋ค.
+- 2. ์์ํ๋ ๊ฐ์ค์น๋ฅผ ๋ก๋ํ๊ณ , bfloat16 ์ ๋ฐ๋์ ์
๋ ฅ ๋ฒกํฐ ์ํ์ค๋ฅผ ๋ชจ๋ธ์ ์ ๋ฌํฉ๋๋ค.
+- 3. ๊ฐ์ค์น๋ฅผ ๋์ ์ผ๋ก bfloat16์ผ๋ก ๋ฐ๋๋ก ์์ํ(dequantize)ํ์ฌ ์
๋ ฅ ๋ฒกํฐ์ ํจ๊ป bfloat16 ์ ๋ฐ๋๋ก ๊ณ์ฐ์ ์ํํฉ๋๋ค.
+
+๊ฐ๋จํ ๋งํด์, *์
๋ ฅ-๊ฐ์ค์น ํ๋ ฌ* ๊ณฑ์
์, \\( X \\)๊ฐ *์
๋ ฅ*, \\( W \\)๊ฐ ๊ฐ์ค์น ํ๋ ฌ, \\( Y \\)๊ฐ ์ถ๋ ฅ์ธ ๊ฒฝ์ฐ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+$$ Y = X * W $$
+
+์ ๊ณต์์ด ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝ๋ฉ๋๋ค
+
+$$ Y = X * \text{dequantize}(W) $$
+
+๋ชจ๋ ํ๋ ฌ ๊ณฑ์
์ ๋ํด ์์ ๊ฐ์ด ์ํ๋ฉ๋๋ค. ์
๋ ฅ์ด ๋คํธ์ํฌ ๊ทธ๋ํ๋ฅผ ํต๊ณผํ๋ฉด์ ๋ชจ๋ ๊ฐ์ค์น ํ๋ ฌ์ ๋ํด ์ญ์์ํ(dequantization)์ ์ฌ์์ํ(re-quantization)๊ฐ ์์ฐจ์ ์ผ๋ก ์ํ๋ฉ๋๋ค.
+
+๋ฐ๋ผ์, ์์ํ๋ ๊ฐ์ค์น๋ฅผ ์ฌ์ฉํ ๋ ์ถ๋ก ์๊ฐ์ด ๊ฐ์ํ์ง **์๊ณ ** ์คํ๋ ค ์ฆ๊ฐํ๋ ๊ฒฝ์ฐ๊ฐ ๋ง์ต๋๋ค. ์ด์ ์ด๋ก ์ ์ถฉ๋ถํ๋ ์ค์ ๋ก ์๋ํด ๋ด
์๋ค! Transformers๋ฅผ ์ฌ์ฉํ์ฌ ๊ฐ์ค์น๋ฅผ ์์ํํ๋ ค๋ฉด [`bitsandbytes`](https://github.com/TimDettmers/bitsandbytes) ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค.
+
+```bash
+!pip install bitsandbytes
+```
+
+๊ทธ๋ฐ ๋ค์ `from_pretrained`์ `load_in_8bit=True` ํ๋๊ทธ๋ฅผ ์ถ๊ฐํ์ฌ 8๋นํธ ์์ํ๋ก ๋ชจ๋ธ์ ๋ก๋ํ ์ ์์ต๋๋ค.
+
+```python
+model = AutoModelForCausalLM.from_pretrained("bigcode/octocoder", load_in_8bit=True, pad_token_id=0)
+```
+
+์ด์ ์์ ๋ฅผ ๋ค์ ์คํํ๊ณ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ์ธก์ ํด ๋ด
์๋ค.
+
+```python
+pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
+
+result = pipe(prompt, max_new_tokens=60)[0]["generated_text"][len(prompt):]
+result
+```
+
+**์ถ๋ ฅ**:
+```
+Here is a Python function that transforms bytes to Giga bytes:\n\n```python\ndef bytes_to_giga_bytes(bytes):\n return bytes / 1024 / 1024 / 1024\n```\n\nThis function takes a single
+```
+
+์ข์ต๋๋ค. ์ ํ๋ ์์ค ์์ด ์ด์ ๊ณผ ๋์ผํ ๊ฒฐ๊ณผ๋ฅผ ์ป๊ณ ์์ต๋๋ค! ์ด๋ฒ์๋ ์ฌ์ฉ๋ ๋ฉ๋ชจ๋ฆฌ ์์ ํ์ธํด ๋ด
์๋ค.
+
+```python
+bytes_to_giga_bytes(torch.cuda.max_memory_allocated())
+```
+
+**์ถ๋ ฅ**:
+```
+15.219234466552734
+```
+
+ํจ์ฌ ์ ๋ค์! ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ด 15GB๋ฅผ ์กฐ๊ธ ๋๋ ์์ค์ผ๋ก ์ค์ด๋ค์ด 4090๊ณผ ๊ฐ์ ์๋น์์ฉ GPU์์๋ ์ด ๋ชจ๋ธ์ ์คํํ ์ ์์ต๋๋ค. ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ์์ ๋งค์ฐ ํฐ ํฅ์์ ๋ณด์ด๊ณ ์์ผ๋ฉฐ ๋ชจ๋ธ ์ถ๋ ฅ์ ํ์ง ์ ํ๋ ๊ฑฐ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ์ถ๋ก ์ค์ ์ฝ๊ฐ์ ์๋ ์ ํ๊ฐ ๋ฐ์ํ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+๋ชจ๋ธ์ ์ญ์ ํ๊ณ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋ค์ ์ด๊ธฐํํฉ๋๋ค.
+
+```python
+del model
+del pipe
+```
+
+```python
+flush()
+```
+
+์ด์ 4๋นํธ ์์ํ๊ฐ ์ ๊ณตํ๋ ์ต๋ GPU ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ ํ์ธํด ๋ด
์๋ค. 4๋นํธ๋ก ๋ชจ๋ธ์ ์์ํํ๋ ค๋ฉด ์ด์ ๊ณผ ๋์ผํ API๋ฅผ ์ฌ์ฉํ๋ ์ด๋ฒ์๋ `load_in_8bit=True` ๋์ `load_in_4bit=True`๋ฅผ ์ ๋ฌํ๋ฉด ๋ฉ๋๋ค.
+
+```python
+model = AutoModelForCausalLM.from_pretrained("bigcode/octocoder", load_in_4bit=True, low_cpu_mem_usage=True, pad_token_id=0)
+
+pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
+
+result = pipe(prompt, max_new_tokens=60)[0]["generated_text"][len(prompt):]
+result
+```
+
+**์ถ๋ ฅ**:
+```
+Here is a Python function that transforms bytes to Giga bytes:\n\n```\ndef bytes_to_gigabytes(bytes):\n return bytes / 1024 / 1024 / 1024\n```\n\nThis function takes a single argument
+```
+
+๋ฐ๋ก ์ ์ฝ๋ ์ค๋ํซ์์ `python`๋ง ๋๋ฝ๋๊ณ , ์ด ์ ๊ณผ ๊ฑฐ์ ๋์ผํ ์ถ๋ ฅ ํ
์คํธ๋ฅผ ๋ณด๊ณ ์์ต๋๋ค. ์ด์ ์ผ๋ง๋ ๋ง์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ํ์ํ๋์ง ํ์ธํด ๋ด
์๋ค.
+
+```python
+bytes_to_giga_bytes(torch.cuda.max_memory_allocated())
+```
+
+**์ถ๋ ฅ**:
+```
+9.543574333190918
+```
+
+9.5GB๋ฐ์ ๋์ง ์์ต๋๋ค! 150์ต ๊ฐ ์ด์์ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ฐ์ง ๋ชจ๋ธ์ธ ๊ฒ์ ๊ฐ์ํ๋ฉด ๋งค์ฐ ์ ์ ์์
๋๋ค.
+
+์ฌ๊ธฐ์๋ ๋ชจ๋ธ์ ์ ํ๋ ์ ํ๊ฐ ๊ฑฐ์ ์์์ ํ์ธํ ์ ์์ง๋ง, ์ค์ ๋ก๋ 4๋นํธ ์์ํ๋ฅผ 8๋นํธ ์์ํ๋ `bfloat16`๋ฅผ ์ฌ์ฉํ ์ถ๋ก ๊ฒฐ๊ณผ์ ๋น๊ตํ๋ฉด ๊ฒฐ๊ณผ๊ฐ ๋ค๋ฅผ ์ ์์ต๋๋ค. ์ฌ์ฉ์๊ฐ ์ง์ ์๋ํด ๋ณด๋ ๊ฒ์ด ์ข๊ฒ ์ต๋๋ค.
+
+๋ํ 4๋นํธ ์์ํ์ ์ฌ์ฉ๋ ๋ ๊ณต๊ฒฉ์ ์ธ ์์ํ ๋ฐฉ๋ฒ์ผ๋ก ์ธํด ์ถ๋ก ์ \\( \text{quantize} \\)์ \\( \text{dequantize} \\) ๊ณผ์ ์ด ๋ ์ค๋ ๊ฑธ๋ฆฌ๋ฏ๋ก ์ฌ๊ธฐ์๋ 8๋นํธ ์์ํ์ ๋น๊ตํ์ฌ ์ถ๋ก ์๋๊ฐ ์ฝ๊ฐ ๋๋ ค์ก์์ ์ ์ํ์ธ์.
+
+```python
+del model
+del pipe
+```
+```python
+flush()
+```
+
+์ ์ฒด์ ์ผ๋ก OctoCoder๋ฅผ 8๋นํธ ์ ๋ฐ๋๋ก ์คํํ๋ฉด ํ์ํ GPU VRAM์ด 32GB์์ 15GB๋ก ์ค์ด๋ค์๊ณ , 4๋นํธ ์ ๋ฐ๋๋ก ๋ชจ๋ธ์ ์คํํ๋ฉด ํ์ํ GPU VRAM์ด 9GB๋ก ๋ ์ค์ด๋๋ ๊ฒ์ ํ์ธํ์ต๋๋ค.
+
+4๋นํธ ์์ํ๋ RTX3090, V100, T4์ ๊ฐ์ GPU์์ ๋ชจ๋ธ์ ์คํํ ์ ์๊ฒ ํด์ฃผ๋ฉฐ, ์ด๋ ๋๋ถ๋ถ์ ์ฌ๋๋ค์ด ์ ๊ทผํ ์ ์๋ GPU์
๋๋ค.
+
+์์ํ์ ๋ํ ๋ ๋ง์ ์ ๋ณด๋ฅผ ํ์ธํ๊ณ 4๋นํธ๋ณด๋ค ๋ ์ ์ GPU VRAM ๋ฉ๋ชจ๋ฆฌ๋ก ๋ชจ๋ธ์ ์์ํํ๊ฑฐ๋, ๋ ๋ง์ ์์ํ ๊ด๋ จ ์ ๋ณด๋ฅผ ๋ณด๋ ค๋ฉด [`AutoGPTQ`](https://huggingface.co/docs/transformers/main/en/main_classes/quantization#autogptq-integration%60) ๊ตฌํ์ ์ฐธ์กฐํ๋ ๊ฒ์ ์ถ์ฒํฉ๋๋ค.
+
+> ๊ฒฐ๋ก ์ ์ผ๋ก, ๋ชจ๋ธ ์์ํ๋ ํฅ์๋ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ๊ณผ ๋ชจ๋ธ ์ ํ์ฑ ๊ฐ์ ๊ท ํ์ ๋ง์ถ๋ ๊ฒ์ด๋ฉฐ, ๊ฒฝ์ฐ์ ๋ฐ๋ผ ์ถ๋ก ์๊ฐ์๋ ์ํฅ์ ๋ฏธ์น ์ ์์ต๋๋ค.
+
+์ค์ ์ฌ๋ก์์ GPU ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ถฉ๋ถํ๋ค๋ฉด, ์์ํ๋ฅผ ๊ณ ๋ คํ ํ์๊ฐ ์์ต๋๋ค. ๊ทธ๋ฌ๋ ๋ง์ GPU๋ ์์ํ ์์ด ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์คํํ ์ ์์ผ๋ฉฐ, ์ด ๊ฒฝ์ฐ 4๋นํธ ๋ฐ 8๋นํธ ์์ํ๊ฐ ๋งค์ฐ ์ ์ฉํ ๋๊ตฌ์
๋๋ค.
+
+์ฌ์ฉ๊ณผ ๊ด๋ จํ ๋ ์์ธํ ์ ๋ณด๋ [ํธ๋์คํฌ๋จธ ์์ํ ๋ฌธ์](https://huggingface.co/docs/transformers/main_classes/quantization#general-usage)๋ฅผ ์ฐธ๊ณ ํ๋ ๊ฒ์ ๊ฐ๋ ฅํ ์ถ์ฒํฉ๋๋ค. ๋ค์์ผ๋ก, ๋ ๋์ ์๊ณ ๋ฆฌ์ฆ๊ณผ ๊ฐ์ ๋ ๋ชจ๋ธ ์ํคํ
์ฒ๋ฅผ ์ฌ์ฉํ์ฌ ๊ณ์ฐ ๋ฐ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ์ ํฅ์์ํค๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+
+## 2. ํ๋์ ์ดํ
์
[[2-flash-attention]]
+
+์ค๋๋ ์ ์ต๊ณ ์ฑ๋ฅ์ ์๋ํ๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๋์ฒด๋ก ํผ๋ํฌ์๋ ๋ ์ด์ด(feed-forward layer), ํ์ฑํ ๋ ์ด์ด(activation layer), ๋ ์ด์ด ์ ๊ทํ ๋ ์ด์ด(layer normalization layer), ๊ทธ๋ฆฌ๊ณ ๊ฐ์ฅ ์ค์ํ ์
ํ ์ดํ
์
๋ ์ด์ด(self-attention layer)๋ก ๊ตฌ์ฑ๋ ์ํคํ
์ฒ๋ฅผ ๊ณต์ ํ๊ณ ์์ต๋๋ค.
+
+์
ํ ์ดํ
์
๋ ์ด์ด๋ ์
๋ ฅ ํ ํฐ ๊ฐ์ ๋ฌธ๋งฅ์ ๊ด๊ณ๋ฅผ ์ดํดํ ์ ์๊ฒ ํด ์ฃผ๊ธฐ ๋๋ฌธ์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ํต์ฌ ์์์
๋๋ค.
+ํ์ง๋ง ์
ํ ์ดํ
์
๋ ์ด์ด์ ์ต๋ GPU ๋ฉ๋ชจ๋ฆฌ ์๋น๋ ์
๋ ฅ ํ ํฐ์ ์(์ดํ \\( N \\)์ผ๋ก ํ๊ธฐ)์ ํจ๊ป ๊ณ์ฐ ๋ฐ ๋ฉ๋ชจ๋ฆฌ ๋ณต์ก์ฑ์ด *2์ฐจ์ *์ผ๋ก ์ฆ๊ฐํฉ๋๋ค. ์
๋ ฅ ์ํ์ค๊ฐ ์งง์ ๊ฒฝ์ฐ(์ต๋ 1000๊ฐ)์๋ ํฌ๊ฒ ๋์ ๋์ง ์์ง๋ง, ๋ ๊ธด ์
๋ ฅ ์ํ์ค(์ฝ 16000๊ฐ)์์๋ ์ฌ๊ฐํ ๋ฌธ์ ๊ฐ ๋ฉ๋๋ค.
+
+์์ธํ ํ ๋ฒ ๋ค์ฌ๋ค ๋ด
์๋ค. ๊ธธ์ด \\( N \\)์ ์
๋ ฅ \\( \mathbf{X} \\)์ ๋ํ ์
ํ ์ดํ
์
๋ ์ด์ด์ ์ถ๋ ฅ \\( \mathbf{O} \\)์ ๊ณ์ฐํ๋ ๊ณต์์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+$$ \textbf{O} = \text{Attn}(\mathbf{X}) = \mathbf{V} \times \text{Softmax}(\mathbf{QK}^T) \text{ with } \mathbf{Q} = \mathbf{W}_q \mathbf{X}, \mathbf{V} = \mathbf{W}_v \mathbf{X}, \mathbf{K} = \mathbf{W}_k \mathbf{X} $$
+
+\\( \mathbf{X} = (\mathbf{x}1, ... \mathbf{x}{N}) \\)๋ ์ดํ
์
๋ ์ด์ด์ ์
๋ ฅ ์ํ์ค์
๋๋ค. ํ๋ก์ ์
\\( \mathbf{Q} \\)์ \\( \mathbf{K} \\)๋ ๊ฐ๊ฐ \\( N \\)๊ฐ์ ๋ฒกํฐ๋ก ๊ตฌ์ฑ๋๋ฉฐ, ๊ทธ ๊ฒฐ๊ณผ \\( \mathbf{QK}^T \\)์ ํฌ๊ธฐ๋ \\( N^2 \\)๊ฐ ๋ฉ๋๋ค.
+
+๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ผ๋ฐ์ ์ผ๋ก ์ฌ๋ฌ ๊ฐ์ ์ดํ
์
ํค๋๋ฅผ ๊ฐ์ง๊ณ ์์ด ์ฌ๋ฌ ๊ฐ์ ์
ํ ์ดํ
์
๊ณ์ฐ์ ๋ณ๋ ฌ๋ก ์ํํฉ๋๋ค. ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด 40๊ฐ์ ์ดํ
์
ํค๋๋ฅผ ๊ฐ์ง๊ณ bfloat16 ์ ๋ฐ๋๋ก ์คํ๋๋ค๊ณ ๊ฐ์ ํ๋ฉด, \\( \mathbf{QK^T} \\) ํ๋ ฌ์ ์ ์ฅํ๋ ๋ฐ ํ์ํ ๋ฉ๋ชจ๋ฆฌ๋ฅผ \\( 40 * 2 * N^2 \\) ๋ฐ์ดํธ๋ก ๊ณ์ฐํ ์ ์์ต๋๋ค. \\( N=1000 \\)์ผ ๋๋ ์ฝ 50MB์ VRAM๋ง ํ์ํ์ง๋ง, \\( N=16000 \\)์ผ ๋๋ 19GB์ VRAM์ด ํ์ํ๋ฉฐ, \\( N=100,000 \\)์ผ ๋๋ \\( \mathbf{QK^T} \\) ํ๋ ฌ์ ์ ์ฅํ๊ธฐ ์ํด ๊ฑฐ์ 1TB์ VRAM์ด ํ์ํฉ๋๋ค.
+
+์์ฝํ์๋ฉด, ๊ธฐ๋ณธ ์
ํ ์ดํ
์
์๊ณ ๋ฆฌ์ฆ์ ํฐ ์
๋ ฅ ์ปจํ
์คํธ์ ๋ํด ๋งค์ฐ ๊ณผ๋ํ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ์ ์๊ตฌํ๊ฒ ๋ฉ๋๋ค.
+
+๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ํ
์คํธ ์ดํด ๋ฐ ์์ฑ ๋ฅ๋ ฅ์ด ๊ฐ์ ๋๋ฉด์ ์ ์ ๋ ๋ณต์กํ ์์
์ ์ฌ์ฉ๋๊ณ ์์ต๋๋ค. ํ๋ ๋ช ๋ฌธ์ฅ์ ๋ฒ์ญ์ด๋ ์์ฝ์ ์ฒ๋ฆฌํ๋ ๋ชจ๋ธ์ด ์ด์ ๋ ์ ์ฒด ํ์ด์ง๋ฅผ ์ฒ๋ฆฌํด์ผ ํ๊ฒ ๋๋ฉด์ ๊ด๋ฒ์ํ ์
๋ ฅ ๊ธธ์ด๋ฅผ ์ฒ๋ฆฌํ ์ ์๋ ๋ฅ๋ ฅ์ด ์๊ตฌ๋๊ณ ์์ต๋๋ค.
+
+์ด๋ป๊ฒ ํ๋ฉด ํฐ ์
๋ ฅ ๊ธธ์ด์ ๋ํ ๊ณผ๋ํ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋ฅผ ์์จ ์ ์์๊น์? \\( QK^T \\) ํ๋ ฌ์ ์ ๊ฑฐํ๋ ์๋ก์ด ์
ํ ์ดํ
์
๋ฉ์ปค๋์ฆ์ ๊ณ์ฐํ๋ ๋ฐฉ๋ฒ์ด ํ์ํฉ๋๋ค. [Tri Dao et al.](https://arxiv.org/abs/2205.14135)์ ๋ฐ๋ก ์ด๋ฌํ ์๋ก์ด ์๊ณ ๋ฆฌ์ฆ์ ๊ฐ๋ฐํ์๊ณ , ๊ทธ๊ฒ์ด **ํ๋์ ์ดํ
์
(Flash Attention)**์
๋๋ค.
+
+๊ฐ๋จํ ๋งํด, ํ๋์ ์ดํ
์
์ \\(\mathbf{V} \times \text{Softmax}(\mathbf{QK}^T\\)) ๊ณ์ฐ์ ๋ถํ ํ๋๋ฐ, ์ฌ๋ฌ ๋ฒ์ ์ํํธ๋งฅ์ค ๊ณ์ฐ์ ๋ฐ๋ณตํ๋ฉด์ ์์ ์ฒญํฌ ๋จ์๋ก ์ถ๋ ฅ์ ๊ณ์ฐํฉ๋๋ค:
+
+$$ \textbf{O}_i \leftarrow s^a_{ij} * \textbf{O}_i + s^b_{ij} * \mathbf{V}_{j} \times \text{Softmax}(\mathbf{QK}^T_{i,j}) \text{ for multiple } i, j \text{ iterations} $$
+
+์ฌ๊ธฐ์ \\( s^a_{ij} \\)์ \\( s^b_{ij} \\)๋ ๊ฐ \\( i \\)์ \\( j \\)์ ๋ํด ๊ณ์ฐ๋๋ ์ํํธ๋งฅ์ค ์ ๊ทํ ํต๊ณ๋์
๋๋ค.
+
+ํ๋์ ์ดํ
์
์ ์ ์ฒด ์๊ณ ๋ฆฌ์ฆ์ ๋ ๋ณต์กํ๋ฉฐ, ๋ณธ ๊ฐ์ด๋์ ๋ฒ์๋ฅผ ๋ฒ์ด๋๊ธฐ ๋๋ฌธ์ ํฌ๊ฒ ๋จ์ํํ์์ต๋๋ค. ์ฌ๋ฌ๋ถ์ ์ ์์ฑ๋ [Flash Attention paper](https://arxiv.org/abs/2205.14135) ๋
ผ๋ฌธ์ ์ฐธ์กฐํ์ฌ ๋ ์์ธํ ๋ด์ฉ์ ํ์ธํด ๋ณด์๊ธฐ ๋ฐ๋๋๋ค.
+
+์ฃผ์ ์์ ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+> ์ํํธ๋งฅ์ค ์ ๊ทํ ํต๊ณ๋๊ณผ ๋ช ๊ฐ์ง ์ค๋งํธํ ์ํ์ ๋ฐฉ๋ฒ์ ์ฌ์ฉํจ์ผ๋ก์จ, ํ๋์ ์ดํ
์
์ ๊ธฐ๋ณธ ์
ํ ์ดํ
์
๋ ์ด์ด์ **์ซ์์ ์ผ๋ก ๋์ผํ** ์ถ๋ ฅ์ ์ ๊ณตํ๊ณ ๋ฉ๋ชจ๋ฆฌ ๋น์ฉ์ \\( N \\)์ ๋ฐ๋ผ ์ ํ์ ์ผ๋ก๋ง ์ฆ๊ฐํฉ๋๋ค.
+
+๊ณต์์ ๋ณด๋ฉด, ํ๋์ ์ดํ
์
์ด ๋ ๋ง์ ๊ณ์ฐ์ ํ์๋ก ํ๊ธฐ ๋๋ฌธ์ ๊ธฐ๋ณธ ์
ํ ์ดํ
์
๊ณต์๋ณด๋ค ํจ์ฌ ๋๋ฆด ๊ฒ์ด๋ผ๊ณ ์๊ฐํ ์ ์์ต๋๋ค. ์ค์ ๋ก ํ๋์ ์ดํ
์
์ ์ํํธ๋งฅ์ค ์ ๊ทํ ํต๊ณ๋์ ์ง์์ ์ผ๋ก ๋ค์ ๊ณ์ฐํด์ผ ํ๊ธฐ ๋๋ฌธ์ ์ผ๋ฐ ์ดํ
์
๋ณด๋ค ๋ ๋ง์ FLOP์ด ํ์ํฉ๋๋ค. (๋ ์์ธํ ๋ด์ฉ์ [๋
ผ๋ฌธ](https://arxiv.org/abs/2205.14135)์ ์ฐธ์กฐํ์ธ์)
+
+> ๊ทธ๋ฌ๋ ํ๋์ ์ดํ
์
์ ๊ธฐ๋ณธ ์ดํ
์
๋ณด๋ค ์ถ๋ก ์๋๊ฐ ํจ์ฌ ๋น ๋ฆ
๋๋ค. ์ด๋ GPU์ ๋๋ฆฌ๊ณ ๊ณ ๋์ญํญ ๋ฉ๋ชจ๋ฆฌ(VRAM)์ ์ฌ์ฉ๋์ ํฌ๊ฒ ์ค์ด๊ณ ๋์ ๋น ๋ฅธ ์จ์นฉ ๋ฉ๋ชจ๋ฆฌ(SRAM)์ ์ง์คํ ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+๋ณธ์ง์ ์ผ๋ก, ํ๋์ ์ดํ
์
์ ๋ชจ๋ ์ค๊ฐ ๋จ๊ณ์ ์ฐ๊ธฐ ๋ฐ ์ฝ๊ธฐ ์์
์ ๋๋ฆฐ VRAM ๋ฉ๋ชจ๋ฆฌ์ ์ ๊ทผํ์ง ์๊ณ ๋น ๋ฅธ *์จ์นฉ* SRAM ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ฌ ์ถ๋ ฅ ๋ฒกํฐ \\( \mathbf{O} \\)๋ฅผ ๊ณ์ฐํ ์ ์๋๋ก ํฉ๋๋ค.
+
+ํ์ค์ ์ผ๋ก ํ๋์ ์ดํ
์
์ด ์ฌ์ฉ ๊ฐ๋ฅํ ๊ฒฝ์ฐ ์ด๋ฅผ **์ฌ์ฉํ์ง ์์** ์ด์ ๋ ์ ํ ์์ต๋๋ค. ์ด ์๊ณ ๋ฆฌ์ฆ์ ์ํ์ ์ผ๋ก ๋์ผํ ์ถ๋ ฅ์ ์ ๊ณตํ๋ฉฐ, ๋ ๋น ๋ฅด๊ณ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ ์
๋๋ค.
+
+์ค์ ์๋ฅผ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+
+์ฐ๋ฆฌ์ OctoCoder ๋ชจ๋ธ์ ์ด์ *์์คํ
ํ๋กฌํํธ*๊ฐ ํฌํจ๋ ํจ์ฌ ๋ ๊ธด ์
๋ ฅ ํ๋กฌํํธ๋ฅผ ๋ฐ๊ฒ ๋ฉ๋๋ค. ์์คํ
ํ๋กฌํํธ๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ฌ์ฉ์์ ์์
์ ๋ง์ถ ๋ ๋์ ์ด์์คํดํธ๋ก ์ ๋ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค. ๋ค์ ์์ ์์๋ OctoCoder๋ฅผ ๋ ๋์ ์ฝ๋ฉ ์ด์์คํดํธ๋ก ๋ง๋ค๊ธฐ ์ํ ์์คํ
ํ๋กฌํํธ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+
+```python
+system_prompt = """Below are a series of dialogues between various people and an AI technical assistant.
+The assistant tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble but knowledgeable.
+The assistant is happy to help with code questions and will do their best to understand exactly what is needed.
+It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer.
+That said, the assistant is practical really does its best, and doesn't let caution get too much in the way of being useful.
+
+The Starcoder models are a series of 15.5B parameter models trained on 80+ programming languages from The Stack (v1.2) (excluding opt-out requests).
+The model uses Multi Query Attention, was trained using the Fill-in-the-Middle objective, and with 8,192 tokens context window for a trillion tokens of heavily deduplicated data.
+
+-----
+
+Question: Write a function that takes two lists and returns a list that has alternating elements from each input list.
+
+Answer: Sure. Here is a function that does that.
+
+def alternating(list1, list2):
+ results = []
+ for i in range(len(list1)):
+ results.append(list1[i])
+ results.append(list2[i])
+ return results
+
+Question: Can you write some test cases for this function?
+
+Answer: Sure, here are some tests.
+
+assert alternating([10, 20, 30], [1, 2, 3]) == [10, 1, 20, 2, 30, 3]
+assert alternating([True, False], [4, 5]) == [True, 4, False, 5]
+assert alternating([], []) == []
+
+Question: Modify the function so that it returns all input elements when the lists have uneven length. The elements from the longer list should be at the end.
+
+Answer: Here is the modified function.
+
+def alternating(list1, list2):
+ results = []
+ for i in range(min(len(list1), len(list2))):
+ results.append(list1[i])
+ results.append(list2[i])
+ if len(list1) > len(list2):
+ results.extend(list1[i+1:])
+ else:
+ results.extend(list2[i+1:])
+ return results
+
+-----
+"""
+```
+์์ฐ์ ์ํด ์์คํ
ํ๋กฌํํธ๋ฅผ 10๋ฒ ์ค๋ณตํ์ฌ ์ฆ๊ฐ์์ผ ํ๋์ ์ดํ
์
์ ๋ฉ๋ชจ๋ฆฌ ์ ์ฝ ํจ๊ณผ๋ฅผ ๊ด์ฐฐํ ์ ์์ ๋งํผ ์
๋ ฅ ๊ธธ์ด๋ฅผ ์ถฉ๋ถํ ๊ธธ๊ฒ ๋ง๋ญ๋๋ค. ์๋์ ํ
์คํธ ํ๋กฌํํธ๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ์ถ๊ฐํฉ๋๋ค. `"Question: Please write a function in Python that transforms bytes to Giga bytes.\n\nAnswer: Here"`
+
+```python
+long_prompt = 10 * system_prompt + prompt
+```
+
+๋ชจ๋ธ์ ๋ค์ bfloat16 ์ ๋ฐ๋๋ก ์ธ์คํด์คํํฉ๋๋ค.
+
+```python
+model = AutoModelForCausalLM.from_pretrained("bigcode/octocoder", torch_dtype=torch.bfloat16, device_map="auto")
+tokenizer = AutoTokenizer.from_pretrained("bigcode/octocoder")
+
+pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
+```
+
+์ด์ ํ๋์ ์ดํ
์
์ *์ฌ์ฉํ์ง ์๊ณ * ์ด์ ๊ณผ ๋์ผํ๊ฒ ๋ชจ๋ธ์ ์คํํ์ฌ ์ต๋ GPU ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋๊ณผ ์ถ๋ก ์๊ฐ์ ์ธก์ ํด ๋ด
์๋ค.
+
+```python
+import time
+
+start_time = time.time()
+result = pipe(long_prompt, max_new_tokens=60)[0]["generated_text"][len(long_prompt):]
+
+print(f"Generated in {time.time() - start_time} seconds.")
+result
+```
+
+**์ถ๋ ฅ**:
+```
+Generated in 10.96854019165039 seconds.
+Sure. Here is a function that does that.\n\ndef bytes_to_giga(bytes):\n return bytes / 1024 / 1024 / 1024\n\nAnswer: Sure. Here is a function that does that.\n\ndef
+````
+
+์ด์ ๊ณผ ๋์ผํ ์ถ๋ ฅ์ ์ป๊ณ ์์ง๋ง, ์ด๋ฒ์๋ ๋ชจ๋ธ์ด ๋ต๋ณ์ ์ฌ๋ฌ ๋ฒ ๋ฐ๋ณตํ์ฌ 60๊ฐ์ ํ ํฐ์ด ์๋ฆด ๋๊น์ง ๊ณ์๋ฉ๋๋ค. ์์ฐ์ ์ํด ์์คํ
ํ๋กฌํํธ๋ฅผ 10๋ฒ ๋ฐ๋ณตํ๊ธฐ ๋๋ฌธ์ ๋ชจ๋ธ์ด ์ค์ค๋ก ๋ฐ๋ณตํ๋๋ก ์ ๋ํ ๊ฒฐ๊ณผ์
๋๋ค. ์ด๋ ๋๋ผ์ด ์ผ์ด ์๋๋๋ค.
+
+**์ฐธ๊ณ ** ์ค์ ์์ฉ์์๋ ์์คํ
ํ๋กฌํํธ๋ฅผ 10๋ฒ ๋ฐ๋ณตํ ํ์๊ฐ ์์ต๋๋ค. ํ ๋ฒ๋ง ์ฌ์ฉํ๋ฉด ์ถฉ๋ถํฉ๋๋ค!
+
+์ต๋ GPU ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋์ ์ธก์ ํด ๋ด
์๋ค.
+
+```python
+bytes_to_giga_bytes(torch.cuda.max_memory_allocated())
+```
+
+**์ถ๋ ฅ**:
+```bash
+37.668193340301514
+```
+
+๋ณด์๋ค์ํผ ์ต๋ GPU ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋์ด ์ฒ์๋ณด๋ค ์๋นํ ๋์์ก์ต๋๋ค. ์ด๋ ์ฃผ๋ก ์
๋ ฅ ์ํ์ค๊ฐ ๊ธธ์ด์ก๊ธฐ ๋๋ฌธ์
๋๋ค. ๋ํ ์์ฑ ์๊ฐ์ด ์ด์ 1๋ถ์ ๋์ด๊ฐ๋๋ค.
+
+๋ค์ ์คํ์ ์ํด `flush()`๋ฅผ ํธ์ถํ์ฌ GPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ด๊ธฐํํฉ๋๋ค.
+
+```python
+flush()
+```
+
+๋น๊ต๋ฅผ ์ํด, ๋์ผํ ๊ธฐ๋ฅ์ ์คํํ๋ ํ๋์ ์ดํ
์
์ ํ์ฑํํด ๋ณด๊ฒ ์ต๋๋ค.
+์ด๋ฅผ ์ํด ๋ชจ๋ธ์ [BetterTransformer](https://huggingface.co/docs/optimum/bettertransformer/overview)๋ก ๋ณํํ๊ณ , ์ด๋ฅผ ํตํด PyTorch์ [SDPA self-attention](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention)์ ํ์ฑํํ๋ฉด ํ๋์ ์ดํ
์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+```python
+model.to_bettertransformer()
+```
+
+์ด์ ์ด์ ๊ณผ ๋์ผํ ์ฝ๋ ์ค๋ํซ์ ์คํํ๋ฉด, ๋ด๋ถ์ ์ผ๋ก Transformers๊ฐ ํ๋์ ์ดํ
์
์ ์ฌ์ฉํ ๊ฒ์
๋๋ค.
+
+```py
+start_time = time.time()
+with torch.backends.cuda.sdp_kernel(enable_flash=True, enable_math=False, enable_mem_efficient=False):
+ result = pipe(long_prompt, max_new_tokens=60)[0]["generated_text"][len(long_prompt):]
+
+print(f"Generated in {time.time() - start_time} seconds.")
+result
+```
+
+**์ถ๋ ฅ**:
+```
+Generated in 3.0211617946624756 seconds.
+ Sure. Here is a function that does that.\n\ndef bytes_to_giga(bytes):\n return bytes / 1024 / 1024 / 1024\n\nAnswer: Sure. Here is a function that does that.\n\ndef
+```
+
+์ด์ ๊ณผ ๋์ผํ ๊ฒฐ๊ณผ๋ฅผ ์ป์์ง๋ง, ํ๋์ ์ดํ
์
๋๋ถ์ ๋งค์ฐ ํฐ ์๋ ํฅ์์ ๊ด์ฐฐํ ์ ์์ต๋๋ค.
+
+๋ฉ๋ชจ๋ฆฌ ์๋น๋์ ๋ง์ง๋ง์ผ๋ก ํ ๋ฒ ๋ ์ธก์ ํด ๋ด
์๋ค.
+
+```python
+bytes_to_giga_bytes(torch.cuda.max_memory_allocated())
+```
+
+**์ถ๋ ฅ**:
+```
+32.617331981658936
+```
+
+๊ทธ๋ฆฌ๊ณ ์ฐ๋ฆฌ๋ ์ฒ์์ ๋ณด์๋ GPU ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ๋์ธ 29GB๋ก ๋์์์ต๋๋ค.
+
+ํ๋์ ์ดํ
์
์ ์ฌ์ฉํ์ฌ ๋งค์ฐ ๊ธด ์
๋ ฅ ์ํ์ค๋ฅผ ์ ๋ฌํ ๋ ์ฒ์์ ์งง์ ์
๋ ฅ ์ํ์ค๋ฅผ ์ ๋ฌํ์ ๋์ ๋น๊ตํ์ฌ ์ฝ 100MB ์ ๋์ GPU ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๋ ์ฌ์ฉํ๋ค๋ ๊ฒ์ ๊ด์ฐฐํ ์ ์์ต๋๋ค.
+
+```py
+flush()
+```
+
+ํ๋์ ์ดํ
์
์ฌ์ฉ์ ๋ํ ์์ธํ ์ ๋ณด๋ [์ด ๋ฌธ์ ํ์ด์ง](https://huggingface.co/docs/transformers/en/perf_infer_gpu_one#flashattention-2)๋ฅผ ์ฐธ์กฐํด ์ฃผ์ธ์.
+
+## 3. ์ํคํ
์ฒ ํ์ [[3-architectural-innovations]]
+
+์ง๊ธ๊น์ง ์ฐ๋ฆฌ๋ ๊ณ์ฐ ๋ฐ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ฑ์ ๊ฐ์ ํ๊ธฐ ์ํด ๋ค์์ ์ดํด๋ณด์์ต๋๋ค:
+
+- ๊ฐ์ค์น๋ฅผ ๋ฎ์ ์ ๋ฐ๋ ํ์์ผ๋ก ๋ณํ
+- ์
ํ ์ดํ
์
์๊ณ ๋ฆฌ์ฆ์ ๋ณด๋ค ๋ ๋ฉ๋ชจ๋ฆฌ ๋ฐ ๊ณ์ฐ ํจ์จ์ ์ธ ๋ฒ์ ์ผ๋ก ๊ต์ฒด
+
+์ด์ ๊ธด ํ
์คํธ ์
๋ ฅ์ด ํ์ํ ์์
์ ๊ฐ์ฅ ํจ๊ณผ์ ์ด๊ณ ํจ์จ์ ์ธ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ์ํคํ
์ฒ๋ก ๋ณ๊ฒฝํ๋ ๋ฐฉ๋ฒ์ ์ดํด๋ณด๊ฒ ์ต๋๋ค. ์์
์ ์์๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+- ๊ฒ์ ์ฆ๊ฐ ์ง์ ์๋ต
+- ์์ฝ
+- ์ฑํ
+
+*์ฑํ
*์ ์ํด์๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ๊ธด ํ
์คํธ ์
๋ ฅ์ ์ฒ๋ฆฌํ๋ ๊ฒ๋ฟ๋ง ์๋๋ผ ์ฌ์ฉ์์ ์ด์์คํดํธ ๊ฐ์ ๋ํ๋ ํจ์จ์ ์ผ๋ก ์ฒ๋ฆฌํ ์ ์์ด์ผ ํฉ๋๋ค(์: ChatGPT).
+
+ํ๋ฒ ํ์ต๋ ํ์๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๊ธฐ๋ณธ ์ํคํ
์ฒ๋ฅผ ๋ณ๊ฒฝํ๊ธฐ ์ด๋ ต๊ธฐ ๋๋ฌธ์, ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์์
์ ๋ํ ๊ณ ๋ ค๋ฅผ ๋ฏธ๋ฆฌ ํ๊ณ ์ด์ ๋ฐ๋ผ ๋ชจ๋ธ์ ์ํคํ
์ฒ๋ฅผ ์ต์ ํํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. ๊ธด ์
๋ ฅ ์ํ์ค์ ๋ํด ๋ฉ๋ชจ๋ฆฌ ๋๋ ์ฑ๋ฅ์ ๋ณ๋ชฉ ํ์์ ๋น ๋ฅด๊ฒ ๋ฐ์์ํค๋ ๋ชจ๋ธ ์ํคํ
์ฒ์ ์ค์ํ ๋ ๊ฐ์ง ๊ตฌ์ฑ ์์๊ฐ ์์ต๋๋ค.
+
+- ์์น ์๋ฒ ๋ฉ
+- ํค-๊ฐ ์บ์
+
+๊ฐ ๊ตฌ์ฑ ์์๋ฅผ ๋ ์์ธํ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+
+### 3.1 ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์์น ์๋ฒ ๋ฉ ๊ฐ์ [[31-improving-positional-embeddings-of-llms]]
+
+์
ํ ์ดํ
์
์ ๊ฐ ํ ํฐ์ ์๋ก์ ํ ํฐ๊ณผ ์ฐ๊ด์ํต๋๋ค.
+์๋ฅผ ๋ค์ด, ํ
์คํธ ์
๋ ฅ ์ํ์ค *"Hello", "I", "love", "you"*์ \\( \text{Softmax}(\mathbf{QK}^T) \\) ํ๋ ฌ์ ๋ค์๊ณผ ๊ฐ์ ์ ์์ต๋๋ค:
+
+
+
+๊ฐ ๋จ์ด ํ ํฐ์ ๋ค๋ฅธ ๋ชจ๋ ๋จ์ด ํ ํฐ์ ์ฃผ์๋ฅผ ๊ธฐ์ธ์ด๋ ํ๋ฅ ์ง๋์ ๋ถ์ฌ๋ฐ์ ๋ชจ๋ ๋ค๋ฅธ ๋จ์ด ํ ํฐ๊ณผ ๊ด๊ณ๋ฅผ ๋งบ๊ฒ ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด, ๋จ์ด *"love"*๋ ๋จ์ด *"Hello"*์ 5%, *"I"*์ 30%, ๊ทธ๋ฆฌ๊ณ ์์ ์๊ฒ 65%์ ์ฃผ์๋ฅผ ๊ธฐ์ธ์
๋๋ค.
+
+์
ํ ์ดํ
์
๊ธฐ๋ฐ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ์์น ์๋ฒ ๋ฉ์ด ์๋ ๊ฒฝ์ฐ ํ
์คํธ ์
๋ ฅ์ ์์น๋ฅผ ์ดํดํ๋ ๋ฐ ํฐ ์ด๋ ค์์ ๊ฒช์ ๊ฒ์
๋๋ค. ์ด๋ \\( \mathbf{QK}^T \\)์ ์ํด ๊ณ์ฐ๋ ํ๋ฅ ์ ์๊ฐ ์๋์ ์์น ๊ฑฐ๋ฆฌ์ ์๊ด์์ด ๊ฐ ๋จ์ด ํ ํฐ์ ๋ค๋ฅธ ๋ชจ๋ ๋จ์ด ํ ํฐ๊ณผ \\( O(1) \\) ๊ณ์ฐ์ผ๋ก ์ฐ๊ด์ํค๊ธฐ ๋๋ฌธ์
๋๋ค. ๋ฐ๋ผ์ ์์น ์๋ฒ ๋ฉ์ด ์๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๊ฐ ํ ํฐ์ด ๋ค๋ฅธ ๋ชจ๋ ํ ํฐ๊ณผ ๋์ผํ ๊ฑฐ๋ฆฌ์ ์๋ ๊ฒ์ผ๋ก ๋ํ๋๊ธฐ ๋๋ฌธ์, *"Hello I love you"*์ *"You love I hello"*๋ฅผ ๊ตฌ๋ถํ๋ ๊ฒ์ด ๋งค์ฐ ์ด๋ ต์ต๋๋ค.
+
+๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ๋ฌธ์ฅ์ ์์๋ฅผ ์ดํดํ๋ ค๋ฉด ์ถ๊ฐ์ ์ธ *๋จ์*๊ฐ ํ์ํ๋ฉฐ, ์ด๋ ์ผ๋ฐ์ ์ผ๋ก *์์น ์ธ์ฝ๋ฉ* (๋๋ *์์น ์๋ฒ ๋ฉ*์ด๋ผ๊ณ ๋ ํจ)์ ํํ๋ก ์ ์ฉ๋ฉ๋๋ค.
+์์น ์ธ์ฝ๋ฉ์ ๊ฐ ํ ํฐ์ ์์น๋ฅผ ์ซ์ ํํ์ผ๋ก ์ธ์ฝ๋ฉํ์ฌ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ๋ฌธ์ฅ์ ์์๋ฅผ ๋ ์ ์ดํดํ ์ ์๋๋ก ๋์์ค๋๋ค.
+
+[*Attention Is All You Need*](https://arxiv.org/abs/1706.03762) ๋
ผ๋ฌธ์ ์ ์๋ค์ ์ฌ์ธ ํจ์ ๊ธฐ๋ฐ์ ์์น ์๋ฒ ๋ฉ \\( \mathbf{P} = \mathbf{p}_1, \ldots, \mathbf{p}_N \\)์ ๋์
ํ์ต๋๋ค. ๊ฐ ๋ฒกํฐ \\( \mathbf{p}_i \\)๋ ์์น \\( i \\)์ ์ฌ์ธ ํจ์๋ก ๊ณ์ฐ๋ฉ๋๋ค. ์์น ์ธ์ฝ๋ฉ์ ์
๋ ฅ ์ํ์ค ๋ฒกํฐ์ ๋จ์ํ ๋ํด์ ธ \\( \mathbf{\hat{X}} = \mathbf{\hat{x}}_1, \ldots, \mathbf{\hat{x}}_N \\) = \\( \mathbf{x}_1 + \mathbf{p}_1, \ldots, \mathbf{x}_N + \mathbf{p}_N \\) ๋ชจ๋ธ์ด ๋ฌธ์ฅ ์์๋ฅผ ๋ ์ ํ์ตํ ์ ์๋๋ก ํฉ๋๋ค.
+
+๊ณ ์ ๋ ์์น ์๋ฒ ๋ฉ ๋์ [Devlin et al.](https://arxiv.org/abs/1810.04805)๊ณผ ๊ฐ์ ๋ค๋ฅธ ์ฐ๊ตฌ์๋ค์ ํ์ต๋ ์์น ์ธ์ฝ๋ฉ์ ์ฌ์ฉํ์ต๋๋ค. ์ด ๊ฒฝ์ฐ ์์น ์๋ฒ ๋ฉ \\( \mathbf{P} \\)์ ํ์ต ์ค์ ์ฌ์ฉ๋ฉ๋๋ค.
+
+์ฌ์ธ ํจ์ ๋ฐ ํ์ต๋ ์์น ์๋ฒ ๋ฉ์ ๋ฌธ์ฅ ์์๋ฅผ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ธ์ฝ๋ฉํ๋ ์ฃผ์ ๋ฐฉ๋ฒ์ด์์ง๋ง, ์ด๋ฌํ ์์น ์ธ์ฝ๋ฉ๊ณผ ๊ด๋ จ๋ ๋ช ๊ฐ์ง ๋ฌธ์ ๊ฐ ๋ฐ๊ฒฌ๋์์ต๋๋ค:
+
+ 1. ์ฌ์ธ ํจ์์ ํ์ต๋ ์์น ์๋ฒ ๋ฉ์ ๋ชจ๋ ์ ๋ ์์น ์๋ฒ ๋ฉ์ผ๋ก, ๊ฐ ์์น ID \\( 0, \ldots, N \\)์ ๋ํด ๊ณ ์ ํ ์๋ฒ ๋ฉ์ ์ธ์ฝ๋ฉํฉ๋๋ค. [Huang et al.](https://arxiv.org/abs/2009.13658) ๋ฐ [Su et al.](https://arxiv.org/abs/2104.09864)์ ์ฐ๊ตฌ์ ๋ฐ๋ฅด๋ฉด, ์ ๋ ์์น ์๋ฒ ๋ฉ์ ๊ธด ํ
์คํธ ์
๋ ฅ์ ๋ํด ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ์ฑ๋ฅ์ด ์ ํ๋ฉ๋๋ค. ๊ธด ํ
์คํธ ์
๋ ฅ์ ๊ฒฝ์ฐ, ๋ชจ๋ธ์ด ์ ๋ ์์น ๋์ ์
๋ ฅ ํ ํฐ ๊ฐ์ ์๋์ ์์น ๊ฑฐ๋ฆฌ๋ฅผ ํ์ตํ๋ ๊ฒ์ด ์ ๋ฆฌํฉ๋๋ค.
+ 2. ํ์ต๋ ์์น ์๋ฒ ๋ฉ์ ์ฌ์ฉํ ๋, ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๊ณ ์ ๋ ์
๋ ฅ ๊ธธ์ด \\( N \\)์ผ๋ก ํ์ต๋์ด์ผ ํ๋ฏ๋ก, ํ์ต๋ ์
๋ ฅ ๊ธธ์ด๋ณด๋ค ๋ ๊ธด ์
๋ ฅ ๊ธธ์ด์ ๋ํด ์ถ๋ก ํ๋ ๊ฒ์ด ์ด๋ ต์ต๋๋ค.
+
+์ต๊ทผ์๋ ์์์ ์ธ๊ธํ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์๋ ์๋์ ์์น ์๋ฒ ๋ฉ์ด ๋ ์ธ๊ธฐ๋ฅผ ๋๊ณ ์์ต๋๋ค. ํนํ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ๋ฒ๋ค์ด ์ฃผ๋ชฉ๋ฐ๊ณ ์์ต๋๋ค:
+
+- [Rotary Position Embedding (RoPE)](https://arxiv.org/abs/2104.09864)
+- [ALiBi](https://arxiv.org/abs/2108.12409)
+
+*RoPE*์ *ALiBi*๋ ๋ชจ๋ ์
ํ ์ดํ
์
์๊ณ ๋ฆฌ์ฆ ๋ด์์ ์ง์ ์ ์ผ๋ก ๋ฌธ์ฅ ์์๋ฅผ ๋ชจ๋ธ์๊ฒ ์๋ ค์ฃผ๋ ๊ฒ์ด ์ต์ ์ด๋ผ๊ณ ์ฃผ์ฅํฉ๋๋ค. ์ด๋ ๋จ์ด ํ ํฐ์ด ์๋ก ๊ด๊ณ๋ฅผ ๋งบ๋ ๊ณณ์ด๊ธฐ ๋๋ฌธ์
๋๋ค. ๊ตฌ์ฒด์ ์ผ๋ก, ๋ฌธ์ฅ ์์๋ฅผ \\( \mathbf{QK}^T \\) ๊ณ์ฐ์ ์์ ํ๋ ๋ฐฉ์์ผ๋ก ์๋ ค์ฃผ์ด์ผ ํ๋ค๋ ๊ฒ์
๋๋ค.
+
+๋๋ฌด ๋ง์ ์ธ๋ถ ์ฌํญ์ ๋ค๋ฃจ์ง ์๊ณ , *RoPE*๋ ์์น ์ ๋ณด๋ฅผ ์ฟผ๋ฆฌ-ํค ์์ ์ธ์ฝ๋ฉํ ์ ์๋ค๊ณ ์ง์ ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ๊ฐ ๋ฒกํฐ \\( \mathbf{q}_i \\)์ \\( \mathbf{x}_j \\)๋ฅผ ๊ฐ๊ฐ \\( \theta * i \\)์ \\( \theta * j \\)์ ๊ฐ๋๋ก ํ์ ์ํด์ผ๋ก์จ ๋ค์๊ณผ ๊ฐ์ด ํํํ ์ ์์ต๋๋ค:
+
+$$ \mathbf{\hat{q}}_i^T \mathbf{\hat{x}}_j = \mathbf{{q}}_i^T \mathbf{R}_{\theta, i -j} \mathbf{{x}}_j. $$
+
+์ฌ๊ธฐ์ \\( \mathbf{R}_{\theta, i - j} \\)๋ ํ์ ํ๋ ฌ์ ๋ํ๋
๋๋ค. \\( \theta \\)๋ ํ๋ จ ์ค์ *ํ์ต๋์ง ์์ผ๋ฉฐ*, ๋์ ํ์ต ์ค ์ต๋ ์
๋ ฅ ์ํ์ค ๊ธธ์ด์ ๋ฐ๋ผ ์ฌ์ ์ ์๋ ๊ฐ์ผ๋ก ์ค์ ๋ฉ๋๋ค.
+
+> ์ด๋ ๊ฒ ํจ์ผ๋ก์จ \\( \mathbf{q}_i \\)์ \\( \mathbf{q}_j \\) ๊ฐ์ ํ๋ฅ ์ ์๋ \\( i \ne j \\)์ธ ๊ฒฝ์ฐ์๋ง ์ํฅ์ ๋ฐ์ผ๋ฉฐ, ๊ฐ ๋ฒกํฐ์ ํน์ ์์น \\( i \\)์ \\( j \\)์๋ ์๊ด์์ด ์ค์ง ์๋์ ๊ฑฐ๋ฆฌ \\( i - j \\)์๋ง ์์กดํ๊ฒ ๋ฉ๋๋ค.
+
+*RoPE*๋ ํ์ฌ ์ฌ๋ฌ ์ค์ํ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ์ฌ์ฉ๋๊ณ ์์ต๋๋ค. ์๋ฅผ ๋ค๋ฉด:
+
+- [**Falcon**](https://huggingface.co/tiiuae/falcon-40b)
+- [**Llama**](https://arxiv.org/abs/2302.13971)
+- [**PaLM**](https://arxiv.org/abs/2204.02311)
+
+๋์์ผ๋ก, *ALiBi*๋ ํจ์ฌ ๋ ๊ฐ๋จํ ์๋์ ์์น ์ธ์ฝ๋ฉ ๋ฐฉ์์ ์ ์ํฉ๋๋ค. ์
๋ ฅ ํ ํฐ ๊ฐ์ ์๋์ ๊ฑฐ๋ฆฌ๋ฅผ ์์์ธ ์ ์๋ก์ ์ฌ์ ์ ์๋ ๊ฐ `m`์ผ๋ก ์ค์ผ์ผ๋งํ์ฌ \\( \mathbf{QK}^T \\) ํ๋ ฌ์ ๊ฐ ์ฟผ๋ฆฌ-ํค ํญ๋ชฉ์ ์ํํธ๋งฅ์ค ๊ณ์ฐ ์ง์ ์ ์ถ๊ฐํฉ๋๋ค.
+
+
+
+[ALiBi](https://arxiv.org/abs/2108.12409) ๋
ผ๋ฌธ์์ ๋ณด์ฌ์ฃผ๋ฏ์ด, ์ด ๊ฐ๋จํ ์๋์ ์์น ์ธ์ฝ๋ฉ์ ๋งค์ฐ ๊ธด ํ
์คํธ ์
๋ ฅ ์ํ์ค์์๋ ๋ชจ๋ธ์ด ๋์ ์ฑ๋ฅ์ ์ ์งํ ์ ์๊ฒ ํฉ๋๋ค.
+
+*ALiBi*๋ ํ์ฌ ์ฌ๋ฌ ์ค์ํ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ๋ชจ๋ธ์ด ์ฌ์ฉํ๊ณ ์์ต๋๋ค. ์๋ฅผ ๋ค๋ฉด:
+
+- [**MPT**](https://huggingface.co/mosaicml/mpt-30b)
+- [**BLOOM**](https://huggingface.co/bigscience/bloom)
+
+*RoPE*์ *ALiBi* ์์น ์ธ์ฝ๋ฉ์ ๋ชจ๋ ํ์ต ์ค์ ๋ณด์ง ๋ชปํ ์
๋ ฅ ๊ธธ์ด์ ๋ํด ํ์ฅํ ์ ์์ผ๋ฉฐ, *ALiBi*๊ฐ *RoPE*๋ณด๋ค ๋ ์ ํ์ฅ๋๋ ๊ฒ์ผ๋ก ๋ํ๋ฌ์ต๋๋ค. *ALiBi*์ ๊ฒฝ์ฐ, ํ์ผ๊ฐ ์์น ํ๋ ฌ์ ๊ฐ์ ์
๋ ฅ ์ํ์ค ๊ธธ์ด์ ๋ง์ถ์ด ์ฆ๊ฐ์ํค๊ธฐ๋ง ํ๋ฉด ๋ฉ๋๋ค. *RoPE*์ ๊ฒฝ์ฐ, ํ์ต ์ค์ ์ฌ์ฉ๋ ๋์ผํ \\( \theta \\)๋ฅผ ์ ์งํ๋ฉด ํ์ต ์ค์ ๋ณด์ง ๋ชปํ ๋งค์ฐ ๊ธด ํ
์คํธ ์
๋ ฅ์ ์ ๋ฌํ ๋ ์ฑ๋ฅ์ด ์ ํ๋ฉ๋๋ค(์ฐธ๊ณ : [Press et al.](https://arxiv.org/abs/2108.12409)). ๊ทธ๋ฌ๋ ์ปค๋ฎค๋ํฐ๋ \\( \theta \\)๋ฅผ ์กฐ์ ํ๋ ๋ช ๊ฐ์ง ํจ๊ณผ์ ์ธ ํธ๋ฆญ์ ์ฐพ์๋์ผ๋ฉฐ, ์ด๋ฅผ ํตํด *RoPE* ์์น ์๋ฒ ๋ฉ์ด ํ์ฅ๋ ํ
์คํธ ์
๋ ฅ ์ํ์ค์์๋ ์ ์๋ํ ์ ์๊ฒ ๋์์ต๋๋ค(์ฐธ๊ณ : [here](https://github.com/huggingface/transformers/pull/24653)).
+
+> RoPE์ ALiBi๋ ๋ชจ๋ ํ๋ จ ์ค์ *ํ์ต๋์ง ์๋* ์๋์ ์์น ์๋ฒ ๋ฉ์ผ๋ก ๋ค์๊ณผ ๊ฐ์ ์ง๊ด์ ๊ธฐ๋ฐํฉ๋๋ค:
+ - ํ
์คํธ ์
๋ ฅ์ ๋ํ ์์น ๋จ์๋ ์
ํ ์ดํ
์
๋ ์ด์ด์ \\( QK^T \\) ํ๋ ฌ์ ์ง์ ์ ๊ณต๋์ด์ผ ํฉ๋๋ค.
+ - ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ผ์ ํ *์๋์ * ๊ฑฐ๋ฆฌ ์์น ์ธ์ฝ๋ฉ์ ์๋ก ํ์ตํ๋๋ก ์ ๋๋์ด์ผ ํฉ๋๋ค.
+ - ํ
์คํธ ์
๋ ฅ ํ ํฐ ๊ฐ์ ๊ฑฐ๋ฆฌ๊ฐ ๋ฉ์ด์ง์๋ก, ๊ทธ๋ค์ ์ฟผ๋ฆฌ-๊ฐ ํ๋ฅ ์ ๋ฎ์์ ธ์ผ ํฉ๋๋ค. RoPE์ ALiBi๋ ์๋ก ๋ฉ๋ฆฌ ๋จ์ด์ง ํ ํฐ์ ์ฟผ๋ฆฌ-ํค ํ๋ฅ ์ ๋ฎ์ถฅ๋๋ค. RoPE๋ ์ฟผ๋ฆฌ-ํค ๋ฒกํฐ ๊ฐ์ ๊ฐ๋๋ฅผ ์ฆ๊ฐ์์ผ ๋ฒกํฐ ๊ณฑ์ ๊ฐ์์ํค๋ ๋ฐฉ์์ผ๋ก, ALiBi๋ ๋ฒกํฐ ๊ณฑ์ ํฐ ์์๋ฅผ ์ถ๊ฐํ๋ ๋ฐฉ์์ผ๋ก ์ด ์์
์ ์ํํฉ๋๋ค.
+
+๊ฒฐ๋ก ์ ์ผ๋ก, ํฐ ํ
์คํธ ์
๋ ฅ์ ์ฒ๋ฆฌํด์ผ ํ๋ ์์
์ ๋ฐฐํฌ๋ ์์ ์ธ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ RoPE์ ALiBi์ ๊ฐ์ ์๋์ ์์น ์๋ฒ ๋ฉ์ผ๋ก ํ๋ จํ๋ ๊ฒ์ด ๋ ์ข์ต๋๋ค. ๋ํ RoPE์ ALiBi๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ จ๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ๊ณ ์ ๊ธธ์ด \\( N_1 = 2048 \\)์์๋ง ํ๋ จ๋์๋๋ผ๋ ์์น ์๋ฒ ๋ฉ์ ์ธ์ฝํ์ฌ \\( N_1 \\)๋ณด๋ค ํจ์ฌ ํฐ ํ
์คํธ ์
๋ ฅ \\( N_2 = 8192 > N_1 \\)๋ก ์ค์ต์์ ์ฌ์ฉํ ์ ์์์ ์ ์ํ์ธ์.
+
+### 3.2 ํค-๊ฐ ์บ์ [[32-the-key-value-cache]]
+
+๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ด์ฉํ ์๊ธฐํ๊ท ํ
์คํธ ์์ฑ์ ์
๋ ฅ ์ํ์ค๋ฅผ ๋ฐ๋ณต์ ์ผ๋ก ๋ฃ๊ณ , ๋ค์ ํ ํฐ์ ์ํ๋งํ๋ฉฐ, ๊ทธ ๋ค์ ํ ํฐ์ ์
๋ ฅ ์ํ์ค์ ์ถ๊ฐํ๊ณ , ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ์์ฑ์ ์๋ฃํ๋ค๋ ํ ํฐ์ ์์ฑํ ๋๊น์ง ์ด๋ฅผ ๊ณ์ ์ํํ๋ ๋ฐฉ์์ผ๋ก ์๋ํฉ๋๋ค.
+
+์๊ธฐํ๊ท ์์ฑ์ด ์ด๋ป๊ฒ ์๋ํ๋์ง์ ๋ํ ์๊ฐ์ ์ค๋ช
์ ๋ณด๋ ค๋ฉด [Transformer's Generate Text Tutorial](https://huggingface.co/docs/transformers/llm_tutorial#generate-text)์ ์ฐธ์กฐํ์ธ์.
+
+์๊ธฐํ๊ท ์์ฑ์ด ์ค์ ๋ก ์ด๋ป๊ฒ ์๋ํ๋์ง ๋ณด์ฌ์ฃผ๋ ๊ฐ๋จํ ์ฝ๋ ์ค๋ํซ์ ์คํํด ๋ณด๊ฒ ์ต๋๋ค. ์ฌ๊ธฐ์๋ `torch.argmax`๋ฅผ ํตํด ๊ฐ์ฅ ๊ฐ๋ฅ์ฑ์ด ๋์ ๋ค์ ํ ํฐ์ ๊ฐ์ ธ์ฌ ๊ฒ์
๋๋ค.
+
+```python
+input_ids = tokenizer(prompt, return_tensors="pt")["input_ids"].to("cuda")
+
+for _ in range(5):
+ next_logits = model(input_ids)["logits"][:, -1:]
+ next_token_id = torch.argmax(next_logits,dim=-1)
+
+ input_ids = torch.cat([input_ids, next_token_id], dim=-1)
+ print("shape of input_ids", input_ids.shape)
+
+generated_text = tokenizer.batch_decode(input_ids[:, -5:])
+generated_text
+```
+
+**์ถ๋ ฅ**:
+```
+shape of input_ids torch.Size([1, 21])
+shape of input_ids torch.Size([1, 22])
+shape of input_ids torch.Size([1, 23])
+shape of input_ids torch.Size([1, 24])
+shape of input_ids torch.Size([1, 25])
+[' Here is a Python function']
+```
+
+๋ณด์๋ค์ํผ ์ํ๋ง๋ ํ ํฐ์ ์ํด ํ
์คํธ ์
๋ ฅ ํ ํฐ์ ๋งค๋ฒ ์ฆ๊ฐ์ํต๋๋ค.
+
+๋งค์ฐ ์์ธ์ ์ธ ๊ฒฝ์ฐ๋ฅผ ์ ์ธํ๊ณ , ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ [์ธ๊ณผ์ ์ธ ์ธ์ด ๋ชจ๋ธ๋ง ๋ชฉํ](https://huggingface.co/docs/transformers/tasks/language_modeling#causal-language-modeling)๋ฅผ ์ฌ์ฉํ์ฌ ํ์ต๋๋ฏ๋ก ์ดํ
์
์ ์์ ์์ผ๊ฐ ํ๋ ฌ์ ๋ง์คํนํฉ๋๋ค. ์ด๊ฒ์ด ์์ ๋ ๋ค์ด์ด๊ทธ๋จ์์ ์ดํ
์
์ ์๊ฐ ๋น์ด ์๋ ์ด์ ์
๋๋ค (์ฆ, 0 ํ๋ฅ ์ ๊ฐ์ง). ์ธ๊ณผ ์ธ์ด ๋ชจ๋ธ๋ง์ ๋ํ ๋น ๋ฅธ ์์ฝ์ [*Illustrated Self Attention ๋ธ๋ก๊ทธ*](https://jalammar.github.io/illustrated-gpt2/#part-2-illustrated-self-attention)๋ฅผ ์ฐธ์กฐํ ์ ์์ต๋๋ค.
+
+๊ฒฐ๊ณผ์ ์ผ๋ก, ํ ํฐ์ *์ ๋* ์ด์ ํ ํฐ์ ์์กดํ์ง ์์ต๋๋ค. ๋ ๊ตฌ์ฒด์ ์ผ๋ก๋ \\( \mathbf{q}_i \\) ๋ฒกํฐ๊ฐ \\( j > i \\)์ธ ๊ฒฝ์ฐ ์ด๋ค ํค, ๊ฐ ๋ฒกํฐ \\( \mathbf{k}_j, \mathbf{v}j \\)์๋ ์ฐ๊ด๋์ง ์์ต๋๋ค. ๋์ \\( \mathbf{q}i \\)๋ ์ด์ ์ ํค-๊ฐ ๋ฒกํฐ \\( \mathbf{k}{m < i}, \mathbf{v}{m < i} \text{ , for } m \in {0, \ldots i - 1} \\)์๋ง ์ฃผ์๋ฅผ ๊ธฐ์ธ์
๋๋ค. ๋ถํ์ํ ๊ณ์ฐ์ ์ค์ด๊ธฐ ์ํด ๊ฐ ์ธต์ ํค-๊ฐ ๋ฒกํฐ๋ฅผ ๋ชจ๋ ์ด์ ์๊ฐ ๋จ๊ณ์ ๋ํด ์บ์ํ ์ ์์ต๋๋ค.
+
+๋ค์์ผ๋ก, ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ๊ฐ ํฌ์๋ ํจ์ค๋ง๋ค ํค-๊ฐ ์บ์๋ฅผ ๊ฒ์ํ๊ณ ์ ๋ฌํ์ฌ ์ด๋ฅผ ํ์ฉํ๋๋ก ํฉ๋๋ค.
+Transformers์์๋ `forward` ํธ์ถ์ `use_cache` ํ๋๊ทธ๋ฅผ ์ ๋ฌํ์ฌ ํค-๊ฐ ์บ์๋ฅผ ๊ฒ์ํ ๋ค์ ํ์ฌ ํ ํฐ๊ณผ ํจ๊ป ์ ๋ฌํ ์ ์์ต๋๋ค.
+
+```python
+past_key_values = None # past_key_values ๋ ํค-๊ฐ ์บ์๋ฅผ ์๋ฏธ
+generated_tokens = []
+next_token_id = tokenizer(prompt, return_tensors="pt")["input_ids"].to("cuda")
+
+for _ in range(5):
+ next_logits, past_key_values = model(next_token_id, past_key_values=past_key_values, use_cache=True).to_tuple()
+ next_logits = next_logits[:, -1:]
+ next_token_id = torch.argmax(next_logits, dim=-1)
+
+ print("shape of input_ids", next_token_id.shape)
+ print("length of key-value cache", len(past_key_values[0][0])) # past_key_values ํํ: [num_layers, 0 for k, 1 for v, batch_size, length, hidden_dim]
+ generated_tokens.append(next_token_id.item())
+
+generated_text = tokenizer.batch_decode(generated_tokens)
+generated_text
+```
+
+**์ถ๋ ฅ**:
+```
+shape of input_ids torch.Size([1, 1])
+length of key-value cache 20
+shape of input_ids torch.Size([1, 1])
+length of key-value cache 21
+shape of input_ids torch.Size([1, 1])
+length of key-value cache 22
+shape of input_ids torch.Size([1, 1])
+length of key-value cache 23
+shape of input_ids torch.Size([1, 1])
+length of key-value cache 24
+[' Here', ' is', ' a', ' Python', ' function']
+```
+
+ํค-๊ฐ ์บ์๋ฅผ ์ฌ์ฉํ ๋, ํ
์คํธ ์
๋ ฅ ํ ํฐ์ ๊ธธ์ด๋ *์ฆ๊ฐํ์ง ์๊ณ * ๋จ์ผ ์
๋ ฅ ๋ฒกํฐ๋ก ์ ์ง๋๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค. ๋ฐ๋ฉด์ ํค-๊ฐ ์บ์์ ๊ธธ์ด๋ ๊ฐ ๋์ฝ๋ฉ ๋จ๊ณ๋ง๋ค ํ๋์ฉ ์ฆ๊ฐํฉ๋๋ค.
+
+> ํค-๊ฐ ์บ์๋ฅผ ์ฌ์ฉํ๋ฉด \\( \mathbf{QK}^T \\)๊ฐ ๋ณธ์ง์ ์ผ๋ก \\( \mathbf{q}_c\mathbf{K}^T \\)๋ก ์ค์ด๋๋๋ฐ, ์ฌ๊ธฐ์ \\( \mathbf{q}_c \\)๋ ํ์ฌ ์ ๋ฌ๋ ์
๋ ฅ ํ ํฐ์ ์ฟผ๋ฆฌ ํ๋ก์ ์
์ผ๋ก, *ํญ์* ๋จ์ผ ๋ฒกํฐ์
๋๋ค.
+
+ํค-๊ฐ ์บ์๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์๋ ๋ ๊ฐ์ง ์ฅ์ ์ด ์์ต๋๋ค:
+- ์ ์ฒด \\( \mathbf{QK}^T \\) ํ๋ ฌ์ ๊ณ์ฐํ๋ ๊ฒ๊ณผ ๋น๊ตํ์ฌ ๊ณ์ฐ ํจ์จ์ฑ์ด ํฌ๊ฒ ํฅ์๋ฉ๋๋ค. ์ด๋ ์ถ๋ก ์๋์ ์ฆ๊ฐ๋ก ์ด์ด์ง๋๋ค.
+- ์์ฑ๋ ํ ํฐ ์์ ๋ฐ๋ผ ํ์ํ ์ต๋ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ด์ฐจ์ ์ผ๋ก ์ฆ๊ฐํ์ง ์๊ณ , ์ ํ์ ์ผ๋ก๋ง ์ฆ๊ฐํฉ๋๋ค.
+
+> ๋ ๊ธด ์
๋ ฅ ์ํ์ค์ ๋ํด ๋์ผํ ๊ฒฐ๊ณผ์ ํฐ ์๋ ํฅ์์ ๊ฐ์ ธ์ค๊ธฐ ๋๋ฌธ์ ํค-๊ฐ ์บ์๋ฅผ *ํญ์* ์ฌ์ฉํด์ผ ํฉ๋๋ค. Transformers๋ ํ
์คํธ ํ์ดํ๋ผ์ธ์ด๋ [`generate` ๋ฉ์๋](https://huggingface.co/docs/transformers/main_classes/text_generation)๋ฅผ ์ฌ์ฉํ ๋ ๊ธฐ๋ณธ์ ์ผ๋ก ํค-๊ฐ ์บ์๋ฅผ ํ์ฑํํฉ๋๋ค.
+
+
+
+์ฐธ๊ณ ๋ก, ํค-๊ฐ ์บ์๋ฅผ ์ฌ์ฉํ ๊ฒ์ ๊ถ์ฅํ์ง๋ง, ์ด๋ฅผ ์ฌ์ฉํ ๋ LLM ์ถ๋ ฅ์ด ์ฝ๊ฐ ๋ค๋ฅผ ์ ์์ต๋๋ค. ์ด๊ฒ์ ํ๋ ฌ ๊ณฑ์
์ปค๋ ์์ฒด์ ํน์ฑ ๋๋ฌธ์
๋๋ค -- ๋ ์์ธํ ๋ด์ฉ์ [์ฌ๊ธฐ](https://github.com/huggingface/transformers/issues/25420#issuecomment-1775317535)์์ ์ฝ์ด๋ณผ ์ ์์ต๋๋ค.
+
+
+
+#### 3.2.1 ๋ฉํฐ ๋ผ์ด๋ ๋ํ [[321-multi-round-conversation]]
+
+ํค-๊ฐ ์บ์๋ ์ฌ๋ฌ ๋ฒ์ ์๊ธฐํ๊ท ๋์ฝ๋ฉ์ด ํ์ํ ์ฑํ
๊ณผ ๊ฐ์ ์ ํ๋ฆฌ์ผ์ด์
์ ํนํ ์ ์ฉํฉ๋๋ค. ์์ ๋ฅผ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+
+```
+User: How many people live in France?
+Assistant: Roughly 75 million people live in France
+User: And how many are in Germany?
+Assistant: Germany has ca. 81 million inhabitants
+```
+
+์ด ์ฑํ
์์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๋ ๋ฒ์ ์๊ธฐํ๊ท ๋์ฝ๋ฉ์ ์คํํฉ๋๋ค:
+ 1. ์ฒซ ๋ฒ์งธ๋ก, ํค-๊ฐ ์บ์๋ ๋น์ด ์๊ณ ์
๋ ฅ ํ๋กฌํํธ๋ `"User: How many people live in France?"`์
๋๋ค. ๋ชจ๋ธ์ ์๊ธฐํ๊ท์ ์ผ๋ก `"Roughly 75 million people live in France"`๋ผ๋ ํ
์คํธ๋ฅผ ์์ฑํ๋ฉฐ ๋์ฝ๋ฉ ๋จ๊ณ๋ง๋ค ํค-๊ฐ ์บ์๋ฅผ ์ฆ๊ฐ์ํต๋๋ค.
+ 2. ๋ ๋ฒ์งธ๋ก, ์
๋ ฅ ํ๋กฌํํธ๋ `"User: How many people live in France? \n Assistant: Roughly 75 million people live in France \n User: And how many in Germany?"`์
๋๋ค. ์บ์ ๋๋ถ์ ์ฒซ ๋ฒ์งธ ๋ ๋ฌธ์ฅ์ ๋ํ ๋ชจ๋ ํค-๊ฐ ๋ฒกํฐ๋ ์ด๋ฏธ ๊ณ์ฐ๋์ด ์์ต๋๋ค. ๋ฐ๋ผ์ ์
๋ ฅ ํ๋กฌํํธ๋ `"User: And how many in Germany?"`๋ก๋ง ๊ตฌ์ฑ๋ฉ๋๋ค. ์ค์ด๋ ์
๋ ฅ ํ๋กฌํํธ๋ฅผ ์ฒ๋ฆฌํ๋ ๋์ ๊ณ์ฐ๋ ํค-๊ฐ ๋ฒกํฐ๊ฐ ์ฒซ ๋ฒ์งธ ๋์ฝ๋ฉ์ ํค-๊ฐ ์บ์์ ์ฐ๊ฒฐ๋ฉ๋๋ค. ๋ ๋ฒ์งธ ์ด์์คํดํธ์ ๋ต๋ณ์ธ `"Germany has ca. 81 million inhabitants"`๋ `"User: How many people live in France? \n Assistant: Roughly 75 million people live in France \n User: And how many are in Germany?"`์ ์ธ์ฝ๋ฉ๋ ํค-๊ฐ ๋ฒกํฐ๋ก ๊ตฌ์ฑ๋ ํค-๊ฐ ์บ์๋ฅผ ์ฌ์ฉํ์ฌ ์๊ธฐํ๊ท์ ์ผ๋ก ์์ฑ๋ฉ๋๋ค.
+
+์ฌ๊ธฐ์ ๋ ๊ฐ์ง๋ฅผ ์ฃผ๋ชฉํด์ผ ํฉ๋๋ค:
+ 1. ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ๋ํ์ ๋ชจ๋ ์ด์ ๋ฌธ๋งฅ์ ์ดํดํ ์ ์๋๋ก ๋ชจ๋ ๋ฌธ๋งฅ์ ์ ์งํ๋ ๊ฒ์ด ์ฑํ
์ ๋ฐฐํฌ๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์์๋ ๋งค์ฐ ์ค์ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์์ ์์์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ฌ์ฉ์๊ฐ `"And how many are in Germany"`๋ผ๊ณ ๋ฌผ์ ๋ ์ธ๊ตฌ๋ฅผ ์ธ๊ธํ๊ณ ์์์ ์ดํดํด์ผ ํฉ๋๋ค.
+ 2. ํค-๊ฐ ์บ์๋ ์ฑํ
์์ ๋งค์ฐ ์ ์ฉํฉ๋๋ค. ์ด๋ ์ธ์ฝ๋ฉ๋ ์ฑํ
๊ธฐ๋ก์ ์ฒ์๋ถํฐ ๋ค์ ์ธ์ฝ๋ฉํ ํ์ ์์ด ๊ณ์ํด์ ํ์ฅํ ์ ์๊ฒ ํด์ฃผ๊ธฐ ๋๋ฌธ์
๋๋ค(์: ์ธ์ฝ๋-๋์ฝ๋ ์ํคํ
์ฒ๋ฅผ ์ฌ์ฉํ ๋์ ๊ฐ์ ๊ฒฝ์ฐ).
+
+`transformers`์์ `generate` ํธ์ถ์ ๊ธฐ๋ณธ์ ์ผ๋ก `use_cache=True`์ ํจ๊ป `return_dict_in_generate=True`๋ฅผ ์ ๋ฌํ๋ฉด `past_key_values`๋ฅผ ๋ฐํํฉ๋๋ค. ์ด๋ ์์ง `pipeline` ์ธํฐํ์ด์ค๋ฅผ ํตํด์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+```python
+# ์ผ๋ฐ์ ์ธ ์์ฑ
+prompt = system_prompt + "Question: Please write a function in Python that transforms bytes to Giga bytes.\n\nAnswer: Here"
+model_inputs = tokenizer(prompt, return_tensors='pt')
+generation_output = model.generate(**model_inputs, max_new_tokens=60, return_dict_in_generate=True)
+decoded_output = tokenizer.batch_decode(generation_output.sequences)[0]
+
+# ๋ฆฌํด๋ `past_key_values`๋ฅผ ํ์ดํ๋ผ์ธํํ์ฌ ๋ค์ ๋ํ ๋ผ์ด๋๋ฅผ ๊ฐ์ํ
+prompt = decoded_output + "\nQuestion: How can I modify the function above to return Mega bytes instead?\n\nAnswer: Here"
+model_inputs = tokenizer(prompt, return_tensors='pt')
+generation_output = model.generate(
+ **model_inputs,
+ past_key_values=generation_output.past_key_values,
+ max_new_tokens=60,
+ return_dict_in_generate=True
+)
+tokenizer.batch_decode(generation_output.sequences)[0][len(prompt):]
+```
+
+**์ถ๋ ฅ**:
+```
+ is a modified version of the function that returns Mega bytes instead.
+
+def bytes_to_megabytes(bytes):
+ return bytes / 1024 / 1024
+
+Answer: The function takes a number of bytes as input and returns the number of
+```
+
+ํ๋ฅญํฉ๋๋ค. ์ดํ
์
์ธต์ ๋์ผํ ํค์ ๊ฐ์ ๋ค์ ๊ณ์ฐํ๋ ๋ฐ ์ถ๊ฐ ์๊ฐ์ด ์์๋์ง ์์ต๋๋ค! ๊ทธ๋ฌ๋ ํ ๊ฐ์ง ๋ฌธ์ ๊ฐ ์์ต๋๋ค. \\( \mathbf{QK}^T \\) ํ๋ ฌ์ ํ์ํ ์ต๋ ๋ฉ๋ชจ๋ฆฌ๋ ํฌ๊ฒ ์ค์ด๋ค์ง๋ง, ๊ธด ์
๋ ฅ ์ํ์ค๋ ๋คํ์ฐจ ์ฑํ
์ ๊ฒฝ์ฐ ํค-๊ฐ ์บ์๋ฅผ ๋ฉ๋ชจ๋ฆฌ์ ๋ณด๊ดํ๋ ๊ฒ์ด ๋งค์ฐ ๋ฉ๋ชจ๋ฆฌ ์ง์ฝ์ ์ด ๋ ์ ์์ต๋๋ค. ํค-๊ฐ ์บ์๋ ๋ชจ๋ ์๊ธฐ ์ดํ
์
์ธต๊ณผ ๋ชจ๋ ์ดํ
์
ํค๋์ ๋ํด ์ด์ ์
๋ ฅ ๋ฒกํฐ \\( \mathbf{x}_i \text{, for } i \in {1, \ldots, c - 1} \\)์ ํค-๊ฐ ๋ฒกํฐ๋ฅผ ์ ์ฅํด์ผ ํ๋ค๋ ์ ์ ๊ธฐ์ตํ์ธ์.
+
+์ด์ ์ ์ฌ์ฉํ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ `bigcode/octocoder`์ ๋ํด ํค-๊ฐ ์บ์์ ์ ์ฅํด์ผ ํ๋ ๋ถ๋ ์์์ ๊ฐ์ ์๋ฅผ ๊ณ์ฐํด ๋ด
์๋ค.
+๋ถ๋ ์์์ ๊ฐ์ ์๋ ์ํ์ค ๊ธธ์ด์ ๋ ๋ฐฐ์ ์ดํ
์
ํค๋ ์, ์ดํ
์
ํค๋ ์ฐจ์, ๋ ์ด์ด ์๋ฅผ ๊ณฑํ ๊ฐ์
๋๋ค.
+๊ฐ์์ ์
๋ ฅ ์ํ์ค ๊ธธ์ด 16000์์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๋ํด ์ด๋ฅผ ๊ณ์ฐํ๋ฉด ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+```python
+config = model.config
+2 * 16_000 * config.n_layer * config.n_head * config.n_embd // config.n_head
+```
+
+**์ถ๋ ฅ**:
+```
+7864320000
+```
+
+๋๋ต 80์ต ๊ฐ์ ๋ถ๋ ์์์ ๊ฐ์
๋๋ค! `float16` ์ ๋ฐ๋๋ก 80์ต ๊ฐ์ ๋ถ๋ ์์์ ๊ฐ์ ์ ์ฅํ๋ ๋ฐ๋ ์ฝ 15GB์ RAM์ด ํ์ํ๋ฉฐ, ์ด๋ ๋ชจ๋ธ ๊ฐ์ค์น ์์ฒด์ ์ ๋ฐ ์ ๋์
๋๋ค.
+์ฐ๊ตฌ์๋ค์ ํค-๊ฐ ์บ์๋ฅผ ์ ์ฅํ๋ ๋ฐ ํ์ํ ๋ฉ๋ชจ๋ฆฌ ๋น์ฉ์ ํฌ๊ฒ ์ค์ผ ์ ์๋ ๋ ๊ฐ์ง ๋ฐฉ๋ฒ์ ์ ์ํ์ผ๋ฉฐ, ์ด๋ ๋ค์ ์ ์์ ์ดํด๋ณด๊ฒ ์ต๋๋ค.
+
+#### 3.2.2 ๋ฉํฐ ์ฟผ๋ฆฌ ์ดํ
์
(MQA) [[322-multi-query-attention-mqa]]
+
+[๋ฉํฐ ์ฟผ๋ฆฌ ์ดํ
์
(MQA)](https://arxiv.org/abs/1911.02150)์ Noam Shazeer์ *Fast Transformer Decoding: One Write-Head is All You Need* ๋
ผ๋ฌธ์์ ์ ์๋์์ต๋๋ค. ์ ๋ชฉ์์ ์ ์ ์๋ฏ์ด, Noam์ `n_head` ํค-๊ฐ ํ๋ก์ ์
๊ฐ์ค์น ๋์ , ๋ชจ๋ ์ดํ
์
ํค๋์์ ๊ณต์ ๋๋ ๋จ์ผ ํค๋-๊ฐ ํ๋ก์ ์
๊ฐ์ค์น๋ฅผ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ, ์ด๋ฅผ ํตํด ๋ชจ๋ธ ์ฑ๋ฅ์ด ํฌ๊ฒ ์ ํ๋์ง ์๋๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค.
+
+> ๋จ์ผ ํค๋-๊ฐ ํ๋ก์ ์
๊ฐ์ค์น๋ฅผ ์ฌ์ฉํจ์ผ๋ก์จ, ํค-๊ฐ ๋ฒกํฐ \\( \mathbf{k}_i, \mathbf{v}_i \\)๋ ๋ชจ๋ ์ดํ
์
ํค๋์์ ๋์ผํด์ผ ํ๋ฉฐ, ์ด๋ ์บ์์ `n_head` ๊ฐ ๋์ ํ๋์ ํค-๊ฐ ํ๋ก์ ์
์๋ง ์ ์ฅํ๋ฉด ๋๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค.
+
+๋๋ถ๋ถ์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด 20์์ 100 ์ฌ์ด์ ์ดํ
์
ํค๋๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์, MQA๋ ํค-๊ฐ ์บ์์ ๋ฉ๋ชจ๋ฆฌ ์๋น๋ฅผ ํฌ๊ฒ ์ค์
๋๋ค. ์ด ๋
ธํธ๋ถ์์ ์ฌ์ฉ๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ์
๋ ฅ ์ํ์ค ๊ธธ์ด 16000์์ ํ์ํ ๋ฉ๋ชจ๋ฆฌ ์๋น๋ฅผ 15GB์์ 400MB ๋ฏธ๋ง์ผ๋ก ์ค์ผ ์ ์์ต๋๋ค.
+
+๋ฉ๋ชจ๋ฆฌ ์ ๊ฐ ์ธ์๋, MQA๋ ๊ณ์ฐ ํจ์จ์ฑ๋ ํฅ์์ํต๋๋ค. ๋ค์๊ณผ ๊ฐ์ด ์ค๋ช
ํฉ๋๋ค.
+์๊ธฐํ๊ท ๋์ฝ๋ฉ์์๋ ํฐ ํค-๊ฐ ๋ฒกํฐ๋ฅผ ๋ค์ ๋ก๋ํ๊ณ , ํ์ฌ ํค-๊ฐ ๋ฒกํฐ ์๊ณผ ์ฐ๊ฒฐํ ํ \\( \mathbf{q}_c\mathbf{K}^T \\) ๊ณ์ฐ์ ๋งค ๋จ๊ณ๋ง๋ค ์
๋ ฅํด์ผ ํฉ๋๋ค. ์๊ธฐํ๊ท ๋์ฝ๋ฉ์ ๊ฒฝ์ฐ, ์ง์์ ์ธ ์ฌ๋ก๋์ ํ์ํ ๋ฉ๋ชจ๋ฆฌ ๋์ญํญ์ด ์ฌ๊ฐํ ์๊ฐ ๋ณ๋ชฉ ํ์์ ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค. ํค-๊ฐ ๋ฒกํฐ์ ํฌ๊ธฐ๋ฅผ ์ค์ด๋ฉด ์ ๊ทผํด์ผ ํ๋ ๋ฉ๋ชจ๋ฆฌ ์์ด ์ค์ด๋ค์ด ๋ฉ๋ชจ๋ฆฌ ๋์ญํญ ๋ณ๋ชฉ ํ์์ด ๊ฐ์ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ [Noam์ ๋
ผ๋ฌธ](https://arxiv.org/abs/1911.02150)์ ์ฐธ์กฐํ์ธ์.
+
+์ฌ๊ธฐ์ ์ดํดํด์ผ ํ ์ค์ํ ๋ถ๋ถ์ ํค-๊ฐ ์ดํ
์
ํค๋ ์๋ฅผ 1๋ก ์ค์ด๋ ๊ฒ์ด ํค-๊ฐ ์บ์๋ฅผ ์ฌ์ฉํ ๋๋ง ์๋ฏธ๊ฐ ์๋ค๋ ๊ฒ์
๋๋ค. ํค-๊ฐ ์บ์ ์์ด ๋จ์ผ ํฌ์๋ ํจ์ค์ ๋ํ ๋ชจ๋ธ์ ์ต๋ ๋ฉ๋ชจ๋ฆฌ ์๋น๋ ๋ณ๊ฒฝ๋์ง ์์ผ๋ฉฐ, ๊ฐ ์ดํ
์
ํค๋๋ ์ฌ์ ํ ๊ณ ์ ํ ์ฟผ๋ฆฌ ๋ฒกํฐ๋ฅผ ๊ฐ์ง๋ฏ๋ก ๊ฐ ์ดํ
์
ํค๋๋ ์ฌ์ ํ ๋ค๋ฅธ \\( \mathbf{QK}^T \\) ํ๋ ฌ์ ๊ฐ์ง๋๋ค.
+
+MQA๋ ์ปค๋ฎค๋ํฐ์์ ๋๋ฆฌ ์ฑํ๋์ด ํ์ฌ ๊ฐ์ฅ ์ธ๊ธฐ ์๋ ๋ง์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์์ ์ฌ์ฉ๋๊ณ ์์ต๋๋ค.
+
+- [**Falcon**](https://huggingface.co/tiiuae/falcon-40b)
+- [**PaLM**](https://arxiv.org/abs/2204.02311)
+- [**MPT**](https://huggingface.co/mosaicml/mpt-30b)
+- [**BLOOM**](https://huggingface.co/bigscience/bloom)
+
+๋ํ, ์ด ๋
ธํธ๋ถ์์ ์ฌ์ฉ๋ ์ฒดํฌํฌ์ธํธ `bigcode/octocoder`๋ MQA๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+
+#### 3.2.3 ๊ทธ๋ฃน ์ฟผ๋ฆฌ ์ดํ
์
(GQA) [[323-grouped-query-attention-gqa]]
+
+[๊ทธ๋ฃน ์ฟผ๋ฆฌ ์ดํ
์
(GQA)](https://arxiv.org/abs/2305.13245)์ Google์ Ainslie ๋ฑ์ ์ฐ๊ตฌ์ง๋ค์ ์ํด ์ ์๋์์ต๋๋ค. ๊ทธ๋ค์ MQA๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ์ข
์ข
์ผ๋ฐ์ ์ธ ๋ฉํฐ ํค-๊ฐ ํค๋ ํ๋ก์ ์
์ ์ฌ์ฉํ๋ ๊ฒ๋ณด๋ค ํ์ง ์ ํ๋ฅผ ๊ฐ์ ธ์ฌ ์ ์๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค. ์ด ๋
ผ๋ฌธ์ ์ฟผ๋ฆฌ ํค๋ ํ๋ก์ ์
๊ฐ์ค์น์ ์๋ฅผ ๋๋ฌด ๊ทน๋จ์ ์ผ๋ก ์ค์ด๋ ๋์ , ๋ ๋ง์ ๋ชจ๋ธ ์ฑ๋ฅ์ ์ ์งํ ์ ์๋ค๊ณ ์ฃผ์ฅํฉ๋๋ค. ๋จ์ผ ํค-๊ฐ ํ๋ก์ ์
๊ฐ์ค์น ๋์ , `n < n_head` ํค-๊ฐ ํ๋ก์ ์
๊ฐ์ค์น๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค. `n_head`๋ณด๋ค ํจ์ฌ ์์ `n`๊ฐ, ์๋ฅผ ๋ค์ด 2, 4 ๋๋ 8์ ์ ํํ๋ฉด, MQA์ ๊ฑฐ์ ๋ชจ๋ ๋ฉ๋ชจ๋ฆฌ ๋ฐ ์๋ ์ด์ ์ ์ ์งํ๋ฉด์ ๋ชจ๋ธ ์ฉ๋์ ๋ ํฌ์ํ๊ณ ๋ฐ๋ผ์ ์ฑ๋ฅ ์ ํ๋ฅผ ์ค์ผ ์ ์์ต๋๋ค.
+
+๋ํ, GQA์ ์ ์๋ค์ ๊ธฐ์กด ๋ชจ๋ธ ์ฒดํฌํฌ์ธํธ๋ฅผ ์๋ ์ฌ์ ํ์ต ๊ณ์ฐ์ 5% ์ ๋์ ์ ์ ์์ผ๋ก GQA ์ํคํ
์ฒ๋ก *์
ํธ๋ ์ด๋*ํ ์ ์์์ ๋ฐ๊ฒฌํ์ต๋๋ค. ์๋ ์ฌ์ ํ์ต ๊ณ์ฐ์ 5%๊ฐ ์ฌ์ ํ ์์ฒญ๋ ์์ผ ์ ์์ง๋ง, GQA *์
ํธ๋ ์ด๋*์ ๊ธฐ์กด ์ฒดํฌํฌ์ธํธ๊ฐ ๋ ๊ธด ์
๋ ฅ ์ํ์ค์์๋ ์ ์ฉํ๋๋ก ํฉ๋๋ค.
+
+GQA๋ ์ต๊ทผ์ ์ ์๋์๊ธฐ ๋๋ฌธ์ ์ด ๋
ธํธ๋ถ์ ์์ฑํ ๋น์์๋ ์ฑํ์ด ๋ ๋์์ต๋๋ค.
+GQA์ ๊ฐ์ฅ ์ฃผ๋ชฉํ ๋งํ ์ ์ฉ ์ฌ๋ก๋ [Llama-v2](https://huggingface.co/meta-llama/Llama-2-70b-hf)์
๋๋ค.
+
+> ๊ฒฐ๋ก ์ ์ผ๋ก, ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด ์๊ธฐํ๊ท ๋์ฝ๋ฉ์ผ๋ก ๋ฐฐํฌ๋๋ฉด์ ์ฑํ
๊ณผ ๊ฐ์ด ํฐ ์
๋ ฅ ์ํ์ค๋ฅผ ๊ฐ์ง ์์
์ ์ฒ๋ฆฌํด์ผ ํ๋ ๊ฒฝ์ฐ GQA ๋๋ MQA๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ๊ฐ๋ ฅํ ๊ถ์ฅ๋ฉ๋๋ค.
+
+
+## ๊ฒฐ๋ก [[conclusion]]
+
+์ฐ๊ตฌ ์ปค๋ฎค๋ํฐ๋ ์ ์ ๋ ํฐ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ์ถ๋ก ์๊ฐ์ ๊ฐ์ํํ๊ธฐ ์ํ ์๋ก์ด ๊ธฐ๋ฐํ ๋ฐฉ๋ฒ๋ค์ ๋์์์ด ์ฐพ์๋ด๊ณ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, [์ถ์ธก ๋์ฝ๋ฉ](https://arxiv.org/abs/2211.17192)์ด๋ผ๋ ์ ๋งํ ์ฐ๊ตฌ ๋ฐฉํฅ์ด ์์ต๋๋ค. ์ฌ๊ธฐ์ "์ฌ์ด ํ ํฐ"์ ๋ ์๊ณ ๋น ๋ฅธ ์ธ์ด ๋ชจ๋ธ์ ์ํด ์์ฑ๋๊ณ , "์ด๋ ค์ด ํ ํฐ"๋ง ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ์์ฒด์ ์ํด ์์ฑ๋ฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ์ด ๋
ธํธ๋ถ์ ๋ฒ์๋ฅผ ๋ฒ์ด๋์ง๋ง, [๋ฉ์ง ๋ธ๋ก๊ทธ ํฌ์คํธ](https://huggingface.co/blog/assisted-generation)์์ ์ฝ์ด๋ณผ ์ ์์ต๋๋ค.
+
+GPT3/4, Llama-2-70b, Claude, PaLM๊ณผ ๊ฐ์ ๊ฑฐ๋ํ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ด [Hugging Face Chat](https://huggingface.co/chat/) ๋๋ ChatGPT์ ๊ฐ์ ์ฑํ
์ธํฐํ์ด์ค์์ ๋น ๋ฅด๊ฒ ์คํ๋ ์ ์๋ ์ด์ ๋ ์์์ ์ธ๊ธํ ์ ๋ฐ๋, ์๊ณ ๋ฆฌ์ฆ, ์ํคํ
์ฒ์ ๊ฐ์ ๋๋ถ์
๋๋ค. ์์ผ๋ก GPU, TPU ๋ฑ๊ณผ ๊ฐ์ ๊ฐ์๊ธฐ๋ ์ ์ ๋ ๋นจ๋ผ์ง๊ณ ๋ ๋ง์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฌ์ฉํ ๊ฒ์
๋๋ค. ๋ฐ๋ผ์ ๊ฐ์ฅ ์ข์ ์๊ณ ๋ฆฌ์ฆ๊ณผ ์ํคํ
์ฒ๋ฅผ ์ฌ์ฉํ์ฌ ์ต๊ณ ์ ํจ์จ์ ์ป๋ ๊ฒ์ด ์ค์ํฉ๋๋ค ๐ค
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/agent.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/agent.md
new file mode 100644
index 0000000000000000000000000000000000000000..d0ef630e2cdf77f4d5755acdc06666c1bd78e88d
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/agent.md
@@ -0,0 +1,134 @@
+
+
+# ์์ด์ ํธ & ๋๊ตฌ [[agents-tools]]
+
+
+
+Transformers Agent๋ ์คํ ์ค์ธ API์ด๋ฏ๋ก ์ธ์ ๋ ์ง ๋ณ๊ฒฝ๋ ์ ์์ต๋๋ค.
+API๋ ๊ธฐ๋ฐ ๋ชจ๋ธ์ด ์์ฃผ ์
๋ฐ์ดํธ๋๋ฏ๋ก, ์์ด์ ํธ๊ฐ ์ ๊ณตํ๋ ๊ฒฐ๊ณผ๋ฌผ์ ๋ฌ๋ผ์ง ์ ์์ต๋๋ค.
+
+
+
+์์ด์ ํธ์ ๋๊ตฌ์ ๋ํด ๋ ์์๋ณด๋ ค๋ฉด [์๊ฐ ๊ฐ์ด๋](../transformers_agents)๋ฅผ ๊ผญ ์ฝ์ด๋ณด์ธ์.
+์ด ํ์ด์ง์๋ ๊ธฐ๋ณธ ํด๋์ค์ ๋ํ API ๋ฌธ์๊ฐ ํฌํจ๋์ด ์์ต๋๋ค.
+
+## ์์ด์ ํธ [[agents]]
+
+์ฐ๋ฆฌ๋ ๊ธฐ๋ณธ [`Agent`] ํด๋์ค๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋ ๊ฐ์ง ์ ํ์ ์์ด์ ํธ๋ฅผ ์ ๊ณตํฉ๋๋ค:
+- [`CodeAgent`]๋ ํ ๋ฒ์ ๋์ํฉ๋๋ค. ์์
์ ํด๊ฒฐํ๊ธฐ ์ํด ์ฝ๋๋ฅผ ์์ฑํ ๋ค์, ๋ฐ๋ก ์คํํฉ๋๋ค.
+- [`ReactAgent`]๋ ๋จ๊ณ๋ณ๋ก ๋์ํ๋ฉฐ, ๊ฐ ๋จ๊ณ๋ ํ๋์ ์๊ฐ, ํ๋์ ๋๊ตฌ ํธ์ถ ๋ฐ ์คํ์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค. ์ด ์์ด์ ํธ์๋ ๋ ๊ฐ์ง ํด๋์ค๊ฐ ์์ต๋๋ค:
+ - [`ReactJsonAgent`]๋ ๋๊ตฌ ํธ์ถ์ JSON์ผ๋ก ์์ฑํฉ๋๋ค.
+ - [`ReactCodeAgent`]๋ ๋๊ตฌ ํธ์ถ์ Python ์ฝ๋๋ก ์์ฑํฉ๋๋ค.
+
+### Agent [[agent]]
+
+[[autodoc]] Agent
+
+### CodeAgent [[codeagent]]
+
+[[autodoc]] CodeAgent
+
+### React agents [[react-agents]]
+
+[[autodoc]] ReactAgent
+
+[[autodoc]] ReactJsonAgent
+
+[[autodoc]] ReactCodeAgent
+
+## Tools [[tools]]
+
+### load_tool [[loadtool]]
+
+[[autodoc]] load_tool
+
+### Tool [[tool]]
+
+[[autodoc]] Tool
+
+### Toolbox [[toolbox]]
+
+[[autodoc]] Toolbox
+
+### PipelineTool [[pipelinetool]]
+
+[[autodoc]] PipelineTool
+
+### launch_gradio_demo [[launchgradiodemo]]
+
+[[autodoc]] launch_gradio_demo
+
+### ToolCollection [[toolcollection]]
+
+[[autodoc]] ToolCollection
+
+## ์์ง [[engines]]
+
+์์ด์ ํธ ํ๋ ์์ํฌ์์ ์ฌ์ฉํ ์ ์๋ ์์ง์ ์์ ๋กญ๊ฒ ๋ง๋ค๊ณ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+์ด ์์ง๋ค์ ๋ค์๊ณผ ๊ฐ์ ์ฌ์์ ๊ฐ์ง๊ณ ์์ต๋๋ค:
+1. ์
๋ ฅ(`List[Dict[str, str]]`)์ ๋ํ [๋ฉ์์ง ํ์](../chat_templating.md)์ ๋ฐ๋ฅด๊ณ ๋ฌธ์์ด์ ๋ฐํํด์ผ ํฉ๋๋ค.
+2. ์ธ์ `stop_sequences`์ ์ํ์ค๊ฐ ์ ๋ฌ๋๊ธฐ *์ ์* ์ถ๋ ฅ์ ์์ฑํ๋ ๊ฒ์ ์ค์งํด์ผ ํฉ๋๋ค.
+
+### HfApiEngine [[HfApiEngine]]
+
+ํธ์๋ฅผ ์ํด, ์์ ์ฌํญ์ ๊ตฌํํ๊ณ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ ์คํ์ ์ํด ์ถ๋ก ์๋ํฌ์ธํธ๋ฅผ ์ฌ์ฉํ๋ `HfApiEngine`์ ์ถ๊ฐํ์ต๋๋ค.
+
+```python
+>>> from transformers import HfApiEngine
+
+>>> messages = [
+... {"role": "user", "content": "Hello, how are you?"},
+... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
+... {"role": "user", "content": "No need to help, take it easy."},
+... ]
+
+>>> HfApiEngine()(messages, stop_sequences=["conversation"])
+
+"That's very kind of you to say! It's always nice to have a relaxed "
+```
+
+[[autodoc]] HfApiEngine
+
+
+## ์์ด์ ํธ ์ ํ [[agent-types]]
+
+์์ด์ ํธ๋ ๋๊ตฌ ๊ฐ์ ๋ชจ๋ ์ ํ์ ๊ฐ์ฒด๋ฅผ ์ฒ๋ฆฌํ ์ ์์ต๋๋ค; ๋๊ตฌ๋ ์์ ํ ๋ฉํฐ๋ชจ๋ฌ์ด๋ฏ๋ก ํ
์คํธ, ์ด๋ฏธ์ง, ์ค๋์ค, ๋น๋์ค ๋ฑ ๋ค์ํ ์ ํ์ ์๋ฝํ๊ณ ๋ฐํํ ์ ์์ต๋๋ค.
+๋๊ตฌ ๊ฐ์ ํธํ์ฑ์ ๋์ด๊ณ ipython (jupyter, colab, ipython ๋
ธํธ๋ถ, ...)์์ ์ด๋ฌํ
+๋ฐํ ๊ฐ์ ์ฌ๋ฐ๋ฅด๊ฒ ๋ ๋๋งํ๊ธฐ ์ํด ์ด๋ฌํ ์ ํ์ ์ค์ฌ์ผ๋ก ๋ํผ ํด๋์ค๋ฅผ
+๊ตฌํํฉ๋๋ค.
+
+๋ํ๋ ๊ฐ์ฒด๋ ์ฒ์๊ณผ ๋์ผํ๊ฒ ์๋ํด์ผ ํฉ๋๋ค; ํ
์คํธ ๊ฐ์ฒด๋ ์ฌ์ ํ ๋ฌธ์์ด๋ก ์๋ํด์ผ ํ๋ฉฐ,
+์ด๋ฏธ์ง ๊ฐ์ฒด๋ ์ฌ์ ํ `PIL.Image`๋ก ์๋ํด์ผ ํฉ๋๋ค.
+
+์ด๋ฌํ ์ ํ์๋ ์ธ ๊ฐ์ง ํน์ ๋ชฉ์ ์ด ์์ต๋๋ค:
+
+- `to_raw`๋ฅผ ํธ์ถํ๋ฉด ๊ธฐ๋ณธ ๊ฐ์ฒด๊ฐ ๋ฐํ๋์ด์ผ ํฉ๋๋ค.
+- `to_string`์ ํธ์ถํ๋ฉด ๊ฐ์ฒด๊ฐ ๋ฌธ์์ด๋ก ๋ฐํ๋์ด์ผ ํฉ๋๋ค:
+`AgentText`์ ๊ฒฝ์ฐ ๋ฌธ์์ด์ด ๋ ์ ์์ง๋ง, ๋ค๋ฅธ ๊ฒฝ์ฐ์๋ ๊ฐ์ฒด์ ์ง๋ ฌํ๋ ๋ฒ์ ์ ๊ฒฝ๋ก์ผ ์ ์์ต๋๋ค.
+- ipython ์ปค๋์์ ํ์ํ ๋ ๊ฐ์ฒด๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ํ์๋์ด์ผ ํฉ๋๋ค.
+
+### AgentText [[agenttext]]
+
+[[autodoc]] transformers.agents.agent_types.AgentText
+
+### AgentImage [[agentimage]]
+
+[[autodoc]] transformers.agents.agent_types.AgentImage
+
+### AgentAudio [[agentaudio]]
+
+[[autodoc]] transformers.agents.agent_types.AgentAudio
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/callback.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/callback.md
new file mode 100644
index 0000000000000000000000000000000000000000..1f280a412989e756b3882f10c9383233e60c08d0
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/callback.md
@@ -0,0 +1,133 @@
+
+
+# ์ฝ๋ฐฑ [[callbacks]]
+
+์ฝ๋ฐฑ์ PyTorch [`Trainer`]์ ๋ฐ๋ณต ํ์ต ๋์์ ์ฌ์ฉ์ ์ ์ํ ์ ์๋ ๊ฐ์ฒด์
๋๋ค
+(์ด ๊ธฐ๋ฅ์ TensorFlow์์๋ ์์ง ๊ตฌํ๋์ง ์์์ต๋๋ค). ์ฝ๋ฐฑ์ ๋ฐ๋ณต ํ์ต์ ์ํ๋ฅผ
+๊ฒ์ฌํ์ฌ (์งํ ์ํฉ ๋ณด๊ณ , TensorBoard ๋๋ ๊ธฐํ ๋จธ์ ๋ฌ๋ ํ๋ซํผ์ ๋ก๊ทธ ๋จ๊ธฐ๊ธฐ ๋ฑ)
+๊ฒฐ์ (์: ์กฐ๊ธฐ ์ข
๋ฃ)์ ๋ด๋ฆด ์ ์์ต๋๋ค.
+
+์ฝ๋ฐฑ์ [`TrainerControl`] ๊ฐ์ฒด๋ฅผ ๋ฐํํ๋ ๊ฒ ์ธ์๋ ๋ฐ๋ณต ํ์ต์์ ์ด๋ค ๊ฒ๋ ๋ณ๊ฒฝํ ์ ์๋
+"์ฝ๊ธฐ ์ ์ฉ" ์ฝ๋ ์กฐ๊ฐ์
๋๋ค. ๋ฐ๋ณต ํ์ต์ ๋ณ๊ฒฝ์ด ํ์ํ ์ฌ์ฉ์ ์ ์ ์์
์ด ํ์ํ ๊ฒฝ์ฐ,
+[`Trainer`]๋ฅผ ์๋ธํด๋์ค๋ก ๋ง๋ค์ด ํ์ํ ๋ฉ์๋๋ค์ ์ค๋ฒ๋ผ์ด๋ํด์ผ ํฉ๋๋ค (์์๋ [trainer](trainer)๋ฅผ ์ฐธ์กฐํ์ธ์).
+
+๊ธฐ๋ณธ์ ์ผ๋ก `TrainingArguments.report_to`๋ `"all"`๋ก ์ค์ ๋์ด ์์ผ๋ฏ๋ก, [`Trainer`]๋ ๋ค์ ์ฝ๋ฐฑ์ ์ฌ์ฉํฉ๋๋ค.
+
+- [`DefaultFlowCallback`]๋ ๋ก๊ทธ, ์ ์ฅ, ํ๊ฐ์ ๋ํ ๊ธฐ๋ณธ ๋์์ ์ฒ๋ฆฌํฉ๋๋ค.
+- [`PrinterCallback`] ๋๋ [`ProgressCallback`]๋ ์งํ ์ํฉ์ ํ์ํ๊ณ ๋ก๊ทธ๋ฅผ ์ถ๋ ฅํฉ๋๋ค
+ ([`TrainingArguments`]๋ฅผ ํตํด tqdm์ ๋นํ์ฑํํ๋ฉด ์ฒซ ๋ฒ์งธ ์ฝ๋ฐฑ์ด ์ฌ์ฉ๋๊ณ , ๊ทธ๋ ์ง ์์ผ๋ฉด ๋ ๋ฒ์งธ๊ฐ ์ฌ์ฉ๋ฉ๋๋ค).
+- [`~integrations.TensorBoardCallback`]๋ TensorBoard๊ฐ (PyTorch >= 1.4
+ ๋๋ tensorboardX๋ฅผ ํตํด) ์ ๊ทผ ๊ฐ๋ฅํ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.WandbCallback`]๋ [wandb](https://www.wandb.com/)๊ฐ ์ค์น๋์ด ์์ผ๋ฉด
+ ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.CometCallback`]๋ [comet_ml](https://www.comet.com/site/)์ด ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.MLflowCallback`]๋ [mlflow](https://www.mlflow.org/)๊ฐ ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.NeptuneCallback`]๋ [neptune](https://neptune.ai/)์ด ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.AzureMLCallback`]๋ [azureml-sdk](https://pypi.org/project/azureml-sdk/)๊ฐ ์ค์น๋์ด
+ ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.CodeCarbonCallback`]๋ [codecarbon](https://pypi.org/project/codecarbon/)์ด ์ค์น๋์ด
+ ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.ClearMLCallback`]๋ [clearml](https://github.com/allegroai/clearml)์ด ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.DagsHubCallback`]๋ [dagshub](https://dagshub.com/)์ด ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.FlyteCallback`]๋ [flyte](https://flyte.org/)๊ฐ ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+- [`~integrations.DVCLiveCallback`]๋ [dvclive](https://dvc.org/doc/dvclive)๊ฐ ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉ๋ฉ๋๋ค.
+
+ํจํค์ง๊ฐ ์ค์น๋์ด ์์ง๋ง ํด๋น ํตํฉ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๊ณ ์ถ์ง ์๋ค๋ฉด, `TrainingArguments.report_to`๋ฅผ ์ฌ์ฉํ๊ณ ์ ํ๋ ํตํฉ ๊ธฐ๋ฅ ๋ชฉ๋ก์ผ๋ก ๋ณ๊ฒฝํ ์ ์์ต๋๋ค (์: `["azure_ml", "wandb"]`).
+
+์ฝ๋ฐฑ์ ๊ตฌํํ๋ ์ฃผ์ ํด๋์ค๋ [`TrainerCallback`]์
๋๋ค. ์ด ํด๋์ค๋ [`Trainer`]๋ฅผ
+์ธ์คํด์คํํ๋ ๋ฐ ์ฌ์ฉ๋ [`TrainingArguments`]๋ฅผ ๊ฐ์ ธ์ค๊ณ , ํด๋น Trainer์ ๋ด๋ถ ์ํ๋ฅผ
+[`TrainerState`]๋ฅผ ํตํด ์ ๊ทผํ ์ ์์ผ๋ฉฐ, [`TrainerControl`]์ ํตํด ๋ฐ๋ณต ํ์ต์์ ์ผ๋ถ
+์์
์ ์ํํ ์ ์์ต๋๋ค.
+
+
+## ์ฌ์ฉ ๊ฐ๋ฅํ ์ฝ๋ฐฑ [[available-callbacks]]
+
+๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ์ฌ์ฉ ๊ฐ๋ฅํ [`TrainerCallback`] ๋ชฉ๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+[[autodoc]] integrations.CometCallback
+ - setup
+
+[[autodoc]] DefaultFlowCallback
+
+[[autodoc]] PrinterCallback
+
+[[autodoc]] ProgressCallback
+
+[[autodoc]] EarlyStoppingCallback
+
+[[autodoc]] integrations.TensorBoardCallback
+
+[[autodoc]] integrations.WandbCallback
+ - setup
+
+[[autodoc]] integrations.MLflowCallback
+ - setup
+
+[[autodoc]] integrations.AzureMLCallback
+
+[[autodoc]] integrations.CodeCarbonCallback
+
+[[autodoc]] integrations.NeptuneCallback
+
+[[autodoc]] integrations.ClearMLCallback
+
+[[autodoc]] integrations.DagsHubCallback
+
+[[autodoc]] integrations.FlyteCallback
+
+[[autodoc]] integrations.DVCLiveCallback
+ - setup
+
+## TrainerCallback [[trainercallback]]
+
+[[autodoc]] TrainerCallback
+
+์ฌ๊ธฐ PyTorch [`Trainer`]์ ํจ๊ป ์ฌ์ฉ์ ์ ์ ์ฝ๋ฐฑ์ ๋ฑ๋กํ๋ ์์๊ฐ ์์ต๋๋ค:
+
+```python
+class MyCallback(TrainerCallback):
+ "A callback that prints a message at the beginning of training"
+
+ def on_train_begin(self, args, state, control, **kwargs):
+ print("Starting training")
+
+
+trainer = Trainer(
+ model,
+ args,
+ train_dataset=train_dataset,
+ eval_dataset=eval_dataset,
+ callbacks=[MyCallback], # ์ฐ๋ฆฌ๋ ์ฝ๋ฐฑ ํด๋์ค๋ฅผ ์ด ๋ฐฉ์์ผ๋ก ์ ๋ฌํ๊ฑฐ๋ ๊ทธ๊ฒ์ ์ธ์คํด์ค(MyCallback())๋ฅผ ์ ๋ฌํ ์ ์์ต๋๋ค
+)
+```
+
+๋ ๋ค๋ฅธ ์ฝ๋ฐฑ์ ๋ฑ๋กํ๋ ๋ฐฉ๋ฒ์ `trainer.add_callback()`์ ํธ์ถํ๋ ๊ฒ์
๋๋ค:
+
+```python
+trainer = Trainer(...)
+trainer.add_callback(MyCallback)
+# ๋ค๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก๋ ์ฝ๋ฐฑ ํด๋์ค์ ์ธ์คํด์ค๋ฅผ ์ ๋ฌํ ์ ์์ต๋๋ค
+trainer.add_callback(MyCallback())
+```
+
+## TrainerState [[trainerstate]]
+
+[[autodoc]] TrainerState
+
+## TrainerControl [[trainercontrol]]
+
+[[autodoc]] TrainerControl
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/configuration.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/configuration.md
new file mode 100644
index 0000000000000000000000000000000000000000..6c6278a02585608a66a600cd610c81af995aaebf
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/configuration.md
@@ -0,0 +1,28 @@
+
+
+# ๊ตฌ์ฑ[[configuration]]
+
+๊ธฐ๋ณธ ํด๋์ค [`PretrainedConfig`]๋ ๋ก์ปฌ ํ์ผ์ด๋ ๋๋ ํ ๋ฆฌ, ๋๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ์ ๊ณตํ๋ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ ๊ตฌ์ฑ(HuggingFace์ AWS S3 ์ ์ฅ์์์ ๋ค์ด๋ก๋๋จ)์ผ๋ก๋ถํฐ ๊ตฌ์ฑ์ ๋ถ๋ฌ์ค๊ฑฐ๋ ์ ์ฅํ๋ ๊ณตํต ๋ฉ์๋๋ฅผ ๊ตฌํํฉ๋๋ค. ๊ฐ ํ์ ๊ตฌ์ฑ ํด๋์ค๋ ๋ชจ๋ธ๋ณ ํน์ฑ์ ๊ตฌํํฉ๋๋ค.
+
+๋ชจ๋ ๊ตฌ์ฑ ํด๋์ค์ ์กด์ฌํ๋ ๊ณตํต ์์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค: `hidden_size`, `num_attention_heads`, `num_hidden_layers`. ํ
์คํธ ๋ชจ๋ธ์ ์ถ๊ฐ๋ก `vocab_size`๋ฅผ ๊ตฌํํฉ๋๋ค.
+
+
+## PretrainedConfig[[transformers.PretrainedConfig]]
+
+[[autodoc]] PretrainedConfig
+ - push_to_hub
+ - all
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/data_collator.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/data_collator.md
new file mode 100644
index 0000000000000000000000000000000000000000..0e677c7d8979b87b418d800978174f1a65701f3a
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/data_collator.md
@@ -0,0 +1,66 @@
+
+
+# ๋ฐ์ดํฐ ์ฝ๋ ์ดํฐ(Data Collator)[[data-collator]]
+
+๋ฐ์ดํฐ ์ฝ๋ ์ดํฐ๋ ๋ฐ์ดํฐ์
์์๋ค์ ๋ฆฌ์คํธ๋ฅผ ์
๋ ฅ์ผ๋ก ์ฌ์ฉํ์ฌ ๋ฐฐ์น๋ฅผ ํ์ฑํ๋ ๊ฐ์ฒด์
๋๋ค. ์ด๋ฌํ ์์๋ค์ `train_dataset` ๋๋ `eval_dataset์` ์์๋ค๊ณผ ๋์ผํ ํ์
์
๋๋ค. ๋ฐฐ์น๋ฅผ ๊ตฌ์ฑํ๊ธฐ ์ํด, ๋ฐ์ดํฐ ์ฝ๋ ์ดํฐ๋ (ํจ๋ฉ๊ณผ ๊ฐ์) ์ผ๋ถ ์ฒ๋ฆฌ๋ฅผ ์ ์ฉํ ์ ์์ต๋๋ค. [`DataCollatorForLanguageModeling`]๊ณผ ๊ฐ์ ์ผ๋ถ ์ฝ๋ ์ดํฐ๋ ํ์ฑ๋ ๋ฐฐ์น์ (๋ฌด์์ ๋ง์คํน๊ณผ ๊ฐ์) ์ผ๋ถ ๋ฌด์์ ๋ฐ์ดํฐ ์ฆ๊ฐ๋ ์ ์ฉํฉ๋๋ค. ์ฌ์ฉ ์์๋ [์์ ์คํฌ๋ฆฝํธ](../examples)๋ [์์ ๋
ธํธ๋ถ](../notebooks)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+
+## ๊ธฐ๋ณธ ๋ฐ์ดํฐ ์ฝ๋ ์ดํฐ[[transformers.default_data_collator]]
+
+[[autodoc]] data.data_collator.default_data_collator
+
+## DefaultDataCollator[[transformers.DefaultDataCollator]]
+
+[[autodoc]] data.data_collator.DefaultDataCollator
+
+## DataCollatorWithPadding[[transformers.DataCollatorWithPadding]]
+
+[[autodoc]] data.data_collator.DataCollatorWithPadding
+
+## DataCollatorForTokenClassification[[transformers.DataCollatorForTokenClassification]]
+
+[[autodoc]] data.data_collator.DataCollatorForTokenClassification
+
+## DataCollatorForSeq2Seq[[transformers.DataCollatorForSeq2Seq]]
+
+[[autodoc]] data.data_collator.DataCollatorForSeq2Seq
+
+## DataCollatorForLanguageModeling[[transformers.DataCollatorForLanguageModeling]]
+
+[[autodoc]] data.data_collator.DataCollatorForLanguageModeling
+ - numpy_mask_tokens
+ - tf_mask_tokens
+ - torch_mask_tokens
+
+## DataCollatorForWholeWordMask[[transformers.DataCollatorForWholeWordMask]]
+
+[[autodoc]] data.data_collator.DataCollatorForWholeWordMask
+ - numpy_mask_tokens
+ - tf_mask_tokens
+ - torch_mask_tokens
+
+## DataCollatorForPermutationLanguageModeling[[transformers.DataCollatorForPermutationLanguageModeling]]
+
+[[autodoc]] data.data_collator.DataCollatorForPermutationLanguageModeling
+ - numpy_mask_tokens
+ - tf_mask_tokens
+ - torch_mask_tokens
+
+## DataCollatorWithFlatteningtransformers.DataCollatorWithFlattening
+
+[[autodoc]] data.data_collator.DataCollatorWithFlattening
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/executorch.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/executorch.md
new file mode 100644
index 0000000000000000000000000000000000000000..a94418ece1a7abcc88b46afea148d02e89683c61
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/executorch.md
@@ -0,0 +1,33 @@
+
+
+
+# ExecuTorch [[executorch]]
+
+[`ExecuTorch`](https://github.com/pytorch/executorch) ๋ ์จ์ด๋ฌ๋ธ, ์๋ฒ ๋๋ ์ฅ์น, ๋ง์ดํฌ๋ก์ปจํธ๋กค๋ฌ๋ฅผ ํฌํจํ ๋ชจ๋ฐ์ผ ๋ฐ ์ฃ์ง ์ฅ์น์์ ์จ๋๋ฐ์ด์ค ์ถ๋ก ๊ธฐ๋ฅ์ ๊ฐ๋ฅํ๊ฒ ํ๋ ์ข
ํฉ ์๋ฃจ์
์
๋๋ค. PyTorch ์ํ๊ณ์ ์ํด์์ผ๋ฉฐ, ์ด์์ฑ, ์์ฐ์ฑ, ์ฑ๋ฅ์ ์ค์ ์ ๋ PyTorch ๋ชจ๋ธ ๋ฐฐํฌ๋ฅผ ์ง์ํฉ๋๋ค.
+
+ExecuTorch๋ ๋ฐฑ์๋ ์์, ์ฌ์ฉ์ ์ ์ ์ปดํ์ผ๋ฌ ๋ณํ, ๋ฉ๋ชจ๋ฆฌ ๊ณํ ๋ฑ ๋ชจ๋ธ, ์ฅ์น ๋๋ ํน์ ์ ์ฆ์ผ์ด์ค ๋ง์ถค ์ต์ ํ๋ฅผ ์ํํ ์ ์๋ ์ง์
์ ์ ๋ช
ํํ๊ฒ ์ ์ํฉ๋๋ค. ExecuTorch๋ฅผ ์ฌ์ฉํด ์ฃ์ง ์ฅ์น์์ PyTorch ๋ชจ๋ธ์ ์คํํ๋ ์ฒซ ๋ฒ์งธ ๋จ๊ณ๋ ๋ชจ๋ธ์ ์ต์คํฌํธํ๋ ๊ฒ์
๋๋ค. ์ด ์์
์ PyTorch API์ธ [`torch.export`](https://pytorch.org/docs/stable/export.html)๋ฅผ ์ฌ์ฉํ์ฌ ์ํํฉ๋๋ค.
+
+
+## ExecuTorch ํตํฉ [[transformers.TorchExportableModuleWithStaticCache]]
+
+`torch.export`๋ฅผ ์ฌ์ฉํ์ฌ ๐ค Transformers๋ฅผ ์ต์คํฌํธ ํ ์ ์๋๋ก ํตํฉ ์ง์ ์ด ๊ฐ๋ฐ๋๊ณ ์์ต๋๋ค. ์ด ํตํฉ์ ๋ชฉํ๋ ์ต์คํฌํธ๋ฟ๋ง ์๋๋ผ, ์ต์คํฌํธํ ์ํฐํฉํธ๊ฐ `ExecuTorch`์์ ํจ์จ์ ์ผ๋ก ์คํ๋ ์ ์๋๋ก ๋ ์ถ์ํ๊ณ ์ต์ ํํ๋ ๊ฒ์
๋๋ค. ํนํ ๋ชจ๋ฐ์ผ ๋ฐ ์ฃ์ง ์ ์ฆ์ผ์ด์ค์ ์ค์ ์ ๋๊ณ ์์ต๋๋ค.
+
+[[autodoc]] integrations.executorch.TorchExportableModuleWithStaticCache
+ - forward
+
+[[autodoc]] integrations.executorch.convert_and_export_with_cache
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/feature_extractor.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/feature_extractor.md
new file mode 100644
index 0000000000000000000000000000000000000000..7c667424c4ff956a1b1dce95db970b88d5aa7eb4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/feature_extractor.md
@@ -0,0 +1,39 @@
+
+
+# ํน์ฑ ์ถ์ถ๊ธฐ [[feature-extractor]]
+
+ํน์ฑ ์ถ์ถ๊ธฐ๋ ์ค๋์ค ๋๋ ๋น์ ๋ชจ๋ธ์ ์ํ ์
๋ ฅ ํน์ฑ์ ์ค๋นํ๋ ์ญํ ์ ํฉ๋๋ค. ์ฌ๊ธฐ์๋ ์ํ์ค์์ ํน์ฑ์ ์ถ์ถํ๋ ์์
(์๋ฅผ ๋ค์ด, ์ค๋์ค ํ์ผ์ ์ ์ฒ๋ฆฌํ์ฌ Log-Mel ์คํํธ๋ก๊ทธ๋จ ํน์ฑ์ ์์ฑํ๋ ๊ฒ), ์ด๋ฏธ์ง์์ ํน์ฑ์ ์ถ์ถํ๋ ์์
(์๋ฅผ ๋ค์ด, ์ด๋ฏธ์ง ํ์ผ์ ์๋ฅด๋ ๊ฒ)์ด ํฌํจ๋ฉ๋๋ค. ๋ฟ๋ง ์๋๋ผ ํจ๋ฉ, ์ ๊ทํ ๋ฐ NumPy, PyTorch, TensorFlow ํ
์๋ก์ ๋ณํ๋ ํฌํจ๋ฉ๋๋ค.
+
+
+## FeatureExtractionMixin [[transformers.FeatureExtractionMixin]]
+
+[[autodoc]] feature_extraction_utils.FeatureExtractionMixin
+ - from_pretrained
+ - save_pretrained
+
+## SequenceFeatureExtractor [[transformers.SequenceFeatureExtractor]]
+
+[[autodoc]] SequenceFeatureExtractor
+ - pad
+
+## BatchFeature [[transformers.BatchFeature]]
+
+[[autodoc]] BatchFeature
+
+## ImageFeatureExtractionMixin [[transformers.ImageFeatureExtractionMixin]]
+
+[[autodoc]] image_utils.ImageFeatureExtractionMixin
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/keras_callbacks.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/keras_callbacks.md
new file mode 100644
index 0000000000000000000000000000000000000000..25d5ea3e40083acad8fa9257ce2c7cfef7c3d9c8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/keras_callbacks.md
@@ -0,0 +1,27 @@
+
+
+# ์ผ๋ผ์ค ์ฝ๋ฐฑ[[keras-callbacks]]
+
+์ผ๋ผ์ค๋ก ํธ๋์คํฌ๋จธ ๋ชจ๋ธ์ ํ์ตํ ๋, ์ผ๋ฐ์ ์ธ ์์
์ ์๋ํํ๊ธฐ ์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ ์ฉ ์ฝ๋ฐฑ๋ค์ ์ฌ์ฉ ํ ์ ์์ต๋๋ค.
+
+## KerasMetricCallback[[transformers.KerasMetricCallback]]
+
+[[autodoc]] KerasMetricCallback
+
+## PushToHubCallback[[transformers.PushToHubCallback]]
+
+[[autodoc]] PushToHubCallback
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/logging.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/logging.md
new file mode 100644
index 0000000000000000000000000000000000000000..55e1a21c7bd57bb1b9f8e0f47052fa085340f65b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/logging.md
@@ -0,0 +1,108 @@
+
+
+# ๋ก๊น
[[logging]]
+
+๐ค ํธ๋์คํฌ๋จธ๋ ์ค์ ์ง์ค์ ๋ก๊น
์์คํ
์ ์ ๊ณตํ์ฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ถ๋ ฅ ๋ ๋ฒจ์ ์ฝ๊ฒ ์ค์ ํ ์ ์์ต๋๋ค.
+
+ํ์ฌ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ธฐ๋ณธ ์ถ๋ ฅ ๋ ๋ฒจ์ `WARNING`์ผ๋ก ์ค์ ๋์ด ์์ต๋๋ค.
+
+์ถ๋ ฅ ๋ ๋ฒจ์ ๋ณ๊ฒฝํ๋ ค๋ฉด ์ง์ ์ ์ธ ์ค์ ๋ฉ์๋๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ์ถ๋ ฅ ๋ ๋ฒจ์ INFO ์์ค์ผ๋ก ๋ณ๊ฒฝํ๋ ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+```python
+import transformers
+
+transformers.logging.set_verbosity_info()
+```
+
+ํ๊ฒฝ ๋ณ์ `TRANSFORMERS_VERBOSITY`๋ฅผ ์ฌ์ฉํ์ฌ ๊ธฐ๋ณธ ์ถ๋ ฅ ๋ ๋ฒจ์ ์ฌ์ ์ํ ์๋ ์์ต๋๋ค. ์ด๋ฅผ `debug`, `info`, `warning`, `error`, `critical`, `fatal` ์ค ํ๋๋ก ์ค์ ํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+```bash
+TRANSFORMERS_VERBOSITY=error ./myprogram.py
+```
+
+๋ํ, ์ผ๋ถ `warnings`๋ ํ๊ฒฝ ๋ณ์ `TRANSFORMERS_NO_ADVISORY_WARNINGS`๋ฅผ 1๊ณผ ๊ฐ์ true ๊ฐ์ผ๋ก ์ค์ ํ์ฌ ๋นํ์ฑํํ ์ ์์ต๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด [`logger.warning_advice`]๋ฅผ ์ฌ์ฉํ์ฌ ๊ธฐ๋ก๋ ๊ฒฝ๊ณ ๊ฐ ๋นํ์ฑํ๋ฉ๋๋ค. ์๋ฅผ ๋ค์ด ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+```bash
+TRANSFORMERS_NO_ADVISORY_WARNINGS=1 ./myprogram.py
+```
+
+๋ค์์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋์ผํ ๋ก๊ฑฐ๋ฅผ ์์ ์ ๋ชจ๋์ด๋ ์คํฌ๋ฆฝํธ์์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ์์์
๋๋ค.
+
+```python
+from transformers.utils import logging
+
+logging.set_verbosity_info()
+logger = logging.get_logger("transformers")
+logger.info("INFO")
+logger.warning("WARN")
+```
+
+
+์ด ๋ก๊น
๋ชจ๋์ ๋ชจ๋ ๋ฉ์๋๋ ์๋์ ๋ฌธ์ํ๋์ด ์์ผ๋ฉฐ, ์ฃผ์ ๋ฉ์๋๋ ํ์ฌ ๋ก๊ฑฐ์ ์ถ๋ ฅ ์์ค์ ๊ฐ์ ธ์ค๋ [`logging.get_verbosity`]์ ์ํ๋ ์ถ๋ ฅ ์์ค์ผ๋ก ์ค์ ํ๋ [`logging.set_verbosity`] ์
๋๋ค. ์ถ๋ ฅ ์์ค์ (๊ฐ์ฅ ์ ์ ์ถ๋ ฅ์์ ๊ฐ์ฅ ๋ง์ ์ถ๋ ฅ ์์ผ๋ก) ๋ค์๊ณผ ๊ฐ์ผ๋ฉฐ, ํด๋น ์์ค์ ๋์ํ๋ ์ ์ ๊ฐ์ ๊ดํธ ์์ ํ์๋ฉ๋๋ค.
+
+- `transformers.logging.CRITICAL` ๋๋ `transformers.logging.FATAL` (์ ์ซ๊ฐ, 50): ๊ฐ์ฅ ์ฌ๊ฐํ ์ค๋ฅ๋ง ๋ณด๊ณ ํฉ๋๋ค.
+- `transformers.logging.ERROR` (์ ์ซ๊ฐ, 40): ์ค๋ฅ๋ง ๋ณด๊ณ ํฉ๋๋ค.
+- `transformers.logging.WARNING` ๋๋ `transformers.logging.WARN` (์ ์ซ๊ฐ, 30): ์ค๋ฅ์ ๊ฒฝ๊ณ ๋ง ๋ณด๊ณ ํฉ๋๋ค. ์ด๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ๊ธฐ๋ณธ์ผ๋ก ์ฌ์ฉ๋๋ ์์ค์
๋๋ค.
+- `transformers.logging.INFO` (์ ์ซ๊ฐ, 20): ์ค๋ฅ, ๊ฒฝ๊ณ , ๊ทธ๋ฆฌ๊ณ ๊ธฐ๋ณธ์ ์ธ ์ ๋ณด๋ฅผ ๋ณด๊ณ ํฉ๋๋ค.
+- `transformers.logging.DEBUG` (์ ์ซ๊ฐ, 10): ๋ชจ๋ ์ ๋ณด๋ฅผ ๋ณด๊ณ ํฉ๋๋ค.
+
+๊ธฐ๋ณธ์ ์ผ๋ก ๋ชจ๋ธ ๋ค์ด๋ก๋ ์ค์๋ `tqdm` ์งํ ํ์์ค์ด ํ์๋ฉ๋๋ค. [`logging.disable_progress_bar`]์ [`logging.enable_progress_bar`]๋ฅผ ์ฌ์ฉํ์ฌ ์ด ๋์์ ์จ๊ธฐ๊ฑฐ๋ ๋ค์ ํ์ํ ์ ์์ต๋๋ค.
+
+## `logging` vs `warnings`[[transformers.utils.logging.captureWarnings]]
+
+Python์๋ ์ข
์ข
ํจ๊ป ์ฌ์ฉ๋๋ ๋ ๊ฐ์ง ๋ก๊น
์์คํ
์ด ์์ต๋๋ค. ์์์ ์ค๋ช
ํ `logging`๊ณผ `warnings`์
๋๋ค. `warnings`๋ ํน์ ๋ฒ์ฃผ๋ก ๊ฒฝ๊ณ ๋ฅผ ์ธ๋ถํํ ์ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, ์ด๋ฏธ ๋ ์ด์ ์ฌ์ฉ๋์ง ์๋ ๊ธฐ๋ฅ์ด๋ ๊ฒฝ๋ก์ ๋ํด `FutureWarning`์ด ์ฌ์ฉ๋๊ณ , ๊ณง ์ฌ์ฉ ์ค๋จ๋ ๊ธฐ๋ฅ์ ์๋ฆฌ๊ธฐ ์ํด `DeprecationWarning`์ด ์ฌ์ฉ๋ฉ๋๋ค.
+
+ํธ๋์คํฌ๋จธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์๋ ๋ ์์คํ
๋ชจ๋๋ฅผ ์ฌ์ฉํฉ๋๋ค. `logging`์ `captureWarnings` ๋ฉ์๋๋ฅผ ํ์ฉํ๊ณ ์ด๋ฅผ ์กฐ์ ํ์ฌ ์์์ ์ค๋ช
ํ ์ถ๋ ฅ ์์ค ์ค์ ์๋ค์ ํตํด ์ด๋ฌํ ๊ฒฝ๊ณ ๋ฉ์์ง๋ค์ ๊ด๋ฆฌํ ์ ์๋๋ก ํฉ๋๋ค.
+
+๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฐ๋ฐ์๋ ๋ค์๊ณผ ๊ฐ์ ์ง์นจ์ ๋ฐ๋ฅด๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+- `warnings`๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฐ๋ฐ์์ `transformers`์ ์์กดํ๋ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฐ๋ฐ์๋ค์๊ฒ ์ ๋ฆฌํฉ๋๋ค.
+- `logging`์ ์ผ๋ฐ์ ์ธ ํ๋ก์ ํธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฐ๋ฐ์๋ณด๋ค๋, ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ์ต์ข
์ฌ์ฉ์๋ค์๊ฒ ์ ๋ฆฌํ ๊ฒ์
๋๋ค.
+
+์๋์์ `captureWarnings` ๋ฉ์๋์ ๋ํ ์ฐธ๊ณ ์ฌํญ์ ํ์ธํ ์ ์์ต๋๋ค.
+
+[[autodoc]] logging.captureWarnings
+
+## ๊ธฐ๋ณธ ์ค์ ์ [[transformers.utils.logging.set_verbosity_error]]
+
+[[autodoc]] logging.set_verbosity_error
+
+[[autodoc]] logging.set_verbosity_warning
+
+[[autodoc]] logging.set_verbosity_info
+
+[[autodoc]] logging.set_verbosity_debug
+
+## ๊ธฐํ ํจ์ [[transformers.utils.logging.get_verbosity]]
+
+[[autodoc]] logging.get_verbosity
+
+[[autodoc]] logging.set_verbosity
+
+[[autodoc]] logging.get_logger
+
+[[autodoc]] logging.enable_default_handler
+
+[[autodoc]] logging.disable_default_handler
+
+[[autodoc]] logging.enable_explicit_format
+
+[[autodoc]] logging.reset_format
+
+[[autodoc]] logging.enable_progress_bar
+
+[[autodoc]] logging.disable_progress_bar
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/model.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/model.md
new file mode 100644
index 0000000000000000000000000000000000000000..71a9768deee1ecf1badbbe60fe0152eb1756cde6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/model.md
@@ -0,0 +1,68 @@
+
+
+# ๋ชจ๋ธ
+
+๊ธฐ๋ณธ ํด๋์ค [`PreTrainedModel`], [`TFPreTrainedModel`], [`FlaxPreTrainedModel`]๋ ๋ก์ปฌ ํ์ผ๊ณผ ๋๋ ํ ๋ฆฌ๋ก๋ถํฐ ๋ชจ๋ธ์ ๋ก๋ํ๊ณ ์ ์ฅํ๊ฑฐ๋ ๋๋ (ํ๊น
ํ์ด์ค AWS S3 ๋ฆฌํฌ์งํ ๋ฆฌ๋ก๋ถํฐ ๋ค์ด๋ก๋๋) ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ ์ ๊ณตํ๋ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ ์ค์ ์ ๋ก๋ํ๊ณ ์ ์ฅํ๋ ๊ฒ์ ์ง์ํ๋ ๊ธฐ๋ณธ ๋ฉ์๋๋ฅผ ๊ตฌํํ์์ต๋๋ค.
+
+[`PreTrainedModel`]๊ณผ [`TFPreTrainedModel`]์ ๋ํ ๋ชจ๋ ๋ชจ๋ธ๋ค์ ๊ณตํต์ ์ผ๋ก ์ง์ํ๋ ๋ฉ์๋ ์ฌ๋ฌ๊ฐ๋ฅผ ๊ตฌํํ์์ต๋๋ค:
+
+- ์ ํ ํฐ์ด ๋จ์ด์ฅ์ ์ถ๊ฐ๋ ๋, ์
๋ ฅ ํ ํฐ ์๋ฒ ๋ฉ์ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํฉ๋๋ค.
+- ๋ชจ๋ธ์ ์ดํ
์
ํค๋๋ฅผ ๊ฐ์ง์น๊ธฐํฉ๋๋ค.
+
+๊ฐ ๋ชจ๋ธ์ ๊ณตํต์ธ ๋ค๋ฅธ ๋ฉ์๋๋ค์ ๋ค์์ ํด๋์ค์์ ์ ์๋ฉ๋๋ค.
+- [`~modeling_utils.ModuleUtilsMixin`](ํ์ดํ ์น ๋ชจ๋ธ์ฉ)
+- ํ
์คํธ ์์ฑ์ ์ํ [`~modeling_tf_utils.TFModuleUtilsMixin`](ํ
์ํ๋ก ๋ชจ๋ธ์ฉ)
+- [`~generation.GenerationMixin`](ํ์ดํ ์น ๋ชจ๋ธ์ฉ)
+- [`~generation.FlaxGenerationMixin`](Flax/JAX ๋ชจ๋ธ์ฉ)
+
+## PreTrainedModel
+
+[[autodoc]] PreTrainedModel
+ - push_to_hub
+ - all
+
+์ฌ์ฉ์ ์ ์ ๋ชจ๋ธ์ ์ด๊ณ ์ ์ด๊ธฐํ(superfast init)๊ฐ ํน์ ๋ชจ๋ธ์ ์ ์ฉ๋ ์ ์๋์ง ์ฌ๋ถ๋ฅผ ๊ฒฐ์ ํ๋ `_supports_assign_param_buffer`๋ ํฌํจํด์ผ ํฉ๋๋ค.
+`test_save_and_load_from_pretrained` ์คํจ ์, ๋ชจ๋ธ์ด `_supports_assign_param_buffer`๋ฅผ ํ์๋ก ํ๋์ง ํ์ธํ์ธ์.
+ํ์๋ก ํ๋ค๋ฉด `False`๋ก ์ค์ ํ์ธ์.
+
+## ModuleUtilsMixin
+
+[[autodoc]] modeling_utils.ModuleUtilsMixin
+
+## TFPreTrainedModel
+
+[[autodoc]] TFPreTrainedModel
+ - push_to_hub
+ - all
+
+## TFModelUtilsMixin
+
+[[autodoc]] modeling_tf_utils.TFModelUtilsMixin
+
+## FlaxPreTrainedModel
+
+[[autodoc]] FlaxPreTrainedModel
+ - push_to_hub
+ - all
+
+## ํ๋ธ์ ์ ์ฅํ๊ธฐ
+
+[[autodoc]] utils.PushToHubMixin
+
+## ๊ณต์ ๋ ์ฒดํฌํฌ์ธํธ
+
+[[autodoc]] modeling_utils.load_sharded_checkpoint
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/onnx.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/onnx.md
new file mode 100644
index 0000000000000000000000000000000000000000..510dab9df2f9332ca5a69252bd7c444e44bdf2e9
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/onnx.md
@@ -0,0 +1,50 @@
+
+
+# ๐ค Transformers ๋ชจ๋ธ์ ONNX๋ก ๋ด๋ณด๋ด๊ธฐ[[exporting--transformers-models-to-onnx]]
+
+๐ค ํธ๋์คํฌ๋จธ๋ `transformers.onnx` ํจํค์ง๋ฅผ ์ ๊ณตํ๋ฉฐ, ์ด ํจํค์ง๋ ์ค์ ๊ฐ์ฒด๋ฅผ ํ์ฉํ์ฌ ๋ชจ๋ธ ์ฒดํฌํฌ์ธํธ๋ฅผ ONNX ๊ทธ๋ํ๋ก ๋ณํํ ์ ์๊ฒ ํฉ๋๋ค.
+
+๐ค Transformers์ ๋ํ ์์ธํ ๋ด์ฉ์ [์ด ๊ฐ์ด๋](../serialization)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+## ONNX ์ค์ [[onnx-configurations]]
+
+๋ด๋ณด๋ด๋ ค๋(export) ๋ชจ๋ธ ์ํคํ
์ฒ์ ์ ํ์ ๋ฐ๋ผ ์์๋ฐ์์ผ ํ ์ธ ๊ฐ์ง ์ถ์ ํด๋์ค๋ฅผ ์ ๊ณตํฉ๋๋ค:
+
+* ์ธ์ฝ๋ ๊ธฐ๋ฐ ๋ชจ๋ธ์ [`~onnx.config.OnnxConfig`]์ ์์๋ฐ์ต๋๋ค.
+* ๋์ฝ๋ ๊ธฐ๋ฐ ๋ชจ๋ธ์ [`~onnx.config.OnnxConfigWithPast`]์ ์์๋ฐ์ต๋๋ค.
+* ์ธ์ฝ๋-๋์ฝ๋ ๊ธฐ๋ฐ ๋ชจ๋ธ์ [`~onnx.config.OnnxSeq2SeqConfigWithPast`]์ ์์๋ฐ์ต๋๋ค.
+
+### OnnxConfig[[transformers.onnx.OnnxConfig]]
+
+[[autodoc]] onnx.config.OnnxConfig
+
+### OnnxConfigWithPast[[transformers.onnx.OnnxConfigWithPast]]
+
+[[autodoc]] onnx.config.OnnxConfigWithPast
+
+### OnnxSeq2SeqConfigWithPast[[OnnxSeq2SeqConfigWithPast]]
+
+[[autodoc]] onnx.config.OnnxSeq2SeqConfigWithPast
+
+## ONNX ํน์ง[[onnx-features]]
+
+๊ฐ ONNX ์ค์ ์ ๋ค์ํ ์ ํ์ ํ ํด๋ก์ง๋ ์์
์ ๋ํด ๋ชจ๋ธ์ ๋ด๋ณด๋ผ ์ ์๊ฒ(exporting) ํด์ฃผ๋ _features_ ์ธํธ์ ์ฐ๊ด๋์ด ์์ต๋๋ค.
+
+### FeaturesManager[[transformers.onnx.FeaturesManager]]
+
+[[autodoc]] onnx.features.FeaturesManager
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/output.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/output.md
new file mode 100644
index 0000000000000000000000000000000000000000..e65a2c2c35906eef6cc4011994d4bdd50d9d3d76
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/output.md
@@ -0,0 +1,314 @@
+
+
+# ๋ชจ๋ธ ์ถ๋ ฅ[[model-outputs]]
+
+๋ชจ๋ ๋ชจ๋ธ์๋ [`~utils.ModelOutput`]์ ์๋ธํด๋์ค์ ์ธ์คํด์ค์ธ ๋ชจ๋ธ ์ถ๋ ฅ์ด ์์ต๋๋ค. ์ด๋ค์
+๋ชจ๋ธ์์ ๋ฐํ๋๋ ๋ชจ๋ ์ ๋ณด๋ฅผ ํฌํจํ๋ ๋ฐ์ดํฐ ๊ตฌ์กฐ์ด์ง๋ง ํํ์ด๋ ๋์
๋๋ฆฌ๋ก๋ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+์์ ๋ฅผ ํตํด ์ดํด๋ณด๊ฒ ์ต๋๋ค:
+
+```python
+from transformers import BertTokenizer, BertForSequenceClassification
+import torch
+
+tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+model = BertForSequenceClassification.from_pretrained("google-bert/bert-base-uncased")
+
+inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
+labels = torch.tensor([1]).unsqueeze(0) # ๋ฐฐ์น ํฌ๊ธฐ 1
+outputs = model(**inputs, labels=labels)
+```
+
+`outputs` ๊ฐ์ฒด๋ [`~modeling_outputs.SequenceClassifierOutput`]์
๋๋ค.
+์๋ ํด๋น ํด๋์ค์ ๋ฌธ์์์ ๋ณผ ์ ์๋ฏ์ด, `loss`(์ ํ์ ), `logits`, `hidden_states`(์ ํ์ ) ๋ฐ `attentions`(์ ํ์ ) ํญ๋ชฉ์ด ์์ต๋๋ค. ์ฌ๊ธฐ์์๋ `labels`๋ฅผ ์ ๋ฌํ๊ธฐ ๋๋ฌธ์ `loss`๊ฐ ์์ง๋ง `hidden_states`์ `attentions`๊ฐ ์๋๋ฐ, ์ด๋ `output_hidden_states=True` ๋๋ `output_attentions=True`๋ฅผ ์ ๋ฌํ์ง ์์๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+
+
+`output_hidden_states=True`๋ฅผ ์ ๋ฌํ ๋ `outputs.hidden_states[-1]`๊ฐ `outputs.last_hidden_state`์ ์ ํํ ์ผ์นํ ๊ฒ์ผ๋ก ์์ํ ์ ์์ต๋๋ค.
+ํ์ง๋ง ํญ์ ๊ทธ๋ฐ ๊ฒ์ ์๋๋๋ค. ์ผ๋ถ ๋ชจ๋ธ์ ๋ง์ง๋ง ์๋ ์ํ๊ฐ ๋ฐํ๋ ๋ ์ ๊ทํ๋ฅผ ์ ์ฉํ๊ฑฐ๋ ๋ค๋ฅธ ํ์ ํ๋ก์ธ์ค๋ฅผ ์ ์ฉํฉ๋๋ค.
+
+
+
+
+์ผ๋ฐ์ ์ผ๋ก ์ฌ์ฉํ ๋์ ๋์ผํ๊ฒ ๊ฐ ์์ฑ๋ค์ ์ ๊ทผํ ์ ์์ผ๋ฉฐ, ๋ชจ๋ธ์ด ํด๋น ์์ฑ์ ๋ฐํํ์ง ์์ ๊ฒฝ์ฐ `None`์ด ๋ฐํ๋ฉ๋๋ค. ์์์์๋ `outputs.loss`๋ ๋ชจ๋ธ์์ ๊ณ์ฐํ ์์ค์ด๊ณ `outputs.attentions`๋ `None`์
๋๋ค.
+
+`outputs` ๊ฐ์ฒด๋ฅผ ํํ๋ก ๊ฐ์ฃผํ ๋๋ `None` ๊ฐ์ด ์๋ ์์ฑ๋ง ๊ณ ๋ คํฉ๋๋ค.
+์์์์๋ `loss`์ `logits`๋ผ๋ ๋ ๊ฐ์ ์์๊ฐ ์์ต๋๋ค. ๊ทธ๋ฌ๋ฏ๋ก,
+
+```python
+outputs[:2]
+```
+
+๋ `(outputs.loss, outputs.logits)` ํํ์ ๋ฐํํฉ๋๋ค.
+
+`outputs` ๊ฐ์ฒด๋ฅผ ๋์
๋๋ฆฌ๋ก ๊ฐ์ฃผํ ๋๋ `None` ๊ฐ์ด ์๋ ์์ฑ๋ง ๊ณ ๋ คํฉ๋๋ค.
+์์์๋ `loss`์ `logits`๋ผ๋ ๋ ๊ฐ์ ํค๊ฐ ์์ต๋๋ค.
+
+์ฌ๊ธฐ์๋ถํฐ๋ ๋ ๊ฐ์ง ์ด์์ ๋ชจ๋ธ ์ ํ์์ ์ฌ์ฉ๋๋ ์ผ๋ฐ ๋ชจ๋ธ ์ถ๋ ฅ์ ๋ค๋ฃน๋๋ค. ๊ตฌ์ฒด์ ์ธ ์ถ๋ ฅ ์ ํ์ ํด๋น ๋ชจ๋ธ ํ์ด์ง์ ๋ฌธ์ํ๋์ด ์์ต๋๋ค.
+
+## ModelOutput[[transformers.utils.ModelOutput]]
+
+[[autodoc]] utils.ModelOutput
+ - to_tuple
+
+## BaseModelOutput[[transformers.BaseModelOutput]]
+
+[[autodoc]] modeling_outputs.BaseModelOutput
+
+## BaseModelOutputWithPooling[[transformers.modeling_outputs.BaseModelOutputWithPooling]]
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPooling
+
+## BaseModelOutputWithCrossAttentions[[transformers.modeling_outputs.BaseModelOutputWithCrossAttentions]]
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithCrossAttentions
+
+## BaseModelOutputWithPoolingAndCrossAttentions[[transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions]]
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions
+
+## BaseModelOutputWithPast[[transformers.modeling_outputs.BaseModelOutputWithPast]]
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPast
+
+## BaseModelOutputWithPastAndCrossAttentions[[transformers.modeling_outputs.BaseModelOutputWithPastAndCrossAttentions]]
+
+[[autodoc]] modeling_outputs.BaseModelOutputWithPastAndCrossAttentions
+
+## Seq2SeqModelOutput[[transformers.modeling_outputs.Seq2SeqModelOutput]]
+
+[[autodoc]] modeling_outputs.Seq2SeqModelOutput
+
+## CausalLMOutput[[transformers.modeling_outputs.CausalLMOutput]]
+
+[[autodoc]] modeling_outputs.CausalLMOutput
+
+## CausalLMOutputWithCrossAttentions[[transformers.modeling_outputs.CausalLMOutputWithCrossAttentions]]
+
+[[autodoc]] modeling_outputs.CausalLMOutputWithCrossAttentions
+
+## CausalLMOutputWithPast[[transformers.modeling_outputs.CausalLMOutputWithPast]]
+
+[[autodoc]] modeling_outputs.CausalLMOutputWithPast
+
+## MaskedLMOutput[[transformers.modeling_outputs.MaskedLMOutput]]
+
+[[autodoc]] modeling_outputs.MaskedLMOutput
+
+## Seq2SeqLMOutput[[transformers.modeling_outputs.Seq2SeqLMOutput]]
+
+[[autodoc]] modeling_outputs.Seq2SeqLMOutput
+
+## NextSentencePredictorOutput[[transformers.modeling_outputs.NextSentencePredictorOutput]]
+
+[[autodoc]] modeling_outputs.NextSentencePredictorOutput
+
+## SequenceClassifierOutput[[transformers.modeling_outputs.SequenceClassifierOutput]]
+
+[[autodoc]] modeling_outputs.SequenceClassifierOutput
+
+## Seq2SeqSequenceClassifierOutput[[transformers.modeling_outputs.Seq2SeqSequenceClassifierOutput]]
+
+[[autodoc]] modeling_outputs.Seq2SeqSequenceClassifierOutput
+
+## MultipleChoiceModelOutput[[transformers.modeling_outputs.MultipleChoiceModelOutput]]
+
+[[autodoc]] modeling_outputs.MultipleChoiceModelOutput
+
+## TokenClassifierOutput[[transformers.modeling_outputs.TokenClassifierOutput]]
+
+[[autodoc]] modeling_outputs.TokenClassifierOutput
+
+## QuestionAnsweringModelOutput[[transformers.modeling_outputs.QuestionAnsweringModelOutput]]
+
+[[autodoc]] modeling_outputs.QuestionAnsweringModelOutput
+
+## Seq2SeqQuestionAnsweringModelOutput[[transformers.modeling_outputs.Seq2SeqQuestionAnsweringModelOutput]]
+
+[[autodoc]] modeling_outputs.Seq2SeqQuestionAnsweringModelOutput
+
+## Seq2SeqSpectrogramOutput[[transformers.modeling_outputs.Seq2SeqSpectrogramOutput]]
+
+[[autodoc]] modeling_outputs.Seq2SeqSpectrogramOutput
+
+## SemanticSegmenterOutput[[transformers.modeling_outputs.SemanticSegmenterOutput]]
+
+[[autodoc]] modeling_outputs.SemanticSegmenterOutput
+
+## ImageClassifierOutput[[transformers.modeling_outputs.ImageClassifierOutput]]
+
+[[autodoc]] modeling_outputs.ImageClassifierOutput
+
+## ImageClassifierOutputWithNoAttention[[transformers.modeling_outputs.ImageClassifierOutputWithNoAttention]]
+
+[[autodoc]] modeling_outputs.ImageClassifierOutputWithNoAttention
+
+## DepthEstimatorOutput[[transformers.modeling_outputs.DepthEstimatorOutput]]
+
+[[autodoc]] modeling_outputs.DepthEstimatorOutput
+
+## Wav2Vec2BaseModelOutput[[transformers.modeling_outputs.Wav2Vec2BaseModelOutput]]
+
+[[autodoc]] modeling_outputs.Wav2Vec2BaseModelOutput
+
+## XVectorOutput[[transformers.modeling_outputs.XVectorOutput]]
+
+[[autodoc]] modeling_outputs.XVectorOutput
+
+## Seq2SeqTSModelOutput[[transformers.modeling_outputs.Seq2SeqTSModelOutput]]
+
+[[autodoc]] modeling_outputs.Seq2SeqTSModelOutput
+
+## Seq2SeqTSPredictionOutput[[transformers.modeling_outputs.Seq2SeqTSPredictionOutput]]
+
+[[autodoc]] modeling_outputs.Seq2SeqTSPredictionOutput
+
+## SampleTSPredictionOutput[[transformers.modeling_outputs.SampleTSPredictionOutput]]
+
+[[autodoc]] modeling_outputs.SampleTSPredictionOutput
+
+## TFBaseModelOutput[[transformers.modeling_outputs.TFBaseModelOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutput
+
+## TFBaseModelOutputWithPooling[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling]]
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPooling
+
+## TFBaseModelOutputWithPoolingAndCrossAttentions[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions]]
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPoolingAndCrossAttentions
+
+## TFBaseModelOutputWithPast[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPast]]
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPast
+
+## TFBaseModelOutputWithPastAndCrossAttentions[[transformers.modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions]]
+
+[[autodoc]] modeling_tf_outputs.TFBaseModelOutputWithPastAndCrossAttentions
+
+## TFSeq2SeqModelOutput[[transformers.modeling_tf_outputs.TFSeq2SeqModelOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqModelOutput
+
+## TFCausalLMOutput[[transformers.modeling_tf_outputs.TFCausalLMOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFCausalLMOutput
+
+## TFCausalLMOutputWithCrossAttentions[[transformers.modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions]]
+
+[[autodoc]] modeling_tf_outputs.TFCausalLMOutputWithCrossAttentions
+
+## TFCausalLMOutputWithPast[[transformers.modeling_tf_outputs.TFCausalLMOutputWithPast]]
+
+[[autodoc]] modeling_tf_outputs.TFCausalLMOutputWithPast
+
+## TFMaskedLMOutput[[transformers.modeling_tf_outputs.TFMaskedLMOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFMaskedLMOutput
+
+## TFSeq2SeqLMOutput[[transformers.modeling_tf_outputs.TFSeq2SeqLMOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqLMOutput
+
+## TFNextSentencePredictorOutput[[transformers.modeling_tf_outputs.TFNextSentencePredictorOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFNextSentencePredictorOutput
+
+## TFSequenceClassifierOutput[[transformers.modeling_tf_outputs.TFSequenceClassifierOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFSequenceClassifierOutput
+
+## TFSeq2SeqSequenceClassifierOutput[[transformers.modeling_tf_outputs.TFSeq2SeqSequenceClassifierOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqSequenceClassifierOutput
+
+## TFMultipleChoiceModelOutput[[transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFMultipleChoiceModelOutput
+
+## TFTokenClassifierOutput[[transformers.modeling_tf_outputs.TFTokenClassifierOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFTokenClassifierOutput
+
+## TFQuestionAnsweringModelOutput[[transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFQuestionAnsweringModelOutput
+
+## TFSeq2SeqQuestionAnsweringModelOutput[[transformers.modeling_tf_outputs.TFSeq2SeqQuestionAnsweringModelOutput]]
+
+[[autodoc]] modeling_tf_outputs.TFSeq2SeqQuestionAnsweringModelOutput
+
+## FlaxBaseModelOutput[[transformers.modeling_flax_outputs.FlaxBaseModelOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutput
+
+## FlaxBaseModelOutputWithPast[[transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPast]]
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutputWithPast
+
+## FlaxBaseModelOutputWithPooling[[transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPooling]]
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutputWithPooling
+
+## FlaxBaseModelOutputWithPastAndCrossAttentions[[transformers.modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions]]
+
+[[autodoc]] modeling_flax_outputs.FlaxBaseModelOutputWithPastAndCrossAttentions
+
+## FlaxSeq2SeqModelOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqModelOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqModelOutput
+
+## FlaxCausalLMOutputWithCrossAttentions[[transformers.modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions]]
+
+[[autodoc]] modeling_flax_outputs.FlaxCausalLMOutputWithCrossAttentions
+
+## FlaxMaskedLMOutput[[transformers.modeling_flax_outputs.FlaxMaskedLMOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxMaskedLMOutput
+
+## FlaxSeq2SeqLMOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqLMOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqLMOutput
+
+## FlaxNextSentencePredictorOutput[[transformers.modeling_flax_outputs.FlaxNextSentencePredictorOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxNextSentencePredictorOutput
+
+## FlaxSequenceClassifierOutput[[transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxSequenceClassifierOutput
+
+## FlaxSeq2SeqSequenceClassifierOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqSequenceClassifierOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqSequenceClassifierOutput
+
+## FlaxMultipleChoiceModelOutput[[transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxMultipleChoiceModelOutput
+
+## FlaxTokenClassifierOutput[[transformers.modeling_flax_outputs.FlaxTokenClassifierOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxTokenClassifierOutput
+
+## FlaxQuestionAnsweringModelOutput[[transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxQuestionAnsweringModelOutput
+
+## FlaxSeq2SeqQuestionAnsweringModelOutput[[transformers.modeling_flax_outputs.FlaxSeq2SeqQuestionAnsweringModelOutput]]
+
+[[autodoc]] modeling_flax_outputs.FlaxSeq2SeqQuestionAnsweringModelOutput
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/quantization.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/quantization.md
new file mode 100644
index 0000000000000000000000000000000000000000..6f793f2210741788cf67a2e2a8232c654ea77484
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/quantization.md
@@ -0,0 +1,75 @@
+
+
+# ์์ํ[[quantization]]
+
+
+
+์์ํ ๊ธฐ๋ฒ์ ๊ฐ์ค์น์ ํ์ฑํ๋ฅผ 8๋นํธ ์ ์(int8)์ ๊ฐ์ ๋ ๋ฎ์ ์ ๋ฐ๋์ ๋ฐ์ดํฐ ํ์
์ผ๋ก ํํํจ์ผ๋ก์จ ๋ฉ๋ชจ๋ฆฌ์ ๊ณ์ฐ ๋น์ฉ์ ์ค์
๋๋ค. ์ด๋ฅผ ํตํด ์ผ๋ฐ์ ์ผ๋ก๋ ๋ฉ๋ชจ๋ฆฌ์ ์ฌ๋ฆด ์ ์๋ ๋ ํฐ ๋ชจ๋ธ์ ๋ก๋ํ ์ ์๊ณ , ์ถ๋ก ์๋๋ฅผ ๋์ผ ์ ์์ต๋๋ค. Transformers๋ AWQ์ GPTQ ์์ํ ์๊ณ ๋ฆฌ์ฆ์ ์ง์ํ๋ฉฐ, bitsandbytes๋ฅผ ํตํด 8๋นํธ์ 4๋นํธ ์์ํ๋ฅผ ์ง์ํฉ๋๋ค.
+Transformers์์ ์ง์๋์ง ์๋ ์์ํ ๊ธฐ๋ฒ๋ค์ [`HfQuantizer`] ํด๋์ค๋ฅผ ํตํด ์ถ๊ฐ๋ ์ ์์ต๋๋ค.
+
+
+
+๋ชจ๋ธ์ ์์ํํ๋ ๋ฐฉ๋ฒ์ ์ด [์์ํ](../quantization) ๊ฐ์ด๋๋ฅผ ํตํด ๋ฐฐ์ธ ์ ์์ต๋๋ค.
+
+
+
+## QuantoConfig[[transformers.QuantoConfig]]
+
+[[autodoc]] QuantoConfig
+
+## AqlmConfig[[transformers.AqlmConfig]]
+
+[[autodoc]] AqlmConfig
+
+## VptqConfig[[transformers.VptqConfig]]
+
+[[autodoc]] VptqConfig
+
+## AwqConfig[[transformers.AwqConfig]]
+
+[[autodoc]] AwqConfig
+
+## EetqConfig[[transformers.EetqConfig]]
+[[autodoc]] EetqConfig
+
+## GPTQConfig[[transformers.GPTQConfig]]
+
+[[autodoc]] GPTQConfig
+
+## BitsAndBytesConfig[[#transformers.BitsAndBytesConfig]]
+
+[[autodoc]] BitsAndBytesConfig
+
+## HfQuantizer[[transformers.quantizers.HfQuantizer]]
+
+[[autodoc]] quantizers.base.HfQuantizer
+
+## HqqConfig[[transformers.HqqConfig]]
+
+[[autodoc]] HqqConfig
+
+## FbgemmFp8Config[[transformers.FbgemmFp8Config]]
+
+[[autodoc]] FbgemmFp8Config
+
+## CompressedTensorsConfig[[transformers.CompressedTensorsConfig]]
+
+[[autodoc]] CompressedTensorsConfig
+
+## TorchAoConfig[[transformers.TorchAoConfig]]
+
+[[autodoc]] TorchAoConfig
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/text_generation.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/text_generation.md
new file mode 100644
index 0000000000000000000000000000000000000000..917d995e6ec15c4a642e2c3bf4c5fc7b865fdb85
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/text_generation.md
@@ -0,0 +1,56 @@
+
+
+# ์์ฑ [[generation]]
+
+๊ฐ ํ๋ ์์ํฌ์๋ ํด๋นํ๋ `GenerationMixin` ํด๋์ค์์ ๊ตฌํ๋ ํ
์คํธ ์์ฑ์ ์ํ generate ๋ฉ์๋๊ฐ ์์ต๋๋ค:
+
+- PyTorch์์๋ [`~generation.GenerationMixin.generate`]๊ฐ [`~generation.GenerationMixin`]์ ๊ตฌํ๋์ด ์์ต๋๋ค.
+- TensorFlow์์๋ [`~generation.TFGenerationMixin.generate`]๊ฐ [`~generation.TFGenerationMixin`]์ ๊ตฌํ๋์ด ์์ต๋๋ค.
+- Flax/JAX์์๋ [`~generation.FlaxGenerationMixin.generate`]๊ฐ [`~generation.FlaxGenerationMixin`]์ ๊ตฌํ๋์ด ์์ต๋๋ค.
+
+์ฌ์ฉํ๋ ํ๋ ์์ํฌ์ ์๊ด์์ด, generate ๋ฉ์๋๋ [`~generation.GenerationConfig`] ํด๋์ค ์ธ์คํด์ค๋ก ๋งค๊ฐ๋ณ์ํ ํ ์ ์์ต๋๋ค. generate ๋ฉ์๋์ ๋์์ ์ ์ดํ๋ ๋ชจ๋ ์์ฑ ๋งค๊ฐ๋ณ์ ๋ชฉ๋ก์ ํ์ธํ๋ ค๋ฉด ์ด ํด๋์ค๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+๋ชจ๋ธ์ ์์ฑ ์ค์ ์ ์ด๋ป๊ฒ ํ์ธํ๊ณ , ๊ธฐ๋ณธ๊ฐ์ด ๋ฌด์์ธ์ง, ๋งค๊ฐ๋ณ์๋ฅผ ์ด๋ป๊ฒ ์์๋ก ๋ณ๊ฒฝํ๋์ง, ๊ทธ๋ฆฌ๊ณ ์ฌ์ฉ์ ์ง์ ์์ฑ ์ค์ ์ ๋ง๋ค๊ณ ์ ์ฅํ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ฐ๋ ค๋ฉด [ํ
์คํธ ์์ฑ ์ ๋ต ๊ฐ์ด๋](../generation_strategies)๋ฅผ ์ฐธ์กฐํ์ธ์. ์ด ๊ฐ์ด๋๋ ํ ํฐ ์คํธ๋ฆฌ๋ฐ๊ณผ ๊ฐ์ ๊ด๋ จ ๊ธฐ๋ฅ์ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ๋ ์ค๋ช
ํฉ๋๋ค.
+
+## GenerationConfig [[transformers.GenerationConfig]]
+
+[[autodoc]] generation.GenerationConfig
+ - from_pretrained
+ - from_model_config
+ - save_pretrained
+ - update
+ - validate
+ - get_generation_mode
+
+[[autodoc]] generation.WatermarkingConfig
+
+## GenerationMixin [[transformers.GenerationMixin]]
+
+[[autodoc]] generation.GenerationMixin
+ - generate
+ - compute_transition_scores
+
+## TFGenerationMixin [[transformers.TFGenerationMixin]]
+
+[[autodoc]] generation.TFGenerationMixin
+ - generate
+ - compute_transition_scores
+
+## FlaxGenerationMixin [[transformers.FlaxGenerationMixin]]
+
+[[autodoc]] generation.FlaxGenerationMixin
+ - generate
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/trainer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/trainer.md
new file mode 100644
index 0000000000000000000000000000000000000000..23eda74a8bd669c16fcb3ebdbd21ea7cd8d6cd65
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/main_classes/trainer.md
@@ -0,0 +1,52 @@
+
+
+# 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`] ํด๋์ค๋ฅผ ์์ํ๋ฉฐ, ์์ฝ์ด๋ ๋ฒ์ญ๊ณผ ๊ฐ์ ์ํ์ค-ํฌ-์ํ์ค ์์
์ ์ํ ๋ชจ๋ธ ํ๋ จ์ ์ ํฉํ๊ฒ ์กฐ์ ๋์ด ์์ต๋๋ค.
+
+
+
+[`Trainer`] ํด๋์ค๋ ๐ค Transformers ๋ชจ๋ธ์ ์ต์ ํ๋์ด ์์ผ๋ฉฐ, ๋ค๋ฅธ ๋ชจ๋ธ๊ณผ ํจ๊ป ์ฌ์ฉ๋ ๋ ์์์น ๋ชปํ ๋์์ ํ๊ฒ ๋ ์ ์์ต๋๋ค. ์์ ๋ง์ ๋ชจ๋ธ์ ์ฌ์ฉํ ๋๋ ๋ค์์ ํ์ธํ์ธ์:
+
+- ๋ชจ๋ธ์ ํญ์ ํํ์ด๋ [`~utils.ModelOutput`]์ ์๋ธํด๋์ค๋ฅผ ๋ฐํํด์ผ ํฉ๋๋ค.
+- ๋ชจ๋ธ์ `labels` ์ธ์๊ฐ ์ ๊ณต๋๋ฉด ์์ค์ ๊ณ์ฐํ ์ ์๊ณ , ๋ชจ๋ธ์ด ํํ์ ๋ฐํํ๋ ๊ฒฝ์ฐ ๊ทธ ์์ค์ด ํํ์ ์ฒซ ๋ฒ์งธ ์์๋ก ๋ฐํ๋์ด์ผ ํฉ๋๋ค.
+- ๋ชจ๋ธ์ ์ฌ๋ฌ ๊ฐ์ ๋ ์ด๋ธ ์ธ์๋ฅผ ์์ฉํ ์ ์์ด์ผ ํ๋ฉฐ, [`Trainer`]์๊ฒ ์ด๋ฆ์ ์๋ฆฌ๊ธฐ ์ํด [`TrainingArguments`]์์ `label_names`๋ฅผ ์ฌ์ฉํ์ง๋ง, ๊ทธ ์ค ์ด๋ ๊ฒ๋ `"label"`๋ก ๋ช
๋ช
๋์ด์๋ ์ ๋ฉ๋๋ค.
+
+
+
+## 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
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/altclip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/altclip.md
new file mode 100644
index 0000000000000000000000000000000000000000..1236bcc9aaa7da8da5fb4820bb87b3f9413cb805
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/altclip.md
@@ -0,0 +1,78 @@
+# AltCLIP
+
+## ๊ฐ์[[overview]]
+
+AltCLIP ๋ชจ๋ธ์ Zhongzhi Chen, Guang Liu, Bo-Wen Zhang, Fulong Ye, Qinghong Yang, Ledell Wu์ [AltCLIP: Altering the Language Encoder in CLIP for Extended Language Capabilities](https://arxiv.org/abs/2211.06679v2) ๋
ผ๋ฌธ์์ ์ ์๋์์ต๋๋ค. AltCLIP(CLIP์ ์ธ์ด ์ธ์ฝ๋๋ฅผ ๋ณ๊ฒฝํ์ฌ ์ธ์ด ๊ธฐ๋ฅ ํ์ฅ)์ ๋ค์ํ ์ด๋ฏธ์ง-ํ
์คํธ ๋ฐ ํ
์คํธ-ํ
์คํธ ์์ผ๋ก ํ๋ จ๋ ์ ๊ฒฝ๋ง์
๋๋ค. CLIP์ ํ
์คํธ ์ธ์ฝ๋๋ฅผ ์ฌ์ ํ๋ จ๋ ๋ค๊ตญ์ด ํ
์คํธ ์ธ์ฝ๋ XLM-R๋ก ๊ต์ฒดํ์ฌ, ๊ฑฐ์ ๋ชจ๋ ์์
์์ CLIP๊ณผ ์ ์ฌํ ์ฑ๋ฅ์ ์ป์ ์ ์์์ผ๋ฉฐ, ์๋ CLIP์ ๋ค๊ตญ์ด ์ดํด์ ๊ฐ์ ๊ธฐ๋ฅ๋ ํ์ฅ๋์์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*๋ณธ ์ฐ๊ตฌ์์๋ ๊ฐ๋ ฅํ ์ด์ค ์ธ์ด ๋ฉํฐ๋ชจ๋ฌ ํํ ๋ชจ๋ธ์ ํ๋ จํ๋ ๊ฐ๋
์ ์ผ๋ก ๊ฐ๋จํ๊ณ ํจ๊ณผ์ ์ธ ๋ฐฉ๋ฒ์ ์ ์ํฉ๋๋ค. OpenAI์์ ์ถ์ํ ์ฌ์ ํ๋ จ๋ ๋ฉํฐ๋ชจ๋ฌ ํํ ๋ชจ๋ธ CLIP์์ ์์ํ์ฌ, ๊ทธ ํ
์คํธ ์ธ์ฝ๋๋ฅผ ์ฌ์ ํ๋ จ๋ ๋ค๊ตญ์ด ํ
์คํธ ์ธ์ฝ๋ XLM-R๋ก ๊ต์ฒดํ๊ณ , ๊ต์ฌ ํ์ต๊ณผ ๋์กฐ ํ์ต์ผ๋ก ๊ตฌ์ฑ๋ 2๋จ๊ณ ํ๋ จ ์คํค๋ง๋ฅผ ํตํด ์ธ์ด์ ์ด๋ฏธ์ง ํํ์ ์ ๋ ฌํ์ต๋๋ค. ์ฐ๋ฆฌ๋ ๊ด๋ฒ์ํ ์์
ํ๊ฐ๋ฅผ ํตํด ์ฐ๋ฆฌ์ ๋ฐฉ๋ฒ์ ๊ฒ์ฆํ์ต๋๋ค. ImageNet-CN, Flicker30k-CN, COCO-CN์ ํฌํจํ ์ฌ๋ฌ ์์
์์ ์๋ก์ด ์ต๊ณ ์ฑ๋ฅ์ ๋ฌ์ฑํ์ผ๋ฉฐ, ๊ฑฐ์ ๋ชจ๋ ์์
์์ CLIP๊ณผ ์ ์ฌํ ์ฑ๋ฅ์ ์ป์์ต๋๋ค. ์ด๋ CLIP์ ํ
์คํธ ์ธ์ฝ๋๋ฅผ ๋จ์ํ ๋ณ๊ฒฝํ์ฌ ๋ค๊ตญ์ด ์ดํด์ ๊ฐ์ ํ์ฅ ๊ธฐ๋ฅ์ ์ป์ ์ ์์์ ์์ฌํฉ๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [jongjyh](https://huggingface.co/jongjyh)์ ์ํด ๊ธฐ์ฌ๋์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ๊ณผ ์์ [[usage-tips-and-example]]
+
+AltCLIP์ ์ฌ์ฉ๋ฒ์ CLIP๊ณผ ๋งค์ฐ ์ ์ฌํ๋ฉฐ, ์ฐจ์ด์ ์ ํ
์คํธ ์ธ์ฝ๋์ ์์ต๋๋ค. ์ผ๋ฐ์ ์ธ ์ดํ
์
๋์ ์๋ฐฉํฅ ์ดํ
์
์ ์ฌ์ฉํ๋ฉฐ, XLM-R์ [CLS] ํ ํฐ์ ์ฌ์ฉํ์ฌ ํ
์คํธ ์๋ฒ ๋ฉ์ ๋ํ๋
๋๋ค.
+
+AltCLIP์ ๋ฉํฐ๋ชจ๋ฌ ๋น์ ๋ฐ ์ธ์ด ๋ชจ๋ธ์
๋๋ค. ์ด๋ฏธ์ง์ ํ
์คํธ ๊ฐ์ ์ ์ฌ์ฑ ๊ณ์ฐ ๋ฐ ์ ๋ก์ท ์ด๋ฏธ์ง ๋ถ๋ฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค. AltCLIP์ ViT์ ๊ฐ์ ํธ๋์คํฌ๋จธ๋ฅผ ์ฌ์ฉํ์ฌ ์๊ฐ์ ํน์ง์ ์ป๊ณ , ์๋ฐฉํฅ ์ธ์ด ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ํ
์คํธ ํน์ง์ ์ป์ต๋๋ค. ์ดํ ํ
์คํธ์ ์๊ฐ์ ํน์ง ๋ชจ๋ ๋์ผํ ์ฐจ์์ ์ ์ฌ ๊ณต๊ฐ์ผ๋ก ํฌ์ฌ๋ฉ๋๋ค. ํฌ์ฌ๋ ์ด๋ฏธ์ง์ ํ
์คํธ ํน์ง ๊ฐ์ ๋ด์ ์ ์ ์ฌ๋ ์ ์๋ก ์ฌ์ฉํฉ๋๋ค.
+
+์ด๋ฏธ์ง๋ฅผ ํธ๋์คํฌ๋จธ ์ธ์ฝ๋์ ์
๋ ฅํ๊ธฐ ์ํด, ๊ฐ ์ด๋ฏธ์ง๋ฅผ ์ผ์ ํ ํฌ๊ธฐ์ ๊ฒน์น์ง ์๋ ํจ์น ์ํ์ค๋ก ๋ถํ ํ ๋ค, ์ด๋ฅผ ์ ํ ์๋ฒ ๋ฉํฉ๋๋ค. ์ ์ฒด ์ด๋ฏธ์ง๋ฅผ ๋ํ๋ด๊ธฐ ์ํด [CLS] ํ ํฐ์ด ์ถ๊ฐ๋ฉ๋๋ค. ์ ์๋ค์ ์ ๋ ์์น ์๋ฒ ๋ฉ๋ ์ถ๊ฐํ์ฌ ๊ฒฐ๊ณผ ๋ฒกํฐ ์ํ์ค๋ฅผ ํ์ค ํธ๋์คํฌ๋จธ ์ธ์ฝ๋์ ์
๋ ฅํฉ๋๋ค. [`CLIPImageProcessor`]๋ ๋ชจ๋ธ์ ์ํด ์ด๋ฏธ์ง๋ฅผ ํฌ๊ธฐ ์กฐ์ ํ๊ณ ์ ๊ทํํ๋ ๋ฐ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+[`AltCLIPProcessor`]๋ [`CLIPImageProcessor`]์ [`XLMRobertaTokenizer`]๋ฅผ ํ๋์ ์ธ์คํด์ค๋ก ๋ฌถ์ด ํ
์คํธ๋ฅผ ์ธ์ฝ๋ฉํ๊ณ ์ด๋ฏธ์ง๋ฅผ ์ค๋นํฉ๋๋ค. ๋ค์ ์์ ๋ [`AltCLIPProcessor`]์ [`AltCLIPModel`]์ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง์ ํ
์คํธ ๊ฐ์ ์ ์ฌ์ฑ ์ ์๋ฅผ ์ป๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค.
+```python
+>>> from PIL import Image
+>>> import requests
+
+>>> from transformers import AltCLIPModel, AltCLIPProcessor
+
+>>> model = AltCLIPModel.from_pretrained("BAAI/AltCLIP")
+>>> processor = AltCLIPProcessor.from_pretrained("BAAI/AltCLIP")
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
+
+>>> outputs = model(**inputs)
+>>> logits_per_image = outputs.logits_per_image # ์ด๋ฏธ์ง-ํ
์คํธ ์ ์ฌ๋ ์ ์
+>>> probs = logits_per_image.softmax(dim=1) # ๋ผ๋ฒจ ๋ง๋ค ํ๋ฅ ์ ์ป๊ธฐ ์ํด softmax ์ ์ฉ
+```
+
+
+์ด ๋ชจ๋ธ์ `CLIPModel`์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฏ๋ก, ์๋ CLIP์ฒ๋ผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+
+
+## AltCLIPConfig
+
+[[autodoc]] AltCLIPConfig
+ - from_text_vision_configs
+
+## AltCLIPTextConfig
+
+[[autodoc]] AltCLIPTextConfig
+
+## AltCLIPVisionConfig
+
+[[autodoc]] AltCLIPVisionConfig
+
+## AltCLIPProcessor
+
+[[autodoc]] AltCLIPProcessor
+
+## AltCLIPModel
+
+[[autodoc]] AltCLIPModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## AltCLIPTextModel
+
+[[autodoc]] AltCLIPTextModel
+ - forward
+
+## AltCLIPVisionModel
+
+[[autodoc]] AltCLIPVisionModel
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/auto.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/auto.md
new file mode 100644
index 0000000000000000000000000000000000000000..cda00adc33a663c1b426a61f10ace8d708936da8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/auto.md
@@ -0,0 +1,375 @@
+
+
+# Auto ํด๋์ค[[auto-classes]]
+
+๋ง์ ๊ฒฝ์ฐ, ์ฌ์ฉํ๋ ค๋ ์ํคํ
์ฒ๋ `from_pretrained()` ๋ฉ์๋์์ ์ ๊ณตํ๋ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ์ ์ด๋ฆ์ด๋ ๊ฒฝ๋ก๋ก๋ถํฐ ์ ์ถํ ์ ์์ต๋๋ค. AutoClasses๋ ์ด ์์
์ ์ํด ์กด์ฌํ๋ฉฐ, ์ฌ์ ํ์ต๋ ๋ชจ๋ธ ๊ฐ์ค์น/๊ตฌ์ฑ/๋จ์ด์ฌ์ ์ ๋ํ ์ด๋ฆ/๊ฒฝ๋ก๋ฅผ ์ ๊ณตํ๋ฉด ์๋์ผ๋ก ๊ด๋ จ ๋ชจ๋ธ์ ๊ฐ์ ธ์ค๋๋ก ๋์์ค๋๋ค.
+
+[`AutoConfig`], [`AutoModel`], [`AutoTokenizer`] ์ค ํ๋๋ฅผ ์ธ์คํด์คํํ๋ฉด ํด๋น ์ํคํ
์ฒ์ ํด๋์ค๋ฅผ ์ง์ ์์ฑํฉ๋๋ค. ์๋ฅผ ๋ค์ด,
+
+
+```python
+model = AutoModel.from_pretrained("google-bert/bert-base-cased")
+```
+
+์ ์ฝ๋๋ [`BertModel`]์ ์ธ์คํด์ค์ธ ๋ชจ๋ธ์ ์์ฑํฉ๋๋ค.
+
+๊ฐ ์์
์ ๋ํด ํ๋์ `AutoModel` ํด๋์ค๊ฐ ์์ผ๋ฉฐ, ๊ฐ๊ฐ์ ๋ฐฑ์๋(PyTorch, TensorFlow ๋๋ Flax)์ ํด๋นํ๋ ํด๋์ค๊ฐ ์กด์ฌํฉ๋๋ค.
+
+## ์๋ ํด๋์ค ํ์ฅ[[extending-the-auto-classes]]
+
+๊ฐ ์๋ ํด๋์ค๋ ์ฌ์ฉ์์ ์ปค์คํ
ํด๋์ค๋ก ํ์ฅ๋ ์ ์๋ ๋ฉ์๋๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค. ์๋ฅผ ๋ค์ด, `NewModel`์ด๋ผ๋ ์ปค์คํ
๋ชจ๋ธ ํด๋์ค๋ฅผ ์ ์ํ๋ค๋ฉด, `NewModelConfig`๋ฅผ ์ค๋นํ ํ ๋ค์๊ณผ ๊ฐ์ด ์๋ ํด๋์ค์ ์ถ๊ฐํ ์ ์์ต๋๋ค:
+
+```python
+from transformers import AutoConfig, AutoModel
+
+AutoConfig.register("new-model", NewModelConfig)
+AutoModel.register(NewModelConfig, NewModel)
+```
+
+์ดํ์๋ ์ผ๋ฐ์ ์ผ๋ก ์๋ ํด๋์ค๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ฒ๋ผ ์ฌ์ฉํ ์ ์์ต๋๋ค!
+
+
+
+๋ง์ฝ `NewModelConfig`๊ฐ [`~transformers.PretrainedConfig`]์ ์๋ธํด๋์ค๋ผ๋ฉด, ํด๋น `model_type` ์์ฑ์ด ๋ฑ๋กํ ๋ ์ฌ์ฉํ๋ ํค(์ฌ๊ธฐ์๋ `"new-model"`)์ ๋์ผํ๊ฒ ์ค์ ๋์ด ์๋์ง ํ์ธํ์ธ์.
+
+๋ง์ฐฌ๊ฐ์ง๋ก, `NewModel`์ด [`PreTrainedModel`]์ ์๋ธํด๋์ค๋ผ๋ฉด, ํด๋น `config_class` ์์ฑ์ด ๋ฑ๋กํ ๋ ์ฌ์ฉํ๋ ํด๋์ค(์ฌ๊ธฐ์๋ `NewModelConfig`)์ ๋์ผํ๊ฒ ์ค์ ๋์ด ์๋์ง ํ์ธํ์ธ์.
+
+
+
+## AutoConfig[[transformers.AutoConfig]]
+
+[[autodoc]] AutoConfig
+
+## AutoTokenizer[[transformers.AutoTokenizer]]
+
+[[autodoc]] AutoTokenizer
+
+## AutoFeatureExtractor[[transformers.AutoFeatureExtractor]]
+
+[[autodoc]] AutoFeatureExtractor
+
+## AutoImageProcessor[[transformers.AutoImageProcessor]]
+
+[[autodoc]] AutoImageProcessor
+
+## AutoProcessor[[transformers.AutoProcessor]]
+
+[[autodoc]] AutoProcessor
+
+## ์ผ๋ฐ์ ์ธ ๋ชจ๋ธ ํด๋์ค[[generic-model-classes]]
+
+๋ค์ ์๋ ํด๋์ค๋ค์ ํน์ ํค๋ ์์ด ๊ธฐ๋ณธ ๋ชจ๋ธ ํด๋์ค๋ฅผ ์ธ์คํด์คํํ๋ ๋ฐ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+### AutoModel[[transformers.AutoModel]]
+
+[[autodoc]] AutoModel
+
+### TFAutoModel[[transformers.TFAutoModel]]
+
+[[autodoc]] TFAutoModel
+
+### FlaxAutoModel[[transformers.FlaxAutoModel]]
+
+[[autodoc]] FlaxAutoModel
+
+## ์ผ๋ฐ์ ์ธ ์ฌ์ ํ์ต ํด๋์ค[[generic-pretraining-classes]]
+
+๋ค์ ์๋ ํด๋์ค๋ค์ ์ฌ์ ํ๋ จ ํค๋๊ฐ ํฌํจ๋ ๋ชจ๋ธ์ ์ธ์คํด์คํํ๋ ๋ฐ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+### AutoModelForPreTraining[[transformers.AutoModelForPreTraining]]
+
+[[autodoc]] AutoModelForPreTraining
+
+### TFAutoModelForPreTraining[[transformers.TFAutoModelForPreTraining]]
+
+[[autodoc]] TFAutoModelForPreTraining
+
+### FlaxAutoModelForPreTraining[[transformers.FlaxAutoModelForPreTraining]]
+
+[[autodoc]] FlaxAutoModelForPreTraining
+
+## ์์ฐ์ด ์ฒ๋ฆฌ[[natural-language-processing]]
+
+๋ค์ ์๋ ํด๋์ค๋ค์ ์๋์ ์์ฐ์ด ์ฒ๋ฆฌ ์์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+### AutoModelForCausalLM[[transformers.AutoModelForCausalLM]]
+
+[[autodoc]] AutoModelForCausalLM
+
+### TFAutoModelForCausalLM[[transformers.TFAutoModelForCausalLM]]
+
+[[autodoc]] TFAutoModelForCausalLM
+
+### FlaxAutoModelForCausalLM[[transformers.FlaxAutoModelForCausalLM]]
+
+[[autodoc]] FlaxAutoModelForCausalLM
+
+### AutoModelForMaskedLM[[transformers.AutoModelForMaskedLM]]
+
+[[autodoc]] AutoModelForMaskedLM
+
+### TFAutoModelForMaskedLM[[transformers.TFAutoModelForMaskedLM]]
+
+[[autodoc]] TFAutoModelForMaskedLM
+
+### FlaxAutoModelForMaskedLM[[transformers.FlaxAutoModelForMaskedLM]]
+
+[[autodoc]] FlaxAutoModelForMaskedLM
+
+### AutoModelForMaskGeneration[[transformers.AutoModelForMaskGeneration]]
+
+[[autodoc]] AutoModelForMaskGeneration
+
+### TFAutoModelForMaskGeneration[[transformers.TFAutoModelForMaskGeneration]]
+
+[[autodoc]] TFAutoModelForMaskGeneration
+
+### AutoModelForSeq2SeqLM[[transformers.AutoModelForSeq2SeqLM]]
+
+[[autodoc]] AutoModelForSeq2SeqLM
+
+### TFAutoModelForSeq2SeqLM[[transformers.TFAutoModelForSeq2SeqLM]]
+
+[[autodoc]] TFAutoModelForSeq2SeqLM
+
+### FlaxAutoModelForSeq2SeqLM[[transformers.FlaxAutoModelForSeq2SeqLM]]
+
+[[autodoc]] FlaxAutoModelForSeq2SeqLM
+
+### AutoModelForSequenceClassification[[transformers.AutoModelForSequenceClassification]]
+
+[[autodoc]] AutoModelForSequenceClassification
+
+### TFAutoModelForSequenceClassification[[transformers.TFAutoModelForSequenceClassification]]
+
+[[autodoc]] TFAutoModelForSequenceClassification
+
+### FlaxAutoModelForSequenceClassification[[transformers.FlaxAutoModelForSequenceClassification]]
+
+[[autodoc]] FlaxAutoModelForSequenceClassification
+
+### AutoModelForMultipleChoice[[transformers.AutoModelForMultipleChoice]]
+
+[[autodoc]] AutoModelForMultipleChoice
+
+### TFAutoModelForMultipleChoice[[transformers.TFAutoModelForMultipleChoice]]
+
+[[autodoc]] TFAutoModelForMultipleChoice
+
+### FlaxAutoModelForMultipleChoice[[transformers.FlaxAutoModelForMultipleChoice]]
+
+[[autodoc]] FlaxAutoModelForMultipleChoice
+
+### AutoModelForNextSentencePrediction[[transformers.AutoModelForNextSentencePrediction]]
+
+[[autodoc]] AutoModelForNextSentencePrediction
+
+### TFAutoModelForNextSentencePrediction[[transformers.TFAutoModelForNextSentencePrediction]]
+
+[[autodoc]] TFAutoModelForNextSentencePrediction
+
+### FlaxAutoModelForNextSentencePrediction[[transformers.FlaxAutoModelForNextSentencePrediction]]
+
+[[autodoc]] FlaxAutoModelForNextSentencePrediction
+
+### AutoModelForTokenClassification[[transformers.AutoModelForTokenClassification]]
+
+[[autodoc]] AutoModelForTokenClassification
+
+### TFAutoModelForTokenClassification[[transformers.TFAutoModelForTokenClassification]]
+
+[[autodoc]] TFAutoModelForTokenClassification
+
+### FlaxAutoModelForTokenClassification[[transformers.FlaxAutoModelForTokenClassification]]
+
+[[autodoc]] FlaxAutoModelForTokenClassification
+
+### AutoModelForQuestionAnswering[[transformers.AutoModelForQuestionAnswering]]
+
+[[autodoc]] AutoModelForQuestionAnswering
+
+### TFAutoModelForQuestionAnswering[[transformers.TFAutoModelForQuestionAnswering]]
+
+[[autodoc]] TFAutoModelForQuestionAnswering
+
+### FlaxAutoModelForQuestionAnswering[[transformers.FlaxAutoModelForQuestionAnswering]]
+
+[[autodoc]] FlaxAutoModelForQuestionAnswering
+
+### AutoModelForTextEncoding[[transformers.AutoModelForTextEncoding]]
+
+[[autodoc]] AutoModelForTextEncoding
+
+### TFAutoModelForTextEncoding[[transformers.TFAutoModelForTextEncoding]]
+
+[[autodoc]] TFAutoModelForTextEncoding
+
+## ์ปดํจํฐ ๋น์ [[computer-vision]]
+
+๋ค์ ์๋ ํด๋์ค๋ค์ ์๋์ ์ปดํจํฐ ๋น์ ์์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+### AutoModelForDepthEstimation[[transformers.AutoModelForDepthEstimation]]
+
+[[autodoc]] AutoModelForDepthEstimation
+
+### AutoModelForImageClassification[[transformers.AutoModelForImageClassification]]
+
+[[autodoc]] AutoModelForImageClassification
+
+### TFAutoModelForImageClassification[[transformers.TFAutoModelForImageClassification]]
+
+[[autodoc]] TFAutoModelForImageClassification
+
+### FlaxAutoModelForImageClassification[[transformers.FlaxAutoModelForImageClassification]]
+
+[[autodoc]] FlaxAutoModelForImageClassification
+
+### AutoModelForVideoClassification[[transformers.AutoModelForVideoClassification]]
+
+[[autodoc]] AutoModelForVideoClassification
+
+### AutoModelForKeypointDetection[[transformers.AutoModelForKeypointDetection]]
+
+[[autodoc]] AutoModelForKeypointDetection
+
+### AutoModelForMaskedImageModeling[[transformers.AutoModelForMaskedImageModeling]]
+
+[[autodoc]] AutoModelForMaskedImageModeling
+
+### TFAutoModelForMaskedImageModeling[[transformers.TFAutoModelForMaskedImageModeling]]
+
+[[autodoc]] TFAutoModelForMaskedImageModeling
+
+### AutoModelForObjectDetection[[transformers.AutoModelForObjectDetection]]
+
+[[autodoc]] AutoModelForObjectDetection
+
+### AutoModelForImageSegmentation[[transformers.AutoModelForImageSegmentation]]
+
+[[autodoc]] AutoModelForImageSegmentation
+
+### AutoModelForImageToImage[[transformers.AutoModelForImageToImage]]
+
+[[autodoc]] AutoModelForImageToImage
+
+### AutoModelForSemanticSegmentation[[transformers.AutoModelForSemanticSegmentation]]
+
+[[autodoc]] AutoModelForSemanticSegmentation
+
+### TFAutoModelForSemanticSegmentation[[transformers.TFAutoModelForSemanticSegmentation]]
+
+[[autodoc]] TFAutoModelForSemanticSegmentation
+
+### AutoModelForInstanceSegmentation[[transformers.AutoModelForInstanceSegmentation]]
+
+[[autodoc]] AutoModelForInstanceSegmentation
+
+### AutoModelForUniversalSegmentation[[transformers.AutoModelForUniversalSegmentation]]
+
+[[autodoc]] AutoModelForUniversalSegmentation
+
+### AutoModelForZeroShotImageClassification[[transformers.AutoModelForZeroShotImageClassification]]
+
+[[autodoc]] AutoModelForZeroShotImageClassification
+
+### TFAutoModelForZeroShotImageClassification[[transformers.TFAutoModelForZeroShotImageClassification]]
+
+[[autodoc]] TFAutoModelForZeroShotImageClassification
+
+### AutoModelForZeroShotObjectDetection[[transformers.AutoModelForZeroShotObjectDetection]]
+
+[[autodoc]] AutoModelForZeroShotObjectDetection
+
+## ์ค๋์ค[[audio]]
+
+๋ค์ ์๋ ํด๋์ค๋ค์ ์๋์ ์ค๋์ค ์์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+### AutoModelForAudioClassification[[transformers.AutoModelForAudioClassification]]
+
+[[autodoc]] AutoModelForAudioClassification
+
+### TFAutoModelForAudioClassification[[transformers.TFAutoModelForAudioClassification]]
+
+[[autodoc]] TFAutoModelForAudioClassification
+
+### AutoModelForAudioFrameClassification[[transformers.AutoModelForAudioFrameClassification]]
+
+[[autodoc]] AutoModelForAudioFrameClassification
+
+### AutoModelForCTC[[transformers.AutoModelForCTC]]
+
+[[autodoc]] AutoModelForCTC
+
+### AutoModelForSpeechSeq2Seq[[transformers.AutoModelForSpeechSeq2Seq]]
+
+[[autodoc]] AutoModelForSpeechSeq2Seq
+
+### TFAutoModelForSpeechSeq2Seq[[transformers.TFAutoModelForSpeechSeq2Seq]]
+
+[[autodoc]] TFAutoModelForSpeechSeq2Seq
+
+### FlaxAutoModelForSpeechSeq2Seq[[transformers.FlaxAutoModelForSpeechSeq2Seq]]
+
+[[autodoc]] FlaxAutoModelForSpeechSeq2Seq
+
+### AutoModelForAudioXVector[[transformers.AutoModelForAudioXVector]]
+
+[[autodoc]] AutoModelForAudioXVector
+
+### AutoModelForTextToSpectrogram[[transformers.AutoModelForTextToSpectrogram]]
+
+[[autodoc]] AutoModelForTextToSpectrogram
+
+### AutoModelForTextToWaveform[[transformers.AutoModelForTextToWaveform]]
+
+[[autodoc]] AutoModelForTextToWaveform
+
+## ๋ฉํฐ๋ชจ๋ฌ[[multimodal]]
+
+๋ค์ ์๋ ํด๋์ค๋ค์ ์๋์ ๋ฉํฐ๋ชจ๋ฌ ์์
์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+### AutoModelForTableQuestionAnswering[[transformers.AutoModelForTableQuestionAnswering]]
+
+[[autodoc]] AutoModelForTableQuestionAnswering
+
+### TFAutoModelForTableQuestionAnswering[[transformers.TFAutoModelForTableQuestionAnswering]]
+
+[[autodoc]] TFAutoModelForTableQuestionAnswering
+
+### AutoModelForDocumentQuestionAnswering[[transformers.AutoModelForDocumentQuestionAnswering]]
+
+[[autodoc]] AutoModelForDocumentQuestionAnswering
+
+### TFAutoModelForDocumentQuestionAnswering[[transformers.TFAutoModelForDocumentQuestionAnswering]]
+
+[[autodoc]] TFAutoModelForDocumentQuestionAnswering
+
+### AutoModelForVisualQuestionAnswering[[transformers.AutoModelForVisualQuestionAnswering]]
+
+[[autodoc]] AutoModelForVisualQuestionAnswering
+
+### AutoModelForVision2Seq[[transformers.AutoModelForVision2Seq]]
+
+[[autodoc]] AutoModelForVision2Seq
+
+### TFAutoModelForVision2Seq[[transformers.TFAutoModelForVision2Seq]]
+
+[[autodoc]] TFAutoModelForVision2Seq
+
+### FlaxAutoModelForVision2Seq[[transformers.FlaxAutoModelForVision2Seq]]
+
+[[autodoc]] FlaxAutoModelForVision2Seq
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/autoformer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/autoformer.md
new file mode 100644
index 0000000000000000000000000000000000000000..e8534ac95c327ab65a1ccc8a3c3fa67fab446344
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/autoformer.md
@@ -0,0 +1,50 @@
+
+
+# Autoformer[[autoformer]]
+
+## ๊ฐ์[[overview]]
+
+The Autoformer ๋ชจ๋ธ์ Haixu Wu, Jiehui Xu, Jianmin Wang, Mingsheng Long๊ฐ ์ ์ํ [์คํ ํฌ๋จธ: ์ฅ๊ธฐ ์๊ณ์ด ์์ธก์ ์ํ ์๊ธฐ์๊ด ๋ถํด ํธ๋์คํฌ๋จธ](https://arxiv.org/abs/2106.13008) ๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ ๋์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ ํธ๋์คํฌ๋จธ๋ฅผ ์ฌ์ธต ๋ถํด ์ํคํ
์ฒ๋ก ํ์ฅํ์ฌ, ์์ธก ๊ณผ์ ์์ ์ถ์ธ์ ๊ณ์ ์ฑ ์์๋ฅผ ์ ์ง์ ์ผ๋ก ๋ถํดํ ์ ์์ต๋๋ค.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*์์ธก ์๊ฐ์ ์ฐ์ฅํ๋ ๊ฒ์ ๊ทนํ ๊ธฐ์ ์กฐ๊ธฐ ๊ฒฝ๋ณด ๋ฐ ์ฅ๊ธฐ ์๋์ง ์๋น ๊ณํ๊ณผ ๊ฐ์ ์ค์ ์์ฉ ํ๋ก๊ทธ๋จ์ ์ค์ํ ์๊ตฌ ์ฌํญ์
๋๋ค. ๋ณธ ๋
ผ๋ฌธ์ ์๊ณ์ด์ ์ฅ๊ธฐ ์์ธก ๋ฌธ์ ๋ฅผ ์ฐ๊ตฌํฉ๋๋ค. ๊ธฐ์กด์ ํธ๋์คํฌ๋จธ ๊ธฐ๋ฐ ๋ชจ๋ธ๋ค์ ์ฅ๊ฑฐ๋ฆฌ ์ข
์์ฑ์ ๋ฐ๊ฒฌํ๊ธฐ ์ํด ๋ค์ํ ์
ํ ์ดํ
์
๋ฉ์ปค๋์ฆ์ ์ฑํํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ฅ๊ธฐ ๋ฏธ๋์ ๋ณต์กํ ์๊ฐ์ ํจํด์ผ๋ก ์ธํด ๋ชจ๋ธ์ด ์ ๋ขฐํ ์ ์๋ ์ข
์์ฑ์ ์ฐพ๊ธฐ ์ด๋ ต์ต๋๋ค. ๋ํ, ํธ๋์คํฌ๋จธ๋ ๊ธด ์๊ณ์ด์ ํจ์จ์ฑ์ ์ํด ์ ๋ณ ์
ํ ์ดํ
์
์ ํฌ์ ๋ฒ์ ์ ์ฑํํด์ผ ํ๋ฏ๋ก ์ ๋ณด ํ์ฉ์ ๋ณ๋ชฉ ํ์์ด ๋ฐ์ํฉ๋๋ค. ์ฐ๋ฆฌ๋ ํธ๋์คํฌ๋จธ๋ฅผ ๋์ด์ ์๊ธฐ์๊ด ๋ฉ์ปค๋์ฆ์ ๊ฐ์ถ ์๋ก์ด ๋ถํด ์ํคํ
์ฒ์ธ Autoformer๋ฅผ ์ค๊ณํ์ต๋๋ค. ์ฐ๋ฆฌ๋ ์๊ณ์ด ๋ถํด์ ์ ์ฒ๋ฆฌ ๊ดํ์ ๊นจ๊ณ ์ด๋ฅผ ์ฌ์ธต ๋ชจ๋ธ์ ๊ธฐ๋ณธ ๋ด๋ถ ๋ธ๋ก์ผ๋ก ํ์ ํ์ต๋๋ค. ์ด ์ค๊ณ๋ Autoformer์ ๋ณต์กํ ์๊ณ์ด์ ๋ํ ์ ์ง์ ๋ถํด ๋ฅ๋ ฅ์ ๋ถ์ฌํฉ๋๋ค. ๋ํ, ํ๋ฅ ๊ณผ์ ์ด๋ก ์์ ์๊ฐ์ ๋ฐ์ ์๊ณ์ด์ ์ฃผ๊ธฐ์ฑ์ ๊ธฐ๋ฐ์ผ๋ก ์๊ธฐ์๊ด ๋ฉ์ปค๋์ฆ์ ์ค๊ณํ์ผ๋ฉฐ, ์ด๋ ํ์ ์๊ณ์ด ์์ค์์ ์ข
์์ฑ ๋ฐ๊ฒฌ๊ณผ ํํ ์ง๊ณ๋ฅผ ์ํํฉ๋๋ค. ์๊ธฐ์๊ด์ ํจ์จ์ฑ๊ณผ ์ ํ๋ ๋ฉด์์ ์
ํ ์ดํ
์
๋ฅผ ๋ฅ๊ฐํฉ๋๋ค. ์ฅ๊ธฐ ์์ธก์์ Autoformer๋ ์๋์ง, ๊ตํต, ๊ฒฝ์ , ๋ ์จ, ์ง๋ณ ๋ฑ 5๊ฐ์ง ์ค์ฉ์ ์์ฉ ๋ถ์ผ๋ฅผ ํฌ๊ดํ๋ 6๊ฐ ๋ฒค์น๋งํฌ์์ 38%์ ์๋์ ๊ฐ์ ์ผ๋ก ์ต์ฒจ๋จ ์ ํ๋๋ฅผ ๋ฌ์ฑํ์ต๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [elisim](https://huggingface.co/elisim)๊ณผ [kashif](https://huggingface.co/kashif)์ ์ํด ๊ธฐ์ฌ ๋์์ต๋๋ค.
+์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/thuml/Autoformer)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์๋ฃ[[resources]]
+
+์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค. ์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐ ํด๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+- HuggingFace ๋ธ๋ก๊ทธ์์ Autoformer ํฌ์คํธ๋ฅผ ํ์ธํ์ธ์: [๋ค, ๊ทธ๋ ์ต๋๋ค, ํธ๋์คํฌ๋จธ๋ ์๊ณ์ด ์์ธก์ ํจ๊ณผ์ ์
๋๋ค(+ Autoformer)](https://huggingface.co/blog/autoformer)
+
+## AutoformerConfig[[transformers.AutoformerConfig]]
+
+[[autodoc]] AutoformerConfig
+
+## AutoformerModel[[transformers.AutoformerModel]]
+
+[[autodoc]] AutoformerModel
+ - forward
+
+## AutoformerForPrediction[[transformers.AutoformerForPrediction]]
+
+[[autodoc]] AutoformerForPrediction
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bart.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bart.md
new file mode 100644
index 0000000000000000000000000000000000000000..0f7636b3cc95c284de5eb5a650b6393c6d0c69bf
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bart.md
@@ -0,0 +1,217 @@
+
+
+# BART[[bart]]
+
+
+
+## ๊ฐ์ [[overview]]
+
+Bart ๋ชจ๋ธ์ 2019๋
10์ 29์ผ Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, Luke Zettlemoyer๊ฐ ๋ฐํํ [BART: ์์ฐ์ด ์์ฑ, ๋ฒ์ญ, ์ดํด๋ฅผ ์ํ ์ก์ ์ ๊ฑฐ seq2seq ์ฌ์ ํ๋ จ](https://arxiv.org/abs/1910.13461)์ด๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ๋์์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ฐ๋ฅด๋ฉด,
+
+- Bart๋ ์๋ฐฉํฅ ์ธ์ฝ๋(BERT์ ์ ์ฌ)์ ์ผ์ชฝ์์ ์ค๋ฅธ์ชฝ์ผ๋ก ๋์ฝ๋ฉํ๋ ๋์ฝ๋(GPT์ ์ ์ฌ)๋ฅผ ์ฌ์ฉํ๋ ํ์ค seq2seq/๊ธฐ๊ณ ๋ฒ์ญ ์ํคํ
์ฒ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+- ์ฌ์ ํ๋ จ ์์
์ ์๋ ๋ฌธ์ฅ์ ์์๋ฅผ ๋ฌด์์๋ก ์๊ณ , ํ
์คํธ์ ์ผ๋ถ ๊ตฌ๊ฐ์ ๋จ์ผ ๋ง์คํฌ ํ ํฐ์ผ๋ก ๋์ฒดํ๋ ์๋ก์ด ์ธํ๋ง(in-filling) ๋ฐฉ์์ ํฌํจํฉ๋๋ค.
+- BART๋ ํนํ ํ
์คํธ ์์ฑ์ ์ํ ๋ฏธ์ธ ์กฐ์ ์ ํจ๊ณผ์ ์ด์ง๋ง ์ดํด ์์
์๋ ์ ์๋ํฉ๋๋ค. GLUE์ SQuAD์์ ๋น์ทํ ํ๋ จ ๋ฆฌ์์ค๋ก RoBERTa์ ์ฑ๋ฅ๊ณผ ์ผ์นํ๋ฉฐ, ์ถ์์ ๋ํ, ์ง์์๋ต, ์์ฝ ์์
๋ฑ์์ ์ต๋ 6 ROUGE ์ ์์ ํฅ์์ ๋ณด์ด๋ฉฐ ์๋ก์ด ์ต๊ณ ์ฑ๋ฅ์ ๋ฌ์ฑํ์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ [sshleifer](https://huggingface.co/sshleifer)์ ์ํด ๊ธฐ์ฌ ๋์์ต๋๋ค. ์ ์์ ์ฝ๋๋ [์ด๊ณณ](https://github.com/pytorch/fairseq/tree/master/examples/bart)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ:[[usage-tips]]
+
+- BART๋ ์ ๋ ์์น ์๋ฒ ๋ฉ์ ์ฌ์ฉํ๋ ๋ชจ๋ธ์ด๋ฏ๋ก ์ผ๋ฐ์ ์ผ๋ก ์
๋ ฅ์ ์ผ์ชฝ๋ณด๋ค๋ ์ค๋ฅธ์ชฝ์ ํจ๋ฉํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+- ์ธ์ฝ๋์ ๋์ฝ๋๊ฐ ์๋ seq2seq ๋ชจ๋ธ์
๋๋ค. ์ธ์ฝ๋์๋ ์์๋ ํ ํฐ์ด(corrupted tokens) ์
๋ ฅ๋๊ณ , ๋์ฝ๋์๋ ์๋ ํ ํฐ์ด ์
๋ ฅ๋ฉ๋๋ค(๋จ, ์ผ๋ฐ์ ์ธ ํธ๋์คํฌ๋จธ ๋์ฝ๋์ฒ๋ผ ๋ฏธ๋ ๋จ์ด๋ฅผ ์จ๊ธฐ๋ ๋ง์คํฌ๊ฐ ์์ต๋๋ค). ์ฌ์ ํ๋ จ ์์
์์ ์ธ์ฝ๋์ ์ ์ฉ๋๋ ๋ณํ๋ค์ ๊ตฌ์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+์ฌ์ ํ๋ จ ์์
์์ ์ธ์ฝ๋์ ์ ์ฉ๋๋ ๋ณํ๋ค์ ๊ตฌ์ฑ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+ * ๋ฌด์์ ํ ํฐ ๋ง์คํน (BERT ์ฒ๋ผ)
+ * ๋ฌด์์ ํ ํฐ ์ญ์
+ * k๊ฐ ํ ํฐ์ ๋ฒ์๋ฅผ ๋จ์ผ ๋ง์คํฌ ํ ํฐ์ผ๋ก ๋ง์คํน (0๊ฐ ํ ํฐ์ ๋ฒ์๋ ๋ง์คํฌ ํ ํฐ์ ์ฝ์
์ ์๋ฏธ)
+ * ๋ฌธ์ฅ ์์ ๋ค์๊ธฐ
+ * ํน์ ํ ํฐ์์ ์์ํ๋๋ก ๋ฌธ์ ํ์
+
+## ๊ตฌํ ๋
ธํธ[[implementation-notes]]
+
+- Bart๋ ์ํ์ค ๋ถ๋ฅ์ `token_type_ids`๋ฅผ ์ฌ์ฉํ์ง ์์ต๋๋ค. ์ ์ ํ๊ฒ ๋๋๊ธฐ ์ํด์ [`BartTokenizer`]๋
+ [`~BartTokenizer.encode`]๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+- [`BartModel`]์ ์ ๋ฐฉํฅ ์ ๋ฌ์ `decoder_input_ids`๊ฐ ์ ๋ฌ๋์ง ์์ผ๋ฉด `decoder_input_ids`๋ฅผ ์๋์ผ๋ก ์์ฑํ ๊ฒ์
๋๋ค. ์ด๋ ๋ค๋ฅธ ์ผ๋ถ ๋ชจ๋ธ๋ง API์ ๋ค๋ฅธ ์ ์
๋๋ค. ์ด ๊ธฐ๋ฅ์ ์ผ๋ฐ์ ์ธ ์ฌ์ฉ ์ฌ๋ก๋ ๋ง์คํฌ ์ฑ์ฐ๊ธฐ(mask filling)์
๋๋ค.
+- ๋ชจ๋ธ ์์ธก์ `forced_bos_token_id=0`์ผ ๋ ๊ธฐ์กด ๊ตฌํ๊ณผ ๋์ผํ๊ฒ ์๋ํ๋๋ก ์๋๋์์ต๋๋ค. ํ์ง๋ง, [`fairseq.encode`]์ ์ ๋ฌํ๋ ๋ฌธ์์ด์ด ๊ณต๋ฐฑ์ผ๋ก ์์ํ ๋๋ง ์ด ๊ธฐ๋ฅ์ด ์๋ํฉ๋๋ค.
+- [`~generation.GenerationMixin.generate`]๋ ์์ฝ๊ณผ ๊ฐ์ ์กฐ๊ฑด๋ถ ์์ฑ ์์
์ ์ฌ์ฉ๋์ด์ผ ํฉ๋๋ค. ์์ธํ ๋ด์ฉ์ ํด๋น ๋ฌธ์์ ์์ ๋ฅผ ์ฐธ์กฐํ์ธ์.
+- *facebook/bart-large-cnn* ๊ฐ์ค์น๋ฅผ ๋ก๋ํ๋ ๋ชจ๋ธ์ `mask_token_id`๊ฐ ์๊ฑฐ๋, ๋ง์คํฌ ์ฑ์ฐ๊ธฐ ์์
์ ์ํํ ์ ์์ต๋๋ค.
+
+## ๋ง์คํฌ ์ฑ์ฐ๊ธฐ[[mask-filling]]
+
+`facebook/bart-base`์ `facebook/bart-large` ์ฒดํฌํฌ์ธํธ๋ ๋ฉํฐ ํ ํฐ ๋ง์คํฌ๋ฅผ ์ฑ์ฐ๋๋ฐ ์ฌ์ฉ๋ ์ ์์ต๋๋ค.
+
+```python
+from transformers import BartForConditionalGeneration, BartTokenizer
+
+model = BartForConditionalGeneration.from_pretrained("facebook/bart-large", forced_bos_token_id=0)
+tok = BartTokenizer.from_pretrained("facebook/bart-large")
+example_english_phrase = "UN Chief Says There Is No in Syria"
+batch = tok(example_english_phrase, return_tensors="pt")
+generated_ids = model.generate(batch["input_ids"])
+assert tok.batch_decode(generated_ids, skip_special_tokens=True) == [
+ "UN Chief Says There Is No Plan to Stop Chemical Weapons in Syria"
+]
+```
+
+## ์๋ฃ[[resources]]
+
+BART๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค. ์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐ ํด๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+
+
+- [๋ถ์ฐํ ํ์ต: ๐ค Transformers์ Amazon SageMaker๋ฅผ ์ด์ฉํ์ฌ ์์ฝํ๊ธฐ ์ํ BART/T5 ํ์ต](https://huggingface.co/blog/sagemaker-distributed-training-seq2seq)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [blurr๋ฅผ ์ด์ฉํ์ฌ fastai๋ก ์์ฝํ๊ธฐ ์ํ BART๋ฅผ ๋ฏธ์ธ ์กฐ์ ](https://colab.research.google.com/github/ohmeow/ohmeow_website/blob/master/posts/2021-05-25-mbart-sequence-classification-with-blurr.ipynb)ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋
ธํธ๋ถ. ๐
+- [Trainer ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ๋ ๊ฐ์ง ์ธ์ด๋ก ์์ฝํ๊ธฐ ์ํ BART ๋ฏธ์ธ ์กฐ์ ](https://colab.research.google.com/github/elsanns/xai-nlp-notebooks/blob/master/fine_tune_bart_summarization_two_langs.ipynb)ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋
ธํธ๋ถ. ๐
+- ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb)์์๋ [`BartForConditionalGeneration`]์ด ์ง์๋ฉ๋๋ค.
+- [`TFBartForConditionalGeneration`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/summarization)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb)์์ ์ง์๋ฉ๋๋ค.
+- ์ด [์์ ์คํฌ๋ฆฝํธ์์๋](https://github.com/huggingface/transformers/tree/main/examples/flax/summarization)[`FlaxBartForConditionalGeneration`]์ด ์ง์๋ฉ๋๋ค.
+- Hugging Face `datasets` ๊ฐ์ฒด๋ฅผ ํ์ฉํ์ฌ [`BartForConditionalGeneration`]์ ํ์ต์ํค๋ ๋ฐฉ๋ฒ์ ์๋ ์ด [ํฌ๋ผ ํ ๋ก ](https://discuss.huggingface.co/t/train-bart-for-conditional-generation-e-g-summarization/1904)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+- ๐ค Hugging Face ์ฝ์ค์ [์์ฝ](https://huggingface.co/course/chapter7/5?fw=pt#summarization)์ฅ.
+- [์์ฝ ์์
๊ฐ์ด๋](../tasks/summarization)
+
+
+
+- [`BartForConditionalGeneration`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์ ์ฐธ๊ณ ํ์ธ์.
+- [`TFBartForConditionalGeneration`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์ ์ฐธ๊ณ ํ์ธ์.
+- [`FlaxBartForConditionalGeneration`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์ ์ฐธ๊ณ ํ์ธ์.
+- ๐ค Hugging Face ์ฝ์ค์ [๋ง์คํฌ ์ธ์ด ๋ชจ๋ธ๋ง](https://huggingface.co/course/chapter7/3?fw=pt) ์ฑํฐ.
+- [๋ง์คํฌ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/masked_language_modeling)
+
+
+
+- [Seq2SeqTrainer๋ฅผ ์ด์ฉํ์ฌ ์ธ๋์ด๋ฅผ ์์ด๋ก ๋ฒ์ญํ๋ mBART๋ฅผ ๋ฏธ์ธ ์กฐ์ ](https://colab.research.google.com/github/vasudevgupta7/huggingface-tutorials/blob/main/translation_training.ipynb)ํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๊ฐ์ด๋. ๐
+- [`BartForConditionalGeneration`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/translation)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation.ipynb)์ ์ฐธ๊ณ ํ์ธ์.
+- [`TFBartForConditionalGeneration`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/translation)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb)์ ์ฐธ๊ณ ํ์ธ์.
+- [๋ฒ์ญ ์์
๊ฐ์ด๋](../tasks/translation)
+
+์ถ๊ฐ์ ์ผ๋ก ๋ณผ ๊ฒ๋ค:
+- [ํ
์คํธ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/sequence_classification)
+- [์ง๋ฌธ ๋ต๋ณ ์์
๊ฐ์ด๋](../tasks/question_answering)
+- [์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/language_modeling)
+- ์ด [๋
ผ๋ฌธ](https://arxiv.org/abs/2010.13002)์ [์ฆ๋ฅ๋ ์ฒดํฌํฌ์ธํธ](https://huggingface.co/models?search=distilbart)์ ๋ํด ์ค๋ช
ํฉ๋๋ค.
+
+## BartConfig[[transformers.BartConfig]]
+
+[[autodoc]] BartConfig
+ - all
+
+## BartTokenizer[[transformers.BartTokenizer]]
+
+[[autodoc]] BartTokenizer
+ - all
+
+## BartTokenizerFast[[transformers.BartTokenizerFast]]
+
+[[autodoc]] BartTokenizerFast
+ - all
+
+
+
+
+
+## BartModel[[transformers.BartModel]]
+
+[[autodoc]] BartModel
+ - forward
+
+## BartForConditionalGeneration[[transformers.BartForConditionalGeneration]]
+
+[[autodoc]] BartForConditionalGeneration
+ - forward
+
+## BartForSequenceClassification[[transformers.BartForSequenceClassification]]
+
+[[autodoc]] BartForSequenceClassification
+ - forward
+
+## BartForQuestionAnswering[[transformers.BartForQuestionAnswering]]
+
+[[autodoc]] BartForQuestionAnswering
+ - forward
+
+## BartForCausalLM[[transformers.BartForCausalLM]]
+
+[[autodoc]] BartForCausalLM
+ - forward
+
+
+
+
+## TFBartModel[[transformers.TFBartModel]]
+
+[[autodoc]] TFBartModel
+ - call
+
+## TFBartForConditionalGeneration[[transformers.TFBartForConditionalGeneration]]
+
+[[autodoc]] TFBartForConditionalGeneration
+ - call
+
+## TFBartForSequenceClassification[[transformers.TFBartForSequenceClassification]]
+
+[[autodoc]] TFBartForSequenceClassification
+ - call
+
+
+
+
+## FlaxBartModel[[transformers.FlaxBartModel]]
+
+[[autodoc]] FlaxBartModel
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForConditionalGeneration[[transformers.FlaxBartForConditionalGeneration]]
+
+[[autodoc]] FlaxBartForConditionalGeneration
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForSequenceClassification[[transformers.FlaxBartForSequenceClassification]]
+
+[[autodoc]] FlaxBartForSequenceClassification
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForQuestionAnswering[[transformers.FlaxBartForQuestionAnswering]]
+
+[[autodoc]] FlaxBartForQuestionAnswering
+ - __call__
+ - encode
+ - decode
+
+## FlaxBartForCausalLM[[transformers.FlaxBartForCausalLM]]
+
+[[autodoc]] FlaxBartForCausalLM
+ - __call__
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/barthez.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/barthez.md
new file mode 100644
index 0000000000000000000000000000000000000000..131db38856cc1b253a6cbdaa6e3d45de9197de1c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/barthez.md
@@ -0,0 +1,60 @@
+
+
+# BARThez [[barthez]]
+
+## ๊ฐ์ [[overview]]
+
+BARThez ๋ชจ๋ธ์ 2020๋
10์ 23์ผ, Moussa Kamal Eddine, Antoine J.-P. Tixier, Michalis Vazirgiannis์ ์ํด [BARThez: a Skilled Pretrained French Sequence-to-Sequence Model](https://arxiv.org/abs/2010.12321)์์ ์ ์๋์์ต๋๋ค.
+
+์ด ๋
ผ๋ฌธ์ ์ด๋ก:
+
+
+*์๊ธฐ์ง๋ ํ์ต์ ์ํด ๊ฐ๋ฅํด์ง ๊ท๋ฉ์ ์ ์ด ํ์ต์ ์์ฐ์ด ์ฒ๋ฆฌ(NLP) ๋ถ์ผ ์ ๋ฐ์ ๊ฑธ์ณ ํฐ ๋ฐํฅ์ ์ผ์ผ์ผฐ์ผ๋ฉฐ,
+BERT์ BART์ ๊ฐ์ ๋ชจ๋ธ๋ค์ ์๋ง์ ์์ฐ์ด ์ดํด ์์
์์ ์๋ก์ด ์ต์ฒจ๋จ ์ฑ๊ณผ๋ฅผ ๊ธฐ๋กํ์ต๋๋ค. ์ผ๋ถ ์ฃผ๋ชฉํ ๋งํ ์์ธ๊ฐ ์์ง๋ง,
+๋๋ถ๋ถ์ ์ฌ์ฉ ๊ฐ๋ฅํ ๋ชจ๋ธ๊ณผ ์ฐ๊ตฌ๋ ์์ด์ ์ง์ค๋์ด ์์์ต๋๋ค. ๋ณธ ์ฐ๊ตฌ์์๋ BARThez๋ฅผ ์๊ฐํฉ๋๋ค.
+์ด๋ (์ฐ๋ฆฌ๊ฐ ์๋ ํ) ํ๋์ค์ด๋ฅผ ์ํ ์ฒซ ๋ฒ์งธ BART ๋ชจ๋ธ์
๋๋ค.
+BARThez๋ ๊ณผ๊ฑฐ ์ฐ๊ตฌ์์ ์ป์ ๋งค์ฐ ํฐ ํ๋์ค์ด ๋จ์ผ ์ธ์ด ๋ง๋ญ์น๋ก ์ฌ์ ํ๋ จ๋์์ผ๋ฉฐ,
+BART์ ๋ณํ ๋ฐฉ์์ ๋ง๊ฒ ์กฐ์ ๋์์ต๋๋ค.
+CamemBERT ๋ฐ FlauBERT์ ๊ฐ์ ๊ธฐ์กด์ BERT ๊ธฐ๋ฐ ํ๋์ค์ด ๋ชจ๋ธ๊ณผ ๋ฌ๋ฆฌ, BARThez๋ ์์ฑ ์์
์ ํนํ ์ ํฉํฉ๋๋ค.
+์ด๋ ์ธ์ฝ๋๋ฟ๋ง ์๋๋ผ ๋์ฝ๋๋ ์ฌ์ ํ๋ จ๋์๊ธฐ ๋๋ฌธ์
๋๋ค.
+์ฐ๋ฆฌ๋ FLUE ๋ฒค์น๋งํฌ์์์ ํ๋ณ ์์
์ธ์๋ ์ด ๋
ผ๋ฌธ๊ณผ ํจ๊ป ๊ณต๊ฐํ๋ ์๋ก์ด ์์ฝ ๋ฐ์ดํฐ์
์ธ OrangeSum์์ BARThez๋ฅผ ํ๊ฐํ์ต๋๋ค.
+๋ํ ์ด๋ฏธ ์ฌ์ ํ๋ จ๋ ๋ค๊ตญ์ด BART์ ์ฌ์ ํ๋ จ์ BARThez์ ๋ง๋ญ์น๋ก ๊ณ์ ์งํํ์์ผ๋ฉฐ,
+๊ฒฐ๊ณผ์ ์ผ๋ก ์ป์ด์ง ๋ชจ๋ธ์ธ mBARTHez๊ฐ ๊ธฐ๋ณธ BARThez๋ณด๋ค ์ ์๋ฏธํ ์ฑ๋ฅ ํฅ์์ ๋ณด์๊ณ ,
+CamemBERT ๋ฐ FlauBERT์ ๋๋ฑํ๊ฑฐ๋ ์ด๋ฅผ ๋ฅ๊ฐํจ์ ๋ณด์์ต๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [moussakam](https://huggingface.co/moussakam)์ด ๊ธฐ์ฌํ์ต๋๋ค. ์ ์์ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/moussaKam/BARThez)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+
+
+BARThez ๊ตฌํ์ ๐ค BART์ ๋์ผํ๋, ํ ํฐํ์์ ์ฐจ์ด๊ฐ ์์ต๋๋ค. ๊ตฌ์ฑ ํด๋์ค์ ๊ทธ ๋งค๊ฐ๋ณ์์ ๋ํ ์ ๋ณด๋ [BART ๋ฌธ์](bart)๋ฅผ ์ฐธ์กฐํ์ญ์์ค.
+BARThez ์ ์ฉ ํ ํฌ๋์ด์ ๋ ์๋์ ๋ฌธ์ํ๋์ด ์์ต๋๋ค.
+
+
+
+## ๋ฆฌ์์ค [[resources]]
+
+- BARThez๋ ๐ค BART์ ์ ์ฌํ ๋ฐฉ์์ผ๋ก ์ํ์ค-ํฌ-์ํ์ค ์์
์ ๋ง์ถฐ ๋ฏธ์ธ ์กฐ์ ๋ ์ ์์ต๋๋ค. ๋ค์์ ํ์ธํ์ธ์:
+ [examples/pytorch/summarization/](https://github.com/huggingface/transformers/tree/main/examples/pytorch/summarization/README.md).
+
+
+## BarthezTokenizer [[bartheztokenizer]]
+
+[[autodoc]] BarthezTokenizer
+
+## BarthezTokenizerFast [[bartheztokenizerfast]]
+
+[[autodoc]] BarthezTokenizerFast
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bartpho.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bartpho.md
new file mode 100644
index 0000000000000000000000000000000000000000..a323c28152c5d9969cee4b08b9dd21a8cb9ab999
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bartpho.md
@@ -0,0 +1,86 @@
+
+
+# BARTpho [[bartpho]]
+
+## ๊ฐ์ [[overview]]
+
+BARTpho ๋ชจ๋ธ์ Nguyen Luong Tran, Duong Minh Le, Dat Quoc Nguyen์ ์ํด [BARTpho: Pre-trained Sequence-to-Sequence Models for Vietnamese](https://arxiv.org/abs/2109.09701)์์ ์ ์๋์์ต๋๋ค.
+
+์ด ๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ฐ๋ฆฌ๋ BARTpho_word์ BARTpho_syllable์ ๋ ๊ฐ์ง ๋ฒ์ ์ผ๋ก BARTpho๋ฅผ ์ ์ํฉ๋๋ค.
+์ด๋ ๋ฒ ํธ๋จ์ด๋ฅผ ์ํด ์ฌ์ ํ๋ จ๋ ์ต์ด์ ๋๊ท๋ชจ ๋จ์ผ ์ธ์ด ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ์
๋๋ค.
+์ฐ๋ฆฌ์ BARTpho๋ ์ํ์ค-ํฌ-์ํ์ค ๋๋
ธ์ด์ง ๋ชจ๋ธ์ธ BART์ "large" ์ํคํ
์ฒ์ ์ฌ์ ํ๋ จ ๋ฐฉ์์ ์ฌ์ฉํ์ฌ, ์์ฑํ NLP ์์
์ ํนํ ์ ํฉํฉ๋๋ค.
+๋ฒ ํธ๋จ์ด ํ
์คํธ ์์ฝ์ ๋ค์ด์คํธ๋ฆผ ์์
์คํ์์,
+์๋ ๋ฐ ์ธ๊ฐ ํ๊ฐ ๋ชจ๋์์ BARTpho๊ฐ ๊ฐ๋ ฅํ ๊ธฐ์ค์ธ mBART๋ฅผ ๋ฅ๊ฐํ๊ณ ์ต์ ์ฑ๋ฅ์ ๊ฐ์ ํ์์ ๋ณด์ฌ์ค๋๋ค.
+์ฐ๋ฆฌ๋ ํฅํ ์ฐ๊ตฌ ๋ฐ ๋ฒ ํธ๋จ์ด ์์ฑํ NLP ์์
์ ์์ฉ์ ์ด์งํ๊ธฐ ์ํด BARTpho๋ฅผ ๊ณต๊ฐํฉ๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [dqnguyen](https://huggingface.co/dqnguyen)์ด ๊ธฐ์ฌํ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/VinAIResearch/BARTpho)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ์์ [[usage-example]]
+
+```python
+>>> import torch
+>>> from transformers import AutoModel, AutoTokenizer
+
+>>> bartpho = AutoModel.from_pretrained("vinai/bartpho-syllable")
+
+>>> tokenizer = AutoTokenizer.from_pretrained("vinai/bartpho-syllable")
+
+>>> line = "Chรบng tรดi lร nhแปฏng nghiรชn cแปฉu viรชn."
+
+>>> input_ids = tokenizer(line, return_tensors="pt")
+
+>>> with torch.no_grad():
+... features = bartpho(**input_ids) # ์ด์ ๋ชจ๋ธ ์ถ๋ ฅ์ ํํ์
๋๋ค
+
+>>> # With TensorFlow 2.0+:
+>>> from transformers import TFAutoModel
+
+>>> bartpho = TFAutoModel.from_pretrained("vinai/bartpho-syllable")
+>>> input_ids = tokenizer(line, return_tensors="tf")
+>>> features = bartpho(**input_ids)
+```
+
+## ์ฌ์ฉ ํ [[usage-tips]]
+
+- mBART๋ฅผ ๋ฐ๋ฅด๋ฉฐ, BARTpho๋ BART์ "large" ์ํคํ
์ฒ์ ์ธ์ฝ๋์ ๋์ฝ๋์ ์๋จ์ ์ถ๊ฐ์ ์ธ ๋ ์ด์ด ์ ๊ทํ ๋ ์ด์ด๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+๋ฐ๋ผ์ [BART ๋ฌธ์](bart)์ ์๋ ์ฌ์ฉ ์์๋ฅผ BARTpho์ ๋ง๊ฒ ์ ์ฉํ๋ ค๋ฉด
+BART ์ ์ฉ ํด๋์ค๋ฅผ mBART ์ ์ฉ ํด๋์ค๋ก ๋์ฒดํ์ฌ ์กฐ์ ํด์ผ ํฉ๋๋ค.
+์๋ฅผ ๋ค์ด:
+
+```python
+>>> from transformers import MBartForConditionalGeneration
+
+>>> bartpho = MBartForConditionalGeneration.from_pretrained("vinai/bartpho-syllable")
+>>> TXT = "Chรบng tรดi lร nghiรชn cแปฉu viรชn."
+>>> input_ids = tokenizer([TXT], return_tensors="pt")["input_ids"]
+>>> logits = bartpho(input_ids).logits
+>>> masked_index = (input_ids[0] == tokenizer.mask_token_id).nonzero().item()
+>>> probs = logits[0, masked_index].softmax(dim=0)
+>>> values, predictions = probs.topk(5)
+>>> print(tokenizer.decode(predictions).split())
+```
+
+- ์ด ๊ตฌํ์ ํ ํฐํ๋ง์ ์ํ ๊ฒ์
๋๋ค: "monolingual_vocab_file"์ ๋ค๊ตญ์ด
+ XLM-RoBERTa์์ ์ ๊ณต๋๋ ์ฌ์ ํ๋ จ๋ SentencePiece ๋ชจ๋ธ
+ "vocab_file"์์ ์ถ์ถ๋ ๋ฒ ํธ๋จ์ด ์ ์ฉ ์ ํ์ผ๋ก ๊ตฌ์ฑ๋ฉ๋๋ค.
+ ๋ค๋ฅธ ์ธ์ด๋ค๋ ์ด ์ฌ์ ํ๋ จ๋ ๋ค๊ตญ์ด SentencePiece ๋ชจ๋ธ "vocab_file"์ ํ์ ๋จ์ด ๋ถํ ์ ์ฌ์ฉํ๋ฉด, ์์ ์ ์ธ์ด ์ ์ฉ "monolingual_vocab_file"๊ณผ ํจ๊ป BartphoTokenizer๋ฅผ ์ฌ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+## BartphoTokenizer [[bartphotokenizer]]
+
+[[autodoc]] BartphoTokenizer
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bert-japanese.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bert-japanese.md
new file mode 100644
index 0000000000000000000000000000000000000000..8c21ef3558908e76288f670cf57d97252775252f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bert-japanese.md
@@ -0,0 +1,79 @@
+
+
+# ์ผ๋ณธ์ด BERT (BertJapanese) [[bertjapanese]]
+
+## ๊ฐ์ [[overview]]
+
+์ผ๋ณธ์ด ๋ฌธ์ฅ์ ํ์ต๋ BERT ๋ชจ๋ธ ์
๋๋ค.
+
+๊ฐ๊ฐ ์๋ก ๋ค๋ฅธ ํ ํฐํ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ๋ ๋ ๋ชจ๋ธ:
+
+- MeCab์ WordPiece๋ฅผ ์ฌ์ฉํ์ฌ ํ ํฐํํฉ๋๋ค. ์ด๋ฅผ ์ํด ์ถ๊ฐ ์์กด์ฑ [fugashi](https://github.com/polm/fugashi)์ด ํ์ํฉ๋๋ค. (์ด๋ [MeCab](https://taku910.github.io/mecab/)์ ๋ํผ์
๋๋ค.)
+- ๋ฌธ์ ๋จ์๋ก ํ ํฐํํฉ๋๋ค.
+
+*MecabTokenizer*๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด, ์์กด์ฑ์ ์ค์นํ๊ธฐ ์ํด `pip install transformers["ja"]` (๋๋ ์์ค์์ ์ค์นํ๋ ๊ฒฝ์ฐ `pip install -e .["ja"]`) ๋ช
๋ น์ ์คํํด์ผ ํฉ๋๋ค.
+
+์์ธํ ๋ด์ฉ์ [cl-tohoku ๋ฆฌํฌ์งํ ๋ฆฌ](https://github.com/cl-tohoku/bert-japanese)์์ ํ์ธํ์ธ์.
+
+MeCab๊ณผ WordPiece ํ ํฐํ๋ฅผ ์ฌ์ฉํ๋ ๋ชจ๋ธ ์์:
+
+```python
+>>> import torch
+>>> from transformers import AutoModel, AutoTokenizer
+
+>>> bertjapanese = AutoModel.from_pretrained("cl-tohoku/bert-base-japanese")
+>>> tokenizer = AutoTokenizer.from_pretrained("cl-tohoku/bert-base-japanese")
+
+>>> ## Input Japanese Text
+>>> line = "ๅพ่ผฉใฏ็ซใงใใใ"
+
+>>> inputs = tokenizer(line, return_tensors="pt")
+
+>>> print(tokenizer.decode(inputs["input_ids"][0]))
+[CLS] ๅพ่ผฉ ใฏ ็ซ ใง ใใ ใ [SEP]
+
+>>> outputs = bertjapanese(**inputs)
+```
+
+๋ฌธ์ ํ ํฐํ๋ฅผ ์ฌ์ฉํ๋ ๋ชจ๋ธ ์์:
+
+```python
+>>> bertjapanese = AutoModel.from_pretrained("cl-tohoku/bert-base-japanese-char")
+>>> tokenizer = AutoTokenizer.from_pretrained("cl-tohoku/bert-base-japanese-char")
+
+>>> ## Input Japanese Text
+>>> line = "ๅพ่ผฉใฏ็ซใงใใใ"
+
+>>> inputs = tokenizer(line, return_tensors="pt")
+
+>>> print(tokenizer.decode(inputs["input_ids"][0]))
+[CLS] ๅพ ่ผฉ ใฏ ็ซ ใง ใ ใ ใ [SEP]
+
+>>> outputs = bertjapanese(**inputs)
+```
+
+
+
+์ด๋ ํ ํฐํ ๋ฐฉ๋ฒ์ ์ ์ธํ๊ณ ๋ BERT์ ๋์ผํฉ๋๋ค. API ์ฐธ์กฐ ์ ๋ณด๋ [BERT ๋ฌธ์](https://huggingface.co/docs/transformers/main/en/model_doc/bert)๋ฅผ ์ฐธ์กฐํ์ธ์.
+์ด ๋ชจ๋ธ์ [cl-tohoku](https://huggingface.co/cl-tohoku)๊ป์ ๊ธฐ์ฌํ์์ต๋๋ค.
+
+
+
+
+## BertJapaneseTokenizer
+
+[[autodoc]] BertJapaneseTokenizer
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bert.md
new file mode 100644
index 0000000000000000000000000000000000000000..531d3e3dd6394766531b64adacf280d6392576c4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bert.md
@@ -0,0 +1,340 @@
+
+
+# BERT[[BERT]]
+
+
+
+## ๊ฐ์[[Overview]]
+
+BERT ๋ชจ๋ธ์ Jacob Devlin. Ming-Wei Chang, Kenton Lee, Kristina Touranova๊ฐ ์ ์ํ ๋
ผ๋ฌธ [BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding](https://arxiv.org/abs/1810.04805)์์ ์๊ฐ๋์์ต๋๋ค. BERT๋ ์ฌ์ ํ์ต๋ ์๋ฐฉํฅ ํธ๋์คํฌ๋จธ๋ก, Toronto Book Corpus์ Wikipedia๋ก ๊ตฌ์ฑ๋ ๋๊ท๋ชจ ์ฝํผ์ค์์ ๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง๊ณผ ๋ค์ ๋ฌธ์ฅ ์์ธก(Next Sentence Prediction) ๋ชฉํ๋ฅผ ๊ฒฐํฉํด ํ์ต๋์์ต๋๋ค.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*์ฐ๋ฆฌ๋ BERT(Bidirectional Encoder Representations from Transformers)๋ผ๋ ์๋ก์ด ์ธ์ด ํํ ๋ชจ๋ธ์ ์๊ฐํฉ๋๋ค. ์ต๊ทผ์ ๋ค๋ฅธ ์ธ์ด ํํ ๋ชจ๋ธ๋ค๊ณผ ๋ฌ๋ฆฌ, BERT๋ ๋ชจ๋ ๊ณ์ธต์์ ์๋ฐฉํฅ์ผ๋ก ์์ชฝ ๋ฌธ๋งฅ์ ์กฐ๊ฑด์ผ๋ก ์ฌ์ฉํ์ฌ ๋น์ง๋ ํ์ต๋ ํ
์คํธ์์ ๊น์ด ์๋ ์๋ฐฉํฅ ํํ์ ์ฌ์ ํ์ตํ๋๋ก ์ค๊ณ๋์์ต๋๋ค. ๊ทธ ๊ฒฐ๊ณผ, ์ฌ์ ํ์ต๋ BERT ๋ชจ๋ธ์ ์ถ๊ฐ์ ์ธ ์ถ๋ ฅ ๊ณ์ธต ํ๋๋ง์ผ๋ก ์ง๋ฌธ ์๋ต, ์ธ์ด ์ถ๋ก ๊ณผ ๊ฐ์ ๋ค์ํ ์์
์์ ๋ฏธ์ธ ์กฐ์ ๋ ์ ์์ผ๋ฏ๋ก, ํน์ ์์
์ ์ํด ์ํคํ
์ฒ๋ฅผ ์์ ํ ํ์๊ฐ ์์ต๋๋ค.*
+
+*BERT๋ ๊ฐ๋
์ ์ผ๋ก ๋จ์ํ๋ฉด์๋ ์ค์ฆ์ ์ผ๋ก ๊ฐ๋ ฅํ ๋ชจ๋ธ์
๋๋ค. BERT๋ 11๊ฐ์ ์์ฐ์ด ์ฒ๋ฆฌ ๊ณผ์ ์์ ์๋ก์ด ์ต๊ณ ์ฑ๋ฅ์ ๋ฌ์ฑํ์ผ๋ฉฐ, GLUE ์ ์๋ฅผ 80.5% (7.7% ํฌ์ธํธ ์ ๋ ๊ฐ์ )๋ก, MultiNLI ์ ํ๋๋ฅผ 86.7% (4.6% ํฌ์ธํธ ์ ๋ ๊ฐ์ ), SQuAD v1.1 ์ง๋ฌธ ์๋ต ํ
์คํธ์์ F1 ์ ์๋ฅผ 93.2 (1.5% ํฌ์ธํธ ์ ๋ ๊ฐ์ )๋ก, SQuAD v2.0์์ F1 ์ ์๋ฅผ 83.1 (5.1% ํฌ์ธํธ ์ ๋ ๊ฐ์ )๋ก ํฅ์์์ผฐ์ต๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [thomwolf](https://huggingface.co/thomwolf)๊ฐ ๊ธฐ์ฌํ์์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/google-research/bert)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[Usage tips]]
+
+- BERT๋ ์ ๋ ์์น ์๋ฒ ๋ฉ์ ์ฌ์ฉํ๋ ๋ชจ๋ธ์ด๋ฏ๋ก ์
๋ ฅ์ ์ผ์ชฝ์ด ์๋๋ผ ์ค๋ฅธ์ชฝ์์ ํจ๋ฉํ๋ ๊ฒ์ด ์ผ๋ฐ์ ์ผ๋ก ๊ถ์ฅ๋ฉ๋๋ค.
+- BERT๋ ๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ(MLM)๊ณผ Next Sentence Prediction(NSP) ๋ชฉํ๋ก ํ์ต๋์์ต๋๋ค. ์ด๋ ๋ง์คํน๋ ํ ํฐ ์์ธก๊ณผ ์ ๋ฐ์ ์ธ ์์ฐ์ด ์ดํด(NLU)์ ๋ฐ์ด๋์ง๋ง, ํ
์คํธ ์์ฑ์๋ ์ต์ ํ๋์ด์์ง ์์ต๋๋ค.
+- BERT์ ์ฌ์ ํ์ต ๊ณผ์ ์์๋ ์
๋ ฅ ๋ฐ์ดํฐ๋ฅผ ๋ฌด์์๋ก ๋ง์คํนํ์ฌ ์ผ๋ถ ํ ํฐ์ ๋ง์คํนํฉ๋๋ค. ์ ์ฒด ํ ํฐ ์ค ์ฝ 15%๊ฐ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ๋ง์คํน๋ฉ๋๋ค:
+
+ * 80% ํ๋ฅ ๋ก ๋ง์คํฌ ํ ํฐ์ผ๋ก ๋์ฒด
+ * 10% ํ๋ฅ ๋ก ์์์ ๋ค๋ฅธ ํ ํฐ์ผ๋ก ๋์ฒด
+ * 10% ํ๋ฅ ๋ก ์๋ ํ ํฐ ๊ทธ๋๋ก ์ ์ง
+
+- ๋ชจ๋ธ์ ์ฃผ์ ๋ชฉํ๋ ์๋ณธ ๋ฌธ์ฅ์ ์์ธกํ๋ ๊ฒ์ด์ง๋ง, ๋ ๋ฒ์งธ ๋ชฉํ๊ฐ ์์ต๋๋ค: ์
๋ ฅ์ผ๋ก ๋ฌธ์ฅ A์ B (์ฌ์ด์๋ ๊ตฌ๋ถ ํ ํฐ์ด ์์)๊ฐ ์ฃผ์ด์ง๋๋ค. ์ด ๋ฌธ์ฅ ์์ด ์ฐ์๋ ํ๋ฅ ์ 50%์ด๋ฉฐ, ๋๋จธ์ง 50%๋ ์๋ก ๋ฌด๊ดํ ๋ฌธ์ฅ๋ค์
๋๋ค. ๋ชจ๋ธ์ ์ด ๋ ๋ฌธ์ฅ์ด ์๋์ง๋ฅผ ์์ธกํด์ผ ํฉ๋๋ค.
+
+### Scaled Dot Product Attention(SDPA) ์ฌ์ฉํ๊ธฐ [[Using Scaled Dot Product Attention (SDPA)]]
+
+Pytorch๋ `torch.nn.functional`์ ์ผ๋ถ๋ก Scaled Dot Product Attention(SDPA) ์ฐ์ฐ์๋ฅผ ๊ธฐ๋ณธ์ ์ผ๋ก ์ ๊ณตํฉ๋๋ค. ์ด ํจ์๋ ์
๋ ฅ๊ณผ ํ๋์จ์ด์ ๋ฐ๋ผ ์ฌ๋ฌ ๊ตฌํ ๋ฐฉ์์ ์ฌ์ฉํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ [๊ณต์ ๋ฌธ์](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)๋ [GPU Inference](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+`torch>=2.1.1`์์๋ ๊ตฌํ์ด ๊ฐ๋ฅํ ๊ฒฝ์ฐ SDPA๊ฐ ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ์ฉ๋์ง๋ง, `from_pretrained()`ํจ์์์ `attn_implementation="sdpa"`๋ฅผ ์ค์ ํ์ฌ SDPA๋ฅผ ๋ช
์์ ์ผ๋ก ์ฌ์ฉํ๋๋ก ์ง์ ํ ์๋ ์์ต๋๋ค.
+
+```
+from transformers import BertModel
+
+model = BertModel.from_pretrained("bert-base-uncased", torch_dtype=torch.float16, attn_implementation="sdpa")
+...
+```
+
+์ต์ ์ฑ๋ฅ ํฅ์์ ์ํด ๋ชจ๋ธ์ ๋ฐ์ ๋ฐ๋(์: `torch.float16` ๋๋ `torch.bfloat16`)๋ก ๋ถ๋ฌ์ค๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
+
+๋ก์ปฌ ๋ฒค์น๋งํฌ (A100-80GB, CPUx12, RAM 96.6GB, PyTorch 2.2.0, OS Ubuntu 22.04)์์ `float16`์ ์ฌ์ฉํด ํ์ต ๋ฐ ์ถ๋ก ์ ์ํํ ๊ฒฐ๊ณผ, ๋ค์๊ณผ ๊ฐ์ ์๋ ํฅ์์ด ๊ด์ฐฐ๋์์ต๋๋ค.
+
+#### ํ์ต [[Training]]
+
+|batch_size|seq_len|Time per batch (eager - s)|Time per batch (sdpa - s)|Speedup (%)|Eager peak mem (MB)|sdpa peak mem (MB)|Mem saving (%)|
+|----------|-------|--------------------------|-------------------------|-----------|-------------------|------------------|--------------|
+|4 |256 |0.023 |0.017 |35.472 |939.213 |764.834 |22.800 |
+|4 |512 |0.023 |0.018 |23.687 |1970.447 |1227.162 |60.569 |
+|8 |256 |0.023 |0.018 |23.491 |1594.295 |1226.114 |30.028 |
+|8 |512 |0.035 |0.025 |43.058 |3629.401 |2134.262 |70.054 |
+|16 |256 |0.030 |0.024 |25.583 |2874.426 |2134.262 |34.680 |
+|16 |512 |0.064 |0.044 |46.223 |6964.659 |3961.013 |75.830 |
+
+#### ์ถ๋ก [[Inference]]
+
+|batch_size|seq_len|Per token latency eager (ms)|Per token latency SDPA (ms)|Speedup (%)|Mem eager (MB)|Mem BT (MB)|Mem saved (%)|
+|----------|-------|----------------------------|---------------------------|-----------|--------------|-----------|-------------|
+|1 |128 |5.736 |4.987 |15.022 |282.661 |282.924 |-0.093 |
+|1 |256 |5.689 |4.945 |15.055 |298.686 |298.948 |-0.088 |
+|2 |128 |6.154 |4.982 |23.521 |314.523 |314.785 |-0.083 |
+|2 |256 |6.201 |4.949 |25.303 |347.546 |347.033 |0.148 |
+|4 |128 |6.049 |4.987 |21.305 |378.895 |379.301 |-0.107 |
+|4 |256 |6.285 |5.364 |17.166 |443.209 |444.382 |-0.264 |
+
+
+
+## ์๋ฃ[[Resources]]
+
+BERT๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค. ์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐ ํด๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+
+
+- [BERT ํ
์คํธ ๋ถ๋ฅ (๋ค๋ฅธ ์ธ์ด๋ก)](https://www.philschmid.de/bert-text-classification-in-a-different-language)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [๋ค์ค ๋ ์ด๋ธ ํ
์คํธ ๋ถ๋ฅ๋ฅผ ์ํ BERT (๋ฐ ๊ด๋ จ ๋ชจ๋ธ) ๋ฏธ์ธ ์กฐ์ ](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/BERT/Fine_tuning_BERT_(and_friends)_for_multi_label_text_classification.ipynb)์ ๋ํ ๋
ธํธ๋ถ.
+- [PyTorch๋ฅผ ์ด์ฉํด BERT๋ฅผ ๋ค์ค ๋ ์ด๋ธ ๋ถ๋ฅ๋ฅผ ์ํด ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ](htt๊ธฐps://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multi_label_classification.ipynb)์ ๋ํ ๋
ธํธ๋ถ. ๐
+- [BERT๋ก EncoderDecoder ๋ชจ๋ธ์ warm-startํ์ฌ ์์ฝํ๊ธฐ](https://colab.research.google.com/github/patrickvonplaten/notebooks/blob/master/BERT2BERT_for_CNN_Dailymail.ipynb)์ ๋ํ ๋
ธํธ๋ถ.
+- [`BertForSequenceClassification`]์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)์์ ์ง์๋ฉ๋๋ค.
+- [`TFBertForSequenceClassification`]์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)์์ ์ง์๋ฉ๋๋ค.
+- [`FlaxBertForSequenceClassification`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [ํ
์คํธ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/sequence_classification)
+
+
+
+- [Keras์ ํจ๊ป Hugging Face Transformers๋ฅผ ์ฌ์ฉํ์ฌ ๋น์๋ฆฌ BERT๋ฅผ ๊ฐ์ฒด๋ช
์ธ์(NER)์ฉ์ผ๋ก ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/huggingface-transformers-keras-tf)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [BERT๋ฅผ ๊ฐ์ฒด๋ช
์ธ์์ ์ํด ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://colab.research.google.com/github/NielsRogge/Transformers-Tutorials/blob/master/BERT/Custom_Named_Entity_Recognition_with_BERT_only_first_wordpiece.ipynb)์ ๋ํ ๋
ธํธ๋ถ. ๊ฐ ๋จ์ด์ ์ฒซ ๋ฒ์งธ wordpiece์๋ง ๋ ์ด๋ธ์ ์ง์ ํ์ฌ ํ์ตํ๋ ๋ฐฉ๋ฒ์ ์ค๋ช
ํฉ๋๋ค. ๋ชจ๋ wordpiece์ ๋ ์ด๋ธ์ ์ ํํ๋ ๋ฐฉ๋ฒ์ [์ด ๋ฒ์ ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/BERT/Custom_Named_Entity_Recognition_with_BERT.ipynb)์์ ํ์ธํ ์ ์์ต๋๋ค.
+- [`BertForTokenClassification`]์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)์์ ์ง์๋ฉ๋๋ค.
+- [`TFBertForTokenClassification`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [`FlaxBertForTokenClassification`]์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/flax/token-classification)์์ ์ง์๋ฉ๋๋ค.
+- ๐ค Hugging Face ์ฝ์ค์ [ํ ํฐ ๋ถ๋ฅ ์ฑํฐ](https://huggingface.co/course/chapter7/2?fw=pt).
+- [ํ ํฐ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/token_classification)
+
+
+
+- [`BertForMaskedLM`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [`TFBertForMaskedLM`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [`FlaxBertForMaskedLM`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- ๐ค Hugging Face ์ฝ์ค์ [๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง ์ฑํฐ](https://huggingface.co/course/chapter7/3?fw=pt).
+- [๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/masked_language_modeling)
+
+
+
+- [`BertForQuestionAnswering`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [`TFBertForQuestionAnswering`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [`FlaxBertForQuestionAnswering`]์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/flax/question-answering)์์ ์ง์๋ฉ๋๋ค.
+- ๐ค Hugging Face ์ฝ์ค์ [์ง๋ฌธ ๋ต๋ณ ์ฑํฐ](https://huggingface.co/course/chapter7/7?fw=pt).
+- [์ง๋ฌธ ๋ต๋ณ ์์
๊ฐ์ด๋](../tasks/question_answering)
+
+**๋ค์ค ์ ํ**
+- [`BertForMultipleChoice`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [`TFBertForMultipleChoice`]์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์๋ฉ๋๋ค.
+- [๋ค์ค ์ ํ ์์
๊ฐ์ด๋](../tasks/multiple_choice)
+
+โก๏ธ **์ถ๋ก **
+- [Hugging Face Transformers์ AWS Inferentia๋ฅผ ์ฌ์ฉํ์ฌ BERT ์ถ๋ก ์ ๊ฐ์ํํ๋ ๋ฐฉ๋ฒ](https://huggingface.co/blog/bert-inferentia-sagemaker)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [GPU์์ DeepSpeed-Inference๋ก BERT ์ถ๋ก ์ ๊ฐ์ํํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/bert-deepspeed-inference)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+
+โ๏ธ **์ฌ์ ํ์ต**
+- [Hugging Face Optimum์ผ๋ก Transformers๋ฅผ ONMX๋ก ๋ณํํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/pre-training-bert-habana)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+
+๐ **๋ฐฐํฌ**
+- [Hugging Face Optimum์ผ๋ก Transformers๋ฅผ ONMX๋ก ๋ณํํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/convert-transformers-to-onnx)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [AWS์์ Hugging Face Transformers๋ฅผ ์ํ Habana Gaudi ๋ฅ๋ฌ๋ ํ๊ฒฝ ์ค์ ๋ฐฉ๋ฒ](https://www.philschmid.de/getting-started-habana-gaudi#conclusion)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [Hugging Face Transformers, Amazon SageMaker ๋ฐ Terraform ๋ชจ๋์ ์ด์ฉํ BERT ์๋ ํ์ฅ](https://www.philschmid.de/terraform-huggingface-amazon-sagemaker-advanced)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [Hugging Face, AWS Lambda, Docker๋ฅผ ํ์ฉํ์ฌ ์๋ฒ๋ฆฌ์ค BERT ์ค์ ํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/serverless-bert-with-huggingface-aws-lambda-docker)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [Amazon SageMaker์ Training Compiler๋ฅผ ์ฌ์ฉํ์ฌ Hugging Face Transformers์์ BERT ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/huggingface-amazon-sagemaker-training-compiler)์ ๋ํ ๋ธ๋ก๊ทธ.
+- [Amazon SageMaker๋ฅผ ์ฌ์ฉํ Transformers์ BERT์ ์์
๋ณ ์ง์ ์ฆ๋ฅ](https://www.philschmid.de/knowledge-distillation-bert-transformers)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+
+## BertConfig
+
+[[autodoc]] BertConfig
+ - all
+
+## BertTokenizer
+
+[[autodoc]] BertTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+
+
+
+## BertTokenizerFast
+
+[[autodoc]] BertTokenizerFast
+
+
+
+
+## TFBertTokenizer
+
+[[autodoc]] TFBertTokenizer
+
+
+
+
+## Bert specific outputs
+
+[[autodoc]] models.bert.modeling_bert.BertForPreTrainingOutput
+
+[[autodoc]] models.bert.modeling_tf_bert.TFBertForPreTrainingOutput
+
+[[autodoc]] models.bert.modeling_flax_bert.FlaxBertForPreTrainingOutput
+
+
+
+
+
+## BertModel
+
+[[autodoc]] BertModel
+ - forward
+
+## BertForPreTraining
+
+[[autodoc]] BertForPreTraining
+ - forward
+
+## BertLMHeadModel
+
+[[autodoc]] BertLMHeadModel
+ - forward
+
+## BertForMaskedLM
+
+[[autodoc]] BertForMaskedLM
+ - forward
+
+## BertForNextSentencePrediction
+
+[[autodoc]] BertForNextSentencePrediction
+ - forward
+
+## BertForSequenceClassification
+
+[[autodoc]] BertForSequenceClassification
+ - forward
+
+## BertForMultipleChoice
+
+[[autodoc]] BertForMultipleChoice
+ - forward
+
+## BertForTokenClassification
+
+[[autodoc]] BertForTokenClassification
+ - forward
+
+## BertForQuestionAnswering
+
+[[autodoc]] BertForQuestionAnswering
+ - forward
+
+
+
+
+## TFBertModel
+
+[[autodoc]] TFBertModel
+ - call
+
+## TFBertForPreTraining
+
+[[autodoc]] TFBertForPreTraining
+ - call
+
+## TFBertModelLMHeadModel
+
+[[autodoc]] TFBertLMHeadModel
+ - call
+
+## TFBertForMaskedLM
+
+[[autodoc]] TFBertForMaskedLM
+ - call
+
+## TFBertForNextSentencePrediction
+
+[[autodoc]] TFBertForNextSentencePrediction
+ - call
+
+## TFBertForSequenceClassification
+
+[[autodoc]] TFBertForSequenceClassification
+ - call
+
+## TFBertForMultipleChoice
+
+[[autodoc]] TFBertForMultipleChoice
+ - call
+
+## TFBertForTokenClassification
+
+[[autodoc]] TFBertForTokenClassification
+ - call
+
+## TFBertForQuestionAnswering
+
+[[autodoc]] TFBertForQuestionAnswering
+ - call
+
+
+
+
+## FlaxBertModel
+
+[[autodoc]] FlaxBertModel
+ - __call__
+
+## FlaxBertForPreTraining
+
+[[autodoc]] FlaxBertForPreTraining
+ - __call__
+
+## FlaxBertForCausalLM
+
+[[autodoc]] FlaxBertForCausalLM
+ - __call__
+
+## FlaxBertForMaskedLM
+
+[[autodoc]] FlaxBertForMaskedLM
+ - __call__
+
+## FlaxBertForNextSentencePrediction
+
+[[autodoc]] FlaxBertForNextSentencePrediction
+ - __call__
+
+## FlaxBertForSequenceClassification
+
+[[autodoc]] FlaxBertForSequenceClassification
+ - __call__
+
+## FlaxBertForMultipleChoice
+
+[[autodoc]] FlaxBertForMultipleChoice
+ - __call__
+
+## FlaxBertForTokenClassification
+
+[[autodoc]] FlaxBertForTokenClassification
+ - __call__
+
+## FlaxBertForQuestionAnswering
+
+[[autodoc]] FlaxBertForQuestionAnswering
+ - __call__
+
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bertweet.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bertweet.md
new file mode 100644
index 0000000000000000000000000000000000000000..7a46087d0a8ebf85929aadbb74808ffe029537c9
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/bertweet.md
@@ -0,0 +1,67 @@
+
+
+# BERTweet [[bertweet]]
+
+## ๊ฐ์ [[overview]]
+
+BERTweet ๋ชจ๋ธ์ Dat Quoc Nguyen, Thanh Vu, Anh Tuan Nguyen์ ์ํด [BERTweet: A pre-trained language model for English Tweets](https://www.aclweb.org/anthology/2020.emnlp-demos.2.pdf) ์์ ์ ์๋์์ต๋๋ค.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก :
+
+*์์ด ํธ์์ ์ํ ์ต์ด์ ๊ณต๊ฐ ๋๊ท๋ชจ ์ฌ์ ํ์ต๋ ์ธ์ด ๋ชจ๋ธ์ธ BERTweet์ ์๊ฐํฉ๋๋ค.
+BERTweet์ BERT-base(Devlin et al., 2019)์ ๋์ผํ ์ํคํ
์ฒ๋ฅผ ๊ฐ์ง๊ณ ์์ผ๋ฉฐ, RoBERTa ์ฌ์ ํ์ต ์ ์ฐจ(Liu et al., 2019)๋ฅผ ์ฌ์ฉํ์ฌ ํ์ต๋์์ต๋๋ค.
+์คํ ๊ฒฐ๊ณผ, BERTweet์ ๊ฐ๋ ฅํ ๊ธฐ์ค ๋ชจ๋ธ์ธ RoBERTa-base ๋ฐ XLM-R-base(Conneau et al., 2020)์ ์ฑ๋ฅ์ ๋ฅ๊ฐํ์ฌ ์ธ ๊ฐ์ง ํธ์ NLP ์์
(ํ์ฌ ํ๊น
, ๊ฐ์ฒด๋ช
์ธ์, ํ
์คํธ ๋ถ๋ฅ)์์ ์ด์ ์ต์ ๋ชจ๋ธ๋ณด๋ค ๋ ๋์ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ์์ต๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [dqnguyen](https://huggingface.co/dqnguyen) ๊ป์ ๊ธฐ์ฌํ์
จ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/VinAIResearch/BERTweet).์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+## ์ฌ์ฉ ์์ [[usage-example]]
+
+```python
+>>> import torch
+>>> from transformers import AutoModel, AutoTokenizer
+
+>>> bertweet = AutoModel.from_pretrained("vinai/bertweet-base")
+
+>>> # ํธ๋์คํฌ๋จธ ๋ฒ์ 4.x ์ด์ :
+>>> tokenizer = AutoTokenizer.from_pretrained("vinai/bertweet-base", use_fast=False)
+
+>>> # ํธ๋์คํฌ๋จธ ๋ฒ์ 3.x ์ด์:
+>>> # tokenizer = AutoTokenizer.from_pretrained("vinai/bertweet-base")
+
+>>> # ์
๋ ฅ๋ ํธ์์ ์ด๋ฏธ ์ ๊ทํ๋์์ต๋๋ค!
+>>> line = "SC has first two presumptive cases of coronavirus , DHEC confirms HTTPURL via @USER :cry:"
+
+>>> input_ids = torch.tensor([tokenizer.encode(line)])
+
+>>> with torch.no_grad():
+... features = bertweet(input_ids) # Models outputs are now tuples
+
+>>> # With TensorFlow 2.0+:
+>>> # from transformers import TFAutoModel
+>>> # bertweet = TFAutoModel.from_pretrained("vinai/bertweet-base")
+```
+
+
+
+์ด ๊ตฌํ์ ํ ํฐํ ๋ฐฉ๋ฒ์ ์ ์ธํ๊ณ ๋ BERT์ ๋์ผํฉ๋๋ค. API ์ฐธ์กฐ ์ ๋ณด๋ [BERT ๋ฌธ์](bert) ๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+
+
+## Bertweet ํ ํฐํ(BertweetTokenizer) [[transformers.BertweetTokenizer]]
+
+[[autodoc]] BertweetTokenizer
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/biogpt.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/biogpt.md
new file mode 100644
index 0000000000000000000000000000000000000000..4b24af8493b9d5dc025416476cb75876c91e5249
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/biogpt.md
@@ -0,0 +1,109 @@
+
+
+# BioGPT [[biogpt]]
+
+## ๊ฐ์ [[overview]]
+
+BioGPT๋ Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon, Tie-Yan Liu์ ์ํด [BioGPT: generative pre-trained transformer for biomedical text generation and mining](https://academic.oup.com/bib/advance-article/doi/10.1093/bib/bbac409/6713511?guestAccessKey=a66d9b5d-4f83-4017-bb52-405815c907b9) ์์ ์ ์๋ ๋ชจ๋ธ์
๋๋ค. BioGPT๋ ์๋ฌผ์ํ ํ
์คํธ ์์ฑ๊ณผ ๋ง์ด๋์ ์ํด ๋๋ฉ์ธ์ ํนํ๋ ์์ฑํ ์ฌ์ ํ์ต ํธ๋์คํฌ๋จธ ์ธ์ด ๋ชจ๋ธ์
๋๋ค. BioGPT๋ ํธ๋์คํฌ๋จธ ์ธ์ด ๋ชจ๋ธ ๊ตฌ์กฐ๋ฅผ ๋ฐ๋ฅด๋ฉฐ, 1,500๋ง ๊ฐ์ PubMed ์ด๋ก์ ์ด์ฉํด ์ฒ์๋ถํฐ ํ์ต๋์์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์๋ฌผ์ํ ๋ถ์ผ์์ ์ฌ์ ํ์ต๋ ์ธ์ด ๋ชจ๋ธ์ ์ผ๋ฐ ์์ฐ์ด ์ฒ๋ฆฌ ๋ถ์ผ์์์ ์ฑ๊ณต์ ์๊ฐ์ ๋ฐ์ ์ ์ ๋ ๋ง์ ์ฃผ๋ชฉ์ ๋ฐ๊ณ ์์ต๋๋ค. ์ผ๋ฐ ์ธ์ด ๋ถ์ผ์์ ์ฌ์ ํ์ต๋ ์ธ์ด ๋ชจ๋ธ์ ๋ ๊ฐ์ง ์ฃผ์ ๊ณํต์ธ BERT(๋ฐ ๊ทธ ๋ณํ)์ GPT(๋ฐ ๊ทธ ๋ณํ) ์ค ์ฒซ ๋ฒ์งธ๋ ์๋ฌผ์ํ ๋ถ์ผ์์ BioBERT์ PubMedBERT์ ๊ฐ์ด ๊ด๋ฒ์ํ๊ฒ ์ฐ๊ตฌ๋์์ต๋๋ค. ์ด๋ค์ ๋ค์ํ ๋ถ๋ฅ ๊ธฐ๋ฐ์ ์๋ฌผ์ํ ์์
์์ ํฐ ์ฑ๊ณต์ ๊ฑฐ๋์์ง๋ง, ์์ฑ ๋ฅ๋ ฅ์ ๋ถ์กฑ์ ๊ทธ๋ค์ ์ ์ฉ ๋ฒ์๋ฅผ ์ ํํ์ต๋๋ค. ๋ณธ ๋
ผ๋ฌธ์์๋ ๋๊ท๋ชจ ์๋ฌผ์ํ ๋ฌธํ์ ์ฌ์ ํ์ตํ ๋๋ฉ์ธ ํนํ ์์ฑํ ํธ๋์คํฌ๋จธ ์ธ์ด ๋ชจ๋ธ์ธ BioGPT๋ฅผ ์ ์ํฉ๋๋ค. ์ฐ๋ฆฌ๋ 6๊ฐ์ ์๋ฌผ์ํ ์์ฐ์ด ์ฒ๋ฆฌ ์์
์์ BioGPT๋ฅผ ํ๊ฐํ ๊ฒฐ๊ณผ, ๋๋ถ๋ถ์ ์์
์์ ์ด์ ๋ชจ๋ธ๋ณด๋ค ์ฐ์ํ ์ฑ๋ฅ์ ๋ณด์์ต๋๋ค. ํนํ, BC5CDR, KD-DTI, DDI ์๋-ํฌ-์๋ ๊ด๊ณ ์ถ์ถ ์์
์์ ๊ฐ๊ฐ 44.98%, 38.42%, 40.76%์ F1 ์ ์๋ฅผ ๊ธฐ๋กํ์์ผ๋ฉฐ, PubMedQA์์ 78.2%์ ์ ํ๋๋ฅผ ๋ฌ์ฑํด ์๋ก์ด ๊ธฐ๋ก์ ์ธ์ ์ต๋๋ค. ๋ํ ํ
์คํธ ์์ฑ์ ๋ํ ์ฌ๋ก ์ฐ๊ตฌ๋ ์๋ฌผ์ํ ์ฉ์ด์ ๋ํ ์ ์ฐฝํ ์ค๋ช
์ ์์ฑํ๋ ๋ฐ ์์ด BioGPT์ ์ฅ์ ์ ๋์ฑ ์
์ฆํ์ต๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [kamalkraj](https://huggingface.co/kamalkraj)์ ์ํด ๊ธฐ์ฌ๋์์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/microsoft/BioGPT)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ [[usage-tips]]
+
+- BioGPT๋ ์ ๋์ ์์น ์๋ฒ ๋ฉ(absolute position embedding)์ ์ฌ์ฉํ๋ฏ๋ก, ์
๋ ฅ์ ์ผ์ชฝ์ด ์๋ ์ค๋ฅธ์ชฝ์์ ํจ๋ฉํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค.
+- BioGPT๋ ์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ๋ง(Casual Langague Modeling, CLM) ๋ชฉํ๋ก ํ์ต๋์๊ธฐ ๋๋ฌธ์, ๋ค์ ํ ํฐ์ ์์ธกํ๋ ๋ฐ ๊ฐ๋ ฅํ ์ฑ๋ฅ์ ๋ณด์
๋๋ค. ์ด ๊ธฐ๋ฅ์ ํ์ฉํ์ฌ BioGPT๋ ๊ตฌ๋ฌธ์ ์ผ๋ก ์ผ๊ด๋ ํ
์คํธ๋ฅผ ์์ฑํ ์ ์์ผ๋ฉฐ, ์์ ์คํฌ๋ฆฝํธ `run_generation.py`์์ ์ด๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
+- ์ด ๋ชจ๋ธ์ `past_key_values`(PyTorch ์ฉ)๋ฅผ ์
๋ ฅ์ผ๋ก ๋ฐ์ ์ ์๋๋ฐ, ์ด๋ ์ด์ ์ ๊ณ์ฐ๋ ํค/๊ฐ ์ดํ
์
์์
๋๋ค. ์ด ๊ฐ์ ์ฌ์ฉํ๋ฉด ํ
์คํธ ์์ฑ ์ค ์ด๋ฏธ ๊ณ์ฐ๋ ๊ฐ์ ๋ค์ ๊ณ์ฐํ์ง ์๋๋ก ํ ์ ์์ต๋๋ค. PyTorch์์ `past_key_values` ์ธ์๋ BioGptForCausalLM.forward() ๋ฉ์๋์์ ์์ธํ ์ค๋ช
๋์ด ์์ต๋๋ค.
+
+### Scaled Dot Product Attention(SDPA) ์ฌ์ฉ [[using-scaled-dot-product-attention-sdpa]]
+
+PyTorch๋ `torch.nn.functional`์ ์ผ๋ถ๋ก ์ค์ผ์ผ๋ ์ ๊ณฑ ์ดํ
์
(SDPA) ์ฐ์ฐ์๋ฅผ ๊ธฐ๋ณธ์ ์ผ๋ก ํฌํจํฉ๋๋ค. ์ด ํจ์๋ ์
๋ ฅ๊ณผ ์ฌ์ฉ ์ค์ธ ํ๋์จ์ด์ ๋ฐ๋ผ ์ฌ๋ฌ ๊ตฌํ์ ์ ์ฉํ ์ ์์ต๋๋ค. ์์ธํ ๋ด์ฉ์ [๊ณต์ ๋ฌธ์](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html) ๋๋ [GPU ์ถ๋ก ](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention) ํ์ด์ง๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+`torch>=2.1.1`์์ ๊ตฌํ์ด ๊ฐ๋ฅํ ๊ฒฝ์ฐ SDPA๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ์ฉ๋๋ฉฐ, `attn_implementation="sdpa"`๋ฅผ `from_pretrained()`์์ ์ค์ ํ์ฌ SDPA ์ฌ์ฉ์ ๋ช
์์ ์ผ๋ก ์์ฒญํ ์ ์์ต๋๋ค.
+
+```
+from transformers import BioGptForCausalLM
+model = BioGptForCausalLM.from_pretrained("microsoft/biogpt", attn_implementation="sdpa", torch_dtype=torch.float16)
+```
+
+NVIDIA GeForce RTX 2060-8GB, PyTorch 2.3.1, Ubuntu 20.04 ํ๊ฒฝ์์ `float16` ๋ฐ CausalLM ํค๋๊ฐ ์๋ `microsoft/biogpt` ๋ชจ๋ธ๋ก ๋ก์ปฌ ๋ฒค์น๋งํฌ๋ฅผ ์ํํ ๊ฒฐ๊ณผ, ํ๋ จ ์ค ๋ค์๊ณผ ๊ฐ์ ์๋ ํฅ์์ ํ์ธํ์ต๋๋ค.
+
+์ต์ ์ ์๋ ํฅ์์ ์ํด ๋ชจ๋ธ์ ๋ฐ์ ๋ฐ๋(์: `torch.float16` ๋๋ `torch.bfloat16`)๋ก ๋ก๋ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+| num_training_steps | batch_size | seq_len | is cuda | Time per batch (eager - s) | Time per batch (sdpa - s) | Speedup (%) | Eager peak mem (MB) | sdpa peak mem (MB) | Mem saving (%) |
+|--------------------|------------|---------|---------|----------------------------|---------------------------|-------------|---------------------|--------------------|----------------|
+| 100 | 1 | 128 | False | 0.038 | 0.031 | 21.301 | 1601.862 | 1601.497 | 0.023 |
+| 100 | 1 | 256 | False | 0.039 | 0.034 | 15.084 | 1624.944 | 1625.296 | -0.022 |
+| 100 | 2 | 128 | False | 0.039 | 0.033 | 16.820 | 1624.567 | 1625.296 | -0.045 |
+| 100 | 2 | 256 | False | 0.065 | 0.059 | 10.255 | 1672.164 | 1672.164 | 0.000 |
+| 100 | 4 | 128 | False | 0.062 | 0.058 | 6.998 | 1671.435 | 1672.164 | -0.044 |
+| 100 | 4 | 256 | False | 0.113 | 0.100 | 13.316 | 2350.179 | 1848.435 | 27.144 |
+| 100 | 8 | 128 | False | 0.107 | 0.098 | 9.883 | 2098.521 | 1848.435 | 13.530 |
+| 100 | 8 | 256 | False | 0.222 | 0.196 | 13.413 | 3989.980 | 2986.492 | 33.601 |
+
+NVIDIA GeForce RTX 2060-8GB, PyTorch 2.3.1, Ubuntu 20.04 ํ๊ฒฝ์์ `float16` ๋ฐ AutoModel ํค๋๊ฐ ์๋ `microsoft/biogpt` ๋ชจ๋ธ๋ก ์ถ๋ก ์ค ๋ค์๊ณผ ๊ฐ์ ์๋ ํฅ์์ ํ์ธํ์ต๋๋ค.
+
+| num_batches | batch_size | seq_len | is cuda | is half | use mask | Per token latency eager (ms) | Per token latency SDPA (ms) | Speedup (%) | Mem eager (MB) | Mem BT (MB) | Mem saved (%) |
+|-------------|------------|---------|---------|---------|----------|------------------------------|-----------------------------|-------------|----------------|--------------|---------------|
+| 50 | 1 | 64 | True | True | True | 0.115 | 0.098 | 17.392 | 716.998 | 716.998 | 0.000 |
+| 50 | 1 | 128 | True | True | True | 0.115 | 0.093 | 24.640 | 730.916 | 730.916 | 0.000 |
+| 50 | 2 | 64 | True | True | True | 0.114 | 0.096 | 19.204 | 730.900 | 730.900 | 0.000 |
+| 50 | 2 | 128 | True | True | True | 0.117 | 0.095 | 23.529 | 759.262 | 759.262 | 0.000 |
+| 50 | 4 | 64 | True | True | True | 0.113 | 0.096 | 18.325 | 759.229 | 759.229 | 0.000 |
+| 50 | 4 | 128 | True | True | True | 0.186 | 0.178 | 4.289 | 816.478 | 816.478 | 0.000 |
+
+
+## ๋ฆฌ์์ค [[resources]]
+
+- [์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/language_modeling)
+
+## BioGptConfig [[transformers.BioGptConfig]]
+
+[[autodoc]] BioGptConfig
+
+
+## BioGptTokenizer [[transformers.BioGptTokenizer]]
+
+[[autodoc]] BioGptTokenizer
+ - save_vocabulary
+
+
+## BioGptModel [[transformers.BioGptModel]]
+
+[[autodoc]] BioGptModel
+ - forward
+
+
+## BioGptForCausalLM [[transformers.BioGptForCausalLM]]
+
+[[autodoc]] BioGptForCausalLM
+ - forward
+
+
+## BioGptForTokenClassification [[transformers.BioGptForTokenClassification]]
+
+[[autodoc]] BioGptForTokenClassification
+ - forward
+
+
+## BioGptForSequenceClassification [[transformers.BioGptForSequenceClassification]]
+
+[[autodoc]] BioGptForSequenceClassification
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/blip-2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/blip-2.md
new file mode 100644
index 0000000000000000000000000000000000000000..ae3da11d3a18c310568f2b3360f5e8079c48a02c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/blip-2.md
@@ -0,0 +1,98 @@
+
+
+# BLIP-2[[blip-2]]
+
+## ๊ฐ์[[overview]]
+BLIP-2 ๋ชจ๋ธ์ Junnan Li, Dongxu Li, Silvio Savarese, Steven Hoi์ [BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models](https://arxiv.org/abs/2301.12597) ๋
ผ๋ฌธ์์ ์ ์๋์์ต๋๋ค. BLIP-2๋ ๋๊ฒฐ๋ ์ฌ์ ํ์ต ์ด๋ฏธ์ง ์ธ์ฝ๋์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ(LLM)์ ์ฐ๊ฒฐํ๋ 12์ธต์ ๊ฒฝ๋ Transformer ์ธ์ฝ๋๋ฅผ ํ์ต์์ผ, ์ฌ๋ฌ ๋น์ -์ธ์ด ์์
์์ SOTA(ํ์ฌ ์ต๊ณ ์ ์ฑ๋ฅ)์ ๋ฌ์ฑํ์ต๋๋ค. ํนํ, BLIP-2๋ 800์ต ๊ฐ์ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ฐ์ง Flamingo ๋ชจ๋ธ๋ณด๋ค ์ ๋ก์ท VQAv2์์ 8.7% ๋ ๋์ ์ฑ๋ฅ์ ๊ธฐ๋กํ์ผ๋ฉฐ, ํ์ต ๊ฐ๋ฅํ ํ๋ผ๋ฏธํฐ ์๋ Flamingo๋ณด๋ค 54๋ฐฐ ์ ์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*๋น์ -์ธ์ด ์ฌ์ ํ์ต์ ๋น์ฉ์ ๋๊ท๋ชจ ๋ชจ๋ธ์ ์๋-ํฌ-์๋ ํ์ต์ผ๋ก ์ธํด ์ ์ ๋ ๋ถ๋ด์ค๋ฌ์์ง๊ณ ์์ต๋๋ค. ๋ณธ ๋
ผ๋ฌธ์ ์ฌ์ ํ์ต๋ ์ด๋ฏธ์ง ์ธ์ฝ๋์ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ์ ํ์ฉํ์ฌ ๋น์ -์ธ์ด ์ฌ์ ํ์ต์ ๋ถํธ์คํธ๋ํํ๋ ์ผ๋ฐ์ ์ด๊ณ ํจ์จ์ ์ธ ์ฌ์ ํ์ต ์ ๋ต์ธ BLIP-2๋ฅผ ์ ์ํฉ๋๋ค. BLIP-2๋ ๊ฒฝ๋ํ๋ Querying Transformer๋ฅผ ํตํด ๋ชจ๋ฌ๋ฆฌํฐ ๊ฐ์ ์ฐจ์ด๋ฅผ ์ฐ๊ฒฐํ๋ฉฐ, ๋ ๋จ๊ณ๋ก ์ฌ์ ํ์ต๋ฉ๋๋ค. ์ฒซ ๋ฒ์งธ ๋จ๊ณ๋ ๋๊ฒฐ๋ ์ด๋ฏธ์ง ์ธ์ฝ๋๋ก๋ถํฐ ๋น์ -์ธ์ด ํํ ํ์ต์ ๋ถํธ์คํธ๋ํํ๊ณ , ๋ ๋ฒ์งธ ๋จ๊ณ๋ ๋๊ฒฐ๋ ์ธ์ด ๋ชจ๋ธ๋ก๋ถํฐ ๋น์ -์ธ์ด ์์ฑ ํ์ต์ ๋ถํธ์คํธ๋ํํฉ๋๋ค. BLIP-2๋ ๊ธฐ์กด ๋ฐฉ๋ฒ๋ค์ ๋นํด ํจ์ฌ ์ ์ ํ์ต ๊ฐ๋ฅํ ํ๋ผ๋ฏธํฐ๋ก ๋ค์ํ ๋น์ -์ธ์ด ์์
์์ ์ต์ฒจ๋จ ์ฑ๋ฅ์ ๋ฌ์ฑํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์ฐ๋ฆฌ ๋ชจ๋ธ์ ์ ๋ก์ท VQAv2์์ Flamingo80B๋ณด๋ค 8.7% ๋์ ์ฑ๋ฅ์ ๊ธฐ๋กํ๋ฉฐ, ํ์ต ๊ฐ๋ฅํ ํ๋ผ๋ฏธํฐ ์๋ 54๋ฐฐ ์ ์ต๋๋ค. ์ฐ๋ฆฌ๋ ๋ํ ์์ฐ์ด ๋ช
๋ น์ ๋ฐ๋ฅผ ์ ์๋ ์ ๋ก์ท ์ด๋ฏธ์ง-ํ
์คํธ ์์ฑ์ ์๋ก์ด ๊ธฐ๋ฅ์ ์
์ฆํ์ต๋๋ค.*
+
+
+
+ BLIP-2 ๊ตฌ์กฐ. ์๋ณธ ๋
ผ๋ฌธ ์์ ๋ฐ์ท.
+
+์ด ๋ชจ๋ธ์ [nielsr](https://huggingface.co/nielsr)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/salesforce/LAVIS/tree/5ee63d688ba4cebff63acee04adaef2dee9af207)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+- BLIP-2๋ ์ด๋ฏธ์ง์ ์กฐ๊ฑด์ ๋ฐ๋ผ ํ
์คํธ ํ๋กฌํํธ๋ฅผ ์
๋ ฅ๋ฐ์ ์กฐ๊ฑด๋ถ ํ
์คํธ๋ฅผ ์์ฑํฉ๋๋ค. ์ถ๋ก ์ [`generate`] ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค.
+- [`Blip2Processor`]๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ์ด๋ฏธ์ง๋ฅผ ์ค๋นํ๊ณ , ์์ธก๋ ํ ํฐ ID๋ฅผ ํ
์คํธ๋ก ๋์ฝ๋ฉํ ์ ์์ต๋๋ค.
+
+## ์๋ฃ[[resources]]
+
+BLIP-2๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ ๊ณต์ Hugging Face ๋ฐ ์ปค๋ฎค๋ํฐ(๐ ํ์) ์๋ฃ ๋ชฉ๋ก์
๋๋ค.
+
+- ์ด๋ฏธ์ง ์บก์
๋, ์๊ฐ ์ง๋ฌธ ์๋ต(VQA), ์ฑํ
๊ณผ ๊ฐ์ ๋ํํ ์์
์ ์ํ BLIP-2 ๋ฐ๋ชจ ๋
ธํธ๋ถ์ [์ฌ๊ธฐ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/BLIP-2)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+๋ฆฌ์์ค๋ฅผ ์ ์ถํ์ฌ ์ฌ๊ธฐ์ ํฌํจํ๊ณ ์ถ๋ค๋ฉด ์ธ์ ๋ ์ง ํ ๋ฆฌํ์คํธ๋ฅผ ์ด์ด์ฃผ์ธ์! ๋ฆฌ์์ค๋ ๊ธฐ์กด ๋ฆฌ์์ค๋ฅผ ๋ณต์ ํ์ง ์๊ณ ์๋ก์ด ๋ด์ฉ์ด์ด์ผ ํฉ๋๋ค.
+
+## Blip2Config[[transformers.Blip2Config]]
+
+[[autodoc]] Blip2Config
+ - from_vision_qformer_text_configs
+
+## Blip2VisionConfig[[transformers.Blip2VisionConfig]]
+
+[[autodoc]] Blip2VisionConfig
+
+## Blip2QFormerConfig[[transformers.Blip2QFormerConfig]]
+
+[[autodoc]] Blip2QFormerConfig
+
+## Blip2Processor[[transformers.Blip2Processor]]
+
+[[autodoc]] Blip2Processor
+
+## Blip2VisionModel[[transformers.Blip2VisionModel]]
+
+[[autodoc]] Blip2VisionModel
+ - forward
+
+## Blip2QFormerModel[[transformers.Blip2QFormerModel]]
+
+[[autodoc]] Blip2QFormerModel
+ - forward
+
+## Blip2Model[[transformers.Blip2Model]]
+
+[[autodoc]] Blip2Model
+ - forward
+ - get_text_features
+ - get_image_features
+ - get_qformer_features
+
+## Blip2ForConditionalGeneration[[transformers.Blip2ForConditionalGeneration]]
+
+[[autodoc]] Blip2ForConditionalGeneration
+ - forward
+ - generate
+
+## Blip2ForImageTextRetrieval[[transformers.Blip2ForImageTextRetrieval]]
+
+[[autodoc]] Blip2ForImageTextRetrieval
+ - forward
+
+## Blip2TextModelWithProjection[[transformers.Blip2TextModelWithProjection]]
+
+[[autodoc]] Blip2TextModelWithProjection
+
+## Blip2VisionModelWithProjection[[transformers.Blip2VisionModelWithProjection]]
+
+[[autodoc]] Blip2VisionModelWithProjection
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/blip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/blip.md
new file mode 100644
index 0000000000000000000000000000000000000000..27e085315b891130598a49e4de909ccc28ecc8d5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/blip.md
@@ -0,0 +1,136 @@
+
+
+# BLIP[[blip]]
+
+## ๊ฐ์[[overview]]
+
+BLIP ๋ชจ๋ธ์ Junnan Li, Dongxu Li, Caiming Xiong, Steven Hoi์ [BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation](https://arxiv.org/abs/2201.12086) ๋
ผ๋ฌธ์์ ์ ์๋์์ต๋๋ค.
+
+BLIP์ ์ฌ๋ฌ ๋ฉํฐ๋ชจ๋ฌ ์์
์ ์ํํ ์ ์๋ ๋ชจ๋ธ์
๋๋ค:
+
+- ์๊ฐ ์ง๋ฌธ ์๋ต (Visual Question Answering, VQA)
+- ์ด๋ฏธ์ง-ํ
์คํธ ๊ฒ์ (์ด๋ฏธ์ง-ํ
์คํธ ๋งค์นญ)
+- ์ด๋ฏธ์ง ์บก์
๋
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*๋น์ -์ธ์ด ์ฌ์ ํ์ต(Vision-Language Pre-training, VLP)์ ๋ค์ํ ๋น์ -์ธ์ด ์์
์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์์ผฐ์ต๋๋ค. ํ์ง๋ง, ๋๋ถ๋ถ์ ๊ธฐ์กด ์ฌ์ ํ์ต ๋ชจ๋ธ๋ค์ ์ดํด ๊ธฐ๋ฐ ์์
์ด๋ ์์ฑ ๊ธฐ๋ฐ ์์
์ค ํ๋์์๋ง ๋ฐ์ด๋ ์ฑ๋ฅ์ ๋ฐํํฉ๋๋ค. ๋ํ ์ฑ๋ฅ ํฅ์์ ์ฃผ๋ก ์น์์ ์์งํ ๋
ธ์ด์ฆ๊ฐ ๋ง์ ์ด๋ฏธ์ง-ํ
์คํธ ์์ผ๋ก ๋ฐ์ดํฐ์
์ ๊ท๋ชจ๋ฅผ ํค์ฐ๋ ๋ฐฉ์์ผ๋ก ์ด๋ฃจ์ด์ก๋๋ฐ, ์ด๋ ์ต์ ์ ์ง๋ ํ์ต ๋ฐฉ์์ด๋ผ๊ณ ๋ณด๊ธฐ ์ด๋ ต์ต๋๋ค. ๋ณธ ๋
ผ๋ฌธ์์๋ BLIP์ด๋ผ๋ ์๋ก์ด VLP ํ๋ ์์ํฌ๋ฅผ ์ ์ํฉ๋๋ค. ์ด ํ๋ ์์ํฌ๋ ๋น์ -์ธ์ด ์ดํด ๋ฐ ์์ฑ ์์
๋ชจ๋์ ์ ์ฐํ๊ฒ ์ ์ฉ๋ ์ ์์ต๋๋ค. BLIP๋ ์บก์
๋๊ฐ ํฉ์ฑ ์บก์
์ ์์ฑํ๊ณ ํํฐ๊ฐ ๋
ธ์ด์ฆ ์บก์
์ ์ ๊ฑฐํ๋ ๋ถํธ์คํธ๋ํ ๋ฐฉ๋ฒ์ ํตํด ์น ๋ฐ์ดํฐ์ ๋
ธ์ด์ฆ๋ฅผ ํจ๊ณผ์ ์ผ๋ก ํ์ฉํฉ๋๋ค. ์ฐ๋ฆฌ๋ ์ด๋ฏธ์ง-ํ
์คํธ ๊ฒ์(Recall@1์์ +2.7%), ์ด๋ฏธ์ง ์บก์
๋(CIDEr์์ +2.8%), ๊ทธ๋ฆฌ๊ณ VQA(VQA ์ ์์์ +1.6%)์ ๊ฐ์ ๋ค์ํ ๋น์ -์ธ์ด ์์
์์ ์ต์ ์ฑ๊ณผ๋ฅผ ๋ฌ์ฑํ์ต๋๋ค. ๋ํ BLIP์ ์ ๋ก์ท ๋ฐฉ์์ผ๋ก ๋น๋์ค-์ธ์ด ์์
์ ์ง์ ์ ์ด๋ ๋๋ ๊ฐ๋ ฅํ ์ผ๋ฐํ ๋ฅ๋ ฅ์ ๋ณด์ฌ์ค๋๋ค. ์ด ๋
ผ๋ฌธ์ ์ฝ๋, ๋ชจ๋ธ, ๋ฐ์ดํฐ์
์ ๊ณต๊ฐ๋์์ต๋๋ค.*
+
+
+
+์ด ๋ชจ๋ธ์ [ybelkada](https://huggingface.co/ybelkada)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค.
+์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/salesforce/BLIP)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+## ์๋ฃ[[resources]]
+
+- [Jupyter notebook](https://github.com/huggingface/notebooks/blob/main/examples/image_captioning_blip.ipynb): ์ฌ์ฉ์ ์ ์ ๋ฐ์ดํฐ์
์์ BLIP๋ฅผ ์ด๋ฏธ์ง ์บก์
๋์ผ๋ก ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ
+
+## BlipConfig[[transformers.BlipConfig]]
+
+[[autodoc]] BlipConfig
+ - from_text_vision_configs
+
+## BlipTextConfig[[transformers.BlipTextConfig]]
+
+[[autodoc]] BlipTextConfig
+
+## BlipVisionConfig[[transformers.BlipVisionConfig]]
+
+[[autodoc]] BlipVisionConfig
+
+## BlipProcessor[[transformers.BlipProcessor]]
+
+[[autodoc]] BlipProcessor
+
+## BlipImageProcessor[[transformers.BlipImageProcessor]]
+
+[[autodoc]] BlipImageProcessor
+ - preprocess
+
+
+
+
+## BlipModel[[transformers.BlipModel]]
+
+`BlipModel`์ ํฅํ ๋ฒ์ ์์ ๋ ์ด์ ์ง์๋์ง ์์ ์์ ์
๋๋ค. ๋ชฉ์ ์ ๋ฐ๋ผ `BlipForConditionalGeneration`, `BlipForImageTextRetrieval` ๋๋ `BlipForQuestionAnswering`์ ์ฌ์ฉํ์ญ์์ค.
+
+[[autodoc]] BlipModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## BlipTextModel[[transformers.BlipTextModel]]
+
+[[autodoc]] BlipTextModel
+ - forward
+
+## BlipVisionModel[[transformers.BlipVisionModel]]
+
+[[autodoc]] BlipVisionModel
+ - forward
+
+## BlipForConditionalGeneration[[transformers.BlipForConditionalGeneration]]
+
+[[autodoc]] BlipForConditionalGeneration
+ - forward
+
+## BlipForImageTextRetrieval[[transformers.BlipForImageTextRetrieval]]
+
+[[autodoc]] BlipForImageTextRetrieval
+ - forward
+
+## BlipForQuestionAnswering[[transformers.BlipForQuestionAnswering]]
+
+[[autodoc]] BlipForQuestionAnswering
+ - forward
+
+
+
+
+## TFBlipModel[[transformers.TFBlipModel]]
+
+[[autodoc]] TFBlipModel
+ - call
+ - get_text_features
+ - get_image_features
+
+## TFBlipTextModel[[transformers.TFBlipTextModel]]
+
+[[autodoc]] TFBlipTextModel
+ - call
+
+## TFBlipVisionModel[[transformers.TFBlipVisionModel]]
+
+[[autodoc]] TFBlipVisionModel
+ - call
+
+## TFBlipForConditionalGeneration[[transformers.TFBlipForConditionalGeneration]]
+
+[[autodoc]] TFBlipForConditionalGeneration
+ - call
+
+## TFBlipForImageTextRetrieval[[transformers.TFBlipForImageTextRetrieval]]
+
+[[autodoc]] TFBlipForImageTextRetrieval
+ - call
+
+## TFBlipForQuestionAnswering[[transformers.TFBlipForQuestionAnswering]]
+
+[[autodoc]] TFBlipForQuestionAnswering
+ - call
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/chameleon.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/chameleon.md
new file mode 100644
index 0000000000000000000000000000000000000000..14a18a09765bd4cd737dcf40f0a8ffa82f173e3f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/chameleon.md
@@ -0,0 +1,186 @@
+
+
+# Chameleon [[chameleon]]
+
+## ๊ฐ์ [[overview]]
+
+Chameleon ๋ชจ๋ธ์ META AI Chameleon ํ์ ๋
ผ๋ฌธ [Chameleon: Mixed-Modal Early-Fusion Foundation Models](https://arxiv.org/abs/2405.09818v1)์์ ์ ์๋์์ต๋๋ค. Chameleon์ ๋ฒกํฐ ์์ํ๋ฅผ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง๋ฅผ ํ ํฐํํจ์ผ๋ก์จ ๋ฉํฐ๋ชจ๋ฌ ์ถ๋ ฅ์ ์์ฑํ ์ ์๋ ๋น์ -์ธ์ด ๋ชจ๋ธ์
๋๋ค. ์ด ๋ชจ๋ธ์ ๊ต์ฐจ๋ ํ์์ ํฌํจํ ์ด๋ฏธ์ง์ ํ
์คํธ๋ฅผ ์
๋ ฅ์ผ๋ก ๋ฐ์ผ๋ฉฐ, ํ
์คํธ ์๋ต์ ์์ฑํฉ๋๋ค. ์ด๋ฏธ์ง ์์ฑ ๋ชจ๋์ ์์ง ๊ณต๊ฐ๋์ง ์์์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ฐ๋ฆฌ๋ ์ด๋ฏธ์ง์ ํ
์คํธ๋ฅผ ์์์ ์์๋ก ์ดํดํ๊ณ ์์ฑํ ์ ์๋ early-fusion ํ ํฐ ๊ธฐ๋ฐ์ ํผํฉ ๋ชจ๋ฌ(mixed-modal) ๋ชจ๋ธ์ ์ผ์ข
์ธ Chameleon์ ์๊ฐํฉ๋๋ค. ์ฐ๋ฆฌ๋ ์ด๊ธฐ๋ถํฐ ์์ ์ ์ธ ํ๋ จ ์ ๊ทผ๋ฒ, ์ ๋ ฌ ๋ฐฉ๋ฒ, ๊ทธ๋ฆฌ๊ณ early-fusion, ํ ํฐ ๊ธฐ๋ฐ, ํผํฉ ๋ชจ๋ฌ ์ค์ ์ ๋ง์ถ ์ํคํ
์ฒ ๋งค๊ฐ๋ณ์๋ฅผ ์ ์ํฉ๋๋ค. ์ด ๋ชจ๋ธ๋ค์ ์๊ฐ์ ์ง๋ฌธ ์๋ต, ์ด๋ฏธ์ง ์บก์
์์ฑ, ํ
์คํธ ์์ฑ, ์ด๋ฏธ์ง ์์ฑ, ์ฅ๋ฌธ ํผํฉ ๋ชจ๋ฌ ์์ฑ ๋ฑ ํฌ๊ด์ ์ธ ์์
๋ฒ์์์ ํ๊ฐ๋์์ต๋๋ค. Chameleon์ ๋จ์ผ ๋ชจ๋ธ์์ ์ด๋ฏธ์ง ์บก์
์์ฑ ์์
์์์ ์ต์ฒจ๋จ ์ฑ๋ฅ์ ํฌํจํ ๊ด๋ฒ์ํ๊ณ ์ผ๋ฐ์ ์ผ๋ก ์ ์ฉ ๊ฐ๋ฅํ ๋ฅ๋ ฅ์ ๋ณด์ฌ์ฃผ๋ฉฐ, ํ
์คํธ ์ ์ฉ ์์
์์ Llama-2๋ฅผ ๋ฅ๊ฐํ๋ฉด์ Mixtral 8x7B์ Gemini-Pro์ ๊ฐ์ ๋ชจ๋ธ๋ค ์ฌ์ด์์๋ ๊ฒฝ์๋ ฅ์ ๊ฐ์ถ๊ณ ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ์๋นํ ์ฑ๋ฅ์ ์ด๋ฏธ์ง ์์ฑ๋ ์ํํฉ๋๋ค. ๋ํ ํ๋กฌํํธ๋ ์ถ๋ ฅ์ ์ด๋ฏธ์ง์ ํ
์คํธ์ ํผํฉ ์ํ์ค๊ฐ ํฌํจ๋ ์๋ก์ด ์ฅ๋ฌธ ํผํฉ ๋ชจ๋ฌ ์์ฑ ํ๊ฐ์์, ์ธ๊ฐ์ ํ๋จ์ ๋ฐ๋ฅด๋ฉด Gemini Pro์ GPT-4V๋ฅผ ํฌํจํ ํจ์ฌ ๋ ํฐ ๋ชจ๋ธ์ ์ฑ๋ฅ๊ณผ ๋๋ฑํ๊ฑฐ๋ ์ด๋ฅผ ๋ฅ๊ฐํฉ๋๋ค. Chameleon์ ์์ ํ ๋ฉํฐ๋ชจ๋ฌ ๋ฌธ์์ ํตํฉ ๋ชจ๋ธ๋ง์์ ์ค์ํ ๋ฐ์ ์ ๋ณด์ฌ์ค๋๋ค.*
+
+
+
+Chameleon์ ์ด๋ฏธ์ง๋ฅผ ์ด์ฐ์ ์ธ ํ ํฐ์ผ๋ก ๋ณํํ๊ธฐ ์ํด ๋ฒกํฐ ์์ํ ๋ชจ๋์ ํตํฉํฉ๋๋ค. ์ด๋ ์๊ธฐํ๊ท transformer๋ฅผ ์ฌ์ฉํ ์ด๋ฏธ์ง ์์ฑ์ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. ์๋ณธ ๋
ผ๋ฌธ ์์ ๊ฐ์ ธ์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ [joaogante](https://huggingface.co/joaogante)์ [RaushanTurganbay](https://huggingface.co/RaushanTurganbay)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/facebookresearch/chameleon)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ [[usage-tips]]
+
+- ๋ ์ ํํ ๊ฒฐ๊ณผ๋ฅผ ์ํด, ๋ฐฐ์น ์์ฑ ์ `padding_side="left"`๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค. ์์ฑํ๊ธฐ ์ ์ `processor.tokenizer.padding_side = "left"`๋ก ์ค์ ํ์ญ์์ค.
+
+- Chameleon์ ์์ ์ฑ ์ ๋ ฌ์ ์ํด ํ๋๋์์์ ์ ์ํ์ญ์์ค. ๋ชจ๋ธ์ด ์๋ต์ ๊ฑฐ๋ถํ๋ ๊ฒฝ์ฐ, ์ด๋ฆฐ ์ง๋ฌธ๋ณด๋ค๋ ๋ ๊ตฌ์ฒด์ ์ผ๋ก ์ง๋ฌธ์ ํด๋ณด์ธ์.
+
+- Chameleon์ ์ฑํ
ํ์์ผ๋ก ์์ฑํ๋ฏ๋ก, ์์ฑ๋ ํ
์คํธ๋ ํญ์ "assistant's turn"์ผ๋ก ํ์๋ฉ๋๋ค. ํ๋ก์ธ์๋ฅผ ํธ์ถํ ๋ `return_for_text_completion=True`๋ฅผ ์ ๋ฌํ์ฌ ํ
์คํธ ์์ฑ ์์ฑ์ ํ์ฑํํ ์ ์์ต๋๋ค.
+
+> [!NOTE]
+> Transformers์์์ Chameleon ๊ตฌํ์ ์ด๋ฏธ์ง ์๋ฒ ๋ฉ์ ๋ณํฉํ ์์น๋ฅผ ๋ํ๋ด๊ธฐ ์ํด ํน๋ณํ ์ด๋ฏธ์ง ํ ํฐ์ ์ฌ์ฉํฉ๋๋ค. ํน๋ณํ ์ด๋ฏธ์ง ํ ํฐ์ ์ํด ์๋ก์ด ํ ํฐ์ ์ถ๊ฐํ์ง ์๊ณ ์์ฝ๋ ํ ํฐ ์ค ํ๋์ธ ``๋ฅผ ์ฌ์ฉํ์ต๋๋ค. ์ฌ๋ฐ๋ฅธ ์์ฑ์ ์ํด ํ๋กฌํํธ์์ ์ด๋ฏธ์ง๊ฐ ์๋ฒ ๋ฉ๋ ์์น์ ``๋ฅผ ์ถ๊ฐํด์ผ ํฉ๋๋ค.
+
+## ์ฌ์ฉ ์์ [[usage-example]]
+
+### ๋จ์ผ ์ด๋ฏธ์ง ์ถ๋ก [[single-image-inference]]
+
+Chameleon์ ๊ฒ์ดํฐ๋(gated) ๋ชจ๋ธ์ด๋ฏ๋ก Hugging Face Hub์ ๋ํ ์ก์ธ์ค ๊ถํ์ด ์๊ณ ํ ํฐ์ผ๋ก ๋ก๊ทธ์ธํ๋์ง ํ์ธํ์ธ์. ๋ค์์ ๋ชจ๋ธ์ ๋ก๋ํ๊ณ ๋ฐ์ ๋ฐ๋(`torch.bfloat16`)๋ก ์ถ๋ก ํ๋ ๋ฐฉ๋ฒ์
๋๋ค:
+
+```python
+from transformers import ChameleonProcessor, ChameleonForConditionalGeneration
+import torch
+from PIL import Image
+import requests
+
+processor = ChameleonProcessor.from_pretrained("facebook/chameleon-7b")
+model = ChameleonForConditionalGeneration.from_pretrained("facebook/chameleon-7b", torch_dtype=torch.bfloat16, device_map="cuda")
+
+# ์ด๋ฏธ์ง์ ํ
์คํธ ํ๋กฌํํธ ์ค๋น
+url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
+image = Image.open(requests.get(url, stream=True).raw)
+prompt = "์ด ์ด๋ฏธ์ง์์ ๋ฌด์์ ๋ณด๋์?"
+
+inputs = processor(images=image, text=prompt, return_tensors="pt").to(model.device, dtype=torch.bfloat16)
+
+# ํ๋กฌํํธ๋ฅผ ์๊ธฐํ๊ท์ ์ผ๋ก ์์ฑ
+output = model.generate(**inputs, max_new_tokens=50)
+print(processor.decode(output[0], skip_special_tokens=True))
+```
+
+### ๋ค์ค ์ด๋ฏธ์ง ์ถ๋ก [[multi-image-inference]]
+
+Chameleon์ ์ฌ๋ฌ ์ด๋ฏธ์ง๋ฅผ ์
๋ ฅ์ผ๋ก ๋ฐ์๋ค์ด๋ฉฐ, ์ด๋ฏธ์ง๋ค์ ๋์ผํ ํ๋กฌํํธ์ ์ํ๊ฑฐ๋ ๋ค๋ฅธ ํ๋กฌํํธ์ ์ํ ์ ์์ต๋๋ค(๋ฐฐ์น ์ถ๋ก ์์). ๋ค์์ ๊ทธ ๋ฐฉ๋ฒ์
๋๋ค:
+
+```python
+from transformers import ChameleonProcessor, ChameleonForConditionalGeneration
+import torch
+from PIL import Image
+import requests
+
+processor = ChameleonProcessor.from_pretrained("facebook/chameleon-7b")
+
+model = ChameleonForConditionalGeneration.from_pretrained("facebook/chameleon-7b", torch_dtype=torch.bfloat16, device_map="cuda")
+
+# ์ธ ๊ฐ์ง ๋ค๋ฅธ ์ด๋ฏธ์ง ๊ฐ์ ธ์ค๊ธฐ
+url = "https://www.ilankelman.org/stopsigns/australia.jpg"
+image_stop = Image.open(requests.get(url, stream=True).raw)
+
+url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+image_cats = Image.open(requests.get(url, stream=True).raw)
+
+url = "https://huggingface.co/microsoft/kosmos-2-patch14-224/resolve/main/snowman.jpg"
+image_snowman = Image.open(requests.get(url, stream=True).raw)
+
+# ๋ฐฐ์น๋ ํ๋กฌํํธ ์ค๋น: ์ฒซ ๋ฒ์งธ๋ ๋ค์ค ์ด๋ฏธ์ง ํ๋กฌํํธ์ด๊ณ ๋ ๋ฒ์งธ๋ ๋จ์ผ ์ด๋ฏธ์ง ํ๋กฌํํธ์
๋๋ค
+prompts = [
+ "์ด ์ด๋ฏธ์ง๋ค์ ๋ฌด์์ด ๊ณตํต์ ์ธ๊ฐ์?",
+ "์ด ์ด๋ฏธ์ง์ ๋ฌด์์ด ๋ํ๋ ์๋์?"
+]
+
+# ์ด๋ฏธ์ง๋ค์ ํ
์คํธ ํ๋กฌํํธ์์ ์ฌ์ฉ๋์ด์ผ ํ๋ ์์๋๋ก ์
๋ ฅํ ์ ์์ต๋๋ค
+# ๊ฐ "" ํ ํฐ์ ํ๋์ ์ด๋ฏธ์ง๋ฅผ ์ฌ์ฉํ๋ฉฐ, ๋ค์ "" ํ ํฐ์ ๋ค์ ์ด๋ฏธ์ง๋ฅผ ์ฌ์ฉํฉ๋๋ค
+inputs = processor(images=[image_stop, image_cats, image_snowman], text=prompts, padding=True, return_tensors="pt").to(device="cuda", dtype=torch.bfloat16)
+
+# ์์ฑ
+generate_ids = model.generate(**inputs, max_new_tokens=50)
+processor.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)
+```
+
+## ๋ชจ๋ธ ์ต์ ํ [[model-optimization]]
+
+### Bitsandbytes๋ฅผ ์ฌ์ฉํ ์์ํ [[quantization-using-bitsandbytes]]
+
+๋ชจ๋ธ์ 8๋นํธ ๋๋ 4๋นํธ๋ก ๋ก๋ํ ์ ์์ผ๋ฉฐ, ์ด๋ ์๋ณธ ๋ชจ๋ธ์ ์ฑ๋ฅ์ ์ ์งํ๋ฉด์ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ ์ฌํญ์ ํฌ๊ฒ ์ค์ฌ์ค๋๋ค. ๋จผ์ bitsandbytes๋ฅผ ์ค์นํ๊ณ (`pip install bitsandbytes`), ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์ง์ํ๋ GPU/๊ฐ์๊ธฐ๋ฅผ ์ฌ์ฉ ์ค์ธ์ง ํ์ธํ์ญ์์ค.
+
+
+
+bitsandbytes๋ CUDA ์ด์ธ์ ์ฌ๋ฌ ๋ฐฑ์๋๋ฅผ ์ง์ํ๋๋ก ๋ฆฌํฉํฐ๋ง๋๊ณ ์์ต๋๋ค. ํ์ฌ ROCm(AMD GPU) ๋ฐ Intel CPU ๊ตฌํ์ด ์ฑ์ ๋จ๊ณ์ด๋ฉฐ, Intel XPU๋ ์งํ ์ค์ด๊ณ Apple Silicon ์ง์์ Q4/Q1์ ์์๋ฉ๋๋ค. ์ค์น ์ง์นจ ๋ฐ ์ต์ ๋ฐฑ์๋ ์
๋ฐ์ดํธ๋ [์ด ๋งํฌ](https://huggingface.co/docs/bitsandbytes/main/en/installation#multi-backend)๋ฅผ ๋ฐฉ๋ฌธํ์ธ์.
+
+์ ์ฒด ๊ณต๊ฐ ์ ์ ๋ฒ๊ทธ๋ฅผ ์๋ณํ๋ ๋ฐ ๋์์ด ๋๋ ํผ๋๋ฐฑ์ ํ์ํฉ๋๋ค! ์์ธํ ๋ด์ฉ๊ณผ ํผ๋๋ฐฑ์ [์ด ๋ฌธ์](https://huggingface.co/docs/bitsandbytes/main/en/non_cuda_backends)๋ฅผ ํ์ธํ์ธ์.
+
+
+
+์์ ์ฝ๋ ์ค๋ํซ์ ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝํ๋ฉด ๋ฉ๋๋ค:
+
+```python
+from transformers import ChameleonForConditionalGeneration, BitsAndBytesConfig
+
+# ๋ชจ๋ธ ์์ํ ๋ฐฉ์ ์ง์
+quantization_config = BitsAndBytesConfig(
+ load_in_4bit=True,
+ bnb_4bit_quant_type="nf4",
+ bnb_4bit_compute_dtype=torch.bfloat16,
+)
+
+model = ChameleonForConditionalGeneration.from_pretrained("facebook/chameleon-7b", quantization_config=quantization_config, device_map="cuda")
+```
+
+### Flash-Attention 2์ SDPA๋ฅผ ์ฌ์ฉํ์ฌ ์์ฑ ์๋ ํฅ์ [[use-flash-attention-2-and-sdpa-to-further-speed-up-generation]]
+
+์ด ๋ชจ๋ธ์ ์ต์ ํ๋ฅผ ์ํด Flash-Attention 2์ PyTorch์ [`torch.nn.functional.scaled_dot_product_attention`](https://pytorch.org/docs/master/generated/torch.nn.functional.scaled_dot_product_attention.html)๋ฅผ ๋ชจ๋ ์ง์ํฉ๋๋ค. SDPA๋ ๋ชจ๋ธ์ ๋ก๋ํ ๋ ๊ธฐ๋ณธ ์ต์
์
๋๋ค. Flash Attention 2๋ก ์ ํํ๋ ค๋ฉด ๋จผ์ flash-attn์ ์ค์นํด์ผ ํฉ๋๋ค. ํด๋น ํจํค์ง ์ค์น์ ๋ํด์๋ [์๋ณธ ๋ฆฌํฌ์งํ ๋ฆฌ](https://github.com/Dao-AILab/flash-attention)๋ฅผ ์ฐธ๊ณ ํ์ญ์์ค. ์์ ์ฝ๋ ์ค๋ํซ์ ๋ค์๊ณผ ๊ฐ์ด ๋ณ๊ฒฝํ๋ฉด ๋ฉ๋๋ค:
+
+```python
+from transformers import ChameleonForConditionalGeneration
+
+model_id = "facebook/chameleon-7b"
+model = ChameleonForConditionalGeneration.from_pretrained(
+ model_id,
+ torch_dtype=torch.bfloat16,
+ low_cpu_mem_usage=True,
+ attn_implementation="flash_attention_2"
+).to(0)
+```
+
+## ChameleonConfig [[transformers.ChameleonConfig]]
+
+[[autodoc]] ChameleonConfig
+
+## ChameleonVQVAEConfig [[transformers.ChameleonVQVAEConfig]]
+
+[[autodoc]] ChameleonVQVAEConfig
+
+## ChameleonProcessor [[transformers.ChameleonProcessor]]
+
+[[autodoc]] ChameleonProcessor
+
+## ChameleonImageProcessor [[transformers.ChameleonImageProcessor]]
+
+[[autodoc]] ChameleonImageProcessor
+ - preprocess
+
+## ChameleonVQVAE [[transformers.ChameleonVQVAE]]
+
+[[autodoc]] ChameleonVQVAE
+ - forward
+
+## ChameleonModel [[transformers.ChameleonModel]]
+
+[[autodoc]] ChameleonModel
+ - forward
+
+## ChameleonForConditionalGeneration [[transformers.ChameleonForConditionalGeneration]]
+
+[[autodoc]] ChameleonForConditionalGeneration
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/clip.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/clip.md
new file mode 100644
index 0000000000000000000000000000000000000000..5c19a31e10e658a694464cb079b513f5fccf62f6
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/clip.md
@@ -0,0 +1,318 @@
+
+
+# CLIP[[clip]]
+
+## ๊ฐ์[[overview]]
+
+CLIP ๋ชจ๋ธ์ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh,
+Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, Ilya Sutskever๊ฐ ์ ์ํ [์์ฐ์ด ์ง๋(supervision)๋ฅผ ํตํ ์ ์ด ๊ฐ๋ฅํ ์๊ฐ ๋ชจ๋ธ ํ์ต](https://arxiv.org/abs/2103.00020)๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ๋์์ต๋๋ค. CLIP(Contrastive Language-Image Pre-Training)์ ๋ค์ํ ์ด๋ฏธ์ง์ ํ
์คํธ ์์ผ๋ก ํ๋ จ๋ ์ ๊ฒฝ๋ง ์
๋๋ค. GPT-2์ 3์ ์ ๋ก์ท ๋ฅ๋ ฅ๊ณผ ์ ์ฌํ๊ฒ, ํด๋น ์์
์ ์ง์ ์ ์ผ๋ก ์ต์ ํํ์ง ์๊ณ ๋ ์ฃผ์ด์ง ์ด๋ฏธ์ง์ ๋ํด ๊ฐ์ฅ ๊ด๋ จ์ฑ ์๋ ํ
์คํธ ์ค๋ํซ์ ์์ธกํ๋๋ก ์์ฐ์ด๋ก ์ง์ํ ์ ์์ต๋๋ค.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค.
+
+*์ต์ ์ปดํจํฐ ๋น์ ์์คํ
์ ๋ฏธ๋ฆฌ ์ ํด์ง ๊ณ ์ ๋ ๊ฐ์ฒด ์นดํ
๊ณ ๋ฆฌ ์งํฉ์ ์์ธกํ๋๋ก ํ๋ จ๋ฉ๋๋ค. ์ด๋ฌํ ์ ํ๋ ํํ์ ์ง๋๋ ๋ค๋ฅธ ์๊ฐ์ ๊ฐ๋
์ ์ง์ ํ๊ธฐ ์ํด ์ถ๊ฐ์ ์ธ ๋ผ๋ฒจ๋ง๋ ๋ฐ์ดํฐ๊ฐ ํ์ํ๋ฏ๋ก ๊ทธ ์ผ๋ฐ์ฑ๊ณผ ์ฌ์ฉ์ฑ์ ์ ํํฉ๋๋ค. ์ด๋ฏธ์ง ์์ ํ
์คํธ์์ ์ง์ ํ์ตํ๋ ๊ฒ์ ํจ์ฌ ๋ ๊ด๋ฒ์ํ ์ง๋ ์์ค๋ฅผ ํ์ฉํ๋ ์์ฃผ ์ข์ ๋์์
๋๋ค. ์ด๋ฏธ์ง์ ์บก์
์ ๋ง์ถ๋ ๊ฐ๋จํ ์ฌ์ ํ์ต ์์
์ด, ์ธํฐ๋ท์์ ์์งํ 4์ต ์์ ์ด๋ฏธ์ง-ํ
์คํธ ๋ฐ์ดํฐ์
์์ SOTA ์์ค์ ์ด๋ฏธ์ง ํํ์ ์ฒ์๋ถํฐ ํจ์จ์ ์ด๊ณ ํ์ฅ ๊ฐ๋ฅํ๊ฒ ํ์ตํ๋ ๋ฐฉ๋ฒ์์ ํ์ธํ ์ ์์ต๋๋ค. ์ฌ์ ํ๋ จ ํ, ์์ฐ์ด๋ ํ์ต๋ ์๊ฐ์ ๊ฐ๋
์ ์ฐธ์กฐํ๊ฑฐ๋ ์๋ก์ด ๊ฐ๋
์ ์ค๋ช
ํ๋ ๋ฐ ์ฌ์ฉ๋์ด ๋ชจ๋ธ์ ํ์ ์์
์ผ๋ก์ ์ ๋ก์ท ์ ์ด๋ฅผ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. ํด๋น ๋
ผ๋ฌธ์์๋ OCR, ๋น๋์ค ๋ด ํ๋ ์ธ์, ์ง๋ฆฌ์ ์์น ํ์
, ๊ทธ๋ฆฌ๊ณ ๋ง์ ์ข
๋ฅ์ ์ธ๋ฐํ ๊ฐ์ฒด ๋ถ๋ฅ ๋ฑ 30๊ฐ ์ด์์ ๋ค์ํ ๊ธฐ์กด ์ปดํจํฐ ๋น์ ๋ฐ์ดํฐ์
์ ๋ํ ๋ฒค์น๋งํน์ ํตํด ์ด ์ ๊ทผ ๋ฐฉ์์ ์ฑ๋ฅ์ ์ฐ๊ตฌํฉ๋๋ค. ์ด ๋ชจ๋ธ์ ๋๋ถ๋ถ์ ์์
์ ๋ํด ์๋ฏธ ์๊ฒ ์ ์ด๋๋ฉฐ, ์ข
์ข
๋ฐ์ดํฐ์
๋ณ ํ๋ จ ์์ด๋ ์์ ์ง๋ ํ์ต ๊ธฐ์ค์ ๊ณผ ๊ฒฝ์๋ ฅ ์๋ ์ฑ๋ฅ์ ๋ณด์
๋๋ค. ์๋ฅผ ๋ค์ด, ImageNet์์ ์๋ ResNet-50์ ์ ํ๋๋ฅผ ์ ๋ก์ท์ผ๋ก ์ผ์น์ํค๋๋ฐ, ์ด๋ ResNet-50์ด ํ๋ จ๋ 128๋ง ๊ฐ์ ํ๋ จ ์์ ๋ฅผ ์ ํ ์ฌ์ฉํ ํ์๊ฐ ์์์ต๋๋ค. ์ฝ๋ ๋ฐ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ ๊ฐ์ค์น๋ ์ด https URL์์ ๊ณต๊ฐํฉ๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [valhalla](https://huggingface.co/valhalla)์ ์ํด ๊ธฐ์ฌ๋์์ต๋๋ค.
+์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/openai/CLIP)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ๊ณผ ์์[[usage-tips-and-example]]
+
+CLIP์ ๋ฉํฐ๋ชจ๋ฌ ๋น์ ๋ฐ ์ธ์ด ๋ชจ๋ธ์
๋๋ค. ์ด๋ฏธ์ง-ํ
์คํธ ์ ์ฌ๋ ๊ณ์ฐ๊ณผ ์ ๋ก์ท ์ด๋ฏธ์ง ๋ถ๋ฅ์ ์ฌ์ฉ๋ ์ ์์ต๋๋ค. CLIP์ ViT์ ์ ์ฌํ ํธ๋์คํฌ๋จธ๋ฅผ ์ฌ์ฉํ์ฌ ์๊ฐ์ ํน์ง์ ์ถ์ถํ๊ณ , ์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ์ ์ฌ์ฉํ์ฌ ํ
์คํธ ํน์ง์ ์ถ์ถํฉ๋๋ค. ๊ทธ ํ ํ
์คํธ์ ์๊ฐ์ ํน์ง ๋ชจ๋ ๋์ผํ ์ฐจ์์ ์ ์ฌ(latent) ๊ณต๊ฐ์ผ๋ก ํฌ์๋ฉ๋๋ค. ํฌ์๋ ์ด๋ฏธ์ง์ ํ
์คํธ ํน์ง ์ฌ์ด์ ๋ด์ ์ด ์ ์ฌ๋ ์ ์๋ก ์ฌ์ฉ๋ฉ๋๋ค.
+
+ํธ๋์คํฌ๋จธ ์ธ์ฝ๋์ ์ด๋ฏธ์ง๋ฅผ ์
๋ ฅํ๊ธฐ ์ํด, ๊ฐ ์ด๋ฏธ์ง๋ ๊ณ ์ ํฌ๊ธฐ์ ๊ฒน์น์ง ์๋ ํจ์น๋ค์ ์ํ์ค๋ก ๋ถํ ๋๊ณ , ์ดํ ์ ํ ์๋ฒ ๋ฉ๋ฉ๋๋ค. [CLS]ํ ํฐ์ด ์ ์ฒด ์ด๋ฏธ์ง์ ํํ์ผ๋ก ์ถ๊ฐ๋ฉ๋๋ค. ์ ์๋ค์ ๋ํ ์ ๋ ์์น ์๋ฒ ๋ฉ์ ์ถ๊ฐํ๊ณ , ๊ฒฐ๊ณผ๋ก ๋์จ ๋ฒกํฐ ์ํ์ค๋ฅผ ํ์ค ํธ๋์คํฌ๋จธ ์ธํ ๋์ ์
๋ ฅํฉ๋๋ค. [`CLIPImageProcessor`]๋ ๋ชจ๋ธ์ ์ํด ์ด๋ฏธ์ง๋ฅผ ๋ฆฌ์ฌ์ด์ฆ(๋๋ ์ฌ์ค์บ์ผ๋ง)ํ๊ณ ์ ๊ทํํ๋๋ฐ ์ฌ์ฉ๋ ์ ์์ต๋๋ค.
+
+[`CLIPTokenizer`]๋ ํ
์คํธ๋ฅผ ์ธ์ฝ๋ฉํ๋๋ฐ ์ฌ์ฉ๋ฉ๋๋ค. [`CLIPProcessor`]๋ [`CLIPImageProcessor`]์ [`CLIPTokenizer`]๋ฅผ ํ๋์ ์ธ์คํด์ค๋ก ๊ฐ์ธ์ ํ
์คํธ๋ฅผ ์ธ์ฝ๋ฉํ๊ณ ์ด๋ฏธ์ง๋ฅผ ์ค๋นํ๋๋ฐ ๋ชจ๋ ์ฌ์ฉ๋ฉ๋๋ค.
+
+๋ค์ ์์๋ [`CLIPProcessor`]์ [`CLIPModel`]์ ์ฌ์ฉํ์ฌ ์ด๋ฏธ์ง-ํ
์คํธ ์ ์ฌ๋ ์ ์๋ฅผ ์ป๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค.
+
+
+```python
+>>> from PIL import Image
+>>> import requests
+
+>>> from transformers import CLIPProcessor, CLIPModel
+
+>>> model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
+>>> processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
+
+>>> outputs = model(**inputs)
+>>> logits_per_image = outputs.logits_per_image # ์ด๋ฏธ์ง-ํ
์คํธ ์ ์ฌ์ฑ ์ ์
+>>> probs = logits_per_image.softmax(dim=1) # ํ๋ฅ ์ ๋ ์ด๋ธ๋ง ํ๊ธฐ์ํด์ ์ํํธ๋งฅ์ค๋ฅผ ์ทจํฉ๋๋ค.
+```
+
+
+### CLIP๊ณผ ํ๋์ ์ดํ
์
2 ๊ฒฐํฉ[[combining-clip-and-flash-attention-2]]
+
+๋จผ์ ์ต์ ๋ฒ์ ์ ํ๋์ ์ดํ
์
2๋ฅผ ์ค์นํฉ๋๋ค.
+
+```bash
+pip install -U flash-attn --no-build-isolation
+```
+
+ํ๋์ ์ดํ
์
2์ ํธํ๋๋ ํ๋์จ์ด๋ฅผ ๊ฐ์ง๊ณ ์๋์ง ํ์ธํ์ธ์. ์ด์ ๋ํ ์์ธํ ๋ด์ฉ์ flash-attn ๋ฆฌํฌ์งํ ๋ฆฌ์ ๊ณต์๋ฌธ์์์ ํ์ธํ ์ ์์ต๋๋ค. ๋ํ ๋ชจ๋ธ์ ๋ฐ์ ๋ฐ๋(`torch.float16`)๋ก ๋ก๋ํ๋ ๊ฒ์ ์์ง ๋ง์ธ์.
+
+
+
+์์ ๋ฐฐ์น ํฌ๊ธฐ๋ฅผ ์ฌ์ฉํ ๋, ํ๋์ ์ดํ
์
์ ์ฌ์ฉํ๋ฉด ๋ชจ๋ธ์ด ๋๋ ค์ง๋ ๊ฒ์ ๋๋ ์ ์์ต๋๋ค.์๋์ [ํ๋์ ์ดํ
์
๊ณผ SDPA๋ฅผ ์ฌ์ฉํ ์์ ์๋ ํฅ์](#Expected-speedups-with-Flash-Attention-and-SDPA) ์น์
์ ์ฐธ์กฐํ์ฌ ์ ์ ํ ์ดํ
์
๊ตฌํ์ ์ ํํ์ธ์.
+
+
+
+ํ๋์ ์ดํ
์
2๋ฅผ ์ฌ์ฉํด์ ๋ชจ๋ธ์ ๋ก๋ํ๊ณ ๊ตฌ๋ํ๊ธฐ ์ํด์ ๋ค์ ์ค๋ํซ์ ์ฐธ๊ณ ํ์ธ์:
+
+```python
+>>> import torch
+>>> import requests
+>>> from PIL import Image
+
+>>> from transformers import CLIPProcessor, CLIPModel
+
+>>> device = "cuda"
+>>> torch_dtype = torch.float16
+
+>>> model = CLIPModel.from_pretrained(
+... "openai/clip-vit-base-patch32",
+... attn_implementation="flash_attention_2",
+... device_map=device,
+... torch_dtype=torch_dtype,
+... )
+>>> processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
+
+>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
+>>> image = Image.open(requests.get(url, stream=True).raw)
+
+>>> inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
+>>> inputs.to(device)
+
+>>> with torch.no_grad():
+... with torch.autocast(device):
+... outputs = model(**inputs)
+
+>>> logits_per_image = outputs.logits_per_image # ์ด๋ฏธ์ง-ํ
์คํธ ์ ์ฌ์ฑ ์ ์
+>>> probs = logits_per_image.softmax(dim=1) # ํ๋ฅ ์ ๋ ์ด๋ธ๋ง ํ๊ธฐ์ํด์ ์ํํธ๋งฅ์ค๋ฅผ ์ทจํฉ๋๋ค.
+>>> print(probs)
+tensor([[0.9946, 0.0052]], device='cuda:0', dtype=torch.float16)
+```
+
+
+### ์ค์ผ์ผ๋ ๋ด์ ์ดํ
์
(Scaled dot-product Attention(SDPA)) ์ฌ์ฉํ๊ธฐ[[using-scaled-dot-product-attention-sdpa]]
+
+ํ์ดํ ์น๋ `torch.nn.functional`์ ์ผ๋ถ๋ก ๋ค์ดํฐ๋ธ ์ค์ผ์ผ๋ ๋ด์ ์ดํ
์
(SPDA) ์ฐ์ฐ์๋ฅผ ํฌํจํ๊ณ ์์ต๋๋ค. ์ด ํจ์๋ ์
๋ ฅ๊ณผ ์ฌ์ฉ ์ค์ธ ํ๋์จ์ด์ ๋ฐ๋ผ ์ ์ฉ๋ ์ ์๋ ์ฌ๋ฌ ๊ตฌํ์ ํฌํจํฉ๋๋ค. ์์ธํ ์ ๋ณด๋ [๊ณต์๋ฌธ์](https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html)๋ [GPU ์ถ๋ก ](https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention) ํ์ด์ง๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+`torch>=2.1.1`์์๋ ๊ตฌํ์ด ๊ฐ๋ฅํ ๋ SDPA๊ฐ ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ์ฉ๋์ง๋ง, `from_pretrained()` ํจ์์์ `attn_implementation="sdpa"`๋ฅผ ์ค์ ํ์ฌ SDPA๋ฅผ ๋ช
์์ ์ผ๋ก ์ฌ์ฉํ๋๋ก ์์ฒญํ ์๋ ์์ต๋๋ค.
+
+```python
+from transformers import CLIPModel
+
+model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32", torch_dtype=torch.float16, attn_implementation="sdpa")
+```
+
+์ต๊ณ ์ ์๋ํฅ์์ ์ํด์, ๋ฐ์ ๋ฐ๋๋ก ๋ชจ๋ธ์ ๋ก๋ํ๋ ๊ฒ์ ์ถ์ฒํฉ๋๋ค. (์๋ฅผ๋ค๋ฉด `torch.float16` ๋๋ `torch.bfloat16`).
+
+### ํ๋์ ์ดํ
์
๊ณผ ์ค์ผ์ผ๋ ๋ด์ ์ดํ
์
(SDPA)์ผ๋ก ์ธํด ์์๋๋ ์๋ํฅ์[[expected-speedups-with-flash-attention-and-sdpa]]
+
+๋ก์ปฌ ๋ฒค์น๋งํฌ(NVIDIA A10G, PyTorch 2.3.1+cu121)์์ `float16`์ ์ฌ์ฉํ์ฌ `"openai/clip-vit-large-patch14"` ์ฒดํฌํฌ์ธํธ๋ก ์ถ๋ก ์ ์ํํ์ ๋, ๋ค์๊ณผ ๊ฐ์ ์๋ ํฅ์์ ํ์ธ ํ์ต๋๋ค.
+[์ฝ๋](https://gist.github.com/qubvel/ac691a54e54f9fae8144275f866a7ff8):
+
+#### CLIPTextModel[[cliptextmodel]]
+
+| Num text labels | Eager (s/iter) | FA2 (s/iter) | FA2 speedup | SDPA (s/iter) | SDPA speedup |
+|------------------:|-----------------:|---------------:|--------------:|----------------:|---------------:|
+| 4 | 0.009 | 0.012 | 0.737 | 0.007 | 1.269 |
+| 16 | 0.009 | 0.014 | 0.659 | 0.008 | 1.187 |
+| 32 | 0.018 | 0.021 | 0.862 | 0.016 | 1.142 |
+| 64 | 0.034 | 0.034 | 1.001 | 0.03 | 1.163 |
+| 128 | 0.063 | 0.058 | 1.09 | 0.054 | 1.174 |
+
+
+
+#### CLIPVisionModel[[clipvisionmodel]]
+
+| Image batch size | Eager (s/iter) | FA2 (s/iter) | FA2 speedup | SDPA (s/iter) | SDPA speedup |
+|-------------------:|-----------------:|---------------:|--------------:|----------------:|---------------:|
+| 1 | 0.016 | 0.013 | 1.247 | 0.012 | 1.318 |
+| 4 | 0.025 | 0.021 | 1.198 | 0.021 | 1.202 |
+| 16 | 0.093 | 0.075 | 1.234 | 0.075 | 1.24 |
+| 32 | 0.181 | 0.147 | 1.237 | 0.146 | 1.241 |
+
+
+
+#### CLIPModel[[clipmodel]]
+
+| Image batch size | Num text labels | Eager (s/iter) | FA2 (s/iter) | FA2 speedup | SDPA (s/iter) | SDPA speedup |
+|-------------------:|------------------:|-----------------:|---------------:|--------------:|----------------:|---------------:|
+| 1 | 4 | 0.025 | 0.026 | 0.954 | 0.02 | 1.217 |
+| 1 | 16 | 0.026 | 0.028 | 0.918 | 0.02 | 1.287 |
+| 1 | 64 | 0.042 | 0.046 | 0.906 | 0.036 | 1.167 |
+| 4 | 4 | 0.028 | 0.033 | 0.849 | 0.024 | 1.189 |
+| 4 | 16 | 0.034 | 0.035 | 0.955 | 0.029 | 1.169 |
+| 4 | 64 | 0.059 | 0.055 | 1.072 | 0.05 | 1.179 |
+| 16 | 4 | 0.096 | 0.088 | 1.091 | 0.078 | 1.234 |
+| 16 | 16 | 0.102 | 0.09 | 1.129 | 0.083 | 1.224 |
+| 16 | 64 | 0.127 | 0.11 | 1.157 | 0.105 | 1.218 |
+| 32 | 4 | 0.185 | 0.159 | 1.157 | 0.149 | 1.238 |
+| 32 | 16 | 0.19 | 0.162 | 1.177 | 0.154 | 1.233 |
+| 32 | 64 | 0.216 | 0.181 | 1.19 | 0.176 | 1.228 |
+
+## ์๋ฃ[[resources]]
+
+CLIP์ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค.
+
+- [์๊ฒฉ ์ผ์ฑ (์ธ๊ณต์์ฑ) ์ด๋ฏธ์ง์ ์บก์
์ ๊ฐ์ง๊ณ CLIP ๋ฏธ์ธ์กฐ์ ํ๊ธฐ](https://huggingface.co/blog/fine-tune-clip-rsicd):
+[RSICD dataset](https://github.com/201528014227051/RSICD_optimal)์ ๊ฐ์ง๊ณ CLIP์ ๋ฏธ์ธ์กฐ์ ํ๋ ๋ฐฉ๋ฒ๊ณผ ๋ฐ์ดํฐ ์ฆ๊ฐ์ ๋ํ ์ฑ๋ฅ ๋น๊ต์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ
+- ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/contrastive-image-text)๋ [COCO dataset](https://cocodataset.org/#home)๋ฅผ ์ด์ฉํ ์ฌ์ ํ์ต๋ ๋น์ ๊ณผ ํ
์คํธ์ ์ธ์ฝ๋๋ฅผ ์ฌ์ฉํด์ CLIP๊ฐ์ ๋น์ -ํ
์คํธ ๋์ผ ๋ชจ๋ธ์ ์ด๋ป๊ฒ ํ์ต์ํค๋์ง ๋ณด์ฌ์ค๋๋ค.
+
+
+
+- ์ฌ์ ํ์ต๋ CLIP๋ชจ๋ธ์ ์ด๋ฏธ์ง ์บก์
๋์ ์ํ ๋น์์น ์ถ๋ก ์ ์ด๋ป๊ฒ ํ์ฉํ๋์ง์ ๊ดํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1tuoAC5F4sC7qid56Z0ap-stR3rwdk0ZV?usp=sharing)
+
+**์ด๋ฏธ์ง ๊ฒ์**
+
+- ์ฌ์ ํ์ต๋ CLIP๋ชจ๋ธ๊ณผ MRR(Mean Reciprocal Rank) ์ ์ ์ฐ์ฐ์ ์ฌ์ฉํ ์ด๋ฏธ์ง ๊ฒ์์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1bLVwVKpAndpEDHqjzxVPr_9nGrSbuOQd?usp=sharing). ๐
+- ์ด๋ฏธ์ง ๊ฒ์๊ณผ ์ ์ฌ์ฑ ์ ์์ ๋ํด ๋ณด์ฌ์ฃผ๋ [๋
ธํธ๋ถ](https://colab.research.google.com/github/deep-diver/image_search_with_natural_language/blob/main/notebooks/Image_Search_CLIP.ipynb). ๐
+- Multilingual CLIP๋ฅผ ์ฌ์ฉํด์ ์ด๋ฏธ์ง์ ํ
์คํธ๋ฅผ ์ด๋ป๊ฒ ๊ฐ์ ๋ฒกํฐ ๊ณต๊ฐ์ ๋งคํ ์ํค๋์ง์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1xO-wC_m_GNzgjIBQ4a4znvQkvDoZJvH4?usp=sharing). ๐
+- [Unsplash](https://unsplash.com)์ [TMDB](https://www.themoviedb.org/) ๋ฐ์ดํฐ์
์ ํ์ฉํ ์๋ฏธ๋ก ์ (semantic) ์ด๋ฏธ์ง ๊ฒ์์์ CLIP์ ๊ตฌ๋ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/github/vivien000/clip-demo/blob/master/clip.ipynb#scrollTo=uzdFhRGqiWkR). ๐
+
+**์ค๋ช
๊ฐ๋ฅ์ฑ**
+
+- ์
๋ ฅ ํ ํฐ๊ณผ ์ด๋ฏธ์ง ์กฐ๊ฐ(segment) ์ฌ์ด์ ์ ์ฌ์ฑ์ ์๊ฐํ ์ํค๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/github/hila-chefer/Transformer-MM-Explainability/blob/main/CLIP_explainability.ipynb). ๐
+
+์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐ ํด๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+## CLIPConfig[[transformers.CLIPConfig]]
+
+[[autodoc]] CLIPConfig
+ - from_text_vision_configs
+
+## CLIPTextConfig[[transformers.CLIPTextConfig]]
+
+[[autodoc]] CLIPTextConfig
+
+## CLIPVisionConfig[[transformers.CLIPVisionConfig]]
+
+[[autodoc]] CLIPVisionConfig
+
+## CLIPTokenizer[[transformers.CLIPTokenizer]]
+
+[[autodoc]] CLIPTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## CLIPTokenizerFast[[transformers.CLIPTokenizerFast]]
+
+[[autodoc]] CLIPTokenizerFast
+
+## CLIPImageProcessor[[transformers.CLIPImageProcessor]]
+
+[[autodoc]] CLIPImageProcessor
+ - preprocess
+
+## CLIPFeatureExtractor[[transformers.CLIPFeatureExtractor]]
+
+[[autodoc]] CLIPFeatureExtractor
+
+## CLIPProcessor[[transformers.CLIPProcessor]]
+
+[[autodoc]] CLIPProcessor
+
+
+
+
+## CLIPModel[[transformers.CLIPModel]]
+
+[[autodoc]] CLIPModel
+ - forward
+ - get_text_features
+ - get_image_features
+
+## CLIPTextModel[[transformers.CLIPTextModel]]
+
+[[autodoc]] CLIPTextModel
+ - forward
+
+## CLIPTextModelWithProjection[[transformers.CLIPTextModelWithProjection]]
+
+[[autodoc]] CLIPTextModelWithProjection
+ - forward
+
+## CLIPVisionModelWithProjection[[transformers.CLIPVisionModelWithProjection]]
+
+[[autodoc]] CLIPVisionModelWithProjection
+ - forward
+
+## CLIPVisionModel[[transformers.CLIPVisionModel]]
+
+[[autodoc]] CLIPVisionModel
+ - forward
+
+## CLIPForImageClassification[[transformers.CLIPForImageClassification]]
+
+[[autodoc]] CLIPForImageClassification
+ - forward
+
+
+
+
+## TFCLIPModel[[transformers.TFCLIPModel]]
+
+[[autodoc]] TFCLIPModel
+ - call
+ - get_text_features
+ - get_image_features
+
+## TFCLIPTextModel[[transformers.TFCLIPTextModel]]
+
+[[autodoc]] TFCLIPTextModel
+ - call
+
+## TFCLIPVisionModel[[transformers.TFCLIPVisionModel]]
+
+[[autodoc]] TFCLIPVisionModel
+ - call
+
+
+
+
+## FlaxCLIPModel[[transformers.FlaxCLIPModel]]
+
+[[autodoc]] FlaxCLIPModel
+ - __call__
+ - get_text_features
+ - get_image_features
+
+## FlaxCLIPTextModel[[transformers.FlaxCLIPTextModel]]
+
+[[autodoc]] FlaxCLIPTextModel
+ - __call__
+
+## FlaxCLIPTextModelWithProjection[[transformers.FlaxCLIPTextModelWithProjection]]
+
+[[autodoc]] FlaxCLIPTextModelWithProjection
+ - __call__
+
+## FlaxCLIPVisionModel[[transformers.FlaxCLIPVisionModel]]
+
+[[autodoc]] FlaxCLIPVisionModel
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/cohere.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/cohere.md
new file mode 100644
index 0000000000000000000000000000000000000000..c577764623f49672a27b78f850828cc21fa7a37b
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/cohere.md
@@ -0,0 +1,139 @@
+# Cohere[[cohere]]
+
+## ๊ฐ์[[overview]]
+
+The Cohere Command-R ๋ชจ๋ธ์ Cohereํ์ด [Command-R: ํ๋ก๋์
๊ท๋ชจ์ ๊ฒ์ ์ฆ๊ฐ ์์ฑ](https://txt.cohere.com/command-r/)๋ผ๋ ๋ธ๋ก๊ทธ ํฌ์คํธ์์ ์๊ฐ ๋์์ต๋๋ค.
+
+๋
ผ๋ฌธ ์ด๋ก:
+
+*Command-R์ ๊ธฐ์
์ ํ๋ก๋์
๊ท๋ชจ AI๋ฅผ ๊ฐ๋ฅํ๊ฒ ํ๊ธฐ ์ํด RAG(๊ฒ์ ์ฆ๊ฐ ์์ฑ)์ ๋๊ตฌ ์ฌ์ฉ์ ๋ชฉํ๋ก ํ๋ ํ์ฅ ๊ฐ๋ฅํ ์์ฑ ๋ชจ๋ธ์
๋๋ค. ์ค๋ ์ฐ๋ฆฌ๋ ๋๊ท๋ชจ ํ๋ก๋์
์ํฌ๋ก๋๋ฅผ ๋ชฉํ๋ก ํ๋ ์๋ก์ด LLM์ธ Command-R์ ์๊ฐํฉ๋๋ค. Command-R์ ๋์ ํจ์จ์ฑ๊ณผ ๊ฐ๋ ฅํ ์ ํ์ฑ์ ๊ท ํ์ ๋ง์ถ๋ 'ํ์ฅ ๊ฐ๋ฅํ' ๋ชจ๋ธ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ๋์์ผ๋ก ํ์ฌ, ๊ธฐ์
๋ค์ด ๊ฐ๋
์ฆ๋ช
์ ๋์ด ํ๋ก๋์
๋จ๊ณ๋ก ๋์๊ฐ ์ ์๊ฒ ํฉ๋๋ค.*
+
+*Command-R์ ๊ฒ์ ์ฆ๊ฐ ์์ฑ(RAG)์ด๋ ์ธ๋ถ API ๋ฐ ๋๊ตฌ ์ฌ์ฉ๊ณผ ๊ฐ์ ๊ธด ๋ฌธ๋งฅ ์์
์ ์ต์ ํ๋ ์์ฑ ๋ชจ๋ธ์
๋๋ค. ์ด ๋ชจ๋ธ์ RAG ์ ํ๋ฆฌ์ผ์ด์
์ ์ํ ์ต๊ณ ์์ค์ ํตํฉ์ ์ ๊ณตํ๊ณ ๊ธฐ์
์ฌ์ฉ ์ฌ๋ก์์ ๋ฐ์ด๋ ์ฑ๋ฅ์ ๋ฐํํ๊ธฐ ์ํด ์ฐ๋ฆฌ์ ์
๊ณ ์ ๋์ ์ธ Embed ๋ฐ Rerank ๋ชจ๋ธ๊ณผ ์กฐํ๋กญ๊ฒ ์๋ํ๋๋ก ์ค๊ณ๋์์ต๋๋ค. ๊ธฐ์
์ด ๋๊ท๋ชจ๋ก ๊ตฌํํ ์ ์๋๋ก ๋ง๋ค์ด์ง ๋ชจ๋ธ๋ก์, Command-R์ ๋ค์๊ณผ ๊ฐ์ ํน์ง์ ์๋ํฉ๋๋ค:
+- RAG ๋ฐ ๋๊ตฌ ์ฌ์ฉ์ ๋ํ ๊ฐ๋ ฅํ ์ ํ์ฑ
+- ๋ฎ์ ์ง์ฐ ์๊ฐ๊ณผ ๋์ ์ฒ๋ฆฌ๋
+- ๋ ๊ธด 128k ์ปจํ
์คํธ์ ๋ฎ์ ๊ฐ๊ฒฉ
+- 10๊ฐ์ ์ฃผ์ ์ธ์ด์ ๊ฑธ์น ๊ฐ๋ ฅํ ๊ธฐ๋ฅ
+- ์ฐ๊ตฌ ๋ฐ ํ๊ฐ๋ฅผ ์ํด HuggingFace์์ ์ฌ์ฉ ๊ฐ๋ฅํ ๋ชจ๋ธ ๊ฐ์ค์น
+
+๋ชจ๋ธ ์ฒดํฌํฌ์ธํธ๋ [์ด๊ณณ](https://huggingface.co/CohereForAI/c4ai-command-r-v01)์์ ํ์ธํ์ธ์.
+์ด ๋ชจ๋ธ์ [Saurabh Dash](https://huggingface.co/saurabhdash)๊ณผ [Ahmet รstรผn](https://huggingface.co/ahmetustun)์ ์ํด ๊ธฐ์ฌ ๋์์ต๋๋ค. Hugging Face์์ ์ด ์ฝ๋์ ๊ตฌํ์ [GPT-NeoX](https://github.com/EleutherAI/gpt-neox)์ ๊ธฐ๋ฐํ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+
+
+Hub์ ์
๋ก๋๋ ์ฒดํฌํฌ์ธํธ๋ค์ `torch_dtype = 'float16'`์ ์ฌ์ฉํฉ๋๋ค.
+์ด๋ `AutoModel` API๊ฐ ์ฒดํฌํฌ์ธํธ๋ฅผ `torch.float32`์์ `torch.float16`์ผ๋ก ๋ณํํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
+
+์จ๋ผ์ธ ๊ฐ์ค์น์ `dtype`์ `model = AutoModelForCausalLM.from_pretrained("path", torch_dtype = "auto")`๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ์ด๊ธฐํํ ๋ `torch_dtype="auto"`๋ฅผ ์ฌ์ฉํ์ง ์๋ ํ ๋๋ถ๋ถ ๋ฌด๊ดํฉ๋๋ค. ๊ทธ ์ด์ ๋ ๋ชจ๋ธ์ด ๋จผ์ ๋ค์ด๋ก๋๋๊ณ (์จ๋ผ์ธ ์ฒดํฌํฌ์ธํธ์ `dtype` ์ฌ์ฉ), ๊ทธ ๋ค์ `torch`์ ๊ธฐ๋ณธ `dtype`์ผ๋ก ๋ณํ๋๋ฉฐ(์ด๋ `torch.float32`๊ฐ ๋จ), ๋ง์ง๋ง์ผ๋ก config์ `torch_dtype`์ด ์ ๊ณต๋ ๊ฒฝ์ฐ ์ด๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+๋ชจ๋ธ์ `float16`์ผ๋ก ํ๋ จํ๋ ๊ฒ์ ๊ถ์ฅ๋์ง ์์ผ๋ฉฐ `nan`์ ์์ฑํ๋ ๊ฒ์ผ๋ก ์๋ ค์ ธ ์์ต๋๋ค. ๋ฐ๋ผ์ ๋ชจ๋ธ์ `bfloat16`์ผ๋ก ํ๋ จํด์ผ ํฉ๋๋ค.
+
+๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ ๋ค์๊ณผ ๊ฐ์ด ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```python
+# pip install transformers
+from transformers import AutoTokenizer, AutoModelForCausalLM
+
+model_id = "CohereForAI/c4ai-command-r-v01"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id)
+
+# Format message with the command-r chat template
+messages = [{"role": "user", "content": "Hello, how are you?"}]
+input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
+## <|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
+
+gen_tokens = model.generate(
+ input_ids,
+ max_new_tokens=100,
+ do_sample=True,
+ temperature=0.3,
+ )
+
+gen_text = tokenizer.decode(gen_tokens[0])
+print(gen_text)
+```
+
+- Flash Attention 2๋ฅผ `attn_implementation="flash_attention_2"`๋ฅผ ํตํด ์ฌ์ฉํ ๋๋, `from_pretrained` ํด๋์ค ๋ฉ์๋์ `torch_dtype`์ ์ ๋ฌํ์ง ๋ง๊ณ ์๋ ํผํฉ ์ ๋ฐ๋ ํ๋ จ(Automatic Mixed-Precision training)์ ์ฌ์ฉํ์ธ์. `Trainer`๋ฅผ ์ฌ์ฉํ ๋๋ ๋จ์ํ `fp16` ๋๋ `bf16`์ `True`๋ก ์ง์ ํ๋ฉด ๋ฉ๋๋ค. ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ์๋ `torch.autocast`๋ฅผ ์ฌ์ฉํ๊ณ ์๋์ง ํ์ธํ์ธ์. ์ด๋ Flash Attention์ด `fp16`์ `bf16` ๋ฐ์ดํฐ ํ์
๋ง ์ง์ํ๊ธฐ ๋๋ฌธ์ ํ์ํฉ๋๋ค.
+
+## ๋ฆฌ์์ค[[resources]]
+
+Command-R์ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค. ์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐ ํด๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+
+
+
+FP16 ๋ชจ๋ธ ๋ก๋ฉ
+```python
+# pip install transformers
+from transformers import AutoTokenizer, AutoModelForCausalLM
+
+model_id = "CohereForAI/c4ai-command-r-v01"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id)
+
+# command-r ์ฑ ํ
ํ๋ฆฟ์ผ๋ก ๋ฉ์ธ์ง ํ์์ ์ ํ์ธ์
+messages = [{"role": "user", "content": "Hello, how are you?"}]
+input_ids = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
+## <|START_OF_TURN_TOKEN|><|USER_TOKEN|>Hello, how are you?<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>
+
+gen_tokens = model.generate(
+ input_ids,
+ max_new_tokens=100,
+ do_sample=True,
+ temperature=0.3,
+ )
+
+gen_text = tokenizer.decode(gen_tokens[0])
+print(gen_text)
+```
+
+bitsandbytes ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ด์ฉํด์ 4bit ์์ํ๋ ๋ชจ๋ธ ๋ก๋ฉ
+```python
+# pip install transformers bitsandbytes accelerate
+from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
+
+bnb_config = BitsAndBytesConfig(load_in_4bit=True)
+
+model_id = "CohereForAI/c4ai-command-r-v01"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config)
+
+gen_tokens = model.generate(
+ input_ids,
+ max_new_tokens=100,
+ do_sample=True,
+ temperature=0.3,
+ )
+
+gen_text = tokenizer.decode(gen_tokens[0])
+print(gen_text)
+```
+
+
+## CohereConfig[[transformers.CohereConfig]]
+
+[[autodoc]] CohereConfig
+
+## CohereTokenizerFast[[transformers.CohereTokenizerFast]]
+
+[[autodoc]] CohereTokenizerFast
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - update_post_processor
+ - save_vocabulary
+
+## CohereModel[[transformers.CohereModel]]
+
+[[autodoc]] CohereModel
+ - forward
+
+
+## CohereForCausalLM[[transformers.CohereForCausalLM]]
+
+[[autodoc]] CohereForCausalLM
+ - forward
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/convbert.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/convbert.md
new file mode 100644
index 0000000000000000000000000000000000000000..ec64a369b56a3f0e33f9e41c44f6b95555dc36dd
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/convbert.md
@@ -0,0 +1,135 @@
+
+
+# ConvBERT [[convbert]]
+
+
+
+## ๊ฐ์ [[overview]]
+
+ConvBERT ๋ชจ๋ธ์ Zihang Jiang, Weihao Yu, Daquan Zhou, Yunpeng Chen, Jiashi Feng, Shuicheng Yan์ ์ํด ์ ์๋์์ผ๋ฉฐ, ์ ์ ๋
ผ๋ฌธ ์ ๋ชฉ์ [ConvBERT: Improving BERT with Span-based Dynamic Convolution](https://arxiv.org/abs/2008.02496)์
๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*BERT์ ๊ทธ ๋ณํ ๋ชจ๋ธ๊ณผ ๊ฐ์ ์ฌ์ ํ์ต๋ ์ธ์ด ๋ชจ๋ธ๋ค์ ์ต๊ทผ ๋ค์ํ ์์ฐ์ด ์ดํด ๊ณผ์ ์์ ๋๋ผ์ด ์ฑ๊ณผ๋ฅผ ์ด๋ฃจ์์ต๋๋ค. ๊ทธ๋ฌ๋ BERT๋ ๊ธ๋ก๋ฒ ์
ํ ์ดํ
์
๋ธ๋ก์ ํฌ๊ฒ ์์กดํ๊ธฐ ๋๋ฌธ์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ด ๋ง๊ณ ๊ณ์ฐ ๋น์ฉ์ด ํฝ๋๋ค. ๋ชจ๋ ์ดํ
์
ํค๋๊ฐ ๊ธ๋ก๋ฒ ๊ด์ ์์ ์ดํ
์
๋งต์ ์์ฑํ๊ธฐ ์ํด ์
๋ ฅ ์ํ์ค ์ ์ฒด๋ฅผ ํ์ํ์ง๋ง, ์ผ๋ถ ํค๋๋ ๋ก์ปฌ ์ข
์์ฑ๋ง ํ์ตํ ํ์๊ฐ ์๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค. ์ด๋ ๋ถํ์ํ ๊ณ์ฐ์ด ํฌํจ๋์ด ์์์ ์๋ฏธํฉ๋๋ค. ๋ฐ๋ผ์ ์ฐ๋ฆฌ๋ ์ด๋ฌํ self-attention ํค๋๋ค์ ๋์ฒดํ์ฌ ๋ก์ปฌ ์ข
์์ฑ์ ์ง์ ๋ชจ๋ธ๋งํ๊ธฐ ์ํด ์๋ก์ด span ๊ธฐ๋ฐ ๋์ ์ปจ๋ณผ๋ฃจ์
์ ์ ์ํฉ๋๋ค. ์๋ก์ด ์ปจ๋ณผ๋ฃจ์
ํค๋์ ๋๋จธ์ง self-attention ํค๋๋ค์ด ๊ฒฐํฉํ์ฌ ๊ธ๋ก๋ฒ ๋ฐ ๋ก์ปฌ ๋ฌธ๋งฅ ํ์ต์ ๋ ํจ์จ์ ์ธ ํผํฉ ์ดํ
์
๋ธ๋ก์ ๊ตฌ์ฑํฉ๋๋ค. ์ฐ๋ฆฌ๋ BERT์ ์ด ํผํฉ ์ดํ
์
์ค๊ณ๋ฅผ ์ ์ฉํ์ฌ ConvBERT ๋ชจ๋ธ์ ๊ตฌ์ถํ์ต๋๋ค. ์คํ ๊ฒฐ๊ณผ, ConvBERT๋ ๋ค์ํ ๋ค์ด์คํธ๋ฆผ ๊ณผ์ ์์ BERT ๋ฐ ๊ทธ ๋ณํ ๋ชจ๋ธ๋ณด๋ค ๋ ์ฐ์ํ ์ฑ๋ฅ์ ๋ณด์์ผ๋ฉฐ, ํ๋ จ ๋น์ฉ๊ณผ ๋ชจ๋ธ ํ๋ผ๋ฏธํฐ ์๊ฐ ๋ ์ ์์ต๋๋ค. ํนํ ConvBERTbase ๋ชจ๋ธ์ GLUE ์ค์ฝ์ด 86.4๋ฅผ ๋ฌ์ฑํ์ฌ ELECTRAbase๋ณด๋ค 0.7 ๋์ ์ฑ๊ณผ๋ฅผ ๋ณด์ด๋ฉฐ, ํ๋ จ ๋น์ฉ์ 1/4 ์ดํ๋ก ์ค์์ต๋๋ค. ์ฝ๋์ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ๊ณต๊ฐ๋ ์์ ์
๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [abhishek](https://huggingface.co/abhishek)์ ์ํด ๊ธฐ์ฌ๋์์ผ๋ฉฐ, ์๋ณธ ๊ตฌํ์ ์ฌ๊ธฐ์์ ์ฐพ์ ์ ์์ต๋๋ค : https://github.com/yitu-opensource/ConvBert
+
+
+
+## ์ฌ์ฉ ํ [[usage-tips]]
+ConvBERT ํ๋ จ ํ์ BERT์ ์ ์ฌํฉ๋๋ค. ์ฌ์ฉ ํ์ [BERT ๋ฌธ์](bert).๋ฅผ ์ฐธ๊ณ ํ์ญ์์ค.
+
+
+## ๋ฆฌ์์ค [[resources]]
+
+- [ํ
์คํธ ๋ถ๋ฅ ์์
๊ฐ์ด๋ (Text classification task guide)](../tasks/sequence_classification)
+- [ํ ํฐ ๋ถ๋ฅ ์์
๊ฐ์ด๋ (Token classification task guide)](../tasks/token_classification)
+- [์ง์์๋ต ์์
๊ฐ์ด๋ (Question answering task guide)](../tasks/question_answering)
+- [๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋ (Masked language modeling task guide)](../tasks/masked_language_modeling)
+- [๋ค์ค ์ ํ ์์
๊ฐ์ด๋ (Multiple choice task guide)](../tasks/multiple_choice)
+
+## ConvBertConfig [[transformers.ConvBertConfig]]
+
+[[autodoc]] ConvBertConfig
+
+## ConvBertTokenizer [[transformers.ConvBertTokenizer]]
+
+[[autodoc]] ConvBertTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## ConvBertTokenizerFast [[transformers.ConvBertTokenizerFast]]
+
+[[autodoc]] ConvBertTokenizerFast
+
+
+
+
+## ConvBertModel [[transformers.ConvBertModel]]
+
+[[autodoc]] ConvBertModel
+ - forward
+
+## ConvBertForMaskedLM [[transformers.ConvBertForMaskedLM]]
+
+[[autodoc]] ConvBertForMaskedLM
+ - forward
+
+## ConvBertForSequenceClassification [[transformers.ConvBertForSequenceClassification]]
+
+[[autodoc]] ConvBertForSequenceClassification
+ - forward
+
+## ConvBertForMultipleChoice [[transformers.ConvBertForMultipleChoice]]
+
+[[autodoc]] ConvBertForMultipleChoice
+ - forward
+
+## ConvBertForTokenClassification [[transformers.ConvBertForTokenClassification]]
+
+[[autodoc]] ConvBertForTokenClassification
+ - forward
+
+## ConvBertForQuestionAnswering [[transformers.ConvBertForQuestionAnswering]]
+
+[[autodoc]] ConvBertForQuestionAnswering
+ - forward
+
+
+
+
+## TFConvBertModel [[transformers.TFConvBertModel]]
+
+[[autodoc]] TFConvBertModel
+ - call
+
+## TFConvBertForMaskedLM [[transformers.TFConvBertForMaskedLM]]
+
+[[autodoc]] TFConvBertForMaskedLM
+ - call
+
+## TFConvBertForSequenceClassification [[transformers.TFConvBertForSequenceClassification]]
+
+[[autodoc]] TFConvBertForSequenceClassification
+ - call
+
+## TFConvBertForMultipleChoice [[transformers.TFConvBertForMultipleChoice]]
+
+[[autodoc]] TFConvBertForMultipleChoice
+ - call
+
+## TFConvBertForTokenClassification [[transformers.TFConvBertForTokenClassification]]
+
+[[autodoc]] TFConvBertForTokenClassification
+ - call
+
+## TFConvBertForQuestionAnswering [[transformers.TFConvBertForQuestionAnswering]]
+
+[[autodoc]] TFConvBertForQuestionAnswering
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/dbrx.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/dbrx.md
new file mode 100644
index 0000000000000000000000000000000000000000..4b33e95700691edd07f82c989c9c07e36aa0b419
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/dbrx.md
@@ -0,0 +1,125 @@
+
+
+# DBRX[[dbrx]]
+
+## ๊ฐ์[[overview]]
+
+DBRX๋ [ํธ๋์คํฌ๋จธ ๊ธฐ๋ฐ์](https://www.isattentionallyouneed.com/) ๋ค์ ํ ํฐ์ ์์ธกํ๋ ๋์ฝ๋ ์ ์ฉ LLM ๋ชจ๋ธ์
๋๋ค.
+์ด 132B ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง *์ธ๋ฐํ* ์ ๋ฌธ๊ฐ ํผํฉ(MoE) ์ํคํ
์ฒ๋ฅผ ์ฌ์ฉํ๋ฉฐ, ์ด ์ค 36B ๋งค๊ฐ๋ณ์๊ฐ ์
๋ ฅ๋ง๋ค ํ์ฑํ๋ฉ๋๋ค.
+12T ํ ํฐ์ ํ
์คํธ์ ์ฝ๋ ๋ฐ์ดํฐ๋ก ์ฌ์ ํ์ต๋์์ต๋๋ค.
+
+Mixtral-8x7B์ Grok-1๊ณผ ๊ฐ์ ๋ค๋ฅธ ๊ณต๊ฐ MoE ๋ชจ๋ธ๋ค๊ณผ ๋น๊ตํ์ ๋, DBRX๋ ๋ ๋ง์ ์์ ์์ ์ ๋ฌธ๊ฐ๋ค์ ์ฌ์ฉํ๋ ์ธ๋ฐํ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค. DBRX๋ 16๊ฐ์ ์ ๋ฌธ๊ฐ ์ค 4๊ฐ๋ฅผ ์ ํํ๋ ๋ฐ๋ฉด, Mixtral-8x7B์ Grok-1์ 8๊ฐ์ ์ ๋ฌธ๊ฐ ์ค 2๊ฐ๋ฅผ ์ ํํฉ๋๋ค.
+
+์ด๋ 65๋ฐฐ ๋ ๋ง์ ์ ๋ฌธ๊ฐ ์กฐํฉ์ ๊ฐ๋ฅํ๊ฒ ํ๋ฉฐ, ์ด๋ฅผ ํตํด ๋ชจ๋ธ์ ํ์ง์ด ํฅ์๋๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค.
+DBRX๋ ํ์ ์์น ์ธ์ฝ๋ฉ(RoPE), ๊ฒ์ดํธ ์ ํ ์ ๋(GLU), ๊ทธ๋ฃน ์ฟผ๋ฆฌ ์ดํ
์
(GQA)์ ์ฌ์ฉํฉ๋๋ค.
+BPE ๊ธฐ๋ฐ ๋ชจ๋ธ์ด๋ฉฐ [tiktoken](https://github.com/openai/tiktoken) ์ ์ฅ์์ ์ค๋ช
๋ GPT-4 ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+์ด๋ฌํ ์ ํ๋ค์ ์ฒ ์ ํ ํ๊ฐ์ ์ค์ผ์ผ๋ง ์คํ์ ๊ธฐ๋ฐ์ผ๋ก ์ด๋ฃจ์ด์ก์ต๋๋ค.
+
+DBRX๋ ์ ์คํ๊ฒ ์ ๋ณ๋ 12T ํ ํฐ์ ๋ฐ์ดํฐ๋ก ์ฌ์ ํ์ต๋์์ผ๋ฉฐ, ์ต๋ ๋ฌธ๋งฅ ๊ธธ์ด๋ 32K ํ ํฐ์
๋๋ค.
+์ด ๋ฐ์ดํฐ๋ ํ ํฐ ๋๋น MPT ๊ณ์ด ๋ชจ๋ธ ํ์ต์ ์ฌ์ฉ๋ ๋ฐ์ดํฐ๋ณด๋ค ์ต์ 2๋ฐฐ ์ด์ ๋ ์ข์ ๊ฒ์ผ๋ก ์ถ์ ๋ฉ๋๋ค.
+์ด ์๋ก์ด ๋ฐ์ดํฐ์
์ ๋ฐ์ดํฐ ์ฒ๋ฆฌ๋ฅผ ์ํ Apache Sparkโข์ Databricks ๋
ธํธ๋ถ, ๊ทธ๋ฆฌ๊ณ ๋ฐ์ดํฐ ๊ด๋ฆฌ์ ๊ฑฐ๋ฒ๋์ค๋ฅผ ์ํ Unity Catalog๋ฅผ ํฌํจํ Databricks ๋๊ตฌ ์ ์ฒด๋ฅผ ํ์ฉํ์ฌ ๊ฐ๋ฐ๋์์ต๋๋ค.
+์ฐ๋ฆฌ๋ ์ฌ์ ํ์ต์ ์ํด ์ปค๋ฆฌํ๋ผ ํ์ต์ ์ฌ์ฉํ์ผ๋ฉฐ, ํ์ต ์ค ๋ฐ์ดํฐ ๋ฏน์ค๋ฅผ ๋ณ๊ฒฝํ๋ ๋ฐฉ์์ด ๋ชจ๋ธ ํ์ง์ ์๋นํ ๊ฐ์ ํ๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค.
+
+
+DBRX Instruct์ DBRX Base์ ๋ํ ๋ ์์ธํ ์ ๋ณด๋ ์ด [๊ธฐ์ ๋ธ๋ก๊ทธ ํฌ์คํธ](https://www.databricks.com/blog/introducing-dbrx-new-state-art-open-llm)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ [eitan-turok](https://huggingface.co/eitanturok)์ [abhi-db](https://huggingface.co/abhi-db)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/databricks/dbrx-instruct)์์ ์ฐพ์ ์ ์์ง๋ง, ์ต์ ๋ฒ์ ์ด ์๋ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ์[[usage-examples]]
+
+`generate()` ๋ฉ์๋๋ DBRX๋ฅผ ์ฌ์ฉํ์ฌ ํ
์คํธ๋ฅผ ์์ฑํ๋ ๋ฐ ์ฌ์ฉ๋ ์ ์์ต๋๋ค. ํ์ค ์ดํ
์
๊ตฌํ, ํ๋์ ์ดํ
์
, PyTorch์ ์ค์ผ์ผ๋ ๋ด์ ์ดํ
์
(Scaled Dot-Product Attention)์ ์ฌ์ฉํ์ฌ ์์ฑํ ์ ์์ต๋๋ค. ํ์์ ๋ ์ดํ
์
๊ตฌํ ๋ฐฉ์์ ์ฒ๋ฆฌ ์๋๋ฅผ ํฌ๊ฒ ๋์ฌ์ค๋๋ค.
+
+```python
+from transformers import DbrxForCausalLM, AutoTokenizer
+import torch
+
+tokenizer = AutoTokenizer.from_pretrained("databricks/dbrx-instruct", token="YOUR_HF_TOKEN")
+model = DbrxForCausalLM.from_pretrained(
+ "databricks/dbrx-instruct",
+ device_map="auto",
+ torch_dtype=torch.bfloat16,
+ token="YOUR_HF_TOKEN",
+ )
+
+input_text = "What does it take to build a great LLM?"
+messages = [{"role": "user", "content": input_text}]
+input_ids = tokenizer.apply_chat_template(messages, return_dict=True, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
+
+outputs = model.generate(**input_ids, max_new_tokens=200)
+print(tokenizer.decode(outputs[0]))
+```
+
+`pip install flash-attn`๋ฅผ ํตํด ํ๋์ ์ดํ
์
์ ์ค์นํ๋ฉด, ๋ ๋น ๋ฅธ ์์ฑ์ด ๊ฐ๋ฅํฉ๋๋ค. (ํ๋์ ์ดํ
์
์ ๋ํ HuggingFace ๋ฌธ์๋ [์ด๊ณณ](https://huggingface.co/docs/transformers/perf_infer_gpu_one#flashattention-2)์์ ํ์ธํ ์ ์์ต๋๋ค.)
+
+
+```python
+from transformers import DbrxForCausalLM, AutoTokenizer
+import torch
+
+tokenizer = AutoTokenizer.from_pretrained("databricks/dbrx-instruct", token="YOUR_HF_TOKEN")
+model = DbrxForCausalLM.from_pretrained(
+ "databricks/dbrx-instruct",
+ device_map="auto",
+ torch_dtype=torch.bfloat16,
+ token="YOUR_HF_TOKEN",
+ attn_implementation="flash_attention_2",
+ )
+
+input_text = "What does it take to build a great LLM?"
+messages = [{"role": "user", "content": input_text}]
+input_ids = tokenizer.apply_chat_template(messages, return_dict=True, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
+
+outputs = model.generate(**input_ids, max_new_tokens=200)
+print(tokenizer.decode(outputs[0]))
+```
+
+PyTorch์ ์ค์ผ์ผ๋ ๋ด์ ์ดํ
์
์ ์ฌ์ฉํ์ฌ๋ ๋ ๋น ๋ฅธ ์์ฑ์ด ๊ฐ๋ฅํฉ๋๋ค. (์ค์ผ์ผ๋ ๋ด์ ์ดํ
์
์ ๋ํ HuggingFace ๋ฌธ์๋ [์ด๊ณณ](https://huggingface.co/docs/transformers/perf_infer_gpu_one#pytorch-scaled-dot-product-attention)์์ ํ์ธํ ์ ์์ต๋๋ค.)
+
+
+```python
+from transformers import DbrxForCausalLM, AutoTokenizer
+import torch
+
+tokenizer = AutoTokenizer.from_pretrained("databricks/dbrx-instruct", token="YOUR_HF_TOKEN")
+model = DbrxForCausalLM.from_pretrained(
+ "databricks/dbrx-instruct",
+ device_map="auto",
+ torch_dtype=torch.bfloat16,
+ token="YOUR_HF_TOKEN",
+ attn_implementation="sdpa",
+ )
+
+input_text = "What does it take to build a great LLM?"
+messages = [{"role": "user", "content": input_text}]
+input_ids = tokenizer.apply_chat_template(messages, return_dict=True, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
+
+outputs = model.generate(**input_ids, max_new_tokens=200)
+print(tokenizer.decode(outputs[0]))
+```
+
+## DbrxConfig[[transformers.DbrxConfig]]
+
+[[autodoc]] DbrxConfig
+
+
+## DbrxModel[[transformers.DbrxModel]]
+
+[[autodoc]] DbrxModel
+ - forward
+
+
+## DbrxForCausalLM[[transformers.DbrxForCausalLM]]
+
+[[autodoc]] DbrxForCausalLM
+ - forward
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/deberta-v2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/deberta-v2.md
new file mode 100644
index 0000000000000000000000000000000000000000..2e590ad8a5abcf90da995dc90b6592c8a205b309
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/deberta-v2.md
@@ -0,0 +1,147 @@
+
+
+# DeBERTa-v2
+
+## ๊ฐ์
+
+
+DeBERTa ๋ชจ๋ธ์ Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen์ด ์์ฑํ [DeBERTa: ๋ถ๋ฆฌ๋ ์ดํ
์
์ ํ์ฉํ ๋์ฝ๋ฉ ๊ฐํ BERT](https://arxiv.org/abs/2006.03654)์ด๋ผ๋ ๋
ผ๋ฌธ์์ ์ ์๋์์ต๋๋ค. ์ด ๋ชจ๋ธ์ 2018๋
Google์ด ๋ฐํํ BERT ๋ชจ๋ธ๊ณผ 2019๋
Facebook์ด ๋ฐํํ RoBERTa ๋ชจ๋ธ์ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค.
+DeBERTa๋ RoBERTa์์ ์ฌ์ฉ๋ ๋ฐ์ดํฐ์ ์ ๋ฐ๋ง์ ์ฌ์ฉํ์ฌ ๋ถ๋ฆฌ๋(disentangled) ์ดํ
์
๊ณผ ํฅ์๋ ๋ง์คํฌ ๋์ฝ๋ ํ์ต์ ํตํด RoBERTa๋ฅผ ๊ฐ์ ํ์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ฌ์ ํ์ต๋ ์ ๊ฒฝ๋ง ์ธ์ด ๋ชจ๋ธ์ ์ต๊ทผ ๋ฐ์ ์ ๋ง์ ์์ฐ์ด ์ฒ๋ฆฌ(NLP) ์์
์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์์ผฐ์ต๋๋ค. ๋ณธ ๋
ผ๋ฌธ์์๋ ๋ ๊ฐ์ง ์๋ก์ด ๊ธฐ์ ์ ์ฌ์ฉํ์ฌ BERT์ RoBERTa ๋ชจ๋ธ์ ๊ฐ์ ํ ์๋ก์ด ๋ชจ๋ธ ๊ตฌ์กฐ์ธ DeBERTa๋ฅผ ์ ์ํฉ๋๋ค. ์ฒซ ๋ฒ์งธ๋ ๋ถ๋ฆฌ๋ ์ดํ
์
๋ฉ์ปค๋์ฆ์ผ๋ก, ๊ฐ ๋จ์ด๊ฐ ๋ด์ฉ๊ณผ ์์น๋ฅผ ๊ฐ๊ฐ ์ธ์ฝ๋ฉํ๋ ๋ ๊ฐ์ ๋ฒกํฐ๋ก ํํ๋๋ฉฐ, ๋จ์ด๋ค ๊ฐ์ ์ดํ
์
๊ฐ์ค์น๋ ๋ด์ฉ๊ณผ ์๋์ ์์น์ ๋ํ ๋ถ๋ฆฌ๋ ํ๋ ฌ์ ์ฌ์ฉํ์ฌ ๊ณ์ฐ๋ฉ๋๋ค. ๋ ๋ฒ์งธ๋ก, ๋ชจ๋ธ ์ฌ์ ํ์ต์ ์ํด ๋ง์คํน๋ ํ ํฐ์ ์์ธกํ๋ ์ถ๋ ฅ ์ํํธ๋งฅ์ค ์ธต์ ๋์ฒดํ๋ ํฅ์๋ ๋ง์คํฌ ๋์ฝ๋๊ฐ ์ฌ์ฉ๋ฉ๋๋ค. ์ฐ๋ฆฌ๋ ์ด ๋ ๊ฐ์ง ๊ธฐ์ ์ด ๋ชจ๋ธ ์ฌ์ ํ์ต์ ํจ์จ์ฑ๊ณผ ๋ค์ด์คํธ๋ฆผ ์์
์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์ํจ๋ค๋ ๊ฒ์ ๋ณด์ฌ์ค๋๋ค. RoBERTa-Large์ ๋น๊ตํ์ ๋, ์ ๋ฐ์ ํ์ต ๋ฐ์ดํฐ๋ก ํ์ต๋ DeBERTa ๋ชจ๋ธ์ ๊ด๋ฒ์ํ NLP ์์
์์ ์ผ๊ด๋๊ฒ ๋ ๋์ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ๋ฉฐ, MNLI์์ +0.9%(90.2% vs 91.1%), SQuAD v2.0์์ +2.3%(88.4% vs 90.7%), RACE์์ +3.6%(83.2% vs 86.8%)์ ์ฑ๋ฅ ํฅ์์ ๋ฌ์ฑํ์ต๋๋ค. DeBERTa ์ฝ๋์ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ https://github.com/microsoft/DeBERTa ์์ ๊ณต๊ฐ๋ ์์ ์
๋๋ค.*
+
+
+๋ค์ ์ ๋ณด๋ค์ [์๋ณธ ๊ตฌํ ์ ์ฅ์](https://github.com/microsoft/DeBERTa)์์ ๋ณด์ค ์ ์์ต๋๋ค. DeBERTa v2๋ DeBERTa์ ๋๋ฒ์งธ ๋ชจ๋ธ์
๋๋ค.
+DeBERTa v2๋ SuperGLUE ๋จ์ผ ๋ชจ๋ธ ์ ์ถ์ ์ฌ์ฉ๋ 1.5B ๋ชจ๋ธ์ ํฌํจํ๋ฉฐ, ์ธ๊ฐ ๊ธฐ์ค์ (๋ฒ ์ด์ค๋ผ์ธ) 89.8์ ๋๋น 89.9์ ์ ๋ฌ์ฑํ์ต๋๋ค. ์ ์์
+[๋ธ๋ก๊ทธ](https://www.microsoft.com/en-us/research/blog/microsoft-deberta-surpasses-human-performance-on-the-superglue-benchmark/)์์ ๋ ์์ธํ ์ ๋ณด๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
+
+v2์ ์๋ก์ด ์ :
+
+- **์ดํ(Vocabulary)** v2์์๋ ํ์ต ๋ฐ์ดํฐ๋ก๋ถํฐ ๊ตฌ์ถ๋ 128K ํฌ๊ธฐ์ ์๋ก์ด ์ดํ๋ฅผ ์ฌ์ฉํ๋๋ก ํ ํฌ๋์ด์ ๊ฐ ๋ณ๊ฒฝ๋์์ต๋๋ค. GPT2 ๊ธฐ๋ฐ ํ ํฌ๋์ด์ ๋์ , ์ด์ ๋ [์ผํ
์คํผ์ค ๊ธฐ๋ฐ](https://github.com/google/sentencepiece) ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+- **nGiE[n๊ทธ๋จ ์ ๋(Induced) ์
๋ ฅ ์ธ์ฝ๋ฉ]** DeBERTa-v2 ๋ชจ๋ธ์ ์
๋ ฅ ํ ํฐ๋ค์ ์ง์ญ์ ์์กด์ฑ์ ๋ ์ ํ์ตํ๊ธฐ ์ํด ์ฒซ ๋ฒ์งธ ํธ๋์คํฌ๋จธ ์ธต๊ณผ ํจ๊ป ์ถ๊ฐ์ ์ธ ํฉ์ฑ๊ณฑ ์ธต์ ์ฌ์ฉํฉ๋๋ค.
+- **์ดํ
์
์ธต์์ ์์น ํฌ์ ํ๋ ฌ๊ณผ ๋ด์ฉ ํฌ์ ํ๋ ฌ ๊ณต์ ** ์ด์ ์คํ๋ค์ ๊ธฐ๋ฐ์ผ๋ก, ์ด๋ ์ฑ๋ฅ์ ์ํฅ์ ์ฃผ์ง ์์ผ๋ฉด์ ๋งค๊ฐ๋ณ์๋ฅผ ์ ์ฝํ ์ ์์ต๋๋ค.
+- **์๋์ ์์น๋ฅผ ์ธ์ฝ๋ฉํ๊ธฐ ์ํ ๋ฒํท ์ ์ฉ** DeBERTa-v2 ๋ชจ๋ธ์ T5์ ์ ์ฌํ๊ฒ ์๋์ ์์น๋ฅผ ์ธ์ฝ๋ฉํ๊ธฐ ์ํด ๋ก๊ทธ ๋ฒํท์ ์ฌ์ฉํฉ๋๋ค.
+- **900M ๋ชจ๋ธ & 1.5B ๋ชจ๋ธ** 900M๊ณผ 1.5B, ๋ ๊ฐ์ง ์ถ๊ฐ ๋ชจ๋ธ ํฌ๊ธฐ๊ฐ ์ ๊ณต๋๋ฉฐ, ์ด๋ ๋ค์ด์คํธ๋ฆผ ์์
์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์ํต๋๋ค.
+
+[DeBERTa](https://huggingface.co/DeBERTa) ๋ชจ๋ธ์ ํ
์ํ๋ก 2.0 ๊ตฌํ์ [kamalkraj](https://huggingface.co/kamalkraj)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/microsoft/DeBERTa)์์ ํ์ธํ์ค ์ ์์ต๋๋ค.
+
+## ์๋ฃ
+
+- [ํ
์คํธ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/sequence_classification)
+- [ํ ํฐ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/token_classification)
+- [์ง์์๋ต ์์
๊ฐ์ด๋](../tasks/question_answering)
+- [๋ง์คํฌ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/masked_language_modeling)
+- [๋ค์ค ์ ํ ์์
๊ฐ์ด๋](../tasks/multiple_choice)
+
+## DebertaV2Config
+
+[[autodoc]] DebertaV2Config
+
+## DebertaV2Tokenizer
+
+[[autodoc]] DebertaV2Tokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## DebertaV2TokenizerFast
+
+[[autodoc]] DebertaV2TokenizerFast
+ - build_inputs_with_special_tokens
+ - create_token_type_ids_from_sequences
+
+
+
+
+## DebertaV2Model
+
+[[autodoc]] DebertaV2Model
+ - forward
+
+## DebertaV2PreTrainedModel
+
+[[autodoc]] DebertaV2PreTrainedModel
+ - forward
+
+## DebertaV2ForMaskedLM
+
+[[autodoc]] DebertaV2ForMaskedLM
+ - forward
+
+## DebertaV2ForSequenceClassification
+
+[[autodoc]] DebertaV2ForSequenceClassification
+ - forward
+
+## DebertaV2ForTokenClassification
+
+[[autodoc]] DebertaV2ForTokenClassification
+ - forward
+
+## DebertaV2ForQuestionAnswering
+
+[[autodoc]] DebertaV2ForQuestionAnswering
+ - forward
+
+## DebertaV2ForMultipleChoice
+
+[[autodoc]] DebertaV2ForMultipleChoice
+ - forward
+
+
+
+
+## TFDebertaV2Model
+
+[[autodoc]] TFDebertaV2Model
+ - call
+
+## TFDebertaV2PreTrainedModel
+
+[[autodoc]] TFDebertaV2PreTrainedModel
+ - call
+
+## TFDebertaV2ForMaskedLM
+
+[[autodoc]] TFDebertaV2ForMaskedLM
+ - call
+
+## TFDebertaV2ForSequenceClassification
+
+[[autodoc]] TFDebertaV2ForSequenceClassification
+ - call
+
+## TFDebertaV2ForTokenClassification
+
+[[autodoc]] TFDebertaV2ForTokenClassification
+ - call
+
+## TFDebertaV2ForQuestionAnswering
+
+[[autodoc]] TFDebertaV2ForQuestionAnswering
+ - call
+
+## TFDebertaV2ForMultipleChoice
+
+[[autodoc]] TFDebertaV2ForMultipleChoice
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/deberta.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/deberta.md
new file mode 100644
index 0000000000000000000000000000000000000000..6f82bed033a0e063b80210a71325741868fdc994
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/deberta.md
@@ -0,0 +1,152 @@
+
+
+# DeBERTa[[deberta]]
+
+## ๊ฐ์[[overview]]
+
+
+DeBERTa ๋ชจ๋ธ์ Pengcheng He, Xiaodong Liu, Jianfeng Gao, Weizhu Chen์ด ์์ฑํ [DeBERTa: ๋ถ๋ฆฌ๋ ์ดํ
์
์ ํ์ฉํ ๋์ฝ๋ฉ ๊ฐํ BERT](https://arxiv.org/abs/2006.03654)์ด๋ผ๋ ๋
ผ๋ฌธ์์ ์ ์๋์์ต๋๋ค. ์ด ๋ชจ๋ธ์ 2018๋
Google์ด ๋ฐํํ BERT ๋ชจ๋ธ๊ณผ 2019๋
Facebook์ด ๋ฐํํ RoBERTa ๋ชจ๋ธ์ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค.
+DeBERTa๋ RoBERTa์์ ์ฌ์ฉ๋ ๋ฐ์ดํฐ์ ์ ๋ฐ๋ง์ ์ฌ์ฉํ์ฌ ๋ถ๋ฆฌ๋(disentangled) ์ดํ
์
๊ณผ ํฅ์๋ ๋ง์คํฌ ๋์ฝ๋ ํ์ต์ ํตํด RoBERTa๋ฅผ ๊ฐ์ ํ์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ฌ์ ํ์ต๋ ์ ๊ฒฝ๋ง ์ธ์ด ๋ชจ๋ธ์ ์ต๊ทผ ๋ฐ์ ์ ๋ง์ ์์ฐ์ด ์ฒ๋ฆฌ(NLP) ์์
์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์์ผฐ์ต๋๋ค. ๋ณธ ๋
ผ๋ฌธ์์๋ ๋ ๊ฐ์ง ์๋ก์ด ๊ธฐ์ ์ ์ฌ์ฉํ์ฌ BERT์ RoBERTa ๋ชจ๋ธ์ ๊ฐ์ ํ ์๋ก์ด ๋ชจ๋ธ ๊ตฌ์กฐ์ธ DeBERTa๋ฅผ ์ ์ํฉ๋๋ค. ์ฒซ ๋ฒ์งธ๋ ๋ถ๋ฆฌ๋ ์ดํ
์
๋ฉ์ปค๋์ฆ์ผ๋ก, ๊ฐ ๋จ์ด๊ฐ ๋ด์ฉ๊ณผ ์์น๋ฅผ ๊ฐ๊ฐ ์ธ์ฝ๋ฉํ๋ ๋ ๊ฐ์ ๋ฒกํฐ๋ก ํํ๋๋ฉฐ, ๋จ์ด๋ค ๊ฐ์ ์ดํ
์
๊ฐ์ค์น๋ ๋ด์ฉ๊ณผ ์๋์ ์์น์ ๋ํ ๋ถ๋ฆฌ๋ ํ๋ ฌ์ ์ฌ์ฉํ์ฌ ๊ณ์ฐ๋ฉ๋๋ค. ๋ ๋ฒ์งธ๋ก, ๋ชจ๋ธ ์ฌ์ ํ์ต์ ์ํด ๋ง์คํน๋ ํ ํฐ์ ์์ธกํ๋ ์ถ๋ ฅ ์ํํธ๋งฅ์ค ์ธต์ ๋์ฒดํ๋ ํฅ์๋ ๋ง์คํฌ ๋์ฝ๋๊ฐ ์ฌ์ฉ๋ฉ๋๋ค. ์ฐ๋ฆฌ๋ ์ด ๋ ๊ฐ์ง ๊ธฐ์ ์ด ๋ชจ๋ธ ์ฌ์ ํ์ต์ ํจ์จ์ฑ๊ณผ ๋ค์ด์คํธ๋ฆผ ์์
์ ์ฑ๋ฅ์ ํฌ๊ฒ ํฅ์์ํจ๋ค๋ ๊ฒ์ ๋ณด์ฌ์ค๋๋ค. RoBERTa-Large์ ๋น๊ตํ์ ๋, ์ ๋ฐ์ ํ์ต ๋ฐ์ดํฐ๋ก ํ์ต๋ DeBERTa ๋ชจ๋ธ์ ๊ด๋ฒ์ํ NLP ์์
์์ ์ผ๊ด๋๊ฒ ๋ ๋์ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ๋ฉฐ, MNLI์์ +0.9%(90.2% vs 91.1%), SQuAD v2.0์์ +2.3%(88.4% vs 90.7%), RACE์์ +3.6%(83.2% vs 86.8%)์ ์ฑ๋ฅ ํฅ์์ ๋ฌ์ฑํ์ต๋๋ค. DeBERTa ์ฝ๋์ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ https://github.com/microsoft/DeBERTa ์์ ๊ณต๊ฐ๋ ์์ ์
๋๋ค.*
+
+[DeBERTa](https://huggingface.co/DeBERTa) ๋ชจ๋ธ์ ํ
์ํ๋ก 2.0 ๊ตฌํ์ [kamalkraj](https://huggingface.co/kamalkraj)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/microsoft/DeBERTa)์์ ํ์ธํ์ค ์ ์์ต๋๋ค.
+
+## ๋ฆฌ์์ค[[resources]]
+
+
+DeBERTa๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค. ์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐํด ๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+
+
+
+- DeBERTa์ [DeepSpeed๋ฅผ ์ด์ฉํด์ ๋ํ ๋ชจ๋ธ ํ์ต์ ๊ฐ์์ํค๋](https://huggingface.co/blog/accelerate-deepspeed) ๋ฐฉ๋ฒ์ ๋ํ ํฌ์คํธ.
+- DeBERTa์ [๋จธ์ ๋ฌ๋์ผ๋ก ํ์ธต ํฅ์๋ ๊ณ ๊ฐ ์๋น์ค](https://huggingface.co/blog/supercharge-customer-service-with-machine-learning)์ ๋ํ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+- [`DebertaForSequenceClassification`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb)์์ ์ง์๋ฉ๋๋ค.
+- [`TFDebertaForSequenceClassification`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb)์์ ์ง์๋ฉ๋๋ค.
+- [ํ
์คํธ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/sequence_classification)
+
+
+
+- [`DebertaForTokenClassification`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification)์ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb)์์ ์ง์ํฉ๋๋ค.
+- [`TFDebertaForTokenClassification`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์ํฉ๋๋ค.
+- ๐ค Hugging Face ์ฝ์ค์ [ํ ํฐ ๋ถ๋ฅ](https://huggingface.co/course/chapter7/2?fw=pt) ์ฅ.
+- ๐ค Hugging Face ์ฝ์ค์ [BPE(Byte-Pair Encoding) ํ ํฐํ](https://huggingface.co/course/chapter6/5?fw=pt) ์ฅ.
+- [ํ ํฐ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/token_classification)
+
+
+
+- [`DebertaForMaskedLM`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์ํฉ๋๋ค.
+- [`TFDebertaForMaskedLM`]์ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์ํฉ๋๋ค.
+- ๐ค Hugging Face ์ฝ์ค์ [๋ง์คํฌ ์ธ์ด ๋ชจ๋ธ๋ง](https://huggingface.co/course/chapter7/3?fw=pt) ์ฅ.
+- [๋ง์คํฌ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/masked_language_modeling)
+
+
+
+- [`DebertaForQuestionAnswering`]์ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์ํฉ๋๋ค.
+- [`TFDebertaForQuestionAnswering`]๋ ์ด [์์ ์คํฌ๋ฆฝํธ](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)์์ ์ง์ํฉ๋๋ค.
+- ๐ค Hugging Face ์ฝ์ค์ [์ง์์๋ต(Question answering)](https://huggingface.co/course/chapter7/7?fw=pt) ์ฅ.
+- [์ง์์๋ต ์์
๊ฐ์ด๋](../tasks/question_answering)
+
+## DebertaConfig[[transformers.DebertaConfig]]
+
+[[autodoc]] DebertaConfig
+
+## DebertaTokenizer[[transformers.DebertaTokenizer]]
+
+[[autodoc]] DebertaTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## DebertaTokenizerFast[[transformers.DebertaTokenizerFast]]
+
+[[autodoc]] DebertaTokenizerFast
+ - build_inputs_with_special_tokens
+ - create_token_type_ids_from_sequences
+
+
+
+
+## DebertaModel[[transformers.DebertaModel]]
+
+[[autodoc]] DebertaModel
+ - forward
+
+## DebertaPreTrainedModel[[transformers.DebertaPreTrainedModel]]
+
+[[autodoc]] DebertaPreTrainedModel
+
+## DebertaForMaskedLM[[transformers.DebertaForMaskedLM]]
+
+[[autodoc]] DebertaForMaskedLM
+ - forward
+
+## DebertaForSequenceClassification[[transformers.DebertaForSequenceClassification]]
+
+[[autodoc]] DebertaForSequenceClassification
+ - forward
+
+## DebertaForTokenClassification[[transformers.DebertaForTokenClassification]]
+
+[[autodoc]] DebertaForTokenClassification
+ - forward
+
+## DebertaForQuestionAnswering[[transformers.DebertaForQuestionAnswering]]
+
+[[autodoc]] DebertaForQuestionAnswering
+ - forward
+
+
+
+
+## TFDebertaModel[[transformers.TFDebertaModel]]
+
+[[autodoc]] TFDebertaModel
+ - call
+
+## TFDebertaPreTrainedModel[[transformers.TFDebertaPreTrainedModel]]
+
+[[autodoc]] TFDebertaPreTrainedModel
+ - call
+
+## TFDebertaForMaskedLM[[transformers.TFDebertaForMaskedLM]]
+
+[[autodoc]] TFDebertaForMaskedLM
+ - call
+
+## TFDebertaForSequenceClassification[[transformers.TFDebertaForSequenceClassification]]
+
+[[autodoc]] TFDebertaForSequenceClassification
+ - call
+
+## TFDebertaForTokenClassification[[transformers.TFDebertaForTokenClassification]]
+
+[[autodoc]] TFDebertaForTokenClassification
+ - call
+
+## TFDebertaForQuestionAnswering[[transformers.TFDebertaForQuestionAnswering]]
+
+[[autodoc]] TFDebertaForQuestionAnswering
+ - call
+
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/encoder-decoder.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/encoder-decoder.md
new file mode 100644
index 0000000000000000000000000000000000000000..c5c553561395361bf2ea588f50a5bb3756d213a8
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/encoder-decoder.md
@@ -0,0 +1,167 @@
+
+
+# ์ธ์ฝ๋-๋์ฝ๋ ๋ชจ๋ธ[[Encoder Decoder Models]]
+
+## ๊ฐ์[[Overview]]
+
+[`EncoderDecoderModel`]์ ์ฌ์ ํ์ต๋ ์๋ ์ธ์ฝ๋ฉ(autoencoding) ๋ชจ๋ธ์ ์ธ์ฝ๋๋ก, ์ฌ์ ํ์ต๋ ์๊ฐ ํ๊ท(autoregressive) ๋ชจ๋ธ์ ๋์ฝ๋๋ก ํ์ฉํ์ฌ ์ํ์ค-ํฌ-์ํ์ค(sequence-to-sequence) ๋ชจ๋ธ์ ์ด๊ธฐํํ๋ ๋ฐ ์ด์ฉ๋ฉ๋๋ค.
+
+์ฌ์ ํ์ต๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ํ์ฉํด ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ์ ์ด๊ธฐํํ๋ ๊ฒ์ด ์ํ์ค ์์ฑ(sequence generation) ์์
์ ํจ๊ณผ์ ์ด๋ผ๋ ์ ์ด Sascha Rothe, Shashi Narayan, Aliaksei Severyn์ ๋
ผ๋ฌธ [Leveraging Pre-trained Checkpoints for Sequence Generation Tasks](https://arxiv.org/abs/1907.12461)์์ ์
์ฆ๋์์ต๋๋ค.
+
+[`EncoderDecoderModel`]์ด ํ์ต/๋ฏธ์ธ ์กฐ์ ๋ ํ์๋ ๋ค๋ฅธ ๋ชจ๋ธ๊ณผ ๋ง์ฐฌ๊ฐ์ง๋ก ์ ์ฅ/๋ถ๋ฌ์ค๊ธฐ๊ฐ ๊ฐ๋ฅํฉ๋๋ค. ์์ธํ ์ฌ์ฉ๋ฒ์ ์์ ๋ฅผ ์ฐธ๊ณ ํ์ธ์.
+
+์ด ์ํคํ
์ฒ์ ํ ๊ฐ์ง ์์ฉ ์ฌ๋ก๋ ๋ ๊ฐ์ ์ฌ์ ํ์ต๋ [`BertModel`]์ ๊ฐ๊ฐ ์ธ์ฝ๋์ ๋์ฝ๋๋ก ํ์ฉํ์ฌ ์์ฝ ๋ชจ๋ธ(summarization model)์ ๊ตฌ์ถํ๋ ๊ฒ์
๋๋ค. ์ด๋ Yang Liu์ Mirella Lapata์ ๋
ผ๋ฌธ [Text Summarization with Pretrained Encoders](https://arxiv.org/abs/1908.08345)์์ ์ ์๋ ๋ฐ ์์ต๋๋ค.
+
+## ๋ชจ๋ธ ์ค์ ์์ `EncoderDecoderModel`์ ๋ฌด์์ ์ด๊ธฐํํ๊ธฐ[[Randomly initializing `EncoderDecoderModel` from model configurations.]]
+
+[`EncoderDecoderModel`]์ ์ธ์ฝ๋์ ๋์ฝ๋ ์ค์ (config)์ ๊ธฐ๋ฐ์ผ๋ก ๋ฌด์์ ์ด๊ธฐํ๋ฅผ ํ ์ ์์ต๋๋ค. ์๋ ์์๋ [`BertModel`] ์ค์ ์ ์ธ์ฝ๋๋ก, ๊ธฐ๋ณธ [`BertForCausalLM`] ์ค์ ์ ๋์ฝ๋๋ก ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค.
+
+```python
+>>> from transformers import BertConfig, EncoderDecoderConfig, EncoderDecoderModel
+
+>>> config_encoder = BertConfig()
+>>> config_decoder = BertConfig()
+
+>>> config = EncoderDecoderConfig.from_encoder_decoder_configs(config_encoder, config_decoder)
+>>> model = EncoderDecoderModel(config=config)
+```
+
+## ์ฌ์ ํ์ต๋ ์ธ์ฝ๋์ ๋์ฝ๋๋ก `EncoderDecoderModel` ์ด๊ธฐํํ๊ธฐ[[Initialising `EncoderDecoderModel` from a pretrained encoder and a pretrained decoder.]]
+
+[`EncoderDecoderModel`]์ ์ฌ์ ํ์ต๋ ์ธ์ฝ๋ ์ฒดํฌํฌ์ธํธ์ ์ฌ์ ํ์ต๋ ๋์ฝ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ์ฉํด ์ด๊ธฐํํ ์ ์์ต๋๋ค. BERT์ ๊ฐ์ ๋ชจ๋ ์ฌ์ ํ์ต๋ ์๋ ์ธ์ฝ๋ฉ(auto-encoding) ๋ชจ๋ธ์ ์ธ์ฝ๋๋ก ํ์ฉํ ์ ์์ผ๋ฉฐ, GPT2์ ๊ฐ์ ์๊ฐ ํ๊ท(autoregressive) ๋ชจ๋ธ์ด๋ BART์ ๋์ฝ๋์ ๊ฐ์ด ์ฌ์ ํ์ต๋ ์ํ์ค-ํฌ-์ํ์ค ๋์ฝ๋ ๋ชจ๋ธ์ ๋์ฝ๋๋ก ์ฌ์ฉํ ์ ์์ต๋๋ค. ๋์ฝ๋๋ก ์ ํํ ์ํคํ
์ฒ์ ๋ฐ๋ผ ๊ต์ฐจ ์ดํ
์
(cross-attention) ๋ ์ด์ด๊ฐ ๋ฌด์์๋ก ์ด๊ธฐํ๋ ์ ์์ต๋๋ค. ์ฌ์ ํ์ต๋ ์ธ์ฝ๋์ ๋์ฝ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ด์ฉํด [`EncoderDecoderModel`]์ ์ด๊ธฐํํ๋ ค๋ฉด, ๋ชจ๋ธ์ ๋ค์ด์คํธ๋ฆผ ์์
์ ๋ํด ๋ฏธ์ธ ์กฐ์ (fine-tuning)ํด์ผ ํฉ๋๋ค. ์ด์ ๋ํ ์์ธํ ๋ด์ฉ์ [the *Warm-starting-encoder-decoder blog post*](https://huggingface.co/blog/warm-starting-encoder-decoder)์ ์ค๋ช
๋์ด ์์ต๋๋ค. ์ด ์์
์ ์ํด `EncoderDecoderModel` ํด๋์ค๋ [`EncoderDecoderModel.from_encoder_decoder_pretrained`] ๋ฉ์๋๋ฅผ ์ ๊ณตํฉ๋๋ค.
+
+
+```python
+>>> from transformers import EncoderDecoderModel, BertTokenizer
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+>>> model = EncoderDecoderModel.from_encoder_decoder_pretrained("google-bert/bert-base-uncased", "google-bert/bert-base-uncased")
+```
+
+## ๊ธฐ์กด `EncoderDecoderModel` ์ฒดํฌํฌ์ธํธ ๋ถ๋ฌ์ค๊ธฐ ๋ฐ ์ถ๋ก ํ๊ธฐ[[Loading an existing `EncoderDecoderModel` checkpoint and perform inference.]]
+
+`EncoderDecoderModel` ํด๋์ค์ ๋ฏธ์ธ ์กฐ์ (fine-tuned)๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ถ๋ฌ์ค๋ ค๋ฉด, Transformers์ ๋ค๋ฅธ ๋ชจ๋ธ ์ํคํ
์ฒ์ ๋ง์ฐฌ๊ฐ์ง๋ก [`EncoderDecoderModel`]์์ ์ ๊ณตํ๋ `from_pretrained(...)`๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+์ถ๋ก ์ ์ํํ๋ ค๋ฉด [`generate`] ๋ฉ์๋๋ฅผ ํ์ฉํ์ฌ ํ
์คํธ๋ฅผ ์๋ ํ๊ท(autoregressive) ๋ฐฉ์์ผ๋ก ์์ฑํ ์ ์์ต๋๋ค. ์ด ๋ฉ์๋๋ ํ์ ๋์ฝ๋ฉ(greedy decoding), ๋น ์์น(beam search), ๋คํญ ์ํ๋ง(multinomial sampling) ๋ฑ ๋ค์ํ ๋์ฝ๋ฉ ๋ฐฉ์์ ์ง์ํฉ๋๋ค.
+
+```python
+>>> from transformers import AutoTokenizer, EncoderDecoderModel
+
+>>> # ๋ฏธ์ธ ์กฐ์ ๋ seq2seq ๋ชจ๋ธ๊ณผ ๋์ํ๋ ํ ํฌ๋์ด์ ๊ฐ์ ธ์ค๊ธฐ
+>>> model = EncoderDecoderModel.from_pretrained("patrickvonplaten/bert2bert_cnn_daily_mail")
+>>> tokenizer = AutoTokenizer.from_pretrained("patrickvonplaten/bert2bert_cnn_daily_mail")
+
+>>> # let's perform inference on a long piece of text
+>>> ARTICLE_TO_SUMMARIZE = (
+... "PG&E stated it scheduled the blackouts in response to forecasts for high winds "
+... "amid dry conditions. The aim is to reduce the risk of wildfires. Nearly 800 thousand customers were "
+... "scheduled to be affected by the shutoffs which were expected to last through at least midday tomorrow."
+... )
+>>> input_ids = tokenizer(ARTICLE_TO_SUMMARIZE, return_tensors="pt").input_ids
+
+>>> # ์๊ธฐํ๊ท์ ์ผ๋ก ์์ฝ ์์ฑ (๊ธฐ๋ณธ์ ์ผ๋ก ๊ทธ๋ฆฌ๋ ๋์ฝ๋ฉ ์ฌ์ฉ)
+>>> generated_ids = model.generate(input_ids)
+>>> generated_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
+>>> print(generated_text)
+nearly 800 thousand customers were affected by the shutoffs. the aim is to reduce the risk of wildfires. nearly 800, 000 customers were expected to be affected by high winds amid dry conditions. pg & e said it scheduled the blackouts to last through at least midday tomorrow.
+```
+
+## `TFEncoderDecoderModel`์ Pytorch ์ฒดํฌํฌ์ธํธ ๋ถ๋ฌ์ค๊ธฐ[[Loading a PyTorch checkpoint into `TFEncoderDecoderModel`.]]
+
+[`TFEncoderDecoderModel.from_pretrained`] ๋ฉ์๋๋ ํ์ฌ Pytorch ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ์ฉํ ๋ชจ๋ธ ์ด๊ธฐํ๋ฅผ ์ง์ํ์ง ์์ต๋๋ค. ์ด ๋ฉ์๋์ `from_pt=True`๋ฅผ ์ ๋ฌํ๋ฉด ์์ธ(exception)๊ฐ ๋ฐ์ํฉ๋๋ค. ํน์ ์ธ์ฝ๋-๋์ฝ๋ ๋ชจ๋ธ์ ๋ํ Pytorch ์ฒดํฌํฌ์ธํธ๋ง ์กด์ฌํ๋ ๊ฒฝ์ฐ, ๋ค์๊ณผ ๊ฐ์ ํด๊ฒฐ ๋ฐฉ๋ฒ์ ์ฌ์ฉํ ์ ์์ต๋๋ค:
+
+```python
+>>> # ํ์ดํ ์น ์ฒดํฌํฌ์ธํธ์์ ๋ก๋ํ๋ ํด๊ฒฐ ๋ฐฉ๋ฒ
+>>> from transformers import EncoderDecoderModel, TFEncoderDecoderModel
+
+>>> _model = EncoderDecoderModel.from_pretrained("patrickvonplaten/bert2bert-cnn_dailymail-fp16")
+
+>>> _model.encoder.save_pretrained("./encoder")
+>>> _model.decoder.save_pretrained("./decoder")
+
+>>> model = TFEncoderDecoderModel.from_encoder_decoder_pretrained(
+... "./encoder", "./decoder", encoder_from_pt=True, decoder_from_pt=True
+... )
+>>> # ์ด ๋ถ๋ถ์ ํน์ ๋ชจ๋ธ์ ๊ตฌ์ฒด์ ์ธ ์ธ๋ถ์ฌํญ์ ๋ณต์ฌํ ๋์๋ง ์ฌ์ฉํฉ๋๋ค.
+>>> model.config = _model.config
+```
+
+## ํ์ต[[Training]]
+
+๋ชจ๋ธ์ด ์์ฑ๋ ํ์๋ BART, T5 ๋๋ ๊ธฐํ ์ธ์ฝ๋-๋์ฝ๋ ๋ชจ๋ธ๊ณผ ์ ์ฌํ ๋ฐฉ์์ผ๋ก ๋ฏธ์ธ ์กฐ์ (fine-tuning)ํ ์ ์์ต๋๋ค.
+๋ณด์๋ค์ํผ, ์์ค(loss)์ ๊ณ์ฐํ๋ ค๋ฉด ๋จ 2๊ฐ์ ์
๋ ฅ๋ง ํ์ํฉ๋๋ค: `input_ids`(์
๋ ฅ ์ํ์ค๋ฅผ ์ธ์ฝ๋ฉํ `input_ids`)์ `labels`(๋ชฉํ ์ํ์ค๋ฅผ ์ธ์ฝ๋ฉํ `input_ids`).
+
+```python
+>>> from transformers import BertTokenizer, EncoderDecoderModel
+
+>>> tokenizer = BertTokenizer.from_pretrained("google-bert/bert-base-uncased")
+>>> model = EncoderDecoderModel.from_encoder_decoder_pretrained("google-bert/bert-base-uncased", "google-bert/bert-base-uncased")
+
+>>> model.config.decoder_start_token_id = tokenizer.cls_token_id
+>>> model.config.pad_token_id = tokenizer.pad_token_id
+
+>>> input_ids = tokenizer(
+... "The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side.During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, 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, it is now taller than the Chrysler Building by 5.2 metres (17 ft).Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.",
+... return_tensors="pt",
+... ).input_ids
+
+>>> labels = tokenizer(
+... "the eiffel tower surpassed the washington monument to become the tallest structure in the world. it was the first structure to reach a height of 300 metres in paris in 1930. it is now taller than the chrysler building by 5. 2 metres ( 17 ft ) and is the second tallest free - standing structure in paris.",
+... return_tensors="pt",
+... ).input_ids
+
+>>> # forward ํจ์๊ฐ ์๋์ผ๋ก ์ ํฉํ decoder_input_ids๋ฅผ ์์ฑํฉ๋๋ค.
+>>> loss = model(input_ids=input_ids, labels=labels).loss
+```
+ํ๋ จ์ ๋ํ ์์ธํ ๋ด์ฉ์ [colab](https://colab.research.google.com/drive/1WIk2bxglElfZewOHboPFNj8H44_VAyKE?usp=sharing#scrollTo=ZwQIEhKOrJpl) ๋
ธํธ๋ถ์ ์ฐธ์กฐํ์ธ์.
+
+์ด ๋ชจ๋ธ์ [thomwolf](https://github.com/thomwolf)๊ฐ ๊ธฐ์ฌํ์ผ๋ฉฐ, ์ด ๋ชจ๋ธ์ ๋ํ TensorFlow ๋ฐ Flax ๋ฒ์ ์ [ydshieh](https://github.com/ydshieh)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค.
+
+
+## EncoderDecoderConfig
+
+[[autodoc]] EncoderDecoderConfig
+
+
+
+
+## EncoderDecoderModel
+
+[[autodoc]] EncoderDecoderModel
+ - forward
+ - from_encoder_decoder_pretrained
+
+
+
+
+## TFEncoderDecoderModel
+
+[[autodoc]] TFEncoderDecoderModel
+ - call
+ - from_encoder_decoder_pretrained
+
+
+
+
+## FlaxEncoderDecoderModel
+
+[[autodoc]] FlaxEncoderDecoderModel
+ - __call__
+ - from_encoder_decoder_pretrained
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/esm.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/esm.md
new file mode 100644
index 0000000000000000000000000000000000000000..6ea1191dabe0bae8306f981b7bffe9dfd8edbd94
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/esm.md
@@ -0,0 +1,115 @@
+
+
+# ESM [[esm]]
+
+## ๊ฐ์ [[overview]]
+
+์ด ํ์ด์ง๋ Meta AI์ Fundamental AI Research ํ์์ ์ ๊ณตํ๋ Transformer ๋จ๋ฐฑ์ง ์ธ์ด ๋ชจ๋ธ์ ๋ํ ์ฝ๋์ ์ฌ์ ํ๋ จ๋ ๊ฐ์ค์น๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ฌ๊ธฐ์๋ ์ต์ฒจ๋จ์ธ ESMFold์ ESM-2, ๊ทธ๋ฆฌ๊ณ ์ด์ ์ ๊ณต๊ฐ๋ ESM-1b์ ESM-1v๊ฐ ํฌํจ๋ฉ๋๋ค. Transformer ๋จ๋ฐฑ์ง ์ธ์ด ๋ชจ๋ธ์ Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott, C. Lawrence Zitnick, Jerry Ma, Rob Fergus์ ๋
ผ๋ฌธ [Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences](https://www.pnas.org/content/118/15/e2016239118)์์ ์๊ฐ๋์์ต๋๋ค. ์ด ๋
ผ๋ฌธ์ ์ฒซ ๋ฒ์งธ ๋ฒ์ ์ 2019๋
์ [์ถํ ์ ๋
ผ๋ฌธ](https://www.biorxiv.org/content/10.1101/622803v1?versioned=true) ํํ๋ก ๊ณต๊ฐ๋์์ต๋๋ค.
+
+ESM-2๋ ๋ค์ํ ๊ตฌ์กฐ ์์ธก ์์
์์ ํ
์คํธ๋ ๋ชจ๋ ๋จ์ผ ์ํ์ค ๋จ๋ฐฑ์ง ์ธ์ด ๋ชจ๋ธ์ ๋ฅ๊ฐํ๋ฉฐ, ์์ ์์ค์ ๊ตฌ์กฐ ์์ธก์ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. ์ด ๋ชจ๋ธ์ Zeming Lin, Halil Akin, Roshan Rao, Brian Hie, Zhongkai Zhu, Wenting Lu, Allan dos Santos Costa, Maryam Fazel-Zarandi, Tom Sercu, Sal Candido, Alexander Rives์ ๋
ผ๋ฌธ [Language models of protein sequences at the scale of evolution enable accurate structure prediction](https://doi.org/10.1101/2022.07.20.500902)์์ ๊ณต๊ฐ๋์์ต๋๋ค.
+
+์ด ๋
ผ๋ฌธ์์ ํจ๊ป ์๊ฐ๋ ESMFold๋ ESM-2 ์คํ
์ ์ฌ์ฉํ๋ฉฐ, ์ต์ฒจ๋จ์ ์ ํ๋๋ก ๋จ๋ฐฑ์ง ์ ํ ๊ตฌ์กฐ๋ฅผ ์์ธกํ ์ ์๋ ํค๋๋ฅผ ๊ฐ์ถ๊ณ ์์ต๋๋ค. [AlphaFold2](https://www.nature.com/articles/s41586-021-03819-2)์ ๋ฌ๋ฆฌ, ์ด๋ ๋ํ ์ฌ์ ํ๋ จ๋ ๋จ๋ฐฑ์ง ์ธ์ด ๋ชจ๋ธ ์คํ
์ ํ ํฐ ์๋ฒ ๋ฉ์ ์์กดํ๋ฉฐ, ์ถ๋ก ์ ๋ค์ค ์ํ์ค ์ ๋ ฌ(MSA) ๋จ๊ณ๋ฅผ ์ํํ์ง ์์ต๋๋ค. ์ด๋ ESMFold ์ฒดํฌํฌ์ธํธ๊ฐ ์์ ํ "๋
๋ฆฝ์ "์ด๋ฉฐ, ์์ธก์ ์ํด ์๋ ค์ง ๋จ๋ฐฑ์ง ์ํ์ค์ ๊ตฌ์กฐ์ ๋ฐ์ดํฐ๋ฒ ์ด์ค, ๊ทธ๋ฆฌ๊ณ ๊ทธ์ ๊ด๋ จ ์ธ๋ถ ์ฟผ๋ฆฌ ๋๊ตฌ๋ฅผ ํ์๋ก ํ์ง ์๋๋ค๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ๊ทธ ๊ฒฐ๊ณผ, ํจ์ฌ ๋น ๋ฆ
๋๋ค.
+
+"Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences"์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ธ๊ณต์ง๋ฅ ๋ถ์ผ์์๋ ๋๊ท๋ชจ์ ๋ฐ์ดํฐ์ ๋ชจ๋ธ ์ฉ๋์ ๊ฐ์ถ ๋น์ง๋ ํ์ต์ ์กฐํฉ์ด ํํ ํ์ต๊ณผ ํต๊ณ์ ์์ฑ์์ ์ฃผ์ํ ๋ฐ์ ์ ์ด๋์ด๋์ต๋๋ค. ์๋ช
๊ณผํ์์๋ ์ํ์ฑ ๊ธฐ์ ์ ์ฑ์ฅ์ด ์์๋๋ฉฐ, ์์ฐ ์ํ์ค ๋ค์์ฑ์ ๋ํ ์ ๋ก ์๋ ๋ฐ์ดํฐ๊ฐ ๋์ฌ ๊ฒ์ผ๋ก ๊ธฐ๋๋ฉ๋๋ค. ์งํ์ ๋จ๊ณ์์ ๋ณผ ๋, ๋จ๋ฐฑ์ง ์ธ์ด ๋ชจ๋ธ๋ง์ ์๋ฌผํ์ ์ํ ์์ธก ๋ฐ ์์ฑ ์ธ๊ณต์ง๋ฅ์ ํฅํ ๋
ผ๋ฆฌ์ ์ธ ๋จ๊ณ์ ์์ต๋๋ค. ์ด๋ฅผ ์ํด ์ฐ๋ฆฌ๋ ์งํ์ ๋ค์์ฑ์ ์์ฐ๋ฅด๋ 2์ต 5์ฒ๋ง ๊ฐ์ ๋จ๋ฐฑ์ง ์ํ์ค์์ ์ถ์ถํ 860์ต ๊ฐ์ ์๋ฏธ๋
ธ์ฐ์ ๋ํด ์ฌ์ธต ์ปจํ
์คํธ ์ธ์ด ๋ชจ๋ธ์ ๋น์ง๋ ํ์ต์ผ๋ก ํ๋ จํฉ๋๋ค. ๊ทธ ๊ฒฐ๊ณผ ๋ชจ๋ธ์ ๊ทธ ํํ์์ ์๋ฌผํ์ ์์ฑ์ ๋ํ ์ ๋ณด๋ฅผ ํฌํจํฉ๋๋ค. ์ด ํํ์ ์ํ์ค ๋ฐ์ดํฐ๋ง์ผ๋ก ํ์ต๋ฉ๋๋ค. ํ์ต๋ ํํ ๊ณต๊ฐ์ ์๋ฏธ๋
ธ์ฐ์ ์ํํ์ ํน์ฑ ์์ค์์๋ถํฐ ๋จ๋ฐฑ์ง์ ์๊ฑฐ๋ฆฌ ์๋์ฑ๊น์ง ๊ตฌ์กฐ๋ฅผ ๋ฐ์ํ๋ ๋ค์ค ๊ท๋ชจ์ ์กฐ์ง์ ๊ฐ์ง๊ณ ์์ต๋๋ค. ์ด ํํ์๋ 2์ฐจ ๋ฐ 3์ฐจ ๊ตฌ์กฐ์ ๋ํ ์ ๋ณด๊ฐ ์ธ์ฝ๋ฉ๋์ด ์์ผ๋ฉฐ, ์ ํ ์ ์ฌ์ ์ํด ์๋ณ ๋ ์ ์์ต๋๋ค. ํํ ํ์ต์ ๋์ฐ๋ณ์ด์ ์ํ ํจ๊ณผ์ 2์ฐจ ๊ตฌ์กฐ์ ์ต์ฒจ๋จ ์ง๋ ์์ธก์ ๊ฐ๋ฅํ๊ฒ ํ๊ณ , ๋์ ๋ฒ์์ ์ ์ด ๋ถ์ ์์ธก์ ์ํ ์ต์ฒจ๋จ ํน์ง์ ํฅ์์ํต๋๋ค.*
+
+"Language models of protein sequences at the scale of evolution enable accurate structure prediction"์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*๋ํ ์ธ์ด ๋ชจ๋ธ์ ์ต๊ทผ ๊ท๋ชจ๊ฐ ์ปค์ง์ ๋ฐ๋ผ ๊ธด๊ธํ ๊ธฐ๋ฅ์ ๊ฐ๋ฐํ์ฌ ๋จ์ํ ํจํด ๋งค์นญ์ ๋์ด ๋ ๋์ ์์ค์ ์ถ๋ก ์ ์ํํ๊ณ ์์ํ ์ด๋ฏธ์ง์ ํ
์คํธ๋ฅผ ์์ฑํ๋ ๊ฒ์ผ๋ก ๋ํ๋ฌ์ต๋๋ค. ๋ ์์ ๊ท๋ชจ์์ ํ๋ จ๋ ๋จ๋ฐฑ์ง ์ํ์ค์ ์ธ์ด ๋ชจ๋ธ์ด ์ฐ๊ตฌ๋์์ง๋ง, ๊ทธ๋ค์ด ๊ท๋ชจ๊ฐ ์ปค์ง์ ๋ฐ๋ผ ์๋ฌผํ์ ๋ํด ๋ฌด์์ ๋ฐฐ์ฐ๋์ง๋ ๊ฑฐ์ ์๋ ค์ ธ ์์ง ์์ต๋๋ค. ์ด ์ฐ๊ตฌ์์ ์ฐ๋ฆฌ๋ ํ์ฌ๊น์ง ํ๊ฐ๋ ๊ฐ์ฅ ํฐ 150์ต ๊ฐ์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง ๋ชจ๋ธ์ ํ๋ จํฉ๋๋ค. ์ฐ๋ฆฌ๋ ๋ชจ๋ธ์ด ๊ท๋ชจ๊ฐ ์ปค์ง์ ๋ฐ๋ผ ๋จ์ผ ์๋ฏธ๋
ธ์ฐ์ ํด์๋๋ก ๋จ๋ฐฑ์ง์ 3์ฐจ์ ๊ตฌ์กฐ๋ฅผ ์์ธกํ ์ ์๋ ์ ๋ณด๋ฅผ ํ์ตํ๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค. ์ฐ๋ฆฌ๋ ๊ฐ๋ณ ๋จ๋ฐฑ์ง ์ํ์ค๋ก๋ถํฐ ์ง์ ๊ณ ์ ๋ฐ ์์ ์์ค์ ์๋-ํฌ-์๋ ๊ตฌ์กฐ ์์ธก์ ํ๊ธฐ ์ํ ESMFold๋ฅผ ์ ์ํฉ๋๋ค. ESMFold๋ ์ธ์ด ๋ชจ๋ธ์ ์ ์ดํด๋๋ ๋ฎ์ ํผํ๋ ์ํฐ๋ฅผ ๊ฐ์ง ์ํ์ค์ ๋ํด AlphaFold2์ RoseTTAFold์ ์ ์ฌํ ์ ํ๋๋ฅผ ๊ฐ์ง๊ณ ์์ต๋๋ค. ESMFold์ ์ถ๋ก ์ AlphaFold2๋ณด๋ค ํ ์๋ฆฟ์ ๋น ๋ฅด๋ฉฐ, ๋ฉํ๊ฒ๋ ๋จ๋ฐฑ์ง์ ๊ตฌ์กฐ์ ๊ณต๊ฐ์ ์ค์ฉ์ ์ธ ์๊ฐ ๋ด์ ํ์ํ ์ ์๊ฒ ํฉ๋๋ค.*
+
+์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/facebookresearch/esm)์์ ์ฐพ์ ์ ์์ผ๋ฉฐ, Meta AI์ Fundamental AI Research ํ์์ ๊ฐ๋ฐ๋์์ต๋๋ค. ESM-1b, ESM-1v, ESM-2๋ [jasonliu](https://huggingface.co/jasonliu)์ [Matt](https://huggingface.co/Rocketknight1)์ ์ํด HuggingFace์ ๊ธฐ์ฌ๋์์ต๋๋ค.
+
+ESMFold๋ [Matt](https://huggingface.co/Rocketknight1)์ [Sylvain](https://huggingface.co/sgugger)์ ์ํด HuggingFace์ ๊ธฐ์ฌ๋์์ผ๋ฉฐ, ์ด ๊ณผ์ ์์ ๋ง์ ๋์์ ์ค Nikita Smetanin, Roshan Rao, Tom Sercu์๊ฒ ํฐ ๊ฐ์ฌ๋ฅผ ๋๋ฆฝ๋๋ค!
+
+## ์ฌ์ฉ ํ [[usage-tips]]
+
+- ESM ๋ชจ๋ธ์ ๋ง์คํฌ๋ ์ธ์ด ๋ชจ๋ธ๋ง(MLM) ๋ชฉํ๋ก ํ๋ จ๋์์ต๋๋ค.
+- HuggingFace์ ESMFold ํฌํธ๋ [openfold](https://github.com/aqlaboratory/openfold) ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ผ๋ถ๋ฅผ ์ฌ์ฉํฉ๋๋ค. `openfold` ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ Apache License 2.0์ ๋ฐ๋ผ ๋ผ์ด์ ์ค๊ฐ ๋ถ์ฌ๋ฉ๋๋ค.
+
+## ๋ฆฌ์์ค [[resources]]
+
+- [ํ
์คํธ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/sequence_classification)
+- [ํ ํฐ ๋ถ๋ฅ ์์
๊ฐ์ด๋](../tasks/token_classification)
+- [๋ง์คํน๋ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/masked_language_modeling)
+
+## EsmConfig [[transformers.EsmConfig]]
+
+[[autodoc]] EsmConfig
+ - all
+
+## EsmTokenizer [[transformers.EsmTokenizer]]
+
+[[autodoc]] EsmTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+
+
+
+## EsmModel [[transformers.EsmModel]]
+
+[[autodoc]] EsmModel
+ - forward
+
+## EsmForMaskedLM [[transformers.EsmForMaskedLM]]
+
+[[autodoc]] EsmForMaskedLM
+ - forward
+
+## EsmForSequenceClassification [[transformers.EsmForSequenceClassification]]
+
+[[autodoc]] EsmForSequenceClassification
+ - forward
+
+## EsmForTokenClassification [[transformers.EsmForTokenClassification]]
+
+[[autodoc]] EsmForTokenClassification
+ - forward
+
+## EsmForProteinFolding [[transformers.EsmForProteinFolding]]
+
+[[autodoc]] EsmForProteinFolding
+ - forward
+
+
+
+
+## TFEsmModel [[transformers.TFEsmModel]]
+
+[[autodoc]] TFEsmModel
+ - call
+
+## TFEsmForMaskedLM [[transformers.TFEsmForMaskedLM]]
+
+[[autodoc]] TFEsmForMaskedLM
+ - call
+
+## TFEsmForSequenceClassification [[transformers.TFEsmForSequenceClassification]]
+
+[[autodoc]] TFEsmForSequenceClassification
+ - call
+
+## TFEsmForTokenClassification [[transformers.TFEsmForTokenClassification]]
+
+[[autodoc]] TFEsmForTokenClassification
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gemma.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gemma.md
new file mode 100644
index 0000000000000000000000000000000000000000..25fe6f1c772950ec5bab3d0f3a9850666d90b94f
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gemma.md
@@ -0,0 +1,76 @@
+
+
+# Gemma [[gemma]]
+
+## ๊ฐ์ [[overview]]
+
+Gemma ๋ชจ๋ธ์ Google์ Gemma ํ์ด ์์ฑํ [Gemma: Open Models Based on Gemini Technology and Research](https://blog.google/technology/developers/gemma-open-models/)์์ ์ ์๋์์ต๋๋ค.
+
+Gemma ๋ชจ๋ธ์ 6์กฐ ํ ํฐ์ผ๋ก ํ์ต๋์์ผ๋ฉฐ, 2b์ 7b์ ๋ ๊ฐ์ง ๋ฒ์ ์ผ๋ก ์ถ์๋์์ต๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ด ์ฐ๊ตฌ๋ ์ธ์ด ์ดํด, ์ถ๋ก ๋ฐ ์์ ์ฑ์ ๋ํ ํ์ ๋ฒค์น๋งํฌ์์ ๋ฐ์ด๋ ์ฑ๋ฅ์ ๋ณด์ด๋ ์๋ก์ด ์คํ ์ธ์ด ๋ชจ๋ธ ๊ณ์ด์ธ Gemma๋ฅผ ์๊ฐํฉ๋๋ค. ์ฐ๋ฆฌ๋ ๋ ๊ฐ์ง ํฌ๊ธฐ(20์ต ๋ฐ 70์ต ๋งค๊ฐ๋ณ์)์ ๋ชจ๋ธ์ ์ถ์ํ๋ฉฐ, ์ฌ์ ํ์ต๋ ์ฒดํฌํฌ์ธํธ์ ๋ฏธ์ธ ์กฐ์ ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ๋ชจ๋ ์ ๊ณตํฉ๋๋ค. Gemma๋ 18๊ฐ์ ํ
์คํธ ๊ธฐ๋ฐ ์์
์ค 11๊ฐ์์ ์ ์ฌํ ํฌ๊ธฐ์ ์คํ ๋ชจ๋ธ์ ๋ฅ๊ฐํ๋ฉฐ, ์ฐ๋ฆฌ๋ ๋ชจ๋ธ ๊ฐ๋ฐ์ ๋ํ ์์ธํ ์ค๋ช
๊ณผ ํจ๊ป ์์ ์ฑ๊ณผ ์ฑ
์ ์ธก๋ฉด์ ๋ํ ์ข
ํฉ์ ์ธ ํ๊ฐ๋ฅผ ์ ๊ณตํฉ๋๋ค. ์ฐ๋ฆฌ๋ LLM์ ์ฑ
์๊ฐ ์๋ ๊ณต๊ฐ๊ฐ ์ต์ฒจ๋จ ๋ชจ๋ธ์ ์์ ์ฑ์ ํฅ์์ํค๊ณ ๋ค์ ์ธ๋์ LLM ํ์ ์ ๊ฐ๋ฅํ๊ฒ ํ๋ ๋ฐ ์ค์ํ๋ค๊ณ ๋ฏฟ์ต๋๋ค.*
+
+ํ:
+
+- ์๋ณธ ์ฒดํฌํฌ์ธํธ๋ ๋ณํ ์คํฌ๋ฆฝํธ `src/transformers/models/gemma/convert_gemma_weights_to_hf.py`๋ฅผ ์ฌ์ฉํ์ฌ ๋ณํํ ์ ์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ [Arthur Zucker](https://huggingface.co/ArthurZ), [Younes Belkada](https://huggingface.co/ybelkada), [Sanchit Gandhi](https://huggingface.co/sanchit-gandhi), [Pedro Cuenca](https://huggingface.co/pcuenq)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค.
+
+## GemmaConfig [[transformers.GemmaConfig]]
+
+[[autodoc]] GemmaConfig
+
+## GemmaTokenizer [[transformers.GemmaTokenizer]]
+
+[[autodoc]] GemmaTokenizer
+
+
+## GemmaTokenizerFast [[transformers.GemmaTokenizerFast]]
+
+[[autodoc]] GemmaTokenizerFast
+
+## GemmaModel [[transformers.GemmaModel]]
+
+[[autodoc]] GemmaModel
+ - forward
+
+## GemmaForCausalLM [[transformers.GemmaForCausalLM]]
+
+[[autodoc]] GemmaForCausalLM
+ - forward
+
+## GemmaForSequenceClassification [[transformers.GemmaForSequenceClassification]]
+
+[[autodoc]] GemmaForSequenceClassification
+ - forward
+
+## GemmaForTokenClassification [[transformers.GemmaForTokenClassification]]
+
+[[autodoc]] GemmaForTokenClassification
+ - forward
+
+## FlaxGemmaModel [[transformers.FlaxGemmaModel]]
+
+[[autodoc]] FlaxGemmaModel
+ - __call__
+
+## FlaxGemmaForCausalLM [[transformers.FlaxGemmaForCausalLM]]
+
+[[autodoc]] FlaxGemmaForCausalLM
+ - __call__
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gemma2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gemma2.md
new file mode 100644
index 0000000000000000000000000000000000000000..6bffec616c6e97d853a8e4d0b8f279bf1033d668
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gemma2.md
@@ -0,0 +1,63 @@
+
+
+
+# Gemma2 [[gemma2]]
+
+## ๊ฐ์ [[overview]]
+
+Gemma2 ๋ชจ๋ธ์ Google์ Gemma2 ํ์ด ์์ฑํ [Gemma2: Open Models Based on Gemini Technology and Research](https://blog.google/technology/developers/google-gemma-2/)์์ ์ ์๋์์ต๋๋ค.
+ํ๋ผ๋ฏธํฐ ํฌ๊ธฐ๊ฐ ๊ฐ๊ฐ 90์ต(9B)๊ณผ 270์ต(27B)์ธ ๋ ๊ฐ์ง Gemma2 ๋ชจ๋ธ์ด ์ถ์๋์์ต๋๋ค.
+
+๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ด์ ์ฐ๋ฆฌ๋ ์ ์ธ๊ณ์ ์ฐ๊ตฌ์์ ๊ฐ๋ฐ์๋ค์๊ฒ Gemma 2๋ฅผ ๊ณต์์ ์ผ๋ก ์ถ์ํฉ๋๋ค. 90์ต(9B)๊ณผ 270์ต(27B) ํ๋ผ๋ฏธํฐ ํฌ๊ธฐ๋ก ์ ๊ณต๋๋ Gemma 2๋ 1์ธ๋๋ณด๋ค ๋ ๋์ ์ฑ๋ฅ๊ณผ ์ถ๋ก ํจ์จ์ฑ์ ์ ๊ณตํ๋ฉฐ, ์๋นํ ์์ ์ฑ ํฅ์์ ํฌํจํ๊ณ ์์ต๋๋ค. ์ฌ์ค 270์ต ๊ท๋ชจ์ ๋ชจ๋ธ์ ํฌ๊ธฐ๊ฐ ๋ ๋ฐฐ ์ด์์ธ ๋ชจ๋ธ๊ณผ ๋น๊ตํด๋ ๊ฒฝ์๋ ฅ ์๋ ๋์์ ์ ๊ณตํ๋ฉฐ, ์ด๋ ์๋
12์๊น์ง๋ง ํด๋ ๋
์ ๋ชจ๋ธ์์๋ง ๊ฐ๋ฅํ๋ ์ฑ๋ฅ์ ์ ๊ณตํฉ๋๋ค.*
+
+ํ:
+
+- ์๋ณธ ์ฒดํฌํฌ์ธํธ๋ ๋ณํ ์คํฌ๋ฆฝํธ `src/transformers/models/Gemma2/convert_Gemma2_weights_to_hf.py`๋ฅผ ์ฌ์ฉํ์ฌ ๋ณํํ ์ ์์ต๋๋ค.
+
+
+
+- Gemma2๋ ๋งค ๋ ๋ฒ์งธ ๋ ์ด์ด๋ง๋ค ์ฌ๋ผ์ด๋ฉ ์๋์ฐ ์ดํ
์
์ ์ฌ์ฉํ๋ฏ๋ก [`~DynamicCache`] ๋๋ ํ
์์ ํํ๊ณผ ๊ฐ์ ์ผ๋ฐ์ ์ธ kv ์บ์ฑ์๋ ์ ํฉํ์ง ์์ต๋๋ค. Gemma2์ forward ํธ์ถ์์ ์บ์ฑ์ ํ์ฑํํ๋ ค๋ฉด [`~HybridCache`] ์ธ์คํด์ค๋ฅผ ์ด๊ธฐํํ๊ณ ์ด๋ฅผ `past_key_values`๋ก forward ํธ์ถ์ ์ ๋ฌํด์ผ ํฉ๋๋ค. ๋ํ `past_key_values`์ ์ด๋ฏธ ์ด์ ์ ํค์ ๊ฐ์ด ํฌํจ๋์ด ์๋ค๋ฉด `cache_position`๋ ์ค๋นํด์ผ ํฉ๋๋ค.
+
+
+
+์ด ๋ชจ๋ธ์ [Arthur Zucker](https://huggingface.co/ArthurZ), [Pedro Cuenca](https://huggingface.co/pcuenq), [Tom Arsen]()์ด ๊ธฐ์ฌํ์ต๋๋ค.
+
+## Gemma2Config [[transformers.Gemma2Config]]
+
+[[autodoc]] Gemma2Config
+
+## Gemma2Model [[transformers.Gemma2Model]]
+
+[[autodoc]] Gemma2Model
+ - forward
+
+## Gemma2ForCausalLM [[transformers.Gemma2ForCausalLM]]
+
+[[autodoc]] Gemma2ForCausalLM
+ - forward
+
+## Gemma2ForSequenceClassification [[transformers.Gemma2ForSequenceClassification]]
+
+[[autodoc]] Gemma2ForSequenceClassification
+ - forward
+
+## Gemma2ForTokenClassification [[transformers.Gemma2ForTokenClassification]]
+
+[[autodoc]] Gemma2ForTokenClassification
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gpt_neox_japanese.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gpt_neox_japanese.md
new file mode 100644
index 0000000000000000000000000000000000000000..13fb656dd50e9463740e1ea273bfcb9073ecd1e1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/gpt_neox_japanese.md
@@ -0,0 +1,76 @@
+
+
+# GPT-NeoX-Japanese [[gpt-neox-japanese]]
+
+## ๊ฐ์ [[overview]]
+
+
+์ผ๋ณธ์ด๋ฅผ ์ํ ์๋ํ๊ท ์ธ์ด ๋ชจ๋ธ์ธ GPT-NeoX-Japanese๋ฅผ ์๊ฐํฉ๋๋ค. ์ด ๋ชจ๋ธ์ [https://github.com/EleutherAI/gpt-neox](https://github.com/EleutherAI/gpt-neox)์์ ํ์ต๋์์ต๋๋ค. ์ผ๋ณธ์ด๋ ๋ง์ ์ดํ์ ํ๋ผ๊ฐ๋, ๊ฐํ์นด๋, ํ์์ ์กฐํฉ์ผ๋ก ์ด๋ฃจ์ด์ง ๋
ํนํ ์ธ์ด์
๋๋ค. ์ด๋ฌํ ์ผ๋ณธ์ด์ ๋
ํนํ ๊ตฌ์กฐ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด [ํน์ ์๋ธ์๋ ํ ํฌ๋์ด์ ](https://github.com/tanreinama/Japanese-BPEEncoder_V2)๋ฅผ ์ฌ์ฉํ์ต๋๋ค. ์ด ์ ์ฉํ ํ ํฌ๋์ด์ ๋ฅผ ์คํ์์ค๋ก ์ ๊ณตํด ์ค *tanreinama*์๊ฒ ๋งค์ฐ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
+
+์ด ๋ชจ๋ธ์ Google์ [PaLM](https://ai.googleblog.com/2022/04/pathways-language-model-palm-scaling-to.html) ์ฐ๊ตฌ ๊ถ์ฅ ์ฌํญ์ ๋ฐ๋ฅด๋ฉฐ, ํธ๋์คํฌ๋จธ ๋ธ๋ก์์ ํธํฅ ํ๋ผ๋ฏธํฐ๋ฅผ ์ ๊ฑฐํ์ฌ ๋ชจ๋ธ ์ฑ๋ฅ์ ํฅ์์์ผฐ์ต๋๋ค. ์์ธํ ๋ด์ฉ์ [์ด ๊ธฐ์ฌ](https://medium.com/ml-abeja/training-a-better-gpt-2-93b157662ae4)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+๋ชจ๋ธ ๊ฐ๋ฐ์ [ABEJA, Inc.](https://www.abejainc.com/)์ [์ ์ผ ์คํ๋](https://github.com/SO0529), [ํ์นด์์ ๋ง์นด๋ฒ ](https://github.com/spider-man-tm), [์์ฃผ ์๋ก๋ผ](https://github.com/Anuj040), [์ฟ ํํ ๋ฆฌ](https://github.com/go5paopao)์ ์ํด ์ฃผ๋๋์์ต๋๋ค. ์ด ๋ชจ๋ธ ๊ฐ๋ฐ ํ๋์ ๋ํ ์์ธํ ๋ด์ฉ์ [์ฌ๊ธฐ](https://tech-blog.abeja.asia/entry/abeja-gpt-project-202207)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+
+
+### ์ฌ์ฉ ์์ [[usage-example]]
+
+`generate()` ๋ฉ์๋๋ฅผ ์ฌ์ฉํ๋ฉด GPT NeoX Japanese ๋ชจ๋ธ์ ํตํด ํ
์คํธ๋ฅผ ์์ฑํ ์ ์์ต๋๋ค.
+
+```python
+>>> from transformers import GPTNeoXJapaneseForCausalLM, GPTNeoXJapaneseTokenizer
+
+>>> model = GPTNeoXJapaneseForCausalLM.from_pretrained("abeja/gpt-neox-japanese-2.7b")
+>>> tokenizer = GPTNeoXJapaneseTokenizer.from_pretrained("abeja/gpt-neox-japanese-2.7b")
+
+>>> prompt = "ไบบใจAIใๅ่ชฟใใใใใซใฏใ"
+
+>>> input_ids = tokenizer(prompt, return_tensors="pt").input_ids
+
+>>> gen_tokens = model.generate(
+... input_ids,
+... do_sample=True,
+... temperature=0.9,
+... max_length=100,
+... )
+>>> gen_text = tokenizer.batch_decode(gen_tokens, skip_special_tokens=True)[0]
+
+>>> print(gen_text)
+ไบบใจAIใๅ่ชฟใใใใใซใฏใAIใจไบบใๅ
ฑๅญใใAIใๆญฃใใ็่งฃใใๅฟ
่ฆใใใใพใใ
+```
+
+## ์๋ฃ [[resources]]
+
+- [์ผ์ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋ ](../tasks/language_modeling)
+
+## GPTNeoXJapanese ์ค์ (GPTNeoXJapaneseConfig) [[transformers.GPTNeoXJapaneseConfig]]
+
+[[autodoc]] GPTNeoXJapaneseConfig
+
+## GPTNeoXJapaneseํ ํฐํ (GPTNeoXJapaneseTokenizer) [[transformers.GPTNeoXJapaneseTokenizer]]
+
+[[autodoc]] GPTNeoXJapaneseTokenizer
+
+## GPTNeoXJapaneseModel [[transformers.GPTNeoXJapaneseModel]]
+
+[[autodoc]] GPTNeoXJapaneseModel
+ - forward
+
+## ์ผ์ LLM ์ ์ํ GPTNeoXJapanese(GPTNeoXJapaneseForCausalLM) [[transformers.GPTNeoXJapaneseForCausalLM]]
+
+[[autodoc]] GPTNeoXJapaneseForCausalLM
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/graphormer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/graphormer.md
new file mode 100644
index 0000000000000000000000000000000000000000..fc6aa2c9e2f7eef354a1ae4835f12d1a883f4938
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/graphormer.md
@@ -0,0 +1,52 @@
+
+
+# Graphormer[[graphormer]]
+
+
+
+์ด ๋ชจ๋ธ์ ์ ์ง ๋ณด์ ๋ชจ๋๋ก๋ง ์ด์๋๋ฉฐ, ์ฝ๋๋ฅผ ๋ณ๊ฒฝํ๋ ์๋ก์ด PR(Pull Request)์ ๋ฐ์ง ์์ต๋๋ค.
+์ด ๋ชจ๋ธ์ ์คํํ๋ ๋ฐ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ค๋ฉด, ์ด ๋ชจ๋ธ์ ์ง์ํ๋ ๋ง์ง๋ง ๋ฒ์ ์ธ v4.40.2๋ฅผ ๋ค์ ์ค์นํด ์ฃผ์ธ์. ๋ค์ ๋ช
๋ น์ด๋ฅผ ์คํํ์ฌ ์ฌ์ค์นํ ์ ์์ต๋๋ค: `pip install -U transformers==4.40.2`.
+
+
+
+## ๊ฐ์[[overview]]
+
+Graphormer ๋ชจ๋ธ์ Chengxuan Ying, Tianle Cai, Shengjie Luo, Shuxin Zheng, Guolin Ke, Di He, Yanming Shen, Tie-Yan Liu๊ฐ ์ ์ํ [ํธ๋์คํฌ๋จธ๊ฐ ๊ทธ๋ํ ํํ์ ์์ด์ ์ ๋ง ์ฝํ ๊น?](https://arxiv.org/abs/2106.05234) ๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ๋์์ต๋๋ค. Graphormer๋ ๊ทธ๋ํ ํธ๋์คํฌ๋จธ ๋ชจ๋ธ์
๋๋ค. ํ
์คํธ ์ํ์ค ๋์ ๊ทธ๋ํ์์ ๊ณ์ฐ์ ์ํํ ์ ์๋๋ก ์์ ๋์์ผ๋ฉฐ, ์ ์ฒ๋ฆฌ์ ๋ณํฉ ๊ณผ์ ์์ ์๋ฒ ๋ฉ๊ณผ ๊ด์ฌ ํน์ฑ์ ์์ฑํ ํ ์์ ๋ ์ดํ
์
์ ์ฌ์ฉํฉ๋๋ค.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*ํธ๋์คํฌ๋จธ ์ํคํ
์ฒ๋ ์์ฐ์ด ์ฒ๋ฆฌ์ ์ปดํจํฐ ๋น์ ๋ฑ ๋ง์ ๋ถ์ผ์์ ์ง๋ฐฐ์ ์ธ ์ ํ์ ๋ฐ๊ณ ์๋ ์ํคํ
์ฒ ์
๋๋ค. ๊ทธ๋ฌ๋ ๊ทธ๋ํ ์์ค ์์ธก ๋ฆฌ๋๋ณด๋ ์์์๋ ์ฃผ๋ฅ GNN ๋ณํ๋ชจ๋ธ๋ค์ ๋นํด ๊ฒฝ์๋ ฅ ์๋ ์ฑ๋ฅ์ ๋ฌ์ฑํ์ง ๋ชปํ์ต๋๋ค. ๋ฐ๋ผ์ ํธ๋์คํฌ๋จธ๊ฐ ๊ทธ๋ํ ํํ ํ์ต์์ ์ด๋ป๊ฒ ์ ์ํ๋ ์ ์์์ง๋ ์ฌ์ ํ ๋ฏธ์คํฐ๋ฆฌ์์ต๋๋ค. ๋ณธ ๋
ผ๋ฌธ์์๋ Graphormer๋ฅผ ์ ์ํจ์ผ๋ก์จ ์ด ๋ฏธ์คํฐ๋ฆฌ๋ฅผ ํด๊ฒฐํฉ๋๋ค. Graphormer๋ ํ์ค ํธ๋์คํฌ๋จธ ์ํคํ
์ฒ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๊ตฌ์ถ๋์์ผ๋ฉฐ, ํนํ ์ต๊ทผ์ OpenGraphBenchmark Large-Scale Challenge(OGB-LSC)์ ๊ด๋ฒ์ํ ๊ทธ๋ํ ํํ ํ์ต ์์
์์ ํ์ํ ๊ฒฐ๊ณผ๋ฅผ ์ป์ ์ ์์์ต๋๋ค. ๊ทธ๋ํ์์ ํธ๋์คํฌ๋จธ๋ฅผ ํ์ฉํ๋๋ฐ ํต์ฌ์ ๊ทธ๋ํ์ ๊ตฌ์กฐ์ ์ ๋ณด๋ฅผ ๋ชจ๋ธ์ ํจ๊ณผ์ ์ผ๋ก ์ธ์ฝ๋ฉํ๋ ๊ฒ์
๋๋ค. ์ด๋ฅผ ์ํด ์ฐ๋ฆฌ๋ Graphormer๊ฐ ๊ทธ๋ํ ๊ตฌ์กฐ ๋ฐ์ดํฐ๋ฅผ ๋ ์ ๋ชจ๋ธ๋งํ ์ ์๋๋ก ๋๋ ๋ช ๊ฐ์ง ๊ฐ๋จํ๋ฉด์๋ ํจ๊ณผ์ ์ธ ๊ตฌ์กฐ์ ์ธ์ฝ๋ฉ ๋ฐฉ๋ฒ์ ์ ์ํฉ๋๋ค. ๋ํ, ์ฐ๋ฆฌ๋ Graphormer์ ํํ์ ์ํ์ ์ผ๋ก ํน์ฑํํ๊ณ , ๊ทธ๋ํ์ ๊ตฌ์กฐ์ ์ ๋ณด๋ฅผ ์ธ์ฝ๋ฉํ๋ ์ฐ๋ฆฌ์ ๋ฐฉ์์ผ๋ก ๋ง์ ์ธ๊ธฐ ์๋ GNN ๋ณํ๋ชจ๋ธ๋ค์ด Graphormer์ ํน์ํ ๊ฒฝ์ฐ๋ก ํฌํจ๋ ์ ์์์ ๋ณด์ฌ์ค๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [clefourrier](https://huggingface.co/clefourrier)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค. ์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/microsoft/Graphormer)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+์ด ๋ชจ๋ธ์ ํฐ ๊ทธ๋ํ(100๊ฐ ์ด์์ ๋
ธ๋๊ฐ์/์ฃ์ง๊ฐ์)์์๋ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ด ํญ๋ฐ์ ์ผ๋ก ์ฆ๊ฐํ๋ฏ๋ก ์ ์๋ํ์ง ์์ต๋๋ค. ๋์์ผ๋ก ๋ฐฐ์น ํฌ๊ธฐ๋ฅผ ์ค์ด๊ฑฐ๋, RAM์ ๋๋ฆฌ๊ฑฐ๋ ๋๋ algos_graphormer.pyx ํ์ผ์ `UNREACHABLE_NODE_DISTANCE` ๋งค๊ฐ๋ณ์๋ฅผ ์ค์ด๋ ๋ฐฉ๋ฒ๋ ์์ง๋ง, 700๊ฐ ์ด์์ ๋
ธ๋๊ฐ์/์ฃ์ง๊ฐ์๋ฅผ ์ฒ๋ฆฌํ๊ธฐ์๋ ์ฌ์ ํ ์ด๋ ค์ธ ๊ฒ์
๋๋ค.
+
+์ด ๋ชจ๋ธ์ ํ ํฌ๋์ด์ ๋ฅผ ์ฌ์ฉํ์ง ์๊ณ , ๋์ ํ๋ จ ์ค์ ํน๋ณํ ์ฝ๋ ์ดํฐ(collator)๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+
+## GraphormerConfig[[transformers.GraphormerConfig]]
+
+[[autodoc]] GraphormerConfig
+
+## GraphormerModel[[transformers.GraphormerModel]]
+
+[[autodoc]] GraphormerModel
+ - forward
+
+## GraphormerForGraphClassification[[transformers.GraphormerForGraphClassification]]
+
+[[autodoc]] GraphormerForGraphClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/informer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/informer.md
new file mode 100644
index 0000000000000000000000000000000000000000..03722545a5625e7340eedb4a64948d366d190fa4
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/informer.md
@@ -0,0 +1,55 @@
+
+
+# Informer[[informer]]
+
+## ๊ฐ์[[overview]]
+
+The Informer ๋ชจ๋ธ์ Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, Wancai Zhang๊ฐ ์ ์ํ [Informer: ์ฅ๊ธฐ ์ํ์ค ์๊ณ์ด ์์ธก(LSTF)์ ์ํ ๋์ฑ ํจ์จ์ ์ธ ํธ๋์คํฌ๋จธ(Beyond Efficient Transformer)](https://arxiv.org/abs/2012.07436)๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ๋์์ต๋๋ค.
+
+์ด ๋ฐฉ๋ฒ์ ํ๋ฅ ์ ์ดํ
์
๋ฉ์ปค๋์ฆ์ ๋์
ํ์ฌ "๊ฒ์ผ๋ฅธ" ์ฟผ๋ฆฌ๊ฐ ์๋ "ํ์ฑ" ์ฟผ๋ฆฌ๋ฅผ ์ ํํ๊ณ , ํฌ์ ํธ๋์คํฌ๋จธ๋ฅผ ์ ๊ณตํ์ฌ ๊ธฐ์กด ์ดํ
์
์ ์ด์ฐจ์ ๊ณ์ฐ ๋ฐ ๋ฉ๋ชจ๋ฆฌ ์๊ตฌ์ฌํญ์ ์ํํฉ๋๋ค.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*์ค์ ๋ก ๋ง์ ์์ฉํ๋ก๊ทธ๋จ์์๋ ์ฅ๊ธฐ ์ํ์ค ์๊ณ์ด ์์ธก(LSTF)์ ํ์๋ก ํฉ๋๋ค. LSTF๋ ์ถ๋ ฅ - ์
๋ ฅ ๊ฐ ์ ํํ ์ฅ๊ธฐ ์์กด์ฑ ๊ฒฐํฉ๋๋ฅผ ํฌ์ฐฉํด๋ด๋ ๋์ ์์ธก ๋ฅ๋ ฅ์ ๋ชจ๋ธ์ ์๊ตฌํฉ๋๋ค. ์ต๊ทผ ์ฐ๊ตฌ๋ค์ ์์ธก ๋ฅ๋ ฅ์ ํฅ์์ํฌ ์ ์๋ ํธ๋์คํฌ๋จธ์ ์ ์ฌ๋ ฅ์ ๋ณด์ฌ์ฃผ๊ณ ์์ต๋๋ค. ๊ทธ๋ฌ๋, ํธ๋์คํฌ๋จธ๋ฅผ LSTF์ ์ง์ ์ ์ฉํ์ง ๋ชปํ๋๋ก ๋ง๋ ๋ช ์ฌ๊ฐํ ๋ฌธ์ ์ ๋ค์ด ์์ต๋๋ค. ์๋ก, ์ด์ฐจ ์๊ฐ ๋ณต์ก๋, ๋์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋, ์ธ์ฝ๋-๋์ฝ๋ ์ํคํ
์ฒ์ ๋ณธ์ง์ ํ๊ณ๋ฅผ ๋ค ์ ์์ต๋๋ค. ์ด๋ฌํ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด LSTF๋ฅผ ์ํ ํจ์จ์ ์ธ ํธ๋์คํฌ๋จธ ๊ธฐ๋ฐ ๋ชจ๋ธ์ธ Informer๋ฅผ ์ค๊ณํ์ต๋๋ค.
+
+Informer์ ์ธ๊ฐ์ง ๋
ํนํ ํน์ฑ:
+(i) ProbSparse ์
ํ ์ดํ
์
๋ฉ์ปค๋์ฆ์ผ๋ก, ์๊ฐ ๋ณต์ก๋์ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์์ O(L logL)๋ฅผ ๋ฌ์ฑํ๋ฉฐ ์ํ์ค ์์กด์ฑ ์ ๋ ฌ์์ ๋น๊ต ๊ฐ๋ฅํ ์ฑ๋ฅ์ ๋ณด์
๋๋ค.
+(ii) ์
ํ ์ดํ
์
์ฆ๋ฅ๋ ๊ณ๋จ์ ๋ ์ด์ด ์
๋ ฅ์ ๋ฐ์ผ๋ก ์ค์ฌ ์ง๋ฐฐ์ ์ธ ์ดํ
์
์ ๊ฐ์กฐํ๊ณ ๊ทน๋จ์ ์ผ๋ก ๊ธด ์
๋ ฅ ์ํ์ค๋ฅผ ํจ์จ์ ์ผ๋ก ์ฒ๋ฆฌํฉ๋๋ค.
+(iii) ์์ฑ ์คํ์ผ ๋์ฝ๋๋ ๊ฐ๋
์ ์ผ๋ก ๋จ์ํ์ง๋ง ์ฅ๊ธฐ ์๊ณ์ด ์ํ์ค๋ฅผ ๋จ๊ณ๋ณ ๋ฐฉ์์ด ์๋ ํ ๋ฒ์ ์ ๋ฐฉ ์ฐ์ฐ์ผ๋ก ์์ธกํ์ฌ ์ฅ๊ธฐ ์ํ์ค ์์ธก์ ์ถ๋ก ์๋๋ฅผ ํฌ๊ฒ ํฅ์์ํต๋๋ค. 4๊ฐ์ ๋๊ท๋ชจ ๋ฐ์ดํฐ์
์ ๊ฑธ์น ๊ด๋ฒ์ํ ์คํ์ Informer๊ฐ ๊ธฐ์กด ๋ฐฉ๋ฒ๋ค์ ํฌ๊ฒ ๋ฅ๊ฐํ๋ฉฐ LSTF ๋ฌธ์ ์ ์๋ก์ด ํด๊ฒฐ์ฑ
์ ์ ๊ณตํจ์ ๋ณด์ฌ์ค๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [elisim](https://huggingface.co/elisim)์ [kashif](https://huggingface.co/kashif)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค.
+์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/zhouhaoyi/Informer2020)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์๋ฃ[[resources]]
+
+์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค. ์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐ ํด๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+- HuggingFace ๋ธ๋ก๊ทธ์์ Informer ํฌ์คํธ๋ฅผ ํ์ธํ์ธ์: [Informer๋ฅผ ํ์ฉํ ๋ค๋ณ๋ ํ๋ฅ ์ ์๊ณ์ด ์์ธก](https://huggingface.co/blog/informer)
+
+## InformerConfig[[transformers.InformerConfig]]
+
+[[autodoc]] InformerConfig
+
+## InformerModel[[transformers.InformerModel]]
+
+[[autodoc]] InformerModel
+ - forward
+
+## InformerForPrediction[[transformers.InformerForPrediction]]
+
+[[autodoc]] InformerForPrediction
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama.md
new file mode 100644
index 0000000000000000000000000000000000000000..282befac213ddd24d7869bc3438bd3b88959f050
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama.md
@@ -0,0 +1,117 @@
+
+
+# LLaMA [[llama]]
+
+## ๊ฐ์ [[overview]]
+
+LLaMA ๋ชจ๋ธ์ Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothรฉe Lacroix, Baptiste Roziรจre, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, Guillaume Lample์ ์ํด ์ ์๋ [LLaMA: Open and Efficient Foundation Language Models](https://arxiv.org/abs/2302.13971)์์ ์๊ฐ๋์์ต๋๋ค. ์ด ๋ชจ๋ธ์ 7B์์ 65B๊ฐ์ ํ๋ผ๋ฏธํฐ๊น์ง ๋ค์ํ ํฌ๊ธฐ์ ๊ธฐ์ด ์ธ์ด ๋ชจ๋ธ์ ๋ชจ์๋์ ๊ฒ์
๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*"LLaMA๋ 7B์์ 65B๊ฐ์ ํ๋ผ๋ฏธํฐ ์๋ฅผ ๊ฐ์ง ๊ธฐ์ด ์ธ์ด ๋ชจ๋ธ์ ๋ชจ์์
๋๋ค. ์ฐ๋ฆฌ๋ ์์กฐ ๊ฐ์ ํ ํฐ์ผ๋ก ๋ชจ๋ธ์ ํ๋ จ์์ผฐ๊ณ , ๊ณต๊ฐ์ ์ผ๋ก ์ด์ฉ ๊ฐ๋ฅํ ๋ฐ์ดํฐ์
๋ง์ ์ฌ์ฉํ์ฌ ์ต๊ณ ์์ค์ ๋ชจ๋ธ์ ํ๋ จ์ํฌ ์ ์์์ ๋ณด์ฌ์ค๋๋ค. ํนํ, LLaMA-13B ๋ชจ๋ธ์ ๋๋ถ๋ถ์ ๋ฒค์น๋งํฌ์์ GPT-3 (175B)๋ฅผ ๋ฅ๊ฐํ๋ฉฐ, LLaMA-65B๋ ์ต๊ณ ์์ค์ ๋ชจ๋ธ์ธ Chinchilla-70B์ PaLM-540B์ ๋ฒ๊ธ๊ฐ๋ ์ฑ๋ฅ์ ๋ณด์
๋๋ค. ์ฐ๋ฆฌ๋ ๋ชจ๋ ๋ชจ๋ธ์ ์ฐ๊ตฌ ์ปค๋ฎค๋ํฐ์ ๊ณต๊ฐํฉ๋๋ค."*
+
+ํ:
+
+- LLaMA ๋ชจ๋ธ์ ๊ฐ์ค์น๋ [์ด ์์](https://docs.google.com/forms/d/e/1FAIpQLSfqNECQnMkycAp2jP4Z9TFX0cGR4uf7b_fBxjY_OjhJILlKGA/viewform?usp=send_form)์ ์์ฑํ์ฌ ์ป์ ์ ์์ต๋๋ค.
+- ๊ฐ์ค์น๋ฅผ ๋ค์ด๋ก๋ํ ํ์๋ ์ด๋ฅผ [๋ณํ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py)๋ฅผ ์ฌ์ฉํ์ฌ Hugging Face Transformers ํ์์ผ๋ก ๋ณํํด์ผํฉ๋๋ค. ๋ณํ ์คํฌ๋ฆฝํธ๋ฅผ ์คํํ๋ ค๋ฉด ์๋์ ์์ ๋ช
๋ น์ด๋ฅผ ์ฐธ๊ณ ํ์ธ์:
+
+```bash
+python src/transformers/models/llama/convert_llama_weights_to_hf.py \
+ --input_dir /path/to/downloaded/llama/weights --model_size 7B --output_dir /output/path
+```
+
+- ๋ณํ์ ํ์๋ค๋ฉด ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ ๋ค์๊ณผ ๊ฐ์ด ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```python
+from transformers import LlamaForCausalLM, LlamaTokenizer
+
+tokenizer = LlamaTokenizer.from_pretrained("/output/path")
+model = LlamaForCausalLM.from_pretrained("/output/path")
+```
+
+์คํฌ๋ฆฝํธ๋ฅผ ์คํํ๊ธฐ ์ํด์๋ ๋ชจ๋ธ์ float16 ์ ๋ฐ๋๋ก ์ ๋ถ ๋ก๋ํ ์ ์์ ๋งํผ์ ์ถฉ๋ถํ CPU RAM์ด ํ์ํฉ๋๋ค. (๊ฐ์ฅ ํฐ ๋ฒ์ ์ ๋ชจ๋ธ์ด ์ฌ๋ฌ ์ฒดํฌํฌ์ธํธ๋ก ๋๋์ด ์๋๋ผ๋, ๊ฐ ์ฒดํฌํฌ์ธํธ๋ ๋ชจ๋ธ์ ๊ฐ ๊ฐ์ค์น์ ์ผ๋ถ๋ฅผ ํฌํจํ๊ณ ์๊ธฐ ๋๋ฌธ์ ๋ชจ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ RAM์ ๋ก๋ํด์ผ ํฉ๋๋ค) 65B ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ์ด 130GB์ RAM์ด ํ์ํฉ๋๋ค.
+
+
+- LLaMA ํ ํฌ๋์ด์ ๋ [sentencepiece](https://github.com/google/sentencepiece)๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๋ BPE ๋ชจ๋ธ์
๋๋ค. sentencepiece์ ํน์ง ์ค ํ๋๋ ์ํ์ค๋ฅผ ๋์ฝ๋ฉํ ๋ ์ฒซ ํ ํฐ์ด ๋จ์ด์ ์์์ด๋ผ๋ฉด (์๋ฅผ ๋ค์ด "Banana"), ํ ํฌ๋์ด์ ๋ ๋ฌธ์์ด ์์ ๊ณต๋ฐฑ์ ์ถ๊ฐํ์ง ์๋๋ค๋ ๊ฒ์
๋๋ค.
+
+์ด ๋ชจ๋ธ์ [BlackSamorez](https://huggingface.co/BlackSamorez)์ ๊ธฐ์ฌ์ ํจ๊ป, [zphang](https://huggingface.co/zphang)์ ์ํด ์ ๊ณต๋์์ต๋๋ค. Hugging Face์์์ ๊ตฌํ ์ฝ๋๋ GPT-NeoX๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉฐ [์ฌ๊ธฐ](https://github.com/EleutherAI/gpt-neox)์์ ์ฐพ์ ์ ์๊ณ , ์ ์์ ์ฝ๋ ์๋ณธ์ [์ฌ๊ธฐ](https://github.com/facebookresearch/llama)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+์๋ LLaMA ๋ชจ๋ธ์ ๊ธฐ๋ฐ์ผ๋ก Meta AI์์ ๋ช ๊ฐ์ง ํ์ ์์
์ ๋ฐํํ์ต๋๋ค:
+
+- **Llama2**: Llama2๋ ๊ตฌ์กฐ์ ์ธ ๋ช ๊ฐ์ง ์์ (Grouped Query Attention)์ ํตํด ๊ฐ์ ๋ ๋ฒ์ ์ด๋ฉฐ, 2์กฐ ๊ฐ์ ํ ํฐ์ผ๋ก ์ฌ์ ํ๋ จ์ด ๋์ด ์์ต๋๋ค. Llama2์ ๋ํ ์์ธํ ๋ด์ฉ์ [์ด ๋ฌธ์](llama2)๋ฅผ ์ฐธ๊ณ ํ์ธ์.
+
+## ๋ฆฌ์์ค [[resources]]
+
+LLaMA๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋ Hugging Face ๋ฐ ์ปค๋ฎค๋ํฐ(๐๋ก ํ์)์ ๊ณต์ ์๋ฃ ๋ชฉ๋ก์
๋๋ค. ์ฌ๊ธฐ์ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ๋ค๋ฉด Pull Request๋ฅผ ์ฌ๋ ค์ฃผ์ธ์! ์ถ๊ฐํ ์๋ฃ๋ ๊ธฐ์กด์ ์๋ฃ์ ์ค๋ณต๋์ง ์๊ณ ์๋ก์ด ๋ด์ฉ์ ๋ณด์ฌ์ฃผ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+
+
+- LLaMA ๋ชจ๋ธ์ ํ
์คํธ ๋ถ๋ฅ ์์
์ ์ ์ฉํ๊ธฐ ์ํ ํ๋กฌํํธ ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/github/bigscience-workshop/petals/blob/main/examples/prompt-tuning-sst2.ipynb#scrollTo=f04ba4d2) ๐
+
+
+
+- [Stack Exchange](https://stackexchange.com/)์์ ์ง๋ฌธ์ ๋ตํ๋ LLaMA๋ฅผ ํ๋ จํ๋ ๋ฐฉ๋ฒ์ ์ํ [StackLLaMA: RLHF๋ก LLaMA๋ฅผ ํ๋ จํ๋ ์ค์ ๊ฐ์ด๋](https://huggingface.co/blog/stackllama#stackllama-a-hands-on-guide-to-train-llama-with-rlhf) ๐
+
+โ๏ธ ์ต์ ํ
+- ์ ํ๋ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๊ฐ์ง GPU์์ xturing ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ฌ LLaMA ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1SQUXq1AMZPSLD4mk3A3swUIc6Y2dclme?usp=sharing) ๐
+
+โก๏ธ ์ถ๋ก
+- ๐ค PEFT ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ PeftModel์ ์ฌ์ฉํ์ฌ LLaMA ๋ชจ๋ธ์ ์คํํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/github/DominguesM/alpaca-lora-ptbr-7b/blob/main/notebooks/02%20-%20Evaluate.ipynb) ๐
+- LangChain์ ์ฌ์ฉํ์ฌ PEFT ์ด๋ํฐ LLaMA ๋ชจ๋ธ์ ๋ก๋ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1l2GiSSPbajVyp2Nk3CFT4t3uH6-5TiBe?usp=sharing) ๐
+
+๐ ๋ฐฐํฌ
+- ๐ค PEFT ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ฌ์ฉ์ ์นํ์ ์ธ UI๋ก LLaMA ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/github/lxe/simple-llama-finetuner/blob/master/Simple_LLaMA_FineTuner.ipynb#scrollTo=3PM_DilAZD8T) ๐
+- Amazon SageMaker์์ ํ
์คํธ ์์ฑ์ ์ํด Open-LLaMA ๋ชจ๋ธ์ ๋ฐฐํฌํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://github.com/aws/amazon-sagemaker-examples/blob/main/introduction_to_amazon_algorithms/jumpstart-foundation-models/text-generation-open-llama.ipynb) ๐
+
+## LlamaConfig [[llamaconfig]]
+
+[[autodoc]] LlamaConfig
+
+
+## LlamaTokenizer [[llamatokenizer]]
+
+[[autodoc]] LlamaTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## LlamaTokenizerFast [[llamatokenizerfast]]
+
+[[autodoc]] LlamaTokenizerFast
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - update_post_processor
+ - save_vocabulary
+
+## LlamaModel [[llamamodel]]
+
+[[autodoc]] LlamaModel
+ - forward
+
+
+## LlamaForCausalLM [[llamaforcausallm]]
+
+[[autodoc]] LlamaForCausalLM
+ - forward
+
+## LlamaForSequenceClassification [[llamaforsequenceclassification]]
+
+[[autodoc]] LlamaForSequenceClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama2.md
new file mode 100644
index 0000000000000000000000000000000000000000..5290f2bb7b6f8d39ca6fb4fd1bba98e4f1b449aa
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama2.md
@@ -0,0 +1,129 @@
+
+
+# Llama2 [[llama2]]
+
+## ๊ฐ์ [[overview]]
+
+Llama2 ๋ชจ๋ธ์ Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Ya1smine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing EllenTan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, Thomas Scialom์ ๋
ผ๋ฌธ [LLaMA: Open Foundation and Fine-Tuned Chat Models](https://ai.meta.com/research/publications/llama-2-open-foundation-and-fine-tuned-chat-models/)์์ ์ ์๋์์ต๋๋ค. ์ฑํ
์ดํ๋ฆฌ์ผ์ด์
์ ๋ง๊ฒ ๋ฏธ์ธ ์กฐ์ ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ํฌํจ๋ 7B์์ 70B ๋ฒ์์ ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง ๊ธฐ์ด ์ธ์ด ๋ชจ๋ธ ๋ชจ์์
๋๋ค!
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์ด ์ฐ๊ตฌ์์ ์ฐ๋ฆฌ๋ 70์ต์์ 700์ต ํ๋ผ๋ฏธํฐ์ ๋ฒ์์์ ์ฌ์ ํ๋ จ ๋ฐ ๋ฏธ์ธ ์กฐ์ ๋ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ(LLMs)์ ๋ชจ์์ธ Llama 2๋ฅผ ๊ฐ๋ฐ ๋ฐ ๊ณต๊ฐํฉ๋๋ค. Llama 2-Chat๋ผ๊ณ ๋ถ๋ฆฌ๋ ๋ฏธ์ธ ์กฐ์ ๋ LLMs์ ๋ํ ์ฌ์ฉ ์ฌ๋ก์ ์ต์ ํ๋์์ต๋๋ค. ์ฐ๋ฆฌ์ ๋ชจ๋ธ์ ํ
์คํธํ ๋๋ถ๋ถ์ ๋ฒค์น๋งํฌ์์ ์คํ ์์ค ์ฑํ
๋ชจ๋ธ๋ณด๋ค ์ฑ๋ฅ์ด ๋ฐ์ด๋๋ฉฐ, ์ ์ฉ์ฑ๊ณผ ์์ ์ฑ์ ๋ํ ์ธ์ ํ๊ฐ๋ฅผ ๋ฐํ์ผ๋ก ๋น๊ณต๊ฐ ์์ค ๋ชจ๋ธ์ ๋์ฒดํ ์ ์๋ ์ ์ ํ ๋์์ด ๋ ์ ์์ต๋๋ค. ์ฐ๋ฆฌ๋ Llama 2-Chat์ ๋ฏธ์ธ ์กฐ์ ๋ฐ ์์ ์ฑ ํฅ์์ ์ ๊ทผ ๋ฐฉ์์ ๋ํ ์์ธํ ์ค๋ช
์ ์ ๊ณตํ์ฌ ์ปค๋ฎค๋ํฐ๊ฐ ์ฐ๋ฆฌ์ ์์
์ ๊ธฐ๋ฐ์ผ๋ก LLMs์ ์ฑ
์์๋ ๊ฐ๋ฐ์ ๊ธฐ์ฌํ ์ ์๋๋ก ํฉ๋๋ค.*
+
+[์ฌ๊ธฐ](https://huggingface.co/models?search=llama2)์์ ๋ชจ๋ Llama2 ๋ชจ๋ธ์ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+
+`Llama2` ๋ชจ๋ธ์ `bfloat16`์ ์ฌ์ฉํ์ฌ ํ๋ จ๋์์ง๋ง, ์๋ ์ถ๋ก ์ `float16`์ ์ฌ์ฉํฉ๋๋ค. ํ๋ธ์ ์
๋ก๋๋ ์ฒดํฌํฌ์ธํธ๋ `torch_dtype = 'float16'`์ ์ฌ์ฉํ๋ฉฐ, ์ด๋ `AutoModel` API์ ์ํด ์ฒดํฌํฌ์ธํธ๋ฅผ `torch.float32`์์ `torch.float16`์ผ๋ก ์บ์คํ
ํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
+
+์จ๋ผ์ธ ๊ฐ์ค์น์ `dtype`์ `model = AutoModelForCausalLM.from_pretrained("path", torch_dtype = "auto")`๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ์ด๊ธฐํํ ๋ `torch_dtype="auto"`๋ฅผ ์ฌ์ฉํ์ง ์๋ ํ ๋๋ถ๋ถ ๊ด๋ จ์ด ์์ต๋๋ค. ๊ทธ ์ด์ ๋ ๋ชจ๋ธ์ด ๋จผ์ ๋ค์ด๋ก๋๋ ๊ฒ์ด๊ณ (์จ๋ผ์ธ ์ฒดํฌํฌ์ธํธ์ `dtype`์ ์ฌ์ฉํ์ฌ) ๊ทธ๋ค์์ ๊ธฐ๋ณธ `dtype`์ธ `torch`๋ก ์บ์คํ
ํ๊ณ (`torch.float32`๊ฐ ๋จ), ๋ง์ง๋ง์ผ๋ก ๊ตฌ์ฑ(configuration)์์ ์ ๊ณต๋ `torch_dtype`์ด ์๋ ๊ฒฝ์ฐ ์ด๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+๋ชจ๋ธ์ `float16`์์ ํ๋ จํ๋ ๊ฒ์ ๊ถ์ฅ๋์ง ์์ผ๋ฉฐ `nan`์ ์์ฑํ๋ ๊ฒ์ผ๋ก ์๋ ค์ ธ ์์ต๋๋ค. ๋ฐ๋ผ์ ๋ชจ๋ธ์ `bfloat16`์์ ํ๋ จ๋์ด์ผ ํฉ๋๋ค.
+
+
+
+๐ฏ ํ:
+
+- Llama2 ๋ชจ๋ธ์ ๊ฐ์ค์น๋ [์ด ์์](https://ai.meta.com/resources/models-and-libraries/llama-downloads/)์ ์์ฑํ์ฌ ์ป์ ์ ์์ต๋๋ค.
+- ์ํคํ
์ฒ๋ ์ฒ์ ๋ฒ์ ์ Llama์ ๋งค์ฐ ์ ์ฌํ๋ฉฐ, [์ด ๋
ผ๋ฌธ](https://arxiv.org/pdf/2305.13245.pdf)์ ๋ด์ฉ์ ๋ฐ๋ผ Grouped Query Attention (GQA)์ด ์ถ๊ฐ๋์์ต๋๋ค.
+- `config.pretraining_tp`๋ฅผ 1๊ณผ ๋ค๋ฅธ ๊ฐ์ผ๋ก ์ค์ ํ๋ฉด ๋ ์ ํํ์ง๋ง ๋๋ฆฐ ์ ํ ๋ ์ด์ด ๊ณ์ฐ์ด ํ์ฑํ๋์ด ์๋ณธ ๋ก์ง๊ณผ ๋ ์ ์ผ์นํ๊ฒ ๋ฉ๋๋ค.
+- ์๋ ๋ชจ๋ธ์ `pad_id = -1`์ ์ฌ์ฉํ๋๋ฐ, ์ด๋ ํจ๋ฉ ํ ํฐ์ด ์์์ ์๋ฏธํฉ๋๋ค. ๋์ผํ ๋ก์ง์ ์ฌ์ฉํ ์ ์์ผ๋ฏ๋ก `tokenizer.add_special_tokens({"pad_token":""})`๋ฅผ ์ฌ์ฉํ์ฌ ํจ๋ฉ ํ ํฐ์ ์ถ๊ฐํ๊ณ ์ด์ ๋ฐ๋ผ ํ ํฐ ์๋ฒ ๋ฉ ํฌ๊ธฐ๋ฅผ ์กฐ์ ํด์ผ ํฉ๋๋ค. ๋ํ `model.config.pad_token_id`๋ฅผ ์ค์ ํด์ผ ํฉ๋๋ค. ๋ชจ๋ธ์ `embed_tokens` ๋ ์ด์ด๋ `self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.config.padding_idx)`๋ก ์ด๊ธฐํ๋์ด, ํจ๋ฉ ํ ํฐ ์ธ์ฝ๋ฉ์ด 0์ ์ถ๋ ฅํ๋๋ก ํฉ๋๋ค. ๋ฐ๋ผ์ ์ด๊ธฐํ ์์ ์ ๋ฌํ๋ ๊ฒ์ ๊ถ์ฅํฉ๋๋ค.
+- ์์์ ์์ฑํ๊ณ ๋ชจ๋ธ ์ฒดํฌํฌ์ธํธ ์ ๊ทผ ๊ถํ์ ์ป์ ํ์๋ ์ด๋ฏธ ๋ณํ๋ ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ๊ทธ๋ ์ง ์๊ณ ์์ ์ ๋ชจ๋ธ์ ์ง์ ๋ณํํ๋ ค๋ ๊ฒฝ์ฐ, [๋ณํ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py)๋ฅผ ์์ ๋กญ๊ฒ ์ฌ์ฉํ์ธ์. ์คํฌ๋ฆฝํธ๋ ๋ค์๊ณผ ๊ฐ์ ์์์ ๋ช
๋ น์ด๋ก ํธ์ถํ ์ ์์ต๋๋ค:
+
+```bash
+python src/transformers/models/llama/convert_llama_weights_to_hf.py \
+ --input_dir /path/to/downloaded/llama/weights --model_size 7B --output_dir /output/path
+```
+
+- ๋ณํ ํ ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ ๋ค์๊ณผ ๊ฐ์ด ๋ก๋ํ ์ ์์ต๋๋ค:
+
+```python
+from transformers import LlamaForCausalLM, LlamaTokenizer
+
+tokenizer = LlamaTokenizer.from_pretrained("/output/path")
+model = LlamaForCausalLM.from_pretrained("/output/path")
+```
+
+์คํฌ๋ฆฝํธ๋ฅผ ์คํํ๋ ค๋ฉด ๋ชจ๋ธ์ float16 ์ ๋ฐ๋๋ก ์ ๋ถ ํธ์คํธํ ์ ์์ ๋งํผ ์ถฉ๋ถํ CPU RAM์ด ํ์ํฉ๋๋ค (๊ฐ์ฅ ํฐ ๋ฒ์ ์ด ์ฌ๋ฌ ์ฒดํฌํฌ์ธํธ๋ก ์ ๊ณต๋๋๋ผ๋ ๊ฐ ์ฒดํฌํฌ์ธํธ๋ ๋ชจ๋ธ ๊ฐ์ค์น์ ์ผ๋ถ๋ง์ ํฌํจํ๋ฏ๋ก ๋ชจ๋ RAM์ ๋ก๋ํด์ผ ํฉ๋๋ค). 75B ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ์ด 145GB์ RAM์ด ํ์ํฉ๋๋ค.
+
+- LLaMA ํ ํฌ๋์ด์ ๋ [sentencepiece](https://github.com/google/sentencepiece)๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ BPE ๋ชจ๋ธ์
๋๋ค. sentencepiece์ ํน์ง ์ค ํ๋๋ ์ํ์ค๋ฅผ ๋์ฝ๋ฉํ ๋ ์ฒซ ๋ฒ์งธ ํ ํฐ์ด ๋จ์ด์ ์์์ด๋ฉด (์: "Banana") ํ ํฌ๋์ด์ ๋ ๋ฌธ์์ด ์์ ์ ๋์ฌ ๊ณต๊ฐ์ ์ถ๊ฐํ์ง ์๋ ๊ฒ์
๋๋ค.
+
+์ด ๋ชจ๋ธ์ [Arthur Zucker](https://huggingface.co/ArthurZ)๊ฐ [Lysandre Debut](https://huggingface.co/lysandre)์ ๋์์ ๋ฐ์ ์ ๊ณตํ์์ต๋๋ค. Hugging Face์์์ ๊ตฌํ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/EleutherAI/gpt-neox)์ GPT-NeoX ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค. ์ ์์ ์๋ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/facebookresearch/llama)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+## ๋ฆฌ์์ค [[resources]]
+
+LLaMA2๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋ Hugging Face์ ๊ณต์ ๋ฐ ์ปค๋ฎค๋ํฐ(๐๋ก ํ์) ๋ฆฌ์์ค ๋ชฉ๋ก์
๋๋ค. ์ฌ๊ธฐ์ ์๋ก์ด ๋ฆฌ์์ค๋ฅผ ์ถ๊ฐํ๊ธฐ ์ํด์ Pull Request๋ฅผ ์ด์ด ์ฃผ์๋ฉด ๊ฒํ ํ๊ฒ ์ต๋๋ค! ๋ฆฌ์์ค๋ ๊ธฐ์กด ๋ฆฌ์์ค์ ์ค๋ณต๋์ง ์๋ ์๋ก์ด ๊ฒ์ ๋ณด์ฌ์ฃผ๋ ๊ฒ์ด ์ด์์ ์
๋๋ค.
+
+- [Llama 2 is here - get it on Hugging Face](https://huggingface.co/blog/llama2), Llama 2์ ๊ดํ ๋ธ๋ก๊ทธ ํฌ์คํธ์ ๐ค Transformers ๋ฐ ๐ค PEFT์ ํจ๊ป ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๋ด์ฉ์
๋๋ค.
+- [LLaMA 2 - Every Resource you need](https://www.philschmid.de/llama-2), LLaMA 2์ ๋ํด ์์๋ณด๊ณ ๋น ๋ฅด๊ฒ ์์ํ๋ ๋ฐ ํ์ํ ๊ด๋ จ ๋ฆฌ์์ค์ ๋ชจ์์
๋๋ค.
+
+
+
+- Google Colab์์ QLoRA์ 4-bit ์ ๋ฐ๋๋ฅผ ์ฌ์ฉํ์ฌ Llama 2๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1PEQyJO1-f6j0S_XJ8DV50NkpzasXkrzd?usp=sharing)์
๋๋ค. ๐
+- "Llama-v2-7b-guanaco" ๋ชจ๋ธ์ 4-bit QLoRA๋ก ๋ฏธ์ธ ์กฐ์ ํ๊ณ PDF์์ Q&A ๋ฐ์ดํฐ์
์ ์์ฑํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/134o_cXcMe_lsvl15ZE_4Y75Kstepsntu?usp=sharing)์
๋๋ค. ๐
+
+โ๏ธ ์ต์ ํ
+- [Llama 2๋ฅผ DPO๋ก ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://huggingface.co/blog/dpo-trl), TRL ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ DPO ๋ฐฉ๋ฒ์ ์ฌ์ฉํ์ฌ ํน์ ๋ฐ์ดํฐ์
์์ Llama 2๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ์ ์๋ดํ๋ ๊ฐ์ด๋์
๋๋ค.
+- [ํ์ฅ ๊ฐ์ด๋: Llama 2 ๋ช
๋ น์ด ์กฐ์ ](https://www.philschmid.de/instruction-tune-llama-2), ์
๋ ฅ์์ ๋ช
๋ น์ด๋ฅผ ์์ฑํ๋๋ก Llama 2๋ฅผ ํ๋ จ์ํค๋ ๋ฐฉ๋ฒ์ ์๋ดํ๋ ๊ฐ์ด๋๋ก, ๋ช
๋ น์ด๋ฅผ ๋ฐ๋ฅด๋ ๋ชจ๋ธ์์ ๋ช
๋ น์ด๋ฅผ ์ฃผ๋ ๋ชจ๋ธ๋ก ๋ณํํฉ๋๋ค.
+- ๊ฐ์ธ ์ปดํจํฐ์์ QLoRA์ TRL์ ์ฌ์ฉํ์ฌ Llama 2 ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1SYpgFpcmtIUzdE7pxqknrM4ArCASfkFQ?usp=sharing)์
๋๋ค. ๐
+
+โก๏ธ ์ถ๋ก
+- AutoGPTQ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ GPTQ๋ฅผ ์ฌ์ฉํ์ฌ Llama 2 ๋ชจ๋ธ์ ์์ํํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1TC56ArKerXUpbgRy5vM3woRsbTEVNq7h?usp=sharing)์
๋๋ค. ๐
+- ๋ก์ปฌ ์ปดํจํฐ๋ Google Colab์์ 4-bit ์์ํ๋ก Llama 2 ์ฑํ
๋ชจ๋ธ์ ์คํํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋
ธํธ๋ถ](https://colab.research.google.com/drive/1X1z9Q6domMKl2CnEM0QGHNwidLfR4dW2?usp=sharing)์
๋๋ค. ๐
+
+๐ ๋ฐฐํฌ
+- [Amazon SageMaker์์ LLaMA 2 (7-70B) ๋ฏธ์ธ ์กฐ์ ํ๊ธฐ](https://www.philschmid.de/sagemaker-llama2-qlora), Amazon SageMaker์์ QLoRA ๋ฏธ์ธ ์กฐ์ ๋ฐ ๋ฐฐํฌ์ ์ด๋ฅด๊ธฐ๊น์ง์ ์์ ํ ๊ฐ์ด๋์
๋๋ค.
+- [Amazon SageMaker์์ Llama 2 7B/13B/70B ๋ฐฐํฌํ๊ธฐ](https://www.philschmid.de/sagemaker-llama-llm), ์์ ํ๊ณ ํ์ฅ ๊ฐ๋ฅํ ๋ฐฐํฌ๋ฅผ ์ํด Hugging Face์ LLM DLC ์ปจํ
์ด๋๋ฅผ ์ฌ์ฉํ๋ ๋ฐฉ๋ฒ์ ๋ํ ๊ฐ์ด๋์
๋๋ค.
+
+
+## LlamaConfig [[llamaconfig]]
+
+[[autodoc]] LlamaConfig
+
+
+## LlamaTokenizer [[llamatokenizer]]
+
+[[autodoc]] LlamaTokenizer
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - save_vocabulary
+
+## LlamaTokenizerFast [[llamatokenizerfast]]
+
+[[autodoc]] LlamaTokenizerFast
+ - build_inputs_with_special_tokens
+ - get_special_tokens_mask
+ - create_token_type_ids_from_sequences
+ - update_post_processor
+ - save_vocabulary
+
+## LlamaModel [[llamamodel]]
+
+[[autodoc]] LlamaModel
+ - forward
+
+
+## LlamaForCausalLM [[llamaforcausallm]]
+
+[[autodoc]] LlamaForCausalLM
+ - forward
+
+## LlamaForSequenceClassification [[llamaforsequenceclassification]]
+
+[[autodoc]] LlamaForSequenceClassification
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama3.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama3.md
new file mode 100644
index 0000000000000000000000000000000000000000..ca819bfcabaf882e54f5f175fdad3732e1e22cd1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/llama3.md
@@ -0,0 +1,80 @@
+
+
+# Llama3[[llama3]]
+
+```py3
+import transformers
+import torch
+
+model_id = "meta-llama/Meta-Llama-3-8B"
+
+pipeline = transformers.pipeline("text-generation", model=model_id, model_kwargs={"torch_dtype": torch.bfloat16}, device_map="auto")
+pipeline("Hey how are you doing today?")
+```
+
+## ๊ฐ์[[overview]]
+
+๋ผ๋ง3 ๋ชจ๋ธ์ Meta AI ํ์ด ์ ์ํ [๋ฉํ ๋ผ๋ง3 ์๊ฐ: ํ์ฌ๊น์ง ๊ฐ์ฅ ์ ๋ฅํ ๊ณต๊ฐ ๊ฐ๋ฅ LLM](https://ai.meta.com/blog/meta-llama-3/)์์ ์๊ฐ๋์์ต๋๋ค.
+
+ํด๋น ๋ธ๋ก๊ทธ ํฌ์คํธ์ ์ด๋ก์
๋๋ค:
+
+*์ค๋, ๊ด๋ฒ์ํ ์ฌ์ฉ์ ์ํด ์ด์ฉ ๊ฐ๋ฅํ ๋ผ๋ง์ ์ฐจ์ธ๋ ๋ชจ๋ธ์ธ ๋ฉํ ๋ผ๋ง3์ ์ฒซ ๋ ๋ชจ๋ธ์ ๊ณต์ ํ๊ฒ ๋์ด ๊ธฐ์ฉ๋๋ค. ์ด๋ฒ ์ถ์๋ 8B์ 70B ๋งค๊ฐ๋ณ์๋ฅผ ๊ฐ์ง ์ฌ์ ํ๋ จ ๋ฐ ์ง์ ๋ฏธ์ธ ์กฐ์ ๋ ์ธ์ด ๋ชจ๋ธ์ ํน์ง์ผ๋ก ํ๋ฉฐ, ๊ด๋ฒ์ํ ์ฌ์ฉ ์ฌ๋ก๋ฅผ ์ง์ํ ์ ์์ต๋๋ค. ๋ผ๋ง์ ์ด ์ฐจ์ธ๋ ๋ชจ๋ธ์ ๋ค์ํ ์ฐ์
๋ฒค์น๋งํฌ์์ ์ต์ฒจ๋จ์ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ๋ฉฐ, ๊ฐ์ ๋ ์ถ๋ก ๋ฅ๋ ฅ์ ํฌํจํ ์๋ก์ด ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค. ์ฐ๋ฆฌ๋ ์ด๊ฒ๋ค์ด ๋จ์ฐ์ฝ ํด๋น ํด๋์ค์์ ์ต๊ณ ์ ์คํ ์์ค ๋ชจ๋ธ์ด๋ผ๊ณ ๋ฏฟ์ต๋๋ค. ์ค๋ ๊ฐ๋ฐฉ์ ์ ๊ทผ ๋ฐฉ์์ ์ง์งํ๋ฉฐ, ์ฐ๋ฆฌ๋ ๋ผ๋ง3๋ฅผ ์ปค๋ฎค๋ํฐ ๊ธฐ์ฌ์๋ค์๊ฒ ๋งก๊ธฐ๊ณ ์์ต๋๋ค. ์ ํ๋ฆฌ์ผ์ด์
์์ ๊ฐ๋ฐ์ ๋๊ตฌ, ํ๊ฐ, ์ถ๋ก ์ต์ ํ ๋ฑ์ ์ด๋ฅด๊ธฐ๊น์ง AI ์คํ ์ ๋ฐ์ ๊ฑธ์น ๋ค์ ํ์ ์ ๋ฌผ๊ฒฐ์ ์ด๋ฐํ๊ธธ ํฌ๋งํฉ๋๋ค. ์ฌ๋ฌ๋ถ์ด ๋ฌด์์ ๋ง๋ค์ง ๊ธฐ๋ํ๋ฉฐ ์ฌ๋ฌ๋ถ์ ํผ๋๋ฐฑ์ ๊ณ ๋ํฉ๋๋ค.*
+
+๋ผ๋ง3 ๋ชจ๋ธ์ ๋ชจ๋ ์ฒดํฌํฌ์ธํธ๋ [์ด๊ณณ](https://huggingface.co/models?search=llama3)์์ ํ์ธํ์ธ์.
+์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/meta-llama/llama3)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+
+
+`๋ผ๋ง3` ๋ชจ๋ธ๋ค์ `bfloat16`๋ฅผ ์ฌ์ฉํ์ฌ ํ๋ จ๋์์ง๋ง, ์๋์ ์ถ๋ก ์ `float16`์ ์ฌ์ฉํฉ๋๋ค. Hub์ ์
๋ก๋๋ ์ฒดํฌํฌ์ธํธ๋ค์ `torch_dtype = 'float16'`์ ์ฌ์ฉํ๋๋ฐ, ์ด๋ `AutoModel` API๊ฐ ์ฒดํฌํฌ์ธํธ๋ฅผ `torch.float32`์์ `torch.float16`์ผ๋ก ๋ณํํ๋๋ฐ ์ด์ฉ๋ฉ๋๋ค.
+
+ `model = AutoModelForCausalLM.from_pretrained("path", torch_dtype = "auto")`๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ์ด๊ธฐํํ ๋, ์จ๋ผ์ธ ๊ฐ์ค์น์ `dtype`๋ `torch_dtype="auto"`๋ฅผ ์ฌ์ฉํ์ง ์๋ ํ ๋๋ถ๋ถ ๋ฌด๊ดํฉ๋๋ค. ๊ทธ ์ด์ ๋ ๋ชจ๋ธ์ด ๋จผ์ ๋ค์ด๋ก๋๋๊ณ (์จ๋ผ์ธ ์ฒดํฌํฌ์ธํธ์ `dtype`๋ฅผ ์ฌ์ฉ), ๊ทธ ๋ค์ `torch`์ `dtype`์ผ๋ก ๋ณํ๋์ด(`torch.float32`๊ฐ ๋จ), ๋ง์ง๋ง์ผ๋ก config์ `torch_dtype`์ด ์ ๊ณต๋ ๊ฒฝ์ฐ ๊ฐ์ค์น๊ฐ ์ฌ์ฉ๋๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+`float16`์ผ๋ก ๋ชจ๋ธ์ ํ๋ จํ๋ ๊ฒ์ ๊ถ์ฅ๋์ง ์์ผ๋ฉฐ `nan`์ ์์ฑํ๋ ๊ฒ์ผ๋ก ์๋ ค์ ธ ์์ต๋๋ค. ๋ฐ๋ผ์ ๋ชจ๋ ๋ชจ๋ธ์ `bfloat16`์ผ๋ก ํ๋ จ๋์ด์ผ ํฉ๋๋ค.
+
+
+
+ํ:
+
+- ๋ผ๋ง3 ๋ชจ๋ธ์ ์ํ ๊ฐ์ค์น๋ [์ด ํผ](https://ai.meta.com/resources/models-and-libraries/llama-downloads/)์ ์ฑ์ฐ๋ฉด์ ์ป์ด์ ธ์ผ ํฉ๋๋ค.
+- ์ํคํ
์ฒ๋ ๋ผ๋ง2์ ์ ํํ ๊ฐ์ต๋๋ค.
+- ํ ํฌ๋์ด์ ๋ [tiktoken](https://github.com/openai/tiktoken) (sentencepiece ๊ตฌํ์ ๊ธฐ๋ฐํ ๋ผ๋ง2 ์๋ ๋ค๋ฅด๊ฒ)์ ๊ธฐ๋ฐํ BPE ๋ชจ๋ธ์
๋๋ค. tiktoken ๊ธฐ๋ฐ ํ ํฌ๋์ด์ ๊ฐ sebtencepiece ๊ธฐ๋ฐ ๋ฐฉ์๊ณผ ๋ค๋ฅธ์ ์ ์
๋ ฅ ํ ํฐ์ด vocab์ ์ด๋ฏธ ์กด์ฌํ ๋ BPE ๋ณํฉ ๋ฃฐ์ ๋ฌด์ํ๊ณ ์ฑ๊ธ ํ ํฐ์ผ๋ก ํ ํฌ๋์ด์งํ๋ค๋ ์ ์์ ๊ฐ์ฅ ํฐ ์ฐจ์ด๋ฅผ ๋ณด์
๋๋ค. ์์ธํ ๋งํ๋ฉด `"hugging"`์ด vocab์ ์กด์ฌํ๊ณ ๊ธฐ์กด์ ๋ณํฉ์ด ์กด์ฌํ์ง ์์ผ๋ฉด, `["hug","ging"]` ์ฒ๋ผ ๋ ํ ํฐ์ผ๋ก ๋ ์์ ๋จ์์ ๋จ์ด๋ฅผ ๊ฐ์ง๋ ๊ฒ์ด ์๋๋ผ, ํ๋์ ํ ํฐ๋ง์ ์๋์ผ๋ก ๋ฆฌํดํ๋ ๊ฒ์ ์๋ฏธํฉ๋๋ค.
+- ๊ธฐ๋ณธ ๋ชจ๋ธ์ ํจ๋ฉ ํ ํฐ์ด ์๋ค๋ ๊ฒ์ ์๋ฏธํ๋ `pad_id = -1`์ ์ฌ์ฉํฉ๋๋ค. ๊ฐ์ ๋ก์ง์ ์ฌ์ฉํ ์ ์์ผ๋ `tokenizer.add_special_tokens({"pad_token":""})`๋ฅผ ์ฌ์ฉํ์ฌ ํ ํฐ์ ์ถ๊ฐํ๊ณ ์๋ฒ ๋ฉ ํฌ๊ธฐ๋ ํ์คํ ์กฐ์ ํด์ผ ํฉ๋๋ค. `model.config.pad_token_id`๋ ์ค์ ์ด ํ์ํฉ๋๋ค. ๋ชจ๋ธ์ `embed_tokens` ๋ ์ด์ด๋ `self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.config.padding_idx)`๋ก ์ด๊ธฐํ๋๋ฉฐ, ํจ๋ฉ ํ ํฐ์ ์ธ์ฝ๋ฉํ๋ ๊ฒ์ด 0(zero)๋ฅผ ์ถ๋ ฅํ๊ฒ ํ ๊ฒ์ธ์ง ๊ทธ๋์ ์ด๊ธฐํ๊ฐ ์ถ์ฒ๋ ๋ ์ด๋ฅผ ํตํ์ํฌ ๊ฒ์ธ์ง๋ฅผ ์ ํ๊ฒ ํฉ๋๋ค.
+- ์๋ณธ ์ฒดํฌํฌ์ธํธ๋ ์ด [๋ณํ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/blob/main/src/transformers/models/llama/convert_llama_weights_to_hf.py)๋ฅผ ์ด์ฉํด์ ๋ณํ ๊ฐ๋ฅํฉ๋๋ค. ์คํฌ๋ฆฝํธ๋ ๋ค์ ๋ช
๋ น์ด๋ก ํธ์ถํ ์ ์์ต๋๋ค:
+
+ ```bash
+ python src/transformers/models/llama/convert_llama_weights_to_hf.py \
+ --input_dir /path/to/downloaded/llama/weights --model_size 7B --output_dir /output/path --llama_version 3
+ ```
+
+- ๋ณํ ํ, ๋ชจ๋ธ๊ณผ ํ ํฌ๋์ด์ ๋ ๋ค์์ ํตํด ๋ก๋๋๋ค.
+
+ ```python
+ from transformers import AutoModelForCausalLM, AutoTokenizer
+
+ tokenizer = AutoTokenizer.from_pretrained("/output/path")
+ model = AutoModelForCausalLM.from_pretrained("/output/path")
+ ```
+
+ ์ด ์คํฌ๋ฆฝํธ๋ฅผ ์คํ์ํค๋ ค๋ฉด ๋ชจ๋ธ ์ ์ฒด๋ฅผ float16 ์ ๋ฐ๋๋ก ํธ์คํ
ํ ์ ์๋ ์ถฉ๋ถํ ๋ฉ์ธ๋ฉ๋ชจ๋ฆฌ๊ฐ ํ์ํ๋ค๋ ์ ์ ์ ์ํ์ธ์. ๊ฐ์ฅ ํฐ ๋ฒ์ ์ด ์ฌ๋ฌ ์ฒดํฌํฌ์ธํธ๋ก ๋๋์ด ์๋๋ผ๋, ๊ฐ ์ฒดํฌํฌ์ธํธ๊ฐ ๋ชจ๋ธ์ ๊ฐ์ค์น ์ผ๋ถ๋ฅผ ํฌํจํ๊ณ ์๊ธฐ ๋๋ฌธ์ ์ด๋ฅผ ๋ชจ๋ RAM์ ๋ก๋ํด์ผ ํฉ๋๋ค. 75B ๋ชจ๋ธ์ ์๋ก ๋ค๋ฉด ๋๋ต 145GB์ RAM์ด ํ์ํฉ๋๋ค.
+
+- `attn_implementation="flash_attention_2"`๋ฅผ ํตํด์ ํ๋์ ์ดํ
์
2๋ฅผ ์ฌ์ฉํ ๋, `from_pretrained` ํด๋์ค ๋ฉ์๋์ `torch_dtype`๋ฅผ ์ ๋ฌํ์ง ๋ง๊ณ ์๋ ํผํฉ ์ ๋ฐ๋(Automatic Mixed-Precision) ํ์ต์ ์ฌ์ฉํ์ธ์. `Trainer`๋ฅผ ์ฌ์ฉํ ๋๋ ๋จ์ํ `fp16` ๋๋ `bf16`์ `True`๋ก ์ค์ ํ๋ฉด ๋ฉ๋๋ค. ๊ทธ๋ ์ง ์์ผ๋ฉด ๋ฐ๋์ `torch.autocast`๋ฅผ ์ฌ์ฉํด์ผ ํฉ๋๋ค. ํ๋์ ์ดํ
์
์ `fp16`๊ณผ `bf16` ๋ฐ์ดํฐ ์ ํ๋ง ์ง์ํ๊ธฐ ๋๋ฌธ์
๋๋ค.
+
+## ์๋ฃ[[resources]]
+
+[๋ผ๋ง2](./llama2) ๋ฌธ์ ํ์ด์ง์์๋ ์ด๋ฏธ ์ ๋ง์ ๋ฉ์ง๊ณ ์ ์ตํ ์๋ฃ๋ค์ ์ ๊ณตํ๊ณ ์์ต๋๋ค. ์ด๊ณณ์ ๋ผ๋ง3์ ๋ํ ์๋ก์ด ์๋ฃ๋ฅผ ๋ํด์ฃผ์ค ์ปจํธ๋ฆฌ๋ทฐํฐ๋ค์ ์ด๋ํฉ๋๋ค! ๐ค
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mamba.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mamba.md
new file mode 100644
index 0000000000000000000000000000000000000000..404b9b06b41353949a8db18867d4fce4a8fa452e
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mamba.md
@@ -0,0 +1,105 @@
+
+
+# ๋ง๋ฐ[[mamba]]
+
+## ๊ฐ์[[overview]]
+
+๋ง๋ฐ(Mamba) ๋ชจ๋ธ์ Albert Gu, Tri Dao๊ฐ ์ ์ํ [๋ง๋ฐ: ์ ํ์ ์ํ ๊ณต๊ฐ์ ์ด์ฉํ ์ ํ ์๊ฐ ์ํ์ค ๋ชจ๋ธ๋ง](https://arxiv.org/abs/2312.00752)๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ ๋์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ `state-space-models`์ ๊ธฐ๋ฐ์ผ๋ก ํ ์๋ก์ด ํจ๋ฌ๋ค์ ์ํคํ
์ฒ์
๋๋ค. ์ง๊ด์ ์ธ ์ดํด๋ฅผ ์ป๊ณ ์ถ๋ค๋ฉด [์ด๊ณณ](https://srush.github.io/annotated-s4/)์ ์ฐธ๊ณ ํ์ธ์.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*ํ์ฌ ๋ฅ๋ฌ๋์์ ํฅ๋ฏธ๋ก์ด ์์ฉ ํ๋ก๊ทธ๋จ์ ๊ตฌ๋ํ๋ ๋๋ถ๋ถ์ ๊ธฐ์ด ๋ชจ๋ธ๋ค์ ๊ฑฐ์ ๋ณดํธ์ ์ผ๋ก ํธ๋์คํฌ๋จธ ์ํคํ
์ฒ์ ๊ทธ ํต์ฌ ์ดํ
์
๋ชจ๋์ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค. ์ ํ ์ดํ
์
, ๊ฒ์ดํธ๋ ์ปจ๋ณผ๋ฃจ์
๊ณผ ์ํ ๋ชจ๋ธ, ๊ตฌ์กฐํ๋ ์ํ ๊ณต๊ฐ ๋ชจ๋ธ(SSM) ๋ฑ ๋ง์ ์ค์ด์ฐจ์๊ฐ(subquadratic-time) ์ํคํ
์ฒ๊ฐ ๊ธด ์ํ์ค์ ๋ํ ํธ๋์คํฌ๋จธ์ ๊ณ์ฐ ๋นํจ์จ์ฑ์ ํด๊ฒฐํ๊ธฐ ์ํด ๊ฐ๋ฐ๋์์ง๋ง, ์ธ์ด์ ๊ฐ์ ์ค์ํ ์์์์๋ ์ดํ
์
๋งํผ ์ฑ๋ฅ์ ๋ด์ง ๋ชปํ์ต๋๋ค. ์ฐ๋ฆฌ๋ ์ด๋ฌํ ๋ชจ๋ธ์ ์ฃผ์ ์ฝ์ ์ด ๋ด์ฉ ๊ธฐ๋ฐ ์ถ๋ก ์ ์ํํ์ง ๋ชปํ๋ค๋ ์ ์์ ์๊ณ ๋ช ๊ฐ์ง๋ฅผ ๊ฐ์ ํ์ต๋๋ค. ์ฒซ์งธ, SSM ๋งค๊ฐ๋ณ์๋ฅผ ์
๋ ฅ์ ํจ์๋ก ๋ง๋๋ ๊ฒ๋ง์ผ๋ก๋ ์ด์ฐ ๋ชจ๋ฌ๋ฆฌํฐ(discrete modalities)์ ์ฝ์ ์ ํด๊ฒฐํ ์ ์์ด, ํ์ฌ ํ ํฐ์ ๋ฐ๋ผ ์ํ์ค ๊ธธ์ด ์ฐจ์์ ๋ฐ๋ผ ์ ๋ณด๋ฅผ ์ ํ์ ์ผ๋ก ์ ํํ๊ฑฐ๋ ์์ ์ ์๊ฒ ํฉ๋๋ค. ๋์งธ, ์ด๋ฌํ ๋ณ๊ฒฝ์ผ๋ก ํจ์จ์ ์ธ ์ปจ๋ณผ๋ฃจ์
์ ์ฌ์ฉํ ์ ์๊ฒ ๋์์ง๋ง, ์ฐ๋ฆฌ๋ ์ํ ๋ชจ๋์์ ํ๋์จ์ด๋ฅผ ์ธ์ํ๋ ๋ณ๋ ฌ ์๊ณ ๋ฆฌ์ฆ์ ์ค๊ณํ์ต๋๋ค. ์ฐ๋ฆฌ๋ ์ด๋ฌํ ์ ํ์ SSM์ ์ดํ
์
์ด๋ MLP ๋ธ๋ก๋ ์๋ ๋จ์ํ๋ ์ข
๋จ๊ฐ ์ ๊ฒฝ๋ง ์ํคํ
์ฒ์ธ ๋ง๋ฐ์ ํตํฉ์์ผฐ์ต๋๋ค. ๋ง๋ฐ๋ ๋น ๋ฅธ ์ถ๋ก (ํธ๋์คํฌ๋จธ๋ณด๋ค 5๋ฐฐ ๋์ ์ฒ๋ฆฌ๋)๊ณผ ์ํ์ค ๊ธธ์ด์ ๋ํ ์ ํ ํ์ฅ์ฑ์ ๋๋ฆฌ๋ฉฐ, ๋ฐฑ๋ง ๊ธธ์ด ์ํ์ค๊น์ง ์ค์ ๋ฐ์ดํฐ์์ ์ฑ๋ฅ์ด ํฅ์๋ฉ๋๋ค. ์ผ๋ฐ์ ์ธ ์ํ์ค ๋ชจ๋ธ ๋ฐฑ๋ณธ์ผ๋ก์ ๋ง๋ฐ๋ ์ธ์ด, ์ค๋์ค, ์ ์ ์ฒดํ๊ณผ ๊ฐ์ ์ฌ๋ฌ ์์์์ ์ต์ฒจ๋จ ์ฑ๋ฅ์ ๋ฌ์ฑํฉ๋๋ค. ์ธ์ด ๋ชจ๋ธ๋ง์์ ์ฐ๋ฆฌ์ ๋ง๋ฐ-3B ๋ชจ๋ธ์ ๊ฐ์ ํฌ๊ธฐ์ ํธ๋์คํฌ๋จธ๋ฅผ ๋ฅ๊ฐํ๊ณ ๋ ๋ฐฐ ํฌ๊ธฐ์ ํธ๋์คํฌ๋จธ์ ๋ง๋จน๋ ์ฑ๋ฅ์ ๋ณด์ด๋ฉฐ, ์ฌ์ ํ๋ จ๊ณผ ๋ค์ด์คํธ๋ฆผ ํ๊ฐ ๋ชจ๋์์ ์ฑ๋ฅ์ ๋ํ๋ฉ๋๋ค.*
+
+ํ:
+
+- ๋ง๋ฐ๋ ๊ณ ์ ์ ์ธ ํธ๋์คํฌ๋จธ์ ๊ฒฌ์ค ๋งํ ์๋ก์ด `์ํ ๊ณต๊ฐ ๋ชจ๋ธ` ์ํคํ
์ฒ์
๋๋ค. ์ด๋ ๊ตฌ์กฐํ๋ ์ํ ๊ณต๊ฐ ๋ชจ๋ธ์ ๋ฐ์ ์ ์์ ์์ผ๋ฉฐ, [ํ๋์์ดํ
์
](https://github.com/Dao-AILab/flash-attention)์ ์ ์ ์ ๋ฐ๋ฅด๋ ํจ์จ์ ์ธ ํ๋์จ์ด ์ธ์ ์ค๊ณ์ ๊ตฌํ์ ํน์ง์ผ๋ก ํฉ๋๋ค.
+- ๋ง๋ฐ๋ `์ดํ
์
` ๋ ์ด์ด์ ๋๋ฑํ `๋ฏน์(mixer)` ๋ ์ด์ด๋ฅผ ์์ต๋๋ค. `๋ง๋ฐ`์ ํต์ฌ ๋ก์ง์ `MambaMixer` ํด๋์ค์ ์์ต๋๋ค.
+- ๋ ๊ฐ์ง ๊ตฌํ์ด ๊ณต์กดํฉ๋๋ค: ํ๋๋ ์ต์ ํ๋์ด ๋น ๋ฅธ cuda์ปค๋์ ์ฌ์ฉํ๊ณ , ๋ค๋ฅธ ํ๋๋ ๋จ์ํ์ง๋ง ๋ชจ๋ ์ฅ์น์์ ์คํํ ์ ์์ต๋๋ค!
+- ํ์ฌ ๊ตฌํ์ ์๋ณธ cuda์ปค๋์ ํ์ฉํฉ๋๋ค: ๋ง๋ฐ๋ฅผ ์ํ ํ๋์ ์ดํ
์
์ ์ญํ ์ ํ๋ ๊ฒ์ [`mamba-ssm`](https://github.com/state-spaces/mamba)์ [`causal_conv1d`](https://github.com/Dao-AILab/causal-conv1d) ์ ์ฅ์์ ํธ์คํ
๋์ด ์์ต๋๋ค. ํ๋์จ์ด๊ฐ ์ง์ํ๋ค๋ฉด ๋ฐ๋์ ์ค์นํ์ธ์!
+- cuda ์ปค๋์ ์ต์ ํํ๋ ๋ฐฉํฅ ๋ณด๋ค๋, ๋จ์ํ์ง๋ง ๋ชจ๋ ์ฅ์น์์ ์คํ๊ฐ๋ฅํ๋๋กํ๋ ๋ฐฉํฅ์ธ '๋จ์๊ตฌํ'์ ์ฑ๋ฅ์ ๋น ๋ฅด๊ฒ ํฅ์์ํค๋ ๊ธฐ์ฌ๋ฅผ ๋ ํ์ํ๊ณ ์์ต๋๋ค. ๐ค
+
+์ด ๋ชจ๋ธ์ [ArthurZ](https://huggingface.co/ArthurZ)์ ์ํด ๊ธฐ์ฌ๋์์ต๋๋ค.
+์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/state-spaces/mamba)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+# ์ฌ์ฉ
+
+### ๊ฐ๋จํ ์์ฑ ์์
+
+```python
+from transformers import MambaConfig, MambaForCausalLM, AutoTokenizer
+import torch
+
+tokenizer = AutoTokenizer.from_pretrained("state-spaces/mamba-130m-hf")
+model = MambaForCausalLM.from_pretrained("state-spaces/mamba-130m-hf")
+input_ids = tokenizer("Hey how are you doing?", return_tensors= "pt")["input_ids"]
+
+out = model.generate(input_ids, max_new_tokens=10)
+print(tokenizer.batch_decode(out))
+```
+
+### Peft ํ์ธํ๋
+๋๋ฆฐ ๋ฒ์ ์ ํ์ต์์ ์์ฃผ ์์ ์ ์ด์ง ์์ต๋๋ค. ๋น ๋ฅธ ๋ฒ์ ์ `float32`๊ฐ ํ์ํฉ๋๋ค!
+
+```python
+from datasets import load_dataset
+from trl import SFTTrainer
+from peft import LoraConfig
+from transformers import AutoTokenizer, AutoModelForCausalLM, TrainingArguments
+model_id = "state-spaces/mamba-130m-hf"
+tokenizer = AutoTokenizer.from_pretrained(model_id)
+model = AutoModelForCausalLM.from_pretrained(model_id)
+dataset = load_dataset("Abirate/english_quotes", split="train")
+training_args = TrainingArguments(
+ output_dir="./results",
+ num_train_epochs=3,
+ per_device_train_batch_size=4,
+ logging_dir='./logs',
+ logging_steps=10,
+ learning_rate=2e-3
+)
+lora_config = LoraConfig(
+ r=8,
+ target_modules=["x_proj", "embeddings", "in_proj", "out_proj"],
+ task_type="CAUSAL_LM",
+ bias="none"
+)
+trainer = SFTTrainer(
+ model=model,
+ tokenizer=tokenizer,
+ args=training_args,
+ peft_config=lora_config,
+ train_dataset=dataset,
+ dataset_text_field="quote",
+)
+trainer.train()
+```
+
+## MambaConfig
+
+[[autodoc]] MambaConfig
+
+## MambaModel
+
+[[autodoc]] MambaModel
+ - forward
+
+## MambaLMHeadModel
+
+[[autodoc]] MambaForCausalLM
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mamba2.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mamba2.md
new file mode 100644
index 0000000000000000000000000000000000000000..b023914bc1276ab99a3aafb693f97b068d055e82
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mamba2.md
@@ -0,0 +1,111 @@
+
+
+# ๋ง๋ฐ2[[mamba-2]]
+
+## ๊ฐ์[[overview]]
+
+๋ง๋ฐ2 ๋ชจ๋ธ์ Tri Dao, Albert Gu๊ฐ ์ ์ํ [ํธ๋์คํฌ๋จธ๋ SSM์ด๋ค: ๊ตฌ์กฐํ๋ ์ํ ๊ณต๊ฐ ์ด์ค์ฑ์ ํตํ ์ผ๋ฐํ๋ ๋ชจ๋ธ๊ณผ ํจ์จ์ ์ธ ์๊ณ ๋ฆฌ์ฆ](https://arxiv.org/abs/2405.21060)๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ๋์์ต๋๋ค. ๋ง๋ฐ2๋ ๋ง๋ฐ1๊ณผ ์ ์ฌํ ์ํ ๊ณต๊ฐ ๋ชจ๋ธ๋ก, ๋จ์ํ๋ ์ํคํ
์ฒ์์ ๋ ๋์ ์ฑ๋ฅ์ ๋ณด์
๋๋ค.
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*ํธ๋์คํฌ๋จธ๋ ์ธ์ด ๋ชจ๋ธ๋ง์์ ๋ฅ๋ฌ๋ ์ฑ๊ณต์ ์ฃผ์ ์ํคํ
์ฒ์์ง๋ง, ๋ง๋ฐ์ ๊ฐ์ ์ํ ๊ณต๊ฐ ๋ชจ๋ธ(SSM)์ด ์ต๊ทผ ์๊ท๋ชจ ํน์ ์ค๊ฐ ๊ท๋ชจ์์ ํธ๋์คํฌ๋จธ์ ๋๋ฑํ๊ฑฐ๋ ๋ ๋์ ์ฑ๋ฅ์ ๋ณด์ด๋ ๊ฒ์ผ๋ก ๋ํ๋ฌ์ต๋๋ค. ์ฐ๋ฆฌ๋ ์ด๋ฌํ ๋ชจ๋ธ ๊ณ์ด๋ค์ด ์ค์ ๋ก ๋งค์ฐ ๋ฐ์ ํ๊ฒ ์ฐ๊ด๋์ด ์์์ ํ์
ํ์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ๊ตฌ์กฐํ๋ ์ค๋ถ๋ฆฌ(semiseparable) ํ๋ ฌ ์ค ์ฐ๊ตฌ๊ฐ ์ ์ด๋ฃจ์ด์ง ํด๋์ค์ ๋ค์ํ ๋ถํด๋ฅผ ํตํด ์ฐ๊ฒฐ๋ SSM๊ณผ ์ดํ
์
๋ณํ ์ฌ์ด์ ํ๋ถํ ์ด๋ก ์ ์ฐ๊ฒฐ ํ๋ ์์ํฌ๋ฅผ ๊ฐ๋ฐํ์ต๋๋ค. ์ํ ๊ณต๊ฐ ์ด์ค์ฑ(SSD) ํ๋ ์์ํฌ๋ฅผ ํตํด ๋ง๋ฐ1์ ์ ํ์ SSM์ ๊ฐ์ ํ ์๋ก์ด ์ํคํ
์ฒ๋ฅผ ์ค๊ณํ ์ ์์๊ณ , ํธ๋์คํฌ๋จธ์ ๊ฒฝ์๋ ฅ์ ์ ์งํ๋ฉด์๋ ์๋๋ 2~8๋ฐฐ ๋ ๋น ๋ฅธ ์ฑ๋ฅ์ ๋
๋๋ค.*
+
+ํ:
+
+์ด ๋ฒ์ ์ ๋ง๋ฐ2 ๊ตฌํ์ ์ง์ํด์ผ ํ๋ฉฐ, ํนํ Mistral AI์ [Mamba-2 codestral](https://huggingface.co/mistralai/Mamba-Codestral-7B-v0.1)์ ์ง์ํฉ๋๋ค. ํนํ, mamba 2 codestral์ 8๊ฐ์ `groups`๋ก ์ถ์๋์๋๋ฐ, ์ด๋ ์ดํ
์
๊ธฐ๋ฐ ๋ชจ๋ธ์ KV ํค๋ ์์ ์ ์ฌํ๋ค๊ณ ํ๋จ ๊ฐ๋ฅํฉ๋๋ค.
+
+์ด ๋ชจ๋ธ์ `torch_forward`์ `cuda_kernels_forward`๋ผ๋ ๋ ๊ฐ์ง ๋ค๋ฅธ ์ ๋ฐฉ ํจ์ค๋ฅผ ๊ฐ์ง๋๋ค. `cuda_kernels_forward`๋ ํ๊ฒฝ์์ cuda ์ปค๋์ ์ฐพ์ผ๋ฉด ์ด๋ฅผ ์ฌ์ฉํ๋ฉฐ, prefill์์๋ ๋ ๋๋ฆฝ๋๋ค. ์ฆ, ๋์ CPU ์ค๋ฒํค๋๋ก ์ธํด "์์
์คํ"์ด ํ์ํ๊ธฐ ๋๋ฌธ์
๋๋ค. ๊ด๋ จ ๋ด์ฉ์ [์ด๊ณณ](https://github.com/state-spaces/mamba/issues/389#issuecomment-2171755306)๊ณผ [์ด๊ณณ](https://github.com/state-spaces/mamba/issues/355#issuecomment-2147597457)์ ์ฐธ๊ณ ํ์ธ์.
+
+์ปดํ์ผ ์์ด๋ `torch_forward` ๊ตฌํ์ด 3~4๋ฐฐ ๋น ๋ฆ
๋๋ค. ๋ํ, ์ด ๋ชจ๋ธ์๋ ์์น ์๋ฒ ๋ฉ์ด ์์ง๋ง `attention_mask`์ ๋ฐฐ์น ์์ฑ์ ๊ฒฝ์ฐ ๋ ๊ณณ์์ ์๋ ์ํ(hidden state)๋ฅผ ๋ง์คํนํ๋ ํน์ ๋ก์ง์ด ์์ต๋๋ค. ๊ด๋ จ ๋ด์ฉ์ [์ด๊ณณ](https://github.com/state-spaces/mamba/issues/66#issuecomment-1863563829)์ ์ฐธ๊ณ ํ์ธ์.
+
+์ด๋ก์ธํด ๋ง๋ฐ2 ์ปค๋์ ์ฌ๊ตฌํ๊ณผ ํจ๊ป ๋ฐฐ์น ์์ฑ ๋ฐ ์บ์๋ ์์ฑ์์ ์ฝ๊ฐ์ ์ฐจ์ด๊ฐ ์์๋ฉ๋๋ค. ๋ํ cuda ์ปค๋ ๋๋ torch forward๊ฐ ์ ๊ณตํ๋ ๊ฒฐ๊ณผ๊ฐ ์ฝ๊ฐ ๋ค๋ฅผ ๊ฒ์ผ๋ก ์์๋ฉ๋๋ค. SSM ์๊ณ ๋ฆฌ์ฆ์ ํ
์ ์์ถ์ ํฌ๊ฒ ์์กดํ๋๋ฐ, ์ด๋ matmul๊ณผ ๋๋ฑํ์ง๋ง ์ฐ์ฐ ์์๊ฐ ์ฝ๊ฐ ๋ค๋ฅด๋ฉฐ, ์ด๋ก ์ธํด ๋ ์์ ์ ๋ฐ๋์์ ์ฐจ์ด๊ฐ ๋ ์ปค์ง๋๋ค.
+
+๋ ๋ค๋ฅธ ์ฐธ๊ณ ์ฌํญ์ผ๋ก, ํจ๋ฉ ํ ํฐ์ ํด๋นํ๋ ์๋ ์ํ(hidden state)์ ์ข
๋ฃ๋ ๋ ๊ณณ์์ ์ด๋ฃจ์ด์ง๋ฉฐ ์ฃผ๋ก ์ผ์ชฝ ํจ๋ฉ์ผ๋ก ํ
์คํธ๋์์ต๋๋ค. ์ค๋ฅธ์ชฝ ํจ๋ฉ์ ๋
ธ์ด์ฆ๋ฅผ ์ ํํ๋ฏ๋ก ๋ง์กฑ์ค๋ฌ์ด ๊ฒฐ๊ณผ๋ฅผ ๋ณด์ฅํ์ง ์์ต๋๋ค. `tokenizer.padding_side = "left"`๋ฅผ ์ฌ์ฉํ๋ฉด ์ฌ๋ฐ๋ฅธ ํจ๋ฉ ๋ฐฉํฅ์ ์ฌ์ฉํ ์ ์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ [Molbap](https://huggingface.co/Molbap)์ด ๊ธฐ์ฌํ์ผ๋ฉฐ, [Anton Vlasjuk](https://github.com/vasqu)์ ํฐ ๋์์ ๋ฐ์์ต๋๋ค.
+์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/state-spaces/mamba)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+
+# ์ฌ์ฉ
+
+### ๊ฐ๋จํ ์์ฑ ์:
+```python
+from transformers import Mamba2Config, Mamba2ForCausalLM, AutoTokenizer
+import torch
+model_id = 'mistralai/Mamba-Codestral-7B-v0.1'
+tokenizer = AutoTokenizer.from_pretrained(model_id, revision='refs/pr/9', from_slow=True, legacy=False)
+model = Mamba2ForCausalLM.from_pretrained(model_id, revision='refs/pr/9')
+input_ids = tokenizer("Hey how are you doing?", return_tensors= "pt")["input_ids"]
+
+out = model.generate(input_ids, max_new_tokens=10)
+print(tokenizer.batch_decode(out))
+```
+
+์ด๊ณณ์ ๋ฏธ์ธ์กฐ์ ์ ์ํ ์ด์ ์คํฌ๋ฆฝํธ์
๋๋ค:
+```python
+from trl import SFTTrainer
+from peft import LoraConfig
+from transformers import AutoTokenizer, Mamba2ForCausalLM, TrainingArguments
+model_id = 'mistralai/Mamba-Codestral-7B-v0.1'
+tokenizer = AutoTokenizer.from_pretrained(model_id, revision='refs/pr/9', from_slow=True, legacy=False)
+tokenizer.pad_token = tokenizer.eos_token
+tokenizer.padding_side = "left" #์ผ์ชฝ ํจ๋ฉ์ผ๋ก ์ค์
+
+model = Mamba2ForCausalLM.from_pretrained(model_id, revision='refs/pr/9')
+dataset = load_dataset("Abirate/english_quotes", split="train")
+# CUDA ์ปค๋์์ด๋, ๋ฐฐ์นํฌ๊ธฐ 2๊ฐ 80GB ์ฅ์น๋ฅผ ํ๋ ์ฐจ์งํฉ๋๋ค.
+# ํ์ง๋ง ์ ํ๋๋ ๊ฐ์ํฉ๋๋ค.
+# ์คํ๊ณผ ์๋๋ฅผ ํ์ํฉ๋๋ค!
+training_args = TrainingArguments(
+ output_dir="./results",
+ num_train_epochs=3,
+ per_device_train_batch_size=2,
+ logging_dir='./logs',
+ logging_steps=10,
+ learning_rate=2e-3
+)
+lora_config = LoraConfig(
+ r=8,
+ target_modules=["embeddings", "in_proj", "out_proj"],
+ task_type="CAUSAL_LM",
+ bias="none"
+)
+trainer = SFTTrainer(
+ model=model,
+ tokenizer=tokenizer,
+ args=training_args,
+ peft_config=lora_config,
+ train_dataset=dataset,
+ dataset_text_field="quote",
+)
+trainer.train()
+```
+
+
+## Mamba2Config
+
+[[autodoc]] Mamba2Config
+
+## Mamba2Model
+
+[[autodoc]] Mamba2Model
+ - forward
+
+## Mamba2LMHeadModel
+
+[[autodoc]] Mamba2ForCausalLM
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/marian.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/marian.md
new file mode 100644
index 0000000000000000000000000000000000000000..79a9641401d01e400c42de70d65f2157fefc97fa
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/marian.md
@@ -0,0 +1,217 @@
+
+
+# MarianMT[[MarianMT]]
+
+
+
+## ๊ฐ์[[Overview]]
+
+BART์ ๋์ผํ ๋ชจ๋ธ์ ์ฌ์ฉํ๋ ๋ฒ์ญ ๋ชจ๋ธ ํ๋ ์์ํฌ์
๋๋ค. ๋ฒ์ญ ๊ฒฐ๊ณผ๋ ๊ฐ ๋ชจ๋ธ ์นด๋์ ํ
์คํธ ์ธํธ์ ์ ์ฌํ์ง๋ง, ์ ํํ ์ผ์นํ์ง๋ ์์ ์ ์์ต๋๋ค. ์ด ๋ชจ๋ธ์ [sshleifer](https://huggingface.co/sshleifer)๊ฐ ์ ๊ณตํ์ต๋๋ค.
+
+
+## ๊ตฌํ ๋
ธํธ[[Implementation Notes]]
+
+- ๊ฐ ๋ชจ๋ธ์ ์ฝ 298 MB๋ฅผ ์ฐจ์งํ๋ฉฐ, 1,000๊ฐ ์ด์์ ๋ชจ๋ธ์ด ์ ๊ณต๋ฉ๋๋ค.
+- ์ง์๋๋ ์ธ์ด ์ ๋ชฉ๋ก์ [์ฌ๊ธฐ](https://huggingface.co/Helsinki-NLP)์์ ํ์ธํ ์ ์์ต๋๋ค.
+- ๋ชจ๋ธ๋ค์ [Jรถrg Tiedemann](https://researchportal.helsinki.fi/en/persons/j%C3%B6rg-tiedemann)์ ์ํด [Marian](https://marian-nmt.github.io/) C++ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ด์ฉํ์ฌ ํ์ต๋์์ต๋๋ค. ์ด ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ ๋น ๋ฅธ ํ์ต๊ณผ ๋ฒ์ญ์ ์ง์ํฉ๋๋ค.
+- ๋ชจ๋ ๋ชจ๋ธ์ 6๊ฐ ๋ ์ด์ด๋ก ์ด๋ฃจ์ด์ง Transformer ๊ธฐ๋ฐ์ ์ธ์ฝ๋-๋์ฝ๋ ๊ตฌ์กฐ์
๋๋ค. ๊ฐ ๋ชจ๋ธ์ ์ฑ๋ฅ์ ๋ชจ๋ธ ์นด๋์ ๊ธฐ์
๋์ด ์์ต๋๋ค.
+- BPE ์ ์ฒ๋ฆฌ๊ฐ ํ์ํ 80๊ฐ์ OPUS ๋ชจ๋ธ์ ์ง์๋์ง ์์ต๋๋ค.
+- ๋ชจ๋ธ๋ง ์ฝ๋๋ [`BartForConditionalGeneration`]์ ๊ธฐ๋ฐ์ผ๋ก ํ๋ฉฐ, ์ผ๋ถ ์์ ์ฌํญ์ด ๋ฐ์๋์ด ์์ต๋๋ค:
+
+ - ์ ์ (์ฌ์ธ ํจ์ ๊ธฐ๋ฐ) ์์น ์๋ฒ ๋ฉ ์ฌ์ฉ (`MarianConfig.static_position_embeddings=True`)
+ - ์๋ฒ ๋ฉ ๋ ์ด์ด ์ ๊ทํ ์๋ต (`MarianConfig.normalize_embedding=False`)
+ - ๋ชจ๋ธ์ ์์ฑ ์ ํ๋ฆฌํฝ์ค๋ก `pad_token_id` (ํด๋น ํ ํฐ ์๋ฒ ๋ฉ ๊ฐ์ 0)๋ฅผ ์ฌ์ฉํ์ฌ ์์ํฉ๋๋ค (Bart๋
+ ` `๋ฅผ ์ฌ์ฉ),
+- Marian ๋ชจ๋ธ์ PyTorch๋ก ๋๋ ๋ณํํ๋ ์ฝ๋๋ `convert_marian_to_pytorch.py`์์ ์ฐพ์ ์ ์์ต๋๋ค.
+
+
+## ๋ชจ๋ธ ์ด๋ฆ ๊ท์น[[Naming]]
+
+- ๋ชจ๋ ๋ชจ๋ธ ์ด๋ฆ์ `Helsinki-NLP/opus-mt-{src}-{tgt}` ํ์์ ๋ฐ๋ฆ
๋๋ค.
+- ๋ชจ๋ธ์ ์ธ์ด ์ฝ๋ ํ๊ธฐ๋ ์ผ๊ด๋์ง ์์ต๋๋ค. ๋ ์๋ฆฌ ์ฝ๋๋ ์ผ๋ฐ์ ์ผ๋ก [์ฌ๊ธฐ](https://developers.google.com/admin-sdk/directory/v1/languages)์์ ์ฐพ์ ์ ์์ผ๋ฉฐ, ์ธ ์๋ฆฌ ์ฝ๋๋ "์ธ์ด ์ฝ๋ {code}"๋ก ๊ตฌ๊ธ ๊ฒ์์ ํตํด ์ฐพ์ต๋๋ค.
+- `es_AR`๊ณผ ๊ฐ์ ํํ์ ์ฝ๋๋ `code_{region}` ํ์์ ์๋ฏธํฉ๋๋ค. ์ฌ๊ธฐ์์ ์์๋ ์๋ฅดํจํฐ๋์ ์คํ์ธ์ด๋ฅผ ์๋ฏธํฉ๋๋ค.
+- ๋ชจ๋ธ ๋ณํ์ ๋ ๋จ๊ณ๋ก ์ด๋ฃจ์ด์ก์ต๋๋ค. ์ฒ์ 1,000๊ฐ ๋ชจ๋ธ์ ISO-639-2 ์ฝ๋๋ฅผ ์ฌ์ฉํ๊ณ , ๋ ๋ฒ์งธ ๊ทธ๋ฃน์ ISO-639-5์ ISO-639-2 ์ฝ๋๋ฅผ ์กฐํฉํ์ฌ ์ธ์ด๋ฅผ ์๋ณํฉ๋๋ค.
+
+
+## ์์[[Examples]]
+
+- Marian ๋ชจ๋ธ์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋ค๋ฅธ ๋ฒ์ญ ๋ชจ๋ธ๋ค๋ณด๋ค ํฌ๊ธฐ๊ฐ ์์ ํ์ธํ๋ ์คํ๊ณผ ํตํฉ ํ
์คํธ์ ์ ์ฉํฉ๋๋ค.
+- [GPU์์ ํ์ธํ๋ํ๊ธฐ](https://github.com/huggingface/transformers/blob/master/examples/legacy/seq2seq/train_distil_marian_enro.sh)
+
+## ๋ค๊ตญ์ด ๋ชจ๋ธ ์ฌ์ฉ๋ฒ[[Multilingual Models]]
+
+- ๋ชจ๋ ๋ชจ๋ธ ์ด๋ฆ์`Helsinki-NLP/opus-mt-{src}-{tgt}` ํ์์ ๋ฐ๋ฆ
๋๋ค.
+- ๋ค์ค ์ธ์ด ์ถ๋ ฅ์ ์ง์ํ๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ์ถ๋ ฅ์ ์ํ๋ ์ธ์ด์ ์ธ์ด ์ฝ๋๋ฅผ `src_text`์ ์์ ๋ถ๋ถ์ ์ถ๊ฐํ์ฌ ์ง์ ํด์ผ ํฉ๋๋ค.
+- ๋ชจ๋ธ ์นด๋์์ ์ง์๋๋ ์ธ์ด ์ฝ๋์ ๋ชฉ๋ก์ ํ์ธํ ์ ์์ต๋๋ค! ์๋ฅผ ๋ค์ด [opus-mt-en-roa](https://huggingface.co/Helsinki-NLP/opus-mt-en-roa)์์ ํ์ธํ ์ ์์ต๋๋ค.
+- `Helsinki-NLP/opus-mt-roa-en`์ฒ๋ผ ์์ค ์ธก์์๋ง ๋ค๊ตญ์ด๋ฅผ ์ง์ํ๋ ๋ชจ๋ธ์ ๊ฒฝ์ฐ, ๋ณ๋์ ์ธ์ด ์ฝ๋ ์ง์ ์ด ํ์ํ์ง ์์ต๋๋ค.
+
+[Tatoeba-Challenge ๋ฆฌํฌ์งํ ๋ฆฌ](https://github.com/Helsinki-NLP/Tatoeba-Challenge)์ ์๋ก์ด ๋ค๊ตญ์ ๋ชจ๋ธ์ 3์๋ฆฌ ์ธ์ด ์ฝ๋๋ฅผ ์ฌ์ฉํฉ๋๋ค:
+
+
+```python
+>>> from transformers import MarianMTModel, MarianTokenizer
+
+>>> src_text = [
+... ">>fra<< this is a sentence in english that we want to translate to french",
+... ">>por<< This should go to portuguese",
+... ">>esp<< And this to Spanish",
+... ]
+
+>>> model_name = "Helsinki-NLP/opus-mt-en-roa"
+>>> tokenizer = MarianTokenizer.from_pretrained(model_name)
+>>> print(tokenizer.supported_language_codes)
+['>>zlm_Latn<<', '>>mfe<<', '>>hat<<', '>>pap<<', '>>ast<<', '>>cat<<', '>>ind<<', '>>glg<<', '>>wln<<', '>>spa<<', '>>fra<<', '>>ron<<', '>>por<<', '>>ita<<', '>>oci<<', '>>arg<<', '>>min<<']
+
+>>> model = MarianMTModel.from_pretrained(model_name)
+>>> translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True))
+>>> [tokenizer.decode(t, skip_special_tokens=True) for t in translated]
+["c'est une phrase en anglais que nous voulons traduire en franรงais",
+ 'Isto deve ir para o portuguรชs.',
+ 'Y esto al espaรฑol']
+```
+
+ํ๋ธ์ ์๋ ๋ชจ๋ ์ฌ์ ํ์ต๋ ๋ชจ๋ธ์ ํ์ธํ๋ ์ฝ๋์
๋๋ค:
+
+```python
+from huggingface_hub import list_models
+
+model_list = list_models()
+org = "Helsinki-NLP"
+model_ids = [x.id for x in model_list if x.id.startswith(org)]
+suffix = [x.split("/")[1] for x in model_ids]
+old_style_multi_models = [f"{org}/{s}" for s in suffix if s != s.lower()]
+```
+
+## ๊ตฌํ ๋ค๊ตญ์ด ๋ชจ๋ธ[[Old Style Multi-Lingual Models]]
+
+์ด ๋ชจ๋ธ๋ค์ OPUS-MT-Train ๋ฆฌํฌ์งํ ๋ฆฌ์ ๊ตฌํ ๋ค๊ตญ์ด ๋ชจ๋ธ๋ค์
๋๋ค. ๊ฐ ์ธ์ด ๊ทธ๋ฃน์ ํฌํจ๋ ์ธ์ด๋ค์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+```python no-style
+['Helsinki-NLP/opus-mt-NORTH_EU-NORTH_EU',
+ 'Helsinki-NLP/opus-mt-ROMANCE-en',
+ 'Helsinki-NLP/opus-mt-SCANDINAVIA-SCANDINAVIA',
+ 'Helsinki-NLP/opus-mt-de-ZH',
+ 'Helsinki-NLP/opus-mt-en-CELTIC',
+ 'Helsinki-NLP/opus-mt-en-ROMANCE',
+ 'Helsinki-NLP/opus-mt-es-NORWAY',
+ 'Helsinki-NLP/opus-mt-fi-NORWAY',
+ 'Helsinki-NLP/opus-mt-fi-ZH',
+ 'Helsinki-NLP/opus-mt-fi_nb_no_nn_ru_sv_en-SAMI',
+ 'Helsinki-NLP/opus-mt-sv-NORWAY',
+ 'Helsinki-NLP/opus-mt-sv-ZH']
+GROUP_MEMBERS = {
+ 'ZH': ['cmn', 'cn', 'yue', 'ze_zh', 'zh_cn', 'zh_CN', 'zh_HK', 'zh_tw', 'zh_TW', 'zh_yue', 'zhs', 'zht', 'zh'],
+ 'ROMANCE': ['fr', 'fr_BE', 'fr_CA', 'fr_FR', 'wa', 'frp', 'oc', 'ca', 'rm', 'lld', 'fur', 'lij', 'lmo', 'es', 'es_AR', 'es_CL', 'es_CO', 'es_CR', 'es_DO', 'es_EC', 'es_ES', 'es_GT', 'es_HN', 'es_MX', 'es_NI', 'es_PA', 'es_PE', 'es_PR', 'es_SV', 'es_UY', 'es_VE', 'pt', 'pt_br', 'pt_BR', 'pt_PT', 'gl', 'lad', 'an', 'mwl', 'it', 'it_IT', 'co', 'nap', 'scn', 'vec', 'sc', 'ro', 'la'],
+ 'NORTH_EU': ['de', 'nl', 'fy', 'af', 'da', 'fo', 'is', 'no', 'nb', 'nn', 'sv'],
+ 'SCANDINAVIA': ['da', 'fo', 'is', 'no', 'nb', 'nn', 'sv'],
+ 'SAMI': ['se', 'sma', 'smj', 'smn', 'sms'],
+ 'NORWAY': ['nb_NO', 'nb', 'nn_NO', 'nn', 'nog', 'no_nb', 'no'],
+ 'CELTIC': ['ga', 'cy', 'br', 'gd', 'kw', 'gv']
+}
+```
+
+์์ด๋ฅผ ์ฌ๋ฌ ๋ก๋ง์ค ์ธ์ด๋ก ๋ฒ์ญํ๋ ์์ ์
๋๋ค. ์ฌ๊ธฐ์๋ ๊ตฌํ 2์๋ฆฌ ์ธ์ด ์ฝ๋๋ฅผ ์ฌ์ฉํฉ๋๋ค:
+
+
+```python
+>>> from transformers import MarianMTModel, MarianTokenizer
+
+>>> src_text = [
+... ">>fr<< this is a sentence in english that we want to translate to french",
+... ">>pt<< This should go to portuguese",
+... ">>es<< And this to Spanish",
+... ]
+
+>>> model_name = "Helsinki-NLP/opus-mt-en-ROMANCE"
+>>> tokenizer = MarianTokenizer.from_pretrained(model_name)
+
+>>> model = MarianMTModel.from_pretrained(model_name)
+>>> translated = model.generate(**tokenizer(src_text, return_tensors="pt", padding=True))
+>>> tgt_text = [tokenizer.decode(t, skip_special_tokens=True) for t in translated]
+["c'est une phrase en anglais que nous voulons traduire en franรงais",
+ 'Isto deve ir para o portuguรชs.',
+ 'Y esto al espaรฑol']
+```
+
+## ์๋ฃ[[Resources]]
+
+- [๋ฒ์ญ ์์
๊ฐ์ด๋](../tasks/translation)
+- [์์ฝ ์์
๊ฐ์ด๋](../tasks/summarization)
+- [์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/language_modeling)
+
+## MarianConfig
+
+[[autodoc]] MarianConfig
+
+## MarianTokenizer
+
+[[autodoc]] MarianTokenizer
+ - build_inputs_with_special_tokens
+
+
+
+
+## MarianModel
+
+[[autodoc]] MarianModel
+ - forward
+
+## MarianMTModel
+
+[[autodoc]] MarianMTModel
+ - forward
+
+## MarianForCausalLM
+
+[[autodoc]] MarianForCausalLM
+ - forward
+
+
+
+
+## TFMarianModel
+
+[[autodoc]] TFMarianModel
+ - call
+
+## TFMarianMTModel
+
+[[autodoc]] TFMarianMTModel
+ - call
+
+
+
+
+## FlaxMarianModel
+
+[[autodoc]] FlaxMarianModel
+ - __call__
+
+## FlaxMarianMTModel
+
+[[autodoc]] FlaxMarianMTModel
+ - __call__
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mistral.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mistral.md
new file mode 100644
index 0000000000000000000000000000000000000000..4c9f2d7a77d4a2fee499e4db14e88f4c122c10e5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/mistral.md
@@ -0,0 +1,233 @@
+
+
+# Mistral[[mistral]]
+
+## ๊ฐ์[[overview]]
+
+๋ฏธ์คํธ๋์ Albert Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lรฉlio Renard Lavaud, Lucile Saulnier, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothรฉe Lacroix, William El Sayed๊ฐ ์์ฑํ [์ด ๋ธ๋ก๊ทธ ํฌ์คํธ](https://mistral.ai/news/announcing-mistral-7b/)์์ ์๊ฐ๋์์ต๋๋ค.
+
+๋ธ๋ก๊ทธ ํฌ์คํธ์ ์๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*๋ฏธ์คํธ๋ AIํ์ ํ์กดํ๋ ์ธ์ด ๋ชจ๋ธ ์ค ํฌ๊ธฐ ๋๋น ๊ฐ์ฅ ๊ฐ๋ ฅํ ๋ฏธ์คํธ๋7B๋ฅผ ์ถ์ํ๊ฒ ๋์ด ์๋์ค๋ฝ์ต๋๋ค.*
+
+๋ฏธ์คํธ๋-7B๋ [mistral.ai](https://mistral.ai/)์์ ์ถ์ํ ์ฒซ ๋ฒ์งธ ๋๊ท๋ชจ ์ธ์ด ๋ชจ๋ธ(LLM)์
๋๋ค.
+
+### ์ํคํ
์ฒ ์ธ๋ถ์ฌํญ[[architectural-details]]
+
+๋ฏธ์คํธ๋-7B๋ ๋ค์๊ณผ ๊ฐ์ ๊ตฌ์กฐ์ ํน์ง์ ๊ฐ์ง ๋์ฝ๋ ์ ์ฉ ํธ๋์คํฌ๋จธ์
๋๋ค:
+
+- ์ฌ๋ผ์ด๋ฉ ์๋์ฐ ์ดํ
์
: 8k ์ปจํ
์คํธ ๊ธธ์ด์ ๊ณ ์ ์บ์ ํฌ๊ธฐ๋ก ํ๋ จ๋์์ผ๋ฉฐ, ์ด๋ก ์ 128K ํ ํฐ์ ์ดํ
์
๋ฒ์๋ฅผ ๊ฐ์ง๋๋ค.
+- GQA(Grouped Query Attention): ๋ ๋น ๋ฅธ ์ถ๋ก ์ด ๊ฐ๋ฅํ๊ณ ๋ ์์ ํฌ๊ธฐ์ ์บ์๋ฅผ ์ฌ์ฉํฉ๋๋ค.
+- ๋ฐ์ดํธ ํด๋ฐฑ(Byte-fallback) BPE ํ ํฌ๋์ด์ : ๋ฌธ์๋ค์ด ์ ๋ ์ดํ ๋ชฉ๋ก ์ธ์ ํ ํฐ์ผ๋ก ๋งคํ๋์ง ์๋๋ก ๋ณด์ฅํฉ๋๋ค.
+
+๋ ์์ธํ ๋ด์ฉ์ [์ถ์ ๋ธ๋ก๊ทธ ํฌ์คํธ](https://mistral.ai/news/announcing-mistral-7b/)๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+### ๋ผ์ด์ ์ค[[license]]
+
+`๋ฏธ์คํธ๋-7B`๋ ์ํ์น 2.0 ๋ผ์ด์ ์ค๋ก ์ถ์๋์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+๋ฏธ์คํธ๋ AIํ์ ๋ค์ 3๊ฐ์ง ์ฒดํฌํฌ์ธํธ๋ฅผ ๊ณต๊ฐํ์ต๋๋ค:
+
+- ๊ธฐ๋ณธ ๋ชจ๋ธ์ธ [๋ฏธ์คํธ๋-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1)์ ์ธํฐ๋ท ๊ท๋ชจ์ ๋ฐ์ดํฐ์์ ๋ค์ ํ ํฐ์ ์์ธกํ๋๋ก ์ฌ์ ํ๋ จ๋์์ต๋๋ค.
+- ์ง์ ์กฐ์ ๋ชจ๋ธ์ธ [๋ฏธ์คํธ๋-7B-Instruct-v0.1](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1)์ ์ง๋ ๋ฏธ์ธ ์กฐ์ (SFT)๊ณผ ์ง์ ์ ํธ๋ ์ต์ ํ(DPO)๋ฅผ ์ฌ์ฉํ ์ฑํ
์ ์ต์ ํ๋ ๊ธฐ๋ณธ ๋ชจ๋ธ์
๋๋ค.
+- ๊ฐ์ ๋ ์ง์ ์กฐ์ ๋ชจ๋ธ์ธ [๋ฏธ์คํธ๋-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)๋ v1์ ๊ฐ์ ํ ๋ฒ์ ์
๋๋ค.
+
+๊ธฐ๋ณธ ๋ชจ๋ธ์ ๋ค์๊ณผ ๊ฐ์ด ์ฌ์ฉํ ์ ์์ต๋๋ค:
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", device_map="auto")
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
+
+>>> prompt = "My favourite condiment is"
+
+>>> model_inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
+>>> model.to(device)
+
+>>> generated_ids = model.generate(**model_inputs, max_new_tokens=100, do_sample=True)
+>>> tokenizer.batch_decode(generated_ids)[0]
+"My favourite condiment is to ..."
+```
+
+์ง์ ์กฐ์ ๋ชจ๋ธ์ ๋ค์๊ณผ ๊ฐ์ด ์ฌ์ฉํ ์ ์์ต๋๋ค:
+
+```python
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", device_map="auto")
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
+
+>>> messages = [
+... {"role": "user", "content": "What is your favourite condiment?"},
+... {"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
+... {"role": "user", "content": "Do you have mayonnaise recipes?"}
+... ]
+
+>>> model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
+
+>>> generated_ids = model.generate(model_inputs, max_new_tokens=100, do_sample=True)
+>>> tokenizer.batch_decode(generated_ids)[0]
+"Mayonnaise can be made as follows: (...)"
+```
+
+์ง์ ์กฐ์ ๋ชจ๋ธ์ ์
๋ ฅ์ด ์ฌ๋ฐ๋ฅธ ํ์์ผ๋ก ์ค๋น๋๋๋ก [์ฑํ
ํ
ํ๋ฆฟ](../chat_templating)์ ์ ์ฉํด์ผ ํฉ๋๋ค.
+
+## ํ๋์ ์ดํ
์
์ ์ด์ฉํ ๋ฏธ์คํธ๋ ์๋ํฅ์[[speeding-up-mistral-by-using-flash-attention]]
+
+์์ ์ฝ๋ ์ค๋ํซ๋ค์ ์ด๋ค ์ต์ ํ ๊ธฐ๋ฒ๋ ์ฌ์ฉํ์ง ์์ ์ถ๋ก ๊ณผ์ ์ ๋ณด์ฌ์ค๋๋ค. ํ์ง๋ง ๋ชจ๋ธ ๋ด๋ถ์์ ์ฌ์ฉ๋๋ ์ดํ
์
๋ฉ์ปค๋์ฆ์ ๋ ๋น ๋ฅธ ๊ตฌํ์ธ [ํ๋์ ์ดํ
์
2](../perf_train_gpu_one.md#flash-attention-2)์ ํ์ฉํ๋ฉด ๋ชจ๋ธ์ ์๋๋ฅผ ํฌ๊ฒ ๋์ผ ์ ์์ต๋๋ค.
+
+๋จผ์ , ์ฌ๋ผ์ด๋ฉ ์๋์ฐ ์ดํ
์
๊ธฐ๋ฅ์ ํฌํจํ๋ ํ๋์ ์ดํ
์
2์ ์ต์ ๋ฒ์ ์ ์ค์นํด์ผ ํฉ๋๋ค.
+
+```bash
+pip install -U flash-attn --no-build-isolation
+```
+
+ํ๋์จ์ด์ ํ๋์ ์ดํ
์
2์ ํธํ์ฌ๋ถ๋ฅผ ํ์ธํ์ธ์. ์ด์ ๋ํ ์์ธํ ๋ด์ฉ์ [ํ๋์ ์ดํ
์
์ ์ฅ์](https://github.com/Dao-AILab/flash-attention)์ ๊ณต์ ๋ฌธ์์์ ํ์ธํ ์ ์์ต๋๋ค. ๋ํ ๋ชจ๋ธ์ ๋ฐ์ ๋ฐ๋(์: `torch.float16`)๋ก ๋ถ๋ฌ์์ผํฉ๋๋ค.
+
+ํ๋์ ์ดํ
์
2๋ฅผ ์ฌ์ฉํ์ฌ ๋ชจ๋ธ์ ๋ถ๋ฌ์ค๊ณ ์คํํ๋ ค๋ฉด ์๋ ์ฝ๋ ์ค๋ํซ์ ์ฐธ์กฐํ์ธ์:
+
+```python
+>>> import torch
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer
+
+>>> model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-v0.1", torch_dtype=torch.float16, attn_implementation="flash_attention_2", device_map="auto")
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-v0.1")
+
+>>> prompt = "My favourite condiment is"
+
+>>> model_inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
+>>> model.to(device)
+
+>>> generated_ids = model.generate(**model_inputs, max_new_tokens=100, do_sample=True)
+>>> tokenizer.batch_decode(generated_ids)[0]
+"My favourite condiment is to (...)"
+```
+
+### ๊ธฐ๋ํ๋ ์๋ ํฅ์[[expected-speedups]]
+
+๋ค์์ `mistralai/Mistral-7B-v0.1` ์ฒดํฌํฌ์ธํธ๋ฅผ ์ฌ์ฉํ ํธ๋์คํฌ๋จธ์ ๊ธฐ๋ณธ ๊ตฌํ๊ณผ ํ๋์ ์ดํ
์
2 ๋ฒ์ ๋ชจ๋ธ ์ฌ์ด์ ์์ ์ถ๋ก ์๊ฐ์ ๋น๊ตํ ์์ ์๋ ํฅ์ ๋ค์ด์ด๊ทธ๋จ์
๋๋ค.
+
+
+
+
+
+### ์ฌ๋ผ์ด๋ฉ ์๋์ฐ ์ดํ
์
[[sliding-window-attention]]
+
+ํ์ฌ ๊ตฌํ์ ์ฌ๋ผ์ด๋ฉ ์๋์ฐ ์ดํ
์
๋ฉ์ปค๋์ฆ๊ณผ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ ์ธ ์บ์ ๊ด๋ฆฌ ๊ธฐ๋ฅ์ ์ง์ํฉ๋๋ค. ์ฌ๋ผ์ด๋ฉ ์๋์ฐ ์ดํ
์
์ ํ์ฑํํ๋ ค๋ฉด, ์ฌ๋ผ์ด๋ฉ ์๋์ฐ ์ดํ
์
๊ณผ ํธํ๋๋`flash-attn`(`>=2.3.0`)๋ฒ์ ์ ์ฌ์ฉํ๋ฉด ๋ฉ๋๋ค.
+
+๋ํ ํ๋์ ์ดํ
์
2 ๋ชจ๋ธ์ ๋ ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ ์ธ ์บ์ ์ฌ๋ผ์ด์ฑ ๋ฉ์ปค๋์ฆ์ ์ฌ์ฉํฉ๋๋ค. ๋ฏธ์คํธ๋ ๋ชจ๋ธ์ ๊ณต์ ๊ตฌํ์์ ๊ถ์ฅํ๋ ๋กค๋ง ์บ์ ๋ฉ์ปค๋์ฆ์ ๋ฐ๋ผ, ์บ์ ํฌ๊ธฐ๋ฅผ ๊ณ ์ (`self.config.sliding_window`)์ผ๋ก ์ ์งํ๊ณ , `padding_side="left"`์ธ ๊ฒฝ์ฐ์๋ง ๋ฐฐ์น ์์ฑ(batch generation)์ ์ง์ํ๋ฉฐ, ํ์ฌ ํ ํฐ์ ์ ๋ ์์น๋ฅผ ์ฌ์ฉํด ์์น ์๋ฒ ๋ฉ์ ๊ณ์ฐํฉ๋๋ค.
+
+## ์์ํ๋ก ๋ฏธ์คํธ๋ ํฌ๊ธฐ ์ค์ด๊ธฐ[[shrinking-down-mistral-using-quantization]]
+
+๋ฏธ์คํธ๋ ๋ชจ๋ธ์ 70์ต ๊ฐ์ ํ๋ผ๋ฏธํฐ๋ฅผ ๊ฐ์ง๊ณ ์์ด, ์ ๋ฐ์ ์ ๋ฐ๋(float16)๋ก ์ฝ 14GB์ GPU RAM์ด ํ์ํฉ๋๋ค. ๊ฐ ํ๋ผ๋ฏธํฐ๊ฐ 2๋ฐ์ดํธ๋ก ์ ์ฅ๋๊ธฐ ๋๋ฌธ์
๋๋ค. ํ์ง๋ง [์์ํ](../quantization.md)๋ฅผ ์ฌ์ฉํ๋ฉด ๋ชจ๋ธ ํฌ๊ธฐ๋ฅผ ์ค์ผ ์ ์์ต๋๋ค. ๋ชจ๋ธ์ 4๋นํธ(์ฆ, ํ๋ผ๋ฏธํฐ๋น ๋ฐ ๋ฐ์ดํธ)๋ก ์์ํํ๋ฉด ์ฝ 3.5GB์ RAM๋ง ํ์ํฉ๋๋ค.
+
+๋ชจ๋ธ์ ์์ํํ๋ ๊ฒ์ `quantization_config`๋ฅผ ๋ชจ๋ธ์ ์ ๋ฌํ๋ ๊ฒ๋งํผ ๊ฐ๋จํฉ๋๋ค. ์๋์์๋ BitsAndBytes ์์ํ๋ฅผ ์ฌ์ฉํ์ง๋ง, ๋ค๋ฅธ ์์ํ ๋ฐฉ๋ฒ์ [์ด ํ์ด์ง](../quantization.md)๋ฅผ ์ฐธ๊ณ ํ์ธ์:
+
+```python
+>>> import torch
+>>> from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
+
+>>> # specify how to quantize the model
+>>> quantization_config = BitsAndBytesConfig(
+... load_in_4bit=True,
+... bnb_4bit_quant_type="nf4",
+... bnb_4bit_compute_dtype="torch.float16",
+... )
+
+>>> model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2", quantization_config=True, device_map="auto")
+>>> tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")
+
+>>> prompt = "My favourite condiment is"
+
+>>> messages = [
+... {"role": "user", "content": "What is your favourite condiment?"},
+... {"role": "assistant", "content": "Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!"},
+... {"role": "user", "content": "Do you have mayonnaise recipes?"}
+... ]
+
+>>> model_inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to("cuda")
+
+>>> generated_ids = model.generate(model_inputs, max_new_tokens=100, do_sample=True)
+>>> tokenizer.batch_decode(generated_ids)[0]
+"The expected output"
+```
+
+์ด ๋ชจ๋ธ์ [Younes Belkada](https://huggingface.co/ybelkada)์ [Arthur Zucker](https://huggingface.co/ArthurZ)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค.
+์๋ณธ ์ฝ๋๋ [์ด๊ณณ](https://github.com/mistralai/mistral-src)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ๋ฆฌ์์ค[[resources]]
+
+๋ฏธ์คํธ๋์ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค. ์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐํด ๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+
+
+- ๋ฏธ์คํธ๋-7B์ ์ง๋ํ ๋ฏธ์ธ์กฐ์ (SFT)์ ์ํํ๋ ๋ฐ๋ชจ ๋
ธํธ๋ถ์ [์ด๊ณณ](https://github.com/NielsRogge/Transformers-Tutorials/blob/master/Mistral/Supervised_fine_tuning_(SFT)_of_an_LLM_using_Hugging_Face_tooling.ipynb)์์ ํ์ธํ ์ ์์ต๋๋ค. ๐
+- 2024๋
์ Hugging Face ๋๊ตฌ๋ฅผ ์ฌ์ฉํด LLM์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ์ ๋ํ [๋ธ๋ก๊ทธ ํฌ์คํธ](https://www.philschmid.de/fine-tune-llms-in-2024-with-trl). ๐
+- Hugging Face์ [์ ๋ ฌ(Alignment) ํธ๋๋ถ](https://github.com/huggingface/alignment-handbook)์๋ ๋ฏธ์คํธ๋-7B๋ฅผ ์ฌ์ฉํ ์ง๋ํ ๋ฏธ์ธ ์กฐ์ (SFT) ๋ฐ ์ง์ ์ ํธ ์ต์ ํ(DPO)๋ฅผ ์ํํ๊ธฐ ์ํ ์คํฌ๋ฆฝํธ์ ๋ ์ํผ๊ฐ ํฌํจ๋์ด ์์ต๋๋ค. ์ฌ๊ธฐ์๋ ๋จ์ผ GPU์์ QLoRa ๋ฐ ๋ค์ค GPU๋ฅผ ์ฌ์ฉํ ์ ์ฒด ๋ฏธ์ธ ์กฐ์ ์ ์ํ ์คํฌ๋ฆฝํธ๊ฐ ํฌํจ๋์ด ์์ต๋๋ค.
+- [์ธ๊ณผ์ ์ธ์ด ๋ชจ๋ธ๋ง ์์
๊ฐ์ด๋](../tasks/language_modeling)
+
+## MistralConfig[[transformers.MistralConfig]]
+
+[[autodoc]] MistralConfig
+
+## MistralModel[[transformers.MistralModel]]
+
+[[autodoc]] MistralModel
+ - forward
+
+## MistralForCausalLM[[transformers.MistralForCausalLM]]
+
+[[autodoc]] MistralForCausalLM
+ - forward
+
+## MistralForSequenceClassification[[transformers.MistralForSequenceClassification]]
+
+[[autodoc]] MistralForSequenceClassification
+ - forward
+
+## MistralForTokenClassification[[transformers.MistralForTokenClassification]]
+
+[[autodoc]] MistralForTokenClassification
+ - forward
+
+## FlaxMistralModel[[transformers.FlaxMistralModel]]
+
+[[autodoc]] FlaxMistralModel
+ - __call__
+
+## FlaxMistralForCausalLM[[transformers.FlaxMistralForCausalLM]]
+
+[[autodoc]] FlaxMistralForCausalLM
+ - __call__
+
+## TFMistralModel[[transformers.TFMistralModel]]
+
+[[autodoc]] TFMistralModel
+ - call
+
+## TFMistralForCausalLM[[transformers.TFMistralForCausalLM]]
+
+[[autodoc]] TFMistralForCausalLM
+ - call
+
+## TFMistralForSequenceClassification[[transformers.TFMistralForSequenceClassification]]
+
+[[autodoc]] TFMistralForSequenceClassification
+ - call
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/openai-gpt.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/openai-gpt.md
new file mode 100644
index 0000000000000000000000000000000000000000..7e8f57c743bf7173e4fd31657abfb0b27b469f83
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/openai-gpt.md
@@ -0,0 +1,149 @@
+
+
+# OpenAI GPT [[openai-gpt]]
+
+
+
+## ๊ฐ์ [[overview]]
+
+OpenAI GPT ๋ชจ๋ธ์ Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever๊ฐ ์์ฑํ [Improving Language Understanding by Generative Pre-Training](https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf) ๋
ผ๋ฌธ์์ ์ ์๋์์ต๋๋ค. ์ด๋ Toronto Book Corpus์ ๊ฐ์ ์ฅ๊ธฐ ์์กด์ฑ์ ๊ฐ์ง ๋๊ท๋ชจ ๋ง๋ญ์น๋ฅผ ์ฌ์ฉํ์ฌ ์ธ์ด ๋ชจ๋ธ๋ง์ผ๋ก ์ฌ์ ํ์ต๋ ์ธ๊ณผ์ (๋จ๋ฐฉํฅ) ํธ๋์คํฌ๋จธ์
๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
+
+*์์ฐ์ด ์ดํด๋ ํ
์คํธ ํจ์, ์ง๋ฌธ ์๋ต, ์๋ฏธ ์ ์ฌ์ฑ ํ๊ฐ, ๋ฌธ์ ๋ถ๋ฅ์ ๊ฐ์ ๋ค์ํ ์์
์ ํฌํจํฉ๋๋ค. ๋น๋ก ๋๊ท๋ชจ์ ๋ ์ด๋ธ์ด ์๋ ํ
์คํธ ๋ง๋ญ์น๊ฐ ํ๋ถํ๊ธฐ๋ ํ์ง๋ง, ์ด๋ฌํ ํน์ ์์
์ ๋ํ ํ์ต์ ์ํ ๋ ์ด๋ธ๋ ๋ฐ์ดํฐ๋ ๋ถ์กฑํ์ฌ ํ๋ณ์ ์ผ๋ก ํ์ต๋ ๋ชจ๋ธ์ด ์ ์ ํ๊ฒ ์ฑ๋ฅ์ ๋ฐํํ๊ธฐ ์ด๋ ต์ต๋๋ค. ์ฐ๋ฆฌ๋ ๋ค์ํ ๋ ์ด๋ธ์ด ์๋ ํ
์คํธ ๋ง๋ญ์น์ ๋ํ ์ธ์ด ๋ชจ๋ธ์ ์์ฑ์ ์ฌ์ ํ์ต์ ์ํํ๊ณ , ๊ฐ ํน์ ๊ณผ์ ์ ๋ํ ํ๋ณ์ ๋ฏธ์ธ ์กฐ์ ์ ์ํํจ์ผ๋ก์จ ์ด๋ฌํ ๊ณผ์ ์์ ํฐ ์ฑ๊ณผ๋ฅผ ๋ฌ์ฑํ ์ ์์์ ๋ณด์ฌ์ค๋๋ค. ์ด์ ์ ๊ทผ ๋ฐฉ์๊ณผ ๋ฌ๋ฆฌ, ์ฐ๋ฆฌ๋ ๋ชจ๋ธ ์ํคํ
์ฒ์ ์ต์ํ์ ๋ณํ๋ฅผ ์๊ตฌํ๋ฉด์ ํจ๊ณผ์ ์ธ ์ ์ด๋ฅผ ๋ฌ์ฑํ๊ธฐ ์ํด ๋ฏธ์ธ ์กฐ์ ์ค์ ๊ณผ์ ์ธ์ ์
๋ ฅ ๋ณํ(task-aware input transformation)์ ์ฌ์ฉํฉ๋๋ค. ์ฐ๋ฆฌ๋ ์์ฐ์ด ์ดํด๋ฅผ ์ํ ๋ค์ํ ๋ฒค์น๋งํฌ์์ ์ฐ๋ฆฌ์ ์ ๊ทผ ๋ฐฉ์์ ํจ๊ณผ๋ฅผ ์
์ฆํฉ๋๋ค. ์ฐ๋ฆฌ์ general task-agnostic ๋ชจ๋ธ์ ๊ฐ ๊ณผ์ ์ ํน๋ณํ ์ค๊ณ๋ ์ํคํ
์ฒ๋ฅผ ์ฌ์ฉํ๋ ํ๋ณ์ ์ผ๋ก ํ์ต๋ ๋ชจ๋ธ๋ณด๋ค ๋ฐ์ด๋๋ฉฐ, ์ฐ๊ตฌ๋ 12๊ฐ ๊ณผ์ ์ค 9๊ฐ ๋ถ๋ฌธ์์ ์ต์ฒจ๋จ ์ฑ๋ฅ(state of the art)์ ํฌ๊ฒ ํฅ์์ํต๋๋ค.*
+
+[Write With Transformer](https://transformer.huggingface.co/doc/gpt)๋ Hugging Face๊ฐ ๋ง๋ ์น ์ ํ๋ฆฌ์ผ์ด์
์ผ๋ก, ์ฌ๋ฌ ๋ชจ๋ธ์ ์์ฑ ๋ฅ๋ ฅ์ ๋ณด์ฌ์ฃผ๋ฉฐ ๊ทธ ์ค์๋ GPT๋ ํฌํจ๋์ด ์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ [thomwolf](https://huggingface.co/thomwolf)์ ์ํด ๊ธฐ์ฌ๋์์ผ๋ฉฐ, ์๋ณธ ์ฝ๋๋ [์ฌ๊ธฐ](https://github.com/openai/finetune-transformer-lm)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ [[usage-tips]]
+
+- GPT๋ ์ ๋ ์์น ์๋ฒ ๋ฉ์ ์ฌ์ฉํ๋ ๋ชจ๋ธ์ด๋ฏ๋ก ์
๋ ฅ์ ์ผ๋ฐ์ ์ผ๋ก ์ผ์ชฝ๋ณด๋ค๋ ์ค๋ฅธ์ชฝ์ ํจ๋ฉํ๋ ๊ฒ์ด ๊ถ์ฅ๋ฉ๋๋ค.
+- GPT๋ ์ธ๊ณผ ์ธ์ด ๋ชจ๋ธ๋ง(Causal Language Modeling, CLM) ๋ชฉํ๋ก ํ์ต๋์๊ธฐ ๋๋ฌธ์ ์ํ์ค์์ ๋ค์ ํ ํฐ์ ์์ธกํ๋ ๋ฐ ๊ฐ๋ ฅํ ์ฑ๋ฅ์ ๋ณด์ฌ์ค๋๋ค. ์ด๋ฅผ ํ์ฉํ๋ฉด *run_generation.py* ์์ ์คํฌ๋ฆฝํธ์์ ๋ณผ ์ ์๋ฏ์ด GPT-2๋ ๊ตฌ๋ฌธ์ ์ผ๋ก ์ผ๊ด๋ ํ
์คํธ๋ฅผ ์์ฑํ ์ ์์ต๋๋ค.
+
+์ฐธ๊ณ :
+
+*OpenAI GPT* ๋
ผ๋ฌธ์ ์๋ ํ ํฐํ ๊ณผ์ ์ ์ฌํํ๋ ค๋ฉด `ftfy`์ `SpaCy`๋ฅผ ์ค์นํด์ผ ํฉ๋๋ค:
+
+```bash
+pip install spacy ftfy==4.4.3
+python -m spacy download en
+```
+
+`ftfy`์ `SpaCy`๋ฅผ ์ค์นํ์ง ์์ผ๋ฉด [`OpenAIGPTTokenizer`]๋ ๊ธฐ๋ณธ์ ์ผ๋ก BERT์ `BasicTokenizer`๋ฅผ ์ฌ์ฉํ ํ Byte-Pair Encoding์ ํตํด ํ ํฐํํฉ๋๋ค(๋๋ถ๋ถ์ ์ฌ์ฉ์ ๋ฌธ์ ๊ฐ ์์ผ๋ ๊ฑฑ์ ํ์ง ๋ง์ธ์).
+
+## ๋ฆฌ์์ค [[resources]]
+
+OpenAI GPT๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ ๊ณต์ Hugging Face ๋ฐ ์ปค๋ฎค๋ํฐ(๐ ํ์) ๋ฆฌ์์ค ๋ชฉ๋ก์
๋๋ค. ์ฌ๊ธฐ์ ๋ฆฌ์์ค๋ฅผ ์ถ๊ฐํ๊ณ ์ถ๋ค๋ฉด, Pull Request๋ฅผ ์ด์ด์ฃผ์๋ฉด ๊ฒํ ํ๊ฒ ์ต๋๋ค! ๋ฆฌ์์ค๋ ๊ธฐ์กด ๋ฆฌ์์ค๋ฅผ ๋ณต์ ํ์ง ์๊ณ ์๋ก์ด ๊ฒ์ ๋ณด์ฌ์ฃผ๋ ๊ฒ์ด ์ข์ต๋๋ค.
+
+
+
+- [SetFit์ ์ฌ์ฉํ์ฌ ํ
์คํธ ๋ถ๋ฅ์์ OpenAI GPT-3์ ๋ฅ๊ฐํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/getting-started-setfit) ๋ธ๋ก๊ทธ ๊ฒ์๋ฌผ.
+- ์ถ๊ฐ ์๋ฃ: [ํ
์คํธ ๋ถ๋ฅ ๊ณผ์ ๊ฐ์ด๋](../tasks/sequence_classification)
+
+
+
+- [Hugging Face์ ํจ๊ป ๋น์์ด GPT-2 ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ](https://www.philschmid.de/fine-tune-a-non-english-gpt-2-model-with-huggingface) ๋ธ๋ก๊ทธ.
+- GPT-2์ ํจ๊ป [Transformers๋ฅผ ์ฌ์ฉํ ์ธ์ด ์์ฑ์ ๋ค์ํ ๋์ฝ๋ฉ ๋ฐฉ๋ฒ](https://huggingface.co/blog/how-to-generate)์ ๋ํ ๋ธ๋ก๊ทธ.
+- [Scratch์์ CodeParrot ๐ฆ์ ํ๋ จํ๋ ๋ฐฉ๋ฒ](https://huggingface.co/blog/codeparrot), ๋๊ท๋ชจ GPT-2 ๋ชจ๋ธ์ ๋ํ ๋ธ๋ก๊ทธ.
+- GPT-2์ ํจ๊ป [TensorFlow ๋ฐ XLA๋ฅผ ์ฌ์ฉํ ๋ ๋น ๋ฅธ ํ
์คํธ ์์ฑ](https://huggingface.co/blog/tf-xla-generate)์ ๋ํ ๋ธ๋ก๊ทธ.
+- [Megatron-LM์ผ๋ก ์ธ์ด ๋ชจ๋ธ์ ํ๋ จํ๋ ๋ฐฉ๋ฒ](https://huggingface.co/blog/megatron-training)์ ๋ํ ๋ธ๋ก๊ทธ.
+- [์ข์ํ๋ ์ํฐ์คํธ์ ์คํ์ผ๋ก ๊ฐ์ฌ๋ฅผ ์์ฑํ๋๋ก GPT2๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ](https://colab.research.google.com/github/AlekseyKorshuk/huggingartists/blob/master/huggingartists-demo.ipynb)์ ๋ํ ๋
ธํธ๋ถ. ๐
+- [์ข์ํ๋ ํธ์ํฐ ์ฌ์ฉ์์ ์คํ์ผ๋ก ํธ์์ ์์ฑํ๋๋ก GPT2๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ](https://colab.research.google.com/github/borisdayma/huggingtweets/blob/master/huggingtweets-demo.ipynb)์ ๋ํ ๋
ธํธ๋ถ. ๐
+- ๐ค Hugging Face ์ฝ์ค์ [์ธ๊ณผ ์ธ์ด ๋ชจ๋ธ๋ง](https://huggingface.co/course/en/chapter7/6?fw=pt#training-a-causal-language-model-from-scratch) ์ฅ.
+- [`OpenAIGPTLMHeadModel`]์ [์ธ๊ณผ ์ธ์ด ๋ชจ๋ธ๋ง ์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#gpt-2gpt-and-causal-language-modeling), [ํ
์คํธ ์์ฑ ์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/blob/main/examples/pytorch/text-generation/run_generation.py) ๋ฐ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb)์ ์ํด ์ง์๋ฉ๋๋ค.
+- [`TFOpenAIGPTLMHeadModel`]์ [์ธ๊ณผ ์ธ์ด ๋ชจ๋ธ๋ง ์์ ์คํฌ๋ฆฝํธ](https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_clmpy) ๋ฐ [๋
ธํธ๋ถ](https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb)์ ์ํด ์ง์๋ฉ๋๋ค.
+- ์ถ๊ฐ ์๋ฃ: [์ธ๊ณผ ์ธ์ด ๋ชจ๋ธ๋ง ๊ณผ์ ๊ฐ์ด๋](../tasks/language_modeling)
+
+
+
+- [Byte-Pair Encoding ํ ํฐํ](https://huggingface.co/course/en/chapter6/5)์ ๋ํ ๊ฐ์ ์๋ฃ.
+
+## OpenAIGPTConfig [[transformers.OpenAIGPTConfig]]
+
+[[autodoc]] OpenAIGPTConfig
+
+## OpenAIGPTTokenizer [[transformers.OpenAIGPTTokenizer]]
+
+[[autodoc]] OpenAIGPTTokenizer
+ - save_vocabulary
+
+## OpenAIGPTTokenizerFast [[transformers.OpenAIGPTTokenizerFast]]
+
+[[autodoc]] OpenAIGPTTokenizerFast
+
+## OpenAI specific outputs [[transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput]]
+
+[[autodoc]] models.openai.modeling_openai.OpenAIGPTDoubleHeadsModelOutput
+
+[[autodoc]] models.openai.modeling_tf_openai.TFOpenAIGPTDoubleHeadsModelOutput
+
+
+
+
+## OpenAIGPTModel [[transformers.OpenAIGPTModel]]
+
+[[autodoc]] OpenAIGPTModel
+ - forward
+
+## OpenAIGPTLMHeadModel [[transformers.OpenAIGPTLMHeadModel]]
+
+[[autodoc]] OpenAIGPTLMHeadModel
+ - forward
+
+## OpenAIGPTDoubleHeadsModel [[transformers.OpenAIGPTDoubleHeadsModel]]
+
+[[autodoc]] OpenAIGPTDoubleHeadsModel
+ - forward
+
+## OpenAIGPTForSequenceClassification [[transformers.OpenAIGPTForSequenceClassification]]
+
+[[autodoc]] OpenAIGPTForSequenceClassification
+ - forward
+
+
+
+
+## TFOpenAIGPTModel [[transformers.TFOpenAIGPTModel]]
+
+[[autodoc]] TFOpenAIGPTModel
+ - call
+
+## TFOpenAIGPTLMHeadModel [[transformers.TFOpenAIGPTLMHeadModel]]
+
+[[autodoc]] TFOpenAIGPTLMHeadModel
+ - call
+
+## TFOpenAIGPTDoubleHeadsModel [[transformers.TFOpenAIGPTDoubleHeadsModel]]
+
+[[autodoc]] TFOpenAIGPTDoubleHeadsModel
+ - call
+
+## TFOpenAIGPTForSequenceClassification [[transformers.TFOpenAIGPTForSequenceClassification]]
+
+[[autodoc]] TFOpenAIGPTForSequenceClassification
+ - call
+
+
+
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/paligemma.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/paligemma.md
new file mode 100644
index 0000000000000000000000000000000000000000..9f5b48086855094ed1d0ad9e746c486760c60ef5
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/paligemma.md
@@ -0,0 +1,80 @@
+
+
+# PaliGemma[[paligemma]]
+
+## ๊ฐ์[[overview]]
+
+PaliGemma ๋ชจ๋ธ์ ๊ตฌ๊ธ์ด ์ ์ํ [PaliGemma โ Google์ ์ต์ฒจ๋จ ์คํ ๋น์ ์ธ์ด ๋ชจ๋ธ](https://huggingface.co/blog/paligemma)์์ ์๊ฐ ๋์์ต๋๋ค. PaliGemma๋ [SigLIP](siglip) ๋น์ ์ธ์ฝ๋์ [Gemma](gemma) ์ธ์ด ์ธ์ฝ๋๋ก ๊ตฌ์ฑ๋ 3B ๊ท๋ชจ์ ๋น์ -์ธ์ด ๋ชจ๋ธ๋ก, ๋ ์ธ์ฝ๋๊ฐ ๋ฉํฐ๋ชจ๋ฌ ์ ํ ํ๋ก์ ์
์ผ๋ก ์ฐ๊ฒฐ๋์ด ์์ต๋๋ค. ์ด ๋ชจ๋ธ์ ์ด๋ฏธ์ง๋ฅผ ๊ณ ์ ๋ ์์ VITํ ํฐ์ผ๋ก ๋ถํ ํ๊ณ ์ด๋ฅผ ์ ํ์ ํ๋กฌํํธ ์์ ์ถ๊ฐ ํ๋ฉฐ, ๋ชจ๋ ์ด๋ฏธ์ง ํ ํฐ๊ณผ ์
๋ ฅ ํ
์คํธ ํ ํฐ์ ๋ํด ์ ์ฒด ๋ธ๋ก ์ดํ
์
์ ์ฌ์ฉํ๋ ํน์ง์ ๊ฐ์ง๊ณ ์์ต๋๋ค.
+
+PaliGemma๋ 224x224, 448x448, 896x896์ 3๊ฐ์ง ํด์๋๋ก ์ ๊ณต๋๋ฉฐ, 3๊ฐ์ ๊ธฐ๋ณธ ๋ชจ๋ธ๊ณผ 55๊ฐ์ ๋ค์ํ ์์
์ ๋ํด ๋ฏธ์ธ ์กฐ์ ๋ ๋ฒ์ , ๊ทธ๋ฆฌ๊ณ 2๊ฐ์ ํผํฉ ๋ชจ๋ธ์ด ์์ต๋๋ค.
+
+
+
+ PaliGemma ์ํคํ
์ฒ ๋ธ๋ก๊ทธ ํฌ์คํธ.
+
+์ด ๋ชจ๋ธ์ [Molbap](https://huggingface.co/Molbap)์ ์ํด ๊ธฐ์ฌ ๋์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+PaliGemma์ ์ถ๋ก ์ ๋ค์์ฒ๋ผ ์ํ๋ฉ๋๋ค:
+
+```python
+from transformers import AutoProcessor, PaliGemmaForConditionalGeneration
+
+model_id = "google/paligemma-3b-mix-224"
+model = PaliGemmaForConditionalGeneration.from_pretrained(model_id)
+processor = AutoProcessor.from_pretrained(model_id)
+
+prompt = "What is on the flower?"
+image_file = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/bee.jpg?download=true"
+raw_image = Image.open(requests.get(image_file, stream=True).raw)
+inputs = processor(raw_image, prompt, return_tensors="pt")
+output = model.generate(**inputs, max_new_tokens=20)
+
+print(processor.decode(output[0], skip_special_tokens=True)[len(prompt):])
+```
+
+- PaliGemma๋ ๋ํ์ฉ์ผ๋ก ์ค๊ณ๋์ง ์์์ผ๋ฉฐ, ํน์ ์ฌ์ฉ ์ฌ๋ก์ ๋ํด ๋ฏธ์ธ ์กฐ์ ํ ๋ ๊ฐ์ฅ ์ ์๋ํฉ๋๋ค. PaliGemma๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ ์ ์๋ ๋ช ๊ฐ์ง ํ์ ์์
์๋ ์ด๋ฏธ์ง ์บก์
๋, ์๊ฐ์ ์ง๋ฌธ ๋ต๋ณ(VQA), ์ค๋ธ์ ํธ ๋ํ
์
, ์ฐธ์กฐ ํํ ๋ถํ ๋ฐ ๋ฌธ์ ์ดํด๊ฐ ํฌํจ๋ฉ๋๋ค.
+- ๋ชจ๋ธ์ ํ์ํ ์ด๋ฏธ์ง, ํ
์คํธ ๋ฐ ์ ํ์ ๋ ์ด๋ธ์ ์ค๋นํ๋๋ฐ `PaliGemmaProcessor`๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. PaliGemma ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ ๋๋, ํ๋ก์ธ์์ `suffix`์ธ์๋ฅผ ์ ๋ฌํ์ฌ ๋ค์ ์ฒ๋ผ ๋ชจ๋ธ์ `labels`๋ฅผ ์์ฑํ ์ ์์ต๋๋ค:
+
+```python
+prompt = "What is on the flower?"
+answer = "a bee"
+inputs = processor(images=raw_image, text=prompt, suffix=answer, return_tensors="pt")
+```
+
+## ์๋ฃ[[resources]]
+
+PaliGemma๋ฅผ ์์ํ๋ ๋ฐ ๋์์ด ๋๋ Hugging Face์ community ์๋ฃ ๋ชฉ๋ก(๐๋ก ํ์๋จ) ์
๋๋ค.์ฌ๊ธฐ์ ํฌํจ๋ ์๋ฃ๋ฅผ ์ ์ถํ๊ณ ์ถ์ผ์๋ค๋ฉด PR(Pull Request)๋ฅผ ์ด์ด์ฃผ์ธ์. ๋ฆฌ๋ทฐ ํด๋๋ฆฌ๊ฒ ์ต๋๋ค! ์๋ฃ๋ ๊ธฐ์กด ์๋ฃ๋ฅผ ๋ณต์ ํ๋ ๋์ ์๋ก์ด ๋ด์ฉ์ ๋ด๊ณ ์์ด์ผ ํฉ๋๋ค.
+
+- PaliGemma์ ๋ชจ๋ ๊ธฐ๋ฅ์ ์๊ฐํ๋ ๋ธ๋ก๊ทธ ํฌ์คํธ๋ [์ด๊ณณ](https://huggingface.co/blog/paligemma)์์ ์ฐพ์ ์ ์์ต๋๋ค. ๐
+- Trainer API๋ฅผ ์ฌ์ฉํ์ฌ VQA(Visual Question Answering)๋ฅผ ์ํด PaliGemma๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ๊ณผ ์ถ๋ก ์ ๋ํ ๋ฐ๋ชจ ๋
ธํธ๋ถ์ [์ด๊ณณ](https://github.com/huggingface/notebooks/tree/main/examples/paligemma)์์ ์ฐพ์ ์ ์์ต๋๋ค. ๐
+- ์ฌ์ฉ์ ์ ์ ๋ฐ์ดํฐ์
(์์์ฆ ์ด๋ฏธ์ง -> JSON)์ ๋ํด PaliGemma๋ฅผ ๋ฏธ์ธ ์กฐ์ ํ๋ ๋ฐฉ๋ฒ๊ณผ ์ถ๋ก ์ ๋ํ ๋ฐ๋ชจ ๋
ธํธ๋ถ์ [์ด๊ณณ](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/PaliGemma)์์ ์ฐพ์ ์ ์์ต๋๋ค. ๐
+
+## PaliGemmaConfig[[transformers.PaliGemmaConfig]]
+
+[[autodoc]] PaliGemmaConfig
+
+## PaliGemmaProcessor[[transformers.PaliGemmaProcessor]]
+
+[[autodoc]] PaliGemmaProcessor
+
+## PaliGemmaForConditionalGeneration[[transformers.PaliGemmaForConditionalGeneration]]
+
+[[autodoc]] PaliGemmaForConditionalGeneration
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/patchtsmixer.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/patchtsmixer.md
new file mode 100644
index 0000000000000000000000000000000000000000..e1463eb85de3e5aca2623fe038da4b249f9c629c
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/patchtsmixer.md
@@ -0,0 +1,95 @@
+
+
+# PatchTSMixer[[patchtsmixer]]
+
+## ๊ฐ์[[overview]]
+
+PatchTSMixer ๋ชจ๋ธ์ Vijay Ekambaram, Arindam Jati, Nam Nguyen, Phanwadee Sinthong, Jayant Kalagnanam์ด ์ ์ํ [TSMixer: ๋ค๋ณ๋ ์๊ณ์ด ์์ธก์ ์ํ ๊ฒฝ๋ MLP-Mixer ๋ชจ๋ธ](https://arxiv.org/pdf/2306.09364.pdf)์ด๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ๋์์ต๋๋ค.
+
+
+PatchTSMixer๋ MLP-Mixer ์ํคํ
์ฒ๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ ๊ฒฝ๋ ์๊ณ์ด ๋ชจ๋ธ๋ง ์ ๊ทผ๋ฒ์
๋๋ค. ํ๊น
ํ์ด์ค ๊ตฌํ์์๋ PatchTSMixer์ ๊ธฐ๋ฅ์ ์ ๊ณตํ์ฌ ํจ์น, ์ฑ๋, ์จ๊ฒจ์ง ํน์ฑ ๊ฐ์ ๊ฒฝ๋ ํผํฉ์ ์ฝ๊ฒ ์ํํ์ฌ ํจ๊ณผ์ ์ธ ๋ค๋ณ๋ ์๊ณ์ด ๋ชจ๋ธ๋ง์ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. ๋ํ ๊ฐ๋จํ ๊ฒ์ดํธ ์ดํ
์
๋ถํฐ ์ฌ์ฉ์ ์ ์๋ ๋ ๋ณต์กํ ์
ํ ์ดํ
์
๋ธ๋ก๊น์ง ๋ค์ํ ์ดํ
์
๋ฉ์ปค๋์ฆ์ ์ง์ํฉ๋๋ค. ์ด ๋ชจ๋ธ์ ์ฌ์ ํ๋ จ๋ ์ ์์ผ๋ฉฐ ์ดํ ์์ธก, ๋ถ๋ฅ, ํ๊ท์ ๊ฐ์ ๋ค์ํ ๋ค์ด์คํธ๋ฆผ ์์
์ ์ฌ์ฉ๋ ์ ์์ต๋๋ค.
+
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*TSMixer๋ ํจ์น ์ฒ๋ฆฌ๋ ์๊ณ์ด์ ๋ค๋ณ๋ ์์ธก ๋ฐ ํํ ํ์ต์ ์ํด ์ค๊ณ๋ ๋ค์ธต ํผ์
ํธ๋ก (MLP) ๋ชจ๋๋ก๋ง ๊ตฌ์ฑ๋ ๊ฒฝ๋ ์ ๊ฒฝ๋ง ์ํคํ
์ฒ์
๋๋ค. ์ฐ๋ฆฌ์ ๋ชจ๋ธ์ ์ปดํจํฐ ๋น์ ๋ถ์ผ์์ MLP-Mixer ๋ชจ๋ธ์ ์ฑ๊ณต์์ ์๊ฐ์ ๋ฐ์์ต๋๋ค. ์ฐ๋ฆฌ๋ Vision MLP-Mixer๋ฅผ ์๊ณ์ด์ ์ ์ฉํ๋ ๋ฐ ๋ฐ๋ฅด๋ ๊ณผ์ ๋ฅผ ๋ณด์ฌ์ฃผ๊ณ , ์ ํ๋๋ฅผ ํฅ์์ํค๊ธฐ ์ํด ๊ฒฝํ์ ์ผ๋ก ๊ฒ์ฆ๋ ๊ตฌ์ฑ ์์๋ค์ ๋์
ํฉ๋๋ค. ์ฌ๊ธฐ์๋ ๊ณ์ธต ๊ตฌ์กฐ ๋ฐ ์ฑ๋ ์๊ด๊ด๊ณ์ ๊ฐ์ ์๊ณ์ด ํน์ฑ์ ๋ช
์์ ์ผ๋ก ๋ชจ๋ธ๋งํ๊ธฐ ์ํด MLP-Mixer ๋ฐฑ๋ณธ์ ์จ๋ผ์ธ ์กฐ์ ํค๋๋ฅผ ๋ถ์ฐฉํ๋ ์๋ก์ด ์ค๊ณ ํจ๋ฌ๋ค์์ด ํฌํจ๋ฉ๋๋ค. ๋ํ ๊ธฐ์กด ํจ์น ์ฑ๋ ํผํฉ ๋ฐฉ๋ฒ์ ์ผ๋ฐ์ ์ธ ๋ฌธ์ ์ธ ๋
ธ์ด์ฆ๊ฐ ์๋ ์ฑ๋ ์ํธ์์ฉ์ ํจ๊ณผ์ ์ผ๋ก ์ฒ๋ฆฌํ๊ณ ๋ค์ํ ๋ฐ์ดํฐ์
์ ๊ฑธ์ณ ์ผ๋ฐํํ๊ธฐ ์ํ ํ์ด๋ธ๋ฆฌ๋ ์ฑ๋ ๋ชจ๋ธ๋ง ์ ๊ทผ๋ฒ์ ์ ์ํฉ๋๋ค. ์ถ๊ฐ๋ก, ์ค์ํ ํน์ฑ์ ์ฐ์ ์ํ๊ธฐ ์ํด ๋ฐฑ๋ณธ์ ๊ฐ๋จํ ๊ฒ์ดํธ ์ฃผ์ ๋ฉ์ปค๋์ฆ์ ๋์
ํฉ๋๋ค. ์ด๋ฌํ ๊ฒฝ๋ ๊ตฌ์ฑ ์์๋ค์ ํตํฉํจ์ผ๋ก์จ, ์ฐ๋ฆฌ๋ ๋จ์ํ MLP ๊ตฌ์กฐ์ ํ์ต ๋ฅ๋ ฅ์ ํฌ๊ฒ ํฅ์์์ผ ์ต์ํ์ ์ปดํจํ
์ฌ์ฉ์ผ๋ก ๋ณต์กํ ํธ๋์คํฌ๋จธ ๋ชจ๋ธ๋ค์ ๋ฅ๊ฐํ๋ ์ฑ๋ฅ์ ๋ฌ์ฑํฉ๋๋ค. ๋์ฑ์ด, TSMixer์ ๋ชจ๋์ ์ค๊ณ๋ ๊ฐ๋
ํ์ต๊ณผ ๋ง์คํฌ ์๊ธฐ ๊ฐ๋
ํ์ต ๋ฐฉ๋ฒ ๋ชจ๋์ ํธํ๋์ด ์๊ณ์ด ๊ธฐ์ด ๋ชจ๋ธ์ ์ ๋งํ ๊ตฌ์ฑ ์์๊ฐ ๋ฉ๋๋ค. TSMixer๋ ์์ธก ์์
์์ ์ต์ฒจ๋จ MLP ๋ฐ ํธ๋์คํฌ๋จธ ๋ชจ๋ธ๋ค์ ์๋นํ ์ฐจ์ด(8-60%)๋ก ๋ฅ๊ฐํฉ๋๋ค. ๋ํ ์ต์ ์ ๊ฐ๋ ฅํ Patch-Transformer ๋ชจ๋ธ ๋ฒค์น๋งํฌ๋ค์ ๋ฉ๋ชจ๋ฆฌ์ ์คํ ์๊ฐ์ ํฌ๊ฒ ์ค์ด๋ฉด์(2-3๋ฐฐ) ์ฑ๋ฅ ๋ฉด์์๋ ์์ญ๋๋ค(1-2%).*
+
+์ด ๋ชจ๋ธ์ [ajati](https://huggingface.co/ajati), [vijaye12](https://huggingface.co/vijaye12),
+[gsinthong](https://huggingface.co/gsinthong), [namctin](https://huggingface.co/namctin),
+[wmgifford](https://huggingface.co/wmgifford), [kashif](https://huggingface.co/kashif)๊ฐ ๊ธฐ์ฌํ์ต๋๋ค.
+
+## ์ฌ์ฉ ์[[usage-example]]
+
+์๋์ ์ฝ๋ ์ค๋ํซ์ PatchTSMixer ๋ชจ๋ธ์ ๋ฌด์์๋ก ์ด๊ธฐํํ๋ ๋ฐฉ๋ฒ์ ๋ณด์ฌ์ค๋๋ค.
+PatchTSMixer ๋ชจ๋ธ์ [Trainer API](../trainer.md)์ ํธํ๋ฉ๋๋ค.
+
+```python
+
+from transformers import PatchTSMixerConfig, PatchTSMixerForPrediction
+from transformers import Trainer, TrainingArguments,
+
+
+config = PatchTSMixerConfig(context_length = 512, prediction_length = 96)
+model = PatchTSMixerForPrediction(config)
+trainer = Trainer(model=model, args=training_args,
+ train_dataset=train_dataset,
+ eval_dataset=valid_dataset)
+trainer.train()
+results = trainer.evaluate(test_dataset)
+```
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+์ด ๋ชจ๋ธ์ ์๊ณ์ด ๋ถ๋ฅ์ ์๊ณ์ด ํ๊ท์๋ ์ฌ์ฉ๋ ์ ์์ต๋๋ค. ๊ฐ๊ฐ[`PatchTSMixerForTimeSeriesClassification`]์ [`PatchTSMixerForRegression`] ํด๋์ค๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+## ์๋ฃ[[resources]]
+
+- PatchTSMixer๋ฅผ ์์ธํ ์ค๋ช
ํ๋ ๋ธ๋ก๊ทธ ํฌ์คํธ๋ ์ฌ๊ธฐ์์ ์ฐพ์ ์ ์์ต๋๋ค [์ด๊ณณ](https://huggingface.co/blog/patchtsmixer). ์ด ๋ธ๋ก๊ทธ๋ Google Colab์์๋ ์ด์ด๋ณผ ์ ์์ต๋๋ค.
+
+## PatchTSMixerConfig[[transformers.PatchTSMixerConfig]]
+
+[[autodoc]] PatchTSMixerConfig
+
+
+## PatchTSMixerModel[[transformers.PatchTSMixerModel]]
+
+[[autodoc]] PatchTSMixerModel
+ - forward
+
+
+## PatchTSMixerForPrediction[[transformers.PatchTSMixerForPrediction]]
+
+[[autodoc]] PatchTSMixerForPrediction
+ - forward
+
+
+## PatchTSMixerForTimeSeriesClassification[[transformers.PatchTSMixerForTimeSeriesClassification]]
+
+[[autodoc]] PatchTSMixerForTimeSeriesClassification
+ - forward
+
+
+## PatchTSMixerForPretraining[[transformers.PatchTSMixerForPretraining]]
+
+[[autodoc]] PatchTSMixerForPretraining
+ - forward
+
+
+## PatchTSMixerForRegression[[transformers.PatchTSMixerForRegression]]
+
+[[autodoc]] PatchTSMixerForRegression
+ - forward
\ No newline at end of file
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/patchtst.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/patchtst.md
new file mode 100644
index 0000000000000000000000000000000000000000..fc9b0eb51e4a427b26f832a30e8d5c007e9a9bb1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/patchtst.md
@@ -0,0 +1,76 @@
+
+
+# PatchTST[[patchtst]]
+
+## ๊ฐ์[[overview]]
+
+The PatchTST ๋ชจ๋ธ์ Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, Jayant Kalagnanam์ด ์ ์ํ [์๊ณ์ด ํ๋๊ฐ 64๊ฐ์ ๋จ์ด๋งํผ ๊ฐ์น์๋ค: ํธ๋์คํฌ๋จธ๋ฅผ ์ด์ฉํ ์ฅ๊ธฐ์์ธก](https://arxiv.org/abs/2211.14730)๋ผ๋ ๋
ผ๋ฌธ์์ ์๊ฐ๋์์ต๋๋ค.
+
+์ด ๋ชจ๋ธ์ ๊ณ ์์ค์์ ์๊ณ์ด์ ์ฃผ์ด์ง ํฌ๊ธฐ์ ํจ์น๋ก ๋ฒกํฐํํ๊ณ , ๊ฒฐ๊ณผ๋ก ๋์จ ๋ฒกํฐ ์ํ์ค๋ฅผ ํธ๋์คํฌ๋จธ๋ฅผ ํตํด ์ธ์ฝ๋ฉํ ๋ค์ ์ ์ ํ ํค๋๋ฅผ ํตํด ์์ธก ๊ธธ์ด์ ์์ธก์ ์ถ๋ ฅํฉ๋๋ค. ๋ชจ๋ธ์ ๋ค์ ๊ทธ๋ฆผ๊ณผ ๊ฐ์ด ๋์ํ๋ฉ๋๋ค:
+
+
+
+ํด๋น ๋
ผ๋ฌธ์ ์ด๋ก์
๋๋ค:
+
+*์ฐ๋ฆฌ๋ ๋ค๋ณ๋ ์๊ณ์ด ์์ธก๊ณผ ์๊ธฐ ๊ฐ๋
ํํ ํ์ต์ ์ํ ํจ์จ์ ์ธ ํธ๋์คํฌ๋จธ ๊ธฐ๋ฐ ๋ชจ๋ธ ์ค๊ณ๋ฅผ ์ ์ํฉ๋๋ค. ์ด๋ ๋ ๊ฐ์ง ์ฃผ์ ๊ตฌ์ฑ ์์๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค:
+
+(i) ์๊ณ์ด์ ํ์ ์๋ฆฌ์ฆ ์์ค์ ํจ์น๋ก ๋ถํ ํ์ฌ ํธ๋์คํฌ๋จธ์ ์
๋ ฅ ํ ํฐ์ผ๋ก ์ฌ์ฉ
+(ii) ๊ฐ ์ฑ๋์ด ๋ชจ๋ ์๋ฆฌ์ฆ์ ๊ฑธ์ณ ๋์ผํ ์๋ฒ ๋ฉ๊ณผ ํธ๋์คํฌ๋จธ ๊ฐ์ค์น๋ฅผ ๊ณต์ ํ๋ ๋จ์ผ ๋จ๋ณ๋ ์๊ณ์ด์ ํฌํจํ๋ ์ฑ๋ ๋
๋ฆฝ์ฑ. ํจ์นญ ์ค๊ณ๋ ์์ฐ์ค๋ฝ๊ฒ ์ธ ๊ฐ์ง ์ด์ ์ ๊ฐ์ง๋๋ค:
+ - ์ง์ญ์ ์๋ฏธ ์ ๋ณด๊ฐ ์๋ฒ ๋ฉ์ ์ ์ง๋ฉ๋๋ค;
+ - ๋์ผํ ๋ฃฉ๋ฐฑ ์๋์ฐ์ ๋ํด ์ดํ
์
๋งต์ ๊ณ์ฐ๊ณผ ๋ฉ๋ชจ๋ฆฌ ์ฌ์ฉ๋์ด ์ ๊ณฑ์ผ๋ก ๊ฐ์ํฉ๋๋ค
+ - ๋ชจ๋ธ์ด ๋ ๊ธด ๊ณผ๊ฑฐ๋ฅผ ์ฐธ์กฐํ ์ ์์ต๋๋ค.
+ ์ฐ๋ฆฌ์ ์ฑ๋ ๋
๋ฆฝ์ ํจ์น ์๊ณ์ด ํธ๋์คํฌ๋จธ(PatchTST)๋ ์ต์ ํธ๋์คํฌ๋จธ ๊ธฐ๋ฐ ๋ชจ๋ธ๋ค๊ณผ ๋น๊ตํ์ ๋ ์ฅ๊ธฐ ์์ธก ์ ํ๋๋ฅผ ํฌ๊ฒ ํฅ์์ํฌ ์ ์์ต๋๋ค. ๋ํ ๋ชจ๋ธ์ ์๊ธฐ์ง๋ ์ฌ์ ํ๋ จ ์์
์ ์ ์ฉํ์ฌ, ๋๊ท๋ชจ ๋ฐ์ดํฐ์
์ ๋ํ ์ง๋ ํ์ต์ ๋ฅ๊ฐํ๋ ์์ฃผ ๋ฐ์ด๋ ๋ฏธ์ธ ์กฐ์ ์ฑ๋ฅ์ ๋ฌ์ฑํ์ต๋๋ค. ํ ๋ฐ์ดํฐ์
์์ ๋ง์คํฌ๋ ์ฌ์ ํ๋ จ ํํ์ ๋ค๋ฅธ ๋ฐ์ดํฐ์
์ผ๋ก ์ ์ดํ๋ ๊ฒ๋ ์ต๊ณ ์์ค์ ์์ธก ์ ํ๋(SOTA)๋ฅผ ์ฐ์ถํ์ต๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [namctin](https://huggingface.co/namctin), [gsinthong](https://huggingface.co/gsinthong), [diepi](https://huggingface.co/diepi), [vijaye12](https://huggingface.co/vijaye12), [wmgifford](https://huggingface.co/wmgifford), [kashif](https://huggingface.co/kashif)์ ์ํด ๊ธฐ์ฌ ๋์์ต๋๋ค. ์๋ณธ์ฝ๋๋ [์ด๊ณณ](https://github.com/yuqinie98/PatchTST)์์ ํ์ธํ ์ ์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ[[usage-tips]]
+
+์ด ๋ชจ๋ธ์ ์๊ณ์ด ๋ถ๋ฅ์ ์๊ณ์ด ํ๊ท์๋ ์ฌ์ฉ๋ ์ ์์ต๋๋ค. ๊ฐ๊ฐ [`PatchTSTForClassification`]์ [`PatchTSTForRegression`] ํด๋์ค๋ฅผ ์ฐธ์กฐํ์ธ์.
+
+## ์๋ฃ[[resources]]
+
+- PatchTST๋ฅผ ์์ธํ ์ค๋ช
ํ๋ ๋ธ๋ก๊ทธ ํฌ์คํธ๋ [์ด๊ณณ](https://huggingface.co/blog/patchtst)์์ ์ฐพ์ ์ ์์ต๋๋ค.
+์ด ๋ธ๋ก๊ทธ๋ Google Colab์์๋ ์ด์ด๋ณผ ์ ์์ต๋๋ค.
+
+## PatchTSTConfig[[transformers.PatchTSTConfig]]
+
+[[autodoc]] PatchTSTConfig
+
+## PatchTSTModel[[transformers.PatchTSTModel]]
+
+[[autodoc]] PatchTSTModel
+ - forward
+
+## PatchTSTForPrediction[[transformers.PatchTSTForPrediction]]
+
+[[autodoc]] PatchTSTForPrediction
+ - forward
+
+## PatchTSTForClassification[[transformers.PatchTSTForClassification]]
+
+[[autodoc]] PatchTSTForClassification
+ - forward
+
+## PatchTSTForPretraining[[transformers.PatchTSTForPretraining]]
+
+[[autodoc]] PatchTSTForPretraining
+ - forward
+
+## PatchTSTForRegression[[transformers.PatchTSTForRegression]]
+
+[[autodoc]] PatchTSTForRegression
+ - forward
diff --git a/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/rag.md b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/rag.md
new file mode 100644
index 0000000000000000000000000000000000000000..0ae88cc7ac5e3e08fc85a3619fb59aaef54a86a1
--- /dev/null
+++ b/tasks/tasksmith-333d8be2d5aa/tests/source/docs/source/ko/model_doc/rag.md
@@ -0,0 +1,100 @@
+
+
+# RAG(๊ฒ์ ์ฆ๊ฐ ์์ฑ) [[rag]]
+
+
+
+## ๊ฐ์ [[overview]]
+
+๊ฒ์ ์ฆ๊ฐ ์์ฑ(Retrieval-augmented generation, "RAG") ๋ชจ๋ธ์ ์ฌ์ ํ๋ จ๋ ๋ฐ์ง ๊ฒ์(DPR)๊ณผ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ์ ์ฅ์ ์ ๊ฒฐํฉํฉ๋๋ค. RAG ๋ชจ๋ธ์ ๋ฌธ์๋ฅผ ๊ฒ์ํ๊ณ , ์ด๋ฅผ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ์ ์ ๋ฌํ ๋ค์, ์ฃผ๋ณํ(marginalization)๋ฅผ ํตํด ์ถ๋ ฅ์ ์์ฑํฉ๋๋ค. ๊ฒ์๊ธฐ์ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋์ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ๋ก ์ด๊ธฐํ๋๋ฉฐ, ํจ๊ป ๋ฏธ์ธ ์กฐ์ ๋์ด ๊ฒ์๊ณผ ์์ฑ ๋ชจ๋ ๋ค์ด์คํธ๋ฆผ ์์
(๋ชจ๋ธ์ ํน์ ํ์คํฌ์ ์ ์ฉํ๋ ๊ฒ)์ ์ ์ํ ์ ์๊ฒ ํฉ๋๋ค.
+
+์ด ๋ชจ๋ธ์ Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kรผttler, Mike Lewis, Wen-tau Yih, Tim Rocktรคschel, Sebastian Riedel, Douwe Kiela์ ๋
ผ๋ฌธ [Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks](https://arxiv.org/abs/2005.11401)๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํฉ๋๋ค.
+
+๋
ผ๋ฌธ์ ์ด๋ก์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
+
+*๋๊ท๋ชจ ์ฌ์ ํ๋ จ ์ธ์ด ๋ชจ๋ธ๋ค์ ๊ทธ๋ค์ ๋งค๊ฐ๋ณ์์ ์ฌ์ค์ ์ง์์ ์ ์ฅํ๊ณ ์์ผ๋ฉฐ, ๋ค์ด์คํธ๋ฆผ NLP ์์
์ ๋ํด ๋ฏธ์ธ ์กฐ์ ๋ ๋ ์ต์ฒจ๋จ ๊ฒฐ๊ณผ๋ฅผ ๋ฌ์ฑํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ง์์ ์ ๊ทผํ๊ณ ์ ํํ๊ฒ ์กฐ์ํ๋ ๋ฅ๋ ฅ์ ์ฌ์ ํ ์ ํ์ ์ด๋ฉฐ, ๋ฐ๋ผ์ ์ง์ ์ง์ฝ์ ์์
์์ ๊ทธ๋ค์ ์ฑ๋ฅ์ ์์
๋ณ ์ํคํ
์ฒ์ ๋นํด ๋ค๋จ์ด์ง๋๋ค. ๋ํ, ๊ทธ๋ค์ ๊ฒฐ์ ์ ๋ํ ๊ทผ๊ฑฐ๋ฅผ ์ ๊ณตํ๊ณ ์ธ๊ณ ์ง์์ ์
๋ฐ์ดํธํ๋ ๊ฒ์ ์ฌ์ ํ ์ด๋ฆฐ ์ฐ๊ตฌ ๋ฌธ์ ๋ก ๋จ์ ์์ต๋๋ค. ๋ช
์์ ๋น๋งค๊ฐ๋ณ์ ๋ฉ๋ชจ๋ฆฌ์ ๋ํ ๋ฏธ๋ถ ๊ฐ๋ฅํ ์ ๊ทผ ๋ฉ์ปค๋์ฆ์ ๊ฐ์ง ์ฌ์ ํ๋ จ ๋ชจ๋ธ์ ์ด ๋ฌธ์ ๋ฅผ ๊ทน๋ณตํ ์ ์์ง๋ง, ์ง๊ธ๊น์ง๋ ์ถ์ถ์ ๋ค์ด์คํธ๋ฆผ ์์
์ ๋ํด์๋ง ์ฐ๊ตฌ๋์์ต๋๋ค. ์ฐ๋ฆฌ๋ ์ธ์ด ์์ฑ์ ์ํด ์ฌ์ ํ๋ จ๋ ๋งค๊ฐ๋ณ์ ๋ฐ ๋น๋งค๊ฐ๋ณ์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ๊ฒฐํฉํ๋ ๋ชจ๋ธ์ธ ๊ฒ์ ์ฆ๊ฐ ์์ฑ(RAG)์ ๋ํ ์ผ๋ฐ์ ์ธ ๋ชฉ์ ์ ๋ฏธ์ธ ์กฐ์ ๋ฐฉ๋ฒ์ ํ๊ตฌํฉ๋๋ค. ์ฐ๋ฆฌ๋ ๋งค๊ฐ๋ณ์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ฌ์ ํ๋ จ๋ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ์ด๊ณ ๋น๋งค๊ฐ๋ณ์ ๋ฉ๋ชจ๋ฆฌ๊ฐ ์ฌ์ ํ๋ จ๋ ์ ๊ฒฝ ๊ฒ์๊ธฐ๋ก ์ ๊ทผ๋๋ ์ํคํผ๋์์ ๋ฐ์ง ๋ฒกํฐ ์ธ๋ฑ์ค์ธ RAG ๋ชจ๋ธ์ ์๊ฐํฉ๋๋ค. ์ฐ๋ฆฌ๋ ์์ฑ๋ ์ ์ฒด ์ํ์ค์ ๊ฑธ์ณ ๋์ผํ ๊ฒ์๋ ๊ตฌ์ ์ ์กฐ๊ฑด์ผ๋ก ํ๋ RAG ๊ณต์๊ณผ ํ ํฐ๋ณ๋ก ๋ค๋ฅธ ๊ตฌ์ ์ ์ฌ์ฉํ ์ ์๋ RAG ๊ณต์์ ๋น๊ตํฉ๋๋ค. ์ฐ๋ฆฌ๋ ๊ด๋ฒ์ํ ์ง์ ์ง์ฝ์ NLP ์์
์ ๋ํด ๋ชจ๋ธ์ ๋ฏธ์ธ ์กฐ์ ํ๊ณ ํ๊ฐํ๋ฉฐ, ๋งค๊ฐ๋ณ์ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ๊ณผ ์์
๋ณ ๊ฒ์-์ถ์ถ ์ํคํ
์ฒ๋ฅผ ๋ฅ๊ฐํ์ฌ ์ธ ๊ฐ์ง ๊ฐ๋ฐฉํ ๋๋ฉ์ธ QA ์์
์์ ์ต์ฒจ๋จ ์ฑ๋ฅ์ ๋ฌ์ฑํฉ๋๋ค. ์ธ์ด ์์ฑ ์์
์ ๊ฒฝ์ฐ, RAG ๋ชจ๋ธ์ด ์ต์ฒจ๋จ ๋งค๊ฐ๋ณ์ ์ ์ฉ ์ํ์ค-ํฌ-์ํ์ค ๊ธฐ์ค์ ๋ณด๋ค ๋ ๊ตฌ์ฒด์ ์ด๊ณ , ๋ค์ํ๋ฉฐ, ์ฌ์ค์ ์ธ ์ธ์ด๋ฅผ ์์ฑํ๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์ต๋๋ค.*
+
+์ด ๋ชจ๋ธ์ [ola13](https://huggingface.co/ola13)์ ์ํด ๊ธฐ์ฌ๋์์ต๋๋ค.
+
+## ์ฌ์ฉ ํ [[usage-tips]]
+
+๊ฒ์ ์ฆ๊ฐ ์์ฑ(Retrieval-augmented generation, "RAG") ๋ชจ๋ธ์ ์ฌ์ ํ๋ จ๋ ๋ฐ์ง ๊ฒ์(DPR)๊ณผ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ์ ๊ฐ์ ์ ๊ฒฐํฉํฉ๋๋ค. RAG ๋ชจ๋ธ์ ๋ฌธ์๋ฅผ ๊ฒ์ํ๊ณ , ์ด๋ฅผ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋ธ์ ์ ๋ฌํ ๋ค์, ์ฃผ๋ณํ(marginalization)๋ฅผ ํตํด ์ถ๋ ฅ์ ์์ฑํฉ๋๋ค. ๊ฒ์๊ธฐ์ ์ํ์ค-ํฌ-์ํ์ค ๋ชจ๋์ ์ฌ์ ํ๋ จ๋ ๋ชจ๋ธ๋ก ์ด๊ธฐํ๋๋ฉฐ, ํจ๊ป ๋ฏธ์ธ ์กฐ์ ๋ฉ๋๋ค. ์ด๋ฅผ ํตํด ๊ฒ์๊ณผ ์์ฑ ๋ชจ๋ ๋ค์ด์คํธ๋ฆผ ์์
์ ์ ์ํ ์ ์๊ฒ ๋ฉ๋๋ค.
+
+## RagConfig [[transformers.RagConfig]]
+
+[[autodoc]] RagConfig
+
+## RagTokenizer [[transformers.RagTokenizer]]
+
+[[autodoc]] RagTokenizer
+
+## Rag specific outputs [[transformers.models.rag.modeling_rag.RetrievAugLMMarginOutput]]
+
+[[autodoc]] models.rag.modeling_rag.RetrievAugLMMarginOutput
+
+[[autodoc]] models.rag.modeling_rag.RetrievAugLMOutput
+
+## RagRetriever [[transformers.RagRetriever]]
+
+[[autodoc]] RagRetriever
+
+
+
+
+## RagModel [[transformers.RagModel]]
+
+[[autodoc]] RagModel
+ - forward
+
+## RagSequenceForGeneration [[transformers.RagSequenceForGeneration]]
+
+[[autodoc]] RagSequenceForGeneration
+ - forward
+ - generate
+
+## RagTokenForGeneration [[transformers.RagTokenForGeneration]]
+
+[[autodoc]] RagTokenForGeneration
+ - forward
+ - generate
+
+
+
+
+## TFRagModel [[transformers.TFRagModel]]
+
+[[autodoc]] TFRagModel
+ - call
+
+## TFRagSequenceForGeneration [[transformers.TFRagSequenceForGeneration]]
+
+[[autodoc]] TFRagSequenceForGeneration
+ - call
+ - generate
+
+## TFRagTokenForGeneration [[transformers.TFRagTokenForGeneration]]
+
+[[autodoc]] TFRagTokenForGeneration
+ - call
+ - generate
+
+
+