pip install refuel-autolabel
https://docs.refuel.ai/
크고 깨끗하며 다양한 라벨링 된 데이터 세트에 대한 액세스는 모든 기계 학습 노력의 성공을위한 중요한 구성 요소입니다. GPT-4와 같은 최첨단 LLM은 수동 라벨링에 비해 정확도가 높은 정확도와 비용의 일부로 데이터를 자동으로 레이블을 지정할 수 있습니다.
Autolabel은 선택한 LLM (Lange Language Model)을 사용하여 텍스트 데이터 세트를 라벨, 청소 및 강화하는 Python 라이브러리입니다.
기술 보고서를 확인하여 벤치 마크에서 Repuelllm-V2의 성능에 대해 자세히 알아보십시오. 아래 단계를 따라 벤치 마크를 직접 복제 할 수 있습니다.
cd autolabel / benchmark
curl https : // autolabel - benchmarking . s3 . us - west - 2. amazonaws . com / data . zip - o data . zip
unzip data . zip
python benchmark . py - - model $ model - - base_dir benchmark - results
python results . py - - eval_dir benchmark - results
cat results . csv $ 모델을 벤치마킹 해야하는 모델의 이름으로 대체하여 관련 모델을 벤치마킹 할 수 있습니다. gpt-3.5-turbo , gpt-4-1106-preview , claude-3-opus-20240229 , gemini-1.5-pro-preview-0409 와 같은 API 호스팅 모델 인 경우 모델 이름 만 쓰십시오. 벤치마킹 될 모델이 VLLM 지원 모델 인 경우 모델에 해당하는 로컬 경로 또는 Huggingface 경로를 전달하십시오. 이것은 모든 모델에 대해 동일한 프롬프트와 함께 벤치 마크를 실행합니다.
results.csv 에는 행으로 벤치마킹 된 모든 모델이있는 행이 포함됩니다. 예를 들어 benchmark/results.csv 참조하십시오.
Autolabel은 데이터 라벨링을위한 간단한 3 단계 프로세스를 제공합니다.
영화 검토에 대한 감정 분석을 분석하기 위해 ML 모델을 구축하고 있다고 상상해 봅시다. 먼저 레이블을 지정하고 싶은 영화 리뷰 데이터 세트가 있습니다. 이 경우 예제 데이터 세트 및 구성의 모습은 다음과 같습니다.
{
"task_name" : "MovieSentimentReview" ,
"task_type" : "classification" ,
"model" : {
"provider" : "openai" ,
"name" : "gpt-3.5-turbo"
},
"dataset" : {
"label_column" : "label" ,
"delimiter" : ","
},
"prompt" : {
"task_guidelines" : "You are an expert at analyzing the sentiment of movie reviews. Your job is to classify the provided movie review into one of the following labels: {labels}" ,
"labels" : [
"positive" ,
"negative" ,
"neutral"
],
"few_shot_examples" : [
{
"example" : "I got a fairly uninspired stupid film about how human industry is bad for nature." ,
"label" : "negative"
},
{
"example" : "I loved this movie. I found it very heart warming to see Adam West, Burt Ward, Frank Gorshin, and Julie Newmar together again." ,
"label" : "positive"
},
{
"example" : "This movie will be played next week at the Chinese theater." ,
"label" : "neutral"
}
],
"example_template" : "Input: {example} n Output: {label}"
}
}라벨링 에이전트를 초기화하고 구성을 전달하십시오.
from autolabel import LabelingAgent , AutolabelDataset
agent = LabelingAgent ( config = 'config.json' )LLM으로 전송되는 예제 프롬프트 미리보기 :
ds = AutolabelDataset ( 'dataset.csv' , config = config )
agent . plan ( ds )이 인쇄물 :
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100/100 0:00:00 0:00:00
┌──────────────────────────┬─────────┐
│ Total Estimated Cost │ $0.538 │
│ Number of Examples │ 200 │
│ Average cost per example │ 0.00269 │
└──────────────────────────┴─────────┘
─────────────────────────────────────────
Prompt Example:
You are an expert at analyzing the sentiment of movie reviews. Your job is to classify the provided movie review into one of the following labels: [positive, negative, neutral]
Some examples with their output answers are provided below:
Example: I got a fairly uninspired stupid film about how human industry is bad for nature.
Output:
negative
Example: I loved this movie. I found it very heart warming to see Adam West, Burt Ward, Frank Gorshin, and Julie Newmar together again.
Output:
positive
Example: This movie will be played next week at the Chinese theater.
Output:
neutral
Now I want you to label the following example:
Input: A rare exception to the rule that great literature makes disappointing films.
Output:
─────────────────────────────────────────────────────────────────────────────────────────
마지막으로 데이터 세트의 서브 세트 또는 전체에서 레이블을 실행할 수 있습니다.
ds = agent . run ( ds )출력 데이터 프레임에는 레이블 열이 포함됩니다.
ds . df . head ()
text ... MovieSentimentReview_llm_label
0 I was very excited about seeing this film , ant ... ... negative
1 Serum is about a crazy doctor that finds a ser ... ... negative
4 I loved this movie . I knew it would be chocked ... ... positive
...급유는 라벨링을위한 호스팅 된 오픈 소스 LLM에 대한 액세스를 제공하며, 신뢰를 추정하는 것은 라벨링 작업에 대한 신뢰 임계 값을 보정 한 다음 자신감있는 라벨을 인간에게 덜 배치 할 수 있지만 여전히 자신감있는 예제에 대한 자동 표시의 이점을 얻을 수 있기 때문에 도움이됩니다.
급유 호스팅 LLM을 사용하려면 여기에서 액세스를 요청할 수 있습니다.
Autolabel 라이브러리의 진행중인 개선 및 계획 개선에 대한 자세한 내용은 공개 로드맵을 확인하십시오.
우리는 항상 지역 사회의 제안과 기여를 찾고 있습니다. 불화에 대한 토론에 참여하거나 GitHub 문제를 열어 버그 및 요청 기능을보고하십시오.
Autolabel은 빠르게 발전하는 프로젝트입니다. 우리는 모든 형태의 기부금을 환영합니다 - 버그 보고서, 풀 요청 및 도서관 개선을위한 아이디어.