I'm aware that using warnings.filterwarnings('ignore')
will suppress warning messages, but there's a specific type of warning that I want to suppress.
More specifically, this warning message is being given by a third-party library that I'm using and the log warning message looks like this:
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
I'm not sure how I should be suppressing the warning message by using regular expressions or something. I don't want to have to go into the actual script and change things and am wondering if there's a way I can find out the specific way to suppress just this warning message. Thanks.
You can assign regular expression to message keyword in filterwarnings method.
warnings.filterwarnings('ignore', message='model will result in indexing errors*')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.