Last active
September 1, 2018 19:10
-
-
Save denis-trofimov/77f8b6418b9ef4b45adca7ed587462d2 to your computer and use it in GitHub Desktop.
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
# For Colab don't run reload_ext autoreload & autoreload 2 | |
#%reload_ext autoreload | |
#%autoreload 2 | |
# Safe for Colab | |
%matplotlib inline | |
# Not sure are this libs are still count as missing on a clean Colab VM. | |
!apt-get -qq install -y libsm6 libxext6 | |
# Install torch compatible with fastai | |
from os import path | |
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag | |
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag()) | |
accelerator = 'cu80' if path.exists('/opt/bin/nvidia-smi') else 'cpu' | |
!pip install -q http://download.pytorch.org/whl/{accelerator}/torch-0.3.1-{platform}-linux_x86_64.whl fastai torchvision | |
# Model weights for other network architectures (e.g. resnext50): | |
!wget -q http://files.fast.ai/models/weights.tgz && tar -xzf weights.tgz -C /usr/local/lib/python3.6/dist-packages/fastai | |
# The dataset dogs & cats is available at http://files.fast.ai/data/dogscats.zip. | |
!mkdir -p data | |
!wget -q http://files.fast.ai/data/dogscats.zip | |
!unzip -q dogscats.zip -d data/ | |
# workaround for PIL.Image | |
!pip install -q Pillow==4.0.0 image | |
from PIL import Image | |
def register_extension(id, extension): Image.EXTENSION[extension.lower()] = id.upper() | |
Image.register_extension = register_extension | |
def register_extensions(id, extensions): | |
for extension in extensions: register_extension(id, extension) | |
Image.register_extensions = register_extensions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make commands more quiet! Tsss...