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

Unity c# script compile issues when creating Custom Protobuf #2531

Closed yakmyakmyakm closed 4 years ago

yakmyakmyakm commented 5 years ago

After I run make.bat the generated files in my unity project throw errors

Screen Shot 2019-09-10 at 10 36 22 PM

To reproduce I restore my project to what is on the repo git reset --hard then I go to /protobuf-definitions and call make.bat

I go to ml-agents and ml-agents-env and call pip install -e . calling mlagents-learn shows the unity logo returning to Unity shows many errors.

Am I supposed to add some python code here? This step was confusing for me, is it just info?

Screen Shot 2019-09-10 at 10 41 44 PM
yakmyakmyakm commented 5 years ago

Here are the newly generated .proto files which are throwing errors CommunicatorObjectsNew.zip

TSTsankov commented 5 years ago

Did you _Un-comment line 7 in make.bat (for Windows, use make_forwin.bat), and set to correct Grpc.Tools sub-directory. and _Run the .bat from the terminal by navigating to $MLAGENTSROOT\protobuf-definitions and entering make.bat ? I have a problem with the Custom Protobuf, yet at least I get it to compile.

yakmyakmyakm commented 5 years ago

Yeah I have done that after resetting my repo and I have the same results. Maybe we have to add something to the python instance?

Screen Shot 2019-09-11 at 9 14 30 AM
yakmyakmyakm commented 5 years ago

I've also found this issue which may be of help to you. https://github.com/Unity-Technologies/ml-agents/pull/932

TSTsankov commented 5 years ago

Well, perhaps what you say makes sense. You know where it says The Python instance of the custom action looks like: from mlagents.envs.communicator_objects import CustomAction env = mlagents.envs.UnityEnvironment(...) ... action = CustomAction(direction=CustomAction.NORTH, walkAmount=2.0) env.step(custom_action=action)

Are we supposed to create this python instance or do we expect it to be generated automatically with the other files? I cannot seem to find it anywhere using grep

Edit* Sorry, for your issue this should not be causing the problem (e.g. the python instance). I am able to go a step further than you (up to building the game) without having to deal with this instance

Do you get any errors when you Run the .bat from the terminal?

awjuliani commented 5 years ago

Hi @yakmyakmyakm

Can you try building the protobuf definitions without changing anything related to the custom observation or action?

yakmyakmyakm commented 5 years ago

Hi @awjuliani

Ok. I have now tried with an empty custom action and observation and I get the same result. Maybe this is a version issue?

awjuliani commented 5 years ago

It seems there is indeed something wrong with your build process. As @TSTsankov asked, what is your output in the terminal from running the .bat ?

yakmyakmyakm commented 5 years ago

@awjuliani Here is my output from running ./make.bat

Screen Shot 2019-09-11 at 12 59 28 PM
surfnerd commented 5 years ago

Hi, we just merged some protobuf generation changes to develop if you’d like to give it a try. Do you have a local version of protoc installed? If so, what version? I tried regenerating the protobufs myself and ran into compile issues because my local protoc was version 3.9.1 while the NuGet package one was 3.51. Maybe something similar is happening to you?

awjuliani commented 4 years ago

Hi All,

We have deprecated the custom protobuf feature in favor of a new method of communication between Unity and Python called side channels. You can read more about them here: https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Custom-SideChannels.md. The main benefit is that building custom protobuf objects is no longer necessary, which should provide faster turnaround time during experimentation.

Feel free to open a new issue if there are any issues or suggestions related to the new side channels.

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.