agilerl 2.3.5.dev0__py3-none-any.whl → 2.4.0.dev0__py3-none-any.whl

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 (70) hide show
  1. agilerl/algorithms/__init__.py +2 -0
  2. agilerl/algorithms/bc_lm.py +3 -3
  3. agilerl/algorithms/core/base.py +763 -125
  4. agilerl/algorithms/core/optimizer_wrapper.py +16 -16
  5. agilerl/algorithms/core/registry.py +77 -45
  6. agilerl/algorithms/cqn.py +5 -6
  7. agilerl/algorithms/ddpg.py +14 -14
  8. agilerl/algorithms/dpo.py +311 -0
  9. agilerl/algorithms/dqn.py +2 -2
  10. agilerl/algorithms/dqn_rainbow.py +5 -6
  11. agilerl/algorithms/grpo.py +45 -624
  12. agilerl/algorithms/ilql.py +2 -2
  13. agilerl/algorithms/ippo.py +25 -25
  14. agilerl/algorithms/maddpg.py +22 -22
  15. agilerl/algorithms/matd3.py +28 -28
  16. agilerl/algorithms/neural_ts_bandit.py +4 -4
  17. agilerl/algorithms/neural_ucb_bandit.py +4 -4
  18. agilerl/algorithms/ppo.py +29 -29
  19. agilerl/algorithms/td3.py +6 -4
  20. agilerl/components/multi_agent_replay_buffer.py +23 -24
  21. agilerl/components/replay_buffer.py +3 -3
  22. agilerl/components/rollout_buffer.py +30 -30
  23. agilerl/components/sampler.py +5 -5
  24. agilerl/data/rl_data.py +8 -8
  25. agilerl/data/tokenizer.py +5 -5
  26. agilerl/hpo/mutation.py +20 -20
  27. agilerl/hpo/tournament.py +6 -8
  28. agilerl/modules/base.py +33 -38
  29. agilerl/modules/bert.py +11 -11
  30. agilerl/modules/cnn.py +43 -43
  31. agilerl/modules/configs.py +11 -11
  32. agilerl/modules/dummy.py +4 -4
  33. agilerl/modules/gpt.py +14 -14
  34. agilerl/modules/lstm.py +11 -11
  35. agilerl/modules/mlp.py +13 -13
  36. agilerl/modules/multi_input.py +18 -18
  37. agilerl/modules/resnet.py +12 -12
  38. agilerl/modules/simba.py +4 -4
  39. agilerl/networks/actors.py +7 -7
  40. agilerl/networks/base.py +27 -27
  41. agilerl/networks/custom_modules.py +4 -4
  42. agilerl/networks/distributions.py +12 -12
  43. agilerl/networks/distributions_experimental.py +3 -3
  44. agilerl/networks/q_networks.py +10 -10
  45. agilerl/networks/value_networks.py +4 -4
  46. agilerl/protocols.py +41 -45
  47. agilerl/rollouts/on_policy.py +10 -10
  48. agilerl/training/train_bandits.py +4 -4
  49. agilerl/training/train_llm.py +296 -14
  50. agilerl/training/train_multi_agent_off_policy.py +4 -4
  51. agilerl/training/train_multi_agent_on_policy.py +4 -4
  52. agilerl/training/train_off_policy.py +5 -5
  53. agilerl/training/train_offline.py +4 -4
  54. agilerl/training/train_on_policy.py +5 -5
  55. agilerl/typing.py +38 -29
  56. agilerl/utils/algo_utils.py +98 -93
  57. agilerl/utils/evolvable_networks.py +26 -26
  58. agilerl/utils/ilql_utils.py +6 -6
  59. agilerl/utils/llm_utils.py +439 -79
  60. agilerl/utils/torch_utils.py +4 -4
  61. agilerl/utils/utils.py +79 -11
  62. agilerl/vector/pz_async_vec_env.py +48 -48
  63. agilerl/vector/pz_vec_env.py +10 -10
  64. agilerl/wrappers/agent.py +14 -14
  65. agilerl/wrappers/make_evolvable.py +17 -17
  66. {agilerl-2.3.5.dev0.dist-info → agilerl-2.4.0.dev0.dist-info}/METADATA +5 -3
  67. agilerl-2.4.0.dev0.dist-info/RECORD +95 -0
  68. {agilerl-2.3.5.dev0.dist-info → agilerl-2.4.0.dev0.dist-info}/WHEEL +1 -1
  69. {agilerl-2.3.5.dev0.dist-info → agilerl-2.4.0.dev0.dist-info/licenses}/LICENSE +13 -0
  70. agilerl-2.3.5.dev0.dist-info/RECORD +0 -94
@@ -1,6 +1,7 @@
1
1
  from .bc_lm import BC_LM, BC_Evaluator, BC_Policy
2
2
  from .cqn import CQN
3
3
  from .ddpg import DDPG
4
+ from .dpo import DPO
4
5
  from .dqn import DQN
5
6
  from .dqn_rainbow import RainbowDQN
6
7
  from .grpo import GRPO
@@ -30,4 +31,5 @@ __all__ = [
30
31
  "PPO",
31
32
  "TD3",
32
33
  "GRPO",
34
+ "DPO",
33
35
  ]
@@ -1,4 +1,4 @@
1
- from typing import Any, Callable, Optional, Tuple, Union
1
+ from typing import Any, Callable, Optional, Union
2
2
 
3
3
  import numpy as np
4
4
  import torch
@@ -167,7 +167,7 @@ class BC_LM(nn.Module):
167
167
  temp: float = 1.0,
168
168
  top_k: Optional[int] = None,
169
169
  top_p: Optional[float] = None,
170
- ) -> Tuple[torch.Tensor, Any]:
170
+ ) -> tuple[torch.Tensor, Any]:
171
171
  prepared_inputs = self.prepare_inputs(items)
172
172
  tokens = prepared_inputs["tokens"]
173
173
  scores, model_outputs = self.score(
@@ -189,7 +189,7 @@ class BC_LM(nn.Module):
189
189
  temp: float = 1.0,
190
190
  top_k: Optional[int] = None,
191
191
  top_p: Optional[float] = None,
192
- ) -> Tuple[torch.Tensor, Any]:
192
+ ) -> tuple[torch.Tensor, Any]:
193
193
  scores, model_outputs = self.score(
194
194
  (
195
195
  tokens.unsqueeze(1),