Korean News Summarization Model
Demo
https://huggingface.co/spaces/gogamza/kobart-summarization
How to use
import torch
from transformers import PreTrainedTokenizerFast
from transformers import BartForConditionalGeneration
tokenizer = PreTrainedTokenizerFast.from_pretrained('gogamza/kobart-summarization')
model = BartForConditionalGeneration.from_pretrained('gogamza/kobart-summarization')
text = "๊ณผ๊ฑฐ๋ฅผ ๋ ์ฌ๋ ค๋ณด์. ๋ฐฉ์ก์ ๋ณด๋ ์ฐ๋ฆฌ์ ๋ชจ์ต์. ๋
๋ณด์ ์ธ ๋งค์ฒด๋ TV์๋ค. ์จ ๊ฐ์กฑ์ด ๋๋ฌ์์ TV๋ฅผ ๋ดค๋ค. ๊ฐํน ๊ฐ์กฑ๋ค๋ผ๋ฆฌ ๋ด์ค์ ๋๋ผ๋ง, ์๋ฅ ํ๋ก๊ทธ๋จ์ ๋๋ฌ์ธ๊ณ ๋ฆฌ๋ชจ์ปจ ์ํ์ ์ด ๋ฒ์ด์ง๊ธฐ๋ ํ๋ค. ๊ฐ์ ์ ํธํ๋ ํ๋ก๊ทธ๋จ์ โ๋ณธ๋ฐฉโ์ผ๋ก ๋ณด๊ธฐ ์ํ ์ธ์์ด์๋ค. TV๊ฐ ํ ๋์ธ์ง ๋ ๋์ธ์ง ์ฌ๋ถ๋ ๊ทธ๋์ ์ค์ํ๋ค. ์ง๊ธ์ ์ด๋ค๊ฐ. โ์๋ฐฉ๊ทน์ฅโ์ด๋ผ๋ ๋ง์ ์๋ง์ด ๋๋ค. TV๊ฐ ์๋ ์ง๋ ๋ง๋ค. ๋ฏธ๋์ด์ ํ ํ์ ๋๋ฆด ์ ์๋ ๋ฐฉ๋ฒ์ ๋์ด๋ฌ๋ค. ๊ฐ์์ ๋ฐฉ์์ ๊ฐ์์ ํด๋ํฐ์ผ๋ก, ๋
ธํธ๋ถ์ผ๋ก, ํ๋ธ๋ฆฟ์ผ๋ก ์ฝํ
์ธ ๋ฅผ ์ฆ๊ธด๋ค."
raw_input_ids = tokenizer.encode(text)
input_ids = [tokenizer.bos_token_id] + raw_input_ids + [tokenizer.eos_token_id]
summary_ids = model.generate(torch.tensor([input_ids]))
tokenizer.decode(summary_ids.squeeze().tolist(), skip_special_tokens=True)
- Downloads last month
- 20,875
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.