Views
No views yet
merge_and_unload()1import torch
2from transformers import AutoModelForVision2Seq, AutoProcessor
3from PIL import Image
4
5# Load model and processor
6model = AutoModelForVision2Seq.from_pretrained(
7 "korea-deep-learning/Qwen2.5-VL-7B-TableRecog",
8 torch_dtype=torch.bfloat16,
9 device_map="auto",
10 trust_remote_code=True
11)
12
13processor = AutoProcessor.from_pretrained(
14 "korea-deep-learning/Qwen2.5-VL-7B-TableRecog",
15 trust_remote_code=True
16)
17
18# Prepare image and text
19image = Image.open("table_image.png")
20text = "Extract the table content and structure from this image."
21
22# Process inputs
23inputs = processor(text=text, images=image, return_tensors="pt").to(model.device)
24
25# Generate output
26with torch.no_grad():
27 outputs = model.generate(**inputs, max_new_tokens=1024)
28
29result = processor.decode(outputs[0], skip_special_tokens=True)
30print(result)1@misc{qwen2.5-vl-tablerecog,
2 author = {Korea Deep Learning Team},
3 title = {Qwen2.5-VL-7B-TableRecog: Table Recognition Model},
4 year = {2025},
5 publisher = {HuggingFace},
6 howpublished = {\url{https://huggingface.co/korea-deep-learning/Qwen2.5-VL-7B-TableRecog}},
7}