class_docstr: 用来管理训练过程中的所有的 callback 实例；
class_docstr_tok: ["\u7528\u6765\u7ba1\u7406\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u7684\u6240\u6709\u7684","callback","\u5b9e\u4f8b\uff1b"]
docstr: 用于断点重训的加载函数，对应于断点重训的保存函数；
  
  :param trainer: :class:`~fastNLP.core.controllers.Trainer` 实例；
  :param states: 同 :func:`on_save_checkpoint` 函数的返回值；
docstr_tok: ["\u7528\u4e8e\u65ad\u70b9\u91cd\u8bad\u7684\u52a0\u8f7d\u51fd\u6570\uff0c\u5bf9\u5e94\u4e8e\u65ad\u70b9\u91cd\u8bad\u7684\u4fdd\u5b58\u51fd\u6570\uff1b",":","param","trainer",":",":","class",":","`","~fastNLP.core.controllers.Trainer","`","\u5b9e\u4f8b\uff1b",":","param","states",":","\u540c",":","func",":","`","on_save_checkpoint","`","\u51fd\u6570\u7684\u8fd4\u56de\u503c\uff1b"]
code: def on_load_checkpoint(self, trainer, states: Dict):
      r"""
      用于断点重训的加载函数，对应于断点重训的保存函数；
  
      :param trainer: :class:`~fastNLP.core.controllers.Trainer` 实例；
      :param states: 同 :func:`on_save_checkpoint` 函数的返回值；
      """
  
      # 1. 先恢复每一个具体的 callback 函数的 filter 的状态；
      # self._callback_filters 是当前的 Trainer 的 callback 的 filter 状态，是我们要去维护的对象；
      _already_loaded_callback_names = set()
      _duplicated_callback_names = set()
      for each_callback_filters in self._callback_filters:
          if each_callback_filters[0] in states:
              if (
                  each_callback_filters[0]
                  not in _already_loaded_callback_names
              ):
                  _already_loaded_callback_names.add(
                      each_callback_filters[0]
                  )
                  if (
                      "filter_states"
                      in states[each_callback_filters[0]]
                      and each_callback_filters[1]
                      in states[each_callback_filters[0]][
                          "filter_states"
                      ]
                  ):
                      each_callback_filters[2].load_state_dict(
                          states[each_callback_filters[0]][
                              "filter_states"
                          ][each_callback_filters[1]]
                      )
              else:
                  _duplicated_callback_names.add(
                      each_callback_filters[0]
                  )
  
      if len(_duplicated_callback_names) > 0:
          logger.rank_zero_warning(
              f"Notice these callback_name: {_duplicated_callback_names} are duplicated, "
              f"fastNLP will only load the first callback's state."
          )
  
      # 2. 再恢复每一个 callback 的单独的状态；
      # 每一个我们自己提供的类 callback，都需要重写其特定的 `callback_name` 方法，保证如果两个 callback 的 callback_name 一样，
      #  那么它们就应该是同一个对象；
      _already_loaded_callback_names = set()
      for each_callback in self.all_callbacks:
          if (
              each_callback.callback_name in states
              and each_callback.callback_name
              not in _already_loaded_callback_names
          ):
              _already_loaded_callback_names.add(
                  each_callback.callback_name
              )
              # 这里要注意，我们已经确保每一个 callback 的 `on_load_checkpoint` 函数拿到的就是其自己的状态；
              each_callback.on_load_checkpoint(
                  trainer, states[each_callback.callback_name]["states"]
              )
  
imports: import inspect
  from typing import List, Optional, Dict, Sequence
  from collections import defaultdict
  from .callback_event import Event
  from .callback import Callback
  from fastNLP.core.log import logger
  from .progress_callback import ProgressCallback, choose_progress_callback
  from ..utils.exceptions import EarlyStopException
  from ..utils.utils import _get_fun_msg
label_desc: Use image node_id 6 for calling the CallbackManager obj's underlying member method code with example usage: obj.on_load_checkpoint(trainer, states) without return types