Skip to content
Snippets Groups Projects
Commit 4f729e8b authored by Joana Plewnia's avatar Joana Plewnia
Browse files

Merge branch 'feature/episodicVerbalizationSkill' of...

Merge branch 'feature/episodicVerbalizationSkill' of git.h2t.iar.kit.edu:sw/armarx/skills/speech into feature/episodicVerbalizationSkill
parents 589982d5 7b4b149a
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@ from pathlib import Path
import pickle
import logging
from episodic_verbalization_core.em.em_tree import HigherLevelSummary
from episodic_verbalization_core.em.em_tree import HigherLevelSummary, GoalBasedSummary
from episodic_verbalization_core.lmp.setup import instantiate_llm
from episodic_verbalization_core.em.armarx_lt_mem import load_episode_from_armarx_lt_mem, extend_existing_history_from_memory_snapshots
from episodic_verbalization_core.em.llm_summary import LLMBasedSummarizer
......@@ -28,7 +28,16 @@ class EM_Verbalization_Tree:
# load tree:
if self.history_cache.is_file():
print('loading tree from', self.history_cache)
self.tree = HigherLevelSummary('', children=[pickle.loads(self.history_cache.read_bytes())])
tree = pickle.loads(self.history_cache.read_bytes())
assert type(tree).__name__ == HigherLevelSummary.__name__
if type(tree.children[-1]).__name__ == HigherLevelSummary.__name__:
# this tree already seems to be in the correct format
self.tree = tree
elif all(type(c).__name__ == GoalBasedSummary.__name__ for c in tree.children):
# this tree should be wrapped
self.tree = HigherLevelSummary('', children=[])
else:
raise ValueError('Unsupported tree file ' + str(self.history_cache))
else:
print('could not load tree from', self.history_cache)
self.create_tree()
......
......@@ -25,7 +25,8 @@ class SimplifiedCodingEMV:
error_handlers: List[ErrorHandler],
max_rounds=10,
exclude_imports=None,
force_initial_command=None
force_initial_command=None,
verbose=False,
):
super().__init__()
self._force_initial_command = force_initial_command
......@@ -46,7 +47,8 @@ class SimplifiedCodingEMV:
# noinspection PyTypeChecker
self._llm_to_python_console_helper = LlmToPythonConsoleHelper(self.llm, self._exec_hist,
self._build_prompt_message,
enforce_python_console_stop_token=False)
enforce_python_console_stop_token=False,
verbose=verbose)
def _set_simplified_repr(node):
node._simplified_repr = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment