Skip to content

Latest commit

 

History

History
58 lines (46 loc) · 2.38 KB

README.md

File metadata and controls

58 lines (46 loc) · 2.38 KB

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