mirror of
https://github.com/Tavish9/any4lerobot.git
synced 2026-07-22 11:41:46 +00:00
💥 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>
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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."""
|
||||
Reference in New Issue
Block a user