drlab 0.2.6__tar.gz → 0.2.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {drlab-0.2.6/src/drlab.egg-info → drlab-0.2.7}/PKG-INFO +1 -1
  2. {drlab-0.2.6 → drlab-0.2.7}/pyproject.toml +1 -1
  3. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/__init__.py +1 -1
  4. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/off_policy/sac.py +11 -5
  5. {drlab-0.2.6 → drlab-0.2.7/src/drlab.egg-info}/PKG-INFO +1 -1
  6. {drlab-0.2.6 → drlab-0.2.7}/tests/test_public_api.py +1 -1
  7. {drlab-0.2.6 → drlab-0.2.7}/LICENSE +0 -0
  8. {drlab-0.2.6 → drlab-0.2.7}/README.md +0 -0
  9. {drlab-0.2.6 → drlab-0.2.7}/setup.cfg +0 -0
  10. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/controllers/__init__.py +0 -0
  11. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/controllers/base.py +0 -0
  12. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/controllers/e_greedy.py +0 -0
  13. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/controllers/gaussian.py +0 -0
  14. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/controllers/greedy.py +0 -0
  15. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/controllers/stochastic.py +0 -0
  16. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/controllers/warmup.py +0 -0
  17. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/experiments/__init__.py +0 -0
  18. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/experiments/off_policy_experiment.py +0 -0
  19. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/experiments/on_policy_experiment.py +0 -0
  20. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/__init__.py +0 -0
  21. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/off_policy/__init__.py +0 -0
  22. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/off_policy/base.py +0 -0
  23. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/off_policy/configs.py +0 -0
  24. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/off_policy/dqn.py +0 -0
  25. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/on_policy/__init__.py +0 -0
  26. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/on_policy/actor_critic.py +0 -0
  27. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/on_policy/base.py +0 -0
  28. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/on_policy/configs.py +0 -0
  29. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/on_policy/ppo.py +0 -0
  30. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/learners/on_policy/reinforce.py +0 -0
  31. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/replay/__init__.py +0 -0
  32. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/replay/replay_buffer.py +0 -0
  33. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/replay/transition_batch.py +0 -0
  34. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/runners/__init__.py +0 -0
  35. {drlab-0.2.6 → drlab-0.2.7}/src/drlab/runners/runner.py +0 -0
  36. {drlab-0.2.6 → drlab-0.2.7}/src/drlab.egg-info/SOURCES.txt +0 -0
  37. {drlab-0.2.6 → drlab-0.2.7}/src/drlab.egg-info/dependency_links.txt +0 -0
  38. {drlab-0.2.6 → drlab-0.2.7}/src/drlab.egg-info/requires.txt +0 -0
  39. {drlab-0.2.6 → drlab-0.2.7}/src/drlab.egg-info/top_level.txt +0 -0
  40. {drlab-0.2.6 → drlab-0.2.7}/tests/test_controllers.py +0 -0
  41. {drlab-0.2.6 → drlab-0.2.7}/tests/test_learners.py +0 -0
  42. {drlab-0.2.6 → drlab-0.2.7}/tests/test_off_policy_experiment.py +0 -0
  43. {drlab-0.2.6 → drlab-0.2.7}/tests/test_replay.py +0 -0
  44. {drlab-0.2.6 → drlab-0.2.7}/tests/test_runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drlab
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: Deep Reinforcement Learning kit for research.
5
5
  Author: Tomas Osarte
6
6
  Keywords: reinforcement-learning,deep-learning,pytorch,gymnasium
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "drlab"
7
- version = "0.2.6"
7
+ version = "0.2.7"
8
8
  description = "Deep Reinforcement Learning kit for research."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -35,7 +35,7 @@ from drlab.learners import (
35
35
  from drlab.replay import ReplayBuffer, TransitionBatch
36
36
  from drlab.runners import Runner
37
37
 
38
- __version__ = "0.2.6"
38
+ __version__ = "0.2.7"
39
39
 
40
40
  __all__ = [
41
41
  "__version__",
@@ -196,12 +196,18 @@ class SACLearner(OffPolicyLearner):
196
196
  ])
197
197
 
198
198
  loss = actor_loss + critic_loss + alpha_loss
199
+
200
+ # A single batched host transfer avoids five separate device
201
+ # synchronizations (one per .item() call) on every training step.
202
+ actor_v, critic_v, alpha_v, reg_v, total_v = th.stack(
203
+ [policy_loss, critic_loss, alpha_loss, reg_loss, loss]
204
+ ).tolist()
199
205
  self.last_losses = {
200
- "actor": float(policy_loss.item()),
201
- "critic": float(critic_loss.item()),
202
- "alpha": float(alpha_loss.item()),
203
- "regularization": float(reg_loss.item()),
204
- "total": float(loss.item()),
206
+ "actor": actor_v,
207
+ "critic": critic_v,
208
+ "alpha": alpha_v,
209
+ "regularization": reg_v,
210
+ "total": total_v,
205
211
  }
206
212
 
207
213
  return self.last_losses["total"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: drlab
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: Deep Reinforcement Learning kit for research.
5
5
  Author: Tomas Osarte
6
6
  Keywords: reinforcement-learning,deep-learning,pytorch,gymnasium
@@ -37,7 +37,7 @@ class PublicAPITest(unittest.TestCase):
37
37
  "WarmupController",
38
38
  }
39
39
 
40
- self.assertEqual(drlab.__version__, "0.2.5")
40
+ self.assertEqual(drlab.__version__, "0.2.7")
41
41
  self.assertTrue(expected.issubset(set(drlab.__all__)))
42
42
  for name in expected:
43
43
  self.assertTrue(hasattr(drlab, name), name)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes