예제 #1
0
    exit(0)

# Distribute args
args = ArgParser(sys.argv[1:])
vgpus = args.pop_get("--vgpu", default=1, dtype=int)
gpus = args.pop_get("--gpus", default=None)
do_cpu = args.pop_get("--cpu", default=False, dtype=bool)
distribute = create_distribute(vgpus=vgpus, do_cpu=do_cpu, gpus=gpus)

# Core args
problems = args.pop_get("--problem", "conv_train").split(",")
targets = args.pop_get("--directory", "weights").split(",")
repeat = args.pop_get("--repeat", default=10, dtype=int)
debug = args.pop_get("--debug", default=False, dtype=bool)
show_info = args.pop_get("--info", default=False, dtype=bool)
recursive = args.pop_check("--recursive")

# Unpack recursive
if recursive:
    targets = [os.path.join(t, d) for t in targets for d in os.listdir(t)]

# Suffix
suffix = args.pop_get("--suffix", "")
if suffix != "":
    suffix = "_" + suffix
if debug:
    suffix += "_dbg"

# Checkpoint specification
strategy = args.pop_get("--strategy", "repeat")
if strategy == "repeat":
예제 #2
0
import tensorflow as tf
import l2o
from gpu_setup import create_distribute

# Directory
directory = args.pop_get("--directory", default="weights")

# Distribute
vgpus = int(args.pop_get("--vgpu", default=1))
memory_limit = int(args.pop_get("--vram", default=12000))
gpus = args.pop_get("--gpus", default=None)
distribute = create_distribute(
    vgpus=vgpus, memory_limit=memory_limit, gpus=gpus)

# Pick up flags first
initialize_only = args.pop_check("--initialize")

# Default params
strategy = args.pop_get("--strategy", "repeat")
policy = args.pop_get("--policy", "rnnprop")
default = get_default(strategy=strategy, policy=policy)

# Build overrides
presets = args.pop_get("--presets", "")
overrides = []
if presets != "":
    for p in presets.split(','):
        overrides += get_preset(p)
overrides += args.to_overrides()

with distribute.scope():