# yichao-liang/rma4rma architecture

> Architecture diagram of the GitHub repository yichao-liang/rma4rma, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yichao-liang/rma4rma
- Repository: https://github.com/yichao-liang/rma4rma

## Overview

RMA² trains and evaluates manipulation policies in randomized ManiSkill2 environments. Its main workflow is configuration and environment creation, PPO training with privileged information, adapter training to infer the policy embedding from depth and proprioception, then checkpoint-based evaluation. The graph retains the five task implementations and the algorithm’s policy, model, rollout, callback, and evaluation layers. Some internal calls are established only by the SOURCE INDEX or README; unsampled details are not assumed.

Main entry points: [`src/rma4rma/train.py`](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/train.py) (Training entry), [`src/rma4rma/tasks/__init__.py`](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/__init__.py) (Task registry), [`src/rma4rma/algo/policy.py`](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/policy.py) (RMA actor-critic), [`src/rma4rma/algo/evaluate_policy.py`](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/evaluate_policy.py) (Policy evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Run orchestration"]
  node_train["Training entry<br/>[train.py]"]
  node_config["Run configuration<br/>[config.py]"]
end

subgraph group_tasks["Manipulation tasks"]
  node_taskmap["Task registry<br/>[__init__.py]"]
  node_pick_single["YCB / EGAD pick<br/>[pick_single.py]"]
  node_pick_cube["Cube pick<br/>[pick_cube.py]"]
  node_stack_cube["Cube stacking<br/>[stack_cube.py]"]
  node_peg["Peg insertion<br/>[peg_insertion.py]"]
  node_faucet["Faucet turning<br/>[turn_faucet.py]"]
end

subgraph group_learning["Learning algorithm"]
  node_ppo["PPO and ADR<br/>[ppo.py]"]
  node_policy["RMA actor-critic<br/>[policy.py]"]
  node_models["Encoders and CNNs<br/>[models.py]"]
  node_buffer["Rollout buffer<br/>[buffer.py]"]
  node_adaptation["Adapter training<br/>[adaptation.py]"]
end

subgraph group_support["Runtime support"]
  node_callbacks["Training callbacks<br/>[callbacks.py]"]
  node_evaluation["Policy evaluation<br/>[evaluate_policy.py]"]
  node_misc["Wrappers and schedules<br/>[misc.py]"]
end

node_operator(("CLI user"))

node_operator -->|"runs"| node_train
node_train -->|"parses and configures"| node_config
node_train -->|"selects task"| node_taskmap
node_taskmap -->|"maps task"| node_pick_single
node_taskmap -->|"maps task"| node_pick_cube
node_taskmap -->|"maps task"| node_stack_cube
node_taskmap -->|"maps task"| node_peg
node_taskmap -->|"maps task"| node_faucet
node_config -->|"uses wrappers"| node_misc
node_train -->|"creates learner"| node_ppo
node_train -->|"configures policy"| node_policy
node_train -->|"runs phase two"| node_adaptation
node_train -->|"uses callbacks"| node_callbacks
node_train -->|"evaluates checkpoint"| node_evaluation
node_ppo -->|"uses rollout buffer"| node_buffer
node_policy -->|"builds networks"| node_models
node_callbacks -->|"invokes evaluation"| node_evaluation
node_adaptation -->|"uses utilities"| node_misc
node_evaluation -->|"predicts actions"| node_policy

click node_train "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/train.py"
click node_config "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/config.py"
click node_taskmap "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/__init__.py"
click node_pick_single "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/pick_single.py"
click node_pick_cube "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/pick_cube.py"
click node_stack_cube "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/stack_cube.py"
click node_peg "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/peg_insertion.py"
click node_faucet "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/turn_faucet.py"
click node_ppo "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/ppo.py"
click node_policy "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/policy.py"
click node_models "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/models.py"
click node_buffer "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/buffer.py"
click node_adaptation "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/adaptation.py"
click node_callbacks "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/callbacks.py"
click node_evaluation "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/evaluate_policy.py"
click node_misc "https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/misc.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_train,node_config,node_operator toneBlue
class node_taskmap,node_pick_single,node_pick_cube,node_stack_cube,node_peg,node_faucet toneAmber
class node_ppo,node_policy,node_models,node_buffer,node_adaptation toneMint
class node_callbacks,node_evaluation,node_misc toneRose
```

## Components

### Run orchestration

- [Training entry](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/train.py): `src/rma4rma/train.py`
- [Run configuration](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/config.py): `src/rma4rma/config.py`

### Manipulation tasks

- [Task registry](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/__init__.py): `src/rma4rma/tasks/__init__.py`
- [YCB / EGAD pick](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/pick_single.py): `src/rma4rma/tasks/pick_single.py`
- [Cube pick](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/pick_cube.py): `src/rma4rma/tasks/pick_cube.py`
- [Cube stacking](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/stack_cube.py): `src/rma4rma/tasks/stack_cube.py`
- [Peg insertion](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/peg_insertion.py): `src/rma4rma/tasks/peg_insertion.py`
- [Faucet turning](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/tasks/turn_faucet.py): `src/rma4rma/tasks/turn_faucet.py`

### Learning algorithm

- [PPO and ADR](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/ppo.py): `src/rma4rma/algo/ppo.py`
- [RMA actor-critic](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/policy.py): `src/rma4rma/algo/policy.py`
- [Encoders and CNNs](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/models.py): `src/rma4rma/algo/models.py`
- [Rollout buffer](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/buffer.py): `src/rma4rma/algo/buffer.py`
- [Adapter training](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/adaptation.py): `src/rma4rma/algo/adaptation.py`

### Runtime support

- [Training callbacks](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/callbacks.py): `src/rma4rma/algo/callbacks.py`
- [Policy evaluation](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/evaluate_policy.py): `src/rma4rma/algo/evaluate_policy.py`
- [Wrappers and schedules](https://github.com/yichao-liang/rma4rma/blob/main/src/rma4rma/algo/misc.py): `src/rma4rma/algo/misc.py`

### Other components

- **CLI user**

## Connections

- CLI user → Training entry: runs (evidence: `README.md`)
- Training entry → Run configuration: parses and configures (evidence: `src/rma4rma/train.py`)
- Training entry → Task registry: selects task (evidence: `src/rma4rma/train.py`)
- Task registry → YCB / EGAD pick: maps task (evidence: `src/rma4rma/tasks/__init__.py`)
- Task registry → Cube pick: maps task (evidence: `src/rma4rma/tasks/__init__.py`)
- Task registry → Cube stacking: maps task (evidence: `src/rma4rma/tasks/__init__.py`)
- Task registry → Peg insertion: maps task (evidence: `src/rma4rma/tasks/__init__.py`)
- Task registry → Faucet turning: maps task (evidence: `src/rma4rma/tasks/__init__.py`)
- Run configuration → Wrappers and schedules: uses wrappers (evidence: `src/rma4rma/config.py`)
- Training entry → PPO and ADR: creates learner (evidence: `src/rma4rma/train.py`)
- Training entry → RMA actor-critic: configures policy (evidence: `src/rma4rma/train.py`)
- Training entry → Adapter training: runs phase two (evidence: `README.md`)
- Training entry → Training callbacks: uses callbacks (evidence: `src/rma4rma/train.py`)
- Training entry → Policy evaluation: evaluates checkpoint (evidence: `src/rma4rma/train.py`)
- PPO and ADR → Rollout buffer: uses rollout buffer (evidence: `src/rma4rma/algo/ppo.py`)
- RMA actor-critic → Encoders and CNNs: builds networks (evidence: `src/rma4rma/algo/policy.py`)
- Training callbacks → Policy evaluation: invokes evaluation (evidence: `src/rma4rma/algo/callbacks.py`)
- Adapter training → Wrappers and schedules: uses utilities (evidence: `src/rma4rma/algo/adaptation.py`)
- Policy evaluation → RMA actor-critic: predicts actions (evidence: `src/rma4rma/algo/evaluate_policy.py`)
