Views
No views yet
classla/xlm-roberta-base-multilingual-text-genre-classifier 모델을 기반으로 한 텍스트 분류 파이프라인입니다.transformers 라이브러리의 pipeline 기능을 사용하여 생성되었습니다. 아래와 같이 텍스트 리스트를 입력하여 각 텍스트의 장르를 예측할 수 있습니다.1from transformers import pipeline, AutoModelForSequenceClassification, AutoTokenizer
2
3# 모델 및 토크나이저 로드
4model_name = "classla/xlm-roberta-base-multilingual-text-genre-classifier"
5model = AutoModelForSequenceClassification.from_pretrained(model_name, trust_remote_code=True)
6tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True, use_fast=False)
7
8# 파이프라인 생성
9pipeline = pipeline("text-classification", model=model, tokenizer=tokenizer)
10
11# 예측 예시
12text = [
13 "나는 의공학과 학생으로, 4학년 1학기를 진행중이다.",
14 "gemini와 chatgpt의 다른 점은 encoder 기반이냐 decoder 기반이냐이다.",
15]
16
17output = pipeline(text)
18print(output)[{'label': 'Opinion/Argumentation', 'score': 0.5527392029762268}, {'label': 'Information/Explanation', 'score': 0.9898243546485901}]classla/xlm-roberta-base-multilingual-text-genre-classifier의 학습 데이터 및 평가 지표를 요약하여 작성할 수 있습니다. Hugging Face 모델 페이지를 참조하세요.)