A high-performance reinforcement learning agent implementation for MetaWorld robotics tasks, featuring both PPO and SAC algorithms with JAX/Flax backend.
🚀 Features
Dual Algorithm Support: Implementation of both PPO (Proximal Policy Optimization) and SAC (Soft Actor-Critic) algorithms
MetaWorld Integration: Optimized for MetaWorld robotics benchmark tasks (MT10, MT50)
JAX/Flax Backend: High-performance neural networks with JAX for fast training and inference
Multi-Task Learning: Support for training on multiple MetaWorld tasks simultaneously
Comprehensive Evaluation: Built-in evaluation framework with TensorBoard logging
Checkpoint Management: Automatic model checkpointing and restoration
Server Mode: RPC server for remote agent deployment
📋 Supported Tasks
The agent supports all MetaWorld tasks including:
reach-v3 - Object reaching
push-v3 - Object pushing
pick-place-v3 - Object pick and place
door-open-v3 - Door opening
drawer-open-v3 - Drawer opening
And 45+ other manipulation tasks
🛠️ Installation
Prerequisites
Python 3.12+
MuJoCo (for MetaWorld environments)
Quick Start
bash
1# Clone the repository2git clone <repository-url>3cd kinitro-metaworld-agent
45# Install with uv (recommended)6uv sync78# Or install with pip9pip install -e .
Hardware-Specific Dependencies
For different hardware acceleration:
bash
1# CPU only2uv sync --extra cpu
34# Apple Metal (M1/M2 Macs)5uv sync --extra metal
67# CUDA 128uv sync --extra cuda12
910# TPU11uv sync --extra tpu
🏃♂️ Quick Start
Training a Model
Train PPO Model (Multi-Task)
python train_ppo_model.py --seed 42
Train SAC Model (MT10)
python train_sac_model.py --seed 42
Running the Agent
Start Agent Server
python main.py server --host localhost --port 8000
Local Evaluation
bash
1# Evaluate on reach task2python main.py eval --task reach-v3 --episodes 1034# Evaluate with custom model5python main.py eval --task push-v3 --episodes 5 --model-path ./checkpoints/mt50_ppo_42/checkpoints/1999990
67# List all available tasks8python main.py eval --list-tasks
📊 Algorithm Details
PPO (Proximal Policy Optimization)
Configuration: Multi-task learning on MT50
Features: GAE, value function clipping, KL divergence constraint
Network: Continuous action policy with vanilla MLP architecture
Training: 16 epochs, 32 gradient steps per update
SAC (Soft Actor-Critic)
Configuration: Off-policy learning with replay buffer
Features: Temperature auto-tuning, twin Q-networks, entropy regularization
Network: Continuous action policy with Q-value ensemble