Commit e82635eb authored by Francisc Bungiu's avatar Francisc Bungiu Committed by Facebook GitHub Bot
Browse files

Add ODS logging to all runners

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

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

Allow attaching a monitoring service to the training loop.

Reviewed By: miqueljubert

Differential Revision: D47595332

fbshipit-source-id: 49d770207aeea56113c008fcd29ad7b545cec849
parent 94c7f647
...@@ -6,7 +6,7 @@ import logging ...@@ -6,7 +6,7 @@ import logging
import os import os
from collections import OrderedDict from collections import OrderedDict
from functools import lru_cache from functools import lru_cache
from typing import List, Optional, Type, Union from typing import Any, List, Optional, Type, Union
import detectron2.utils.comm as comm import detectron2.utils.comm as comm
import torch import torch
...@@ -168,6 +168,11 @@ def prepare_fb_model(cfg: CfgNode, model: torch.nn.Module) -> torch.nn.Module: ...@@ -168,6 +168,11 @@ def prepare_fb_model(cfg: CfgNode, model: torch.nn.Module) -> torch.nn.Module:
return model return model
@fb_overwritable()
def get_monitoring_service() -> Any:
pass
class BaseRunner(object): class BaseRunner(object):
def __init__(self): def __init__(self):
identifier = f"D2Go.Runner.{self.__class__.__name__}" identifier = f"D2Go.Runner.{self.__class__.__name__}"
...@@ -529,6 +534,7 @@ class Detectron2GoRunner(D2GoDataAPIMixIn, BaseRunner): ...@@ -529,6 +534,7 @@ class Detectron2GoRunner(D2GoDataAPIMixIn, BaseRunner):
] ]
def do_train(self, cfg, model, resume): def do_train(self, cfg, model, resume):
with get_monitoring_service():
# Note that flops at the beginning of training is often inaccurate, # Note that flops at the beginning of training is often inaccurate,
# if a model has input-dependent logic # if a model has input-dependent logic
attach_profilers(cfg, model) attach_profilers(cfg, model)
......
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