Rate This Document
Findability
Accuracy
Completeness
Readability

Environment Configuration

Before compiling and building the source code, you need to install the dependent components of the required version.

  1. Install system dependencies.
    1
    2
    3
    4
    dnf install -y \
      --setopt=install_weak_deps=False \
      --setopt=tsflags=nodocs \
      python3-pip tar gzip
    
  2. Install the Python build tools.
    1
    python3 -m pip install --upgrade pip setuptools wheel packaging hatchling
    
  3. Install PyTorch of the CUDA version.
    • Method 1: Use the official precompiled wheel.
      1
      python3 -m pip install --index-url https://download.pytorch.org/whl/cu130 torch==2.11.0+cu130
      
    • Method 2: Use the locally built wheel. Replace the path with the actual wheel file path.
      1
      python3 -m pip install --force-reinstall /path/to/torch-2.11.0+cu130-*.whl
      

    To install PyTorch of the CUDA version, you can use either of the following methods: Use the precompiled wheel released by PyTorch that matches the CUDA version, or use the locally built CUDA wheel that has been verified in the current environment. Regardless of the source you choose, before continuing with the source code build of Transformers, ensure that both torch.backends.cuda.is_built() and torch.cuda.is_available() return True.