Search code examples
pytorchnlpgpuhuggingface-transformershuggingface-tokenizers

troubleshooting PyTorch and Hugging Face's Pre-trained deBerta Model on Windows 11 with an RTX 3070 GPU


I'm running Windows 11 on my desktop, which has an NVIDIA RTX 3070 GPU. I'm working on an NLP task using Hugging Face's AutoModelForSequenceClassification and I want to utilize my GPU for training. I've successfully installed PyTorch 1.9.0 with CUDA 11.1 and confirmed that CUDA is available on my system.

However, when I try to run my script, I encounter an ImportError suggesting that I need to install the accelerate library. When I attempt to do so, it not only fails but also replaces my existing PyTorch 1.9.0 installation with version 2.1.0. I've tried various commands like pip install transformers[torch] and pip install accelerate -U, but they all result in the same issue.

The error message also indicates that accelerate requires at least PyTorch 1.10, but I can't find a compatible CUDA version for my RTX 3070.

Does anyone have a solution for running a proper installation of transformers + torch + accelerate?


Solution

  • I have installed PyTorch on multiple combinations (OS+Hardware).

    I have installed PyTorch successfully using those commands (in a virtual environment):

    • %pip install --upgrade transformers

    • %pip install --upgrade torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

    • %pip install accelerate (will take latest at the time of writing @0.23.0)

    • %pip install evaluate datasets

    These helped me kick-start any of the projects which require HuggingFace. I hope it helps you.