Unity-Technologies / ml-agents

The Unity Machine Learning Agents Toolkit (ML-Agents) is an open-source project that enables games and simulations to serve as environments for training intelligent agents using deep reinforcement learning and imitation learning.
https://unity.com/products/machine-learning-agents
Other
17.19k stars 4.16k forks source link

Always use heuristic whether choose "use Heuristic" check box #2972

Closed D-Hsueh closed 4 years ago

D-Hsueh commented 4 years ago

When i import 'ML-Agents' file into my project and migrate my project into 0.11 version, i run this python script and click the play button, but it seems like my unity editor cannot communicate with my python script.

from mlagents.envs.environment import UnityEnvironment
env = UnityEnvironment(file_name=None, worker_id=0, seed=1)
info = env.reset()

And then i found that whether i choose "use Heuristic" check box, my agent always action by my "heuristic" action.

By the way, i think this message may be helpful to find out my problem's solution, but i can't understand it.

Assets\ML-Agents\Scripts\Policy\BehaviorParameters.cs(19,57): warning CS0649: Field 'BehaviorParameters.m_UseHeuristic' is never assigned to, and will always have its default value false

I alerady update my unitySDK and mlagents to 0.11

MarkTension commented 4 years ago

Hi there! I had the same problem, and for me it was because I didn't set a brain yet. If you don't set a brain in the agent's Behavior parameters, ml-agents will always use Heuristics. This is only the case when you're running it in play mode. Hope that helps

D-Hsueh commented 4 years ago

Hi there! I had the same problem, and for me it was because I didn't set a brain yet. If you don't set a brain in the agent's Behavior parameters, ml-agents will always use Heuristics. This is only the case when you're running it in play mode. Hope that helps

But in 0.11 version, i don't know how to set a brain, my Begavior parameters inspector is like this

捕获

the only one thing that i think is related to brain is 'Behavior Name', but it doesn't work.

MarkTension commented 4 years ago

You can put the brain .nn file in Model See # 3 of this guide in the docs

D-Hsueh commented 4 years ago

You can put the brain .nn file in Model See # 3 of this guide in the docs

Thank you very much for your reply, I solved the problem with your method.

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.