Skip to content

Commit

Permalink
Let TF-GNN Colab notebooks set os.environ["TF_USE_LEGACY_KERAS"] = "1"
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoegw authored and tensorflower-gardener committed Apr 24, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 6818eb2 commit 16275ca
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/notebooks/graph_network_shortest_path.ipynb
Original file line number Diff line number Diff line change
@@ -124,7 +124,9 @@
"import collections\n",
"import functools\n",
"import itertools\n",
"import os\n",
"from typing import Callable, Optional, Mapping, Tuple\n",
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"1\" # For TF2.16+.\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import networkx as nx\n",
5 changes: 4 additions & 1 deletion examples/notebooks/intro_mutag_example.ipynb
Original file line number Diff line number Diff line change
@@ -90,7 +90,9 @@
"id": "sS8ot98DEgzJ"
},
"source": [
"Before Python can `import tensorflow_gnn`, the PIP package [`tensorflow-gnn`](https://pypi.org/project/tensorflow-gnn/) needs to be downloaded and installed."
"Before Python can `import tensorflow_gnn`, the PIP package [`tensorflow-gnn`](https://pypi.org/project/tensorflow-gnn/) needs to be downloaded and installed.\n",
"\n",
"TensorFlow 2.16+ must be [configured](https://github.com/tensorflow/gnn/blob/main/tensorflow_gnn/docs/guide/keras_version.md) to use Keras v2 as `tf.keras`."
]
},
{
@@ -113,6 +115,7 @@
"outputs": [],
"source": [
"import os\n",
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"1\" # For TF2.16+.\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
1 change: 1 addition & 0 deletions examples/notebooks/ogbn_mag_e2e.ipynb
Original file line number Diff line number Diff line change
@@ -129,6 +129,7 @@
"import os\n",
"import re\n",
"from typing import Mapping\n",
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"1\" # For TF2.16+.\n",
"\n",
"import tensorflow as tf\n",
"import tensorflow_gnn as tfgnn\n",
1 change: 1 addition & 0 deletions examples/notebooks/ogbn_mag_indepth.ipynb
Original file line number Diff line number Diff line change
@@ -126,6 +126,7 @@
"import os\n",
"import random\n",
"import re\n",
"os.environ[\"TF_USE_LEGACY_KERAS\"] = \"1\" # For TF2.16+.\n",
"\n",
"from google.protobuf import text_format\n",
"import tensorflow as tf\n",

0 comments on commit 16275ca

Please sign in to comment.