Skip to content

Commit

Permalink
Install tf_keras in notebooks
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 602711911
  • Loading branch information
rstz authored and copybara-github committed Jan 30, 2024
1 parent d1d8d08 commit 14b5832
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 10 deletions.
1 change: 1 addition & 0 deletions documentation/tf_df_in_tf_js.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ to TensorFlow.js.

```python
!pip install tensorflow tensorflow_decision_forests 'tensorflowjs>=4.4.0'
!pip install tf_keras

# Prepare and load the model with TensorFlow
import tensorflow as tf
Expand Down
10 changes: 8 additions & 2 deletions documentation/tutorials/advanced_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@
},
"outputs": [],
"source": [
"# Install TensorFlow Dececision Forests.\n",
"# Install TensorFlow Decision Forests.\n",
"!pip install tensorflow_decision_forests\n",
"# TF-DF requires Tensorflow < 2.15 or tf_keras\n",
"!pip install tf_keras\n",
"\n",
"# Use wurlitzer to show the training logs.\n",
"!pip install wurlitzer"
Expand All @@ -104,12 +106,16 @@
},
"outputs": [],
"source": [
"import os\n",
"# Keep using Keras 2\n",
"os.environ['TF_USE_LEGACY_KERAS'] = '1'\n",
"\n",
"import tensorflow_decision_forests as tfdf\n",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"import tensorflow as tf\n",
"import tf_keras\n",
"import matplotlib.pyplot as plt\n",
"import math\n",
"import collections"
Expand Down
10 changes: 8 additions & 2 deletions documentation/tutorials/beginner_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@
},
"outputs": [],
"source": [
"!pip install tensorflow_decision_forests"
"!pip install tensorflow_decision_forests\n",
"# TF-DF requires Tensorflow < 2.15 or tf_keras\n",
"!pip install tf_keras\n"
]
},
{
Expand Down Expand Up @@ -148,12 +150,16 @@
},
"outputs": [],
"source": [
"import os\n",
"# Keep using Keras 2\n",
"os.environ['TF_USE_LEGACY_KERAS'] = '1'\n",
"\n",
"import tensorflow_decision_forests as tfdf\n",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"import tensorflow as tf\n",
"import tf_keras\n",
"import math"
]
},
Expand Down
10 changes: 8 additions & 2 deletions documentation/tutorials/intermediate_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@
"outputs": [],
"source": [
"# Install TensorFlow Dececision Forests\n",
"!pip install tensorflow_decision_forests"
"!pip install tensorflow_decision_forests\n",
"# TF-DF requires Tensorflow < 2.15 or tf_keras\n",
"!pip install tf_keras\n"
]
},
{
Expand Down Expand Up @@ -136,12 +138,16 @@
},
"outputs": [],
"source": [
"import os\n",
"# Keep using Keras 2\n",
"os.environ['TF_USE_LEGACY_KERAS'] = '1'\n",
"\n",
"import tensorflow_decision_forests as tfdf\n",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"import tensorflow as tf\n",
"import tf_keras\n",
"import math"
]
},
Expand Down
10 changes: 8 additions & 2 deletions documentation/tutorials/model_composition_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@
},
"outputs": [],
"source": [
"!pip install tensorflow_decision_forests -U --quiet"
"!pip install tensorflow_decision_forests -U --quiet\n",
"# TF-DF requires Tensorflow < 2.15 or tf_keras\n",
"!pip install tf_keras -U --quiet\n"
]
},
{
Expand Down Expand Up @@ -258,12 +260,16 @@
},
"outputs": [],
"source": [
"import os\n",
"# Keep using Keras 2\n",
"os.environ['TF_USE_LEGACY_KERAS'] = '1'\n",
"\n",
"import tensorflow_decision_forests as tfdf\n",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"import tensorflow as tf\n",
"import tf_keras\n",
"import math\n",
"import matplotlib.pyplot as plt"
]
Expand Down
10 changes: 8 additions & 2 deletions documentation/tutorials/ranking_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
},
"outputs": [],
"source": [
"!pip install tensorflow_decision_forests"
"!pip install tensorflow_decision_forests\n",
"# TF-DF requires Tensorflow < 2.15 or tf_keras\n",
"!pip install tf_keras\n"
]
},
{
Expand Down Expand Up @@ -132,12 +134,16 @@
},
"outputs": [],
"source": [
"import os\n",
"# Keep using Keras 2\n",
"os.environ['TF_USE_LEGACY_KERAS'] = '1'\n",
"\n",
"import tensorflow_decision_forests as tfdf\n",
"\n",
"import os\n",
"import numpy as np\n",
"import pandas as pd\n",
"import tensorflow as tf\n",
"import tf_keras\n",
"import math"
]
},
Expand Down

0 comments on commit 14b5832

Please sign in to comment.