Skip to content

Add support for Melting Pot scenarios #114

@s-a-barnett

Description

@s-a-barnett

Currently, MeltingPotCompatibilityV0 works only when the input env is a substrate, rather than a scenario. This is because self._env.observation_spec()[0] has no attribute "WORLD.RGB". This can be rectified by replacing lines 90-92 of meltingpot_compability.py with

        if type(self._env) is meltingpot.utils.scenarios.scenario.Scenario:
            _env = self._env._substrate
        else:
            _env = self._env
        self.state_space = utils.dm_spec2gym_space(
            _env.observation_spec()[0]["WORLD.RGB"]
        )

and lines 129-131 with

        if type(self._env) is meltingpot.utils.scenarios.scenario.Scenario:
            _env = self._env._substrate
        else:
            _env = self._env
        observation_space = utils.remove_world_observations_from_space(
            utils.dm_spec2gym_space(_env.observation_spec()[0])  # type: ignore

However, the code still runs into a pickling error later down the line. What would be the best way to fix this and add the feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions