README: strip idea-revealing framing; load-only
Browse files
README.md
CHANGED
|
@@ -1,32 +1,19 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
state `h_2` (top LSTM layer) is the canonical 512-d cognitive-map readout.
|
| 6 |
|
| 7 |
-
| folder
|
| 8 |
-
| ------------------- | -------------
|
| 9 |
-
| `blind/`
|
| 10 |
-
| `coarse/`
|
| 11 |
-
| `foveated/`
|
| 12 |
-
| `foveated_logpolar/`
|
| 13 |
-
| `uniform/`
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
anchor, convert ckpt index to absolute frame count first:
|
| 19 |
-
|
| 20 |
-
```python
|
| 21 |
-
FRAMES_PER_CKPT_M = {
|
| 22 |
-
"blind": 10.06,
|
| 23 |
-
"coarse": 5.0,
|
| 24 |
-
"foveated": 5.0,
|
| 25 |
-
"foveated_logpolar": 5.0,
|
| 26 |
-
"uniform": 5.0,
|
| 27 |
-
}
|
| 28 |
-
# blind ckpt.20 ~= coarse ckpt.40 (both ~200 M frames trained)
|
| 29 |
-
```
|
| 30 |
|
| 31 |
## Load a checkpoint
|
| 32 |
|
|
@@ -34,30 +21,24 @@ FRAMES_PER_CKPT_M = {
|
|
| 34 |
import torch
|
| 35 |
from huggingface_hub import hf_hub_download
|
| 36 |
|
| 37 |
-
cond = "foveated" # or: blind | coarse | uniform | foveated_logpolar
|
| 38 |
ckpt_path = hf_hub_download(
|
| 39 |
repo_id="alunxu/spatial-memory-checkpoints",
|
| 40 |
-
filename=
|
| 41 |
)
|
| 42 |
-
|
| 43 |
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
|
| 44 |
-
state_dict = ckpt["state_dict"]
|
| 45 |
-
config = ckpt["config"]
|
| 46 |
```
|
| 47 |
|
| 48 |
Each `.pth` is a habitat-baselines checkpoint with keys `state_dict`,
|
| 49 |
-
`config`, and `extra_state`
|
| 50 |
|
| 51 |
-
## Rebuild the policy and
|
| 52 |
|
| 53 |
```python
|
| 54 |
from habitat_baselines.common.baseline_registry import baseline_registry
|
| 55 |
|
| 56 |
-
#
|
| 57 |
-
env_config = config.habitat # already inside ckpt
|
| 58 |
-
# ... construct the eval env from env_config (see code repo) ...
|
| 59 |
-
|
| 60 |
-
# 2. Instantiate the policy class registered for this config and load weights.
|
| 61 |
policy_cls = baseline_registry.get_policy(
|
| 62 |
config.habitat_baselines.rl.policy.name)
|
| 63 |
policy = policy_cls.from_config(
|
|
@@ -68,11 +49,9 @@ policy = policy_cls.from_config(
|
|
| 68 |
policy.load_state_dict(state_dict)
|
| 69 |
policy.eval()
|
| 70 |
|
| 71 |
-
#
|
| 72 |
-
#
|
| 73 |
-
#
|
| 74 |
-
# Pass `recurrent_hidden_states` back into `policy.act(...)` each step.
|
| 75 |
```
|
| 76 |
|
| 77 |
-
Code
|
| 78 |
-
this release: <https://github.com/alunxu/foveated-cog-map>.
|
|
|
|
| 1 |
+
# spatial-memory-checkpoints
|
| 2 |
|
| 3 |
+
DD-PPO PointNav checkpoints (Habitat, GPS-PointGoal task), full training
|
| 4 |
+
trajectory from initialisation to convergence.
|
|
|
|
| 5 |
|
| 6 |
+
| folder | # checkpoints | frames per checkpoint |
|
| 7 |
+
| -------------------- | ------------- | --------------------- |
|
| 8 |
+
| `blind/` | 35 (`0..34`) | 10.06 M |
|
| 9 |
+
| `coarse/` | 50 (`0..49`) | 5.0 M |
|
| 10 |
+
| `foveated/` | 50 (`0..49`) | 5.0 M |
|
| 11 |
+
| `foveated_logpolar/` | 50 (`0..49`) | 5.0 M |
|
| 12 |
+
| `uniform/` | 50 (`0..49`) | 5.0 M |
|
| 13 |
|
| 14 |
+
`frames per ckpt` differs across folders, so to align at the same training
|
| 15 |
+
step, convert ckpt index to absolute frame count (`blind/ckpt.20.pth` ≈
|
| 16 |
+
`coarse/ckpt.40.pth` ≈ 200 M frames).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
## Load a checkpoint
|
| 19 |
|
|
|
|
| 21 |
import torch
|
| 22 |
from huggingface_hub import hf_hub_download
|
| 23 |
|
|
|
|
| 24 |
ckpt_path = hf_hub_download(
|
| 25 |
repo_id="alunxu/spatial-memory-checkpoints",
|
| 26 |
+
filename="foveated/ckpt.49.pth",
|
| 27 |
)
|
|
|
|
| 28 |
ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
|
| 29 |
+
state_dict = ckpt["state_dict"]
|
| 30 |
+
config = ckpt["config"]
|
| 31 |
```
|
| 32 |
|
| 33 |
Each `.pth` is a habitat-baselines checkpoint with keys `state_dict`,
|
| 34 |
+
`config`, and `extra_state`.
|
| 35 |
|
| 36 |
+
## Rebuild the policy and run rollouts
|
| 37 |
|
| 38 |
```python
|
| 39 |
from habitat_baselines.common.baseline_registry import baseline_registry
|
| 40 |
|
| 41 |
+
# Build env from ckpt's config (env_config = config.habitat).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
policy_cls = baseline_registry.get_policy(
|
| 43 |
config.habitat_baselines.rl.policy.name)
|
| 44 |
policy = policy_cls.from_config(
|
|
|
|
| 49 |
policy.load_state_dict(state_dict)
|
| 50 |
policy.eval()
|
| 51 |
|
| 52 |
+
# policy.act(...) returns (action, recurrent_hidden_states) where
|
| 53 |
+
# recurrent_hidden_states has shape (num_envs, num_layers, hidden_dim).
|
| 54 |
+
# Pass it back at the next step to keep the recurrent state.
|
|
|
|
| 55 |
```
|
| 56 |
|
| 57 |
+
Code: <https://github.com/alunxu/foveated-cog-map>.
|
|
|