A developer wants to quickly test a pre-trained sentiment analysis model from Hugging Face without writing any model-loading or tokenization code. Which transformers library abstraction is BEST suited for this use case?
- A. AutoTokenizer.from_pretrained()
- B. Trainer()
- C. AutoModel.from_pretrained()
- D. pipeline()✓ Correct
Explanation
pipeline() is correct because it provides a high-level, task-oriented API that automatically handles model loading, tokenization, inference, and post-processing in a single call — ideal for quick testing without boilerplate code. AutoModel.from_pretrained() loads only the model weights and requires manual tokenization and forward-pass logic. AutoTokenizer.from_pretrained() loads only the tokenizer, not the model. Trainer() is used for fine-tuning workflows, not inference.