Преглед изворни кода

fix: remove trailing backslashes from strings in modeling_unimernet.py

myhloli пре 5 месеци
родитељ
комит
a392f445e8
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      mineru/model/mfr/unimernet/unimernet_hf/modeling_unimernet.py

+ 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