Skip to content

Commit c8130ba

Browse files
committed
[containers] Updated docs, added comments per PR
1 parent dccb030 commit c8130ba

File tree

7 files changed

+26
-7
lines changed

7 files changed

+26
-7
lines changed

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ RUN set -ex; \
116116
\) -exec rm -rf '{}' +; \
117117
rm -f get-pip.py
118118

119-
CMD ["python3"]
120-
121119

122120
RUN apt-get update && apt-get -y upgrade
123121

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ to the wider research and game developer communities.
2727
* Built-in support for Imitation Learning
2828
* Flexible Agent control with On Demand Decision Making
2929
* Visualizing network outputs within the environment
30-
* Simplified set-up with Docker (Experimental)
30+
* Simplified set-up with Docker
3131

3232
## Documentation and References
3333

docs/ML-Agents-Overview.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,7 @@ the broadcasting feature
428428
* **Docker Set-up (Experimental)** - To facilitate setting up ML-Agents
429429
without installing Python or TensorFlow directly, we provide a
430430
[guide](Using-Docker.md) on how
431-
to create and run a Docker container. Due to limitations on rendering visual
432-
observations, this feature is marked experimental.
431+
to create and run a Docker container.
433432

434433
* **Cloud Training on AWS** - To facilitate using ML-Agents on
435434
Amazon Web Services (AWS) machines, we provide a

docs/Using-Docker.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Using Docker For ML-Agents (Experimental)
22

3-
We currently offer a solution for Windows and Mac users who would like to do training or inference using Docker. This option may be appealing to those who would like to avoid installing Python and TensorFlow themselves. The current setup forces both TensorFlow and Unity to _only_ rely on the CPU for computations. Consequently, our Docker simulation [uses the CPU](https://en.wikipedia.org/wiki/Xvfb) to do visual rendering. This means that environments which involve agents using camera-based visual observations might be slower.
3+
We currently offer a solution for Windows and Mac users who would like to do training or inference using Docker. This option may be appealing to those who would like to avoid installing Python and TensorFlow themselves. The current setup forces both TensorFlow and Unity to _only_ rely on the CPU for computations. Consequently, our Docker simulation [does not use a GPU](https://en.wikipedia.org/wiki/Xvfb) to do visual rendering. This means that rich environments which involve agents using camera-based visual observations might be slower.
44

55

66
## Requirements
@@ -28,10 +28,15 @@ Unity environment **has** to be built for the **linux platform**. When building
2828
- Set the _Target Platform_ to `Linux`
2929
- Set the _Architecture_ to `x86_64`
3030

31-
![Build Settings For Docker](images/docker_build_settings.png)
31+
![Build Settings For Docker](images/docker_build_settings_noheadless.png)
3232

3333
Then click `Build`, pick an environment name (e.g. `3DBall`) and set the output directory to `unity-volume`. After building, ensure that the file `<environment-name>.x86_64` and subdirectory `<environment-name>_Data/` are created under `unity-volume`.
3434

35+
**NOTE** If you are only collecting vector observations from Unity, you can select the `headless` option here:
36+
37+
![Build Settings For Docker](images/docker_build_settings_headless.png)
38+
39+
3540
### Build the Docker Container
3641

3742
First, make sure the Docker engine is running on your machine. Then build the Docker container by calling the following command at the top-level of the repository:
145 KB
Loading

python/unityagents/environment.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,23 @@ def __init__(self, file_name, worker_id=0,
102102
'--port', str(self.port),
103103
'--seed', str(seed)])
104104
else:
105+
"""
106+
Comments for future maintenance:
107+
xvfb-run is a wrapper around Xvfb, a virtual xserver where all
108+
rendering is done to virtual memory. It automatically creates a
109+
new virtual server automatically picking a server number `auto-servernum`.
110+
The server is passed the arguments using `server-args`, we are telling
111+
Xvfb to create Screen number 0 with width 640, height 480 and depth 24 bits.
112+
Note that 640 X 480 are the default width and height. The main reason for
113+
us to add this is because we'd like to change the depth from the default
114+
of 8 bits to 24.
115+
Unfortunately, this means that we will need to pass the arguments through
116+
a shell which is why we set `shell=True`. Now, this adds its own
117+
complications. E.g SIGINT can bounce off the shell and not get propagated
118+
to the child processes. This is why we add `exec`, so that the shell gets
119+
launched, the arguments are passed to `xvfb-run`. `exec` replaces the shell
120+
we created with `xvfb`.
121+
"""
105122
docker_ls = ("exec xvfb-run --auto-servernum"
106123
" --server-args='-screen 0 640x480x24'"
107124
" {0} --port {1} --seed {2}").format(launch_string,

0 commit comments

Comments
 (0)