Support running on Kaggle

This commit is contained in:
Aurélien Geron
2021-05-25 12:07:29 +12:00
parent cbe47c65d5
commit c3020f1da5
8 changed files with 72 additions and 77 deletions

View File

@@ -44,18 +44,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",
" !pip install -q -U tfx==0.21.2\n",
" print(\"You can safely ignore the package incompatibility errors.\")\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",
" !pip install -q -U tfx==0.21.2\n",
" print(\"You can safely ignore the package incompatibility errors.\")\n",
"except Exception:\n",
" pass\n",
"\n",
"# TensorFlow ≥2.0 is required\n",
"import tensorflow as tf\n",
"from tensorflow import keras\n",
@@ -2766,7 +2766,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
"version": "3.7.10"
},
"nav_menu": {
"height": "264px",