# 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Cadene/lerobot",
"name": "lerobot",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "R\u00e9mi Cad\u00e8ne",
"author_email": "re.cadene@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2e/a2/2c04103e737097030018bd4f2971ae70ec7b8adfa5afcada8d5b4373358a/lerobot-0.1.0.tar.gz",
"platform": null,
"description": "# LeRobot\n\n## Installation\n\nCreate a virtual environment with python 3.10, e.g. using `conda`:\n```\nconda create -y -n lerobot python=3.10\nconda activate lerobot\n```\n\n[Install `poetry`](https://python-poetry.org/docs/#installation) (if you don't have it already)\n```\ncurl -sSL https://install.python-poetry.org | python -\n```\n\nInstall dependencies\n```\npoetry install\n```\n\nIf you encounter a disk space error, try to change your tmp dir to a location where you have enough disk space, e.g.\n```\nmkdir ~/tmp\nexport TMPDIR='~/tmp'\n```\n\nInstall `diffusion_policy` #HACK\n```\n# from this directory\ngit clone https://github.com/real-stanford/diffusion_policy\ncp -r diffusion_policy/diffusion_policy $(poetry env info -p)/lib/python3.10/site-packages/\n```\n\n## Usage\n\n\n### Train\n\n```\npython lerobot/scripts/train.py \\\nhydra.job.name=pusht \\\nenv=pusht\n```\n\n### Visualize offline buffer\n\n```\npython lerobot/scripts/visualize_dataset.py \\\nhydra.run.dir=tmp/$(date +\"%Y_%m_%d\") \\\nenv=pusht\n```\n\n### Visualize online buffer / Eval\n\n```\npython lerobot/scripts/eval.py \\\nhydra.run.dir=tmp/$(date +\"%Y_%m_%d\") \\\nenv=pusht\n```\n\n\n## TODO\n\n- [x] priority update doesnt match FOWM or original paper\n- [x] self.step=100000 should be updated at every step to adjust to horizon of planner\n- [ ] prefetch replay buffer to speedup training\n- [ ] parallelize env to speedup eval\n- [ ] clean checkpointing / loading\n- [ ] clean logging\n- [ ] clean config\n- [ ] clean hyperparameter tuning\n- [ ] add pusht\n- [ ] add aloha\n- [ ] add act\n- [ ] add diffusion\n- [ ] add aloha 2\n\n## Profile\n\n**Example**\n```python\nfrom torch.profiler import profile, record_function, ProfilerActivity\n\ndef trace_handler(prof):\n prof.export_chrome_trace(f\"tmp/trace_schedule_{prof.step_num}.json\")\n\nwith profile(\n activities=[ProfilerActivity.CPU, ProfilerActivity.CUDA],\n schedule=torch.profiler.schedule(\n wait=2,\n warmup=2,\n active=3,\n ),\n on_trace_ready=trace_handler\n) as prof:\n with record_function(\"eval_policy\"):\n for i in range(num_episodes):\n prof.step()\n```\n\n```bash\npython lerobot/scripts/eval.py \\\npretrained_model_path=/home/rcadene/code/fowm/logs/xarm_lift/all/default/2/models/final.pt \\\neval_episodes=7\n```\n\n## Contribute\n\n**Style**\n```\n# install if needed\npre-commit install\n# apply style and linter checks before git commit\npre-commit run -a\n```\n\n**Tests**\n```\npytest -sx tests\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Le robot is learning",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/Cadene/lerobot",
"Repository": "https://github.com/Cadene/lerobot"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "828674b3389249d1b20a2af8d6866b5bde49c823028727a4b96884ac12c43f40",
"md5": "ffc80ea0753e56bb115a643362cb4e05",
"sha256": "8a3b1f17796ab8723cf799d97dde0030cd3031d6d31b959a26b4150e5f3bff85"
},
"downloads": -1,
"filename": "lerobot-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ffc80ea0753e56bb115a643362cb4e05",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 50212,
"upload_time": "2024-03-09T09:31:05",
"upload_time_iso_8601": "2024-03-09T09:31:05.833793Z",
"url": "https://files.pythonhosted.org/packages/82/86/74b3389249d1b20a2af8d6866b5bde49c823028727a4b96884ac12c43f40/lerobot-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2ea22c04103e737097030018bd4f2971ae70ec7b8adfa5afcada8d5b4373358a",
"md5": "23e7384d91f8e346c2d073e0a66c4df9",
"sha256": "2a5a3cd93b5eeb86245974882928d45ab764d5313810add9b01f24440ccddbee"
},
"downloads": -1,
"filename": "lerobot-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "23e7384d91f8e346c2d073e0a66c4df9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 38139,
"upload_time": "2024-03-09T09:31:07",
"upload_time_iso_8601": "2024-03-09T09:31:07.927158Z",
"url": "https://files.pythonhosted.org/packages/2e/a2/2c04103e737097030018bd4f2971ae70ec7b8adfa5afcada8d5b4373358a/lerobot-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-09 09:31:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Cadene",
"github_project": "lerobot",
"github_not_found": true,
"lcname": "lerobot"
}