alunxu commited on
Commit
43a95f4
·
verified ·
1 Parent(s): 03d0e7c

README: strip idea-revealing framing; load-only

Browse files
Files changed (1) hide show
  1. README.md +23 -44
README.md CHANGED
@@ -1,32 +1,19 @@
1
- # Spatial-memory checkpoints (5 visual conditions)
2
 
3
- Frozen post-training DD-PPO PointNav agents on Habitat for five visual sensor
4
- conditions on a shared ResNet-18 + 3-layer LSTM (512-d) backbone. Hidden
5
- state `h_2` (top LSTM layer) is the canonical 512-d cognitive-map readout.
6
 
7
- | folder | encoder | # ckpts | frames per ckpt | converged ckpt |
8
- | ------------------- | ------------------------------------------------------ | ------- | --------------- | -------------- |
9
- | `blind/` | no visual encoder | 35 (`0..34`) | 10.06 M | `ckpt.34.pth` (~342 M frames) |
10
- | `coarse/` | 48 x 48 RGB, 1 x 1 encoder feature map | 50 (`0..49`) | 5.0 M | `ckpt.49.pth` (250 M frames) |
11
- | `foveated/` | 256 x 256 RGB, eccentricity Gaussian blur, 4 x 4 map | 50 (`0..49`) | 5.0 M | `ckpt.49.pth` (250 M frames) |
12
- | `foveated_logpolar/`| 64 x 64 log-polar resampled, ~2 x 2 map | 50 (`0..49`) | 5.0 M | `ckpt.49.pth` (250 M frames) |
13
- | `uniform/` | 256 x 256 RGB, no blur, 4 x 4 map | 50 (`0..49`) | 5.0 M | `ckpt.49.pth` (250 M frames) |
14
 
15
- The **full training trajectory** is included for every condition (one
16
- checkpoint per DD-PPO save event). Note that `frames per ckpt` differs
17
- across conditions, so to align across conditions at the same training-step
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=f"{cond}/ckpt.49.pth",
41
  )
42
-
43
  ckpt = torch.load(ckpt_path, map_location="cpu", weights_only=False)
44
- state_dict = ckpt["state_dict"] # actor-critic policy weights
45
- config = ckpt["config"] # habitat-baselines OmegaConf
46
  ```
47
 
48
  Each `.pth` is a habitat-baselines checkpoint with keys `state_dict`,
49
- `config`, and `extra_state` (training step counters).
50
 
51
- ## Rebuild the policy and read `h_2`
52
 
53
  ```python
54
  from habitat_baselines.common.baseline_registry import baseline_registry
55
 
56
- # 1. Build the same env the policy was trained on (for obs/action spaces).
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
- # 3. Run a rollout. The recurrent hidden state has shape
72
- # (num_envs, num_layers=3, hidden=512). h_2 is the top layer:
73
- # h_2 = recurrent_hidden_states[:, 2, :]
74
- # Pass `recurrent_hidden_states` back into `policy.act(...)` each step.
75
  ```
76
 
77
- Code, configs, and the deterministic-rollout probing pipeline that produced
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>.