Reinforcement Learning
ml-agents
TensorBoard
ONNX
Pyramids
deep-reinforcement-learning
ML-Agents-Pyramids
Instructions to use AnnaMats/ppo-Pyramids-Training with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ml-agents
How to use AnnaMats/ppo-Pyramids-Training with ml-agents:
mlagents-load-from-hf --repo-id="AnnaMats/ppo-Pyramids-Training" --local-dir="./download: string[]s"
- Notebooks
- Google Colab
- Kaggle
| using NUnit.Framework; | |
| using Unity.Barracuda; | |
| using Unity.MLAgents.Actuators; | |
| using UnityEngine; | |
| using Unity.MLAgents.Policies; | |
| using UnityEditor; | |
| using UnityEngine.TestTools; | |
| namespace Unity.MLAgents.Tests | |
| { | |
| [] | |
| public class BehaviorParameterTests : IHeuristicProvider | |
| { | |
| const string k_continuousONNXPath = "Packages/com.unity.ml-agents/Tests/Editor/TestModels/continuous2vis8vec2action_v1_0.onnx"; | |
| public void Heuristic(in ActionBuffers actionsOut) | |
| { | |
| // No-op | |
| } | |
| [] | |
| public void TestNoModelInferenceOnlyThrows() | |
| { | |
| var gameObj = new GameObject(); | |
| var bp = gameObj.AddComponent<BehaviorParameters>(); | |
| bp.BehaviorType = BehaviorType.InferenceOnly; | |
| var actionSpec = new ActionSpec(); | |
| Assert.Throws<UnityAgentsException>(() => | |
| { | |
| bp.GeneratePolicy(actionSpec, new ActuatorManager()); | |
| }); | |
| } | |
| [] | |
| public void TestIsInHeuristicMode() | |
| { | |
| var gameObj = new GameObject(); | |
| var bp = gameObj.AddComponent<BehaviorParameters>(); | |
| bp.Model = null; | |
| gameObj.AddComponent<Agent>(); | |
| bp.BehaviorType = BehaviorType.HeuristicOnly; | |
| Assert.IsTrue(bp.IsInHeuristicMode()); | |
| bp.BehaviorType = BehaviorType.Default; | |
| Assert.IsTrue(bp.IsInHeuristicMode()); | |
| bp.Model = ScriptableObject.CreateInstance<NNModel>(); | |
| Assert.IsFalse(bp.IsInHeuristicMode()); | |
| } | |
| [] | |
| public void TestPolicyUpdateEventFired() | |
| { | |
| var gameObj = new GameObject(); | |
| var bp = gameObj.AddComponent<BehaviorParameters>(); | |
| gameObj.AddComponent<Agent>().LazyInitialize(); | |
| bp.OnPolicyUpdated += delegate (bool isInHeuristicMode) { Debug.Log($"OnPolicyChanged:{isInHeuristicMode}"); }; | |
| bp.BehaviorType = BehaviorType.HeuristicOnly; | |
| LogAssert.Expect(LogType.Log, $"OnPolicyChanged:{true}"); | |
| bp.BehaviorType = BehaviorType.Default; | |
| LogAssert.Expect(LogType.Log, $"OnPolicyChanged:{true}"); | |
| Assert.Throws<UnityAgentsException>(() => | |
| { | |
| bp.BehaviorType = BehaviorType.InferenceOnly; | |
| }); | |
| bp.Model = AssetDatabase.LoadAssetAtPath<NNModel>(k_continuousONNXPath); | |
| LogAssert.Expect(LogType.Log, $"OnPolicyChanged:{false}"); | |
| bp.BehaviorType = BehaviorType.HeuristicOnly; | |
| LogAssert.Expect(LogType.Log, $"OnPolicyChanged:{true}"); | |
| } | |
| } | |
| } | |