PaddlePaddle/PaddleTS

使用 WeightingEnsembleAnomaly 的时候出现了 KeyError: 'train_run_cost'

lichenliang666 opened this issue · 1 comments

运行环境:
操作系统:Windows 10 64位
Python:3.7.16
PaddleTS:默认分支(release_v1.1)最新的代码,用 python setup.py install 安装
Jupyter Lab : 3.6.7

代码来源:
按照 PaddleTS 官方文档:集成异常检测 ,代码复制了一份,在 Jupyter Lab 中运行。

运行到:

from paddlets.ensemble import WeightingEnsembleAnomaly
model = WeightingEnsembleAnomaly(
in_chunk_len=2,
estimators=[(AutoEncoder, ae_params),(VAE, vae_params)],
mode = "voting")
model.fit(train_tsdata_scaled)

出现了错误:

D:\anaconda3\envs\ppts-code\lib\site-packages\paddlets-1.1.0-py3.7.egg\paddlets\models\common\callbacks\callbacks.py in on_batch_end(self, batch, logs)
    375         ) / (self._samples_seen + batch_size)
    376         self._samples_seen += batch_size
--> 377         self._train_run_cost += logs['train_run_cost']
    378 

KeyError: 'train_run_cost'

其他小伙伴也有遇到这个问题的吗。

请问如何处理。

小白斗胆,把 self._train_run_cost += logs['train_run_cost'] 改成了 self._train_run_cost += 0 。
这块是过去了,但又出现了别的问题,详见:#516