Prechádzať zdrojové kódy

fix: remove trailing backslashes from strings in modeling_unimernet.py

myhloli 5 mesiacov pred
rodič
commit
a392f445e8

+ 4 - 0
mineru/model/mfr/unimernet/unimernet_hf/modeling_unimernet.py

@@ -374,6 +374,10 @@ def latex_rm_whitespace(s: str):
     # \qquad后补空格
     s = QQUAD_PATTERN.sub(r'\\qquad ', s)
 
+    # 如果字符串以反斜杠结尾,去掉最后的反斜杠
+    while s.endswith('\\'):
+        s = s[:-1]
+
     return s