Skip to main content

7 posts tagged with "Transformers"

Hugging Face Transformers, the Python Library for Pretrained Models, Pipelines, Tokenizers and Fine-Tuning

View All Tags

Hugging Face Transformers Tutorial for NLP in Python — Part 1: Install Transformers and Run Your First Pipeline

· 30 min read
Jagdish Kumawat
Founder @ Dewiride

Hugging Face Transformers gives you thousands of pretrained language models and a few lines of Python to use them. In this first part you install Transformers and PyTorch, run your first pipeline on your computer's GPU, and build the first version of a project the whole series grows: a router that reads a customer's support message and decides what it's about.

How to Choose the Device a Hugging Face Pipeline Runs On

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

A Hugging Face pipeline can run its model on the main processor (CPU) or on a graphics processor (GPU), which is usually much faster. Transformers 5 picks the GPU for you when there is one, and the device argument overrides it. This guide shows what the pipeline picks on an Apple M1 Pro, how to force the CPU, and which setting fails on a Mac.

Fixed: "No model was supplied, defaulted to distilbert/distilbert-base-uncased-finetuned-sst-2-english"

· 6 min read
Jagdish Kumawat
Founder @ Dewiride

A Hugging Face sentiment-analysis pipeline worked, but first printed No model was supplied, defaulted to distilbert/distilbert-base-uncased-finetuned-sst-2-english and revision 714eb0f. and Using a pipeline without specifying a model name and revision in production is not recommended. Naming the model and its revision in the code makes the warning go away, and makes the code safe to run in production.

How to Classify Text into Your Own Labels with Zero-Shot Classification

· 8 min read
Jagdish Kumawat
Founder @ Dewiride

Zero-shot classification sorts text into labels you choose when you call it, such as "sports", "politics" and "technology", without training a model on them first. It works by asking a model trained for natural language inference whether each label fits the text. This guide classifies headlines with Hugging Face Transformers 5.24.1 and facebook/bart-large-mnli, and shows how the two main options change the scores.