Summary
In this chapter, we first discussed the different relevant Hugging Face components for PyTorch users. We then established how to use the transformers library (the most important Hugging Face library) together with PyTorch. Next, we learned about the Hugging Face Hub, which provides a wide range of over 650,000 pre-trained models, and used the Hub to load the BERT model for inference. We then explored the Hugging Face datasets library, which gives us access to over 144,000 datasets. We learned how to use it with PyTorch through an example of fine-tuning a pre-trained model.
Next, we learned about the accelerate library from Hugging Face, and how it can be used to speed up PyTorch training code with just five lines of code changes. We then explored the Optimum library from Hugging Face and used it to convert a PyTorch model to an ONNX model. We used the ONNX model for inference using ONNX Runtime. Finally, we used Optimum to quantize the ONNX model into a 4x smaller model...