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

Hybrid FoodCollector #4746

Merged
merged 19 commits into from
Dec 16, 2020
Merged

Hybrid FoodCollector #4746

merged 19 commits into from
Dec 16, 2020

Conversation

dongruoping
Copy link
Contributor

@dongruoping dongruoping commented Dec 14, 2020

Proposed change(s)

  • FoddCollector with continuous moving and discrete shooting
  • Re-trained models
  • Updated demo file
  • Fix a few bugs in loading demo files

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

Types of change(s)

  • Bug fix
  • New feature
  • Code refactor
  • Breaking change
  • Documentation update
  • Other (please describe)

Checklist

  • Added tests that prove my fix is effective or that my feature works
  • Updated the changelog (if applicable)
  • Updated the documentation (if applicable)
  • Updated the migration guide (if applicable)

Other comments

@@ -139,16 +129,7 @@ public void MoveAgent(ActionSegment<int> act)
if (shootCommand)
{
m_Shoot = true;
dirToGo *= 0.5f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This got lost in the conversion, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe easier to keep everything in one function and just pass the ActionBuffers, instead of doing it individually.

if (Input.GetKey(KeyCode.D))
{
discreteActionsOut[2] = 2;
continuousActionsOut[2] = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be 1 and -1 (or the other way around), not 1 and 2

- `FoodCollector` scene: 3 Continuous Actions + 1 Discrete Action with 2 Branches
- 3 continuous actions correspond to Forward Motion, Side Motion and Rotation
- Laser (2 possible actions: Laser, No Action)
- `GridFoodCollector` and `VisualFoodCollector` scenes: (Discrete) 4 Branches:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we either need to change the ActionSpecs for the other scenes (and retrain), or have two versions of the code to handle discrete or continuous movement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer the former (less code to maintain) but it's your call.

- `FoodCollector` scene: 3 Continuous Actions + 1 Discrete Action with 2 Branches
- 3 continuous actions correspond to Forward Motion, Side Motion and Rotation
- Laser (2 possible actions: Laser, No Action)
- `GridFoodCollector` and `VisualFoodCollector` scenes: (Discrete) 4 Branches:
Copy link
Contributor

@andrewcoh andrewcoh Dec 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be the same as above since they share the FoodCollectorAgent script?

)
if (
current_pair_info.action_info.continuous_actions is None
and current_pair_info.action_info.continuous_actions is None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
and current_pair_info.action_info.continuous_actions is None
and current_pair_info.action_info.discrete_actions is None

(I think, not totally sure)

@@ -23,9 +24,9 @@ internal class DemonstrationEditor : UnityEditor.Editor
const string k_NumberStepsName = "numberSteps";
const string k_NumberEpisodesName = "numberEpisodes";
const string k_MeanRewardName = "meanReward";
const string k_ActionSpecName = "ActionSpec";
const string k_ActionSpecName = "m_ActionSpec";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the problem here? Should we have a unit test that would have caught it?

(OK to do outside of this PR)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this when we were adding an ActionSpec field, and later on we changed it to private field m_ActionSpec and public property ActionSpec.

Since properties won't be serialized, property.FindPropertyRelative("ActionSpec") will get nothing and the demo import will fail. The exception is ignored though, resulted in demo files not imported properly and no information displayed in inspector, but no direct error message.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, missed the fact that it was in the drawer.

@dongruoping dongruoping merged commit 0014f1b into master Dec 16, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-hybrid-food branch December 16, 2020 20:00
dongruoping added a commit that referenced this pull request Dec 16, 2020
* use continuous action for moving and discrete for shooting

* update models
dongruoping added a commit that referenced this pull request Dec 17, 2020
* use continuous action for moving and discrete for shooting

* update models
@dongruoping dongruoping mentioned this pull request Dec 17, 2020
10 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants