metacontroller-pytorch 0.0.33__tar.gz → 0.0.34__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.
Potentially problematic release.
This version of metacontroller-pytorch might be problematic. Click here for more details.
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/PKG-INFO +1 -1
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/metacontroller/metacontroller.py +1 -1
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/metacontroller/metacontroller_with_binary_mapper.py +17 -5
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/pyproject.toml +1 -1
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/.github/workflows/python-publish.yml +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/.github/workflows/test.yml +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/.gitignore +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/LICENSE +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/README.md +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/fig1.png +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/gather_babyai_trajs.py +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/metacontroller/__init__.py +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/metacontroller/transformer_with_resnet.py +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/test_babyai_e2e.sh +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/tests/test_metacontroller.py +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/train_babyai.py +0 -0
- {metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/train_behavior_clone_babyai.py +0 -0
{metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/metacontroller/metacontroller.py
RENAMED
|
@@ -26,7 +26,7 @@ from discrete_continuous_embed_readout import Embed, Readout, EmbedAndReadout
|
|
|
26
26
|
|
|
27
27
|
from assoc_scan import AssocScan
|
|
28
28
|
|
|
29
|
-
from torch_einops_utils import maybe, pad_at_dim, lens_to_mask, masked_mean, align_dims_left
|
|
29
|
+
from torch_einops_utils import maybe, pad_at_dim, lens_to_mask, masked_mean, align_dims_left
|
|
30
30
|
from torch_einops_utils.save_load import save_load
|
|
31
31
|
|
|
32
32
|
# constants
|
|
@@ -23,7 +23,7 @@ from x_mlps_pytorch import Feedforwards
|
|
|
23
23
|
|
|
24
24
|
from assoc_scan import AssocScan
|
|
25
25
|
|
|
26
|
-
from torch_einops_utils import maybe, pad_at_dim, lens_to_mask,
|
|
26
|
+
from torch_einops_utils import maybe, pad_at_dim, lens_to_mask, align_dims_left
|
|
27
27
|
from torch_einops_utils.save_load import save_load
|
|
28
28
|
|
|
29
29
|
from vector_quantize_pytorch import BinaryMapper
|
|
@@ -143,22 +143,34 @@ class MetaControllerWithBinaryMapper(Module):
|
|
|
143
143
|
*self.proposer_to_binary_logits.parameters()
|
|
144
144
|
]
|
|
145
145
|
|
|
146
|
+
def get_action_dist_for_internal_rl(
|
|
147
|
+
self,
|
|
148
|
+
residual_stream
|
|
149
|
+
):
|
|
150
|
+
meta_embed = self.model_to_meta(residual_stream)
|
|
151
|
+
|
|
152
|
+
proposed_action_hidden, _ = self.action_proposer(meta_embed)
|
|
153
|
+
|
|
154
|
+
return self.proposer_to_binary_logits(proposed_action_hidden)
|
|
155
|
+
|
|
146
156
|
def log_prob(
|
|
147
157
|
self,
|
|
148
158
|
action_dist,
|
|
149
159
|
sampled_latent_action
|
|
150
160
|
):
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
161
|
+
log_probs = stack((
|
|
162
|
+
F.logsigmoid(action_dist),
|
|
163
|
+
F.logsigmoid(-action_dist)
|
|
164
|
+
), dim = -1)
|
|
154
165
|
|
|
155
166
|
indices = sampled_latent_action.argmax(dim = -1)
|
|
156
167
|
codes = self.binary_mapper.codes[indices].long()
|
|
157
168
|
|
|
158
169
|
codes = rearrange(codes, '... -> ... 1')
|
|
159
170
|
action_log_probs = log_probs.gather(-1, codes)
|
|
171
|
+
action_log_probs = rearrange(action_log_probs, '... 1 -> ...')
|
|
160
172
|
|
|
161
|
-
return
|
|
173
|
+
return action_log_probs.sum(dim = -1)
|
|
162
174
|
|
|
163
175
|
def forward(
|
|
164
176
|
self,
|
{metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/.github/workflows/python-publish.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/tests/test_metacontroller.py
RENAMED
|
File without changes
|
|
File without changes
|
{metacontroller_pytorch-0.0.33 → metacontroller_pytorch-0.0.34}/train_behavior_clone_babyai.py
RENAMED
|
File without changes
|