MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / main

Function main

examples/simple_trainer.py:1465–1498  ·  view source on GitHub ↗
(local_rank: int, world_rank, world_size: int, cfg: Config)

Source from the content-addressed store, hash-verified

1463
1464
1465def main(local_rank: int, world_rank, world_size: int, cfg: Config):
1466 if world_size > 1 and not cfg.disable_viewer:
1467 cfg.disable_viewer = True
1468 if world_rank == 0:
1469 print("Viewer is disabled in distributed training.")
1470
1471 runner = Runner(local_rank, world_rank, world_size, cfg)
1472
1473 if cfg.mode == "train":
1474 runner.train()
1475 elif cfg.mode == "compress":
1476 if cfg.ckpt is None:
1477 raise ValueError("ckpt parameter is required for compress mode")
1478 # Load checkpoints
1479 ckpts = [
1480 torch.load(file, map_location=runner.device, weights_only=True)
1481 for file in cfg.ckpt
1482 ]
1483 for k in runner.splats.keys():
1484 runner.splats[k].data = torch.cat([ckpt["splats"][k] for ckpt in ckpts])
1485 step = ckpts[0]["step"]
1486 # save ply
1487 runner.save_params_into_ply_file()
1488 # eval and render traj. of uncompressed splats
1489 # runner.eval(step=step)
1490 # runner.render_traj(step=step)
1491
1492 runner.run_post_training_compression(step=step)
1493 else:
1494 raise ValueError(f"Unknown mode: {cfg.mode}")
1495
1496 if not cfg.disable_viewer:
1497 print("Viewer running... Ctrl+C to exit.")
1498 time.sleep(1000000)
1499
1500
1501if __name__ == "__main__":

Callers

nothing calls this directly

Calls 4

trainMethod · 0.95
RunnerClass · 0.70

Tested by

no test coverage detected