Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RayPerceptionSensor related errors #5958

Closed
Duarte-Rodrigues-Neroes opened this issue Aug 4, 2023 · 13 comments
Closed

RayPerceptionSensor related errors #5958

Duarte-Rodrigues-Neroes opened this issue Aug 4, 2023 · 13 comments
Labels
bug Issue describes a potential bug in ml-agents.

Comments

@Duarte-Rodrigues-Neroes
Copy link

Duarte-Rodrigues-Neroes commented Aug 4, 2023

Describe the bug
The RayPerceptionSensor.cs file has errors associated with variable names not existing, error in float to int conversions, some methods don't exist as supposed.

To Reproduce
Steps to reproduce the behavior:

  1. Download the most recent version of ML-agents, as explained in the guidelines.
    Unity will show the error right away, after starting the 3DBall example tutorial.

Console logs / stack traces
...\ml-agents-develop\com.unity.ml-agents\Runtime\Sensors\RayPerceptionSensor.cs(459,39): error CS0103: The name 'QueryParameters' does not exist in the current context
com.unity.ml-agents\Runtime\Sensors\RayPerceptionSensor.cs(466,146): error CS1503: Argument 5: cannot convert from 'float' to 'int'
ml-agents-develop\com.unity.ml-agents\Runtime\Sensors\RayPerceptionSensor.cs(470,122): error CS1503: Argument 4: cannot convert from 'float' to 'int'
ml-agents-develop\com.unity.ml-agents\Runtime\Sensors\RayPerceptionSensor.cs(486,54): error CS1501: No overload for method 'ScheduleBatch' takes 5 arguments
ml-agents-develop\com.unity.ml-agents\Runtime\Sensors\RayPerceptionSensor.cs(491,51): error CS1501: No overload for method 'ScheduleBatch' takes 5 arguments

Environment (please complete the following information):

  • Unity Version: Unity 2021.3.29f
  • OS + version: Windows 11
  • ML-Agents version: 2.3.0-exp.4
  • Torch version: 2.0.1+cu118
  • Environment: 3DBall
@Duarte-Rodrigues-Neroes Duarte-Rodrigues-Neroes added the bug Issue describes a potential bug in ml-agents. label Aug 4, 2023
@Duarte-Rodrigues-Neroes
Copy link
Author

This error could be related to the most recent commit on the main branch - "Update to 2022.3 LTS and batched raycasts"

@miguelalonsojr
Copy link
Collaborator

The package was updated to use Unity 2022.3. The API for batched ray casts has changed a bit in 2022.3. Upgrading Unity to 2022.3 should fix the issue.

@Duarte-Rodrigues-Neroes
Copy link
Author

Does that mean I cannot run ML-agents in a lower version of Unity?

@miguelalonsojr
Copy link
Collaborator

You can use any version that you want, if you install the last registry release from the package manager, which was 2.0.1. Keep in mind, that you'll have to also install the correct python versions as well. You can find this info on the releases page. https://github.com/Unity-Technologies/ml-agents/releases

For installing older versions from GitHub, you'll have to switch to the correct release branch, e.g. release 20, which was released for 2021.3. https://github.com/Unity-Technologies/ml-agents/releases/tag/release_20 If you want to use the bleeding edge available on the develop branch, then you'll have to upgrade to the editor version listed in package.json https://github.com/Unity-Technologies/ml-agents/blob/develop/com.unity.ml-agents/package.json.

@Duarte-Rodrigues-Neroes
Copy link
Author

Thank you so much for the clarification. It is now clear what I should do :)

@miguelalonsojr
Copy link
Collaborator

Closing.

@OmarVector
Copy link

You can use any version that you want, if you install the last registry release from the package manager, which was 2.0.1. Keep in mind, that you'll have to also install the correct python versions as well. You can find this info on the releases page. https://github.com/Unity-Technologies/ml-agents/releases

For installing older versions from GitHub, you'll have to switch to the correct release branch, e.g. release 20, which was released for 2021.3. https://github.com/Unity-Technologies/ml-agents/releases/tag/release_20 If you want to use the bleeding edge available on the develop branch, then you'll have to upgrade to the editor version listed in package.json https://github.com/Unity-Technologies/ml-agents/blob/develop/com.unity.ml-agents/package.json.

