
This handles Hugging Face's transformers library for working with pre-trained models across NLP, vision, and audio tasks. You get pipelines for quick inference on things like text generation, classification, and question answering, plus lower-level APIs when you need fine-tuning or custom preprocessing. The skill covers the standard workflow: load a model with AutoModel classes, tokenize inputs, run inference or training with the Trainer API. It's comprehensive without being overwhelming, though you'll still need to know which model architecture fits your task. The pipeline API is genuinely convenient for prototyping, and the references break down generation strategies, tokenization, and training patterns clearly enough to get productive fast.
$ npx -y skills add davila7/claude-code-templates --skill transformers --agent claude-codeInstalls into .claude/skills of the current project.
The Hugging Face Transformers library provides access to thousands of pre-trained models for tasks across NLP, computer vision, audio, and multimodal domains. Use this skill to load models, perform inference, and fine-tune on custom data.
Install transformers and core dependencies:
uv pip install torch transformers datasets evaluate accelerate
For vision tasks, add:
uv pip install timm pillow
For audio tasks, add:
uv pip install librosa soundfile
Many models on the Hugging Face Hub require authentication. Set up access:
from huggingface_hub import login
login() # Follow prompts to enter token
Or set environment variable:
export HUGGINGFACE_TOKEN="your_token_here"
Get tokens at: https://huggingface.co/settings/tokens
Use the Pipeline API for fast inference without manual configuration:
from transformers import pipeline
# Text generation
generator = pipeline("text-generation", model="gpt2")
result = generator("The future of AI is", max_length=50)
Sponsors