Release v0.9.0 (#174)

This commit is contained in:
Antonin RAFFIN 2020-10-04 17:12:35 +02:00 committed by GitHub
parent 55912576ed
commit a10e3ae587
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -3,9 +3,11 @@
Changelog Changelog
========== ==========
Pre-Release 0.9.0a2 (WIP) Pre-Release 0.9.0 (2020-10-03)
------------------------------ ------------------------------
**Bug fixes, get/set parameters and improved docs**
Breaking Changes: Breaking Changes:
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
- Removed ``device`` keyword argument of policies; use ``policy.to(device)`` instead. (@qxcv) - Removed ``device`` keyword argument of policies; use ``policy.to(device)`` instead. (@qxcv)
@ -50,6 +52,7 @@ Others:
- Clarified docstrings on what is saved and loaded to/from files - Clarified docstrings on what is saved and loaded to/from files
- Simplified ``save_to_zip_file`` function by removing duplicate code - Simplified ``save_to_zip_file`` function by removing duplicate code
- Store library version along with the saved models - Store library version along with the saved models
- DQN loss is now logged
Documentation: Documentation:
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^

View file

@ -147,6 +147,7 @@ class DQN(OffPolicyAlgorithm):
# Update learning rate according to schedule # Update learning rate according to schedule
self._update_learning_rate(self.policy.optimizer) self._update_learning_rate(self.policy.optimizer)
losses = []
for gradient_step in range(gradient_steps): for gradient_step in range(gradient_steps):
# Sample replay buffer # Sample replay buffer
replay_data = self.replay_buffer.sample(batch_size, env=self._vec_normalize_env) replay_data = self.replay_buffer.sample(batch_size, env=self._vec_normalize_env)
@ -169,6 +170,7 @@ class DQN(OffPolicyAlgorithm):
# Compute Huber loss (less sensitive to outliers) # Compute Huber loss (less sensitive to outliers)
loss = F.smooth_l1_loss(current_q, target_q) loss = F.smooth_l1_loss(current_q, target_q)
losses.append(loss.item())
# Optimize the policy # Optimize the policy
self.policy.optimizer.zero_grad() self.policy.optimizer.zero_grad()
@ -181,6 +183,7 @@ class DQN(OffPolicyAlgorithm):
self._n_updates += gradient_steps self._n_updates += gradient_steps
logger.record("train/n_updates", self._n_updates, exclude="tensorboard") logger.record("train/n_updates", self._n_updates, exclude="tensorboard")
logger.record("train/loss", np.mean(losses))
def predict( def predict(
self, self,

View file

@ -1 +1 @@
0.9.0a2 0.9.0