#!/usr/bin/env python3 """ Mobile VLA 사용 예제 """ import torch from transformers import AutoTokenizer, AutoProcessor from PIL import Image import numpy as np def load_mobile_vla_model(model_name="minuum/mobile-vla"): """Mobile VLA 모델 로드""" # 여기서 실제 모델 로딩 로직 구현 print(f"Loading Mobile VLA model: {model_name}") # 실제 구현에서는 MobileVLATrainer를 사용 # from robovlms.train.mobile_vla_trainer import MobileVLATrainer # model = MobileVLATrainer.from_pretrained(model_name) return None # 플레이스홀더 def predict_action(model, image_path, task_description): """액션 예측""" # 이미지 로드 image = Image.open(image_path).convert("RGB") # 전처리 (실제 구현에서는 mobile_vla_collate_fn 사용) # processed = preprocess_image(image) # 예측 (플레이스홀더) dummy_action = [0.5, 0.2, 0.1] # [linear_x, linear_y, angular_z] return dummy_action def main(): """메인 실행 함수""" print("🚀 Mobile VLA 예제 실행") # 모델 로드 model = load_mobile_vla_model() # 예제 예측 task = "Navigate around obstacles to track the target cup" action = predict_action(model, "example_image.jpg", task) print(f"Task: {task}") print(f"Predicted Action: {action}") print(f" - Linear X (forward/backward): {action[0]:.3f}") print(f" - Linear Y (left/right): {action[1]:.3f}") print(f" - Angular Z (rotation): {action[2]:.3f}") if __name__ == "__main__": main()