Paddle Paddle训练求解
Created by: zhu143xin
strategy = hub.AdamWeightDecayStrategy( warmup_proportion=args.warmup_proportion, weight_decay=args.weight_decay, learning_rate=args.learning_rate)
# Setup runing config for PaddleHub Finetune API
config = hub.RunConfig(
eval_interval=args.eval_step,
save_ckpt_interval=args.model_save_step,
use_data_parallel=args.use_data_parallel,
use_cuda=args.use_gpu,
num_epoch=args.num_epoch,
batch_size=args.batch_size,
checkpoint_dir=args.checkpoint_dir,
strategy=strategy)
# Define a sequence labeling finetune task by PaddleHub's API
# If add crf, the network use crf as decoder
seq_label_task = hub.SequenceLabelTask(
data_reader=reader,
feature=sequence_output,
feed_list=feed_list,
max_seq_len=args.max_seq_len,
num_classes=dataset.num_labels,
config=config,
add_crf=args.add_crf)
以上是使用BERT+CRF进行序列标注任务,后续调用finetune_and_eval进行训练。想问一下能否自己单独设置CRF的学习率,让它与BERT不相同,目前没找到实现的方法