| """Train the NODE-ONLY ablation (isolated wrapper around train_wm_graph.py). |
| |
| Reuses the ENTIRE original training pipeline (arg parsing, dataset, loop, |
| checkpointing, sidecar) unchanged, and only swaps the model class to |
| CtrlWorldGraphNodeOnly via a monkeypatch — so the original code is untouched and |
| the training recipe is identical to the full edge_transformer run. |
| |
| Launch exactly like the original, e.g.: |
| CUDA_VISIBLE_DEVICES=0 python -u scripts/train_nodeonly.py \ |
| --tag ablation_node_only_edge_transformer \ |
| --output-dir model_ckpt/ablation_node_only_edge_transformer \ |
| --tensorboard-log-dir model_ckpt/ablation_node_only_edge_transformer/tensorboard \ |
| --history-corruption --graph-backbone edge_transformer --graph-resampler query \ |
| --max-train-steps 50000 --checkpointing-steps 25000 |
| """ |
| import sys |
| from pathlib import Path |
|
|
| ROOT = Path(__file__).resolve().parents[1] |
| if str(ROOT) not in sys.path: |
| sys.path.insert(0, str(ROOT)) |
|
|
| import scripts.train_wm_graph as T |
| from graphwm.models.ctrl_world_graph_node_only import CtrlWorldGraphNodeOnly |
| from accelerate import Accelerator as _BaseAccelerator |
| from accelerate.utils import DistributedDataParallelKwargs |
|
|
| |
| T.CtrlWorldGraph = CtrlWorldGraphNodeOnly |
|
|
|
|
| def _Accelerator(*args, **kwargs): |
| |
| |
| kwargs.setdefault("kwargs_handlers", [DistributedDataParallelKwargs(find_unused_parameters=True)]) |
| return _BaseAccelerator(*args, **kwargs) |
|
|
|
|
| T.Accelerator = _Accelerator |
|
|
|
|
| if __name__ == "__main__": |
| T.main(T.parse_args()) |
|
|