AGENT SKILL

transformers-library

Work with the Transformers ecosystem — pipelines, tokenizers, model loading, training loops, and the hub. Use when using pretrained models for NLP tasks or fine-tuning.

License 许可
MIT
所属仓库
TanNhatCMS/jarvis
最近更新
2026-11-07
Stars
★ 0
Forks
1

01 前言 Front Matter

name
transformers-library
category
ai-research
description
Work with the Transformers ecosystem — pipelines, tokenizers, model loading, training loops, and the hub. Use when using pretrained models for NLP tasks or fine-tuning.

03 SKILL.md 正文

Transformers Library

The Transformers library is the standard interface to pretrained models: tens of thousands of models behind a uniform API — load any architecture, tokenize correctly, run inference or training with the same patterns.

Overview

Three abstractions do most of the work: tokenizers (text → model inputs, model-specific), models (the architectures, loaded from the hub with matching configs), and pipelines (task-level wrappers: sentiment, QA, summarization). Underneath, the Trainer handles training loops with all the standard machinery. Learn these four and you can use nearly any open model.

When to use

  • Using pretrained models for classification, extraction, generation, or embeddings.
  • Fine-tuning open models on your data.
  • Prototyping NLP features quickly with pipelines.
  • Understanding model architectures through their implementations.

Core concepts

  • Pipelines: one-line task interfaces (sentiment-analysis, question-answering, summarization). Start here for prototyping; drop to models when you need control.
  • Tokenizers: model-specific text processing — always use the tokenizer paired with the model. Mismatched tokenizers silently corrupt inputs. Handle truncation, padding, and special tokens explicitly.
  • Auto classes: AutoModel, AutoTokenizer load the right implementation from the model name. Architecture-agnostic code that works across models.
  • Model loading: from the hub by name, with options for precision (fp16), device mapping, and quantization. Know what device_map and dtype choices do to memory.
  • Trainer: the training loop — data collation, optimization, evaluation, checkpointing, logging. Configure via training arguments; custom callbacks for special needs.
  • The Hub: model versioning, model cards (read them — they document training data and limitations), and community models. Pin revisions for reproducibility.

Practical workflow

  1. Prototype with a pipeline on your data; verify the task framing works before investing.
  2. Move to Auto classes when you need control: load model + matching tokenizer, handle batching yourself.
  3. For fine-tuning: prepare the dataset in the model's expected format, configure Trainer arguments (learning rate, epochs, eval strategy), train with evaluation.
  4. Save and version: model + tokenizer + config together, pinned to a hub revision or local snapshot.
  5. Evaluate on held-out data with task metrics; compare against the pipeline baseline.
  6. For deployment: export to optimized formats (quantized, ONNX) as needed; document the exact model revision.
Standard flow:
pipeline (prototype) → AutoModel + AutoTokenizer (control)
→ Trainer (fine-tune) → save (model+tokenizer+config)
→ evaluate (held-out) → optimize + deploy (pinned revision)

Common pitfalls

  • Tokenizer mismatch: using a generic or wrong tokenizer. Always pair with the model; verify special tokens.
  • Unpinned hub revisions: models update; your results shift. Pin the revision.
  • Padding/truncation bugs: silent corruption from wrong padding side or missing attention masks. Handle explicitly, verify shapes.
  • Trainer defaults: default hyperparameters are starting points, not answers. Tune learning rate and epochs for your data size.
  • Ignoring model cards: training data, biases, and limitations documented there. Read before deploying.
  • GPU memory surprises: models bigger than expected once loaded with optimizer states. Calculate before training; use gradient accumulation and mixed precision.

04 同仓库更多 Skills

TanNhatCMS
TanNhatCMS/jarvis

web-scrape

Turn web pages into LLM-ready markdown via the Firecrawl API (renders JS, anti-bot handling). Use when browser_open/fetch fails on JS-heavy pages, or when you need clean markdown/structured extraction from a site. Requires FIRECRAWL_API_KEY.

★ 0
TanNhatCMS
TanNhatCMS/jarvis

design-taste-frontend

tasteskill v2, the anti-slop frontend skill. Art direction for websites, distilled from a study of 247 curated gallery sites (One Page Love, Awwwards Sites of the Day). Deals researched directions (idea, composition, type, palette, photographs, section blueprints) from a library, enforces a strict no-slop house style with a real-browser inspector, and runs a look-and-fix loop on screenshots. Use this whenever you build, design, redesign, restyle, polish or review a landing page, marketing site, portfolio, product page, one-pager, hero or any public-facing web page, in any stack (HTML/CSS, React, Next.js, Vue, Svelte, Astro, Tailwind) — also when the user says a page looks generic, templated, "AI-made", sloppy, or asks to make it look designed, premium, award-level or less like every other site. Not for dashboards or app screens.

★ 0
TanNhatCMS
TanNhatCMS/jarvis

test-driven-development

Use when implementing any feature or bugfix, before writing implementation code

★ 0
TanNhatCMS
TanNhatCMS/jarvis

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

★ 0
TanNhatCMS
TanNhatCMS/jarvis

requesting-code-review

Use when completing tasks, implementing major features, or before merging to verify work meets requirements

★ 0
TanNhatCMS
TanNhatCMS/jarvis

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).

★ 0