【发布时间】:2021-07-17 17:05:24
【问题描述】:
我知道使用 warnings.filterwarnings('ignore') 会抑制警告消息,但我想抑制特定类型的警告。
更具体地说,此警告消息是由我正在使用的第三方库发出的,日志警告消息如下所示:
04/23/2021 21:09:39 - WARNING - pytorch_transformers.tokenization_utils - Token indices sequence length is \
longer than the specified maximum sequence length for this model (589 > 512). Running this sequence through the \
model will result in indexing errors
我不确定我应该如何通过使用正则表达式或其他方式来抑制警告消息。我不想进入实际脚本并更改内容,我想知道是否有办法找出抑制此警告消息的具体方法。谢谢。
【问题讨论】: