Unstructured-IO / Unstructured-IO/unstructured-inference

TypeError: get_model() got an unexpected keyword argument 'ocr_languages' when using strategy=hi_res

Open
#329 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
209
Forks
73
PR merge metrics
No merged PRs in 30d

Description

System Info : python3.10
Environment Details : Google Collab

Error encountered when trying to use elements with pdf using hi_res strategy :
elements = partition_pdf("myPDFfile.pdf", strategy="hi_res")

Error output:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-58-69a6eb81afc1>](https://localhost:8080/#) in <cell line: 1>()
----> 1 elements = partition_pdf("myPDFfile.pdf", strategy="hi_res")

5 frames
[/usr/local/lib/python3.10/dist-packages/unstructured_inference/inference/layout.py](https://localhost:8080/#) in process_file_with_model(filename, model_name, is_image, fixed_layouts, pdf_image_dpi, **kwargs)
    375     model_name."""
    376 
--> 377     model = get_model(model_name, **kwargs)
    378     if isinstance(model, UnstructuredObjectDetectionModel):
    379         detection_model = model

TypeError: get_model() got an unexpected keyword argument 'ocr_languages'

what is this ocr_languages argument??? I am unable to use the table mode preservation with unstructured at all due to this Appreciate any assistance.

p/s: I have already tried loading some older versions of unstructured and unstructured_inference as mention in other gh repo issue but no difference for me.

I followed the blog post, but got stuck from there onwards despite consulting all relevant docs.

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 with partition_pdf(..., strategy="hi_res") and the traceback location in unstructured_inference/inference/layout.py, then inspect how ocr_languages is passed to get_model. Reproduce the failure in the stated Python 3.10 Google Colab setup and check the linked strategy documentation. Done means hi_res PDF partitioning no longer raises this TypeError and table mode preservation can be used.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.