pip install -r requirements.txt
删去包含“录音”、“合声”、“演唱”等含歌词作者信息的数据。只保留只含歌词的数据。清洗后的数据在./data/lyric_train_clean.json
。
python preprocess.py
使用--no_pretrain
参数。训练需要约11GB显存
python main.py --expname gpt-bare --no_pretrain --lr 1e-3 --epoch 20
训练需要约11GB显存
python main.py --expname gpt-finetune --model uer/gpt2-chinese-cluecorpussmall --batchsize 16 --gradient_accumulation_steps 2 --eval_batchsize 32
训练需要约8GB显存
python main.py --expname gpt-distil-finetune --model uer/gpt2-distil-chinese-cluecorpussmall --batchsize 16 --gradient_accumulation_steps 2 --eval_batchsize 32
使用 Test Dataset 计算PPL和MAUVE分数, 需要约8GB显存。
python main.py --test_only --topk 10 --expname gpt-test --model uer/gpt2-chinese-cluecorpussmall --checkpoint ./log/tunegpt-finetune/10.pth --eval_batchsize 32 --mauve_batchsize 32
基于给定的前缀文件--examples <prefix_file>
续写歌词。需要约8GB显存。
python main.py --inference_only --examples ./examples.txt --topk 10 --expname gpt-inference --model uer/gpt2-chinese-cluecorpussmall --checkpoint ./log/tunegpt-finetune/10.pth --eval_batchsize 32 --mauve_batchsize 32