Skip to content

Instantly share code, notes, and snippets.

import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}
# Mount Google Drive
from google.colab import drive # import drive from google colab
ROOT = "/content/drive" # default location for the drive
print(ROOT) # print content of ROOT (Optional)
drive.mount(ROOT) # we mount the google drive at /content/drive
# Clone github repository setup
# import join used to join ROOT path and MY_GOOGLE_DRIVE_PATH
from os.path import join
# path to your project on Google Drive
MY_GOOGLE_DRIVE_PATH = 'My Drive/MyDrive/Udacity/deep-learning-v2-pytorch'
# replace with your Github username
GIT_USERNAME = "vsay01"
# definitely replace with your
GIT_TOKEN = "{YOUR_GITHUB_TOKEN}"
!git clone "{GIT_PATH}" ./temp # clone github repository to temp folder
!mv ./temp/* "{PROJECT_PATH}" # move all files/folders in temp folder to folder defined in project path
!rm -rf ./temp # remove all the files/folders in temp folder
!rsync -aP --exclude=data/ "{PROJECT_PATH}"/* ./ # use remote sync to copy from google drive to local runtime google colab
# but exclude data folder
# https://www.computerhope.com/unix/rsync.htm
#Import drive
from google.colab import drive
#Mount Google Drive
drive.mount("/content/drive")
%cd './drive/My Drive/MyDrive/Udacity/deep-learning-v2-pytorch/intro-to-pytorch/'
%pwd
#import helper.py
%cd "{PROJECT_PATH}" # Change directory to the location defined in project_path
!git clone "{GIT_PATH}" # clone the github repository
@vsay01
vsay01 / git_add_u.sh
Created January 1, 2020 22:59
git add modified files
!git add -u
@vsay01
vsay01 / git_add_all.sh
Created January 1, 2020 22:59
add all tracked files
!git add .
@vsay01
vsay01 / create_directory.sh
Created January 22, 2020 01:39
Make two directories named checkpoint and best_model
# uncomment if you want to create directory checkpoint, best_model
%mkdir checkpoint best_model
@vsay01
vsay01 / import.py
Created January 22, 2020 01:42
Import needed libraries
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import matplotlib.pyplot as plt
import torch
import shutil
from torch import nn
from torch import optim
import torch.nn.functional as F
from torchvision import datasets, transforms