Unstructured-IO / Unstructured-IO/unstructured

bug/unstructured_inference.models.yolox.UnstructuredYoloXModel.initialize() failed

Open
#4,063 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
HTML
Stars
15.5k
Forks
1.3k
Avg merge
4d 2h
Merged PRs (30d)
13

Description

Describe the bug
It occured at unstructured.partition.pdf(), when strategy=hi_res,
if strategy=fast, it unable to extract from pdf.

TypeError: unstructured_inference.models.yolox.UnstructuredYoloXModel.initialize() argument after ** must be a mapping, not LazyDict

elements = partition_pdf(
filename=file_path,
strategy=strategy,
infer_table_structure=True,
hi_res_model_name=model_name,
languages=['chi_sim']
)

Traceback (most recent call last):
File "/root/autodl-tmp/aicode/hw-chat-0.1-jry/data/parse/unstructured_processor.py", line 38, in
lambda: self.process_file(file_path, strategy, model_name),
File "/root/autodl-tmp/aicode/hw-chat-0.1-jry/data/parse/unstructured_processor.py", line 133, in process_file
elements = partition_pdf(
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/documents/elements.py", line 585, in wrapper
elements = func(*args, **kwargs)
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/file_utils/filetype.py", line 816, in wrapper
elements = func(*args, **kwargs)
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/file_utils/filetype.py", line 774, in wrapper
elements = func(*args, **kwargs)
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/chunking/dispatch.py", line 74, in wrapper
elements = func(*args, **kwargs)
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/partition/pdf.py", line 228, in partition_pdf
return partition_pdf_or_image(
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/partition/pdf.py", line 341, in partition_pdf_or_image
elements = _partition_pdf_or_image_local(
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/utils.py", line 216, in wrapper
return func(*args, **kwargs)
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured/partition/pdf.py", line 646, in _partition_pdf_or_image_local
inferred_document_layout = process_file_with_model(
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured_inference/inference/layout.py", line 371, in process_file_with_model
model = get_model(model_name, **kwargs)
File "/root/miniconda3/envs/hw-chat-npu/lib/python3.10/site-packages/unstructured_inference/models/base.py", line 97, in get_model
model.initialize(**initialize_params)
TypeError: unstructured_inference.models.yolox.UnstructuredYoloXModel.initialize() argument after ** must be a mapping, not LazyDict

It seems to be a initialize yolox model failed. How can i fix this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure with partition_pdf using strategy=hi_res and the shown model and language arguments. Trace the call from unstructured/partition/pdf.py through unstructured_inference/inference/layout.py and models/base.py to inspect the initialize parameters passed to UnstructuredYoloXModel. Done means the TypeError is resolved and PDF extraction works for the reported strategies.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.