May I ask what is the science behind forcing upgrade to 2022 to use the latest package version, despite sentis already working on 2021 as far as I'm concern

Our project heavly rely on webgl support, and upgrading to 2022 effect our performance a lot due to having to upgrade URP to newer version and many render features we have no longer working .

@miguelalonsojr
Copy link
Collaborator

There are some new features in the latest release of MLA the depend on 2022, unrelated to Sentis. As Unity evolves, so does MLA.

@OmarVector
Copy link

There are some new features in the latest release of MLA the depend on 2022, unrelated to Sentis. As Unity evolves, so does MLA.

Thanks for explanation, would be possible for those features to be optional?

In my imagination, ML agents hasnt updated for very long time, and most of the users who use it are mostly using old version of unity which difficult for sudden update... so we may expect at least we can still use the package without those exclusive feature for 2022 and up.

However, its just suggestion hopefully put in to account

Thank you:)

@miguelalonsojr
Copy link
Collaborator

miguelalonsojr commented Oct 13, 2023

What version of 2021 are you using? I can patch ML-Agents to exclude features related to 2022.3 and have it available on the develop branch. I also replied to your thread on the Sentis discussion board. https://discussions.unity.com/t/ml-agent-and-sentis-pipeline/282043/15 Reopenning.

@OmarVector
Copy link

What version of 2021 are you using? I can patch ML-Agents to exclude features related to 2022.3 and have it available on the develop branch. I also replied to your thread on the Sentis discussion board. https://discussions.unity.com/t/ml-agent-and-sentis-pipeline/282043/15 Reopenning.

We are using 2021.3.8f1

Really appreciated, lets continue the discussion here for easier collaboration :))

@miguelalonsojr
Copy link
Collaborator

miguelalonsojr commented Oct 15, 2023

@OmarVector So, I've made the changes to support running MLA with Sentis on 2021.3. It's on this branch: https://github.com/Unity-Technologies/ml-agents/tree/fix-remove-batched-raycasts-2021 Unfortunately, I will not be able to merge this into develop, as we do not want to explicitly add support for Unity versions older than 2022.3. Plus, these changes remove any errors with the ML-Agents package, but some of the example scenes do not work on 2021.3 since they've been updated to 2022.3. However, we'll keep this branch around for those that want to use MLA + Sentis in 2021.3.

You can always install ML-Agents from the github repo directly by using the following git url:

git+https://github.com/Unity-Technologies/ml-agents.git?path=com.unity.ml-agents#fix-remove-batched-raycasts-2021

and installing the package through the package manager git URL installation process. Give it a shot and let me know how it goes.

Thanks again for supporting ML-Agents! I'm closing this issue.

@OmarVector
Copy link

@OmarVector So, I've made the changes to support running MLA with Sentis on 2021.3. It's on this branch: https://github.com/Unity-Technologies/ml-agents/tree/fix-remove-batched-raycasts-2021 Unfortunately, I will not be able to merge this into develop, as we do not want to explicitly add support for Unity versions older than 2022.3. Plus, these changes remove any errors with the ML-Agents package, but some of the example scenes do not work on 2021.3 since they've been updated to 2022.3. However, we'll keep this branch around for those that want to use MLA + Sentis in 2021.3.

You can always install ML-Agents from the github repo directly by using the following git url:

git+https://github.com/Unity-Technologies/ml-agents.git?path=com.unity.ml-agents#fix-remove-batched-raycasts-2021

and installing the package through the package manager git URL installation process. Give it a shot and let me know how it goes.

Thanks again for supporting ML-Agents! I'm closing this issue.

It went well, the performance is much higher than the version of 2022 but I believe its due to URP version as well

for the performance compared to our 2021 version, is almost the same, I may consider slightly improvement ... its difficult to observe the difference compared to 2022 due to frame spikes on webgl due to GC... its always in range 30-50 FPS

Thank you for providing this custom version of sentis: ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue describes a potential bug in ml-agents.
Projects
None yet
Development

No branches or pull requests

3 participants