Skip to content

[RLlib] Attention Net prep PR #1: Smaller cleanups. - #12447

Merged
ericl merged 5 commits into
ray-project:masterfrom
sven1977:attention_nets_prep_0
Nov 28, 2020
Merged

ericl merged 5 commits into
ray-project:masterfrom
sven1977:attention_nets_prep_0

Conversation

@sven1977

@sven1977 sven1977 commented Nov 26, 2020 •

Copy link
Copy Markdown
Contributor

The current attention net trajectory view PR (#11729) is too large (>1000 lines added).
Therefore, I'm moving smaller preparatory and cleanup changes in ~2 pre-PRs. This is the first one of these.

Why are these changes needed?

Related issue number

Checks

validate_spaces=validate_spaces,
before_init=before_init_fn,
after_init=setup_late_mixins,
before_loss_init=setup_late_mixins,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the more accurate kwarg to use (torch did not have a loss init step before, so this is new). The old after_init still works the exact same and thus this does not cause an API-break.

# RNN case: Mask away 0-padded chunks at end of time axis.
if state:
max_seq_len = tf.reduce_max(train_batch["seq_lens"])
# Derive max_seq_len from the data itself, not from the seq_lens

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Prep for attention nets, where dynamic max'ing over the given sequences is not allowed.

episode._set_last_observation(agent_id, filtered_obs)
episode._set_last_raw_obs(agent_id, raw_obs)
episode._set_last_info(agent_id, infos[env_id].get(agent_id, {}))
# Infos from the environment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding "infos" to the collector's, if required.

@ericl
ericl merged commit 0df55a1 into ray-project:master Nov 28, 2020
@sven1977
sven1977 deleted the attention_nets_prep_0 branch March 27, 2021 11:39
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