示例#1
0
def parse_args():
    parser = ArgParser(allow_config=True)
    parser.add("--pred_path", type=path, required=True)
    parser.add("--gold_path", type=path, required=True)
    parser.add("--out_path", type=path, required=True)

    args = parser.parse_args()

    return args
示例#2
0
pathfix.init()
# ----------------------------------------------
import sys
# ----------------------------------------------
from scripts.core.base import Paths
from utils.argparser import ArgParser
from utils.duration import Duration
from utils.timer import Timer
from scripts.artifacts.artifacts import ArtifactProcessor
# ----------------------------------------------

parser = ArgParser("runtest.py [<parametes>] [<test set>]  [-- <test arguments>]")
# ----------------------------------------------
parser.add_section('General arguments')
parser.add('-a', '--keep-going', type=True, name='keep_going', docs=[
    'Run all tests, do not stop on the first error.',
    'In PBS mode this arguments is ignored.',
])
parser.add('-v', '--valgrind', type=[True, str], name='valgrind', placeholder='[<VALGRIND ARGS>]', docs=[
    'Run tests under valgrind, with python suppression with optional argument',
    ' <valgrind args> passed to the valgrind. (In PBS mode this arguments is ignored.)?',
])
parser.add('-p', '--parallel', type=int, name='parallel', default=1, placeholder='<N>', docs=[
    'Run at most N jobs in parallel.',
    'In PBS mode this arguments is ignored.',
])
parser.add('', '--batch', type=True, name='batch', docs=[
    'Make output of this script more for an off-line reading',
    'In batch mode, stdout and stderr from executed processes will be printed, not saved'
])
parser.add('', '--include', type=list, subtype=str, name='include', docs=[
    'By default all tags are processed but if --include is set, ',
示例#3
0
def parse_args():
    parser = ArgParser(allow_config=True)
    parser.add("--ckpt_path", type=path, required=True)
    parser.add("--feats_path", type=path, action="append", required=True)
    parser.add("--feats_vocab", type=path, action="append", required=True)
    parser.add("--labels_vocab", type=path, required=True)
    parser.add("--sent_tags", action="store_true", default=False)
    parser.add("--save_dir", type=path, required=True)
    parser.add("--batch_size", type=int, default=32)
    parser.add("--max_length", type=int, default=1e10)
    parser.add("--gpu", action="store_true", default=False)

    group = parser.add_group("Model Parameters")
    group.add("--word_dim", type=int, action="append", required=True)
    group.add("--hidden_dim", type=int, required=True)

    args = parser.parse_args()

    return args
# author:   Jan Hybs
# ----------------------------------------------
from __future__ import absolute_import
import pathfix; pathfix.init()
# ----------------------------------------------
import sys
# ----------------------------------------------
from scripts.core.base import Paths
from utils.argparser import ArgParser
from utils.duration import Duration


parser = ArgParser("exec_with_limit.py [-t <time>] [-m <memory>] -- <executable> <arguments>")
# ----------------------------------------------
parser.add('-t', '--limit-time', type=Duration.parse, name='time_limit', placeholder='<time>', docs=[
    'Obligatory wall clock time limit for execution in seconds or in HH:MM:SS format.',
    'For precision use float value'
])
parser.add('-m', '--limit-memory', type=float, name='memory_limit', placeholder='<memory>', docs=[
    'Optional memory limit per node in MB',
    'For precision use float value'
])
parser.add('', '--batch', type=True, name='batch', docs=[
    'Make output of this script more for an off-line reading',
    'In batch mode, stdout and stderr from executed processes will be printed, not saved'
])
# ----------------------------------------------

if __name__ == '__main__':
    from scripts.exec_with_limit_module import do_work

    # for debug only set dir to where script should be
from __future__ import absolute_import
import pathfix; pathfix.init()
# ----------------------------------------------
import sys
# ----------------------------------------------
from scripts.core.base import Paths, GlobalResult
from utils.argparser import ArgParser
from utils.duration import Duration
# ----------------------------------------------


parser = ArgParser("exec_parallel.py <parameters>  -- <executable> <executable arguments>")
# ----------------------------------------------
parser.add_section('General arguments')
parser.add('-n', '--cpu', type=list, name='cpu', default=[1], placeholder='<cpu>', docs=[
    'Run executable in <cpu> processes',
])
parser.add('-q', '--queue', type=[True, str], name='queue', placeholder='[<queue>]', docs=[
    'Optional PBS queue name to use. If the parameter is not used, ',
    'the application is executed in the same process and without PBS.',
    '',
    'If used without <queue> argument it is executed in the ',
    'background preferably under PBS with the queue selected ',
    'automatically for the given wall clock time limit and number of processes.'
])
parser.add('', '--host', type=str, name='host', placeholder='<host>', docs=[
    'Name of the running host that is used to select system ',
    'specific setup script. Default value of this parameter ',
    'is obtained by first getting the hostname ',
    '(using platform.node() or socket.gethostname()) and then search',
    'it in the table "host_table.json" which assign logical hostname',
示例#6
0
def parse_args():
    parser = ArgParser(allow_config=True)

    parser.add("--name", type=str, default="main")
    parser.add("--feats_path", type=path, action="append", required=True)
    parser.add("--feats_vocab", type=path, action="append", required=True)
    parser.add("--labels_path", type=path, required=True)
    parser.add("--labels_vocab", type=path, required=True)
    parser.add("--save_dir", type=path, required=True)
    parser.add("--gpu", action="store_true", default=False)
    parser.add("--n_previews", type=int, default=10)

    group = parser.add_group("Word Embedding Options")
    group.add("--wordembed_type", type=str, action="append",
              choices=["glove", "fasttext", "none"])
    group.add("--wordembed_path", type=path, action="append")
    group.add("--fasttext_path", type=path, default=None)
    group.add("--wordembed_freeze", type=bool, action="append")

    group = parser.add_group("Training Options")
    group.add("--n_epochs", type=int, default=3)
    group.add("--dropout_prob", type=float, default=0.05)
    group.add("--batch_size", type=int, default=32)
    group.add("--max_len", type=int, default=30)
    group.add("--lr", type=float, default=0.001)

    group = parser.add_group("Save Options")
    group.add("--save", action="store_true", default=False)
    group.add("--save_period", type=int, default=1000)

    group = parser.add_group("Validation Options")
    group.add("--val", action="store_true", default=False)
    group.add("--val_period", type=int, default=100)
    group.add("--text_preview", action="store_true", default=False)
    group.add("--val_feats_path", type=path, action="append")
    group.add("--val_labels_path", type=path, default=None)

    group = parser.add_group("Visdom Options")
    group.add("--visdom_host", type=str, default="localhost")
    group.add("--visdom_port", type=int, default=8097)
    group.add("--visdom_buffer_size", type=int, default=10)

    group = parser.add_group("Model Parameters")
    group.add("--word_dim", type=int, action="append")
    group.add("--hidden_dim", type=int, required=True)

    args = parser.parse_args()

    return args