Skip to content

Commit

Permalink
Merge pull request #426 from adamcrume/master
Browse files Browse the repository at this point in the history
Upgrade to TensorFlow 2.18.0
  • Loading branch information
adamcrume authored Jan 12, 2025
2 parents 454da03 + e4b6aee commit 1ddf5a3
Show file tree
Hide file tree
Showing 25 changed files with 22,776 additions and 1,548 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup Python # Set Python version
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: "3.10"
# Install pip and pytest
- name: Install dependencies
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tensorflow == 2.13.0
tensorflow == 2.18.0
tf_keras == 2.18.0
20 changes: 10 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Note that any crate not mentioned here (e.g. tensorflow-proto-codegen, tensorflo
1. Bump the version for `tensorflow-internal-macros` in the root `Cargo.toml`
1. Bump the version number in `Cargo.toml`
1. Bump the version number in `README.md`
1. Run `./test-all`
1. Inside a virtualenv, run `./test-all`. (See "Running in a virtualenv" section.)
1. Double-check that addition.py is built using the version of TensorFlow being linked against. (See "Upgrading TensorFlow" section.)
1. Run `./run-valgrind`
1. Commit and push the changes. (Push before publishing to ensure that the changes being published are up to date.)
Expand All @@ -56,12 +56,12 @@ Note that any crate not mentioned here (e.g. tensorflow-proto-codegen, tensorflo
## Upgrading TensorFlow

1. Update version and tag in tensorflow-sys/build.rs
1. Update version in run-valgrind
1. Run `python examples/addition/addition.py` using the version of TensorFlow being linked against.
(Use pip in a virtualenv, see https://www.tensorflow.org/install/pip#2-create-a-virtual-environment-recommended)
1. Run `virtualenv --system-site-packages -p python3 ~/tensorflow-${TENSORFLOW_VERSION?}`
1. Run `source ~/tensorflow-${TENSORFLOW_VERSION?}/bin/activate` to activate the virtualenv
1. Run `pip install --upgrade pip`
1. Run `pip install --upgrade tensorflow==${TENSORFLOW_VERSION?}`
1. Run `python examples/addition/addition.py`
1. Run `deactivate` to exit the virtualenv
1. Update version in .github/workflow/requirements.txt
1. Inside a virtualenv using the version of TensorFlow being linked against, run `python examples/addition/addition.py`. (See "Running in a virtualenv" section.)

## Running in a virtualenv

1. If you haven't set it up, run `./create-virtualenv ${TENSORFLOW_VERSION?}`
1. Run `source ~/tensorflow-${TENSORFLOW_VERSION?}/bin/activate` to activate the virtualenv
1. Do whatever you need to do in the virtual env
1. Run `deactivate` to exit the virtualenv
7 changes: 7 additions & 0 deletions check-disk-space
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -euo pipefail

df -h || true
du -sh || true
du -sh /* || true
25 changes: 25 additions & 0 deletions create-virtualenv
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# See https://www.tensorflow.org/install/pip#2-create-a-virtual-environment-recommended

set -euo pipefail

if [ "$#" -lt 1 ]; then
echo "Expected first argument to be TensorFlow version"
exit 1
fi
TENSORFLOW_VERSION="$1"

function run {
echo "----------------------------------------------------------------------"
echo "Running: $@"
"$@"
echo
}

run virtualenv --system-site-packages -p python3 ~/tensorflow-${TENSORFLOW_VERSION?}
run source ~/tensorflow-${TENSORFLOW_VERSION?}/bin/activate
run pip install --upgrade pip
run pip install --upgrade tensorflow==${TENSORFLOW_VERSION?}
run pip install tf_keras # required for examples/mobilenetv3
run deactivate
Binary file modified examples/addition/model.pb
Binary file not shown.
2 changes: 0 additions & 2 deletions run-valgrind
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ function run {
echo
}

tensorflow_version=2.13.0

valgrind_log=valgrind.log
truncate --size=0 "$valgrind_log"

Expand Down
Loading

0 comments on commit 1ddf5a3

Please sign in to comment.