-
|
@dosu The code was executing yesterday but now gives a pytorch error: from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend def docling_table_to_df(table): def extract_pdf_page_tables(name, pdf_path, page_number): RuntimeError Traceback (most recent call last) RuntimeError: Only a single TORCH_LIBRARY can be used to register the namespace prims; please put all of your definitions in a single TORCH_LIBRARY block. If you were trying to specify implementations, consider using TORCH_LIBRARY_IMPL (which can be duplicated). If you really intended to define operators for a single namespace in a distributed way, you can use TORCH_LIBRARY_FRAGMENT to explicitly indicate this. Previous registration of TORCH_LIBRARY was registered at /data/envs/onprem_models312/lib/python3.12/site-packages/torch/_prims/init.py:37; latest registration was registered at /data/envs/onprem_models312/lib/python3.12/site-packages/torch/_prims/init.py:37 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
This PyTorch error is almost always caused by a conflict or corruption in your Python environment—typically from incompatible versions of torch, transformers, or other dependencies, or from multiple torch installations. Docling itself does not register custom PyTorch operators, so the issue is not in your code or in docling, but in the environment or a third-party package being loaded at import time. This can happen if, for example, transformers was recently upgraded (especially to >=4.52.0), or if click or torch was upgraded/downgraded, or if you have multiple torch installations (system + venv, or conda + pip). It can also be triggered by custom or third-party PyTorch extensions. Here's what to do:
Let me know the output of pip freeze and if any packages or the OS were recently changed, and I can help further debug. To reply, just mention @dosu. Docs are dead. Just use Dosu. |
Beta Was this translation helpful? Give feedback.
The problem I forget to add offline modelling path so there was a conflict when I restart the kernel problem has fixed