浏览代码
Merge branch 'develop-agentprocessor-teammanager' into develop-coma2-trainer
/develop/action-slice
Merge branch 'develop-agentprocessor-teammanager' into develop-coma2-trainer
/develop/action-slice
Andrew Cohen
3 年前
当前提交
9060da06
共有 61 个文件被更改,包括 2479 次插入 和 1570 次删除
-
2Project/Assets/ML-Agents/Examples/Match3/Prefabs/Match3VisualObs.prefab
-
1001Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VectorObs.onnx
-
11README.md
-
16com.unity.ml-agents.extensions/Documentation~/Grid-Sensor.md
-
2com.unity.ml-agents.extensions/Documentation~/Match3.md
-
9com.unity.ml-agents.extensions/Documentation~/com.unity.ml-agents.extensions.md
-
12com.unity.ml-agents.extensions/Runtime/Input/InputActionActuator.cs
-
9com.unity.ml-agents.extensions/Runtime/Match3/Match3Actuator.cs
-
2com.unity.ml-agents.extensions/package.json
-
4com.unity.ml-agents/Documentation~/com.unity.ml-agents.md
-
4com.unity.ml-agents/Runtime/Academy.cs
-
1com.unity.ml-agents/Runtime/Actuators/ActionSpec.cs
-
2com.unity.ml-agents/Runtime/Actuators/IActionReceiver.cs
-
2com.unity.ml-agents/Runtime/Actuators/IDiscreteActionMask.cs
-
8com.unity.ml-agents/Runtime/Actuators/VectorActuator.cs
-
47com.unity.ml-agents/Runtime/Agent.cs
-
31com.unity.ml-agents/Runtime/Analytics/Events.cs
-
18com.unity.ml-agents/Runtime/Analytics/InferenceAnalytics.cs
-
17com.unity.ml-agents/Runtime/Analytics/TrainingAnalytics.cs
-
9com.unity.ml-agents/Runtime/Communicator/RpcCommunicator.cs
-
2com.unity.ml-agents/Runtime/Demonstrations/DemonstrationRecorder.cs
-
2com.unity.ml-agents/Runtime/DiscreteActionMasker.cs
-
10com.unity.ml-agents/Runtime/Policies/BarracudaPolicy.cs
-
6com.unity.ml-agents/Runtime/Policies/BehaviorParameters.cs
-
10com.unity.ml-agents/Runtime/Policies/RemotePolicy.cs
-
38com.unity.ml-agents/Runtime/Sensors/IBuiltInSensor.cs
-
6com.unity.ml-agents/Runtime/Sensors/ObservationWriter.cs
-
5com.unity.ml-agents/Runtime/SideChannels/TrainingAnalyticsSideChannel.cs
-
18com.unity.ml-agents/Tests/Editor/Analytics/InferenceAnalyticsTests.cs
-
38com.unity.ml-agents/Tests/Editor/Analytics/TrainingAnalyticsTest.cs
-
86config/ppo/Match3.yaml
-
1config/ppo/PyramidsRND.yaml
-
4docs/Installation-Anaconda-Windows.md
-
6docs/Installation.md
-
4docs/Learning-Environment-Examples.md
-
2docs/Training-on-Amazon-Web-Service.md
-
4docs/Unity-Inference-Engine.md
-
9ml-agents/mlagents/trainers/action_info.py
-
49ml-agents/mlagents/trainers/agent_processor.py
-
53ml-agents/mlagents/trainers/buffer.py
-
15ml-agents/mlagents/trainers/policy/policy.py
-
2ml-agents/mlagents/trainers/ppo/trainer.py
-
62ml-agents/mlagents/trainers/sac/optimizer_torch.py
-
9ml-agents/mlagents/trainers/sac/trainer.py
-
6ml-agents/mlagents/trainers/tests/test_agent_processor.py
-
23ml-agents/mlagents/trainers/tests/test_buffer.py
-
34ml-agents/mlagents/trainers/tests/test_trajectory.py
-
12ml-agents/mlagents/trainers/tests/torch/test_ppo.py
-
2ml-agents/mlagents/trainers/tests/torch/test_sac.py
-
4ml-agents/mlagents/trainers/tests/torch/test_simple_rl.py
-
79ml-agents/mlagents/trainers/torch/agent_action.py
-
39ml-agents/mlagents/trainers/trajectory.py
-
1utils/make_readme_table.py
-
69utils/validate_release_links.py
-
1001Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VisualObs.onnx
-
15Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VisualObs.onnx.meta
-
49com.unity.ml-agents/Runtime/Actuators/IBuiltInActuator.cs
-
3com.unity.ml-agents/Runtime/Actuators/IBuiltInActuator.cs.meta
-
52ml-agents/mlagents/trainers/tests/torch/test_agent_action.py
-
1001Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VisualObs.nn
-
11Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VisualObs.nn.meta
1001
Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VectorObs.onnx
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
1001
Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VisualObs.onnx
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 28ccdfd7cb3d941ce8af0ab89e06130a |
|||
ScriptedImporter: |
|||
fileIDToRecycleName: |
|||
11400000: main obj |
|||
11400002: model data |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 683b6cb6d0a474744822c888b46772c9, type: 3} |
|||
optimizeModel: 1 |
|||
forceArbitraryBatchSize: 1 |
|||
treatErrorsAsWarnings: 0 |
|||
importMode: 1 |
|
|||
namespace Unity.MLAgents.Actuators |
|||
{ |
|||
/// <summary>
|
|||
/// Identifiers for "built in" actuator types.
|
|||
/// These are only used for analytics, and should not be used for any runtime decisions.
|
|||
///
|
|||
/// NOTE: Do not renumber these, since the values are used for analytics. Renaming is allowed though.
|
|||
/// </summary>
|
|||
public enum BuiltInActuatorType |
|||
{ |
|||
/// <summary>
|
|||
/// Default Sensor type if it cannot be determined.
|
|||
/// </summary>
|
|||
Unknown = 0, |
|||
|
|||
/// <summary>
|
|||
/// VectorActuator used by the Agent
|
|||
/// </summary>
|
|||
AgentVectorActuator = 1, |
|||
|
|||
/// <summary>
|
|||
/// Corresponds to <see cref="VectorActuator"/>
|
|||
/// </summary>
|
|||
VectorActuator = 2, |
|||
|
|||
/// <summary>
|
|||
/// Corresponds to the Match3Actuator in com.unity.ml-agents.extensions.
|
|||
/// </summary>
|
|||
Match3Actuator = 3, |
|||
|
|||
/// <summary>
|
|||
/// Corresponds to the InputActionActuator in com.unity.ml-agents.extensions.
|
|||
/// </summary>
|
|||
InputActionActuator = 4, |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Interface for actuators that are provided as part of ML-Agents.
|
|||
/// User-implemented actuators don't need to use this interface.
|
|||
/// </summary>
|
|||
internal interface IBuiltInActuator |
|||
{ |
|||
/// <summary>
|
|||
/// Return the corresponding BuiltInActuatorType for the actuator.
|
|||
/// </summary>
|
|||
/// <returns>A BuiltInActuatorType corresponding to the actuator.</returns>
|
|||
BuiltInActuatorType GetBuiltInActuatorType(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e3d7ef9a9a5043549cc5c0bbee520810 |
|||
timeCreated: 1613514041 |
|
|||
import numpy as np |
|||
from mlagents.torch_utils import torch |
|||
|
|||
from mlagents.trainers.buffer import AgentBuffer, BufferKey |
|||
from mlagents.trainers.torch.agent_action import AgentAction |
|||
|
|||
|
|||
def test_agent_action_group_from_buffer(): |
|||
buff = AgentBuffer() |
|||
# Create some actions |
|||
for _ in range(3): |
|||
buff[BufferKey.GROUP_CONTINUOUS_ACTION].append( |
|||
3 * [np.ones((5,), dtype=np.float32)] |
|||
) |
|||
buff[BufferKey.GROUP_DISCRETE_ACTION].append( |
|||
3 * [np.ones((4,), dtype=np.float32)] |
|||
) |
|||
# Some agents have died |
|||
for _ in range(2): |
|||
buff[BufferKey.GROUP_CONTINUOUS_ACTION].append( |
|||
1 * [np.ones((5,), dtype=np.float32)] |
|||
) |
|||
buff[BufferKey.GROUP_DISCRETE_ACTION].append( |
|||
1 * [np.ones((4,), dtype=np.float32)] |
|||
) |
|||
|
|||
# Get the group actions, which will be a List of Lists of AgentAction, where each element is the same |
|||
# length as the AgentBuffer but contains only one agent's obs. Dead agents are padded by |
|||
# NaNs. |
|||
gact = AgentAction.group_from_buffer(buff) |
|||
# Agent 0 is full |
|||
agent_0_act = gact[0] |
|||
assert agent_0_act.continuous_tensor.shape == (buff.num_experiences, 5) |
|||
assert agent_0_act.discrete_tensor.shape == (buff.num_experiences, 4) |
|||
|
|||
agent_1_act = gact[1] |
|||
assert agent_1_act.continuous_tensor.shape == (buff.num_experiences, 5) |
|||
assert agent_1_act.discrete_tensor.shape == (buff.num_experiences, 4) |
|||
assert (agent_1_act.continuous_tensor[0:3] > 0).all() |
|||
assert (agent_1_act.continuous_tensor[3:] == 0).all() |
|||
assert (agent_1_act.discrete_tensor[0:3] > 0).all() |
|||
assert (agent_1_act.discrete_tensor[3:] == 0).all() |
|||
|
|||
|
|||
def test_to_flat(): |
|||
aa = AgentAction( |
|||
torch.tensor([[1.0, 1.0, 1.0]]), [torch.tensor([2]), torch.tensor([1])] |
|||
) |
|||
flattened_actions = aa.to_flat([3, 3]) |
|||
assert torch.eq( |
|||
flattened_actions, torch.tensor([[1, 1, 1, 0, 0, 1, 0, 1, 0]]) |
|||
).all() |
1001
Project/Assets/ML-Agents/Examples/Match3/TFModels/Match3VisualObs.nn
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 48d14da88fea74d0693c691c6e3f2e34 |
|||
ScriptedImporter: |
|||
fileIDToRecycleName: |
|||
11400000: main obj |
|||
11400002: model data |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|||
script: {fileID: 11500000, guid: 19ed1486aa27d4903b34839f37b8f69f, type: 3} |
撰写
预览
正在加载...
取消
保存
Reference in new issue