In fixing them I looked to your implementation and noticed you prefixed the expressions with r so they are raw strings (presumably to fix the same warnings). However, I think this actually changed one of your regexes to something other than was intended.
Hi, we have some of your regex's in AllenNLP and Python has been warning us about them for a while.
https://github.com/huggingface/pytorch-openai-transformer-lm/blob/master/text_utils.py#L30
In fixing them I looked to your implementation and noticed you prefixed the expressions with
r
so they are raw strings (presumably to fix the same warnings). However, I think this actually changed one of your regexes to something other than was intended.The switch to raw strings changed
'|\\+'
(one or more backslashes) to|\\\\+
(two or more backslashes). I think you actually want the following regex.