의 단순한 설계가 필요할 때까지 핵심 개념을 감춰주지만 여기서 일부 개념을 조금 자세히 알아
보겠습니다.
14
장에서 배웠던 파이프라인으로 시작해 봅니다.
15.5.1
파이프라인
pipeline
함수는
transformers
의 추상화 중 가장 유용합니다. 최소한의 코드로 복잡한
transformers
연산을 수행할 수 있습니다. 적절한 파이프라인과 기본 매개변수 값을 사용하
여 모델의 기본 기능을 수행하게 하거나 기본 매개변수 값을 재정의하여 기능을 커스터마이징
할 수도 있습니다.
파이프라인은 데이터 전처리부터 모델 추론, 결과 포맷팅까지 모든 머신러닝 처리 단계를 하나
의 함수로 캡슐화합니다.
파이프라인의 강력한 성능을 실제로 확인하기 위해 하나의 예를 들어 보죠.
fromtransformersimportpipeline
# 기본 감성 분석
classifier=pipeline("sentiment-analysis")
result=classifier("I love working with transformers!")
이 경우 모델이 아니라 작업(
sentiment
-
analysis
)
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.