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

TypeError: BARTDecoder #234

Open
breisfeld opened this issue Jul 31, 2024 · 4 comments
Open

TypeError: BARTDecoder #234

breisfeld opened this issue Jul 31, 2024 · 4 comments

Comments

@breisfeld
Copy link

Hi,
After running the command

$ nougat.exe .\pharmaceutics-16-00226.pdf -o .\output -m 0.1.0-base

I get successful downloads, but then an error.
I get this same error on Windows and Linux in a fresh conda virtual environment.

WARNING:root:No GPU found. Conversion on CPU is very slow.
downloading nougat checkpoint version 0.1.0-base to path C:\Users\breisfel\.cache\torch\hub\nougat-0.1.0-base
config.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████| 560/560 [00:00<?, ?b/s]
pytorch_model.bin: 100%|██████████████████████████████████████████████████████████████████████████████████| 1.31G/1.31G [02:23<00:00, 9.79Mb/s]
special_tokens_map.json: 100%|██████████████████████████████████████████████████████████████████████████████████████| 96.0/96.0 [00:00<?, ?b/s]
tokenizer.json: 100%|█████████████████████████████████████████████████████████████████████████████████████| 2.04M/2.04M [00:00<00:00, 7.45Mb/s]
tokenizer_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████| 106/106 [00:00<?, ?b/s]
C:\Users\XXXXX\anaconda3\envs\extract_pdf_tables\Lib\site-packages\torch\functional.py:513: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3610.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
  0%|      bre                                                                                                             | 0/21 [02:38<?, ?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 "C:\Users\XXXXX\anaconda3\envs\extract_pdf_tables\Scripts\nougat.exe\__main__.py", line 7, in <module>
  File "C:\Users\XXXXX\anaconda3\envs\extract_pdf_tables\Lib\site-packages\predict.py", line 167, in main
    model_output = model.inference(
                   ^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXX\anaconda3\envs\extract_pdf_tables\Lib\site-packages\nougat\model.py", line 592, in inference
    decoder_output = self.decoder.model.generate(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXX\anaconda3\envs\extract_pdf_tables\Lib\site-packages\torch\utils\_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\XXXXX\anaconda3\envs\extract_pdf_tables\Lib\site-packages\transformers\generation\utils.py", line 1989, in generate
    result = self._sample(
             ^^^^^^^^^^^^^
  File "C:\Users\XXXXX\anaconda3\envs\extract_pdf_tables\Lib\site-packages\transformers\generation\utils.py", line 2925, 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!
-> 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!
@MaksimMrvica-plus
Copy link

you need install transformers==4.38.2

@breisfeld
Copy link
Author

Thanks, I'll give it a try. I just followed the README instructions and installed nougat and dependencies via pip.

@anshumankmr
Copy link

anshumankmr commented Sep 9, 2024

Sad there are so many bugs in this repo. Seems to work for me. Tested.
(using nougat_api and the git version of this repo on Windows 11)

@teknium1
Copy link

Can meta update the repo to pin the right transformers :]

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

4 participants