binary-husky / binary-husky/gpt_academic

[Bug]: RuntimeError: Nougat解析论文失败。

Open
#1,885 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
71.3k
Forks
8.3k
PR merge metrics
No merged PRs in 30d

Description

### Installation Method | 安装方法与平台

Anaconda (I used latest requirements.txt)

### Version | 版本

Latest | 最新版

### OS | 操作系统

Windows

### Describe the bug | 简述

```
Traceback (most recent call last):
File ".\toolbox.py", line 221, in decorated
yield from f(main_input, llm_kwargs, plugin_kwargs, chatbot_with_cookie, history, *args, **kwargs)
File ".\crazy_functions\批量翻译PDF文档_NOUGAT.py", line 93, in 批量翻译PDF文档
yield from 解析PDF_基于NOUGAT(file_manifest, project_folder, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt)
File ".\crazy_functions\批量翻译PDF文档_NOUGAT.py", line 111, in 解析PDF_基于NOUGAT
fpp = yield from nougat_handle.NOUGAT_parse_pdf(fp, chatbot, history)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".\crazy_functions\crazy_utils.py", line 612, in NOUGAT_parse_pdf
raise RuntimeError("Nougat解析论文失败。")
RuntimeError: Nougat解析论文失败。
```

### Screen Shot | 有帮助的截图

![image](https://github.com/binary-husky/gpt_academic/assets/146852649/2728c21f-ec1a-48f4-949f-75963abbc138)
![image](https://github.com/binary-husky/gpt_academic/assets/146852649/c1c4c250-5ce1-4e54-8978-ae47fc7cf725)

### Terminal Traceback & Material to Help Reproduce Bugs | 终端traceback(如有) + 帮助我们复现的测试材料样本(如有)

```
C:\Users\23243\anaconda3\envs\academic\Lib\site-packages\torch\functional.py:512: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:3588.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
0%| | 0/17 [02:44", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Users\23243\anaconda3\envs\academic\Scripts\nougat.exe\__main__.py", line 7, in
File "C:\Users\23243\anaconda3\envs\academic\Lib\site-packages\predict.py", line 167, in main
model_output = model.inference(
^^^^^^^^^^^^^^^^
File "C:\Users\23243\anaconda3\envs\academic\Lib\site-packages\nougat\model.py", line 592, in inference
decoder_output = self.decoder.model.generate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\23243\anaconda3\envs\academic\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\23243\anaconda3\envs\academic\Lib\site-packages\transformers\generation\utils.py", line 1914, in generate
result = self._sample(
^^^^^^^^^^^^^
File "C:\Users\23243\anaconda3\envs\academic\Lib\site-packages\transformers\generation\utils.py", line 2648, in _sample
model_inputs = self.prepare_inputs_for_generation(input_ids, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BARTDecoder.prepare_inputs_for_inference() got an unexpected keyword argument 'cache_position'
-> Cannot close object, library is destroyed. This may cause a memory leak!
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with crazy_functions/crazy_utils.py and crazy_functions/批量翻译PDF文档_NOUGAT.py, then inspect requirements.txt and reproduce the Nougat PDF path on Windows. Check the reported Transformers generation error involving cache_position and confirm that a compatible dependency setup allows the sample PDF to finish parsing without the RuntimeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.