Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project.urls]
homepage = "https://huggingface.co/lerobot"
Expand Down Expand Up @@ -58,7 +59,7 @@ keywords = ["lerobot", "huggingface", "robotics", "machine learning", "artifici
dependencies = [

# Hugging Face dependencies
"datasets>=2.19.0",
"datasets>=2.19.0,<=3.6.0", # TODO: Bumb dependency
"diffusers>=0.27.2",
"huggingface-hub[hf-transfer,cli]>=0.27.1",

Expand Down Expand Up @@ -91,20 +92,20 @@ dependencies = [
[project.optional-dependencies]

# Common
pygame_dep = ["pygame>=2.5.1"]
placo_dep = ["placo>=0.9.6"]
transformers_dep = ["transformers>=4.50.3"]
grpc_dep = ["grpcio==1.71.0"]
pygame-dep = ["pygame>=2.5.1"]
placo-dep = ["placo>=0.9.6"]
transformers-dep = ["transformers>=4.50.3"]
grpcio-dep = ["grpcio==1.71.0"]

# Motors
feetech = ["feetech-servo-sdk>=1.0.0"]
dynamixel = ["dynamixel-sdk>=3.7.31"]

# Robots
gamepad = ["pygame_dep", "hidapi>=0.14.0"]
hopejr = ["feetech", "pygame_dep"]
lekiwi = ["feetech", "pyzmq>=26.2.1"]
kinematics = ["placo_dep"]
gamepad = ["lerobot[pygame-dep]", "hidapi>=0.14.0"]
hopejr = ["lerobot[feetech]", "lerobot[pygame-dep]"]
lekiwi = ["lerobot[feetech]", "pyzmq>=26.2.1"]
kinematics = ["lerobot[placo-dep]"]
intelrealsense = [
"pyrealsense2>=2.55.1.6486 ; sys_platform != 'darwin'",
"pyrealsense2-macosx>=2.54 ; sys_platform == 'darwin'",
Expand All @@ -116,12 +117,12 @@ stretch = [
] # TODO: Currently not supported

# Policies
pi0 = ["transformers_dep"]
smolvla = ["transformers_dep", "num2words>=0.5.14", "accelerate>=1.7.0", "safetensors>=0.4.3"]
hilserl = ["transformers_dep", "gym-hil>=0.1.9", "protobuf>=5.29.3", "grpcio_dep", "placo_dep"]
pi0 = ["lerobot[transformers-dep]"]
smolvla = ["lerobot[transformers-dep]", "num2words>=0.5.14", "accelerate>=1.7.0", "safetensors>=0.4.3"]
hilserl = ["lerobot[transformers-dep]", "gym-hil>=0.1.9", "protobuf>=5.29.3", "lerobot[grpcio-dep]", "lerobot[placo-dep]"]

# Features
async = ["grpcio_dep", "matplotlib>=3.10.3"]
async = ["lerobot[grpcio-dep]", "matplotlib>=3.10.3"]

# Development
docs = ["hf-doc-builder @ git+https://github.com/huggingface/doc-builder.git@main", "watchdog >= 6.0.0"]
Expand All @@ -135,6 +136,9 @@ pusht = ["gym-pusht>=0.1.5", "pymunk>=6.6.0,<7.0.0"] # TODO: Fix pymunk version
xarm = ["gym-xarm>=0.1.1"]

# ---------------- Tool Configurations ----------------
[tool.setuptools.packages.find]
where = ["src"]

[tool.ruff]
target-version = "py310"
line-length = 110
Expand Down
4 changes: 2 additions & 2 deletions src/lerobot/configs/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import abc
import builtins
import json
import logging
import os
Expand All @@ -31,7 +32,6 @@
from lerobot.utils.hub import HubMixin
from lerobot.utils.utils import auto_select_torch_device, is_amp_available, is_torch_device_available

# Generic variable that is either PreTrainedConfig or a subclass thereof
T = TypeVar("T", bound="PreTrainedConfig")


Expand Down Expand Up @@ -148,7 +148,7 @@ def _save_pretrained(self, save_directory: Path) -> None:

@classmethod
def from_pretrained(
cls: Type[T],
cls: builtins.type[T],
pretrained_name_or_path: str | Path,
*,
force_download: bool = False,
Expand Down
3 changes: 2 additions & 1 deletion src/lerobot/configs/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import builtins
import datetime as dt
import os
from dataclasses import dataclass, field
Expand Down Expand Up @@ -135,7 +136,7 @@ def _save_pretrained(self, save_directory: Path) -> None:

@classmethod
def from_pretrained(
cls: Type["TrainPipelineConfig"],
cls: builtins.type["TrainPipelineConfig"],
pretrained_name_or_path: str | Path,
*,
force_download: bool = False,
Expand Down
3 changes: 2 additions & 1 deletion src/lerobot/datasets/card_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
# For reference on dataset card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/datasetcard.md?plain=1
# Doc / guide: https://huggingface.co/docs/hub/datasets-cards
{{ card_data }}
# prettier-ignore
{{card_data}}
---

This dataset was created using [LeRobot](https://github.com/huggingface/lerobot).
Expand Down
3 changes: 2 additions & 1 deletion src/lerobot/policies/pretrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import abc
import builtins
import logging
import os
from importlib.resources import files
Expand Down Expand Up @@ -67,7 +68,7 @@ def _save_pretrained(self, save_directory: Path) -> None:

@classmethod
def from_pretrained(
cls: Type[T],
cls: builtins.type[T],
pretrained_name_or_path: str | Path,
*,
config: PreTrainedConfig | None = None,
Expand Down
6 changes: 5 additions & 1 deletion src/lerobot/robots/lekiwi/lekiwi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import cv2
import numpy as np
import zmq

from lerobot.errors import DeviceAlreadyConnectedError, DeviceNotConnectedError

Expand All @@ -35,6 +34,9 @@ class LeKiwiClient(Robot):
name = "lekiwi_client"

def __init__(self, config: LeKiwiClientConfig):
import zmq

self._zmq = zmq
super().__init__(config)
self.config = config
self.id = config.id
Expand Down Expand Up @@ -117,6 +119,7 @@ def connect(self) -> None:
"LeKiwi Daemon is already connected. Do not run `robot.connect()` twice."
)

zmq = self._zmq
self.zmq_context = zmq.Context()
self.zmq_cmd_socket = self.zmq_context.socket(zmq.PUSH)
zmq_cmd_locator = f"tcp://{self.remote_ip}:{self.port_zmq_cmd}"
Expand All @@ -141,6 +144,7 @@ def calibrate(self) -> None:

def _poll_and_get_latest_message(self) -> Optional[str]:
"""Polls the ZMQ socket for a limited time and returns the latest message string."""
zmq = self._zmq
poller = zmq.Poller()
poller.register(self.zmq_observation_socket, zmq.POLLIN)

Expand Down
3 changes: 2 additions & 1 deletion src/lerobot/robots/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import abc
import builtins
from pathlib import Path
from typing import Any, Type

Expand All @@ -39,7 +40,7 @@ class Robot(abc.ABC):
"""

# Set these in ALL subclasses
config_class: Type[RobotConfig]
config_class: builtins.type[RobotConfig]
name: str

def __init__(self, config: RobotConfig):
Expand Down
3 changes: 2 additions & 1 deletion src/lerobot/teleoperators/teleoperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import abc
import builtins
from pathlib import Path
from typing import Any, Type

Expand All @@ -37,7 +38,7 @@ class Teleoperator(abc.ABC):
"""

# Set these in ALL subclasses
config_class: Type[TeleoperatorConfig]
config_class: builtins.type[TeleoperatorConfig]
name: str

def __init__(self, config: TeleoperatorConfig):
Expand Down
3 changes: 2 additions & 1 deletion src/lerobot/templates/lerobot_modelcard_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
# For reference on model card metadata, see the spec: https://github.com/huggingface/hub-docs/blob/main/modelcard.md?plain=1
# Doc / guide: https://huggingface.co/docs/hub/model-cards
{{ card_data }}
# prettier-ignore
{{card_data}}
---

# Model Card for {{ model_name | default("Model ID", true) }}
Expand Down
3 changes: 2 additions & 1 deletion src/lerobot/utils/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import builtins
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Type, TypeVar
Expand Down Expand Up @@ -85,7 +86,7 @@ def _save_pretrained(self, save_directory: Path) -> None:
@classmethod
@validate_hf_hub_args
def from_pretrained(
cls: Type[T],
cls: builtins.type[T],
pretrained_name_or_path: str | Path,
*,
force_download: bool = False,
Expand Down