Test enhancement and doc correction for QAT #602
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.
Hi @jaybdub:
Hope you are doing well. This PR
I have been using pSNR test for quite sometime to test the correctness of TRT conversion instead of max difference as pSNR is more robust test than max difference.
There is an issue with interpolate layer in TRT>=7 when
align_corners=True. I added a unit test for a similar set of parameters where internal model metrics were showing regression. However, the unit test passed themax_differencetest in the repo but failed onpSNRtest. I will get back to this test case at the endUsually, when we calculate pSNR at FP32 , if
pSNR>=100, it is safe to say that the conversion was fine. The best case is whenpSNR=NaN, i.e. ,MSEormean squared errorwas zero , that led to pSNR being an infinite number which means that both the output tensors (pytorch model output and trt model output) were identicalAlthough I havent added pSNR test at FP16 in the repo, I can summarize my findings here , so that if you feel free, we can add those later on.
Inspired from Image processing basics, if
pSNR at FP32 >= 100db, we can safely say that the conversion is goodpSNR at FP16 ~= (pSNR at FP32)//2 - xx~=10. Based on numerous experiments that I did,xis around10dband accounts for variance.For e.g.
pSNR will drop if MSE (mean squared error) is highNow back to interpolate conversion issue
As you can see all the 4 tests pass
max differencetest. However, the middle tests represent test cases wherealign_corner=TrueandpSNR <20db at FP32which indicates that there is a problem in conversion and it leads to degradation in model metrics.1st and 4thtests havealign_corner=Falseand pSNR is way greater than 100.I have already raised the issue with Nvidia and it is being looked into. I think pSNR test will make our unit tests more robust and we should definitely add them
Let me know if you have any questions
Thanks
Kshitij Srivastava