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

feat: use protocol to force all environment states to have a key #45

Merged
merged 13 commits into from
Nov 15, 2022

Conversation

dluo96
Copy link
Contributor

@dluo96 dluo96 commented Nov 14, 2022

Closes #33.

Implemented a protocol which ensures that every Environment's State must implement a key to manage stochasticity (even if the key isn't used e.g. for deterministic environments). If a State is defined which doesn't implement key, mypy will throw errors.

Currently, mypy does not error when a key attribute is implemented with a different type from jax.random.PRNGKey.

@dluo96 dluo96 self-assigned this Nov 15, 2022
clement-bonnet
clement-bonnet previously approved these changes Nov 15, 2022
Copy link
Collaborator

@clement-bonnet clement-bonnet left a comment

Choose a reason for hiding this comment

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

Great contribution! Just left a few comment regarding using chex

jumanji/env.py Outdated Show resolved Hide resolved
jumanji/environments/combinatorial/cvrp/types.py Outdated Show resolved Hide resolved
jumanji/environments/combinatorial/knapsack/types.py Outdated Show resolved Hide resolved
jumanji/environments/combinatorial/tsp/types.py Outdated Show resolved Hide resolved
jumanji/environments/games/connect4/types.py Outdated Show resolved Hide resolved
dluo96 and others added 2 commits November 15, 2022 15:46

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Co-authored-by: Clément Bonnet <56230714+clement-bonnet@users.noreply.github.com>
dluo96 and others added 7 commits November 15, 2022 15:48
Co-authored-by: Clément Bonnet <56230714+clement-bonnet@users.noreply.github.com>
Co-authored-by: Clément Bonnet <56230714+clement-bonnet@users.noreply.github.com>
Co-authored-by: Clément Bonnet <56230714+clement-bonnet@users.noreply.github.com>
Co-authored-by: Clément Bonnet <56230714+clement-bonnet@users.noreply.github.com>
jumanji/env.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@clement-bonnet clement-bonnet left a comment

Choose a reason for hiding this comment

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

Great stuff

@dluo96 dluo96 modified the milestone: v0.1.2 Nov 15, 2022
@dluo96 dluo96 merged commit 9999660 into instadeepai:main Nov 15, 2022
@dluo96 dluo96 deleted the 33-constrain-state-to-have-key branch November 15, 2022 17:15
dluo96 pushed a commit that referenced this pull request Mar 17, 2023
Co-authored-by: Donal Byrne <d.byrne@instadeep.com>
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.

feat: constrain all environment states to have a key attribute
2 participants