A video-language model fine-tuned to detect naughty vs nice pet behavior with a sarcastic pet detective persona.
PetVLM runs on Mac computers with Apple Silicon (M1/M2/M3) using Metal Performance Shaders (MPS).
1# Install dependencies
2pip install torch torchvision torchaudio
3pip install transformers peft accelerate
4pip install qwen-vl-utils imageio[ffmpeg]
5
6# Run inference
7python inference_mac.py your_video.mp4
1import torch
2from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
3from peft import PeftModel
4
5# Use MPS for Apple Silicon
6device = "mps" if torch.backends.mps.is_available() else "cpu"
7
8# Load model
9model = Qwen2VLForConditionalGeneration.from_pretrained(
10 "Qwen/Qwen2-VL-2B-Instruct",
11 torch_dtype=torch.float16
12).to(device)
13
14model = PeftModel.from_pretrained(model, "Raullen/petvlm")
15model.eval()
16
17processor = AutoProcessor.from_pretrained("Raullen/petvlm")