Install the TensorFlow-Addons library on Colab or Kaggle

main
Aurélien Geron 2022-02-21 14:39:49 +13:00
parent b5fa249fd3
commit c3ca373556
1 changed files with 102 additions and 85 deletions

View File

@ -1793,9 +1793,26 @@
"**AdamW Optimization**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"On Colab or Kaggle, we need to install the TensorFlow-Addons library:"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [],
"source": [
"if \"google.colab\" in sys.modules or \"kaggle_secrets\" in sys.modules:\n",
" %pip install -q -U tensorflow-addons"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {
"tags": []
},
@ -1809,7 +1826,7 @@
},
{
"cell_type": "code",
"execution_count": 64,
"execution_count": 65,
"metadata": {},
"outputs": [
{
@ -1845,7 +1862,7 @@
},
{
"cell_type": "code",
"execution_count": 65,
"execution_count": 66,
"metadata": {},
"outputs": [
{
@ -1917,7 +1934,7 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": 67,
"metadata": {},
"outputs": [],
"source": [
@ -1926,7 +1943,7 @@
},
{
"cell_type": "code",
"execution_count": 67,
"execution_count": 68,
"metadata": {},
"outputs": [
{
@ -1962,7 +1979,7 @@
},
{
"cell_type": "code",
"execution_count": 68,
"execution_count": 69,
"metadata": {},
"outputs": [
{
@ -2017,7 +2034,7 @@
},
{
"cell_type": "code",
"execution_count": 69,
"execution_count": 70,
"metadata": {},
"outputs": [],
"source": [
@ -2027,7 +2044,7 @@
},
{
"cell_type": "code",
"execution_count": 70,
"execution_count": 71,
"metadata": {},
"outputs": [],
"source": [
@ -2041,7 +2058,7 @@
},
{
"cell_type": "code",
"execution_count": 71,
"execution_count": 72,
"metadata": {},
"outputs": [],
"source": [
@ -2056,7 +2073,7 @@
},
{
"cell_type": "code",
"execution_count": 72,
"execution_count": 73,
"metadata": {},
"outputs": [
{
@ -2125,7 +2142,7 @@
},
{
"cell_type": "code",
"execution_count": 73,
"execution_count": 74,
"metadata": {},
"outputs": [
{
@ -2162,7 +2179,7 @@
},
{
"cell_type": "code",
"execution_count": 74,
"execution_count": 75,
"metadata": {},
"outputs": [],
"source": [
@ -2179,7 +2196,7 @@
},
{
"cell_type": "code",
"execution_count": 75,
"execution_count": 76,
"metadata": {},
"outputs": [],
"source": [
@ -2203,7 +2220,7 @@
},
{
"cell_type": "code",
"execution_count": 76,
"execution_count": 77,
"metadata": {},
"outputs": [],
"source": [
@ -2216,7 +2233,7 @@
},
{
"cell_type": "code",
"execution_count": 77,
"execution_count": 78,
"metadata": {},
"outputs": [
{
@ -2288,7 +2305,7 @@
},
{
"cell_type": "code",
"execution_count": 78,
"execution_count": 79,
"metadata": {
"scrolled": true
},
@ -2330,7 +2347,7 @@
},
{
"cell_type": "code",
"execution_count": 79,
"execution_count": 80,
"metadata": {},
"outputs": [],
"source": [
@ -2345,7 +2362,7 @@
},
{
"cell_type": "code",
"execution_count": 80,
"execution_count": 81,
"metadata": {},
"outputs": [],
"source": [
@ -2364,7 +2381,7 @@
},
{
"cell_type": "code",
"execution_count": 81,
"execution_count": 82,
"metadata": {},
"outputs": [
{
@ -2442,7 +2459,7 @@
},
{
"cell_type": "code",
"execution_count": 82,
"execution_count": 83,
"metadata": {},
"outputs": [
{
@ -2479,7 +2496,7 @@
},
{
"cell_type": "code",
"execution_count": 83,
"execution_count": 84,
"metadata": {},
"outputs": [],
"source": [
@ -2493,7 +2510,7 @@
},
{
"cell_type": "code",
"execution_count": 84,
"execution_count": 85,
"metadata": {},
"outputs": [
{
@ -2562,7 +2579,7 @@
},
{
"cell_type": "code",
"execution_count": 85,
"execution_count": 86,
"metadata": {},
"outputs": [
{
@ -2606,7 +2623,7 @@
},
{
"cell_type": "code",
"execution_count": 86,
"execution_count": 87,
"metadata": {},
"outputs": [],
"source": [
@ -2622,7 +2639,7 @@
},
{
"cell_type": "code",
"execution_count": 87,
"execution_count": 88,
"metadata": {},
"outputs": [
{
@ -2666,7 +2683,7 @@
},
{
"cell_type": "code",
"execution_count": 88,
"execution_count": 89,
"metadata": {},
"outputs": [],
"source": [
@ -2692,7 +2709,7 @@
},
{
"cell_type": "code",
"execution_count": 89,
"execution_count": 90,
"metadata": {},
"outputs": [],
"source": [
@ -2727,7 +2744,7 @@
},
{
"cell_type": "code",
"execution_count": 90,
"execution_count": 91,
"metadata": {},
"outputs": [],
"source": [
@ -2755,7 +2772,7 @@
},
{
"cell_type": "code",
"execution_count": 91,
"execution_count": 92,
"metadata": {},
"outputs": [],
"source": [
@ -2779,7 +2796,7 @@
},
{
"cell_type": "code",
"execution_count": 92,
"execution_count": 93,
"metadata": {},
"outputs": [],
"source": [
@ -2798,7 +2815,7 @@
},
{
"cell_type": "code",
"execution_count": 93,
"execution_count": 94,
"metadata": {},
"outputs": [
{
@ -2844,7 +2861,7 @@
},
{
"cell_type": "code",
"execution_count": 94,
"execution_count": 95,
"metadata": {},
"outputs": [],
"source": [
@ -2885,7 +2902,7 @@
},
{
"cell_type": "code",
"execution_count": 95,
"execution_count": 96,
"metadata": {},
"outputs": [
{
@ -2974,7 +2991,7 @@
},
{
"cell_type": "code",
"execution_count": 96,
"execution_count": 97,
"metadata": {},
"outputs": [],
"source": [
@ -2992,7 +3009,7 @@
},
{
"cell_type": "code",
"execution_count": 97,
"execution_count": 98,
"metadata": {},
"outputs": [],
"source": [
@ -3001,7 +3018,7 @@
},
{
"cell_type": "code",
"execution_count": 98,
"execution_count": 99,
"metadata": {},
"outputs": [],
"source": [
@ -3022,7 +3039,7 @@
},
{
"cell_type": "code",
"execution_count": 99,
"execution_count": 100,
"metadata": {},
"outputs": [
{
@ -3054,7 +3071,7 @@
},
{
"cell_type": "code",
"execution_count": 100,
"execution_count": 101,
"metadata": {},
"outputs": [],
"source": [
@ -3063,7 +3080,7 @@
},
{
"cell_type": "code",
"execution_count": 101,
"execution_count": 102,
"metadata": {},
"outputs": [],
"source": [
@ -3082,7 +3099,7 @@
},
{
"cell_type": "code",
"execution_count": 102,
"execution_count": 103,
"metadata": {},
"outputs": [
{
@ -3130,7 +3147,7 @@
},
{
"cell_type": "code",
"execution_count": 103,
"execution_count": 104,
"metadata": {},
"outputs": [
{
@ -3146,7 +3163,7 @@
"[0.30816400051116943, 0.8849090933799744]"
]
},
"execution_count": 103,
"execution_count": 104,
"metadata": {},
"output_type": "execute_result"
}
@ -3157,7 +3174,7 @@
},
{
"cell_type": "code",
"execution_count": 104,
"execution_count": 105,
"metadata": {},
"outputs": [
{
@ -3173,7 +3190,7 @@
"[0.3628920316696167, 0.8700000047683716]"
]
},
"execution_count": 104,
"execution_count": 105,
"metadata": {},
"output_type": "execute_result"
}
@ -3198,7 +3215,7 @@
},
{
"cell_type": "code",
"execution_count": 105,
"execution_count": 106,
"metadata": {},
"outputs": [],
"source": [
@ -3207,7 +3224,7 @@
},
{
"cell_type": "code",
"execution_count": 106,
"execution_count": 107,
"metadata": {},
"outputs": [],
"source": [
@ -3218,7 +3235,7 @@
},
{
"cell_type": "code",
"execution_count": 107,
"execution_count": 108,
"metadata": {},
"outputs": [
{
@ -3228,7 +3245,7 @@
" 0.844]], dtype=float32)"
]
},
"execution_count": 107,
"execution_count": 108,
"metadata": {},
"output_type": "execute_result"
}
@ -3239,7 +3256,7 @@
},
{
"cell_type": "code",
"execution_count": 108,
"execution_count": 109,
"metadata": {},
"outputs": [
{
@ -3249,7 +3266,7 @@
" 0.723], dtype=float32)"
]
},
"execution_count": 108,
"execution_count": 109,
"metadata": {},
"output_type": "execute_result"
}
@ -3260,7 +3277,7 @@
},
{
"cell_type": "code",
"execution_count": 109,
"execution_count": 110,
"metadata": {},
"outputs": [
{
@ -3270,7 +3287,7 @@
" 0.183], dtype=float32)"
]
},
"execution_count": 109,
"execution_count": 110,
"metadata": {},
"output_type": "execute_result"
}
@ -3282,7 +3299,7 @@
},
{
"cell_type": "code",
"execution_count": 110,
"execution_count": 111,
"metadata": {},
"outputs": [
{
@ -3291,7 +3308,7 @@
"0.8717"
]
},
"execution_count": 110,
"execution_count": 111,
"metadata": {},
"output_type": "execute_result"
}
@ -3304,7 +3321,7 @@
},
{
"cell_type": "code",
"execution_count": 111,
"execution_count": 112,
"metadata": {},
"outputs": [],
"source": [
@ -3315,7 +3332,7 @@
},
{
"cell_type": "code",
"execution_count": 112,
"execution_count": 113,
"metadata": {},
"outputs": [],
"source": [
@ -3330,7 +3347,7 @@
},
{
"cell_type": "code",
"execution_count": 113,
"execution_count": 114,
"metadata": {},
"outputs": [
{
@ -3375,7 +3392,7 @@
},
{
"cell_type": "code",
"execution_count": 114,
"execution_count": 115,
"metadata": {},
"outputs": [
{
@ -3385,7 +3402,7 @@
" dtype=float32)"
]
},
"execution_count": 114,
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
@ -3406,7 +3423,7 @@
},
{
"cell_type": "code",
"execution_count": 115,
"execution_count": 116,
"metadata": {},
"outputs": [],
"source": [
@ -3417,7 +3434,7 @@
},
{
"cell_type": "code",
"execution_count": 116,
"execution_count": 117,
"metadata": {},
"outputs": [
{
@ -3512,7 +3529,7 @@
},
{
"cell_type": "code",
"execution_count": 117,
"execution_count": 118,
"metadata": {},
"outputs": [],
"source": [
@ -3543,7 +3560,7 @@
},
{
"cell_type": "code",
"execution_count": 118,
"execution_count": 119,
"metadata": {},
"outputs": [],
"source": [
@ -3559,7 +3576,7 @@
},
{
"cell_type": "code",
"execution_count": 119,
"execution_count": 120,
"metadata": {},
"outputs": [],
"source": [
@ -3578,7 +3595,7 @@
},
{
"cell_type": "code",
"execution_count": 120,
"execution_count": 121,
"metadata": {},
"outputs": [],
"source": [
@ -3600,7 +3617,7 @@
},
{
"cell_type": "code",
"execution_count": 121,
"execution_count": 122,
"metadata": {},
"outputs": [],
"source": [
@ -3616,7 +3633,7 @@
},
{
"cell_type": "code",
"execution_count": 122,
"execution_count": 123,
"metadata": {},
"outputs": [
{
@ -3653,7 +3670,7 @@
},
{
"cell_type": "code",
"execution_count": 123,
"execution_count": 124,
"metadata": {},
"outputs": [
{
@ -3739,7 +3756,7 @@
"<keras.callbacks.History at 0x7fb9f02fc070>"
]
},
"execution_count": 123,
"execution_count": 124,
"metadata": {},
"output_type": "execute_result"
}
@ -3752,7 +3769,7 @@
},
{
"cell_type": "code",
"execution_count": 124,
"execution_count": 125,
"metadata": {},
"outputs": [
{
@ -3768,7 +3785,7 @@
"[1.5061508417129517, 0.4675999879837036]"
]
},
"execution_count": 124,
"execution_count": 125,
"metadata": {},
"output_type": "execute_result"
}
@ -3805,7 +3822,7 @@
},
{
"cell_type": "code",
"execution_count": 125,
"execution_count": 126,
"metadata": {},
"outputs": [
{
@ -3891,7 +3908,7 @@
"[1.4236289262771606, 0.5073999762535095]"
]
},
"execution_count": 125,
"execution_count": 126,
"metadata": {},
"output_type": "execute_result"
}
@ -3948,7 +3965,7 @@
},
{
"cell_type": "code",
"execution_count": 126,
"execution_count": 127,
"metadata": {
"scrolled": true
},
@ -4042,7 +4059,7 @@
"[1.4607702493667603, 0.5026000142097473]"
]
},
"execution_count": 126,
"execution_count": 127,
"metadata": {},
"output_type": "execute_result"
}
@ -4103,7 +4120,7 @@
},
{
"cell_type": "code",
"execution_count": 127,
"execution_count": 128,
"metadata": {},
"outputs": [
{
@ -4183,7 +4200,7 @@
"[1.4779616594314575, 0.498199999332428]"
]
},
"execution_count": 127,
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
@ -4244,7 +4261,7 @@
},
{
"cell_type": "code",
"execution_count": 128,
"execution_count": 129,
"metadata": {},
"outputs": [],
"source": [
@ -4262,7 +4279,7 @@
},
{
"cell_type": "code",
"execution_count": 129,
"execution_count": 130,
"metadata": {},
"outputs": [],
"source": [
@ -4285,7 +4302,7 @@
},
{
"cell_type": "code",
"execution_count": 130,
"execution_count": 131,
"metadata": {},
"outputs": [],
"source": [
@ -4307,7 +4324,7 @@
},
{
"cell_type": "code",
"execution_count": 131,
"execution_count": 132,
"metadata": {},
"outputs": [
{
@ -4316,7 +4333,7 @@
"0.4984"
]
},
"execution_count": 131,
"execution_count": 132,
"metadata": {},
"output_type": "execute_result"
}
@ -4348,7 +4365,7 @@
},
{
"cell_type": "code",
"execution_count": 132,
"execution_count": 133,
"metadata": {},
"outputs": [],
"source": [
@ -4372,7 +4389,7 @@
},
{
"cell_type": "code",
"execution_count": 133,
"execution_count": 134,
"metadata": {},
"outputs": [
{
@ -4404,7 +4421,7 @@
},
{
"cell_type": "code",
"execution_count": 134,
"execution_count": 135,
"metadata": {},
"outputs": [],
"source": [
@ -4428,7 +4445,7 @@
},
{
"cell_type": "code",
"execution_count": 135,
"execution_count": 136,
"metadata": {},
"outputs": [
{