Skip to content

Commit

Permalink
Remove use of the (deprecated) environment metrics. Instead, use only…
Browse files Browse the repository at this point in the history
… component metrics that use measurements.

PiperOrigin-RevId: 588109071
Change-Id: Ib9aa38f42c1c2b514fcfdd08058635fdc8843f73
  • Loading branch information
duenez authored and copybara-github committed Dec 5, 2023
1 parent 6ad76fc commit 0aa31ee
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 595 deletions.
5 changes: 0 additions & 5 deletions concordia/components/game_master/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from concordia.language_model import language_model
from concordia.typing import clock as clock_lib
from concordia.typing import component
from concordia.typing import metric
from concordia.utils import helper_functions
import termcolor

Expand All @@ -46,7 +45,6 @@ def __init__(
cap_nonplayer_characters: int = 3,
game_master_instructions: str = '',
shared_context: str = '',
measurements: Sequence[metric.Metric] | None = None,
components: Sequence[component.Component] | None = None,
allow_self_talk: bool = False,
verbose: bool = False,
Expand All @@ -66,7 +64,6 @@ def __init__(
allowed in the conversation.
game_master_instructions: A string to use as the game master instructions.
shared_context: A string to use as the generic context for the NPCs.
measurements: metrics to pass into the conversation GM
components: components that contextualise the conversation
allow_self_talk: allow players to have a conversation with themselves
verbose: Whether to print debug messages or not.
Expand All @@ -84,7 +81,6 @@ def __init__(
self._clock = clock
self._burner_memory_factory = burner_memory_factory
self._memory = memory
self._measurements = measurements
self._allow_self_talk = allow_self_talk
self._all_player_names = [player.name for player in self._players]
self._min_speakers = 1 if self._allow_self_talk else 2
Expand Down Expand Up @@ -285,7 +281,6 @@ def update_after_event(
memory_factory=self._burner_memory_factory,
name='Conversation scene',
premise=event_statement,
measurements=self._measurements,
)
with self._clock.higher_gear():
scene_output = convo_scene.run_episode()
Expand Down
12 changes: 0 additions & 12 deletions concordia/environment/game_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
from concordia.typing import clock as game_clock
from concordia.typing import component
from concordia.typing import game_master as simulacrum_game_master
from concordia.typing import metric
import termcolor


Expand All @@ -48,7 +47,6 @@ def __init__(
clock: game_clock.GameClock,
players: Sequence[basic_agent.BasicAgent],
name: str = 'Game Master',
measurements: Sequence[metric.Metric] | None = None,
update_thought_chain: (
Sequence[
Callable[[interactive_document.InteractiveDocument, str], str]
Expand All @@ -74,8 +72,6 @@ def __init__(
players: a sequence of generative agent simulacra which is assumed to
contain only information that players also can access.
name: name of the game master.
measurements: sequence of measurements which look at text and store the
answers to questions in python state variables.
update_thought_chain: chain of thoughts for update from player
components: components to condition on
action_spec: specific action_spec to pass to agents, default is used if
Expand All @@ -99,7 +95,6 @@ def __init__(
self._clock = clock
self._players = players
self._log_colour = log_colour
self._measurements = measurements or []
self._randomise_initiative = randomise_initiative
self._player_observes_event = player_observes_event
self._players_act_simultaneously = players_act_simultaneously
Expand Down Expand Up @@ -223,13 +218,6 @@ def get_externality(externality):

self._log.append(update_log)

# MULTI-THREAD
def process_measurements(signal):
return signal.update(event_statement, player_name, prompt)

with concurrent.futures.ThreadPoolExecutor() as executor:
executor.map(process_measurements, self._measurements)

return event_statement

def view_for_player(self, player_name):
Expand Down
21 changes: 0 additions & 21 deletions concordia/environment/metrics/__init__.py

This file was deleted.

115 changes: 0 additions & 115 deletions concordia/environment/metrics/common_sense_morality.py

This file was deleted.

116 changes: 0 additions & 116 deletions concordia/environment/metrics/goal_achievement.py

This file was deleted.

Loading

0 comments on commit 0aa31ee

Please sign in to comment.