hannahyh commited on
Commit
182347a
·
verified ·
1 Parent(s): 95ad783

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. model/tachin_paired30_cache_20260923/cache/bases/smolvla/test/complete.json +30 -0
  2. model/tachin_paired30_cache_20260923/cache/bases/smolvla/test/smoke_complete.json +30 -0
  3. model/tachin_paired30_cache_20260923/cache/bases/smolvla/train/complete.json +30 -0
  4. model/tachin_paired30_cache_20260923/cache/bases/smolvla/train/smoke_complete.json +30 -0
  5. model/tachin_paired30_cache_20260923/cache/bases/smolvla/val/complete.json +30 -0
  6. model/tachin_paired30_cache_20260923/cache/bases/smolvla/val/smoke_complete.json +30 -0
  7. model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete.json +30 -0
  8. model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_00_of_04.json +33 -0
  9. model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_01_of_04.json +33 -0
  10. model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_02_of_04.json +33 -0
  11. model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_03_of_04.json +33 -0
  12. model/tachin_paired30_cache_20260923/cache/bases/trex/test/smoke_complete.json +30 -0
  13. model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete.json +30 -0
  14. model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_00_of_04.json +33 -0
  15. model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_01_of_04.json +33 -0
  16. model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_02_of_04.json +33 -0
  17. model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_03_of_04.json +33 -0
  18. model/tachin_paired30_cache_20260923/cache/bases/trex/train/smoke_complete.json +30 -0
  19. model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete.json +30 -0
  20. model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_00_of_04.json +33 -0
  21. model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_01_of_04.json +33 -0
  22. model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_02_of_04.json +33 -0
  23. model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_03_of_04.json +33 -0
  24. model/tachin_paired30_cache_20260923/cache/bases/trex/val/smoke_complete.json +30 -0
  25. model/tachin_paired30_cache_20260923/cache/bases/twla/test/shard_00/complete.json +22 -0
  26. model/tachin_paired30_cache_20260923/cache/bases/twla/test/shard_01/complete.json +22 -0
  27. model/tachin_paired30_cache_20260923/cache/bases/twla/train/shard_00/complete.json +22 -0
  28. model/tachin_paired30_cache_20260923/cache/bases/twla/train/shard_01/complete.json +22 -0
  29. model/tachin_paired30_cache_20260923/cache/bases/twla/val/shard_00/complete.json +22 -0
  30. model/tachin_paired30_cache_20260923/cache/bases/twla/val/shard_01/complete.json +22 -0
  31. model/tachin_paired30_cache_20260923/cache/bases/vitra/test/complete.json +30 -0
  32. model/tachin_paired30_cache_20260923/cache/bases/vitra/test/smoke_complete.json +30 -0
  33. model/tachin_paired30_cache_20260923/cache/bases/vitra/train/complete.json +30 -0
  34. model/tachin_paired30_cache_20260923/cache/bases/vitra/train/smoke_complete.json +30 -0
  35. model/tachin_paired30_cache_20260923/cache/bases/vitra/val/complete.json +30 -0
  36. model/tachin_paired30_cache_20260923/cache/bases/vitra/val/smoke_complete.json +30 -0
  37. model/tachin_paired30_cache_20260923/cache/shared/test/complete.json +22 -0
  38. model/tachin_paired30_cache_20260923/cache/shared/train/complete.json +22 -0
  39. model/tachin_paired30_cache_20260923/cache/shared/val/complete.json +22 -0
  40. model/tachin_paired30_cache_20260923/code/src/tactile_editor/__init__.py +181 -0
  41. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/__init__.py +1 -0
  42. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/provenance.json +71 -0
  43. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/__init__.py +0 -0
  44. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/config.py +410 -0
  45. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/flow.py +396 -0
  46. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/group_loss.py +92 -0
  47. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/model.py +341 -0
  48. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/smolvlm_with_expert.py +559 -0
  49. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/vla_utils.py +169 -0
  50. model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/vitra_original/__init__.py +0 -0
