From 832ba9980df2680dd98452c8613fe6e81e69027d Mon Sep 17 00:00:00 2001 From: mr-yamraj Date: Sun, 22 Sep 2019 02:43:40 +0530 Subject: [PATCH] Tutorial for Google Colab added --- .../Using_ELL_in_Colab.ipynb | 191 ++++++++++++++++++ .../Google-Colaboratory-setup/index.md | 15 ++ docs/tutorials/index.md | 1 + 3 files changed, 207 insertions(+) create mode 100644 docs/tutorials/Google-Colaboratory-setup/Using_ELL_in_Colab.ipynb create mode 100644 docs/tutorials/Google-Colaboratory-setup/index.md diff --git a/docs/tutorials/Google-Colaboratory-setup/Using_ELL_in_Colab.ipynb b/docs/tutorials/Google-Colaboratory-setup/Using_ELL_in_Colab.ipynb new file mode 100644 index 000000000..d3c93edd9 --- /dev/null +++ b/docs/tutorials/Google-Colaboratory-setup/Using_ELL_in_Colab.ipynb @@ -0,0 +1,191 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "Using_ELL_in_Colab.ipynb", + "provenance": [], + "collapsed_sections": [ + "B-ZvwR1xCbIj", + "rGIpbb8I1ia_", + "EImJ8zAu0pft", + "qXCg279c9K4J", + "jjZQ9x2GFx2d", + "S4IdnctJdmzK", + "yG-KQm4cdzyn", + "rUY1J5Nkeevh", + "TR3mOcAKuKiC", + "wuZo3-yLfa3O", + "16Rs_5vzffox", + "saRJ1aCrwods", + "UoO1Z2PkgWlJ", + "O_xxjMLJjB3E", + "TcWZXKcwEXuV", + "oJoC8q-lmcQ1", + "RTxb1qFXm3NW", + "DTMcYT71zX2K" + ] + }, + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "accelerator": "GPU" + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "d1VlrdClNx7M", + "colab_type": "text" + }, + "source": [ + "# Introduction\n", + "In this Jupyter Notebook, we are going to setup ELL.\n", + "\n", + "Note: You should prefer to use Python3 and Hardware Accelerator as GPU" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "B-ZvwR1xCbIj", + "colab_type": "text" + }, + "source": [ + "# Installing Base Modules\n" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "2rIlw78XCZG9", + "colab_type": "code", + "colab": {} + }, + "source": [ + "%cd /content\n", + "!pip install gdown\n", + "#### Install required dependencies to build ELL\n", + "!sudo add-apt-repository --assume-yes ppa:ubuntu-toolchain-r/test\n", + "!sudo apt-get -y update\n", + "!sudo apt-get install -y gcc-8 g++-8 cmake libedit-dev zlibc zlib1g zlib1g-dev make\n", + "!sudo apt-get install -y libopenblas-dev doxygen\n", + "!sudo sh -c 'echo deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main >> /etc/apt/sources.list'\n", + "!sudo sh -c 'echo deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-8 main >> /etc/apt/sources.list'\n", + "!wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -\n", + "!sudo apt-get update\n", + "!sudo apt-get install llvm-8 -y\n", + "!sudo apt-get install -y curl\n", + "!curl -O --location http://prdownloads.sourceforge.net/swig/swig-4.0.0.tar.gz\n", + "!tar zxvf swig-4.0.0.tar.gz\n", + "%cd swig-4.0.0\n", + "!./configure --without-pcre && make -j && sudo make install\n", + "%cd ..\n", + "### Setting up softlink with required version of gcc\n", + "!rm /usr/bin/gcc\n", + "!rm /usr/bin/g++\n", + "!ln -s /usr/bin/gcc-8 /usr/bin/gcc\n", + "!ln -s /usr/bin/g++-8 /usr/bin/g++" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "rGIpbb8I1ia_", + "colab_type": "text" + }, + "source": [ + "# Section 1 (USING ELL)\n", + "Select any of the following two ways to go forward:\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "EImJ8zAu0pft", + "colab_type": "text" + }, + "source": [ + "## 1. Using precompiled latest version of ELL\n", + "Latest compiled version: [v3.0.2](https://github.com/microsoft/ELL/releases/tag/v3.0.2)\n", + "\n", + "Run the cell below to download and unzip the Latest compiled ELL version" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "BnyuS3L0CWW1", + "colab_type": "code", + "colab": {} + }, + "source": [ + "%cd /content\n", + "!gdown https://drive.google.com/uc?id=1uxHoNex9xnIVevfe8hBPvpZrWrq71q3r\n", + "!unzip -q ELL.zip\n", + "%env ELL_ROOT=/content/ELL\n", + "!chmod +x $ELL_ROOT/build/bin/compile" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "qXCg279c9K4J", + "colab_type": "text" + }, + "source": [ + "## 2. Compiling latest version of ELL\n", + "Url to git repo : [link](https://github.com/microsoft/ELL)\n", + "\n", + "Note: Clone the version or branch which you want to use. If you are using version less than Release v3.0.1 then please take care of the version of SWIG that you have installed in this [cell](https://colab.research.google.com/drive/1XTARgz_3Cnd2NBB4_YxL8PzafcJ6JOWj#scrollTo=X5G5N40-S242&line=5&uniqifier=1)" + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "dCs_qvSCgNvf", + "colab_type": "code", + "colab": {} + }, + "source": [ + "%cd /content\n", + "#### Cloning ELL repository\n", + "!git clone https://github.com/Microsoft/ELL.git\n", + "\n", + "### Building ELL\n", + "%cd /content/ELL\n", + "!mkdir build\n", + "%cd build\n", + "!rm -rf *\n", + "!cmake ..\n", + "!make -j4\n", + "!make _ELL_python\n", + "%cd ../..\n", + "%env ELL_ROOT=/content/ELL\n", + "!chmod +x $ELL_ROOT/build/bin/compile" + ], + "execution_count": 0, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": { + "colab_type": "text", + "id": "LrtRdTZlmRue" + }, + "source": [ + "# References\n", + "\n", + "## Libraries and Tools\n", + "2. ELL by Microsoft ([link](https://github.com/microsoft/ELL)). License: [MIT License](https://github.com/microsoft/ELL/blob/master/LICENSE.txt)\n", + "\n", + "Contributers to the script: [mr-yamraj](https://github.com/mr-yamraj)" + ] + } + ] +} \ No newline at end of file diff --git a/docs/tutorials/Google-Colaboratory-setup/index.md b/docs/tutorials/Google-Colaboratory-setup/index.md new file mode 100644 index 000000000..13024ede4 --- /dev/null +++ b/docs/tutorials/Google-Colaboratory-setup/index.md @@ -0,0 +1,15 @@ +--- +layout: default +title: Google Colaboratory Setup +permalink: /tutorials/Google-Colaboratory-setup/ +--- + +# Google Colaboratory Setup + +*by Yash Gaurkar* + +Most Embedded Learning Library (ELL) tutorials follow a common workflow. You typically start by designing an ELL model on a laptop or desktop computer. It is easy to setup ELL on the system but it takes some time to build the binaries for ELL. And if you prefer to use Google Colab to train your model then you will prefer to generate the trained model on the same platform for different devices. + +Find the colab notebook here: + +* [ELL on Colab](https://colab.research.google.com/github//microsoft/ELL/blob/master/docs/tutorials/Google-Colaboratory-setup/Using_ELL_in_Colab.ipynb): This Notebook contains pre-build Latest Version of ELL and commands to build your preferred version of ELL. If you want to use pre-build Latest Version of ELL then you can get started within 5 mins of which most of the time it take to install Base Models for ELL. diff --git a/docs/tutorials/index.md b/docs/tutorials/index.md index 89d0cf261..a101bc07b 100644 --- a/docs/tutorials/index.md +++ b/docs/tutorials/index.md @@ -10,6 +10,7 @@ permalink: /tutorials/ * [Raspberry Pi Setup](/ELL/tutorials/Raspberry-Pi-setup) * [Active cooling your Raspberry Pi 3](/ELL/tutorials/Active-cooling-your-Raspberry-Pi-3) +* [Google Colaboratory Setup](/ELL/tutorials/Google-Colaboratory-setup) ## Image Classification Tutorials in Python