Edit model card
YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM

# device setting
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# load model and tokenizer
model_name_or_path = "ddobokki/gpt2_poem"

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = AutoModelForCausalLM.from_pretrained(model_name_or_path)
model.to(device)

keyword_start_token = "<k>"
keyword_end_token = "</k>"
text = "์‚ฐ ๊ผญ๋Œ€๊ธฐ๊ฐ€ ๋ณด์ด๋Š” ๊ฒฝ์น˜"
input_text = keyword_start_token + text + keyword_end_token

input_ids = tokenizer.encode(input_text, return_tensors="pt").to(device)
gen_ids = model.generate(
    input_ids, max_length=64, num_beams=100, no_repeat_ngram_size=2
)
generated = tokenizer.decode(gen_ids[0, :].tolist(), skip_special_tokens=True)
>> ์˜ค๋ฅด๋ฝ๋‚ด๋ฆฌ๋ฝ
์‚ฐ ๊ผญ๋Œ€๊ธฐ๋ฅผ ์˜ฌ๋ ค๋‹ค๋ณด๋‹ˆ
์•„๋“ํžˆ ๋ฉ€๊ณ  ์•„๋“ํ•œ
๋‚˜๋ญ‡๊ฐ€์ง€์— ๋งค๋‹ฌ๋ฆฐ
์ž‘์€ ์‚ฐ์ƒˆ ํ•œ ๋งˆ๋ฆฌ
์ด๋ฆ„ ๋ชจ๋ฅผ ํ’€ ํ•œํฌ๊ธฐ ์•ˆ๊ณ 
์–ด๋””๋ก ๊ฐ€ ํ›Œ์ฉ ๋– ๋‚˜๊ฐ€ ๋ฒ„๋ ธ๋‹ค
Downloads last month
20
Safetensors
Model size
138M params
Tensor type
F32
ยท
U8
ยท
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.