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.
npx skills add znlgis/opengis-skills --skill huggingface-transformersgit clone --depth 1 https://github.com/znlgis/opengis-skillsWrote 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.
[](https://agentmods.dev/skills/znlgis/opengis-skills/huggingface-transformers)<a href="https://agentmods.dev/skills/znlgis/opengis-skills/huggingface-transformers"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-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.
<a href="https://agentmods.dev/skills/znlgis/opengis-skills/huggingface-transformers"><img src="https://agentmods.dev/badge/skills/znlgis/opengis-skills/huggingface-transformers.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00086 | $0.04427 |
| Opus 5.5 | $0.00034 | $0.01771 |
| Sonnet 5.5 | $0.00017 | $0.00885 |
| Haiku 4.5 | $0.00009 | $0.00443 |
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.
How it starts
The opening of the file, as written. The whole thing — 360 lines — stays where its author put it; the contents beside it link to each section on GitHub.
项目地址: https://github.com/huggingface/transformers
官方文档: https://huggingface.co/docs/transformers/
许可证: Apache-2.0 最新版本: v5.19.0(PyPI 与 GitHub Releases 双核实,截至 2026-10)
概述
Transformers 是 Hugging Face 开源的模型定义框架,为文本、视觉、音频与多模态模型提供统一的推理与训练接口。它把「配置、模型、预处理器」抽象为三类基类,并只用 pipeline 与 Trainer 两个 API 覆盖推理与微调两条主线。模型权重托管在 Hugging Face Hub,from_pretrained() 可按名称或路径自动下载并缓存。
- AutoClass:
AutoModel/AutoTokenizer/AutoModelForCausalLM/AutoModelForSequenceClassification/AutoModelForSeq2SeqLM等按任务自动推断架构 - pipeline():任务级推理封装,一行完成预处理、前向与后处理
- Trainer:PyTorch 训练/评估循环,配合
TrainingArguments配置超参 - 显存管理:
device_map="auto"、dtype="auto"、BitsAndBytesConfig量化 - 生态:
datasets、evaluate、accelerate、huggingface_hub、safetensors协同工作
Transformers 是库(进程内推理/训练),与 Ollama 这类独立推理服务定位不同,详见「最佳实践」。
环境准备
要求 Python >= 3.10(v5 起)。
# 核心:Transformers 与 PyTorch
pip install -U transformers torch
# 常用配套:数据集、评估指标、多设备调度
pip install -U datasets evaluate accelerate
可选 GPU 加速:
# NVIDIA CUDA(按显卡驱动选择 cu 版本,示例)
pip install torch --index-url https://download.pytorch.org/whl/cu124
量化推理(8bit/4bit)需额外安装:
pip install -U bitsandbytes
验证安装:
python -X utf8 -c "import torch, transformers; print(transformers.__version__, torch.__version__, torch.cuda.is_available())"
登录 Hub(拉取受限模型或推送模型时需要,Token 从账号设置生成):
hf auth login
核心 API/命令
pipeline() 快速推理
pipeline(task, model=..., device=..., dtype=...) 返回任务流水线;不传 model 时使用该任务的默认模型。
from transformers import pipeline
# 文本分类(情感分析别名 sentiment-analysis)
clf = pipeline("text-classification", model="distilbert/distilbert-base-uncased-finetuned-sst-2-english")
clf("This restaurant is awesome")
# [{'label': 'POSITIVE', 'score': 0.9998...}]
# 文本生成
gen = pipeline("text-generation", model="openai-community/gpt2")
gen("the secret to baking a good cake is", max_new_tokens=40, return_full_text=False)
# 特征抽取(嵌入)
feat = pipeline("feature-extraction", model="BAAI/bge-large-zh-v1.5")
feat("地理信息系统")
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.
- today First seen · 360 lines · 86 tokens per session scan A 19b1348b45d0
huggingface-transformers is a skill published in the GitHub repository znlgis/opengis-skills (64 stars, last pushed yesterday), licensed MIT. It adds 86 tokens to every session and 4,427 once invoked, about $0.0003 per session on Opus 5.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-10-16.
Other skills, from other repositories
huggingface-transformers
Use Hugging Face Transformers pipelines, tokenizers, and AutoModel interfaces for inference and fine-tuning workflows.
llm-ops
LLM Operations -- RAG, embeddings, vector databases, fine-tuning, prompt engineering avancado, custos de LLM, evals de qualidade e arquiteturas de IA para producao.
huggingface-hub
Hugging Face Hub — model discovery, download, inference, and upload.
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…
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.
autorag-setup
Install and configure AutoRAG, register its Lite MCP server for external agents, or repair its single search model, approved roots, indexes, datasources, and health checks without exposing credentials. Use when AutoRAG or MCP is missing, init/refresh/health fails, indexes are stale, or the user wants to add folders or…