streaming-deep-rl 0.2.4__tar.gz → 0.2.5__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streaming-deep-rl
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Streaming Deep Reinforcement Learning
5
5
  Project-URL: Homepage, https://pypi.org/project/streaming-deep-rl/
6
6
  Project-URL: Repository, https://codeberg.org/lucidrains/streaming-deep-rl
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "streaming-deep-rl"
3
- version = "0.2.4"
3
+ version = "0.2.5"
4
4
  description = "Streaming Deep Reinforcement Learning"
5
5
  authors = [
6
6
  { name = "Phil Wang", email = "lucidrains@gmail.com" }
@@ -20,6 +20,8 @@ from ema_pytorch import EMA
20
20
 
21
21
  from hl_gauss_pytorch import HLGaussLayer
22
22
 
23
+ from x_mlps_pytorch import MLP
24
+
23
25
  from streaming_deep_rl.buffer_dict import BufferDict
24
26
 
25
27
  # helpers
@@ -117,12 +119,14 @@ class SelfPredictRepr(Module):
117
119
  num_continuous_actions = 0,
118
120
  dim_predict = None,
119
121
  target_embed_from_ema = True, # whether the target embed is from an EMA, or from the model itself (traditional vs sigreg from lejepa)
120
- sigreg_weight = 0.
122
+ sigreg_weight = 0.,
123
+ dim_hidden_expand_factor = 4
121
124
  ):
122
125
  super().__init__()
123
126
  assert num_discrete_actions > 0 or num_continuous_actions > 0
124
127
 
125
128
  dim_predict = default(dim_predict, dim_embed)
129
+ dim_mlp_hidden = int(dim_embed * dim_hidden_expand_factor)
126
130
 
127
131
  self.to_action_embed = Embed(dim_embed, num_discrete = num_discrete_actions, num_continuous = num_continuous_actions)
128
132
 
@@ -130,12 +134,10 @@ class SelfPredictRepr(Module):
130
134
 
131
135
  self.to_projection = nn.Sequential(
132
136
  nn.RMSNorm(dim_embed),
133
- nn.Linear(dim_embed, dim_predict, bias = False)
137
+ MLP(dim_embed, dim_mlp_hidden, dim_predict)
134
138
  )
135
139
 
136
- self.to_prediction = nn.Sequential(
137
- nn.Linear(dim_predict + dim_embed, dim_predict, bias = False)
138
- )
140
+ self.to_prediction = MLP(dim_predict + dim_embed, dim_mlp_hidden, dim_predict)
139
141
 
140
142
  self.apply_sigreg = sigreg_weight > 0.
141
143
  self.sigreg_weight = sigreg_weight
@@ -386,6 +388,7 @@ class StreamingACLambda(Module):
386
388
  critic_self_predict_repr = False,
387
389
  spr_target_embed_from_ema = True,
388
390
  spr_sigreg_weight = 0.,
391
+ spr_dim_hidden_expand_factor = 4,
389
392
  entropy_weight = 0.01,
390
393
  init_sparsity = 0.9,
391
394
  dim_critic = 128,
@@ -468,7 +471,8 @@ class StreamingACLambda(Module):
468
471
  num_discrete_actions = num_discrete_actions,
469
472
  num_continuous_actions = num_continuous_actions,
470
473
  target_embed_from_ema = spr_target_embed_from_ema,
471
- sigreg_weight = spr_sigreg_weight
474
+ sigreg_weight = spr_sigreg_weight,
475
+ dim_hidden_expand_factor = spr_dim_hidden_expand_factor
472
476
  )
473
477
 
474
478
  if critic_self_predict_repr:
@@ -481,7 +485,8 @@ class StreamingACLambda(Module):
481
485
  num_discrete_actions = num_discrete_actions,
482
486
  num_continuous_actions = num_continuous_actions,
483
487
  target_embed_from_ema = spr_target_embed_from_ema,
484
- sigreg_weight = spr_sigreg_weight
488
+ sigreg_weight = spr_sigreg_weight,
489
+ dim_hidden_expand_factor = spr_dim_hidden_expand_factor
485
490
  )
486
491
 
487
492
  # actor