Skip to main content

Reverb is an efficient and easy-to-use data storage and transport system designed for machine learning research.

Project description

How to develop and build Reverb with the Docker containers

Overview

This document covers a couple scenarios:

While there is overlap in the above scenarios, treating them separately seems the most clear at the moment. Before you get started, setup a local variable pointing to your local Reverb GitHub repo.

$ export REVERB_DIR=/path/to/reverb/github/repo

Create a stable Reverb release

There are two steps for building the Reverb package.

  • Build the Docker container with the version of TensorFlow to build Reverb against.
  • Execute the build and declare any specific TensorFlow dependency for the pip install. The dependency is only enforced if the user uses pip install reverb[tensorflow].

Execute from the root of the git repository. The end result will end up in $REVERB_DIR/dist.

##################################
# Creates the Docker container.
##################################
# Builds the container with Python 3.8, 3.9, 3.10, and 3.11. Set the
# `build-arg tensorflow_pip` to the version of TensorFlow to build against.
# If building against an RC, use == rather than ~= for `tensorflow_pip`.
$ docker build --pull --no-cache \
  --tag tensorflow:reverb_release \
  --build-arg tensorflow_pip=tensorflow~=2.8.0 \
  --build-arg python_version="python3.8 python3.9 python3.10 python3.11" \
  - < "$REVERB_DIR/docker/release.dockerfile"

#################################################
# Builds Reverb against TensorFlow stable or rc.
#################################################

# Builds Reverb against most recent stable release of TensorFlow and
# requires `tensorflow~=2.8.0` if using `pip install reverb[tensorflow]`.
# Packages for Python 3.8, 3.9, 3.10, and 3.11 are created.
$ docker run --rm --mount "type=bind,src=$REVERB_DIR,dst=/tmp/reverb" \
  tensorflow:reverb_release bash oss_build.sh --clean true \
  --tf_dep_override "tensorflow~=2.11.0" --release --python "3.8 3.9 3.10 3.11"

# Builds Reverb against an RC of TensorFlow. `>=` and `~=` are not effective
# because pip does not recognize 2.4.0rc0 as greater than 2.3.0. RC builds need
# to have a strict dependency on the RC of TensorFlow used.
$ docker run --rm --mount "type=bind,src=$REVERB_DIR,dst=/tmp/reverb" \
  tensorflow:reverb_release bash oss_build.sh --clean true \
  --tf_dep_override "tensorflow==2.12.0rc0" --release --python "3.8 3.9 3.10 3.11"

# Builds a debug version of Reverb. The debug version is not labeled as debug
# as that can result in a user installing both the debug and regular packages
# making it unclear which is installed as they both have the same package
# namespace. The command below puts the .whl files in ./dist/debug/**.
# Debug builds are ~90M compared to normal builds that are closer to 7M.
$ docker run --rm --mount "type=bind,src=$REVERB_DIR,dst=/tmp/reverb" \
  tensorflow:reverb_release bash oss_build.sh --clean true --debug_build true \
  --output_dir /tmp/reverb/dist/debug/ --tf_dep_override "tensorflow~=2.10.0" \
  --release --python "3.8 3.9 3.10 3.11"

Develop Reverb inside a Docker container

  1. Build the Docker container. By default the container is setup for python 3.9. Use the python_version arg to configure the container with 3.8 or 3.9.
$ docker build --tag tensorflow:reverb - < "$REVERB_DIR/docker/release.dockerfile"

# Alternatively you can build the container with Python 3.8 support.
$ docker build --tag tensorflow:reverb \
    --build-arg python_version=python3.8 \
    - < "$REVERB_DIR/docker/release.dockerfile"
  1. Run and enter the Docker container.
$ docker run --rm -it \
  --mount "type=bind,src=$REVERB_DIR,dst=/tmp/reverb" \
  --mount "type=bind,src=$HOME/.gitconfig,dst=/etc/gitconfig,ro" \
  --name reverb tensorflow:reverb bash
  1. Compile Reverb.
$ python3.8 configure.py
$ bazel build -c opt //reverb/pip_package:build_pip_package
  1. Build the .whl file and output it to /tmp/reverb_build/dist/.
$ ./bazel-bin/reverb/pip_package/build_pip_package \
  --dst /tmp/reverb_build/dist/
  1. Install the .whl file.
# If multiple versions were built, pass the exact wheel to install rather than
# *.whl.
$ $PYTHON_BIN_PATH -mpip install --upgrade /tmp/reverb_build/dist/*.whl

Builds Tips and Hints

protoc / protobuf version mismatch

There is a check in the Reverb build process that checks if the protoc library in Tensorflow matches what Reverb is using. It throws this error if there is a mismatch: "Please update the PROTOC_VERSION in your WORKSPACE". Here for search reasons :-).

Tensorflow sets its version of Protobuf in this WORKSPACE file. Reverb sets its version of protoc in this WORKSPACE file. The twist is the protobuf people release protoc as 21.9 and the protobuf library as 3.21.0 as seen here.

Until Feb-2023, Tensorflow was using a version of Protobuf that was ~2 years old. In Feb 2023, TF jumped to the latest protobuf 3.21.9.

Note: While I am pretty sure Tensorflow was on 21.9 as of Feb-2023, The checker in Reverb saw it as 21.0. 21.0 worked so I (tobyboyd) did not look into it any farther.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dm-reverb-macos-nightly-0.11.20241207.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dm_reverb_macos_nightly-0.11.20241207-cp36-cp36m-macosx_10_9_x86_64.whl (4.1 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file dm-reverb-macos-nightly-0.11.20241207.tar.gz.

File metadata

  • Download URL: dm-reverb-macos-nightly-0.11.20241207.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13

File hashes

Hashes for dm-reverb-macos-nightly-0.11.20241207.tar.gz
Algorithm Hash digest
SHA256 818e2e6d0c82e3752fdce52840e384f92cbc5a7dd32418873d1c06cb1df7b9f2
MD5 3e0d50c3aaa610a93886cd6cc3dd4278
BLAKE2b-256 750f0abb3053cc04e28d8d2124b23c2820588fd2c24643b77bb7478d3168fd58

See more details on using hashes here.

File details

Details for the file dm_reverb_macos_nightly-0.11.20241207-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: dm_reverb_macos_nightly-0.11.20241207-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/1.0.0 urllib3/1.26.20 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.13

File hashes

Hashes for dm_reverb_macos_nightly-0.11.20241207-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fd28e5908c8660bb402215c06cb7159d65d9ba4c239d8bf9c707ebe892dd9089
MD5 46f16b2a578d1a4e4dcf539bc8503a03
BLAKE2b-256 db99327dd25f78bd0f737886d5917ac5d8bd4b1df4b6616e1d7ee77c1fc8323b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page