Skip to content

Commit 056b4d3

Browse files
author
Ervin T
authored
Change docs and ipynb to reflect new import path for UnityEnvironment (#2673)
1 parent aa586f7 commit 056b4d3

File tree

6 files changed

+34
-33
lines changed

6 files changed

+34
-33
lines changed

docs/Learning-Environment-Executable.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Make sure the Brains in the scene have the right type. For example, if you want
3131
to be able to control your agents from Python, you will need to put the Brain
3232
controlling the Agents to be a **Learning Brain** and drag it into the
3333
Academy's `Broadcast Hub` with the `Control` checkbox checked. In the 3DBall
34-
scene, this can be done in the Platform GameObject within the Game prefab in
35-
`Assets/ML-Agents/Examples/3DBall/Prefabs/`, or in each instance of the
34+
scene, this can be done in the Platform GameObject within the Game prefab in
35+
`Assets/ML-Agents/Examples/3DBall/Prefabs/`, or in each instance of the
3636
Platform in the Scene.
3737

3838
Next, we want the set up scene to play correctly when the training process
@@ -73,7 +73,7 @@ executable, you can pass the name of the executable with the argument
7373
'file_name' of the `UnityEnvironment`. For instance:
7474

7575
```python
76-
from mlagents.envs import UnityEnvironment
76+
from mlagents.envs.environment import UnityEnvironment
7777
env = UnityEnvironment(file_name=<env_name>)
7878
```
7979

docs/Migrating.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* `UnitySDK/Assets/ML-Agents/Scripts/Communicator.cs` and its class `Communicator` have been renamed to `UnitySDK/Assets/ML-Agents/Scripts/ICommunicator.cs` and `ICommunicator` respectively.
1111
* The `SpaceType` Enums `discrete`, and `continuous` have been renamed to `Discrete` and `Continuous`.
1212
* We have removed the `Done` call as well as the capacity to set `Max Steps` on the Academy. Therefore an AcademyReset will never be triggered from C# (only from Python). If you want to reset the simulation after a fixed number of steps, or when an event in the simulation occurs, we recommend looking at our multi-agent example environments (such as BananaCollector). In our examples, groups of Agents can be reset through an "Area" that can reset groups of Agents.
13+
* The import for `mlagents.envs.UnityEnvironment` was removed. If you are using the Python API, change `from mlagents.envs import UnityEnvironment` to `from mlagents.envs.environment import UnityEnvironment`.
1314

1415

1516
## Migrating from ML-Agents toolkit v0.8 to v0.9

docs/Python-API.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ imitation learning.
1616
The ML-Agents Toolkit provides a Python API for controlling the Agent simulation
1717
loop of an environment or game built with Unity. This API is used by the
1818
training algorithms inside the ML-Agent Toolkit, but you can also write your own
19-
Python programs using this API. Go [here](../notebooks/getting-started.ipynb)
19+
Python programs using this API. Go [here](../notebooks/getting-started.ipynb)
2020
for a Jupyter Notebook walking through the functionality of the API.
2121

2222
The key objects in the Python API include:
@@ -52,7 +52,7 @@ file, put the file in the same directory as `envs`. For example, if the filename
5252
of your Unity environment is 3DBall.app, in python, run:
5353

5454
```python
55-
from mlagents.envs import UnityEnvironment
55+
from mlagents.envs.environment import UnityEnvironment
5656
env = UnityEnvironment(file_name="3DBall", worker_id=0, seed=1)
5757
```
5858

@@ -94,14 +94,14 @@ A BrainInfo object contains the following fields:
9494
`(batch size, number of branches)` if the vector action space is discrete.
9595

9696
Once loaded, you can use your UnityEnvironment object, which referenced by a
97-
variable named `env` in this example, can be used in the following way:
97+
variable named `env` in this example, can be used in the following way:
9898

99-
- **Print : `print(str(env))`**
100-
Prints all parameters relevant to the loaded environment and the
101-
Brains.
102-
- **Reset : `env.reset(train_model=True, config=None)`**
99+
- **Print : `print(str(env))`**
100+
Prints all parameters relevant to the loaded environment and the
101+
Brains.
102+
- **Reset : `env.reset(train_model=True, config=None)`**
103103
Send a reset signal to the environment, and provides a dictionary mapping
104-
Brain names to BrainInfo objects.
104+
Brain names to BrainInfo objects.
105105
- `train_model` indicates whether to run the environment in train (`True`) or
106106
test (`False`) mode.
107107
- `config` is an optional dictionary of configuration flags specific to the
@@ -110,7 +110,7 @@ variable named `env` in this example, can be used in the following way:
110110
`resetParameters` and the values are their corresponding float values.
111111
Define the reset parameters on the Academy Inspector window in the Unity
112112
Editor.
113-
- **Step : `env.step(action, memory=None, text_action=None)`**
113+
- **Step : `env.step(action, memory=None, text_action=None)`**
114114
Sends a step signal to the environment using the actions. For each Brain :
115115
- `action` can be one dimensional arrays or two dimensional arrays if you have
116116
multiple Agents per Brain.
@@ -141,7 +141,7 @@ variable named `env` in this example, can be used in the following way:
141141
action = {'brain1':[1.0, 2.0], 'brain2':[3.0,4.0]}
142142
```
143143

144-
Returns a dictionary mapping Brain names to BrainInfo objects.
144+
Returns a dictionary mapping Brain names to BrainInfo objects.
145145
- **Close : `env.close()`**
146146
Sends a shutdown signal to the environment and closes the communication
147147
socket.

docs/Training-on-Amazon-Web-Service.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Service for training ML-Agents environments.
77

88
We've prepared a pre-configured AMI for you with the ID: `ami-016ff5559334f8619` in the
99
`us-east-1` region. It was created as a modification of [Deep Learning AMI
10-
(Ubuntu)](https://aws.amazon.com/marketplace/pp/B077GCH38C). The AMI has been
11-
tested with p2.xlarge instance. Furthermore, if you want to train without
12-
headless mode, you need to enable X Server.
10+
(Ubuntu)](https://aws.amazon.com/marketplace/pp/B077GCH38C). The AMI has been
11+
tested with p2.xlarge instance. Furthermore, if you want to train without
12+
headless mode, you need to enable X Server.
1313

14-
After launching your EC2 instance using the ami and ssh into it, run the
14+
After launching your EC2 instance using the ami and ssh into it, run the
1515
following commands to enable it:
1616

1717
```sh
@@ -102,14 +102,14 @@ linux executables which use visual observations.
102102
103103
# Remove the Section "Files" from the /etc/X11/xorg.conf file
104104
# And remove two lines that contain Section "Files" and EndSection
105-
$ sudo vim /etc/X11/xorg.conf
105+
$ sudo vim /etc/X11/xorg.conf
106106
```
107107

108108
#### Update and setup Nvidia driver:
109109

110110
```sh
111111
# Download and install the latest Nvidia driver for ubuntu
112-
# Please refer to http://download.nvidia.com/XFree86/Linux-#x86_64/latest.txt
112+
# Please refer to http://download.nvidia.com/XFree86/Linux-#x86_64/latest.txt
113113
$ wget http://download.nvidia.com/XFree86/Linux-x86_64/390.87/NVIDIA-Linux-x86_64-390.87.run
114114
$ sudo /bin/bash ./NVIDIA-Linux-x86_64-390.67.run --accept-license --no-questions --ui=none
115115
@@ -138,7 +138,7 @@ linux executables which use visual observations.
138138
# You will have a list of processes running on the GPU, Xorg should not be in
139139
# the list, as shown below.
140140
$ nvidia-smi
141-
141+
142142
# Thu Jun 14 20:21:11 2018
143143
# +-----------------------------------------------------------------------------+
144144
# | NVIDIA-SMI 390.67 Driver Version: 390.67 |
@@ -156,7 +156,7 @@ linux executables which use visual observations.
156156
# |=============================================================================|
157157
# | No running processes found |
158158
# +-----------------------------------------------------------------------------+
159-
159+
160160
```
161161

162162
#### Start X Server and make the ubuntu use X Server for display:
@@ -179,21 +179,21 @@ linux executables which use visual observations.
179179
# For more information on glxgears, see ftp://www.x.org/pub/X11R6.8.1/doc/glxgears.1.html.
180180
$ glxgears
181181
# If Xorg is configured correctly, you should see the following message
182-
182+
183183
# Running synchronized to the vertical refresh. The framerate should be
184184
# approximately the same as the monitor refresh rate.
185185
# 137296 frames in 5.0 seconds = 27459.053 FPS
186186
# 141674 frames in 5.0 seconds = 28334.779 FPS
187187
# 141490 frames in 5.0 seconds = 28297.875 FPS
188-
188+
189189
```
190190

191191
## Training on EC2 instance
192192

193193
1. In the Unity Editor, load a project containing an ML-Agents environment (you
194194
can use one of the example environments if you have not created your own).
195195
2. Open the Build Settings window (menu: File > Build Settings).
196-
3. Select Linux as the Target Platform, and x86_64 as the target architecture
196+
3. Select Linux as the Target Platform, and x86_64 as the target architecture
197197
(the default x86 currently does not work).
198198
4. Check Headless Mode if you have not setup the X Server. (If you do not use
199199
Headless Mode, you have to setup the X Server to enable training.)
@@ -220,7 +220,7 @@ Headless Mode, you have to setup the X Server to enable training.)
220220
9. Test the instance setup from Python using:
221221

