Repository: DS4SD/docling
Issue category: Bug Report

Issue:
Unable to run.
### Bug
<!-- Describe the buggy behavior you have observed. -->
PS C:\Users\genco> & C:/ProgramData/anaconda3/envs/docling/python.exe c:/Users/genco/OneDrive/Documents/marker_new/docling_convertor_testing.py
Fetching 9 files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9/9 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "c:\Users\genco\OneDrive\Documents\marker_new\docling_convertor_testing.py", line 5, in <module>
    result = converter.convert(source)
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\pydantic\validate_call_decorator.py", line 60, in wrapper_function
    return validate_call_wrapper(*args, **kwargs)
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\pydantic\_internal\_validate_call.py", line 96, in __call__
    res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\document_converter.py", line 161, in convert
    return next(all_res)
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\document_converter.py", line 180, in convert_all
    for conv_res in conv_res_iter:
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\document_converter.py", line 211, in _convert
    for item in map(
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\document_converter.py", line 255, in _process_document
    conv_res = self._execute_pipeline(in_doc, raises_on_error=raises_on_error)
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\document_converter.py", line 263, in _execute_pipeline
    pipeline = self._get_pipeline(in_doc.format)
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\document_converter.py", line 244, in _get_pipeline
    self.initialized_pipelines[pipeline_class] = pipeline_class(
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\pipeline\standard_pdf_pipeline.py", line 54, in __init__
    self.glm_model = GlmModel(options=GlmOptions())
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\docling\models\ds_glm_model.py", line 46, in __init__
    load_pretrained_nlp_models()
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\deepsearch_glm\utils\load_pretrained_models.py", line 120, in load_pretrained_nlp_models
    done, data = download_items(downloads)
  File "C:\ProgramData\anaconda3\envs\docling\lib\site-packages\deepsearch_glm\utils\load_pretrained_models.py", line 50, in download_items
    with target.open("wb") as fw:
  File "C:\ProgramData\anaconda3\envs\docling\lib\pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
PermissionError: [Errno 13] Permission denied: 'C:\\ProgramData\\anaconda3\\envs\\docling\\lib\\site-packages\\deepsearch_glm\\resources\\models\\crf\\part-of-speech\\crf_pos_model_en.bin'
### Steps to reproduce
<!-- Describe the sequence of steps for reproducing the bug. -->
run code: 
from docling.document_converter import DocumentConverter

source = "https://arxiv.org/pdf/2408.09869"  # PDF path or URL
converter = DocumentConverter()
result = converter.convert(source)
print(result.document.export_to_markdown())  # output: "### Docling Technical Report[...]"

### Docling version
<!-- Copy the output of `docling --version`. -->
latest version.

### Python version
<!-- Copy the output of `python --version`. -->
3.10.15

<!-- ⚠️ ATTENTION: When sharing screenshots, attachments, or other data make sure not to include any sensitive information. -->



Hints:
@ashunaveed Can you please tell us the exact version. There should be no need to download `crf_pos_model_en.bin`.

Please run, 

```
docling --version
```

We suspect that you have by chance an older version, but we want to be 100% sure.
I'm trying to run Docling on a server without internet connection so I have downloaded the layout model and tableformer from Hugging Face and then I try to run with custom artifact path as per your documentation:
```
pipeline_options = PdfPipelineOptions(artifacts_path=artifacts_path)
doc_converter = DocumentConverter(
    format_options={
        InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
    }
)
```
But I get an error similar to the OP (though for me the problem is timeout due to connection error).

I have tried with these versions:
Docling version: 2.5.1
Docling Core version: 2.3.2
Docling IBM Models version: 2.0.3
Docling Parse version: 2.0.3

and an older version:
Docling version: 2.3.1
Docling Core version: 2.3.1
Docling IBM Models version: 2.0.3
Docling Parse version: 2.0.2

And it tries to download the glm files in both versions.

I'm mostly curious to understand if the GLM files are needed as your answer above indicates that, at least crf_pos_model_en.bin, shouldn't be needed at all.

Patch:
diff --git a/docling/models/ds_glm_model.py b/docling/models/ds_glm_model.py
index e63bad3a..0a066bfa 100644
--- a/docling/models/ds_glm_model.py
+++ b/docling/models/ds_glm_model.py
@@ -43,7 +43,8 @@ class GlmModel:
     def __init__(self, options: GlmOptions):
         self.options = options
 
-        load_pretrained_nlp_models()
+        if self.options.model_names != "":
+            load_pretrained_nlp_models()
         self.model = init_nlp_model(model_names=self.options.model_names)
 
     def _to_legacy_document(self, conv_res) -> DsDocument:


Test patch: