Skip to content

Commit

Permalink
Use tensorflow >=2.16 to avoid having reinstall keras3
Browse files Browse the repository at this point in the history
  • Loading branch information
nhuet authored and ducoffeM committed Mar 19, 2024
1 parent 02f00ee commit 4f7bd2f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 43 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ jobs:
python -m pip install -U pip setuptools
pip install .
pip install -r docs/requirements.txt
# ensure having keras 3 instead of keras 2.15 installed by tensorflow
pip uninstall -y keras
pip install "keras>=3"
- name: generate documentation
id: sphinx-build
run: |
Expand Down
6 changes: 3 additions & 3 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- kaggle
- pandas
- scipy
- tensorboard>=2.13
# - tensorflow>=2.15 # conflicting dependencies with decomon (keras 2)
- tensorboard>=2.16
- tensorflow>=2.16
- jupyter-server-proxy
- .. # decomon
- .. # decomon
6 changes: 0 additions & 6 deletions binder/postBuild
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# install tensorflow backend separately from decomon (dependencies conflict as tf 2.15 requires keras 2)
pip install tensorflow>=2.15
# use keras 3 instead of keras 2 installed by tensorflow
pip uninstall -y keras
pip install "keras>=3"

# tensorboard launches at startup
mv binder/tensorboardserverextension.py ${NB_PYTHON_PREFIX}/lib/python*/site-packages/
# enable tensorboard extension
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sphinx
myst_parser
sphinx_rtd_theme
tensorflow>=2.15 # install a backend for keras 3 (and tensorflow is the one needed by default)
tensorflow>=2.16 # install a backend for keras 3 (and tensorflow is the one needed by default)
5 changes: 1 addition & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ deps =
pytest<8
pytest-cases
py39-linux-tf: pytest-cov
tf: tensorflow>=2.15 # backend for keras 3
tf: tensorflow>=2.16 # backend for keras 3
torch: torch>=2.1.0 # backend for keras 3
setenv =
tf: KERAS_BACKEND=tensorflow
torch: KERAS_BACKEND=torch
commands =
# be sure to get keras 3 instead of keras 2 brought back by tensorflow 2.15
pip uninstall keras -y
pip install "keras>=3"
pip list
python -c 'import keras; print(keras.config.backend())'
pytest -v \
Expand Down
7 changes: 2 additions & 5 deletions tutorials/tutorial1_sinus-interactive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@
" !{sys.executable} -m pip install -U pip\n",
" !{sys.executable} -m pip install git+https://github.com/airbus/decomon@main#egg=decomon\n",
" # install desired backend (by default tensorflow)\n",
" !{sys.executable} -m pip install \"tensorflow>=2.15\"\n",
" # ensure having keras 3 and not keras 2.15\n",
" !{sys.executable} -m pip uninstall -y keras\n",
" !{sys.executable} -m pip install \"keras>=3\""
" !{sys.executable} -m pip install \"tensorflow>=2.16\""
]
},
{
Expand Down Expand Up @@ -423,7 +420,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.18"
},
"toc": {
"base_numbering": 1,
Expand Down
7 changes: 2 additions & 5 deletions tutorials/tutorial2_noise_sensor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@
" !{sys.executable} -m pip install -U pip\n",
" !{sys.executable} -m pip install git+https://github.com/airbus/decomon@main#egg=decomon\n",
" # install desired backend (by default tensorflow)\n",
" !{sys.executable} -m pip install \"tensorflow>=2.15\"\n",
" # ensure having keras 3 and not keras 2.15\n",
" !{sys.executable} -m pip uninstall -y keras\n",
" !{sys.executable} -m pip install \"keras>=3\""
" !{sys.executable} -m pip install \"tensorflow>=2.16\""
]
},
{
Expand Down Expand Up @@ -492,7 +489,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.18"
},
"toc": {
"base_numbering": 1,
Expand Down
7 changes: 2 additions & 5 deletions tutorials/tutorial3_adversarial_attack.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@
" !{sys.executable} -m pip install -U pip\n",
" !{sys.executable} -m pip install git+https://github.com/airbus/decomon@main#egg=decomon\n",
" # install desired backend (by default tensorflow)\n",
" !{sys.executable} -m pip install \"tensorflow>=2.15\"\n",
" # ensure having keras 3 and not keras 2.15\n",
" !{sys.executable} -m pip uninstall -y keras\n",
" !{sys.executable} -m pip install \"keras>=3\""
" !{sys.executable} -m pip install \"tensorflow>=2.16\""
]
},
{
Expand Down Expand Up @@ -506,7 +503,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.18"
},
"toc": {
"base_numbering": 1,
Expand Down
7 changes: 2 additions & 5 deletions tutorials/tutorial4_certified_over_estimation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@
" !{sys.executable} -m pip install -U pip\n",
" !{sys.executable} -m pip install git+https://github.com/airbus/decomon@main#egg=decomon\n",
" # install desired backend (by default tensorflow)\n",
" !{sys.executable} -m pip install \"tensorflow>=2.15\"\n",
" # ensure having keras 3 and not keras 2.15\n",
" !{sys.executable} -m pip uninstall -y keras\n",
" !{sys.executable} -m pip install \"keras>=3\""
" !{sys.executable} -m pip install \"tensorflow>=2.16\""
]
},
{
Expand Down Expand Up @@ -735,7 +732,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.18"
},
"toc": {
"base_numbering": 1,
Expand Down
8 changes: 2 additions & 6 deletions tutorials/z_Advanced/tensorboard-and-decomon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,10 @@
" import sys # noqa: avoid having this import removed by pycln\n",
"\n",
" # install dev version for dev doc, or release version for release doc\n",
" !{sys.executable} -m pip install \"tensorflow>=2.13\" \"tensorboard>=2.13\" \"keras>=2.13\"\n",
" !{sys.executable} -m pip install -U pip\n",
" !{sys.executable} -m pip install git+https://github.com/airbus/decomon@main#egg=decomon\n",
" # install desired backend (by default tensorflow)\n",
" !{sys.executable} -m pip install \"tensorflow>=2.15\"\n",
" # ensure having keras 3 and not keras 2.15\n",
" !{sys.executable} -m pip uninstall -y keras\n",
" !{sys.executable} -m pip install \"keras>=3\""
" !{sys.executable} -m pip install \"tensorflow>=2.16 tensorboard>=2.16\""
]
},
{
Expand Down Expand Up @@ -356,7 +352,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.12"
"version": "3.9.18"
},
"toc": {
"base_numbering": 1,
Expand Down

0 comments on commit 4f7bd2f

Please sign in to comment.