222222
```python
223-
from mlagents.envs import UnityEnvironment
223+
from mlagents.envs.environment import UnityEnvironment
224224
225225
env = UnityEnvironment(<your_env>)
226226
```
@@ -233,12 +233,12 @@ Headless Mode, you have to setup the X Server to enable training.)
233233
```console
234234
mlagents-learn <trainer-config-file> --env=<your_env> --train
235235
```
236-
236+
237237
## FAQ
238238

239239
### The <Executable_Name>_Data folder hasn't been copied cover
240240

241-
If you've built your Linux executable, but forget to copy over the corresponding <Executable_Name>_Data folder, you will see error message like the following:
241+
If you've built your Linux executable, but forget to copy over the corresponding <Executable_Name>_Data folder, you will see error message like the following:
242242
243243
```sh
244244
Set current directory to /home/ubuntu/ml-agents/ml-agents
@@ -269,7 +269,7 @@ mlagents.envs.exception.UnityTimeOutException: The Unity environment took too lo
269269
The environment and the Python interface have compatible versions.
270270
```
271271
272-
It would be also really helpful to check your /home/ubuntu/.config/unity3d/<Some_Path>/Player.log to see what happens with your Unity environment.
272+
It would be also really helpful to check your /home/ubuntu/.config/unity3d/<Some_Path>/Player.log to see what happens with your Unity environment.
273273
274274
### Could not launch X Server
275275
@@ -310,4 +310,4 @@ You might see something like:
310310
```sh
311311
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
312312
```
313-
This means the NVIDIA's driver needs to be updated. Refer to [this section](Training-on-Amazon-Web-Service.md#update-and-setup-nvidia-driver) for more information.
313+
This means the NVIDIA's driver needs to be updated. Refer to [this section](Training-on-Amazon-Web-Service.md#update-and-setup-nvidia-driver) for more information.

