docling-project / docling-project/docling

Qwen2VLForConditionalGeneration.__init__() got an unexpected keyword argument 'dtype'

Open
#2,544 4 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug
Cant use the DocumentExtractor using the example code from the documentation due to error

--> 144 self.vlm_model = AutoModelForImageTextToText.from_pretrained(
145 artifacts_path,
146 device_map=self.device,
147 dtype=self.vlm_options.torch_dtype,
148 _attn_implementation=(
149 "flash_attention_2"
150 if self.device.startswith("cuda")
151 and accelerator_options.cuda_use_flash_attention2
152 else "sdpa"
153 ),
154 trust_remote_code=vlm_options.trust_remote_code,
155 )

TypeError: Qwen2VLForConditionalGeneration.__init__() got an unexpected keyword argument 'dtype'
...

### Steps to reproduce
Run the following code

class Invoice(BaseModel):
bill_no: str = Field(
examples=["A123", "5414"]
) # provide some examples, but no default value
total: float = Field(
default=10, examples=[20]
) # provide some examples and a default value
tax_id: Optional[str] = Field(default=None, examples=["1234567890"])

result = extractor.extract(
source=path_to_file,
template=Invoice,
)
print(result.pages)
...

### Docling version

Version: 2.58.0

### Python version
Python 3.10.13

...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.