@@ -10,10 +10,8 @@ the basic concepts of Unity.
10
10
11
11
## Setting up the ML-Agents Toolkit within Unity
12
12
13
- In order to use the ML-Agents toolkit within Unity, you need to change some
14
- Unity settings first. You will also need to have appropriate inference backends
15
- installed in order to run your models inside of Unity. See [ here] ( Inference-Engine.md )
16
- for more information.
13
+ In order to use the ML-Agents toolkit within Unity, you first need to change a few
14
+ Unity settings.
17
15
18
16
1 . Launch Unity
19
17
2 . On the Projects dialog, choose the ** Open** option at the top of the window.
@@ -22,26 +20,43 @@ for more information.
22
20
4 . Go to ** Edit** > ** Project Settings** > ** Player**
23
21
5 . For ** each** of the platforms you target (** PC, Mac and Linux Standalone** ,
24
22
** iOS** or ** Android** ):
25
- 1 . Option the ** Other Settings** section.
23
+ 1 . Expand the ** Other Settings** section.
26
24
2 . Select ** Scripting Runtime Version** to ** Experimental (.NET 4.6
27
25
Equivalent or .NET 4.x Equivalent)**
28
26
6 . Go to ** File** > ** Save Project**
29
27
28
+ ## Setting up the Inference Engine
29
+
30
+ We provide pre-trained models for all the agents in all our demo environments.
31
+ To be able to run those models, you'll first need to set-up the Inference
32
+ Engine. The Inference Engine is a general API to
33
+ run neural network models in Unity that leverages existing inference libraries such
34
+ as TensorFlowSharp and Apple's Core ML. Since the ML-Agents Toolkit uses TensorFlow
35
+ for training neural network models, the output model format is TensorFlow and
36
+ the model files include a ` .tf ` extension. Consequently, you need to install
37
+ the TensorFlowSharp backend to be able to run these models within the Unity
38
+ Editor. You can find instructions
39
+ on how to install the TensorFlowSharp backend [ here] ( Inference-Engine.md ) .
40
+ Once the backend is installed, you will need to reimport the models : Right click
41
+ on the ` .tf ` model and select ` Reimport ` .
42
+
43
+
30
44
## Running a Pre-trained Model
31
45
32
46
1 . In the ** Project** window, go to ` Assets/ML-Agents/Examples/3DBall/Scenes ` folder
33
47
and open the ` 3DBall ` scene file.
34
48
2 . In the ** Project** window, go to ` Assets/ML-Agents/Examples/3DBall/Prefabs ` folder
35
49
and select the ` Game/Platform ` prefab.
36
- 3 . In the ` Ball 3D Agent ` Component: Drag the ** 3DBallLearning** located into
50
+ 3 . In the ` Ball 3D Agent ` Component: Drag the ** 3DBallLearning** Brain located in
37
51
` Assets/ML-Agents/Examples/3DBall/Brains ` into the ` Brain ` property of
38
52
the ` Ball 3D Agent ` .
39
53
4 . Make sure that all of the Agents in the Scene now have ** 3DBallLearning** as ` Brain ` .
40
- __ Note__ : You can modify multiple game objects in a scene by selecting them all at once using the search bar in the Scene Hierarchy.
54
+ __ Note__ : You can modify multiple game objects in a scene by selecting them all at
55
+ once using the search bar in the Scene Hierarchy.
41
56
5 . In the ** Project** window, locate the ` Assets/ML-Agents/Examples/3DBall/TFModels `
42
57
folder.
43
- 6 . Drag the ` 3DBall ` model file from the ` Assets/ML-Agents/Examples/3DBall/TFModels `
44
- folder to the ** Model** field of the ** 3DBallLearning** .
58
+ 6 . Drag the ` 3DBallLearning ` model file from the ` Assets/ML-Agents/Examples/3DBall/TFModels `
59
+ folder to the ** Model** field of the ** 3DBallLearning** Brain .
45
60
7 . Click the ** Play** button and you will see the platforms balance the balls
46
61
using the pretrained model.
47
62
@@ -63,15 +78,26 @@ More information and documentation is provided in the
63
78
64
79
### Adding a Brain to the training session
65
80
66
- Since we are going to build this environment to conduct training, we need to add
67
- the Brain to the training session. This allows the Agents linked to that Brain
68
- to communicate with the external training process when making their decisions.
69
-
70
- 1 . Assign the ** 3DBallLearning** to the agents you would like to train and the ** 3DBallPlayer** Brain to the agents you want to control manually.
71
- __ Note:__ You can only perform training with an ` Learning Brain ` .
81
+ To set up the environment for training, you will need to specify which agents are contributing
82
+ to the training and which Brain is being trained. You can only perform training with
83
+ a ` Learning Brain ` .
84
+
85
+ 1 . Assign the ** 3DBallLearning** Brain to the agents you would like to train.
86
+ __ Note:__ You can assign the same Brain to multiple agents at once : To do so, you can
87
+ use the prefab system. When an agent is created from a prefab, modifying the prefab
88
+ will modify the agent as well. If the agent does not synchronize with the prefab, you
89
+ can hit the Revert button on top of the Inspector.
90
+ Alternatively, you can select multiple agents in the scene and modify their ` Brain `
91
+ property all at once.
72
92
2 . Select the ** Ball3DAcademy** GameObject and make sure the ** 3DBallLearning** Brain
73
93
is in the Broadcast Hub. In order to train, you need to toggle the
74
94
` Control ` checkbox.
95
+
96
+ __ Note:__ Assigning a Brain to an agent (dragging a Brain into the ` Brain ` property of
97
+ the agent) means that the Brain will be making decision for that agent. Whereas dragging
98
+ a Brain into the Broadcast Hub means that the Brain will be exposed to the Python process.
99
+ The ` Control ` checkbox means that in addition to being exposed to Python, the Brain will
100
+ be controlled by the Python process (required for training).
75
101
76
102
![ Set Brain to External] ( images/mlagents-SetBrainToTrain.png )
77
103
0 commit comments