Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions step_anticipation/src/models/llm_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,9 @@ def anticipation(
else:
remove_toySequence = False

# ! Don't know why it was inside the loop
# >>>
prompt_builder = load_data(f"{CONTEXT_PROMPT_PATH}/context_prompt.json")
init = prompt_builder[prompt_context]["init"]

if remove_toySequence:
prompt_ = f"{prompt}{init} {toy_class}\n"
else:
prompt_ = f"{prompt}{init} {toy}\n"
# <<<

for i in range(len(seq)):
if type_prompt == "emoji":
hist, action = ["👉"] + seq[:i], seq[i]
Expand All @@ -169,6 +161,12 @@ def anticipation(

print(f"[INFO] >>> {hist} -> {action}")

# reinitialize prompt_ for each step
if remove_toySequence:
prompt_ = f"{prompt}{init} {toy_class}\n"
else:
prompt_ = f"{prompt}{init} {toy}\n"

input_builder = prompt_builder[prompt_context]["input"]
prompt_ += f"{input_builder}\n {', '.join(map(str, hist))}\n"

Expand Down