Farama-Foundation / miniwob-plusplus

MiniWoB++: a web interaction benchmark for reinforcement learning
https://miniwob.farama.org/
MIT License
280 stars 47 forks source link

Ported code to Gymnasium API #12

Closed ppasupat closed 1 year ago

ppasupat commented 1 year ago

Description

Fixes #10. Ported the class MiniWoBEnvironment to the gymnasium.Env interface. The environments are registered and a test is added to test the API.

Note: This modification changes the signatures of methods in MiniWoBEnvironment. Old code using miniwob-plusplus will no longer work.

Summary of the changes:

Type of change

Please delete options that are not relevant.

Checklist:

ppasupat commented 1 year ago

Thank you for the code review.

Im very uncertain of the MiniWoBActionSpace and MiniWoBObsSpace. Most training libraries require the use of Box, etc from Gym / Gymnasium. Is there no equivalent spaces in Gymnasium already?

The challenges are that the action space (1) has a dynamic size (e.g., can click on any element in the web page), and (2) : can be customized (e.g., one could add "drag" or "double click" actions).

I can coerce the spaces to fit the predefined spaces, but it would require big code changes and reduce flexibility somewhat. Can I do this in a different pull request?

Could we add CI test soon?

I can do this in a separate pull request, since it does not depend on the changes in this pull request.

pseudo-rnd-thoughts commented 1 year ago

I think getting the spaces right should be a priority and I would prefer to avoid using this custom space. Could you look through all of the current spaces, https://gymnasium.farama.org/api/spaces/#fundamental-spaces, Im happy to get on a discord call to discuss what to do if you want

ppasupat commented 1 year ago

I see. Below is what I came up with for the action and observation spaces. What do you think? I would be happy to discuss further on Discord.

Action space

Observation space

The original DOM dict (as returned by Javascript) will be put in the info dict

pseudo-rnd-thoughts commented 1 year ago

When you have addressed the review comments, could you react to the comment in some way for me to know that you have solved it

ppasupat commented 1 year ago

Ah, sorry, it's not done yet. I still need to add type annotations and verify the flattened spaces. I will mark the review comments as resolved when they're done.

ppasupat commented 1 year ago

@pseudo-rnd-thoughts I have finished converting the action and observation spaces into Gymnasium build-in spaces. With this observation space, the seed determinism test also passes now.

I also tried flattening the observation space: the top-level Dict couldn't be flattened since dom_elements is a variable-length Sequence, but each entry of dom_elements and other top-level values were flattened. The test is in miniwob.tests.test_api.

For modularity, can I address the type annotation in a separate pull request? I made a new GitHub Issue here: #14.