Beispiel #1
0
import argparse

from gtd.io import save_stdout
from gtd.log import set_log_level
from gtd.utils import Config
from textmorph.edit_model.training_run import EditTrainingRuns

set_log_level('DEBUG')

arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('exp_id', nargs='+')
arg_parser.add_argument('-c', '--check_commit', default='strict')
arg_parser.add_argument('-p', '--profile', action='store_true')
args = arg_parser.parse_args()

# create experiment
experiments = EditTrainingRuns(
    check_commit=(args.check_commit == 'disable'))  #'strict'  wyl

exp_id = args.exp_id
if exp_id == ['default']:
    # new default experiment
    exp = experiments.new()
elif len(exp_id) == 1 and exp_id[0].isdigit():
    # reload old experiment
    exp = experiments[int(exp_id[0])]
else:
    # new experiment according to configs
    config = Config.from_file(exp_id[0])
    for filename in exp_id[1:]:
        config = Config.merge(config, Config.from_file(filename))
Beispiel #2
0
from phrasenode import data
from phrasenode.eval_run import PhraseNodeEvalRun

# CONFIGS ARE MERGED IN THE FOLLOWING ORDER:
# 1. configs in args.config_paths, from left to right
# 2. config_strings

parser = argparse.ArgumentParser()
parser.add_argument('-p', '--port', type=int, default=6006)
parser.add_argument('-m', '--model-file', default='')
parser.add_argument('-s', '--config-strings', action='append', default=[])
parser.add_argument('config_paths', nargs='+')
args = parser.parse_args()

set_log_level('WARNING')

# create run
config_strings = []
config_paths = args.config_paths
if len(config_paths) == 1 and config_paths[0].isdigit():
    # Get configs from a run
    run_dirname = IntegerDirectories(data.workspace.experiments)[int(
        config_paths[0])]
    with open(join(run_dirname, 'config.txt')) as fin:
        config_strings.append(fin.read())
else:
    # Merge strings to allow object overwites
    run_dirname = None
    for filename in config_paths:
        with open(filename) as fin:
Beispiel #3
0
import argparse
import random

import numpy as np
import tensorflow as tf

from gtd.io import save_stdout
from gtd.log import set_log_level
from gtd.utils import Config
from strongsup.experiment import Experiments
from strongsup.results.tracker import TopLevelTracker
from strongsup.results.entry import ExperimentType

set_log_level('DEBUG')


arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('exp_id', nargs='+')
arg_parser.add_argument('-m', '--mode', default='train', choices=['train', 'eval'])
arg_parser.add_argument('-v', '--eval-visualize', action='store_true',
        help='(eval mode) whether to log things to visualizers (WARNING: big file size!)')
arg_parser.add_argument('-s', '--eval_samples', default=float('inf'), type=float,
        help='(eval mode) number of examples to evaluate on (default: entire dataset)')
arg_parser.add_argument('-c', '--check_commit', default='strict')
arg_parser.add_argument('-t', '--tracker')
arg_parser.add_argument('-r', '--random-seed', default=0, type=int)
args = arg_parser.parse_args()


# set random seeds
seed = args.random_seed