Support recreating dataloaders during loop
Summary: Sometimes users need to recreate the dataloaders at the start of the epoch during the overall training loop. To support this, we allow users to register a creation function when creating the state for training or fitting. We pass the state as an argument since users may want to use progress information such as the progress counters to reinitialize the dataloader.
We don't add this support for evaluate or predict since those functions iterate through the corresponding dataloader just once.
For fit, this allows flexibility to reload training & evaluation dataloaders independently during if desired
Differential Revision: D40539580
This pull request was exported from Phabricator. Differential Revision: D40539580
Codecov Report
Merging #248 (a636d89) into master (bc64893) will increase coverage by
0.11%. The diff coverage is100.00%.
@@ Coverage Diff @@
## master #248 +/- ##
==========================================
+ Coverage 89.22% 89.34% +0.11%
==========================================
Files 85 85
Lines 5272 5330 +58
==========================================
+ Hits 4704 4762 +58
Misses 568 568
| Impacted Files | Coverage Δ | |
|---|---|---|
| tests/runner/test_fit.py | 96.98% <100.00%> (+0.36%) |
:arrow_up: |
| tests/runner/test_train.py | 100.00% <100.00%> (ø) |
|
| torchtnt/runner/evaluate.py | 91.54% <100.00%> (+0.37%) |
:arrow_up: |
| torchtnt/runner/fit.py | 83.01% <100.00%> (+3.94%) |
:arrow_up: |
| torchtnt/runner/state.py | 98.93% <100.00%> (+0.04%) |
:arrow_up: |
| torchtnt/runner/train.py | 92.37% <100.00%> (+0.48%) |
:arrow_up: |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
This pull request was exported from Phabricator. Differential Revision: D40539580
Hi @ananthsub!
Thank you for your pull request.
We require contributors to sign our Contributor License Agreement, and yours needs attention.
You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.
Process
In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.
Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.
If you have received this in error or have any questions, please contact us at [email protected]. Thanks!