Skip to content

Instantly share code, notes, and snippets.

@serithemage
Last active November 18, 2019 01:52
Show Gist options
  • Save serithemage/44f7bb9ec9eed7cefa5ce48e13f09772 to your computer and use it in GitHub Desktop.
Save serithemage/44f7bb9ec9eed7cefa5ce48e13f09772 to your computer and use it in GitHub Desktop.
Setup for D2L.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Setup for D2L.ipynb",
"provenance": [],
"collapsed_sections": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/serithemage/44f7bb9ec9eed7cefa5ce48e13f09772/setup-for-d2l.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "NcFWElylPeA2",
"colab_type": "text"
},
"source": [
"# Deve into Deep Learning 실습환경 구축\n",
"\n",
"- 이 문서는 Google Colab에서 Dive into Deep Learning의 예제 코드를 실행하기 위한 환경설정을 다루고 있습니다.\n",
"- 런타입 유형은 Python3을 선택합니다.\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "ZUxFYu7wFL24",
"colab_type": "code",
"outputId": "7721d316-8f48-4660-9748-b2b63cc41de6",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
}
},
"source": [
"# 최신버전의 D2L은 numpy 인터페이스를 사용하고 있으므로 이에 맞춰 라이브러리를 설치합니다.\n",
"!pip install deepnumpy\n",
"!pip install d2l"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting deepnumpy\n",
" Downloading https://files.pythonhosted.org/packages/c7/03/831385307ecd664cb90c12668eb941406685b132ccad09faae9488ebf1e1/deepnumpy-0.1.0-py3-none-any.whl\n",
"Requirement already satisfied: numpy>=1.16.0 in /usr/local/lib/python3.6/dist-packages (from deepnumpy) (1.17.3)\n",
"Installing collected packages: deepnumpy\n",
"Successfully installed deepnumpy-0.1.0\n",
"Collecting d2l\n",
" Downloading https://files.pythonhosted.org/packages/c9/d3/e9b92d14359953524609ed21f41508cfbba3814313668b125c904c7cc6e2/d2l-0.10.1.tar.gz\n",
"Requirement already satisfied: jupyter in /usr/local/lib/python3.6/dist-packages (from d2l) (1.0.0)\n",
"Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from d2l) (1.17.3)\n",
"Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/dist-packages (from d2l) (3.1.1)\n",
"Requirement already satisfied: pandas in /usr/local/lib/python3.6/dist-packages (from d2l) (0.25.3)\n",
"Requirement already satisfied: qtconsole in /usr/local/lib/python3.6/dist-packages (from jupyter->d2l) (4.5.5)\n",
"Requirement already satisfied: ipywidgets in /usr/local/lib/python3.6/dist-packages (from jupyter->d2l) (7.5.1)\n",
"Requirement already satisfied: nbconvert in /usr/local/lib/python3.6/dist-packages (from jupyter->d2l) (5.6.1)\n",
"Requirement already satisfied: ipykernel in /usr/local/lib/python3.6/dist-packages (from jupyter->d2l) (4.6.1)\n",
"Requirement already satisfied: jupyter-console in /usr/local/lib/python3.6/dist-packages (from jupyter->d2l) (5.2.0)\n",
"Requirement already satisfied: notebook in /usr/local/lib/python3.6/dist-packages (from jupyter->d2l) (5.2.2)\n",
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->d2l) (2.4.4)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->d2l) (1.1.0)\n",
"Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->d2l) (2.6.1)\n",
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->d2l) (0.10.0)\n",
"Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas->d2l) (2018.9)\n",
"Requirement already satisfied: jupyter-client>=4.1 in /usr/local/lib/python3.6/dist-packages (from qtconsole->jupyter->d2l) (5.3.4)\n",
"Requirement already satisfied: pygments in /usr/local/lib/python3.6/dist-packages (from qtconsole->jupyter->d2l) (2.1.3)\n",
"Requirement already satisfied: jupyter-core in /usr/local/lib/python3.6/dist-packages (from qtconsole->jupyter->d2l) (4.6.1)\n",
"Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.6/dist-packages (from qtconsole->jupyter->d2l) (0.2.0)\n",
"Requirement already satisfied: traitlets in /usr/local/lib/python3.6/dist-packages (from qtconsole->jupyter->d2l) (4.3.3)\n",
"Requirement already satisfied: nbformat>=4.2.0 in /usr/local/lib/python3.6/dist-packages (from ipywidgets->jupyter->d2l) (4.4.0)\n",
"Requirement already satisfied: ipython>=4.0.0; python_version >= \"3.3\" in /usr/local/lib/python3.6/dist-packages (from ipywidgets->jupyter->d2l) (5.5.0)\n",
"Requirement already satisfied: widgetsnbextension~=3.5.0 in /usr/local/lib/python3.6/dist-packages (from ipywidgets->jupyter->d2l) (3.5.1)\n",
"Requirement already satisfied: defusedxml in /usr/local/lib/python3.6/dist-packages (from nbconvert->jupyter->d2l) (0.6.0)\n",
"Requirement already satisfied: bleach in /usr/local/lib/python3.6/dist-packages (from nbconvert->jupyter->d2l) (3.1.0)\n",
"Requirement already satisfied: jinja2>=2.4 in /usr/local/lib/python3.6/dist-packages (from nbconvert->jupyter->d2l) (2.10.3)\n",
"Requirement already satisfied: entrypoints>=0.2.2 in /usr/local/lib/python3.6/dist-packages (from nbconvert->jupyter->d2l) (0.3)\n",
"Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/lib/python3.6/dist-packages (from nbconvert->jupyter->d2l) (1.4.2)\n",
"Requirement already satisfied: testpath in /usr/local/lib/python3.6/dist-packages (from nbconvert->jupyter->d2l) (0.4.4)\n",
"Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/lib/python3.6/dist-packages (from nbconvert->jupyter->d2l) (0.8.4)\n",
"Requirement already satisfied: tornado>=4.0 in /usr/local/lib/python3.6/dist-packages (from ipykernel->jupyter->d2l) (4.5.3)\n",
"Requirement already satisfied: prompt-toolkit<2.0.0,>=1.0.0 in /usr/local/lib/python3.6/dist-packages (from jupyter-console->jupyter->d2l) (1.0.18)\n",
"Requirement already satisfied: terminado>=0.3.3; sys_platform != \"win32\" in /usr/local/lib/python3.6/dist-packages (from notebook->jupyter->d2l) (0.8.2)\n",
"Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from kiwisolver>=1.0.1->matplotlib->d2l) (41.4.0)\n",
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/dist-packages (from python-dateutil>=2.1->matplotlib->d2l) (1.12.0)\n",
"Requirement already satisfied: pyzmq>=13 in /usr/local/lib/python3.6/dist-packages (from jupyter-client>=4.1->qtconsole->jupyter->d2l) (17.0.0)\n",
"Requirement already satisfied: decorator in /usr/local/lib/python3.6/dist-packages (from traitlets->qtconsole->jupyter->d2l) (4.4.1)\n",
"Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /usr/local/lib/python3.6/dist-packages (from nbformat>=4.2.0->ipywidgets->jupyter->d2l) (2.6.0)\n",
"Requirement already satisfied: pexpect; sys_platform != \"win32\" in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets->jupyter->d2l) (4.7.0)\n",
"Requirement already satisfied: simplegeneric>0.8 in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets->jupyter->d2l) (0.8.1)\n",
"Requirement already satisfied: pickleshare in /usr/local/lib/python3.6/dist-packages (from ipython>=4.0.0; python_version >= \"3.3\"->ipywidgets->jupyter->d2l) (0.7.5)\n",
"Requirement already satisfied: webencodings in /usr/local/lib/python3.6/dist-packages (from bleach->nbconvert->jupyter->d2l) (0.5.1)\n",
"Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python3.6/dist-packages (from jinja2>=2.4->nbconvert->jupyter->d2l) (1.1.1)\n",
"Requirement already satisfied: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt-toolkit<2.0.0,>=1.0.0->jupyter-console->jupyter->d2l) (0.1.7)\n",
"Requirement already satisfied: ptyprocess; os_name != \"nt\" in /usr/local/lib/python3.6/dist-packages (from terminado>=0.3.3; sys_platform != \"win32\"->notebook->jupyter->d2l) (0.6.0)\n",
"Building wheels for collected packages: d2l\n",
" Building wheel for d2l (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for d2l: filename=d2l-0.10.1-cp36-none-any.whl size=16622 sha256=b7214012631a67a5fbe2ac6c57714723a3aed7c932bec7a4bae0e4a55699e728\n",
" Stored in directory: /root/.cache/pip/wheels/60/35/5d/df7f13dd4b012de688ffcc516091c6cd67c765dc64c9d1f43f\n",
"Successfully built d2l\n",
"Installing collected packages: d2l\n",
"Successfully installed d2l-0.10.1\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "APnIKwwSbwNt",
"colab_type": "code",
"outputId": "ddabb6df-f91f-43b3-d58a-33969a3be14a",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 309
}
},
"source": [
"# MXNet을 설치합니다\n",
"!pip install mxnet==1.6.0b20190915"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting mxnet==1.6.0b20190915\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/e5/74/f9262ace5919511139a64a7c015f7a8770d819282e1d404c8fbd7018cb17/mxnet-1.6.0b20190915-py2.py3-none-manylinux1_x86_64.whl (28.1MB)\n",
"\u001b[K |████████████████████████████████| 28.1MB 96.8MB/s \n",
"\u001b[?25hRequirement already satisfied: requests<3,>=2.20.0 in /usr/local/lib/python3.6/dist-packages (from mxnet==1.6.0b20190915) (2.21.0)\n",
"Requirement already satisfied: numpy<2.0.0,>1.16.0 in /usr/local/lib/python3.6/dist-packages (from mxnet==1.6.0b20190915) (1.17.3)\n",
"Collecting graphviz<0.9.0,>=0.8.1\n",
" Downloading https://files.pythonhosted.org/packages/53/39/4ab213673844e0c004bed8a0781a0721a3f6bb23eb8854ee75c236428892/graphviz-0.8.4-py2.py3-none-any.whl\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.20.0->mxnet==1.6.0b20190915) (2019.9.11)\n",
"Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.20.0->mxnet==1.6.0b20190915) (2.8)\n",
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.20.0->mxnet==1.6.0b20190915) (3.0.4)\n",
"Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests<3,>=2.20.0->mxnet==1.6.0b20190915) (1.24.3)\n",
"Installing collected packages: graphviz, mxnet\n",
" Found existing installation: graphviz 0.10.1\n",
" Uninstalling graphviz-0.10.1:\n",
" Successfully uninstalled graphviz-0.10.1\n",
"Successfully installed graphviz-0.8.4 mxnet-1.6.0b20190915\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "FUkiCBfRb8mx",
"colab_type": "code",
"colab": {}
},
"source": [
"# 정상적으로 MXNet이 설치되었는지 테스트 합니다. 에러가 나지 않으면 정상 설치가 된 것 입니다.\n",
"from mxnet import np, npx\n",
"npx.set_np()"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "lqHoYwY8FUyn",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment