Skip to content

Commit 9061520

Browse files
Johannes Ball?copybara-github
authored andcommitted
Adds some help for using Docker.
PiperOrigin-RevId: 260019521 Change-Id: I3733b7e02d630353f540459ad23ed9fb742392af
1 parent 9246c4e commit 9061520

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ python -m tensorflow_compression.python.all_test
7474
Once the command finishes, you should see a message ```OK (skipped=11)``` or
7575
similar in the last line.
7676

77+
To use a Docker container (e.g. on Windows), be sure to install Docker
78+
(e.g., [Docker Desktop](https://www.docker.com/products/docker-desktop),
79+
use a [TensorFlow Docker image](https://www.tensorflow.org/install/docker),
80+
and then run the `pip install` command inside the Docker container, not on the
81+
host. For instance, you can use a command line like this:
82+
```bash
83+
docker run tensorflow/tensorflow:latest-py3 bash -c \
84+
"pip install tensorflow-compression &&
85+
python -m tensorflow_compression.python.all_test"
86+
```
87+
This will fetch the latest TensorFlow Docker image, install the `pip` package
88+
and then run the unit tests to confirm that it works.
89+
7790
## Usage
7891

7992
We recommend importing the library from your Python code as follows:
@@ -125,7 +138,7 @@ To train the model, you need to supply it with a dataset of RGB training images.
125138
They should be provided in PNG format. Training can be as simple as the
126139
following command:
127140
```bash
128-
python bls2017.py -v --train_glob="images/*.png" train
141+
python bls2017.py --verbose --train_glob="images/*.png" train
129142
```
130143

131144
This will use the default settings. The most important parameter is `--lambda`,
@@ -151,8 +164,8 @@ When training has finished, the Python script can be used to compress and
151164
decompress images as follows. The same model checkpoint must be accessible to
152165
both commands.
153166
```bash
154-
python bls2017.py [options] compress original.png compressed.bin
155-
python bls2017.py [options] decompress compressed.bin reconstruction.png
167+
python bls2017.py [options] compress original.png compressed.tfci
168+
python bls2017.py [options] decompress compressed.tfci reconstruction.png
156169
```
157170

158171
## Building `pip` packages
@@ -174,11 +187,12 @@ Inside a Docker container from the image, the following steps need to be taken.
174187

175188
```bash
176189
sudo docker run -v /tmp/tensorflow_compression:/tmp/tensorflow_compression \
177-
tensorflow/tensorflow:nightly-custom-op \
178-
bash -c "pip install tensorflow &&
179-
git clone https://github.com/tensorflow/compression.git
180-
/tensorflow_compression && cd /tensorflow_compression &&
181-
bazel run -c opt --copt=-mavx :build_pip_pkg"
190+
tensorflow/tensorflow:nightly-custom-op bash -c \
191+
"pip install tensorflow &&
192+
git clone https://github.com/tensorflow/compression.git
193+
/tensorflow_compression &&
194+
cd /tensorflow_compression &&
195+
bazel run -c opt --copt=-mavx :build_pip_pkg"
182196
```
183197

184198
The wheel file is created inside `/tmp/tensorflow_compression`. Optimization

0 commit comments

Comments
 (0)