Files
any4lerobot/generic_converter/adapter.py
T
Qizhi Chen f40e09f481 💥 Add generic converter pipeline (#104)
* Add generic converter pipeline

Co-authored-by: Codex <codex@openai.com>

* Update generic converter README

Co-authored-by: Codex <codex@openai.com>

* Simplify generic converter README

Co-authored-by: Codex <codex@openai.com>

* Simplify adapter task loading API

Co-authored-by: Codex <codex@openai.com>

* Require adapter output path

Co-authored-by: Codex <codex@openai.com>

* Use adapter temp output path for LIBERO

Co-authored-by: Codex <codex@openai.com>

* Remove LIBERO changes from generic converter PR

Co-authored-by: Codex <codex@openai.com>

* update readme

---------

Co-authored-by: Codex <codex@openai.com>
2026-06-11 22:16:44 -07:00

33 lines
914 B
Python

from abc import ABC, abstractmethod
from collections.abc import Iterable, Sequence
from pathlib import Path
from .utils import ConversionTask, FeatureSpec
class BaseAdapter(ABC):
"""Dataset-specific hooks used by the generic conversion pipeline."""
dataset_type: str
fps: int
robot_type: str
features: FeatureSpec
tags: Sequence[str] = ()
def __init__(self, output_path: Path):
self.output_path = output_path.expanduser().resolve()
@property
def temp_output_path(self) -> Path:
return self.output_path.with_name(f"{self.output_path.name}_temp")
@abstractmethod
def load_tasks(self) -> list[ConversionTask]:
"""Build conversion tasks from dataset-specific inputs."""
@abstractmethod
def load_subset(
self, task: ConversionTask
) -> Iterable[Sequence[dict]]:
"""Yield LeRobot episodes for one raw input path."""