MCPcopy Create free account
hub / github.com/Physical-Intelligence/openpi / init_wandb

Function init_wandb

scripts/train_pytorch.py:72–91  ·  view source on GitHub ↗

Initialize wandb logging.

(config: _config.TrainConfig, *, resuming: bool, enabled: bool = True)

Source from the content-addressed store, hash-verified

70
71
72def init_wandb(config: _config.TrainConfig, *, resuming: bool, enabled: bool = True):
73 """Initialize wandb logging."""
74 if not enabled:
75 wandb.init(mode="disabled")
76 return
77
78 ckpt_dir = config.checkpoint_dir
79 if not ckpt_dir.exists():
80 raise FileNotFoundError(f"Checkpoint directory {ckpt_dir} does not exist.")
81
82 if resuming:
83 run_id = (ckpt_dir / "wandb_id.txt").read_text().strip()
84 wandb.init(id=run_id, resume="must", project=config.project_name)
85 else:
86 wandb.init(
87 name=config.exp_name,
88 config=dataclasses.asdict(config),
89 project=config.project_name,
90 )
91 (ckpt_dir / "wandb_id.txt").write_text(wandb.run.id)
92
93
94def setup_ddp():

Callers 1

train_loopFunction · 0.70

Calls 1

initMethod · 0.45

Tested by

no test coverage detected