Skip to content

Commit

Permalink
Prepares for 2.1 release.
Browse files Browse the repository at this point in the history
- Removes workarounds for TF 2.4, since they are not enough to make TFC fully
  functional. Instead, we depend on TF nightly builds.
- Removes dynamic check for TF version, and moves TF into `requirements.txt`.
  This is possible since in TF 2, the `-gpu` pip packages have been
  discontinued.
- Simplifies/adjusts installation instructions accordingly.

PiperOrigin-RevId: 362235658
Change-Id: I939d07387cdbe244493b37e659a9bbfe21ee06da
  • Loading branch information
Johannes Ballé authored and copybara-github committed Mar 11, 2021
1 parent 6158a0e commit 77a340f
Show file tree
Hide file tree
Showing 29 changed files with 146 additions and 138 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,29 +36,31 @@ for a complete description of the classes and functions this package implements.
## Installation

***Note: Precompiled packages are currently only provided for Linux and
Darwin/Mac OS. To use these packages on Windows, consider using a [TensorFlow
Docker image](https://www.tensorflow.org/install/docker) and installing
TensorFlow Compression using pip inside the Docker container.***
Darwin/Mac OS and Python 3.6-3.8. To use these packages on Windows, consider
using a [TensorFlow Docker image](https://www.tensorflow.org/install/docker) and
installing TensorFlow Compression using pip inside the Docker container.***

Set up an environment in which you can install precompiled binary Python
packages using the `pip` command. Refer to the
[TensorFlow installation instructions](https://www.tensorflow.org/install/pip)
for more information on how to set up such a Python environment.

The current version of TFC (v2.0) requires TensorFlow v2.4. For versions
compatible with TensorFlow v1, see our [previous
The current version of TensorFlow Compression requires TensorFlow 2. For
versions compatible with TensorFlow 1, see our [previous
releases](https://github.com/tensorflow/compression/releases).
***Note: Because TFC currently relies on features and fixes designated for
TF 2.5, the pip package currently depends on tf-nightly packages. Once TF 2.5 is
released (likely in April 2021), we will resume depending on the stable version
of TF.***

### pip

To install TF and TFC via `pip`, run the following command:
To install TFC via `pip`, run the following command:

```bash
pip install tensorflow-gpu==2.4.* tensorflow-compression==2.0
pip install tensorflow-compression
```

If you don't need GPU support, you can drop the `-gpu` part.

To test that the installation works correctly, you can run the unit tests with:

```bash
Expand All @@ -77,8 +79,8 @@ and then run the `pip install` command inside the Docker container, not on the
host. For instance, you can use a command line like this:

```bash
docker run tensorflow/tensorflow:2.4.1 bash -c \
"pip install tensorflow-compression==2.0 &&
docker run tensorflow/tensorflow:nightly bash -c \
"pip install tensorflow-compression &&
python -m tensorflow_compression.all_tests"
```

Expand All @@ -91,13 +93,12 @@ It seems that [Anaconda](https://www.anaconda.com/distribution/) ships its own
binary version of TensorFlow which is incompatible with our pip package. To
solve this, always install TensorFlow via `pip` rather than `conda`. For
example, this creates an Anaconda environment with Python 3.6 and CUDA
libraries, and then installs TensorFlow and TensorFlow Compression with GPU
support:
libraries, and then installs TensorFlow and TensorFlow Compression:

```bash
conda create --name ENV_NAME python=3.6 cudatoolkit=10.0 cudnn
conda create --name ENV_NAME python=3.8 cudatoolkit=10.0 cudnn
conda activate ENV_NAME
pip install tensorflow-gpu==2.4.* tensorflow-compression==2.0
pip install tensorflow-compression
```

## Usage
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/DeepFactorized.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`init_scale`
</td>
<td>
Expand Down
10 changes: 5 additions & 5 deletions docs/api_docs/python/tfc/GDNParameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description: Nonnegative parameterization as needed for GDN parameters.

<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L149-L229">
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L147-L226">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
Expand Down Expand Up @@ -220,7 +220,7 @@ of calling this method if you don't expect the return value to change.

<h3 id="get_config"><code>get_config</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L220-L229">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L217-L226">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_config() -> Dict[str, Any]
Expand All @@ -231,7 +231,7 @@ Returns the configuration of the `Parameter`.

<h3 id="get_weights"><code>get_weights</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L49-L50">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L48-L49">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_weights()
Expand All @@ -242,7 +242,7 @@ Returns the configuration of the `Parameter`.

<h3 id="set_weights"><code>set_weights</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L52-L57">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L51-L56">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>set_weights(
Expand Down Expand Up @@ -318,7 +318,7 @@ The original method wrapped such that it enters the module's name scope.

<h3 id="__call__"><code>__call__</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L207-L210">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L203-L207">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__call__() -> tf.Tensor
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/MonotonicAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyDeepFactorized.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyLogistic.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyLogisticMixture.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`mixture_distribution`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyMixtureSameFamily.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`mixture_distribution`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyNormal.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyNormalMixture.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`mixture_distribution`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyRoundedDeepFactorized.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisyRoundedNormal.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisySoftRoundedDeepFactorized.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
7 changes: 7 additions & 0 deletions docs/api_docs/python/tfc/NoisySoftRoundedNormal.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ May be partially defined or unknown.
</td>
</tr><tr>
<td>
`experimental_is_sharded`
</td>
<td>
`True` for distributions which parallel-sum `log_prob` across devices.
</td>
</tr><tr>
<td>
`name`
</td>
<td>
Expand Down
10 changes: 5 additions & 5 deletions docs/api_docs/python/tfc/Parameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description: Reparameterized Layer variable.

<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L32-L57">
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L31-L56">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
Expand Down Expand Up @@ -132,7 +132,7 @@ of calling this method if you don't expect the return value to change.

<h3 id="get_config"><code>get_config</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L44-L47">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L43-L46">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@abc.abstractmethod</code>
Expand All @@ -144,7 +144,7 @@ Returns the configuration of the `Parameter`.

<h3 id="get_weights"><code>get_weights</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L49-L50">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L48-L49">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_weights()
Expand All @@ -155,7 +155,7 @@ Returns the configuration of the `Parameter`.

<h3 id="set_weights"><code>set_weights</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L52-L57">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L51-L56">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>set_weights(
Expand Down Expand Up @@ -231,7 +231,7 @@ The original method wrapped such that it enters the module's name scope.

<h3 id="__call__"><code>__call__</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L40-L42">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L39-L41">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>@abc.abstractmethod</code>
Expand Down
10 changes: 5 additions & 5 deletions docs/api_docs/python/tfc/RDFTParameter.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description: RDFT reparameterization of a convolution kernel.

<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L72-L145">
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L71-L143">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
Expand Down Expand Up @@ -207,7 +207,7 @@ of calling this method if you don't expect the return value to change.

<h3 id="get_config"><code>get_config</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L137-L145">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L135-L143">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_config() -> Dict[str, Any]
Expand All @@ -218,7 +218,7 @@ Returns the configuration of the `Parameter`.

<h3 id="get_weights"><code>get_weights</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L49-L50">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L48-L49">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>get_weights()
Expand All @@ -229,7 +229,7 @@ Returns the configuration of the `Parameter`.

<h3 id="set_weights"><code>set_weights</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L52-L57">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L51-L56">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>set_weights(
Expand Down Expand Up @@ -305,7 +305,7 @@ The original method wrapped such that it enters the module's name scope.

<h3 id="__call__"><code>__call__</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L133-L135">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/parameters.py#L130-L133">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>__call__() -> tf.Tensor
Expand Down
4 changes: 2 additions & 2 deletions docs/api_docs/python/tfc/Round.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description: Applies rounding.

<table class="tfo-notebook-buttons tfo-api nocontent" align="left">
<td>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/soft_round.py#L21-L28">
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/soft_round.py#L28-L35">
<img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" />
View source on GitHub
</a>
Expand Down Expand Up @@ -585,7 +585,7 @@ one per output tensor of the layer).

<h3 id="compute_output_shape"><code>compute_output_shape</code></h3>

<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/soft_round.py#L27-L28">View source</a>
<a target="_blank" href="https://github.com/tensorflow/compression/tree/master/tensorflow_compression/python/layers/soft_round.py#L34-L35">View source</a>

<pre class="devsite-click-to-copy prettyprint lang-py tfo-signature-link">
<code>compute_output_shape(
Expand Down
Loading

0 comments on commit 77a340f

Please sign in to comment.