Skip to content

Commit 8079c17

Browse files
authored
Remove unused functions from mettagrid and grid_env (Metta-AI#274)
Cleans up mettagrid and grid_env by removing unused functions. This includes removing last_action tracking, which currently doesn't work. This cleaning is nice on it's own, but is mostly aimed towards making it easier to migrate this code to cpp.
1 parent a840bfa commit 8079c17

File tree

13 files changed

+5
-127
lines changed

13 files changed

+5
-127
lines changed

configs/agent/reference_design.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ policy_selector:
99

1010
observations:
1111
obs_key: grid_obs
12-
track_last_action: false
1312

1413
clip_range: 3.0 # clip weights greater or less than this value * largest weight in layer * clip_scale
1514
analyze_weights_interval: 300 # compute weight metrics every N epochs and log to wandb, add analyze_weights: true to the layer to enable

configs/agent/simple.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ policy_selector:
1010

1111
observations:
1212
obs_key: grid_obs
13-
track_last_action: false
1413

1514
clip_range: 0 # set to 0 to disable clipping
1615
analyze_weights_interval: 300

configs/env/mettagrid/mettagrid.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ _target_: mettagrid.mettagrid_env.MettaGridEnv
33

44
report_stats_interval: 100
55
normalize_rewards: false
6-
track_last_action: false
76

87
sampling: 0
98

configs/env/mettagrid/puffer.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ _target_: mettagrid.mettagrid_env.MettaGridEnv
33

44
report_stats_interval: 100
55
normalize_rewards: false
6-
track_last_action: false
76

87
sampling: 0
98

configs/user/sasmith.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ defaults:
66
- _self_
77

88
trainer:
9-
env: /env/mettagrid/navigation/training/multienv_with_cylinder
109
evaluate_interval: 200
1110
evaluate: false
1211

13-
sim:
14-
env: /env/mettagrid/navigation/training/multienv_with_cylinder
15-
1612
eval_db_uri: wandb://artifacts/testing
1713

1814
analyzer:
@@ -42,6 +38,6 @@ sweep:
4238
metric: action.use
4339

4440
seed: null
45-
run_id: 20250429.2
41+
run_id: 20250501.1
4642
run: ${oc.env:USER}.local.${run_id}
4743
trained_policy_uri: ./train_dir/${oc.env:USER}.local.train.${run_id}/checkpoints

deps/mettagrid/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ The `use` action allows agents to interact with objects such as altars, converte
9494

9595
The `swap` action allows agents to swap positions with other agents. It is currently not implemented.
9696

97-
### Tracking the Agent's Last Action
98-
99-
The `track_last_action` property adds the agent's last action to the observation space. It is currently not implemented.
100-
10197
## Configuration
10298

10399
The MettaGrid environment is highly configurable through the use of YAML configuration files. These files specify the layout of the gridworld, the placement of objects, and various properties of the objects and agents.

deps/mettagrid/configs/benchmark.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# This is a modified `sample.yaml` config with sampling removed, for benchmark_env_perf.py script.
22
report_stats_interval: 100
33
normalize_rewards: false
4-
track_last_action: false
54

65
sampling: 0
76

deps/mettagrid/configs/show_map.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# This config is used by `tools.map.view` script.
22
report_stats_interval: 100
33
normalize_rewards: false
4-
track_last_action: false
54

65
game:
76
# no map_builder, tools.utils.view passes the map directly

deps/mettagrid/configs/test_basic.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
_target_: mettagrid.mettagrid_env.MettaGridEnv
22

33
normalize_rewards: false
4-
track_last_action: false
54

65
sampling: 0
76

deps/mettagrid/mettagrid/grid_env.pxd

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ cdef class GridEnv:
3131

3232
unsigned short _obs_width
3333
unsigned short _obs_height
34-
unsigned short _middle_x
35-
unsigned short _middle_y
3634

3735
vector[Agent*] _agents
3836

@@ -86,7 +84,6 @@ cdef class GridEnv:
8684
cpdef list[str] grid_features(self)
8785
cpdef list[str] action_names(self)
8886
cpdef unsigned int num_agents(self)
89-
cpdef tuple observation_shape(self)
9087

9188
cpdef tuple[cnp.ndarray, dict] reset(self)
9289
cpdef tuple[cnp.ndarray, cnp.ndarray, cnp.ndarray, cnp.ndarray, dict] step(self, cnp.ndarray actions)
@@ -109,6 +106,4 @@ cdef class GridEnv:
109106
cpdef dict get_episode_stats(self)
110107
cpdef get_episode_rewards(self)
111108

112-
cpdef tuple get_buffers(self)
113109
cpdef cnp.ndarray render_ascii(self)
114-
cpdef cnp.ndarray grid_objects_types(self)

0 commit comments

Comments
 (0)