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# Load MLP action head to generate continuous actions (via L1 regression)
23action_head = get_action_head(cfg, llm_dim=vla.llm_dim)
24# Load proprio projector to map proprio to language embedding space
25proprio_projector = get_proprio_projector(cfg, llm_dim=vla.llm_dim, proprio_dim=PROPRIO_DIM)
26
27# Load sample observation:
28# observation (dict): {
29# "full_image": primary third-person image,
30# "wrist_image": wrist-mounted camera image,
31# "state": robot proprioceptive state,
32# "task_description": task description,
33# }
34with open("experiments/robot/libero/sample_libero_spatial_observation.pkl", "rb") as file:
35 observation = pickle.load(file)
36# Generate robot action chunk (sequence of future actions)
37actions = get_vla_action(cfg, vla, processor, observation, observation["task_description"], action_head, proprio_projector)
38print("Generated action chunk:")
39for act in actions:
40 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}