Views
No views yet
Qwen2-VL-2B-Instruct, specifically optimized for converting handwritten mathematical formulas into machine-readable LaTeX format. The fine-tuning process leverages the unsloth framework for efficient low-bit precision training, making it suitable for deployment on resource-constrained environments.unsloth for optimized performance.transformers.transformers library:1from transformers import AutoModelForCausalLM, AutoProcessor
2import torch
3
4model_name = "path_to_your_finetuned_model"
5model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16)
6processor = AutoProcessor.from_pretrained(model_name)
7
8# Load an image and get LaTeX output
9image = "path_to_handwritten_math_image.jpg"
10inputs = processor(images=image, return_tensors="pt")
11outputs = model.generate(**inputs)
12latex_code = processor.batch_decode(outputs, skip_special_tokens=True)
13print("Generated LaTeX:", latex_code)