PAPO-7B
Collection
The collection of 7B PAPO models
•
4 items
•
Updated
This is the official model released for the paper Perception-Aware Policy Optimization for Multimodal Reasoning.
Project Page: https://mikewangwzhl.github.io/PAPO/ Code: https://github.com/mikewangwzhl/PAPO
PAPO (γ=0.02)
This model can be loaded and used with the transformers
library.
from transformers import AutoProcessor, AutoModelForCausalLM
from PIL import Image
import requests
# Load the processor and model
# Note: Replace "PAPOGalaxy/PAPO-Qwen2.5-7B" with the actual model ID if different
processor = AutoProcessor.from_pretrained("PAPOGalaxy/PAPO-Qwen2.5-7B", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("PAPOGalaxy/PAPO-Qwen2.5-7B", trust_remote_code=True)
# Example image (replace with your image URL or local path)
image_url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/tasks/preprocessor_config_vln.png"
image = Image.open(requests.get(image_url, stream=True).raw).convert("RGB")
# Define your prompt
prompt = "What are the main objects in this image?"
# Format messages for the model
messages = [
{"role": "user", "content": [{"type": "image", "content": image}, {"type": "text", "text": prompt}]}
]
# Apply chat template and tokenize
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
input_ids = processor(text, return_tensors="pt").input_ids
# Generate response
output_ids = model.generate(
input_ids,
max_new_tokens=100,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
# Decode and print the generated text
generated_text = processor.decode(output_ids[0], skip_special_tokens=True)
print(generated_text)