Last active
January 7, 2022 00:52
-
-
Save pmbaumgartner/937282d78f113dcb2cca88f2cab5a8cc to your computer and use it in GitHub Desktop.
Install spaCy with correct cuda version on Colab with GPU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SETUP | |
cuda_version = !nvcc --version | grep -Po '^.*release \K([0-9]+\.[0-9])' | sed 's/\.//g' | |
# REQUIREMENTS | |
from pathlib import Path | |
reqs = f""" | |
spacy[cuda{cuda_version.s},transformers,lookups]==3.2.1 | |
""" | |
Path("requirements.txt").write_text(reqs) | |
!pip install --quiet -r requirements.txt | |
# Check GPU is available | |
import spacy | |
assert spacy.require_gpu() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment