Hugging Face Transformers is a Python library and model hub for trying pretrained Transformer models locally. It offers models for tasks such as sentiment classification, image captioning, visual question answering, and speech-to-text. section 8.4.1 section 8.4.2
A practical workflow is:
- Browse the model repository and filter models by the task you need. section 8.4.1
- Read a model’s description, associated papers, code samples, and hardware guidance before trying it. section 8.4.1
- Install Transformers and its PyTorch dependency, then import the library with import transformers. section 8.4.2
- Use a pipeline to connect a selected model with an input and obtain a task-specific result. section 8.4.2
Classify a review
A sentiment pipeline can use Cardiff University’s RoBERTa model: create the pipeline with model='cardiffnlp/twitter-roberta-base-sentiment-latest', pass it a review, and print the result. Running it on “This movie was really awful!” produces a negative label with a score of about 0.94. The first run automatically downloads the model from the public repository. section 8.4.2
Figure 8.4 Overview of Hugging Face Transformer models. Click the Tasks filters to narrow the selec-tion. Click models in the Models list to see details.
Use the model browser to narrow a very large catalog by task and inspect candidate models. section 8.4.1





