Created
April 5, 2019 17:37
-
-
Save flc/a16a23f85825c34d9fcc0665993753e2 to your computer and use it in GitHub Desktop.
pytorch install google colab
This file contains hidden or 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
from os.path import exists | |
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag | |
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag()) | |
cuda_output = !ldconfig -p|grep cudart.so|sed -e 's/.*\.\([0-9]*\)\.\([0-9]*\)$/cu\1\2/' | |
accelerator = cuda_output[0] if exists('/dev/nvidia0') else 'cpu' | |
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.4.1-{platform}-linux_x86_64.whl torchvision |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment