From a96b8de05605a9a81f2d5146e3a2e9ccf7c598ff Mon Sep 17 00:00:00 2001 From: Sasha Vezhnevets Date: Thu, 7 Dec 2023 06:23:22 -0800 Subject: [PATCH] shorten tokens PiperOrigin-RevId: 588770633 Change-Id: Id15b4e0c345cd5c65d1e866e46d51c563d74dda7 --- concordia/associative_memory/formative_memories.py | 8 ++++---- concordia/components/agent/reflection.py | 4 ++-- examples/cyberball/cyberball.ipynb | 4 ++-- examples/magic_beans_for_sale.ipynb | 4 ++-- examples/phone/calendar.ipynb | 4 ++-- examples/three_key_questions.ipynb | 6 +++--- examples/village/day_in_riverbend.ipynb | 4 ++-- examples/village/riverbend_elections.ipynb | 4 ++-- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/concordia/associative_memory/formative_memories.py b/concordia/associative_memory/formative_memories.py index e31e5e02..9cd1301b 100644 --- a/concordia/associative_memory/formative_memories.py +++ b/concordia/associative_memory/formative_memories.py @@ -112,8 +112,8 @@ def make_backstory( question += f'Take into account the following context: {context}' result = prompt.open_question( question, - max_characters=8000, - max_tokens=8000, + max_characters=4000, + max_tokens=4000, terminators=[], ) result = re.sub(r'\.\s', '.\n', result) @@ -204,8 +204,8 @@ def add_memories( episode = prompt.open_question( question, - max_characters=8000, - max_tokens=8000, + max_characters=4000, + max_tokens=4000, terminators=[], ) memory.add( diff --git a/concordia/components/agent/reflection.py b/concordia/components/agent/reflection.py index dfba6a0d..823c3435 100644 --- a/concordia/components/agent/reflection.py +++ b/concordia/components/agent/reflection.py @@ -83,7 +83,7 @@ def update(self) -> None: f' answer about {self._agent_name}?' ), ]), - max_characters=5000, + max_characters=4000, max_tokens=5000, terminators=(), ) @@ -105,7 +105,7 @@ def update(self) -> None: ' statements?' ), ]), - max_characters=5000, + max_characters=4000, max_tokens=5000, terminators=(), ) diff --git a/examples/cyberball/cyberball.ipynb b/examples/cyberball/cyberball.ipynb index 610d45ce..5b0df422 100644 --- a/examples/cyberball/cyberball.ipynb +++ b/examples/cyberball/cyberball.ipynb @@ -764,7 +764,7 @@ " f'Sequence of events:\\n{detailed_story}'+\n", " '\\nNarratively summarize the above temporally ordered ' +\n", " 'sequence of events. Write it as a news report. Summary:\\n',\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "print(episode_summary)" ] }, @@ -788,7 +788,7 @@ " f'Sequence of events that happened to {name}:\\n{detailed_story}'\n", " '\\nWrite a short story that summarises these events.\\n'\n", " ,\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "\n", " all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n", " all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n", diff --git a/examples/magic_beans_for_sale.ipynb b/examples/magic_beans_for_sale.ipynb index de7d9b87..c58c7b4f 100644 --- a/examples/magic_beans_for_sale.ipynb +++ b/examples/magic_beans_for_sale.ipynb @@ -722,7 +722,7 @@ " f'Sequence of events:\\n{detailed_story}'+\n", " '\\nNarratively summarize the above temporally ordered ' +\n", " 'sequence of events. Write it as a news report. Summary:\\n',\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "print(episode_summary)" ] }, @@ -746,7 +746,7 @@ " f'Sequence of events that happened to {name}:\\n{detailed_story}'\n", " '\\nWrite a short story that summarises these events.\\n'\n", " ,\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "\n", " all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n", " all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n", diff --git a/examples/phone/calendar.ipynb b/examples/phone/calendar.ipynb index a6807455..26476c9a 100644 --- a/examples/phone/calendar.ipynb +++ b/examples/phone/calendar.ipynb @@ -536,7 +536,7 @@ " f'Sequence of events:\\n{detailed_story}'+\n", " '\\nNarratively summarize the above temporally ordered ' +\n", " 'sequence of events. Write it as a news report. Summary:\\n',\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "print(episode_summary)" ] }, @@ -559,7 +559,7 @@ " f'Sequence of events that happened to {name}:\\n{detailed_story}'\n", " '\\nWrite a short story that summarises these events.\\n'\n", " ,\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "\n", " all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n", " all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n", diff --git a/examples/three_key_questions.ipynb b/examples/three_key_questions.ipynb index 72ad3ea4..8ac0ff4e 100644 --- a/examples/three_key_questions.ipynb +++ b/examples/three_key_questions.ipynb @@ -175,7 +175,7 @@ "outputs": [], "source": [ "#@title Importance models\n", - "importance_model = importance_function.AgentImportanceModel(model)\n", + "importance_model = importance_function.ConstantImportanceModel(model)\n", "importance_model_gm = importance_function.ConstantImportanceModel()\n" ] }, @@ -671,7 +671,7 @@ " f'Sequence of events:\\n{detailed_story}'+\n", " '\\nNarratively summarize the above temporally ordered ' +\n", " 'sequence of events. Write it as a news report. Summary:\\n',\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "print(episode_summary)" ] }, @@ -695,7 +695,7 @@ " f'Sequence of events that happened to {name}:\\n{detailed_story}'\n", " '\\nWrite a short story that summarises these events.\\n'\n", " ,\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "\n", " all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n", " all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n", diff --git a/examples/village/day_in_riverbend.ipynb b/examples/village/day_in_riverbend.ipynb index d6959ce5..04a504a0 100644 --- a/examples/village/day_in_riverbend.ipynb +++ b/examples/village/day_in_riverbend.ipynb @@ -694,7 +694,7 @@ " f'Sequence of events:\\n{detailed_story}'+\n", " '\\nNarratively summarize the above temporally ordered ' +\n", " 'sequence of events. Write it as a news report. Summary:\\n',\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "print(episode_summary)" ] }, @@ -717,7 +717,7 @@ " f'Sequence of events that happened to {name}:\\n{detailed_story}'\n", " '\\nWrite a short story that summarises these events.\\n'\n", " ,\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "\n", " all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n", " all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n", diff --git a/examples/village/riverbend_elections.ipynb b/examples/village/riverbend_elections.ipynb index 4cbbf38c..bdcc4b65 100644 --- a/examples/village/riverbend_elections.ipynb +++ b/examples/village/riverbend_elections.ipynb @@ -773,7 +773,7 @@ " f'Sequence of events:\\n{detailed_story}'+\n", " '\\nNarratively summarize the above temporally ordered ' +\n", " 'sequence of events. Write it as a news report. Summary:\\n',\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "print(episode_summary)" ] }, @@ -797,7 +797,7 @@ " f'Sequence of events that happened to {name}:\\n{detailed_story}'\n", " '\\nWrite a short story that summarises these events.\\n'\n", " ,\n", - " max_characters=8000, max_tokens=8000, terminators=())\n", + " max_characters=4000, max_tokens=4000, terminators=())\n", "\n", " all_player_mem = player._memory.retrieve_recent(k=1000, add_time=True)\n", " all_player_mem = ['Summary:', summary, 'Memories:'] + all_player_mem\n",