尽管被过滤,仍然显示Pytorch警告

时间:2020-03-29 08:55:27

标签: python pytorch warnings

我正在使用fastai库拟合数据集。导致问题的代码在这里:

learn = language_model_learner(data_lm, TransformerXL, path='training_data')

with warnings.catch_warnings():

    warnings.simplefilter("ignore")
    warnings.filterwarnings("ignore")

    learn.fit_one_cycle(epochs, 1e-2)

尽管有过滤器,它仍会在每个步骤中发出警告:

Warning: masked_fill_ received a mask with dtype torch.uint8, this behavior is now deprecated,please use a mask with dtype torch.bool instead. (masked_fill__cuda at /pytorch/aten/src/ATen/native/cuda/LegacyDefinitions.cpp:19)

代码有效,并且我不直接使用pytorch,所以我宁愿忽略警告。特别是,警告会填满控制台,从而阻止显示历时损失统计信息。看起来标准库正在处理它,那么为什么过滤器不起作用?我尝试过有无渔获物和两个过滤器。

0 个答案:

没有答案