-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathrun_dmtet.py
32 lines (25 loc) · 1014 Bytes
/
run_dmtet.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
import argparse
import os
import sys
import time
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--text", "-t", type=str, default="an astronaut riding a horse")
parser.add_argument("--gpus", type=int, default=0)
parser.add_argument("--output_dir", "-o", type=str, required=True)
parser.add_argument("--iters", "-i", type=int, default=None)
parser.add_argument("--img_res", "-r", type=int, default=128)
args, extras = parser.parse_known_args()
return args, extras
def main(args, extras):
start_time = time.time()
if args.iters is not None:
cmd = f'bash scripts/dmtet/run_single.sh {args.gpus} "{args.text}" {args.output_dir} trainer.max_steps={args.iters}'
else:
cmd = f'bash scripts/dmtet/run_single.sh {args.gpus} "{args.text}" {args.output_dir} '
print(f"cmd:{cmd}")
os.system(cmd)
print(f"time cost:{time.time() - start_time}")
if __name__ == "__main__":
args, extras = get_args()
main(args, extras)