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# Instantiate config (see class GenerateConfig in experiments/robot/libero/run_libero_eval.py for definitions)
6cfg = GenerateConfig(
7 pretrained_checkpoint = "moojink/openvla-7b-oft-finetuned-libero-spatial",
8 use_l1_regression = True,
9 use_diffusion = False,
10 use_film = False,
11 num_images_in_input = 2,
12 use_proprio = True,
13 load_in_8bit = False,
14 load_in_4bit = False,
15 center_crop = True,
16 num_open_loop_steps = NUM_ACTIONS_CHUNK,
17 unnorm_key = "libero_spatial_no_noops",
18)
19# Load OpenVLA-OFT policy and inputs processor
20vla = get_vla(cfg)
21processor = get_processor(cfg)
22
23# Load MLP action head to generate continuous actions (via L1 regression)
24action_head = get_action_head(cfg, llm_dim=vla.llm_dim)
25# Load proprio projector to map proprio to language embedding space
26proprio_projector = get_proprio_projector(cfg, llm_dim=vla.llm_dim, proprio_dim=PROPRIO_DIM)
27
28# Load sample observation:
29# observation (dict): {
30# "full_image": primary third-person image,
31# "wrist_image": wrist-mounted camera image,
32# "state": robot proprioceptive state,
33# "task_description": task description,
34# }
35with open("experiments/robot/libero/sample_libero_spatial_observation.pkl", "rb") as file:
36 observation = pickle.load(file)
37# Generate robot action chunk (sequence of future actions)
38actions = get_vla_action(cfg, vla, processor, observation, observation["task_description"], action_head, proprio_projector)
39print("Generated action chunk:")
40for act in actions:
41 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}