Repository navigation
Conversation
`dataloader_kwargs` passes anything through to the training `DataLoader`, but `persistent_workers` and `prefetch_factor` only apply with worker processes, and DataLoader raises for them when `dataloader_workers` is 0. That error surfaced deep in training startup and named neither the option nor the config field. Checking it while the config loads keeps the failure where the user can fix it. Only values that ask for something are rejected: `persistent_workers: false` and `prefetch_factor: null` are the DataLoader defaults and still pass.
|
Thanks @lu123bing for your active contributions! I agree with what @Ayskin mentioned here:
In principle, I would prefer |
|
Got it — pure passthrough to PyTorch it is. Closing this since the validation approach here isn't wanted; the kwargs design in #3550 stands. |
Follow-up on your
dataloader_kwargsproposal, as discussed in #3550. This branches offjaap/config-extra-kwargsso it can merge straight into #3554; close it if you would rather fold the change in yourself.What it adds
dataloader_kwargspasses everything through to the trainingDataLoader, butpersistent_workersandprefetch_factoronly apply with worker processes. Withdataloader_workers: 0, DataLoader raises for them:That happens once training starts and names neither
dataloader_kwargsnordataloader_workers, so a config that validates cleanly still fails later. Since the pass-through field is new, this seemed like the moment to catch it at config load, where the message can point at the field to change.reject_multiprocessing_only_kwargsnext toreject_reserved_keysincore/config/validation.py.TrainSettingsConfigwith amodel_validator(mode="after"), since the check needs bothdataloader_kwargsanddataloader_workers.docs/pytorch/pytorch_config.mdnoting when the check happens.The check only rejects values that ask for something.
persistent_workers: falseandprefetch_factor: nullare the DataLoader defaults, so they still validate — matching what DataLoader itself accepts.Tests
Four cases in
tests/pose_estimation_pytorch/config/test_train_settings_config.py: rejected with no workers, accepted with workers, and the two no-op default values still passing. Without the change the first case is the reported failure (dataloader_workers: 0pluspersistent_workers: truevalidates, then breaks at training).Verified:
pytest tests/pose_estimation_pytorch/config/ tests/core/config/→ 302 passed, 5 xfailed.ruff checkandruff format --checkclean. Not run: the full suite, and no end-to-end training run.I have left the
wandb_kwargssimplification you mentioned in #3554 alone — happy to do it here or in a separate PR, whichever you prefer.