mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-23 17:56:07 +00:00
refactor(pi052): always suppress <loc> in runtime text gen
Drop LOC_SUPPRESS_KINDS. With interactive VQA gone, every runtime text kind (subtask / memory / interjection) is prose that must never emit PaliGemma <loc> tokens, so suppress unconditionally. No behavior change: the only non-suppressed kind (plan) is never generated by the runtime. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,11 +36,6 @@ _LOC_TOKENIZER_CACHE: dict[str, Any] = {}
|
|||||||
class PI052PolicyAdapter(BaseLanguageAdapter):
|
class PI052PolicyAdapter(BaseLanguageAdapter):
|
||||||
"""Runtime bridge for PI052 policies."""
|
"""Runtime bridge for PI052 policies."""
|
||||||
|
|
||||||
# PaliGemma's ``<locDDDD>`` prior dominates the first token on a small
|
|
||||||
# text-CE budget; suppress it for prose kinds (VQA would keep it, but
|
|
||||||
# the runtime no longer does interactive VQA).
|
|
||||||
LOC_SUPPRESS_KINDS = frozenset({"subtask", "memory", "interjection"})
|
|
||||||
|
|
||||||
def select_action(self, observation: dict[str, Any], state: RuntimeState) -> Any:
|
def select_action(self, observation: dict[str, Any], state: RuntimeState) -> Any:
|
||||||
subtask = state.language_context.get("subtask") or state.task or ""
|
subtask = state.language_context.get("subtask") or state.task or ""
|
||||||
text_batch = _build_text_batch(
|
text_batch = _build_text_batch(
|
||||||
@@ -72,7 +67,7 @@ class PI052PolicyAdapter(BaseLanguageAdapter):
|
|||||||
min_new_tokens=self.gen.min_new_tokens,
|
min_new_tokens=self.gen.min_new_tokens,
|
||||||
temperature=self.gen.temperature,
|
temperature=self.gen.temperature,
|
||||||
top_p=self.gen.top_p,
|
top_p=self.gen.top_p,
|
||||||
suppress_loc_tokens=kind in self.LOC_SUPPRESS_KINDS,
|
suppress_loc_tokens=True, # all runtime text is prose; never emit <loc>
|
||||||
)
|
)
|
||||||
|
|
||||||
def build_messages(
|
def build_messages(
|
||||||
|
|||||||
Reference in New Issue
Block a user