Agent skill

Hugging Face Transformers Usage

by davila7 in davila7/claude-code-templates

Loads pre-trained Hugging Face Transformers models for text, vision and audio tasks, runs inference with pipelines and fine-tunes on custom datasets.

MITAuto-check passedAI & LLM Engineering

Install Hugging Face Transformers Usage

skills CLI
$ npx skills add davila7/claude-code-templates --skill transformers -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install davila7/claude-code-templates transformers --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .claude/skills && cp -r skills-src/cli-tool/components/skills/scientific/transformers .claude/skills/transformers && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
transformers
GitHub stars
32k
Used in
12 other repos
Token cost
~1.2k tokens
SKILL.md length
359 words
Files
6 (incl. references)
Skills in repo
477
Repo updated
First seen
Licence
MIT

At a glance

Loads pre-trained Hugging Face Transformers models for text, vision and audio tasks, runs inference with pipelines and fine-tunes on custom datasets.

  • Works in 5 steps: Pipelines for Quick Inference → Model Loading and Management → Text Generation → …
  • Running a pre-trained model for classification, NER or question answering
  • SKILL.md covers Overview, Installation, Authentication and Quick Start, plus 3 more sections
  • Calls uv; needs HUGGINGFACE_TOKEN

What it does

This skill covers the Hugging Face Transformers library across NLP, computer vision, audio and multimodal tasks. It starts with installing torch, transformers, datasets, evaluate and accelerate, with extra packages for vision (timm, pillow) and audio (librosa, soundfile), and explains logging in to the Hugging Face Hub or setting a token for models that require authentication.

The agent is pointed to pipelines for quick inference on tasks like text generation, classification, NER, question answering, summarization, translation, image classification, object detection and audio classification, and to fuller model loading with control over device placement and precision. Text generation covers greedy, beam search and sampling decoding with temperature, top-k and top-p, and fine-tuning uses the Trainer API with mixed precision, distributed training and logging. Separate reference files cover pipelines, models, generation, tokenizers and training.

When your agent uses it

  • Running a pre-trained model for classification, NER or question answering
  • Generating text with a chosen decoding strategy and sampling settings
  • Fine-tuning a pre-trained model on a custom dataset with the Trainer API
  • Running image classification, object detection or speech recognition models

Example prompts

  • “Use a Transformers pipeline to classify the sentiment of every row in reviews.csv.”
  • “Fine-tune a small text classification model on my labeled tickets and report accuracy.”
  • “Generate three completions for this prompt with beam search and compare them.”

Requirements

  • Python with torch, transformers, datasets, evaluate and accelerate
  • A Hugging Face access token for models that need authentication
  • timm and pillow for vision, librosa and soundfile for audio (optional)

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Pipelines for Quick Inference
  2. Model Loading and Management
  3. Text Generation
  4. Training and Fine-Tuning
  5. Tokenization

What it can do on your machine

Read from SKILL.md and the folder at commit 4c82aba. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • huggingface.co

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • HUGGINGFACE_TOKEN

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Hugging Face Transformers Usage loads about 1.2k tokens when it runs, and up to ~13k if it reads all its reference files. Until then it costs about 89 tokens; SKILL.md has 359 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~89
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~13k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from davila7/claude-code-templates at commit 4c82aba, republished under its MIT licence (© davila7). 359 words, ~1,239 tokens.

Download SKILL.mdSave it as .claude/skills/transformers/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.
name
transformers
description
This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.

Transformers

Overview

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.

Installation

Install transformers and core dependencies:

bash
uv pip install torch transformers datasets evaluate accelerate

For vision tasks, add:

bash
uv pip install timm pillow

For audio tasks, add:

bash
uv pip install librosa soundfile

Authentication

Many models on the Hugging Face Hub require authentication. Set up access:

python
from huggingface_hub import login
login()  # Follow prompts to enter token

Or set environment variable:

bash
export HUGGINGFACE_TOKEN="your_token_here"

Get tokens at: https://huggingface.co/settings/tokens

Quick Start

Use the Pipeline API for fast inference without manual configuration:

python
from transformers import pipeline

# Text generation
generator = pipeline("text-generation", model="gpt2")
result = generator("The future of AI is", max_length=50)

# Text classification
classifier = pipeline("text-classification")
result = classifier("This movie was excellent!")

# Question answering
qa = pipeline("question-answering")
result = qa(question="What is AI?", context="AI is artificial intelligence...")

Core Capabilities

1. Pipelines for Quick Inference

Use for simple, optimized inference across many tasks. Supports text generation, classification, NER, question answering, summarization, translation, image classification, object detection, audio classification, and more.

When to use: Quick prototyping, simple inference tasks, no custom preprocessing needed.

See references/pipelines.md for comprehensive task coverage and optimization.

2. Model Loading and Management

Load pre-trained models with fine-grained control over configuration, device placement, and precision.

When to use: Custom model initialization, advanced device management, model inspection.

See references/models.md for loading patterns and best practices.

3. Text Generation

