Skip to content

Latest commit

 

History

History
42 lines (37 loc) · 1.3 KB

README.md

File metadata and controls

42 lines (37 loc) · 1.3 KB

Naver sentiment movie corpus(NSMC) BERT Pytorch Lightning

[POST] ⚡pytorch lightning 으로 koBERT Fine-tuning 하기 - NSMC

Download pretrained model and tokenizer

$ python download_pretrained.py --save_path pretrained
  • It will create './pretrained' directory.
  • It will download kobert pretrained model and tokenizer files below './pretrained' directory.

Train

# run example
python train.py
  • arguments
    • seed: random seed number
    • data_path: where to prepare data
    • max_epoch: maximum number of epochs to train
    • num_gpus: number of available gpus (-1: all avauilable)
    • mode: train only korean data or not
    • save_path: where to save checkpoints files
    • valid_size: size of validation file
    • max_seq_len: number of available gpus
    • batch_size: batch size

Test

# run example
python test.py --ckpt_path checkpoints/epoch=05-val_acc=0.897.ckpt
  • arguments
    • ckpt_path: checkpoint file path which is execute test with
    • The rest is same with train.py

Export to onnx

# run example
python export_to_onnx.py --ckpt_path checkpoints/epoch=05-val_acc=0.897.ckpt
  • It will create model.onnx.