Updated grad clips

This commit is contained in:
Vasilis Valatsos 2023-12-10 06:55:07 +01:00
parent 85c1532920
commit 939a90dd0f
10 changed files with 4 additions and 2 deletions

BIN
agents/.DS_Store vendored

Binary file not shown.

View file

@ -104,14 +104,16 @@ class Agent:
T.nn.utils.clip_grad_norm_( T.nn.utils.clip_grad_norm_(
self.actor.parameters(), max_norm=2) self.actor.parameters(), max_norm=2)
T.nn.utils.clip_grad_norm_( T.nn.utils.clip_grad_norm_(
self.critic.parameters(), max_norm=2) self.critic.parameters(), max_norm=2)
# Calculate the gradient norms for both networks # Calculate the gradient norms for both networks
actor_grad_norm = T.nn.utils.clip_grad_norm_( actor_grad_norm = T.nn.utils.clip_grad_norm_(
self.actor.parameters(), max_norm=1) self.actor.parameters(), max_norm=2)
critic_grad_norm = T.nn.utils.clip_grad_norm_( critic_grad_norm = T.nn.utils.clip_grad_norm_(
self.critic.parameters(), max_norm=1) self.critic.parameters(), max_norm=2)
# Log or print the gradient norms # Log or print the gradient norms
print(f"Actor Gradient Norm: {actor_grad_norm}") print(f"Actor Gradient Norm: {actor_grad_norm}")

BIN
agents/saved_models/A0 Normal file

Binary file not shown.

BIN
agents/saved_models/C0 Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 13 KiB