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

PPO attention net (GTrXLNet) #176

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update policies.py
Remove model call when episode starts (memory dimension and features sequence not always the same)
RemiG3 committed Apr 19, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
zakkak Foivos Zakkak
commit 3a26f4aa319b4cedcb7846119d9eab2f765061c8
10 changes: 5 additions & 5 deletions sb3_contrib/common/attention/policies.py
Original file line number Diff line number Diff line change
@@ -175,10 +175,10 @@ def _process_sequence(

# If we don't have to reset the memory in the middle of a sequence
# we can avoid the for loop, which speeds up things
if th.all(episode_starts == 0.0):
attn_output, attn_memory = model(features_sequence, attn_memory)
# attn_output = th.flatten(attn_output.transpose(0, 1), start_dim=0, end_dim=1)
return attn_output, attn_memory
# if th.all(episode_starts == 0.0):
# attn_output, attn_memory = model(features_sequence, attn_memory)
# # attn_output = th.flatten(attn_output.transpose(0, 1), start_dim=0, end_dim=1)
# return attn_output, attn_memory

outputs = []
# Iterate over the sequence
@@ -334,7 +334,7 @@ def evaluate_actions(
# latent_vf = latent_pi.detach()
# else:
# latent_vf = self.critic(vf_features)
latent_vf = latent_pi.detach()
#latent_vf = latent_pi.detach()

latent_pi = self.mlp_extractor.forward_actor(latent_pi)
#latent_vf = self.mlp_extractor.forward_critic(latent_vf)