본문으로 건너뛰기
Skillpedia
머신러닝33k · #9038

transformers

하는 일

이 스킬은 에이전트가 Hugging Face Transformers 라이브러리를 사용하도록 안내합니다. 미리 만들어진 AI 모델을 사용하거나 미세 조정하려는 개발자와 데이터 팀을 위한 스킬입니다.

사용하는 경우

  • ✓미리 만들어진 모델로 텍스트를 분류하거나 질문에 답하고 번역하고 싶을 때.
  • ✓이미지에서 객체를 감지하거나 음성을 텍스트로 바꿔야 할 때.
  • ✓사전 학습된 모델을 내 데이터에 맞게 조정하고 싶을 때.

스킬 링크

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/transformers/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/scientific/transformers/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“미리 만들어진 모델을 사용해 고객 이메일을 주제별로 나눠 주실 수 있나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 Hugging Face 라이브러리에서 사전 학습된 모델을 불러와 입력에 실행합니다. 내 예시로 모델을 더 학습시킬 수도 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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:

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

Authentication

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

Quick Start

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)

# 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.

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:

pipe = pipeline("task-name", model="model-id")
output = pipe(input_data)

Pattern 2: Custom Model Usage

For advanced control, load model and tokenizer separately:

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:

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
  • **Toke
자주 묻는 질문

이 모델을 쓰려면 돈을 내야 하나요?

스킬은 비용을 언급하지 않습니다. 많은 모델은 무료지만, 일부는 Hugging Face 로그인 토큰이 필요합니다.

이미지와 오디오도 다룰 수 있나요?

네. 스킬은 비전과 오디오 작업을 다루며, 그런 작업에 필요한 추가 패키지를 나열합니다.

프로그래머여야 하나요?

일부 설정이 필요하지만, 에이전트가 코드를 대신 작성하고 실행할 수 있습니다.

상세 정보

작성자의 원본 설명

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.

repo: davila7/claude-code-templates

인기도

GitHub 스타
33k
순위
#9038
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