Generate text with LLMs using various decoding strategies (greedy, beam search, sampling) and control parameters (temperature, top-k, top-p).

When to use: Creative text generation, code generation, conversational AI, text completion.

See references/generation.md for generation strategies and parameters.

Show full SKILL.md (147 more words)Show less
4. Training and Fine-Tuning

Fine-tune pre-trained models on custom datasets using the Trainer API with automatic mixed precision, distributed training, and logging.

When to use: Task-specific model adaptation, domain adaptation, improving model performance.

See references/training.md for training workflows and best practices.

5. Tokenization

Convert text to tokens and token IDs for model input, with padding, truncation, and special token handling.

When to use: Custom preprocessing pipelines, understanding model inputs, batch processing.

See references/tokenizers.md for tokenization details.

Common Patterns

Pattern 1: Simple Inference

For straightforward tasks, use pipelines:

python
pipe = pipeline("task-name", model="model-id")
output = pipe(input_data)
Pattern 2: Custom Model Usage

For advanced control, load model and tokenizer separately:

python
from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("model-id")
model = AutoModelForCausalLM.from_pretrained("model-id", device_map="auto")

inputs = tokenizer("text", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=100)
result = tokenizer.decode(outputs[0])
Pattern 3: Fine-Tuning

For task adaptation, use Trainer:

python
from transformers import Trainer, TrainingArguments

training_args = TrainingArguments(
    output_dir="./results",
    num_train_epochs=3,
    per_device_train_batch_size=8,
)

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=train_dataset,
)

trainer.train()

Reference Documentation

For detailed information on specific components:

  • Pipelines: references/pipelines.md - All supported tasks and optimization
  • Models: references/models.md - Loading, saving, and configuration
  • Generation: references/generation.md - Text generation strategies and parameters
  • Training: references/training.md - Fine-tuning with Trainer API
  • Tokenizers: references/tokenizers.md - Tokenization and preprocessing

© davila7, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 5 other files (references) in cli-tool/components/skills/scientific/transformers of davila7/claude-code-templates.

  • SKILL.md
  • references/generation.md
  • references/models.md
  • references/pipelines.md
  • references/tokenizers.md
  • references/training.md

Open the folder on GitHubat commit 4c82aba

Used in 12 other repositories

We found 24 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 12 other GitHub owners. This page covers the copy in davila7/claude-code-templates, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Hugging Face Transformers Usage next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Hugging Face Transformers Usage compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Hugging Face Transformers Usage this skilldavila7/claude-code-templates32k12 repos~1.2kAutomated safety check: PassMIT
Hugging Face Vision Trainerhuggingface/skills11k1 repos~7.5kAutomated safety check: PassApache-2.0
Transformers.jshuggingface/skills11k1 repos~6.2kAutomated safety check: PassApache-2.0
Hugging Face TokenizersOrchestra-Research/AI-Research-SKILLs13k7 repos~3.4kAutomated safety check: PassMIT
bitsandbytes Model QuantizationOrchestra-Research/AI-Research-SKILLs13k3 repos~2.5kAutomated safety check: PassMIT
Huggingface Vision Trainerwaybarrios/opencode-power-pack533—~2.7kAutomated safety check: PassApache-2.0

Similar skills

  • Hugging Face Vision Trainer

    huggingface/skills

    Official

    Trains and fine-tunes object detection, image classification and SAM or SAM2 segmentation models on Hugging Face Jobs cloud GPUs and saves the results to the Hub.

    11k GitHub starsUsed in 1 repo~7.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Transformers.js

    huggingface/skills

    Official

    Runs pre-trained Hugging Face models in JavaScript or TypeScript with Transformers.js, in browsers or Node.js, Bun and Deno, for text, vision, audio and multimodal tasks.

    11k GitHub starsUsed in 1 repo~6.2k tokens
    AI & LLM EngineeringAuto-check passed
  • Hugging Face Tokenizers

    Orchestra-Research/AI-Research-SKILLs

    Shows how to load, train and use fast Hugging Face tokenizers, with BPE, WordPiece and Unigram models, padding, truncation and alignment tracking.

    13k GitHub starsUsed in 7 repos~3.4k tokens
    AI & LLM EngineeringAuto-check passed
  • bitsandbytes Model Quantization

    Orchestra-Research/AI-Research-SKILLs

    Loads large language models in 8-bit or 4-bit with bitsandbytes so they fit smaller GPUs, and sets up QLoRA fine-tuning on a 4-bit base model.

    13k GitHub starsUsed in 3 repos~2.5k tokens
    AI & LLM EngineeringAuto-check passed
  • Huggingface Vision Trainer

    waybarrios/opencode-power-pack

    Train object-detection, image-classification, or SAM segmentation models on Hugging Face Jobs.

    533 GitHub stars~2.7k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Huggingface Spaces

    huggingface/skills

    Official

    Build, deploy, and maintain applications on Hugging Face Spaces — Gradio / Docker / Static SDKs, ZeroGPU and dedicated hardware, model loading, debugging, buckets, inference providers, community…

    11k GitHub starsUsed in 1 repo~4.4k tokens
    AI & LLM EngineeringAuto-check passed

