Notes about
fastai_xla_extensions
development setup
The fastai_xla_extensions
project uses nbdev
to build the package from Jupyter notebooks.
In order to contribute or update the package, the development environment must be setup to run on Colab, which provides access to TPUs.
The following steps are based on instructions from nbdev
documentation on running nbdev on Colab.
from google.colab import drive
drive.mount('/content/drive')
%cd /content/drive
%cd /content/drive/MyDrive
!git clone https://github.com/butchland/fastai_xla_extensions.git
%cd /content
!ln -s /content/drive/MyDrive/fastai_xla_extensions fastai_xla_extensions
!pip install -Uqq cloud-tpu-client==0.10 https://storage.googleapis.com/tpu-pytorch/wheels/torch_xla-1.7-cp36-cp36m-linux_x86_64.whl
!pip install -Uqq fastai==2.3.0
!pip install -qqq nbdev
%cd /content/fastai_xla_extensions
from fastai_xla_extensions.all import *
%cd /content
%cd /content/fastai_xla_extensions
!nbdev_clean_nbs && nbdev_build_lib && nbdev_build_docs
#@title Enter your github info {display-mode: "form"}
github_id = "" #@param {type: "string"}
user_email = "" #@param {type: "string"}
real_name = "" #@param {type: "string"}
Check that the github ID, repo, email and name have been filled out
github_repo = 'fastai_xla_extensions'
if github_id == "" or github_repo == "" or user_email == "" or real_name == "":
print("Rerun your notebook by pressing Cmd/Ctrl-F9 or menu Runtime/Run all")
raise RuntimeError("Please enter your Github ID and Repo as well as your user email and name")
!git config --global user.name "{real_name}"
!git config --global user.email "{user_email}"
from pathlib import Path
if not (Path('/content')/github_repo).is_dir():
print('You might have entered the wrong github credentials')
raise RuntimeError(f'Could not download your github repo https://github.com/{github_id}/{github_repo}.git')
%cd /content/{github_repo}
Run git commands to add your changes to your local repo.
# !git status
# !git add -all
# !git commit -m ""
#@title {display-mode: "form"}
print('Please enter your password.')
import getpass
github_password = getpass.getpass()
#@title {display-mode: "form"}
!git config credential.helper store
!echo "https://{github_id}:{github_password}@github.com" > /root/.git-credentials
!git push
!rm -f /root/.git-credentials