Morizeyao / GPT2-Chinese

Chinese version of GPT2 training code, using BERT tokenizer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

多gpu报错:Input tensor at index 2 has invalid shape

tuzeao opened this issue · comments

python3.8,环境同requirements.txt
当使用多个gpu训练时候,会报错
RuntimeError: Input tensor at index 2 has invalid shape [2, 10, 12, 1024, 64], but expected [2, 11, 12, 1024, 64]

出错行显示在模型推理那行
outputs = model.forward(input_ids=batch_inputs, labels=batch_inputs)

这就很奇怪了,明明input_ids和labels完全是一个东西,却会报shape invalid

尝试性用了单gpu,发现代码能跑了

试了一些常规方法,没发现问题原因