neural-compressor
neural-compressor copied to clipboard
Use TorchVision's Model Registration API to fetch available backbones
One of the example files of the Neural Compressor project uses the following approach to fetch all the available backbones of TorchVision:
https://github.com/intel/neural-compressor/blob/3482e789e1d26967c448ca53a6bba8714f75c8f2/examples/pytorch/image_recognition/torchvision_models/distillation/eager/main.py#L11-L13
The above approach will return all backbones but it will also include methods that are not models such as the get_weight()
. This might cause confusion to the users. An alternative approach recently introduced on TorchVision is to use it's Model Registration API (see details here). For example you should be able to update the above code with:
model_names = models.list_models(module=models)
For full transparency, the new API is currently considered Beta. We've intentionally marked it as such to ensure that we can act upon the feedback of our partners and users. We are currently collecting feedback at https://github.com/pytorch/vision/issues/6365 and hoping to promote to stable before TorchVision v0.14. If you have any feedback or feature requests, we would be happy to discuss more.
@datumbox many thanks for raising this. we will have a check on that and get back to you asap