Commit 3c811d21 authored by Kevin Chih-Yao Ma's avatar Kevin Chih-Yao Ma Committed by Facebook GitHub Bot
Browse files

add cfg option to control the frequency of the writers

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

Add a cfg option to control the frequency of the writers.

Currently, the default writers include:
```
writers = [
    CommonMetricPrinter(max_iter),
    JSONWriter(os.path.join(cfg.OUTPUT_DIR, "metrics.json")),
    tbx_writer,
]
```

Reviewed By: wat3rBro

Differential Revision: D38065583

fbshipit-source-id: ebdc20aab71e03b4e18772af78b410f17ba4216d
parent 72a3804c
......@@ -120,6 +120,9 @@ def get_base_runner_default_cfg(cfg: CN) -> CN:
cfg.SOLVER.AUTO_SCALING_METHODS = ["default_scale_d2_configs"]
# Frequency of metric printer, tensorboard writer, etc.
cfg.WRITER_PERIOD = 20
return cfg
......
......@@ -471,7 +471,7 @@ class Detectron2GoRunner(BaseRunner):
JSONWriter(os.path.join(cfg.OUTPUT_DIR, "metrics.json")),
tbx_writer,
]
trainer_hooks.append(hooks.PeriodicWriter(writers))
trainer_hooks.append(hooks.PeriodicWriter(writers, cfg.WRITER_PERIOD))
update_hooks_from_registry(trainer_hooks)
trainer.register_hooks(trainer_hooks)
trainer.train(start_iter, max_iter)
......
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