From ebb9d9321dbed719680067f4c583f7e43a10312b Mon Sep 17 00:00:00 2001 From: Stas Bekman Date: Wed, 4 Nov 2020 06:02:28 -0800 Subject: [PATCH] [blenderbot] regex fix (#8282) Fixing: ``` src/transformers/tokenization_blenderbot.py:163: DeprecationWarning: invalid escape sequence \s token = re.sub("\s{2,}", " ", token) ``` --- src/transformers/tokenization_blenderbot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transformers/tokenization_blenderbot.py b/src/transformers/tokenization_blenderbot.py index d93962598851bf..ec350cf2625350 100644 --- a/src/transformers/tokenization_blenderbot.py +++ b/src/transformers/tokenization_blenderbot.py @@ -160,7 +160,7 @@ def bpe(self, token: str) -> str: return self.cache[token] token = re.sub("([.,!?()])", r" \1", token) token = re.sub("(')", r" \1 ", token) - token = re.sub("\s{2,}", " ", token) + token = re.sub(r"\s{2,}", " ", token) if "\n" in token: token = token.replace("\n", " __newln__")