LeMEM 是一个面向 LeRobot 0.6.0 与 pi0.5 的即插即用记忆模块。 它提供统一配置、数据适配、运行时包装、训练包装与离线预处理能力,可直接接入现有 LeRobot 训练流程。
- 统一管理不同记忆策略
- 接入 pi0.5 训练与推理流程
- 支持离线子目标预处理
- 支持可替换的记忆选择、表示与融合模块
- 提供模块化 Python 包与命令行入口
cd <LEMEM_ROOT>
python -m pip install -e .cd <LEMEM_ROOT>
python -m pip install .如果你的环境里已经有 LeRobot 0.6.0、pi0.5 及其依赖,LeMEM 可作为补丁包直接安装。
from lerobot_policy_lemem import (
LeMEMConfig,
attach_lemem_to_trainer,
build_LeMEM_finetune_plan,
build_LeMEM_pi05_training_components,
make_lemem_trainer_bundle,
wrap_with_lemem,
)
config = LeMEMConfig.from_LeMEM_profile("perceptual-framesamp-modul", num_memory_frames=8)
plan = build_LeMEM_finetune_plan(config=config)
dataset, pi05_config, preprocessor, postprocessor = build_LeMEM_pi05_training_components(plan=plan)policy = wrap_with_lemem(pi05_policy, config, dataset_stats=dataset.meta.stats)bundle = make_lemem_trainer_bundle(pi05_policy, config, dataset_stats=dataset.meta.stats)
bundle.build_processors(pi05_config)
bundle.install_runtime()
policy = bundle.policybundle = attach_lemem_to_trainer(trainer, pi05_policy, config)perceptual-framesamp-contextperceptual-framesamp-modulperceptual-tokendrop-contextperceptual-tokendrop-modul
recurrent-rmt-contextrecurrent-rmt-modulrecurrent-ttt-contextrecurrent-ttt-modul
symbolic-simple-subgoalsymbolic-grounded-subgoal
bridgevla_spatiotemporal
frame_stacklast_nnearestretrievalreservoirrecency_retrievalscore_decay
lemem-plan --profile perceptual-framesamp-modul --num-memory-frames 8 --max-siglip-frames 4
# Use only when GPU memory is sufficient for the 32-frame benchmark window:
lemem-plan --profile perceptual-framesamp-modul --full-memory-32 --max-siglip-frames 4Note: num_memory_frames controls the history window, while LeMEM_max_siglip_frames / --max-siglip-frames caps the number of frames actually encoded by SigLIP. Historical memory vision encoding is frozen by default, so training updates LeMEM memory/modulation parameters without pushing every 32-frame history window through the vision tower with gradients.
lemem-subgoal --helplemem-preprocess --helpsrc/lerobot_policy_lemem/:源码tests/:单元测试docs/diagrams/:机制图
python -m compileall -q src tests
python -m unittest discover -s tests -v- 默认推荐配置为
perceptual-framesamp-modul symbolic-simple-subgoal和symbolic-grounded-subgoal走符号记忆路径bridgevla_spatiotemporal走结构化字段路径
