# OpenVLA 및 LIBERO 환경 구축
- [참고] https://kimelab.notion.site/OpenVLA-LIBERO-24f875de525f813984b9f84b75e5d5fb
- [다운로드]
(1) finetuning version: https://huggingface.co/openvla/openvla-7b-finetuned-libero-spatial/tree/main 의 모든 파일 다운로드
(2) original: https://huggingface.co/openvla/openvla-7b/tree/main
- 연구실의 우분투 서버: /home/vislab/.cache/huggingface/hub/openvla-7b-finetuned-libero-spatial/
폴더에 학습된 pt파일 및 관련 설정파일, 소스 등이 저장되어 있음
- [실행] ~/Downloads/openvla위치로 가서
> xvfb-run -a python experiments/robot/libero/run_libero_eval.py --model_family openvla --pretrained_checkpoint /home/vislab/.cache/huggingface/hub/openvla-7b-finetuned-libero-spatial/ --task_suite_name libero_spatial --center_crop True --num_trials_per_task 1
- [확인] /home/vislab/Downloads/openvla/rollouts/2026_02_26/ 폴더 위치에 만들어 지는 mp4파일을 열어봄
## Set-up: Conda Env
# Create and activate conda environment
conda create -n openvla python=3.10 -y
conda activate openvla
# CUDA 12.1 (Conda)
conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia -y
## Set-up: Openvla Repo
# Clone and install the openvla repo
git clone https://github.com/openvla/openvla.git
cd openvla
pip install -e .
# openvla pip 설치이후 Pytorch CPU 버전으로 downgrade 현상 체크
## Set-up(for Ubuntu): Ninja & Flash Attention 2
# Install Flash Attention 2 for training (https://github.com/Dao-AILab/flash-attention)
# =>> If you run into difficulty, try `pip cache remove flash_attn` first
pip install packaging ninja
# ninja --version; echo $? # Verify Ninja --> should return exit code "0"
# Linux GCC 필수 (윈도우에서는 MSVC 필요)
pip install "flash-attn==2.5.5" --no-build-isolation
## Inference Test — OpenVLA (Linux & Windows)
- [실행 스크립트] Source code: vla-scripts/extern/verify_openvla.py
# Install — LIBERO
## Clone and install the LIBERO repo
git clone https://github.com/Lifelong-Robot-Learning/LIBERO.git
cd LIBERO
pip install -e .
cd ..
## Install other required packages for OpenVLA
cd openvla
pip install -r experiments/robot/libero/libero_requirements.txt
# Launching LIBERO Evaluations (Only Linux)
## Set-up — 4-bit 양자화 모드
`openvla/experiments/robot/libero` 폴더 > `run_libero_eval.py`
GenerateConfig 클래스 > `load_in_4bit: bool = False` → `load_in_4bit: bool = True`
# Launch LIBERO-Spatial evals
python experiments/robot/libero/run_libero_eval.py \
--model_family openvla \
--pretrained_checkpoint openvla/openvla-7b-finetuned-libero-spatial \
--task_suite_name libero_spatial \
--center_crop True
python experiments/robot/libero/run_libero_eval.py --model_family openvla --pretrained_checkpoint openvla/openvla-7b-finetuned-libero-spatial --task_suite_name libero_spatial --center_crop True
# Launch LIBERO-Object evals
python experiments/robot/libero/run_libero_eval.py \
--model_family openvla \
--pretrained_checkpoint openvla/openvla-7b-finetuned-libero-object \
--task_suite_name libero_object \
--center_crop True
# Launch LIBERO-Goal evals
python experiments/robot/libero/run_libero_eval.py \
--model_family openvla \
--pretrained_checkpoint openvla/openvla-7b-finetuned-libero-goal \
--task_suite_name libero_goal \
--center_crop True
# Launch LIBERO-10 (LIBERO-Long) evals
python experiments/robot/libero/run_libero_eval.py \
--model_family openvla \
--pretrained_checkpoint openvla/openvla-7b-finetuned-libero-10 \
--task_suite_name libero_10 \
--center_crop True