Reproducibility is an essential part of machine learning research which confirms whether a proposed model achieves the performance promised. When researchers submit new papers, they usually open-source the code and parameters of their pretrained models on GitHub to enable others to see whether they can achieve the published experiment results. A number of time-consuming steps are however involved in loading models for reproducibility testing.

In a bid to provide a smoother reproduction experience, Facebook has announced the beta release of PyTorch Hub, a new pretrained model repository designed to facilitate research reproducibility testing. PyTorch is one of the most favoured machine learning frameworks due to its unparalleled flexibility and power. Facebook released PyTorch v1.1 with key features including TensorBoard and JIT compiler at last month’s F8 Developer Conference.

PyTorch Hub allows users to publish models by sending a pull request, and load models with just one line of code. Below are specific description of PyTorch Hub’s key features:

Publishing models: PyTorch Hub supports publishing pretrained models (model definitions and pretrained weights) to a GitHub repository by adding a simple hubconf.py file, which provides a list of supported models and dependencies needed to run the models.

After researchers send a pull request, the Facebook PyTorch team will help refine their pull request and decide whether to accept it. The accepted publishing models will eventually show up on PyTorch Hub webpage.

Loading models: Users can load pre-trained models using torch.hub.load() API. Below is the code to load the resnet18 entrypoint from the pytorch/vision repo.

model = torch.hub.load('pytorch/vision', 'resnet18', pretrained=True)

PyTorch Hub currently accommodates 18 high-profile machine learning models, including Google’s Bidirectional Encoder Representations from Transformers (BERT) reimplemented by Hugging Face, and Progressive Growing of GANs (PGANs) by Facebook AI Research. Users can also view these and other models on Colab and Papers With Code. Facebook says PyTorch Hub will soon also provide developers with plug-and-play models to further accelerate machine learning model reproducibility testing and development.

Further information is available on the PyTorch Hub project page.