Views
No views yet
1import pickle
2from experiments.robot.libero.run_libero_eval import GenerateConfig
3from experiments.robot.openvla_utils import get_action_head, get_processor, get_proprio_projector, get_vla, get_vla_action
4from prismatic.vla.constants import NUM_ACTIONS_CHUNK, PROPRIO_DIM
5
6# Instantiate config (see class GenerateConfig in experiments/robot/libero/run_libero_eval.py for definitions)
7cfg = GenerateConfig(
8 pretrained_checkpoint = "moojink/openvla-7b-oft-finetuned-libero-spatial",
9 use_l1_regression = True,
10 use_diffusion = False,
11 use_film = False,
12 num_images_in_input = 2,
13 use_proprio = True,
14 load_in_8bit = False,
15 load_in_4bit = False,
16 center_crop = True,
17 num_open_loop_steps = NUM_ACTIONS_CHUNK,
18 unnorm_key = "libero_spatial_no_noops",
19)
20
21# Load OpenVLA-OFT policy and inputs processor
22vla = get_vla(cfg)
23processor = get_processor(cfg)
24
25# Load MLP action head to generate continuous actions (via L1 regression)
26action_head = get_action_head(cfg, llm_dim=vla.llm_dim)
27
28# Load proprio projector to map proprio to language embedding space
29proprio_projector = get_proprio_projector(cfg, llm_dim=vla.llm_dim, proprio_dim=PROPRIO_DIM)
30
31# Load sample observation:
32# observation (dict): {
33# "full_image": primary third-person image,
34# "wrist_image": wrist-mounted camera image,
35# "state": robot proprioceptive state,
36# "task_description": task description,
37# }
38with open("experiments/robot/libero/sample_libero_spatial_observation.pkl", "rb") as file:
39 observation = pickle.load(file)
40
41# Generate robot action chunk (sequence of future actions)
42actions = get_vla_action(cfg, vla, processor, observation, observation["task_description"], action_head, proprio_projector)
43print("Generated action chunk:")
44for act in actions:
45 print(act)1@article{kim2025fine,
2 title={Fine-Tuning Vision-Language-Action Models: Optimizing Speed and Success},
3 author={Kim, Moo Jin and Finn, Chelsea and Liang, Percy},
4 journal={arXiv preprint arXiv:2502.19645},
5 year={2025}
6}