Usage

# import library
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification, TextClassificationPipeline

# load model
tokenizer = AutoTokenizer.from_pretrained("Copycats/koelectra-base-v3-generalized-sentiment-analysis")
model = AutoModelForSequenceClassification.from_pretrained("Copycats/koelectra-base-v3-generalized-sentiment-analysis")
sentiment_classifier = TextClassificationPipeline(tokenizer=tokenizer, model=model)

# target reviews
review_list = [
    '이쁘고 μ’‹μ•„μš”~~~씻기도 νŽΈν•˜κ³  아이고 μ΄μ˜λ‹€κ³  μžκΈ°λ°©μ— 갖닀놓고 μž˜μ¨μš”~^^',
    '아직 μž…μ–΄λ³΄μ§„ μ•Šμ•˜μ§€λ§Œ ꡉμž₯히 κ°€λ²Όμ›Œμš”~~ λ‹€λ₯Έ 리뷰처럼 어깑이 μ’€ λ˜λ„€μš”γ…‹ λ§Œμ‘±ν•©λ‹ˆλ‹€. μ—„μ²­ λΉ λ₯Έλ°œμ†‘ κ°μ‚¬λ“œλ €μš” :)',
    '재ꡬ맀 ν•œκ±΄λ° λ„ˆλ¬΄λ„ˆλ¬΄ 가성비인거 κ°™μ•„μš”!! λ‹€μŒμ— 또 μƒκ°λ‚˜λ©΄ 3개째 또 μ‚΄λ“―..γ…Žγ…Ž',
    'κ°€μŠ΅λŸ‰μ΄ λ„ˆλ¬΄ μ μ–΄μš”. 방이 μž‘μ§€ μ•Šλ‹€λ©΄ 무쑰건 ν°κ±Έλ‘œκ΅¬λ§€ν•˜μ„Έμš”. λ¬ΌλŸ‰λ„ μ‘°κΈˆλ°–μ— μ•ˆλ“€μ–΄κ°€μ„œ 쓰기도 λΆˆνŽΈν•¨',
    'ν•œλ²ˆμž…μ—ˆλŠ”λ° μ˜†μ— λ΄‰μ œμ„  λ‹€ 풀리고 μ‹€λ°₯도 계속 λ‚˜μ˜΅λ‹ˆλ‹€. 마감 처리 λ„ˆλ¬΄ 엉망 μ•„λ‹Œκ°€μš”?',
    'λ”°λœ»ν•˜κ³  μ’‹κΈ΄ν•œλ° 배솑이 λŠλ €μš”',
    '맛은 μžˆλŠ”λ° 가격이 μžˆλŠ” νŽΈμ΄μ—μš”'
]

# predict
for idx, review in enumerate(review_list):
  pred = sentiment_classifier(review)
  print(f'{review}\n>> {pred[0]}')
이쁘고 μ’‹μ•„μš”~~~씻기도 νŽΈν•˜κ³  아이고 μ΄μ˜λ‹€κ³  μžκΈ°λ°©μ— 갖닀놓고 μž˜μ¨μš”~^^
>> {'label': '1', 'score': 0.9945501685142517}
아직 μž…μ–΄λ³΄μ§„ μ•Šμ•˜μ§€λ§Œ ꡉμž₯히 κ°€λ²Όμ›Œμš”~~ λ‹€λ₯Έ 리뷰처럼 어깑이 μ’€ λ˜λ„€μš”γ…‹ λ§Œμ‘±ν•©λ‹ˆλ‹€. μ—„μ²­ λΉ λ₯Έλ°œμ†‘ κ°μ‚¬λ“œλ €μš” :)
>> {'label': '1', 'score': 0.995430588722229}
재ꡬ맀 ν•œκ±΄λ° λ„ˆλ¬΄λ„ˆλ¬΄ 가성비인거 κ°™μ•„μš”!! λ‹€μŒμ— 또 μƒκ°λ‚˜λ©΄ 3개째 또 μ‚΄λ“―..γ…Žγ…Ž
>> {'label': '1', 'score': 0.9959582686424255}
κ°€μŠ΅λŸ‰μ΄ λ„ˆλ¬΄ μ μ–΄μš”. 방이 μž‘μ§€ μ•Šλ‹€λ©΄ 무쑰건 ν°κ±Έλ‘œκ΅¬λ§€ν•˜μ„Έμš”. λ¬ΌλŸ‰λ„ μ‘°κΈˆλ°–μ— μ•ˆλ“€μ–΄κ°€μ„œ 쓰기도 λΆˆνŽΈν•¨
>> {'label': '0', 'score': 0.9984619617462158}
ν•œλ²ˆμž…μ—ˆλŠ”λ° μ˜†μ— λ΄‰μ œμ„  λ‹€ 풀리고 μ‹€λ°₯도 계속 λ‚˜μ˜΅λ‹ˆλ‹€. 마감 처리 λ„ˆλ¬΄ 엉망 μ•„λ‹Œκ°€μš”?
>> {'label': '0', 'score': 0.9991756677627563}
λ”°λœ»ν•˜κ³  μ’‹κΈ΄ν•œλ° 배솑이 λŠλ €μš”
>> {'label': '1', 'score': 0.6473883390426636}
맛은 μžˆλŠ”λ° 가격이 μžˆλŠ” νŽΈμ΄μ—μš”
>> {'label': '1', 'score': 0.5128092169761658}
  • label 0 : negative review
  • label 1 : positive review
Downloads last month
25,306
Safetensors
Model size
113M params
Tensor type
I64
Β·
F32
Β·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.