mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 10:16:09 +00:00
refactor(factory): remove PI052 processor overrides
This commit is contained in:
@@ -23,13 +23,9 @@ supervised target span must end with an EOS token so the LM head learns
|
||||
to stop instead of rambling to ``max_length`` at inference).
|
||||
"""
|
||||
|
||||
from types import SimpleNamespace
|
||||
|
||||
import torch
|
||||
|
||||
from lerobot.configs.recipe import MessageTurn, TrainingRecipe
|
||||
from lerobot.policies import factory
|
||||
from lerobot.policies.pi052.configuration_pi052 import PI052Config
|
||||
from lerobot.policies.pi052.text_processor_pi052 import (
|
||||
PI052TextTokenizerStep,
|
||||
_flatten_say_tool_calls,
|
||||
@@ -126,24 +122,6 @@ def test_pi052_steps_roundtrip_through_standard_pipeline_loader(tmp_path):
|
||||
assert loaded.steps[1].dropout_seed == 3
|
||||
|
||||
|
||||
def test_pi052_legacy_checkpoint_uses_standard_loader_with_rebuild_overrides(monkeypatch):
|
||||
calls = []
|
||||
|
||||
def fake_from_pretrained(cls, *args, **kwargs):
|
||||
calls.append(kwargs)
|
||||
return SimpleNamespace(steps=[])
|
||||
|
||||
monkeypatch.setattr(PolicyProcessorPipeline, "from_pretrained", classmethod(fake_from_pretrained))
|
||||
config = PI052Config(recipe_path="recipes/subtask_mem.yaml", auto_fit_fast_tokenizer=False)
|
||||
|
||||
factory.make_pre_post_processors(config, pretrained_path="checkpoint")
|
||||
|
||||
overrides = calls[0]["overrides"]
|
||||
assert isinstance(overrides["render_messages_processor"]["recipe"], TrainingRecipe)
|
||||
assert overrides["pi052_text_tokenizer"]["max_length"] == config.tokenizer_max_length
|
||||
assert overrides["action_tokenizer_processor"]["action_tokenizer_name"] == config.action_tokenizer_name
|
||||
|
||||
|
||||
def _eos_char_id() -> int:
|
||||
"""Token id _CharTokenizer assigns to its 1-char EOS."""
|
||||
return ord("\x1f") % 251 + 1
|
||||
|
||||
Reference in New Issue
Block a user