Instructions to use INSAIT-Institute/LADDER-RoboLab-Long with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- LeRobot
How to use INSAIT-Institute/LADDER-RoboLab-Long with LeRobot:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
File size: 1,358 Bytes
01171b7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import abc
from typing import Any, Callable, Iterator, Tuple, Union
class DataclassInterface(abc.ABC):
"""
Interface for dataclasses and the supported methods.
All dataclasses are immutable and all methods return new instances.
"""
@classmethod
@abc.abstractmethod
def from_json(cls, data, recursive: bool = True, ignore_redundant: bool = False):
pass
@classmethod
@abc.abstractmethod
def make_empty(cls):
pass
@abc.abstractmethod
def as_json(self, recursive: bool = True) -> Union[dict, list]:
pass
@abc.abstractmethod
def replace(self, **kwargs):
"""Returns a new instance of the dataclass with the given fields replaced by the given values"""
@abc.abstractmethod
def apply(self, fcn: Callable, recursive: bool = True, skip_nones: bool = False):
pass
@abc.abstractmethod
def items(self, recursive: bool = False) -> Iterator[Tuple[str, Any]]:
pass
def __repr__(self) -> str:
indent = " " * 2
fields_reprs = [
f"{indent}{key}={repr(value)}".replace('\n', f'\n{indent}')
for key, value in self.items(recursive=False)
]
fields_repr = ("\n" + ",\n".join(fields_reprs) + f",\n") if len(fields_reprs) > 0 else ""
return f"{self.__class__.__name__}({fields_repr})"
|