File size: 906 Bytes
660e429 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
---
base_model: deepseek-ai/DeepSeek-OCR
library_name: peft
tags:
- lora
- ocr
- deepseek
- unsloth
pipeline_tag: image-text-to-text
license: mit
---
# LoRA Adapter for DeepSeek-OCR (Vietnamese Bills)
This repository contains LoRA fine-tuned weights for the model
**deepseek-ai/DeepSeek-OCR**, specialized for OCR tasks.
## Usage
```python
from transformers import AutoModel, AutoTokenizer
from peft import PeftModel
import torch
base = "deepseek-ai/DeepSeek-OCR"
lora = "giayphuyen/lora_model"
tokenizer = AutoTokenizer.from_pretrained(base, trust_remote_code=True)
model = AutoModel.from_pretrained(base, trust_remote_code=True).cuda()
model = PeftModel.from_pretrained(model, lora)
model = model.eval().to(torch.bfloat16)
prompt = "<image>\nExtract the text."
image = "your_image.jpg"
res = model.infer(
tokenizer,
prompt=prompt,
image_file=image,
output_path=".",
)
print(res)
|