class_docstr: 执行保存的对象。保存的文件组织结构为::
  
      - folder  # 当前初始化的参数
          - YYYY-mm-dd-HH_MM_SS_fffff/  # 自动根据当前脚本的启动时间创建的
              - folder_name  # 由 save() 调用时传入。
  
  :param folder: 保存在哪个文件夹下，默认为当前 folder 下。
  :param save_object: 可选 ``['trainer', 'model']`` ，表示在保存时的保存对象为 ``trainer+model`` 还是 只是 ``model`` 。如果
      保存 ``trainer`` 对象的话，将会保存 :class:`~fastNLP.core.controllers.Trainer` 的相关状态，可以通过 :meth:`Trainer.load_checkpoint` 加载该断
      点继续训练。如果保存的是 ``Model`` 对象，则可以通过 :meth:`Trainer.load_model` 加载该模型权重。
  :param only_state_dict: 保存时是否仅保存权重，在 model_save_fn 不为 None 时无意义。
  :param model_save_fn: 个性化的保存函数，当触发保存操作时，就调用这个函数，这个函数应当接受一个文件夹作为参数，不返回任何东西。
      如果传入了 model_save_fn 函数，fastNLP 将不再进行模型相关的保存。在多卡场景下，我们只在 rank 0 上会运行该函数。
  :param kwargs: 更多需要传递给 Trainer.save_checkpoint() 或者 Trainer.save_model() 接口的参数。
class_docstr_tok: ["\u6267\u884c\u4fdd\u5b58\u7684\u5bf9\u8c61\u3002\u4fdd\u5b58\u7684\u6587\u4ef6\u7ec4\u7ec7\u7ed3\u6784\u4e3a",":",":","-","folder","#","\u5f53\u524d\u521d\u59cb\u5316\u7684\u53c2\u6570","-","YYYY-mm-dd-HH_MM_SS_fffff\/","#","\u81ea\u52a8\u6839\u636e\u5f53\u524d\u811a\u672c\u7684\u542f\u52a8\u65f6\u95f4\u521b\u5efa\u7684","-","folder_name","#","\u7531","save","(",")","\u8c03\u7528\u65f6\u4f20\u5165\u3002",":","param","folder",":","\u4fdd\u5b58\u5728\u54ea\u4e2a\u6587\u4ef6\u5939\u4e0b\uff0c\u9ed8\u8ba4\u4e3a\u5f53\u524d","folder","\u4e0b\u3002",":","param","save_object",":","\u53ef\u9009","``","[","'trainer","'",",","'model","'","]","``","\uff0c\u8868\u793a\u5728\u4fdd\u5b58\u65f6\u7684\u4fdd\u5b58\u5bf9\u8c61\u4e3a","``","trainer+model","``","\u8fd8\u662f","\u53ea\u662f","``","model","``","\u3002\u5982\u679c","\u4fdd\u5b58","``","trainer","``","\u5bf9\u8c61\u7684\u8bdd\uff0c\u5c06\u4f1a\u4fdd\u5b58",":","class",":","`","~fastNLP.core.controllers.Trainer","`","\u7684\u76f8\u5173\u72b6\u6001\uff0c\u53ef\u4ee5\u901a\u8fc7",":","meth",":","`","Trainer.load_checkpoint","`","\u52a0\u8f7d\u8be5\u65ad","\u70b9\u7ee7\u7eed\u8bad\u7ec3\u3002\u5982\u679c\u4fdd\u5b58\u7684\u662f","``","Model","``","\u5bf9\u8c61\uff0c\u5219\u53ef\u4ee5\u901a\u8fc7",":","meth",":","`","Trainer.load_model","`","\u52a0\u8f7d\u8be5\u6a21\u578b\u6743\u91cd\u3002",":","param","only_state_dict",":","\u4fdd\u5b58\u65f6\u662f\u5426\u4ec5\u4fdd\u5b58\u6743\u91cd\uff0c\u5728","model_save_fn","\u4e0d\u4e3a","None","\u65f6\u65e0\u610f\u4e49\u3002",":","param","model_save_fn",":","\u4e2a\u6027\u5316\u7684\u4fdd\u5b58\u51fd\u6570\uff0c\u5f53\u89e6\u53d1\u4fdd\u5b58\u64cd\u4f5c\u65f6\uff0c\u5c31\u8c03\u7528\u8fd9\u4e2a\u51fd\u6570\uff0c\u8fd9\u4e2a\u51fd\u6570\u5e94\u5f53\u63a5\u53d7\u4e00\u4e2a\u6587\u4ef6\u5939\u4f5c\u4e3a\u53c2\u6570\uff0c\u4e0d\u8fd4\u56de\u4efb\u4f55\u4e1c\u897f\u3002","\u5982\u679c\u4f20\u5165\u4e86","model_save_fn","\u51fd\u6570\uff0cfastNLP","\u5c06\u4e0d\u518d\u8fdb\u884c\u6a21\u578b\u76f8\u5173\u7684\u4fdd\u5b58\u3002\u5728\u591a\u5361\u573a\u666f\u4e0b\uff0c\u6211\u4eec\u53ea\u5728","rank","0","\u4e0a\u4f1a\u8fd0\u884c\u8be5\u51fd\u6570\u3002",":","param","kwargs",":","\u66f4\u591a\u9700\u8981\u4f20\u9012\u7ed9","Trainer.save_checkpoint","(",")","\u6216\u8005","Trainer.save_model","(",")","\u63a5\u53e3\u7684\u53c2\u6570\u3002"]
code: def state_dict(self):
      states = {
          "timestamp_path": str(self.timestamp_path),
      }
      return states
  
imports: import json
  import os
  from copy import deepcopy
  from pathlib import Path
  from typing import Optional, Dict, Tuple, Callable, Union
  from ...envs.distributed import rank_zero_rm
  from fastNLP.core.log import logger
  from fastNLP.envs import FASTNLP_LAUNCH_TIME
  from fastNLP.envs import rank_zero_call
  from fastNLP.envs.env import FASTNLP_EVALUATE_RESULT_FILENAME
  from .has_monitor_callback import ResultsMonitor
label_desc: Use image node_id 5 for calling the Saver obj's underlying member method code with example usage: obj.state_dict() and returns: states