chaiNNer-org / spandrel

Spandrel gives your project support for various PyTorch architectures meant for AI Super-Resolution, restoration, and inpainting. Based on the model support implemented in chaiNNer.
MIT License
139 stars 12 forks source link

Fuzz size requirements #123

Closed RunDevelopment closed 8 months ago

RunDevelopment commented 8 months ago

Progress towards #122.

This PR adds the fuzzing method and uses it for ESRGAN. I confirmed this fuzzing would have found #121, and it even found another issue: ESRGAN does not like width/height=1.

The fuzzing itself is pretty simple. We use the model's size requirements to derive a list of valid sizes. Those sizes are then used to run the model on random input images. The output of those images is then checked to see whether (1) no errors occur and (2) the output shape is correct.

I also clarified in the documentation that minimum is NOT guaranteed to be a multiple of multiple_of. This is surprising, so I wonder whether we should make it a guarantee.