Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: 使用NOUGAT 精准翻译PDF文档功能时报错,查找不到GPU #1686

Open
Yyyyyyyy09 opened this issue Apr 7, 2024 · 3 comments

Comments

@Yyyyyyyy09
Copy link

Installation Method | 安装方法与平台

Anaconda (I used latest requirements.txt)

Version | 版本

Latest | 最新版

OS | 操作系统

Windows

Describe the bug | 简述

使用NOUGAT 精准翻译PDF文档功能时报错

1. 终端报错:

WARNING:root:No GPU found. Conversion on CPU is very slow.
E:\Anaconda\envs\gptac_venv\Lib\site-packages\torch\functional.py:507: 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:3550.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
  0%|                                                                                            | 0/8 [01:51<?, ?it/s]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "E:\Anaconda\envs\gptac_venv\Scripts\nougat.exe\__main__.py", line 7, in <module>
  File "E:\Anaconda\envs\gptac_venv\Lib\site-packages\predict.py", line 167, in main
    model_output = model.inference(
                   ^^^^^^^^^^^^^^^^
  File "E:\Anaconda\envs\gptac_venv\Lib\site-packages\nougat\model.py", line 592, in inference
    decoder_output = self.decoder.model.generate(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Anaconda\envs\gptac_venv\Lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "E:\Anaconda\envs\gptac_venv\Lib\site-packages\transformers\generation\utils.py", line 1527, in generate
    result = self._greedy_search(
             ^^^^^^^^^^^^^^^^^^^^
  File "E:\Anaconda\envs\gptac_venv\Lib\site-packages\transformers\generation\utils.py", line 2408, in _greedy_search
    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!
-> Cannot close object, library is destroyed. This may cause a memory leak!
-> Cannot close object, library is destroyed. This may cause a memory leak!
-> Cannot close object, library is destroyed. This may cause a memory leak!
-> Cannot close object, library is destroyed. This may cause a memory leak!
-> Cannot close object, library is destroyed. This may cause a memory leak!
-> Cannot close object, library is destroyed. This may cause a memory leak!
-> Cannot close object, library is destroyed. This may cause a memory leak!

2. Web界面报错:

Traceback (most recent call last):
  File ".\toolbox.py", line 203, 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 599, in NOUGAT_parse_pdf
    raise RuntimeError("Nougat解析论文失败。")
RuntimeError: Nougat解析论文失败。

Screen Shot | 有帮助的截图

image
image

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

No response

@binaryYuki
Copy link
Contributor

需要安装带cuda的pytorch

@Yyyyyyyy09
Copy link
Author

需要安装带cuda的pytorch

就是说amd显卡没办法用这个插件了吧

@binaryYuki
Copy link
Contributor

binaryYuki commented Apr 12, 2024

@Yyyyyyyy09

wait.. 这个问题似乎是 gpu 驱动造成的 但是可能需要作者确认一下

我建议是尝试一下使用最新版本

如果还是不行可以尝试排除 cpu 的调用问题:
可以试试 amd-gpu
驱动在 https://repo.radeon.com/amdgpu-install/latest/ubuntu/focal/
装完可以试试

import torch
torch.cuda.is_available()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants