Skip to content

Generate novel text - novel finetuned from skt KoGPT2 base v2 - 한국어

License

Notifications You must be signed in to change notification settings

ttop32/KoGPT2novel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KoGPT2novel

Generate novel text based on given input text
novel finetuned from skt/kogpt2-base-v2
colab: colab
web demo: okteto kubernautic

japan web novel finetuned colab: kogpt2jnovel_colab

Result

result

Required environment to run

pip install torch==1.7.1+cu110
pip install fastai==2.4
pip install transformers==4.10.2
pip install BentoML==0.13.1

Use in transformers

from transformers import AutoTokenizer, AutoModelWithLMHead
tokenizer = AutoTokenizer.from_pretrained("ttop324/kogpt2novel")
model = AutoModelWithLMHead.from_pretrained("ttop324/kogpt2novel")

inputs = tokenizer.encode("위치추적 전자장치(전자발찌) 훼손 전후로 여성 2명을 잇달아 살해한 ", return_tensors="pt")
output = model.generate(inputs, 
                        repetition_penalty=2.0, 
                        max_length=128,
                        use_cache=True)
output = tokenizer.decode(output[0])
print(output)

Run train

train.ipynb

Run deploy

deploy.ipynb

Acknowledgement and References