Use the correct PyTorch in the Colab notebook

This commit is contained in:
oobabooga 2024-03-04 20:58:21 -08:00
parent 3cfcab63a5
commit 164ff2440d

View File

@ -66,6 +66,11 @@
" print(f\"TORCH: {torver}\")\n", " print(f\"TORCH: {torver}\")\n",
" is_cuda118 = '+cu118' in torver # 2.1.0+cu118\n", " is_cuda118 = '+cu118' in torver # 2.1.0+cu118\n",
"\n", "\n",
" if is_cuda118:\n",
" !python -m pip install --upgrade torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu118\n",
" else:\n",
" !python -m pip install --upgrade torch==2.2.1 torchvision==0.17.1 torchaudio==2.2.1 --index-url https://download.pytorch.org/whl/cu121\n",
"\n",
" textgen_requirements = open('requirements.txt').read().splitlines()\n", " textgen_requirements = open('requirements.txt').read().splitlines()\n",
" if is_cuda118:\n", " if is_cuda118:\n",
" textgen_requirements = [req.replace('+cu121', '+cu118').replace('+cu122', '+cu118') for req in textgen_requirements]\n", " textgen_requirements = [req.replace('+cu121', '+cu118').replace('+cu122', '+cu118') for req in textgen_requirements]\n",