Downloads · 30 days
7
17% of all-time downloads
giayphuyen/lora_model
lora_model is a image-text-to-text model from giayphuyen. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as mit.
This repository contains LoRA fine-tuned weights for the model deepseek-ai/DeepSeek-OCR, specialized for OCR tasks.
Downloads · 30 days
7
17% of all-time downloads
All-time downloads
42
Public
Repo size
311 MB
Likes
0
Public
Click a slice to open those files.
.safetensors311 MB · 97%
From the Hugging Face model README
This repository contains LoRA fine-tuned weights for the model deepseek-ai/DeepSeek-OCR, specialized for OCR tasks.
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)