MCPcopy Create free account
hub / github.com/modelscope/modelscope / invoke_hook

Method invoke_hook

modelscope/trainers/trainer.py:1390–1399  ·  view source on GitHub ↗

Call all hooks. Args: fn_name (str): The function name in each hook to be called, such as "before_train_epoch".

(self, fn_name: str)

Source from the content-addressed store, hash-verified

1388 return [h for h in self._hooks if h.__class__ == cls]
1389
1390 def invoke_hook(self, fn_name: str) -> None:
1391 """Call all hooks.
1392
1393 Args:
1394 fn_name (str): The function name in each hook to be called, such as
1395 "before_train_epoch".
1396 """
1397 for hook in self._hooks:
1398 if hasattr(hook, fn_name):
1399 getattr(hook, fn_name)(self)
1400
1401 def print_cfg(self):
1402 if is_master():

Callers 15

__init__Method · 0.95
train_loopMethod · 0.95
evaluation_loopMethod · 0.95
train_loopMethod · 0.80
train_loopMethod · 0.80
evaluation_loopMethod · 0.80
train_loopMethod · 0.80
test_iter_time_hookMethod · 0.80
test_optimizer_hookMethod · 0.80

Calls

no outgoing calls