Views
No views yet
1import torch
2from peft import PeftModel
3from transformers import Qwen2VLForConditionalGeneration
4
5# 1. Load the Base Vision-Language Model
6base_model = Qwen2VLForConditionalGeneration.from_pretrained(
7 "Qwen/Qwen2-VL-2B-Instruct",
8 torch_dtype=torch.float16, # Recommended to save memory
9 device_map="auto" # Automatically dispatches to GPU
10)
11
12# 2. Apply your trained LoRA adapter
13model = PeftModel.from_pretrained(base_model, "PrathamMMallya99/textilenet-qwen-lora")
14model.eval()
15
16print("Successfully loaded VLM and LoRA adapter!")