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*')
Reference: https://docs.python.org/3/library/warnings.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With