MCPcopy
hub / github.com/hustvl/Vim / train

Method train

det/detectron2/engine/train_loop.py:139–165  ·  view source on GitHub ↗

Args: start_iter, max_iter (int): See docs above

(self, start_iter: int, max_iter: int)

Source from the content-addressed store, hash-verified

137 self._hooks.extend(hooks)
138
139 def train(self, start_iter: int, max_iter: int):
140 """
141 Args:
142 start_iter, max_iter (int): See docs above
143 """
144 logger = logging.getLogger(__name__)
145 logger.info("Starting training from iteration {}".format(start_iter))
146
147 self.iter = self.start_iter = start_iter
148 self.max_iter = max_iter
149
150 with EventStorage(start_iter) as self.storage:
151 try:
152 self.before_train()
153 for self.iter in range(start_iter, max_iter):
154 self.before_step()
155 self.run_step()
156 self.after_step()
157 # self.iter == max_iter can be used by `after_train` to
158 # tell whether the training successfully finished or failed
159 # due to exceptions.
160 self.iter += 1
161 except Exception:
162 logger.exception("Exception during training:")
163 raise
164 finally:
165 self.after_train()
166
167 def before_train(self):
168 for h in self._hooks:

Callers 15

train_one_epochFunction · 0.45
do_trainFunction · 0.45
do_trainFunction · 0.45
benchmark_trainFunction · 0.45
mainFunction · 0.45
__init__Method · 0.45
flop_count_operatorsFunction · 0.45
_wrapper_count_operatorsFunction · 0.45
__init__Method · 0.45
inference_contextFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls 6

before_trainMethod · 0.95
before_stepMethod · 0.95
run_stepMethod · 0.95
after_stepMethod · 0.95
after_trainMethod · 0.95
EventStorageClass · 0.90

Tested by 9

test_simple_trainerMethod · 0.36
test_writer_hooksMethod · 0.36
test_eval_hookMethod · 0.36
_test_trainMethod · 0.36