Commit 000e81ca authored by Yanghan Wang's avatar Yanghan Wang Committed by Facebook GitHub Bot
Browse files

use public trainer API to re-create data loader for QAT

Summary:
X-link: https://github.com/facebookresearch/detectron2/pull/4458

Pull Request resolved: https://github.com/facebookresearch/d2go/pull/353

- The QAT was using old code prior to D36786902, update to use public API
- Make `trainer:reset_data_loader` to take lazy lambda expression in order to delay the creation of dataloader. It's possible that we don't have enough RAM to hold two data loader at the same time, so we need to delete the first one, then create the second one.

Differential Revision: D38330148

fbshipit-source-id: aae28a48eabf211fe00cafe5d9ea8aeaf56e4e0c
parent 80d3844b
......@@ -616,8 +616,4 @@ def _reset_qat_data_loader_if_needed(cfg, trainer, build_loader_func):
)
# This method assumes the data loader can be replaced from trainer
assert trainer.__class__ == SimpleTrainer
del trainer._data_loader_iter
del trainer.data_loader
data_loader = build_loader_func(loader_cfg)
trainer.data_loader = data_loader
trainer._data_loader_iter = iter(data_loader)
trainer.reset_data_loader(lambda: build_loader_func(loader_cfg))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment