Add configurable initial reset for ONNX inference mode (to overcome minor differences between Python server inference and Onnx inference) - #67
Open
stefanfausser wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
This PR adds the sync-node export variable
initial_reset_onnx_inference. Once this is set totrue(default is false), the environments are initially resetted once in Onnx inference mode, same as it happens in the Python server inference (sync node: training mode).In addition to this, I added a
set_pause(true)in_inference_process()which was missing.The reason for this PR and, thus, the added feature, is to get the same sequence of observations and actions both for Python server inference (sync node: training mode) and Onnx inference.
Together with PR #66, this target can be reached.
How I tested it (on RingPong example):
Both PRs, this and #66, need to be merged and
initial_reset_onnx_inferencemust be set totrue. Then a seed needs to be set in the RingPong example ingame.gd:Furthermore, a debug output in
controller.gdneeds to be added (and action value is rounded to avoid suffering from floating point differences between C#-ONNX and Python / Pytorch):Last, Python server inference (training mode) followed by Onnx inference needs to be done for some steps and the debug outputs (log) of the two need to be compared. Optionally, the obs vector values can be printed as well in training and inference functions in the sync node. Expected are the same sequences of action values (and obs values).
I got the same sequence of observations + action values / actions for 100 timesteps with seed 777.