mirror of
https://github.com/Tavish9/any4lerobot.git
synced 2026-06-29 00:47:02 +00:00
f40e09f481
* 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>
40 lines
893 B
Python
40 lines
893 B
Python
import shutil
|
|
from collections.abc import Mapping, Sequence
|
|
from dataclasses import dataclass, field
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
TaskMetadata = Mapping[str, Any]
|
|
FeatureSpec = Mapping[str, dict]
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class ConversionTask:
|
|
"""One independently convertible raw input file and adapter metadata."""
|
|
|
|
input_path: Path
|
|
output_path: Path
|
|
local_repo_id: str | None = None
|
|
metadata: TaskMetadata = field(default_factory=dict)
|
|
|
|
|
|
def setup_logger():
|
|
import sys
|
|
|
|
from datatrove.utils.logging import logger
|
|
|
|
logger.remove()
|
|
logger.add(sys.stdout, level="INFO", colorize=True)
|
|
return logger
|
|
|
|
|
|
def unique_strings(values: Sequence[str]) -> list[str]:
|
|
result = []
|
|
seen = set()
|
|
for value in values:
|
|
if value in seen:
|
|
continue
|
|
result.append(value)
|
|
seen.add(value)
|
|
return result
|