-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtrain_dp3.py
executable file
·37 lines (31 loc) · 1.02 KB
/
train_dp3.py
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
32
33
34
35
36
37
"""
Usage:
Training:
python train_hdp.py --config-name=train_diffusion_lowdim_workspace
"""
import sys
# use line-buffering for both stdout and stderr
sys.stdout = open(sys.stdout.fileno(), mode='w', buffering=1)
sys.stderr = open(sys.stderr.fileno(), mode='w', buffering=1)
import wandb
import hydra
from omegaconf import OmegaConf
from hydra.core.hydra_config import HydraConfig
import pathlib
from hiera_diffusion_policy.workspace.base_workspace import BaseWorkspace
# allows arbitrary python code execution in configs using the ${eval:''} resolver
OmegaConf.register_new_resolver("eval", eval, replace=True)
@hydra.main(
version_base=None,
config_path=str(pathlib.Path(__file__).parent.joinpath(
'hiera_diffusion_policy','config'))
)
def main(cfg: OmegaConf):
# resolve immediately so all the ${now:} resolvers
# will use the same time.
OmegaConf.resolve(cfg)
cls = hydra.utils.get_class(cfg._target_)
workspace: BaseWorkspace = cls(cfg)
workspace.run()
if __name__ == "__main__":
main()