Imitation Learning with ACT (Action Chunking Transformer)
This notebook demonstrates how to use the ACT (Action Chunking Transformer) model for imitation learning tasks for Aloha Robot, with OpenVINO optimization for efficient inference.
Content
Imitation Learning with ACT (Action Chunking Transformer)
This notebook demonstrates how to use the ACT (Action Chunking Transformer) model for imitation learning tasks for Aloha Robot, with OpenVINO optimization for efficient inference.
Note: This notebook currently supports Ubuntu 22.04, Python 3.11-3.12 only.
Overview
Imitation learning is a machine learning approach where a model learns to mimic expert behavior by observing and replicating demonstrations. ACT is an action chunking policy that uses Transformers for sequence modeling and is trained as a conditional VAE (CVAE) to capture variability in human data. It significantly outperforms previous imitation learning algorithms on various simulated and real-world fine manipulation tasks.
For more details, see the original paper: Action Chunking Transformer
Contents
This notebook covers:
- Prerequisites - Downloading pre-trained weights
- Dependency Installation - Setting up required packages and repositories
- Model Conversion - Converting PyTorch checkpoint to OpenVINO IR format
- Device Selection - Choosing target hardware for inference
- Policy Evaluation - Running the trained policy on simulation tasks
Requirements
- OpenVINO 2025.4.1
- PyTorch 2.7.1
- MuJoCo 3.2.6
- Additional dependencies (automatically installed by the notebook)
Pre-trained Weights
Pre-trained weights for the sim_insertion_scripted task are required. The notebook will automatically download and extract them from:
Installation
The notebook handles all installation automatically, including:
- Cloning the edge-ai-suites repository at revision
95113c44e2636f57a54ffefd3cc5622fc3f55f92(sparse checkout) - Setting up the ACT pipeline from the robotics-ai-suite
- Installing DETR (Detection Transformer) dependencies
- Applying OpenVINO-specific patches
- Installing all required Python packages
The source revision is pinned because the suites have since moved to separate repositories. Only the OpenVINO patch series is applied; the IPEX series is an alternative implementation. Setup stops if the required patches cannot be applied or the conversion script is missing. Re-running setup recognizes an already applied OpenVINO patch series.
Usage
Simply run the notebook cells in order:
- Download Pre-trained Weights - Downloads and extracts model checkpoint
- Install Dependencies - Sets up environment and installs packages
- Convert Model - Converts PyTorch checkpoint to OpenVINO IR format
- Select Device - Choose CPU, GPU, or other available hardware
- Evaluate Policy - Run inference and evaluate the policy performance
Model Conversion
The conversion uses the following parameters:
python3 ov_convert.py --ckpt_path <path> --height 480 --weight 640 --camera_num 4 --chunk_size 100
Evaluation
The evaluation script runs with these default parameters:
python3 imitate_episodes.py \
--task_name sim_insertion_scripted \
--ckpt_dir <path> \
--policy_class ACT \
--kl_weight 10 \
--chunk_size 100 \
--hidden_dim 512 \
--batch_size 8 \
--dim_feedforward 3200 \
--num_epochs 2000 \
--lr 1e-5 \
--seed 0 \
--device CPU/GPU \
--eval
Repository Structure
aloha-act/
├── aloha-act.ipynb # Main notebook
├── README.md # This file
├── sim_insertion_scripted/ # Downloaded pre-trained weights
│ └── four_camera/
│ └── policy_best.ckpt
└── edge-ai-suites/ # Cloned ACT pipeline
└── robotics-ai-suite/
└── pipelines/
└── act-sample/
References
- ACT Paper - Action Chunking Transformer
- OpenVINO Toolkit
- Edge AI Suites
- Original ACT Implementation
Source and license
- Source
- Intel OpenVINO Notebooks
- Original
- openvinotoolkit/openvino_notebooks/notebooks/aloha-act
- License
- Apache-2.0