1.
temperature参数相当于给softmax降降温,让各个词概率差距加大(跟刚才的随机 sample 相比,增加了高概率词的可能性,降低了低概率词的可能性)公式如下:
top_p:已知生成各个词的总概率是1(即默认是1.0)如果top_p小于1,则从高到低累加直到top_p,取这前N个词作为候选。
top_k:top-k-filtering 算法保留多少个 最高概率的词 作为候选,默认50。
repetition_penalty:默认是1.0,重复词惩罚。
2.transformer版本过老
gpt2-chinese模型
之前的transformer2.1.1的WarmupLinearSchedule在4.26.1版本改为下面函数get_linear_schedule_with_warmup,
def get_linear_schedule_with_warmup(optimizer, num_warmup_steps, num_training_steps, last_epoch=-1):
"""
Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0, after
a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer.
3.RuntimeError: CUDA error: CUBLAS_STATUS_NOT_INITIALIZED when calling `cublasCreate(handle)`
config字典字数错误