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

why for :{"detail":"Review the parameters to initialize a UnstructuredTableTransformerModel obj"} #379

Open
J2DOG opened this issue Feb 26, 2024 · 6 comments

Comments

@J2DOG
Copy link

J2DOG commented Feb 26, 2024

Describe the bug
Defult mode is OK, but when i try to set hi_res mode!!!
it turns to :{"detail":"Review the parameters to initialize a UnstructuredTableTransformerModel obj"}
it runs in a local Unstructured-api docker image.

headers = {
'accept': 'application/json',
}
data = {
'strategy': 'hi_res',
# 'pdf_infer_table_structure': 'true',
# 'strategy': 'ocr_only',

}

@awalker4
Copy link
Collaborator

awalker4 commented Mar 4, 2024

Hi there - this may be a bug with our api docker image. Can you let me know what endpoint you're calling? The freemium (api.unstructured.io) or a paid SaaS url? Please include a minimal working example of your client code as well.

@MthwRobinson
Copy link
Contributor

@J2DOG - If you're still having this issue, could you provide client code to reproduce? This may be fixed in a more recent version of the API.

@spongxin
Copy link

spongxin commented Jun 4, 2024

as same when i run "docker run -p 8009:8000 -d --rm --name unstructured-api downloads.unstructured.io/unstructured-io/unstructured-api:latest --port 8000 --host 0.0.0.0" and "curl -X 'POST' 'http://localhost:8009/general/v0/general' -H 'accept: application/json' -H 'Content-Type: multipart/form-data' -F 'strategy=hi_res' -F 'languages=eng' -F '[email protected]' | jq -C . | less -R > a.json"

@alimoezzi
Copy link

alimoezzi commented Jun 29, 2024

@MthwRobinson @awalker4 I'm having the same issue with downloads.unstructured.io/unstructured-io/unstructured-api:latest

  File "/home/notebook-user/prepline_general/api/general.py", line 723, in response_generator                                                                                                                                                                             
    response = pipeline_api(                                                                                                                                                                                                                                              
               ^^^^^^^^^^^^^                                                                                                                                                                                                                                              
  File "/home/notebook-user/prepline_general/api/general.py", line 410, in pipeline_api                                                                                                                                                                                   
    elements = partition_pdf_splits(                                                                                                                                                                                                                                      
               ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                      
  File "/home/notebook-user/prepline_general/api/general.py", line 190, in partition_pdf_splits                                                                                                                                                                           
    return partition(                                                                                                                                                                                                                                                     
           ^^^^^^^^^^                                                                                                                                                                                                                                                     
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/auto.py", line 427, in partition                                                                                                                                                   
    elements = _partition_pdf(                                                                                                                                                                                                                                            
               ^^^^^^^^^^^^^^^                                                                                                                                                                                                                                            
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/documents/elements.py", line 593, in wrapper                                                                                                                                                 
    elements = func(*args, **kwargs)                                                                                                                                                                                                                                      
               ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                      
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/file_utils/filetype.py", line 626, in wrapper                                                                                                                                                
    elements = func(*args, **kwargs)                                                                                                                                                                                                                                      
               ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                      
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/file_utils/filetype.py", line 582, in wrapper                                                                                                                                                
    elements = func(*args, **kwargs)                                                                                                                                                                                                                                      
               ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                      
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/chunking/dispatch.py", line 74, in wrapper                                                                                                                                                   
    elements = func(*args, **kwargs)                                                                                                                                                                                                                                      
               ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                      
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/pdf.py", line 192, in partition_pdf                                                                                                                                                
    return partition_pdf_or_image(                                                                                                                                                                                                                                        
           ^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                        
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/pdf.py", line 288, in partition_pdf_or_image                                                                                                                                       
    elements = _partition_pdf_or_image_local(                                                                                                                                                                                                                             
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                             
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/utils.py", line 249, in wrapper                                                                                                                                                              
    return func(*args, **kwargs)                                                                                                                                                                                                                                          
           ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                          
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/pdf.py", line 621, in _partition_pdf_or_image_local                                                                                                                                
    final_document_layout = process_data_with_ocr(                                                                                                                                                                                                                        
                            ^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                        
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/pdf_image/ocr.py", line 74, in process_data_with_ocr                                                                                                                               
    merged_layouts = process_file_with_ocr(                                                                                                                                                                                                                               
                     ^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                               
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/utils.py", line 249, in wrapper                                                                                                                                                              
    return func(*args, **kwargs)                                                                                                                                                                                                                                          
           ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                          
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/pdf_image/ocr.py", line 174, in process_file_with_ocr                                                                                                                              
    raise e                                                                                                                                                                                                                                                               
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/pdf_image/ocr.py", line 162, in process_file_with_ocr                                                                                                                              
    merged_page_layout = supplement_page_layout_with_ocr(                                                                                                                                                                                                                 
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                 
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/utils.py", line 249, in wrapper                                                                                                                                                              
    return func(*args, **kwargs)                                                                                                                                                                                                                                          
           ^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                                                                                          
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured/partition/pdf_image/ocr.py", line 236, in supplement_page_layout_with_ocr                                                                                                                    
    tables.load_agent()                                                                                                                                                                                                                                                   
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured_inference/models/tables.py", line 139, in load_agent                                                                                                                                         
    tables_agent.initialize("microsoft/table-transformer-structure-recognition")                                                                                                                                                                                          
  File "/home/notebook-user/.local/lib/python3.11/site-packages/unstructured_inference/models/tables.py", line 74, in initialize                                                                                                                                          
    raise ImportError(                                                                                                                                                                                                                                                    
ImportError: Review the parameters to initialize a UnstructuredTableTransformerModel obj

@Falven
Copy link

Falven commented Sep 11, 2024

# Cache table-transformer-structure-recognition model
RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download(repo_id='microsoft/table-transformer-structure-recognition', filename='config.json');"

@qq157755587
Copy link

I encountered the same issue, and it seemed to be an error when downloading "microsoft/table-transformer-structure-recognition" from Hugging Face. I resolved it after switching to a different VPN line.

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

No branches or pull requests

7 participants