text
stringlengths
5
58.6k
source
stringclasses
470 values
url
stringlengths
49
167
source_section
stringlengths
0
90
file_type
stringclasses
1 value
id
stringlengths
3
6
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 Dis...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/sequence_classification.md
https://huggingface.co/docs/transformers/en/tasks/sequence_classification/#preprocess
#preprocess
.md
83_3
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 🤗 ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/sequence_classification.md
https://huggingface.co/docs/transformers/en/tasks/sequence_classification/#evaluate
#evaluate
.md
83_4
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} ``` <frameworkcontent> <pt> <Tip> If you aren't familiar with finetuning a model with the [`Train...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/sequence_classification.md
https://huggingface.co/docs/transformers/en/tasks/sequence_classification/#train
#train
.md
83_5
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 fin...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/sequence_classification.md
https://huggingface.co/docs/transformers/en/tasks/sequence_classification/#inference
#inference
.md
83_6
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/knowledge_distillation_for_image_classification.md
https://huggingface.co/docs/transformers/en/tasks/knowledge_distillation_for_image_classification/
.md
84_0
[[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 r...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/knowledge_distillation_for_image_classification.md
https://huggingface.co/docs/transformers/en/tasks/knowledge_distillation_for_image_classification/#knowledge-distillation-for-computer-vision
#knowledge-distillation-for-computer-vision
.md
84_1
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/zero_shot_image_classification.md
https://huggingface.co/docs/transformers/en/tasks/zero_shot_image_classification/
.md
85_0
[[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 l...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/zero_shot_image_classification.md
https://huggingface.co/docs/transformers/en/tasks/zero_shot_image_classification/#zero-shot-image-classification
#zero-shot-image-classification
.md
85_1
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 transf...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/zero_shot_image_classification.md
https://huggingface.co/docs/transformers/en/tasks/zero_shot_image_classification/#zero-shot-image-classification-pipeline
#zero-shot-image-classification-pipeline
.md
85_2
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-classificat...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/zero_shot_image_classification.md
https://huggingface.co/docs/transformers/en/tasks/zero_shot_image_classification/#zero-shot-image-classification-by-hand
#zero-shot-image-classification-by-hand
.md
85_3
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/
.md
86_0
[[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 incl...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/#visual-question-answering
#visual-question-answering
.md
86_1
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 `[CL...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/#fine-tuning-vilt
#fine-tuning-vilt
.md
86_2
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...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/#load-the-data
#load-the-data
.md
86_3
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 p...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/#preprocessing-data
#preprocessing-data
.md
86_4
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...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/#train-the-model
#train-the-model
.md
86_5
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_finet...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/#inference
#inference
.md
86_6
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 ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/visual_question_answering.md
https://huggingface.co/docs/transformers/en/tasks/visual_question_answering/#zero-shot-vqa
#zero-shot-vqa
.md
86_7
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_text_to_text.md
https://huggingface.co/docs/transformers/en/tasks/video_text_to_text/
.md
87_0
[[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...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_text_to_text.md
https://huggingface.co/docs/transformers/en/tasks/video_text_to_text/#video-text-to-text
#video-text-to-text
.md
87_1
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_classification.md
https://huggingface.co/docs/transformers/en/tasks/image_classification/
.md
88_0
[[open-in-colab]] <Youtube id="tjAIM7BOYhw"/> 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 cr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_classification.md
https://huggingface.co/docs/transformers/en/tasks/image_classification/#image-classification
#image-classification
.md
88_1
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]")...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_classification.md
https://huggingface.co/docs/transformers/en/tasks/image_classification/#load-food-101-dataset
#load-food-101-dataset
.md
88_2
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) ``` <frameworkcontent> <pt> Apply some image transformat...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_classification.md
https://huggingface.co/docs/transformers/en/tasks/image_classification/#preprocess
#preprocess
.md
88_3
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 🤗...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_classification.md
https://huggingface.co/docs/transformers/en/tasks/image_classification/#evaluate
#evaluate
.md
88_4
<frameworkcontent> <pt> <Tip> 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)! </Tip> You're ready to start training your model now! Load ViT with [`AutoModelForImageClassification`]. Specify the number of labels...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_classification.md
https://huggingface.co/docs/transformers/en/tasks/image_classification/#train
#train
.md
88_5
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] ``` <div class="flex justify-center"> <img src="https://huggingface.co/datasets/huggingface/documentatio...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_classification.md
https://huggingface.co/docs/transformers/en/tasks/image_classification/#inference
#inference
.md
88_6
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/monocular_depth_estimation.md
https://huggingface.co/docs/transformers/en/tasks/monocular_depth_estimation/
.md
89_0
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 recon...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/monocular_depth_estimation.md
https://huggingface.co/docs/transformers/en/tasks/monocular_depth_estimation/#monocular-depth-estimation
#monocular-depth-estimation
.md
89_1
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 >>> impor...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/monocular_depth_estimation.md
https://huggingface.co/docs/transformers/en/tasks/monocular_depth_estimation/#depth-estimation-pipeline
#depth-estimation-pipeline
.md
89_2
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 ch...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/monocular_depth_estimation.md
https://huggingface.co/docs/transformers/en/tasks/monocular_depth_estimation/#depth-estimation-inference-by-hand
#depth-estimation-inference-by-hand
.md
89_3
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/multiple_choice.md
https://huggingface.co/docs/transformers/en/tasks/multiple_choice/
.md
90_0
[[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 `reg...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/multiple_choice.md
https://huggingface.co/docs/transformers/en/tasks/multiple_choice/#multiple-choice
#multiple-choice
.md
90_1
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 instrum...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/multiple_choice.md
https://huggingface.co/docs/transformers/en/tasks/multiple_choice/#load-swag-dataset
#load-swag-dataset
.md
90_2
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 o...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/multiple_choice.md
https://huggingface.co/docs/transformers/en/tasks/multiple_choice/#preprocess
#preprocess
.md
90_3
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 🤗 ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/multiple_choice.md
https://huggingface.co/docs/transformers/en/tasks/multiple_choice/#evaluate
#evaluate
.md
90_4
<frameworkcontent> <pt> <Tip> 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)! </Tip> You're ready to start training your model now! Load BERT with [`AutoModelForMultipleChoice`]: ```py >>> from transformers im...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/multiple_choice.md
https://huggingface.co/docs/transformers/en/tasks/multiple_choice/#train
#train
.md
90_5
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." ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/multiple_choice.md
https://huggingface.co/docs/transformers/en/tasks/multiple_choice/#inference
#inference
.md
90_6
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/keypoint_detection.md
https://huggingface.co/docs/transformers/en/tasks/keypoint_detection/
.md
91_0
[[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 S...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/keypoint_detection.md
https://huggingface.co/docs/transformers/en/tasks/keypoint_detection/#keypoint-detection
#keypoint-detection
.md
91_1
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/question_answering.md
https://huggingface.co/docs/transformers/en/tasks/question_answering/
.md
92_0
[[open-in-colab]] <Youtube id="ajPx5LwJD-I"/> 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: - Extractiv...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/question_answering.md
https://huggingface.co/docs/transformers/en/tasks/question_answering/#question-answering
#question-answering
.md
92_1
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]") ``` ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/question_answering.md
https://huggingface.co/docs/transformers/en/tasks/question_answering/#load-squad-dataset
#load-squad-dataset
.md
92_2
<Youtube id="qgaM0weJHpA"/> 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 qu...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/question_answering.md
https://huggingface.co/docs/transformers/en/tasks/question_answering/#preprocess
#preprocess
.md
92_3
<frameworkcontent> <pt> <Tip> 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)! </Tip> You're ready to start training your model now! Load DistilBERT with [`AutoModelForQuestionAnswering`]: ```py >>> from transf...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/question_answering.md
https://huggingface.co/docs/transformers/en/tasks/question_answering/#train
#train
.md
92_4
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 ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/question_answering.md
https://huggingface.co/docs/transformers/en/tasks/question_answering/#evaluate
#evaluate
.md
92_5
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 la...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/question_answering.md
https://huggingface.co/docs/transformers/en/tasks/question_answering/#inference
#inference
.md
92_6
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/masked_language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/masked_language_modeling/
.md
93_0
[[open-in-colab]] <Youtube id="mqElG5QJWUg"/> 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 under...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/masked_language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/masked_language_modeling/#masked-language-modeling
#masked-language-modeling
.md
93_1
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_data...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/masked_language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/masked_language_modeling/#load-eli5-dataset
#load-eli5-dataset
.md
93_2
<Youtube id="8PmhEIXhBvI"/> 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, th...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/masked_language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/masked_language_modeling/#preprocess
#preprocess
.md
93_3
<frameworkcontent> <pt> <Tip> 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)! </Tip> You're ready to start training your model now! Load DistilRoBERTa with [`AutoModelForMaskedLM`]: ```py >>> from transformers...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/masked_language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/masked_language_modeling/#train
#train
.md
93_4
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 `<mask>` token to indicate the blank: ```py >>> text = "The Milky Way is a <mask> galaxy." ``` The simplest way to try out your finetuned model for inf...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/masked_language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/masked_language_modeling/#inference
#inference
.md
93_5
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_to_image.md
https://huggingface.co/docs/transformers/en/tasks/image_to_image/
.md
94_0
[[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-im...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/image_to_image.md
https://huggingface.co/docs/transformers/en/tasks/image_to_image/#image-to-image-task-guide
#image-to-image-task-guide
.md
94_1
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/
.md
95_0
[[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 ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/#video-classification
#video-classification
.md
95_1
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/u...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/#load-ucf101-dataset
#load-ucf101-dataset
.md
95_2
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 >>...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/#load-a-model-to-fine-tune
#load-a-model-to-fine-tune
.md
95_3
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, ... Remove...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/#prepare-the-datasets-for-training
#prepare-the-datasets-for-training
.md
95_4
```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...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/#visualize-the-preprocessed-video-for-better-debugging
#visualize-the-preprocessed-video-for-better-debugging
.md
95_5
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_c...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/#train-the-model
#train-the-model
.md
95_6
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)) ``` <div class="flex justify-center"> <img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/sample_gif_...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/video_classification.md
https://huggingface.co/docs/transformers/en/tasks/video_classification/#inference
#inference
.md
95_7
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/
.md
96_0
[[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), [VI...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#text-to-speech
#text-to-speech
.md
96_1
[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...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#load-the-dataset
#load-the-dataset
.md
96_2
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) ```
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#preprocess-the-data
#preprocess-the-data
.md
96_3
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 do...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#text-cleanup-for-speecht5-tokenization
#text-cleanup-for-speecht5-tokenization
.md
96_4
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...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#speakers
#speakers
.md
96_5
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-...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#speaker-embeddings
#speaker-embeddings
.md
96_6
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....
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#processing-the-dataset
#processing-the-dataset
.md
96_7
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 ins...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#data-collator
#data-collator
.md
96_8
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....
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#train-the-model
#train-the-model
.md
96_9
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/speec...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#inference-with-a-pipeline
#inference-with-a-pipeline
.md
96_10
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 embeddin...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/text-to-speech.md
https://huggingface.co/docs/transformers/en/tasks/text-to-speech/#run-inference-manually
#run-inference-manually
.md
96_11
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/audio_classification.md
https://huggingface.co/docs/transformers/en/tasks/audio_classification/
.md
97_0
[[open-in-colab]] <Youtube id="KWwzcmG98Ds"/> 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, languag...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/audio_classification.md
https://huggingface.co/docs/transformers/en/tasks/audio_classification/#audio-classification
#audio-classification
.md
97_1
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`] meth...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/audio_classification.md
https://huggingface.co/docs/transformers/en/tasks/audio_classification/#load-minds-14-dataset
#load-minds-14-dataset
.md
97_2
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 it...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/audio_classification.md
https://huggingface.co/docs/transformers/en/tasks/audio_classification/#preprocess
#preprocess
.md
97_3
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 🤗...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/audio_classification.md
https://huggingface.co/docs/transformers/en/tasks/audio_classification/#evaluate
#evaluate
.md
97_4
<frameworkcontent> <pt> <Tip> 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)! </Tip> You're ready to start training your model now! Load Wav2Vec2 with [`AutoModelForAudioClassification`] along with the number of...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/audio_classification.md
https://huggingface.co/docs/transformers/en/tasks/audio_classification/#train
#train
.md
97_5
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=...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/audio_classification.md
https://huggingface.co/docs/transformers/en/tasks/audio_classification/#inference
#inference
.md
97_6
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/asr.md
https://huggingface.co/docs/transformers/en/tasks/asr/
.md
98_0
[[open-in-colab]] <Youtube id="TksaY_FDgnk"/> 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 cap...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/asr.md
https://huggingface.co/docs/transformers/en/tasks/asr/#automatic-speech-recognition
#automatic-speech-recognition
.md
98_1
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 ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/asr.md
https://huggingface.co/docs/transformers/en/tasks/asr/#load-minds-14-dataset
#load-minds-14-dataset
.md
98_2
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://hug...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/asr.md
https://huggingface.co/docs/transformers/en/tasks/asr/#preprocess
#preprocess
.md
98_3
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 (re...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/asr.md
https://huggingface.co/docs/transformers/en/tasks/asr/#evaluate
#evaluate
.md
98_4
<frameworkcontent> <pt> <Tip> 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)! </Tip> You are now ready to start training your model! Load Wav2Vec2 with [`AutoModelForCTC`]. Specify the reduction to apply with th...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/asr.md
https://huggingface.co/docs/transformers/en/tasks/asr/#train
#train
.md
98_5
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(...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/asr.md
https://huggingface.co/docs/transformers/en/tasks/asr/#inference
#inference
.md
98_6
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/language_modeling/
.md
99_0
[[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 li...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/language_modeling/#causal-language-modeling
#causal-language-modeling
.md
99_1
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_data...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/language_modeling/#load-eli5-dataset
#load-eli5-dataset
.md
99_2
<Youtube id="ma1TrR7gE7I"/> 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 ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/language_modeling/#preprocess
#preprocess
.md
99_3
<frameworkcontent> <pt> <Tip> If you aren't familiar with finetuning a model with the [`Trainer`], take a look at the [basic tutorial](../training#train-with-pytorch-trainer)! </Tip> You're ready to start training your model now! Load DistilGPT2 with [`AutoModelForCausalLM`]: ```py >>> from transformers import ...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/language_modeling/#train
#train
.md
99_4
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 `p...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/language_modeling.md
https://huggingface.co/docs/transformers/en/tasks/language_modeling/#inference
#inference
.md
99_5
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agr...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/prompting.md
https://huggingface.co/docs/transformers/en/tasks/prompting/
.md
100_0
[[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 bec...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/prompting.md
https://huggingface.co/docs/transformers/en/tasks/prompting/#llm-prompting-guide
#llm-prompting-guide
.md
100_1
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 [...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/prompting.md
https://huggingface.co/docs/transformers/en/tasks/prompting/#types-of-models
#types-of-models
.md
100_2
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 whe...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/prompting.md
https://huggingface.co/docs/transformers/en/tasks/prompting/#base-vs-instructchat-models
#base-vs-instructchat-models
.md
100_3
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 = "t...
/Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/tasks/prompting.md
https://huggingface.co/docs/transformers/en/tasks/prompting/#nlp-tasks
#nlp-tasks
.md
100_4