安装Pytorch和torchtext:
Previous PyTorch Versions | PyTorch Installing previous versions of PyTorchhttps://pytorch.org/get-started/previous-versions/
上面的命令如下:
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
只需将torchtext的版本和torchvision的版本一致即可:
pip install torch==2.1.2 torchvision==0.16.2 torchtext==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121