File size: 1,540 Bytes
0250497
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Construct a fresh action head for joint14, never reuse a LIBERO action head."""
from pathlib import Path
from omegaconf import OmegaConf
from starVLA.model.framework.share_tools import apply_config_compat
from .framework import Qwen_GR00T
from .runtime import install_graph
from work.graphvla_tcp_20261020.geometry import default_recipe
from .training_settings import DEFAULT_CONFIG,load_training_config

def build_model(base_config=None, vlm_path=None, device='cuda'):
    selected=Path(base_config or DEFAULT_CONFIG)
    cfg=apply_config_compat(OmegaConf.load(selected) if selected.name=='train_pilot_legacy.yaml' else load_training_config(selected))
    if vlm_path is not None:cfg.framework.qwenvl.base_vlm=str(vlm_path)
    cfg.framework.action_model.action_dim=14
    cfg.framework.action_model.state_dim=14
    cfg.framework.action_model.action_horizon=16
    cfg.framework.graph=OmegaConf.merge(OmegaConf.create(default_recipe()['graph']),cfg.framework.graph)
    cfg.framework.graph.enabled=False
    cfg.trainer.pretrained_checkpoint=None
    cfg.trainer.is_resume=False
    cfg.trainer.initial_checkpoint_step=0
    cfg.trainer.optimizer.fused=False
    cfg.trainer.optimizer.foreach=False
    cfg.datasets.vla_data.include_state=True
    # run_id and schedule come from the independent real-world configuration.
    model=install_graph(Qwen_GR00T(cfg)).to(device)
    cfg.framework.graph.enabled=True
    model.config.framework.graph.enabled=True
    model.qwen_vl_interface.model.config.use_cache=False
    return model,cfg