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

fix: term vs trunc #983

Draft
wants to merge 11 commits into
base: develop
Choose a base branch
from
Draft

fix: term vs trunc #983

wants to merge 11 commits into from

Conversation

sash-a
Copy link
Contributor

@sash-a sash-a commented Jan 9, 2024

Note

This is quite confusing so please check this carefully and make sure I haven't mixed up where to use each one!

What?

Mostly explained in #951. We are mixing up termination and truncation. This is especially prevalent in recurrent systems, but all systems have this issue.

Now very explicit about termination vs truncation, removed all mentions of done.
Done attribute remove from RnnLearnerState and replaced with truncated in the PpoTransition.

How?

Explicitly name variables termination and trunctation instead of done

@sash-a sash-a self-assigned this Jan 9, 2024
@sash-a sash-a added the bug Something isn't working label Jan 9, 2024
@OmaymaMahjoub OmaymaMahjoub added the benchmark required Docker images get pushed if PR has this label. label Jan 15, 2024
Copy link
Contributor

@OmaymaMahjoub OmaymaMahjoub left a comment

Choose a reason for hiding this comment

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

Thanks @sash-a! I will continue the review once we verify the recurrent systems performance :)

Comment on lines +160 to +162
trunc = jnp.repeat(timestep.last(), config.system.num_agents)
trunc = trunc.reshape(config.arch.num_envs, -1)
term = 1 - timestep.discount
Copy link
Contributor

Choose a reason for hiding this comment

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

If you can add documentation to timestep.last() and timestep.discount

info = {
"episode_return": env_state.episode_return_info,
"episode_length": env_state.episode_length_info,
}

transition = PPOTransition(
done, action, value, timestep.reward, log_prob, last_timestep.observation, info
terminal=term,
truncated=trunc,
Copy link
Contributor

Choose a reason for hiding this comment

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

Random question, why do we include truncation if we don't use it 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

I really like the changes of removing last_done from the learner_state

hstates,
) = learner_state

rng, policy_rng = jax.random.split(rng)

last_trunc = jnp.repeat(last_timestep.last(), n_agents).reshape(n_envs, -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

if you can add documentation # Add last_trunc to the input to the network.

@sash-a sash-a marked this pull request as draft February 16, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark required Docker images get pushed if PR has this label. bug Something isn't working priority/high size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants