Downloads · 30 days
3
18% of all-time downloads
yashwanthgowdanm/openvla_stretch_lora
openvla_stretch_lora is a robotics model from yashwanthgowdanm. Use it for the robotics task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
This repository contains the PEFT (LoRA) adapter weights for openvla/openvla-7b fine-tuned for pick-and-place manipulation tasks on the Hello Robot Stretch.
Downloads · 30 days
3
18% of all-time downloads
All-time downloads
17
Public
Repo size
34.1 MB
Likes
0
Public
Click a slice to open those files.
.safetensors33.6 MB · 93%
From the Hugging Face model README
This repository contains the PEFT (LoRA) adapter weights for openvla/openvla-7b fine-tuned for pick-and-place manipulation tasks on the Hello Robot Stretch.
openvla/openvla-7bpeft)q_proj), Key (k_proj), Value (v_proj), Output (o_proj)The model predicts actions in a 7-dimensional delta action space:
delta_x (End-effector / Base translation along X)delta_y (End-effector / Base translation along Y)delta_z (Lift position change)delta_roll (Wrist roll angle change)delta_pitch (Wrist pitch angle change)delta_yaw (Wrist yaw angle change)gripper_pos (Gripper open/close target position)Continuous actions are normalized to the range [-1.0, 1.0] and discretized into 256 uniform bins mapped to OpenVLA action token IDs [31744 - 31999].
5e-4 with cosine decay and warmupweight_decay=0.01)bfloat16 / float16~0.1192To load and generate physical action predictions, combine the base OpenVLA model with this fine-tuned LoRA adapter:
import torch
import numpy as np
from PIL import Image
from transformers import AutoProcessor, AutoModelForVision2Seq
from peft import PeftModel
# 1. Define Model Identifiers
BASE_MODEL = "openvla/openvla-7b"
LORA_MODEL = "https://huggingface.co/yashwanthgowdanm/openvla_stretch_lora"
device = "cuda" if torch.cuda.is_available() else "cpu"
# 2. Dataset Min/Max Bounds used during training (update to match your exact bounds)
ACTION_MIN = np.array([-0.05, -0.05, -0.05, -0.1, -0.1, -0.1, 0.0])
ACTION_MAX = np.array([ 0.05, 0.05, 0.05, 0.1, 0.1, 0.1, 1.0])
# 3. Load Base Model and Apply LoRA Adapter
processor = AutoProcessor.from_pretrained(BASE_MODEL, trust_remote_code=True)
base_model = AutoModelForVision2Seq.from_pretrained(
BASE_MODEL,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
trust_remote_code=True,
low_cpu_mem_usage=True
).to(device)
model = PeftModel.from_pretrained(base_model, LORA_MODEL).to(device)
model.eval()
# 4. Prepare Input Image & Prompt
image_path = "path/to/camera_frame.jpg"
image = Image.open(image_path).convert("RGB")
prompt = "In: What action should the robot take to pick up the water bottle?\nOut:"
inputs = processor(text=prompt, images=image, return_tensors="pt").to(device)
# 5. Predict Action
with torch.no_grad():
generated_ids = model.generate(
input_ids=inputs["input_ids"],
pixel_values=inputs["pixel_values"].to(dtype=model.dtype),
max_new_tokens=7,
do_sample=False
)
# Extract predicted action token IDs (last 7 generated tokens)
predicted_tokens = generated_ids[0, -7:].cpu().numpy()
# 6. Un-quantize Token IDs to Physical Robot Commands
bin_indices = np.clip(predicted_tokens - 31744, 0, 255)
norm_actions = (bin_indices / 256.0) * 2.0 - 1.0
physical_actions = 0.5 * (norm_actions + 1.0) * (ACTION_MAX - ACTION_MIN) + ACTION_MIN
print("Predicted Physical Delta Action:", physical_actions)