Metadata-Version: 2.1
Name: lerobot
Version: 0.1.0
Summary: Le robot is learning
Home-page: https://github.com/Cadene/lerobot
License: MIT
Author: Rémi Cadène
Author-email: re.cadene@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Build Tools
Requires-Dist: cython (>=3.0.8,<4.0.0)
Requires-Dist: diffusers (>=0.26.3,<0.27.0)
Requires-Dist: dm-env (>=1.6,<2.0)
Requires-Dist: einops (>=0.7.0,<0.8.0)
Requires-Dist: gdown (>=5.1.0,<6.0.0)
Requires-Dist: gym (>=0.26.2,<0.27.0)
Requires-Dist: h5py (>=3.10.0,<4.0.0)
Requires-Dist: hydra-core (>=1.3.2,<2.0.0)
Requires-Dist: imageio[pyav] (>=2.34.0,<3.0.0)
Requires-Dist: moviepy (>=1.0.3,<2.0.0)
Requires-Dist: mpmath (>=1.3.0,<2.0.0)
Requires-Dist: mujoco (>=3.1.2,<4.0.0)
Requires-Dist: mujoco-py (>=2.1.2.14,<3.0.0.0)
Requires-Dist: numba (>=0.59.0,<0.60.0)
Requires-Dist: omegaconf (>=2.3.0,<3.0.0)
Requires-Dist: opencv-python (>=4.9.0.80,<5.0.0.0)
Requires-Dist: pandas (>=2.2.1,<3.0.0)
Requires-Dist: pygame (>=2.5.2,<3.0.0)
Requires-Dist: pymunk (>=6.6.0,<7.0.0)
Requires-Dist: scikit-image (>=0.22.0,<0.23.0)
Requires-Dist: shapely (>=2.0.3,<3.0.0)
Requires-Dist: termcolor (>=2.4.0,<3.0.0)
Requires-Dist: torch (>=2.2.1,<3.0.0)
Requires-Dist: torchvision (>=0.17.1,<0.18.0)
Requires-Dist: wandb (>=0.16.3,<0.17.0)
Requires-Dist: zarr (>=2.17.0,<3.0.0)
Project-URL: Repository, https://github.com/Cadene/lerobot
Description-Content-Type: text/markdown

# LeRobot

## Installation

Create a virtual environment with python 3.10, e.g. using `conda`:
```
conda create -y -n lerobot python=3.10
conda activate lerobot
```

[Install `poetry`](https://python-poetry.org/docs/#installation) (if you don't have it already)
```
curl -sSL https://install.python-poetry.org | python -
```

Install dependencies
```
poetry install
```

If you encounter a disk space error, try to change your tmp dir to a location where you have enough disk space, e.g.
```
mkdir ~/tmp
export TMPDIR='~/tmp'
```

Install `diffusion_policy` #HACK
```
# from this directory
git clone https://github.com/real-stanford/diffusion_policy
cp -r diffusion_policy/diffusion_policy $(poetry env info -p)/lib/python3.10/site-packages/
```

## Usage


### Train

```
python lerobot/scripts/train.py \
hydra.job.name=pusht \
env=pusht
```

### Visualize offline buffer

```
python lerobot/scripts/visualize_dataset.py \
hydra.run.dir=tmp/$(date +"%Y_%m_%d") \
env=pusht
```

### Visualize online buffer / Eval

```
python lerobot/scripts/eval.py \
hydra.run.dir=tmp/$(date +"%Y_%m_%d") \
env=pusht
```


## TODO

- [x] priority update doesnt match FOWM or original paper
- [x] self.step=100000 should be updated at every step to adjust to horizon of planner
- [ ] prefetch replay buffer to speedup training
- [ ] parallelize env to speedup eval
- [ ] clean checkpointing / loading
- [ ] clean logging
- [ ] clean config
- [ ] clean hyperparameter tuning
- [ ] add pusht
- [ ] add aloha
- [ ] add act
- [ ] add diffusion
- [ ] add aloha 2

## Profile

**Example**
```python
from torch.profiler import profile, record_function, ProfilerActivity

def trace_handler(prof):
    prof.export_chrome_trace(f"tmp/trace_schedule_{prof.step_num}.json")

with profile(
    activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA],
    schedule=torch.profiler.schedule(
        wait=2,
        warmup=2,
        active=3,
    ),
    on_trace_ready=trace_handler
) as prof:
    with record_function("eval_policy"):
        for i in range(num_episodes):
            prof.step()
```

```bash
python lerobot/scripts/eval.py \
pretrained_model_path=/home/rcadene/code/fowm/logs/xarm_lift/all/default/2/models/final.pt \
eval_episodes=7
```

## Contribute

**Style**
```
# install if needed
pre-commit install
# apply style and linter checks before git commit
pre-commit run -a
```

**Tests**
```
pytest -sx tests
```

