PyTorch Tensorboard 与文档中描述的不符

PyTorch Tensorboard not as described in documentation

我正在使用 PyTorch 的 ùtils.tensorboard.writer 来记录 RNN 的训练。对于 àdd_hparams() 函数,文档说:

Params:

  • hparam_dict (dict) – Each key-value pair in the dictionary is the name of the hyper parameter and it’s corresponding value. The type of the value can be one of bool, string, float, int, or None.
  • metric_dict (dict) – Each key-value pair in the dictionary is the name of the metric and it’s corresponding value. Note that the key used here should be unique in the tensorboard record. Otherwise the value you added by add_scalar will be displayed in hparam plugin. In most cases, this is unwanted.
  • hparam_domain_discrete – (Optional[Dict[str, List[Any]]]) A dictionary that contains names of the hyperparameters and all discrete values they can hold
  • run_name (str) – Name of the run, to be included as part of the logdir. If unspecified, will use current timestamp.

Source: https://pytorch.org/docs/master/tensorboard.html

但是当我尝试使用 run_name 参数时,出现错误

TypeError: add_hparams() got an unexpected keyword argument 'run_name'

所以我查找了我导入的 writer.py 文件,发现原因是 add_hparams() 函数本身:

def add_hparams(self, hparam_dict, metric_dict):

我检查了我的 PyTorch 安装,但它是最新的。这是某种夜间功能吗?如果是,我如何下载夜间版本的 torch?

您链接的文档来自 PyTorch 当前的 master 分支。所以是的,这是一个夜间功能。稳定版 (1.6) 的文档没有提到 add_hparams.

您可以通过选择 Preview (Nightly) 而不是 Stable 来获取每晚下载 PyTorch 的命令 here