AlexWortega commited on
Commit
11ae309
·
verified ·
1 Parent(s): 23e6b1f

Upload tinyvla2/scripts/expand_checkpoint.py with huggingface_hub

Browse files
tinyvla2/scripts/expand_checkpoint.py CHANGED
@@ -62,6 +62,13 @@ def main():
62
  cfg["max_state_dim"] = new_state
63
  cfg["max_action_dim"] = new_action
64
  cfg["num_embodiments"] = new_emb
 
 
 
 
 
 
 
65
  cfg_path.write_text(json.dumps(cfg, indent=2))
66
  print(f"config: state {old_state}->{new_state} action {old_action}->{new_action} "
67
  f"embodiments {old_emb}->{new_emb}")
 
62
  cfg["max_state_dim"] = new_state
63
  cfg["max_action_dim"] = new_action
64
  cfg["num_embodiments"] = new_emb
65
+ # input/output_features carry their own copy of the dims. Leaving them stale
66
+ # makes the checkpoint load with a 32-wide expert but an 8-wide declared
67
+ # action, so anything reading the feature spec silently truncates.
68
+ if "action" in cfg.get("output_features", {}):
69
+ cfg["output_features"]["action"]["shape"] = [new_action]
70
+ if "observation.state" in cfg.get("input_features", {}):
71
+ cfg["input_features"]["observation.state"]["shape"] = [new_state]
72
  cfg_path.write_text(json.dumps(cfg, indent=2))
73
  print(f"config: state {old_state}->{new_state} action {old_action}->{new_action} "
74
  f"embodiments {old_emb}->{new_emb}")