Avoid accessing .dataset of a DataLoader in Trainer (#16451)
* Avoid accessing .dataset of a dataloader
* style
* fix
* cleaning up, reverting some misunderstandings
* black
* add train_dataset argument to get_train_dataloader, and fix other instances of length checks
* flake8
* address comments
* fix bug
* cleanup
* add test
* Update tests/trainer/test_trainer.py
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
* under torch
* merge
* stylistic suggestion
Co-authored-by: Sander Land <sander@chatdesk.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>