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

Directly using and serializing gym.spaces and their value #116

Merged
merged 3 commits into from
Jan 24, 2023

Conversation

cloderic
Copy link
Member

@cloderic cloderic commented Jan 18, 2023

closes #115


  • Removing custom cogment_verse.specs.Space and cogment_verse.specs.SpaceValue classes in favour of directly using gym.spaces.Space instances and np.array directly. Introduce cogment_verse.specs.EnvironmentSpecs, cogment_verse.specs.ObservationSpace, cogment_verse.specs.ActionSpace as (relatively) thin wrapper around gym stuffs. Remove custom flatten, unflatten, sample functions in favor of using Gym's.
  • Enable deserialization of the np.array on the javascript side to open the door to implementing rendering on the client side. Currently using that for action mask and for a new debug display showing the observation tensor:

Capture d’écran, le 2023-01-19 à 13 39 42

Capture d’écran, le 2023-01-19 à 15 46 43

  • Benchmarking various numpy array serialization/deserialization strategies

To reviewer -> Take a look a the changes in actors and environment to get an understanding of the API changes, this is the "last" API change I'd like to consider before merging next in main.

@cloderic cloderic force-pushed the directly_use_gym_spaces branch 7 times, most recently from bff5f3f to 3abf16c Compare January 19, 2023 20:34
wduguay-air
wduguay-air previously approved these changes Jan 24, 2023
Copy link
Contributor

@wduguay-air wduguay-air left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice work! I like the changes to the API. Left some very small suggestions/comments here and there.

cogment_verse/specs/data.proto Outdated Show resolved Hide resolved
cogment_verse/specs/data.proto Outdated Show resolved Hide resolved
cogment_verse/specs/spaces_serialization.py Show resolved Hide resolved
cogment_verse/specs/environment_specs.py Outdated Show resolved Hide resolved
environments/gym_adapter.py Show resolved Hide resolved
tests/test_ndarray_serialization.py Show resolved Hide resolved
Copy link
Contributor

@wduguay-air wduguay-air left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cloderic cloderic merged commit 1375045 into next Jan 24, 2023
@cloderic cloderic deleted the directly_use_gym_spaces branch January 24, 2023 18:52
cloderic added a commit that referenced this pull request Jan 24, 2023
* Directly using and serializing gym.spaces and their value

* Introducing debug inspector of received observation on the web side

* Take into account review
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

Successfully merging this pull request may close these issues.

2 participants