More from davila7/claude-code-templates

All 477 skills in this repo
  • Perplexity Web Search

    davila7/claude-code-templates

    Runs web-grounded searches through Perplexity's Sonar models over OpenRouter for current events, recent literature and cited facts beyond the model's training cutoff.

    32k GitHub starsUsed in 12 repos~3.5k tokens
    Auto-check: notes
  • Neuropixels Data Analysis

    davila7/claude-code-templates

    Analyzes Neuropixels recordings from SpikeGLX or Open Ephys through preprocessing, drift correction, Kilosort4 spike sorting, quality metrics and curation.

    32k GitHub starsUsed in 10 repos~2.8k tokens
    Auto-check passed
  • Scientific Venue Templates

    davila7/claude-code-templates

    Supplies LaTeX templates and formatting rules for journals, conferences, posters, and grant proposals, then can check a draft against them.

    32k GitHub starsUsed in 9 repos~5.1k tokens
    Auto-check: notes
  • Brand Voice Content Creator

    davila7/claude-code-templates

    Analyzes a brand's existing writing to lock in a consistent voice, then builds SEO blog posts and platform-specific social content around it.

    32k GitHub starsUsed in 2 repos~1.9k tokens
    Auto-check passed
  • CAPA Officer

    davila7/claude-code-templates

    Guides corrective and preventive action (CAPA) work in a quality management system, from initiation and root cause analysis through effectiveness verification.

    32k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Fda Consultant Specialist

    davila7/claude-code-templates

    Senior FDA consultant and specialist for medical device companies including HIPAA compliance and requirement management.

    32k GitHub starsUsed in 1 repo~2.7k tokens
    Auto-check passed

Questions about Hugging Face Transformers Usage

What does Hugging Face Transformers Usage do?

Loads pre-trained Hugging Face Transformers models for text, vision and audio tasks, runs inference with pipelines and fine-tunes on custom datasets. This skill covers the Hugging Face Transformers library across NLP, computer vision, audio and multimodal tasks. It starts with installing torch, transformers, datasets, evaluate and accelerate, with extra packages for vision (timm, pillow) and audio (librosa, soundfile), and explains logging in to the Hugging Face Hub or setting a token for models that require authentication.

When should I use Hugging Face Transformers Usage?

Hugging Face Transformers Usage fits situations like: running a pre-trained model for classification, NER or question answering; generating text with a chosen decoding strategy and sampling settings; fine-tuning a pre-trained model on a custom dataset with the Trainer API; running image classification, object detection or speech recognition models.

How do I install Hugging Face Transformers Usage in Claude Code?

Run `npx skills add davila7/claude-code-templates --skill transformers -a claude-code`. Or copy the skill folder (cli-tool/components/skills/scientific/transformers in davila7/claude-code-templates) into .claude/skills/transformers in your project. Claude Code loads it when a task matches its description.

How do I install Hugging Face Transformers Usage in Codex?

Run `npx skills add davila7/claude-code-templates --skill transformers -a codex`. Or copy the skill folder (cli-tool/components/skills/scientific/transformers in davila7/claude-code-templates) into .agents/skills/transformers in your project. Codex loads it when a task matches its description.

Can I use Hugging Face Transformers Usage in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davila7/claude-code-templates --skill transformers -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/transformers, .gemini/skills/transformers, .github/skills/transformers and .opencode/skills/transformers in your project.

What does Hugging Face Transformers Usage need to run?

Going by SKILL.md and its folder, Hugging Face Transformers Usage needs the command-line tools its instructions call (uv) and credentials named HUGGINGFACE_TOKEN. Our summary lists: Python with torch, transformers, datasets, evaluate and accelerate; A Hugging Face access token for models that need authentication; timm and pillow for vision, librosa and soundfile for audio (optional).

Does Hugging Face Transformers Usage access the network?

SKILL.md names 1 domain. As links in the text: huggingface.co. This is read from the text; nothing was executed.

Is Hugging Face Transformers Usage safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Hugging Face Transformers Usage use?

Hugging Face Transformers Usage is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Hugging Face Transformers Usage use?

About 1.2k tokens (SKILL.md is roughly 5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 12k tokens, read only when the agent opens those files.

What are the alternatives to Hugging Face Transformers Usage?

Skills that share tags, products or a category with Hugging Face Transformers Usage: Hugging Face Vision Trainer (huggingface/skills, 11k stars), Transformers.js (huggingface/skills, 11k stars), Hugging Face Tokenizers (Orchestra-Research/AI-Research-SKILLs, 13k stars) and bitsandbytes Model Quantization (Orchestra-Research/AI-Research-SKILLs, 13k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Hugging Face Transformers Usage?

davila7 (a GitHub user) maintains it in davila7/claude-code-templates, which has 32,432 GitHub stars. The repository holds 477 skills in this directory. The repository was last updated on October 7, 2026.

Source: davila7/claude-code-templates on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.