소스 검색

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