[ML] Add ability to evaluate a simple PyTorch model #1817
Merged
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.
The main motivation for this change is to enable round trip testing of the Java and C++ processes with a small TorchScript model where downloading a large BERT model in the integration tests is not practical. Additionally this represents another use-case which is beneficial for evolving the design.
PyTorch tensors have a type, BERT uses uint 64 whereas this model expects float 32, to distinguish between the 2 a new field has been added to the input JSON. The JSON document is used only for internal communications between Java and C++ and can be changed freely provided both sides are upgraded together, for this reason I have gone for a practical rather than elegant structure.
test_run.json
describes the input and outputThe app knows little about the model is it evaluating, some introspection is possible but not much. In future a more complex command document may be required to express has the inputs and outputs should be processed.
cc @dimitris-athanasiou