YAML Metadata Warning:The pipeline tag "text2text-generation" is not in the official list: text-classification, token-classification, table-question-answering, question-answering, zero-shot-classification, translation, summarization, feature-extraction, text-generation, fill-mask, sentence-similarity, text-to-speech, text-to-audio, automatic-speech-recognition, audio-to-audio, audio-classification, audio-text-to-text, voice-activity-detection, depth-estimation, image-classification, object-detection, image-segmentation, text-to-image, image-to-text, image-to-image, image-to-video, unconditional-image-generation, video-classification, reinforcement-learning, robotics, tabular-classification, tabular-regression, tabular-to-text, table-to-text, multiple-choice, text-ranking, text-retrieval, time-series-forecasting, text-to-video, image-text-to-text, image-text-to-image, image-text-to-video, visual-question-answering, document-question-answering, zero-shot-image-classification, graph-ml, mask-generation, zero-shot-object-detection, text-to-3d, image-to-3d, image-feature-extraction, video-text-to-text, keypoint-detection, visual-document-retrieval, any-to-any, video-to-video, other
paust/pko-t5-base model based
Since this model is based on paust/pko-t5-base tokenizer, you need to import it.
tokenizer = T5TokenizerFast.from_pretrained("paust/pko-t5-base")
model = T5ForConditionalGeneration.from_pretrained("emotionanalysis/diaryempathizer-t5-ko")
Test code
from transformers import T5TokenizerFast, T5ForConditionalGeneration
model = T5ForConditionalGeneration.from_pretrained("emotionanalysis/diaryempathizer-t5-ko")
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
tokenizer = T5TokenizerFast.from_pretrained("paust/pko-t5-base")
input_text = """
์ค๋์ ์ ๋ง๋ก ์ฆ๊ฑฐ์ด ๋ ์ด์๋ค. ๋ฉฐ์น ์งธ ์ ๋ ๋ชป ์๊ณ ์๊ณ ๋ฆฌ์ฆ ์์
์ ๊ธฐ๋ ์ค์ด๋ค. ์ด์ ์ ๋ง๋ก ๋๋ ๋ฒํฐ๊ธฐ ์ด๋ ต๊ฒ ๋ค๊ณ ๋ณด์ธ๋ค. ๋ฎ์ ๊ต์๋์ด ๊ฐ์๊ธฐ ์ด์ ์ ์ผ๋ก ์์
์ ํ์๋ ๊ฒ์ด์๋ค. ๊ทธ๋ฌ๋ค๊ฐ automata์
๋ํด ์ค๋ช
ํ์๋๋ฐ, ์ ๋ง ๊ฐ๋์ ๋๋ฌผ๊ณผ ๊ฒฝํ์ ๊ธํ ๊ธธ ์์๊ณ , ์ด ์์
์ ๋ฃ๊ธฐ ์ํด ํ์ด๋ฌ๋ค๋ ์๊ฐ์ด ๋ค์์ผ๋ฉฐ, ๊ณผ์ (ํฌ์)๊น์ง ์ฃผ์๋ ๊ฒ์ด์๋ค.
๋๋ ํฉํ๊ฒฝ์ ๋น ์ก๋ค. ๋ชฉ์จ์ ๋ฐ์น๊ณ ์ ์์ ๋ด๋์ ธ์ผ ํ ์ธ์์ ์ด์ ๋ฅผ ์ฐพ์๊ธฐ ๋๋ฌธ์ด๋ค.
"""
inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True, padding="max_length")
inputs = {key: value.to(device) for key, value in inputs.items()}
outputs = model.generate(input_ids=inputs["input_ids"], max_length=128, num_beams=4, early_stopping=True)
generated_comment = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_comment)
- Downloads last month
- 12
Model tree for emotionanalysis/diaryempathizer-t5-ko
Base model
paust/pko-t5-base