SUSYUSTC / MathTranslate

translate scientific papers in latex, especially arxiv papers
https://github.com/SUSYUSTC/MathTranslate
Apache License 2.0
1.04k stars 69 forks source link

Translation doesn't work. #92

Open stemplock opened 6 months ago

stemplock commented 6 months ago

A great idea for a program, but unfortunately, despite all my efforts, I could not get it to work on Arch Linux. Neither method worked. Meanwhile, the demo version works great. Unfortunately, you cannot select the translation language there. Could you check the code or download the docker image from your working demo version? Thank you in advance. I will be looking forward to your answer.

SUSYUSTC commented 6 months ago

Currently the command line version allows you to select the language, but the website is still not supporting it. Additionally the current code is optimized for translation to Chinese only. Other languages should work in principle but never tested.

stemplock commented 6 months ago

I was unable to run the command line version as well. There were errors with streams. When I set threads to 1. Parsing errors appeared. My default configuration uses Google, en, de (de-DE - tested in different formats. I don’t know how to do it correctly.) It also couldn’t be translated into Chinese. The document is loaded quite successfully, but then stops. `

The current mathtranslate is latest Start engine google language from en language to de_DE threads auto

arxiv number: 2304.03442

temporary directory /tmp/tmpw4zke45z main tex files found: ./main.tex merging ./content/introduction.tex merging ./content/related_work.tex merging ./content/gameworld.tex merging ./figures/map.tex merging ./figures/daily_routine.tex merging ./figures/valentine.tex merging ./figures/architecture-figure.tex merging ./content/architecture.tex merging ./figures/retrieval.tex merging ./figures/reflection.tex merging ./content/implementation.tex merging ./content/technical_eval.tex merging ./figures/rank_score.tex merging ./content/designer_eval.tex merging ./figures/info_diffusion.tex merging ./content/discussion.tex merging ./content/conclusion.tex merging ./content/appendix.tex Processing ./main Cache is found It is a full latex document 14%|███████▉ | 19/139 [00:20<00:04, 26.61it/s] 14%|████████▎ | 20/139 [00:30<03:01, 1.53s/it] ^CTraceback (most recent call last): File "/home/st/PROJECT/2024/MathTranslate/venv/lib/python3.11/site-packages/mathtranslate/translate.py", line 246, in translate_full_latex latex_translated_paragraphs = list(tqdm.auto.tqdm(executor.map(self.worker, latex_original_paragraphs), total=len(latex_original_paragraphs))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/st/PROJECT/2024/MathTranslate/venv/lib/python3.11/site-packages/tqdm/std.py", line 1182, in iter for obj in iterable: File "/usr/lib/python3.11/concurrent/futures/_base.py", line 619, in result_iterator yield _result_or_cancel(fs.pop()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 317, in _result_or_cancel return fut.result(timeout) ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/concurrent/futures/_base.py", line 451, in result self._condition.wait(timeout) File "/usr/lib/python3.11/threading.py", line 327, in wait waiter.acquire() KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/st/PROJECT/2024/MathTranslate/venv/bin/translate_arxiv", line 8, in sys.exit(main()) ^^^^^^ File "/home/st/PROJECT/2024/MathTranslate/venv/lib/python3.11/site-packages/mathtranslate/translate_arxiv.py", line 176, in main raise e File "/home/st/PROJECT/2024/MathTranslate/venv/lib/python3.11/site-packages/mathtranslate/translate_arxiv.py", line 166, in main success = translate_dir('.', options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/st/PROJECT/2024/MathTranslate/venv/lib/python3.11/site-packages/mathtranslate/translate_arxiv.py", line 91, in translate_dir translate_single_tex_file(file_path, file_path, options.engine, options.l_from, options.l_to, options.debug, options.nocache, options.threads) File "/home/st/PROJECT/2024/MathTranslate/venv/lib/python3.11/site-packages/mathtranslate/translate.py", line 273, in translate_single_tex_file text_final = latex_translator.translate_full_latex(text_original, nocache=nocache) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/st/PROJECT/2024/MathTranslate/venv/lib/python3.11/site-packages/mathtranslate/translate.py", line 245, in translate_full_latex with concurrent.futures.ThreadPoolExecutor(max_workers=self.threads) as executor: File "/usr/lib/python3.11/concurrent/futures/_base.py", line 647, in exit self.shutdown(wait=True) File "/usr/lib/python3.11/concurrent/futures/thread.py", line 235, in shutdown t.join() File "/usr/lib/python3.11/threading.py", line 1119, in join self._wait_for_tstate_lock() File "/usr/lib/python3.11/threading.py", line 1139, in _wait_for_tstate_lock if lock.acquire(block, timeout): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyboardInterrupt

` Can you check this? It is very difficult to read scientific articles in English.