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 |
|---|---|---|---|---|---|
An example FSDP configuration file may look like:
```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
... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/fsdp.md | https://huggingface.co/docs/transformers/en/fsdp/#launch-training | #launch-training | .md | 46_8 |
FSDP can be a powerful tool for training really large models and you have access to more than one GPU or TPU. By sharding the model parameters, optimizer and gradient states, and even offloading them to the CPU when they're inactive, FSDP can reduce the high cost of large-scale training. If you're interested in learnin... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/fsdp.md | https://huggingface.co/docs/transformers/en/fsdp/#next-steps | #next-steps | .md | 46_9 |
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/ | .md | 47_0 | |
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 processi... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#the-transformer-model-family | #the-transformer-model-family | .md | 47_1 |
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="1000" height="450" src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FacQBpeFBVvrDUlzFlkejoz%2FModelscape-timeline%3Fnode-id%3D0%253A1%26t%3Dm0zJ7m2BQ9oe0WtO-1" allowfullscreen></iframe> | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#computer-vision | #computer-vision | .md | 47_2 |
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 certai... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#convolutional-network | #convolutional-network | .md | 47_3 |
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 ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encodercv-encoder | #encodercv-encoder | .md | 47_4 |
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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#decodercv-decoder | #decodercv-decoder | .md | 47_5 |
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 repre... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encoder-decodercv-encoder-decoder | #encoder-decodercv-encoder-decoder | .md | 47_6 |
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="1000" height="450" src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FUhbQAZDlpYW5XEpdFy6GoG%2Fnlp-model-timeline%3Fnode-id%3D0%253A1%26t%3D4mZMr4r1vDEYGJ50-1" allowfullscreen></iframe> | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#natural-language-processing | #natural-language-processing | .md | 47_7 |
[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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encodernlp-encoder | #encodernlp-encoder | .md | 47_8 |
[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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#decodernlp-decoder | #decodernlp-decoder | .md | 47_9 |
[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 he... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encoder-decodernlp-encoder-decoder | #encoder-decodernlp-encoder-decoder | .md | 47_10 |
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="1000" height="450" src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2Fvrchl8jDV9YwNVPWu2W0kK%2Fspeech-and-audio-model-timeline%3Fnode-id%3D0%253A1%26t%3DmM4H8pPMuK23rClL-1" allowfullscreen></iframe> | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#audio | #audio | .md | 47_11 |
[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 proce... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encoderaudio-encoder | #encoderaudio-encoder | .md | 47_12 |
[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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encoder-decoderaudio-encoder-decoder | #encoder-decoderaudio-encoder-decoder | .md | 47_13 |
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="1000" height="450" src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FcX125FQHXJS2gxeICiY93p%2Fmultimodal%3Fnode-id%3D0%253A1%26t%3DhPQwdx3HFPWJWnVf-1" allowfullscreen></iframe> | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#multimodal | #multimodal | .md | 47_14 |
[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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encodermm-encoder | #encodermm-encoder | .md | 47_15 |
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 t... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#encoder-decodermm-encoder-decoder | #encoder-decodermm-encoder-decoder | .md | 47_16 |
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="1000" height="450" src="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2FiB3Y6RvWYki7ZuKO6tNgZq%2Freinforcement-learning%3Fnode-id%3D0%253A1%26t%3DhPQwdx3HFPWJWnVf-1" allowfullscreen></iframe> | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#reinforcement-learning | #reinforcement-learning | .md | 47_17 |
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 ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_summary.md | https://huggingface.co/docs/transformers/en/model_summary/#decoderrl-decoder | #decoderrl-decoder | .md | 47_18 |
<!---
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 a... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_hardware.md | https://huggingface.co/docs/transformers/en/perf_hardware/ | .md | 48_0 | |
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. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_hardware.md | https://huggingface.co/docs/transformers/en/perf_hardware/#custom-hardware-for-training | #custom-hardware-for-training | .md | 48_1 |
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. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_hardware.md | https://huggingface.co/docs/transformers/en/perf_hardware/#gpu | #gpu | .md | 48_2 |
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 t... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_hardware.md | https://huggingface.co/docs/transformers/en/perf_hardware/#power-and-cooling | #power-and-cooling | .md | 48_3 |
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, ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_hardware.md | https://huggingface.co/docs/transformers/en/perf_hardware/#multi-gpu-connectivity | #multi-gpu-connectivity | .md | 48_4 |
[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/N... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_hardware.md | https://huggingface.co/docs/transformers/en/perf_hardware/#nvlink | #nvlink | .md | 48_5 |
<!--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/gguf.md | https://huggingface.co/docs/transformers/en/gguf/ | .md | 49_0 | |
The GGUF file format is used to store models for inference with [GGML](https://github.com/ggerganov/ggml) and other
libraries that depend on it, like the very popular [llama.cpp](https://github.com/ggerganov/llama.cpp) or
[whisper.cpp](https://github.com/ggerganov/whisper.cpp).
It is a file format [supported by the H... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/gguf.md | https://huggingface.co/docs/transformers/en/gguf/#gguf-and-interaction-with-transformers | #gguf-and-interaction-with-transformers | .md | 49_1 |
We have added the ability to load `gguf` files within `transformers` in order to offer further training/fine-tuning
capabilities to gguf models, before converting back those models to `gguf` to use within the `ggml` ecosystem. When
loading a model, we first dequantize it to fp32, before loading the weights to be used i... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/gguf.md | https://huggingface.co/docs/transformers/en/gguf/#support-within-transformers | #support-within-transformers | .md | 49_2 |
The initial supported quantization types are decided according to the popular quantized files that have been shared
on the 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]
> To suppo... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/gguf.md | https://huggingface.co/docs/transformers/en/gguf/#supported-quantization-types | #supported-quantization-types | .md | 49_3 |
For now the supported model architectures are the architectures that have been very popular on the Hub, namely:
- LLaMa
- Mistral
- Qwen2
- Qwen2Moe
- Phi3
- Bloom
- Falcon
- StableLM
- GPT2
- Starcoder2
- T5
- Mamba
- Nemotron
- Gemma2 | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/gguf.md | https://huggingface.co/docs/transformers/en/gguf/#supported-model-architectures | #supported-model-architectures | .md | 49_4 |
In order to load `gguf` files in `transformers`, you should specify the `gguf_file` argument to the `from_pretrained`
methods of both tokenizers and models. 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, AutoModelForCausa... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/gguf.md | https://huggingface.co/docs/transformers/en/gguf/#example-usage | #example-usage | .md | 49_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/attention.md | https://huggingface.co/docs/transformers/en/attention/ | .md | 50_0 | |
Most transformer models use full attention in the sense that the attention matrix is square. It can be a big
computational bottleneck when you have long texts. Longformer and reformer are models that try to be more efficient and
use a sparse version of the attention matrix to speed up training. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/attention.md | https://huggingface.co/docs/transformers/en/attention/#attention-mechanisms | #attention-mechanisms | .md | 50_1 |
[Reformer](model_doc/reformer) uses LSH attention. In the softmax(QK^t), only the biggest elements (in the softmax
dimension) of the matrix QK^t are going to give useful contributions. So for each query q in Q, we can consider only
the keys k in K that are close to q. A hash function is used to determine if q and k are... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/attention.md | https://huggingface.co/docs/transformers/en/attention/#lsh-attention | #lsh-attention | .md | 50_2 |
[Longformer](model_doc/longformer) uses local attention: often, the local context (e.g., what are the two tokens to the
left and right?) is enough to take action for a given token. Also, by stacking attention layers that have a small
window, the last layer will have a receptive field of more than just the tokens in the... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/attention.md | https://huggingface.co/docs/transformers/en/attention/#local-attention | #local-attention | .md | 50_3 |
[Reformer](model_doc/reformer) uses axial positional encodings: in traditional transformer models, the positional encoding
E is a matrix of size \\(l\\) by \\(d\\), \\(l\\) being the sequence length and \\(d\\) the dimension of the
hidden state. If you have very long texts, this matrix can be huge and take way too much... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/attention.md | https://huggingface.co/docs/transformers/en/attention/#axial-positional-encodings | #axial-positional-encodings | .md | 50_4 |
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/fast_tokenizers.md | https://huggingface.co/docs/transformers/en/fast_tokenizers/ | .md | 51_0 | |
The [`PreTrainedTokenizerFast`] depends on the [🤗 Tokenizers](https://huggingface.co/docs/tokenizers) library. The tokenizers obtained from the 🤗 Tokenizers library can be
loaded very simply into 🤗 Transformers.
Before getting in the specifics, let's first start by creating a dummy tokenizer in a few lines:
```p... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/fast_tokenizers.md | https://huggingface.co/docs/transformers/en/fast_tokenizers/#use-tokenizers-from--tokenizers | #use-tokenizers-from--tokenizers | .md | 51_1 |
Let's see how to leverage this tokenizer object in the 🤗 Transformers library. The
[`PreTrainedTokenizerFast`] class allows for easy instantiation, by accepting the instantiated
*tokenizer* object as an argument:
```python
>>> from transformers import PreTrainedTokenizerFast
>>> fast_tokenizer = PreTrainedTokenizer... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/fast_tokenizers.md | https://huggingface.co/docs/transformers/en/fast_tokenizers/#loading-directly-from-the-tokenizer-object | #loading-directly-from-the-tokenizer-object | .md | 51_2 |
In order to load a tokenizer from a JSON file, let's first start by saving our tokenizer:
```python
>>> tokenizer.save("tokenizer.json")
```
The path to which we saved this file can be passed to the [`PreTrainedTokenizerFast`] initialization
method using the `tokenizer_file` parameter:
```python
>>> from transfor... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/fast_tokenizers.md | https://huggingface.co/docs/transformers/en/fast_tokenizers/#loading-from-a-json-file | #loading-from-a-json-file | .md | 51_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/big_models.md | https://huggingface.co/docs/transformers/en/big_models/ | .md | 52_0 | |
A barrier to accessing very large pretrained models is the amount of memory required. When loading a pretrained PyTorch model, you usually:
1. Create a model with random weights.
2. Load your pretrained weights.
3. Put those pretrained weights in the model.
The first two steps both require a full version of the mod... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/big_models.md | https://huggingface.co/docs/transformers/en/big_models/#instantiate-a-big-model | #instantiate-a-big-model | .md | 52_1 |
From Transformers v4.18.0, a checkpoint larger than 10GB is automatically sharded by the [`~PreTrainedModel.save_pretrained`] method. It is split into several smaller partial checkpoints and creates an index file that maps parameter names to the files they're stored in.
The maximum shard size is controlled with the `... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/big_models.md | https://huggingface.co/docs/transformers/en/big_models/#sharded-checkpoints | #sharded-checkpoints | .md | 52_2 |
The index file determines which keys are in the checkpoint and where the corresponding weights are stored. This file is loaded like any other JSON file and you can get a dictionary from it.
```py
>>> import json
>>> with tempfile.TemporaryDirectory() as tmp_dir:
... model.save_pretrained(tmp_dir, max_shard_size=... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/big_models.md | https://huggingface.co/docs/transformers/en/big_models/#shard-metadata | #shard-metadata | .md | 52_3 |
> [!TIP]
> Make sure you have Accelerate v0.9.0 or later and PyTorch v1.9.0 or later installed.
From Transformers v4.20.0, the [`~PreTrainedModel.from_pretrained`] method is supercharged with Accelerate's [Big Model Inference](https://hf.co/docs/accelerate/usage_guides/big_modeling) feature to efficiently handle real... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/big_models.md | https://huggingface.co/docs/transformers/en/big_models/#accelerates-big-model-inference | #accelerates-big-model-inference | .md | 52_4 |
PyTorch model weights are normally instantiated as torch.float32 and it can be an issue if you try to load a model as a different data type. For example, you'd need twice as much memory to load the weights in torch.float32 and then again to load them in your desired data type, like torch.float16.
> [!WARNING]
> Due t... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/big_models.md | https://huggingface.co/docs/transformers/en/big_models/#model-data-type | #model-data-type | .md | 52_5 |
<!--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/perf_train_cpu.md | https://huggingface.co/docs/transformers/en/perf_train_cpu/ | .md | 53_0 | |
This guide focuses on training large models efficiently on CPU. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_train_cpu.md | https://huggingface.co/docs/transformers/en/perf_train_cpu/#efficient-training-on-cpu | #efficient-training-on-cpu | .md | 53_1 |
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 proces... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_train_cpu.md | https://huggingface.co/docs/transformers/en/perf_train_cpu/#mixed-precision-with-ipex | #mixed-precision-with-ipex | .md | 53_2 |
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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_train_cpu.md | https://huggingface.co/docs/transformers/en/perf_train_cpu/#ipex-installation | #ipex-installation | .md | 53_3 |
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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_train_cpu.md | https://huggingface.co/docs/transformers/en/perf_train_cpu/#usage-in-trainer | #usage-in-trainer | .md | 53_4 |
Blog: [Accelerating PyTorch Transformers with Intel Sapphire Rapids](https://huggingface.co/blog/intel-sapphire-rapids) | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perf_train_cpu.md | https://huggingface.co/docs/transformers/en/perf_train_cpu/#practice-example | #practice-example | .md | 53_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 a... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_memory_anatomy.md | https://huggingface.co/docs/transformers/en/model_memory_anatomy/ | .md | 54_0 | |
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 ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_memory_anatomy.md | https://huggingface.co/docs/transformers/en/model_memory_anatomy/#model-training-anatomy | #model-training-anatomy | .md | 54_1 |
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-la... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_memory_anatomy.md | https://huggingface.co/docs/transformers/en/model_memory_anatomy/#load-model | #load-model | .md | 54_2 |
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... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_memory_anatomy.md | https://huggingface.co/docs/transformers/en/model_memory_anatomy/#memory-utilization-at-vanilla-training | #memory-utilization-at-vanilla-training | .md | 54_3 |
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. **... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_memory_anatomy.md | https://huggingface.co/docs/transformers/en/model_memory_anatomy/#anatomy-of-models-operations | #anatomy-of-models-operations | .md | 54_4 |
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 co... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/model_memory_anatomy.md | https://huggingface.co/docs/transformers/en/model_memory_anatomy/#anatomy-of-models-memory | #anatomy-of-models-memory | .md | 54_5 |
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perplexity.md | https://huggingface.co/docs/transformers/en/perplexity/ | .md | 55_0 | |
[[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 BE... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perplexity.md | https://huggingface.co/docs/transformers/en/perplexity/#perplexity-of-fixed-length-models | #perplexity-of-fixed-length-models | .md | 55_1 |
If we weren't limited by a model's context size, we would evaluate the model's perplexity by autoregressively
factorizing a sequence and conditioning on the entire preceding subsequence at each step, as shown below.
<img width="600" alt="Full decomposition of a sequence with unlimited context length" src="https://hug... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perplexity.md | https://huggingface.co/docs/transformers/en/perplexity/#calculating-ppl-with-fixed-length-models | #calculating-ppl-with-fixed-length-models | .md | 55_2 |
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"
m... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/perplexity.md | https://huggingface.co/docs/transformers/en/perplexity/#example-calculating-perplexity-with-gpt-2-in--transformers | #example-calculating-perplexity-with-gpt-2-in--transformers | .md | 55_3 |
<!--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/agents.md | https://huggingface.co/docs/transformers/en/agents/ | .md | 56_0 | |
[[open-in-colab]] | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#agents-and-tools | #agents-and-tools | .md | 56_1 |
Large Language Models (LLMs) trained to perform [causal language modeling](./tasks/language_modeling) can tackle a wide range of tasks, but they often struggle with basic tasks like logic, calculation, and search. When prompted in domains in which they do not perform well, they often fail to generate the answer we expe... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#what-is-an-agent | #what-is-an-agent | .md | 56_2 |
This agent has a planning step, then generates python code to execute all its actions at once. It natively handles different input and output types for its tools, thus it is the recommended choice for multimodal tasks. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#code-agent | #code-agent | .md | 56_3 |
This is the go-to agent to solve reasoning tasks, since the ReAct framework ([Yao et al., 2022](https://huggingface.co/papers/2210.03629)) makes it really efficient to think on the basis of its previous observations.
We implement two versions of ReactJsonAgent:
- [`ReactJsonAgent`] generates tool calls as a JSON in i... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#react-agents | #react-agents | .md | 56_4 |
To initialize an agent, you need these arguments:
- an LLM to power your agent - the agent is not exactly the LLM, it’s more like the agent is a program that uses an LLM as its engine.
- a system prompt: what the LLM engine will be prompted with to generate its output
- a toolbox from which the agent pick tools to ex... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#how-can-i-build-an-agent | #how-can-i-build-an-agent | .md | 56_5 |
A Python interpreter executes the code on a set of inputs passed along with your tools.
This should be safe because the only functions that can be called are the tools you provided (especially if it's only tools by Hugging Face) and the print function, so you're already limited in what can be executed.
The Python int... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#code-execution | #code-execution | .md | 56_6 |
An agent, or rather the LLM that drives the agent, generates an output based on the system prompt. The system prompt can be customized and tailored to the intended task. For example, check the system prompt for the [`ReactCodeAgent`] (below version is slightly simplified).
```text
You will be given a task to solve as... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#the-system-prompt | #the-system-prompt | .md | 56_7 |
Here are a few useful attributes to inspect what happened after a run:
- `agent.logs` stores the fine-grained logs of the agent. At every step of the agent's run, everything gets stored in a dictionary that then is appended to `agent.logs`.
- Running `agent.write_inner_memory_from_logs()` creates an inner memory of the... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#inspecting-an-agent-run | #inspecting-an-agent-run | .md | 56_8 |
A tool is an atomic function to be used by an agent.
You can for instance check the [`PythonInterpreterTool`]: it has a name, a description, input descriptions, an output type, and a `__call__` method to perform the action.
When the agent is initialized, the tool attributes are used to generate a tool description w... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#tools | #tools | .md | 56_9 |
Transformers comes with a default toolbox for empowering agents, that you can add to your agent upon initialization with argument `add_base_tools = True`:
- **Document question answering**: given a document (such as a PDF) in image format, answer a question on this document ([Donut](./model_doc/donut))
- **Image ques... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#default-toolbox | #default-toolbox | .md | 56_10 |
You can create your own tool for use cases not covered by the default tools from Hugging Face.
For example, let's create a tool that returns the most downloaded model for a given task from the Hub.
You'll start with the code below.
```python
from huggingface_hub import list_models
task = "text-classification"
mod... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#create-a-new-tool | #create-a-new-tool | .md | 56_11 |
If you have already initialized an agent, it is inconvenient to reinitialize it from scratch with a tool you want to use. With Transformers, you can manage an agent's toolbox by adding or replacing a tool.
Let's add the `model_download_tool` to an existing agent initialized with only the default toolbox.
```python
... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#manage-your-agents-toolbox | #manage-your-agents-toolbox | .md | 56_12 |
You can leverage tool collections by using the ToolCollection object, with the slug of the collection you want to use.
Then pass them as a list to initialize you agent, and start using them!
```py
from transformers import ToolCollection, ReactCodeAgent
image_tool_collection = ToolCollection(collection_slug="huggingf... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/agents.md | https://huggingface.co/docs/transformers/en/agents/#use-a-collection-of-tools | #use-a-collection-of-tools | .md | 56_13 |
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/philosophy.md | https://huggingface.co/docs/transformers/en/philosophy/ | .md | 57_0 | |
🤗 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 ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/philosophy.md | https://huggingface.co/docs/transformers/en/philosophy/#philosophy | #philosophy | .md | 57_1 |
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](... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/philosophy.md | https://huggingface.co/docs/transformers/en/philosophy/#main-concepts | #main-concepts | .md | 57_2 |
<!--Copyright 2020 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agr... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/add_new_pipeline.md | https://huggingface.co/docs/transformers/en/add_new_pipeline/ | .md | 58_0 | |
In this guide, we will see how to create a custom pipeline and share it on the [Hub](https://hf.co/models) or add it to the
🤗 Transformers library.
First and foremost, you need to decide the raw entries the pipeline will be able to take. It can be strings, raw bytes,
dictionaries or whatever seems to be the most lik... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/add_new_pipeline.md | https://huggingface.co/docs/transformers/en/add_new_pipeline/#how-to-create-a-custom-pipeline | #how-to-create-a-custom-pipeline | .md | 58_1 |
To register your `new-task` to the list of supported tasks, you have to add it to the `PIPELINE_REGISTRY`:
```python
from transformers.pipelines import PIPELINE_REGISTRY
PIPELINE_REGISTRY.register_pipeline(
"new-task",
pipeline_class=MyPipeline,
pt_model=AutoModelForSequenceClassification,
)
```
You can specify a ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/add_new_pipeline.md | https://huggingface.co/docs/transformers/en/add_new_pipeline/#adding-it-to-the-list-of-supported-tasks | #adding-it-to-the-list-of-supported-tasks | .md | 58_2 |
To share your custom pipeline on the Hub, you just have to save the custom code of your `Pipeline` subclass in a
python file. For instance, let's say we want to use a custom pipeline for sentence pair classification like this:
```py
import numpy as np
from transformers import Pipeline
def softmax(outputs):
maxes =... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/add_new_pipeline.md | https://huggingface.co/docs/transformers/en/add_new_pipeline/#share-your-pipeline-on-the-hub | #share-your-pipeline-on-the-hub | .md | 58_3 |
If you want to contribute your pipeline to 🤗 Transformers, you will need to add a new module in the `pipelines` submodule
with the code of your pipeline, then add it to the list of tasks defined in `pipelines/__init__.py`.
Then you will need to add tests. Create a new file `tests/test_pipelines_MY_PIPELINE.py` with ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/add_new_pipeline.md | https://huggingface.co/docs/transformers/en/add_new_pipeline/#add-the-pipeline-to--transformers | #add-the-pipeline-to--transformers | .md | 58_4 |
<!--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/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/ | .md | 59_0 | |
[[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-uncase... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#multilingual-models-for-inference | #multilingual-models-for-inference | .md | 59_1 |
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. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#xlm | #xlm | .md | 59_2 |
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-Romani... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#xlm-with-language-embeddings | #xlm-with-language-embeddings | .md | 59_3 |
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 checkpoi... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#xlm-without-language-embeddings | #xlm-without-language-embeddings | .md | 59_4 |
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 requ... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#bert | #bert | .md | 59_5 |
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. I... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#xlm-roberta | #xlm-roberta | .md | 59_6 |
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 tra... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#m2m100 | #m2m100 | .md | 59_7 |
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-on... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/multilingual.md | https://huggingface.co/docs/transformers/en/multilingual/#mbart | #mbart | .md | 59_8 |
<!--Copyright 2021 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/debugging.md | https://huggingface.co/docs/transformers/en/debugging/ | .md | 60_0 | |
Training on multiple GPUs can be a tricky endeavor whether you're running into installation issues or communication problems between your GPUs. This debugging guide covers some issues you may run into and how to resolve them. | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/debugging.md | https://huggingface.co/docs/transformers/en/debugging/#debugging | #debugging | .md | 60_1 |
If you're using DeepSpeed, you've probably already installed it with the following command.
```bash
pip install deepspeed
```
DeepSpeed compiles CUDA C++ code and it can be a potential source of errors when building PyTorch extensions that require CUDA. These errors depend on how CUDA is installed on your system, a... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/debugging.md | https://huggingface.co/docs/transformers/en/debugging/#deepspeed-cuda-installation | #deepspeed-cuda-installation | .md | 60_2 |
PyTorch comes with its own CUDA toolkit, but to use DeepSpeed with PyTorch, you need to have an identical version of CUDA installed system-wide. For example, if you installed PyTorch with `cudatoolkit==10.2` in your Python environment, then you'll also need to have CUDA 10.2 installed system-wide. If you don't have CUD... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/debugging.md | https://huggingface.co/docs/transformers/en/debugging/#non-identical-cuda-toolkits | #non-identical-cuda-toolkits | .md | 60_3 |
You may also have more than one CUDA toolkit installed system-wide.
```bash
/usr/local/cuda-10.2
/usr/local/cuda-11.0
```
Typically, package installers set the paths to whatever the last version was installed. If the package build fails because it can't find the right CUDA version (despite it being installed system... | /Users/nielsrogge/Documents/python_projecten/transformers/docs/source/en/debugging.md | https://huggingface.co/docs/transformers/en/debugging/#multiple-cuda-toolkits | #multiple-cuda-toolkits | .md | 60_4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.