mirror of
https://github.com/ArthurDanjou/handson-ml3.git
synced 2026-01-14 12:14:36 +01:00
Update notebook 16 to TF 2.1
This commit is contained in:
@@ -66,7 +66,7 @@
|
|||||||
"from tensorflow import keras\n",
|
"from tensorflow import keras\n",
|
||||||
"assert tf.__version__ >= \"2.0\"\n",
|
"assert tf.__version__ >= \"2.0\"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"if not tf.test.is_gpu_available():\n",
|
"if not tf.config.list_physical_devices('GPU'):\n",
|
||||||
" print(\"No GPU was detected. LSTMs and CNNs can be very slow without a GPU.\")\n",
|
" print(\"No GPU was detected. LSTMs and CNNs can be very slow without a GPU.\")\n",
|
||||||
" if IS_COLAB:\n",
|
" if IS_COLAB:\n",
|
||||||
" print(\"Go to Runtime > Change runtime and select a GPU hardware accelerator.\")\n",
|
" print(\"Go to Runtime > Change runtime and select a GPU hardware accelerator.\")\n",
|
||||||
@@ -317,12 +317,9 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"model = keras.models.Sequential([\n",
|
"model = keras.models.Sequential([\n",
|
||||||
" keras.layers.GRU(128, return_sequences=True, input_shape=[None, max_id],\n",
|
" keras.layers.GRU(128, return_sequences=True, input_shape=[None, max_id],\n",
|
||||||
" # no dropout in stateful RNN (https://github.com/ageron/handson-ml2/issues/32)\n",
|
" dropout=0.2, recurrent_dropout=0.2),\n",
|
||||||
" # dropout=0.2, recurrent_dropout=0.2,\n",
|
|
||||||
" ),\n",
|
|
||||||
" keras.layers.GRU(128, return_sequences=True,\n",
|
" keras.layers.GRU(128, return_sequences=True,\n",
|
||||||
" # dropout=0.2, recurrent_dropout=0.2\n",
|
" dropout=0.2, recurrent_dropout=0.2),\n",
|
||||||
" ),\n",
|
|
||||||
" keras.layers.TimeDistributed(keras.layers.Dense(max_id,\n",
|
" keras.layers.TimeDistributed(keras.layers.Dense(max_id,\n",
|
||||||
" activation=\"softmax\"))\n",
|
" activation=\"softmax\"))\n",
|
||||||
"])\n",
|
"])\n",
|
||||||
@@ -1237,7 +1234,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.7.3"
|
"version": "3.7.6"
|
||||||
},
|
},
|
||||||
"nav_menu": {},
|
"nav_menu": {},
|
||||||
"toc": {
|
"toc": {
|
||||||
@@ -1251,5 +1248,5 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
"nbformat_minor": 1
|
"nbformat_minor": 2
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user