Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JointQ not work in custom env #223

Open
Yilgrimage opened this issue Feb 19, 2024 · 1 comment
Open

JointQ not work in custom env #223

Yilgrimage opened this issue Feb 19, 2024 · 1 comment

Comments

@Yilgrimage
Copy link

Yilgrimage commented Feb 19, 2024

i build a new env on marllib, and i test it by MAPPO, it worked. but when I try to switch algo to qmix, it met a problem in preprocessors.py.
it occurs in "check_shape", self._obs_space is a tuple of GymDict when I use JointQ algos, which should be a GymDict I guess. ,it makes " if not self._obs_space.contains(observation):"(ray/rllib/models/preprocessors.py", line 93)"return false and raise ValueError. I don't know why smac doesn't meet this problem, I believe I used the right form to build my env. This is my obs_space,and I ensure "step" and "reset" will return right data.

self.observation_space = GymDict({
            "obs": Box(
                low=0,
                high=10,
                shape=(self.obs_size,),
                dtype=np.dtype("int64")),
            "state": Box(
                low=-1,
                high=self.n_agents+self.n_preys*10,
                shape=((self.map_size + 2 * self.sight_range)**2,),
                dtype=np.dtype("int64")),
            "action_mask": Box(
                low=0,
                high=1,
                shape=(self.n_actions,),
                dtype=np.dtype("int64"))

        })
@Yilgrimage
Copy link
Author

I get it.
when you build your obs dict in step or reset, you should ensure the key of obs dict is a member of self.agents. If not, it will happen a problem in GroupWrapper, which doesn't affect some algorithms, but algorithms like QMIX can be problematic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant