huggingface-transformers

huggingface-transformers is a skill for Claude Code from alivirgo/Major-AI-Skills. It costs 28 tokens per session (865 once invoked), scanned A, original, MIT.

An AI operating guide for Hugging Face Transformers, a software library for using trained machine-learning models. It covers tokenizers, model loading, text and other model pipelines, fine-tuning, and inference.

In plain words
What is it for?
Use it for text classification, named-entity recognition, summarisation, generation, and models that process images or audio.
Why use it?
It helps prevent common model-serving and training mistakes, such as using the wrong input length, loading an unpinned model revision, or running inference in training mode.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Codex.

Part of the major-ai-skills plugin — 147 skills, 7 plugins shipped together

Good fit Use it for text classification, named-entity recognition, summarisation, generation, and models that process images or audio.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alivirgo/major-ai-skills/huggingface-transformers
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add alivirgo/Major-AI-Skills --skill huggingface-transformers
Clone the repo
git clone --depth 1 https://github.com/alivirgo/Major-AI-Skills

Made for: Claude Code.

Or install major-ai-skills, the plugin that ships this one along with the rest of its 147 skills, 7 plugins.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for huggingface-transformers

README.md
[![agentmods](https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/huggingface-transformers/github.svg)](https://agentmods.dev/skills/alivirgo/major-ai-skills/huggingface-transformers)
Your own site
<a href="https://agentmods.dev/skills/alivirgo/major-ai-skills/huggingface-transformers"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/huggingface-transformers/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for huggingface-transformers

Your own site · 80×15
<a href="https://agentmods.dev/skills/alivirgo/major-ai-skills/huggingface-transformers"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/huggingface-transformers.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 865 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00865
Opus 5 $0.00014 $0.00432
Sonnet 5 $0.00006 $0.00173
Haiku 4.5 $0.00003 $0.00086

Measured today against content hash 097d3350c43a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

huggingface-transformers scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/huggingface-transformers/SKILL.md · 105 lines

How it starts

The opening of the file, as written. The whole thing — 105 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Hugging Face Transformers AI Skill Guide

Overview & Engine Architecture

Transformers provides pretrained model configs, tokenizers, and Auto* loaders plus high-level pipeline helpers. Tokenizers map text to tensors; models run on PyTorch/TensorFlow/Flax backends. Agents pin model revisions, respect max sequence lengths, separate train/eval modes, and treat Hub downloads as supply-chain inputs (revision hashes, not floating latest).

Tokenizer -> input_ids / attention_mask
      -> AutoModel* (forward)
          -> logits / generated tokens
          -> decode

When to use this skill

  • NLP classification, NER, summarization, generation
  • Vision/audio models exposed via Transformers APIs
  • Fine-tuning with Trainer or custom @pytorch loops

Operational directives

  1. Pin revision (commit hash) for production model loads.
  2. Use pipeline for prototypes; switch to explicit tokenizer+model for control.
  3. Truncate/pad consistently with the model's max length.
  4. Call model.eval() and torch.inference_mode() for serving paths.
  5. Respect model licenses and data privacy before uploading to the Hub.

Pipeline + explicit inference

from transformers import pipeline, AutoTokenizer, AutoModelForSequenceClassification
import torch

clf = pipeline("text-classification", model="distilbert-base-uncased-finetuned-sst-2-english", revision="main")
print(clf("This deployment looks solid."))

tok = AutoTokenizer.from_pretrained("distilbert-base-uncased-finetuned-sst-2-english")
model = AutoModelForSequenceClassification.from_pretrained(
    "distilbert-base-uncased-finetuned-sst-2-english",
    revision="main",
)
model.eval()
batch = tok(["ship it", "needs work"], return_tensors="pt", padding=True, truncation=True)
with torch.inference_mode():
    logits = model(**batch).logits
    print(logits.softmax(-1))

Fine-tune sketch

from transformers import Trainer, TrainingArguments

args = TrainingArguments(
    output_dir="out/sentiment",
    per_device_train_batch_size=16,
    num_train_epochs=2,
    evaluation_strategy="epoch",
    save_strategy="epoch",
    load_best_model_at_end=True,
)
trainer = Trainer(model=model, args=args, train_dataset=train_ds, eval_dataset=val_ds, tokenizer=tok)
trainer.train()

Read the full file on GitHub · 105 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · -2 tokens per session 097d3350c43a
  2. 6d ago First seen · 105 lines · 30 tokens per session scan A 69df60f7e653

Subscribe to this mod's changes

huggingface-transformers is a skill published in the GitHub repository alivirgo/Major-AI-Skills (1 stars, last pushed yesterday), licensed MIT. It adds 28 tokens to every session and 865 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.

Related

Other skills, from other repositories

transformers-huggingface

Use this skill when the user asks to load, fine-tune, or run inference with pre-trained transformer models using the Hugging Face transformers library. Triggers include requests like "classify this text with BERT", "fine-tune GPT-2 on my dataset", "build a text summarization pipeline", "tokenize text for…

lucifertrj/skills-based-app · 139 tokens

nlp

Use when choosing how to tokenize text or which transformer type fits an NLP task, when a tokenizer over-fragments non-English text or inflates token cost, when picking a language metric, or when classification, NER or summarization output looks wrong and it is unclear whether the tokenizer, the architecture or the…

ericrisco/rsc-harness · 142 tokens

huggingface

Use when running open models or working on the Hugging Face platform — the Inference Providers router or InferenceClient, Hub repos via the hf CLI, a dedicated Inference Endpoint with scale-to-zero, a Gradio Space with ZeroGPU, picking an open model by task/license/size, or loading one locally with transformers. NOT…

ericrisco/rsc-harness · 131 tokens

huggingface-hub

Hugging Face Hub — model discovery, download, inference, and upload.

furkangonel/cowrangler · 22 tokens

llama-factory

Expert guidance for fine-tuning LLMs with LLaMA-Factory - WebUI no-code, 100+ models, 2/3/4/5/6/8-bit QLoRA, multimodal support.

davila7/claude-code-templates · 51 tokens

mlflow

Track ML experiments, manage model registry with versioning, deploy models to production, and reproduce experiments with MLflow - framework-agnostic ML lifecycle platform.

davila7/claude-code-templates · 33 tokens