docs/Training-on-Microsoft-Azure.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ To verify that all steps worked correctly:
4545
7. Test the instance setup from Python using:
4646

4747
```python
48-
from mlagents.envs import UnityEnvironment
48+
from mlagents.envs.environment import UnityEnvironment
4949

5050
env = UnityEnvironment(<your_env>)
5151
```
@@ -79,9 +79,9 @@ the GPU is being used by running `nvidia-smi` from the command line.
7979
## Monitoring your Training Run with TensorBoard
8080

8181
Once you have started training, you can [use TensorBoard to observe the
82-
training](Using-Tensorboard.md).
82+
training](Using-Tensorboard.md).
8383

84-
1. Start by [opening the appropriate port for web traffic to connect to your VM](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal).
84+
1. Start by [opening the appropriate port for web traffic to connect to your VM](https://docs.microsoft.com/en-us/azure/virtual-machines/windows/nsg-quickstart-portal).
8585

8686
* Note that you don't need to generate a new `Network Security Group` but
8787
instead, go to the **Networking** tab under **Settings** for your VM.

notebooks/getting-started.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"import numpy as np\n",
4848
"import sys\n",
4949
"\n",
50-
"from mlagents.envs import UnityEnvironment\n",
50+
"from mlagents.envs.environment import UnityEnvironment\n",
5151
"\n",
5252
"%matplotlib inline\n",
5353
"\n",

0 commit comments

Comments
 (0)