batch_sampler with trainer.py would not set the epoch 
Dear Huggingface team
If one uses batch_sampler instead of sampler then in trainer.py the part you set_epoch for the dataloader sampler it would not work, also in case one define custom sampler in certain application, like what I do, again in trainer.py it would not be called.
I was wondering if the codes can be more general to include these cases.

thanks.

Best
Rabeeh 
Hi there.
To use custom sampling (either through a sampler or a batch sampler), users are expected to subsclass `Trainer` and override the `get_train_dataloader`/`get_eval_dataloader` methods to suit their needs.

Note that those changes might then not be compatible with distributed training/TPU training.<|||||>Hi there
yes, thats correct, but looking into train() method of trainer.py class,
the user needs to overwrite the whole train() function for such cases, and
this is just for setting the epoch for other type of sampler, it would be
very nice if the train() method allowed custom sampler. thanks.

On Sun, Dec 6, 2020 at 11:56 PM Sylvain Gugger <notifications@github.com>
wrote:

> Hi there.
> To use custom sampling (either through a sampler or a batch sampler),
> users are expected to subsclass Trainer and override the
> get_train_dataloader/get_eval_dataloader methods to suit their needs.
>
> Note that those changes might then not be compatible with distributed
> training/TPU training.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/huggingface/transformers/issues/8952#issuecomment-739579294>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABP4ZCGAIHTYBBBJI75TGKLSTQDYXANCNFSM4UPTHQNQ>
> .
>
<|||||>This issue has been automatically marked as stale and been closed because it has not had recent activity. Thank you for your contributions.

If you think this still needs to be addressed please comment on this thread.