ml-agents | Unity Machine Learning Agents Toolkit | Reinforcement Learning library

 by   Unity-Technologies C# Version: release_20 License: Non-SPDX

kandi X-RAY | ml-agents Summary

kandi X-RAY | ml-agents Summary

ml-agents is a C# library typically used in Institutions, Learning, Education, Artificial Intelligence, Reinforcement Learning, Deep Learning, Tensorflow, Unity applications. ml-agents has no bugs, it has no vulnerabilities and it has medium support. However ml-agents has a Non-SPDX License. You can download it from GitHub.

Unity Machine Learning Agents Toolkit

            kandi-support Support

              ml-agents has a medium active ecosystem.
              It has 14917 star(s) with 3882 fork(s). There are 552 watchers for this library.
              It had no major release in the last 12 months.
              There are 136 open issues and 2635 have been closed. On average issues are closed in 15 days. There are 35 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of ml-agents is release_20

            kandi-Quality Quality

              ml-agents has 0 bugs and 0 code smells.

            kandi-Security Security

              ml-agents has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              ml-agents code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              ml-agents has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              ml-agents releases are available to install and integrate.
              ml-agents saves you 14040 person hours of effort in developing the same functionality from scratch.
              It has 28132 lines of code, 1512 functions and 501 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ml-agents
            Get all kandi verified functions for this library.

            ml-agents Key Features

            No Key Features are available at this moment for ml-agents.

            ml-agents Examples and Code Snippets

            Training ML-Agents-Training Configurations-Behavior Configurations
            C#dot img1Lines of Code : 128dot img1License : Non-SPDX (NOASSERTION)
            copy iconCopy
                trainer_type: ppo
                  # Hyperparameters common to PPO and SAC
                  batch_size: 1024
                  buffer_size: 10240
                  learning_rate: 3.0e-4
                  learning_rate_schedule: linear
                  # PPO-specific  
            copy iconCopy
            # Install Xorg
            $ sudo apt-get update
            $ sudo apt-get install -y xserver-xorg mesa-utils
            $ sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024
            # Get the BusID information
            $ nvidia-xconfig --query-gpu-info
            # Add the BusID inform  
            Step 1: Write your custom trainer class
            C#dot img3Lines of Code : 75dot img3License : Non-SPDX (NOASSERTION)
            copy iconCopy
            conda create -n trainer-env python=3.8.13
            conda activate trainer-env
            def create_policy(
                self, parsed_behavior_id: BehaviorIdentifiers, behavior_spec: BehaviorSpec
            ) -> TorchPolicy:
                actor_cls: Union[Type[SimpleActor], Type[SharedActorCrit  
            Weird results with unity ml agents python api
            Pythondot img4Lines of Code : 45dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import numpy as np
            import mlagents
            from mlagents_envs.environment import UnityEnvironment
            # -----------------
            # This code is used to close an env that might not have been closed before
            # -------
            How do I avoid pylint warning C0103
            Pythondot img5Lines of Code : 12dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from unityagents import UnityEnvironment
            def main():
                env = UnityEnvironment(file_name='FrozenLakeGym')
                state = env.reset(train_mode=True)
                result = env.step(0)
            if __name__ == "__main__":

            Community Discussions


            Error loading native library grpc_csharp_ext x64 dll unity
            Asked 2021-Dec-08 at 12:17

            I'm following the tutorial in the documentation of ml-agents from release 18. I'm not able to run the training of the example available. When I try to run the code with anaconda running I get the error Error loading native library grpc_csharp_ext x64 dll and the mlagent don't connect to the python code and the agent just runs the heuristic mode.



            Answered 2021-Dec-08 at 12:17

            This was happening because the path to my unity code had special charactes such as ç and other accentuations like ã and á. I saw in a forum that Germans have special characters and when using them in the file names in the path it gave the same error (see here).



            Ml-agents cooperative push block not returning rewards
            Asked 2021-Oct-06 at 07:04

            I'm working with the Cooperative push block environment ( (exported in order to use the Python API) using the latest stable version. The issue is that I'm not getting the reward (positives or negatives). It is always 0. If I export the Single push block environment, I receive the rewards correctly. Below you have the code I'm using from the collab example



            Answered 2021-Oct-06 at 07:04

            I have received this answer from the Unity ml-agents GitHub issues section:

            The DecisionStep also has a group_reward field which is separate from the reward field. The group rewards given to the Cooperative Pushblock agents should be here. We apologize that the collab doesn't point this out explicitly and I will make an update to it.




            'UnityEnvironment' object has no attribute 'get_agent_groups' ( mlagents_envs 0.16.1 )
            Asked 2020-Jun-18 at 19:41

            python version as



            Answered 2020-Jun-18 at 19:41

            Like 'derHugo' already mentioned it is basically a duplicate.

            You're pointing to the documentation of version 0.15 but using version 0.16.1

            env.get_agent_groups() was replaced by env.get_behavior_names()

            This is the documentation that matches your version



            Couldn't connect to trainer on port 5004 using API version API-13 when using Unity3D ML-Agents
            Asked 2020-Jun-18 at 19:15

            I'm using Unity3D ML-Agents and when running examples of multiple clones inside(3DBall for example), there is a message in the console says:

            Couldn't connect to trainer on port 5004 using API version API-13. Will perform inference instead. UnityEngine.Debug:Log(Object) MLAgents.Academy:InitializeEnvironment() (at Assets/ML-Agents/Scripts/Academy.cs:228) MLAgents.Academy:LazyInitialization() (at Assets/ML-Agents/Scripts/Academy.cs:147) MLAgents.Agent:OnEnable() (at Assets/ML-Agents/Scripts/Agent.cs:255)

            I tried to turn off the firewall but it didn't work. How can I solve it?

            The version I'm using is



            Answered 2020-Jun-18 at 19:15

            This is just a normal warning that tells you that you won't train but instead use an already trained version in the environment(s). You don't need to worry about this. I assume your environment works when you start it.

            If you really want to turn this off, you can go to the agent object and look for the 'Behavior Parameters' -> 'Behavior Type' then set this value to "Inference". Make sure to set it back to default when you want to train your agents.

            If you want a good introduction to MLAgents, make sure to check out my YouTube ML-Agents Playlist

            Edit: I just saw that you're using a beta version. Make sure to use at least version 0.16.0. Probably just going through my first video would be the best idea to get you started.



            How do I know the agents are working together?
            Asked 2020-Feb-10 at 03:10

            I've been using ML-Agents for several months now and have been working on a self-balancing pair of legs. Though, I've had a question that's been itching me since the day I've started: How do I KNOW for a fact that the agents are working together? All I've done is copy and paste the area prefab 9 times. Is that all you have to do to make the agents learn more efficiently? Or is there something else I'm missing? Thanks.

            Agent Script >>> (I've not really needed to use any other scripts besides this one. Area and academy have nothing in them.)



            Answered 2020-Feb-10 at 03:10

            I believe yes all you need to do is have multiple instances of the prefab. As long as there are multiple Areas in the scene, they should be able to coordinate their batches for learning.

            If you want to measure how having multiple areas changes things, I would have one area and let it play for some time, and look at a graph of cumulative reward vs. episode number and see how high it gets, then do the same thing with many areas and see how the same graph looks with that.


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install ml-agents

            You can download it from GitHub.


            The table below lists all our releases, including our main branch which is under active development and may be unstable. A few helpful guidelines:. If you are a researcher interested in a discussion of Unity as an AI platform, see a pre-print of our reference paper on Unity and the ML-Agents Toolkit.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Reinforcement Learning Libraries

            Try Top Libraries by Unity-Technologies


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#


            by Unity-TechnologiesC#