JunnYu / RoFormer_pytorch

RoFormer V1 & V2 pytorch
Apache License 2.0
477 stars 42 forks source link

在run_clue_no_trainer.py中,为什么train_dataloader的batch_siz=32在经过accelerator的处理后就变成None了? #31

Open learnmore-HDU opened 2 years ago

learnmore-HDU commented 2 years ago

在训练的时候,从Dataloader中拿数据说没有batch_size,我检查了好几遍是有输入这个参数的。结果发现 ( model, optimizer, train_dataloader, eval_dataloader, lr_scheduler, ) = accelerator.prepare( model, optimizer, train_dataloader, eval_dataloader, lr_scheduler ) 这一段代码处理完后的train_dataloader的batch_size=None

JunnYu commented 2 years ago

https://github.com/huggingface/accelerate/blob/23c0341262bd396a3ba9265614b3818d6e08a6c1/src/accelerate/data_loader.py#L417-L571 看这里accelerate仓库处理dataloader返回的是DataLoaderShard