model/tachin_paired30_cache_20260923/cache/bases/smolvla/test/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "smolvla",
4
+ "split": "test",
5
+ "rows": 1169,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/smolvla/best.pt",
7
+ "checkpoint_sha256": "c427d2a44799d371f6c5c57cd008f5910ebc57580f404f8e68bec356793dab0c",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/smolvla_official/best.pt",
14
+ "initial_sha256": "cdb1acffa5ac98eb872d35cf654d551dcbabc68b95b6c1b7ddc7442bd6a6c0c1",
15
+ "initial_step": 18000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "smolvla",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 100284352,
24
+ "frozen_parameters": 350165184,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/smolvla/test/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "smolvla",
4
+ "split": "test",
5
+ "rows": 2,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/smolvla/best.pt",
7
+ "checkpoint_sha256": "c427d2a44799d371f6c5c57cd008f5910ebc57580f404f8e68bec356793dab0c",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/smolvla_official/best.pt",
14
+ "initial_sha256": "cdb1acffa5ac98eb872d35cf654d551dcbabc68b95b6c1b7ddc7442bd6a6c0c1",
15
+ "initial_step": 18000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "smolvla",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 100284352,
24
+ "frozen_parameters": 350165184,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/smolvla/train/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "smolvla",
4
+ "split": "train",
5
+ "rows": 18208,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/smolvla/best.pt",
7
+ "checkpoint_sha256": "c427d2a44799d371f6c5c57cd008f5910ebc57580f404f8e68bec356793dab0c",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/smolvla_official/best.pt",
14
+ "initial_sha256": "cdb1acffa5ac98eb872d35cf654d551dcbabc68b95b6c1b7ddc7442bd6a6c0c1",
15
+ "initial_step": 18000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "smolvla",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 100284352,
24
+ "frozen_parameters": 350165184,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/smolvla/train/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "smolvla",
4
+ "split": "train",
5
+ "rows": 2,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/smolvla/best.pt",
7
+ "checkpoint_sha256": "c427d2a44799d371f6c5c57cd008f5910ebc57580f404f8e68bec356793dab0c",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/smolvla_official/best.pt",
14
+ "initial_sha256": "cdb1acffa5ac98eb872d35cf654d551dcbabc68b95b6c1b7ddc7442bd6a6c0c1",
15
+ "initial_step": 18000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "smolvla",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 100284352,
24
+ "frozen_parameters": 350165184,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/smolvla/val/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "smolvla",
4
+ "split": "val",
5
+ "rows": 1006,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/smolvla/best.pt",
7
+ "checkpoint_sha256": "c427d2a44799d371f6c5c57cd008f5910ebc57580f404f8e68bec356793dab0c",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/smolvla_official/best.pt",
14
+ "initial_sha256": "cdb1acffa5ac98eb872d35cf654d551dcbabc68b95b6c1b7ddc7442bd6a6c0c1",
15
+ "initial_step": 18000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "smolvla",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 100284352,
24
+ "frozen_parameters": 350165184,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/smolvla/val/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "smolvla",
4
+ "split": "val",
5
+ "rows": 2,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/smolvla/best.pt",
7
+ "checkpoint_sha256": "c427d2a44799d371f6c5c57cd008f5910ebc57580f404f8e68bec356793dab0c",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/smolvla_official/best.pt",
14
+ "initial_sha256": "cdb1acffa5ac98eb872d35cf654d551dcbabc68b95b6c1b7ddc7442bd6a6c0c1",
15
+ "initial_step": 18000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "smolvla",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 100284352,
24
+ "frozen_parameters": 350165184,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "test",
5
+ "rows": 1169,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_00_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "test",
5
+ "rows": 1169,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 293,
31
+ "shard": 0,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_01_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "test",
5
+ "rows": 1169,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 292,
31
+ "shard": 1,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_02_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "test",
5
+ "rows": 1169,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 292,
31
+ "shard": 2,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/test/complete_shard_03_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "test",
5
+ "rows": 1169,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 292,
31
+ "shard": 3,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/test/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "test",
5
+ "rows": 1,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "train",
5
+ "rows": 18208,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_00_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "train",
5
+ "rows": 18208,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 4552,
31
+ "shard": 0,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_01_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "train",
5
+ "rows": 18208,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 4552,
31
+ "shard": 1,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_02_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "train",
5
+ "rows": 18208,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 4552,
31
+ "shard": 2,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/train/complete_shard_03_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "train",
5
+ "rows": 18208,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 4552,
31
+ "shard": 3,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/train/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "train",
5
+ "rows": 1,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "val",
5
+ "rows": 1006,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_00_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "val",
5
+ "rows": 1006,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 252,
31
+ "shard": 0,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_01_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "val",
5
+ "rows": 1006,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 252,
31
+ "shard": 1,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_02_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "val",
5
+ "rows": 1006,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 251,
31
+ "shard": 2,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/val/complete_shard_03_of_04.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "val",
5
+ "rows": 1006,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ },
30
+ "assigned_rows": 251,
31
+ "shard": 3,
32
+ "shards": 4
33
+ }
model/tachin_paired30_cache_20260923/cache/bases/trex/val/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "trex",
4
+ "split": "val",
5
+ "rows": 1,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/trex/best.pt",
7
+ "checkpoint_sha256": "ad61d4665fcc29191b1e5f670540f33e8e83abaf20a19c4a60ca9a4b652fc478",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": null,
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/trex_runs/g3_lora/best.pt",
14
+ "initial_sha256": "a0bdf8b91a795c3746b293ba633a995da55226476bd45ca77e9880bb06efe717",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "trex",
22
+ "renamed_vision_wrapper_keys": 0,
23
+ "trainable_parameters": 22026432,
24
+ "frozen_parameters": 3541664768,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/twla/test/shard_00/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.twla_w3_cache.v1",
3
+ "split": "test",
4
+ "shard": 0,
5
+ "shards": 2,
6
+ "rows": 585,
7
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/runs/twla_tachin_common_adaptation_20260922/best.pt",
8
+ "checkpoint_sha256": "8df6c87fda2e5ec09d61686451744c37bdcc2d1b4d9d13b58893851be620db7d",
9
+ "checkpoint_step": 800,
10
+ "checkpoint_is_tachin_adapted": true,
11
+ "adaptation_protocol": "Tachin-only expert adaptation from T-WLA-110k",
12
+ "adaptation_initial_checkpoint": "checkpoints/v4d_ten_stageA/best.pt",
13
+ "adaptation_initial_sha256": "ccd65fcf845ec01c7de46bb76e9cf0fee33674dd848771e114ff23b2535f13d9",
14
+ "adaptation_common_complete_sha256": "1cffe026d12e556cc2f66fbda0b34a65a985f50d7aeb0a5adb50571e8437e740",
15
+ "memory_protocol": "up to eight available 10-Hz historical observations plus current",
16
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
17
+ "world_checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/checkpoints/v4d_world_stage1/last.pt",
18
+ "world_checkpoint_sha256": "1ce7c8fad5fca3f5c19246f88d48ca53e75aee1402ad7ec743350ed3cbd534bb",
19
+ "max_common_target_difference": 0.19084084033966064,
20
+ "common_mask_mismatches": 0,
21
+ "seconds": 130.8162066936493
22
+ }
model/tachin_paired30_cache_20260923/cache/bases/twla/test/shard_01/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.twla_w3_cache.v1",
3
+ "split": "test",
4
+ "shard": 1,
5
+ "shards": 2,
6
+ "rows": 584,
7
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/runs/twla_tachin_common_adaptation_20260922/best.pt",
8
+ "checkpoint_sha256": "8df6c87fda2e5ec09d61686451744c37bdcc2d1b4d9d13b58893851be620db7d",
9
+ "checkpoint_step": 800,
10
+ "checkpoint_is_tachin_adapted": true,
11
+ "adaptation_protocol": "Tachin-only expert adaptation from T-WLA-110k",
12
+ "adaptation_initial_checkpoint": "checkpoints/v4d_ten_stageA/best.pt",
13
+ "adaptation_initial_sha256": "ccd65fcf845ec01c7de46bb76e9cf0fee33674dd848771e114ff23b2535f13d9",
14
+ "adaptation_common_complete_sha256": "1cffe026d12e556cc2f66fbda0b34a65a985f50d7aeb0a5adb50571e8437e740",
15
+ "memory_protocol": "up to eight available 10-Hz historical observations plus current",
16
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
17
+ "world_checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/checkpoints/v4d_world_stage1/last.pt",
18
+ "world_checkpoint_sha256": "1ce7c8fad5fca3f5c19246f88d48ca53e75aee1402ad7ec743350ed3cbd534bb",
19
+ "max_common_target_difference": 0.19073008000850677,
20
+ "common_mask_mismatches": 0,
21
+ "seconds": 101.12281584739685
22
+ }
model/tachin_paired30_cache_20260923/cache/bases/twla/train/shard_00/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.twla_w3_cache.v1",
3
+ "split": "train",
4
+ "shard": 0,
5
+ "shards": 2,
6
+ "rows": 9104,
7
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/runs/twla_tachin_common_adaptation_20260922/best.pt",
8
+ "checkpoint_sha256": "8df6c87fda2e5ec09d61686451744c37bdcc2d1b4d9d13b58893851be620db7d",
9
+ "checkpoint_step": 800,
10
+ "checkpoint_is_tachin_adapted": true,
11
+ "adaptation_protocol": "Tachin-only expert adaptation from T-WLA-110k",
12
+ "adaptation_initial_checkpoint": "checkpoints/v4d_ten_stageA/best.pt",
13
+ "adaptation_initial_sha256": "ccd65fcf845ec01c7de46bb76e9cf0fee33674dd848771e114ff23b2535f13d9",
14
+ "adaptation_common_complete_sha256": "1cffe026d12e556cc2f66fbda0b34a65a985f50d7aeb0a5adb50571e8437e740",
15
+ "memory_protocol": "up to eight available 10-Hz historical observations plus current",
16
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
17
+ "world_checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/checkpoints/v4d_world_stage1/last.pt",
18
+ "world_checkpoint_sha256": "1ce7c8fad5fca3f5c19246f88d48ca53e75aee1402ad7ec743350ed3cbd534bb",
19
+ "max_common_target_difference": 0.3907139301300049,
20
+ "common_mask_mismatches": 414,
21
+ "seconds": 1011.7041006088257
22
+ }
model/tachin_paired30_cache_20260923/cache/bases/twla/train/shard_01/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.twla_w3_cache.v1",
3
+ "split": "train",
4
+ "shard": 1,
5
+ "shards": 2,
6
+ "rows": 9104,
7
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/runs/twla_tachin_common_adaptation_20260922/best.pt",
8
+ "checkpoint_sha256": "8df6c87fda2e5ec09d61686451744c37bdcc2d1b4d9d13b58893851be620db7d",
9
+ "checkpoint_step": 800,
10
+ "checkpoint_is_tachin_adapted": true,
11
+ "adaptation_protocol": "Tachin-only expert adaptation from T-WLA-110k",
12
+ "adaptation_initial_checkpoint": "checkpoints/v4d_ten_stageA/best.pt",
13
+ "adaptation_initial_sha256": "ccd65fcf845ec01c7de46bb76e9cf0fee33674dd848771e114ff23b2535f13d9",
14
+ "adaptation_common_complete_sha256": "1cffe026d12e556cc2f66fbda0b34a65a985f50d7aeb0a5adb50571e8437e740",
15
+ "memory_protocol": "up to eight available 10-Hz historical observations plus current",
16
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
17
+ "world_checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/checkpoints/v4d_world_stage1/last.pt",
18
+ "world_checkpoint_sha256": "1ce7c8fad5fca3f5c19246f88d48ca53e75aee1402ad7ec743350ed3cbd534bb",
19
+ "max_common_target_difference": 0.39840880036354065,
20
+ "common_mask_mismatches": 621,
21
+ "seconds": 881.0313642024994
22
+ }
model/tachin_paired30_cache_20260923/cache/bases/twla/val/shard_00/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.twla_w3_cache.v1",
3
+ "split": "val",
4
+ "shard": 0,
5
+ "shards": 2,
6
+ "rows": 503,
7
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/runs/twla_tachin_common_adaptation_20260922/best.pt",
8
+ "checkpoint_sha256": "8df6c87fda2e5ec09d61686451744c37bdcc2d1b4d9d13b58893851be620db7d",
9
+ "checkpoint_step": 800,
10
+ "checkpoint_is_tachin_adapted": true,
11
+ "adaptation_protocol": "Tachin-only expert adaptation from T-WLA-110k",
12
+ "adaptation_initial_checkpoint": "checkpoints/v4d_ten_stageA/best.pt",
13
+ "adaptation_initial_sha256": "ccd65fcf845ec01c7de46bb76e9cf0fee33674dd848771e114ff23b2535f13d9",
14
+ "adaptation_common_complete_sha256": "1cffe026d12e556cc2f66fbda0b34a65a985f50d7aeb0a5adb50571e8437e740",
15
+ "memory_protocol": "up to eight available 10-Hz historical observations plus current",
16
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
17
+ "world_checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/checkpoints/v4d_world_stage1/last.pt",
18
+ "world_checkpoint_sha256": "1ce7c8fad5fca3f5c19246f88d48ca53e75aee1402ad7ec743350ed3cbd534bb",
19
+ "max_common_target_difference": 0.14446601271629333,
20
+ "common_mask_mismatches": 0,
21
+ "seconds": 127.37033939361572
22
+ }
model/tachin_paired30_cache_20260923/cache/bases/twla/val/shard_01/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.twla_w3_cache.v1",
3
+ "split": "val",
4
+ "shard": 1,
5
+ "shards": 2,
6
+ "rows": 503,
7
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/runs/twla_tachin_common_adaptation_20260922/best.pt",
8
+ "checkpoint_sha256": "8df6c87fda2e5ec09d61686451744c37bdcc2d1b4d9d13b58893851be620db7d",
9
+ "checkpoint_step": 800,
10
+ "checkpoint_is_tachin_adapted": true,
11
+ "adaptation_protocol": "Tachin-only expert adaptation from T-WLA-110k",
12
+ "adaptation_initial_checkpoint": "checkpoints/v4d_ten_stageA/best.pt",
13
+ "adaptation_initial_sha256": "ccd65fcf845ec01c7de46bb76e9cf0fee33674dd848771e114ff23b2535f13d9",
14
+ "adaptation_common_complete_sha256": "1cffe026d12e556cc2f66fbda0b34a65a985f50d7aeb0a5adb50571e8437e740",
15
+ "memory_protocol": "up to eight available 10-Hz historical observations plus current",
16
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
17
+ "world_checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/checkpoints/v4d_world_stage1/last.pt",
18
+ "world_checkpoint_sha256": "1ce7c8fad5fca3f5c19246f88d48ca53e75aee1402ad7ec743350ed3cbd534bb",
19
+ "max_common_target_difference": 0.16731011867523193,
20
+ "common_mask_mismatches": 0,
21
+ "seconds": 65.5791323184967
22
+ }
model/tachin_paired30_cache_20260923/cache/bases/vitra/test/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "vitra",
4
+ "split": "test",
5
+ "rows": 1169,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/vitra/best.pt",
7
+ "checkpoint_sha256": "953d60fbf9b65b7a94ede70c82dd84def60da3cc20c8fce3868efaa30d29f4dc",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": "native MANO_LEFT/MANO_RIGHT",
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/vitra_original/best.pt",
14
+ "initial_sha256": "3c4765c0497ad0c7a702b26948683f9218283412d0aafa219de25dcd3bf077f7",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "vitra",
22
+ "renamed_vision_wrapper_keys": 437,
23
+ "trainable_parameters": 141907392,
24
+ "frozen_parameters": 3032242416,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/vitra/test/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "vitra",
4
+ "split": "test",
5
+ "rows": 2,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/vitra/best.pt",
7
+ "checkpoint_sha256": "953d60fbf9b65b7a94ede70c82dd84def60da3cc20c8fce3868efaa30d29f4dc",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": "native MANO_LEFT/MANO_RIGHT",
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/vitra_original/best.pt",
14
+ "initial_sha256": "3c4765c0497ad0c7a702b26948683f9218283412d0aafa219de25dcd3bf077f7",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "vitra",
22
+ "renamed_vision_wrapper_keys": 437,
23
+ "trainable_parameters": 141907392,
24
+ "frozen_parameters": 3032242416,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/vitra/train/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "vitra",
4
+ "split": "train",
5
+ "rows": 18208,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/vitra/best.pt",
7
+ "checkpoint_sha256": "953d60fbf9b65b7a94ede70c82dd84def60da3cc20c8fce3868efaa30d29f4dc",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": "native MANO_LEFT/MANO_RIGHT",
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/vitra_original/best.pt",
14
+ "initial_sha256": "3c4765c0497ad0c7a702b26948683f9218283412d0aafa219de25dcd3bf077f7",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "vitra",
22
+ "renamed_vision_wrapper_keys": 437,
23
+ "trainable_parameters": 141907392,
24
+ "frozen_parameters": 3032242416,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/vitra/train/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "vitra",
4
+ "split": "train",
5
+ "rows": 2,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/vitra/best.pt",
7
+ "checkpoint_sha256": "953d60fbf9b65b7a94ede70c82dd84def60da3cc20c8fce3868efaa30d29f4dc",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": "native MANO_LEFT/MANO_RIGHT",
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/vitra_original/best.pt",
14
+ "initial_sha256": "3c4765c0497ad0c7a702b26948683f9218283412d0aafa219de25dcd3bf077f7",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "vitra",
22
+ "renamed_vision_wrapper_keys": 437,
23
+ "trainable_parameters": 141907392,
24
+ "frozen_parameters": 3032242416,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/vitra/val/complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "vitra",
4
+ "split": "val",
5
+ "rows": 1006,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/vitra/best.pt",
7
+ "checkpoint_sha256": "953d60fbf9b65b7a94ede70c82dd84def60da3cc20c8fce3868efaa30d29f4dc",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": "native MANO_LEFT/MANO_RIGHT",
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/vitra_original/best.pt",
14
+ "initial_sha256": "3c4765c0497ad0c7a702b26948683f9218283412d0aafa219de25dcd3bf077f7",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "vitra",
22
+ "renamed_vision_wrapper_keys": 437,
23
+ "trainable_parameters": 141907392,
24
+ "frozen_parameters": 3032242416,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/bases/vitra/val/smoke_complete.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.frozen_base.v1",
3
+ "model": "vitra",
4
+ "split": "val",
5
+ "rows": 2,
6
+ "checkpoint": "/scratch/hannahyao24/VLA-tactile_paper/artifacts/huggingface/vla-hand-baselines/model/tachin_adaptation_20260922/vitra/best.pt",
7
+ "checkpoint_sha256": "953d60fbf9b65b7a94ede70c82dd84def60da3cc20c8fce3868efaa30d29f4dc",
8
+ "adaptation_step": 1000,
9
+ "noise": "per-row torch seed 20260922 + zero-based common row index",
10
+ "output": "physical canonical [16,192] keypoint action",
11
+ "vitra_fk": "native MANO_LEFT/MANO_RIGHT",
12
+ "audit": {
13
+ "initial_checkpoint": "/scratch/chonghej/VLA/checkpoints/vla-hand-baselines/vitra_original/best.pt",
14
+ "initial_sha256": "3c4765c0497ad0c7a702b26948683f9218283412d0aafa219de25dcd3bf077f7",
15
+ "initial_step": 10000,
16
+ "initial_training_sources": [
17
+ "gigahands",
18
+ "oakink2",
19
+ "taco"
20
+ ],
21
+ "model": "vitra",
22
+ "renamed_vision_wrapper_keys": 437,
23
+ "trainable_parameters": 141907392,
24
+ "frozen_parameters": 3032242416,
25
+ "tactile_input": false,
26
+ "editor": false,
27
+ "world_model": false,
28
+ "normalization": "fresh Tachin train-only, installed after checkpoint weights"
29
+ }
30
+ }
model/tachin_paired30_cache_20260923/cache/shared/test/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.paired30.shared.v1",
3
+ "split": "test",
4
+ "plans": 1169,
5
+ "rows_sha256": "fe2df096077fb2264f3cd4aff08fc9278789e8f0177fb3c5aeff9670cc9de751",
6
+ "decision_ticks": [
7
+ 0,
8
+ 1,
9
+ 2
10
+ ],
11
+ "decision_hz": 30.0,
12
+ "action_hz": 80.0,
13
+ "first_editable_action": [
14
+ 0,
15
+ 3,
16
+ 6
17
+ ],
18
+ "touch_input": "8-frame causal windows ending at plan + decision_tick/30 s",
19
+ "w3_tactile_target": "decision-relative +100 ms (+3 frames)",
20
+ "base_plan_reused_across_decisions": true,
21
+ "gated": false
22
+ }
model/tachin_paired30_cache_20260923/cache/shared/train/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.paired30.shared.v1",
3
+ "split": "train",
4
+ "plans": 18208,
5
+ "rows_sha256": "ab63b0ad309dffdba1dc97560c51bf4c3d6ca1caf91bea5c856003ca4794cfef",
6
+ "decision_ticks": [
7
+ 0,
8
+ 1,
9
+ 2
10
+ ],
11
+ "decision_hz": 30.0,
12
+ "action_hz": 80.0,
13
+ "first_editable_action": [
14
+ 0,
15
+ 3,
16
+ 6
17
+ ],
18
+ "touch_input": "8-frame causal windows ending at plan + decision_tick/30 s",
19
+ "w3_tactile_target": "decision-relative +100 ms (+3 frames)",
20
+ "base_plan_reused_across_decisions": true,
21
+ "gated": false
22
+ }
model/tachin_paired30_cache_20260923/cache/shared/val/complete.json ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "tachin.table1.paired30.shared.v1",
3
+ "split": "val",
4
+ "plans": 1006,
5
+ "rows_sha256": "d29b089a609c293c8cb2b5f05e6fa96b0924be82016304dba6c55aa7fd73bb87",
6
+ "decision_ticks": [
7
+ 0,
8
+ 1,
9
+ 2
10
+ ],
11
+ "decision_hz": 30.0,
12
+ "action_hz": 80.0,
13
+ "first_editable_action": [
14
+ 0,
15
+ 3,
16
+ 6
17
+ ],
18
+ "touch_input": "8-frame causal windows ending at plan + decision_tick/30 s",
19
+ "w3_tactile_target": "decision-relative +100 ms (+3 frames)",
20
+ "base_plan_reused_across_decisions": true,
21
+ "gated": false
22
+ }
model/tachin_paired30_cache_20260923/code/src/tactile_editor/__init__.py ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Method D + EgoTouch tactile integration framework."""
2
+
3
+ from .config import (
4
+ EditorConfig,
5
+ EncoderConfig,
6
+ FusionConfig,
7
+ RuntimeConfig,
8
+ RuntimeMode,
9
+ TrainMode,
10
+ Variant,
11
+ )
12
+ from .action_layout import (
13
+ ACTION_DIM,
14
+ ARTICULATION_GROUPS,
15
+ DEFAULT_ACTION_LAYOUT,
16
+ FULL_ACTION_GROUPS,
17
+ FULL_HAND_GROUPS,
18
+ ActionLayout,
19
+ ActionNormalizer,
20
+ )
21
+ from .action_output import NormalizedActionOutput
22
+ from .table1_protocol import MODEL_SPECS, protocol_metadata, validate_action_contract, validate_mask
23
+ from .editor_interface import BaseActionContext, EditorOutput, TactileEditorBackend
24
+ from .editor_backends import (
25
+ MemoryFreeTactileEditor,
26
+ MemoryW0W3Editor,
27
+ NativeFinalActionEditor,
28
+ TactileEditorRouter,
29
+ )
30
+ from .model_adapters import (
31
+ AdapterSpec,
32
+ MemoryVLAAdapter,
33
+ ModelAdapter,
34
+ SmolVLAAdapter,
35
+ TRexAdapter,
36
+ TWLAAdapter,
37
+ VITRAAdapter,
38
+ )
39
+ from .checkpoint_loaders import (
40
+ load_v4d_checkpoint, official_memoryvla_contract, trex_action_contract,
41
+ vitra_action_contract,
42
+ )
43
+ from .direct_residual import (
44
+ DIRECT_INPUT_MODES,
45
+ DirectTactileResidualEditor,
46
+ DirectTactileTrunk,
47
+ )
48
+ from .table1_editor_cache import Table1EditorCache
49
+ from .encoder import (
50
+ DualHandTactileEncoder,
51
+ TouchFeatures,
52
+ initialize_random_t2p_encoder,
53
+ load_formal_t2p_encoder,
54
+ load_huggingface_encoder,
55
+ )
56
+ from .fusion import CenteredArticulationTouchEditor
57
+ from .model import TactileMethodD, component_report
58
+ from .offline_data import CachedPlan, EpisodeTouch, OfflineV1Dataset, collate_v1_samples
59
+ from .real_data import (
60
+ RealEgoTouchEpisode,
61
+ load_pinned_egotouch_episode,
62
+ operate_real_data_replay,
63
+ )
64
+ from .runtime import (
65
+ ActionPlan,
66
+ InferenceRequest,
67
+ PipelinedController,
68
+ ScheduledActionPlan,
69
+ TactileRingBuffer,
70
+ next_action_boundary,
71
+ )
72
+ from .trainability import configure_trainable_components
73
+ from .training import (
74
+ V1TrainingBatch,
75
+ build_future_action_mask,
76
+ nominal_revision_times,
77
+ v1_residual_objective,
78
+ )
79
+ from .single_stage_world import (
80
+ SingleStageWorldTactileEditor,
81
+ TactileTargetCodec,
82
+ gather_action_window,
83
+ ramp_world_weight,
84
+ )
85
+ from .rgb_world_editor import (
86
+ FrozenRGBWorldResidual,
87
+ RGBWorldRegularizedTactileEditor,
88
+ TactileMemoryConditionModulator,
89
+ roi_weighted_world_loss,
90
+ )
91
+ from .world_regularized_data import (
92
+ ShardedWorldEditorDataset,
93
+ WORLD_ARRAY_NAMES,
94
+ future_tactile_targets,
95
+ )
96
+ from .unified_cache import UnifiedWorldCache
97
+ from .unified_world import UnifiedWorldTactileEditor, WorldMode
98
+
99
+ __all__ = [
100
+ "ActionPlan",
101
+ "ACTION_DIM",
102
+ "ActionLayout",
103
+ "ActionNormalizer",
104
+ "NormalizedActionOutput",
105
+ "MODEL_SPECS",
106
+ "protocol_metadata",
107
+ "validate_action_contract",
108
+ "validate_mask",
109
+ "BaseActionContext",
110
+ "EditorOutput",
111
+ "TactileEditorBackend",
112
+ "MemoryFreeTactileEditor",
113
+ "MemoryW0W3Editor",
114
+ "NativeFinalActionEditor",
115
+ "TactileEditorRouter",
116
+ "AdapterSpec",
117
+ "ModelAdapter",
118
+ "MemoryVLAAdapter",
119
+ "SmolVLAAdapter",
120
+ "VITRAAdapter",
121
+ "TRexAdapter",
122
+ "TWLAAdapter",
123
+ "load_v4d_checkpoint",
124
+ "vitra_action_contract",
125
+ "trex_action_contract",
126
+ "official_memoryvla_contract",
127
+ "ARTICULATION_GROUPS",
128
+ "CachedPlan",
129
+ "CenteredArticulationTouchEditor",
130
+ "EpisodeTouch",
131
+ "OfflineV1Dataset",
132
+ "collate_v1_samples",
133
+ "DualHandTactileEncoder",
134
+ "DIRECT_INPUT_MODES",
135
+ "DirectTactileResidualEditor",
136
+ "DirectTactileTrunk",
137
+ "Table1EditorCache",
138
+ "EditorConfig",
139
+ "EncoderConfig",
140
+ "FusionConfig",
141
+ "FULL_ACTION_GROUPS",
142
+ "FULL_HAND_GROUPS",
143
+ "InferenceRequest",
144
+ "PipelinedController",
145
+ "RealEgoTouchEpisode",
146
+ "RuntimeConfig",
147
+ "RuntimeMode",
148
+ "DEFAULT_ACTION_LAYOUT",
149
+ "ScheduledActionPlan",
150
+ "TactileMethodD",
151
+ "TactileRingBuffer",
152
+ "TouchFeatures",
153
+ "TrainMode",
154
+ "Variant",
155
+ "V1TrainingBatch",
156
+ "build_future_action_mask",
157
+ "component_report",
158
+ "configure_trainable_components",
159
+ "load_huggingface_encoder",
160
+ "load_formal_t2p_encoder",
161
+ "initialize_random_t2p_encoder",
162
+ "load_pinned_egotouch_episode",
163
+ "next_action_boundary",
164
+ "nominal_revision_times",
165
+ "operate_real_data_replay",
166
+ "v1_residual_objective",
167
+ "SingleStageWorldTactileEditor",
168
+ "TactileTargetCodec",
169
+ "ShardedWorldEditorDataset",
170
+ "WORLD_ARRAY_NAMES",
171
+ "future_tactile_targets",
172
+ "gather_action_window",
173
+ "ramp_world_weight",
174
+ "FrozenRGBWorldResidual",
175
+ "RGBWorldRegularizedTactileEditor",
176
+ "TactileMemoryConditionModulator",
177
+ "roi_weighted_world_loss",
178
+ "UnifiedWorldCache",
179
+ "UnifiedWorldTactileEditor",
180
+ "WorldMode",
181
+ ]
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """Pinned model runtimes from VLA-HAND/Kai_final."""
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/provenance.json ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "repository": "https://github.com/kaichen-z/VLA-HAND",
3
+ "commit": "6597491add7acf92343e7a78ade66c529c5eb5b4",
4
+ "files": {
5
+ "smolvla_official/config.py": "ca4af48d152030f4741068308f9b0faac63af18178eefd8c9cbf2efe2b776f34",
6
+ "smolvla_official/model.py": "8ebfec996d6c1841adcc68f5d491ba4b68dc70b5519e46c7ca043207fd63f2ad",
7
+ "smolvla_official/flow.py": "8ec960f681de59fc47bcc9dc0a048b5f6f095ee83259e4ced6b85d2196c414fd",
8
+ "smolvla_official/smolvlm_with_expert.py": "8b17d09c5ab9b68e324e1b4f5011ab21e8d66165d8c955f3d36c19469229619e",
9
+ "smolvla_official/vla_utils.py": "689fea725369aba4f7bb5eb72112eb7f96911061bbde225113793626d7b687b2",
10
+ "smolvla_official/group_loss.py": "f8f26dc7af38af10db0d012d527a53c77493a034d96c0fda4e7462d2f6af0164",
11
+ "vitra_original/config.py": "306ce5d342acbe665c9160771b4c3711463a70598fddbc39a41df5362d7bdbc7",
12
+ "vitra_original/model.py": "edaaf0ce60a97459594f034a53a8edf9b1b07d2354cecf829ac74e957848bdc7",
13
+ "vitra_original/vlm.py": "f8e4f6c753f660201398a544d2b8f32bb94b573573acb21037221a341cb68807",
14
+ "vitra_original/dit.py": "7448464d79b9bbda800688798ba825e1864f9240502d2a5f6848e5d650074b73",
15
+ "vitra_original/diffusion.py": "5f7101f06653e57c2bec1ee03b6eaba473974ba0a475779d2baf0f91c9ec6ba1",
16
+ "vitra_original/prompt.py": "b0816ec6cd3f66e61bbd5ebd77b393a794a847fa0e801ca6a174b82ba6876fc7",
17
+ "vitra_original/group_loss.py": "bb021ee4c9d8f38db633f1f60fc8f9ffc6c4b963f442850233f794c42a79524a",
18
+ "memoryvla_official/config.py": "9ebb0bb52c5e2b28531c14f19efb982efd9d749308253b2ee4960d6b1bc123cc",
19
+ "memoryvla_official/model.py": "a53100dc812eaedc50e548839128ac9e83971354da3bb0427e57d6a8131d3c8a",
20
+ "memoryvla_official/upstream/action_model/__init__.py": "a250b824623704828544e600495214eed3595f37d3426d3b1c6cc6c73eebd2ba",
21
+ "memoryvla_official/upstream/action_model/action_model.py": "ea8df2900e9b3135937b01545efefcc3807c931c9199324f5ca4474c3012f407",
22
+ "memoryvla_official/upstream/action_model/diffusion_utils.py": "b18704df849ab6ef01fe5ffcd050762b24700b0c78a26d35eae9ad92e725f5ef",
23
+ "memoryvla_official/upstream/action_model/gaussian_diffusion.py": "e41926edcb562fa12f73c052295a04c965506e02a9f524f6e3dd52c95bf49180",
24
+ "memoryvla_official/upstream/action_model/models.py": "1ca165d31d7a607f793669b0d5a33c19d771cebedc08dce755df212917841486",
25
+ "memoryvla_official/upstream/action_model/respace.py": "e1cdca3da8b4ae828b79b37b76432881d10248aa85044861a3e1cbb874e5d26b",
26
+ "memoryvla_official/upstream/memory_vla.py": "998070d35cba0c57e7be85259c680aeee0120942545f04ad3bcd0bf5036d6f9a",
27
+ "memoryvla_official/upstream/prismatic/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
28
+ "memoryvla_official/upstream/prismatic/models/__init__.py": "5c8c5740fe21de0a59de08aabfc9fdf7d519094030f4824b4b78d7c9ac0d20dd",
29
+ "memoryvla_official/upstream/prismatic/models/backbones/__init__.py": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
30
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/__init__.py": "94c49353334c38c67f9555d39915ba83e4b712420dfd4bc98cbde10ab20b5897",
31
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/base_llm.py": "8f6b06fdd1af22c0d3d8fdbeb6a6bd490f0f3fafa97e9514994d24053453321a",
32
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/llama2.py": "587e88dec921271a2b8d1de3867d6bf9584a70196176ecf54cf43b14ccfceeb5",
33
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/mistral.py": "e72025a82d56ded938b6a119d98c81eea8cbf956c8d9f6b2f3bbe9b628fd71e1",
34
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/phi.py": "e9ff83d1934c9e588b1ebcb8c755bbd20543125767d261f5eb75cbd07ed7c416",
35
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/prompting/__init__.py": "6f532ea1f274096e32a5b4bf9b98648f3e0521f1f7e30599487a3230663d7b92",
36
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/prompting/base_prompter.py": "d98922038a2607e21bd94fcd8a14451162ebded5e190c3b9869515ffcc28e2a5",
37
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/prompting/llama2_chat_prompter.py": "85c7c39fe6f625b05d6b8becc4c1f670373d61f4c0414fc79f63591452306579",
38
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/prompting/mistral_instruct_prompter.py": "3d5f57db4028ef84f8d09fb83e07f2049985c90a74cec471c764e353fe0fc617",
39
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/prompting/phi_prompter.py": "0cba9b7821d43102ab7c0e53273033d0c53691df44efd10d91ebb037136bb29f",
40
+ "memoryvla_official/upstream/prismatic/models/backbones/llm/prompting/vicuna_v15_prompter.py": "0a9967daf1ca2e7796fc9cd8830f73b91996b573cf6bb3e0e3a5af1dfa93be39",
41
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/__init__.py": "6e2d34cf72a18596dad8e18c3c6e9983588526ec1ee58a49516be88a91d03e17",
42
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/base_vision.py": "80aa3fe577d3f23641077eaf358859683dde29fed9a2a8ec373c0cec2896579d",
43
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/clip_vit.py": "ff8347d818230940059b47a58b997ea6d21f92a9b826b9e1cc50277ecd6dcaa6",
44
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/dinoclip_vit.py": "05afd1bc7c0bb1fa6d4a5ee16948422375861b80cece854b56086eb81604b213",
45
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/dinosiglip_vit.py": "8143262f1b62c1f83739a9142a8feb0c755025ce0751a476a22eb69fe5808131",
46
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/dinov2_vit.py": "1b967fe1cba0d585f78ebfc21c904ac412c61fb7464c03c77131cf7a770a0791",
47
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/in1k_vit.py": "a53de7f6ba1f82ae5976741740deefc25062901b88ffe5adf890b349720a7a41",
48
+ "memoryvla_official/upstream/prismatic/models/backbones/vision/siglip_vit.py": "c1f3500eaabe361457cb4110e404676587d231a0a0e1d29c1c8a41111ef3c3ec",
49
+ "memoryvla_official/upstream/prismatic/models/materialize.py": "b3fca60a822b4765644a1bbbe8402b6a6537f642de43d089faa560658cbb6e49",
50
+ "memoryvla_official/upstream/prismatic/models/registry.py": "eacdeb9201cd9fd1828d7ad7ffe2133f89e0de872c31f76b0038838b8a7dd493",
51
+ "memoryvla_official/upstream/prismatic/models/vlms/__init__.py": "bf58ab5c127b6df35f5d881357ec5aa24e0b46f2916c527612af484b95c7c448",
52
+ "memoryvla_official/upstream/prismatic/models/vlms/base_vlm.py": "ea291ec87810abfc4be2c4fcd942708c33a47b0601aa50ffa9e581a736dcd38c",
53
+ "memoryvla_official/upstream/prismatic/models/vlms/prismatic.py": "760d56e73fcdef9d5a4d260d00aba7fb6bfec048aa2b2ea3d319edef9c402137",
54
+ "memoryvla_official/upstream/prismatic/overwatch/__init__.py": "bd036db0376e394f189a420f798d0fa0b93637b72004419ccaaf316b8b5e757d",
55
+ "memoryvla_official/upstream/prismatic/overwatch/overwatch.py": "3f2342cd90dec06655e599975eb1a037d96602b453f6b720557125f311b15c8d",
56
+ "memoryvla_official/upstream/prismatic/util/__init__.py": "8ab7190ed1f1bd087966fcc59f35f9a7b4b315dd7b17f68a6a7ed6e335fc7380",
57
+ "memoryvla_official/upstream/prismatic/util/batching_utils.py": "a41d58f7baa40ccefe92be2727c19963a720a41feeada301a09cf01c8b261feb",
58
+ "memoryvla_official/upstream/prismatic/util/data_utils.py": "794742041f8da269ec2c185428e705984d29142be2a6febd53ba8ff1ac24de3f",
59
+ "memoryvla_official/upstream/prismatic/util/nn_utils.py": "7aa0562eab374f0585bb53639b861f06b6c44b82384e938dda9cd32d844bc0d0",
60
+ "memoryvla_official/upstream/prismatic/util/torch_utils.py": "a70e3b8d7e24b15a5d8abfa94f1c596ea70a9a85c86b50e8d8f963af51ff3304"
61
+ },
62
+ "changes": [
63
+ "SmolVLA group_loss uses a relative import, without sys.path modification.",
64
+ "VITRA diffusion imports its packaged group_loss by relative import.",
65
+ "MemoryVLA runtime uses package-qualified imports; the integration changes are documented in doc/memoryvla_integration.md.",
66
+ "MemoryVLA restores native memory modules strictly and resets runtime memory on failed windows.",
67
+ "MemoryVLA skips temporary LLM initialization before strict loading; embedding resize uses mean_resizing=False.",
68
+ "MemoryVLA vision unpacking accepts both list and tuple features from timm.",
69
+ "Trailing whitespace in the vendored MemoryVLA runtime was removed."
70
+ ]
71
+ }
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/__init__.py ADDED
File without changes
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/config.py ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Every knob for the SmolVLA-official baseline. Nothing is defaulted elsewhere.
2
+
3
+ Values are transcribed from two places and each field says which:
4
+
5
+ * `lerobot/smolvla_base`'s own `config.json` -- what the released checkpoint was trained
6
+ with. This is the authority wherever it and the dataclass default disagree.
7
+ * `src/lerobot/policies/smolvla/configuration_smolvla.py` @ 22bd7a2 -- the dataclass
8
+ defaults, for the fields the release does not record.
9
+
10
+ Sections `vlm`, `image`, `action`, `data` and `train` carry the field names V4's dataloader
11
+ and `baselines/train.py` read. That is a hard interface, not a style choice: the loader is
12
+ shared so that the data reaching this baseline and the data reaching V4 are the same data.
13
+
14
+ **Three fields differ from upstream and all three are forced by our action space:**
15
+
16
+ max_action_dim 32 -> 192 (2 hands x 69, of which 138 are real)
17
+ max_state_dim 32 -> 212
18
+ chunk_size 50 -> 16 (16 actions at 80 Hz = 0.2 s, V4's horizon)
19
+
20
+ Everything else is upstream's, deliberately -- the baseline is "their model on our data",
21
+ so the recipe stays theirs (user, 2026-09-10).
22
+ """
23
+
24
+ from __future__ import annotations
25
+
26
+ from dataclasses import dataclass, field, fields, is_dataclass
27
+ from typing import Any
28
+
29
+
30
+ # --------------------------------------------------------------------------- VLM
31
+
32
+ @dataclass
33
+ class VLMConfig:
34
+ """SmolVLM2-500M plus the action expert built beside it.
35
+
36
+ The expert is NOT a copy of the VLM: `SmolVLMWithExpertModel` builds it from a
37
+ deep-copied text config with `hidden_size * expert_width_multiplier`, so 960 -> 720,
38
+ and always `AutoModel.from_config(...)` -- **never pretrained**. That is upstream's
39
+ own behaviour, not a choice made here: even loading `smolvla_base` through LeRobot
40
+ constructs the expert from scratch and then overwrites it from the policy state dict.
41
+ """
42
+
43
+ # ** Raw SmolVLM2-500M, the SAME starting weights V4 uses. ** User, 2026-09-11,
44
+ # revising an earlier choice of `lerobot/smolvla_base`'s VLM.
45
+ #
46
+ # The reasoning: whichever checkpoint is named, the part that makes `smolvla_base`
47
+ # *SmolVLA* is discarded anyway -- its `action_in_proj` is [720, 32] and
48
+ # `action_out_proj` [32, 720], neither of which can carry 192 channels, so the expert
49
+ # and both projections are rebuilt from scratch. What is left to choose is only which
50
+ # VLM weights, and choosing V4's removes a confound for free: both models then start
51
+ # from bit-identical weights and any difference is architecture and recipe.
52
+ #
53
+ # ⚠ The cost is what this baseline answers. It is now "SmolVLA's architecture and
54
+ # recipe, from the same start as V4", not "the released SmolVLA". The VITRA baseline
55
+ # answers the latter -- its pretrained action head is what makes it VITRA, so there
56
+ # was no equivalent choice there. Say which is which when reporting.
57
+ #
58
+ # V4 chose the same way and wrote down why (`v4_d_fm_0/config.py:24`): "our data is
59
+ # egocentric human hands, so the appearance prior of a general video model is closer
60
+ # than that of a model fitted to table-top grippers". It keeps the other checkpoint as
61
+ # a commented ablation switch; so do we.
62
+ model_id: str = "HuggingFaceTB/SmolVLM2-500M-Video-Instruct"
63
+ # Ablation: set `init.pretrain_path` to smolvla_base's safetensors to start from the
64
+ # robot-pretrained VLM instead. `model.load_pretrained` takes only its 345
65
+ # `model.vlm_with_expert.vlm.*` tensors.
66
+ pretrained_policy: str = "lerobot/smolvla_base"
67
+
68
+ num_vlm_layers: int = 16 # first 16 layers of the text model are kept
69
+ num_expert_layers: int = 0 # <= 0 -> expert has as many layers as the VLM
70
+ expert_width_multiplier: float = 0.75
71
+ self_attn_every_n_layers: int = 2
72
+ attention_mode: str = "cross_attn"
73
+
74
+ freeze_vision_encoder: bool = True
75
+ train_expert_only: bool = True # ⚠ the ENTIRE VLM is frozen, vision tower included
76
+ train_state_proj: bool = True
77
+ add_image_special_tokens: bool = False
78
+ prefix_length: int = 0 # 0 -> no padding of the prefix to a fixed length
79
+
80
+ use_cache: bool = True # prefix K/V cached once per sampling call
81
+
82
+ # Read by the dataloader, not by the model. 512 with aspect preserved and padding on
83
+ # the LEFT and TOP -- `_to_square` and upstream's `resize_with_pad` are the same
84
+ # geometry, so no image knob exists for this baseline (unlike the VITRA one, which
85
+ # needed PaliGemma's aspect-destroying squash).
86
+ image_size: int = 512
87
+
88
+ # `tokenizer_max_length` upstream. No image placeholders to count: SmolVLA embeds
89
+ # images separately and concatenates, rather than scattering into `input_ids`.
90
+ max_language_tokens: int = 48
91
+
92
+ gradient_checkpointing: bool = False
93
+
94
+
95
+ # --------------------------------------------------------------------------- image
96
+
97
+ @dataclass
98
+ class ImageConfig:
99
+ """`pad`, and there is no second option worth offering.
100
+
101
+ V4's `_to_square` pads LEFT and TOP at 512 with the aspect preserved, and its docstring
102
+ says outright that the geometry matches `vlm.resize_with_pad`. SmolVLA's
103
+ `resize_with_pad` is the same convention. So for this baseline the shared loader's
104
+ default path already IS upstream preprocessing.
105
+ """
106
+
107
+ mode: str = "pad"
108
+
109
+
110
+ # --------------------------------------------------------------------------- action
111
+
112
+ @dataclass
113
+ class ActionConfig:
114
+ """The action and state vectors -- ours, not upstream's 32/32."""
115
+
116
+ chunk_size: int = 16 # upstream 50. 16 at 80 Hz = 0.2 s, matching V4.
117
+ dim: int = 192 # `max_action_dim`
118
+ state_dim: int = 212 # `max_state_dim`
119
+
120
+ control_hz: float = 10.0
121
+ action_hz: float = 80.0
122
+ source_fps: float = 30.0
123
+
124
+ # `keypoints`, not `angle` (user, 2026-09-10). Unlike VITRA, nothing here is
125
+ # pretrained into a layout -- the expert and both projections start from scratch -- so
126
+ # the layout is free, and keypoints is V4's. That means the evaluation needs no MANO
127
+ # forward kinematics and carries none of the FK floor the VITRA baseline does.
128
+ action_type: str = "keypoints"
129
+
130
+ dual_layout: bool = False # evaluation only; see dataloader/FORK.md
131
+
132
+
133
+ # --------------------------------------------------------------------------- flow
134
+
135
+ @dataclass
136
+ class FlowConfig:
137
+ """Flow matching. `x_t = t*noise + (1-t)*a`, target `u_t = noise - a`, MSE.
138
+
139
+ ⚠ Note what the target is: `noise - a`, a difference of two unit-variance quantities,
140
+ so a zero-output model scores **2.0**, not 1.0. VITRA's DDPM predicts epsilon and
141
+ starts at 1.0. The two baselines' loss curves are not comparable to each other, nor to
142
+ V4's -- only the physical test error is.
143
+ """
144
+
145
+ num_steps: int = 10 # Euler steps at sampling time
146
+
147
+ # Timestep sampling: Beta(1.5, 1) * 0.999 + 0.001, openpi's convention. Weighted
148
+ # towards t near 1 (mostly noise), which is where the velocity field is hardest.
149
+ time_alpha: float = 1.5
150
+ time_beta: float = 1.0
151
+ time_scale: float = 0.999
152
+ time_offset: float = 0.001
153
+
154
+ # Sine-cosine timestep embedding period range.
155
+ min_period: float = 4e-3
156
+ max_period: float = 4.0
157
+
158
+
159
+ # --------------------------------------------------------------------------- loss
160
+
161
+ @dataclass
162
+ class LossConfig:
163
+ """Per-channel groups, for reporting AND for masking.
164
+
165
+ ⚠ **Upstream's loss is not usable as-is.** `SmolVLAPolicy.forward` masks with
166
+ `action_is_pad`, which marks padded TIME STEPS; our padding is per CHANNEL -- 192
167
+ slots of which 138 carry data and 54 are permanently zero. Taking the plain mean would
168
+ train the model to predict those 54 zeros and divide the real error by 192/138. It
169
+ would not raise, and the loss would look better than it is. `model.loss` masks by
170
+ `action_mask` instead; these groups are how the result is reported.
171
+
172
+ Six groups, matching V4's split (each wrist block into translation and rotation)
173
+ rather than VITRA's four. SmolVLA has no group structure of its own to be faithful
174
+ to -- its loss is one undifferentiated mean -- so the reporting follows the model this
175
+ baseline is compared against.
176
+ """
177
+
178
+ groups: tuple[tuple[str, int, int, float], ...] = (
179
+ ("left_translation", 0, 3, 1.0),
180
+ ("left_rotation", 3, 6, 1.0),
181
+ ("left_joints", 6, 69, 1.0),
182
+ ("right_translation", 69, 72, 1.0),
183
+ ("right_rotation", 72, 75, 1.0),
184
+ ("right_joints", 75, 138, 1.0),
185
+ )
186
+
187
+
188
+ # --------------------------------------------------------------------------- data
189
+
190
+ @dataclass
191
+ class DataConfig:
192
+ """Read by the shared dataloader. Field names are its interface, not ours."""
193
+
194
+ stride: int = 3 # source_fps / control_hz
195
+ interpolation: str = "pchip_bone_preserving"
196
+ geometric_augmentation: bool = False
197
+ random_paraphrase: bool = True
198
+
199
+ sources: tuple[dict[str, Any], ...] = ()
200
+ stats_path: str = ""
201
+
202
+
203
+ # --------------------------------------------------------------------------- train
204
+
205
+ @dataclass
206
+ class TrainConfig:
207
+ # ** `max_seq_len` and `length_alpha` are the LOADER's interface, and both must match
208
+ # V4's or the two models see different distributions of episode position. ** 9 is
209
+ # V4's bank capacity 8 plus the supervised step; `length_alpha` weights the draw of L
210
+ # by `L ** alpha`. This model has no memory and reads only `steps[-1]`, but the window
211
+ # still decides WHERE in an episode the supervised anchor lands -- shortening it here
212
+ # would quietly train on a different slice of the data than V4 and the VITRA baseline.
213
+ max_seq_len: int = 9
214
+ length_alpha: float = 1.0
215
+
216
+ use_only_last_step: bool = True # no memory: only the supervised anchor is consumed
217
+ seed: int = 0
218
+ parallel: str = "ddp" # "fsdp" | "ddp"
219
+
220
+
221
+ @dataclass
222
+ class OptimConfig:
223
+ """Upstream's preset, verbatim (`get_optimizer_preset` / `get_scheduler_preset`).
224
+
225
+ ⚠ `weight_decay = 1e-10` is not a typo and not our choice -- it is what SmolVLA ships.
226
+ Effectively no decay. VITRA uses 0.1. Both are their authors'.
227
+ """
228
+
229
+ lr: float = 1e-4
230
+
231
+ # ⚠ NOT upstream. `None` means one group at `lr` for everything, which is what
232
+ # upstream does and what stage A wants (the VLM is frozen, so there is no backbone in
233
+ # the trainable set). Stage B sets it: unfreezing the language model puts pretrained
234
+ # weights beside a still-learning expert, and upstream's single 1e-4 would hit both.
235
+ # 1e-5 is the rate both VITRA and V4 give their backbones -- a 10x split with
236
+ # precedent in this project rather than a number picked here.
237
+ vlm_lr: float | None = None
238
+
239
+ betas: tuple[float, float] = (0.9, 0.95)
240
+ eps: float = 1e-8
241
+ weight_decay: float = 1e-10
242
+ grad_clip: float = 10.0
243
+ grad_accum_steps: int = 1
244
+
245
+ # Cosine decay with warmup, upstream's schedule.
246
+ warmup_steps: int = 1_000
247
+ decay_steps: int = 30_000
248
+ decay_lr: float = 2.5e-6
249
+
250
+
251
+ @dataclass
252
+ class InitConfig:
253
+ pretrain_path: str = "" # the smolvla_base safetensors, VLM part only
254
+ allow_partial_load: bool = False
255
+
256
+
257
+ # --------------------------------------------------------------------------- top
258
+
259
+ @dataclass
260
+ class Config:
261
+ """The whole configuration for this baseline. `train.py` and `test.py` in this
262
+ package import it by name."""
263
+
264
+ vlm: VLMConfig = field(default_factory=VLMConfig)
265
+ image: ImageConfig = field(default_factory=ImageConfig)
266
+ action: ActionConfig = field(default_factory=ActionConfig)
267
+ flow: FlowConfig = field(default_factory=FlowConfig)
268
+ loss: LossConfig = field(default_factory=LossConfig)
269
+ data: DataConfig = field(default_factory=DataConfig)
270
+ train: TrainConfig = field(default_factory=TrainConfig)
271
+ optim: OptimConfig = field(default_factory=OptimConfig)
272
+ init: InitConfig = field(default_factory=InitConfig)
273
+
274
+ # ** `None` = report the preflight numbers but do NOT gate on them. **
275
+ #
276
+ # The gate's premise is a head that outputs zero: then the first-batch loss is
277
+ # `E[(0 - target)^2]` and any departure from it is a normalisation error. VITRA's DiT
278
+ # satisfies that -- adaLN-Zero puts `nn.init.constant_(..., 0)` on the final layer, so
279
+ # its output really is zero at init (adaLN-Zero clears the final layer).
280
+ #
281
+ # SmolVLA does not. `action_out_proj` is a plain `nn.Linear` with PyTorch's default
282
+ # init and `flow.py` contains no zero-initialisation at all, so `v_t` is a random
283
+ # projection's output. The first batch measures
284
+ # `E[(noise - a - v_t)^2] ~= 2 + E[v_t^2]`, where the second term differs per output
285
+ # channel -- which is why the six groups spread over 1.94 to 2.87 on a run whose
286
+ # statistics were fine. No constant repairs that; the test simply does not apply.
287
+ preflight_loss: float | None = None
288
+
289
+ # ----------------------------------------------------------------- validation
290
+
291
+ def validate(self) -> None:
292
+ v, a, f = self.vlm, self.action, self.flow
293
+
294
+ if self.image.mode != "pad":
295
+ raise ValueError(
296
+ f"image.mode {self.image.mode!r}: SmolVLA's preprocessing IS the shared "
297
+ f"loader's `pad` path (512, aspect preserved, padded left and top). "
298
+ f"'squash' is PaliGemma's and belongs to the VITRA baseline.")
299
+
300
+ if a.action_type != "keypoints":
301
+ raise ValueError(
302
+ f"action.action_type {a.action_type!r}: this baseline trains keypoints "
303
+ f"(user, 2026-09-10). Nothing here is pretrained into a layout, so there "
304
+ f"is no reason to take on `angle`'s MANO-FK conversion at evaluation.")
305
+
306
+ if a.dim != 192 or a.state_dim != 212:
307
+ raise ValueError(
308
+ f"action.dim={a.dim}, state_dim={a.state_dim}: the normalisation "
309
+ f"statistics and the loss groups are tied to 192/212.")
310
+
311
+ hi = max(h for _, _, h, _ in self.loss.groups)
312
+ if hi > a.dim:
313
+ raise ValueError(f"loss group ends at {hi}, past action dim {a.dim}")
314
+ if self.loss.groups[2][2] != 69:
315
+ raise ValueError(
316
+ "loss.groups do not carry the keypoints ranges. keypoints is "
317
+ "(0,3)/(3,6)/(6,69)/(69,72)/(72,75)/(75,138).")
318
+
319
+ if v.attention_mode not in ("cross_attn", "self_attn"):
320
+ raise ValueError(f"vlm.attention_mode {v.attention_mode!r}")
321
+ if v.num_expert_layers > 0 and v.num_vlm_layers % v.num_expert_layers != 0:
322
+ raise ValueError(
323
+ f"num_vlm_layers {v.num_vlm_layers} is not a multiple of "
324
+ f"num_expert_layers {v.num_expert_layers}; `get_model_layers` divides them")
325
+ if not v.train_expert_only and not v.freeze_vision_encoder:
326
+ # Not an error upstream, but it changes what the baseline is.
327
+ pass
328
+
329
+ if f.num_steps < 1:
330
+ raise ValueError("flow.num_steps must be >= 1")
331
+
332
+ if self.train.parallel not in ("fsdp", "ddp"):
333
+ raise ValueError(f"train.parallel {self.train.parallel!r}")
334
+ if not self.train.use_only_last_step:
335
+ raise ValueError(
336
+ "use_only_last_step=False: this model has no memory and no way to consume "
337
+ "earlier steps.")
338
+
339
+ if self.data.stride != int(round(a.source_fps / a.control_hz)):
340
+ raise ValueError(
341
+ f"data.stride {self.data.stride} != source_fps/control_hz = "
342
+ f"{a.source_fps}/{a.control_hz}")
343
+ if not self.data.stats_path:
344
+ raise ValueError(
345
+ "data.stats_path is empty. The baseline MUST use the same normalisation "
346
+ "statistics as V4 -- see 项目专项规则.md, '归一化器属数据管线'.")
347
+
348
+
349
+ class FlatConfig:
350
+ """What the forked `VLAFlowMatching` expects: one flat namespace.
351
+
352
+ Upstream's `SmolVLAConfig` is flat; ours is sectioned, because `baselines/train.py`
353
+ and the shared loader read `cfg.action.chunk_size`, `cfg.vlm.image_size` and so on.
354
+ Rather than edit the forked maths to walk our sections -- an unmarked change to a file
355
+ whose whole value is being unmodified -- the model builds this view over it.
356
+
357
+ Attribute names here are upstream's, spelled exactly as `flow.py` reads them.
358
+ """
359
+
360
+ def __init__(self, cfg: Config):
361
+ v, a, f = cfg.vlm, cfg.action, cfg.flow
362
+ self.vlm_model_name = v.model_id
363
+ self.freeze_vision_encoder = v.freeze_vision_encoder
364
+ self.train_expert_only = v.train_expert_only
365
+ self.train_state_proj = v.train_state_proj
366
+ self.load_vlm_weights = True # build the architecture from the Hub config
367
+ self.attention_mode = v.attention_mode
368
+ self.num_expert_layers = v.num_expert_layers
369
+ self.num_vlm_layers = v.num_vlm_layers
370
+ self.self_attn_every_n_layers = v.self_attn_every_n_layers
371
+ self.expert_width_multiplier = v.expert_width_multiplier
372
+ self.add_image_special_tokens = v.add_image_special_tokens
373
+ self.prefix_length = v.prefix_length
374
+ self.use_cache = v.use_cache
375
+ self.device = None
376
+ self.max_state_dim = a.state_dim
377
+ self.max_action_dim = a.dim
378
+ self.chunk_size = a.chunk_size
379
+ self.num_steps = f.num_steps
380
+ self.min_period = f.min_period
381
+ self.max_period = f.max_period
382
+
383
+
384
+ # --------------------------------------------------------------------------- json
385
+
386
+ def apply_overrides(cfg: Any, overrides: dict[str, Any], path: str = "") -> None:
387
+ """Recursively overwrite dataclass fields from a parsed json.
388
+
389
+ Unknown keys RAISE. A run json with a typo'd knob otherwise trains happily with the
390
+ default and the log says nothing; that failure is indistinguishable from the
391
+ experiment simply not working.
392
+ """
393
+ known = {f.name: f for f in fields(cfg)}
394
+ for key, value in overrides.items():
395
+ if key not in known:
396
+ raise KeyError(f"unknown config key {path}{key!r}; known here: {sorted(known)}")
397
+ current = getattr(cfg, key)
398
+ if is_dataclass(current) and isinstance(value, dict):
399
+ apply_overrides(current, value, f"{path}{key}.")
400
+ elif isinstance(current, tuple) and isinstance(value, list):
401
+ setattr(cfg, key, tuple(tuple(v) if isinstance(v, list) else v for v in value))
402
+ else:
403
+ setattr(cfg, key, value)
404
+
405
+
406
+ def from_json(overrides: dict[str, Any]) -> Config:
407
+ cfg = Config()
408
+ apply_overrides(cfg, overrides)
409
+ cfg.validate()
410
+ return cfg
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/flow.py ADDED
@@ -0,0 +1,396 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """SmolVLA's flow-matching policy, forked from LeRobot. See `FORK.md`.
2
+
3
+ Source: `yuzhench/paper_code/smolvla_lerobot` @ 22bd7a2,
4
+ `src/lerobot/policies/smolvla/modeling_smolvla.py` -- `pad_tensor` and `VLAFlowMatching`.
5
+ `SmolVLAPolicy` is NOT forked: it is the LeRobot wrapper (queues, processor pipeline, Hub
6
+ mixin, RTC) and `model.py` here plays that role against this project's interfaces instead.
7
+
8
+ **The maths is unchanged.** Four edits, each marked `** FORK EDIT **` in place:
9
+
10
+ 1. real-time chunking removed -- `rtc_processor`, `_rtc_enabled`, and the four RTC
11
+ kwargs of `sample_actions`. RTC is an online-execution feature (it blends a new chunk
12
+ with the tail of the one still running); offline evaluation never reaches it.
13
+ 2. `euler_integrate` inlined. Upstream's helper is mostly RTC plumbing around four lines
14
+ -- `dt = -1/num_steps`, `time = 1 + step*dt`, `v_t = denoise(x_t, time)`,
15
+ `x_t += dt * v_t`. Written out so the sampler is readable without the RTC branches.
16
+ 3. `torch.compile` block dropped; this tree compiles nothing.
17
+ 4. the `state` argument of `embed_prefix` loses its `= None` default -- it is required
18
+ here and a silent `None` would reach `state_proj` as a shape error far from the cause.
19
+
20
+ ⚠ **`embed_prefix` puts the state in the PREFIX**, next to the image and language tokens,
21
+ and `att_masks` marks it `1` so images and language cannot attend to it. That is SmolVLA's
22
+ arrangement and it is one of the things this baseline exists to hold fixed.
23
+ """
24
+
25
+ from __future__ import annotations
26
+
27
+ import math
28
+
29
+ import torch
30
+ import torch.nn.functional as F # noqa: N812
31
+ from torch import Tensor, nn
32
+
33
+ from .config import Config
34
+ from .smolvlm_with_expert import SmolVLMWithExpertModel
35
+ from .vla_utils import (
36
+ create_sinusoidal_pos_embedding,
37
+ make_att_2d_masks,
38
+ sample_noise,
39
+ sample_time_beta,
40
+ )
41
+
42
+
43
+ def pad_tensor(tensor, max_len, pad_value=0):
44
+ """
45
+ Efficiently pads a tensor along sequence dimension to match max_len.
46
+
47
+ Args:
48
+ tensor (torch.Tensor): Shape (B, L, ...) or (B, L).
49
+ max_len (int): Fixed sequence length.
50
+ pad_value (int/float): Value for padding.
51
+
52
+ Returns:
53
+ torch.Tensor: Shape (B, max_len, ...) or (B, max_len).
54
+ """
55
+ b, d = tensor.shape[:2]
56
+
57
+ # Create a padded tensor of max_len and copy the existing values
58
+ padded_tensor = torch.full(
59
+ (b, max_len, *tensor.shape[2:]), pad_value, dtype=tensor.dtype, device=tensor.device
60
+ )
61
+ padded_tensor[:, :d] = tensor # Efficient in-place copy
62
+
63
+ return padded_tensor
64
+
65
+
66
+ class VLAFlowMatching(nn.Module):
67
+ """
68
+ SmolVLA
69
+
70
+ [Paper]()
71
+
72
+ Designed by Hugging Face.
73
+ ┌──────────────────────────────┐
74
+ │ actions │
75
+ │ ▲ │
76
+ │ ┌─────────┐ ┌─|────┐ │
77
+ │ | │────► │ │ │
78
+ │ | │ kv │ │ │
79
+ │ | │────► │Action│ │
80
+ │ | VLM │cache │Expert│ |
81
+ │ │ │────► | │ │
82
+ │ │ │ │ │ │
83
+ │ └▲──▲───▲─┘ └───▲──┘ |
84
+ │ │ | | │ |
85
+ │ | | | noise │
86
+ │ │ │ state │
87
+ │ │ language tokens │
88
+ │ image(s) │
89
+ └──────────────────────────────┘
90
+ """
91
+
92
+ def __init__(self, config: Config):
93
+ # ** FORK EDIT 1 ** `rtc_processor` dropped; ** FORK EDIT 3 ** no torch.compile.
94
+ super().__init__()
95
+ self.config = config
96
+
97
+ self.vlm_with_expert = SmolVLMWithExpertModel(
98
+ model_id=self.config.vlm_model_name,
99
+ freeze_vision_encoder=self.config.freeze_vision_encoder,
100
+ train_expert_only=self.config.train_expert_only,
101
+ load_vlm_weights=self.config.load_vlm_weights,
102
+ attention_mode=self.config.attention_mode,
103
+ num_expert_layers=self.config.num_expert_layers,
104
+ num_vlm_layers=self.config.num_vlm_layers,
105
+ self_attn_every_n_layers=self.config.self_attn_every_n_layers,
106
+ expert_width_multiplier=self.config.expert_width_multiplier,
107
+ device=self.config.device if self.config.device is not None else "auto",
108
+ )
109
+ self.state_proj = nn.Linear(
110
+ self.config.max_state_dim, self.vlm_with_expert.config.text_config.hidden_size
111
+ )
112
+ self.action_in_proj = nn.Linear(self.config.max_action_dim, self.vlm_with_expert.expert_hidden_size)
113
+ self.action_out_proj = nn.Linear(self.vlm_with_expert.expert_hidden_size, self.config.max_action_dim)
114
+
115
+ self.action_time_mlp_in = nn.Linear(
116
+ self.vlm_with_expert.expert_hidden_size * 2, self.vlm_with_expert.expert_hidden_size
117
+ )
118
+ self.action_time_mlp_out = nn.Linear(
119
+ self.vlm_with_expert.expert_hidden_size, self.vlm_with_expert.expert_hidden_size
120
+ )
121
+
122
+ self.set_requires_grad()
123
+ self.fake_image_token = self.vlm_with_expert.processor.tokenizer.fake_image_token_id
124
+ self.global_image_token = self.vlm_with_expert.processor.tokenizer.global_image_token_id
125
+ self.global_image_start_token = torch.tensor(
126
+ [self.fake_image_token, self.global_image_token], dtype=torch.long
127
+ )
128
+
129
+ self.add_image_special_tokens = self.config.add_image_special_tokens
130
+ self.image_end_token = torch.tensor([self.fake_image_token], dtype=torch.long)
131
+ self.prefix_length = self.config.prefix_length
132
+
133
+ def set_requires_grad(self):
134
+ for params in self.state_proj.parameters():
135
+ params.requires_grad = self.config.train_state_proj
136
+
137
+ def sample_noise(self, shape, device):
138
+ return sample_noise(shape, device)
139
+
140
+ def sample_time(self, bsize, device):
141
+ return sample_time_beta(bsize, device, alpha=1.5, beta=1.0, scale=0.999, offset=0.001)
142
+
143
+ def embed_prefix(
144
+ self, images, img_masks, lang_tokens, lang_masks, state: torch.Tensor
145
+ ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
146
+ # ** FORK EDIT 4 ** `state` is required; upstream defaults it to None.
147
+ """Embed images with SigLIP and language tokens with embedding layer to prepare
148
+ for SmolVLM transformer processing.
149
+ """
150
+ embs = []
151
+ pad_masks = []
152
+ att_masks = []
153
+ for _img_idx, (
154
+ img,
155
+ img_mask,
156
+ ) in enumerate(zip(images, img_masks, strict=False)):
157
+ if self.add_image_special_tokens:
158
+ image_start_token = (
159
+ self.vlm_with_expert.embed_language_tokens(
160
+ self.global_image_start_token.to(device=self.vlm_with_expert.vlm.device)
161
+ )
162
+ .unsqueeze(0)
163
+ .expand(img.shape[0], -1, -1)
164
+ )
165
+ image_start_mask = torch.ones_like(
166
+ image_start_token[:, :, 0], dtype=torch.bool, device=image_start_token.device
167
+ )
168
+ att_masks += [0] * (image_start_mask.shape[-1])
169
+ embs.append(image_start_token)
170
+ pad_masks.append(image_start_mask)
171
+
172
+ img_emb = self.vlm_with_expert.embed_image(img)
173
+ img_emb = img_emb
174
+
175
+ # Normalize image embeddings
176
+ img_emb_dim = img_emb.shape[-1]
177
+ img_emb = img_emb * torch.tensor(img_emb_dim**0.5, dtype=img_emb.dtype, device=img_emb.device)
178
+
179
+ bsize, num_img_embs = img_emb.shape[:2]
180
+ img_mask = img_mask[:, None].expand(bsize, num_img_embs)
181
+
182
+ embs.append(img_emb)
183
+ pad_masks.append(img_mask)
184
+
185
+ att_masks += [0] * (num_img_embs)
186
+ if self.add_image_special_tokens:
187
+ image_end_token = (
188
+ self.vlm_with_expert.embed_language_tokens(
189
+ self.image_end_token.to(device=self.vlm_with_expert.vlm.device)
190
+ )
191
+ .unsqueeze(0)
192
+ .expand(img.shape[0], -1, -1)
193
+ )
194
+ image_end_mask = torch.ones_like(
195
+ image_end_token[:, :, 0], dtype=torch.bool, device=image_end_token.device
196
+ )
197
+ embs.append(image_end_token)
198
+ pad_masks.append(image_end_mask)
199
+ att_masks += [0] * (image_end_mask.shape[1])
200
+ lang_emb = self.vlm_with_expert.embed_language_tokens(lang_tokens)
201
+ # Normalize language embeddings
202
+ lang_emb_dim = lang_emb.shape[-1]
203
+ lang_emb = lang_emb * math.sqrt(lang_emb_dim)
204
+
205
+ embs.append(lang_emb)
206
+ pad_masks.append(lang_masks)
207
+
208
+ num_lang_embs = lang_emb.shape[1]
209
+ att_masks += [0] * num_lang_embs
210
+
211
+ state_emb = self.state_proj(state)
212
+ state_emb = state_emb[:, None, :] if state_emb.ndim == 2 else state_emb
213
+ embs.append(state_emb)
214
+ bsize = state_emb.shape[0]
215
+ device = state_emb.device
216
+
217
+ states_seq_len = state_emb.shape[1]
218
+ state_mask = torch.ones(bsize, states_seq_len, dtype=torch.bool, device=device)
219
+ pad_masks.append(state_mask)
220
+
221
+ # Set attention masks so that image and language inputs do not attend to state or actions
222
+ att_masks += [1] * (states_seq_len)
223
+ embs = torch.cat(embs, dim=1)
224
+ pad_masks = torch.cat(pad_masks, dim=1)
225
+ att_masks = torch.tensor(att_masks, dtype=torch.bool, device=pad_masks.device)
226
+ att_masks = att_masks[None, :]
227
+
228
+ seq_len = pad_masks.shape[1]
229
+ if seq_len < self.prefix_length:
230
+ embs = pad_tensor(embs, self.prefix_length, pad_value=0)
231
+ pad_masks = pad_tensor(pad_masks, self.prefix_length, pad_value=0)
232
+ att_masks = pad_tensor(att_masks, self.prefix_length, pad_value=0)
233
+
234
+ att_masks = att_masks.expand(bsize, -1)
235
+
236
+ return embs, pad_masks, att_masks
237
+
238
+ def embed_suffix(self, noisy_actions, timestep):
239
+ """Embed state, noisy_actions, timestep to prepare for Expert Gemma processing."""
240
+ embs = []
241
+ pad_masks = []
242
+ att_masks = []
243
+
244
+ # Fuse timestep + action information using an MLP
245
+ action_emb = self.action_in_proj(noisy_actions)
246
+ device = action_emb.device
247
+ bsize = action_emb.shape[0]
248
+ dtype = action_emb.dtype
249
+ # Embed timestep using sine-cosine positional encoding with sensitivity in the range [0, 1]
250
+ time_emb = create_sinusoidal_pos_embedding(
251
+ timestep,
252
+ self.vlm_with_expert.expert_hidden_size,
253
+ self.config.min_period,
254
+ self.config.max_period,
255
+ device=device,
256
+ )
257
+ time_emb = time_emb.type(dtype=dtype)
258
+
259
+ time_emb = time_emb[:, None, :].expand_as(action_emb)
260
+ action_time_emb = torch.cat([action_emb, time_emb], dim=2)
261
+
262
+ action_time_emb = self.action_time_mlp_in(action_time_emb)
263
+ action_time_emb = F.silu(action_time_emb) # swish == silu
264
+ action_time_emb = self.action_time_mlp_out(action_time_emb)
265
+
266
+ # Add to input tokens
267
+ embs.append(action_time_emb)
268
+
269
+ bsize, action_time_dim = action_time_emb.shape[:2]
270
+ action_time_mask = torch.ones(bsize, action_time_dim, dtype=torch.bool, device=device)
271
+ pad_masks.append(action_time_mask)
272
+
273
+ # Set attention masks so that image, language and state inputs do not attend to action tokens
274
+ att_masks += [1] * self.config.chunk_size
275
+ embs = torch.cat(embs, dim=1)
276
+ pad_masks = torch.cat(pad_masks, dim=1)
277
+ att_masks = torch.tensor(att_masks, dtype=embs.dtype, device=embs.device)
278
+ att_masks = att_masks[None, :].expand(bsize, len(att_masks))
279
+ return embs, pad_masks, att_masks
280
+
281
+ def forward(
282
+ self, images, img_masks, lang_tokens, lang_masks, state, actions, noise=None, time=None
283
+ ) -> Tensor:
284
+ """Do a full training forward pass and compute the loss (batch_size x num_steps x num_motors)"""
285
+ if noise is None:
286
+ noise = self.sample_noise(actions.shape, actions.device)
287
+
288
+ if time is None:
289
+ time = self.sample_time(actions.shape[0], actions.device)
290
+
291
+ time_expanded = time[:, None, None]
292
+ x_t = time_expanded * noise + (1 - time_expanded) * actions
293
+ u_t = noise - actions
294
+ prefix_embs, prefix_pad_masks, prefix_att_masks = self.embed_prefix(
295
+ images, img_masks, lang_tokens, lang_masks, state=state
296
+ )
297
+ suffix_embs, suffix_pad_masks, suffix_att_masks = self.embed_suffix(x_t, time)
298
+
299
+ pad_masks = torch.cat([prefix_pad_masks, suffix_pad_masks], dim=1)
300
+ att_masks = torch.cat([prefix_att_masks, suffix_att_masks], dim=1)
301
+
302
+ att_2d_masks = make_att_2d_masks(pad_masks, att_masks)
303
+ position_ids = torch.cumsum(pad_masks, dim=1) - 1
304
+ (_, suffix_out), _ = self.vlm_with_expert.forward(
305
+ attention_mask=att_2d_masks,
306
+ position_ids=position_ids,
307
+ past_key_values=None,
308
+ inputs_embeds=[prefix_embs, suffix_embs],
309
+ use_cache=False,
310
+ )
311
+ suffix_out = suffix_out[:, -self.config.chunk_size :]
312
+ # Original openpi code, upcast attention output
313
+ suffix_out = suffix_out.to(dtype=torch.float32)
314
+ v_t = self.action_out_proj(suffix_out)
315
+ losses = F.mse_loss(u_t, v_t, reduction="none")
316
+ return losses
317
+
318
+ def sample_actions(self, images, img_masks, lang_tokens, lang_masks, state,
319
+ noise=None) -> Tensor:
320
+ # ** FORK EDIT 1 ** the four RTC kwargs are gone.
321
+ """Do a full inference forward and compute the action (batch_size x num_steps x num_motors)"""
322
+ bsize = state.shape[0]
323
+ device = state.device
324
+
325
+ if noise is None:
326
+ actions_shape = (bsize, self.config.chunk_size, self.config.max_action_dim)
327
+ noise = self.sample_noise(actions_shape, device)
328
+
329
+ prefix_embs, prefix_pad_masks, prefix_att_masks = self.embed_prefix(
330
+ images, img_masks, lang_tokens, lang_masks, state=state
331
+ )
332
+ prefix_att_2d_masks = make_att_2d_masks(prefix_pad_masks, prefix_att_masks)
333
+ prefix_position_ids = torch.cumsum(prefix_pad_masks, dim=1) - 1
334
+ # Compute image and language key value cache
335
+ _, past_key_values = self.vlm_with_expert.forward(
336
+ attention_mask=prefix_att_2d_masks,
337
+ position_ids=prefix_position_ids,
338
+ past_key_values=None,
339
+ inputs_embeds=[prefix_embs, None],
340
+ use_cache=self.config.use_cache,
341
+ )
342
+ # ** FORK EDIT 2 ** `euler_integrate` inlined. Upstream's helper is these four
343
+ # lines wrapped in RTC branches; identical arithmetic, including that `time`
344
+ # starts at exactly 1.0 and the last step lands on 1/num_steps, not 0.
345
+ num_steps = self.config.num_steps
346
+ dt = -1.0 / num_steps
347
+ x_t = noise
348
+ for step in range(num_steps):
349
+ time = 1.0 + step * dt
350
+ time_tensor = torch.tensor(time, dtype=torch.float32,
351
+ device=device).expand(bsize)
352
+ v_t = self.denoise_step(
353
+ x_t=x_t,
354
+ prefix_pad_masks=prefix_pad_masks,
355
+ past_key_values=past_key_values,
356
+ timestep=time_tensor,
357
+ )
358
+ x_t = x_t + dt * v_t
359
+ return x_t
360
+
361
+ def denoise_step(
362
+ self,
363
+ prefix_pad_masks,
364
+ past_key_values,
365
+ x_t,
366
+ timestep,
367
+ ):
368
+ """Apply one denoising step of the noise `x_t` at a given timestep."""
369
+ suffix_embs, suffix_pad_masks, suffix_att_masks = self.embed_suffix(x_t, timestep)
370
+
371
+ suffix_len = suffix_pad_masks.shape[1]
372
+ batch_size = prefix_pad_masks.shape[0]
373
+ prefix_len = prefix_pad_masks.shape[1]
374
+ prefix_pad_2d_masks = prefix_pad_masks[:, None, :].expand(batch_size, suffix_len, prefix_len)
375
+
376
+ suffix_att_2d_masks = make_att_2d_masks(suffix_pad_masks, suffix_att_masks)
377
+
378
+ full_att_2d_masks = torch.cat([prefix_pad_2d_masks, suffix_att_2d_masks], dim=2)
379
+ prefix_offsets = torch.sum(prefix_pad_masks, dim=-1)[:, None]
380
+ position_ids = prefix_offsets + torch.cumsum(suffix_pad_masks, dim=1) - 1
381
+
382
+ outputs_embeds, _ = self.vlm_with_expert.forward(
383
+ attention_mask=full_att_2d_masks,
384
+ position_ids=position_ids,
385
+ past_key_values=past_key_values,
386
+ inputs_embeds=[None, suffix_embs],
387
+ use_cache=self.config.use_cache,
388
+ )
389
+ if past_key_values is not None:
390
+ # Self-attention layers append suffix K/V in place; restore the prefix for the next step.
391
+ past_key_values.crop(prefix_len)
392
+ suffix_out = outputs_embeds[1]
393
+ suffix_out = suffix_out[:, -self.config.chunk_size :]
394
+ suffix_out = suffix_out.to(dtype=torch.float32)
395
+ v_t = self.action_out_proj(suffix_out)
396
+ return v_t
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/group_loss.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The per-channel masked group loss, shared by both baselines.
2
+
3
+ The group table is an argument rather than a constant: this baseline reports six groups
4
+ (each wrist block split into translation and rotation, matching V4), and the same
5
+ arithmetic serves any table.
6
+
7
+ **Why a masked group loss at all, for a model whose upstream has none.** SmolVLA's own
8
+ loss is `F.mse_loss(u_t, v_t)` reduced by a mean over everything, with `action_is_pad`
9
+ masking padded TIME STEPS. Our padding is per CHANNEL: 192 slots of which 138 carry data
10
+ and 54 are permanently zero, and which 138 depends on the sample (an episode annotates one
11
+ hand). Taking upstream's plain mean would
12
+
13
+ * train the model to predict 54 constant zeros, and
14
+ * divide the real error by 192 instead of by the number of live channels,
15
+
16
+ so the reported loss would sit below the true one by a factor that varies with how many
17
+ hands the batch happens to contain. Nothing raises. That is not a faithfulness question --
18
+ upstream never met this layout -- it is a correctness one.
19
+
20
+ The group WEIGHTING is where the two baselines legitimately differ, and the caller owns it:
21
+ VITRA uses four groups (a 6-D wrist block per hand), V4 and this project's SmolVLA baseline
22
+ use six (translation and rotation split). Those belong to the objective each model is
23
+ trained under, not to this function.
24
+ """
25
+
26
+ from __future__ import annotations
27
+
28
+ import torch
29
+
30
+
31
+ def masked_group_loss(pred: torch.Tensor, target: torch.Tensor,
32
+ action_mask: torch.Tensor,
33
+ groups,
34
+ ) -> tuple[torch.Tensor, dict[str, torch.Tensor]]:
35
+ """VITRA's `DiffusionPolicy.loss`, term for term, over `groups`.
36
+
37
+ Per group: the masked mean of the squared error over that channel range, times the
38
+ group's weight. Those are then combined weighted by `count`, where count is the number
39
+ of (sample, step) pairs for which the group's FIRST channel is unmasked. Our cut writes
40
+ one hand per episode, so a group is either wholly present or wholly absent for a given
41
+ sample; the count is therefore "how many rows this group had", and the combination is
42
+ a mean over present groups rather than over channels.
43
+
44
+ `groups` is an iterable of `(name, lo, hi, weight)`.
45
+
46
+ The `total_count == 0` branch is upstream's: it returns `square_delta[0,0,0]`, a real
47
+ element of the graph, so the backward pass still has something to traverse and DDP
48
+ does not hang waiting for a rank that produced no gradient.
49
+ """
50
+ return masked_group_loss_sq((pred - target) ** 2, action_mask, groups)
51
+
52
+
53
+ def masked_group_loss_sq(square: torch.Tensor, action_mask: torch.Tensor, groups
54
+ ) -> tuple[torch.Tensor, dict[str, torch.Tensor]]:
55
+ """Same, entered from an already-computed per-element squared error.
56
+
57
+ SmolVLA's `VLAFlowMatching.forward` returns `F.mse_loss(u_t, v_t, reduction="none")`
58
+ and never exposes `v_t`, so the baseline cannot hand over a (pred, target) pair
59
+ without re-implementing that forward pass. Entering here instead keeps upstream's
60
+ file unmodified and the aggregation shared.
61
+ """
62
+ m = action_mask.to(square.dtype)
63
+ square_delta = square * m
64
+
65
+ parts: dict[str, torch.Tensor] = {}
66
+ counts: dict[str, torch.Tensor] = {}
67
+ dens: dict[str, torch.Tensor] = {}
68
+ for name, lo, hi, weight in groups:
69
+ n = m[:, :, lo:hi].sum()
70
+ val = square_delta[:, :, lo:hi].sum() / n if n > 0 else square_delta.new_zeros(())
71
+ parts[name] = val * weight
72
+ counts[name] = m[:, :, lo].sum()
73
+ dens[name] = n
74
+
75
+ total = sum(counts.values())
76
+ if float(total) == 0.0:
77
+ loss = square_delta[0, 0, 0]
78
+ else:
79
+ loss = sum(parts[k] * counts[k] for k in counts) / total
80
+
81
+ logged = {k: v.detach() for k, v in parts.items()}
82
+ # Two different counts, and they are not interchangeable:
83
+ # `_n` the FIRST channel's unmasked count. This is what upstream weights the
84
+ # groups by when it combines them -- effectively "how many rows had this
85
+ # group at all", since our cut turns a whole hand on or off together.
86
+ # `_den` the mean's actual denominator, over every channel in the range.
87
+ # Averaging per-batch means over a validation set needs `_den`; reproducing the
88
+ # training objective's group weighting needs `_n`. Using one for the other silently
89
+ # rescales the wrist against the fingers by the ratio of their channel counts (3 vs 63).
90
+ logged.update({f"{k}_n": v.detach() for k, v in counts.items()})
91
+ logged.update({f"{k}_den": v.detach() for k, v in dens.items()})
92
+ return loss, logged
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/model.py ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """The SmolVLA-official baseline, wired to this project's interfaces.
2
+
3
+ Observation --> SmolVLM2-500M (frozen) --prefix K/V--> action expert --> v_t
4
+ state ----------^ (in the PREFIX) noise ---------^
5
+
6
+ This file plays the part LeRobot's `SmolVLAPolicy` plays upstream -- it owns the batch
7
+ shape, the normalisation and the optimiser groups -- while `flow.py` and
8
+ `smolvlm_with_expert.py` hold upstream's model, forked unmodified. The split is deliberate:
9
+ everything that could change the model's behaviour is in the forked files and pinned; this
10
+ file only adapts calling conventions.
11
+
12
+ `Observation` carries exactly the fields this package's `to_observations` fills -- the
13
+ loader's contract, so the batches are V4's batches.
14
+
15
+ **This model has no memory.** `loss` and `predict_from_noise` take the same
16
+ `steps: list[Observation]` V4's do and use only `steps[-1]`; the earlier steps exist so the
17
+ supervised anchor lands on the distribution of episode positions V4 trains on.
18
+
19
+ **Three things here are NOT upstream, and each is forced rather than chosen:**
20
+
21
+ 1. **the loss is masked per channel** (`group_loss.py`). Upstream reduces with a plain
22
+ mean and masks only padded time steps; our 192 slots carry 138 real channels and which
23
+ ones depends on the sample. See that module for what the unmasked mean would do.
24
+ 2. **normalisation comes from our statistics file**, installed as buffers, not from
25
+ LeRobot's processor pipeline -- 项目专项规则.md: the normaliser belongs to the data
26
+ pipeline, and MSE across two normalisers is not comparable.
27
+ 3. **only the VLM is loaded from `smolvla_base`.** Its `action_in_proj` is [720, 32] and
28
+ `action_out_proj` [32, 720]; our action space is 192-wide, so the expert and both
29
+ projections start fresh. (User, 2026-09-10.)
30
+ """
31
+
32
+ from __future__ import annotations
33
+
34
+ import os
35
+ import sys
36
+ from dataclasses import dataclass
37
+
38
+ import torch
39
+ import torch.nn as nn
40
+
41
+ from .config import Config, FlatConfig
42
+ from .flow import VLAFlowMatching
43
+ from .vla_utils import sample_noise, sample_time_beta
44
+
45
+ from .group_loss import masked_group_loss_sq
46
+
47
+
48
+ @dataclass
49
+ class Observation:
50
+ """One control step. Field names and shapes are the shared loader's contract."""
51
+
52
+ images: torch.Tensor # [B, N, 3, H, W] float, already in [-1, 1]
53
+ lang_ids: torch.Tensor # [B, L] int
54
+ lang_mask: torch.Tensor # [B, L] bool
55
+ state: torch.Tensor # [B, 212] ** RAW ** -- the model normalises it
56
+ state_mask: torch.Tensor # [B, 212] bool
57
+ fov: torch.Tensor # [B, N, 2] ⚠ unused: SmolVLA has no FoV token
58
+
59
+
60
+ class SmolVLAOfficialModel(nn.Module):
61
+ def __init__(self, cfg: Config, *, load_weights: bool = True,
62
+ dtype: torch.dtype = torch.float32):
63
+ super().__init__()
64
+ cfg.validate()
65
+ self.cfg = cfg
66
+ # `load_weights` controls whether the Hub is read for the ARCHITECTURE's weights.
67
+ # Evaluation passes False: every parameter is about to be overwritten by a
68
+ # checkpoint, so reading 865 MB first is waste. Training passes True and then
69
+ # `load_pretrained` replaces the VLM with smolvla_base's.
70
+ flat = FlatConfig(cfg)
71
+ flat.load_vlm_weights = bool(load_weights)
72
+ self.flow = VLAFlowMatching(flat)
73
+ if dtype == torch.float32:
74
+ # `AutoModelForImageTextToText.from_pretrained(..., torch_dtype="bfloat16")` is
75
+ # hard-coded upstream, so the VLM arrives in bf16 whatever we ask for. Training
76
+ # in fp32 with bf16 autocast around the VLM forward is what the rest of this
77
+ # tree does; a silently-bf16 backbone is the bug the VITRA baseline hit on
78
+ # 2026-09-09 (3.03 B parameters in bf16 while `config.dtype` read float32).
79
+ self.flow = self.flow.to(torch.float32)
80
+
81
+ d, s = cfg.action.dim, cfg.action.state_dim
82
+ for name, n in (("action_mean", d), ("action_std", d),
83
+ ("state_mean", s), ("state_std", s)):
84
+ self.register_buffer(name, torch.zeros(n) if name.endswith("mean")
85
+ else torch.ones(n))
86
+ self.register_buffer("stats_loaded", torch.zeros((), dtype=torch.bool))
87
+
88
+ bad = [(n, p.dtype) for n, p in self.named_parameters() if p.dtype != dtype]
89
+ if bad:
90
+ raise RuntimeError(
91
+ f"{len(bad)} parameters are not {dtype} after construction, e.g. "
92
+ f"{bad[:3]}. A guard on the requested dtype is not enough here -- "
93
+ f"upstream pins the VLM's dtype inside `from_pretrained`.")
94
+
95
+ # ------------------------------------------------------------------ statistics
96
+
97
+ def set_normalisation(self, *, action_mean, action_std, state_mean, state_std,
98
+ eps: float = 1e-6) -> None:
99
+ """Install the dataset statistics. Must be called before training or inference.
100
+
101
+ A sigma of exactly ZERO is ordinary and must not raise: MANO joint 0 sits at the
102
+ palm origin by construction, so its three coordinates have zero variance in every
103
+ domain, and the padding dimensions are the same case. Clamping keeps them an
104
+ identity transform; left alone they normalise to +-inf.
105
+ """
106
+ for name, v, n in (("action_mean", action_mean, self.cfg.action.dim),
107
+ ("action_std", action_std, self.cfg.action.dim),
108
+ ("state_mean", state_mean, self.cfg.action.state_dim),
109
+ ("state_std", state_std, self.cfg.action.state_dim)):
110
+ t = torch.as_tensor(v, dtype=torch.float32).reshape(-1)
111
+ if t.numel() != n:
112
+ raise ValueError(f"{name} must have {n} entries, got {t.numel()}")
113
+ if not bool(torch.isfinite(t).all()):
114
+ raise ValueError(
115
+ f"{name} has {int((~torch.isfinite(t)).sum())} non-finite entries. "
116
+ f"Nothing downstream checks for this: the first `(a - mean) / std` "
117
+ f"turns the loss into NaN several thousand steps from here.")
118
+ if name.endswith("_std"):
119
+ if bool((t < 0).any()):
120
+ raise ValueError(
121
+ f"{name} has negative entries (min {float(t.min()):.3e}); a "
122
+ f"standard deviation cannot be negative, so the file is corrupt.")
123
+ t = t.clamp_min(eps)
124
+ getattr(self, name).copy_(t.to(getattr(self, name).device))
125
+ self.stats_loaded.fill_(True)
126
+
127
+ def _require_stats(self) -> None:
128
+ if not bool(self.stats_loaded):
129
+ raise RuntimeError(
130
+ "normalisation statistics were never installed. Call set_normalisation() "
131
+ "with values measured on THIS dataset at the 80 Hz action convention.")
132
+
133
+ def normalise_action(self, a: torch.Tensor) -> torch.Tensor:
134
+ return (a - self.action_mean) / self.action_std
135
+
136
+ def unnormalise_action(self, a: torch.Tensor) -> torch.Tensor:
137
+ return a * self.action_std + self.action_mean
138
+
139
+ # ------------------------------------------------------------------ parameters
140
+
141
+ def trainable_params_setup(self) -> None:
142
+ """Upstream's `set_requires_grad`, called once.
143
+
144
+ ⚠ With `train_expert_only=True` -- SmolVLA's own default and what `smolvla_base`
145
+ was trained with -- the WHOLE VLM is frozen, vision tower included. What trains is
146
+ the action expert, `state_proj`, the two action projections and the time MLP.
147
+ """
148
+ self.flow.vlm_with_expert.set_requires_grad()
149
+ self.flow.set_requires_grad()
150
+
151
+ def param_groups(self) -> list[dict]:
152
+ """One group while the VLM is frozen; two once it is not.
153
+
154
+ Upstream has only ever needed one: `get_optim_params` returns `self.parameters()`
155
+ and `AdamWConfig` gives every tensor the same rate. With `train_expert_only=True`
156
+ that is exactly right -- there is no backbone in the trainable set, and with
157
+ `weight_decay = 1e-10` there is no decay to exempt anything from.
158
+
159
+ ** Stage B is different, and upstream never ran it. ** Unfreezing the language
160
+ model puts pretrained weights into the trainable set beside an action expert that
161
+ is still learning. Upstream's single 1e-4 would then hit a pretrained backbone at
162
+ the rate its randomly-initialised head needs. Both reference models in this project
163
+ split them by exactly 10x -- VITRA is action head 1e-4 / backbone 1e-5, V4 the same
164
+ -- so `optim.vlm_lr` follows that precedent rather than inventing a ratio.
165
+
166
+ Setting `optim.vlm_lr` to `None` restores upstream's single group, whatever the
167
+ freeze setting: the deviation is a knob, not a hard-coded opinion.
168
+ """
169
+ o = self.cfg.optim
170
+ trainable = [(n, p) for n, p in self.named_parameters() if p.requires_grad]
171
+ vlm = [p for n, p in trainable if "vlm_with_expert.vlm" in n]
172
+ rest = [p for n, p in trainable if "vlm_with_expert.vlm" not in n]
173
+ if o.vlm_lr is None or not vlm:
174
+ return [{"name": "all", "params": [p for _n, p in trainable], "lr": o.lr,
175
+ "weight_decay": o.weight_decay, "is_backbone": False}]
176
+ return [
177
+ {"name": "expert", "params": rest, "lr": o.lr,
178
+ "weight_decay": o.weight_decay, "is_backbone": False},
179
+ {"name": "vlm", "params": vlm, "lr": o.vlm_lr,
180
+ "weight_decay": o.weight_decay, "is_backbone": True},
181
+ ]
182
+
183
+ # ------------------------------------------------------------------ adaptation
184
+
185
+ def _inputs(self, obs: Observation):
186
+ """Our `Observation` -> the five positional arguments `flow` takes.
187
+
188
+ `images` is a LIST of `[B, 3, H, W]`, one per camera, because `embed_prefix`
189
+ iterates cameras and appends each one's embeddings to the prefix. Ours arrives
190
+ stacked as `[B, N, 3, H, W]` already in [-1, 1], which is the range SigLIP wants
191
+ and exactly what upstream's `prepare_images` produces -- so the conversion is a
192
+ split, with no resizing or rescaling left to do.
193
+
194
+ `obs.fov` is dropped. SmolVLA has no field-of-view token; V4 added one. Passing it
195
+ would be inventing an architecture that is neither model's.
196
+ """
197
+ self._require_stats()
198
+ imgs = obs.images
199
+ images = [imgs[:, i] for i in range(imgs.shape[1])]
200
+ ones = torch.ones(imgs.shape[0], dtype=torch.bool, device=imgs.device)
201
+ img_masks = [ones for _ in images]
202
+ state = (obs.state - self.state_mean) / self.state_std
203
+ return images, img_masks, obs.lang_ids, obs.lang_mask, state
204
+
205
+ # ------------------------------------------------------------------ training
206
+
207
+ def forward(self, steps: list[Observation], step_valid: torch.Tensor,
208
+ actions: torch.Tensor, action_mask: torch.Tensor):
209
+ return self.loss(steps, step_valid, actions, action_mask)
210
+
211
+ def loss(self, steps: list[Observation], step_valid: torch.Tensor,
212
+ actions: torch.Tensor, action_mask: torch.Tensor,
213
+ generator: torch.Generator | None = None):
214
+ """-> (scalar loss, dict of per-group values for logging).
215
+
216
+ `step_valid` is accepted and ignored: only `steps[-1]` is read, and the collate
217
+ left-pads so that index is the supervised step for every item in the batch.
218
+
219
+ The noise and timestep are drawn HERE rather than left to `flow.forward`'s
220
+ defaults, so that a `generator` can make a run reproducible. The draws are
221
+ upstream's own functions with upstream's Beta parameters, so an unseeded call is
222
+ distributed identically to letting `flow.forward` do it.
223
+ """
224
+ del step_valid
225
+ obs = steps[-1]
226
+ images, img_masks, lang_ids, lang_mask, state = self._inputs(obs)
227
+
228
+ # RAW actions from the loader; normalise with the buffers a checkpoint carries.
229
+ a = self.normalise_action(actions.to(state.dtype))
230
+ f = self.cfg.flow
231
+ noise = (sample_noise(a.shape, a.device) if generator is None else
232
+ torch.randn(a.shape, device=a.device, dtype=a.dtype, generator=generator))
233
+ time = sample_time_beta(a.shape[0], a.device, alpha=f.time_alpha,
234
+ beta=f.time_beta, scale=f.time_scale, offset=f.time_offset)
235
+
236
+ # `flow.forward` returns the per-element squared error, [B, chunk, 192].
237
+ square = self.flow.forward(images, img_masks, lang_ids, lang_mask, state, a,
238
+ noise=noise, time=time)
239
+ return masked_group_loss_sq(square, action_mask, self.cfg.loss.groups)
240
+
241
+ # ------------------------------------------------------------------ inference
242
+
243
+ @torch.no_grad()
244
+ def predict_from_noise(self, steps: list[Observation], noise: torch.Tensor
245
+ ) -> torch.Tensor:
246
+ """-> [B, chunk, 192] in the NORMALISED domain, integrated from a GIVEN noise.
247
+
248
+ The noise is passed in rather than drawn: the test protocol pairs one test frame
249
+ across conditions and the starting noise must be held fixed, so a `select_action`
250
+ that draws its own is unusable there.
251
+ """
252
+ obs = steps[-1]
253
+ images, img_masks, lang_ids, lang_mask, state = self._inputs(obs)
254
+ return self.flow.sample_actions(images, img_masks, lang_ids, lang_mask, state,
255
+ noise=noise.to(state.dtype))
256
+
257
+ # ------------------------------------------------------------------ weights
258
+
259
+ def load_pretrained(self, path: str) -> dict[str, list[str]]:
260
+ """Load ONLY the VLM out of `smolvla_base`. Returns {missing, unexpected, loaded}.
261
+
262
+ The release stores a whole `SmolVLAPolicy`: 345 `model.vlm_with_expert.vlm.*`
263
+ tensors, 145 `model.vlm_with_expert.lm_expert.*`, and five projections sized for a
264
+ 32-dimensional action space. Only the first group is taken.
265
+
266
+ ⚠ **The expert is deliberately left at its fresh initialisation.** It could be
267
+ loaded -- it is architecturally identical -- but it was trained to drive
268
+ `action_out_proj` [32, 720] into 32 robot joint targets, and ours emits 192 hand
269
+ channels through a randomly initialised head. An expert tuned to a head that no
270
+ longer exists is not a warm start; the first VITRA run was voided for the same
271
+ class of mismatch (its released head was `angle`-pretrained and we loaded it into
272
+ a keypoints layout).
273
+
274
+ The count is asserted, not trusted: a silently-empty remap would leave the VLM at
275
+ its Hub initialisation and the run would look like a bad baseline rather than a
276
+ broken load.
277
+ """
278
+ from safetensors.torch import load_file
279
+
280
+ raw = load_file(path) if path.endswith(".safetensors") else torch.load(
281
+ path, map_location="cpu", weights_only=False)
282
+ # Our own checkpoints wrap the state dict under "model" alongside "step"; a
283
+ # LeRobot release is the state dict itself. Unwrap only when the inner value is
284
+ # a dict of tensors, so a release whose top level happens to hold a "model" key
285
+ # is not mistaken for one of ours.
286
+ if isinstance(raw, dict) and isinstance(raw.get("model"), dict):
287
+ raw = raw["model"]
288
+
289
+ # ** Two kinds of checkpoint reach this method, and they are not interchangeable. **
290
+ #
291
+ # a LeRobot release keys under `model.vlm_with_expert.vlm.` -- take the VLM,
292
+ # leave the expert and projections fresh (see above).
293
+ # one of OUR OWN keys are this model's own, e.g. `flow.action_in_proj.*`
294
+ # and the normalisation buffers. Stage B starts from stage
295
+ # A's `last.pt`, which is exactly this. Taking only the VLM
296
+ # there would throw away everything stage A trained and
297
+ # restart the expert from noise -- silently, because the VLM
298
+ # tensors would all match.
299
+ own_keys = set(self.state_dict())
300
+ if any(k in own_keys for k in raw):
301
+ report = self.load_state_dict(raw, strict=False)
302
+ if report.missing_keys or report.unexpected_keys:
303
+ raise RuntimeError(
304
+ f"{path} is one of ours but does not match this model: "
305
+ f"{len(report.missing_keys)} missing, "
306
+ f"{len(report.unexpected_keys)} unexpected, e.g. "
307
+ f"{(report.missing_keys + report.unexpected_keys)[:3]}. Resuming "
308
+ f"across a config change would train a different model than the "
309
+ f"checkpoint describes.")
310
+ return {"loaded": sorted(raw), "missing": [], "unexpected": [],
311
+ "kind": "resume"}
312
+
313
+ prefix = "model.vlm_with_expert.vlm."
314
+ remapped = {"vlm_with_expert.vlm." + k[len(prefix):]: v
315
+ for k, v in raw.items() if k.startswith(prefix)}
316
+ if not remapped:
317
+ raise RuntimeError(
318
+ f"{path} holds neither this model's own keys nor anything under "
319
+ f"{prefix!r}; keys look like {sorted(raw)[:3]}. Loading nothing would "
320
+ f"leave the VLM at its Hub initialisation and the baseline would be "
321
+ f"measuring the wrong model.")
322
+
323
+ own = dict(self.flow.named_parameters())
324
+ own.update(dict(self.flow.named_buffers()))
325
+ bad = [k for k, v in remapped.items()
326
+ if k in own and tuple(own[k].shape) != tuple(v.shape)]
327
+ if bad:
328
+ raise RuntimeError(f"shape mismatch on {len(bad)} VLM tensors, e.g. {bad[:3]}")
329
+
330
+ report = self.flow.load_state_dict(remapped, strict=False)
331
+ missing_vlm = [k for k in report.missing_keys if k.startswith("vlm_with_expert.vlm.")]
332
+ if missing_vlm:
333
+ raise RuntimeError(
334
+ f"{len(missing_vlm)} VLM parameters were not covered by the checkpoint, "
335
+ f"e.g. {missing_vlm[:3]}. A partially loaded backbone trains without "
336
+ f"complaint.")
337
+ return {"loaded": sorted(remapped), "missing": list(report.missing_keys),
338
+ "unexpected": list(report.unexpected_keys), "kind": "vlm-only"}
339
+
340
+
341
+ Model = SmolVLAOfficialModel
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/smolvlm_with_expert.py ADDED
@@ -0,0 +1,559 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """SmolVLA's VLM + action-expert stack, forked verbatim from LeRobot. See `FORK.md`.
2
+
3
+ Source: `yuzhench/paper_code/smolvla_lerobot` @ 22bd7a2,
4
+ `src/lerobot/policies/smolvla/smolvlm_with_expert.py`, from `def apply_rope` to the end.
5
+ **Not one character of the model maths is changed.** Only the module header differs: the
6
+ upstream one guards the `transformers` imports behind LeRobot's `require_package`
7
+ machinery, which exists to give a nice error when an extra is missing. Here transformers
8
+ is a hard dependency, so the imports are plain.
9
+
10
+ This is the file that holds what the user called "他们内部的信息交互方式" -- the part that
11
+ is genuinely NOT ours:
12
+
13
+ * `forward_attn_layer` joint self-attention over [prefix | suffix]
14
+ * `forward_cross_attn_layer` the expert projects the VLM's hidden states through its OWN
15
+ k_proj / v_proj, i.e. real cross-attention rather than a
16
+ shared K/V cache
17
+ * `forward` alternates the two: layer index divisible by
18
+ `self_attn_every_n_layers` (2) does self-attention, the rest
19
+ cross-attend. The prefill pass forces self-attention on
20
+ every layer so the cache is complete.
21
+
22
+ V4 variant A calls itself "the upstream SmolVLA arrangement", but it is a re-implementation
23
+ inside V4's own tree and it carries V4's memory bank, FoV token and state handling. This
24
+ file is the actual upstream, which is the point of the baseline.
25
+ """
26
+
27
+ import copy
28
+
29
+ import torch
30
+ from torch import nn
31
+ from transformers import (
32
+ AutoConfig,
33
+ AutoModel,
34
+ AutoModelForImageTextToText,
35
+ AutoProcessor,
36
+ DynamicCache,
37
+ SmolVLMForConditionalGeneration,
38
+ )
39
+
40
+
41
+ def apply_rope(x, positions, max_wavelength=10_000):
42
+ """
43
+ Applies RoPE positions [B, L] to x [B, L, H, D].
44
+ """
45
+ d_half = x.shape[-1] // 2
46
+ device = x.device
47
+ dtype = x.dtype
48
+ x = x.to(torch.float32)
49
+
50
+ freq_exponents = (2.0 / x.shape[-1]) * torch.arange(d_half, dtype=torch.float32, device=device)
51
+ timescale = max_wavelength**freq_exponents
52
+ radians = positions[..., None].to(torch.float32) / timescale[None, None, :].to(torch.float32)
53
+
54
+ radians = radians[..., None, :]
55
+
56
+ sin = torch.sin(radians) # .to(dtype=dtype)
57
+ cos = torch.cos(radians) # .to(dtype=dtype)
58
+
59
+ x1, x2 = x.split(d_half, dim=-1)
60
+ res = torch.empty_like(x)
61
+ res[..., :d_half] = x1 * cos - x2 * sin
62
+ res[..., d_half:] = x2 * cos + x1 * sin
63
+
64
+ return res.to(dtype)
65
+
66
+
67
+ def get_intermediate_size(hidden_dim, ffn_dim_multiplier=4, multiple_of=256):
68
+ hidden_dim = int(2 * hidden_dim / 3)
69
+ hidden_dim = int(ffn_dim_multiplier * hidden_dim)
70
+ hidden_dim = multiple_of * ((hidden_dim + multiple_of - 1) // multiple_of)
71
+ return hidden_dim
72
+
73
+
74
+ class SmolVLMWithExpertModel(nn.Module):
75
+ def __init__(
76
+ self,
77
+ model_id: str = "HuggingFaceTB/SmolVLM2-500M-Video-Instruct",
78
+ load_vlm_weights: bool = True,
79
+ train_expert_only: bool = True,
80
+ freeze_vision_encoder: bool = False,
81
+ attention_mode: str = "self_attn",
82
+ num_expert_layers: int = -1,
83
+ num_vlm_layers: int = -1,
84
+ self_attn_every_n_layers: int = -1,
85
+ expert_width_multiplier: float = 0.5,
86
+ device: str = "auto",
87
+ ):
88
+ super().__init__()
89
+ if load_vlm_weights:
90
+ print(f"Loading {model_id} weights ...")
91
+ self.vlm = AutoModelForImageTextToText.from_pretrained(
92
+ model_id,
93
+ torch_dtype="bfloat16",
94
+ low_cpu_mem_usage=True,
95
+ )
96
+ config = self.vlm.config
97
+ else:
98
+ config = AutoConfig.from_pretrained(model_id)
99
+ self.vlm = SmolVLMForConditionalGeneration(config=config)
100
+ self.processor = AutoProcessor.from_pretrained(model_id)
101
+ if num_vlm_layers > 0:
102
+ print(f"Reducing the number of VLM layers to {num_vlm_layers} ...")
103
+ self.get_vlm_model().text_model.layers = self.get_vlm_model().text_model.layers[:num_vlm_layers]
104
+ self.num_vlm_layers = len(self.get_vlm_model().text_model.layers)
105
+ self.config = config
106
+ # Smaller lm expert
107
+ lm_expert_config = copy.deepcopy(config.text_config)
108
+ hidden_size = lm_expert_config.hidden_size
109
+ lm_expert_config.hidden_size = int(hidden_size * expert_width_multiplier) # hidden_size // 2
110
+ lm_expert_config.intermediate_size = get_intermediate_size(int(hidden_size * expert_width_multiplier))
111
+ lm_expert_config.num_hidden_layers = self.num_vlm_layers
112
+ if num_expert_layers > 0:
113
+ assert len(self.get_vlm_model().text_model.layers) % num_expert_layers == 0, (
114
+ f"Number of layers in the VLM {len(self.get_vlm_model().text_model.layers)} are not multiple of num_expert_layers {num_expert_layers}"
115
+ )
116
+ lm_expert_config.num_hidden_layers = num_expert_layers
117
+ self.lm_expert = AutoModel.from_config(lm_expert_config)
118
+
119
+ self.num_expert_layers = len(self.lm_expert.layers)
120
+ self.self_attn_every_n_layers = self_attn_every_n_layers
121
+ if "cross" in attention_mode:
122
+ # Reshape qkv projections to have the same input dimension as the vlm
123
+ for layer_idx in range(len(self.lm_expert.layers)):
124
+ if self.self_attn_every_n_layers > 0 and layer_idx % self.self_attn_every_n_layers == 0:
125
+ continue
126
+ self.lm_expert.layers[layer_idx].self_attn.k_proj = nn.Linear(
127
+ config.text_config.num_key_value_heads * config.text_config.head_dim,
128
+ lm_expert_config.num_key_value_heads * lm_expert_config.head_dim,
129
+ bias=lm_expert_config.attention_bias,
130
+ )
131
+ self.lm_expert.layers[layer_idx].self_attn.v_proj = nn.Linear(
132
+ config.text_config.num_key_value_heads * config.text_config.head_dim,
133
+ lm_expert_config.num_key_value_heads * lm_expert_config.head_dim,
134
+ bias=lm_expert_config.attention_bias,
135
+ )
136
+ # Remove unused embed_tokens
137
+ self.lm_expert.embed_tokens = None
138
+
139
+ self.num_attention_heads = self.config.text_config.num_attention_heads
140
+ self.num_key_value_heads = self.config.text_config.num_key_value_heads
141
+
142
+ self.freeze_vision_encoder = freeze_vision_encoder
143
+ self.train_expert_only = train_expert_only
144
+ self.attention_mode = attention_mode
145
+ self.expert_hidden_size = lm_expert_config.hidden_size
146
+ self.set_requires_grad()
147
+
148
+ def get_vlm_model(self):
149
+ return self.vlm.model
150
+
151
+ def set_requires_grad(self):
152
+ if self.freeze_vision_encoder:
153
+ self.get_vlm_model().vision_model.eval()
154
+ for params in self.get_vlm_model().vision_model.parameters():
155
+ params.requires_grad = False
156
+ if self.train_expert_only:
157
+ self.vlm.eval()
158
+ for params in self.vlm.parameters():
159
+ params.requires_grad = False
160
+ else:
161
+ # To avoid unused params issue with distributed training
162
+ last_layers = [self.num_vlm_layers - 1]
163
+ if (
164
+ self.num_vlm_layers != self.num_expert_layers
165
+ and self.num_vlm_layers % self.num_expert_layers == 0
166
+ ):
167
+ last_layers.append(self.num_vlm_layers - 2)
168
+ frozen_layers = [
169
+ "lm_head",
170
+ "text_model.norm.weight",
171
+ ]
172
+ for layer in last_layers:
173
+ frozen_layers.append(f"text_model.layers.{layer}.")
174
+
175
+ unmatched_patterns = set(frozen_layers)
176
+ for name, params in self.vlm.named_parameters():
177
+ matched_patterns = [k for k in frozen_layers if k in name]
178
+ if matched_patterns:
179
+ params.requires_grad = False
180
+ unmatched_patterns.difference_update(matched_patterns)
181
+ if unmatched_patterns:
182
+ raise RuntimeError(
183
+ "Some frozen layer patterns matched no VLM parameters, so the corresponding layers "
184
+ "would silently remain trainable (parameter naming may have changed in transformers): "
185
+ f"{sorted(unmatched_patterns)}"
186
+ )
187
+ # To avoid unused params issue with distributed training
188
+ for name, params in self.lm_expert.named_parameters():
189
+ if "lm_head" in name:
190
+ params.requires_grad = False
191
+
192
+ def train(self, mode: bool = True):
193
+ super().train(mode)
194
+
195
+ if self.freeze_vision_encoder:
196
+ self.get_vlm_model().vision_model.eval()
197
+
198
+ if self.train_expert_only:
199
+ self.vlm.eval()
200
+
201
+ def embed_image(self, image: torch.Tensor):
202
+ patch_attention_mask = None
203
+ # Get sequence from the vision encoder
204
+ image_hidden_states = (
205
+ self.get_vlm_model()
206
+ .vision_model(
207
+ pixel_values=image.to(dtype=self.get_vlm_model().vision_model.dtype),
208
+ patch_attention_mask=patch_attention_mask,
209
+ )
210
+ .last_hidden_state
211
+ )
212
+ # Modality projection & resampling
213
+ image_hidden_states = self.get_vlm_model().connector(image_hidden_states)
214
+ return image_hidden_states
215
+
216
+ def embed_language_tokens(self, tokens: torch.Tensor):
217
+ return self.get_vlm_model().text_model.get_input_embeddings()(tokens)
218
+
219
+ def forward_attn_layer(
220
+ self,
221
+ model_layers,
222
+ inputs_embeds,
223
+ layer_idx,
224
+ position_ids,
225
+ attention_mask,
226
+ batch_size,
227
+ head_dim,
228
+ use_cache: bool = True,
229
+ past_key_values: "DynamicCache | None" = None,
230
+ ) -> "tuple[list[torch.Tensor], DynamicCache | None]":
231
+ query_states = []
232
+ key_states = []
233
+ value_states = []
234
+ for i, hidden_states in enumerate(inputs_embeds):
235
+ layer = model_layers[i][layer_idx]
236
+ if hidden_states is None or layer is None:
237
+ continue
238
+ hidden_states = layer.input_layernorm(hidden_states)
239
+
240
+ input_shape = hidden_states.shape[:-1]
241
+ hidden_shape = (*input_shape, -1, layer.self_attn.head_dim)
242
+
243
+ hidden_states = hidden_states.to(dtype=layer.self_attn.q_proj.weight.dtype)
244
+ query_state = layer.self_attn.q_proj(hidden_states).view(hidden_shape)
245
+ key_state = layer.self_attn.k_proj(hidden_states).view(hidden_shape)
246
+ value_state = layer.self_attn.v_proj(hidden_states).view(hidden_shape)
247
+
248
+ query_states.append(query_state)
249
+ key_states.append(key_state)
250
+ value_states.append(value_state)
251
+
252
+ # B,L,H,D with L sequence length, H number of heads, D head dim
253
+ # concatenate on the number of embeddings/tokens
254
+ query_states = torch.cat(query_states, dim=1)
255
+ key_states = torch.cat(key_states, dim=1)
256
+ value_states = torch.cat(value_states, dim=1)
257
+ seq_len = query_states.shape[1]
258
+ if seq_len < position_ids.shape[1]:
259
+ _position_ids = position_ids[:, :seq_len]
260
+ _attention_mask = attention_mask[:, :seq_len, :seq_len]
261
+ else:
262
+ _position_ids = position_ids
263
+ _attention_mask = attention_mask
264
+
265
+ attention_mask_ = _attention_mask
266
+ position_ids_ = _position_ids
267
+
268
+ query_states = apply_rope(query_states, position_ids_)
269
+ key_states = apply_rope(key_states, position_ids_)
270
+
271
+ if use_cache:
272
+ # `DynamicCache` stores tensors as [batch, heads, seq, head_dim]; this module works with
273
+ # [batch, seq, heads, head_dim]. During prefix prefill this stores the (post-RoPE) K/V and
274
+ # returns them unchanged; during denoising it appends the suffix K/V and returns
275
+ # [prefix; suffix], exactly like the previous hand-rolled dict cache.
276
+ key_states, value_states = past_key_values.update(
277
+ key_states.transpose(1, 2), value_states.transpose(1, 2), layer_idx
278
+ )
279
+ key_states = key_states.transpose(1, 2)
280
+ value_states = value_states.transpose(1, 2)
281
+
282
+ attention_interface = self.get_attention_interface()
283
+
284
+ att_output = attention_interface(
285
+ attention_mask_, batch_size, head_dim, query_states, key_states, value_states
286
+ )
287
+ return [att_output], past_key_values
288
+
289
+ def forward_cross_attn_layer(
290
+ self,
291
+ model_layers,
292
+ inputs_embeds,
293
+ layer_idx,
294
+ position_ids,
295
+ attention_mask,
296
+ batch_size,
297
+ head_dim,
298
+ use_cache: bool = True,
299
+ past_key_values: "DynamicCache | None" = None,
300
+ ) -> "tuple[list[torch.Tensor], DynamicCache | None]":
301
+ attention_interface = self.get_attention_interface()
302
+
303
+ att_outputs = []
304
+ assert len(inputs_embeds) == 2 or (use_cache and past_key_values is not None), (
305
+ f"Both len(inputs_embeds) == {len(inputs_embeds)} and past_key_values is {past_key_values}"
306
+ )
307
+
308
+ if len(inputs_embeds) == 2 and not past_key_values:
309
+ # Prefix attention
310
+ seq_len = inputs_embeds[0].shape[1]
311
+ position_id, expert_position_id = position_ids[:, :seq_len], position_ids[:, seq_len:]
312
+ prefix_attention_mask = attention_mask[:, :seq_len, :seq_len]
313
+
314
+ layer = model_layers[0][layer_idx]
315
+
316
+ hidden_states = layer.input_layernorm(inputs_embeds[0])
317
+
318
+ input_shape = hidden_states.shape[:-1]
319
+ hidden_shape = (*input_shape, -1, layer.self_attn.head_dim)
320
+
321
+ hidden_states = hidden_states.to(dtype=layer.self_attn.q_proj.weight.dtype)
322
+ query_state = layer.self_attn.q_proj(hidden_states).view(hidden_shape)
323
+ key_state = layer.self_attn.k_proj(hidden_states).view(hidden_shape)
324
+ value_states = layer.self_attn.v_proj(hidden_states).view(hidden_shape)
325
+
326
+ # B,L,H,D with L sequence length, H number of heads, D head dim
327
+ query_states = apply_rope(query_state, position_id)
328
+ key_states = apply_rope(key_state, position_id)
329
+
330
+ att_output = attention_interface(
331
+ prefix_attention_mask, batch_size, head_dim, query_states, key_states, value_states
332
+ )
333
+ att_outputs.append(att_output)
334
+ else:
335
+ expert_position_id = position_ids
336
+
337
+ if use_cache and past_key_values is not None:
338
+ # Cross-attention layers never fill the cache themselves: during the prefix prefill every
339
+ # layer goes through `forward_attn_layer`, which stores the (post-RoPE) VLM K/V for this
340
+ # layer index. Here we only read them back (no concatenation: the expert cross-attends to
341
+ # the fixed prefix). `DynamicCache` stores [batch, heads, seq, head_dim]; transpose back.
342
+ key_states = past_key_values.layers[layer_idx].keys.transpose(1, 2)
343
+ value_states = past_key_values.layers[layer_idx].values.transpose(1, 2)
344
+
345
+ # Expert
346
+ expert_layer = model_layers[1][layer_idx]
347
+ if expert_layer is not None:
348
+ expert_hidden_states = expert_layer.input_layernorm(inputs_embeds[1])
349
+
350
+ expert_input_shape = expert_hidden_states.shape[:-1]
351
+ expert_hidden_shape = (*expert_input_shape, -1, expert_layer.self_attn.head_dim)
352
+
353
+ expert_hidden_states = expert_hidden_states.to(dtype=expert_layer.self_attn.q_proj.weight.dtype)
354
+ expert_query_state = expert_layer.self_attn.q_proj(expert_hidden_states).view(expert_hidden_shape)
355
+
356
+ # reshape (not view): K/V read back from the cache are transposed, hence non-contiguous
357
+ _key_states = key_states.to(dtype=expert_layer.self_attn.k_proj.weight.dtype).reshape(
358
+ *key_states.shape[:2], -1
359
+ )
360
+ expert_key_states = expert_layer.self_attn.k_proj(_key_states).view(
361
+ *_key_states.shape[:-1], -1, expert_layer.self_attn.head_dim
362
+ ) # k_proj should have same dim as kv
363
+
364
+ _value_states = value_states.to(dtype=expert_layer.self_attn.v_proj.weight.dtype).reshape(
365
+ *value_states.shape[:2], -1
366
+ )
367
+ expert_value_states = expert_layer.self_attn.v_proj(_value_states).view(
368
+ *_value_states.shape[:-1], -1, expert_layer.self_attn.head_dim
369
+ )
370
+
371
+ expert_position_id = (
372
+ expert_position_id - torch.min(expert_position_id, dim=1, keepdim=True).values
373
+ ) # start from 0
374
+ expert_attention_mask = attention_mask[
375
+ :, -inputs_embeds[1].shape[1] :, : expert_key_states.shape[1] :
376
+ ] # take into account kv
377
+
378
+ expert_query_states = apply_rope(expert_query_state, expert_position_id)
379
+
380
+ att_output = attention_interface(
381
+ expert_attention_mask,
382
+ batch_size,
383
+ head_dim,
384
+ expert_query_states,
385
+ expert_key_states,
386
+ expert_value_states,
387
+ )
388
+ att_outputs.append(att_output)
389
+ else:
390
+ att_outputs.append(None)
391
+
392
+ # att_output = att_output.to(dtype=models[i].dtype)
393
+ return att_outputs, past_key_values
394
+
395
+ def get_model_layers(self, models: list) -> list:
396
+ vlm_layers = []
397
+ expert_layers = []
398
+ multiple_of = self.num_vlm_layers // self.num_expert_layers
399
+ for i in range(self.num_vlm_layers):
400
+ if multiple_of > 0 and i > 0 and i % multiple_of != 0:
401
+ expert_layer = None
402
+ else:
403
+ expert_layer_index = i // multiple_of if multiple_of > 0 else i
404
+ expert_layer = models[1].layers[expert_layer_index]
405
+ vlm_layers.append(models[0].layers[i])
406
+ expert_layers.append(expert_layer)
407
+ return [vlm_layers, expert_layers]
408
+
409
+ def forward(
410
+ self,
411
+ attention_mask: torch.Tensor | None = None,
412
+ position_ids: torch.LongTensor | None = None,
413
+ past_key_values: "DynamicCache | None" = None,
414
+ inputs_embeds: list[torch.FloatTensor] = None,
415
+ use_cache: bool | None = None,
416
+ ):
417
+ models = [self.get_vlm_model().text_model, self.lm_expert]
418
+ model_layers = self.get_model_layers(models)
419
+ for hidden_states in inputs_embeds:
420
+ # TODO this is very inefficient
421
+ # dtype is always the same, batch size too (if > 1 len)
422
+ # device could be trickier in multi gpu edge cases but that's it
423
+ if hidden_states is None:
424
+ continue
425
+ batch_size = hidden_states.shape[0]
426
+
427
+ # Prefix prefill: no cache was passed, so create one and fill it (every layer runs
428
+ # self-attention over the prefix). When a filled cache is passed (denoising), layers
429
+ # read from it instead.
430
+ fill_kv_cache = use_cache and past_key_values is None
431
+ if fill_kv_cache:
432
+ past_key_values = DynamicCache()
433
+
434
+ # RMSNorm
435
+ num_layers = self.num_vlm_layers
436
+ head_dim = self.vlm.config.text_config.head_dim
437
+ for layer_idx in range(num_layers):
438
+ if (
439
+ fill_kv_cache
440
+ or "cross" not in self.attention_mode
441
+ or (self.self_attn_every_n_layers > 0 and layer_idx % self.self_attn_every_n_layers == 0)
442
+ ):
443
+ att_outputs, past_key_values = self.forward_attn_layer(
444
+ model_layers,
445
+ inputs_embeds,
446
+ layer_idx,
447
+ position_ids,
448
+ attention_mask,
449
+ batch_size,
450
+ head_dim,
451
+ use_cache=use_cache,
452
+ past_key_values=past_key_values,
453
+ )
454
+ else:
455
+ att_outputs, past_key_values = self.forward_cross_attn_layer(
456
+ model_layers,
457
+ inputs_embeds,
458
+ layer_idx,
459
+ position_ids,
460
+ attention_mask,
461
+ batch_size,
462
+ head_dim,
463
+ use_cache=use_cache,
464
+ past_key_values=past_key_values,
465
+ )
466
+ outputs_embeds = []
467
+ start = 0
468
+ for i, hidden_states in enumerate(inputs_embeds):
469
+ layer = model_layers[i][layer_idx]
470
+ att_output = (
471
+ att_outputs[i] if i < len(att_outputs) else att_outputs[0]
472
+ ) # in case of self_attn
473
+ if hidden_states is not None:
474
+ if layer is None:
475
+ outputs_embeds.append(hidden_states)
476
+ continue
477
+ end = start + hidden_states.shape[1]
478
+
479
+ if att_output.dtype != layer.self_attn.o_proj.weight.dtype:
480
+ att_output = att_output.to(layer.self_attn.o_proj.weight.dtype)
481
+ att_out = att_output[:, start:end]
482
+ out_emb = layer.self_attn.o_proj(att_out)
483
+
484
+ out_emb += hidden_states
485
+ after_first_residual = out_emb.clone()
486
+
487
+ out_emb = layer.post_attention_layernorm(out_emb)
488
+ out_emb = layer.mlp(out_emb)
489
+
490
+ out_emb += after_first_residual
491
+
492
+ outputs_embeds.append(out_emb)
493
+
494
+ start = end if len(att_outputs) == 1 else 0
495
+ else:
496
+ outputs_embeds.append(None)
497
+
498
+ inputs_embeds = outputs_embeds
499
+
500
+ # final norm
501
+ outputs_embeds = []
502
+ for i, hidden_states in enumerate(inputs_embeds):
503
+ if hidden_states is not None:
504
+ out_emb = models[i].norm(hidden_states)
505
+ outputs_embeds.append(out_emb)
506
+ else:
507
+ outputs_embeds.append(None)
508
+ return outputs_embeds, past_key_values
509
+
510
+ def get_attention_interface(self):
511
+ attention_interface = self.eager_attention_forward
512
+ return attention_interface
513
+
514
+ def eager_attention_forward(
515
+ self, attention_mask, batch_size, head_dim, query_states, key_states, value_states
516
+ ):
517
+ num_att_heads = self.num_attention_heads
518
+ num_key_value_heads = self.num_key_value_heads
519
+ num_key_value_groups = num_att_heads // num_key_value_heads
520
+
521
+ sequence_length = key_states.shape[1]
522
+
523
+ key_states = key_states[:, :, :, None, :].expand(
524
+ batch_size, sequence_length, num_key_value_heads, num_key_value_groups, head_dim
525
+ )
526
+ key_states = key_states.reshape(
527
+ batch_size, sequence_length, num_key_value_heads * num_key_value_groups, head_dim
528
+ )
529
+
530
+ value_states = value_states[:, :, :, None, :].expand(
531
+ batch_size, sequence_length, num_key_value_heads, num_key_value_groups, head_dim
532
+ )
533
+ value_states = value_states.reshape(
534
+ batch_size, sequence_length, num_key_value_heads * num_key_value_groups, head_dim
535
+ )
536
+
537
+ # Attention here is upcasted to float32 to match the original eager implementation.
538
+ query_states = query_states.to(dtype=torch.float32)
539
+ key_states = key_states.to(dtype=torch.float32)
540
+
541
+ query_states = query_states.transpose(1, 2)
542
+ key_states = key_states.transpose(1, 2)
543
+
544
+ att_weights = torch.matmul(query_states, key_states.transpose(2, 3))
545
+ att_weights *= head_dim**-0.5
546
+
547
+ att_weights = att_weights.to(dtype=torch.float32)
548
+ big_neg = torch.finfo(att_weights.dtype).min # -2.3819763e38 # See gemma/modules.py
549
+ masked_att_weights = torch.where(attention_mask[:, None, :, :], att_weights, big_neg)
550
+ probs = nn.functional.softmax(masked_att_weights, dim=-1)
551
+ probs = probs.to(dtype=value_states.dtype)
552
+
553
+ att_output = torch.matmul(probs, value_states.permute(0, 2, 1, 3))
554
+
555
+ att_output = att_output.permute(0, 2, 1, 3)
556
+ # we use -1 because sequence length can change
557
+ att_output = att_output.reshape(batch_size, -1, num_key_value_heads * num_key_value_groups * head_dim)
558
+
559
+ return att_output
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/smolvla_official/vla_utils.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """SmolVLA's helper functions, forked verbatim from LeRobot. See `FORK.md`.
2
+
3
+ Source: `yuzhench/paper_code/smolvla_lerobot` @ 22bd7a2
4
+ * `src/lerobot/policies/common/flow_matching.py` -- sample_beta / sample_noise /
5
+ sample_time_beta
6
+ * `src/lerobot/policies/common/vla_utils.py` -- create_sinusoidal_pos_embedding /
7
+ make_att_2d_masks / pad_vector
8
+
9
+ Forked rather than imported because LeRobot is a whole application -- draccus configs,
10
+ gymnasium envs, a processor pipeline, a Hub mixin -- and this baseline needs the model
11
+ maths, not the framework. Importing it would put all of that in the Modal image for the
12
+ sake of five functions.
13
+
14
+ `euler_integrate` is NOT forked: its signature is half real-time-chunking parameters that
15
+ have no meaning here, and the loop it wraps is four lines. `flow.py` writes them out and
16
+ records the equivalence there.
17
+ """
18
+
19
+
20
+ from __future__ import annotations
21
+
22
+
23
+ import logging # ** FORK EDIT ** upstream utils/device_utils.py:17. The fork took
24
+ # `get_safe_dtype` without the imports its own file carried, so its two
25
+ # `logging.warning` lines were NameErrors waiting for a device that
26
+ # cannot do float64. Latent on CUDA; found 2026-09-11 by an AST scan.
27
+ import math
28
+
29
+
30
+ import torch
31
+ import torch.nn.functional as F # noqa: N812
32
+ # ** FORK EDIT ** upstream policies/common/vla_utils.py:28, same cause
33
+ # -- `pad_vector` uses `F.pad`. No caller in this tree today.
34
+
35
+ from torch import Tensor
36
+
37
+
38
+
39
+ # ---- flow_matching.py -------------------------------------------------------
40
+
41
+ def sample_beta(alpha: float, beta: float, bsize: int, device) -> Tensor: # see openpi (exact copy)
42
+ # Beta sampling uses _sample_dirichlet which isn't implemented for MPS, so sample on CPU
43
+ alpha_t = torch.tensor(alpha, dtype=torch.float32)
44
+ beta_t = torch.tensor(beta, dtype=torch.float32)
45
+ dist = torch.distributions.Beta(alpha_t, beta_t)
46
+ return dist.sample((bsize,)).to(device)
47
+
48
+ def sample_noise(shape, device) -> Tensor:
49
+ """Standard-normal float32 noise, the flow-matching x_1 sample."""
50
+ return torch.normal(
51
+ mean=0.0,
52
+ std=1.0,
53
+ size=shape,
54
+ dtype=torch.float32,
55
+ device=device,
56
+ )
57
+
58
+ def sample_time_beta(bsize: int, device, *, alpha: float, beta: float, scale: float, offset: float) -> Tensor:
59
+ """Beta-distributed flow-matching timesteps: ``Beta(alpha, beta) * scale + offset`` (openpi convention)."""
60
+ time_beta = sample_beta(alpha, beta, bsize, device)
61
+ time = time_beta * scale + offset
62
+ return time.to(dtype=torch.float32, device=device)
63
+
64
+
65
+ # ---- utils/device_utils.py ---------------------------------------------------
66
+ # Used by `create_sinusoidal_pos_embedding`; MPS has no float64, so the period grid falls
67
+ # back to float32 there. Kept so the embedding is bit-identical to upstream's.
68
+
69
+ def get_safe_dtype(dtype: torch.dtype, device: str | torch.device):
70
+ """
71
+ mps is currently not compatible with float64
72
+ """
73
+ if isinstance(device, torch.device):
74
+ device = device.type
75
+ if device == "mps" and dtype == torch.float64:
76
+ return torch.float32
77
+ if device == "xpu" and dtype == torch.float64:
78
+ if hasattr(torch.xpu, "get_device_capability"):
79
+ device_capability = torch.xpu.get_device_capability()
80
+ # NOTE: Some Intel XPU devices do not support double precision (FP64).
81
+ # The `has_fp64` flag is returned by `torch.xpu.get_device_capability()`
82
+ # when available; if False, we fall back to float32 for compatibility.
83
+ if not device_capability.get("has_fp64", False):
84
+ logging.warning(f"Device {device} does not support float64, using float32 instead.")
85
+ return torch.float32
86
+ else:
87
+ logging.warning(
88
+ f"Device {device} capability check failed. Assuming no support for float64, using float32 instead."
89
+ )
90
+ return torch.float32
91
+ return dtype
92
+ else:
93
+ return dtype
94
+
95
+ # ---- vla_utils.py -----------------------------------------------------------
96
+
97
+ def create_sinusoidal_pos_embedding( # see openpi `create_sinusoidal_pos_embedding` (exact copy)
98
+ time: torch.Tensor, dimension: int, min_period: float, max_period: float, device="cpu"
99
+ ) -> Tensor:
100
+ """Computes sine-cosine positional embedding vectors for scalar positions."""
101
+ if dimension % 2 != 0:
102
+ raise ValueError(f"dimension ({dimension}) must be divisible by 2")
103
+
104
+ if time.ndim != 1:
105
+ raise ValueError("The time tensor is expected to be of shape `(batch_size, )`.")
106
+
107
+ dtype = get_safe_dtype(torch.float64, device.type)
108
+ fraction = torch.linspace(0.0, 1.0, dimension // 2, dtype=dtype, device=device)
109
+ period = min_period * (max_period / min_period) ** fraction
110
+
111
+ # Compute the outer product
112
+ scaling_factor = 1.0 / period * 2 * math.pi
113
+ sin_input = scaling_factor[None, :] * time[:, None]
114
+ return torch.cat([torch.sin(sin_input), torch.cos(sin_input)], dim=1)
115
+
116
+ def make_att_2d_masks(pad_masks: Tensor, att_masks: Tensor) -> Tensor: # see openpi (exact copy)
117
+ """Copied from big_vision.
118
+
119
+ Tokens can attend to valid inputs tokens which have a cumulative mask_ar
120
+ smaller or equal to theirs. This way `mask_ar` int[B, N] can be used to
121
+ setup several types of attention, for example:
122
+
123
+ [[1 1 1 1 1 1]]: pure causal attention.
124
+
125
+ [[0 0 0 1 1 1]]: prefix-lm attention. The first 3 tokens can attend between
126
+ themselves and the last 3 tokens have a causal attention. The first
127
+ entry could also be a 1 without changing behaviour.
128
+
129
+ [[1 0 1 0 1 0 0 1 0 0]]: causal attention between 4 blocks. Tokens of a
130
+ block can attend all previous blocks and all tokens on the same block.
131
+
132
+ Args:
133
+ input_mask: bool[B, N] true if its part of the input, false if padding.
134
+ mask_ar: int32[B, N] mask that's 1 where previous tokens cannot depend on
135
+ it and 0 where it shares the same attention mask as the previous token.
136
+ """
137
+ if att_masks.ndim != 2:
138
+ raise ValueError(att_masks.ndim)
139
+ if pad_masks.ndim != 2:
140
+ raise ValueError(pad_masks.ndim)
141
+
142
+ cumsum = torch.cumsum(att_masks, dim=1)
143
+ att_2d_masks = cumsum[:, None, :] <= cumsum[:, :, None]
144
+ pad_2d_masks = pad_masks[:, None, :] * pad_masks[:, :, None]
145
+ return att_2d_masks & pad_2d_masks
146
+
147
+ def pad_vector(vector: Tensor, new_dim: int, *, truncate: bool = False) -> Tensor:
148
+ """Pad the last dimension of a vector to new_dim with zeros.
149
+
150
+ Can be (batch_size x sequence_length x features_dimension)
151
+ or (batch_size x features_dimension)
152
+
153
+ With ``truncate=False`` (openpi behavior), vectors whose last dimension is already
154
+ >= new_dim are returned unchanged. With ``truncate=True`` (xVLA behavior), the last
155
+ dimension is truncated to exactly ``new_dim`` (which may be 0).
156
+ """
157
+ if vector.shape[-1] == new_dim:
158
+ return vector
159
+ if not truncate:
160
+ if vector.shape[-1] >= new_dim:
161
+ return vector
162
+ return F.pad(vector, (0, new_dim - vector.shape[-1]))
163
+ shape = list(vector.shape)
164
+ current_dim = shape[-1]
165
+ shape[-1] = new_dim
166
+ new_vector = vector.new_zeros(*shape)
167
+ length = min(current_dim, new_dim)
168
+ new_vector[..., :length] = vector[..., :length]
169
+ return new_vector
model/tachin_paired30_cache_20260923/code/src/tactile_editor/_baselines/vitra_original/__init__.py ADDED
File without changes