Views
No views yet
1from transformers import AutoModelForVision2Seq, AutoProcessor
2from PIL import Image
3
4import torch
5
6# Load Processor & VLA
7processor = AutoProcessor.from_pretrained("Juelg/openvla-7b-finetuned-maniskill", trust_remote_code=True)
8vla = AutoModelForVision2Seq.from_pretrained(
9 "openvla/openvla-7b",
10 attn_implementation="flash_attention_2", # [Optional] Requires `flash_attn`
11 torch_dtype=torch.bfloat16,
12 low_cpu_mem_usage=True,
13 trust_remote_code=True
14).to("cuda:0")
15
16# Grab image input & format prompt
17image: Image.Image = get_from_camera(...)
18prompt = "In: What action should the robot take to {<INSTRUCTION>}?
19Out:"
20
21# Predict Action (7-DoF franka; un-normalize for maniskill env)
22inputs = processor(prompt, image).to("cuda:0", dtype=torch.bfloat16)
23action = vla.predict_action(**inputs, unnorm_key="maniskill_human:7.0.0", do_sample=False)
24
25# Execute...
26robot.act(action, ...)@inproceedings{juelg2025refinedpolicydistillationvla,
title={{Refined Policy Distillation}: {F}rom {VLA} Generalists to {RL} Experts},
author={Tobias Jülg and Wolfram Burgard and Florian Walter},
year={2025},
booktitle={Proc.~of the IEEE/RSJ Int.~Conf.~on Intelligent Robots and Systems (IROS)},
note={Accepted for publication.}
}