C.W.K.
Stream
Lesson 01 of 06 · published

설치, 그리고 백엔드 셋의 현실

~25 min · transformers, install

Level 0스카우트
0 XP0/50 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

백엔드 셋, 라이브러리 하나

transformers 라이브러리는 PyTorch (디폴트), TensorFlow, JAX/Flax 를 타겟해. 2026 년에 reach for 할 백엔드는 PyTorch 하나야 — 특정 이유 없으면. TF 는 upstream maintenance 모드, JAX/Flax 는 살아있지만 리서치용 niche. Apple Silicon 에선 PyTorch + MPS 가 디폴트; 진지한 로컬 인퍼런스엔 MLX 백엔드 (transformers 와 별개) 가 메모리에서 이김.

설치할 거:

  • transformers — 모델 클래스, 토크나이저, 파이프라인.
  • torch — 백엔드. 하드웨어 (CUDA, MPS, CPU) 맞는 wheel 골라.
  • accelerate — multi-GPU / mixed-precision / device_map auto 에 필수.
  • safetensors — safe weight format. 모던 transformers 에 번들.
  • Optional: 8/4-bit 양자화엔 bitsandbytes, LoRA 엔 peft, 데이터 로딩엔 datasets.

transformers-cli env 로 설치 검증

“왜 느려” 디버깅하기 전에, transformers-cli env 돌려. 출력이 “CUDA 가 진짜 동작하나” 티켓 80% 의 답이야 — platform, Python, transformers, torch 버전; CUDA / MPS 가용 여부; GPU 이름. 어떤 버그 리포트든 거기 paste.

Code

플랫폼별로 transformers 정확하게 깔기·bash
# Linux + CUDA
pip install --upgrade torch  # 시스템 CUDA 버전 매치
pip install --upgrade transformers accelerate safetensors

# macOS Apple Silicon (MPS)
pip install --upgrade torch torchvision torchaudio
pip install --upgrade transformers accelerate safetensors

# 검증
python -c "import torch; print('cuda:', torch.cuda.is_available(), 'mps:', torch.backends.mps.is_available())"
transformers-cli env
최소 smoke test·python
from transformers import pipeline

# 빠른 iteration 위한 tiny BERT. 초 단위 로드.
pipe = pipeline("text-classification", model="prajjwal1/bert-tiny")
print(pipe("Hugging Face is the GitHub of AI."))
# [{'label': 'LABEL_0', 'score': 0.5...}]

External links

Exercise

Fresh venv 셋업. 플랫폼 매치되는 transformers + torch 깔아. transformers-cli env 돌려서 출력 저장. bert-tiny smoke test 돌려. 그다음 meta-llama/Llama-3.2-1B-Instruct (또는 Llama 가 gated 면 1B 급 apache/mit license 모델) 를 pipeline('text-generation', ...) 로 로드해서 짧은 문장 생성.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.