mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-01-14 12:14:36 +01:00
Merge branch 'ageron:master' into add-kaggle-badge
This commit is contained in:
@@ -32,13 +32,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Setup"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Setup\n",
|
||||
"First, let's import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures. We also check that Python 3.5 or later is installed (although Python 2.x may work, it is deprecated so we strongly recommend you use Python 3 instead), as well as Scikit-Learn ≥0.20 and TensorFlow ≥2.0."
|
||||
]
|
||||
},
|
||||
@@ -52,19 +46,18 @@
|
||||
"import sys\n",
|
||||
"assert sys.version_info >= (3, 5)\n",
|
||||
"\n",
|
||||
"# Is this notebook running on Colab or Kaggle?\n",
|
||||
"IS_COLAB = \"google.colab\" in sys.modules\n",
|
||||
"IS_KAGGLE = \"kaggle_secrets\" in sys.modules\n",
|
||||
"\n",
|
||||
"if IS_COLAB or IS_KAGGLE:\n",
|
||||
" !apt update && apt install -y libpq-dev libsdl2-dev swig xorg-dev xvfb\n",
|
||||
" !pip install -q -U tf-agents pyvirtualdisplay gym[atari,box2d]\n",
|
||||
"\n",
|
||||
"# Scikit-Learn ≥0.20 is required\n",
|
||||
"import sklearn\n",
|
||||
"assert sklearn.__version__ >= \"0.20\"\n",
|
||||
"\n",
|
||||
"try:\n",
|
||||
" # %tensorflow_version only exists in Colab.\n",
|
||||
" %tensorflow_version 2.x\n",
|
||||
" !apt update && apt install -y libpq-dev libsdl2-dev swig xorg-dev xvfb\n",
|
||||
" !pip install -q -U tf-agents pyvirtualdisplay gym[atari,box2d]\n",
|
||||
" IS_COLAB = True\n",
|
||||
"except Exception:\n",
|
||||
" IS_COLAB = False\n",
|
||||
"\n",
|
||||
"# TensorFlow ≥2.0 is required\n",
|
||||
"import tensorflow as tf\n",
|
||||
"from tensorflow import keras\n",
|
||||
@@ -74,6 +67,8 @@
|
||||
" print(\"No GPU was detected. CNNs can be very slow without a GPU.\")\n",
|
||||
" if IS_COLAB:\n",
|
||||
" print(\"Go to Runtime > Change runtime and select a GPU hardware accelerator.\")\n",
|
||||
" if IS_KAGGLE:\n",
|
||||
" print(\"Go to Settings > Accelerator and select GPU.\")\n",
|
||||
"\n",
|
||||
"# Common imports\n",
|
||||
"import numpy as np\n",
|
||||
@@ -3226,7 +3221,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.9"
|
||||
"version": "3.7.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user