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

issue while running the code #71

Open
samanofficial opened this issue Sep 23, 2023 · 7 comments
Open

issue while running the code #71

samanofficial opened this issue Sep 23, 2023 · 7 comments

Comments

@samanofficial
Copy link

print(q, p(question=q, **doc.context))

Exception: You cannot use pop on a ModelOutput instance.

@julianzz98
Copy link

Running into the same problem...

System:

  • Ubuntu 22.04

Installed docquery via:

  • pip install docquery

Trying to use docquery using:

  • docquery scan "What are the street names?" ./plantest.pdf

Output:

document-question-answering is already registered. Overwriting pipeline for task document-question-answering...
2023-09-23 21:49:30,121 INFO: Loading ./plantest.pdf
2023-09-23 21:49:30,126 INFO: Done loading 1 file(s).
2023-09-23 21:49:30,126 INFO: Loading pipelines.
Downloading (…)/ff904df/config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 789/789 [00:00<00:00, 2.71MB/s]
Downloading (…)okenizer_config.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 315/315 [00:00<00:00, 1.01MB/s]
Downloading (…)e/ff904df/vocab.json: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 798k/798k [00:00<00:00, 2.91MB/s]
Downloading (…)e/ff904df/merges.txt: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 456k/456k [00:00<00:00, 3.28MB/s]
Downloading (…)904df/tokenizer.json: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1.36M/1.36M [00:00<00:00, 2.85MB/s]
Downloading (…)cial_tokens_map.json: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 239/239 [00:00<00:00, 872kB/s]
Downloading pytorch_model.bin: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 511M/511M [03:20<00:00, 2.55MB/s]
2023-09-23 21:52:56,516 INFO: Ready to start evaluating!
2023-09-23 21:53:10,667 ERROR: Failed while processing ./plantest.pdf on question: 'What are the street names?'
Traceback (most recent call last):
  File "/usr/local/bin/docquery", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/docquery/cmd/__main__.py", line 61, in main
    return args.func(args)
  File "/usr/local/lib/python3.10/dist-packages/docquery/cmd/scan.py", line 95, in main
    response = nlp(question=q, **d.context)
  File "/usr/local/lib/python3.10/dist-packages/docquery/ext/pipeline_document_question_answering.py", line 232, in __call__
    return super().__call__({"question": question, "pages": normalized_images}, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/base.py", line 1132, in __call__
    return next(
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/pt_utils.py", line 124, in __next__
    item = next(self.iterator)
  File "/usr/local/lib/python3.10/dist-packages/transformers/pipelines/pt_utils.py", line 291, in __next__
    is_last = item.pop("is_last")
  File "/usr/local/lib/python3.10/dist-packages/transformers/utils/generic.py", line 376, in pop
    raise Exception(f"You cannot use ``pop`` on a {self.__class__.__name__} instance.")
Exception: You cannot use ``pop`` on a ModelOutput instance.

@AnuragJha003
Copy link

@samanofficial @julianzz98 Hey hello there !
I had the same error and was able to get rid of it by downgrading the transformers library like this:

pip uninstall transformers
pip install transformers==4.23

@julianzz98
Copy link

@AnuragJha003 thank you, was finally able to test it and the library downgrade made it work!

I think this issue can be closed now.

@shikhasingh1797
Copy link

(mydoc) PS C:\Users\N_B\OneDrive\Desktop\docquery> docquery scan "What is the title?" "https://www.zomato.com/"

document-question-answering is already registered. Overwriting pipeline for task document-question-answering...
Traceback (most recent call last):
File "C:\Users\N_B\Miniconda3\envs\mydoc\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "C:\Users\N_B\Miniconda3\envs\mydoc\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\N_B\Miniconda3\envs\mydoc\Scripts\docquery.exe_main
.py", line 7, in
File "C:\Users\N_B\Miniconda3\envs\mydoc\lib\site-packages\docquery\cmd_main
.py", line 61, in main
return args.func(args)
File "C:\Users\N_B\Miniconda3\envs\mydoc\lib\site-packages\docquery\cmd\scan.py", line 54, in main
if pathlib.Path(args.path).is_dir():
File "C:\Users\N_B\Miniconda3\envs\mydoc\lib\pathlib.py", line 1373, in is_dir
return S_ISDIR(self.stat().st_mode)
File "C:\Users\N_B\Miniconda3\envs\mydoc\lib\pathlib.py", line 1183, in stat
return self._accessor.stat(self)
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'https:\www.zomato.com'
(mydoc) PS C:\Users\N_B\OneDrive\Desktop\docquery>

@alexlorans
Copy link

Hi, I run into the same problem, but when I tried to downgrade transformers I get an error:

ERROR: Failed building wheel for tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects

any ideas?
Thanks

@julianzz98
Copy link

@alexlorans maybe check your Python version. If you use Python 3.11+ there might be issues, try it again using Python 3.10 as I used this version back then :)

@varun-affinsys
Copy link

For users using Python3.9 and Ubuntu, below combination works:
(After pip install docquery)
transformers==4.23
pydantic==1.10

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

6 participants