ml-agents icon indicating copy to clipboard operation
ml-agents copied to clipboard

Disable the construction of action_mask and deterministic_discrete_actions branches in the NN Graph through config file settings

Open ohernpaul opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. Submitting a request for a config file parameter where you can opt out of deterministic_discrete_actions branch in the neural network graph as well as opting out of action masking. While these are convenient to have in most cases, these graph branches generally contribute a significant amount of un-necessary overhead while not using action masking or the deterministic outputs.

Describe alternatives you've considered At the moment, the only option for disabling these branches of the graph is to manually modify the onnx model either through the python api or other onnx visual tools people have released.

Additional context When developing mlagents for mobile/VR platforms, this overhead is significant, even while operating in the barracuda sliced inference context. For a standard model I have gained over 50% improvement in total ms used for a single slice of inference. It would be nice to simply provide bool switches for these branches in the config file rather than modifying the NN architecture code on the python end. To highlight: the action_mask branch is un-necessary when not in use because a (vector of ones * -1) + 1 * 1e8 is a zero vector and the extra sub and mult functions in the graph don't do anything to the (onnx) gemm outputs. The attached photo shows the required modules while not using action_mask or deterministic_discrete_actions

1_256_model_actionmask

ohernpaul avatar Jul 26 '22 18:07 ohernpaul