Model Card for Model ID
koelectra-base-news-classification
Fine-tuned KoElectra model for Korean news classification for summarization.
Model Details
- Base model:
monologg/koelectra-base-discriminator - Task: Text Classification (News polarity)
- Language: Korean
- Number of labels: 2 (LABEL_0 = ๋ถ์ , LABEL_1 = ๊ธ์ )
Training
- Epochs: 3
- Optimizer: AdamW
- Max length: 128
- Dataset: https://aihub.or.kr/aihubdata/data/view.do?currMenu=115&topMenu=100&aihubDataSe=realm&dataSetSn=97. 11,000 pieces of train news data and 4,000 pieces of valid news data used
Usage
from transformers import AutoModelForSequenceClassification, AutoTokenizer, pipeline
import torch
device = 0 if torch.cuda.is_available() else -1
model = AutoModelForSequenceClassification.from_pretrained("jxchlee/koelectra-base-news-summerization2")
tokenizer = AutoTokenizer.from_pretrained("jxchlee/koelectra-base-news-summerization2")
nlp = pipeline("text-classification", model=model, tokenizer=tokenizer, device=device)
result = nlp("์ด ๋ชจ๋ธ์ ์ฑ๋ฅ์ด ์ข์๊น?")
print(result)
long_text = '''
์ ๋ผ๋จ๋๊ฐ ์ ๊ณผ์๋ฌธ์ ๋ฅผ ๊ทผ๋ณธ์ ์ผ๋ก ํด๊ฒฐํ๊ธฐ ์ํด ์ฌํด๋ถํฐ ์ํํ๋ ์ ์์ฐ์กฐ์ ์ ๋ฅผ ์ ๊ทน ์ถ์งํค๋ก ํ๋ค.
์ ์์ฐ์กฐ์ ์ ๋ ๋ฒผ๋ฅผ ์ฌ์๋ ๋
ผ์ ๋ฒผ ๋์ ์ฌ๋ฃ์๋ฌผ์ด๋ ์ฝฉ ๋ฑ ๋ค๋ฅธ ์๋ฌผ์ ์ฌ์ผ๋ฉด ๋ฒผ์์ ์ผ์ ์๋์ฐจ๋ฅผ ๋ณด์ ํด์ฃผ๋ ์ ๋๋ค.
์ฌํด ์ ๋จ์ ๋
ผ ๋ค๋ฅธ ์๋ฌผ ์ฌ๋ฐฐ ๊ณํ๋ฉด์ ์ ์ ๊ตญ 5๋งha์ ์ฝ 21%์ธ 1๋ง 698ha๋ก, ์ธ๋ถ์ํ์ง์นจ์ ํ์ , ์๊ตฐ์ ํต๋ณดํ๋ค.
์ง์ ๋์ ์๋ฌผ์ 1๋
์์ ํฌํจํ ๋ค๋
์์ ๋ชจ๋ ์๋ฌผ์ด ํด๋น๋๋ ์ฌ๋ฐฐ ๋ฉด์ ํ๋ ์ ์๊ธ๊ณผ์์ด ์ฐ๋ ค๋๋ ๊ณ ์ถ, ๋ฌด, ๋ฐฐ์ถ, ์ธ์ผ, ๋ํ ๋ฑ ์๊ธ ๋ถ์ ํ๋ชฉ์ ์ ์ธ๋๋ค.
๋์ง์ ๊ฒฝ์ฐ๋ ์ด๋ฏธ ๋ค๋ฅธ ์๋ฌผ ์ฌ๋ฐฐ ์๋ฌด๊ฐ ๋ถ์ฌ๋ ๊ฐ์ฒ์ง, ์ ๋ถ๋งค์
๋น์ถ๋์ง, ๋์ง์ฒญ ์๋ฒ์ฌ์
, ๊ฒฝ๊ด๋ณด์ ์ง๋ถ๊ธ ์๋ น ๋์ง ๋ฑ์ ์ ์ธ๋ ์์ ์ด๋ค.
'''
import kss
sentences = kss.split_sentences(long_text)
result2 = nlp(sentences)
print(result2)
- Downloads last month
- -