Skip to content

Commit

Permalink
Update translate_once.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Huanshere committed Sep 12, 2024
1 parent 0b6b5f2 commit f019913
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions core/translate_once.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ def retry_translation(prompt, model, step_name):
translate_result = "\n".join([express_result[i]["Free Translation"].replace('\n', ' ').strip() for i in express_result])

if len(lines.split('\n')) != len(translate_result.split('\n')):
print_msg = f'❌ Translation of block {index} failed, Length Mismatch, Please check `output/gpt_log/translate_expressiveness.json`, expected {len(lines.split("\n"))} lines, but got {len(translate_result.split("\n"))} lines.'
print(print_msg)
print(f'❌ Translation of block {index} failed, Length Mismatch, Please check `output/gpt_log/translate_expressiveness.json`')
raise ValueError(f'Original ···{lines}···,\nbut got ···{translate_result}···')
else:
print(f'✅ Translation of block {index} completed')
Expand Down

0 comments on commit f019913

Please sign in to comment.