浏览代码

Added tooltip and helpURL to ML-Agents scripts (#276)

/develop-generalizationTraining-TrainerController
Arthur Juliani 7 年前
当前提交
15f10de0
共有 6 个文件被更改,包括 66 次插入12 次删除
  1. 14
      unity-environment/Assets/ML-Agents/Scripts/Academy.cs
  2. 5
      unity-environment/Assets/ML-Agents/Scripts/Agent.cs
  3. 21
      unity-environment/Assets/ML-Agents/Scripts/Brain.cs
  4. 3
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs
  5. 30
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs
  6. 5
      unity-environment/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs

14
unity-environment/Assets/ML-Agents/Scripts/Academy.cs


[System.Serializable]
public class ScreenConfiguration
{
[Tooltip("Width of the environment window in pixels.")]
[Tooltip("Height of the environment window in pixels")]
[Tooltip("Rendering quality of environment. (Higher is better quality)")]
[Tooltip("Speed at which environment is run. (Higher is faster)")]
[Tooltip("FPS engine attempts to maintain.")]
public int targetFrameRate;
public ScreenConfiguration(int w, int h, int q, float ts, int tf)

}
[HelpURL("https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Agents-Editor-Interface.md#academy")]
/** Create a child class to implement InitializeAcademy(), AcademyStep()
* and AcademyReset(). The child class script must be attached to an empty game
* object in your scene, and there can only be one such object within the scene.

[SerializeField]
[Tooltip("Total number of steps per episode. \n" +
"0 corresponds to episodes without a maximum number of steps. \n" +
"Once the step counter reaches maximum, the environment will reset.")]
[Tooltip("How many steps of the environment to skip before asking Brains for decisions.")]
[Tooltip("How many seconds to wait between steps when running in Inference.")]
private float waitTime;
[HideInInspector]
public bool isInference = true;

[SerializeField]
[Tooltip("The engine-level settings which correspond to rendering quality and engine speed during Training.")]
[Tooltip("The engine-level settings which correspond to rendering quality and engine speed during Inference.")]
[Tooltip("List of custom parameters that can be changed in the environment on reset.")]
private ResetParameter[] defaultResetParameters;
/**< \brief Contains a mapping from parameter names to float values. */

5
unity-environment/Assets/ML-Agents/Scripts/Agent.cs


using UnityEngine;
[HelpURL("https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Agents-Editor-Interface.md#agent")]
/** Generic functions for parent Agent class.
* Contains all logic for Brain-Agent communication and Agent-Environment
* interaction.

[Tooltip("The brain to register this agent to. Can be dragged into the inspector using the Editor.")]
[Tooltip("A list of Cameras which will be used to generate observations.")]
[Tooltip("The per-agent maximum number of steps.")]
/**< \brief The number of steps the agent takes before being done. */
/**< If set to 0, the agent can only be set to done via a script.
* If set to any positive integer, the agent will be set to done after that

[Tooltip("If checked, the agent will reset on done. Else, AgentOnDone() will be called.")]
/**< \brief Determines the behaviour of the Agent when done.*/
/**< If true, the agent will reset when done.
* If not, the agent will remain done, and no longer take actions.*/

21
unity-environment/Assets/ML-Agents/Scripts/Brain.cs


[System.Serializable]
public class BrainParameters
{
[Tooltip("Length of state vector for brain (In Continuous state space)." +
"Or number of possible values (in Discrete state space).")]
[Tooltip("Number of states that will be staked before beeing fed to the neural network.")]
[Tooltip("Length of action vector for brain (In Continuous state space)." +
"Or number of possible values (in Discrete action space).")]
[Tooltip("Length of memory vector for brain. Used with Recurrent networks.")]
[Tooltip("Describes height, width, and whether to greyscale visual observations for the Brain.")]
public string[] actionDescriptions;
[Tooltip("A list of strings used to name the available actions for the Brain.")]
public string[] actionDescriptions;
[Tooltip("Corresponds to whether state vector contains a single integer (Discrete) " +
"or a series of real-valued floats (Continuous).")]
[Tooltip("Corresponds to whether action vector contains a single integer (Discrete)" +
" or a series of real-valued floats (Continuous).")]
[HelpURL("https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Agents-Editor-Interface.md#brain")]
/**
* Contains all high-level Brain logic.
* Add this component to an empty GameObject in your scene and drag this

public Dictionary<int, float[]> currentActions = new Dictionary<int, float[]>(32);
public Dictionary<int, float[]> currentMemories = new Dictionary<int, float[]>(32);
[Tooltip("Define state, observation, and action spaces for the Brain.")]
/**< \brief Defines what is the type of the brain :
/**< \brief Defines what is the type of the brain :
[Tooltip("Describes how the Brain will decide actions.")]
public BrainType brainType;
[HideInInspector]

3
unity-environment/Assets/ML-Agents/Scripts/CoreBrainHeuristic.cs


{
#if UNITY_EDITOR
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
broadcast = EditorGUILayout.Toggle("Broadcast", broadcast);
broadcast = EditorGUILayout.Toggle(new GUIContent("Broadcast",
"If checked, the brain will broadcast states and actions to Python."), broadcast);
if (brain.gameObject.GetComponent<Decision>() == null)
{
EditorGUILayout.HelpBox("You need to add a 'Decision' component to this gameObject", MessageType.Error);

30
unity-environment/Assets/ML-Agents/Scripts/CoreBrainInternal.cs


{
[SerializeField]
[Tooltip("If checked, the brain will broadcast states and actions to Python.")]
private bool broadcast = true;
[System.Serializable]

ExternalCommunicator coord;
[Tooltip("This must be the bytes file corresponding to the pretrained Tensorflow graph.")]
[Tooltip("If your graph takes additional inputs that are fixed (example: noise level) you can specify them here.")]
/// Modify only in inspector : If your graph takes additional inputs that are fixed you can specify them here.
private TensorFlowAgentPlaceholder[] graphPlaceholders;
/// Modify only in inspector : Name of the placholder of the batch size

{
#if ENABLE_TENSORFLOW && UNITY_EDITOR
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
broadcast = EditorGUILayout.Toggle("Broadcast", broadcast);
broadcast = EditorGUILayout.Toggle(new GUIContent("Broadcast",
"If checked, the brain will broadcast states and actions to Python."), broadcast);
var serializedBrain = new SerializedObject(this);
GUILayout.Label("Edit the Tensorflow graph parameters here");
var tfGraphModel = serializedBrain.FindProperty("graphModel");

}
graphScope = EditorGUILayout.TextField("Graph Scope : ", graphScope);
graphScope = EditorGUILayout.TextField(new GUIContent("Graph Scope", "If you set a scope while training your tensorflow model, " +
"all your placeholder name will have a prefix. You must specify that prefix here."), graphScope);
BatchSizePlaceholderName = EditorGUILayout.TextField("Batch Size Node Name", BatchSizePlaceholderName);
BatchSizePlaceholderName = EditorGUILayout.TextField(new GUIContent("Batch Size Node Name", "If the batch size is one of " +
"the inputs of your graph, you must specify the name if the placeholder here."), BatchSizePlaceholderName);
StatePlacholderName = EditorGUILayout.TextField("State Node Name", StatePlacholderName);
StatePlacholderName = EditorGUILayout.TextField(new GUIContent("State Node Name", "If your graph uses the state as an input, " +
"you must specify the name if the placeholder here."), StatePlacholderName);
RecurrentInPlaceholderName = EditorGUILayout.TextField("Recurrent Input Node Name", RecurrentInPlaceholderName);
RecurrentInPlaceholderName = EditorGUILayout.TextField(new GUIContent("Recurrent Input Node Name", "If your graph uses a " +
"recurrent input / memory as input and outputs new recurrent input / memory, " +
"you must specify the name if the input placeholder here."), RecurrentInPlaceholderName);
RecurrentOutPlaceholderName = EditorGUILayout.TextField("Recurrent Output Node Name", RecurrentOutPlaceholderName);
RecurrentOutPlaceholderName = EditorGUILayout.TextField(new GUIContent("Recurrent Output Node Name", " If your graph uses a " +
"recurrent input / memory as input and outputs new recurrent input / memory, you must specify the name if " +
"the output placeholder here."), RecurrentOutPlaceholderName);
if (brain.brainParameters.cameraResolutions != null)
{

{
ActionPlaceholderName = "action";
}
ActionPlaceholderName = EditorGUILayout.TextField("Action Node Name", ActionPlaceholderName);
ActionPlaceholderName = EditorGUILayout.TextField(new GUIContent("Action Node Name", "Specify the name of the " +
"placeholder corresponding to the actions of the brain in your graph. If the action space type is " +
"continuous, the output must be a one dimensional tensor of float of length Action Space Size, " +
"if the action space type is discrete, the output must be a one dimensional tensor of int " +
"of length 1."), ActionPlaceholderName);

5
unity-environment/Assets/ML-Agents/Scripts/CoreBrainPlayer.cs


ExternalCommunicator coord;
[SerializeField]
[Tooltip("The list of keys and the value they correspond to for continuous control.")]
[Tooltip("The list of keys and the value they correspond to for discrete control.")]
/// Contains the mapping from input to discrete actions
private DiscretePlayerAction[] discretePlayerActions;
[SerializeField]

{
#if UNITY_EDITOR
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
broadcast = EditorGUILayout.Toggle("Broadcast", broadcast);
broadcast = EditorGUILayout.Toggle(new GUIContent("Broadcast",
"If checked, the brain will broadcast states and actions to Python."), broadcast);
var serializedBrain = new SerializedObject(this);
if (brain.brainParameters.actionSpaceType == StateType.continuous)
{

正在加载...
取消
保存