Downloads · 30 days
0
MMoshtaghi/Qwen2-VL-7B-Instruct-LoRAAdpt-MathOCR
Qwen2-VL-7B-Instruct-LoRAAdpt-MathOCR is a machine learning model from MMoshtaghi. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
- Developed by: MMoshtaghi - License: apache-2.0 - Finetuned from model : unsloth/qwen2-vl-7b-instruct-unsloth-bnb-4bit - Finetuned on dataset: unsloth/LaTeXOCR - PEFT method : Quantized LoRA
Downloads · 30 days
0
Access
Public
Updated Jan 17, 2025
Repo size
215 MB
Likes
2
Public
Click a slice to open those files.
.safetensors204 MB · 93%
From the Hugging Face model README
from datasets import load_dataset
from unsloth import FastVisionModel
model, tokenizer = FastVisionModel.from_pretrained(
model_name = "MMoshtaghi/Qwen2-VL-7B-Instruct-LoRAAdpt-MathOCR",
load_in_4bit = True,
)
FastVisionModel.for_inference(model) # Enable for inference!
dataset = load_dataset("unsloth/LaTeX_OCR", split = "train")
image = dataset[0]["image"]
instruction = "Write the LaTeX representation for this image."
messages = [
{"role": "user", "content": [
{"type": "image"},
{"type": "text", "text": instruction}
]}
]
input_text = tokenizer.apply_chat_template(messages, add_generation_prompt = True)
inputs = tokenizer(
image,
input_text,
add_special_tokens = False,
return_tensors = "pt",
).to("cuda")
from transformers import TextStreamer
text_streamer = TextStreamer(tokenizer, skip_prompt = True)
_ = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128,
use_cache = True, temperature = 1.5, min_p = 0.1)
(Log-in required!) <img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>
This VLM model was trained 2x faster with Unsloth and Huggingface's TRL library.