Xilinx / inference-server

https://xilinx.github.io/inference-server/
Apache License 2.0
43 stars 13 forks source link

Add FP16 test in Python #203

Closed varunsh-xilinx closed 1 year ago

varunsh-xilinx commented 1 year ago

Summary of Changes

Closes #201

Motivation

Sending float16 data to the server from Python is important to maintain parity with C++.

Implementation

There was an issue raised in Pybind11 about this issue and a suggested workaround, which I've duplicated here.

Prior to this PR, the MIGraphX worker would crash the server if the worker threw an exception during batch processing. The cause was that that the new_batch was null. Now, this condition is checked for and it returns early. In the base class, I also allowed the return value from the worker to be null. This indicates that there is nothing to pass on to a subsequent worker even if one is configured. This scenario will occur in general when the worker encounters an error though the other workers aren't actively handling this well at the moment.

There are missing Python preprocessing methods for different types as they're being added on an as-needed basis. This also adds fp16 variants to them.

Notes

The preprocessing code was using functions like imagePreprocessFloat() when FP32 was the only type bound. This function has been deprecated. Instead, new code should use imagePreprocessFp32().

gbuildx commented 1 year ago

Build successful!