Instructions to use giayphuyen/lora_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use giayphuyen/lora_model with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("./deepseek_ocr") model = PeftModel.from_pretrained(base_model, "giayphuyen/lora_model") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Desktop
|
Download README.md from giayphuyen/lora_model: direct link, hf CLI and curl.
- Browser
- Download file 906 Bytes
-
https://huggingface.co/giayphuyen/lora_model/resolve/main/README.md
- Command line
-
hf download hf://giayphuyen/lora_model/README.md
-
curl -L -o README.md https://huggingface.co/giayphuyen/lora_model/resolve/main/README.md
906 Bytes
metadata
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
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)